@nxgt/graphql-codegen-zod 0.2.1 → 0.3.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 +65 -3
- package/dist/config.d.ts +12 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/formats.d.ts +26 -0
- package/dist/formats.d.ts.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +88 -20
- package/dist/index.js.map +8 -6
- package/dist/modules.d.ts +13 -0
- package/dist/modules.d.ts.map +1 -0
- package/dist/scalars.d.ts.map +1 -1
- package/dist/writer.d.ts +2 -1
- package/dist/writer.d.ts.map +1 -1
- package/docs/README.md +1 -1
- package/docs/guide/output.md +138 -3
- package/docs/roadmap.md +12 -6
- package/docs/troubleshooting.md +150 -1
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -23,10 +23,11 @@ Peers, all **required**:
|
|
|
23
23
|
| --- | --- |
|
|
24
24
|
| `graphql` | `^16.11.0 \|\| ^17.0.0` |
|
|
25
25
|
| `zod` | `>=4.6.5 <5` |
|
|
26
|
-
| `typescript` | `^6.0.3` |
|
|
26
|
+
| `typescript` | `^6.0.3 \|\| ^7.0.0` |
|
|
27
27
|
|
|
28
28
|
`@nxgt/graphql-validation` is a dependency; you install it yourself only to
|
|
29
|
-
run `withValidation` on a server
|
|
29
|
+
run `withValidation` on a server, or to type your formats module with its
|
|
30
|
+
`FormatSchemas` (see [Your own formats](#your-own-formats)).
|
|
30
31
|
|
|
31
32
|
## Setup
|
|
32
33
|
|
|
@@ -34,7 +35,8 @@ Write the SDL files codegen reads: `@constraint` from
|
|
|
34
35
|
`@nxgt/graphql-validation` and the custom scalars from `@nxgt/graphql-scalars`.
|
|
35
36
|
Install both, so their bins are yours, whatever the package manager links:
|
|
36
37
|
`bun add @nxgt/graphql-validation @nxgt/graphql-scalars` (the generated file
|
|
37
|
-
imports `@nxgt/graphql-scalars` at run time
|
|
38
|
+
imports `@nxgt/graphql-scalars` at run time, unless it takes `@nxgt/zod`; see
|
|
39
|
+
below). Without the directive
|
|
38
40
|
nothing is constrained; plain types are still generated.
|
|
39
41
|
|
|
40
42
|
```sh
|
|
@@ -72,6 +74,10 @@ const config: CodegenConfig = {
|
|
|
72
74
|
export default config;
|
|
73
75
|
```
|
|
74
76
|
|
|
77
|
+
A client that only runs the generated file can set
|
|
78
|
+
`scalarSchemas: '@nxgt/zod'` instead: the same record, without `graphql`. See
|
|
79
|
+
[On a client](docs/guide/output.md#on-a-client-nxgtzod).
|
|
80
|
+
|
|
75
81
|
The plugin writes types named as `@graphql-codegen/typescript` names them
|
|
76
82
|
(`SignUpInput`, `MutationSignUpArgs`), which would collide with that plugin's
|
|
77
83
|
in one file. Its `*Args` and `*Variables` types can replace the typescript
|
|
@@ -83,6 +89,56 @@ plugin's; so can its object types, interfaces and unions (`User`), or
|
|
|
83
89
|
`scalarSchemas` supplies a Zod schema for each custom scalar of the schema;
|
|
84
90
|
see [Scalars](docs/guide/output.md#scalars).
|
|
85
91
|
|
|
92
|
+
### Your own formats
|
|
93
|
+
|
|
94
|
+
When the server hands `withValidation` formats of its own
|
|
95
|
+
(`withValidation(schema, { formats: formatSchemas })`, from
|
|
96
|
+
`@nxgt/graphql-validation` 0.3), point the plugin at the module that exports
|
|
97
|
+
that record. It loads it at generation, checks it as `withValidation` does,
|
|
98
|
+
and the generated schemas import it:
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
// src/formats.ts
|
|
102
|
+
import type { FormatSchemas } from '@nxgt/graphql-validation';
|
|
103
|
+
import { z } from 'zod';
|
|
104
|
+
|
|
105
|
+
export const formatSchemas = {
|
|
106
|
+
slug: z.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, 'Invalid slug'),
|
|
107
|
+
} satisfies FormatSchemas;
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
```ts
|
|
111
|
+
// codegen.ts, generating src/generated/zod.ts
|
|
112
|
+
config: {
|
|
113
|
+
scalarSchemas: '@nxgt/graphql-scalars',
|
|
114
|
+
formatSchemas: '../formats', // relative to the generated file; nodenext: '../formats.js'
|
|
115
|
+
},
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
```ts
|
|
119
|
+
// src/generated/zod.ts, for handle: String! @constraint(format: "slug", maxLength: 40)
|
|
120
|
+
import { formatSchemas } from "../formats";
|
|
121
|
+
|
|
122
|
+
handle: formatSchemas.slug.max(40),
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Keep `satisfies`, not a `Record<string, …>` annotation: the generated file
|
|
126
|
+
reads `formatSchemas.slug`. The module must be one graphql-codegen can import:
|
|
127
|
+
JavaScript, or TypeScript when codegen runs under Bun or tsx (plain
|
|
128
|
+
`graphql-codegen` under Node is not one: depending on its version it does not
|
|
129
|
+
load a `.ts` module, and it never reads `formats.js` as `formats.ts`). One it cannot load
|
|
130
|
+
fails generation. A format that rewrites the value (`.trim()`,
|
|
131
|
+
`.toLowerCase()`, `z.url()`, `z.coerce.string()`, …) fails it too, as it
|
|
132
|
+
fails `withValidation`.
|
|
133
|
+
|
|
134
|
+
The path is written into the generated import as you give it. Under
|
|
135
|
+
`moduleResolution: nodenext` (or `node16`), give it the `.js` extension, as
|
|
136
|
+
any relative import there: `formatSchemas: '../formats.js'`, even for
|
|
137
|
+
`formats.ts`; Bun and tsx still load it at generation. Without it the
|
|
138
|
+
generated file fails to typecheck with TS2835. The same holds for a relative
|
|
139
|
+
`scalarSchemas`, `zodScalars` or `zodFormats` path. See
|
|
140
|
+
[Your own formats](docs/guide/output.md#your-own-formats).
|
|
141
|
+
|
|
86
142
|
Run codegen, once or on every change:
|
|
87
143
|
|
|
88
144
|
```sh
|
|
@@ -178,6 +234,8 @@ are in [Output](docs/guide/output.md).
|
|
|
178
234
|
| --- | --- | --- | --- |
|
|
179
235
|
| `scalarSchemas` | `string` | none | module exporting a `scalarSchemas` record keyed by scalar name |
|
|
180
236
|
| `zodScalars` | `Record<string, string>` | none | `'<module>#<export>'` per scalar; wins over `scalarSchemas` |
|
|
237
|
+
| `formatSchemas` | `string` | none | module exporting a `formatSchemas` record, your own `@constraint(format: "...")` values, as `withValidation` takes them; loaded at generation |
|
|
238
|
+
| `zodFormats` | `Record<string, string>` | none | `'<module>#<export>'` per format; wins over `formatSchemas` |
|
|
181
239
|
| `schemaPrefix` | `string` | `'z'` | before each schema's name |
|
|
182
240
|
| `namingConvention` | `'keep' \| 'change-case-all#<case>' \| (name) => string \| { typeNames, transformUnderscore, enumValues }` | PascalCase per underscore part | how type names are cased, as the typescript plugins read it |
|
|
183
241
|
| `typesPrefix`, `typesSuffix` | `string` | none | around each type's name |
|
|
@@ -207,6 +265,10 @@ Each is detailed in [Output](docs/guide/output.md).
|
|
|
207
265
|
[validation troubleshooting](https://github.com/softistx/nxgt-graphql/blob/develop/packages/graphql-validation/docs/troubleshooting.md).
|
|
208
266
|
- A custom scalar mapped nowhere fails generation, naming it, rather than
|
|
209
267
|
becoming an unchecked `z.unknown()`.
|
|
268
|
+
- A format of your own is loaded at generation: the module `formatSchemas`
|
|
269
|
+
or `zodFormats` names must be importable by graphql-codegen, or generation
|
|
270
|
+
fails. It must also be the very record the server hands `withValidation`,
|
|
271
|
+
or the client and the server check different things.
|
|
210
272
|
- An abstract type whose possible types select different fields is a union on
|
|
211
273
|
`__typename`: select it, under one key for every member, or generation
|
|
212
274
|
fails. When they all select the same fields, no `__typename` is needed.
|
package/dist/config.d.ts
CHANGED
|
@@ -16,6 +16,18 @@ export interface CodegenZodConfig {
|
|
|
16
16
|
* `scalarSchemas`: `{ Money: './money#moneySchema' }`.
|
|
17
17
|
*/
|
|
18
18
|
readonly zodScalars?: Readonly<Record<string, string>>;
|
|
19
|
+
/**
|
|
20
|
+
* A module exporting `formatSchemas`, the record of the application's own
|
|
21
|
+
* formats that `withValidation(schema, { formats })` takes: a path
|
|
22
|
+
* relative to the generated file, or a package. Loaded at generation, so
|
|
23
|
+
* graphql-codegen must be able to import it.
|
|
24
|
+
*/
|
|
25
|
+
readonly formatSchemas?: string;
|
|
26
|
+
/**
|
|
27
|
+
* One format's schema, `'<module>#<export>'`, winning over
|
|
28
|
+
* `formatSchemas`: `{ slug: './slug#slugSchema' }`.
|
|
29
|
+
*/
|
|
30
|
+
readonly zodFormats?: Readonly<Record<string, string>>;
|
|
19
31
|
/** Before each schema's name: `zSignUpInput`. Default `'z'`. */
|
|
20
32
|
readonly schemaPrefix?: string;
|
|
21
33
|
/**
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAChC;;;;OAIG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC;;;OAGG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACvD,gEAAgE;IAChE,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;;OAKG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EACvB,MAAM,GACN,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC,GAC1B;QACA,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;QACzD,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;QAC9B,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAC;KACtC,CAAC;IACL,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAC3C,Q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UAAU,CAAC,EAAE,OAAO,CAAC;QAC9B,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAC;KACtC,CAAC;IACL,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAC3C,QAAQ,CAAC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IACzC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IACvC;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B;;;OAGG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,sEAAsE;AACtE,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC;IAC7C,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACvC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { FormatSchemas } from '@nxgt/graphql-validation/codegen';
|
|
2
|
+
import type { CodegenZodConfig } from './config.js';
|
|
3
|
+
import type { Imports } from './imports.js';
|
|
4
|
+
/** The application's formats as the writer needs them for one file. */
|
|
5
|
+
export interface FormatCode {
|
|
6
|
+
/** The record `checkConstraints` and `inputCode` take; none when unset. */
|
|
7
|
+
readonly schemas: FormatSchemas | undefined;
|
|
8
|
+
/** The source of a format's schema, its import added. */
|
|
9
|
+
readonly code: (name: string) => string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The application's own formats: `zodFormats` entries, winning over the
|
|
13
|
+
* `formatSchemas` record. Unlike a scalar record, each module is loaded,
|
|
14
|
+
* never trusted: the plugin checks every format, and every default against
|
|
15
|
+
* it, as `withValidation` does, so a module it cannot load fails generation.
|
|
16
|
+
*/
|
|
17
|
+
export declare class FormatSources {
|
|
18
|
+
#private;
|
|
19
|
+
/** The record `checkConstraints` and `inputCode` take; none when unset. */
|
|
20
|
+
readonly schemas: FormatSchemas | undefined;
|
|
21
|
+
private constructor();
|
|
22
|
+
static load(config: CodegenZodConfig, outputFile: string | undefined): Promise<FormatSources>;
|
|
23
|
+
/** The formats as written into a file whose imports are `imports`. */
|
|
24
|
+
for(imports: Imports): FormatCode;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=formats.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formats.d.ts","sourceRoot":"","sources":["../src/formats.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAWzC,uEAAuE;AACvE,MAAM,WAAW,UAAU;IAC1B,2EAA2E;IAC3E,QAAQ,CAAC,OAAO,EAAE,aAAa,GAAG,SAAS,CAAC;IAC5C,yDAAyD;IACzD,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CACxC;AAED;;;;;GAKG;AACH,qBAAa,aAAa;;IACzB,2EAA2E;IAC3E,QAAQ,CAAC,OAAO,EAAE,aAAa,GAAG,SAAS,CAAC;IAG5C,OAAO;WAQM,IAAI,CAChB,MAAM,EAAE,gBAAgB,EACxB,UAAU,EAAE,MAAM,GAAG,SAAS,GAC5B,OAAO,CAAC,aAAa,CAAC;IA6CzB,sEAAsE;IACtE,GAAG,CAAC,OAAO,EAAE,OAAO,GAAG,UAAU;CAejC"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,aAAa,EAIlB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,aAAa,EAIlB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAW/D,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE/D;;;;;;GAMG;AACH,wBAAsB,MAAM,CAC3B,MAAM,EAAE,aAAa,EACrB,SAAS,EAAE,SAAS,YAAY,EAAE,EAClC,MAAM,GAAE,gBAAqB,EAC7B,IAAI,CAAC,EAAE;IAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GACjD,OAAO,CAAC,MAAM,CAAC,CAsCjB"}
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,80 @@ import {
|
|
|
6
6
|
isObjectType as isObjectType6
|
|
7
7
|
} from "graphql";
|
|
8
8
|
|
|
9
|
+
// src/modules.ts
|
|
10
|
+
import { createRequire } from "node:module";
|
|
11
|
+
import { dirname, resolve } from "node:path";
|
|
12
|
+
import { pathToFileURL } from "node:url";
|
|
13
|
+
async function importModule(module, outputFile) {
|
|
14
|
+
const path = module.startsWith(".") ? resolve(dirname(resolve(outputFile ?? "index.ts")), module) : createRequire(resolve("package.json")).resolve(module);
|
|
15
|
+
return import(pathToFileURL(path).href);
|
|
16
|
+
}
|
|
17
|
+
function moduleExport(option, value, example) {
|
|
18
|
+
const at = value.lastIndexOf("#");
|
|
19
|
+
if (at <= 0 || at === value.length - 1) {
|
|
20
|
+
throw new Error(`@nxgt/graphql-codegen-zod: ${option} is "${value}"; write it '<module>#<export>', e.g. '${example}'.`);
|
|
21
|
+
}
|
|
22
|
+
return { module: value.slice(0, at), exported: value.slice(at + 1) };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// src/formats.ts
|
|
26
|
+
class FormatSources {
|
|
27
|
+
schemas;
|
|
28
|
+
#sources;
|
|
29
|
+
constructor(schemas, sources) {
|
|
30
|
+
this.schemas = schemas;
|
|
31
|
+
this.#sources = sources;
|
|
32
|
+
}
|
|
33
|
+
static async load(config, outputFile) {
|
|
34
|
+
const schemas = {};
|
|
35
|
+
const sources = new Map;
|
|
36
|
+
const record = config.formatSchemas;
|
|
37
|
+
if (record) {
|
|
38
|
+
const loaded = (await load("formatSchemas", record, outputFile))["formatSchemas"];
|
|
39
|
+
if (typeof loaded !== "object" || loaded === null || Array.isArray(loaded)) {
|
|
40
|
+
throw new Error(`@nxgt/graphql-codegen-zod: ${record} exports no formatSchemas record.`);
|
|
41
|
+
}
|
|
42
|
+
for (const [key, schema] of Object.entries(loaded)) {
|
|
43
|
+
schemas[key] = schema;
|
|
44
|
+
sources.set(key, { module: record, exported: "formatSchemas", key });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
for (const [name, value] of Object.entries(config.zodFormats ?? {})) {
|
|
48
|
+
const option = `zodFormats.${name}`;
|
|
49
|
+
const { module, exported } = moduleExport(option, value, "./slug#slugSchema");
|
|
50
|
+
const loaded = await load(option, module, outputFile);
|
|
51
|
+
if (!Object.hasOwn(loaded, exported)) {
|
|
52
|
+
throw new Error(`@nxgt/graphql-codegen-zod: ${module} exports no ${exported} (${option}).`);
|
|
53
|
+
}
|
|
54
|
+
schemas[name] = loaded[exported];
|
|
55
|
+
sources.set(name, { module, exported });
|
|
56
|
+
}
|
|
57
|
+
return new FormatSources(sources.size > 0 || record ? schemas : undefined, sources);
|
|
58
|
+
}
|
|
59
|
+
for(imports) {
|
|
60
|
+
return {
|
|
61
|
+
schemas: this.schemas,
|
|
62
|
+
code: (name) => {
|
|
63
|
+
const source = this.#sources.get(name);
|
|
64
|
+
if (!source)
|
|
65
|
+
throw new Error(`Unknown application format "${name}".`);
|
|
66
|
+
const local = imports.add(source.module, source.exported);
|
|
67
|
+
if (source.key === undefined)
|
|
68
|
+
return local;
|
|
69
|
+
return /^[a-z][a-z0-9]*$/.test(source.key) ? `${local}.${source.key}` : `${local}[${JSON.stringify(source.key)}]`;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
async function load(option, module, outputFile) {
|
|
75
|
+
try {
|
|
76
|
+
return await importModule(module, outputFile);
|
|
77
|
+
} catch (error) {
|
|
78
|
+
const cause = error instanceof Error ? error.message : String(error);
|
|
79
|
+
throw new Error(`@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.`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
9
83
|
// src/imports.ts
|
|
10
84
|
class Imports {
|
|
11
85
|
#byModule = new Map([
|
|
@@ -583,10 +657,6 @@ function resultsBlocks(schema, documents, writer, naming) {
|
|
|
583
657
|
}
|
|
584
658
|
|
|
585
659
|
// src/scalars.ts
|
|
586
|
-
import { createRequire } from "node:module";
|
|
587
|
-
import { dirname, resolve } from "node:path";
|
|
588
|
-
import { pathToFileURL } from "node:url";
|
|
589
|
-
|
|
590
660
|
class ScalarSources {
|
|
591
661
|
#config;
|
|
592
662
|
#imports;
|
|
@@ -605,11 +675,8 @@ class ScalarSources {
|
|
|
605
675
|
code(type) {
|
|
606
676
|
const own = this.#config.zodScalars?.[type.name];
|
|
607
677
|
if (own !== undefined) {
|
|
608
|
-
const
|
|
609
|
-
|
|
610
|
-
throw new Error(`@nxgt/graphql-codegen-zod: zodScalars.${type.name} is "${own}"; write it '<module>#<export>', e.g. './money#moneySchema'.`);
|
|
611
|
-
}
|
|
612
|
-
return this.#imports.add(own.slice(0, at), own.slice(at + 1));
|
|
678
|
+
const { module, exported } = moduleExport(`zodScalars.${type.name}`, own, "./money#moneySchema");
|
|
679
|
+
return this.#imports.add(module, exported);
|
|
613
680
|
}
|
|
614
681
|
const record = this.#config.scalarSchemas;
|
|
615
682
|
if (record && (!this.#recordKeys || this.#recordKeys.has(type.name))) {
|
|
@@ -621,9 +688,7 @@ class ScalarSources {
|
|
|
621
688
|
}
|
|
622
689
|
async function recordKeys(module, outputFile) {
|
|
623
690
|
try {
|
|
624
|
-
const
|
|
625
|
-
const loaded = await import(pathToFileURL(base).href);
|
|
626
|
-
const record = loaded.scalarSchemas;
|
|
691
|
+
const record = (await importModule(module, outputFile))["scalarSchemas"];
|
|
627
692
|
if (typeof record !== "object" || record === null) {
|
|
628
693
|
throw new Error(`@nxgt/graphql-codegen-zod: ${module} exports no scalarSchemas record.`);
|
|
629
694
|
}
|
|
@@ -1012,10 +1077,14 @@ class Writer {
|
|
|
1012
1077
|
directive;
|
|
1013
1078
|
#naming;
|
|
1014
1079
|
#scalars;
|
|
1015
|
-
|
|
1080
|
+
#formats;
|
|
1081
|
+
#options;
|
|
1082
|
+
constructor(directive, naming, scalars, formats) {
|
|
1016
1083
|
this.directive = directive;
|
|
1017
1084
|
this.#naming = naming;
|
|
1018
1085
|
this.#scalars = scalars;
|
|
1086
|
+
this.#formats = formats;
|
|
1087
|
+
this.#options = { list: singleOrList, format: formats.code };
|
|
1019
1088
|
}
|
|
1020
1089
|
scalarCode(type) {
|
|
1021
1090
|
return this.#scalars.code(type);
|
|
@@ -1036,13 +1105,11 @@ class Writer {
|
|
|
1036
1105
|
};
|
|
1037
1106
|
if (!defaultValue)
|
|
1038
1107
|
return {
|
|
1039
|
-
code: inputCode2(type, constraints, where, named,
|
|
1040
|
-
list: singleOrList
|
|
1041
|
-
}),
|
|
1108
|
+
code: inputCode2(type, constraints, where, named, this.#options, this.#formats.schemas),
|
|
1042
1109
|
lazy
|
|
1043
1110
|
};
|
|
1044
1111
|
const nullable = !isNonNullType7(type);
|
|
1045
|
-
const required = inputCode2(nullable ? new GraphQLNonNull(type) : type, constraints, where, named,
|
|
1112
|
+
const required = inputCode2(nullable ? new GraphQLNonNull(type) : type, constraints, where, named, this.#options, this.#formats.schemas);
|
|
1046
1113
|
const value = JSON.stringify(parsedDefault(defaultValue, type, where));
|
|
1047
1114
|
return {
|
|
1048
1115
|
code: `${required}.prefault(${value})${nullable ? ".nullable()" : ""}`,
|
|
@@ -1066,13 +1133,14 @@ var singleOrList = ({
|
|
|
1066
1133
|
|
|
1067
1134
|
// src/index.ts
|
|
1068
1135
|
async function plugin(schema, documents, config = {}, info) {
|
|
1069
|
-
const
|
|
1136
|
+
const formats = await FormatSources.load(config, info?.outputFile);
|
|
1137
|
+
const directive = checkConstraints(schema, undefined, formats.schemas);
|
|
1070
1138
|
if (directive)
|
|
1071
1139
|
assertSdl(schema);
|
|
1072
1140
|
const naming = new Naming(config);
|
|
1073
1141
|
const write = async (imports) => {
|
|
1074
1142
|
const scalars = await ScalarSources.load(config, imports, info?.outputFile);
|
|
1075
|
-
const writer = new Writer(directive, naming, scalars);
|
|
1143
|
+
const writer = new Writer(directive, naming, scalars, formats.for(imports));
|
|
1076
1144
|
return [
|
|
1077
1145
|
...schemaBlocks(schema, writer, naming),
|
|
1078
1146
|
...config.objects === false ? [] : objectBlocks(schema, writer, naming),
|
|
@@ -1110,5 +1178,5 @@ export {
|
|
|
1110
1178
|
plugin
|
|
1111
1179
|
};
|
|
1112
1180
|
|
|
1113
|
-
//# debugId=
|
|
1181
|
+
//# debugId=6146A02E619F9D3564756E2164756E21
|
|
1114
1182
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
{
|
|
2
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"],
|
|
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"],
|
|
4
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",
|
|
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
|
+
"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
|
+
"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",
|
|
6
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",
|
|
7
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",
|
|
8
10
|
"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",
|
|
@@ -12,14 +14,14 @@
|
|
|
12
14
|
"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
15
|
"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
16
|
"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
|
|
17
|
+
"import type { GraphQLScalarType } from 'graphql';\nimport type { CodegenZodConfig } from './config';\nimport type { Imports } from './imports';\nimport { importModule, moduleExport } from './modules';\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 { module, exported } = moduleExport(\n\t\t\t\t`zodScalars.${type.name}`,\n\t\t\t\town,\n\t\t\t\t'./money#moneySchema',\n\t\t\t);\n\t\t\treturn this.#imports.add(module, exported);\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 record = (await importModule(module, outputFile))['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
18
|
"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
19
|
"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
20
|
"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
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\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(
|
|
22
|
+
"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 { 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 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"
|
|
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A,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;",
|
|
25
|
+
"debugId": "6146A02E619F9D3564756E2164756E21",
|
|
24
26
|
"names": []
|
|
25
27
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Imports a module the config names as the generated file will: a path
|
|
3
|
+
* relative to `outputFile` (`'./formats'`), or a package resolved from the
|
|
4
|
+
* working directory (`'@nxgt/graphql-scalars'`). Throws what resolving or
|
|
5
|
+
* loading throws.
|
|
6
|
+
*/
|
|
7
|
+
export declare function importModule(module: string, outputFile: string | undefined): Promise<Readonly<Record<string, unknown>>>;
|
|
8
|
+
/** `'<module>#<export>'` split in two, or an error naming the option. */
|
|
9
|
+
export declare function moduleExport(option: string, value: string, example: string): {
|
|
10
|
+
readonly module: string;
|
|
11
|
+
readonly exported: string;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=modules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modules.d.ts","sourceRoot":"","sources":["../src/modules.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,wBAAsB,YAAY,CACjC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,GAAG,SAAS,GAC5B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAK5C;AAED,yEAAyE;AACzE,wBAAgB,YAAY,CAC3B,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,GACb;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAQxD"}
|
package/dist/scalars.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scalars.d.ts","sourceRoot":"","sources":["../src/scalars.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"scalars.d.ts","sourceRoot":"","sources":["../src/scalars.ts"],"names":[],"mappings":"AAAA,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;AAGzC;;;;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;CAqBrC"}
|
package/dist/writer.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Constraint } from '@nxgt/graphql-validation/codegen';
|
|
2
2
|
import { type ConstValueNode, type GraphQLDirective, type GraphQLInputType, type GraphQLNamedInputType, type GraphQLScalarType } from 'graphql';
|
|
3
|
+
import type { FormatCode } from './formats.js';
|
|
3
4
|
import type { Naming } from './naming.js';
|
|
4
5
|
import type { ScalarSources } from './scalars.js';
|
|
5
6
|
/** One value's schema as source, and whether it names an input object. */
|
|
@@ -19,7 +20,7 @@ export interface ValueCode {
|
|
|
19
20
|
export declare class Writer {
|
|
20
21
|
#private;
|
|
21
22
|
readonly directive: GraphQLDirective | undefined;
|
|
22
|
-
constructor(directive: GraphQLDirective | undefined, naming: Naming, scalars: ScalarSources);
|
|
23
|
+
constructor(directive: GraphQLDirective | undefined, naming: Naming, scalars: ScalarSources, formats: FormatCode);
|
|
23
24
|
/** The source of a custom scalar's schema, from its mapping. */
|
|
24
25
|
scalarCode(type: GraphQLScalarType): string;
|
|
25
26
|
/** The schema's name of an enum or an input object. */
|
package/dist/writer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writer.d.ts","sourceRoot":"","sources":["../src/writer.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,UAAU,EAGf,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACN,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAE1B,KAAK,iBAAiB,EAOtB,MAAM,SAAS,CAAC;AAEjB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C,0EAA0E;AAC1E,MAAM,WAAW,SAAS;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,yEAAyE;IACzE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,8DAA8D;IAC9D,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACjD;AAED;;;;;GAK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AC3B,SAAS;IAwCZ,yEAAyE;IACzE,QAAQ,CACP,IAAI,EAAE,gBAAgB,EACtB,WAAW,EAAE,SAAS,UAAU,EAAE,EAClC,KAAK,EAAE,MAAM,GACX,SAAS;CAOZ"}
|
package/docs/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
| Page | Read it when |
|
|
6
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,
|
|
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, how custom scalars are mapped, and your own formats |
|
|
8
8
|
|
|
9
9
|
## Reference
|
|
10
10
|
|
package/docs/guide/output.md
CHANGED
|
@@ -413,13 +413,13 @@ A custom scalar needs a Zod schema from you, mapped in one of two ways:
|
|
|
413
413
|
|
|
414
414
|
| Option | Type | Effect |
|
|
415
415
|
| --- | --- | --- |
|
|
416
|
-
| `scalarSchemas` | `string` | a module exporting a `scalarSchemas` record keyed by GraphQL name; `@nxgt/graphql-scalars` exports one from 0.4.0 |
|
|
416
|
+
| `scalarSchemas` | `string` | a module exporting a `scalarSchemas` record keyed by GraphQL name; `@nxgt/graphql-scalars` exports one from 0.4.0, `@nxgt/zod` from 0.1.0 |
|
|
417
417
|
| `zodScalars` | `Record<string, string>` | `'<module>#<export>'` for one scalar; wins over the record |
|
|
418
418
|
|
|
419
419
|
```ts
|
|
420
420
|
config: {
|
|
421
421
|
scalarSchemas: '@nxgt/graphql-scalars',
|
|
422
|
-
zodScalars: { Money: './money#moneySchema' },
|
|
422
|
+
zodScalars: { Money: './money#moneySchema' }, // nodenext: './money.js#moneySchema'
|
|
423
423
|
}
|
|
424
424
|
```
|
|
425
425
|
|
|
@@ -435,10 +435,47 @@ birth: scalarSchemas.DateTime.nullish(),
|
|
|
435
435
|
price: moneySchema,
|
|
436
436
|
```
|
|
437
437
|
|
|
438
|
+
### On a client: `@nxgt/zod`
|
|
439
|
+
|
|
440
|
+
`@nxgt/zod` exports the same `scalarSchemas` record, with the rules of
|
|
441
|
+
`@nxgt/graphql-scalars`, and does not depend on `graphql`. A client that only
|
|
442
|
+
runs the generated file imports it instead, and keeps `graphql` out of its
|
|
443
|
+
bundle:
|
|
444
|
+
|
|
445
|
+
```ts
|
|
446
|
+
config: { scalarSchemas: '@nxgt/zod' },
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
```ts
|
|
450
|
+
// what the generated file imports
|
|
451
|
+
import { z } from "zod";
|
|
452
|
+
import { scalarSchemas } from "@nxgt/zod";
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
The generated schemas are the same either way; only the import changes. The
|
|
456
|
+
SDL codegen reads still comes from `@nxgt/graphql-scalars`
|
|
457
|
+
(`bunx nxgt-graphql-scalars typedefs --out`), so a client installs it as a
|
|
458
|
+
devDependency and `@nxgt/zod` as a dependency. Everything codegen needs is a
|
|
459
|
+
devDependency too, so `graphql` never reaches the bundle: the generated file
|
|
460
|
+
imports only `zod` and `@nxgt/zod`.
|
|
461
|
+
|
|
462
|
+
```sh
|
|
463
|
+
bun add @nxgt/zod zod
|
|
464
|
+
bun add -d @nxgt/graphql-codegen-zod @nxgt/graphql-validation @nxgt/graphql-scalars
|
|
465
|
+
bun add -d graphql @graphql-codegen/cli typescript
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
Under `moduleResolution` `nodenext` or `node16`, use `@nxgt/zod` 0.1.2 or
|
|
469
|
+
later.
|
|
470
|
+
|
|
438
471
|
- Two exports with the same name from different modules are aliased:
|
|
439
472
|
`import { schema } from "./money"; import { schema as schema2 } from "./cost";`.
|
|
440
473
|
- Module paths are written as they are in the generated file, so a relative
|
|
441
|
-
one (`./money`) is relative to **it**, not to `codegen.ts`.
|
|
474
|
+
one (`./money`) is relative to **it**, not to `codegen.ts`. Under
|
|
475
|
+
`moduleResolution` `nodenext` or `node16`, write a relative one with its
|
|
476
|
+
`.js` extension (`'./money.js#moneySchema'`, even for `money.ts`), or the
|
|
477
|
+
generated file fails with
|
|
478
|
+
[TS2835](../troubleshooting.md#ts2835-relative-import-paths-need-explicit-file-extensions-in-ecmascript-imports-when---moduleresolution-is-node16-or-nodenext-did-you-mean-formatsjs).
|
|
442
479
|
- A custom scalar that is in neither fails generation, naming it. See
|
|
443
480
|
[Troubleshooting](../troubleshooting.md).
|
|
444
481
|
- The option is `zodScalars`, not `scalars`: a root `config: { scalars: {
|
|
@@ -450,6 +487,104 @@ price: moneySchema,
|
|
|
450
487
|
- A rule on a custom scalar (`@constraint` on a `DateTime` field) is refused,
|
|
451
488
|
as `withValidation` refuses it; check the value in the scalar's own schema.
|
|
452
489
|
|
|
490
|
+
## Your own formats
|
|
491
|
+
|
|
492
|
+
`@nxgt/graphql-validation` 0.3 takes formats of your own:
|
|
493
|
+
`withValidation(schema, { formats })`, a record of Zod string schemas that
|
|
494
|
+
`@constraint(format: "...")` may name beside the built-in ones. The plugin
|
|
495
|
+
reads the same record, mapped in one of two ways:
|
|
496
|
+
|
|
497
|
+
| Option | Type | Effect |
|
|
498
|
+
| --- | --- | --- |
|
|
499
|
+
| `formatSchemas` | `string` | a module exporting a `formatSchemas` record keyed by format name, the one the server hands `withValidation` |
|
|
500
|
+
| `zodFormats` | `Record<string, string>` | `'<module>#<export>'` for one format; wins over the record |
|
|
501
|
+
|
|
502
|
+
```ts
|
|
503
|
+
// src/formats.ts, shared by the server and codegen
|
|
504
|
+
import type { FormatSchemas } from '@nxgt/graphql-validation';
|
|
505
|
+
import { z } from 'zod';
|
|
506
|
+
|
|
507
|
+
export const formatSchemas = {
|
|
508
|
+
slug: z.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, 'Invalid slug'),
|
|
509
|
+
'country-code': z.string().length(2).refine(
|
|
510
|
+
(value) => value === value.toUpperCase(),
|
|
511
|
+
'Invalid country code: write it uppercase',
|
|
512
|
+
),
|
|
513
|
+
} satisfies FormatSchemas;
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
```ts
|
|
517
|
+
// codegen.ts
|
|
518
|
+
config: {
|
|
519
|
+
formatSchemas: '../formats', // relative to the generated file; nodenext: '../formats.js'
|
|
520
|
+
zodFormats: { sku: '../sku#skuSchema' }, // nodenext: '../sku.js#skuSchema'
|
|
521
|
+
}
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
```graphql
|
|
525
|
+
input SignUpInput {
|
|
526
|
+
handle: String! @constraint(format: "slug", maxLength: 40)
|
|
527
|
+
country: String @constraint(format: "country-code")
|
|
528
|
+
skus: [String!] @constraint(format: "sku", maxItems: 2)
|
|
529
|
+
email: String! @constraint(format: "email")
|
|
530
|
+
}
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
```ts
|
|
534
|
+
// what the generated file imports and writes
|
|
535
|
+
import { formatSchemas } from "../formats";
|
|
536
|
+
import { skuSchema } from "../sku";
|
|
537
|
+
|
|
538
|
+
handle: formatSchemas.slug.max(40),
|
|
539
|
+
country: formatSchemas["country-code"].nullish(),
|
|
540
|
+
skus: z.union([z.array(skuSchema).max(2), /* a single value, wrapped */]).nullish(),
|
|
541
|
+
email: z.email(),
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
- **Your schema, then the other rules.** `format` comes first and the rules
|
|
545
|
+
after it are chained on your schema, as `withValidation` applies them: the
|
|
546
|
+
client refuses what the server refuses, with your messages. A key that is
|
|
547
|
+
not an identifier is read with brackets (`formatSchemas["country-code"]`).
|
|
548
|
+
- **Export the record as an object literal** (`satisfies FormatSchemas`,
|
|
549
|
+
as above), never annotated `Record<string, …>`: the generated file reads
|
|
550
|
+
`formatSchemas.slug`, which `noUncheckedIndexedAccess` types
|
|
551
|
+
`… | undefined` on a `Record`, and the file then fails to typecheck.
|
|
552
|
+
- **The built-in formats stay inline** (`z.email()`), whatever the record
|
|
553
|
+
holds; a record cannot replace them.
|
|
554
|
+
- **Loaded, never trusted.** The plugin imports each module at generation and
|
|
555
|
+
checks the record as `withValidation` does: names, no built-in name, a Zod
|
|
556
|
+
string schema each, and every default value against its format. A module it
|
|
557
|
+
cannot load fails generation; unlike a `scalarSchemas` record, it is never
|
|
558
|
+
taken on trust, since a default could then break its format unseen. Run
|
|
559
|
+
codegen under Bun or tsx to load a TypeScript module (plain
|
|
560
|
+
`graphql-codegen` under Node may not load one, and never reads
|
|
561
|
+
`formats.js` as `formats.ts`), or point the option at JavaScript. A
|
|
562
|
+
format that rewrites the value (`.trim()`, `.toLowerCase()`,
|
|
563
|
+
`.toUpperCase()`, `.normalize()`, `.slugify()`, `.overwrite()`, `z.url()`,
|
|
564
|
+
`z.httpUrl()`, `.url()`, `z.coerce.string()`) fails generation as it fails
|
|
565
|
+
`withValidation`: the client would check the rewritten value, the server
|
|
566
|
+
the one sent. A custom `.check()` that sets `ctx.value` shows nothing to
|
|
567
|
+
check: the server fails the request it rewrites, naming the format, so
|
|
568
|
+
fix the format rather than trust the client.
|
|
569
|
+
- **The `.js` extension under `nodenext`.** The path is written into the
|
|
570
|
+
generated import as given, so under `moduleResolution` `nodenext` or
|
|
571
|
+
`node16` a relative one needs its extension, as any relative import there:
|
|
572
|
+
`formatSchemas: '../formats.js'` and `zodFormats: { sku: '../sku.js#skuSchema' }`,
|
|
573
|
+
even when the files are `formats.ts` and `sku.ts`. Bun and tsx load them at
|
|
574
|
+
generation all the same. Without it, the generated file fails with
|
|
575
|
+
[TS2835](../troubleshooting.md#ts2835-relative-import-paths-need-explicit-file-extensions-in-ecmascript-imports-when---moduleresolution-is-node16-or-nodenext-did-you-mean-formatsjs).
|
|
576
|
+
- **One record for both sides.** Hand the server the very record codegen
|
|
577
|
+
reads, `zodFormats` entries included
|
|
578
|
+
(`withValidation(schema, { formats: { ...formatSchemas, sku: skuSchema } })`),
|
|
579
|
+
or the client and the server check different things.
|
|
580
|
+
- **The client's issue has no `constraint`.** The server's carries
|
|
581
|
+
`constraint: "format"` for every issue your schema raises; the generated
|
|
582
|
+
schema is plain Zod, its issues the ones your schema raises, as for a
|
|
583
|
+
built-in format.
|
|
584
|
+
- A format that neither option maps fails generation with `withValidation`'s
|
|
585
|
+
own message, `Unknown @constraint format "slug". Known formats: …`. See
|
|
586
|
+
[Troubleshooting](../troubleshooting.md#formats).
|
|
587
|
+
|
|
453
588
|
## Output types
|
|
454
589
|
|
|
455
590
|
Every object type gets a schema and a type, typed `z.output`: what a
|
package/docs/roadmap.md
CHANGED
|
@@ -4,10 +4,11 @@ What `@nxgt/graphql-codegen-zod` is heading for, phrased as what you get.
|
|
|
4
4
|
|
|
5
5
|
## Now
|
|
6
6
|
|
|
7
|
-
- **
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
- **Your own formats** (in progress, not released yet). `formatSchemas:
|
|
8
|
+
'./formats'` reads the record `withValidation(schema, { formats })` takes,
|
|
9
|
+
`zodFormats` one format; the generated schemas import your formats and
|
|
10
|
+
chain the other rules on them, so the client refuses what the server
|
|
11
|
+
refuses. Needs `@nxgt/graphql-validation` 0.3.
|
|
11
12
|
|
|
12
13
|
## Next
|
|
13
14
|
|
|
@@ -15,8 +16,6 @@ Candidates, not commitments.
|
|
|
15
16
|
|
|
16
17
|
- **Emit only some parts**, an option to write just the arguments, or just
|
|
17
18
|
the variables, of a file.
|
|
18
|
-
- **Your own formats**, once `@nxgt/graphql-validation` supports custom
|
|
19
|
-
`@constraint(format: "...")` values; the plugin will carry them.
|
|
20
19
|
|
|
21
20
|
## Later
|
|
22
21
|
|
|
@@ -32,6 +31,13 @@ Nothing yet.
|
|
|
32
31
|
|
|
33
32
|
## Shipped
|
|
34
33
|
|
|
34
|
+
- **Declarations that resolve under `nodenext`, 0.2.1.** The generated
|
|
35
|
+
file's `scalarSchemas` import typechecks with `moduleResolution`
|
|
36
|
+
`nodenext` or `node16`, with `@nxgt/graphql-scalars` 0.4.1 or later.
|
|
37
|
+
- **Output types, 0.2.0.** Zod schemas and types for the SDL's object types,
|
|
38
|
+
interfaces and unions, and for each named operation's result and each
|
|
39
|
+
fragment, with `__typename` discriminating abstract types; `objects: false`
|
|
40
|
+
or `operations: false` turns either part off.
|
|
35
41
|
- **The first release, 0.1.0.** Zod 4 schemas and types for enums, input
|
|
36
42
|
types, field arguments and operation variables, carrying every
|
|
37
43
|
`@constraint` of `@nxgt/graphql-validation`, so the client refuses what the
|
package/docs/troubleshooting.md
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
# Troubleshooting
|
|
2
2
|
|
|
3
3
|
One entry per error you can hit, headed by the message you will search for.
|
|
4
|
-
Configuration, Scalars, Operations and The schema happen while
|
|
4
|
+
Configuration, Scalars, Formats, Operations and The schema happen while
|
|
5
5
|
`graphql-codegen` runs; The generated file is what `tsc` and the generated
|
|
6
6
|
schemas report.
|
|
7
7
|
|
|
8
8
|
- [Configuration](#configuration)
|
|
9
9
|
- [Scalars](#scalars)
|
|
10
|
+
- [Formats](#formats)
|
|
10
11
|
- [Operations](#operations)
|
|
11
12
|
- [The generated file](#the-generated-file)
|
|
12
13
|
- [The schema](#the-schema)
|
|
@@ -86,6 +87,119 @@ export const scalarSchemas = {
|
|
|
86
87
|
};
|
|
87
88
|
```
|
|
88
89
|
|
|
90
|
+
## Formats
|
|
91
|
+
|
|
92
|
+
Your own `@constraint(format: "...")` values, from `formatSchemas` and
|
|
93
|
+
`zodFormats`. The plugin loads them at generation, so each module must be one
|
|
94
|
+
graphql-codegen can import.
|
|
95
|
+
|
|
96
|
+
### `@nxgt/graphql-codegen-zod: cannot load ./formats (formatSchemas): …`
|
|
97
|
+
|
|
98
|
+
The full message goes on: `<the loader's own error>. The plugin checks your
|
|
99
|
+
formats as withValidation does, so it must import them: point formatSchemas at
|
|
100
|
+
a module graphql-codegen can load: a path relative to the generated file or a
|
|
101
|
+
package, in JavaScript, or in TypeScript when codegen runs under Bun or tsx.`
|
|
102
|
+
With `zodFormats`, the option reads `zodFormats.slug`.
|
|
103
|
+
|
|
104
|
+
**When:** running codegen with `formatSchemas` or `zodFormats` set, when the
|
|
105
|
+
module cannot be imported: the path is wrong, it is TypeScript and codegen
|
|
106
|
+
runs under a Node that does not load it, or the module itself throws.
|
|
107
|
+
**Why:** the plugin checks your formats, and every default value against
|
|
108
|
+
them, as `withValidation` does at startup, so it needs the real schemas.
|
|
109
|
+
Unlike a `scalarSchemas` record, a module it cannot load is never trusted:
|
|
110
|
+
a default that breaks its format would reach the generated file unseen.
|
|
111
|
+
**Fix:** a relative path is relative to the **generated file**, not to
|
|
112
|
+
`codegen.ts`. Then make the module loadable: run codegen under Bun or tsx
|
|
113
|
+
(`bunx --bun graphql-codegen` runs it under Bun), or point
|
|
114
|
+
the option at a compiled `.js` file or a package.
|
|
115
|
+
|
|
116
|
+
```ts
|
|
117
|
+
// generating src/generated/zod.ts from src/formats.ts
|
|
118
|
+
config: { formatSchemas: '../formats' }
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### `The format "sku" rewrites the value (.trim(), .toLowerCase(), .toUpperCase(), .normalize(), .slugify(), .overwrite(), z.url(), z.httpUrl() or z.coerce.string()): refuse what is not canonical with .regex() or .refine() instead, so the server and the client check the value as it was sent.`
|
|
122
|
+
|
|
123
|
+
**When:** running codegen with `formatSchemas` or `zodFormats` naming a
|
|
124
|
+
schema that rewrites the value: `z.string().trim().toUpperCase()`, any of
|
|
125
|
+
`.trim()`, `.toLowerCase()`, `.toUpperCase()`, `.normalize()`, `.slugify()`,
|
|
126
|
+
`.overwrite()`, a URL format (`z.url()`, `z.httpUrl()`, `.url()`, which trim
|
|
127
|
+
the value) or `z.coerce.string()` (which turns `12345` into `"12345"`).
|
|
128
|
+
**Why:** the generated client chains the other rules on your schema, so it
|
|
129
|
+
would check the rewritten value while the server checks the one sent: with
|
|
130
|
+
`@constraint(format: "sku", maxLength: 8)`, the server refuses `" sku-1234 "`
|
|
131
|
+
and the client accepts it. The plugin refuses it as `withValidation` does
|
|
132
|
+
([its entry](https://github.com/softistx/nxgt-graphql/blob/develop/packages/graphql-validation/docs/troubleshooting.md)).
|
|
133
|
+
**Fix:** refuse what is not canonical instead:
|
|
134
|
+
|
|
135
|
+
```ts
|
|
136
|
+
export const skuSchema = z.string().regex(/^SKU-[0-9]{4}$/, 'Invalid SKU');
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### `@nxgt/graphql-codegen-zod: ./formats exports no formatSchemas record.`
|
|
140
|
+
|
|
141
|
+
**When:** running codegen with `formatSchemas` set. The module path in the
|
|
142
|
+
message is the one you configured.
|
|
143
|
+
**Why:** the module loaded, but exports no `formatSchemas` object.
|
|
144
|
+
**Fix:** export the record under that name, or name one format at a time
|
|
145
|
+
with `zodFormats`.
|
|
146
|
+
|
|
147
|
+
```ts
|
|
148
|
+
// formats.ts
|
|
149
|
+
import { z } from 'zod';
|
|
150
|
+
|
|
151
|
+
export const formatSchemas = {
|
|
152
|
+
slug: z.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, 'Invalid slug'),
|
|
153
|
+
};
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### `@nxgt/graphql-codegen-zod: zodFormats.slug is "slugSchema"; write it '<module>#<export>', e.g. './slug#slugSchema'.`
|
|
157
|
+
|
|
158
|
+
**When:** running codegen with a `zodFormats` entry that is not
|
|
159
|
+
`module#export`.
|
|
160
|
+
**Why:** the entry needs a module and an export name on either side of the
|
|
161
|
+
last `#`; the one in the message has none, or an empty side.
|
|
162
|
+
**Fix:**
|
|
163
|
+
|
|
164
|
+
```ts
|
|
165
|
+
config: { zodFormats: { slug: './slug#slugSchema' } }
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### `@nxgt/graphql-codegen-zod: ./slug exports no slugSchema (zodFormats.slug).`
|
|
169
|
+
|
|
170
|
+
**When:** running codegen with a `zodFormats` entry whose module loaded but
|
|
171
|
+
has no export of that name.
|
|
172
|
+
**Why:** the name after `#` must be one the module exports, spelled the same.
|
|
173
|
+
**Fix:** export the schema under that name, or correct the entry.
|
|
174
|
+
|
|
175
|
+
```ts
|
|
176
|
+
// slug.ts
|
|
177
|
+
export const slugSchema = z.string().regex(/^[a-z0-9-]+$/, 'Invalid slug');
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### `Unknown @constraint format "slug". Known formats: byte, date, date-time, email, ipv4, ipv6, uri, uuid.`
|
|
181
|
+
|
|
182
|
+
**When:** running codegen on a schema whose `@constraint(format: "slug")`
|
|
183
|
+
names a format of your own, with neither `formatSchemas` nor `zodFormats`
|
|
184
|
+
mapping it. The list ends with the formats the plugin did load.
|
|
185
|
+
**Why:** this is `withValidation`'s own message: the plugin knows the
|
|
186
|
+
built-in formats and those you map, nothing else.
|
|
187
|
+
**Fix:** point `formatSchemas` at the record the server hands
|
|
188
|
+
`withValidation`, or map that one format.
|
|
189
|
+
|
|
190
|
+
```ts
|
|
191
|
+
config: { formatSchemas: '../formats' }
|
|
192
|
+
// or
|
|
193
|
+
config: { zodFormats: { slug: '../slug#slugSchema' } }
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
The plugin also refuses, with `withValidation`'s messages, a format whose name
|
|
197
|
+
is a built-in one (`The format "email" is built in: give yours another
|
|
198
|
+
name.`), a schema that is not a Zod string schema, and a default value its
|
|
199
|
+
format refuses (`The default value of Query.a(s:) breaks its @constraint`);
|
|
200
|
+
each is in
|
|
201
|
+
[`@nxgt/graphql-validation`'s troubleshooting](https://github.com/softistx/nxgt-graphql/blob/develop/packages/graphql-validation/docs/troubleshooting.md).
|
|
202
|
+
|
|
89
203
|
## Operations
|
|
90
204
|
|
|
91
205
|
### `@nxgt/graphql-codegen-zod: SignUp's $input has a type the schema does not define.`
|
|
@@ -147,6 +261,29 @@ query Both($e: String, $u: String) { e(v: $e) u(v: $u) }
|
|
|
147
261
|
|
|
148
262
|
## The generated file
|
|
149
263
|
|
|
264
|
+
### `TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean '../formats.js'?`
|
|
265
|
+
|
|
266
|
+
**When:** type-checking the generated file under `moduleResolution`
|
|
267
|
+
`nodenext` or `node16`, with a relative `formatSchemas`, `zodFormats`,
|
|
268
|
+
`scalarSchemas` or `zodScalars` path written without an extension
|
|
269
|
+
(`formatSchemas: '../formats'`).
|
|
270
|
+
**Why:** the plugin writes the path into the generated import as you give it,
|
|
271
|
+
and `nodenext` requires a relative import to name its file, with the `.js`
|
|
272
|
+
extension even for a `.ts` source.
|
|
273
|
+
**Fix:** give the path its `.js` extension in the config. Bun and tsx load the
|
|
274
|
+
`.ts` file behind it at generation; plain `graphql-codegen` under Node never
|
|
275
|
+
reads `formats.js` as `formats.ts` (and, depending on its version, does not
|
|
276
|
+
load a `.ts` module at all), so run it under Bun (`bunx --bun graphql-codegen`)
|
|
277
|
+
or tsx.
|
|
278
|
+
|
|
279
|
+
```ts
|
|
280
|
+
// generating src/generated/zod.ts from src/formats.ts and src/sku.ts
|
|
281
|
+
config: {
|
|
282
|
+
formatSchemas: '../formats.js',
|
|
283
|
+
zodFormats: { sku: '../sku.js#skuSchema' },
|
|
284
|
+
}
|
|
285
|
+
```
|
|
286
|
+
|
|
150
287
|
### `TS2305: Module '"@nxgt/graphql-scalars"' has no exported member 'scalarSchemas'`
|
|
151
288
|
|
|
152
289
|
**When:** type-checking the generated file under `moduleResolution`
|
|
@@ -159,6 +296,18 @@ query Both($e: String, $u: String) { e(v: $e) u(v: $u) }
|
|
|
159
296
|
bun add @nxgt/graphql-scalars@latest
|
|
160
297
|
```
|
|
161
298
|
|
|
299
|
+
### `TS2305: Module '"@nxgt/zod"' has no exported member 'scalarSchemas'`
|
|
300
|
+
|
|
301
|
+
**When:** type-checking the generated file under `moduleResolution`
|
|
302
|
+
`nodenext` or `node16`, with `scalarSchemas: '@nxgt/zod'`.
|
|
303
|
+
**Why:** `@nxgt/zod` before 0.1.2 ships declarations that `nodenext` does not
|
|
304
|
+
resolve.
|
|
305
|
+
**Fix:** upgrade it to 0.1.2 or later.
|
|
306
|
+
|
|
307
|
+
```bash
|
|
308
|
+
bun add @nxgt/zod@latest
|
|
309
|
+
```
|
|
310
|
+
|
|
162
311
|
### `Property 'Money' does not exist on type '{ DateTime: ... }'` (or `TS2339`)
|
|
163
312
|
|
|
164
313
|
**When:** type-checking the generated file, with `scalarSchemas` set.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nxgt/graphql-codegen-zod",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.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",
|
|
@@ -46,18 +46,19 @@
|
|
|
46
46
|
"generated:write": "bun run test/write-generated.ts"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@nxgt/graphql-validation": "^0.
|
|
49
|
+
"@nxgt/graphql-validation": "^0.3.0",
|
|
50
50
|
"change-case": "^5.4.4"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@nxgt/graphql-scalars": "^0.
|
|
53
|
+
"@nxgt/graphql-scalars": "^0.6.1",
|
|
54
|
+
"@nxgt/zod": "^0.1.2",
|
|
54
55
|
"@types/bun": "^1.4.0",
|
|
55
56
|
"graphql": "16.11.0",
|
|
56
57
|
"zod": "4.6.5"
|
|
57
58
|
},
|
|
58
59
|
"peerDependencies": {
|
|
59
60
|
"graphql": "^16.11.0 || ^17.0.0",
|
|
60
|
-
"typescript": "^6.0.3",
|
|
61
|
+
"typescript": "^6.0.3 || ^7.0.0",
|
|
61
62
|
"zod": ">=4.6.5 <5"
|
|
62
63
|
}
|
|
63
64
|
}
|