From 5ac12faafaf3ad25d51374daaa692a3c58cb7346 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 25 Jan 2023 05:29:29 +0000 Subject: [PATCH] chore(release): update monorepo packages versions --- ...codegen_client-preset-8757-dependencies.md | 5 - .changeset/big-mice-switch.md | 5 - .changeset/lemon-zebras-hunt.md | 52 -------- .changeset/tasty-adults-doubt.md | 54 --------- .changeset/unlucky-suits-pay.md | 5 - examples/typescript-esm/package.json | 2 +- .../typescript-graphql-request/package.json | 2 +- examples/typescript-resolvers/package.json | 6 +- .../graphql-cli-codegen-plugin/CHANGELOG.md | 7 ++ .../graphql-cli-codegen-plugin/package.json | 4 +- packages/graphql-codegen-cli/CHANGELOG.md | 6 + packages/graphql-codegen-cli/package.json | 2 +- .../other/visitor-plugin-common/CHANGELOG.md | 6 + .../other/visitor-plugin-common/package.json | 2 +- .../typescript/document-nodes/CHANGELOG.md | 7 ++ .../typescript/document-nodes/package.json | 4 +- .../gql-tag-operations/CHANGELOG.md | 7 ++ .../gql-tag-operations/package.json | 4 +- .../typescript/operations/CHANGELOG.md | 8 ++ .../typescript/operations/package.json | 6 +- .../plugins/typescript/resolvers/CHANGELOG.md | 8 ++ .../plugins/typescript/resolvers/package.json | 6 +- .../typed-document-node/CHANGELOG.md | 7 ++ .../typed-document-node/package.json | 4 +- .../typescript/typescript/CHANGELOG.md | 7 ++ .../typescript/typescript/package.json | 4 +- packages/presets/client/CHANGELOG.md | 114 ++++++++++++++++++ packages/presets/client/package.json | 12 +- packages/presets/graphql-modules/CHANGELOG.md | 7 ++ packages/presets/graphql-modules/package.json | 4 +- website/package.json | 10 +- 31 files changed, 220 insertions(+), 157 deletions(-) delete mode 100644 .changeset/@graphql-codegen_client-preset-8757-dependencies.md delete mode 100644 .changeset/big-mice-switch.md delete mode 100644 .changeset/lemon-zebras-hunt.md delete mode 100644 .changeset/tasty-adults-doubt.md delete mode 100644 .changeset/unlucky-suits-pay.md 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 869028f0cd1c..000000000000 --- 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 f9b10720567c..000000000000 --- 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 2b7a0d8c27ed..000000000000 --- 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/tasty-adults-doubt.md b/.changeset/tasty-adults-doubt.md deleted file mode 100644 index c98cf9cce4c0..000000000000 --- 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 7ce21d89c29b..000000000000 --- 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 ee4cc8ef5fcf..006e75f7c677 100644 --- a/examples/typescript-esm/package.json +++ b/examples/typescript-esm/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-graphql-request/package.json b/examples/typescript-graphql-request/package.json index c8eaafc9b91a..66d517380c00 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 01017daaa449..1855f97837d2 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 0519f8d69a68..f818e41f1f4f 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 [[`884d25c4e`](https://github.com/dotansimha/graphql-code-generator/commit/884d25c4edb099a46bffb23ffd935abec7d14f80)]: + - @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 3840379dd99d..643daed5890d 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 e32c70dd63fa..92c75a5c96e9 100644 --- a/packages/graphql-codegen-cli/CHANGELOG.md +++ b/packages/graphql-codegen-cli/CHANGELOG.md @@ -1,5 +1,11 @@ # @graphql-codegen/cli +## 2.16.5 + +### Patch Changes + +- [#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 + ## 2.16.4 ### Patch Changes diff --git a/packages/graphql-codegen-cli/package.json b/packages/graphql-codegen-cli/package.json index 2cfacac5e667..6c7c1adeeec9 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 760c966106dd..bb82c0e1a7fc 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 e87a4c22f171..c8e95fcea001 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 468c0ab46b74..3c1844042e37 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 e07694bc0663..7bc04d88be2b 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 077158746dff..beaed23ec36c 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 4b1aa704f67f..3c684e1e0fe2 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 366b0697b500..34e2d0b1744f 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 0496dd5e015a..ef7aa3b3cadc 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 c8325fd4e760..ae611a12c387 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 967cbc4b4ff4..a27339635cb8 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 380afef357c7..74df134c6568 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 a8fb27c9f41b..a340e5868985 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 403545d4f71d..695e77c534d2 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 4550dcadc2bf..812f1a201e50 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 dc8be189fcec..3c24cca6c82e 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 af081cb01eee..93432caef426 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 b0d40c39f26c..1c8ebb270dac 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 4a4f0e7e7d8a..742e1b33ca99 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 9d8f88db548a..d2780e79e144 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",