@nxgt/graphql-codegen-zod 0.3.5 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -287,9 +287,21 @@ Each is detailed in [Output](docs/guide/output.md).
287
287
 
288
288
  Every error and its fix is in [Troubleshooting](docs/troubleshooting.md).
289
289
 
290
+ ### From another plugin: the variables schema's name
291
+
292
+ ```ts
293
+ import { variablesSchemaName } from '@nxgt/graphql-codegen-zod/naming';
294
+
295
+ variablesSchemaName({ dedupeOperationSuffix: true }, 'getHTTPThing', 'query');
296
+ // 'zGetHttpThingQueryVariables'
297
+ ```
298
+
299
+ Pass the same `config` as the plugin's (the types `NamingConfig` and `OperationKind` are exported beside it); the plugin names the schema through
300
+ this function, so the two never disagree.
301
+
290
302
  ## Documentation
291
303
 
292
- The package exports `plugin` and the `CodegenZodConfig` and `DocumentFile` types from `.`; graphql-codegen finds `plugin` by the package name. See [Output](docs/guide/output.md#the-plugin-function).
304
+ The package exports `plugin` and the `CodegenZodConfig` and `DocumentFile` types from `.`; graphql-codegen finds `plugin` by the package name. The variables schema's name for a companion plugin is on `./naming` (see [Naming](docs/guide/output.md#computing-a-name-from-another-plugin)).
293
305
 
294
306
  - [Documentation index](docs/README.md)
295
307
  - Guides: [Output](docs/guide/output.md)
@@ -0,0 +1,107 @@
1
+ // src/naming.ts
2
+ import * as changeCase from "change-case";
3
+
4
+ class Naming {
5
+ #config;
6
+ #convert;
7
+ constructor(config) {
8
+ this.#config = config;
9
+ this.#convert = converter(config.namingConvention);
10
+ }
11
+ type(name) {
12
+ return this.#wrap(this.#convert(name));
13
+ }
14
+ args(parent, field) {
15
+ const underscore = this.#config.addUnderscoreToArgsType ? "_" : "";
16
+ return this.#wrap(this.#convert(`${parent}${underscore}${this.#convert(field)}Args`));
17
+ }
18
+ variables(operation, kind) {
19
+ return this.#wrap(this.#convert(`${operation}${this.#suffix(operation, kind)}Variables`));
20
+ }
21
+ variablesSchema(operation, kind) {
22
+ const type = this.variables(operation, kind);
23
+ return { type, schema: this.schema(type) };
24
+ }
25
+ result(operation, kind) {
26
+ return this.#wrap(this.#convert(`${operation}${this.#suffix(operation, kind)}`));
27
+ }
28
+ fragment(name) {
29
+ return this.#wrap(this.#convert(`${name}${this.#suffix(name, "fragment")}`));
30
+ }
31
+ #suffix(operation, kind) {
32
+ const type = changeCase.pascalCase(kind);
33
+ const { omitOperationSuffix, dedupeOperationSuffix } = this.#config;
34
+ return omitOperationSuffix || dedupeOperationSuffix && operation.toLowerCase().endsWith(type.toLowerCase()) ? "" : type;
35
+ }
36
+ schema(type) {
37
+ return `${this.#config.schemaPrefix ?? "z"}${type}`;
38
+ }
39
+ #wrap(name) {
40
+ return `${this.#config.typesPrefix ?? ""}${name}${this.#config.typesSuffix ?? ""}`;
41
+ }
42
+ }
43
+ var lowerCaseFirst = (name) => name.charAt(0).toLowerCase() + name.slice(1);
44
+ var upperCaseFirst = (name) => name.charAt(0).toUpperCase() + name.slice(1);
45
+ var cases = {
46
+ "change-case-all": {
47
+ camelCase: changeCase.camelCase,
48
+ capitalCase: changeCase.capitalCase,
49
+ constantCase: changeCase.constantCase,
50
+ dotCase: changeCase.dotCase,
51
+ headerCase: changeCase.trainCase,
52
+ noCase: changeCase.noCase,
53
+ paramCase: changeCase.kebabCase,
54
+ pascalCase: changeCase.pascalCase,
55
+ pathCase: changeCase.pathCase,
56
+ sentenceCase: changeCase.sentenceCase,
57
+ snakeCase: changeCase.snakeCase,
58
+ lowerCase: (name) => name.toLowerCase(),
59
+ upperCase: (name) => name.toUpperCase(),
60
+ lowerCaseFirst,
61
+ upperCaseFirst
62
+ },
63
+ "change-case": {
64
+ camelCase: changeCase.camelCase,
65
+ capitalCase: changeCase.capitalCase,
66
+ constantCase: changeCase.constantCase,
67
+ dotCase: changeCase.dotCase,
68
+ kebabCase: changeCase.kebabCase,
69
+ noCase: changeCase.noCase,
70
+ pascalCase: changeCase.pascalCase,
71
+ pascalSnakeCase: changeCase.pascalSnakeCase,
72
+ pathCase: changeCase.pathCase,
73
+ sentenceCase: changeCase.sentenceCase,
74
+ snakeCase: changeCase.snakeCase,
75
+ trainCase: changeCase.trainCase
76
+ }
77
+ };
78
+ var byPart = (fn, transformUnderscore) => (name) => transformUnderscore ? fn(name) : name.split("_").map(fn).join("_");
79
+ function converter(convention) {
80
+ if (convention === undefined)
81
+ return byPart(changeCase.pascalCase, false);
82
+ if (convention === "keep")
83
+ return (name) => name;
84
+ if (typeof convention === "function")
85
+ return byPart(convention, false);
86
+ if (typeof convention === "string")
87
+ return byPart(caseNamed(convention), false);
88
+ const { typeNames, transformUnderscore } = convention;
89
+ if (typeNames === "keep")
90
+ return (name) => name;
91
+ if (typeNames === undefined)
92
+ return byPart(changeCase.pascalCase, transformUnderscore ?? false);
93
+ const fn = typeof typeNames === "function" ? typeNames : caseNamed(typeNames);
94
+ return byPart(fn, true);
95
+ }
96
+ function caseNamed(spec) {
97
+ const [module = "", name = ""] = spec.split("#");
98
+ const fn = cases[module]?.[name];
99
+ if (fn)
100
+ return fn;
101
+ throw new Error(`@nxgt/graphql-codegen-zod: namingConvention "${spec}" is not one this plugin reads. Use 'keep', a function, or 'change-case-all#<case>' with one of ${Object.keys(cases["change-case-all"] ?? {}).join(", ")}.`);
102
+ }
103
+
104
+ export { Naming };
105
+
106
+ //# debugId=E7A111ED0318BDE264756E2164756E21
107
+ //# sourceMappingURL=index-19w6rb9e.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/naming.ts"],
4
+ "sourcesContent": [
5
+ "import * as changeCase from 'change-case';\nimport type { OperationTypeNode } from 'graphql';\nimport type { CodegenZodConfig } from './config';\n\n/** An operation's kind, as graphql names it: `OperationTypeNode`'s values. */\nexport type OperationKind = `${OperationTypeNode}`;\n\n/** The options of `CodegenZodConfig` that decide a name. */\nexport type NamingConfig = Pick<\n\tCodegenZodConfig,\n\t| 'namingConvention'\n\t| 'typesPrefix'\n\t| 'typesSuffix'\n\t| 'schemaPrefix'\n\t| 'omitOperationSuffix'\n\t| 'dedupeOperationSuffix'\n\t| 'addUnderscoreToArgsType'\n>;\n\n/**\n * The names of what the plugin writes: each type as\n * `@graphql-codegen/typescript` and `typescript-operations` name it, each\n * schema the same name behind `schemaPrefix`.\n */\nexport class Naming {\n\treadonly #config: NamingConfig;\n\treadonly #convert: (name: string) => string;\n\n\tconstructor(config: NamingConfig) {\n\t\tthis.#config = config;\n\t\tthis.#convert = converter(config.namingConvention);\n\t}\n\n\t/** An input type's or an enum's type name: `SignUpInput`. */\n\ttype(name: string): string {\n\t\treturn this.#wrap(this.#convert(name));\n\t}\n\n\t/** A field's arguments type name: `MutationSignUpArgs`. */\n\targs(parent: string, field: string): string {\n\t\tconst underscore = this.#config.addUnderscoreToArgsType ? '_' : '';\n\t\treturn this.#wrap(\n\t\t\tthis.#convert(`${parent}${underscore}${this.#convert(field)}Args`),\n\t\t);\n\t}\n\n\t/** An operation's variables type name: `SignUpMutationVariables`. */\n\tvariables(operation: string, kind: OperationKind): string {\n\t\treturn this.#wrap(\n\t\t\tthis.#convert(`${operation}${this.#suffix(operation, kind)}Variables`),\n\t\t);\n\t}\n\n\t/**\n\t * An operation's variables type and its schema: `SignUpMutationVariables`\n\t * and `zSignUpMutationVariables`. The one place the pair is computed, for\n\t * the plugin and for `variablesSchemaName`.\n\t */\n\tvariablesSchema(\n\t\toperation: string,\n\t\tkind: OperationKind,\n\t): { readonly type: string; readonly schema: string } {\n\t\tconst type = this.variables(operation, kind);\n\t\treturn { type, schema: this.schema(type) };\n\t}\n\n\t/** An operation's result type name: `SignUpMutation`. */\n\tresult(operation: string, kind: OperationKind): string {\n\t\treturn this.#wrap(\n\t\t\tthis.#convert(`${operation}${this.#suffix(operation, kind)}`),\n\t\t);\n\t}\n\n\t/** A fragment's type name: `UserFieldsFragment`. */\n\tfragment(name: string): string {\n\t\treturn this.#wrap(\n\t\t\tthis.#convert(`${name}${this.#suffix(name, 'fragment')}`),\n\t\t);\n\t}\n\n\t/** As visitor-plugin-common's `getOperationSuffix`, fragments included. */\n\t#suffix(operation: string, kind: OperationKind | 'fragment'): string {\n\t\tconst type = changeCase.pascalCase(kind);\n\t\tconst { omitOperationSuffix, dedupeOperationSuffix } = this.#config;\n\t\treturn omitOperationSuffix ||\n\t\t\t(dedupeOperationSuffix &&\n\t\t\t\toperation.toLowerCase().endsWith(type.toLowerCase()))\n\t\t\t? ''\n\t\t\t: type;\n\t}\n\n\t/** The schema of the type named `type`: `zSignUpInput`. */\n\tschema(type: string): string {\n\t\treturn `${this.#config.schemaPrefix ?? 'z'}${type}`;\n\t}\n\n\t#wrap(name: string): string {\n\t\treturn `${this.#config.typesPrefix ?? ''}${name}${this.#config.typesSuffix ?? ''}`;\n\t}\n}\n\ntype Convention = NonNullable<CodegenZodConfig['namingConvention']>;\ntype Case = (name: string) => string;\n\nconst lowerCaseFirst: Case = (name) =>\n\tname.charAt(0).toLowerCase() + name.slice(1);\nconst upperCaseFirst: Case = (name) =>\n\tname.charAt(0).toUpperCase() + name.slice(1);\n\n/**\n * The cases a `namingConvention` string can name, by module: change-case-all\n * 2's names (what the typescript plugins resolve), and change-case 5's.\n */\nconst cases: Readonly<Record<string, Readonly<Record<string, Case>>>> = {\n\t'change-case-all': {\n\t\tcamelCase: changeCase.camelCase,\n\t\tcapitalCase: changeCase.capitalCase,\n\t\tconstantCase: changeCase.constantCase,\n\t\tdotCase: changeCase.dotCase,\n\t\theaderCase: changeCase.trainCase,\n\t\tnoCase: changeCase.noCase,\n\t\tparamCase: changeCase.kebabCase,\n\t\tpascalCase: changeCase.pascalCase,\n\t\tpathCase: changeCase.pathCase,\n\t\tsentenceCase: changeCase.sentenceCase,\n\t\tsnakeCase: changeCase.snakeCase,\n\t\tlowerCase: (name) => name.toLowerCase(),\n\t\tupperCase: (name) => name.toUpperCase(),\n\t\tlowerCaseFirst,\n\t\tupperCaseFirst,\n\t},\n\t'change-case': {\n\t\tcamelCase: changeCase.camelCase,\n\t\tcapitalCase: changeCase.capitalCase,\n\t\tconstantCase: changeCase.constantCase,\n\t\tdotCase: changeCase.dotCase,\n\t\tkebabCase: changeCase.kebabCase,\n\t\tnoCase: changeCase.noCase,\n\t\tpascalCase: changeCase.pascalCase,\n\t\tpascalSnakeCase: changeCase.pascalSnakeCase,\n\t\tpathCase: changeCase.pathCase,\n\t\tsentenceCase: changeCase.sentenceCase,\n\t\tsnakeCase: changeCase.snakeCase,\n\t\ttrainCase: changeCase.trainCase,\n\t},\n};\n\n/** Applies `fn` to each part between underscores, or to the whole name. */\nconst byPart =\n\t(fn: Case, transformUnderscore: boolean): Case =>\n\t(name) =>\n\t\ttransformUnderscore ? fn(name) : name.split('_').map(fn).join('_');\n\n/**\n * A `namingConvention` as `@graphql-codegen/visitor-plugin-common`'s\n * `convertFactory` reads it for type names: undefined is PascalCase per\n * part; `'keep'`; a `'change-case-all#<case>'` string or a function, per\n * part; an object's `typeNames`, on the whole name (upstream reads no\n * `transformUnderscore` there), or, without `typeNames`, PascalCase per\n * part unless `transformUnderscore` is true.\n * Enum values are written as they are, so `enumValues` is not read.\n */\nfunction converter(convention: Convention | undefined): Case {\n\tif (convention === undefined) return byPart(changeCase.pascalCase, false);\n\tif (convention === 'keep') return (name) => name;\n\tif (typeof convention === 'function') return byPart(convention, false);\n\tif (typeof convention === 'string')\n\t\treturn byPart(caseNamed(convention), false);\n\tconst { typeNames, transformUnderscore } = convention;\n\tif (typeNames === 'keep') return (name) => name;\n\tif (typeNames === undefined)\n\t\treturn byPart(changeCase.pascalCase, transformUnderscore ?? false);\n\tconst fn = typeof typeNames === 'function' ? typeNames : caseNamed(typeNames);\n\treturn byPart(fn, true);\n}\n\nfunction caseNamed(spec: string): Case {\n\tconst [module = '', name = ''] = spec.split('#');\n\tconst fn = cases[module]?.[name];\n\tif (fn) return fn;\n\tthrow new Error(\n\t\t`@nxgt/graphql-codegen-zod: namingConvention \"${spec}\" is not one this plugin reads. Use 'keep', a function, or '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YAA0C;AAAA,EAC5D,IAAI,eAAe;AAAA,IAAW,OAAO,OAAkB,uBAAY,KAAK;AAAA,EACxE,IAAI,eAAe;AAAA,IAAQ,OAAO,CAAC,SAAS;AAAA,EAC5C,IAAI,OAAO,eAAe;AAAA,IAAY,OAAO,OAAO,YAAY,KAAK;AAAA,EACrE,IAAI,OAAO,eAAe;AAAA,IACzB,OAAO,OAAO,UAAU,UAAU,GAAG,KAAK;AAAA,EAC3C,QAAQ,WAAW,wBAAwB;AAAA,EAC3C,IAAI,cAAc;AAAA,IAAQ,OAAO,CAAC,SAAS;AAAA,EAC3C,IAAI,cAAc;AAAA,IACjB,OAAO,OAAkB,uBAAY,uBAAuB,KAAK;AAAA,EAClE,MAAM,KAAK,OAAO,cAAc,aAAa,YAAY,UAAU,SAAS;AAAA,EAC5E,OAAO,OAAO,IAAI,IAAI;AAAA;AAGvB,SAAS,SAAS,CAAC,MAAoB;AAAA,EACtC,OAAO,SAAS,IAAI,OAAO,MAAM,KAAK,MAAM,GAAG;AAAA,EAC/C,MAAM,KAAK,MAAM,UAAU;AAAA,EAC3B,IAAI;AAAA,IAAI,OAAO;AAAA,EACf,MAAM,IAAI,MACT,gDAAgD,uGAAuG,OAAO,KAAK,MAAM,sBAAsB,CAAC,CAAC,EAAE,KAAK,IAAI,IAC7M;AAAA;",
8
+ "debugId": "E7A111ED0318BDE264756E2164756E21",
9
+ "names": []
10
+ }
package/dist/index.js CHANGED
@@ -1,3 +1,7 @@
1
+ import {
2
+ Naming
3
+ } from "./chunks/index-19w6rb9e.js";
4
+
1
5
  // src/index.ts
2
6
  import { checkConstraints } from "@nxgt/graphql-validation/codegen";
3
7
  import {
@@ -107,105 +111,6 @@ class Imports {
107
111
  }
108
112
  }
