From 43b525d1f94a027b01d579d8b2953463f0e4c35a Mon Sep 17 00:00:00 2001 From: Fran Dios Date: Tue, 24 Oct 2023 01:40:54 +0900 Subject: [PATCH 1/8] fix(visitor-plugin-common): avoid reading from null values (#9709) * fix(visitor-plugin-common): avoid reading from null values * Add e2e test --- .changeset/perfect-forks-flash.md | 5 ++ dev-test/codegen.ts | 11 ++++ dev-test/test-null-value/query.ts | 16 ++++++ dev-test/test-null-value/result.d.ts | 50 +++++++++++++++++++ dev-test/test-null-value/schema.graphql | 32 ++++++++++++ .../src/selection-set-to-object.ts | 3 +- 6 files changed, 116 insertions(+), 1 deletion(-) create mode 100644 .changeset/perfect-forks-flash.md create mode 100644 dev-test/test-null-value/query.ts create mode 100644 dev-test/test-null-value/result.d.ts create mode 100644 dev-test/test-null-value/schema.graphql diff --git a/.changeset/perfect-forks-flash.md b/.changeset/perfect-forks-flash.md new file mode 100644 index 00000000000..c9a037331d4 --- /dev/null +++ b/.changeset/perfect-forks-flash.md @@ -0,0 +1,5 @@ +--- +'@graphql-codegen/visitor-plugin-common': patch +--- + +Avoid reading from null values when selection sets only contain fragments. diff --git a/dev-test/codegen.ts b/dev-test/codegen.ts index fb2419cd2a2..ba8afd46511 100644 --- a/dev-test/codegen.ts +++ b/dev-test/codegen.ts @@ -221,6 +221,17 @@ const config: CodegenConfig = { preset: 'client', presetConfig: { fragmentMasking: true }, }, + './dev-test/test-null-value/result.d.ts': { + schema: './dev-test/test-null-value/schema.graphql', + documents: ['./dev-test/test-null-value/query.ts'], + plugins: ['typescript', 'typescript-operations'], + config: { + // The combination of these two flags caused the following issue: + // https://github.com/dotansimha/graphql-code-generator/pull/9709 + skipTypename: true, + mergeFragmentTypes: true, + }, + }, }, }; diff --git a/dev-test/test-null-value/query.ts b/dev-test/test-null-value/query.ts new file mode 100644 index 00000000000..c270b53c57a --- /dev/null +++ b/dev-test/test-null-value/query.ts @@ -0,0 +1,16 @@ +export const MY_QUERY = /* GraphQL */ ` + fragment CartLine on CartLine { + id + quantity + } + + query Test { + cart { + lines { + nodes { + ...CartLine + } + } + } + } +`; diff --git a/dev-test/test-null-value/result.d.ts b/dev-test/test-null-value/result.d.ts new file mode 100644 index 00000000000..9e88d265c27 --- /dev/null +++ b/dev-test/test-null-value/result.d.ts @@ -0,0 +1,50 @@ +export type Maybe = T | null; +export type InputMaybe = Maybe; +export type Exact = { [K in keyof T]: T[K] }; +export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; +export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +export type MakeEmpty = { [_ in K]?: never }; +export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; +/** All built-in and custom scalars, mapped to their actual values */ +export type Scalars = { + ID: { input: string; output: string }; + String: { input: string; output: string }; + Boolean: { input: boolean; output: boolean }; + Int: { input: number; output: number }; + Float: { input: number; output: number }; +}; + +export type BaseCartLine = { + id: Scalars['String']['output']; + quantity: Scalars['Int']['output']; +}; + +export type BaseCartLineConnection = { + id: Scalars['String']['output']; + nodes: Array; +}; + +export type Cart = { + id: Scalars['String']['output']; + lines: BaseCartLineConnection; +}; + +export type CartLine = BaseCartLine & { + id: Scalars['String']['output']; + quantity: Scalars['Int']['output']; +}; + +export type ComponentizableCartLine = BaseCartLine & { + id: Scalars['String']['output']; + quantity: Scalars['Int']['output']; +}; + +export type QueryRoot = { + cart?: Maybe; +}; + +export type CartLineFragment = { id: string; quantity: number }; + +export type TestQueryVariables = Exact<{ [key: string]: never }>; + +export type TestQuery = { cart?: { lines: { nodes: Array<{ id: string; quantity: number }> } } | null }; diff --git a/dev-test/test-null-value/schema.graphql b/dev-test/test-null-value/schema.graphql new file mode 100644 index 00000000000..3b43e75237e --- /dev/null +++ b/dev-test/test-null-value/schema.graphql @@ -0,0 +1,32 @@ +schema { + query: QueryRoot +} + +interface BaseCartLine { + id: String! + quantity: Int! +} + +type BaseCartLineConnection { + id: String! + nodes: [BaseCartLine!]! +} + +type Cart { + id: String! + lines: BaseCartLineConnection! +} + +type CartLine implements BaseCartLine { + id: String! + quantity: Int! +} + +type ComponentizableCartLine implements BaseCartLine { + id: String! + quantity: Int! +} + +type QueryRoot { + cart: Cart +} diff --git a/packages/plugins/other/visitor-plugin-common/src/selection-set-to-object.ts b/packages/plugins/other/visitor-plugin-common/src/selection-set-to-object.ts index c5dd7c4ad9b..fb16ad0bc6b 100644 --- a/packages/plugins/other/visitor-plugin-common/src/selection-set-to-object.ts +++ b/packages/plugins/other/visitor-plugin-common/src/selection-set-to-object.ts @@ -714,7 +714,6 @@ export class SelectionSetToObject { - const hasUnions = grouped[typeName].filter(s => typeof s !== 'string' && s.union).length > 0; const relevant = grouped[typeName].filter(Boolean); if (relevant.length === 0) { @@ -729,6 +728,8 @@ export class SelectionSetToObject typeof s !== 'string' && s.union).length > 0; + return relevant.length > 1 && !hasUnions ? `( ${res} )` : res; }) .filter(Boolean) From 06f105111148de1f16c8003dae8fcfae077f472a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 23 Oct 2023 11:42:58 -0500 Subject: [PATCH 2/8] chore(deps): update dependency @types/babel__helper-plugin-utils to v7.10.2 (#9717) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- packages/presets/client/package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/presets/client/package.json b/packages/presets/client/package.json index f51374353c3..28db50b2dd7 100644 --- a/packages/presets/client/package.json +++ b/packages/presets/client/package.json @@ -13,7 +13,7 @@ "test": "jest --no-watchman --config ../../../jest.config.js" }, "devDependencies": { - "@types/babel__helper-plugin-utils": "7.10.0", + "@types/babel__helper-plugin-utils": "7.10.2", "@types/babel__template": "7.4.1" }, "dependencies": { diff --git a/yarn.lock b/yarn.lock index fe7da797077..14a8853d066 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4161,10 +4161,10 @@ dependencies: "@babel/types" "^7.0.0" -"@types/babel__helper-plugin-utils@7.10.0": - version "7.10.0" - resolved "https://registry.yarnpkg.com/@types/babel__helper-plugin-utils/-/babel__helper-plugin-utils-7.10.0.tgz#dcd2416f9c189d5837ab2a276368cf67134efe78" - integrity sha512-60YtHzhQ9HAkToHVV+TB4VLzBn9lrfgrsOjiJMtbv/c1jPdekBxaByd6DMsGBzROXWoIL6U3lEFvvbu69RkUoA== +"@types/babel__helper-plugin-utils@7.10.2": + version "7.10.2" + resolved "https://registry.yarnpkg.com/@types/babel__helper-plugin-utils/-/babel__helper-plugin-utils-7.10.2.tgz#d733528f1181c606e92f1a38f18e95575518254b" + integrity sha512-Sa17cG0SKMedlH5bEozh0eXo/54iWpSxbxCoqknRJY0oGGTwO9/SCfIx1taDnG0dvkJnYW+/7tv+PTSFaQsRNA== dependencies: "@types/babel__core" "*" From 6dd4accf66622e95745ef047c871fb688b5f51cf Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 23 Oct 2023 12:59:10 -0500 Subject: [PATCH 3/8] chore(deps): update dependency @types/debounce to v1.2.3 (#9719) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- packages/graphql-codegen-cli/package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/graphql-codegen-cli/package.json b/packages/graphql-codegen-cli/package.json index 9839a6e14de..f1249b52ac6 100644 --- a/packages/graphql-codegen-cli/package.json +++ b/packages/graphql-codegen-cli/package.json @@ -78,7 +78,7 @@ "devDependencies": { "@graphql-tools/merge": "9.0.0", "@parcel/watcher": "^2.1.0", - "@types/debounce": "1.2.1", + "@types/debounce": "1.2.3", "@types/inquirer": "8.2.6", "@types/is-glob": "4.0.2", "@types/js-yaml": "4.0.5", diff --git a/yarn.lock b/yarn.lock index 14a8853d066..4fcbedc249e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4212,10 +4212,10 @@ resolved "https://registry.yarnpkg.com/@types/d3-time/-/d3-time-3.0.0.tgz#e1ac0f3e9e195135361fa1a1d62f795d87e6e819" integrity sha512-sZLCdHvBUcNby1cB6Fd3ZBrABbjz3v1Vm90nysCQ6Vt7vd6e/h9Lt7SiJUoEX0l4Dzc7P5llKyhqSi1ycSf1Hg== -"@types/debounce@1.2.1": - version "1.2.1" - resolved "https://registry.yarnpkg.com/@types/debounce/-/debounce-1.2.1.tgz#79b65710bc8b6d44094d286aecf38e44f9627852" - integrity sha512-epMsEE85fi4lfmJUH/89/iV/LI+F5CvNIvmgs5g5jYFPfhO2S/ae8WSsLOKWdwtoaZw9Q2IhJ4tQ5tFCcS/4HA== +"@types/debounce@1.2.3": + version "1.2.3" + resolved "https://registry.yarnpkg.com/@types/debounce/-/debounce-1.2.3.tgz#52c50549708d403684b29e42d14235276517765f" + integrity sha512-97mx7gWt4e+kd0wPa1pNEvE4tYGhgBVa4ExWOLcfFohAjF9wERfJ+3qrn7I1e76oHupOvRs4UyYe9xzy0i4TUw== "@types/debug@^4.0.0": version "4.1.7" From 6d57a3d0945f31bf331177f0ecd488952f98a9f3 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 23 Oct 2023 13:22:01 -0500 Subject: [PATCH 4/8] chore(deps): update dependency @types/dedent to v0.7.1 (#9721) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- website/package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/website/package.json b/website/package.json index 012f12871e6..6d5c5ef3ab9 100644 --- a/website/package.json +++ b/website/package.json @@ -12,7 +12,7 @@ "devDependencies": { "@theguild/algolia": "1.1.9", "@theguild/tailwind-config": "0.3.0", - "@types/dedent": "0.7.0", + "@types/dedent": "0.7.1", "@types/jsonpath": "0.2.0", "@types/node": "18.17.11", "@types/react": "18.2.21", diff --git a/yarn.lock b/yarn.lock index 4fcbedc249e..3a1790f019b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4224,10 +4224,10 @@ dependencies: "@types/ms" "*" -"@types/dedent@0.7.0": - version "0.7.0" - resolved "https://registry.yarnpkg.com/@types/dedent/-/dedent-0.7.0.tgz#155f339ca404e6dd90b9ce46a3f78fd69ca9b050" - integrity sha512-EGlKlgMhnLt/cM4DbUSafFdrkeJoC9Mvnj0PUCU7tFmTjMjNRT957kXCx0wYm3JuEq4o4ZsS5vG+NlkM2DMd2A== +"@types/dedent@0.7.1": + version "0.7.1" + resolved "https://registry.yarnpkg.com/@types/dedent/-/dedent-0.7.1.tgz#05a6af9dbe7d3c927f3f6f54082fc69157a31a69" + integrity sha512-NKo033xLkoVCgUobq+FS1S3J6kwWeOcyqEBc2r2oi9J/dKncY11J9VgS0Giv7T4rxVt/MajUVcFppT2TPJA2Cg== "@types/estree-jsx@^1.0.0": version "1.0.0" From f5a26b1cd921df74d521172c9ac9e4ff6b3421f5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 23 Oct 2023 13:23:04 -0500 Subject: [PATCH 5/8] chore(deps): update dependency @types/babel__template to v7.4.3 (#9718) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- packages/presets/client/package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/presets/client/package.json b/packages/presets/client/package.json index 28db50b2dd7..f67ce4e926e 100644 --- a/packages/presets/client/package.json +++ b/packages/presets/client/package.json @@ -14,7 +14,7 @@ }, "devDependencies": { "@types/babel__helper-plugin-utils": "7.10.2", - "@types/babel__template": "7.4.1" + "@types/babel__template": "7.4.3" }, "dependencies": { "@babel/helper-plugin-utils": "^7.20.2", diff --git a/yarn.lock b/yarn.lock index 3a1790f019b..d0650e0059e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4168,10 +4168,10 @@ dependencies: "@types/babel__core" "*" -"@types/babel__template@*", "@types/babel__template@7.4.1": - version "7.4.1" - resolved "https://registry.yarnpkg.com/@types/babel__template/-/babel__template-7.4.1.tgz#3d1a48fd9d6c0edfd56f2ff578daed48f36c8969" - integrity sha512-azBFKemX6kMg5Io+/rdGT0dkGreboUVR0Cdm3fz9QJWpaQGJRQXl7C+6hOTCZcMll7KFyEQpgbYI2lHdsS4U7g== +"@types/babel__template@*", "@types/babel__template@7.4.3": + version "7.4.3" + resolved "https://registry.yarnpkg.com/@types/babel__template/-/babel__template-7.4.3.tgz#db9ac539a2fe05cfe9e168b24f360701bde41f5f" + integrity sha512-ciwyCLeuRfxboZ4isgdNZi/tkt06m8Tw6uGbBSBgWrnnZGNXiEyM27xc/PjXGQLqlZ6ylbgHMnm7ccF9tCkOeQ== dependencies: "@babel/parser" "^7.1.0" "@babel/types" "^7.0.0" From 6fd672b2d6f42171274836d18e60e311d0a29a2b Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 23 Oct 2023 13:40:39 -0500 Subject: [PATCH 6/8] chore(deps): update dependency @types/inquirer to v8.2.9 (#9722) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- packages/graphql-codegen-cli/package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/graphql-codegen-cli/package.json b/packages/graphql-codegen-cli/package.json index f1249b52ac6..31579c1f868 100644 --- a/packages/graphql-codegen-cli/package.json +++ b/packages/graphql-codegen-cli/package.json @@ -79,7 +79,7 @@ "@graphql-tools/merge": "9.0.0", "@parcel/watcher": "^2.1.0", "@types/debounce": "1.2.3", - "@types/inquirer": "8.2.6", + "@types/inquirer": "8.2.9", "@types/is-glob": "4.0.2", "@types/js-yaml": "4.0.5", "@types/micromatch": "^4.0.2", diff --git a/yarn.lock b/yarn.lock index d0650e0059e..72424205a3b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4262,10 +4262,10 @@ dependencies: "@types/unist" "*" -"@types/inquirer@8.2.6": - version "8.2.6" - resolved "https://registry.yarnpkg.com/@types/inquirer/-/inquirer-8.2.6.tgz#abd41a5fb689c7f1acb12933d787d4262a02a0ab" - integrity sha512-3uT88kxg8lNzY8ay2ZjP44DKcRaTGztqeIvN2zHvhzIBH/uAPaL75aBtdNRKbA7xXoMbBt5kX0M00VKAnfOYlA== +"@types/inquirer@8.2.9": + version "8.2.9" + resolved "https://registry.yarnpkg.com/@types/inquirer/-/inquirer-8.2.9.tgz#bb29e7d2358e3af7d9f4d6c6410320498b428d48" + integrity sha512-5IEO2PwCy4NZDgj977dho4Qbdiw6dJZJzD4ZaB/9j7dfppf7z0xxFPKZz/FtTAUQbDjmWHJ6Jlz/gn0YzWHPsw== dependencies: "@types/through" "*" rxjs "^7.2.0" From 07134e8eb64451d1b3d36408faad54a63776d15e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 23 Oct 2023 13:41:13 -0500 Subject: [PATCH 7/8] fix(deps): update dependency @graphql-codegen/typescript-nhost to v0.0.2 (#9706) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- website/package.json | 2 +- yarn.lock | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/website/package.json b/website/package.json index 6d5c5ef3ab9..1bab484caa8 100644 --- a/website/package.json +++ b/website/package.json @@ -52,7 +52,7 @@ "@graphql-codegen/typescript-graphql-request": "5.0.0", "@graphql-codegen/typescript-mongodb": "2.4.6", "@graphql-codegen/typescript-msw": "1.1.6", - "@graphql-codegen/typescript-nhost": "0.0.1", + "@graphql-codegen/typescript-nhost": "0.0.2", "@graphql-codegen/typescript-operations": "4.0.1", "@graphql-codegen/typescript-react-apollo": "3.3.7", "@graphql-codegen/typescript-react-query": "4.1.0", diff --git a/yarn.lock b/yarn.lock index 72424205a3b..3d041b99db0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2258,16 +2258,16 @@ change-case-all "1.0.14" tslib "~2.4.0" -"@graphql-codegen/typescript-nhost@0.0.1": - version "0.0.1" - resolved "https://registry.yarnpkg.com/@graphql-codegen/typescript-nhost/-/typescript-nhost-0.0.1.tgz#81a222ed9b03b6265c94b23f11e2cfd3ac567544" - integrity sha512-ISVfpk7PYqWEhcA5Ypky7X9Fyosb9etxyGkT85rW4AK9VrshwN32osbA1Zkmsx3WhoZxIBpGzUk1Vf4YNYSurg== +"@graphql-codegen/typescript-nhost@0.0.2": + version "0.0.2" + resolved "https://registry.yarnpkg.com/@graphql-codegen/typescript-nhost/-/typescript-nhost-0.0.2.tgz#e29bd26073c2bac548d67b42899f6992d7a53646" + integrity sha512-DhBqEyTZti3MARYXKezgX2TgG0aTM5AgEuGm96sWHR7OxkrXx73VX+lsC2xARI/vue7liqxjJLDOxBjV5CpqjQ== dependencies: "@graphql-codegen/plugin-helpers" "^4.0.0" "@graphql-codegen/typescript" "^3.0.0" "@graphql-codegen/visitor-plugin-common" "3.0.0" "@urql/introspection" "^1.0.0" - tslib "~2.5.0" + tslib "~2.6.0" "@graphql-codegen/typescript-react-apollo@3.3.7": version "3.3.7" From 80e4a5bfe7fda613b96609bbc4ba462b2928d871 Mon Sep 17 00:00:00 2001 From: mizdra Date: Tue, 24 Oct 2023 03:42:36 +0900 Subject: [PATCH 8/8] Add typescript-fabbrica plugin in doc (#9694) * yarn workspace website add @mizdra/graphql-codegen-typescript-fabbrica * add typescript-fabbrica plugin in doc --- website/package.json | 3 ++- website/src/category-to-packages.mjs | 1 + website/src/lib/plugins.ts | 6 ++++++ website/src/pages/plugins/typescript/_meta.ts | 1 + .../plugins/typescript/typescript-fabbrica.mdx | 11 +++++++++++ yarn.lock | 15 ++++++++++++++- 6 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 website/src/pages/plugins/typescript/typescript-fabbrica.mdx diff --git a/website/package.json b/website/package.json index 1bab484caa8..50103e3ca7e 100644 --- a/website/package.json +++ b/website/package.json @@ -25,6 +25,7 @@ "@graphql-codegen/c-sharp": "4.3.1", "@graphql-codegen/c-sharp-operations": "2.3.1", "@graphql-codegen/cli": "5.0.0", + "@graphql-codegen/client-preset": "4.1.0", "@graphql-codegen/core": "4.0.0", "@graphql-codegen/flow": "2.3.6", "@graphql-codegen/flow-operations": "2.3.6", @@ -65,8 +66,8 @@ "@graphql-codegen/typescript-vue-apollo-smart-ops": "2.3.6", "@graphql-codegen/typescript-vue-urql": "2.3.6", "@graphql-codegen/urql-introspection": "2.2.1", - "@graphql-codegen/client-preset": "4.1.0", "@mendable/search": "0.0.155", + "@mizdra/graphql-codegen-typescript-fabbrica": "^0.3.0", "@monaco-editor/react": "4.5.2", "@theguild/components": "^6.0.1", "classnames": "2.3.2", diff --git a/website/src/category-to-packages.mjs b/website/src/category-to-packages.mjs index 7f30f170552..50ed1682539 100644 --- a/website/src/category-to-packages.mjs +++ b/website/src/category-to-packages.mjs @@ -26,6 +26,7 @@ export const CategoryToPackages = { 'typescript-apollo-client-helpers', 'typescript-apollo-next', 'typescript-document-nodes', + 'typescript-fabbrica', 'typescript-generic-sdk', 'typescript-graphql-files-modules', 'typescript-graphql-request', diff --git a/website/src/lib/plugins.ts b/website/src/lib/plugins.ts index 99eba417214..7e0622eeddc 100644 --- a/website/src/lib/plugins.ts +++ b/website/src/lib/plugins.ts @@ -277,6 +277,12 @@ export const PACKAGES: Record< icon: 'typescript', tags: ['plugin', 'typescript'], }, + 'typescript-fabbrica': { + title: 'TypeScript Mock Data Factory', + npmPackage: '@mizdra/graphql-codegen-typescript-fabbrica', + icon: 'typescript', + tags: ['plugin', 'typescript'], + }, 'typescript-generic-sdk': { title: 'TypeScript Generic SDK', npmPackage: '@graphql-codegen/typescript-generic-sdk', diff --git a/website/src/pages/plugins/typescript/_meta.ts b/website/src/pages/plugins/typescript/_meta.ts index 09510aa2a06..bf6b9280e9e 100644 --- a/website/src/pages/plugins/typescript/_meta.ts +++ b/website/src/pages/plugins/typescript/_meta.ts @@ -7,6 +7,7 @@ export default { 'typescript-apollo-client-helpers': 'apollo-client-helpers', 'typescript-apollo-next': 'apollo-next', 'typescript-document-nodes': 'document-nodes', + 'typescript-fabbrica': 'fabbrica', 'typescript-generic-sdk': 'generic-sdk', 'typescript-graphql-files-modules': 'graphql-files-modules', 'typescript-graphql-request': 'graphql-request', diff --git a/website/src/pages/plugins/typescript/typescript-fabbrica.mdx b/website/src/pages/plugins/typescript/typescript-fabbrica.mdx new file mode 100644 index 00000000000..49e0de905e1 --- /dev/null +++ b/website/src/pages/plugins/typescript/typescript-fabbrica.mdx @@ -0,0 +1,11 @@ +--- +title: typescript-fabbrica +description: GraphQL Code Generator Plugin to define mock data factory. +--- + +import { PluginApiDocs, PluginHeader } from '@/components/plugin' +import { pluginGetStaticProps } from '@/lib/plugin-get-static-props' +export const getStaticProps = pluginGetStaticProps(__filename) + + + diff --git a/yarn.lock b/yarn.lock index 3d041b99db0..dddcc74ddc2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3389,6 +3389,14 @@ html-react-parser "^4.2.0" posthog-js "^1.45.1" +"@mizdra/graphql-codegen-typescript-fabbrica@^0.3.0": + version "0.3.0" + resolved "https://registry.yarnpkg.com/@mizdra/graphql-codegen-typescript-fabbrica/-/graphql-codegen-typescript-fabbrica-0.3.0.tgz#783ffc7c4ade7b844a6c65cc1fb7bac340a2f42d" + integrity sha512-ShPEpC6GrzL1fqXqx4Ua1heid8ExrK/evJI1vozVPt6mZWebwKG0tf26v9KwQ0F8HZBufnq4BURUMXobWi9ckQ== + dependencies: + "@graphql-codegen/plugin-helpers" "^5.0.1" + "@graphql-codegen/visitor-plugin-common" "^4.0.1" + "@monaco-editor/loader@^1.3.3": version "1.3.3" resolved "https://registry.yarnpkg.com/@monaco-editor/loader/-/loader-1.3.3.tgz#7f1742bd3cc21c0362a46a4056317f6e5215cfca" @@ -8617,11 +8625,16 @@ graphql-yoga@4.0.4: lru-cache "^10.0.0" tslib "^2.5.2" -graphql@16.8.0, graphql@^16.0.0, graphql@^16.6.0: +graphql@16.8.0, graphql@^16.6.0: version "16.8.0" resolved "https://registry.yarnpkg.com/graphql/-/graphql-16.8.0.tgz#374478b7f27b2dc6153c8f42c1b80157f79d79d4" integrity sha512-0oKGaR+y3qcS5mCu1vb7KG+a89vjn06C7Ihq/dDl3jA+A8B3TKomvi3CiEcVLJQGalbu8F52LxkOym7U5sSfbg== +graphql@^16.0.0: + version "16.8.1" + resolved "https://registry.yarnpkg.com/graphql/-/graphql-16.8.1.tgz#1930a965bef1170603702acdb68aedd3f3cf6f07" + integrity sha512-59LZHPdGZVh695Ud9lRzPBVTtlX9ZCV150Er2W43ro37wVof0ctenSaskPPjN7lVTIN8mSZt8PHUNKZuNQUuxw== + gray-matter@^4.0.3: version "4.0.3" resolved "https://registry.yarnpkg.com/gray-matter/-/gray-matter-4.0.3.tgz#e893c064825de73ea1f5f7d88c7a9f7274288798"