@schema-hub/zod-graphql-query-builder 0.0.16 → 0.0.18
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 +1 -1
- package/sbom.cdx.json +5 -5
- package/zod-graphql-query-builder/build-context.js +1 -9
- package/zod-graphql-query-builder/build-context.js.map +1 -1
- package/zod-graphql-query-builder/builder.d.ts +0 -8
- package/zod-graphql-query-builder/builder.d.ts.map +1 -1
- package/zod-graphql-query-builder/builder.js +7 -41
- package/zod-graphql-query-builder/builder.js.map +1 -1
- package/zod-graphql-query-builder/custom-scalar.d.ts +0 -1
- package/zod-graphql-query-builder/custom-scalar.d.ts.map +1 -1
- package/zod-graphql-query-builder/custom-scalar.js +1 -12
- package/zod-graphql-query-builder/custom-scalar.js.map +1 -1
- package/zod-graphql-query-builder/fragment-definitions.js +0 -14
- package/zod-graphql-query-builder/fragment-definitions.js.map +1 -1
- package/zod-graphql-query-builder/query-schema.d.ts +1 -18
- package/zod-graphql-query-builder/query-schema.d.ts.map +1 -1
- package/zod-graphql-query-builder/query-schema.js +2 -51
- package/zod-graphql-query-builder/query-schema.js.map +1 -1
- package/zod-graphql-query-builder/root-shape.js +0 -6
- package/zod-graphql-query-builder/root-shape.js.map +1 -1
- package/zod-graphql-query-builder/serializer.js +6 -309
- package/zod-graphql-query-builder/serializer.js.map +1 -1
- package/zod-graphql-query-builder/type-name.d.ts +0 -3
- package/zod-graphql-query-builder/type-name.d.ts.map +1 -1
- package/zod-graphql-query-builder/type-name.js +3 -43
- package/zod-graphql-query-builder/type-name.js.map +1 -1
- package/zod-graphql-query-builder/values/enum.d.ts +0 -1
- package/zod-graphql-query-builder/values/enum.d.ts.map +1 -1
- package/zod-graphql-query-builder/values/enum.js +2 -15
- package/zod-graphql-query-builder/values/enum.js.map +1 -1
- package/zod-graphql-query-builder/values/name.js +0 -4
- package/zod-graphql-query-builder/values/name.js.map +1 -1
- package/zod-graphql-query-builder/values/parameter-list.js +3 -24
- package/zod-graphql-query-builder/values/parameter-list.js.map +1 -1
- package/zod-graphql-query-builder/values/record.js +0 -6
- package/zod-graphql-query-builder/values/record.js.map +1 -1
- package/zod-graphql-query-builder/values/value.d.ts +0 -5
- package/zod-graphql-query-builder/values/value.d.ts.map +1 -1
- package/zod-graphql-query-builder/values/value.js +5 -76
- package/zod-graphql-query-builder/values/value.js.map +1 -1
- package/zod-graphql-query-builder/values/variable-set.js +0 -3
- package/zod-graphql-query-builder/values/variable-set.js.map +1 -1
- package/zod-graphql-query-builder/variable-correlations.js +0 -13
- package/zod-graphql-query-builder/variable-correlations.js.map +1 -1
- package/zod-graphql-query-builder/variable-definition.d.ts +0 -1
- package/zod-graphql-query-builder/variable-definition.d.ts.map +1 -1
- package/zod-graphql-query-builder/variable-definition.js +2 -27
- package/zod-graphql-query-builder/variable-definition.js.map +1 -1
- package/zod-graphql-query-builder/variable-type.js +1 -10
- package/zod-graphql-query-builder/variable-type.js.map +1 -1
- package/zod-graphql-query-builder/build-context.d.ts +0 -11
- package/zod-graphql-query-builder/build-context.d.ts.map +0 -1
- package/zod-graphql-query-builder/fragment-definitions.d.ts +0 -7
- package/zod-graphql-query-builder/fragment-definitions.d.ts.map +0 -1
- package/zod-graphql-query-builder/root-shape.d.ts +0 -3
- package/zod-graphql-query-builder/root-shape.d.ts.map +0 -1
- package/zod-graphql-query-builder/serializer.d.ts +0 -10
- package/zod-graphql-query-builder/serializer.d.ts.map +0 -1
- package/zod-graphql-query-builder/values/name.d.ts +0 -2
- package/zod-graphql-query-builder/values/name.d.ts.map +0 -1
- package/zod-graphql-query-builder/values/parameter-list.d.ts +0 -3
- package/zod-graphql-query-builder/values/parameter-list.d.ts.map +0 -1
- package/zod-graphql-query-builder/values/record.d.ts +0 -3
- package/zod-graphql-query-builder/values/record.d.ts.map +0 -1
- package/zod-graphql-query-builder/values/variable-set.d.ts +0 -2
- package/zod-graphql-query-builder/values/variable-set.d.ts.map +0 -1
- package/zod-graphql-query-builder/variable-correlations.d.ts +0 -3
- package/zod-graphql-query-builder/variable-correlations.d.ts.map +0 -1
- package/zod-graphql-query-builder/variable-type.d.ts +0 -2
- package/zod-graphql-query-builder/variable-type.d.ts.map +0 -1
|
@@ -1,14 +1 @@
|
|
|
1
|
-
export function ensureValidVariableCorrelations(variableDefinitions, referencedVariables) {
|
|
2
|
-
const unusedVariableDefinitions = new Set(Object.keys(variableDefinitions));
|
|
3
|
-
for (const referencedVariable of referencedVariables) {
|
|
4
|
-
unusedVariableDefinitions.delete(referencedVariable);
|
|
5
|
-
if (!Object.hasOwn(variableDefinitions, referencedVariable)) {
|
|
6
|
-
throw new Error(`Referenced variable "${referencedVariable}" is missing in variableDefinitions`);
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
const [firstUnusedVariable] = Array.from(unusedVariableDefinitions);
|
|
10
|
-
if (firstUnusedVariable !== undefined) {
|
|
11
|
-
throw new Error(`Variable definition for "${firstUnusedVariable}" is never referenced`);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
1
|
//# sourceMappingURL=variable-correlations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variable-correlations.js","sourceRoot":"","sources":["../../../../source/zod-graphql-query-builder/variable-correlations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"variable-correlations.js","sourceRoot":"","sources":["../../../../source/zod-graphql-query-builder/variable-correlations.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variable-definition.d.ts","sourceRoot":"","sources":["../../../../source/zod-graphql-query-builder/variable-definition.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC
|
|
1
|
+
{"version":3,"file":"variable-definition.d.ts","sourceRoot":"","sources":["../../../../source/zod-graphql-query-builder/variable-definition.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC"}
|
|
@@ -1,28 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
function ensureValidVariableDefinition(variableDefinition) {
|
|
4
|
-
const [variableName, variableType] = variableDefinition;
|
|
5
|
-
if (!isValidVariableIdentifier(variableName)) {
|
|
6
|
-
throw new Error(`Variable name "${variableName}" is not a valid GraphQL variable name`);
|
|
7
|
-
}
|
|
8
|
-
if (!isValidGraphqlType(variableType)) {
|
|
9
|
-
throw new Error(`Type "${variableType}" for variable "${variableName}" is invalid`);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
function serializeVariableDefinitionPair(variableDefinition) {
|
|
13
|
-
const [variableName, variableType] = variableDefinition;
|
|
14
|
-
return `${variableName}: ${variableType}`;
|
|
15
|
-
}
|
|
16
|
-
export function serializeVariableDefinitions(definitions) {
|
|
17
|
-
const entries = Object.entries(definitions);
|
|
18
|
-
if (entries.length === 0) {
|
|
19
|
-
return '';
|
|
20
|
-
}
|
|
21
|
-
entries.forEach(ensureValidVariableDefinition);
|
|
22
|
-
const sortedEntries = entries.toSorted(function ([nameA], [nameB]) {
|
|
23
|
-
return nameA.localeCompare(nameB);
|
|
24
|
-
});
|
|
25
|
-
const serializedEntries = sortedEntries.map(serializeVariableDefinitionPair);
|
|
26
|
-
return `(${serializedEntries.join(', ')})`;
|
|
27
|
-
}
|
|
1
|
+
import "./values/variable-placeholder.js";
|
|
2
|
+
import "./variable-type.js";
|
|
28
3
|
//# sourceMappingURL=variable-definition.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variable-definition.js","sourceRoot":"","sources":["../../../../source/zod-graphql-query-builder/variable-definition.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"variable-definition.js","sourceRoot":"","sources":["../../../../source/zod-graphql-query-builder/variable-definition.ts"],"names":[],"mappings":"AAAA,OAA0C,kCAAkC,CAAC;AAC7E,OAAmC,oBAAoB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variable-type.js","sourceRoot":"","sources":["../../../../source/zod-graphql-query-builder/variable-type.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"variable-type.js","sourceRoot":"","sources":["../../../../source/zod-graphql-query-builder/variable-type.ts"],"names":[],"mappings":"AAAA,OAA0B,SAAS,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { FragmentDefinition } from './fragment-definitions.ts';
|
|
2
|
-
import type { FieldSchema, FieldShape } from './query-schema.ts';
|
|
3
|
-
import type { FieldOptionsRegistry } from './type-name.ts';
|
|
4
|
-
export type BuildContext = {
|
|
5
|
-
counts: ReadonlyMap<FieldSchema, number>;
|
|
6
|
-
nameForSchema: Map<FieldSchema, string>;
|
|
7
|
-
counterPerTypeName: Map<string, number>;
|
|
8
|
-
definitions: Map<string, FragmentDefinition>;
|
|
9
|
-
};
|
|
10
|
-
export declare function createBuildContext(registry: FieldOptionsRegistry, rootShape: FieldShape): BuildContext;
|
|
11
|
-
//# sourceMappingURL=build-context.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build-context.d.ts","sourceRoot":"","sources":["../../../../source/zod-graphql-query-builder/build-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEjE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAK3D,MAAM,MAAM,YAAY,GAAG;IACvB,MAAM,EAAE,WAAW,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IACzC,aAAa,EAAE,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IACxC,kBAAkB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;CAChD,CAAC;AAGF,wBAAgB,kBAAkB,CAC9B,QAAQ,EAAE,oBAAoB,EAC9B,SAAS,EAAE,UAAU,GACtB,YAAY,CAOd"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export type FragmentDefinition = {
|
|
2
|
-
readonly typeName: string;
|
|
3
|
-
readonly body: string;
|
|
4
|
-
readonly referencedVariables: ReadonlySet<string>;
|
|
5
|
-
};
|
|
6
|
-
export declare function formatFragmentDefinitions(definitions: ReadonlyMap<string, FragmentDefinition>): string;
|
|
7
|
-
//# sourceMappingURL=fragment-definitions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fragment-definitions.d.ts","sourceRoot":"","sources":["../../../../source/zod-graphql-query-builder/fragment-definitions.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,mBAAmB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACrD,CAAC;AAEF,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,WAAW,CAAC,MAAM,EAAE,kBAAkB,CAAC,GAAG,MAAM,CAatG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"root-shape.d.ts","sourceRoot":"","sources":["../../../../source/zod-graphql-query-builder/root-shape.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEjE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,WAAW,GAAG,UAAU,CAKhE"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { BuildContext } from './build-context.ts';
|
|
2
|
-
import { type FieldSchema, type FieldShape } from './query-schema.ts';
|
|
3
|
-
import { type FieldOptionsRegistry } from './type-name.ts';
|
|
4
|
-
export type SerializedRootShape = {
|
|
5
|
-
readonly bodyEntries: readonly string[];
|
|
6
|
-
readonly referencedVariables: ReadonlySet<string>;
|
|
7
|
-
};
|
|
8
|
-
export declare function collectSchemaReferences(registry: FieldOptionsRegistry, rootShape: FieldShape): Map<FieldSchema, number>;
|
|
9
|
-
export declare function serializeRootShape(registry: FieldOptionsRegistry, rootShape: FieldShape, context: BuildContext): SerializedRootShape;
|
|
10
|
-
//# sourceMappingURL=serializer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../../../../source/zod-graphql-query-builder/serializer.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAEH,KAAK,WAAW,EAEhB,KAAK,UAAU,EAclB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACH,KAAK,oBAAoB,EAG5B,MAAM,gBAAgB,CAAC;AAKxB,MAAM,MAAM,mBAAmB,GAAG;IAC9B,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,QAAQ,CAAC,mBAAmB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACrD,CAAC;AAgJF,wBAAgB,uBAAuB,CACnC,QAAQ,EAAE,oBAAoB,EAC9B,SAAS,EAAE,UAAU,GACtB,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,CAiC1B;AAoQD,wBAAgB,kBAAkB,CAC9B,QAAQ,EAAE,oBAAoB,EAC9B,SAAS,EAAE,UAAU,EACrB,OAAO,EAAE,YAAY,GACtB,mBAAmB,CAcrB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"name.d.ts","sourceRoot":"","sources":["../../../../../source/zod-graphql-query-builder/values/name.ts"],"names":[],"mappings":"AAEA,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEzD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parameter-list.d.ts","sourceRoot":"","sources":["../../../../../source/zod-graphql-query-builder/values/parameter-list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,sBAAsB,EAAyB,MAAM,YAAY,CAAC;AAGnG,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,GAAG,sBAAsB,CAwBjH"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export declare function hasProperty<Value extends Record<string, unknown>, Property extends string>(value: Value, property: Property): value is Record<Property, unknown> & Value;
|
|
2
|
-
export declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
3
|
-
//# sourceMappingURL=record.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../../../../../source/zod-graphql-query-builder/values/record.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,SAAS,MAAM,EACtF,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,GACnB,KAAK,IAAI,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,KAAK,CAE5C;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"variable-set.d.ts","sourceRoot":"","sources":["../../../../../source/zod-graphql-query-builder/values/variable-set.ts"],"names":[],"mappings":"AAAA,wBAAgB,cAAc,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,CAEnG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"variable-correlations.d.ts","sourceRoot":"","sources":["../../../../source/zod-graphql-query-builder/variable-correlations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEpE,wBAAgB,+BAA+B,CAC3C,mBAAmB,EAAE,mBAAmB,EACxC,mBAAmB,EAAE,WAAW,CAAC,MAAM,CAAC,GACzC,IAAI,CAcN"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"variable-type.d.ts","sourceRoot":"","sources":["../../../../source/zod-graphql-query-builder/variable-type.ts"],"names":[],"mappings":"AAEA,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAOxD"}
|