109
113
 
110
- // src/naming.ts
111
- import * as changeCase from "change-case";
112
-
113
- class Naming {
114
- #config;
115
- #convert;
116
- constructor(config) {
117
- this.#config = config;
118
- this.#convert = converter(config.namingConvention);
119
- }
120
- type(name) {
121
- return this.#wrap(this.#convert(name));
122
- }
123
- args(parent, field) {
124
- const underscore = this.#config.addUnderscoreToArgsType ? "_" : "";
125
- return this.#wrap(this.#convert(`${parent}${underscore}${this.#convert(field)}Args`));
126
- }
127
- variables(operation, kind) {
128
- return this.#wrap(this.#convert(`${operation}${this.#suffix(operation, kind)}Variables`));
129
- }
130
- result(operation, kind) {
131
- return this.#wrap(this.#convert(`${operation}${this.#suffix(operation, kind)}`));
132
- }
133
- fragment(name) {
134
- return this.#wrap(this.#convert(`${name}${this.#suffix(name, "fragment")}`));
135
- }
136
- #suffix(operation, kind) {
137
- const type = changeCase.pascalCase(kind);
138
- const { omitOperationSuffix, dedupeOperationSuffix } = this.#config;
139
- return omitOperationSuffix || dedupeOperationSuffix && operation.toLowerCase().endsWith(type.toLowerCase()) ? "" : type;
140
- }
141
- schema(type) {
142
- return `${this.#config.schemaPrefix ?? "z"}${type}`;
143
- }
144
- #wrap(name) {
145
- return `${this.#config.typesPrefix ?? ""}${name}${this.#config.typesSuffix ?? ""}`;
146
- }
147
- }
148
- var lowerCaseFirst = (name) => name.charAt(0).toLowerCase() + name.slice(1);
149
- var upperCaseFirst = (name) => name.charAt(0).toUpperCase() + name.slice(1);
150
- var cases = {
151
- "change-case-all": {
152
- camelCase: changeCase.camelCase,
153
- capitalCase: changeCase.capitalCase,
154
- constantCase: changeCase.constantCase,
155
- dotCase: changeCase.dotCase,
156
- headerCase: changeCase.trainCase,
157
- noCase: changeCase.noCase,
158
- paramCase: changeCase.kebabCase,
159
- pascalCase: changeCase.pascalCase,
160
- pathCase: changeCase.pathCase,
161
- sentenceCase: changeCase.sentenceCase,
162
- snakeCase: changeCase.snakeCase,
163
- lowerCase: (name) => name.toLowerCase(),
164
- upperCase: (name) => name.toUpperCase(),
165
- lowerCaseFirst,
166
- upperCaseFirst
167
- },
168
- "change-case": {
169
- camelCase: changeCase.camelCase,
170
- capitalCase: changeCase.capitalCase,
171
- constantCase: changeCase.constantCase,
172
- dotCase: changeCase.dotCase,
173
- kebabCase: changeCase.kebabCase,
174
- noCase: changeCase.noCase,
175
- pascalCase: changeCase.pascalCase,
176
- pascalSnakeCase: changeCase.pascalSnakeCase,
177
- pathCase: changeCase.pathCase,
178
- sentenceCase: changeCase.sentenceCase,
179
- snakeCase: changeCase.snakeCase,
180
- trainCase: changeCase.trainCase
181
- }
182
- };
183
- var byPart = (fn, transformUnderscore) => (name) => transformUnderscore ? fn(name) : name.split("_").map(fn).join("_");
184
- function converter(convention) {
185
- if (convention === undefined)
186
- return byPart(changeCase.pascalCase, false);
187
- if (convention === "keep")
188
- return (name) => name;
189
- if (typeof convention === "function")
190
- return byPart(convention, false);
191
- if (typeof convention === "string")
192
- return byPart(caseNamed(convention), false);
193
- const { typeNames, transformUnderscore } = convention;
194
- if (typeNames === "keep")
195
- return (name) => name;
196
- if (typeNames === undefined)
197
- return byPart(changeCase.pascalCase, transformUnderscore ?? false);
198
- const fn = typeof typeNames === "function" ? typeNames : caseNamed(typeNames);
199
- return byPart(fn, true);
200
- }
201
- function caseNamed(spec) {
202
- const [module = "", name = ""] = spec.split("#");
203
- const fn = cases[module]?.[name];
204
- if (fn)
205
- return fn;
206
- throw new Error(`@nxgt/graphql-codegen-zod: namingConvention "${spec}" is not one this plugin reads. Use 'keep', a function, or 'change-case-all#<case>' with one of ${Object.keys(cases["change-case-all"] ?? {}).join(", ")}.`);
207
- }
208
-
209
114
  // src/objects-output.ts
