diff --git a/.changeset/@graphql-codegen_cli-8865-dependencies.md b/.changeset/@graphql-codegen_cli-8865-dependencies.md deleted file mode 100644 index 1dd94800e16..00000000000 --- a/.changeset/@graphql-codegen_cli-8865-dependencies.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -"@graphql-codegen/cli": patch ---- -dependencies updates: - - Updated dependency [`@graphql-codegen/core@^2.6.8` ↗︎](https://www.npmjs.com/package/@graphql-codegen/core/v/2.6.8) (from `2.6.8`, in `dependencies`) - - Updated dependency [`@graphql-tools/load@^7.8.0` ↗︎](https://www.npmjs.com/package/@graphql-tools/load/v/7.8.0) (from `7.8.0`, in `dependencies`) - - Updated dependency [`cosmiconfig-typescript-loader@^4.3.0` ↗︎](https://www.npmjs.com/package/cosmiconfig-typescript-loader/v/4.3.0) (from `4.3.0`, in `dependencies`) - - Updated dependency [`graphql-config@^4.4.0` ↗︎](https://www.npmjs.com/package/graphql-config/v/4.4.0) (from `4.4.0`, in `dependencies`) - - Added dependency [`ts-node@^10.9.1` ↗︎](https://www.npmjs.com/package/ts-node/v/10.9.1) (to `dependencies`) - - Removed dependency [`ts-node@>=10` ↗︎](https://www.npmjs.com/package/ts-node/v/10.0.0) (from `peerDependencies`) diff --git a/.changeset/@graphql-codegen_client-preset-8757-dependencies.md b/.changeset/@graphql-codegen_client-preset-8757-dependencies.md deleted file mode 100644 index 869028f0cd1..00000000000 --- a/.changeset/@graphql-codegen_client-preset-8757-dependencies.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@graphql-codegen/client-preset": patch ---- -dependencies updates: - - Added dependency [`@graphql-tools/documents@^0.1.0` ↗︎](https://www.npmjs.com/package/@graphql-tools/documents/v/0.1.0) (to `dependencies`) diff --git a/.changeset/big-mice-switch.md b/.changeset/big-mice-switch.md deleted file mode 100644 index f9b10720567..00000000000 --- a/.changeset/big-mice-switch.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@graphql-codegen/cli': patch ---- - -fix: `gqlMagicComment` type diff --git a/.changeset/lemon-zebras-hunt.md b/.changeset/lemon-zebras-hunt.md deleted file mode 100644 index 2b7a0d8c27e..00000000000 --- a/.changeset/lemon-zebras-hunt.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -'@graphql-codegen/client-preset': minor ---- - -Add support for persisted documents. - -You can now generate and embed a persisted documents hash for the executable documents. - -```ts -/** codegen.ts */ -import { CodegenConfig } from '@graphql-codegen/cli' - -const config: CodegenConfig = { - schema: 'https://swapi-graphql.netlify.app/.netlify/functions/index', - documents: ['src/**/*.tsx'], - ignoreNoDocuments: true, // for better experience with the watcher - generates: { - './src/gql/': { - preset: 'client', - plugins: [], - presetConfig: { - persistedDocuments: true, - } - } - } -} - -export default config -``` - -This will generate `./src/gql/persisted-documents.json` (dictionary of hashes with their operation string). - -In addition to that each generated document node will have a `__meta__.hash` property. - -```ts -import { gql } from './gql.js' - -const allFilmsWithVariablesQueryDocument = graphql(/* GraphQL */ ` - query allFilmsWithVariablesQuery($first: Int!) { - allFilms(first: $first) { - edges { - node { - ...FilmItem - } - } - } - } -`) - -console.log((allFilmsWithVariablesQueryDocument as any)["__meta__"]["hash"]) -``` - diff --git a/.changeset/many-llamas-teach.md b/.changeset/many-llamas-teach.md deleted file mode 100644 index 2c5a489adf2..00000000000 --- a/.changeset/many-llamas-teach.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@graphql-codegen/cli': patch ---- - -move ts-node from peer dependencies to dependencies diff --git a/.changeset/tasty-adults-doubt.md b/.changeset/tasty-adults-doubt.md deleted file mode 100644 index c98cf9cce4c..00000000000 --- a/.changeset/tasty-adults-doubt.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -'@graphql-codegen/client-preset': minor ---- - -Add support for embedding metadata in the document AST. - -It is now possible to embed metadata (e.g. for your GraphQL client within the emitted code). - -```ts -/** codegen.ts */ -import { CodegenConfig } from '@graphql-codegen/cli' - -const config: CodegenConfig = { - schema: 'https://swapi-graphql.netlify.app/.netlify/functions/index', - documents: ['src/**/*.tsx'], - ignoreNoDocuments: true, // for better experience with the watcher - generates: { - './src/gql/': { - preset: 'client', - plugins: [], - presetConfig: { - onExecutableDocumentNode(documentNode) { - return { - operation: documentNode.definitions[0].operation, - name: documentNode.definitions[0].name.value - } - } - } - } - } -} - -export default config -``` - -You can then access the metadata via the `__meta__` property on the document node. - -```ts -import { gql } from './gql.js' - -const allFilmsWithVariablesQueryDocument = graphql(/* GraphQL */ ` - query allFilmsWithVariablesQuery($first: Int!) { - allFilms(first: $first) { - edges { - node { - ...FilmItem - } - } - } - } -`) - -console.log((allFilmsWithVariablesQueryDocument as any)["__meta__"]) -``` diff --git a/.changeset/unlucky-suits-pay.md b/.changeset/unlucky-suits-pay.md deleted file mode 100644 index 7ce21d89c29..00000000000 --- a/.changeset/unlucky-suits-pay.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@graphql-codegen/visitor-plugin-common': patch ---- - -Fix issue where visitor-plugin-common emitted ESM imports for Operations when emitLegacyCommonJSImports is true diff --git a/examples/typescript-esm/package.json b/examples/typescript-esm/package.json index 1d99f365589..45719b60c77 100644 --- a/examples/typescript-esm/package.json +++ b/examples/typescript-esm/package.json @@ -3,8 +3,8 @@ "version": "0.0.0", "private": true, "devDependencies": { - "@graphql-codegen/cli": "2.16.4", - "@graphql-codegen/client-preset": "1.0.2" + "@graphql-codegen/cli": "2.16.5", + "@graphql-codegen/client-preset": "1.3.0" }, "dependencies": { "@graphql-typed-document-node/core": "3.1.1", diff --git a/examples/typescript-graphql-request/package.json b/examples/typescript-graphql-request/package.json index c8eaafc9b91..66d517380c0 100644 --- a/examples/typescript-graphql-request/package.json +++ b/examples/typescript-graphql-request/package.json @@ -3,7 +3,7 @@ "version": "0.0.0", "private": true, "devDependencies": { - "@graphql-codegen/cli": "2.16.4", + "@graphql-codegen/cli": "2.16.5", "@graphql-codegen/gql-tag-operations-preset": "1.7.4" }, "dependencies": { diff --git a/examples/typescript-resolvers/package.json b/examples/typescript-resolvers/package.json index 01017daaa44..1855f97837d 100644 --- a/examples/typescript-resolvers/package.json +++ b/examples/typescript-resolvers/package.json @@ -3,9 +3,9 @@ "version": "0.0.0", "private": true, "devDependencies": { - "@graphql-codegen/cli": "2.16.4", - "@graphql-codegen/typescript": "2.8.7", - "@graphql-codegen/typescript-resolvers": "2.7.12" + "@graphql-codegen/cli": "2.16.5", + "@graphql-codegen/typescript": "2.8.8", + "@graphql-codegen/typescript-resolvers": "2.7.13" }, "dependencies": { "graphql": "16.6.0", diff --git a/packages/graphql-cli-codegen-plugin/CHANGELOG.md b/packages/graphql-cli-codegen-plugin/CHANGELOG.md index 0519f8d69a6..03e9dbf4b01 100644 --- a/packages/graphql-cli-codegen-plugin/CHANGELOG.md +++ b/packages/graphql-cli-codegen-plugin/CHANGELOG.md @@ -1,5 +1,12 @@ # @graphql-cli/codegen +## 2.4.25 + +### Patch Changes + +- Updated dependencies [[`e4d073b16`](https://github.com/dotansimha/graphql-code-generator/commit/e4d073b16f904e0879a3d15774ddc9826b0ab5e5), [`884d25c4e`](https://github.com/dotansimha/graphql-code-generator/commit/884d25c4edb099a46bffb23ffd935abec7d14f80), [`e4d073b16`](https://github.com/dotansimha/graphql-code-generator/commit/e4d073b16f904e0879a3d15774ddc9826b0ab5e5)]: + - @graphql-codegen/cli@2.16.5 + ## 2.4.24 ### Patch Changes diff --git a/packages/graphql-cli-codegen-plugin/package.json b/packages/graphql-cli-codegen-plugin/package.json index 3840379dd99..643daed5890 100644 --- a/packages/graphql-cli-codegen-plugin/package.json +++ b/packages/graphql-cli-codegen-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@graphql-cli/codegen", - "version": "2.4.24", + "version": "2.4.25", "description": "GraphQL Code Generator's GraphQL CLI plugin. GraphQL Code Generator is a tool that generates code from your GraphQL schema and documents for your backend or frontend with flexible support for custom plugins and templates.", "license": "MIT", "keywords": [ @@ -25,7 +25,7 @@ "graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0" }, "dependencies": { - "@graphql-codegen/cli": "2.16.4", + "@graphql-codegen/cli": "2.16.5", "@graphql-cli/common": "4.1.0" }, "main": "dist/cjs/index.js", diff --git a/packages/graphql-codegen-cli/CHANGELOG.md b/packages/graphql-codegen-cli/CHANGELOG.md index e32c70dd63f..e791711a7bd 100644 --- a/packages/graphql-codegen-cli/CHANGELOG.md +++ b/packages/graphql-codegen-cli/CHANGELOG.md @@ -1,5 +1,22 @@ # @graphql-codegen/cli +## 2.16.5 + +### Patch Changes + +- [#8865](https://github.com/dotansimha/graphql-code-generator/pull/8865) [`e4d073b16`](https://github.com/dotansimha/graphql-code-generator/commit/e4d073b16f904e0879a3d15774ddc9826b0ab5e5) Thanks [@n1ru4l](https://github.com/n1ru4l)! - dependencies updates: + + - Updated dependency [`@graphql-codegen/core@^2.6.8` ↗︎](https://www.npmjs.com/package/@graphql-codegen/core/v/2.6.8) (from `2.6.8`, in `dependencies`) + - Updated dependency [`@graphql-tools/load@^7.8.0` ↗︎](https://www.npmjs.com/package/@graphql-tools/load/v/7.8.0) (from `7.8.0`, in `dependencies`) + - Updated dependency [`cosmiconfig-typescript-loader@^4.3.0` ↗︎](https://www.npmjs.com/package/cosmiconfig-typescript-loader/v/4.3.0) (from `4.3.0`, in `dependencies`) + - Updated dependency [`graphql-config@^4.4.0` ↗︎](https://www.npmjs.com/package/graphql-config/v/4.4.0) (from `4.4.0`, in `dependencies`) + - Added dependency [`ts-node@^10.9.1` ↗︎](https://www.npmjs.com/package/ts-node/v/10.9.1) (to `dependencies`) + - Removed dependency [`ts-node@>=10` ↗︎](https://www.npmjs.com/package/ts-node/v/10.0.0) (from `peerDependencies`) + +- [#8808](https://github.com/dotansimha/graphql-code-generator/pull/8808) [`884d25c4e`](https://github.com/dotansimha/graphql-code-generator/commit/884d25c4edb099a46bffb23ffd935abec7d14f80) Thanks [@rwu823](https://github.com/rwu823)! - fix: `gqlMagicComment` type + +- [#8865](https://github.com/dotansimha/graphql-code-generator/pull/8865) [`e4d073b16`](https://github.com/dotansimha/graphql-code-generator/commit/e4d073b16f904e0879a3d15774ddc9826b0ab5e5) Thanks [@n1ru4l](https://github.com/n1ru4l)! - move ts-node from peer dependencies to dependencies + ## 2.16.4 ### Patch Changes diff --git a/packages/graphql-codegen-cli/package.json b/packages/graphql-codegen-cli/package.json index aa722247b8c..1ba147517f0 100644 --- a/packages/graphql-codegen-cli/package.json +++ b/packages/graphql-codegen-cli/package.json @@ -1,6 +1,6 @@ { "name": "@graphql-codegen/cli", - "version": "2.16.4", + "version": "2.16.5", "license": "MIT", "bin": { "gql-gen": "dist/cjs/bin.js", diff --git a/packages/plugins/other/visitor-plugin-common/CHANGELOG.md b/packages/plugins/other/visitor-plugin-common/CHANGELOG.md index 760c966106d..bb82c0e1a7f 100644 --- a/packages/plugins/other/visitor-plugin-common/CHANGELOG.md +++ b/packages/plugins/other/visitor-plugin-common/CHANGELOG.md @@ -1,5 +1,11 @@ # @graphql-codegen/visitor-plugin-common +## 2.13.8 + +### Patch Changes + +- [#8816](https://github.com/dotansimha/graphql-code-generator/pull/8816) [`a98198524`](https://github.com/dotansimha/graphql-code-generator/commit/a9819852443884b43de7c15040ccffc205f9177a) Thanks [@charle692](https://github.com/charle692)! - Fix issue where visitor-plugin-common emitted ESM imports for Operations when emitLegacyCommonJSImports is true + ## 2.13.7 ### Patch Changes diff --git a/packages/plugins/other/visitor-plugin-common/package.json b/packages/plugins/other/visitor-plugin-common/package.json index e87a4c22f17..c8e95fcea00 100644 --- a/packages/plugins/other/visitor-plugin-common/package.json +++ b/packages/plugins/other/visitor-plugin-common/package.json @@ -1,6 +1,6 @@ { "name": "@graphql-codegen/visitor-plugin-common", - "version": "2.13.7", + "version": "2.13.8", "license": "MIT", "repository": { "type": "git", diff --git a/packages/plugins/typescript/document-nodes/CHANGELOG.md b/packages/plugins/typescript/document-nodes/CHANGELOG.md index 468c0ab46b7..3c1844042e3 100644 --- a/packages/plugins/typescript/document-nodes/CHANGELOG.md +++ b/packages/plugins/typescript/document-nodes/CHANGELOG.md @@ -1,5 +1,12 @@ # @graphql-codegen/typescript-document-nodes +## 2.3.13 + +### Patch Changes + +- Updated dependencies [[`a98198524`](https://github.com/dotansimha/graphql-code-generator/commit/a9819852443884b43de7c15040ccffc205f9177a)]: + - @graphql-codegen/visitor-plugin-common@2.13.8 + ## 2.3.12 ### Patch Changes diff --git a/packages/plugins/typescript/document-nodes/package.json b/packages/plugins/typescript/document-nodes/package.json index e07694bc066..7bc04d88be2 100644 --- a/packages/plugins/typescript/document-nodes/package.json +++ b/packages/plugins/typescript/document-nodes/package.json @@ -1,6 +1,6 @@ { "name": "@graphql-codegen/typescript-document-nodes", - "version": "2.3.12", + "version": "2.3.13", "description": "GraphQL Code Generator plugin for generating TypeScript modules with embedded GraphQL document nodes", "repository": { "type": "git", @@ -14,7 +14,7 @@ }, "dependencies": { "@graphql-codegen/plugin-helpers": "^3.1.2", - "@graphql-codegen/visitor-plugin-common": "2.13.7", + "@graphql-codegen/visitor-plugin-common": "2.13.8", "auto-bind": "~4.0.0", "tslib": "~2.4.0" }, diff --git a/packages/plugins/typescript/gql-tag-operations/CHANGELOG.md b/packages/plugins/typescript/gql-tag-operations/CHANGELOG.md index 077158746df..beaed23ec36 100644 --- a/packages/plugins/typescript/gql-tag-operations/CHANGELOG.md +++ b/packages/plugins/typescript/gql-tag-operations/CHANGELOG.md @@ -1,5 +1,12 @@ # @graphql-codegen/gql-tag-operations +## 1.6.2 + +### Patch Changes + +- Updated dependencies [[`a98198524`](https://github.com/dotansimha/graphql-code-generator/commit/a9819852443884b43de7c15040ccffc205f9177a)]: + - @graphql-codegen/visitor-plugin-common@2.13.8 + ## 1.6.1 ### Patch Changes diff --git a/packages/plugins/typescript/gql-tag-operations/package.json b/packages/plugins/typescript/gql-tag-operations/package.json index 4b1aa704f67..3c684e1e0fe 100644 --- a/packages/plugins/typescript/gql-tag-operations/package.json +++ b/packages/plugins/typescript/gql-tag-operations/package.json @@ -1,6 +1,6 @@ { "name": "@graphql-codegen/gql-tag-operations", - "version": "1.6.1", + "version": "1.6.2", "description": "GraphQL Code Generator plugin for generating a typed gql tag function", "repository": { "type": "git", @@ -18,7 +18,7 @@ "dependencies": { "@graphql-tools/utils": "^9.0.0", "@graphql-codegen/plugin-helpers": "^3.1.2", - "@graphql-codegen/visitor-plugin-common": "2.13.7", + "@graphql-codegen/visitor-plugin-common": "2.13.8", "auto-bind": "~4.0.0", "tslib": "~2.4.0" }, diff --git a/packages/plugins/typescript/operations/CHANGELOG.md b/packages/plugins/typescript/operations/CHANGELOG.md index 366b0697b50..34e2d0b1744 100644 --- a/packages/plugins/typescript/operations/CHANGELOG.md +++ b/packages/plugins/typescript/operations/CHANGELOG.md @@ -1,5 +1,13 @@ # @graphql-codegen/typescript-operations +## 2.5.13 + +### Patch Changes + +- Updated dependencies [[`a98198524`](https://github.com/dotansimha/graphql-code-generator/commit/a9819852443884b43de7c15040ccffc205f9177a)]: + - @graphql-codegen/visitor-plugin-common@2.13.8 + - @graphql-codegen/typescript@2.8.8 + ## 2.5.12 ### Patch Changes diff --git a/packages/plugins/typescript/operations/package.json b/packages/plugins/typescript/operations/package.json index 0496dd5e015..ef7aa3b3cad 100644 --- a/packages/plugins/typescript/operations/package.json +++ b/packages/plugins/typescript/operations/package.json @@ -1,6 +1,6 @@ { "name": "@graphql-codegen/typescript-operations", - "version": "2.5.12", + "version": "2.5.13", "description": "GraphQL Code Generator plugin for generating TypeScript types for GraphQL queries, mutations, subscriptions and fragments", "repository": { "type": "git", @@ -14,8 +14,8 @@ }, "dependencies": { "@graphql-codegen/plugin-helpers": "^3.1.2", - "@graphql-codegen/typescript": "^2.8.7", - "@graphql-codegen/visitor-plugin-common": "2.13.7", + "@graphql-codegen/typescript": "^2.8.8", + "@graphql-codegen/visitor-plugin-common": "2.13.8", "auto-bind": "~4.0.0", "tslib": "~2.4.0" }, diff --git a/packages/plugins/typescript/resolvers/CHANGELOG.md b/packages/plugins/typescript/resolvers/CHANGELOG.md index c8325fd4e76..ae611a12c38 100644 --- a/packages/plugins/typescript/resolvers/CHANGELOG.md +++ b/packages/plugins/typescript/resolvers/CHANGELOG.md @@ -1,5 +1,13 @@ # @graphql-codegen/typescript-resolvers +## 2.7.13 + +### Patch Changes + +- Updated dependencies [[`a98198524`](https://github.com/dotansimha/graphql-code-generator/commit/a9819852443884b43de7c15040ccffc205f9177a)]: + - @graphql-codegen/visitor-plugin-common@2.13.8 + - @graphql-codegen/typescript@2.8.8 + ## 2.7.12 ### Patch Changes diff --git a/packages/plugins/typescript/resolvers/package.json b/packages/plugins/typescript/resolvers/package.json index 967cbc4b4ff..a27339635cb 100644 --- a/packages/plugins/typescript/resolvers/package.json +++ b/packages/plugins/typescript/resolvers/package.json @@ -1,6 +1,6 @@ { "name": "@graphql-codegen/typescript-resolvers", - "version": "2.7.12", + "version": "2.7.13", "description": "GraphQL Code Generator plugin for generating TypeScript types for resolvers signature", "repository": { "type": "git", @@ -14,8 +14,8 @@ }, "dependencies": { "@graphql-codegen/plugin-helpers": "^3.1.2", - "@graphql-codegen/typescript": "^2.8.7", - "@graphql-codegen/visitor-plugin-common": "2.13.7", + "@graphql-codegen/typescript": "^2.8.8", + "@graphql-codegen/visitor-plugin-common": "2.13.8", "@graphql-tools/utils": "^9.0.0", "auto-bind": "~4.0.0", "tslib": "~2.4.0" diff --git a/packages/plugins/typescript/typed-document-node/CHANGELOG.md b/packages/plugins/typescript/typed-document-node/CHANGELOG.md index 380afef357c..74df134c656 100644 --- a/packages/plugins/typescript/typed-document-node/CHANGELOG.md +++ b/packages/plugins/typescript/typed-document-node/CHANGELOG.md @@ -1,5 +1,12 @@ # @graphql-codegen/typed-document-node +## 2.3.13 + +### Patch Changes + +- Updated dependencies [[`a98198524`](https://github.com/dotansimha/graphql-code-generator/commit/a9819852443884b43de7c15040ccffc205f9177a)]: + - @graphql-codegen/visitor-plugin-common@2.13.8 + ## 2.3.12 ### Patch Changes diff --git a/packages/plugins/typescript/typed-document-node/package.json b/packages/plugins/typescript/typed-document-node/package.json index a8fb27c9f41..a340e586898 100644 --- a/packages/plugins/typescript/typed-document-node/package.json +++ b/packages/plugins/typescript/typed-document-node/package.json @@ -1,6 +1,6 @@ { "name": "@graphql-codegen/typed-document-node", - "version": "2.3.12", + "version": "2.3.13", "description": "GraphQL Code Generator plugin for generating ready-to-use TypedDocumentNode based on GraphQL operations", "repository": { "type": "git", @@ -18,7 +18,7 @@ "dependencies": { "change-case-all": "1.0.15", "@graphql-codegen/plugin-helpers": "^3.1.2", - "@graphql-codegen/visitor-plugin-common": "2.13.7", + "@graphql-codegen/visitor-plugin-common": "2.13.8", "auto-bind": "~4.0.0", "tslib": "~2.4.0" }, diff --git a/packages/plugins/typescript/typescript/CHANGELOG.md b/packages/plugins/typescript/typescript/CHANGELOG.md index 403545d4f71..695e77c534d 100644 --- a/packages/plugins/typescript/typescript/CHANGELOG.md +++ b/packages/plugins/typescript/typescript/CHANGELOG.md @@ -1,5 +1,12 @@ # @graphql-codegen/typescript +## 2.8.8 + +### Patch Changes + +- Updated dependencies [[`a98198524`](https://github.com/dotansimha/graphql-code-generator/commit/a9819852443884b43de7c15040ccffc205f9177a)]: + - @graphql-codegen/visitor-plugin-common@2.13.8 + ## 2.8.7 ### Patch Changes diff --git a/packages/plugins/typescript/typescript/package.json b/packages/plugins/typescript/typescript/package.json index 4550dcadc2b..812f1a201e5 100644 --- a/packages/plugins/typescript/typescript/package.json +++ b/packages/plugins/typescript/typescript/package.json @@ -1,6 +1,6 @@ { "name": "@graphql-codegen/typescript", - "version": "2.8.7", + "version": "2.8.8", "description": "GraphQL Code Generator plugin for generating TypeScript types", "repository": { "type": "git", @@ -15,7 +15,7 @@ "dependencies": { "@graphql-codegen/plugin-helpers": "^3.1.2", "@graphql-codegen/schema-ast": "^2.6.1", - "@graphql-codegen/visitor-plugin-common": "2.13.7", + "@graphql-codegen/visitor-plugin-common": "2.13.8", "auto-bind": "~4.0.0", "tslib": "~2.4.0" }, diff --git a/packages/presets/client/CHANGELOG.md b/packages/presets/client/CHANGELOG.md index dc8be189fce..3c24cca6c82 100644 --- a/packages/presets/client/CHANGELOG.md +++ b/packages/presets/client/CHANGELOG.md @@ -1,5 +1,119 @@ # @graphql-codegen/client-preset +## 1.3.0 + +### Minor Changes + +- [#8757](https://github.com/dotansimha/graphql-code-generator/pull/8757) [`4f290aa72`](https://github.com/dotansimha/graphql-code-generator/commit/4f290aa7279a05ffa40920c1c9e5e5b37c164335) Thanks [@n1ru4l](https://github.com/n1ru4l)! - Add support for persisted documents. + + You can now generate and embed a persisted documents hash for the executable documents. + + ```ts + /** codegen.ts */ + import { CodegenConfig } from '@graphql-codegen/cli'; + + const config: CodegenConfig = { + schema: 'https://swapi-graphql.netlify.app/.netlify/functions/index', + documents: ['src/**/*.tsx'], + ignoreNoDocuments: true, // for better experience with the watcher + generates: { + './src/gql/': { + preset: 'client', + plugins: [], + presetConfig: { + persistedDocuments: true, + }, + }, + }, + }; + + export default config; + ``` + + This will generate `./src/gql/persisted-documents.json` (dictionary of hashes with their operation string). + + In addition to that each generated document node will have a `__meta__.hash` property. + + ```ts + import { gql } from './gql.js'; + + const allFilmsWithVariablesQueryDocument = graphql(/* GraphQL */ ` + query allFilmsWithVariablesQuery($first: Int!) { + allFilms(first: $first) { + edges { + node { + ...FilmItem + } + } + } + } + `); + + console.log((allFilmsWithVariablesQueryDocument as any)['__meta__']['hash']); + ``` + +- [#8757](https://github.com/dotansimha/graphql-code-generator/pull/8757) [`4f290aa72`](https://github.com/dotansimha/graphql-code-generator/commit/4f290aa7279a05ffa40920c1c9e5e5b37c164335) Thanks [@n1ru4l](https://github.com/n1ru4l)! - Add support for embedding metadata in the document AST. + + It is now possible to embed metadata (e.g. for your GraphQL client within the emitted code). + + ```ts + /** codegen.ts */ + import { CodegenConfig } from '@graphql-codegen/cli'; + + const config: CodegenConfig = { + schema: 'https://swapi-graphql.netlify.app/.netlify/functions/index', + documents: ['src/**/*.tsx'], + ignoreNoDocuments: true, // for better experience with the watcher + generates: { + './src/gql/': { + preset: 'client', + plugins: [], + presetConfig: { + onExecutableDocumentNode(documentNode) { + return { + operation: documentNode.definitions[0].operation, + name: documentNode.definitions[0].name.value, + }; + }, + }, + }, + }, + }; + + export default config; + ``` + + You can then access the metadata via the `__meta__` property on the document node. + + ```ts + import { gql } from './gql.js'; + + const allFilmsWithVariablesQueryDocument = graphql(/* GraphQL */ ` + query allFilmsWithVariablesQuery($first: Int!) { + allFilms(first: $first) { + edges { + node { + ...FilmItem + } + } + } + } + `); + + console.log((allFilmsWithVariablesQueryDocument as any)['__meta__']); + ``` + +### Patch Changes + +- [#8757](https://github.com/dotansimha/graphql-code-generator/pull/8757) [`4f290aa72`](https://github.com/dotansimha/graphql-code-generator/commit/4f290aa7279a05ffa40920c1c9e5e5b37c164335) Thanks [@n1ru4l](https://github.com/n1ru4l)! - dependencies updates: + - Added dependency [`@graphql-tools/documents@^0.1.0` ↗︎](https://www.npmjs.com/package/@graphql-tools/documents/v/0.1.0) (to `dependencies`) +- Updated dependencies [[`a98198524`](https://github.com/dotansimha/graphql-code-generator/commit/a9819852443884b43de7c15040ccffc205f9177a)]: + - @graphql-codegen/visitor-plugin-common@2.13.8 + - @graphql-codegen/gql-tag-operations@1.6.2 + - @graphql-codegen/typescript-operations@2.5.13 + - @graphql-codegen/typed-document-node@2.3.13 + - @graphql-codegen/typescript@2.8.8 + ## 1.2.6 ### Patch Changes diff --git a/packages/presets/client/package.json b/packages/presets/client/package.json index af081cb01ee..93432caef42 100644 --- a/packages/presets/client/package.json +++ b/packages/presets/client/package.json @@ -1,6 +1,6 @@ { "name": "@graphql-codegen/client-preset", - "version": "1.2.6", + "version": "1.3.0", "description": "GraphQL Code Generator preset for client.", "repository": { "type": "git", @@ -20,12 +20,12 @@ "@babel/helper-plugin-utils": "^7.14.5", "@babel/template": "^7.15.4", "@graphql-codegen/add": "^3.2.3", - "@graphql-codegen/typed-document-node": "^2.3.12", - "@graphql-codegen/typescript": "^2.8.7", - "@graphql-codegen/typescript-operations": "^2.5.12", - "@graphql-codegen/gql-tag-operations": "1.6.1", + "@graphql-codegen/typed-document-node": "^2.3.13", + "@graphql-codegen/typescript": "^2.8.8", + "@graphql-codegen/typescript-operations": "^2.5.13", + "@graphql-codegen/gql-tag-operations": "1.6.2", "@graphql-codegen/plugin-helpers": "^3.1.2", - "@graphql-codegen/visitor-plugin-common": "^2.13.7", + "@graphql-codegen/visitor-plugin-common": "^2.13.8", "@graphql-typed-document-node/core": "3.1.1", "@graphql-tools/documents": "^0.1.0", "@graphql-tools/utils": "^9.0.0", diff --git a/packages/presets/graphql-modules/CHANGELOG.md b/packages/presets/graphql-modules/CHANGELOG.md index b0d40c39f26..1c8ebb270da 100644 --- a/packages/presets/graphql-modules/CHANGELOG.md +++ b/packages/presets/graphql-modules/CHANGELOG.md @@ -1,5 +1,12 @@ # @graphql-codegen/graphql-modules-preset +## 2.5.12 + +### Patch Changes + +- Updated dependencies [[`a98198524`](https://github.com/dotansimha/graphql-code-generator/commit/a9819852443884b43de7c15040ccffc205f9177a)]: + - @graphql-codegen/visitor-plugin-common@2.13.8 + ## 2.5.11 ### Patch Changes diff --git a/packages/presets/graphql-modules/package.json b/packages/presets/graphql-modules/package.json index 4a4f0e7e7d8..742e1b33ca9 100644 --- a/packages/presets/graphql-modules/package.json +++ b/packages/presets/graphql-modules/package.json @@ -1,6 +1,6 @@ { "name": "@graphql-codegen/graphql-modules-preset", - "version": "2.5.11", + "version": "2.5.12", "description": "GraphQL Code Generator preset for modularized schema", "repository": { "type": "git", @@ -16,7 +16,7 @@ }, "dependencies": { "@graphql-codegen/plugin-helpers": "^3.1.2", - "@graphql-codegen/visitor-plugin-common": "2.13.7", + "@graphql-codegen/visitor-plugin-common": "2.13.8", "@graphql-tools/utils": "^9.0.0", "parse-filepath": "^1.0.2", "change-case-all": "1.0.15", diff --git a/website/package.json b/website/package.json index 9d8f88db548..d2780e79e14 100644 --- a/website/package.json +++ b/website/package.json @@ -24,7 +24,7 @@ "@graphql-codegen/add": "3.2.3", "@graphql-codegen/c-sharp": "4.3.1", "@graphql-codegen/c-sharp-operations": "2.3.1", - "@graphql-codegen/cli": "2.16.4", + "@graphql-codegen/cli": "2.16.5", "@graphql-codegen/core": "2.6.8", "@graphql-codegen/flow": "2.3.6", "@graphql-codegen/flow-operations": "2.3.6", @@ -40,8 +40,8 @@ "@graphql-codegen/near-operation-file-preset": "2.4.4", "@graphql-codegen/schema-ast": "2.6.1", "@graphql-codegen/time": "3.2.3", - "@graphql-codegen/typed-document-node": "2.3.12", - "@graphql-codegen/typescript": "2.8.7", + "@graphql-codegen/typed-document-node": "2.3.13", + "@graphql-codegen/typescript": "2.8.8", "@graphql-codegen/typescript-apollo-angular": "3.5.6", "@graphql-codegen/typescript-apollo-client-helpers": "2.2.6", "@graphql-codegen/typescript-generic-sdk": "3.0.4", @@ -49,10 +49,10 @@ "@graphql-codegen/typescript-graphql-request": "4.5.8", "@graphql-codegen/typescript-mongodb": "2.4.6", "@graphql-codegen/typescript-msw": "1.1.6", - "@graphql-codegen/typescript-operations": "2.5.12", + "@graphql-codegen/typescript-operations": "2.5.13", "@graphql-codegen/typescript-react-apollo": "3.3.7", "@graphql-codegen/typescript-react-query": "4.0.6", - "@graphql-codegen/typescript-resolvers": "2.7.12", + "@graphql-codegen/typescript-resolvers": "2.7.13", "@graphql-codegen/typescript-rtk-query": "2.3.7", "@graphql-codegen/typescript-stencil-apollo": "2.3.6", "@graphql-codegen/typescript-type-graphql": "2.3.6",