@gqlbase/plugins 0.1.3 → 0.1.4
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/appsync/AppSyncSchemaGeneratorPlugin/AppSyncSchemaGeneratorPlugin.d.ts.map +1 -1
- package/dist/appsync/AppSyncSchemaGeneratorPlugin/AppSyncSchemaGeneratorPlugin.js +2 -3
- package/dist/appsync/AppSyncSchemaGeneratorPlugin/AppSyncSchemaGeneratorPlugin.js.map +1 -1
- package/dist/appsync/AppSyncSchemaGeneratorPlugin/AppSyncSchemaGeneratorPlugin.utils.d.ts +0 -3
- package/dist/appsync/AppSyncSchemaGeneratorPlugin/AppSyncSchemaGeneratorPlugin.utils.d.ts.map +1 -1
- package/dist/appsync/AppSyncSchemaGeneratorPlugin/AppSyncSchemaGeneratorPlugin.utils.js +1 -7
- package/dist/appsync/AppSyncSchemaGeneratorPlugin/AppSyncSchemaGeneratorPlugin.utils.js.map +1 -1
- package/dist/base/UtilitiesPlugin/UtilitiesPlugin.d.ts +1 -1
- package/dist/base/UtilitiesPlugin/UtilitiesPlugin.d.ts.map +1 -1
- package/dist/base/UtilitiesPlugin/UtilitiesPlugin.js +14 -12
- package/dist/base/UtilitiesPlugin/UtilitiesPlugin.js.map +1 -1
- package/dist/base/UtilitiesPlugin/UtilitiesPlugin.utils.d.ts +12 -1
- package/dist/base/UtilitiesPlugin/UtilitiesPlugin.utils.d.ts.map +1 -1
- package/dist/base/UtilitiesPlugin/UtilitiesPlugin.utils.js +27 -0
- package/dist/base/UtilitiesPlugin/UtilitiesPlugin.utils.js.map +1 -1
- package/dist/base/UtilitiesPlugin/index.d.ts +1 -1
- package/dist/base/UtilitiesPlugin/index.d.ts.map +1 -1
- package/dist/base/UtilitiesPlugin/index.js +1 -1
- package/dist/base/UtilitiesPlugin/index.js.map +1 -1
- package/dist/zod/ZodSchemaGeneratorPlugin/ZodSchemaGeneratorPlugin.d.ts +68 -0
- package/dist/zod/ZodSchemaGeneratorPlugin/ZodSchemaGeneratorPlugin.d.ts.map +1 -0
- package/dist/zod/ZodSchemaGeneratorPlugin/ZodSchemaGeneratorPlugin.js +300 -0
- package/dist/zod/ZodSchemaGeneratorPlugin/ZodSchemaGeneratorPlugin.js.map +1 -0
- package/dist/zod/ZodSchemaGeneratorPlugin/ZodSchemaGeneratorPlugin.utils.d.ts +17 -0
- package/dist/zod/ZodSchemaGeneratorPlugin/ZodSchemaGeneratorPlugin.utils.d.ts.map +1 -0
- package/dist/zod/ZodSchemaGeneratorPlugin/ZodSchemaGeneratorPlugin.utils.js +24 -0
- package/dist/zod/ZodSchemaGeneratorPlugin/ZodSchemaGeneratorPlugin.utils.js.map +1 -0
- package/dist/zod/ZodSchemaGeneratorPlugin/index.d.ts +2 -0
- package/dist/zod/ZodSchemaGeneratorPlugin/index.d.ts.map +1 -0
- package/dist/zod/ZodSchemaGeneratorPlugin/index.js +2 -0
- package/dist/zod/ZodSchemaGeneratorPlugin/index.js.map +1 -0
- package/dist/zod/index.d.ts +2 -0
- package/dist/zod/index.d.ts.map +1 -0
- package/dist/zod/index.js +2 -0
- package/dist/zod/index.js.map +1 -0
- package/package.json +4 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppSyncSchemaGeneratorPlugin.d.ts","sourceRoot":"","sources":["../../../src/appsync/AppSyncSchemaGeneratorPlugin/AppSyncSchemaGeneratorPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,EACL,cAAc,EAEd,YAAY,
|
|
1
|
+
{"version":3,"file":"AppSyncSchemaGeneratorPlugin.d.ts","sourceRoot":"","sources":["../../../src/appsync/AppSyncSchemaGeneratorPlugin/AppSyncSchemaGeneratorPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,EACL,cAAc,EAEd,YAAY,EAcb,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAE,mCAAmC,EAAE,MAAM,yCAAyC,CAAC;AAO9F;;GAEG;AAEH,qBAAa,4BAA6B,SAAQ,qBAAqB;IACrE,QAAQ,EAAE,YAAY,CAAC;IACvB,OAAO,EAAE,QAAQ,CAAC,mCAAmC,CAAC,CAAC;gBAE3C,OAAO,EAAE,mBAAmB,EAAE,OAAO,GAAE,mCAAwC;IAW3F,OAAO,CAAC,cAAc;IAqBtB,OAAO,CAAC,YAAY;IAYpB,OAAO,CAAC,iBAAiB;IAkBzB,OAAO,CAAC,UAAU;IA4BlB,OAAO,CAAC,eAAe;IAevB,OAAO,CAAC,UAAU;IAUlB,OAAO,CAAC,aAAa;IAYrB,OAAO,CAAC,SAAS;IAOjB,OAAO,CAAC,QAAQ;IAOhB,OAAO,CAAC,eAAe;IAOhB,MAAM;IAIN,KAAK,CAAC,UAAU,EAAE,cAAc,GAAG,OAAO;IAM1C,QAAQ,CAAC,UAAU,EAAE,cAAc;IAsBnC,MAAM;;;;;;;CAkBd;AAED,eAAO,MAAM,4BAA4B,uGAAoD,CAAC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { TransformerPluginBase } from "@gqlbase/core";
|
|
2
|
-
import { DirectiveNode, DocumentNode, EnumNode, FieldNode, InputObjectNode, InputValueNode, InterfaceNode, ListTypeNode, NamedTypeNode, NonNullTypeNode, ObjectNode, UnionNode, } from "@gqlbase/core/definition";
|
|
2
|
+
import { DirectiveNode, DocumentNode, EnumNode, FieldNode, InputObjectNode, InputValueNode, InterfaceNode, ListTypeNode, NamedTypeNode, NonNullTypeNode, ObjectNode, UnionNode, isScalarNode, isDirectiveDefinitionNode, } from "@gqlbase/core/definition";
|
|
3
3
|
import { createPluginFactory, isInternal } from "@gqlbase/core/plugins";
|
|
4
4
|
import { isBuildInScalar } from "@gqlbase/shared/definition";
|
|
5
|
-
import { isDirectiveNode, isScalarNode, } from "./AppSyncSchemaGeneratorPlugin.utils.js";
|
|
6
5
|
import { isAppSyncDirective, isAppSyncScalar, mapToAppSyncScalarName, } from "../AppSyncUtilsPlugin/AppSyncUtilsPlugin.utils.js";
|
|
7
6
|
/**
|
|
8
7
|
* Generates an AppSync compatible GraphQL schema.
|
|
@@ -107,7 +106,7 @@ export class AppSyncSchemaGeneratorPlugin extends TransformerPluginBase {
|
|
|
107
106
|
this.document = DocumentNode.create();
|
|
108
107
|
}
|
|
109
108
|
match(definition) {
|
|
110
|
-
return !isScalarNode(definition) && !
|
|
109
|
+
return (!isScalarNode(definition) && !isDirectiveDefinitionNode(definition) && !isInternal(definition));
|
|
111
110
|
}
|
|
112
111
|
generate(definition) {
|
|
113
112
|
if (definition instanceof InterfaceNode) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppSyncSchemaGeneratorPlugin.js","sourceRoot":"","sources":["../../../src/appsync/AppSyncSchemaGeneratorPlugin/AppSyncSchemaGeneratorPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,EAEL,aAAa,EACb,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,eAAe,EACf,cAAc,EACd,aAAa,EACb,YAAY,EACZ,aAAa,EACb,eAAe,EACf,UAAU,EACV,SAAS,
|
|
1
|
+
{"version":3,"file":"AppSyncSchemaGeneratorPlugin.js","sourceRoot":"","sources":["../../../src/appsync/AppSyncSchemaGeneratorPlugin/AppSyncSchemaGeneratorPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,EAEL,aAAa,EACb,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,eAAe,EACf,cAAc,EACd,aAAa,EACb,YAAY,EACZ,aAAa,EACb,eAAe,EACf,UAAU,EACV,SAAS,EAET,YAAY,EACZ,yBAAyB,GAC1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,E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,CAAC;QACrC,CAAC;QAED,IAAI,UAAU,YAAY,SAAS,EAAE,CAAC;YACpC,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QACpC,CAAC;QAED,IAAI,UAAU,YAAY,eAAe,EAAE,CAAC;YAC1C,OAAO,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;QAC1C,CAAC;QAED,IAAI,UAAU,YAAY,QAAQ,EAAE,CAAC;YACnC,OAAO,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;QACnC,CAAC;IACH,CAAC;IAEM,MAAM;QACX,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QAErC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC;YACtB,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,wBAAwB;YAC9B,QAAQ,EAAE,gBAAgB;YAC1B,OAAO,EAAE,MAAM;SAChB,CAAC,CAAC;QAEH,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;YAC5B,OAAO;gBACL,OAAO,EAAE,EAAE,MAAM,EAAE;aACpB,CAAC;QACJ,CAAC;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AAED,MAAM,CAAC,MAAM,4BAA4B,GAAG,mBAAmB,CAAC,4BAA4B,CAAC,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { DefinitionNode } from "@gqlbase/core/definition";
|
|
2
1
|
import { AppSyncScalarName } from "../AppSyncUtilsPlugin/AppSyncUtilsPlugin.utils.js";
|
|
3
2
|
import { BuildInScalar } from "@gqlbase/shared/definition";
|
|
4
3
|
export interface AppSyncSchemaGeneratorPluginOptions {
|
|
@@ -13,6 +12,4 @@ export interface AppSyncSchemaGeneratorPluginOptions {
|
|
|
13
12
|
*/
|
|
14
13
|
scalarMappings?: Record<string, AppSyncScalarName | BuildInScalar>;
|
|
15
14
|
}
|
|
16
|
-
export declare const isScalarNode: (node: DefinitionNode) => boolean;
|
|
17
|
-
export declare const isDirectiveNode: (node: DefinitionNode) => boolean;
|
|
18
15
|
//# sourceMappingURL=AppSyncSchemaGeneratorPlugin.utils.d.ts.map
|
package/dist/appsync/AppSyncSchemaGeneratorPlugin/AppSyncSchemaGeneratorPlugin.utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppSyncSchemaGeneratorPlugin.utils.d.ts","sourceRoot":"","sources":["../../../src/appsync/AppSyncSchemaGeneratorPlugin/AppSyncSchemaGeneratorPlugin.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"AppSyncSchemaGeneratorPlugin.utils.d.ts","sourceRoot":"","sources":["../../../src/appsync/AppSyncSchemaGeneratorPlugin/AppSyncSchemaGeneratorPlugin.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mDAAmD,CAAC;AACtF,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,MAAM,WAAW,mCAAmC;IAClD;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,GAAG,aAAa,CAAC,CAAC;CACpE"}
|
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export const isScalarNode = (node) => {
|
|
3
|
-
return node instanceof ScalarNode;
|
|
4
|
-
};
|
|
5
|
-
export const isDirectiveNode = (node) => {
|
|
6
|
-
return node instanceof DirectiveDefinitionNode;
|
|
7
|
-
};
|
|
1
|
+
export {};
|
|
8
2
|
//# sourceMappingURL=AppSyncSchemaGeneratorPlugin.utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppSyncSchemaGeneratorPlugin.utils.js","sourceRoot":"","sources":["../../../src/appsync/AppSyncSchemaGeneratorPlugin/AppSyncSchemaGeneratorPlugin.utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AppSyncSchemaGeneratorPlugin.utils.js","sourceRoot":"","sources":["../../../src/appsync/AppSyncSchemaGeneratorPlugin/AppSyncSchemaGeneratorPlugin.utils.ts"],"names":[],"mappings":""}
|
|
@@ -9,7 +9,7 @@ export declare class UtilitiesPlugin implements ITransformerPlugin {
|
|
|
9
9
|
readonly context: ITransformerContext;
|
|
10
10
|
constructor(context: ITransformerContext);
|
|
11
11
|
init(): void;
|
|
12
|
-
match(definition: DefinitionNode):
|
|
12
|
+
match(definition: DefinitionNode): definition is InterfaceNode | ObjectNode;
|
|
13
13
|
cleanup(definition: ObjectNode | InterfaceNode): void;
|
|
14
14
|
after(): void;
|
|
15
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UtilitiesPlugin.d.ts","sourceRoot":"","sources":["../../../src/base/UtilitiesPlugin/UtilitiesPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAuB,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChF,OAAO,EACL,cAAc,
|
|
1
|
+
{"version":3,"file":"UtilitiesPlugin.d.ts","sourceRoot":"","sources":["../../../src/base/UtilitiesPlugin/UtilitiesPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAuB,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChF,OAAO,EACL,cAAc,EAGd,aAAa,EAGb,UAAU,EAEX,MAAM,0BAA0B,CAAC;AAGlC;;GAEG;AAEH,qBAAa,eAAgB,YAAW,kBAAkB;IACxD,SAAgB,IAAI,qBAAqB;IACzC,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAC;gBAE1B,OAAO,EAAE,mBAAmB;IAIjC,IAAI,IAAI,IAAI;IAqFZ,KAAK,CAAC,UAAU,EAAE,cAAc;IAIhC,OAAO,CAAC,UAAU,EAAE,UAAU,GAAG,aAAa,GAAG,IAAI;IAoCrD,KAAK,IAAI,IAAI;CAWrB;AAED,eAAO,MAAM,WAAW,uEAAuC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createPluginFactory } from "@gqlbase/core/plugins";
|
|
2
|
-
import { DirectiveDefinitionNode,
|
|
2
|
+
import { DirectiveDefinitionNode, InputValueNode, isInterfaceNode, isObjectNode, ValueNode, } from "@gqlbase/core/definition";
|
|
3
3
|
import { UtilityDirective } from "./UtilitiesPlugin.utils.js";
|
|
4
4
|
/**
|
|
5
5
|
* Adds utility directives to the schema that can be used to mark fields as server-only, client-only, read-only, write-only, filter-only, create-only, or update-only.
|
|
@@ -15,20 +15,18 @@ export class UtilitiesPlugin {
|
|
|
15
15
|
.addNode(DirectiveDefinitionNode.create(UtilityDirective.READ_ONLY, ValueNode.string("Marks a field as read-only, meaning it should only be included in output types and not in input types.", true), ["FIELD_DEFINITION"]))
|
|
16
16
|
.addNode(DirectiveDefinitionNode.create(UtilityDirective.WRITE_ONLY, ValueNode.string("Marks a field as write-only, meaning it should only be included in input types and not in output types.", true), ["FIELD_DEFINITION"]))
|
|
17
17
|
.addNode(DirectiveDefinitionNode.create(UtilityDirective.SERVER_ONLY, ValueNode.string("Marks a field as server-only, meaning it should only be included in the persistence layer and not exposed in final GraphQL schema.", true), ["FIELD_DEFINITION"]))
|
|
18
|
-
.addNode(DirectiveDefinitionNode.create(UtilityDirective.CLIENT_ONLY, ValueNode.string(`Marks a field as client-only, meaning the output value for this field is computed at runtime, and should not be included in the persistence layer
|
|
19
|
-
|
|
20
|
-
This is useful for fields that are computed from other fields, or for fields that are only relevant to the client and should not be stored in the database.
|
|
21
|
-
|
|
22
|
-
The field will not be included in input objects.`, true), ["FIELD_DEFINITION"]))
|
|
18
|
+
.addNode(DirectiveDefinitionNode.create(UtilityDirective.CLIENT_ONLY, ValueNode.string(`Marks a field as client-only, meaning the output value for this field is computed at runtime, and should not be included in the persistence layer.\n\nThis is useful for fields that are computed from other fields, or for fields that are only relevant to the client and should not be stored in the database.\n\nThe field will not be included in input objects.`, true), ["FIELD_DEFINITION"]))
|
|
23
19
|
.addNode(DirectiveDefinitionNode.create(UtilityDirective.FILTER_ONLY, ValueNode.string("The field will be preserved in the output type but only included in the filter input."), ["FIELD_DEFINITION"]))
|
|
24
20
|
.addNode(DirectiveDefinitionNode.create(UtilityDirective.CREATE_ONLY, ValueNode.string("The field will be preserved in the output type but only included in the create input."), ["FIELD_DEFINITION"]))
|
|
25
|
-
.addNode(DirectiveDefinitionNode.create(UtilityDirective.UPDATE_ONLY, ValueNode.string("The field will be preserved in the output type but only included in the update input."), ["FIELD_DEFINITION"]))
|
|
21
|
+
.addNode(DirectiveDefinitionNode.create(UtilityDirective.UPDATE_ONLY, ValueNode.string("The field will be preserved in the output type but only included in the update input."), ["FIELD_DEFINITION"]))
|
|
22
|
+
.addNode(DirectiveDefinitionNode.create(UtilityDirective.CONSTRAINT, ValueNode.string("Adds validation constraints to a field. Mainly used by other plugins to add validation rules to fields. At least one parameter must be provided."), ["FIELD_DEFINITION", "INPUT_FIELD_DEFINITION", "ARGUMENT_DEFINITION"], [
|
|
23
|
+
InputValueNode.create("min", undefined, undefined, "Float"),
|
|
24
|
+
InputValueNode.create("max", undefined, undefined, "Float"),
|
|
25
|
+
InputValueNode.create("pattern", undefined, undefined, "String"),
|
|
26
|
+
]));
|
|
26
27
|
}
|
|
27
28
|
match(definition) {
|
|
28
|
-
|
|
29
|
-
return true;
|
|
30
|
-
}
|
|
31
|
-
return false;
|
|
29
|
+
return isObjectNode(definition) || isInterfaceNode(definition);
|
|
32
30
|
}
|
|
33
31
|
cleanup(definition) {
|
|
34
32
|
for (const field of definition.fields ?? []) {
|
|
@@ -53,6 +51,9 @@ export class UtilitiesPlugin {
|
|
|
53
51
|
if (field.hasDirective(UtilityDirective.UPDATE_ONLY)) {
|
|
54
52
|
field.removeDirective(UtilityDirective.UPDATE_ONLY);
|
|
55
53
|
}
|
|
54
|
+
if (field.hasDirective(UtilityDirective.CONSTRAINT)) {
|
|
55
|
+
field.removeDirective(UtilityDirective.CONSTRAINT);
|
|
56
|
+
}
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
59
|
after() {
|
|
@@ -63,7 +64,8 @@ export class UtilitiesPlugin {
|
|
|
63
64
|
.removeNode(UtilityDirective.CLIENT_ONLY)
|
|
64
65
|
.removeNode(UtilityDirective.FILTER_ONLY)
|
|
65
66
|
.removeNode(UtilityDirective.CREATE_ONLY)
|
|
66
|
-
.removeNode(UtilityDirective.UPDATE_ONLY)
|
|
67
|
+
.removeNode(UtilityDirective.UPDATE_ONLY)
|
|
68
|
+
.removeNode(UtilityDirective.CONSTRAINT);
|
|
67
69
|
}
|
|
68
70
|
}
|
|
69
71
|
export const utilsPlugin = createPluginFactory(UtilitiesPlugin);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UtilitiesPlugin.js","sourceRoot":"","sources":["../../../src/base/UtilitiesPlugin/UtilitiesPlugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAsB,MAAM,uBAAuB,CAAC;AAChF,OAAO,EAEL,uBAAuB,EACvB,
|
|
1
|
+
{"version":3,"file":"UtilitiesPlugin.js","sourceRoot":"","sources":["../../../src/base/UtilitiesPlugin/UtilitiesPlugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAsB,MAAM,uBAAuB,CAAC;AAChF,OAAO,EAEL,uBAAuB,EACvB,cAAc,EAEd,eAAe,EACf,YAAY,EAEZ,SAAS,GACV,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D;;GAEG;AAEH,MAAM,OAAO,eAAe;IACV,IAAI,GAAG,iBAAiB,CAAC;IAChC,OAAO,CAAsB;IAEtC,YAAY,OAA4B;QACtC,I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BACrD,KAAK,CAAC,eAAe,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;YACtD,CAAC;YAED,IAAI,KAAK,CAAC,YAAY,CAAC,gBAAgB,CAAC,WAAW,CAAC,EAAE,CAAC;gBACrD,KAAK,CAAC,eAAe,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;YACtD,CAAC;YAED,IAAI,KAAK,CAAC,YAAY,CAAC,gBAAgB,CAAC,WAAW,CAAC,EAAE,CAAC;gBACrD,KAAK,CAAC,eAAe,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;YACtD,CAAC;YAED,IAAI,KAAK,CAAC,YAAY,CAAC,gBAAgB,CAAC,UAAU,CAAC,EAAE,CAAC;gBACpD,KAAK,CAAC,eAAe,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC;YACrD,CAAC;QACH,CAAC;IACH,CAAC;IAEM,KAAK;QACV,IAAI,CAAC,OAAO,CAAC,QAAQ;aAClB,UAAU,CAAC,gBAAgB,CAAC,SAAS,CAAC;aACtC,UAAU,CAAC,gBAAgB,CAAC,UAAU,CAAC;aACvC,UAAU,CAAC,gBAAgB,CAAC,WAAW,CAAC;aACxC,UAAU,CAAC,gBAAgB,CAAC,WAAW,CAAC;aACxC,UAAU,CAAC,gBAAgB,CAAC,WAAW,CAAC;aACxC,UAAU,CAAC,gBAAgB,CAAC,WAAW,CAAC;aACxC,UAAU,CAAC,gBAAgB,CAAC,WAAW,CAAC;aACxC,UAAU,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC;IAC7C,CAAC;CACF;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,mBAAmB,CAAC,eAAe,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FieldNode } from "@gqlbase/core/definition";
|
|
1
|
+
import { FieldNode, InputValueNode } from "@gqlbase/core/definition";
|
|
2
2
|
export declare const UtilityDirective: {
|
|
3
3
|
/** @serverOnly Marks a field as server-only, meaning it should only be resolved on the server and not exposed to the client. The field will be removed from the final schema */
|
|
4
4
|
readonly SERVER_ONLY: "serverOnly";
|
|
@@ -14,7 +14,16 @@ export declare const UtilityDirective: {
|
|
|
14
14
|
readonly CREATE_ONLY: "createOnly";
|
|
15
15
|
/** @updateOnly Marks a field as update-only, meaning it will only be available in the update input */
|
|
16
16
|
readonly UPDATE_ONLY: "updateOnly";
|
|
17
|
+
/**
|
|
18
|
+
* @constraint Adds validation constraints to a field. Mainly used by other plugins to add validation rules to fields.
|
|
19
|
+
*/
|
|
20
|
+
readonly CONSTRAINT: "constraint";
|
|
17
21
|
};
|
|
22
|
+
export interface FieldContraints {
|
|
23
|
+
min?: number;
|
|
24
|
+
max?: number;
|
|
25
|
+
pattern?: string;
|
|
26
|
+
}
|
|
18
27
|
export declare const isReadOnly: (node: FieldNode) => boolean;
|
|
19
28
|
export declare const isWriteOnly: (node: FieldNode) => boolean;
|
|
20
29
|
export declare const isServerOnly: (node: FieldNode) => boolean;
|
|
@@ -22,4 +31,6 @@ export declare const isClientOnly: (node: FieldNode) => boolean;
|
|
|
22
31
|
export declare const isFilterOnly: (node: FieldNode) => boolean;
|
|
23
32
|
export declare const isCreateOnly: (node: FieldNode) => boolean;
|
|
24
33
|
export declare const isUpdateOnly: (node: FieldNode) => boolean;
|
|
34
|
+
export declare const hasConstraints: (node: FieldNode | InputValueNode) => boolean;
|
|
35
|
+
export declare const parseConstraints: (node: FieldNode | InputValueNode) => FieldContraints;
|
|
25
36
|
//# sourceMappingURL=UtilitiesPlugin.utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UtilitiesPlugin.utils.d.ts","sourceRoot":"","sources":["../../../src/base/UtilitiesPlugin/UtilitiesPlugin.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"UtilitiesPlugin.utils.d.ts","sourceRoot":"","sources":["../../../src/base/UtilitiesPlugin/UtilitiesPlugin.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAErE,eAAO,MAAM,gBAAgB;IAC3B,gLAAgL;;IAGhL,iIAAiI;;IAGjI,mKAAmK;;IAGnK,2FAA2F;;IAG3F,sGAAsG;;IAGtG,sGAAsG;;IAGtG,sGAAsG;;IAGtG;;OAEG;;CAEK,CAAC;AAEX,MAAM,WAAW,eAAe;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,UAAU,GAAI,MAAM,SAAS,KAAG,OAE5C,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,MAAM,SAAS,KAAG,OAE7C,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,MAAM,SAAS,KAAG,OAE9C,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,MAAM,SAAS,KAAG,OAE9C,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,MAAM,SAAS,KAAG,OAE9C,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,MAAM,SAAS,KAAG,OAE9C,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,MAAM,SAAS,KAAG,OAE9C,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,MAAM,SAAS,GAAG,cAAc,KAAG,OAEjE,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,MAAM,SAAS,GAAG,cAAc,KAAG,eAuBnE,CAAC"}
|
|
@@ -13,6 +13,10 @@ export const UtilityDirective = {
|
|
|
13
13
|
CREATE_ONLY: "createOnly",
|
|
14
14
|
/** @updateOnly Marks a field as update-only, meaning it will only be available in the update input */
|
|
15
15
|
UPDATE_ONLY: "updateOnly",
|
|
16
|
+
/**
|
|
17
|
+
* @constraint Adds validation constraints to a field. Mainly used by other plugins to add validation rules to fields.
|
|
18
|
+
*/
|
|
19
|
+
CONSTRAINT: "constraint",
|
|
16
20
|
};
|
|
17
21
|
export const isReadOnly = (node) => {
|
|
18
22
|
return node.hasDirective(UtilityDirective.READ_ONLY);
|
|
@@ -35,4 +39,27 @@ export const isCreateOnly = (node) => {
|
|
|
35
39
|
export const isUpdateOnly = (node) => {
|
|
36
40
|
return node.hasDirective(UtilityDirective.UPDATE_ONLY);
|
|
37
41
|
};
|
|
42
|
+
export const hasConstraints = (node) => {
|
|
43
|
+
return node.hasDirective(UtilityDirective.CONSTRAINT);
|
|
44
|
+
};
|
|
45
|
+
export const parseConstraints = (node) => {
|
|
46
|
+
if (!hasConstraints(node)) {
|
|
47
|
+
return {};
|
|
48
|
+
}
|
|
49
|
+
const directive = node.getDirective(UtilityDirective.CONSTRAINT);
|
|
50
|
+
const args = directive?.getArgumentsJSON();
|
|
51
|
+
return {
|
|
52
|
+
min: typeof args?.min === "number"
|
|
53
|
+
? node.type.getTypeName() === "Float"
|
|
54
|
+
? args.min
|
|
55
|
+
: Math.floor(args.min)
|
|
56
|
+
: undefined,
|
|
57
|
+
max: typeof args?.max === "number"
|
|
58
|
+
? node.type.getTypeName() === "Float"
|
|
59
|
+
? args.max
|
|
60
|
+
: Math.floor(args.max)
|
|
61
|
+
: undefined,
|
|
62
|
+
pattern: typeof args?.pattern === "string" ? args.pattern : undefined,
|
|
63
|
+
};
|
|
64
|
+
};
|
|
38
65
|
//# sourceMappingURL=UtilitiesPlugin.utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UtilitiesPlugin.utils.js","sourceRoot":"","sources":["../../../src/base/UtilitiesPlugin/UtilitiesPlugin.utils.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,gLAAgL;IAChL,WAAW,EAAE,YAAY;IAEzB,iIAAiI;IACjI,WAAW,EAAE,YAAY;IAEzB,mKAAmK;IACnK,SAAS,EAAE,UAAU;IAErB,2FAA2F;IAC3F,UAAU,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gBACnC,CAAC,CAAC,IAAI,CAAC,GAAG;gBACV,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC;YACxB,CAAC,CAAC,SAAS;QACf,OAAO,EAAE,OAAO,IAAI,EAAE,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;KACtE,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { UtilitiesPlugin, utilsPlugin } from "./UtilitiesPlugin.js";
|
|
2
|
-
export { UtilityDirective, isReadOnly, isClientOnly, isCreateOnly, isFilterOnly, isServerOnly, isUpdateOnly, isWriteOnly, } from "./UtilitiesPlugin.utils.js";
|
|
2
|
+
export { UtilityDirective, isReadOnly, isClientOnly, isCreateOnly, isFilterOnly, isServerOnly, isUpdateOnly, isWriteOnly, hasConstraints, parseConstraints, type FieldContraints, } from "./UtilitiesPlugin.utils.js";
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/base/UtilitiesPlugin/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EACL,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,WAAW,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/base/UtilitiesPlugin/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EACL,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,KAAK,eAAe,GACrB,MAAM,4BAA4B,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { UtilitiesPlugin, utilsPlugin } from "./UtilitiesPlugin.js";
|
|
2
|
-
export { UtilityDirective, isReadOnly, isClientOnly, isCreateOnly, isFilterOnly, isServerOnly, isUpdateOnly, isWriteOnly, } from "./UtilitiesPlugin.utils.js";
|
|
2
|
+
export { UtilityDirective, isReadOnly, isClientOnly, isCreateOnly, isFilterOnly, isServerOnly, isUpdateOnly, isWriteOnly, hasConstraints, parseConstraints, } from "./UtilitiesPlugin.utils.js";
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/base/UtilitiesPlugin/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EACL,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,WAAW,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/base/UtilitiesPlugin/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EACL,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,cAAc,EACd,gBAAgB,GAEjB,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ITransformerContext, TransformerPluginBase } from "@gqlbase/core";
|
|
2
|
+
import { DefinitionNode } from "@gqlbase/core/definition";
|
|
3
|
+
import { ZodSchemaGeneratorPluginOptions } from "./ZodSchemaGeneratorPlugin.utils.js";
|
|
4
|
+
/**
|
|
5
|
+
* Generates Zod schemas for the defined types in the GraphQL schema. This can be used for runtime validation of data against the schema.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```graphql
|
|
9
|
+
* # schema.graphql
|
|
10
|
+
* enum UserRole {
|
|
11
|
+
* ADMIN
|
|
12
|
+
* USER
|
|
13
|
+
* }
|
|
14
|
+
*
|
|
15
|
+
* type User {
|
|
16
|
+
* id: ID!
|
|
17
|
+
* name: String! `@constraint(min: 3, max: 50)`
|
|
18
|
+
* email: String!
|
|
19
|
+
* role: UserRole!
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* ```typescript
|
|
24
|
+
* // generated/zod/validators.typegen.ts
|
|
25
|
+
* import { z } from "zod";
|
|
26
|
+
*
|
|
27
|
+
* export const UserRoleSchema = z.enum(["ADMIN", "USER"]);
|
|
28
|
+
*
|
|
29
|
+
* export const UserSchema = z.object({
|
|
30
|
+
* id: z.string(),
|
|
31
|
+
* name: z.string().min(3).max(50),
|
|
32
|
+
* email: z.string(),
|
|
33
|
+
* role: UserRoleSchema,
|
|
34
|
+
* });
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare class ZodSchemaGeneratorPlugin extends TransformerPluginBase {
|
|
38
|
+
private nodes;
|
|
39
|
+
private options;
|
|
40
|
+
constructor(context: ITransformerContext, options?: ZodSchemaGeneratorPluginOptions);
|
|
41
|
+
private _getContent;
|
|
42
|
+
private _zCall;
|
|
43
|
+
private _chainCall;
|
|
44
|
+
private _parseZodExpression;
|
|
45
|
+
private _createScalarZodExpression;
|
|
46
|
+
private _applyConstraints;
|
|
47
|
+
private _applyNullable;
|
|
48
|
+
private _createOutputFieldZodExpression;
|
|
49
|
+
private _createInputFieldZodExpression;
|
|
50
|
+
private _createObjectFieldProperties;
|
|
51
|
+
private _createInputFieldProperties;
|
|
52
|
+
private _createSchemaConstDeclaration;
|
|
53
|
+
private _getSelfReferenceFields;
|
|
54
|
+
private _generateEnum;
|
|
55
|
+
private _generateObject;
|
|
56
|
+
private _generateInputObject;
|
|
57
|
+
private _generateUnion;
|
|
58
|
+
before(): void;
|
|
59
|
+
match(definition: DefinitionNode): boolean;
|
|
60
|
+
generate(definition: DefinitionNode): void;
|
|
61
|
+
output(): {
|
|
62
|
+
zodSchemas: string;
|
|
63
|
+
} | {
|
|
64
|
+
zodSchemas?: undefined;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export declare const zodSchemaGeneratorPlugin: (options?: ZodSchemaGeneratorPluginOptions | undefined) => import("@gqlbase/core").IPluginFactory;
|
|
68
|
+
//# sourceMappingURL=ZodSchemaGeneratorPlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZodSchemaGeneratorPlugin.d.ts","sourceRoot":"","sources":["../../../src/zod/ZodSchemaGeneratorPlugin/ZodSchemaGeneratorPlugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAuB,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAIhG,OAAO,EACL,cAAc,EAoBf,MAAM,0BAA0B,CAAC;AAWlC,OAAO,EAGL,+BAA+B,EAChC,MAAM,qCAAqC,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,qBAAa,wBAAyB,SAAQ,qBAAqB;IACjE,OAAO,CAAC,KAAK,CAAiB;IAC9B,OAAO,CAAC,OAAO,CAA4C;gBAE/C,OAAO,EAAE,mBAAmB,EAAE,OAAO,GAAE,+BAAoC;IAKvF,OAAO,CAAC,WAAW;IAiBnB,OAAO,CAAC,MAAM;IAWd,OAAO,CAAC,UAAU;IAYlB,OAAO,CAAC,mBAAmB;IAY3B,OAAO,CAAC,0BAA0B;IA2ClC,OAAO,CAAC,iBAAiB;IA0BzB,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,+BAA+B;IA+BvC,OAAO,CAAC,8BAA8B;IAoCtC,OAAO,CAAC,4BAA4B;IAyBpC,OAAO,CAAC,2BAA2B;IAsBnC,OAAO,CAAC,6BAA6B;IAsBrC,OAAO,CAAC,uBAAuB;IAY/B,OAAO,CAAC,aAAa;IAerB,OAAO,CAAC,eAAe;IAUvB,OAAO,CAAC,oBAAoB;IA6C5B,OAAO,CAAC,cAAc;IAiBf,MAAM;IAoBN,KAAK,CAAC,UAAU,EAAE,cAAc,GAAG,OAAO;IAS1C,QAAQ,CAAC,UAAU,EAAE,cAAc;IAsBnC,MAAM;;;;;CAYd;AAED,eAAO,MAAM,wBAAwB,mGAAgD,CAAC"}
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import { createPluginFactory, TransformerPluginBase } from "@gqlbase/core";
|
|
3
|
+
import { isBuildInScalar } from "@gqlbase/shared/definition";
|
|
4
|
+
import { createFileHeaders } from "@gqlbase/shared/codegen";
|
|
5
|
+
import { getTypeHint, isInternal } from "@gqlbase/core/plugins";
|
|
6
|
+
import { InputObjectNode, isDirectiveDefinitionNode, isEnumNode, isInputObjectNode, isInterfaceNode, isNullableTypeNode, isObjectNode, isOperationNode, isScalarNode, isUnionNode, ListTypeNode, NonNullTypeNode, } from "@gqlbase/core/definition";
|
|
7
|
+
import { TransformerPluginExecutionError } from "@gqlbase/shared/errors";
|
|
8
|
+
import { isBaseScalar } from "../../base/ScalarsPlugin/ScalarsPlugin.utils.js";
|
|
9
|
+
import { hasConstraints, parseConstraints, isServerOnly, isWriteOnly, } from "../../base/UtilitiesPlugin/index.js";
|
|
10
|
+
import { isSemanticNullable } from "../../base/RfcFeaturesPlugin/index.js";
|
|
11
|
+
import { isRelationField } from "../../base/RelationsPlugin/index.js";
|
|
12
|
+
import { CUSTOM_SCALAR_ZOD_MAP, mergeOptions, } from "./ZodSchemaGeneratorPlugin.utils.js";
|
|
13
|
+
/**
|
|
14
|
+
* Generates Zod schemas for the defined types in the GraphQL schema. This can be used for runtime validation of data against the schema.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```graphql
|
|
18
|
+
* # schema.graphql
|
|
19
|
+
* enum UserRole {
|
|
20
|
+
* ADMIN
|
|
21
|
+
* USER
|
|
22
|
+
* }
|
|
23
|
+
*
|
|
24
|
+
* type User {
|
|
25
|
+
* id: ID!
|
|
26
|
+
* name: String! `@constraint(min: 3, max: 50)`
|
|
27
|
+
* email: String!
|
|
28
|
+
* role: UserRole!
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* ```typescript
|
|
33
|
+
* // generated/zod/validators.typegen.ts
|
|
34
|
+
* import { z } from "zod";
|
|
35
|
+
*
|
|
36
|
+
* export const UserRoleSchema = z.enum(["ADMIN", "USER"]);
|
|
37
|
+
*
|
|
38
|
+
* export const UserSchema = z.object({
|
|
39
|
+
* id: z.string(),
|
|
40
|
+
* name: z.string().min(3).max(50),
|
|
41
|
+
* email: z.string(),
|
|
42
|
+
* role: UserRoleSchema,
|
|
43
|
+
* });
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export class ZodSchemaGeneratorPlugin extends TransformerPluginBase {
|
|
47
|
+
nodes = [];
|
|
48
|
+
options;
|
|
49
|
+
constructor(context, options = {}) {
|
|
50
|
+
super("ZodSchemaGeneratorPlugin", context);
|
|
51
|
+
this.options = mergeOptions(options);
|
|
52
|
+
}
|
|
53
|
+
_getContent() {
|
|
54
|
+
const file = ts.createSourceFile(this.options.fileName,
|
|
55
|
+
/*sourceText*/ "", ts.ScriptTarget.Latest,
|
|
56
|
+
/*setParentNodes*/ false, ts.ScriptKind.TS);
|
|
57
|
+
const printer = ts.createPrinter({
|
|
58
|
+
newLine: ts.NewLineKind.CarriageReturnLineFeed,
|
|
59
|
+
removeComments: false,
|
|
60
|
+
});
|
|
61
|
+
return printer.printList(ts.ListFormat.MultiLine, ts.factory.createNodeArray(this.nodes), file);
|
|
62
|
+
}
|
|
63
|
+
_zCall(name, args = []) {
|
|
64
|
+
return ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier("z"), ts.factory.createIdentifier(name)), undefined, args);
|
|
65
|
+
}
|
|
66
|
+
_chainCall(expr, method, args = []) {
|
|
67
|
+
return ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(expr, ts.factory.createIdentifier(method)), undefined, args);
|
|
68
|
+
}
|
|
69
|
+
_parseZodExpression(zodCode) {
|
|
70
|
+
const sourceFile = ts.createSourceFile("temp.ts", zodCode, ts.ScriptTarget.Latest, false);
|
|
71
|
+
const statement = sourceFile.statements[0];
|
|
72
|
+
if (ts.isExpressionStatement(statement)) {
|
|
73
|
+
return statement.expression;
|
|
74
|
+
}
|
|
75
|
+
throw new TransformerPluginExecutionError(this.name, `Failed to parse Zod expression: ${zodCode}`);
|
|
76
|
+
}
|
|
77
|
+
_createScalarZodExpression(typeName, suffix = "Schema") {
|
|
78
|
+
if (isBuildInScalar(typeName)) {
|
|
79
|
+
switch (typeName) {
|
|
80
|
+
case "ID":
|
|
81
|
+
case "String":
|
|
82
|
+
return this._zCall("string");
|
|
83
|
+
case "Int":
|
|
84
|
+
return this._zCall("int");
|
|
85
|
+
case "Float":
|
|
86
|
+
return this._zCall("number");
|
|
87
|
+
case "Boolean":
|
|
88
|
+
return this._zCall("boolean");
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (isBaseScalar(typeName)) {
|
|
92
|
+
const zodCode = CUSTOM_SCALAR_ZOD_MAP[typeName];
|
|
93
|
+
return this._parseZodExpression(zodCode);
|
|
94
|
+
}
|
|
95
|
+
const typeDef = this.context.document.getNodeOrThrow(typeName);
|
|
96
|
+
if (isScalarNode(typeDef)) {
|
|
97
|
+
const hint = getTypeHint(typeDef);
|
|
98
|
+
switch (hint) {
|
|
99
|
+
case "id":
|
|
100
|
+
case "string":
|
|
101
|
+
return this._zCall("string");
|
|
102
|
+
case "number":
|
|
103
|
+
return this._zCall("number");
|
|
104
|
+
case "boolean":
|
|
105
|
+
return this._zCall("boolean");
|
|
106
|
+
case "object":
|
|
107
|
+
return this._parseZodExpression("z.record(z.string(), z.unknown())");
|
|
108
|
+
case "unknown":
|
|
109
|
+
default:
|
|
110
|
+
return this._zCall("unknown");
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return ts.factory.createIdentifier(`${typeName}${suffix}`);
|
|
114
|
+
}
|
|
115
|
+
_applyConstraints(expr, field) {
|
|
116
|
+
if (!hasConstraints(field)) {
|
|
117
|
+
return expr;
|
|
118
|
+
}
|
|
119
|
+
const constraints = parseConstraints(field);
|
|
120
|
+
let result = expr;
|
|
121
|
+
if (constraints.min !== undefined) {
|
|
122
|
+
result = this._chainCall(result, "min", [ts.factory.createNumericLiteral(constraints.min)]);
|
|
123
|
+
}
|
|
124
|
+
if (constraints.max !== undefined) {
|
|
125
|
+
result = this._chainCall(result, "max", [ts.factory.createNumericLiteral(constraints.max)]);
|
|
126
|
+
}
|
|
127
|
+
if (constraints.pattern !== undefined) {
|
|
128
|
+
result = this._chainCall(result, "regex", [
|
|
129
|
+
ts.factory.createRegularExpressionLiteral(`/${constraints.pattern}/`),
|
|
130
|
+
]);
|
|
131
|
+
}
|
|
132
|
+
return result;
|
|
133
|
+
}
|
|
134
|
+
_applyNullable(expr, level) {
|
|
135
|
+
const nullable = this._chainCall(expr, "nullable");
|
|
136
|
+
return level === 0 ? this._chainCall(nullable, "optional") : nullable;
|
|
137
|
+
}
|
|
138
|
+
_createOutputFieldZodExpression(field, fieldType, level = 0) {
|
|
139
|
+
if (fieldType instanceof NonNullTypeNode) {
|
|
140
|
+
return this._createOutputFieldZodExpression(field, fieldType.type, level);
|
|
141
|
+
}
|
|
142
|
+
if (fieldType instanceof ListTypeNode) {
|
|
143
|
+
const elementExpr = this._createOutputFieldZodExpression(field, fieldType.type, level + 1);
|
|
144
|
+
let arrayExpr = this._zCall("array", [elementExpr]);
|
|
145
|
+
if (isSemanticNullable(field, level)) {
|
|
146
|
+
arrayExpr = this._applyNullable(arrayExpr, level);
|
|
147
|
+
}
|
|
148
|
+
return arrayExpr;
|
|
149
|
+
}
|
|
150
|
+
// Named type (leaf)
|
|
151
|
+
let expr = this._createScalarZodExpression(fieldType.name);
|
|
152
|
+
expr = this._applyConstraints(expr, field);
|
|
153
|
+
if (isSemanticNullable(field, level)) {
|
|
154
|
+
expr = this._applyNullable(expr, level);
|
|
155
|
+
}
|
|
156
|
+
return expr;
|
|
157
|
+
}
|
|
158
|
+
_createInputFieldZodExpression(field, fieldType, level = 0, suffix = "Schema") {
|
|
159
|
+
if (fieldType instanceof NonNullTypeNode) {
|
|
160
|
+
return this._createInputFieldZodExpression(field, fieldType.type, level, suffix);
|
|
161
|
+
}
|
|
162
|
+
if (fieldType instanceof ListTypeNode) {
|
|
163
|
+
const elementExpr = this._createInputFieldZodExpression(field, fieldType.type, level + 1, suffix);
|
|
164
|
+
let arrayExpr = this._zCall("array", [elementExpr]);
|
|
165
|
+
if (isNullableTypeNode(field.type, level)) {
|
|
166
|
+
arrayExpr = this._applyNullable(arrayExpr, level);
|
|
167
|
+
}
|
|
168
|
+
return arrayExpr;
|
|
169
|
+
}
|
|
170
|
+
let expr = this._createScalarZodExpression(fieldType.name, suffix);
|
|
171
|
+
expr = this._applyConstraints(expr, field);
|
|
172
|
+
if (isNullableTypeNode(field.type, level)) {
|
|
173
|
+
expr = this._applyNullable(expr, level);
|
|
174
|
+
}
|
|
175
|
+
return expr;
|
|
176
|
+
}
|
|
177
|
+
_createObjectFieldProperties(definition) {
|
|
178
|
+
const properties = [];
|
|
179
|
+
for (const field of definition.fields ?? []) {
|
|
180
|
+
if (isInternal(field) ||
|
|
181
|
+
isWriteOnly(field) ||
|
|
182
|
+
isServerOnly(field) ||
|
|
183
|
+
isRelationField(field)) {
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
const zodExpr = this._createOutputFieldZodExpression(field, field.type);
|
|
187
|
+
properties.push(ts.factory.createPropertyAssignment(ts.factory.createIdentifier(field.name), zodExpr));
|
|
188
|
+
}
|
|
189
|
+
return properties;
|
|
190
|
+
}
|
|
191
|
+
_createInputFieldProperties(definition, excludes = [], suffix = "Schema") {
|
|
192
|
+
const properties = [];
|
|
193
|
+
for (const field of definition.fields ?? []) {
|
|
194
|
+
if (excludes.includes(field.name)) {
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
const zodExpr = this._createInputFieldZodExpression(field, field.type, 0, suffix);
|
|
198
|
+
properties.push(ts.factory.createPropertyAssignment(ts.factory.createIdentifier(field.name), zodExpr));
|
|
199
|
+
}
|
|
200
|
+
return properties;
|
|
201
|
+
}
|
|
202
|
+
_createSchemaConstDeclaration(name, initializer, suffix = "Schema", exported = true) {
|
|
203
|
+
return ts.factory.createVariableStatement(exported ? [ts.factory.createModifier(ts.SyntaxKind.ExportKeyword)] : undefined, ts.factory.createVariableDeclarationList([
|
|
204
|
+
ts.factory.createVariableDeclaration(ts.factory.createIdentifier(`${name}${suffix}`), undefined, undefined, initializer),
|
|
205
|
+
], ts.NodeFlags.Const));
|
|
206
|
+
}
|
|
207
|
+
_getSelfReferenceFields(definition) {
|
|
208
|
+
const selfRefs = [];
|
|
209
|
+
for (const field of definition.fields ?? []) {
|
|
210
|
+
if (field.type.getTypeName() === definition.name) {
|
|
211
|
+
selfRefs.push(field);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return selfRefs;
|
|
215
|
+
}
|
|
216
|
+
_generateEnum(definition) {
|
|
217
|
+
if (!definition.values?.length) {
|
|
218
|
+
throw new TransformerPluginExecutionError(this.name, `Enum type ${definition.name} must have at least one value.`);
|
|
219
|
+
}
|
|
220
|
+
const args = definition.values.map((v) => ts.factory.createStringLiteral(v.name));
|
|
221
|
+
const initializer = this._zCall("enum", [ts.factory.createArrayLiteralExpression(args)]);
|
|
222
|
+
this.nodes.push(this._createSchemaConstDeclaration(definition.name, initializer));
|
|
223
|
+
}
|
|
224
|
+
_generateObject(definition) {
|
|
225
|
+
const properties = this._createObjectFieldProperties(definition);
|
|
226
|
+
const initializer = this._zCall("object", [
|
|
227
|
+
ts.factory.createObjectLiteralExpression(properties, true),
|
|
228
|
+
]);
|
|
229
|
+
this.nodes.push(this._createSchemaConstDeclaration(definition.name, initializer));
|
|
230
|
+
}
|
|
231
|
+
_generateInputObject(definition) {
|
|
232
|
+
const selfRefs = this._getSelfReferenceFields(definition);
|
|
233
|
+
if (selfRefs.length > 0) {
|
|
234
|
+
const properties = this._createInputFieldProperties(definition, selfRefs.map((f) => f.name));
|
|
235
|
+
const base = this._zCall("object", [
|
|
236
|
+
ts.factory.createObjectLiteralExpression(properties, true),
|
|
237
|
+
]);
|
|
238
|
+
const extension = InputObjectNode.create(definition.name, undefined, undefined, selfRefs);
|
|
239
|
+
const initializer = ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier(`${definition.name}Base`), ts.factory.createIdentifier("extend")), undefined, [
|
|
240
|
+
ts.factory.createObjectLiteralExpression(this._createInputFieldProperties(extension, undefined, "Base"), true),
|
|
241
|
+
]);
|
|
242
|
+
this.nodes.push(this._createSchemaConstDeclaration(definition.name, base, "Base", false), this._createSchemaConstDeclaration(definition.name, initializer));
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
const properties = this._createInputFieldProperties(definition);
|
|
246
|
+
const initializer = this._zCall("object", [
|
|
247
|
+
ts.factory.createObjectLiteralExpression(properties, true),
|
|
248
|
+
]);
|
|
249
|
+
this.nodes.push(this._createSchemaConstDeclaration(definition.name, initializer));
|
|
250
|
+
}
|
|
251
|
+
_generateUnion(definition) {
|
|
252
|
+
if (!definition.types?.length) {
|
|
253
|
+
throw new TransformerPluginExecutionError(this.name, `Union type ${definition.name} must have at least one member type.`);
|
|
254
|
+
}
|
|
255
|
+
const memberRefs = definition.types.map((type) => ts.factory.createIdentifier(`${type.name}Schema`));
|
|
256
|
+
const initializer = this._zCall("union", [ts.factory.createArrayLiteralExpression(memberRefs)]);
|
|
257
|
+
this.nodes.push(this._createSchemaConstDeclaration(definition.name, initializer));
|
|
258
|
+
}
|
|
259
|
+
before() {
|
|
260
|
+
const headers = createFileHeaders();
|
|
261
|
+
this.nodes = [...headers];
|
|
262
|
+
// import * as z from "zod/v4";
|
|
263
|
+
this.nodes.push(ts.factory.createImportDeclaration(undefined, ts.factory.createImportClause(undefined, undefined, ts.factory.createNamespaceImport(ts.factory.createIdentifier("z"))), ts.factory.createStringLiteral("zod/v4"), undefined), ts.factory.createIdentifier("\n"));
|
|
264
|
+
}
|
|
265
|
+
match(definition) {
|
|
266
|
+
return (!isOperationNode(definition) &&
|
|
267
|
+
!isInternal(definition) &&
|
|
268
|
+
!isScalarNode(definition) &&
|
|
269
|
+
!isDirectiveDefinitionNode(definition));
|
|
270
|
+
}
|
|
271
|
+
generate(definition) {
|
|
272
|
+
if (isEnumNode(definition)) {
|
|
273
|
+
return this._generateEnum(definition);
|
|
274
|
+
}
|
|
275
|
+
if (isObjectNode(definition)) {
|
|
276
|
+
return this._generateObject(definition);
|
|
277
|
+
}
|
|
278
|
+
if (isInterfaceNode(definition)) {
|
|
279
|
+
return this._generateObject(definition);
|
|
280
|
+
}
|
|
281
|
+
if (isInputObjectNode(definition)) {
|
|
282
|
+
return this._generateInputObject(definition);
|
|
283
|
+
}
|
|
284
|
+
if (isUnionNode(definition)) {
|
|
285
|
+
return this._generateUnion(definition);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
output() {
|
|
289
|
+
const content = this._getContent();
|
|
290
|
+
this.context.files.push({
|
|
291
|
+
type: "ts",
|
|
292
|
+
path: `zod/${this.options.fileName}`,
|
|
293
|
+
filename: this.options.fileName,
|
|
294
|
+
content,
|
|
295
|
+
});
|
|
296
|
+
return this.options.emitOutput ? { zodSchemas: content } : {};
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
export const zodSchemaGeneratorPlugin = createPluginFactory(ZodSchemaGeneratorPlugin);
|
|
300
|
+
//# sourceMappingURL=ZodSchemaGeneratorPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZodSch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AAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QACxC,CAAC;QAED,IAAI,YAAY,CAAC,UAAU,CAAC,EAAE,CAAC;YAC7B,OAAO,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;QAC1C,CAAC;QAED,IAAI,eAAe,CAAC,UAAU,CAAC,EAAE,CAAC;YAChC,OAAO,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;QAC1C,CAAC;QAED,IAAI,iBAAiB,CAAC,UAAU,CAAC,EAAE,CAAC;YAClC,OAAO,IAAI,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC;QAC/C,CAAC;QAED,IAAI,WAAW,CAAC,UAAU,CAAC,EAAE,CAAC;YAC5B,OAAO,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;QACzC,CAAC;IACH,CAAC;IAEM,MAAM;QACX,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QAEnC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC;YACtB,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;YACpC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ;YAC/B,OAAO;SACR,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAChE,CAAC;CACF;AAED,MAAM,CAAC,MAAM,wBAAwB,GAAG,mBAAmB,CAAC,wBAAwB,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type BaseScalarName } from "../../base/ScalarsPlugin/ScalarsPlugin.utils.js";
|
|
2
|
+
export interface ZodSchemaGeneratorPluginOptions {
|
|
3
|
+
/**
|
|
4
|
+
* The output file name for the generated schemas.
|
|
5
|
+
* @default "validators.typegen.ts"
|
|
6
|
+
*/
|
|
7
|
+
fileName?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Whether to include the generated schemas in the output object.
|
|
10
|
+
* @default false
|
|
11
|
+
*/
|
|
12
|
+
emitOutput?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare const DEFAULT_OPTIONS: Required<ZodSchemaGeneratorPluginOptions>;
|
|
15
|
+
export declare const mergeOptions: (options?: ZodSchemaGeneratorPluginOptions) => Required<ZodSchemaGeneratorPluginOptions>;
|
|
16
|
+
export declare const CUSTOM_SCALAR_ZOD_MAP: Record<BaseScalarName, string>;
|
|
17
|
+
//# sourceMappingURL=ZodSchemaGeneratorPlugin.utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZodSchemaGeneratorPlugin.utils.d.ts","sourceRoot":"","sources":["../../../src/zod/ZodSchemaGeneratorPlugin/ZodSchemaGeneratorPlugin.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,iDAAiD,CAAC;AAElG,MAAM,WAAW,+BAA+B;IAC9C;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,+BAA+B,CAG5D,CAAC;AAEX,eAAO,MAAM,YAAY,GACvB,UAAU,+BAA+B,KACxC,QAAQ,CAAC,+BAA+B,CAK1C,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,cAAc,EAAE,MAAM,CAWhE,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BaseScalar } from "../../base/ScalarsPlugin/ScalarsPlugin.utils.js";
|
|
2
|
+
export const DEFAULT_OPTIONS = {
|
|
3
|
+
fileName: "validators.typegen.ts",
|
|
4
|
+
emitOutput: false,
|
|
5
|
+
};
|
|
6
|
+
export const mergeOptions = (options) => {
|
|
7
|
+
return {
|
|
8
|
+
...DEFAULT_OPTIONS,
|
|
9
|
+
...options,
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export const CUSTOM_SCALAR_ZOD_MAP = {
|
|
13
|
+
[BaseScalar.DATE_TIME]: "z.iso.datetime()",
|
|
14
|
+
[BaseScalar.DATE]: "z.iso.date()",
|
|
15
|
+
[BaseScalar.TIME]: "z.iso.time()",
|
|
16
|
+
[BaseScalar.TIMESTAMP]: "z.number()",
|
|
17
|
+
[BaseScalar.UUID]: "z.uuid()",
|
|
18
|
+
[BaseScalar.URL]: "z.url()",
|
|
19
|
+
[BaseScalar.EMAIL_ADDRESS]: "z.email()",
|
|
20
|
+
[BaseScalar.PHONE_NUMBER]: "z.e164()",
|
|
21
|
+
[BaseScalar.IP_ADDRESS]: "z.ip()",
|
|
22
|
+
[BaseScalar.JSON]: "z.record(z.string(), z.unknown())",
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=ZodSchemaGeneratorPlugin.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZodSchemaGeneratorPlugin.utils.js","sourceRoot":"","sources":["../../../src/zod/ZodSchemaGeneratorPlugin/ZodSchemaGeneratorPlugin.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAuB,MAAM,iDAAiD,CAAC;AAgBlG,MAAM,CAAC,MAAM,eAAe,GAA8C;IACxE,QAAQ,EAAE,uBAAuB;IACjC,UAAU,EAAE,KAAK;CACT,CAAC;AAEX,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,OAAyC,EACE,EAAE;IAC7C,OAAO;QACL,GAAG,eAAe;QAClB,GAAG,OAAO;KACX,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAmC;IACnE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,kBAAkB;IAC1C,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,cAAc;IACjC,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,cAAc;IACjC,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,YAAY;IACpC,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,UAAU;IAC7B,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,SAAS;IAC3B,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,WAAW;IACvC,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,UAAU;IACrC,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,QAAQ;IACjC,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,mCAAmC;CACvD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/zod/ZodSchemaGeneratorPlugin/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,+BAA+B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/zod/ZodSchemaGeneratorPlugin/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,+BAA+B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/zod/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,wDAAwD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/zod/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,wDAAwD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gqlbase/plugins",
|
|
3
3
|
"description": "Collection of plugins and presets for gqlbase, providing common transformations and utilities that can be used in GraphQL schema transformation processes.",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.4",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|
|
@@ -46,19 +46,10 @@
|
|
|
46
46
|
"test": "vitest run"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@gqlbase/core": "^0.1.
|
|
50
|
-
"@gqlbase/shared": "^0.1.
|
|
51
|
-
},
|
|
52
|
-
"devDependencies": {
|
|
53
|
-
"@middy-appsync/graphql": "^0.1.1"
|
|
49
|
+
"@gqlbase/core": "^0.1.4",
|
|
50
|
+
"@gqlbase/shared": "^0.1.4"
|
|
54
51
|
},
|
|
55
52
|
"peerDependencies": {
|
|
56
|
-
"
|
|
57
|
-
"graphql": "^16.13.2"
|
|
58
|
-
},
|
|
59
|
-
"peerDependenciesMeta": {
|
|
60
|
-
"@middy-appsync/graphql": {
|
|
61
|
-
"optional": true
|
|
62
|
-
}
|
|
53
|
+
"typescript": "^5 || ^6"
|
|
63
54
|
}
|
|
64
55
|
}
|