Skip to content

Commit afaace6

Browse files
eddeee888ikusakov2ikusakovgithub-actions[bot]ikusakov
authored
[typescript-operations/client-preset] Next major version (dotansimha#10496)
* Add dummy commit to create branch * Ensure CI runs * [typescript-operations] Generate `Exact` into target file (dotansimha#10504) * Create standalone test * Add Exact and set up test * Remove Exact from typescript plugin * Update tests that switch out Exact * Update dev tests * Add changeset * Update test * Add InputMaybe Scalars tests * Fix schema in test * Fix up examples tests * Add result enum example * [typescript-operations] Remove inputmaybe and scalars (dotansimha#10509) * [typescript-operations] Remove generation of InputMaybe and Scalars for variables * Adding support for `config.scalars`, fixing intergation tests --------- Co-authored-by: Igor Kusakov <[email protected]> * chore(dependencies): updated changesets for modified dependencies * [typescript-operations] Extract convertSchemaEnumToDeclarationBlockString and getNodeComment to `visitor-plugin-common` (dotansimha#10520) * Extract convertSchemaEnumToDeclarationBlockString and getNodeComment to visitor-plugin-common to re-use in next major version * Create major breaking changeset for @graphql-codegen/visitor-plugin-common * Fix naming * Replace buildEnumValuesBlock method in base-types-visitor with a utility version * Fix changeset * Fix import path * Fix getNodeComment import issue by moving to utils.ts * [typescript-operations] Generate enums referenced in operation Variables (dotansimha#10508) * Collect used enums * Use enum converter for Enum * Add changeset * Add doc * Update dev tests * Fix return type issue * [typescript-operations] Add missing enum tests & fix enum generating logic for standalone approach (dotansimha#10525) * Add tests for enum * Baselin tests * Ensure correctness of enumValues import * Split enum tests * Abstract import printing functions * Add missing enum tests * Format to minimise conflict * Add changeset * Add generatesOperationTypes config option to generate shared types only (dotansimha#10529) * [typescript-operations] Add importSchemaTypesFrom to import user-defined+used input/enum types externally (dotansimha#10534) * Draft importSchemaTypesFrom * Minor test fixes * Fix test name * Update dev-tests * Baseline dev-test for importSchemaTypesFrom * Implement relative import paths correctly * Update tests to handle outputDir correctly * Add test for absolute importSchemaTypesFrom * Remove unncessary files * Add test about unused things * Remove comment * Add comments * Add changeset * [typescript-operations][client-preset] Integrate new typescript-operations with client preset (dotansimha#10540) * Do not use typescript and its config in Client Preset * Fix issue where enumValues are imported even if not used * Split enum tests for client preset * Update unit tests * Update examples * Generate Incremental utilty type * Add changeset * Rebase tests (with errors) * [typescript-operations] No optional Result fields, unless deferred or conditional (dotansimha#10548) * Fix types issues and put comments * Handle avoidOptionals * Update integration tests * Add FIXME to pass test for now * Add changeset * Generate input types and output enums into target file (dotansimha#10527) * input types, input/output enums are generated to the target files * cleanup * better code * more tests * cleanup * better code * better tests * bugfixing for inner types and outer enums * bugfixing after merge * cleanup * cleanup * fix snapshots * fix type errors in presets/client * updated tests/examples * Add standalone.input.spec.ts and update standalone tests to TDD * Update operations/visitor.ts to satisfy tests * Revert Client Preset changes * Add oneOf directive for GraphQL 15 * Update changeset * Refactor IIFE --------- Co-authored-by: Igor Kusakov <[email protected]> Co-authored-by: Eddy Nguyen <[email protected]> * Remove placeholder and test release 🤞 * Test snapshot release * [typescript-operations] Fix __typename optionality and nullability (dotansimha#10552) * Fix typename optionality and existence at Result root and types * Update tests * Update tests * Stop allowing skipTypename into Client Preset and typescript-operations, and update tests * Remove dependency on typescript plugin * Add changeset * [typescript-operations] Clean up selection set processor that depends on `typescript` plugin (`preResolveTypes: false`) (dotansimha#10556) * Remove legacy selection set proccessor that depends on typescript plugin * Remove obsolete tests * Improve tests to be explicit * Adjust config inheritance to reflect usage and type-hint better (dotansimha#10560) * Refactor utility function to match practice * Fix config option inheritance - addTypename/skipTypename: is only a types-visitor concern. This is moved to types-visitor from base-visitor - nonOptionalTypename: is a documents-visitor and types-visitor concern. Moved from base-visitor there - extractAllFieldsToTypes: is a documents-visitor concern. Moved from base-visitor there - enumPrefix and enumSuffix: need to be in base-visitor as all 3 types of visitors need this to correctly sync the enum type names. This is moved to base visitor - ignoreEnumValuesFromSchema: is a documents-visitor and types-visitor concern. Moved from base-visitor there. - globalNamespace: is a documents-visitor concern. Moved from base-visitor there Other changes: - documents-visitor no longer extends types-visitor _option types_ as they have two distinct usages now. The types now extend base-visitor types. This is now consistent with documents-visitor extending base-visitor - Classes now handle config parsing and types at the same level e.g. if typescript-operations plugin parses configOne, then the types for configOne must be in that class, rather than in base-documents-visitor * Remove references and tests related to skipTypename in operations plugin * Add changeset * chore(dependencies): updated changesets for modified dependencies * Fix issues after rebasing (dotansimha#10563) * Fix missing dep * chore(dependencies): updated changesets for modified dependencies * Fix dev-tests --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * chore(dependencies): updated changesets for modified dependencies * Remove unused utility types and functions (dotansimha#10564) * Remove MakeOptional MakeMaybe MakeEmpty and Incremental utitlity types from typescript plugin because they were used for typescript-operations * Fix unit tests * Remove deprecated functions * Add changeset * Add config extract all fields to types field names only (same as apollo-tooling), v2 (dotansimha#10568) * add extractAllFieldsToTypesCompact config option * adding changeset * fixing duplication bug * duplication bug fix --------- Co-authored-by: Igor Kusakov <[email protected]> * Only generate `Exact` utility type if documents have operations (dotansimha#10571) * Remove extraneous test setup * Do not generate Exact utility type of not used * Add default test case to check that Exact is used for Mutation and Subscription variables * Update dev-tests * Add changeset * Remove extraneous config for Exact test * Make `unknown` instead of `any` the default scalar type (dotansimha#10566) * Make default scalar unknown, instead of any * Set up defaultScalarType tests * Add changeset * Revert unrelated null | undefined changes * Fix test description * Add a test case for custom scalar in dev-test * Decouple `typescript-operations` plugin from `typescript` plugin (dotansimha#10572) * Decouple TypeScriptOperationVariablesToObject from typescript plugin * Add changeset * Remove typescript plugin dep * chore(dependencies): updated changesets for modified dependencies --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * chore(dependencies): updated changesets for modified dependencies * Add `inputMaybeValue` to allow changing Variables and Input nullable types (dotansimha#10573) * Shuffle methods to group things together, cleanup * Wire up _inputMaybeValue and organise config * Wire up inputMaybeValue * Add inputMaybeValue test * Update tests * Add changeset * [typescript-operations] Handle printing "Maybe" types consistently when types are `any` and `unknown` (dotansimha#10574) * Use printTypeScriptType to handle printing typescript types consistently, especially for any and unknown * Update tests * Add changeset * Make printTypeScriptMaybeType scope smaller * Update tests * [typescript-operations] Fix Input generation when using `importSchemaTypesFrom` (dotansimha#10575) * Fix importing issue when using importSchemaTypesFrom * Add dev-tests for usage with typescript plugin * Update unit test * Add changeset * Bugfix: enums from external fragments were not generated along with operations (dotansimha#10565) * integration test * cleanups * cleanups2 * fixed a bug with external fragments * cleanup * keep generated files, refactored visitorwq * cleanup * changeset * adding missing dependency * delete temporary files * cleanup * cleanups * Adding back the integration tests + fix them * merged + fixes * cleanup * cleanup * patching near-operation-file preset * cleanup * adding duplicates case to integration tests * Fixing bug with duplicates generated when using extractAllFieldsToTypesCompact * cleanup * prevent running prettier on generated code * cleanups * cleanup * adding unit tests * update changeset * cleanups * try resolving graphql 16 error * remove unused deps * remove unused deps * cleanups * Revert and apply minimal yarn.lock changes --------- Co-authored-by: ikusakov <[email protected]> Co-authored-by: Igor Kusakov <[email protected]> Co-authored-by: Eddy Nguyen <[email protected]> Co-authored-by: Eddy Nguyen <[email protected]> * Various test, FIXMEs, config fixes (dotansimha#10577) * Enable TS test * Add missing test for globalNamespace * Ensure dev-test-apollo-tooling is private * [typescript-operations] Cut down `avoidOptionals` to only support `object`, `inputValue` and `defaultValue` (+ minor drive-by fixes) (dotansimha#10579) * Trim down avoidOptionals for client use case * Add changeset * Correctly ignore dev-test from changeset * [typescript-operations] Rename `avoidOptionals.object` to `avoidOptionals.variableValue` to better reflect the target (dotansimha#10582) * Rename avoidOptionals.object -> avoidOptionals.variableValue to better reflect the target. Add tests. * Add default input use cases * [typescript-operations] Fix external custom scalars not getting imported (dotansimha#10584) * Rename scalar test * Refactor to move position of getEnumsImports to group methods * Implement handling of external scalars * Add (wrong) import scalar tests to work against * Fix importing types wrongly count Scalar as part of types generated into shared type file * Do not generate scalar imports if not needed * Add changeset * Cleanup * Fix granularity of operation-file * Improve comments, remove unused prop (dotansimha#10589) Co-authored-by: Igor Kusakov <[email protected]> * Remove support for directiveArgumentAndInputFieldMappings (dotansimha#10596) * [CLI] Set `noSilentErrors: true` by default (dotansimha#10597) * Set noSilentErrors: true by default * Add changeset * Format tests * Change generatesOperationTypes to generateOperationTypes for consistency (dotansimha#10602) * [typescript-operations] Set `namespacedImportName` default value when `importSchemaTypesFrom` is used (dotansimha#10603) * Improve namespacedImportName integration with importSchemaTypesFrom * Update dev-test * Update changeset * [typescript-operations] Change default input ID scalar type (dotansimha#10604) * Ensure input and variables use the same input scalars default * Add changeset * chore(dependencies): updated changesets for modified dependencies * Fix lint issue * Fix unit tests (dotansimha#10606) * [client-preset] Update client preset doc and clean up deps (dotansimha#10608) * Remove typescript plugin from client-preset as no longer used * Update client-preset doc * Add changeset * chore(dependencies): updated changesets for modified dependencies --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * chore(dependencies): updated changesets for modified dependencies * [client-preset] Fix docs for upcoming major release (dotansimha#10609) * Fix enumValues doc issue * fix link issues in client preset doc * Move nonOptionalTypename and skipTypeNameForRoot together in the doc for ease of read * chore(dependencies): updated changesets for modified dependencies * Bring in latest near-operation-file preset (dotansimha#10621) * Master next fix native ast detection (dotansimha#10637) * Fix isNativeNamedType function * Add changeset * Regen dev-tests * Rename function from collectUsedInputTypes to collectUsedSchemaTypesToGenerate to correctly reflect its functionality (dotansimha#10640) * [typescript-operations] Add warning for internal utility types (dotansimha#10643) * Add internal utility type warning * Update snapshots * Add changeset * Improve internal type message * [typescript-operations] Fix `@skip` and `@include` not applying conditional modifiers correctly when used on inline fragment (dotansimha#10645) * Migrate skip and include directive tests to a new file * Add test for aliased field * Add test for include directive, inline fragment cases * Refactor selection set to object to reflect current usages * Standardise type, parsing, fragment directive handling and fix conditional when inline fragment is used * Add inline fragment skip directive test * Add changeset * [typescript-operations] Fix @Skip and @include not applying conditional modifiers correctly when used on fragment spread (dotansimha#10646) * Set up TDD * WIP implement conditional fragmentspread * Fix empty object detection logic * Format/cleanup * Add test for include+skip+defer * Add changeset * Fix test * Add test case (dotansimha#10647) * [Major version release] Drop Node 20 tests for normal runs (dotansimha#10648) * Drop Node 20 tests for normal runs * Add changeset * Drop Node 20 support for watcher tests * Revert "Drop Node 20 support for watcher tests" This reverts commit cc52a81. * Update package deps (dotansimha#10650) * Bump ESM packages - detect-indent v7 - auto-bind v5 - chalk v5 - log-symbols v7 - debounce v3 * Bum all package deps to latest * chore(dependencies): updated changesets for modified dependencies * Revert @inquirer/prompts to v7 to be handled later * chore(dependencies): updated changesets for modified dependencies --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * chore(dependencies): updated changesets for modified dependencies * Bump inquirer and improve related tests (dotansimha#10651) * Bump inquirer * chore(dependencies): updated changesets for modified dependencies * WIP fix test * Swap bddstd for inquirer/testing * Fix spec tsconfig to fix ts import issue in tests ESM * Fix unnecessary Promise * Update init tests to use @inquirer/testing --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * chore(dependencies): updated changesets for modified dependencies * Add ESM changeset * [client-preset] Make persisted docs default hashing algorithm sha256, and follow recommended format (dotansimha#10652) * Update default hash to be sha256 for persisted documents * Add changeset * chore(dependencies): updated changesets for modified dependencies * Update tests * chore(dependencies): updated changesets for modified dependencies --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * [typescript-operations] Add `declarationKind` support (dotansimha#10654) * typescript-operations: Add support for declarationKind option * Drive-by: add fixme * Add changeset * [typesceript-operations] Refactor operations avoidOptionals and declarationKind config (dotansimha#10655) * move normalizeAvoidOptionals to visitor-plugin-common * Make normalizeOperationDeclarationKind similar to normalizeOperationAvoidOptionals * Fix issue where extractAllFieldsToTypes always causes console to warn * Fix compilation issues * [typescript-operations] Fix enumValues not considering namingConvention in certain scenarios (dotansimha#10656) * Set up test * Refactor naming functions to visitor-plugin-common/naming * Parse EnumValues with applying namingConvention on the schema type and use it for imports * Ensure converted enum type is used across imports, exports and Result * Fix enum-values.spec tests * Update implementation to match expected * Update enumValues tests * Ensure correct naming convention being applied to Input, Variables and Result types * Create a section for enumValues * add changeset * [typescript][typescript-resolvers] Fix enumValues not considering namingConvention in certain scenarios (2) (dotansimha#10657) * Ensure enumValues is consistent in typescript and typescript-resolvers * Add a note to default alias import not doing anything * Add changeset * chore(dependencies): updated changesets for modified dependencies * Cleanup after rebase * feat(cli): use `ESM` by default (dotansimha#10705) * feat(cli): use `ESM` by default * Update graphql-codegen-esm to use esm/bin.js * Remove master-next CI config --------- Co-authored-by: Igor Kusakov <[email protected]> Co-authored-by: Igor Kusakov <[email protected]> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: ikusakov <[email protected]> Co-authored-by: Arda TANRIKULU <[email protected]>
1 parent b4a3614 commit afaace6

229 files changed

Lines changed: 16536 additions & 28294 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 12 additions & 0 deletions
Lines changed: 11 additions & 0 deletions
Lines changed: 5 additions & 0 deletions
Lines changed: 5 additions & 0 deletions
Lines changed: 5 additions & 0 deletions
Lines changed: 5 additions & 0 deletions
Lines changed: 5 additions & 0 deletions
Lines changed: 5 additions & 0 deletions
Lines changed: 5 additions & 0 deletions
Lines changed: 5 additions & 0 deletions

0 commit comments

Comments
 (0)