@nxgt/graphql-codegen-zod 0.0.0-stage → 0.2.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.
Files changed (43) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +232 -2
  3. package/dist/collect-fields.d.ts +24 -0
  4. package/dist/collect-fields.d.ts.map +1 -0
  5. package/dist/config.d.ts +53 -0
  6. package/dist/config.d.ts.map +1 -0
  7. package/dist/cycles.d.ts +16 -0
  8. package/dist/cycles.d.ts.map +1 -0
  9. package/dist/defaults.d.ts +21 -0
  10. package/dist/defaults.d.ts.map +1 -0
  11. package/dist/imports.d.ts +14 -0
  12. package/dist/imports.d.ts.map +1 -0
  13. package/dist/index.d.ts +14 -0
  14. package/dist/index.d.ts.map +1 -0
  15. package/dist/index.js +1114 -0
  16. package/dist/index.js.map +25 -0
  17. package/dist/naming.d.ts +24 -0
  18. package/dist/naming.d.ts.map +1 -0
  19. package/dist/objects-output.d.ts +16 -0
  20. package/dist/objects-output.d.ts.map +1 -0
  21. package/dist/output-types.d.ts +15 -0
  22. package/dist/output-types.d.ts.map +1 -0
  23. package/dist/results-output.d.ts +16 -0
  24. package/dist/results-output.d.ts.map +1 -0
  25. package/dist/results-selections.d.ts +21 -0
  26. package/dist/results-selections.d.ts.map +1 -0
  27. package/dist/scalars.d.ts +21 -0
  28. package/dist/scalars.d.ts.map +1 -0
  29. package/dist/schema-output.d.ts +10 -0
  30. package/dist/schema-output.d.ts.map +1 -0
  31. package/dist/source.d.ts +9 -0
  32. package/dist/source.d.ts.map +1 -0
  33. package/dist/type-code.d.ts +12 -0
  34. package/dist/type-code.d.ts.map +1 -0
  35. package/dist/variables-output.d.ts +13 -0
  36. package/dist/variables-output.d.ts.map +1 -0
  37. package/dist/writer.d.ts +36 -0
  38. package/dist/writer.d.ts.map +1 -0
  39. package/docs/README.md +14 -0
  40. package/docs/guide/output.md +732 -0
  41. package/docs/roadmap.md +38 -0
  42. package/docs/troubleshooting.md +267 -0
  43. package/package.json +62 -5
