@schema-hub/zod-graphql-client 0.0.13 → 0.0.15
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 +25 -7
- package/readme.md +127 -45
- package/sbom.cdx.json +101 -0
- package/zod-graphql-client/client.d.ts +10 -24
- package/zod-graphql-client/client.d.ts.map +1 -1
- package/zod-graphql-client/client.js +111 -93
- package/zod-graphql-client/client.js.map +1 -1
- package/zod-graphql-client/define-variables.d.ts +28 -0
- package/zod-graphql-client/define-variables.d.ts.map +1 -0
- package/zod-graphql-client/define-variables.js +11 -0
- package/zod-graphql-client/define-variables.js.map +1 -0
- package/zod-graphql-client/entry-point.d.ts +12 -4
- package/zod-graphql-client/entry-point.d.ts.map +1 -1
- package/zod-graphql-client/entry-point.js +4 -1
- package/zod-graphql-client/entry-point.js.map +1 -1
- package/zod-graphql-client/graphql-error.d.ts +12 -0
- package/zod-graphql-client/graphql-error.d.ts.map +1 -0
- package/zod-graphql-client/graphql-error.js +2 -36
- package/zod-graphql-client/graphql-error.js.map +1 -1
- package/zod-graphql-client/graphql-response.js +3 -3
- package/zod-graphql-client/graphql-response.js.map +1 -1
- package/zod-graphql-client/infer-graphql-type.d.ts +2 -0
- package/zod-graphql-client/infer-graphql-type.d.ts.map +1 -0
- package/zod-graphql-client/infer-graphql-type.js +67 -0
- package/zod-graphql-client/infer-graphql-type.js.map +1 -0
- package/zod-graphql-client/operation-error.d.ts +7 -7
- package/zod-graphql-client/operation-error.d.ts.map +1 -1
- package/zod-graphql-client/operation-error.js +2 -1
- package/zod-graphql-client/operation-error.js.map +1 -1
- package/zod-graphql-client/operation-handle.d.ts +13 -0
- package/zod-graphql-client/operation-handle.d.ts.map +1 -0
- package/zod-graphql-client/operation-handle.js +1 -0
- package/zod-graphql-client/operation-handle.js.map +1 -0
- package/zod-graphql-client/operation-payload.d.ts +24 -0
- package/zod-graphql-client/operation-payload.d.ts.map +1 -0
- package/zod-graphql-client/operation-payload.js +70 -0
- package/zod-graphql-client/operation-payload.js.map +1 -0
- package/zod-graphql-client/operation-result.d.ts +1 -1
- package/zod-graphql-client/persisted-query.d.ts +9 -0
- package/zod-graphql-client/persisted-query.d.ts.map +1 -0
- package/zod-graphql-client/persisted-query.js +50 -0
- package/zod-graphql-client/persisted-query.js.map +1 -0
- package/zod-graphql-client/variable-entry.d.ts +11 -0
- package/zod-graphql-client/variable-entry.d.ts.map +1 -0
- package/zod-graphql-client/variable-entry.js +2 -0
- package/zod-graphql-client/variable-entry.js.map +1 -0
- package/zod-graphql-client/variables.d.ts +0 -9
- package/zod-graphql-client/variables.d.ts.map +0 -1
- package/zod-graphql-client/variables.js +0 -15
- package/zod-graphql-client/variables.js.map +0 -1
|
@@ -3,7 +3,8 @@ export class GraphqlOperationError extends Error {
|
|
|
3
3
|
details;
|
|
4
4
|
constructor(details) {
|
|
5
5
|
const { message, ...remainingDetails } = details;
|
|
6
|
-
|
|
6
|
+
const cause = 'cause' in remainingDetails ? remainingDetails.cause : undefined;
|
|
7
|
+
super(message, cause === undefined ? undefined : { cause });
|
|
7
8
|
// eslint-disable-next-line functional/no-this-expressions -- sub-classing errors is ok
|
|
8
9
|
this.details = remainingDetails;
|
|
9
10
|
}
|
|
@@ -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":"AAqCA,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAC5C,4FAA4F;IAC5E,OAAO,CAAyC;IAEhE,YAAY,OAA8B;QACtC,MAAM,EAAE,OAAO,EAAE,GAAG,gBAAgB,EAAE,GAAG,OAAO,CAAC;QACjD,MAAM,KAAK,GAAG,OAAO,IAAI,gBAAgB,CAAC,CAAC,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;QAC/E,KAAK,CAAC,OAAO,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QAC5D,uFAAuF;QACvF,IAAI,CAAC,OAAO,GAAG,gBAAgB,CAAC;IACpC,CAAC;CACJ"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { QuerySchema } from '@schema-hub/zod-graphql-query-builder';
|
|
2
|
+
import type { AnyVariableMapHandle, ValuesOfVariableMapHandle } from './define-variables.js';
|
|
3
|
+
export type OperationKind = 'mutation' | 'query';
|
|
4
|
+
declare const operationHandleTag: unique symbol;
|
|
5
|
+
export type OperationHandle<Schema extends QuerySchema, Variables extends AnyVariableMapHandle | undefined> = {
|
|
6
|
+
readonly [operationHandleTag]: true;
|
|
7
|
+
readonly kind: OperationKind;
|
|
8
|
+
readonly schema: Schema;
|
|
9
|
+
readonly variables?: Variables;
|
|
10
|
+
readonly operationName?: string;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=operation-handle.d.ts.map
|
|
@@ -0,0 +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;AACjC,IAD8E,CAAC,EACxE,KAAK,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,uBAAuB;AAE5F,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,OAAO;AAEhD,QAAA,MAAM,kBAAkB,eAA6B;AAErD,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=operation-handle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation-handle.js","sourceRoot":"","sources":["../../../../source/zod-graphql-client/operation-handle.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type QuerySchema } from '@schema-hub/zod-graphql-query-builder';
|
|
2
|
+
import { type AnyVariableMapHandle, type MaybeVariables, type ValuesOfVariableMapHandle } from './define-variables.js';
|
|
3
|
+
import type { OperationHandle } from './operation-handle.js';
|
|
4
|
+
import type { OperationFailureResult } from './operation-result.js';
|
|
5
|
+
import { type PersistedQueryExtensions } from './persisted-query.js';
|
|
6
|
+
export type { OperationHandle } from './operation-handle.js';
|
|
7
|
+
export type OperationType = 'mutation' | 'query';
|
|
8
|
+
export type OperationOptions = {
|
|
9
|
+
timeout?: number;
|
|
10
|
+
headers?: Record<string, string | undefined>;
|
|
11
|
+
};
|
|
12
|
+
export type GraphqlOverHttpOperationRequestPayload = {
|
|
13
|
+
query?: string;
|
|
14
|
+
variables: Record<string, unknown>;
|
|
15
|
+
operationName?: string | undefined;
|
|
16
|
+
extensions?: PersistedQueryExtensions;
|
|
17
|
+
};
|
|
18
|
+
type WithVariables<Variables extends AnyVariableMapHandle> = readonly [
|
|
19
|
+
values: ValuesOfVariableMapHandle<Variables>,
|
|
20
|
+
options?: OperationOptions
|
|
21
|
+
];
|
|
22
|
+
type WithoutVariables = readonly [options?: OperationOptions];
|
|
23
|
+
export type OperationCallArgs<V extends MaybeVariables> = V extends AnyVariableMapHandle ? WithVariables<V> : WithoutVariables;
|
|
24
|
+
//# sourceMappingURL=operation-payload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation-payload.d.ts","sourceRoot":"","sources":["../../../../source/zod-graphql-client/operation-payload.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2C,KAAK,WAAW,EAAE,MAAM;AAC1E,IADuH,CAAC,EACjH,EACH,KAAK,oBAAoB,EAEzB,KAAK,cAAc,EACnB,KAAK,yBAAyB,EACjC,MAAM,uBAAuB;AAC9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB;AAC5D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB;AACnE,OAAO,EAAiC,KAAK,wBAAwB,EAAE,MAAM,sBAAsB;AAEnG,YAAY,EAAE,eAAe,EAAE,MAAM,uBAAuB;AAE5D,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,OAAO;AAEhD,MAAM,MAAM,gBAAgB,GAAG;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;CAChD;AAED,MAAM,MAAM,sCAAsC,GAAG;IACjD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,UAAU,CAAC,EAAE,wBAAwB,CAAC;CACzC;AAkCD,KAAK,aAAa,CAAC,SAAS,SAAS,oBAAoB,IAAI,SAAS;IAClE,MAAM,EAAE,yBAAyB,CAAC,SAAS,CAAC;IAC5C,OAAO,CAAC,EAAE,gBAAgB;CAC7B;AACD,KAAK,gBAAgB,GAAG,SAAS,CAAC,OAAO,CAAC,EAAE,gBAAgB,CAAC;AAE7D,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,cAAc,IAAI,CAAC,SAAS,oBAAoB,GAAG,aAAa,CAAC,CAAC,CAAC,GACvG,gBAAgB"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { buildGraphqlMutation, buildGraphqlQuery } from '@schema-hub/zod-graphql-query-builder';
|
|
2
|
+
import { getVariableMapMetadata } from './define-variables.js';
|
|
3
|
+
import { buildPersistedQueryExtensions } from './persisted-query.js';
|
|
4
|
+
export function buildOperationPayload(input) {
|
|
5
|
+
const builderOptions = {
|
|
6
|
+
operationName: input.operationName,
|
|
7
|
+
variableDefinitions: input.variableDefinitions
|
|
8
|
+
};
|
|
9
|
+
const serializedQuery = input.operationType === 'query' ?
|
|
10
|
+
buildGraphqlQuery(input.schema, builderOptions) :
|
|
11
|
+
buildGraphqlMutation(input.schema, builderOptions);
|
|
12
|
+
return {
|
|
13
|
+
query: serializedQuery,
|
|
14
|
+
variables: input.variableValues,
|
|
15
|
+
operationName: input.operationName
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export function resolveOperationInputs(handle, valuesOrOptions, maybeOptions) {
|
|
19
|
+
if (handle.variables === undefined) {
|
|
20
|
+
return {
|
|
21
|
+
success: true,
|
|
22
|
+
data: {
|
|
23
|
+
schema: handle.schema,
|
|
24
|
+
operationName: handle.operationName,
|
|
25
|
+
variableDefinitions: {},
|
|
26
|
+
variableValues: {},
|
|
27
|
+
options: valuesOrOptions ?? {}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const metadata = getVariableMapMetadata(handle.variables);
|
|
32
|
+
const parsed = metadata.parse(valuesOrOptions);
|
|
33
|
+
if (!parsed.success) {
|
|
34
|
+
return {
|
|
35
|
+
success: false,
|
|
36
|
+
errorDetails: {
|
|
37
|
+
type: 'validation',
|
|
38
|
+
message: 'GraphQL variable values don’t match the expected schema',
|
|
39
|
+
issues: parsed.error.issues
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
success: true,
|
|
45
|
+
data: {
|
|
46
|
+
schema: handle.schema,
|
|
47
|
+
operationName: handle.operationName,
|
|
48
|
+
variableDefinitions: { ...metadata.definitions },
|
|
49
|
+
variableValues: parsed.data,
|
|
50
|
+
options: maybeOptions ?? {}
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export function toPersistedQueryPayload(payload, mode) {
|
|
55
|
+
const extensions = buildPersistedQueryExtensions(payload.query);
|
|
56
|
+
if (mode === 'hash-only') {
|
|
57
|
+
return {
|
|
58
|
+
variables: payload.variables,
|
|
59
|
+
operationName: payload.operationName,
|
|
60
|
+
extensions
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
query: payload.query,
|
|
65
|
+
variables: payload.variables,
|
|
66
|
+
operationName: payload.operationName,
|
|
67
|
+
extensions
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=operation-payload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation-payload.js","sourceRoot":"","sources":["../../../../source/zod-graphql-client/operation-payload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAoB,MAAM,6CAA6C,CAAC;AACxH,OAAO,EAEH,sBAAsB,EAGzB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,6BAA6B,EAAiC,MAAM,sBAAsB,CAAC;AAgCpG,MAAM,UAAU,qBAAqB,CAAC,KAAiC;IACnE,MAAM,cAAc,GAAG;QACnB,aAAa,EAAE,KAAK,CAAC,aAAa;QAClC,mBAAmB,EAAE,KAAK,CAAC,mBAAmB;KACjD,CAAC;IACF,MAAM,eAAe,GAAG,KAAK,CAAC,aAAa,KAAK,OAAO,CAAC,CAAC;QACrD,iBAAiB,CAAC,KAAK,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC;QACjD,oBAAoB,CAAC,KAAK,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAEvD,OAAO;QACH,KAAK,EAAE,eAAe;QACtB,SAAS,EAAE,KAAK,CAAC,cAAc;QAC/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E,CAAC;QACvB,OAAO;YACH,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,aAAa,EAAE,OAAO,CAAC,aAAa;YACpC,UAAU;SACb,CAAC;IACN,CAAC;IACD,OAAO;QACH,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,aAAa,EAAE,OAAO,CAAC,aAAa;QACpC,UAAU;KACb,CAAC;AACN,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { output as TypeOf } from 'zod/v4/core';
|
|
2
|
-
import type { QuerySchema } from '@schema-hub/zod-graphql-query-builder
|
|
2
|
+
import type { QuerySchema } from '@schema-hub/zod-graphql-query-builder';
|
|
3
3
|
import type { OperationErrorDetails } from './operation-error.js';
|
|
4
4
|
export type OperationFailureResult = {
|
|
5
5
|
data?: undefined;
|
|
@@ -0,0 +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;AAE/B,MAAM,MAAM,wBAAwB,GAAG;IACnC,cAAc,EAAE;QACZ,OAAO,EAAE,OAAO,qBAAqB,CAAC;QACtC,UAAU,EAAE,MAAM,CAAC;KACtB,CAAC;CACL"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { z } from 'zod/v4-mini';
|
|
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 (error.message === persistedQueryNotFoundMessage || code === persistedQueryNotFoundCode) {
|
|
30
|
+
return 'not-found';
|
|
31
|
+
}
|
|
32
|
+
if (error.message === persistedQueryNotSupportedMessage || code === persistedQueryNotSupportedCode) {
|
|
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
|
+
}
|
|
50
|
+
//# sourceMappingURL=persisted-query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"persisted-query.js","sourceRoot":"","sources":["../../../../source/zod-graphql-client/persisted-query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAA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CAAC,OAAO,KAAK,iCAAiC,IAAI,IAAI,KAAK,8BAA8B,EAAE,CAAC;QACjG,OAAO,eAAe,CAAC;IAC3B,CAAC;IACD,OAAO,SAAS,CAAC;AACrB,CAAC;AAED,MAAM,UAAU,+BAA+B,CAAC,WAAoB;IAChE,MAAM,MAAM,GAAG,kCAAkC,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACzE,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QACtD,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACrC,MAAM,MAAM,GAAG,2BAA2B,CAAC,KAAK,CAAC,CAAC;QAClD,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACvB,OAAO,MAAM,CAAC;QAClB,CAAC;IACL,CAAC;IACD,OAAO,SAAS,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { $ZodType, type output as TypeOf } from 'zod/v4/core';
|
|
2
|
+
export type ExplicitVariableEntry<Schema extends $ZodType = $ZodType> = {
|
|
3
|
+
readonly type: string;
|
|
4
|
+
readonly schema: Schema;
|
|
5
|
+
};
|
|
6
|
+
export type VariableEntry = $ZodType | ExplicitVariableEntry;
|
|
7
|
+
type SchemaFromZodType<Entry> = Entry extends $ZodType ? Entry : never;
|
|
8
|
+
export type EntrySchema<Entry extends VariableEntry> = Entry extends ExplicitVariableEntry<infer Schema> ? Schema : SchemaFromZodType<Entry>;
|
|
9
|
+
export type EntryValueType<Entry extends VariableEntry> = TypeOf<EntrySchema<Entry>>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=variable-entry.d.ts.map
|
|
@@ -0,0 +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;AAE7D,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;AAED,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,qBAAqB;AAE5D,KAAK,iBAAiB,CAAC,KAAK,IAAI,KAAK,SAAS,QAAQ,GAAG,KAAK,GAAG,KAAK;AAEtE,MAAM,MAAM,WAAW,CAAC,KAAK,SAAS,aAAa,IAAI,KAAK,SAAS,qBAAqB,CAAC,MAAM,MAAM,CAAC,GAAG,MAAM,GAC7G,iBAAiB,CAAC,KAAK,CAAC;AAE5B,MAAM,MAAM,cAAc,CAAC,KAAK,SAAS,aAAa,IAAI,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variable-entry.js","sourceRoot":"","sources":["../../../../source/zod-graphql-client/variable-entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAyB,MAAM,aAAa"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
type Variable = {
|
|
2
|
-
type: string;
|
|
3
|
-
value: unknown;
|
|
4
|
-
};
|
|
5
|
-
export type Variables = Record<string, Variable>;
|
|
6
|
-
export declare function extractVariableDefinitions(variables: Variables): Record<string, string>;
|
|
7
|
-
export declare function extractVariableValues(variables: Variables): Record<string, unknown>;
|
|
8
|
-
export {};
|
|
9
|
-
//# sourceMappingURL=variables.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"variables.d.ts","sourceRoot":"","sources":["../../../../source/zod-graphql-client/variables.ts"],"names":[],"mappings":"AAAA,KAAK,QAAQ,GAAG;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AAEjD,wBAAgB,0BAA0B,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAMvF;AAED,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAMnF"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export function extractVariableDefinitions(variables) {
|
|
2
|
-
const entries = Object.entries(variables);
|
|
3
|
-
const entriesWithTypeOnly = entries.map(([name, variable]) => {
|
|
4
|
-
return [`$${name}`, variable.type];
|
|
5
|
-
});
|
|
6
|
-
return Object.fromEntries(entriesWithTypeOnly);
|
|
7
|
-
}
|
|
8
|
-
export function extractVariableValues(variables) {
|
|
9
|
-
const entries = Object.entries(variables);
|
|
10
|
-
const entriesWithTypeOnly = entries.map(([name, variable]) => {
|
|
11
|
-
return [name, variable.value];
|
|
12
|
-
});
|
|
13
|
-
return Object.fromEntries(entriesWithTypeOnly);
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=variables.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"variables.js","sourceRoot":"","sources":["../../../../source/zod-graphql-client/variables.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,0BAA0B,CAAC,SAAoB;IAC3D,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAC1C,MAAM,mBAAmB,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAoB,EAAE;QAC3E,OAAO,CAAC,IAAI,IAAI,EAAE,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,SAAoB;IACtD,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAC1C,MAAM,mBAAmB,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAqB,EAAE;QAC5E,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IACH,OAAO,MAAM,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC;AACnD,CAAC"}
|