@schema-hub/zod-graphql-client 0.0.22 → 0.0.23
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/package.json +4 -5
- package/sbom.cdx.json +15 -15
- package/zod-graphql-client/define-variables.d.ts +0 -1
- package/zod-graphql-client/define-variables.d.ts.map +1 -1
- package/zod-graphql-client/define-variables.js +5 -38
- package/zod-graphql-client/define-variables.js.map +1 -1
- package/zod-graphql-client/graphql-error.js +0 -8
- package/zod-graphql-client/graphql-error.js.map +1 -1
- package/zod-graphql-client/graphql-response.js +2 -26
- package/zod-graphql-client/graphql-response.js.map +1 -1
- package/zod-graphql-client/infer-graphql-type.d.ts +0 -2
- package/zod-graphql-client/infer-graphql-type.d.ts.map +1 -1
- package/zod-graphql-client/infer-graphql-type.js +1 -64
- package/zod-graphql-client/infer-graphql-type.js.map +1 -1
- package/zod-graphql-client/operation-error.js +0 -19
- package/zod-graphql-client/operation-error.js.map +1 -1
- package/zod-graphql-client/operation-handle.d.ts +0 -1
- package/zod-graphql-client/operation-handle.d.ts.map +1 -1
- package/zod-graphql-client/operation-handle.js +0 -19
- package/zod-graphql-client/operation-handle.js.map +1 -1
- package/zod-graphql-client/persisted-query.d.ts +0 -4
- package/zod-graphql-client/persisted-query.d.ts.map +1 -1
- package/zod-graphql-client/persisted-query.js +2 -49
- package/zod-graphql-client/persisted-query.js.map +1 -1
- package/zod-graphql-client/variable-entry.d.ts +0 -2
- package/zod-graphql-client/variable-entry.d.ts.map +1 -1
- package/zod-graphql-client/variable-entry.js +1 -10
- package/zod-graphql-client/variable-entry.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "Mathias Schreck <schreck.mathias@gmail.com>",
|
|
3
3
|
"dependencies": {
|
|
4
|
-
"@schema-hub/zod-error-formatter": "0.0.
|
|
5
|
-
"@schema-hub/zod-graphql-query-builder": "0.0.
|
|
4
|
+
"@schema-hub/zod-error-formatter": "0.0.17",
|
|
5
|
+
"@schema-hub/zod-graphql-query-builder": "0.0.18",
|
|
6
6
|
"ky": "2.0.2"
|
|
7
7
|
},
|
|
8
8
|
"description": "A lightweight and type-safe zod-based GraphQL client",
|
|
@@ -43,9 +43,8 @@
|
|
|
43
43
|
"sideEffects": [
|
|
44
44
|
"./zod-graphql-client/graphql-error.js",
|
|
45
45
|
"./zod-graphql-client/graphql-response.js",
|
|
46
|
-
"./zod-graphql-client/infer-graphql-type.js"
|
|
47
|
-
"./zod-graphql-client/persisted-query.js"
|
|
46
|
+
"./zod-graphql-client/infer-graphql-type.js"
|
|
48
47
|
],
|
|
49
48
|
"type": "module",
|
|
50
|
-
"version": "0.0.
|
|
49
|
+
"version": "0.0.23"
|
|
51
50
|
}
|
package/sbom.cdx.json
CHANGED
|
@@ -9,44 +9,44 @@
|
|
|
9
9
|
{
|
|
10
10
|
"type": "application",
|
|
11
11
|
"name": "packtory",
|
|
12
|
-
"version": "0.0.
|
|
12
|
+
"version": "0.0.98"
|
|
13
13
|
}
|
|
14
14
|
]
|
|
15
15
|
},
|
|
16
16
|
"component": {
|
|
17
17
|
"type": "library",
|
|
18
18
|
"name": "@schema-hub/zod-graphql-client",
|
|
19
|
-
"version": "0.0.
|
|
20
|
-
"bom-ref": "pkg:npm/@schema-hub/zod-graphql-client@0.0.
|
|
21
|
-
"purl": "pkg:npm/@schema-hub/zod-graphql-client@0.0.
|
|
19
|
+
"version": "0.0.23",
|
|
20
|
+
"bom-ref": "pkg:npm/@schema-hub/zod-graphql-client@0.0.23",
|
|
21
|
+
"purl": "pkg:npm/@schema-hub/zod-graphql-client@0.0.23"
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"components": [
|
|
25
25
|
{
|
|
26
26
|
"type": "library",
|
|
27
27
|
"name": "@schema-hub/zod-error-formatter",
|
|
28
|
-
"version": "0.0.
|
|
29
|
-
"bom-ref": "pkg:npm/@schema-hub/zod-error-formatter@0.0.
|
|
28
|
+
"version": "0.0.17",
|
|
29
|
+
"bom-ref": "pkg:npm/@schema-hub/zod-error-formatter@0.0.17",
|
|
30
30
|
"scope": "required",
|
|
31
31
|
"licenses": [
|
|
32
32
|
{
|
|
33
33
|
"expression": "MIT"
|
|
34
34
|
}
|
|
35
35
|
],
|
|
36
|
-
"purl": "pkg:npm/@schema-hub/zod-error-formatter@0.0.
|
|
36
|
+
"purl": "pkg:npm/@schema-hub/zod-error-formatter@0.0.17"
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
39
|
"type": "library",
|
|
40
40
|
"name": "@schema-hub/zod-graphql-query-builder",
|
|
41
|
-
"version": "0.0.
|
|
42
|
-
"bom-ref": "pkg:npm/@schema-hub/zod-graphql-query-builder@0.0.
|
|
41
|
+
"version": "0.0.18",
|
|
42
|
+
"bom-ref": "pkg:npm/@schema-hub/zod-graphql-query-builder@0.0.18",
|
|
43
43
|
"scope": "required",
|
|
44
44
|
"licenses": [
|
|
45
45
|
{
|
|
46
46
|
"expression": "MIT"
|
|
47
47
|
}
|
|
48
48
|
],
|
|
49
|
-
"purl": "pkg:npm/@schema-hub/zod-graphql-query-builder@0.0.
|
|
49
|
+
"purl": "pkg:npm/@schema-hub/zod-graphql-query-builder@0.0.18"
|
|
50
50
|
},
|
|
51
51
|
{
|
|
52
52
|
"type": "library",
|
|
@@ -77,19 +77,19 @@
|
|
|
77
77
|
],
|
|
78
78
|
"dependencies": [
|
|
79
79
|
{
|
|
80
|
-
"ref": "pkg:npm/@schema-hub/zod-error-formatter@0.0.
|
|
80
|
+
"ref": "pkg:npm/@schema-hub/zod-error-formatter@0.0.17"
|
|
81
81
|
},
|
|
82
82
|
{
|
|
83
|
-
"ref": "pkg:npm/@schema-hub/zod-graphql-client@0.0.
|
|
83
|
+
"ref": "pkg:npm/@schema-hub/zod-graphql-client@0.0.23",
|
|
84
84
|
"dependsOn": [
|
|
85
|
-
"pkg:npm/@schema-hub/zod-error-formatter@0.0.
|
|
86
|
-
"pkg:npm/@schema-hub/zod-graphql-query-builder@0.0.
|
|
85
|
+
"pkg:npm/@schema-hub/zod-error-formatter@0.0.17",
|
|
86
|
+
"pkg:npm/@schema-hub/zod-graphql-query-builder@0.0.18",
|
|
87
87
|
"pkg:npm/ky@2.0.2",
|
|
88
88
|
"pkg:npm/zod@%5E4.0.5"
|
|
89
89
|
]
|
|
90
90
|
},
|
|
91
91
|
{
|
|
92
|
-
"ref": "pkg:npm/@schema-hub/zod-graphql-query-builder@0.0.
|
|
92
|
+
"ref": "pkg:npm/@schema-hub/zod-graphql-query-builder@0.0.18"
|
|
93
93
|
},
|
|
94
94
|
{
|
|
95
95
|
"ref": "pkg:npm/ky@2.0.2"
|
|
@@ -24,7 +24,6 @@ export type VariableMapHandle<Variables extends Record<string, VariableEntry>> =
|
|
|
24
24
|
};
|
|
25
25
|
type MapOfHandle<Handle> = Handle extends VariableMapHandle<infer Variables> ? Variables : never;
|
|
26
26
|
export type ValuesOfVariableMapHandle<Handle extends AnyVariableMapHandle> = VariableValues<MapOfHandle<Handle>>;
|
|
27
|
-
export declare function getVariableMapMetadata(handle: AnyVariableMapHandle): AnyVariableMapMetadata;
|
|
28
27
|
export declare function defineVariables<Variables extends Record<string, VariableEntry>>(map: Variables): VariableMapHandle<Variables>;
|
|
29
28
|
export {};
|
|
30
29
|
//# sourceMappingURL=define-variables.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define-variables.d.ts","sourceRoot":"","sources":["../../../../source/zod-graphql-client/define-variables.ts"],"names":[],"mappings":"AAEA,OAAO,EAAa,KAAK,eAAe,EAAE,MAAM,iCAAqC,CAAC;AACtF,OAAO,EACH,KAAK,0BAA0B,EAElC,MAAM,gGAA6D,CAAC;AAErE,OAAO,EACH,KAAK,cAAc,EAGnB,KAAK,aAAa,EACrB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,MAAM,cAAc,CAAC,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,IAAI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ACvD,QAAQ,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,eAAe,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC;CAClF,CAAC;AAEF,OAAO,CAAC,MAAM,sBAAsB,EAAE,OAAO,MAAM,CAAC;AAEpD,MAAM,MAAM,oBAAoB,GAAG;IAC/B,QAAQ,CAAC,CAAC,sBAAsB,CAAC,CAAC,EAAE,IAAI,CAAC;IACzC,QAAQ,CAAC,CAAC,sBAAsB,CAAC,EAAE,sBAAsB,CAAC;CAC7D,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,oBAAoB,GAAG,SAAS,CAAC;AAE9D,MAAM,MAAM,iBAAiB,CAAC,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,IACvE,oBAAoB,GACpB,QAAQ,CAAC,MAAM,CAAC,MAAM,GAAG,MAAM,SAAS,EAAE,0BAA0B,CAAC,CAAC,GACtE;IACE,QAAQ,CAAC,CAAC,sBAAsB,CAAC,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;CACrE,CAAC;AAEN,KAAK,WAAW,CAAC,MAAM,IAAI,MAAM,SAAS,iBAAiB,CAAC,MAAM,SAAS,CAAC,GAAG,SAAS,GAAG,KAAK,CAAC;AAEjG,MAAM,MAAM,yBAAyB,CAAC,MAAM,SAAS,oBAAoB,IAAI,cAAc,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;AAEjH,uCAyB+B,CAAC,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,EAC3E,GAAG,EAAE,SAAS,GACf,iBAAiB,CAAC,SAAS,CAAC,CAkB9B"}
|
|
@@ -1,39 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
const variableMapMetadataKey = Symbol('variable-map-metadata');
|
|
7
|
-
export function getVariableMapMetadata(handle) {
|
|
8
|
-
return handle[variableMapMetadataKey];
|
|
9
|
-
}
|
|
10
|
-
function prepareVariableMap(map) {
|
|
11
|
-
const definitions = {};
|
|
12
|
-
const schemaShape = {};
|
|
13
|
-
const placeholders = {};
|
|
14
|
-
for (const [name, entry] of Object.entries(map)) {
|
|
15
|
-
const placeholderName = `$${name}`;
|
|
16
|
-
placeholders[name] = variablePlaceholder(placeholderName);
|
|
17
|
-
definitions[placeholderName] = isExplicitVariableEntry(entry) ? entry.type : inferGraphqlType(entry);
|
|
18
|
-
schemaShape[name] = getEntrySchema(entry);
|
|
19
|
-
}
|
|
20
|
-
return { definitions, schemaShape, placeholders };
|
|
21
|
-
}
|
|
22
|
-
export function defineVariables(map) {
|
|
23
|
-
const { definitions, schemaShape, placeholders } = prepareVariableMap(map);
|
|
24
|
-
const combinedSchema = z.object(schemaShape);
|
|
25
|
-
const metadata = {
|
|
26
|
-
definitions: Object.freeze(definitions),
|
|
27
|
-
parse(input) {
|
|
28
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- the dynamically built schema parses into VariableValues<Variables>
|
|
29
|
-
return safeParse(combinedSchema, input);
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions, @typescript-eslint/no-unsafe-type-assertion -- combined placeholder map + metadata symbol can't be inferred to VariableMapHandle<Variables> structurally
|
|
33
|
-
const handle = {
|
|
34
|
-
...placeholders,
|
|
35
|
-
[variableMapMetadataKey]: metadata
|
|
36
|
-
};
|
|
37
|
-
return handle;
|
|
38
|
-
}
|
|
1
|
+
import 'zod/v4-mini';
|
|
2
|
+
import "@schema-hub/zod-error-formatter";
|
|
3
|
+
import "@schema-hub/zod-graphql-query-builder/zod-graphql-query-builder/values/variable-placeholder.js";
|
|
4
|
+
import "./infer-graphql-type.js";
|
|
5
|
+
import "./variable-entry.js";
|
|
39
6
|
//# sourceMappingURL=define-variables.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define-variables.js","sourceRoot":"","sources":["../../../../source/zod-graphql-client/define-variables.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"define-variables.js","sourceRoot":"","sources":["../../../../source/zod-graphql-client/define-variables.ts"],"names":[],"mappings":"AAAA,OAAkB,aAAa,CAAC;AAEhC,OAAgD,iCAAqC,CAAC;AACtF,OAGO,gGAA6D,CAAC;AACrE,OAAiC,yBAAyB,CAAC;AAC3D,OAKO,qBAAqB,CAAC;AAwEjB"}
|
|
@@ -4,12 +4,4 @@ const locationSchema = z
|
|
|
4
4
|
line: z.number().check(z.int(), z.positive()),
|
|
5
5
|
column: z.number().check(z.int(), z.positive())
|
|
6
6
|
});
|
|
7
|
-
const pathSegmentSchema = z.union([z.string(), z.number()]);
|
|
8
|
-
export const graphqlErrorSchema = z
|
|
9
|
-
.object({
|
|
10
|
-
message: z.string(),
|
|
11
|
-
locations: z.optional(z.array(locationSchema)),
|
|
12
|
-
path: z.optional(z.array(pathSegmentSchema)),
|
|
13
|
-
extensions: z.optional(z.record(z.string(), z.unknown()))
|
|
14
|
-
});
|
|
15
7
|
//# sourceMappingURL=graphql-error.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql-error.js","sourceRoot":"","sources":["../../../../source/zod-graphql-client/graphql-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAEhC,MAAM,cAAc,GAAG,CAAC;KACnB,YAAY,CAAC;IACV,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC7C,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC;CAClD,CAAC,CAAC
|
|
1
|
+
{"version":3,"file":"graphql-error.js","sourceRoot":"","sources":["../../../../source/zod-graphql-client/graphql-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,aAAa,CAAC;AAEhC,MAAM,cAAc,GAAG,CAAC;KACnB,YAAY,CAAC;IACV,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC7C,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC;CAClD,CAAC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod/v4';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import "@schema-hub/zod-error-formatter/tuple/non-empty-array.js";
|
|
3
|
+
import "@schema-hub/zod-error-formatter";
|
|
4
4
|
import { graphqlErrorSchema } from "./graphql-error.js";
|
|
5
5
|
const graphqlResponseSchema = z
|
|
6
6
|
.object({
|
|
@@ -8,28 +8,4 @@ const graphqlResponseSchema = z
|
|
|
8
8
|
errors: z.array(graphqlErrorSchema).optional()
|
|
9
9
|
})
|
|
10
10
|
.strip();
|
|
11
|
-
export function parseGraphqlResponse(responseBody) {
|
|
12
|
-
const graphqlResponseParseResult = safeParse(graphqlResponseSchema, responseBody);
|
|
13
|
-
if (graphqlResponseParseResult.success) {
|
|
14
|
-
const { errors, data } = graphqlResponseParseResult.data;
|
|
15
|
-
if (errors !== undefined && isNonEmptyArray(errors)) {
|
|
16
|
-
return {
|
|
17
|
-
success: false,
|
|
18
|
-
errorDetails: {
|
|
19
|
-
type: 'graphql',
|
|
20
|
-
message: 'GraphQL response contains errors',
|
|
21
|
-
errors
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
return { success: true, data };
|
|
26
|
-
}
|
|
27
|
-
return {
|
|
28
|
-
success: false,
|
|
29
|
-
errorDetails: {
|
|
30
|
-
type: 'unknown',
|
|
31
|
-
message: 'GraphQL server responded with an incorrect data structure'
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
11
|
//# sourceMappingURL=graphql-response.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql-response.js","sourceRoot":"","sources":["../../../../source/zod-graphql-client/graphql-response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAC3B,
|
|
1
|
+
{"version":3,"file":"graphql-response.js","sourceRoot":"","sources":["../../../../source/zod-graphql-client/graphql-response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAC3B,OAAgC,0DAA6B,CAAC;AAC9D,OAA0B,iCAAqC,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAGxD,MAAM,qBAAqB,GAAG,CAAC;KAC1B,MAAM,CAAC;IACJ,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAC5B,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,QAAQ,EAAE;CACjD,CAAC;KACD,KAAK,EAAE,CAAC"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { type $ZodType } from 'zod/v4/core';
|
|
2
1
|
export declare class GraphqlTypeInferenceError extends Error {
|
|
3
2
|
constructor(message: string, options?: ErrorOptions);
|
|
4
3
|
}
|
|
5
|
-
export declare function inferGraphqlType(schema: $ZodType): string;
|
|
6
4
|
//# sourceMappingURL=infer-graphql-type.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"infer-graphql-type.d.ts","sourceRoot":"","sources":["../../../../source/zod-graphql-client/infer-graphql-type.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"infer-graphql-type.d.ts","sourceRoot":"","sources":["../../../../source/zod-graphql-client/infer-graphql-type.ts"],"names":[],"mappings":"qBAYa,yBAA0B,SAAQ,KAAK;gBAC7B,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAK7D"}
|
|
@@ -1,68 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-underscore-dangle -- we need to access _zod */
|
|
2
2
|
/* eslint-disable functional/prefer-immutable-types -- parameters are third-party zod schema types that are only read */
|
|
3
|
-
import
|
|
4
|
-
export class GraphqlTypeInferenceError extends Error {
|
|
5
|
-
constructor(message, options) {
|
|
6
|
-
super(message, options);
|
|
7
|
-
this.name = 'GraphqlTypeInferenceError';
|
|
8
|
-
}
|
|
9
|
-
}
|
|
3
|
+
import 'zod/v4/core';
|
|
10
4
|
const integerNumberFormats = new Set(['safeint', 'int32', 'int64', 'uint32', 'uint64']);
|
|
11
|
-
function hasIntegerFormat(schema) {
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- reads the number schema's internal def shape, which zod doesn't expose with precise types
|
|
13
|
-
const def = schema._zod.def;
|
|
14
|
-
if (def.format !== undefined && integerNumberFormats.has(def.format)) {
|
|
15
|
-
return true;
|
|
16
|
-
}
|
|
17
|
-
const { checks = [] } = def;
|
|
18
|
-
return checks.some(function (check) {
|
|
19
|
-
const checkFormat = check._zod.def.format;
|
|
20
|
-
return checkFormat !== undefined && integerNumberFormats.has(checkFormat);
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
function unwrapNullable(schema) {
|
|
24
|
-
let current = schema;
|
|
25
|
-
let isNullable = false;
|
|
26
|
-
while (current instanceof $ZodNullable || current instanceof $ZodOptional) {
|
|
27
|
-
current = current._zod.def.innerType;
|
|
28
|
-
isNullable = true;
|
|
29
|
-
}
|
|
30
|
-
return { innerSchema: current, isNullable };
|
|
31
|
-
}
|
|
32
|
-
export function inferGraphqlType(schema) {
|
|
33
|
-
const { innerSchema, isNullable } = unwrapNullable(schema);
|
|
34
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define -- mutual recursion via arrays
|
|
35
|
-
const nonNullType = inferNonNullType(innerSchema);
|
|
36
|
-
return isNullable ? nonNullType : `${nonNullType}!`;
|
|
37
|
-
}
|
|
38
|
-
function inferPrimitiveType(schema) {
|
|
39
|
-
if (schema instanceof $ZodString) {
|
|
40
|
-
return 'String';
|
|
41
|
-
}
|
|
42
|
-
if (schema instanceof $ZodBoolean) {
|
|
43
|
-
return 'Boolean';
|
|
44
|
-
}
|
|
45
|
-
if (schema instanceof $ZodNumber) {
|
|
46
|
-
return hasIntegerFormat(schema) ? 'Int' : 'Float';
|
|
47
|
-
}
|
|
48
|
-
return null;
|
|
49
|
-
}
|
|
50
|
-
function inferNonNullType(schema) {
|
|
51
|
-
if (schema instanceof $ZodArray) {
|
|
52
|
-
return `[${inferGraphqlType(schema._zod.def.element)}]`;
|
|
53
|
-
}
|
|
54
|
-
const primitiveType = inferPrimitiveType(schema);
|
|
55
|
-
if (primitiveType !== null) {
|
|
56
|
-
return primitiveType;
|
|
57
|
-
}
|
|
58
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define -- thrown only after the early-return paths are exhausted
|
|
59
|
-
throw new GraphqlTypeInferenceError(buildInferenceErrorMessage(schema._zod.def.type));
|
|
60
|
-
}
|
|
61
|
-
function buildInferenceErrorMessage(kind) {
|
|
62
|
-
return [
|
|
63
|
-
`Cannot infer a GraphQL type for Zod schema of kind "${kind}".`,
|
|
64
|
-
'Use variable(type, schema) to declare the GraphQL type explicitly.'
|
|
65
|
-
]
|
|
66
|
-
.join(' ');
|
|
67
|
-
}
|
|
68
5
|
//# sourceMappingURL=infer-graphql-type.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"infer-graphql-type.js","sourceRoot":"","sources":["../../../../source/zod-graphql-client/infer-graphql-type.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,wHAAwH;AACxH,
|
|
1
|
+
{"version":3,"file":"infer-graphql-type.js","sourceRoot":"","sources":["../../../../source/zod-graphql-client/infer-graphql-type.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,wHAAwH;AACxH,OAQO,aAAa,CAAC;0BAUK,GAAG,IAAI,GAAG,CAAC,CAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAE,CAAC,CAAC;AAQtF"}
|
|
@@ -1,20 +1 @@
|
|
|
1
|
-
function causeOf(details) {
|
|
2
|
-
// eslint-disable-next-line unicorn/prefer-includes-over-repeated-comparisons -- literal comparisons narrow the discriminated union so `cause` is accessible
|
|
3
|
-
if (details.type === 'network' || details.type === 'server' || details.type === 'unknown') {
|
|
4
|
-
return details.cause;
|
|
5
|
-
}
|
|
6
|
-
return undefined;
|
|
7
|
-
}
|
|
8
|
-
export class GraphqlOperationError extends Error {
|
|
9
|
-
// eslint-disable-next-line @typescript-eslint/no-restricted-types, restricted-syntax-typescript/no-public-class-property -- no type-fest installed; details is part of the error's public API
|
|
10
|
-
details;
|
|
11
|
-
// eslint-disable-next-line unicorn/custom-error-definition -- constructor takes a domain details object rather than message + options
|
|
12
|
-
constructor(details) {
|
|
13
|
-
const cause = causeOf(details);
|
|
14
|
-
const { message, ...remainingDetails } = details;
|
|
15
|
-
super(message, cause === undefined ? undefined : { cause });
|
|
16
|
-
this.name = 'GraphqlOperationError';
|
|
17
|
-
this.details = remainingDetails;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
1
|
//# sourceMappingURL=operation-error.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation-error.js","sourceRoot":"","sources":["../../../../source/zod-graphql-client/operation-error.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"operation-error.js","sourceRoot":"","sources":["../../../../source/zod-graphql-client/operation-error.ts"],"names":[],"mappings":"AAoCI"}
|
|
@@ -18,6 +18,5 @@ type OperationHandleConfig<Schema extends QuerySchema, Variables extends AnyVari
|
|
|
18
18
|
};
|
|
19
19
|
export declare function defineQuery<Schema extends QuerySchema, Variables extends AnyVariableMapHandle | undefined = undefined>(config: OperationHandleConfig<Schema, Variables>): OperationHandle<Schema, Variables>;
|
|
20
20
|
export declare function defineMutation<Schema extends QuerySchema, Variables extends AnyVariableMapHandle | undefined = undefined>(config: OperationHandleConfig<Schema, Variables>): OperationHandle<Schema, Variables>;
|
|
21
|
-
export declare function isOperationHandle(value: unknown): value is OperationHandle<QuerySchema, AnyVariableMapHandle | undefined>;
|
|
22
21
|
export {};
|
|
23
22
|
//# sourceMappingURL=operation-handle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation-handle.d.ts","sourceRoot":"","sources":["../../../../source/zod-graphql-client/operation-handle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iFAA8C,CAAC;AAChF,OAAO,KAAK,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAE7F,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,OAAO,CAAC;AAEjD,QAAA,MAAM,kBAAkB,eAA6B,CAAC;AAEtD,MAAM,MAAM,eAAe,CACvB,MAAM,SAAS,WAAW,EAC1B,SAAS,SAAS,oBAAoB,GAAG,SAAS,IAClD;IACA,QAAQ,CAAC,CAAC,kBAAkB,CAAC,EAAE,IAAI,CAAC;IACpC,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC;IAC/B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CACnC,CAAC;AAEF,KAAK,4BAA4B,CAAC,SAAS,IAAI,SAAS,SAAS,oBAAoB,GAC/E,yBAAyB,CAAC,SAAS,CAAC,GACpC,KAAK,CAAC;AAEZ,MAAM,MAAM,uBAAuB,CAAC,MAAM,IAAI,MAAM,SAAS,eAAe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andleTag]: true,
|
|
5
|
-
kind,
|
|
6
|
-
schema: config.schema
|
|
7
|
-
};
|
|
8
|
-
const withVariables = config.variables === undefined ? base : { ...base, variables: config.variables };
|
|
9
|
-
return config.operationName === undefined
|
|
10
|
-
? withVariables
|
|
11
|
-
: { ...withVariables, operationName: config.operationName };
|
|
12
|
-
}
|
|
13
|
-
export function defineQuery(config) {
|
|
14
|
-
return createOperationHandle('query', config);
|
|
15
|
-
}
|
|
16
|
-
export function defineMutation(config) {
|
|
17
|
-
return createOperationHandle('mutation', config);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
1
|
//# sourceMappingURL=operation-handle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation-handle.js","sourceRoot":"","sources":["../../../../source/zod-graphql-client/operation-handle.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"operation-handle.js","sourceRoot":"","sources":["../../../../source/zod-graphql-client/operation-handle.ts"],"names":[],"mappings":""}
|
|
@@ -5,9 +5,5 @@ export type PersistedQueryExtensions = {
|
|
|
5
5
|
readonly sha256Hash: string;
|
|
6
6
|
};
|
|
7
7
|
};
|
|
8
|
-
export declare function computePersistedQueryHash(query: string): string;
|
|
9
|
-
export declare function buildPersistedQueryExtensions(query: string): PersistedQueryExtensions;
|
|
10
|
-
export type PersistedQueryRetryReason = 'not-found' | 'not-supported';
|
|
11
|
-
export declare function detectPersistedQueryRetryReason(rawResponse: unknown): PersistedQueryRetryReason | undefined;
|
|
12
8
|
export {};
|
|
13
9
|
//# sourceMappingURL=persisted-query.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"persisted-query.d.ts","sourceRoot":"","sources":["../../../../source/zod-graphql-client/persisted-query.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,qBAAqB,IAAI,CAAC;AAEhC,MAAM,MAAM,wBAAwB,GAAG;IACnC,QAAQ,CAAC,cAAc,EAAE;QACrB,QAAQ,CAAC,OAAO,EAAE,OAAO,qBAAqB,CAAC;QAC/C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;KAC/B,CAAC;CACL,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"persisted-query.d.ts","sourceRoot":"","sources":["../../../../source/zod-graphql-client/persisted-query.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,qBAAqB,IAAI,CAAC;AAEhC,MAAM,MAAM,wBAAwB,GAAG;IACnC,QAAQ,CAAC,cAAc,EAAE;QACrB,QAAQ,CAAC,OAAO,EAAE,OAAO,qBAAqB,CAAC;QAC/C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;KAC/B,CAAC;CACL,CAAC;AAEF"}
|
|
@@ -1,50 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
const persistedQueryVersion = 1;
|
|
4
|
-
export function computePersistedQueryHash(query) {
|
|
5
|
-
return createHash('sha256').update(query).digest('hex');
|
|
6
|
-
}
|
|
7
|
-
export function buildPersistedQueryExtensions(query) {
|
|
8
|
-
return {
|
|
9
|
-
persistedQuery: {
|
|
10
|
-
version: persistedQueryVersion,
|
|
11
|
-
sha256Hash: computePersistedQueryHash(query)
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
const persistedQueryNotFoundMessage = 'PersistedQueryNotFound';
|
|
16
|
-
const persistedQueryNotFoundCode = 'PERSISTED_QUERY_NOT_FOUND';
|
|
17
|
-
const persistedQueryNotSupportedMessage = 'PersistedQueryNotSupported';
|
|
18
|
-
const persistedQueryNotSupportedCode = 'PERSISTED_QUERY_NOT_SUPPORTED';
|
|
19
|
-
const persistedQueryErrorDetectionSchema = z.object({
|
|
20
|
-
errors: z.optional(z.array(z.object({
|
|
21
|
-
message: z.optional(z.string()),
|
|
22
|
-
extensions: z.optional(z.object({
|
|
23
|
-
code: z.optional(z.string())
|
|
24
|
-
}))
|
|
25
|
-
})))
|
|
26
|
-
});
|
|
27
|
-
function classifyPersistedQueryError(error) {
|
|
28
|
-
const code = error.extensions?.code;
|
|
29
|
-
if (code === persistedQueryNotFoundCode || error.message === persistedQueryNotFoundMessage) {
|
|
30
|
-
return 'not-found';
|
|
31
|
-
}
|
|
32
|
-
if (code === persistedQueryNotSupportedCode || error.message === persistedQueryNotSupportedMessage) {
|
|
33
|
-
return 'not-supported';
|
|
34
|
-
}
|
|
35
|
-
return undefined;
|
|
36
|
-
}
|
|
37
|
-
export function detectPersistedQueryRetryReason(rawResponse) {
|
|
38
|
-
const parsed = persistedQueryErrorDetectionSchema.safeParse(rawResponse);
|
|
39
|
-
if (!parsed.success || parsed.data.errors === undefined) {
|
|
40
|
-
return undefined;
|
|
41
|
-
}
|
|
42
|
-
for (const error of parsed.data.errors) {
|
|
43
|
-
const reason = classifyPersistedQueryError(error);
|
|
44
|
-
if (reason !== undefined) {
|
|
45
|
-
return reason;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return undefined;
|
|
49
|
-
}
|
|
1
|
+
import 'node:crypto';
|
|
2
|
+
import 'zod/v4-mini';
|
|
50
3
|
//# sourceMappingURL=persisted-query.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"persisted-query.js","sourceRoot":"","sources":["../../../../source/zod-graphql-client/persisted-query.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"persisted-query.js","sourceRoot":"","sources":["../../../../source/zod-graphql-client/persisted-query.ts"],"names":[],"mappings":"AAAA,OAA2B,aAAa,CAAC;AACzC,OAAkB,aAAa,CAAC"}
|
|
@@ -7,8 +7,6 @@ export type VariableEntry = $ZodType | ExplicitVariableEntry;
|
|
|
7
7
|
type SchemaFromZodType<Entry> = Entry extends $ZodType ? Entry : never;
|
|
8
8
|
export type EntrySchema<Entry extends VariableEntry> = Entry extends ExplicitVariableEntry<infer Schema> ? Schema : SchemaFromZodType<Entry>;
|
|
9
9
|
export type EntryValueType<Entry extends VariableEntry> = TypeOf<EntrySchema<Entry>>;
|
|
10
|
-
export declare function isExplicitVariableEntry(entry: VariableEntry): entry is ExplicitVariableEntry;
|
|
11
|
-
export declare function getEntrySchema(entry: VariableEntry): $ZodType;
|
|
12
10
|
export declare function variable<Schema extends $ZodType>(type: string, schema: Schema): ExplicitVariableEntry<Schema>;
|
|
13
11
|
export {};
|
|
14
12
|
//# sourceMappingURL=variable-entry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variable-entry.d.ts","sourceRoot":"","sources":["../../../../source/zod-graphql-client/variable-entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,MAAM,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC;AAE9D,MAAM,MAAM,qBAAqB,CAAC,MAAM,SAAS,QAAQ,GAAG,QAAQ,IAAI;IACpE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CAC3B,CAAC;AAGF,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,qBAAqB,CAAC;AAE7D,KAAK,iBAAiB,CAAC,KAAK,IAAI,KAAK,SAAS,QAAQ,GAAG,KAAK,GAAG,KAAK,CAAC;AAEvE,MAAM,MAAM,WAAW,CAAC,KAAK,SAAS,aAAa,IAAI,KAAK,SAAS,qBAAqB,CAAC,MAAM,MAAM,CAAC,GAAG,MAAM,GAC3G,iBAAiB,CAAC,KAAK,CAAC,CAAC;AAE/B,MAAM,MAAM,cAAc,CAAC,KAAK,SAAS,aAAa,IAAI,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;AAErF,
|
|
1
|
+
{"version":3,"file":"variable-entry.d.ts","sourceRoot":"","sources":["../../../../source/zod-graphql-client/variable-entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,MAAM,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC;AAE9D,MAAM,MAAM,qBAAqB,CAAC,MAAM,SAAS,QAAQ,GAAG,QAAQ,IAAI;IACpE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CAC3B,CAAC;AAGF,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,qBAAqB,CAAC;AAE7D,KAAK,iBAAiB,CAAC,KAAK,IAAI,KAAK,SAAS,QAAQ,GAAG,KAAK,GAAG,KAAK,CAAC;AAEvE,MAAM,MAAM,WAAW,CAAC,KAAK,SAAS,aAAa,IAAI,KAAK,SAAS,qBAAqB,CAAC,MAAM,MAAM,CAAC,GAAG,MAAM,GAC3G,iBAAiB,CAAC,KAAK,CAAC,CAAC;AAE/B,MAAM,MAAM,cAAc,CAAC,KAAK,SAAS,aAAa,IAAI,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;AAErF,wBAQgB,QAAQ,CAAC,MAAM,SAAS,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAE7G"}
|
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
export function isExplicitVariableEntry(entry) {
|
|
3
|
-
return !(entry instanceof $ZodType);
|
|
4
|
-
}
|
|
5
|
-
export function getEntrySchema(entry) {
|
|
6
|
-
return isExplicitVariableEntry(entry) ? entry.schema : entry;
|
|
7
|
-
}
|
|
8
|
-
export function variable(type, schema) {
|
|
9
|
-
return { type, schema };
|
|
10
|
-
}
|
|
1
|
+
import 'zod/v4/core';
|
|
11
2
|
//# sourceMappingURL=variable-entry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variable-entry.js","sourceRoot":"","sources":["../../../../source/zod-graphql-client/variable-entry.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"variable-entry.js","sourceRoot":"","sources":["../../../../source/zod-graphql-client/variable-entry.ts"],"names":[],"mappings":"AAAA,OAAgD,aAAa,CAAC"}
|