@@ -0,0 +1,25 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/index.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"],
4
+ "sourcesContent": [
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 { 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 directive = checkConstraints(schema);\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);\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
+ "/**\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",
7
+ "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",
8
+ "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",
9
+ "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",
10
+ "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",
11
+ "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 {\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",
13
+ "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",
14
+ "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",
15
+ "import { createRequire } from 'node:module';\nimport { dirname, resolve } from 'node:path';\nimport { pathToFileURL } from 'node:url';\nimport type { GraphQLScalarType } from 'graphql';\nimport type { CodegenZodConfig } from './config';\nimport type { Imports } from './imports';\n\n/**\n * Where each custom scalar's schema comes from: `zodScalars` first, then the\n * `scalarSchemas` record. A scalar in neither fails generation, naming it:\n * a scalar written as `z.unknown()` would check nothing, in silence.\n */\nexport class ScalarSources {\n\treadonly #config: CodegenZodConfig;\n\treadonly #imports: Imports;\n\t/** The record's keys, when its module could be loaded to read them. */\n\treadonly #recordKeys: ReadonlySet<string> | undefined;\n\n\tprivate constructor(\n\t\tconfig: CodegenZodConfig,\n\t\timports: Imports,\n\t\trecordKeys: ReadonlySet<string> | undefined,\n\t) {\n\t\tthis.#config = config;\n\t\tthis.#imports = imports;\n\t\tthis.#recordKeys = recordKeys;\n\t}\n\n\t/**\n\t * Loads the `scalarSchemas` module, if any, to know its keys. One that\n\t * cannot be loaded here (a `.ts` file under Node) is trusted: the\n\t * generated file then fails to typecheck on a missing key instead.\n\t */\n\tstatic async load(\n\t\tconfig: CodegenZodConfig,\n\t\timports: Imports,\n\t\toutputFile: string | undefined,\n\t): Promise<ScalarSources> {\n\t\tif (!config.scalarSchemas)\n\t\t\treturn new ScalarSources(config, imports, undefined);\n\t\tconst keys = await recordKeys(config.scalarSchemas, outputFile);\n\t\treturn new ScalarSources(config, imports, keys);\n\t}\n\n\t/** The source of `type`'s schema, its import added. */\n\tcode(type: GraphQLScalarType): string {\n\t\tconst own = this.#config.zodScalars?.[type.name];\n\t\tif (own !== undefined) {\n\t\t\tconst at = own.lastIndexOf('#');\n\t\t\tif (at <= 0 || at === own.length - 1) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`@nxgt/graphql-codegen-zod: zodScalars.${type.name} is \"${own}\"; write it '<module>#<export>', e.g. './money#moneySchema'.`,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn this.#imports.add(own.slice(0, at), own.slice(at + 1));\n\t\t}\n\t\tconst record = this.#config.scalarSchemas;\n\t\tif (record && (!this.#recordKeys || this.#recordKeys.has(type.name))) {\n\t\t\treturn `${this.#imports.add(record, 'scalarSchemas')}.${type.name}`;\n\t\t}\n\t\tconst where = record\n\t\t\t? `neither in zodScalars nor in ${record}'s scalarSchemas`\n\t\t\t: 'not in zodScalars, and no scalarSchemas is set';\n\t\tthrow new Error(\n\t\t\t`@nxgt/graphql-codegen-zod: the scalar ${type.name} is ${where}. Map it: zodScalars: { ${type.name}: './module#export' }, or set scalarSchemas: '@nxgt/graphql-scalars'.`,\n\t\t);\n\t}\n}\n\nasync function recordKeys(\n\tmodule: string,\n\toutputFile: string | undefined,\n): Promise<ReadonlySet<string> | undefined> {\n\ttry {\n\t\tconst base = module.startsWith('.')\n\t\t\t? resolve(dirname(resolve(outputFile ?? 'index.ts')), module)\n\t\t\t: createRequire(resolve('package.json')).resolve(module);\n\t\tconst loaded: { scalarSchemas?: unknown } = await import(\n\t\t\tpathToFileURL(base).href\n\t\t);\n\t\tconst record = loaded.scalarSchemas;\n\t\tif (typeof record !== 'object' || record === null) {\n\t\t\tthrow new Error(\n\t\t\t\t`@nxgt/graphql-codegen-zod: ${module} exports no scalarSchemas record.`,\n\t\t\t);\n\t\t}\n\t\treturn new Set(Object.keys(record));\n\t} catch (error) {\n\t\tif (\n\t\t\terror instanceof Error &&\n\t\t\terror.message.startsWith('@nxgt/graphql-codegen-zod:')\n\t\t)\n\t\t\tthrow error;\n\t\treturn undefined;\n\t}\n}\n",
16
+ "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",
17
+ "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",
18
+ "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",
19
+ "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\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\tisNonNullType,\n\tisScalarType,\n\tisSpecifiedScalarType,\n} from 'graphql';\nimport { parsedDefault } from './defaults';\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\n\tconstructor(\n\t\tdirective: GraphQLDirective | undefined,\n\t\tnaming: Naming,\n\t\tscalars: ScalarSources,\n\t) {\n\t\tthis.directive = directive;\n\t\tthis.#naming = naming;\n\t\tthis.#scalars = scalars;\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(type, constraints, where, named, {\n\t\t\t\t\tlist: singleOrList,\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\t{ list: singleOrList },\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 value is wrapped,\n * then checked as the list, so a rule refuses it with the message, and at\n * the path, the server gives. An input object's or a custom scalar's schema\n * may transform (a codec decodes): its single value goes to the pipe as it\n * was sent, and is parsed once there. Never `null`: a nullable list says\n * so with its own `.nullish()`, and graphql never wraps a null.\n */\nconst singleOrList: NonNullable<InputCodeOptions['list']> = ({\n\ttype,\n\tcode,\n\tsingle,\n}) => {\n\tconst named = getNamedType(type);\n\tconst transforms =\n\t\tisInputObjectType(named) ||\n\t\t(isScalarType(named) && !isSpecifiedScalarType(named));\n\tconst first = transforms\n\t\t? `z.custom<z.input<typeof ${single}>>((value) => value != null && !Array.isArray(value))`\n\t\t: single;\n\t// `unknown[]`: the pipe needs what it hands on to fit what the list\n\t// takes, nullable items too.\n\treturn `z.union([${code}, ${first}.transform((value): unknown[] => [value]).pipe(${code})])`;\n};\n"
21
+ ],
22
+ "mappings": ";AAAA;AACA;AAAA,uBAEC;AAAA,qBACA;AAAA,kBACA;AAAA;;;ACDM,MAAM,QAAQ;AAAA,EACX,YAAY,IAAI,IAAiC;AAAA,IACzD,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;AAAA,EAC9B,CAAC;AAAA,EACQ;AAAA,EAGT,WAAW,CAAC,WAA6B,CAAC,GAAG;AAAA,IAC5C,KAAK,SAAS,IAAI,IAAI,CAAC,KAAK,GAAG,QAA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E,KAAK,qGACzE;AAAA,IACD;AAAA,EACD;AAAA;",
23
+ "debugId": "7FB3A417D01910B464756E2164756E21",
24
+ "names": []
25
+ }
@@ -0,0 +1,24 @@
1
+ import type { OperationTypeNode } from 'graphql';
2
+ import type { CodegenZodConfig } from './config';
3
+ /**
4
+ * The names of what the plugin writes: each type as
5
+ * `@graphql-codegen/typescript` and `typescript-operations` name it, each
6
+ * schema the same name behind `schemaPrefix`.
7
+ */
8
+ export declare class Naming {
9
+ #private;
10
+ constructor(config: CodegenZodConfig);
11
+ /** An input type's or an enum's type name: `SignUpInput`. */
12
+ type(name: string): string;
13
+ /** A field's arguments type name: `MutationSignUpArgs`. */
14
+ args(parent: string, field: string): string;
15
+ /** An operation's variables type name: `SignUpMutationVariables`. */
16
+ variables(operation: string, kind: OperationTypeNode): string;
17
+ /** An operation's result type name: `SignUpMutation`. */
18
+ result(operation: string, kind: OperationTypeNode): string;
19
+ /** A fragment's type name: `UserFieldsFragment`. */
20
+ fragment(name: string): string;
21
+ /** The schema of the type named `type`: `zSignUpInput`. */
22
+ schema(type: string): string;
23
+ }
24
+ //# sourceMappingURL=naming.d.ts.map
@@ -0,0 +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,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,GAAG,MAAM;IAM7D,yDAAyD;IACzD,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,GAAG,MAAM;IAM1D,oDAAoD;IACpD,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAiB9B,2DAA2D;IAC3D,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAO5B"}
@@ -0,0 +1,16 @@
1
+ import { type GraphQLSchema } from 'graphql';
2
+ import type { Naming } from './naming';
3
+ import type { Writer } from './writer';
4
+ /** The built-in scalars' schemas on the way out. */
5
+ export declare const builtIns: Readonly<Record<string, string>>;
6
+ /**
7
+ * The SDL's output types: every object type, then every interface and
8
+ * union, typed `z.output`, what a resolver returns once custom scalars are
9
+ * decoded. A field the schema does not declare is dropped (`z.object`), and
10
+ * `__typename` is optional, as a resolver rarely sets it; so an interface
11
+ * or a union is a plain `z.union` of its object types. Interfaces and
12
+ * unions come last: their union reads the object schemas when the module
13
+ * loads, while objects reach each other through getters.
14
+ */
15
+ export declare function objectBlocks(schema: GraphQLSchema, writer: Writer, naming: Naming): string[];
16
+ //# sourceMappingURL=objects-output.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"objects-output.d.ts","sourceRoot":"","sources":["../src/objects-output.ts"],"names":[],"mappings":"AAAA,OAAO,EAQN,KAAK,aAAa,EAYlB,MAAM,SAAS,CAAC;AAEjB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGvC,OAAO,KAAK,EAAa,MAAM,EAAE,MAAM,UAAU,CAAC;AAElD,oDAAoD;AACpD,eAAO,MAAM,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAMrD,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC3B,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GACZ,MAAM,EAAE,CAWV"}
@@ -0,0 +1,15 @@
1
+ import { type GraphQLObjectType } from 'graphql';
2
+ import type { Naming } from './naming';
3
+ import type { Writer } from './writer';
4
+ /**
5
+ * An object type in a cycle, declared with its types written out, as an
6
+ * input type in a cycle is: `User` (what a resolver returns, scalars
7
+ * decoded), `UserWire` (the wire value, apart from an SDL `UserInput`) and `zUser` typed by both.
8
+ */
9
+ export declare function declareCyclicObject(type: GraphQLObjectType, code: string, context: OutputTypeContext): string;
10
+ export interface OutputTypeContext {
11
+ readonly writer: Writer;
12
+ readonly naming: Naming;
13
+ readonly cyclic: ReadonlySet<string>;
14
+ }
15
+ //# sourceMappingURL=output-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output-types.d.ts","sourceRoot":"","sources":["../src/output-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAON,KAAK,iBAAiB,EAQtB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAYvC;;;;GAIG;AACH,wBAAgB,mBAAmB,CAClC,IAAI,EAAE,iBAAiB,EACvB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,iBAAiB,GACxB,MAAM,CAUR;AAED,MAAM,WAAW,iBAAiB;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACrC"}
@@ -0,0 +1,16 @@
1
+ import { type GraphQLSchema } from 'graphql';
2
+ import type { DocumentFile } from './config';
3
+ import type { Naming } from './naming';
4
+ import type { Writer } from './writer';
5
+ /**
6
+ * One schema per fragment and per named operation in `documents`, for the
7
+ * response as it arrives: what was selected, under its alias, custom
8
+ * scalars decoded (`z.output`). A fragment spread is inlined. An abstract
9
+ * type's selection is one object when its possible types select the same,
10
+ * else a union discriminated on `__typename`, which must then be selected;
11
+ * possible types that select the same share one member, `__typename:
12
+ * z.enum([...])`. A field under `@skip`, `@include` or `@defer` may be
13
+ * absent. An unknown field is dropped (`z.object`).
14
+ */
15
+ export declare function resultsBlocks(schema: GraphQLSchema, documents: readonly DocumentFile[], writer: Writer, naming: Naming): string[];
16
+ //# sourceMappingURL=results-output.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"results-output.d.ts","sourceRoot":"","sources":["../src/results-output.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,aAAa,EAIlB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAC5B,MAAM,EAAE,aAAa,EACrB,SAAS,EAAE,SAAS,YAAY,EAAE,EAClC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GACZ,MAAM,EAAE,CA0DV"}
@@ -0,0 +1,21 @@
1
+ import { type FragmentDefinitionNode, type GraphQLCompositeType, type GraphQLSchema } from 'graphql';
2
+ import { type Selected } from './collect-fields';
3
+ import type { Writer } from './writer';
4
+ /**
5
+ * The schema of a selection, for a response: what was selected, under its
6
+ * alias. Deep selections are declared apart, as `<schema>$<n>`, which the
7
+ * caller writes before the schema that uses them.
8
+ */
9
+ export declare class Selections {
10
+ #private;
11
+ constructor(schema: GraphQLSchema, fragments: ReadonlyMap<string, FragmentDefinitionNode>, writer: Writer);
12
+ /**
13
+ * The schema `sets` select on `type`, declared as `name`, after the
14
+ * consts it hoists. `path` names where, for errors.
15
+ */
16
+ declare(name: string, type: GraphQLCompositeType, sets: readonly Selected[], path: string): {
17
+ readonly hoisted: string[];
18
+ readonly code: string;
19
+ };
20
+ }
21
+ //# sourceMappingURL=results-selections.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"results-selections.d.ts","sourceRoot":"","sources":["../src/results-selections.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,sBAAsB,EAE3B,KAAK,oBAAoB,EAGzB,KAAK,aAAa,EAMlB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAiC,KAAK,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEhF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAUvC;;;;GAIG;AACH,qBAAa,UAAU;;gBAQrB,MAAM,EAAE,aAAa,EACrB,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,sBAAsB,CAAC,EACtD,MAAM,EAAE,MAAM;IAOf;;;OAGG;IACH,OAAO,CACN,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,oBAAoB,EAC1B,IAAI,EAAE,SAAS,QAAQ,EAAE,EACzB,IAAI,EAAE,MAAM,GACV;QAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE;CAmLxD"}
@@ -0,0 +1,21 @@
1
+ import type { GraphQLScalarType } from 'graphql';
2
+ import type { CodegenZodConfig } from './config';
3
+ import type { Imports } from './imports';
4
+ /**
5
+ * Where each custom scalar's schema comes from: `zodScalars` first, then the
6
+ * `scalarSchemas` record. A scalar in neither fails generation, naming it:
7
+ * a scalar written as `z.unknown()` would check nothing, in silence.
8
+ */
9
+ export declare class ScalarSources {
10
+ #private;
11
+ private constructor();
12
+ /**
13
+ * Loads the `scalarSchemas` module, if any, to know its keys. One that
14
+ * cannot be loaded here (a `.ts` file under Node) is trusted: the
15
+ * generated file then fails to typecheck on a missing key instead.
16
+ */
17
+ static load(config: CodegenZodConfig, imports: Imports, outputFile: string | undefined): Promise<ScalarSources>;
18
+ /** The source of `type`'s schema, its import added. */
19
+ code(type: GraphQLScalarType): string;
20
+ }
21
+ //# sourceMappingURL=scalars.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scalars.d.ts","sourceRoot":"","sources":["../src/scalars.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC;;;;GAIG;AACH,qBAAa,aAAa;;IAMzB,OAAO;IAUP;;;;OAIG;WACU,IAAI,CAChB,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,GAAG,SAAS,GAC5B,OAAO,CAAC,aAAa,CAAC;IAOzB,uDAAuD;IACvD,IAAI,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM;CAsBrC"}
@@ -0,0 +1,10 @@
1
+ import { type GraphQLSchema } from 'graphql';
2
+ import type { Naming } from './naming';
3
+ import type { Writer } from './writer';
4
+ /**
5
+ * The SDL's part of the file: every enum, then every input type, then the
6
+ * arguments of every object and interface field that takes any. Types are
7
+ * `z.output`: what a resolver receives once `withValidation` parsed them.
8
+ */
9
+ export declare function schemaBlocks(schema: GraphQLSchema, writer: Writer, naming: Naming): string[];
10
+ //# sourceMappingURL=schema-output.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-output.d.ts","sourceRoot":"","sources":["../src/schema-output.ts"],"names":[],"mappings":"AACA,OAAO,EAGN,KAAK,aAAa,EAKlB,MAAM,SAAS,CAAC;AAGjB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC;;;;GAIG;AACH,wBAAgB,YAAY,CAC3B,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GACZ,MAAM,EAAE,CAwCV"}
@@ -0,0 +1,9 @@
1
+ import type { Naming } from './naming';
2
+ import type { ValueCode } from './writer';
3
+ /** A GraphQL description as a doc comment, or nothing. */
4
+ export declare function docComment(description: string | null | undefined, indent?: string): string;
5
+ /** The members of a `z.object({...})`, a getter for each lazy one. */
6
+ export declare function objectMembers(members: readonly (readonly [string, ValueCode])[]): string;
7
+ /** `export const zX = …; export type X = z.output<typeof zX>;` */
8
+ export declare function declare(typeName: string, naming: Naming, code: string, side: 'input' | 'output', description?: string | null): string;
9
+ //# sourceMappingURL=source.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,12 @@
1
+ import { type GraphQLInputObjectType } from 'graphql';
2
+ import type { Naming } from './naming';
3
+ import type { Writer } from './writer';
4
+ /**
5
+ * An input type in a cycle, declared with its types written out, since
6
+ * TypeScript cannot infer them: `Filter` (what the resolver receives),
7
+ * `FilterInput` (what a client sends), and `zFilter` typed by both. The
8
+ * schema's types must fit inside them, a type error otherwise; a type
9
+ * written wider than the schema would compile, so test/types.ts pins them.
10
+ */
11
+ export declare function declareCyclic(type: GraphQLInputObjectType, code: string, writer: Writer, naming: Naming, cyclic: ReadonlySet<string>): string;
12
+ //# sourceMappingURL=type-code.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-code.d.ts","sourceRoot":"","sources":["../src/type-code.ts"],"names":[],"mappings":"AAAA,OAAO,EAKN,KAAK,sBAAsB,EAU3B,MAAM,SAAS,CAAC;AAEjB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAYvC;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC5B,IAAI,EAAE,sBAAsB,EAC5B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,GACzB,MAAM,CAUR"}
@@ -0,0 +1,13 @@
1
+ import { type GraphQLSchema } from 'graphql';
2
+ import type { DocumentFile } from './config';
3
+ import type { Naming } from './naming';
4
+ import type { Writer } from './writer';
5
+ /**
6
+ * One schema per named operation in `documents`, for its variables as a
7
+ * client sends them (`z.input`). A variable gets the constraints of every
8
+ * argument or input field it is passed to, in the operation and in the
9
+ * fragments it spreads: the client refuses what the server would.
10
+ * An anonymous operation has no name to give its schema, and gets none.
11
+ */
12
+ export declare function variablesBlocks(schema: GraphQLSchema, documents: readonly DocumentFile[], writer: Writer, naming: Naming): string[];
13
+ //# sourceMappingURL=variables-output.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,36 @@
1
+ import { type Constraint } from '@nxgt/graphql-validation/codegen';
2
+ import { type ConstValueNode, type GraphQLDirective, type GraphQLInputType, type GraphQLNamedInputType, type GraphQLScalarType } from 'graphql';
3
+ import type { Naming } from './naming';
4
+ import type { ScalarSources } from './scalars';
5
+ /** One value's schema as source, and whether it names an input object. */
6
+ export interface ValueCode {
7
+ readonly code: string;
8
+ /** Written behind a getter: the input object may not be declared yet. */
9
+ readonly lazy: boolean;
10
+ /** The member's doc comment, from its GraphQL description. */
11
+ readonly description?: string | null | undefined;
12
+ }
13
+ /**
14
+ * Writes the schema of a value of a GraphQL input type: an argument, an
15
+ * input field, an operation variable. Enums and input objects are named by
16
+ * their schema, custom scalars come from their mapping, and the rest is
17
+ * `@nxgt/graphql-validation`'s `inputCode`, constraints included.
18
+ */
19
+ export declare class Writer {
20
+ #private;
21
+ readonly directive: GraphQLDirective | undefined;
22
+ constructor(directive: GraphQLDirective | undefined, naming: Naming, scalars: ScalarSources);
23
+ /** The source of a custom scalar's schema, from its mapping. */
24
+ scalarCode(type: GraphQLScalarType): string;
25
+ /** The schema's name of an enum or an input object. */
26
+ schemaName(type: GraphQLNamedInputType): string;
27
+ /**
28
+ * `type`'s schema with `constraints`, `where` naming it in errors. A
29
+ * default makes the value optional on the way in and present on the way
30
+ * out, as graphql fills it: `.prefault(<default>)`, then `.nullable()`.
31
+ */
32
+ value(type: GraphQLInputType, constraints: readonly Constraint[], where: string, defaultValue?: ConstValueNode): ValueCode;
33
+ /** `value` for a type made non-null: a `@oneOf` member, which is set. */
34
+ required(type: GraphQLInputType, constraints: readonly Constraint[], where: string): ValueCode;
35
+ }
36
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AAM,GACX,SAAS;CAOZ"}
package/docs/README.md ADDED
@@ -0,0 +1,14 @@
1
+ # @nxgt/graphql-codegen-zod documentation
2
+
3
+ ## Guides
4
+
5
+ | Page | Read it when |
6
+ | --- | --- |
7
+ | [Output](guide/output.md) | you want to know what the plugin writes: the schemas and types, their names and options, defaults, recursion, `@oneOf`, variables, output types, operation results, and how custom scalars are mapped |
8
+
9
+ ## Reference
10
+
11
+ | Page | Read it when |
12
+ | --- | --- |
13
+ | [Troubleshooting](troubleshooting.md) | you have an error message and want its cause |
14
+ | [Roadmap](roadmap.md) | you want to know what is coming, and what is not |