@nxgt/graphql-codegen-zod 0.2.0 → 0.2.1
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/dist/index.d.ts +2 -2
- package/dist/naming.d.ts +1 -1
- package/dist/objects-output.d.ts +2 -2
- package/dist/output-types.d.ts +2 -2
- package/dist/results-output.d.ts +3 -3
- package/dist/results-selections.d.ts +2 -2
- package/dist/scalars.d.ts +2 -2
- package/dist/schema-output.d.ts +2 -2
- package/dist/source.d.ts +2 -2
- package/dist/type-code.d.ts +2 -2
- package/dist/variables-output.d.ts +3 -3
- package/dist/writer.d.ts +2 -2
- package/docs/troubleshooting.md +12 -0
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type GraphQLSchema } from 'graphql';
|
|
2
|
-
import type { CodegenZodConfig, DocumentFile } from './config';
|
|
3
|
-
export type { CodegenZodConfig, DocumentFile } from './config';
|
|
2
|
+
import type { CodegenZodConfig, DocumentFile } from './config.js';
|
|
3
|
+
export type { CodegenZodConfig, DocumentFile } from './config.js';
|
|
4
4
|
/**
|
|
5
5
|
* The graphql-codegen plugin: Zod schemas, and their types, for the
|
|
6
6
|
* schema's enums, input types, field arguments, object types, interfaces and
|
package/dist/naming.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { OperationTypeNode } from 'graphql';
|
|
2
|
-
import type { CodegenZodConfig } from './config';
|
|
2
|
+
import type { CodegenZodConfig } from './config.js';
|
|
3
3
|
/**
|
|
4
4
|
* The names of what the plugin writes: each type as
|
|
5
5
|
* `@graphql-codegen/typescript` and `typescript-operations` name it, each
|
package/dist/objects-output.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type GraphQLSchema } from 'graphql';
|
|
2
|
-
import type { Naming } from './naming';
|
|
3
|
-
import type { Writer } from './writer';
|
|
2
|
+
import type { Naming } from './naming.js';
|
|
3
|
+
import type { Writer } from './writer.js';
|
|
4
4
|
/** The built-in scalars' schemas on the way out. */
|
|
5
5
|
export declare const builtIns: Readonly<Record<string, string>>;
|
|
6
6
|
/**
|
package/dist/output-types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type GraphQLObjectType } from 'graphql';
|
|
2
|
-
import type { Naming } from './naming';
|
|
3
|
-
import type { Writer } from './writer';
|
|
2
|
+
import type { Naming } from './naming.js';
|
|
3
|
+
import type { Writer } from './writer.js';
|
|
4
4
|
/**
|
|
5
5
|
* An object type in a cycle, declared with its types written out, as an
|
|
6
6
|
* input type in a cycle is: `User` (what a resolver returns, scalars
|
package/dist/results-output.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type GraphQLSchema } from 'graphql';
|
|
2
|
-
import type { DocumentFile } from './config';
|
|
3
|
-
import type { Naming } from './naming';
|
|
4
|
-
import type { Writer } from './writer';
|
|
2
|
+
import type { DocumentFile } from './config.js';
|
|
3
|
+
import type { Naming } from './naming.js';
|
|
4
|
+
import type { Writer } from './writer.js';
|
|
5
5
|
/**
|
|
6
6
|
* One schema per fragment and per named operation in `documents`, for the
|
|
7
7
|
* response as it arrives: what was selected, under its alias, custom
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type FragmentDefinitionNode, type GraphQLCompositeType, type GraphQLSchema } from 'graphql';
|
|
2
|
-
import { type Selected } from './collect-fields';
|
|
3
|
-
import type { Writer } from './writer';
|
|
2
|
+
import { type Selected } from './collect-fields.js';
|
|
3
|
+
import type { Writer } from './writer.js';
|
|
4
4
|
/**
|
|
5
5
|
* The schema of a selection, for a response: what was selected, under its
|
|
6
6
|
* alias. Deep selections are declared apart, as `<schema>$<n>`, which the
|
package/dist/scalars.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { GraphQLScalarType } from 'graphql';
|
|
2
|
-
import type { CodegenZodConfig } from './config';
|
|
3
|
-
import type { Imports } from './imports';
|
|
2
|
+
import type { CodegenZodConfig } from './config.js';
|
|
3
|
+
import type { Imports } from './imports.js';
|
|
4
4
|
/**
|
|
5
5
|
* Where each custom scalar's schema comes from: `zodScalars` first, then the
|
|
6
6
|
* `scalarSchemas` record. A scalar in neither fails generation, naming it:
|
package/dist/schema-output.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type GraphQLSchema } from 'graphql';
|
|
2
|
-
import type { Naming } from './naming';
|
|
3
|
-
import type { Writer } from './writer';
|
|
2
|
+
import type { Naming } from './naming.js';
|
|
3
|
+
import type { Writer } from './writer.js';
|
|
4
4
|
/**
|
|
5
5
|
* The SDL's part of the file: every enum, then every input type, then the
|
|
6
6
|
* arguments of every object and interface field that takes any. Types are
|
package/dist/source.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Naming } from './naming';
|
|
2
|
-
import type { ValueCode } from './writer';
|
|
1
|
+
import type { Naming } from './naming.js';
|
|
2
|
+
import type { ValueCode } from './writer.js';
|
|
3
3
|
/** A GraphQL description as a doc comment, or nothing. */
|
|
4
4
|
export declare function docComment(description: string | null | undefined, indent?: string): string;
|
|
5
5
|
/** The members of a `z.object({...})`, a getter for each lazy one. */
|
package/dist/type-code.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type GraphQLInputObjectType } from 'graphql';
|
|
2
|
-
import type { Naming } from './naming';
|
|
3
|
-
import type { Writer } from './writer';
|
|
2
|
+
import type { Naming } from './naming.js';
|
|
3
|
+
import type { Writer } from './writer.js';
|
|
4
4
|
/**
|
|
5
5
|
* An input type in a cycle, declared with its types written out, since
|
|
6
6
|
* TypeScript cannot infer them: `Filter` (what the resolver receives),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type GraphQLSchema } from 'graphql';
|
|
2
|
-
import type { DocumentFile } from './config';
|
|
3
|
-
import type { Naming } from './naming';
|
|
4
|
-
import type { Writer } from './writer';
|
|
2
|
+
import type { DocumentFile } from './config.js';
|
|
3
|
+
import type { Naming } from './naming.js';
|
|
4
|
+
import type { Writer } from './writer.js';
|
|
5
5
|
/**
|
|
6
6
|
* One schema per named operation in `documents`, for its variables as a
|
|
7
7
|
* client sends them (`z.input`). A variable gets the constraints of every
|
package/dist/writer.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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 { Naming } from './naming';
|
|
4
|
-
import type { ScalarSources } from './scalars';
|
|
3
|
+
import type { Naming } from './naming.js';
|
|
4
|
+
import type { ScalarSources } from './scalars.js';
|
|
5
5
|
/** One value's schema as source, and whether it names an input object. */
|
|
6
6
|
export interface ValueCode {
|
|
7
7
|
readonly code: string;
|
package/docs/troubleshooting.md
CHANGED
|
@@ -147,6 +147,18 @@ query Both($e: String, $u: String) { e(v: $e) u(v: $u) }
|
|
|
147
147
|
|
|
148
148
|
## The generated file
|
|
149
149
|
|
|
150
|
+
### `TS2305: Module '"@nxgt/graphql-scalars"' has no exported member 'scalarSchemas'`
|
|
151
|
+
|
|
152
|
+
**When:** type-checking the generated file under `moduleResolution`
|
|
153
|
+
`nodenext` or `node16`, with `scalarSchemas: '@nxgt/graphql-scalars'`.
|
|
154
|
+
**Why:** `@nxgt/graphql-scalars` before 0.4.1 ships declarations that
|
|
155
|
+
`nodenext` does not resolve.
|
|
156
|
+
**Fix:** upgrade it to 0.4.1 or later.
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
bun add @nxgt/graphql-scalars@latest
|
|
160
|
+
```
|
|
161
|
+
|
|
150
162
|
### `Property 'Money' does not exist on type '{ DateTime: ... }'` (or `TS2339`)
|
|
151
163
|
|
|
152
164
|
**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.2.
|
|
3
|
+
"version": "0.2.1",
|
|
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,11 +46,11 @@
|
|
|
46
46
|
"generated:write": "bun run test/write-generated.ts"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@nxgt/graphql-validation": "^0.2.
|
|
49
|
+
"@nxgt/graphql-validation": "^0.2.1",
|
|
50
50
|
"change-case": "^5.4.4"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@nxgt/graphql-scalars": "^0.4.
|
|
53
|
+
"@nxgt/graphql-scalars": "^0.4.1",
|
|
54
54
|
"@types/bun": "^1.4.0",
|
|
55
55
|
"graphql": "16.11.0",
|
|
56
56
|
"zod": "4.6.5"
|