210
115
  import {
211
116
  GraphQLBoolean as GraphQLBoolean2,
@@ -297,7 +202,9 @@ function objectMembers(members) {
297
202
  `);
298
203
  }
299
204
  function declare(typeName, naming, code, side, description) {
300
- const schemaName = naming.schema(typeName);
205
+ return declareNamed(naming.schema(typeName), typeName, code, side, description);
206
+ }
207
+ function declareNamed(schemaName, typeName, code, side, description) {
301
208
  const doc = docComment(description);
302
209
  return `${doc}export const ${schemaName} = ${code};
303
210
  ${doc}export type ${typeName} = z.${side}<typeof ${schemaName}>;`;
@@ -980,8 +887,9 @@ function variablesBlocks(schema, documents, writer, naming) {
980
887
  writer.value(type, constraints, where, definition.defaultValue)
981
888
  ];
982
889
  });
890
+ const { type, schema: schemaName } = naming.variablesSchema(operationName, operation.operation);
983
891
  return [
984
- declare(naming.variables(operationName, operation.operation), naming, `z.object({
892
+ declareNamed(schemaName, type, `z.object({
985
893
  ${objectMembers(members)}
986
894
  })`, "input")
987
895
  ];
@@ -1200,5 +1108,5 @@ export {
1200
1108
  plugin
1201
1109
  };
1202
1110
 
1203
- //# debugId=895C9FE6E284857764756E2164756E21
1111
+ //# debugId=5F52FA4EFBAE877564756E2164756E21
1204
1112
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1,16 +1,15 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/index.ts", "../src/modules.ts", "../src/formats.ts", "../src/imports.ts", "../src/naming.ts", "../src/objects-output.ts", "../src/cycles.ts", "../src/output-types.ts", "../src/source.ts", "../src/results-output.ts", "../src/results-selections.ts", "../src/collect-fields.ts", "../src/scalars.ts", "../src/schema-output.ts", "../src/defaults.ts", "../src/type-code.ts", "../src/variables-output.ts", "../src/writer.ts"],
3
+ "sources": ["../src/index.ts", "../src/modules.ts", "../src/formats.ts", "../src/imports.ts", "../src/objects-output.ts", "../src/cycles.ts", "../src/output-types.ts", "../src/source.ts", "../src/results-output.ts", "../src/results-selections.ts", "../src/collect-fields.ts", "../src/scalars.ts", "../src/schema-output.ts", "../src/defaults.ts", "../src/type-code.ts", "../src/variables-output.ts", "../src/writer.ts"],
4
4
  "sourcesContent": [
5
5
  "import { checkConstraints } from '@nxgt/graphql-validation/codegen';\nimport {\n\ttype GraphQLSchema,\n\tisInputObjectType,\n\tisInterfaceType,\n\tisObjectType,\n} from 'graphql';\nimport type { CodegenZodConfig, DocumentFile } from './config';\nimport { FormatSources } from './formats';\nimport { Imports } from './imports';\nimport { Naming } from './naming';\nimport { objectBlocks } from './objects-output';\nimport { resultsBlocks } from './results-output';\nimport { ScalarSources } from './scalars';\nimport { schemaBlocks } from './schema-output';\nimport { variablesBlocks } from './variables-output';\nimport { Writer } from './writer';\n\nexport type { CodegenZodConfig, DocumentFile } from './config';\n\n/**\n * The graphql-codegen plugin: Zod schemas, and their types, for the\n * schema's enums, input types, field arguments, object types, interfaces and\n * unions, and for the variables of each operation in `documents`, with every `@constraint` of\n * `@nxgt/graphql-validation`. It refuses a schema `withValidation` would\n * refuse, with the same message.\n */\nexport async function plugin(\n\tschema: GraphQLSchema,\n\tdocuments: readonly DocumentFile[],\n\tconfig: CodegenZodConfig = {},\n\tinfo?: { readonly outputFile?: string | undefined },\n): Promise<string> {\n\tconst formats = await FormatSources.load(config, info?.outputFile);\n\tconst directive = checkConstraints(schema, undefined, formats.schemas);\n\tif (directive) assertSdl(schema);\n\tconst naming = new Naming(config);\n\tconst write = async (imports: Imports) => {\n\t\tconst scalars = await ScalarSources.load(config, imports, info?.outputFile);\n\t\tconst writer = new Writer(directive, naming, scalars, formats.for(imports));\n\t\treturn [\n\t\t\t...schemaBlocks(schema, writer, naming),\n\t\t\t...(config.objects === false ? [] : objectBlocks(schema, writer, naming)),\n\t\t\t...variablesBlocks(schema, documents, writer, naming),\n\t\t\t...(config.operations === false\n\t\t\t\t? []\n\t\t\t\t: resultsBlocks(schema, documents, writer, naming)),\n\t\t];\n\t};\n\t// Written twice: the first pass names what the file declares, so the\n\t// second gives no import one of those names.\n\tconst declarations = (await write(new Imports())).flatMap((block) =>\n\t\t[...block.matchAll(/^(?:export )?(const|type) ([\\w$]+)/gm)].map(\n\t\t\t(m) => `${m[1]} ${m[2]}`,\n\t\t),\n\t);\n\t// A value and a type may share a name; two of one kind may not.\n\tconst twice = declarations.find(\n\t\t(declaration, index) => declarations.indexOf(declaration) !== index,\n\t);\n\tif (twice)\n\t\tthrow new Error(\n\t\t\t`@nxgt/graphql-codegen-zod: the file would declare ${twice.split(' ')[1]} twice: two GraphQL names, or a type in a cycle and its Input or Wire type, give the same name. Rename one of the GraphQL types or operations, set typesSuffix, or set objects: false or operations: false.`,\n\t\t);\n\tconst declared = declarations.map(\n\t\t(declaration) => declaration.split(' ')[1] ?? '',\n\t);\n\tconst imports = new Imports(declared);\n\tconst blocks = await write(imports);\n\treturn `${imports.lines().join('\\n')}\\n\\n${blocks.join('\\n\\n')}\\n`;\n}\n\n/**\n * Fails on a schema that declares `@constraint` but was built without its\n * SDL (introspected, loaded from a URL): its arguments carry no directives\n * to read, and every constraint would be dropped in silence.\n */\nfunction assertSdl(schema: GraphQLSchema): void {\n\tfor (const type of Object.values(schema.getTypeMap())) {\n\t\tif (type.name.startsWith('__')) continue;\n\t\tconst inputs = isInputObjectType(type)\n\t\t\t? Object.values(type.getFields())\n\t\t\t: isObjectType(type) || isInterfaceType(type)\n\t\t\t\t? Object.values(type.getFields()).flatMap((field) => field.args)\n\t\t\t\t: [];\n\t\tconst bare = inputs.find((input) => !input.astNode);\n\t\tif (bare) {\n\t\t\tthrow new Error(\n\t\t\t\t`@nxgt/graphql-codegen-zod: the schema declares @constraint, but ${type.name} has no SDL to read it from (an introspected schema?). Point codegen's schema at the SDL files.`,\n\t\t\t);\n\t\t}\n\t}\n}\n",
6
6
  "import { createRequire } from 'node:module';\nimport { dirname, resolve } from 'node:path';\nimport { pathToFileURL } from 'node:url';\n\n/**\n * Imports a module the config names as the generated file will: a path\n * relative to `outputFile` (`'./formats'`), or a package resolved from the\n * working directory (`'@nxgt/graphql-scalars'`). Throws what resolving or\n * loading throws.\n */\nexport async function importModule(\n\tmodule: string,\n\toutputFile: string | undefined,\n): Promise<Readonly<Record<string, unknown>>> {\n\tconst path = module.startsWith('.')\n\t\t? resolve(dirname(resolve(outputFile ?? 'index.ts')), module)\n\t\t: createRequire(resolve('package.json')).resolve(module);\n\treturn import(pathToFileURL(path).href);\n}\n\n/** `'<module>#<export>'` split in two, or an error naming the option. */\nexport function moduleExport(\n\toption: string,\n\tvalue: string,\n\texample: string,\n): { readonly module: string; readonly exported: string } {\n\tconst at = value.lastIndexOf('#');\n\tif (at <= 0 || at === value.length - 1) {\n\t\tthrow new Error(\n\t\t\t`@nxgt/graphql-codegen-zod: ${option} is \"${value}\"; write it '<module>#<export>', e.g. '${example}'.`,\n\t\t);\n\t}\n\treturn { module: value.slice(0, at), exported: value.slice(at + 1) };\n}\n",
7
7
  "import type { FormatSchemas } from '@nxgt/graphql-validation/codegen';\nimport type { CodegenZodConfig } from './config';\nimport type { Imports } from './imports';\nimport { importModule, moduleExport } from './modules';\n\n/** Where one format's schema is imported from, in the generated file. */\ninterface Source {\n\treadonly module: string;\n\treadonly exported: string;\n\t/** The format's key in a `formatSchemas` record, if it comes from one. */\n\treadonly key?: string;\n}\n\n/** The application's formats as the writer needs them for one file. */\nexport interface FormatCode {\n\t/** The record `checkConstraints` and `inputCode` take; none when unset. */\n\treadonly schemas: FormatSchemas | undefined;\n\t/** The source of a format's schema, its import added. */\n\treadonly code: (name: string) => string;\n}\n\n/**\n * The application's own formats: `zodFormats` entries, winning over the\n * `formatSchemas` record. Unlike a scalar record, each module is loaded,\n * never trusted: the plugin checks every format, and every default against\n * it, as `withValidation` does, so a module it cannot load fails generation.\n */\nexport class FormatSources {\n\t/** The record `checkConstraints` and `inputCode` take; none when unset. */\n\treadonly schemas: FormatSchemas | undefined;\n\treadonly #sources: ReadonlyMap<string, Source>;\n\n\tprivate constructor(\n\t\tschemas: FormatSchemas | undefined,\n\t\tsources: ReadonlyMap<string, Source>,\n\t) {\n\t\tthis.schemas = schemas;\n\t\tthis.#sources = sources;\n\t}\n\n\tstatic async load(\n\t\tconfig: CodegenZodConfig,\n\t\toutputFile: string | undefined,\n\t): Promise<FormatSources> {\n\t\tconst schemas: Record<string, unknown> = {};\n\t\tconst sources = new Map<string, Source>();\n\t\tconst record = config.formatSchemas;\n\t\tif (record) {\n\t\t\tconst loaded = (await load('formatSchemas', record, outputFile))[\n\t\t\t\t'formatSchemas'\n\t\t\t];\n\t\t\tif (\n\t\t\t\ttypeof loaded !== 'object' ||\n\t\t\t\tloaded === null ||\n\t\t\t\tArray.isArray(loaded)\n\t\t\t) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`@nxgt/graphql-codegen-zod: ${record} exports no formatSchemas record.`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tfor (const [key, schema] of Object.entries(loaded)) {\n\t\t\t\tschemas[key] = schema;\n\t\t\t\tsources.set(key, { module: record, exported: 'formatSchemas', key });\n\t\t\t}\n\t\t}\n\t\tfor (const [name, value] of Object.entries(config.zodFormats ?? {})) {\n\t\t\tconst option = `zodFormats.${name}`;\n\t\t\tconst { module, exported } = moduleExport(\n\t\t\t\toption,\n\t\t\t\tvalue,\n\t\t\t\t'./slug#slugSchema',\n\t\t\t);\n\t\t\tconst loaded = await load(option, module, outputFile);\n\t\t\tif (!Object.hasOwn(loaded, exported)) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`@nxgt/graphql-codegen-zod: ${module} exports no ${exported} (${option}).`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tschemas[name] = loaded[exported];\n\t\t\tsources.set(name, { module, exported });\n\t\t}\n\t\t// Each schema is checked by checkConstraints, as withValidation checks it.\n\t\treturn new FormatSources(\n\t\t\tsources.size > 0 || record ? (schemas as FormatSchemas) : undefined,\n\t\t\tsources,\n\t\t);\n\t}\n\n\t/** The formats as written into a file whose imports are `imports`. */\n\tfor(imports: Imports): FormatCode {\n\t\treturn {\n\t\t\tschemas: this.schemas,\n\t\t\tcode: (name) => {\n\t\t\t\tconst source = this.#sources.get(name);\n\t\t\t\t// inputCode asks only for a format of the record it was given.\n\t\t\t\tif (!source) throw new Error(`Unknown application format \"${name}\".`);\n\t\t\t\tconst local = imports.add(source.module, source.exported);\n\t\t\t\tif (source.key === undefined) return local;\n\t\t\t\treturn /^[a-z][a-z0-9]*$/.test(source.key)\n\t\t\t\t\t? `${local}.${source.key}`\n\t\t\t\t\t: `${local}[${JSON.stringify(source.key)}]`;\n\t\t\t},\n\t\t};\n\t}\n}\n\n/** The module, or an error that says why it could not be loaded and what to do. */\nasync function load(\n\toption: string,\n\tmodule: string,\n\toutputFile: string | undefined,\n): Promise<Readonly<Record<string, unknown>>> {\n\ttry {\n\t\treturn await importModule(module, outputFile);\n\t} catch (error) {\n\t\tconst cause = error instanceof Error ? error.message : String(error);\n\t\tthrow new Error(\n\t\t\t`@nxgt/graphql-codegen-zod: cannot load ${module} (${option}): ${cause}. The plugin checks your formats as withValidation does, so it must import them: point ${option} at a module graphql-codegen can load: a path relative to the generated file or a package, in JavaScript, or in TypeScript when codegen runs under Bun or tsx.`,\n\t\t);\n\t}\n}\n",
8
8
  "/**\n * The named imports of the generated file, one line per module, an alias\n * when two modules export the same name.\n */\nexport class Imports {\n\treadonly #byModule = new Map<string, Map<string, string>>([\n\t\t['zod', new Map([['z', 'z']])],\n\t]);\n\treadonly #taken: Set<string>;\n\n\t/** `reserved`: the names the file declares, which no import may take. */\n\tconstructor(reserved: Iterable<string> = []) {\n\t\tthis.#taken = new Set(['z', ...reserved]);\n\t}\n\n\t/** The local name `exported` from `module` is reached by. */\n\tadd(module: string, exported: string): string {\n\t\tconst names = this.#byModule.get(module) ?? new Map<string, string>();\n\t\tthis.#byModule.set(module, names);\n\t\tconst known = names.get(exported);\n\t\tif (known) return known;\n\t\tlet local = exported;\n\t\tfor (let n = 2; this.#taken.has(local); n++) local = `${exported}${n}`;\n\t\tthis.#taken.add(local);\n\t\tnames.set(exported, local);\n\t\treturn local;\n\t}\n\n\t/** The import lines, `zod` first, double-quoted as every string the file holds. */\n\tlines(): string[] {\n\t\treturn [...this.#byModule].map(\n\t\t\t([module, names]) =>\n\t\t\t\t`import { ${[...names]\n\t\t\t\t\t.map(([exported, local]) =>\n\t\t\t\t\t\texported === local ? local : `${exported} as ${local}`,\n\t\t\t\t\t)\n\t\t\t\t\t.join(', ')} } from ${JSON.stringify(module)};`,\n\t\t);\n\t}\n}\n",
9
- "import * as changeCase from 'change-case';\nimport type { OperationTypeNode } from 'graphql';\nimport type { CodegenZodConfig } from './config';\n\n/**\n * The names of what the plugin writes: each type as\n * `@graphql-codegen/typescript` and `typescript-operations` name it, each\n * schema the same name behind `schemaPrefix`.\n */\nexport class Naming {\n\treadonly #config: CodegenZodConfig;\n\treadonly #convert: (name: string) => string;\n\n\tconstructor(config: CodegenZodConfig) {\n\t\tthis.#config = config;\n\t\tthis.#convert = converter(config.namingConvention);\n\t}\n\n\t/** An input type's or an enum's type name: `SignUpInput`. */\n\ttype(name: string): string {\n\t\treturn this.#wrap(this.#convert(name));\n\t}\n\n\t/** A field's arguments type name: `MutationSignUpArgs`. */\n\targs(parent: string, field: string): string {\n\t\tconst underscore = this.#config.addUnderscoreToArgsType ? '_' : '';\n\t\treturn this.#wrap(\n\t\t\tthis.#convert(`${parent}${underscore}${this.#convert(field)}Args`),\n\t\t);\n\t}\n\n\t/** An operation's variables type name: `SignUpMutationVariables`. */\n\tvariables(operation: string, kind: OperationTypeNode): string {\n\t\treturn this.#wrap(\n\t\t\tthis.#convert(`${operation}${this.#suffix(operation, kind)}Variables`),\n\t\t);\n\t}\n\n\t/** An operation's result type name: `SignUpMutation`. */\n\tresult(operation: string, kind: OperationTypeNode): string {\n\t\treturn this.#wrap(\n\t\t\tthis.#convert(`${operation}${this.#suffix(operation, kind)}`),\n\t\t);\n\t}\n\n\t/** A fragment's type name: `UserFieldsFragment`. */\n\tfragment(name: string): string {\n\t\treturn this.#wrap(\n\t\t\tthis.#convert(`${name}${this.#suffix(name, 'fragment')}`),\n\t\t);\n\t}\n\n\t/** As visitor-plugin-common's `getOperationSuffix`, fragments included. */\n\t#suffix(operation: string, kind: OperationTypeNode | 'fragment'): string {\n\t\tconst type = changeCase.pascalCase(kind);\n\t\tconst { omitOperationSuffix, dedupeOperationSuffix } = this.#config;\n\t\treturn omitOperationSuffix ||\n\t\t\t(dedupeOperationSuffix &&\n\t\t\t\toperation.toLowerCase().endsWith(type.toLowerCase()))\n\t\t\t? ''\n\t\t\t: type;\n\t}\n\n\t/** The schema of the type named `type`: `zSignUpInput`. */\n\tschema(type: string): string {\n\t\treturn `${this.#config.schemaPrefix ?? 'z'}${type}`;\n\t}\n\n\t#wrap(name: string): string {\n\t\treturn `${this.#config.typesPrefix ?? ''}${name}${this.#config.typesSuffix ?? ''}`;\n\t}\n}\n\ntype Convention = NonNullable<CodegenZodConfig['namingConvention']>;\ntype Case = (name: string) => string;\n\nconst lowerCaseFirst: Case = (name) =>\n\tname.charAt(0).toLowerCase() + name.slice(1);\nconst upperCaseFirst: Case = (name) =>\n\tname.charAt(0).toUpperCase() + name.slice(1);\n\n/**\n * The cases a `namingConvention` string can name, by module: change-case-all\n * 2's names (what the typescript plugins resolve), and change-case 5's.\n */\nconst cases: Readonly<Record<string, Readonly<Record<string, Case>>>> = {\n\t'change-case-all': {\n\t\tcamelCase: changeCase.camelCase,\n\t\tcapitalCase: changeCase.capitalCase,\n\t\tconstantCase: changeCase.constantCase,\n\t\tdotCase: changeCase.dotCase,\n\t\theaderCase: changeCase.trainCase,\n\t\tnoCase: changeCase.noCase,\n\t\tparamCase: changeCase.kebabCase,\n\t\tpascalCase: changeCase.pascalCase,\n\t\tpathCase: changeCase.pathCase,\n\t\tsentenceCase: changeCase.sentenceCase,\n\t\tsnakeCase: changeCase.snakeCase,\n\t\tlowerCase: (name) => name.toLowerCase(),\n\t\tupperCase: (name) => name.toUpperCase(),\n\t\tlowerCaseFirst,\n\t\tupperCaseFirst,\n\t},\n\t'change-case': {\n\t\tcamelCase: changeCase.camelCase,\n\t\tcapitalCase: changeCase.capitalCase,\n\t\tconstantCase: changeCase.constantCase,\n\t\tdotCase: changeCase.dotCase,\n\t\tkebabCase: changeCase.kebabCase,\n\t\tnoCase: changeCase.noCase,\n\t\tpascalCase: changeCase.pascalCase,\n\t\tpascalSnakeCase: changeCase.pascalSnakeCase,\n\t\tpathCase: changeCase.pathCase,\n\t\tsentenceCase: changeCase.sentenceCase,\n\t\tsnakeCase: changeCase.snakeCase,\n\t\ttrainCase: changeCase.trainCase,\n\t},\n};\n\n/** Applies `fn` to each part between underscores, or to the whole name. */\nconst byPart =\n\t(fn: Case, transformUnderscore: boolean): Case =>\n\t(name) =>\n\t\ttransformUnderscore ? fn(name) : name.split('_').map(fn).join('_');\n\n/**\n * A `namingConvention` as `@graphql-codegen/visitor-plugin-common`'s\n * `convertFactory` reads it for type names: undefined is PascalCase per\n * part; `'keep'`; a `'change-case-all#<case>'` string or a function, per\n * part; an object's `typeNames`, on the whole name (upstream reads no\n * `transformUnderscore` there), or, without `typeNames`, PascalCase per\n * part unless `transformUnderscore` is true.\n * Enum values are written as they are, so `enumValues` is not read.\n */\nfunction converter(convention: Convention | undefined): Case {\n\tif (convention === undefined) return byPart(changeCase.pascalCase, false);\n\tif (convention === 'keep') return (name) => name;\n\tif (typeof convention === 'function') return byPart(convention, false);\n\tif (typeof convention === 'string')\n\t\treturn byPart(caseNamed(convention), false);\n\tconst { typeNames, transformUnderscore } = convention;\n\tif (typeNames === 'keep') return (name) => name;\n\tif (typeNames === undefined)\n\t\treturn byPart(changeCase.pascalCase, transformUnderscore ?? false);\n\tconst fn = typeof typeNames === 'function' ? typeNames : caseNamed(typeNames);\n\treturn byPart(fn, true);\n}\n\nfunction caseNamed(spec: string): Case {\n\tconst [module = '', name = ''] = spec.split('#');\n\tconst fn = cases[module]?.[name];\n\tif (fn) return fn;\n\tthrow new Error(\n\t\t`@nxgt/graphql-codegen-zod: namingConvention \"${spec}\" is not one this plugin reads. Use 'keep', a function, or 'change-case-all#<case>' with one of ${Object.keys(cases['change-case-all'] ?? {}).join(', ')}.`,\n\t);\n}\n",
10
9
  "import {\n\tGraphQLBoolean,\n\tGraphQLFloat,\n\tGraphQLID,\n\tGraphQLInt,\n\ttype GraphQLInterfaceType,\n\ttype GraphQLObjectType,\n\ttype GraphQLOutputType,\n\ttype GraphQLSchema,\n\tGraphQLString,\n\ttype GraphQLUnionType,\n\tgetNamedType,\n\tisAbstractType,\n\tisEnumType,\n\tisInterfaceType,\n\tisListType,\n\tisNonNullType,\n\tisObjectType,\n\tisScalarType,\n\tisUnionType,\n} from 'graphql';\nimport { outputCycles } from './cycles';\nimport type { Naming } from './naming';\nimport { declareCyclicObject, type OutputTypeContext } from './output-types';\nimport { declare, objectMembers } from './source';\nimport type { ValueCode, Writer } from './writer';\n\n/** The built-in scalars' schemas on the way out. */\nexport const builtIns: Readonly<Record<string, string>> = {\n\t[GraphQLString.name]: 'z.string()',\n\t[GraphQLID.name]: 'z.string()',\n\t[GraphQLInt.name]: 'z.int32()',\n\t[GraphQLFloat.name]: 'z.number()',\n\t[GraphQLBoolean.name]: 'z.boolean()',\n};\n\n/**\n * The SDL's output types: every object type, then every interface and\n * union, typed `z.output`, what a resolver returns once custom scalars are\n * decoded. A field the schema does not declare is dropped (`z.object`), and\n * `__typename` is optional, as a resolver rarely sets it; so an interface\n * or a union is a plain `z.union` of its object types. Interfaces and\n * unions come last: their union reads the object schemas when the module\n * loads, while objects reach each other through getters.\n */\nexport function objectBlocks(\n\tschema: GraphQLSchema,\n\twriter: Writer,\n\tnaming: Naming,\n): string[] {\n\tconst types = Object.values(schema.getTypeMap()).filter(\n\t\t(type) => !type.name.startsWith('__'),\n\t);\n\tconst context = { writer, naming, cyclic: outputCycles(schema) };\n\treturn [\n\t\t...types.filter(isObjectType).map((type) => objectBlock(type, context)),\n\t\t...types\n\t\t\t.filter(isAbstractType)\n\t\t\t.map((type) => abstractBlock(schema, type, naming)),\n\t];\n}\n\nfunction objectBlock(\n\ttype: GraphQLObjectType,\n\tcontext: OutputTypeContext,\n): string {\n\tconst { writer, naming } = context;\n\tconst typename: ValueCode = {\n\t\tcode: `z.literal(${JSON.stringify(type.name)}).optional()`,\n\t\tlazy: false,\n\t};\n\tconst members = Object.values(type.getFields()).map(\n\t\t(field) =>\n\t\t\t[\n\t\t\t\tfield.name,\n\t\t\t\t{\n\t\t\t\t\t...outputCode(field.type, writer, naming),\n\t\t\t\t\tdescription: field.description,\n\t\t\t\t},\n\t\t\t] as const,\n\t);\n\tconst code = `z.object({\\n${objectMembers([['__typename', typename], ...members])}\\n})`;\n\treturn context.cyclic.has(type.name)\n\t\t? declareCyclicObject(type, code, context)\n\t\t: declare(naming.type(type.name), naming, code, 'output', type.description);\n}\n\nfunction abstractBlock(\n\tschema: GraphQLSchema,\n\ttype: GraphQLInterfaceType | GraphQLUnionType,\n\tnaming: Naming,\n): string {\n\tconst members = (\n\t\tisUnionType(type) ? type.getTypes() : schema.getPossibleTypes(type)\n\t).map((member) => naming.schema(naming.type(member.name)));\n\tconst code =\n\t\tmembers.length === 0\n\t\t\t? 'z.never()'\n\t\t\t: members.length === 1\n\t\t\t\t? (members[0] ?? 'z.never()')\n\t\t\t\t: `z.union([${members.join(', ')}])`;\n\treturn declare(\n\t\tnaming.type(type.name),\n\t\tnaming,\n\t\tcode,\n\t\t'output',\n\t\ttype.description,\n\t);\n}\n\n/** A field's schema: `.nullish()` unless non-null, a getter for a type. */\nfunction outputCode(\n\ttype: GraphQLOutputType,\n\twriter: Writer,\n\tnaming: Naming,\n): ValueCode {\n\tconst named = getNamedType(type);\n\tconst lazy = !isScalarType(named) && !isEnumType(named);\n\treturn { code: nullable(type, writer, naming), lazy };\n}\n\nfunction nullable(\n\ttype: GraphQLOutputType,\n\twriter: Writer,\n\tnaming: Naming,\n): string {\n\tif (isNonNullType(type)) return required(type.ofType, writer, naming);\n\treturn `${required(type, writer, naming)}.nullish()`;\n}\n\nfunction required(\n\ttype: GraphQLOutputType,\n\twriter: Writer,\n\tnaming: Naming,\n): string {\n\tif (isNonNullType(type)) return required(type.ofType, writer, naming);\n\tif (isListType(type))\n\t\treturn `z.array(${nullable(type.ofType, writer, naming)})`;\n\tif (isScalarType(type)) return builtIns[type.name] ?? writer.scalarCode(type);\n\tif (isEnumType(type)) return writer.schemaName(type);\n\tif (isObjectType(type) || isInterfaceType(type) || isUnionType(type))\n\t\treturn naming.schema(naming.type(type.name));\n\treturn 'z.never()';\n}\n",
11
10
  "import {\n\ttype GraphQLNamedType,\n\ttype GraphQLSchema,\n\tgetNamedType,\n\tisAbstractType,\n\tisInputObjectType,\n\tisInterfaceType,\n\tisObjectType,\n} from 'graphql';\n\n/**\n * The input types that reach themselves through their fields, directly\n * (`Filter.and: [Filter]`) or through others: TypeScript cannot infer the\n * schema of such a type once a field wraps it, so the plugin writes their\n * types out.\n */\nexport function inputCycles(schema: GraphQLSchema): ReadonlySet<string> {\n\treturn cycles(\n\t\tObject.values(schema.getTypeMap()).filter(isInputObjectType),\n\t\t(type) =>\n\t\t\tisInputObjectType(type)\n\t\t\t\t? Object.values(type.getFields())\n\t\t\t\t\t\t.map((field) => getNamedType(field.type))\n\t\t\t\t\t\t.filter(isInputObjectType)\n\t\t\t\t: [],\n\t);\n}\n\n/**\n * The object types that reach themselves through their fields, an\n * interface's or a union's members included: TypeScript infers such a\n * schema only so deep (TS2589 past a loop of ten), so the plugin writes\n * their types out.\n */\nexport function outputCycles(schema: GraphQLSchema): ReadonlySet<string> {\n\treturn cycles(\n\t\tObject.values(schema.getTypeMap()).filter(\n\t\t\t(type) => isObjectType(type) && !type.name.startsWith('__'),\n\t\t),\n\t\t(type) => {\n\t\t\tif (isAbstractType(type)) return schema.getPossibleTypes(type);\n\t\t\tif (!isObjectType(type) && !isInterfaceType(type)) return [];\n\t\t\treturn Object.values(type.getFields())\n\t\t\t\t.map((field) => getNamedType(field.type))\n\t\t\t\t.filter((named) => isObjectType(named) || isAbstractType(named));\n\t\t},\n\t);\n}\n\nfunction cycles(\n\tstarts: readonly GraphQLNamedType[],\n\tnext: (type: GraphQLNamedType) => readonly GraphQLNamedType[],\n): ReadonlySet<string> {\n\tconst reaches = (\n\t\tfrom: GraphQLNamedType,\n\t\ttarget: string,\n\t\tseen: Set<string>,\n\t): boolean =>\n\t\tnext(from).some((named) => {\n\t\t\tif (named.name === target) return true;\n\t\t\tif (seen.has(named.name)) return false;\n\t\t\tseen.add(named.name);\n\t\t\treturn reaches(named, target, seen);\n\t\t});\n\treturn new Set(\n\t\tstarts\n\t\t\t.filter((start) => reaches(start, start.name, new Set()))\n\t\t\t.map((start) => start.name),\n\t);\n}\n",
12
11
  "import {\n\tGraphQLBoolean,\n\ttype GraphQLField,\n\tGraphQLFloat,\n\tGraphQLID,\n\tGraphQLInt,\n\ttype GraphQLNamedOutputType,\n\ttype GraphQLObjectType,\n\ttype GraphQLOutputType,\n\tGraphQLString,\n\tisAbstractType,\n\tisEnumType,\n\tisListType,\n\tisNonNullType,\n\tisObjectType,\n} from 'graphql';\nimport type { Naming } from './naming';\nimport { docComment } from './source';\nimport type { Writer } from './writer';\n\ntype Side = 'input' | 'output';\n\nconst builtIns: Readonly<Record<string, string>> = {\n\t[GraphQLString.name]: 'string',\n\t[GraphQLID.name]: 'string',\n\t[GraphQLInt.name]: 'number',\n\t[GraphQLFloat.name]: 'number',\n\t[GraphQLBoolean.name]: 'boolean',\n};\n\n/**\n * An object type in a cycle, declared with its types written out, as an\n * input type in a cycle is: `User` (what a resolver returns, scalars\n * decoded), `UserWire` (the wire value, apart from an SDL `UserInput`) and `zUser` typed by both.\n */\nexport function declareCyclicObject(\n\ttype: GraphQLObjectType,\n\tcode: string,\n\tcontext: OutputTypeContext,\n): string {\n\tconst types = new OutputTypeCode(context);\n\tconst output = context.naming.type(type.name);\n\tconst input = `${output}Wire`;\n\tconst doc = docComment(type.description);\n\treturn [\n\t\t`${doc}export type ${output} = ${types.object(type, 'output')};`,\n\t\t`${doc}export type ${input} = ${types.object(type, 'input')};`,\n\t\t`${doc}export const ${context.naming.schema(output)}: z.ZodType<${output}, ${input}> = ${code};`,\n\t].join('\\n');\n}\n\nexport interface OutputTypeContext {\n\treadonly writer: Writer;\n\treadonly naming: Naming;\n\treadonly cyclic: ReadonlySet<string>;\n}\n\nclass OutputTypeCode {\n\treadonly #context: OutputTypeContext;\n\n\tconstructor(context: OutputTypeContext) {\n\t\tthis.#context = context;\n\t}\n\n\tobject(type: GraphQLObjectType, side: Side): string {\n\t\tconst members = [\n\t\t\t`\\t__typename?: ${JSON.stringify(type.name)} | undefined;`,\n\t\t\t...Object.values(type.getFields()).map(\n\t\t\t\t(field) =>\n\t\t\t\t\t`${docComment(field.description, '\\t')}\\t${this.#member(field, side)};`,\n\t\t\t),\n\t\t];\n\t\treturn `{\\n${members.join('\\n')}\\n}`;\n\t}\n\n\t#member(field: GraphQLField<unknown, unknown>, side: Side): string {\n\t\tconst type = this.#required(field.type, side);\n\t\treturn isNonNullType(field.type)\n\t\t\t? `${field.name}: ${type}`\n\t\t\t: `${field.name}?: ${type} | null | undefined`;\n\t}\n\n\t#required(type: GraphQLOutputType, side: Side): string {\n\t\tif (isNonNullType(type)) return this.#required(type.ofType, side);\n\t\tif (!isListType(type)) return this.#named(type, side);\n\t\tconst item = this.#required(type.ofType, side);\n\t\treturn isNonNullType(type.ofType)\n\t\t\t? `Array<${item}>`\n\t\t\t: `Array<${item} | null | undefined>`;\n\t}\n\n\t#named(type: GraphQLNamedOutputType, side: Side): string {\n\t\tconst { writer, naming, cyclic } = this.#context;\n\t\tconst builtIn = builtIns[type.name];\n\t\tif (builtIn) return builtIn;\n\t\tif (isEnumType(type)) return `z.output<typeof ${writer.schemaName(type)}>`;\n\t\t// The abstract type's own schema, inferred from its members': one\n\t\t// name per field, not its member list copied into each.\n\t\tif (isAbstractType(type))\n\t\t\treturn `z.${side}<typeof ${naming.schema(naming.type(type.name))}>`;\n\t\tif (isObjectType(type)) {\n\t\t\tconst name = naming.type(type.name);\n\t\t\tif (cyclic.has(type.name))\n\t\t\t\treturn side === 'output' ? name : `${name}Wire`;\n\t\t\treturn `z.${side}<typeof ${naming.schema(name)}>`;\n\t\t}\n\t\treturn `z.${side}<typeof ${writer.scalarCode(type)}>`;\n\t}\n}\n",
13
- "import type { Naming } from './naming';\nimport type { ValueCode } from './writer';\n\n/** A GraphQL description as a doc comment, or nothing. */\nexport function docComment(\n\tdescription: string | null | undefined,\n\tindent = '',\n): string {\n\tif (!description) return '';\n\tconst lines = description\n\t\t.replaceAll('\\r\\n', '\\n')\n\t\t.replaceAll('*/', '*\\\\/')\n\t\t.split('\\n');\n\tif (lines.length === 1) return `${indent}/** ${lines[0]} */\\n`;\n\treturn `${indent}/**\\n${lines.map((line) => `${indent} * ${line}`.trimEnd()).join('\\n')}\\n${indent} */\\n`;\n}\n\n/** The members of a `z.object({...})`, a getter for each lazy one. */\nexport function objectMembers(\n\tmembers: readonly (readonly [string, ValueCode])[],\n): string {\n\treturn members\n\t\t.map(([name, { code, lazy, description }]) => {\n\t\t\tconst doc = docComment(description, '\\t');\n\t\t\treturn lazy\n\t\t\t\t? `${doc}\\tget ${name}() {\\n\\t\\treturn ${code};\\n\\t},`\n\t\t\t\t: `${doc}\\t${name}: ${code},`;\n\t\t})\n\t\t.join('\\n');\n}\n\n/** `export const zX = …; export type X = z.output<typeof zX>;` */\nexport function declare(\n\ttypeName: string,\n\tnaming: Naming,\n\tcode: string,\n\tside: 'input' | 'output',\n\tdescription?: string | null,\n): string {\n\tconst schemaName = naming.schema(typeName);\n\tconst doc = docComment(description);\n\treturn `${doc}export const ${schemaName} = ${code};\\n${doc}export type ${typeName} = z.${side}<typeof ${schemaName}>;`;\n}\n",
12
+ "import type { Naming } from './naming';\nimport type { ValueCode } from './writer';\n\n/** A GraphQL description as a doc comment, or nothing. */\nexport function docComment(\n\tdescription: string | null | undefined,\n\tindent = '',\n): string {\n\tif (!description) return '';\n\tconst lines = description\n\t\t.replaceAll('\\r\\n', '\\n')\n\t\t.replaceAll('*/', '*\\\\/')\n\t\t.split('\\n');\n\tif (lines.length === 1) return `${indent}/** ${lines[0]} */\\n`;\n\treturn `${indent}/**\\n${lines.map((line) => `${indent} * ${line}`.trimEnd()).join('\\n')}\\n${indent} */\\n`;\n}\n\n/** The members of a `z.object({...})`, a getter for each lazy one. */\nexport function objectMembers(\n\tmembers: readonly (readonly [string, ValueCode])[],\n): string {\n\treturn members\n\t\t.map(([name, { code, lazy, description }]) => {\n\t\t\tconst doc = docComment(description, '\\t');\n\t\t\treturn lazy\n\t\t\t\t? `${doc}\\tget ${name}() {\\n\\t\\treturn ${code};\\n\\t},`\n\t\t\t\t: `${doc}\\t${name}: ${code},`;\n\t\t})\n\t\t.join('\\n');\n}\n\n/** `export const zX = …; export type X = z.output<typeof zX>;` */\nexport function declare(\n\ttypeName: string,\n\tnaming: Naming,\n\tcode: string,\n\tside: 'input' | 'output',\n\tdescription?: string | null,\n): string {\n\treturn declareNamed(\n\t\tnaming.schema(typeName),\n\t\ttypeName,\n\t\tcode,\n\t\tside,\n\t\tdescription,\n\t);\n}\n\n/** As `declare`, with the schema's name already computed. */\nexport function declareNamed(\n\tschemaName: string,\n\ttypeName: string,\n\tcode: string,\n\tside: 'input' | 'output',\n\tdescription?: string | null,\n): string {\n\tconst doc = docComment(description);\n\treturn `${doc}export const ${schemaName} = ${code};\\n${doc}export type ${typeName} = z.${side}<typeof ${schemaName}>;`;\n}\n",
14
13
  "import {\n\ttype FragmentDefinitionNode,\n\ttype GraphQLSchema,\n\tisCompositeType,\n\tKind,\n\ttype OperationDefinitionNode,\n} from 'graphql';\nimport type { DocumentFile } from './config';\nimport type { Naming } from './naming';\nimport { Selections } from './results-selections';\nimport { declare } from './source';\nimport type { Writer } from './writer';\n\n/**\n * One schema per fragment and per named operation in `documents`, for the\n * response as it arrives: what was selected, under its alias, custom\n * scalars decoded (`z.output`). A fragment spread is inlined. An abstract\n * type's selection is one object when its possible types select the same,\n * else a union discriminated on `__typename`, which must then be selected;\n * possible types that select the same share one member, `__typename:\n * z.enum([...])`. A field under `@skip`, `@include` or `@defer` may be\n * absent. An unknown field is dropped (`z.object`).\n */\nexport function resultsBlocks(\n\tschema: GraphQLSchema,\n\tdocuments: readonly DocumentFile[],\n\twriter: Writer,\n\tnaming: Naming,\n): string[] {\n\tconst definitions = documents.flatMap(\n\t\t(file) => file.document?.definitions ?? [],\n\t);\n\tconst fragments = new Map(\n\t\tdefinitions\n\t\t\t.filter(\n\t\t\t\t(node): node is FragmentDefinitionNode =>\n\t\t\t\t\tnode.kind === Kind.FRAGMENT_DEFINITION,\n\t\t\t)\n\t\t\t.map((node) => [node.name.value, node]),\n\t);\n\tconst selections = new Selections(schema, fragments, writer);\n\tconst block = (\n\t\ttypeName: string,\n\t\twritten: { readonly hoisted: string[]; readonly code: string },\n\t) =>\n\t\t[\n\t\t\t...written.hoisted,\n\t\t\tdeclare(typeName, naming, written.code, 'output'),\n\t\t].join('\\n');\n\treturn [\n\t\t...[...fragments.values()].flatMap((fragment) => {\n\t\t\tconst type = schema.getType(fragment.typeCondition.name.value);\n\t\t\tif (!isCompositeType(type)) return [];\n\t\t\tconst typeName = naming.fragment(fragment.name.value);\n\t\t\tconst set = { set: fragment.selectionSet, conditional: false };\n\t\t\treturn [\n\t\t\t\tblock(\n\t\t\t\t\ttypeName,\n\t\t\t\t\tselections.declare(\n\t\t\t\t\t\tnaming.schema(typeName),\n\t\t\t\t\t\ttype,\n\t\t\t\t\t\t[set],\n\t\t\t\t\t\t`fragment ${fragment.name.value}`,\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t];\n\t\t}),\n\t\t...definitions\n\t\t\t.filter(\n\t\t\t\t(node): node is OperationDefinitionNode =>\n\t\t\t\t\tnode.kind === Kind.OPERATION_DEFINITION,\n\t\t\t)\n\t\t\t.flatMap((operation) => {\n\t\t\t\tconst name = operation.name?.value;\n\t\t\t\tconst root = schema.getRootType(operation.operation);\n\t\t\t\tif (!name || !root) return [];\n\t\t\t\tconst typeName = naming.result(name, operation.operation);\n\t\t\t\tconst set = { set: operation.selectionSet, conditional: false };\n\t\t\t\treturn [\n\t\t\t\t\tblock(\n\t\t\t\t\t\ttypeName,\n\t\t\t\t\t\tselections.declare(naming.schema(typeName), root, [set], name),\n\t\t\t\t\t),\n\t\t\t\t];\n\t\t\t}),\n\t];\n}\n",
15
14
  "import {\n\ttype FragmentDefinitionNode,\n\ttype GraphQLAbstractType,\n\ttype GraphQLCompositeType,\n\ttype GraphQLObjectType,\n\ttype GraphQLOutputType,\n\ttype GraphQLSchema,\n\tisEnumType,\n\tisListType,\n\tisNonNullType,\n\tisObjectType,\n\tisScalarType,\n} from 'graphql';\nimport { type Collected, collectFields, type Selected } from './collect-fields';\nimport { builtIns } from './objects-output';\nimport type { Writer } from './writer';\n\nconst failure = '@nxgt/graphql-codegen-zod:';\n// Where a member's `__typename` goes, filled once its group is known. No\n// GraphQL name and no module path holds a NUL.\nconst typename = '\\u0000typename\\u0000';\n// Past this many nested selections, one is declared as its own const:\n// TypeScript infers nested `z.object`s only so deep (TS2589 at 14).\nconst hoistDepth = 5;\n\n/**\n * The schema of a selection, for a response: what was selected, under its\n * alias. Deep selections are declared apart, as `<schema>$<n>`, which the\n * caller writes before the schema that uses them.\n */\nexport class Selections {\n\treadonly #schema: GraphQLSchema;\n\treadonly #fragments: ReadonlyMap<string, FragmentDefinitionNode>;\n\treadonly #writer: Writer;\n\t#hoisted = new Map<string, string>();\n\t#prefix = '';\n\n\tconstructor(\n\t\tschema: GraphQLSchema,\n\t\tfragments: ReadonlyMap<string, FragmentDefinitionNode>,\n\t\twriter: Writer,\n\t) {\n\t\tthis.#schema = schema;\n\t\tthis.#fragments = fragments;\n\t\tthis.#writer = writer;\n\t}\n\n\t/**\n\t * The schema `sets` select on `type`, declared as `name`, after the\n\t * consts it hoists. `path` names where, for errors.\n\t */\n\tdeclare(\n\t\tname: string,\n\t\ttype: GraphQLCompositeType,\n\t\tsets: readonly Selected[],\n\t\tpath: string,\n\t): { readonly hoisted: string[]; readonly code: string } {\n\t\tthis.#hoisted = new Map();\n\t\tthis.#prefix = name;\n\t\tconst code = this.#code(type, sets, [path], '', 0);\n\t\treturn {\n\t\t\t// Typed by an alias of its own inference: a reference to it then\n\t\t\t// starts TypeScript's depth over.\n\t\t\thoisted: [...this.#hoisted].map(\n\t\t\t\t([body, hoisted]) =>\n\t\t\t\t\t`const ${hoisted}$ = ${body};\\nconst ${hoisted}: z.ZodType<z.output<typeof ${hoisted}$>, z.input<typeof ${hoisted}$>> = ${hoisted}$;`,\n\t\t\t),\n\t\t\tcode,\n\t\t};\n\t}\n\n\t#code(\n\t\ttype: GraphQLCompositeType,\n\t\tsets: readonly Selected[],\n\t\tpath: readonly string[],\n\t\tindent: string,\n\t\tdepth: number,\n\t): string {\n\t\tif (depth >= hoistDepth) {\n\t\t\tconst body = this.#code(type, sets, path, '', 0);\n\t\t\tconst known = this.#hoisted.get(body);\n\t\t\tif (known) return known;\n\t\t\tconst name = `${this.#prefix}$${this.#hoisted.size + 1}`;\n\t\t\tthis.#hoisted.set(body, name);\n\t\t\treturn name;\n\t\t}\n\t\tif (isObjectType(type))\n\t\t\treturn this.#object(type, sets, path, indent, depth).replaceAll(\n\t\t\t\ttypename,\n\t\t\t\t`z.literal(${JSON.stringify(type.name)})`,\n\t\t\t);\n\t\treturn this.#abstract(type, sets, path, indent, depth);\n\t}\n\n\t/**\n\t * An interface's or a union's selection: one object per group of\n\t * possible types that select the same, a union discriminated on\n\t * `__typename` when there is more than one group.\n\t */\n\t#abstract(\n\t\ttype: GraphQLAbstractType,\n\t\tsets: readonly Selected[],\n\t\tpath: readonly string[],\n\t\tindent: string,\n\t\tdepth: number,\n\t): string {\n\t\tconst members = this.#schema.getPossibleTypes(type);\n\t\tif (members.length === 0) return 'z.never()';\n\t\tconst inner = `${indent}\\t`;\n\t\tconst groups = new Map<string, GraphQLObjectType[]>();\n\t\tconst keys = new Map<string, readonly string[]>();\n\t\tfor (const member of members) {\n\t\t\tconst code = this.#object(member, sets, path, inner, depth);\n\t\t\tgroups.set(code, [...(groups.get(code) ?? []), member]);\n\t\t\tkeys.set(\n\t\t\t\tmember.name,\n\t\t\t\t[...collectFields(this.#schema, this.#fragments, member, sets)]\n\t\t\t\t\t.filter(([, field]) => field.name === '__typename' && !field.optional)\n\t\t\t\t\t.map(([key]) => key),\n\t\t\t);\n\t\t}\n\t\tconst fill = (code: string, group: readonly GraphQLObjectType[]) => {\n\t\t\tconst names = group.map((member) => JSON.stringify(member.name));\n\t\t\treturn code.replaceAll(\n\t\t\t\ttypename,\n\t\t\t\tnames.length === 1\n\t\t\t\t\t? `z.literal(${names[0]})`\n\t\t\t\t\t: `z.enum([${names.join(', ')}])`,\n\t\t\t);\n\t\t};\n\t\tconst all = [...groups];\n\t\tif (all.length === 1) {\n\t\t\tconst [code = '', group = []] = all[0] ?? [];\n\t\t\t// Rendered one level in; back to this one.\n\t\t\treturn fill(code.replaceAll(`\\n${inner}`, `\\n${indent}`), group);\n\t\t}\n\t\tconst discriminator = this.#discriminator(type.name, keys, path);\n\t\treturn `z.discriminatedUnion(${JSON.stringify(discriminator)}, [\\n${all\n\t\t\t.map(([code, group]) => `${inner}${fill(code, group)},`)\n\t\t\t.join('\\n')}\\n${indent}])`;\n\t}\n\n\t/** The key every member selects `__typename` under, `__typename` first. */\n\t#discriminator(\n\t\ttype: string,\n\t\tkeys: ReadonlyMap<string, readonly string[]>,\n\t\tpath: readonly string[],\n\t): string {\n\t\tfor (const [member, selected] of keys)\n\t\t\tif (selected.length === 0)\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`${failure} ${path.join('.')} selects the abstract type ${type} without __typename for ${member}. Select __typename there, so the result tells its members apart.`,\n\t\t\t\t);\n\t\tconst lists = [...keys.values()];\n\t\tconst shared = (lists[0] ?? []).filter((key) =>\n\t\t\tlists.every((selected) => selected.includes(key)),\n\t\t);\n\t\tconst key = shared.includes('__typename') ? '__typename' : shared[0];\n\t\tif (key === undefined)\n\t\t\tthrow new Error(\n\t\t\t\t`${failure} ${path.join('.')} selects __typename under a different key for each member of ${type} (${[...new Set(lists.flat())].join(', ')}). Select it under one key for every member, so the result tells its members apart.`,\n\t\t\t);\n\t\treturn key;\n\t}\n\n\t/** An object type's selection, its `__typename` left to the caller. */\n\t#object(\n\t\ttype: GraphQLObjectType,\n\t\tsets: readonly Selected[],\n\t\tpath: readonly string[],\n\t\tindent: string,\n\t\tdepth: number,\n\t): string {\n\t\tconst inner = `${indent}\\t`;\n\t\tconst members = [\n\t\t\t...collectFields(this.#schema, this.#fragments, type, sets),\n\t\t].map(([key, field]) => {\n\t\t\tconst code = this.#field(type, field, [...path, key], inner, depth);\n\t\t\treturn `${inner}${key}: ${field.optional ? `${code}.optional()` : code},`;\n\t\t});\n\t\treturn members.length === 0\n\t\t\t? 'z.object({})'\n\t\t\t: `z.object({\\n${members.join('\\n')}\\n${indent}})`;\n\t}\n\n\t#field(\n\t\tparent: GraphQLObjectType,\n\t\tfield: Collected,\n\t\tpath: readonly string[],\n\t\tindent: string,\n\t\tdepth: number,\n\t): string {\n\t\tif (field.name === '__typename') return typename;\n\t\tconst definition = parent.getFields()[field.name];\n\t\t// An introspection field: `__schema`, `__type`.\n\t\tif (!definition) return 'z.unknown()';\n\t\t// A field selected by one conditional node is there only when that\n\t\t// condition held, so its sub-fields need not be optional again.\n\t\tconst implied = field.optional && field.nodes.length === 1;\n\t\tconst sets = field.nodes.flatMap(({ node, conditional }) =>\n\t\t\tnode.selectionSet\n\t\t\t\t? [{ set: node.selectionSet, conditional: conditional && !implied }]\n\t\t\t\t: [],\n\t\t);\n\t\treturn this.#nullable(definition.type, sets, path, indent, depth + 1);\n\t}\n\n\t#nullable(\n\t\ttype: GraphQLOutputType,\n\t\tsets: readonly Selected[],\n\t\tpath: readonly string[],\n\t\tindent: string,\n\t\tdepth: number,\n\t): string {\n\t\tif (isNonNullType(type))\n\t\t\treturn this.#required(type.ofType, sets, path, indent, depth);\n\t\treturn `${this.#required(type, sets, path, indent, depth)}.nullable()`;\n\t}\n\n\t#required(\n\t\ttype: GraphQLOutputType,\n\t\tsets: readonly Selected[],\n\t\tpath: readonly string[],\n\t\tindent: string,\n\t\tdepth: number,\n\t): string {\n\t\tif (isNonNullType(type))\n\t\t\treturn this.#required(type.ofType, sets, path, indent, depth);\n\t\tif (isListType(type))\n\t\t\treturn `z.array(${this.#nullable(type.ofType, sets, path, indent, depth)})`;\n\t\tif (isScalarType(type))\n\t\t\treturn builtIns[type.name] ?? this.#writer.scalarCode(type);\n\t\tif (isEnumType(type)) return this.#writer.schemaName(type);\n\t\treturn this.#code(type, sets, path, indent, depth);\n\t}\n}\n",
16
15
  "import {\n\ttype FieldNode,\n\ttype FragmentDefinitionNode,\n\ttype GraphQLObjectType,\n\ttype GraphQLSchema,\n\tisAbstractType,\n\tKind,\n\ttype SelectionNode,\n\ttype SelectionSetNode,\n} from 'graphql';\n\n/** A selection set, and whether the response may leave it out. */\nexport interface Selected {\n\treadonly set: SelectionSetNode;\n\treadonly conditional: boolean;\n}\n\n/** A response key: its field, every node selecting it, if it may be absent. */\nexport interface Collected {\n\treadonly name: string;\n\treadonly nodes: { readonly node: FieldNode; readonly conditional: boolean }[];\n\toptional: boolean;\n}\n\n/** The directives that may leave a selection out of the response. */\nconst conditions = new Set(['skip', 'include', 'defer']);\n\n/**\n * The fields `sets` select on `type`, by response key, as graphql's\n * CollectFields gathers them for every value of the variables: inline\n * fragments and spreads whose type condition `type` satisfies, the same\n * key's nodes merged, each node keeping whether it may be left out, so a\n * sub-field only a conditional node selects stays optional.\n */\nexport function collectFields(\n\tschema: GraphQLSchema,\n\tfragments: ReadonlyMap<string, FragmentDefinitionNode>,\n\ttype: GraphQLObjectType,\n\tsets: readonly Selected[],\n): Map<string, Collected> {\n\tconst fields = new Map<string, Collected>();\n\tconst applies = (condition: string): boolean => {\n\t\tconst named = schema.getType(condition);\n\t\tif (!named) return false;\n\t\tif (named.name === type.name) return true;\n\t\treturn isAbstractType(named) && schema.isSubType(named, type);\n\t};\n\tconst visit = (\n\t\tset: SelectionSetNode,\n\t\toptional: boolean,\n\t\tseen: ReadonlySet<string>,\n\t): void => {\n\t\tfor (const selection of set.selections) {\n\t\t\tconst conditional = optional || isConditional(selection);\n\t\t\tif (selection.kind === Kind.FIELD) {\n\t\t\t\tconst key = selection.alias?.value ?? selection.name.value;\n\t\t\t\tconst entry = { node: selection, conditional };\n\t\t\t\tconst field = fields.get(key);\n\t\t\t\tif (field) {\n\t\t\t\t\tfield.nodes.push(entry);\n\t\t\t\t\tfield.optional &&= conditional;\n\t\t\t\t} else\n\t\t\t\t\tfields.set(key, {\n\t\t\t\t\t\tname: selection.name.value,\n\t\t\t\t\t\tnodes: [entry],\n\t\t\t\t\t\toptional: conditional,\n\t\t\t\t\t});\n\t\t\t} else if (selection.kind === Kind.INLINE_FRAGMENT) {\n\t\t\t\tconst condition = selection.typeCondition?.name.value;\n\t\t\t\tif (!condition || applies(condition))\n\t\t\t\t\tvisit(selection.selectionSet, conditional, seen);\n\t\t\t} else {\n\t\t\t\tconst name = selection.name.value;\n\t\t\t\tconst fragment = fragments.get(name);\n\t\t\t\tif (\n\t\t\t\t\tfragment &&\n\t\t\t\t\t!seen.has(name) &&\n\t\t\t\t\tapplies(fragment.typeCondition.name.value)\n\t\t\t\t)\n\t\t\t\t\tvisit(fragment.selectionSet, conditional, new Set([...seen, name]));\n\t\t\t}\n\t\t}\n\t};\n\tfor (const { set, conditional } of sets) visit(set, conditional, new Set());\n\treturn fields;\n}\n\nfunction isConditional(selection: SelectionNode): boolean {\n\treturn (selection.directives ?? []).some((directive) =>\n\t\tconditions.has(directive.name.value),\n\t);\n}\n",
@@ -18,10 +17,10 @@
18
17
  "import { constraintsOn } from '@nxgt/graphql-validation/codegen';\nimport {\n\ttype GraphQLEnumType,\n\ttype GraphQLInputObjectType,\n\ttype GraphQLSchema,\n\tisEnumType,\n\tisInputObjectType,\n\tisInterfaceType,\n\tisObjectType,\n} from 'graphql';\nimport { inputCycles } from './cycles';\nimport { defaultLiteral } from './defaults';\nimport type { Naming } from './naming';\nimport { declare, objectMembers } from './source';\nimport { declareCyclic } from './type-code';\nimport type { Writer } from './writer';\n\n/**\n * The SDL's part of the file: every enum, then every input type, then the\n * arguments of every object and interface field that takes any. Types are\n * `z.output`: what a resolver receives once `withValidation` parsed them.\n */\nexport function schemaBlocks(\n\tschema: GraphQLSchema,\n\twriter: Writer,\n\tnaming: Naming,\n): string[] {\n\tconst types = Object.values(schema.getTypeMap()).filter(\n\t\t(type) => !type.name.startsWith('__'),\n\t);\n\tconst cyclic = inputCycles(schema);\n\treturn [\n\t\t...types.filter(isEnumType).map((type) => enumBlock(type, naming)),\n\t\t...types\n\t\t\t.filter(isInputObjectType)\n\t\t\t.map((type) => inputBlock(type, writer, naming, cyclic)),\n\t\t...types.flatMap((type) => {\n\t\t\tif (!isObjectType(type) && !isInterfaceType(type)) return [];\n\t\t\treturn Object.values(type.getFields())\n\t\t\t\t.filter((field) => field.args.length > 0)\n\t\t\t\t.map((field) => {\n\t\t\t\t\tconst name = naming.args(type.name, field.name);\n\t\t\t\t\tconst members = field.args.map(\n\t\t\t\t\t\t(arg) =>\n\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\targ.name,\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t...writer.value(\n\t\t\t\t\t\t\t\t\t\targ.type,\n\t\t\t\t\t\t\t\t\t\tconstraintsOn(writer.directive, arg.astNode),\n\t\t\t\t\t\t\t\t\t\t`${type.name}.${field.name}(${arg.name}:)`,\n\t\t\t\t\t\t\t\t\t\tdefaultLiteral(arg),\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tdescription: arg.description,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t] as const,\n\t\t\t\t\t);\n\t\t\t\t\treturn declare(\n\t\t\t\t\t\tname,\n\t\t\t\t\t\tnaming,\n\t\t\t\t\t\t`z.object({\\n${objectMembers(members)}\\n})`,\n\t\t\t\t\t\t'output',\n\t\t\t\t\t);\n\t\t\t\t});\n\t\t}),\n\t];\n}\n\nfunction enumBlock(type: GraphQLEnumType, naming: Naming): string {\n\tconst values = type.getValues().map((value) => JSON.stringify(value.name));\n\treturn declare(\n\t\tnaming.type(type.name),\n\t\tnaming,\n\t\t`z.enum([${values.join(', ')}])`,\n\t\t'output',\n\t\ttype.description,\n\t);\n}\n\nfunction inputBlock(\n\ttype: GraphQLInputObjectType,\n\twriter: Writer,\n\tnaming: Naming,\n\tcyclic: ReadonlySet<string>,\n): string {\n\tconst code = inputCode(type, writer);\n\treturn cyclic.has(type.name)\n\t\t? declareCyclic(type, code, writer, naming, cyclic)\n\t\t: declare(naming.type(type.name), naming, code, 'output', type.description);\n}\n\n/**\n * An input type's schema: strict, as graphql refuses a field the type does\n * not define; for `@oneOf`, a union of one set member each.\n */\nfunction inputCode(type: GraphQLInputObjectType, writer: Writer): string {\n\tconst fields = Object.values(type.getFields());\n\tconst constraints = (field: (typeof fields)[number]) =>\n\t\tconstraintsOn(writer.directive, field.astNode);\n\tconst where = (field: (typeof fields)[number]) =>\n\t\t`${type.name}.${field.name}`;\n\t// @oneOf: exactly one member, set.\n\tif (type.isOneOf) {\n\t\tconst members = fields.map((field) => {\n\t\t\tconst member = {\n\t\t\t\t...writer.required(field.type, constraints(field), where(field)),\n\t\t\t\tdescription: field.description,\n\t\t\t};\n\t\t\treturn `\\tz.strictObject({\\n${indent(objectMembers([[field.name, member]]))}\\n\\t})`;\n\t\t});\n\t\treturn `z.union([\\n${members.join(',\\n')},\\n])`;\n\t}\n\tconst members = fields.map(\n\t\t(field) =>\n\t\t\t[\n\t\t\t\tfield.name,\n\t\t\t\t{\n\t\t\t\t\t...writer.value(\n\t\t\t\t\t\tfield.type,\n\t\t\t\t\t\tconstraints(field),\n\t\t\t\t\t\twhere(field),\n\t\t\t\t\t\tdefaultLiteral(field),\n\t\t\t\t\t),\n\t\t\t\t\tdescription: field.description,\n\t\t\t\t},\n\t\t\t] as const,\n\t);\n\treturn `z.strictObject({\\n${objectMembers(members)}\\n})`;\n}\n\n/** Indents each line of `code` by one tab. */\nfunction indent(code: string): string {\n\treturn code\n\t\t.split('\\n')\n\t\t.map((line) => `\\t${line}`)\n\t\t.join('\\n');\n}\n",
19
18
  "import * as graphql from 'graphql';\nimport {\n\tastFromValue,\n\ttype ConstValueNode,\n\ttype GraphQLArgument,\n\tGraphQLID,\n\ttype GraphQLInputField,\n\ttype GraphQLInputType,\n\tgetNamedType,\n\tgetNullableType,\n\tisInputObjectType,\n\tisListType,\n\tisNonNullType,\n\tisScalarType,\n\tisSpecifiedScalarType,\n\tKind,\n\tvalueFromASTUntyped,\n} from 'graphql';\n\n/**\n * A default's value as the client parses it: its literal coerced as\n * graphql coerces it. An integer a JavaScript number cannot keep exact,\n * given to an ID or a custom scalar, fails, naming `where`: the server\n * would hand the scalar every digit. An Int or a Float rounds on both sides.\n */\nexport function parsedDefault(\n\tliteral: ConstValueNode,\n\ttype: GraphQLInputType,\n\twhere: string,\n): unknown {\n\tassertExact(literal, type, where);\n\treturn coerced(valueFromASTUntyped(literal), type);\n}\n\nfunction assertExact(\n\tliteral: ConstValueNode,\n\ttype: GraphQLInputType,\n\twhere: string,\n): void {\n\tconst nullable = getNullableType(type);\n\tif (isListType(nullable)) {\n\t\tconst items = literal.kind === Kind.LIST ? literal.values : [literal];\n\t\tfor (const item of items) assertExact(item, nullable.ofType, where);\n\t\treturn;\n\t}\n\tif (isInputObjectType(nullable)) {\n\t\tif (literal.kind !== Kind.OBJECT) return;\n\t\tconst fields = nullable.getFields();\n\t\tfor (const field of literal.fields) {\n\t\t\tconst definition = fields[field.name.value];\n\t\t\tif (definition) assertExact(field.value, definition.type, where);\n\t\t}\n\t\treturn;\n\t}\n\tconst keeps =\n\t\tnullable === GraphQLID ||\n\t\t(isScalarType(nullable) && !isSpecifiedScalarType(nullable));\n\tif (\n\t\tkeeps &&\n\t\tliteral.kind === Kind.INT &&\n\t\t!Number.isSafeInteger(Number(literal.value))\n\t)\n\t\tthrow new Error(\n\t\t\t`@nxgt/graphql-codegen-zod: the default of ${where} holds ${literal.value}, which a JavaScript number cannot keep exact. Write it as a string, if its scalar takes one.`,\n\t\t);\n}\n\n/**\n * The default of an argument or input field as a literal: its SDL's, or,\n * for a schema built without SDL (introspected), its value written back.\n * graphql 16 holds that value in `defaultValue`, graphql 17 in `default`.\n */\nexport function defaultLiteral(\n\tinput: GraphQLArgument | GraphQLInputField,\n): ConstValueNode | undefined {\n\tif (input.astNode) return input.astNode.defaultValue;\n\tconst loose = input as {\n\t\tdefaultValue?: unknown;\n\t\tdefault?: { value?: unknown; literal?: ConstValueNode };\n\t};\n\tif (loose.default?.literal) return loose.default.literal;\n\tif (loose.default) {\n\t\t// graphql 17: an external value, written back by valueToLiteral.\n\t\tconst toLiteral = (\n\t\t\tgraphql as {\n\t\t\t\tvalueToLiteral?: (\n\t\t\t\t\tvalue: unknown,\n\t\t\t\t\ttype: GraphQLInputType,\n\t\t\t\t) => ConstValueNode | undefined;\n\t\t\t}\n\t\t).valueToLiteral;\n\t\tif (loose.default.value === undefined || !toLiteral) return undefined;\n\t\treturn toLiteral(loose.default.value, input.type);\n\t}\n\t// graphql 16: an internal value, written back by astFromValue.\n\tif (loose.defaultValue === undefined) return undefined;\n\treturn (astFromValue(loose.defaultValue, input.type) ?? undefined) as\n\t\t| ConstValueNode\n\t\t| undefined;\n}\n\n/**\n * A default as graphql coerces it, through lists and input objects: a\n * single value given for a list is a list of it (`[String!] = \"a\"` is\n * `[\"a\"]`, `[[Int]] = 1` is `[[1]]`), at any depth.\n */\nexport function coerced(value: unknown, type: GraphQLInputType): unknown {\n\tconst nullable = isNonNullType(type) ? type.ofType : type;\n\tif (value === null || value === undefined) return value;\n\tif (isListType(nullable)) {\n\t\tconst items = Array.isArray(value) ? value : [value];\n\t\treturn items.map((item) => coerced(item, nullable.ofType));\n\t}\n\tif (isInputObjectType(nullable) && typeof value === 'object') {\n\t\tconst fields = nullable.getFields();\n\t\treturn Object.fromEntries(\n\t\t\tObject.entries(value as Record<string, unknown>).map(([key, field]) => {\n\t\t\t\tconst definition = fields[key];\n\t\t\t\treturn [key, definition ? coerced(field, definition.type) : field];\n\t\t\t}),\n\t\t);\n\t}\n\t// graphql takes an Int for an ID, and the resolver gets its string.\n\tif (getNamedType(nullable) === GraphQLID && typeof value === 'number')\n\t\treturn String(value);\n\treturn value;\n}\n",
20
19
  "import {\n\tGraphQLBoolean,\n\tGraphQLFloat,\n\tGraphQLID,\n\ttype GraphQLInputField,\n\ttype GraphQLInputObjectType,\n\ttype GraphQLInputType,\n\tGraphQLInt,\n\ttype GraphQLNamedInputType,\n\tGraphQLString,\n\tgetNamedType,\n\tisEnumType,\n\tisInputObjectType,\n\tisListType,\n\tisNonNullType,\n} from 'graphql';\nimport { defaultLiteral } from './defaults';\nimport type { Naming } from './naming';\nimport { docComment } from './source';\nimport type { Writer } from './writer';\n\ntype Side = 'input' | 'output';\n\nconst builtIns: Readonly<Record<string, string>> = {\n\t[GraphQLString.name]: 'string',\n\t[GraphQLID.name]: 'string',\n\t[GraphQLInt.name]: 'number',\n\t[GraphQLFloat.name]: 'number',\n\t[GraphQLBoolean.name]: 'boolean',\n};\n\n/**\n * An input type in a cycle, declared with its types written out, since\n * TypeScript cannot infer them: `Filter` (what the resolver receives),\n * `FilterInput` (what a client sends), and `zFilter` typed by both. The\n * schema's types must fit inside them, a type error otherwise; a type\n * written wider than the schema would compile, so test/types.ts pins them.\n */\nexport function declareCyclic(\n\ttype: GraphQLInputObjectType,\n\tcode: string,\n\twriter: Writer,\n\tnaming: Naming,\n\tcyclic: ReadonlySet<string>,\n): string {\n\tconst types = new TypeCode(writer, naming, cyclic);\n\tconst output = naming.type(type.name);\n\tconst input = `${output}Input`;\n\tconst doc = docComment(type.description);\n\treturn [\n\t\t`${doc}export type ${output} = ${types.object(type, 'output')};`,\n\t\t`${doc}export type ${input} = ${types.object(type, 'input')};`,\n\t\t`${doc}export const ${naming.schema(output)}: z.ZodType<${output}, ${input}> = ${code};`,\n\t].join('\\n');\n}\n\n/** The TypeScript type of a value, on the way in or on the way out. */\nclass TypeCode {\n\treadonly #writer: Writer;\n\treadonly #naming: Naming;\n\treadonly #cyclic: ReadonlySet<string>;\n\n\tconstructor(writer: Writer, naming: Naming, cyclic: ReadonlySet<string>) {\n\t\tthis.#writer = writer;\n\t\tthis.#naming = naming;\n\t\tthis.#cyclic = cyclic;\n\t}\n\n\t/** An input object's fields, or, for `@oneOf`, one member set. */\n\tobject(type: GraphQLInputObjectType, side: Side): string {\n\t\tconst fields = Object.values(type.getFields());\n\t\tif (type.isOneOf)\n\t\t\treturn fields\n\t\t\t\t.map(\n\t\t\t\t\t(field) => `{ ${field.name}: ${this.#required(field.type, side)} }`,\n\t\t\t\t)\n\t\t\t\t.join(' | ');\n\t\tconst members = fields.map(\n\t\t\t(field) =>\n\t\t\t\t`${docComment(field.description, '\\t')}\\t${this.#member(field, side)};`,\n\t\t);\n\t\treturn `{\\n${members.join('\\n')}\\n}`;\n\t}\n\n\t/**\n\t * A field as `Writer.value` writes it: optional on the way in when it\n\t * is nullable or has a default; on the way out, present when it has a\n\t * default, else optional when nullable.\n\t */\n\t#member(field: GraphQLInputField, side: Side): string {\n\t\tconst nullable = !isNonNullType(field.type);\n\t\tconst filled = defaultLiteral(field) !== undefined;\n\t\tconst type = this.#required(field.type, side);\n\t\tif (!nullable)\n\t\t\treturn side === 'input' && filled\n\t\t\t\t? `${field.name}?: ${type} | undefined`\n\t\t\t\t: `${field.name}: ${type}`;\n\t\tif (side === 'output' && filled) return `${field.name}: ${type} | null`;\n\t\treturn `${field.name}?: ${type} | null | undefined`;\n\t}\n\n\t/** `type` without its null: a list, a named type. */\n\t#required(type: GraphQLInputType, side: Side): string {\n\t\tif (isNonNullType(type)) return this.#required(type.ofType, side);\n\t\tif (!isListType(type)) return this.#named(type, side);\n\t\tconst item = isNonNullType(type.ofType)\n\t\t\t? this.#required(type.ofType, side)\n\t\t\t: `${this.#required(type.ofType, side)} | null | undefined`;\n\t\tconst list = `Array<${item}>`;\n\t\t// A single value for a list, as `Writer` takes it.\n\t\treturn side === 'input'\n\t\t\t? `${this.#named(getNamedType(type), side)} | ${list}`\n\t\t\t: list;\n\t}\n\n\t#named(type: GraphQLNamedInputType, side: Side): string {\n\t\tconst builtIn = builtIns[type.name];\n\t\tif (builtIn) return builtIn;\n\t\tif (isEnumType(type))\n\t\t\treturn `z.output<typeof ${this.#writer.schemaName(type)}>`;\n\t\tif (isInputObjectType(type)) {\n\t\t\tconst name = this.#naming.type(type.name);\n\t\t\tif (this.#cyclic.has(type.name))\n\t\t\t\treturn side === 'output' ? name : `${name}Input`;\n\t\t\treturn `z.${side}<typeof ${this.#writer.schemaName(type)}>`;\n\t\t}\n\t\treturn `z.${side}<typeof ${this.#writer.scalarCode(type)}>`;\n\t}\n}\n",
21
- "import {\n\ttype Constraint,\n\tconstraintsOn,\n} from '@nxgt/graphql-validation/codegen';\nimport {\n\ttype ASTNode,\n\ttype FragmentDefinitionNode,\n\ttype GraphQLDirective,\n\ttype GraphQLInputType,\n\ttype GraphQLSchema,\n\tgetNamedType,\n\tisInputObjectType,\n\tisListType,\n\tisNonNullType,\n\tKind,\n\ttype OperationDefinitionNode,\n\tTypeInfo,\n\ttypeFromAST,\n\ttype ValueNode,\n\tvisit,\n\tvisitWithTypeInfo,\n} from 'graphql';\nimport type { DocumentFile } from './config';\nimport type { Naming } from './naming';\nimport { declare, objectMembers } from './source';\nimport type { Writer } from './writer';\n\n/**\n * One schema per named operation in `documents`, for its variables as a\n * client sends them (`z.input`). A variable gets the constraints of every\n * argument or input field it is passed to, in the operation and in the\n * fragments it spreads: the client refuses what the server would.\n * An anonymous operation has no name to give its schema, and gets none.\n */\nexport function variablesBlocks(\n\tschema: GraphQLSchema,\n\tdocuments: readonly DocumentFile[],\n\twriter: Writer,\n\tnaming: Naming,\n): string[] {\n\tconst definitions = documents.flatMap(\n\t\t(file) => file.document?.definitions ?? [],\n\t);\n\tconst fragments = new Map(\n\t\tdefinitions\n\t\t\t.filter(\n\t\t\t\t(node): node is FragmentDefinitionNode =>\n\t\t\t\t\tnode.kind === Kind.FRAGMENT_DEFINITION,\n\t\t\t)\n\t\t\t.map((node) => [node.name.value, node]),\n\t);\n\treturn definitions\n\t\t.filter(\n\t\t\t(node): node is OperationDefinitionNode =>\n\t\t\t\tnode.kind === Kind.OPERATION_DEFINITION,\n\t\t)\n\t\t.flatMap((operation) => {\n\t\t\tconst operationName = operation.name?.value;\n\t\t\tif (!operationName) return [];\n\t\t\tconst used = usages(schema, writer.directive, operation, fragments);\n\t\t\tconst members = (operation.variableDefinitions ?? []).map(\n\t\t\t\t(definition) => {\n\t\t\t\t\tconst variable = definition.variable.name.value;\n\t\t\t\t\tconst type = typeFromAST(schema, definition.type) as\n\t\t\t\t\t\t| GraphQLInputType\n\t\t\t\t\t\t| undefined;\n\t\t\t\t\tif (!type) {\n\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t`@nxgt/graphql-codegen-zod: ${operationName}'s $${variable} has a type the schema does not define.`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tconst where = `${operationName}($${variable}:)`;\n\t\t\t\t\tconst constraints = merged(used.get(variable) ?? [], where);\n\t\t\t\t\treturn [\n\t\t\t\t\t\tvariable,\n\t\t\t\t\t\twriter.value(type, constraints, where, definition.defaultValue),\n\t\t\t\t\t] as const;\n\t\t\t\t},\n\t\t\t);\n\t\t\treturn [\n\t\t\t\tdeclare(\n\t\t\t\t\tnaming.variables(operationName, operation.operation),\n\t\t\t\t\tnaming,\n\t\t\t\t\t`z.object({\\n${objectMembers(members)}\\n})`,\n\t\t\t\t\t'input',\n\t\t\t\t),\n\t\t\t];\n\t\t});\n}\n\n/** One place a variable is passed to, and the constraints written there. */\ninterface Usage {\n\treadonly where: string;\n\treadonly constraints: readonly Constraint[];\n}\n\n/** Where a walk of an operation stands: what it found, what it reads. */\ninterface Walk {\n\treadonly found: Map<string, Usage[]>;\n\treadonly variables: ReadonlySet<string>;\n\treadonly directive: GraphQLDirective | undefined;\n}\n\n/** Each variable's usages, in the operation and the fragments it spreads. */\nfunction usages(\n\tschema: GraphQLSchema,\n\tdirective: GraphQLDirective | undefined,\n\toperation: OperationDefinitionNode,\n\tfragments: ReadonlyMap<string, FragmentDefinitionNode>,\n): Map<string, Usage[]> {\n\tconst walk: Walk = {\n\t\tfound: new Map(),\n\t\tvariables: new Set(\n\t\t\t(operation.variableDefinitions ?? []).map((d) => d.variable.name.value),\n\t\t),\n\t\tdirective,\n\t};\n\tconst seen = new Set<string>();\n\tconst visitNode = (node: ASTNode): void => {\n\t\tconst typeInfo = new TypeInfo(schema);\n\t\tvisit(\n\t\t\tnode,\n\t\t\tvisitWithTypeInfo(typeInfo, {\n\t\t\t\tArgument(argument) {\n\t\t\t\t\tconst definition = typeInfo.getArgument();\n\t\t\t\t\tconst field = typeInfo.getFieldDef();\n\t\t\t\t\t// A directive's argument carries no constraint (withValidation refuses one).\n\t\t\t\t\tif (!definition || !field || typeInfo.getDirective() !== null) return;\n\t\t\t\t\tconst where = `${typeInfo.getParentType()?.name}.${field.name}(${definition.name}:)`;\n\t\t\t\t\twalkValue(\n\t\t\t\t\t\twalk,\n\t\t\t\t\t\targument.value,\n\t\t\t\t\t\tdefinition.type,\n\t\t\t\t\t\tconstraintsOn(directive, definition.astNode),\n\t\t\t\t\t\twhere,\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tFragmentSpread(spread) {\n\t\t\t\t\tconst fragment = fragments.get(spread.name.value);\n\t\t\t\t\tif (fragment && !seen.has(fragment.name.value)) {\n\t\t\t\t\t\tseen.add(fragment.name.value);\n\t\t\t\t\t\tvisitNode(fragment);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t}),\n\t\t);\n\t};\n\tvisitNode(operation);\n\treturn walk.found;\n}\n\n/**\n * Records the variables inside a value passed where `type` is expected:\n * the value itself, the items of a list literal (which take the items'\n * rules), the fields of an object literal (which take their own).\n */\nfunction walkValue(\n\twalk: Walk,\n\tvalue: ValueNode,\n\ttype: GraphQLInputType,\n\tconstraints: readonly Constraint[],\n\twhere: string,\n): void {\n\tif (value.kind === Kind.VARIABLE) {\n\t\tif (!walk.variables.has(value.name.value)) return;\n\t\tconst list = walk.found.get(value.name.value) ?? [];\n\t\tlist.push({ where, constraints });\n\t\twalk.found.set(value.name.value, list);\n\t\treturn;\n\t}\n\tconst nullable = isNonNullType(type) ? type.ofType : type;\n\tif (value.kind === Kind.LIST && isListType(nullable)) {\n\t\tconst items = constraints.filter(({ rule }) => rule.target !== 'list');\n\t\tfor (const item of value.values)\n\t\t\twalkValue(walk, item, nullable.ofType, items, where);\n\t\treturn;\n\t}\n\tconst named = getNamedType(type);\n\tif (value.kind === Kind.OBJECT && isInputObjectType(named)) {\n\t\tfor (const field of value.fields) {\n\t\t\tconst definition = named.getFields()[field.name.value];\n\t\t\tif (definition) {\n\t\t\t\twalkValue(\n\t\t\t\t\twalk,\n\t\t\t\t\tfield.value,\n\t\t\t\t\tdefinition.type,\n\t\t\t\t\tconstraintsOn(walk.directive, definition.astNode),\n\t\t\t\t\t`${named.name}.${definition.name}`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Every constraint of every usage, once each, `format` first. Two\n * different formats cannot both be written (each replaces the schema), so\n * they fail generation, naming both places.\n */\nfunction merged(usages: readonly Usage[], where: string): Constraint[] {\n\tconst all: (Constraint & { readonly at: string })[] = [];\n\tfor (const usage of usages) {\n\t\tfor (const constraint of usage.constraints) {\n\t\t\tconst same = all.some(\n\t\t\t\t(known) =>\n\t\t\t\t\tknown.rule === constraint.rule && known.value === constraint.value,\n\t\t\t);\n\t\t\tif (!same) all.push({ ...constraint, at: usage.where });\n\t\t}\n\t}\n\tconst bases = all.filter(({ rule }) => rule.base);\n\tconst [first, second] = bases;\n\tif (first && second) {\n\t\tthrow new Error(\n\t\t\t`@nxgt/graphql-codegen-zod: ${where} is passed to ${first.at} (${first.rule.argument}: ${JSON.stringify(first.value)}) and to ${second.at} (${second.rule.argument}: ${JSON.stringify(second.value)}), whose schemas cannot both apply. Use one variable for each.`,\n\t\t);\n\t}\n\treturn [...bases, ...all.filter(({ rule }) => !rule.base)].map(\n\t\t({ rule, value }) => ({ rule, value }),\n\t);\n}\n",
20
+ "import {\n\ttype Constraint,\n\tconstraintsOn,\n} from '@nxgt/graphql-validation/codegen';\nimport {\n\ttype ASTNode,\n\ttype FragmentDefinitionNode,\n\ttype GraphQLDirective,\n\ttype GraphQLInputType,\n\ttype GraphQLSchema,\n\tgetNamedType,\n\tisInputObjectType,\n\tisListType,\n\tisNonNullType,\n\tKind,\n\ttype OperationDefinitionNode,\n\tTypeInfo,\n\ttypeFromAST,\n\ttype ValueNode,\n\tvisit,\n\tvisitWithTypeInfo,\n} from 'graphql';\nimport type { DocumentFile } from './config';\nimport type { Naming } from './naming';\nimport { declareNamed, objectMembers } from './source';\nimport type { Writer } from './writer';\n\n/**\n * One schema per named operation in `documents`, for its variables as a\n * client sends them (`z.input`). A variable gets the constraints of every\n * argument or input field it is passed to, in the operation and in the\n * fragments it spreads: the client refuses what the server would.\n * An anonymous operation has no name to give its schema, and gets none.\n */\nexport function variablesBlocks(\n\tschema: GraphQLSchema,\n\tdocuments: readonly DocumentFile[],\n\twriter: Writer,\n\tnaming: Naming,\n): string[] {\n\tconst definitions = documents.flatMap(\n\t\t(file) => file.document?.definitions ?? [],\n\t);\n\tconst fragments = new Map(\n\t\tdefinitions\n\t\t\t.filter(\n\t\t\t\t(node): node is FragmentDefinitionNode =>\n\t\t\t\t\tnode.kind === Kind.FRAGMENT_DEFINITION,\n\t\t\t)\n\t\t\t.map((node) => [node.name.value, node]),\n\t);\n\treturn definitions\n\t\t.filter(\n\t\t\t(node): node is OperationDefinitionNode =>\n\t\t\t\tnode.kind === Kind.OPERATION_DEFINITION,\n\t\t)\n\t\t.flatMap((operation) => {\n\t\t\tconst operationName = operation.name?.value;\n\t\t\tif (!operationName) return [];\n\t\t\tconst used = usages(schema, writer.directive, operation, fragments);\n\t\t\tconst members = (operation.variableDefinitions ?? []).map(\n\t\t\t\t(definition) => {\n\t\t\t\t\tconst variable = definition.variable.name.value;\n\t\t\t\t\tconst type = typeFromAST(schema, definition.type) as\n\t\t\t\t\t\t| GraphQLInputType\n\t\t\t\t\t\t| undefined;\n\t\t\t\t\tif (!type) {\n\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t`@nxgt/graphql-codegen-zod: ${operationName}'s $${variable} has a type the schema does not define.`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tconst where = `${operationName}($${variable}:)`;\n\t\t\t\t\tconst constraints = merged(used.get(variable) ?? [], where);\n\t\t\t\t\treturn [\n\t\t\t\t\t\tvariable,\n\t\t\t\t\t\twriter.value(type, constraints, where, definition.defaultValue),\n\t\t\t\t\t] as const;\n\t\t\t\t},\n\t\t\t);\n\t\t\tconst { type, schema: schemaName } = naming.variablesSchema(\n\t\t\t\toperationName,\n\t\t\t\toperation.operation,\n\t\t\t);\n\t\t\treturn [\n\t\t\t\tdeclareNamed(\n\t\t\t\t\tschemaName,\n\t\t\t\t\ttype,\n\t\t\t\t\t`z.object({\\n${objectMembers(members)}\\n})`,\n\t\t\t\t\t'input',\n\t\t\t\t),\n\t\t\t];\n\t\t});\n}\n\n/** One place a variable is passed to, and the constraints written there. */\ninterface Usage {\n\treadonly where: string;\n\treadonly constraints: readonly Constraint[];\n}\n\n/** Where a walk of an operation stands: what it found, what it reads. */\ninterface Walk {\n\treadonly found: Map<string, Usage[]>;\n\treadonly variables: ReadonlySet<string>;\n\treadonly directive: GraphQLDirective | undefined;\n}\n\n/** Each variable's usages, in the operation and the fragments it spreads. */\nfunction usages(\n\tschema: GraphQLSchema,\n\tdirective: GraphQLDirective | undefined,\n\toperation: OperationDefinitionNode,\n\tfragments: ReadonlyMap<string, FragmentDefinitionNode>,\n): Map<string, Usage[]> {\n\tconst walk: Walk = {\n\t\tfound: new Map(),\n\t\tvariables: new Set(\n\t\t\t(operation.variableDefinitions ?? []).map((d) => d.variable.name.value),\n\t\t),\n\t\tdirective,\n\t};\n\tconst seen = new Set<string>();\n\tconst visitNode = (node: ASTNode): void => {\n\t\tconst typeInfo = new TypeInfo(schema);\n\t\tvisit(\n\t\t\tnode,\n\t\t\tvisitWithTypeInfo(typeInfo, {\n\t\t\t\tArgument(argument) {\n\t\t\t\t\tconst definition = typeInfo.getArgument();\n\t\t\t\t\tconst field = typeInfo.getFieldDef();\n\t\t\t\t\t// A directive's argument carries no constraint (withValidation refuses one).\n\t\t\t\t\tif (!definition || !field || typeInfo.getDirective() !== null) return;\n\t\t\t\t\tconst where = `${typeInfo.getParentType()?.name}.${field.name}(${definition.name}:)`;\n\t\t\t\t\twalkValue(\n\t\t\t\t\t\twalk,\n\t\t\t\t\t\targument.value,\n\t\t\t\t\t\tdefinition.type,\n\t\t\t\t\t\tconstraintsOn(directive, definition.astNode),\n\t\t\t\t\t\twhere,\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tFragmentSpread(spread) {\n\t\t\t\t\tconst fragment = fragments.get(spread.name.value);\n\t\t\t\t\tif (fragment && !seen.has(fragment.name.value)) {\n\t\t\t\t\t\tseen.add(fragment.name.value);\n\t\t\t\t\t\tvisitNode(fragment);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t}),\n\t\t);\n\t};\n\tvisitNode(operation);\n\treturn walk.found;\n}\n\n/**\n * Records the variables inside a value passed where `type` is expected:\n * the value itself, the items of a list literal (which take the items'\n * rules), the fields of an object literal (which take their own).\n */\nfunction walkValue(\n\twalk: Walk,\n\tvalue: ValueNode,\n\ttype: GraphQLInputType,\n\tconstraints: readonly Constraint[],\n\twhere: string,\n): void {\n\tif (value.kind === Kind.VARIABLE) {\n\t\tif (!walk.variables.has(value.name.value)) return;\n\t\tconst list = walk.found.get(value.name.value) ?? [];\n\t\tlist.push({ where, constraints });\n\t\twalk.found.set(value.name.value, list);\n\t\treturn;\n\t}\n\tconst nullable = isNonNullType(type) ? type.ofType : type;\n\tif (value.kind === Kind.LIST && isListType(nullable)) {\n\t\tconst items = constraints.filter(({ rule }) => rule.target !== 'list');\n\t\tfor (const item of value.values)\n\t\t\twalkValue(walk, item, nullable.ofType, items, where);\n\t\treturn;\n\t}\n\tconst named = getNamedType(type);\n\tif (value.kind === Kind.OBJECT && isInputObjectType(named)) {\n\t\tfor (const field of value.fields) {\n\t\t\tconst definition = named.getFields()[field.name.value];\n\t\t\tif (definition) {\n\t\t\t\twalkValue(\n\t\t\t\t\twalk,\n\t\t\t\t\tfield.value,\n\t\t\t\t\tdefinition.type,\n\t\t\t\t\tconstraintsOn(walk.directive, definition.astNode),\n\t\t\t\t\t`${named.name}.${definition.name}`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Every constraint of every usage, once each, `format` first. Two\n * different formats cannot both be written (each replaces the schema), so\n * they fail generation, naming both places.\n */\nfunction merged(usages: readonly Usage[], where: string): Constraint[] {\n\tconst all: (Constraint & { readonly at: string })[] = [];\n\tfor (const usage of usages) {\n\t\tfor (const constraint of usage.constraints) {\n\t\t\tconst same = all.some(\n\t\t\t\t(known) =>\n\t\t\t\t\tknown.rule === constraint.rule && known.value === constraint.value,\n\t\t\t);\n\t\t\tif (!same) all.push({ ...constraint, at: usage.where });\n\t\t}\n\t}\n\tconst bases = all.filter(({ rule }) => rule.base);\n\tconst [first, second] = bases;\n\tif (first && second) {\n\t\tthrow new Error(\n\t\t\t`@nxgt/graphql-codegen-zod: ${where} is passed to ${first.at} (${first.rule.argument}: ${JSON.stringify(first.value)}) and to ${second.at} (${second.rule.argument}: ${JSON.stringify(second.value)}), whose schemas cannot both apply. Use one variable for each.`,\n\t\t);\n\t}\n\treturn [...bases, ...all.filter(({ rule }) => !rule.base)].map(\n\t\t({ rule, value }) => ({ rule, value }),\n\t);\n}\n",
22
21
  "import {\n\ttype Constraint,\n\ttype InputCodeOptions,\n\tinputCode,\n} from '@nxgt/graphql-validation/codegen';\nimport {\n\ttype ConstValueNode,\n\ttype GraphQLDirective,\n\ttype GraphQLInputType,\n\ttype GraphQLNamedInputType,\n\tGraphQLNonNull,\n\ttype GraphQLScalarType,\n\tgetNamedType,\n\tisEnumType,\n\tisInputObjectType,\n\tisListType,\n\tisNonNullType,\n\tisSpecifiedScalarType,\n} from 'graphql';\nimport { parsedDefault } from './defaults';\nimport type { FormatCode } from './formats';\nimport type { Naming } from './naming';\nimport type { ScalarSources } from './scalars';\n\n/** One value's schema as source, and whether it names an input object. */\nexport interface ValueCode {\n\treadonly code: string;\n\t/** Written behind a getter: the input object may not be declared yet. */\n\treadonly lazy: boolean;\n\t/** The member's doc comment, from its GraphQL description. */\n\treadonly description?: string | null | undefined;\n}\n\n/**\n * Writes the schema of a value of a GraphQL input type: an argument, an\n * input field, an operation variable. Enums and input objects are named by\n * their schema, custom scalars come from their mapping, and the rest is\n * `@nxgt/graphql-validation`'s `inputCode`, constraints included.\n */\nexport class Writer {\n\treadonly directive: GraphQLDirective | undefined;\n\treadonly #naming: Naming;\n\treadonly #scalars: ScalarSources;\n\treadonly #formats: FormatCode;\n\treadonly #options: InputCodeOptions;\n\n\tconstructor(\n\t\tdirective: GraphQLDirective | undefined,\n\t\tnaming: Naming,\n\t\tscalars: ScalarSources,\n\t\tformats: FormatCode,\n\t) {\n\t\tthis.directive = directive;\n\t\tthis.#naming = naming;\n\t\tthis.#scalars = scalars;\n\t\tthis.#formats = formats;\n\t\t// An application format is a reference to its schema, chained on.\n\t\tthis.#options = { list: singleOrList, format: formats.code };\n\t}\n\n\t/** The source of a custom scalar's schema, from its mapping. */\n\tscalarCode(type: GraphQLScalarType): string {\n\t\treturn this.#scalars.code(type);\n\t}\n\n\t/** The schema's name of an enum or an input object. */\n\tschemaName(type: GraphQLNamedInputType): string {\n\t\treturn this.#naming.schema(this.#naming.type(type.name));\n\t}\n\n\t/**\n\t * `type`'s schema with `constraints`, `where` naming it in errors. A\n\t * default makes the value optional on the way in and present on the way\n\t * out, as graphql fills it: `.prefault(<default>)`, then `.nullable()`.\n\t */\n\tvalue(\n\t\ttype: GraphQLInputType,\n\t\tconstraints: readonly Constraint[],\n\t\twhere: string,\n\t\tdefaultValue?: ConstValueNode,\n\t): ValueCode {\n\t\tlet lazy = false;\n\t\tconst named = (named: GraphQLNamedInputType): string => {\n\t\t\tif (isInputObjectType(named)) {\n\t\t\t\tlazy = true;\n\t\t\t\treturn this.schemaName(named);\n\t\t\t}\n\t\t\tif (isEnumType(named)) return this.schemaName(named);\n\t\t\treturn this.#scalars.code(named);\n\t\t};\n\t\tif (!defaultValue)\n\t\t\treturn {\n\t\t\t\tcode: inputCode(\n\t\t\t\t\ttype,\n\t\t\t\t\tconstraints,\n\t\t\t\t\twhere,\n\t\t\t\t\tnamed,\n\t\t\t\t\tthis.#options,\n\t\t\t\t\tthis.#formats.schemas,\n\t\t\t\t),\n\t\t\t\tlazy,\n\t\t\t};\n\t\t// The default parsed as the client's value would be, then null allowed\n\t\t// after it: the key is optional on the way in, present on the way out.\n\t\tconst nullable = !isNonNullType(type);\n\t\tconst required = inputCode(\n\t\t\tnullable ? new GraphQLNonNull(type) : type,\n\t\t\tconstraints,\n\t\t\twhere,\n\t\t\tnamed,\n\t\t\tthis.#options,\n\t\t\tthis.#formats.schemas,\n\t\t);\n\t\tconst value = JSON.stringify(parsedDefault(defaultValue, type, where));\n\t\treturn {\n\t\t\tcode: `${required}.prefault(${value})${nullable ? '.nullable()' : ''}`,\n\t\t\tlazy,\n\t\t};\n\t}\n\n\t/** `value` for a type made non-null: a `@oneOf` member, which is set. */\n\trequired(\n\t\ttype: GraphQLInputType,\n\t\tconstraints: readonly Constraint[],\n\t\twhere: string,\n\t): ValueCode {\n\t\treturn this.value(\n\t\t\tisNonNullType(type) ? type : new GraphQLNonNull(type),\n\t\t\tconstraints,\n\t\t\twhere,\n\t\t);\n\t}\n}\n\n/**\n * A list that also takes a single value, as graphql coerces it (`\"a\"` for\n * `[String]` is `[\"a\"]`, for `[[String]]` `[[\"a\"]]`). The union only gives\n * the value its shape, parsing nothing: a list as it was sent, a single\n * value wrapped. Then it is piped into `code`, the list's own schema with\n * every rule, the server's: its items are parsed once, there, and a rule\n * refuses with the message, and at the path, the server gives (`[0]` for\n * a single value). Never `null`: a nullable list says so with its own\n * `.nullish()`, and graphql never wraps a null.\n *\n * Nothing that can fail sits inside an option: zod 4.6.6 aborts an\n * oversized array before its items, and a union with every option aborted\n * reports `invalid_union`, not the list too long. `code` after the union\n * checks size and items as the server's array does, under any zod.\n */\nconst singleOrList: NonNullable<InputCodeOptions['list']> = ({\n\ttype,\n\tcode,\n\tsingle,\n}) => {\n\tconst one = singleInput(getNamedType(type), single);\n\treturn `z.union([z.array(z.custom<${itemInput(type.ofType, one)}>()), z.custom<${one}>((value) => value != null && !Array.isArray(value)).transform((value): unknown[] => [value])]).pipe(${code})`;\n};\n\n/** What a client may send for one value of a list's named type, as a type. */\nfunction singleInput(named: GraphQLNamedInputType, single: string): string {\n\tif (isSpecifiedScalarType(named))\n\t\treturn BUILT_IN_INPUTS[named.name] ?? 'string';\n\treturn `z.input<typeof ${single}>`;\n}\n\n/** The built-in scalars' input types, as `baseCode` parses them. */\nconst BUILT_IN_INPUTS: Readonly<Record<string, string>> = {\n\tString: 'string',\n\tID: 'string',\n\tInt: 'number',\n\tFloat: 'number',\n\tBoolean: 'boolean',\n};\n\n/**\n * What a client may send for one item of a list, as a type: what its\n * schema's `z.input` is, so the union types the list as `code` would.\n */\nfunction itemInput(type: GraphQLInputType, one: string): string {\n\tif (isNonNullType(type)) return requiredInput(type.ofType, one);\n\treturn `${requiredInput(type, one)} | null | undefined`;\n}\n\nfunction requiredInput(type: GraphQLInputType, one: string): string {\n\tif (isNonNullType(type)) return requiredInput(type.ofType, one);\n\t// An inner list takes a single value too.\n\tif (isListType(type)) return `Array<${itemInput(type.ofType, one)}> | ${one}`;\n\treturn one;\n}\n"
23
22
  ],
24
- "mappings": ";AAAA;AACA;AAAA,uBAEC;AAAA,qBACA;AAAA,kBACA;AAAA;;;ACLD;AACA;AACA;AAQA,eAAsB,YAAY,CACjC,QACA,YAC6C;AAAA,EAC7C,MAAM,OAAO,OAAO,WAAW,GAAG,IAC/B,QAAQ,QAAQ,QAAQ,cAAc,UAAU,CAAC,GAAG,MAAM,IAC1D,cAAc,QAAQ,cAAc,CAAC,EAAE,QAAQ,MAAM;AAAA,EACxD,OAAc,qBAAc,IAAI,EAAE;AAAA;AAI5B,SAAS,YAAY,CAC3B,QACA,OACA,SACyD;AAAA,EACzD,MAAM,KAAK,MAA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G,EAAE,+MACvE;AAAA,EACD,MAAM,WAAW,aAAa,IAC7B,CAAC,gBAAgB,YAAY,MAAM,GAAG,EAAE,MAAM,EAC/C;AAAA,EACA,MAAM,UAAU,IAAI,QAAQ,QAAQ;AAAA,EACpC,MAAM,SAAS,MAAM,MAAM,OAAO;AAAA,EAClC,OAAO,GAAG,QAAQ,MAAM,EAAE,KAAK;AAAA,CAAI;AAAA;AAAA,EAAQ,OAAO,KAAK;AAAA;AAAA,CAAM;AAAA;AAAA;AAQ9D,SAAS,SAAS,CAAC,QAA6B;AAAA,EAC/C,WAAW,QAAQ,OAAO,OAAO,OAAO,WAAW,CAAC,GAAG;AAAA,IACtD,IAAI,KAAK,KAAK,WAAW,IAAI;AAAA,MAAG;AAAA,IAChC,MAAM,SAAS,mBAAkB,IAAI,IAClC,OAAO,OAAO,KAAK,UAAU,CAAC,IAC9B,cAAa,IAAI,KAAK,iBAAgB,IAAI,IACzC,OAAO,OAAO,KAAK,UAAU,CAAC,EAAE,QAAQ,CAAC,UAAU,MAAM,IAAI,IAC7D,CAAC;AAAA,IACL,MAAM,OAAO,OAAO,KAAK,CAAC,UAAU,CAAC,MAAM,OAAO;AAAA,IAClD,IAAI,MAAM;AAAA,MACT,MAAM,IAAI,MACT,mEAAmE,KAAK,qGACzE;AAAA,IACD;AAAA,EACD;AAAA;",
24
+ "debugId": "5F52FA4EFBAE877564756E2164756E21",
26
25
  "names": []
27
26
  }
package/dist/naming.d.ts CHANGED
@@ -1,5 +1,9 @@
1
1
  import type { OperationTypeNode } from 'graphql';
2
2
  import type { CodegenZodConfig } from './config.js';
3
+ /** An operation's kind, as graphql names it: `OperationTypeNode`'s values. */
4
+ export type OperationKind = `${OperationTypeNode}`;
5
+ /** The options of `CodegenZodConfig` that decide a name. */
6
+ export type NamingConfig = Pick<CodegenZodConfig, 'namingConvention' | 'typesPrefix' | 'typesSuffix' | 'schemaPrefix' | 'omitOperationSuffix' | 'dedupeOperationSuffix' | 'addUnderscoreToArgsType'>;
3
7
  /**
4
8
  * The names of what the plugin writes: each type as
5
9
  * `@graphql-codegen/typescript` and `typescript-operations` name it, each
@@ -7,15 +11,24 @@ import type { CodegenZodConfig } from './config.js';
7
11
  */
8
12
  export declare class Naming {
9
13
  #private;
10
- constructor(config: CodegenZodConfig);
14
+ constructor(config: NamingConfig);
11
15
  /** An input type's or an enum's type name: `SignUpInput`. */
12
16
  type(name: string): string;
13
17
  /** A field's arguments type name: `MutationSignUpArgs`. */
14
18
  args(parent: string, field: string): string;
15
19
  /** An operation's variables type name: `SignUpMutationVariables`. */
16
- variables(operation: string, kind: OperationTypeNode): string;
20
+ variables(operation: string, kind: OperationKind): string;
21
+ /**
22
+ * An operation's variables type and its schema: `SignUpMutationVariables`
23
+ * and `zSignUpMutationVariables`. The one place the pair is computed, for
24
+ * the plugin and for `variablesSchemaName`.
25
+ */
26
+ variablesSchema(operation: string, kind: OperationKind): {
27
+ readonly type: string;
28
+ readonly schema: string;
29
+ };
17
30
  /** An operation's result type name: `SignUpMutation`. */
18
- result(operation: string, kind: OperationTypeNode): string;
31
+ result(operation: string, kind: OperationKind): string;
19
32
  /** A fragment's type name: `UserFieldsFragment`. */
20
33
  fragment(name: string): string;
21
34
  /** The schema of the type named `type`: `zSignUpInput`. */
@@ -1 +1 @@
1
- {"version":3,"file":"naming.d.ts","sourceRoot":"","sources":["../src/naming.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD;;;;GAIG;AACH,qBAAa,MAAM;;gBAIN,MAAM,EAAE,gBAAgB;IAKpC,6DAA6D;IAC7D,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAI1B,2DAA2D;IAC3D,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;IAO3C,qEAAqE;IACrE,SAAS,CAAC,SAAS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,EAAE,IAAI,EAAE,aAAa,GAAG,MAAM;IAMtD,oDAAoD;IACpD,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAiB9B,2DAA2D;IAC3D,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAO5B"}
package/dist/source.d.ts CHANGED
@@ -6,4 +6,6 @@ export declare function docComment(description: string | null | undefined, inden
6
6
  export declare function objectMembers(members: readonly (readonly [string, ValueCode])[]): string;
7
7
  /** `export const zX = …; export type X = z.output<typeof zX>;` */
8
8
  export declare function declare(typeName: string, naming: Naming, code: string, side: 'input' | 'output', description?: string | null): string;
9
+ /** As `declare`, with the schema's name already computed. */
10
+ export declare function declareNamed(schemaName: string, typeName: string, code: string, side: 'input' | 'output', description?: string | null): string;
9
11
  //# sourceMappingURL=source.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../src/source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,0DAA0D;AAC1D,wBAAgB,UAAU,CACzB,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACtC,MAAM,SAAK,GACT,MAAM,CAQR;AAED,sEAAsE;AACtE,wBAAgB,aAAa,CAC5B,OAAO,EAAE,SAAS,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,EAAE,GAChD,MAAM,CASR;AAED,kEAAkE;AAClE,wBAAgB,OAAO,CACtB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,OAAO,GAAG,QAAQ,EACxB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,GACzB,MAAM,CAIR"}
1
+ {"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../src/source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,0DAA0D;AAC1D,wBAAgB,UAAU,CACzB,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACtC,MAAM,SAAK,GACT,MAAM,CAQR;AAED,sEAAsE;AACtE,wBAAgB,aAAa,CAC5B,OAAO,EAAE,SAAS,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,EAAE,GAChD,MAAM,CASR;AAED,kEAAkE;AAClE,wBAAgB,OAAO,CACtB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,OAAO,GAAG,QAAQ,EACxB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,GACzB,MAAM,CAQR;AAED,6DAA6D;AAC7D,wBAAgB,YAAY,CAC3B,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,OAAO,GAAG,QAAQ,EACxB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,GACzB,MAAM,CAGR"}
@@ -0,0 +1,11 @@
1
+ import { type NamingConfig, type OperationKind } from './naming.js';
2
+ export type { NamingConfig, OperationKind } from './naming.js';
3
+ /**
4
+ * The name of the schema the plugin writes for an operation's variables, from
5
+ * the plugin's own `config`: `zGetHttpThingQueryVariables`. The plugin names
6
+ * its schemas through the same `Naming.variablesSchema`, so a companion plugin
7
+ * importing this from `@nxgt/graphql-codegen-zod/naming` always agrees with
8
+ * the generated file.
9
+ */
10
+ export declare function variablesSchemaName(config: NamingConfig, operationName: string, operationKind: OperationKind): string;
11
+ //# sourceMappingURL=variables-name.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"variables-name.d.ts","sourceRoot":"","sources":["../src/variables-name.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE5D;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAClC,MAAM,EAAE,YAAY,EACpB,aAAa,EAAE,MAAM,EACrB,aAAa,EAAE,aAAa,GAC1B,MAAM,CAGR"}
@@ -0,0 +1,14 @@
1
+ import {
2
+ Naming
3
+ } from "./chunks/index-19w6rb9e.js";
4
+
5
+ // src/variables-name.ts
6
+ function variablesSchemaName(config, operationName, operationKind) {
7
+ return new Naming(config).variablesSchema(operationName, operationKind).schema;
8
+ }
9
+ export {
10
+ variablesSchemaName
11
+ };
12
+
13
+ //# debugId=D8701A6B18C51CA764756E2164756E21
14
+ //# sourceMappingURL=variables-name.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/variables-name.ts"],
4
+ "sourcesContent": [
5
+ "import { Naming, type NamingConfig, type OperationKind } from './naming';\n\nexport type { NamingConfig, OperationKind } from './naming';\n\n/**\n * The name of the schema the plugin writes for an operation's variables, from\n * the plugin's own `config`: `zGetHttpThingQueryVariables`. The plugin names\n * its schemas through the same `Naming.variablesSchema`, so a companion plugin\n * importing this from `@nxgt/graphql-codegen-zod/naming` always agrees with\n * the generated file.\n */\nexport function variablesSchemaName(\n\tconfig: NamingConfig,\n\toperationName: string,\n\toperationKind: OperationKind,\n): string {\n\treturn new Naming(config).variablesSchema(operationName, operationKind)\n\t\t.schema;\n}\n"
6
+ ],
7
+ "mappings": ";;;;;AAWO,SAAS,mBAAmB,CAClC,QACA,eACA,eACS;AAAA,EACT,OAAO,IAAI,OAAO,MAAM,EAAE,gBAAgB,eAAe,aAAa,EACpE;AAAA;",
8
+ "debugId": "D8701A6B18C51CA764756E2164756E21",
9
+ "names": []
10
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"variables-output.d.ts","sourceRoot":"","sources":["../src/variables-output.ts"],"names":[],"mappings":"AAIA,OAAO,EAKN,KAAK,aAAa,EAYlB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC9B,MAAM,EAAE,aAAa,EACrB,SAAS,EAAE,SAAS,YAAY,EAAE,EAClC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GACZ,MAAM,EAAE,CAiDV"}
1
+ {"version":3,"file":"variables-output.d.ts","sourceRoot":"","sources":["../src/variables-output.ts"],"names":[],"mappings":"AAIA,OAAO,EAKN,KAAK,aAAa,EAYlB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC9B,MAAM,EAAE,aAAa,EACrB,SAAS,EAAE,SAAS,YAAY,EAAE,EAClC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GACZ,MAAM,EAAE,CAqDV"}
@@ -195,6 +195,30 @@ config: { namingConvention: { transformUnderscore: true } } // sign_upInput →
195
195
  Any other module string (`'my-module#myCase'`) throws, see
196
196
  [Troubleshooting](../troubleshooting.md).
197
197
 
198
+ ### Computing a name from another plugin
199
+
200
+ A companion plugin that imports the generated variables schemas (a manifest, a
201
+ client wrapper) needs the exact name this plugin wrote. Do not copy the rules:
202
+ `@nxgt/graphql-codegen-zod/naming` exports the function the plugin itself
203
+ names them with.
204
+
205
+ ```ts
206
+ import { variablesSchemaName } from '@nxgt/graphql-codegen-zod/naming';
207
+
208
+ const config = { dedupeOperationSuffix: true }; // the same `config` as the plugin's
209
+
210
+ variablesSchemaName(config, 'getHTTPThing', 'query'); // 'zGetHttpThingQueryVariables'
211
+ variablesSchemaName(config, 'get_book', 'query'); // 'zGet_BookQueryVariables'
212
+ variablesSchemaName(config, 'getThingQuery', 'query'); // 'zGetThingQueryVariables'
213
+ ```
214
+
215
+ `variablesSchemaName(config, operationName, operationKind)` takes the plugin's
216
+ `namingConvention` (every form above), `typesPrefix`, `typesSuffix`,
217
+ `schemaPrefix`, `omitOperationSuffix` and `dedupeOperationSuffix`
218
+ (case-insensitive); `operationKind` is `'query'`, `'mutation'` or
219
+ `'subscription'` (type `OperationKind`; `config` is a `NamingConfig`, so the plugin's whole config fits and other options are ignored). It is pure, and the subpath imports only `change-case`, not
220
+ graphql-codegen nor `graphql`.
221
+
198
222
  ### One file of its own
199
223
 
200
224
  Generate into a file the typescript plugins do not write to: the names would
@@ -259,6 +259,16 @@ in the message are yours.
259
259
  query Both($e: String, $u: String) { e(v: $e) u(v: $u) }
260
260
  ```
261
261
 
262
+ ### A companion plugin imports `zGetHttpThingQueryVariables` and the file has another name
263
+
264
+ **When:** a second codegen plugin writes an import of a variables schema.
265
+ **Why:** it computed the name with its own copy of the naming rules, which
266
+ differs from this plugin's for the `config` in use (`dedupeOperationSuffix`,
267
+ `namingConvention`, `typesPrefix`, ...).
268
+ **Fix:** call `variablesSchemaName(config, operationName, operationKind)` from
269
+ `@nxgt/graphql-codegen-zod/naming` with the plugin's own `config`, instead of
270
+ copying the rules. See [Naming](guide/output.md#computing-a-name-from-another-plugin).
271
+
262
272
  ## The generated file
263
273
 
264
274
  ### `TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean '../formats.js'?`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxgt/graphql-codegen-zod",
3
- "version": "0.3.5",
3
+ "version": "0.4.0",
4
4
  "description": "A graphql-codegen plugin that writes Zod schemas from your SDL — inputs, enums, field arguments, operation variables, operation results and output types — with the @constraint rules of @nxgt/graphql-validation",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -19,6 +19,11 @@
19
19
  "import": "./dist/index.js",
20
20
  "default": "./dist/index.js"
21
21
  },
22
+ "./naming": {
23
+ "types": "./dist/variables-name.d.ts",
24
+ "import": "./dist/variables-name.js",
25
+ "default": "./dist/variables-name.js"
26
+ },
22
27
  "./package.json": "./package.json"
23
28
  },
24
29
  "keywords": [
@@ -45,8 +50,14 @@
45
50
  "typecheck": "tsc --noEmit",
46
51
  "generated:write": "bun run test/write-generated.ts"
47
52
  },
53
+ "nxgt": {
54
+ "entrypoints": [
55
+ "src/index.ts",
56
+ "src/variables-name.ts"
57
+ ]
58
+ },
48
59
  "dependencies": {
49
- "@nxgt/graphql-validation": "^0.7.0",
60
+ "@nxgt/graphql-validation": "^0.8.0",
50
61
  "change-case": "^5.4.4"
51
62
  },
52
63
  "devDependencies": {