@zenstackhq/sdk 3.0.0-beta.2 → 3.0.0-beta.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +119 -575
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -69
- package/dist/index.d.ts +11 -69
- package/dist/index.js +126 -581
- package/dist/index.js.map +1 -1
- package/package.json +6 -16
- package/dist/schema.cjs +0 -19
- package/dist/schema.cjs.map +0 -1
- package/dist/schema.d.cts +0 -165
- package/dist/schema.d.ts +0 -165
- package/dist/schema.js +0 -1
- package/dist/schema.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -20,7 +20,7 @@ __export(model_utils_exports, {
|
|
|
20
20
|
isUniqueField: () => isUniqueField,
|
|
21
21
|
resolved: () => resolved
|
|
22
22
|
});
|
|
23
|
-
import { isDataModel, isLiteralExpr, isModel } from "@zenstackhq/language/ast";
|
|
23
|
+
import { isDataModel, isLiteralExpr, isModel, isTypeDef } from "@zenstackhq/language/ast";
|
|
24
24
|
import { getAllFields, getModelIdFields, getModelUniqueFields } from "@zenstackhq/language/utils";
|
|
25
25
|
function isIdField(field, contextModel) {
|
|
26
26
|
if (hasAttribute(field, "@id")) {
|
|
@@ -88,7 +88,7 @@ function resolved(ref) {
|
|
|
88
88
|
}
|
|
89
89
|
__name(resolved, "resolved");
|
|
90
90
|
function getAuthDecl(model) {
|
|
91
|
-
let found = model.declarations.find((d) => isDataModel(d) && d.attributes.some((attr) => attr.decl.$refText === "@@auth"));
|
|
91
|
+
let found = model.declarations.find((d) => (isDataModel(d) || isTypeDef(d)) && d.attributes.some((attr) => attr.decl.$refText === "@@auth"));
|
|
92
92
|
if (!found) {
|
|
93
93
|
found = model.declarations.find((d) => isDataModel(d) && d.name === "User");
|
|
94
94
|
}
|
|
@@ -103,8 +103,9 @@ var DELEGATE_AUX_RELATION_PREFIX = "delegate_aux";
|
|
|
103
103
|
|
|
104
104
|
// src/prisma/prisma-schema-generator.ts
|
|
105
105
|
import { lowerCaseFirst } from "@zenstackhq/common-helpers";
|
|
106
|
-
import {
|
|
107
|
-
import {
|
|
106
|
+
import { ZModelCodeGenerator } from "@zenstackhq/language";
|
|
107
|
+
import { BooleanLiteral, DataModel, DataSource as DataSource2, Enum as Enum2, GeneratorDecl, isArrayExpr, isDataModel as isDataModel2, isInvocationExpr, isLiteralExpr as isLiteralExpr2, isNullExpr, isReferenceExpr, isStringLiteral, isTypeDef as isTypeDef2, NumberLiteral, StringLiteral } from "@zenstackhq/language/ast";
|
|
108
|
+
import { getAllAttributes, getAllFields as getAllFields2, isAuthInvocation, isDelegateModel as isDelegateModel2 } from "@zenstackhq/language/utils";
|
|
108
109
|
import { AstUtils } from "langium";
|
|
109
110
|
import { match } from "ts-pattern";
|
|
110
111
|
|
|
@@ -586,13 +587,20 @@ var PrismaSchemaGenerator = class {
|
|
|
586
587
|
}
|
|
587
588
|
}
|
|
588
589
|
const allAttributes = getAllAttributes(decl);
|
|
589
|
-
for (const attr of allAttributes.filter((attr2) => this.isPrismaAttribute(attr2))) {
|
|
590
|
+
for (const attr of allAttributes.filter((attr2) => this.isPrismaAttribute(attr2) && !this.isInheritedMapAttribute(attr2, decl))) {
|
|
590
591
|
this.generateContainerAttribute(model, attr);
|
|
591
592
|
}
|
|
592
593
|
decl.comments.forEach((c) => model.addComment(c));
|
|
593
594
|
this.generateDelegateRelationForBase(model, decl);
|
|
594
595
|
this.generateDelegateRelationForConcrete(model, decl);
|
|
595
596
|
}
|
|
597
|
+
isInheritedMapAttribute(attr, contextModel) {
|
|
598
|
+
if (attr.$container === contextModel) {
|
|
599
|
+
return false;
|
|
600
|
+
}
|
|
601
|
+
const attrName = attr.decl.ref?.name ?? attr.decl.$refText;
|
|
602
|
+
return attrName === "@@map";
|
|
603
|
+
}
|
|
596
604
|
isPrismaAttribute(attr) {
|
|
597
605
|
if (!attr.decl.ref) {
|
|
598
606
|
return false;
|
|
@@ -619,7 +627,7 @@ var PrismaSchemaGenerator = class {
|
|
|
619
627
|
if (field.type.type) {
|
|
620
628
|
fieldType = field.type.type;
|
|
621
629
|
} else if (field.type.reference?.ref) {
|
|
622
|
-
if (
|
|
630
|
+
if (isTypeDef2(field.type.reference.ref)) {
|
|
623
631
|
fieldType = "Json";
|
|
624
632
|
} else {
|
|
625
633
|
fieldType = field.type.reference.ref.name;
|
|
@@ -635,10 +643,10 @@ var PrismaSchemaGenerator = class {
|
|
|
635
643
|
}
|
|
636
644
|
const isArray = (
|
|
637
645
|
// typed-JSON fields should be translated to scalar Json type
|
|
638
|
-
|
|
646
|
+
isTypeDef2(field.type.reference?.ref) ? false : field.type.array
|
|
639
647
|
);
|
|
640
648
|
const type = new ModelFieldType(fieldType, isArray, field.type.optional);
|
|
641
|
-
const attributes = field.attributes.filter((attr) => this.isPrismaAttribute(attr)).filter((attr) => !this.
|
|
649
|
+
const attributes = field.attributes.filter((attr) => this.isPrismaAttribute(attr)).filter((attr) => !this.isDefaultWithAuthInvocation(attr)).filter((attr) => (
|
|
642
650
|
// when building physical schema, exclude `@default` for id fields inherited from delegate base
|
|
643
651
|
!(model_utils_exports.isIdField(field, contextModel) && this.isInheritedFromDelegate(field, contextModel) && attr.decl.$refText === "@default")
|
|
644
652
|
)).map((attr) => this.makeFieldAttribute(attr));
|
|
@@ -648,7 +656,7 @@ var PrismaSchemaGenerator = class {
|
|
|
648
656
|
const result = model.addField(field.name, type, attributes, docs, addToFront);
|
|
649
657
|
return result;
|
|
650
658
|
}
|
|
651
|
-
|
|
659
|
+
isDefaultWithAuthInvocation(attr) {
|
|
652
660
|
if (attr.decl.ref?.name !== "@default") {
|
|
653
661
|
return false;
|
|
654
662
|
}
|
|
@@ -656,11 +664,7 @@ var PrismaSchemaGenerator = class {
|
|
|
656
664
|
if (!expr) {
|
|
657
665
|
return false;
|
|
658
666
|
}
|
|
659
|
-
return AstUtils.streamAst(expr).some(
|
|
660
|
-
}
|
|
661
|
-
isFromPlugin(node) {
|
|
662
|
-
const model = AstUtils.getContainerOfType(node, isModel2);
|
|
663
|
-
return !!model && !!model.$document && model.$document.uri.path.endsWith("plugin.zmodel");
|
|
667
|
+
return AstUtils.streamAst(expr).some(isAuthInvocation);
|
|
664
668
|
}
|
|
665
669
|
isInheritedFromDelegate(field, contextModel) {
|
|
666
670
|
return field.$container !== contextModel && model_utils_exports.isDelegateModel(field.$container);
|
|
@@ -778,7 +782,7 @@ var PrismaSchemaGenerator = class {
|
|
|
778
782
|
|
|
779
783
|
// src/ts-schema-generator.ts
|
|
780
784
|
import { invariant } from "@zenstackhq/common-helpers";
|
|
781
|
-
import { isArrayExpr as isArrayExpr2, isBinaryExpr, isDataField, isDataModel as isDataModel3, isDataSource, isEnum, isEnumField, isInvocationExpr as isInvocationExpr2, isLiteralExpr as isLiteralExpr3, isMemberAccessExpr, isNullExpr as isNullExpr2, isProcedure, isReferenceExpr as isReferenceExpr2, isThisExpr, isTypeDef as
|
|
785
|
+
import { isArrayExpr as isArrayExpr2, isBinaryExpr, isDataField, isDataModel as isDataModel3, isDataSource, isEnum, isEnumField, isInvocationExpr as isInvocationExpr2, isLiteralExpr as isLiteralExpr3, isMemberAccessExpr, isNullExpr as isNullExpr2, isProcedure, isReferenceExpr as isReferenceExpr2, isThisExpr, isTypeDef as isTypeDef3, isUnaryExpr } from "@zenstackhq/language/ast";
|
|
782
786
|
import { getAllAttributes as getAllAttributes2, getAllFields as getAllFields3, isDataFieldReference } from "@zenstackhq/language/utils";
|
|
783
787
|
import fs from "fs";
|
|
784
788
|
import path from "path";
|
|
@@ -788,38 +792,58 @@ var TsSchemaGenerator = class {
|
|
|
788
792
|
static {
|
|
789
793
|
__name(this, "TsSchemaGenerator");
|
|
790
794
|
}
|
|
791
|
-
|
|
792
|
-
|
|
795
|
+
usedExpressionUtils = false;
|
|
796
|
+
async generate(model, options) {
|
|
797
|
+
fs.mkdirSync(options.outDir, {
|
|
793
798
|
recursive: true
|
|
794
799
|
});
|
|
795
|
-
this.
|
|
796
|
-
this.
|
|
797
|
-
this.
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
800
|
+
this.usedExpressionUtils = false;
|
|
801
|
+
this.generateSchema(model, options);
|
|
802
|
+
this.generateModelsAndTypeDefs(model, options);
|
|
803
|
+
this.generateInputTypes(model, options);
|
|
804
|
+
}
|
|
805
|
+
generateSchema(model, options) {
|
|
806
|
+
const targets = [];
|
|
807
|
+
if (!options.liteOnly) {
|
|
808
|
+
targets.push({
|
|
809
|
+
lite: false,
|
|
810
|
+
file: "schema.ts"
|
|
811
|
+
});
|
|
812
|
+
}
|
|
813
|
+
if (options.lite || options.liteOnly) {
|
|
814
|
+
targets.push({
|
|
815
|
+
lite: true,
|
|
816
|
+
file: "schema-lite.ts"
|
|
817
|
+
});
|
|
818
|
+
}
|
|
819
|
+
for (const { lite, file } of targets) {
|
|
820
|
+
const statements = [];
|
|
821
|
+
this.generateSchemaStatements(model, statements, lite);
|
|
822
|
+
this.generateBannerComments(statements);
|
|
823
|
+
const schemaOutputFile = path.join(options.outDir, file);
|
|
824
|
+
const sourceFile = ts.createSourceFile(schemaOutputFile, "", ts.ScriptTarget.ESNext, false, ts.ScriptKind.TS);
|
|
825
|
+
const printer = ts.createPrinter();
|
|
826
|
+
const result = printer.printList(ts.ListFormat.MultiLine, ts.factory.createNodeArray(statements), sourceFile);
|
|
827
|
+
fs.writeFileSync(schemaOutputFile, result);
|
|
828
|
+
}
|
|
808
829
|
}
|
|
809
|
-
generateSchemaStatements(model, statements) {
|
|
830
|
+
generateSchemaStatements(model, statements, lite) {
|
|
810
831
|
const hasComputedFields = model.declarations.some((d) => isDataModel3(d) && d.fields.some((f) => hasAttribute(f, "@computed")));
|
|
832
|
+
const schemaObject = this.createSchemaObject(model, lite);
|
|
811
833
|
const runtimeImportDecl = ts.factory.createImportDeclaration(void 0, ts.factory.createImportClause(false, void 0, ts.factory.createNamedImports([
|
|
812
834
|
ts.factory.createImportSpecifier(true, void 0, ts.factory.createIdentifier("SchemaDef")),
|
|
813
835
|
...hasComputedFields ? [
|
|
814
836
|
ts.factory.createImportSpecifier(true, void 0, ts.factory.createIdentifier("OperandExpression"))
|
|
815
837
|
] : [],
|
|
816
|
-
|
|
817
|
-
|
|
838
|
+
...this.usedExpressionUtils ? [
|
|
839
|
+
ts.factory.createImportSpecifier(false, void 0, ts.factory.createIdentifier("ExpressionUtils"))
|
|
840
|
+
] : []
|
|
841
|
+
])), ts.factory.createStringLiteral("@zenstackhq/orm/schema"));
|
|
818
842
|
statements.push(runtimeImportDecl);
|
|
819
843
|
const declaration = ts.factory.createVariableStatement([
|
|
820
844
|
ts.factory.createModifier(ts.SyntaxKind.ExportKeyword)
|
|
821
845
|
], ts.factory.createVariableDeclarationList([
|
|
822
|
-
ts.factory.createVariableDeclaration("schema", void 0, void 0, ts.factory.createSatisfiesExpression(ts.factory.createAsExpression(
|
|
846
|
+
ts.factory.createVariableDeclaration("schema", void 0, void 0, ts.factory.createSatisfiesExpression(ts.factory.createAsExpression(schemaObject, ts.factory.createTypeReferenceNode("const")), ts.factory.createTypeReferenceNode("SchemaDef")))
|
|
823
847
|
], ts.NodeFlags.Const));
|
|
824
848
|
statements.push(declaration);
|
|
825
849
|
const typeDeclaration = ts.factory.createTypeAliasDeclaration([
|
|
@@ -827,15 +851,19 @@ var TsSchemaGenerator = class {
|
|
|
827
851
|
], "SchemaType", void 0, ts.factory.createTypeReferenceNode("typeof schema"));
|
|
828
852
|
statements.push(typeDeclaration);
|
|
829
853
|
}
|
|
830
|
-
|
|
854
|
+
createExpressionUtilsCall(method, args) {
|
|
855
|
+
this.usedExpressionUtils = true;
|
|
856
|
+
return ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier("ExpressionUtils"), method), void 0, args || []);
|
|
857
|
+
}
|
|
858
|
+
createSchemaObject(model, lite) {
|
|
831
859
|
const properties = [
|
|
832
860
|
// provider
|
|
833
861
|
ts.factory.createPropertyAssignment("provider", this.createProviderObject(model)),
|
|
834
862
|
// models
|
|
835
|
-
ts.factory.createPropertyAssignment("models", this.createModelsObject(model)),
|
|
863
|
+
ts.factory.createPropertyAssignment("models", this.createModelsObject(model, lite)),
|
|
836
864
|
// typeDefs
|
|
837
|
-
...model.declarations.some(
|
|
838
|
-
ts.factory.createPropertyAssignment("typeDefs", this.createTypeDefsObject(model))
|
|
865
|
+
...model.declarations.some(isTypeDef3) ? [
|
|
866
|
+
ts.factory.createPropertyAssignment("typeDefs", this.createTypeDefsObject(model, lite))
|
|
839
867
|
] : []
|
|
840
868
|
];
|
|
841
869
|
const enums = model.declarations.filter(isEnum);
|
|
@@ -859,15 +887,15 @@ var TsSchemaGenerator = class {
|
|
|
859
887
|
ts.factory.createPropertyAssignment("type", ts.factory.createStringLiteral(dsProvider.type))
|
|
860
888
|
], true);
|
|
861
889
|
}
|
|
862
|
-
createModelsObject(model) {
|
|
863
|
-
return ts.factory.createObjectLiteralExpression(model.declarations.filter((d) => isDataModel3(d) && !hasAttribute(d, "@@ignore")).map((dm) => ts.factory.createPropertyAssignment(dm.name, this.createDataModelObject(dm))), true);
|
|
890
|
+
createModelsObject(model, lite) {
|
|
891
|
+
return ts.factory.createObjectLiteralExpression(model.declarations.filter((d) => isDataModel3(d) && !hasAttribute(d, "@@ignore")).map((dm) => ts.factory.createPropertyAssignment(dm.name, this.createDataModelObject(dm, lite))), true);
|
|
864
892
|
}
|
|
865
|
-
createTypeDefsObject(model) {
|
|
866
|
-
return ts.factory.createObjectLiteralExpression(model.declarations.filter((d) =>
|
|
893
|
+
createTypeDefsObject(model, lite) {
|
|
894
|
+
return ts.factory.createObjectLiteralExpression(model.declarations.filter((d) => isTypeDef3(d)).map((td) => ts.factory.createPropertyAssignment(td.name, this.createTypeDefObject(td, lite))), true);
|
|
867
895
|
}
|
|
868
|
-
createDataModelObject(dm) {
|
|
896
|
+
createDataModelObject(dm, lite) {
|
|
869
897
|
const allFields = getAllFields3(dm);
|
|
870
|
-
const allAttributes = getAllAttributes2(dm).filter((attr) => {
|
|
898
|
+
const allAttributes = lite ? [] : getAllAttributes2(dm).filter((attr) => {
|
|
871
899
|
if (attr.decl.$refText === "@@delegate" && attr.$container !== dm) {
|
|
872
900
|
return false;
|
|
873
901
|
}
|
|
@@ -882,7 +910,7 @@ var TsSchemaGenerator = class {
|
|
|
882
910
|
ts.factory.createPropertyAssignment("baseModel", ts.factory.createStringLiteral(dm.baseModel.$refText))
|
|
883
911
|
] : [],
|
|
884
912
|
// fields
|
|
885
|
-
ts.factory.createPropertyAssignment("fields", ts.factory.createObjectLiteralExpression(allFields.map((field) => ts.factory.createPropertyAssignment(field.name, this.createDataFieldObject(field, dm))), true)),
|
|
913
|
+
ts.factory.createPropertyAssignment("fields", ts.factory.createObjectLiteralExpression(allFields.map((field) => ts.factory.createPropertyAssignment(field.name, this.createDataFieldObject(field, dm, lite))), true)),
|
|
886
914
|
// attributes
|
|
887
915
|
...allAttributes.length > 0 ? [
|
|
888
916
|
ts.factory.createPropertyAssignment("attributes", ts.factory.createArrayLiteralExpression(allAttributes.map((attr) => this.createAttributeObject(attr)), true))
|
|
@@ -898,6 +926,9 @@ var TsSchemaGenerator = class {
|
|
|
898
926
|
// subModels
|
|
899
927
|
...subModels.length > 0 ? [
|
|
900
928
|
ts.factory.createPropertyAssignment("subModels", ts.factory.createArrayLiteralExpression(subModels.map((subModel) => ts.factory.createStringLiteral(subModel))))
|
|
929
|
+
] : [],
|
|
930
|
+
...dm.isView ? [
|
|
931
|
+
ts.factory.createPropertyAssignment("isView", ts.factory.createTrue())
|
|
901
932
|
] : []
|
|
902
933
|
];
|
|
903
934
|
const computedFields = dm.fields.filter((f) => hasAttribute(f, "@computed"));
|
|
@@ -909,14 +940,14 @@ var TsSchemaGenerator = class {
|
|
|
909
940
|
getSubModels(dm) {
|
|
910
941
|
return dm.$container.declarations.filter(isDataModel3).filter((d) => d.baseModel?.ref === dm).map((d) => d.name);
|
|
911
942
|
}
|
|
912
|
-
createTypeDefObject(td) {
|
|
943
|
+
createTypeDefObject(td, lite) {
|
|
913
944
|
const allFields = getAllFields3(td);
|
|
914
945
|
const allAttributes = getAllAttributes2(td);
|
|
915
946
|
const fields = [
|
|
916
947
|
// name
|
|
917
948
|
ts.factory.createPropertyAssignment("name", ts.factory.createStringLiteral(td.name)),
|
|
918
949
|
// fields
|
|
919
|
-
ts.factory.createPropertyAssignment("fields", ts.factory.createObjectLiteralExpression(allFields.map((field) => ts.factory.createPropertyAssignment(field.name, this.createDataFieldObject(field, void 0))), true)),
|
|
950
|
+
ts.factory.createPropertyAssignment("fields", ts.factory.createObjectLiteralExpression(allFields.map((field) => ts.factory.createPropertyAssignment(field.name, this.createDataFieldObject(field, void 0, lite))), true)),
|
|
920
951
|
// attributes
|
|
921
952
|
...allAttributes.length > 0 ? [
|
|
922
953
|
ts.factory.createPropertyAssignment("attributes", ts.factory.createArrayLiteralExpression(allAttributes.map((attr) => this.createAttributeObject(attr)), true))
|
|
@@ -926,9 +957,9 @@ var TsSchemaGenerator = class {
|
|
|
926
957
|
}
|
|
927
958
|
createComputedFieldsObject(fields) {
|
|
928
959
|
return ts.factory.createObjectLiteralExpression(fields.map((field) => ts.factory.createMethodDeclaration(void 0, void 0, field.name, void 0, void 0, [
|
|
929
|
-
// parameter: `context: {
|
|
960
|
+
// parameter: `context: { modelAlias: string }`
|
|
930
961
|
ts.factory.createParameterDeclaration(void 0, void 0, "_context", void 0, ts.factory.createTypeLiteralNode([
|
|
931
|
-
ts.factory.createPropertySignature(void 0, "
|
|
962
|
+
ts.factory.createPropertySignature(void 0, "modelAlias", void 0, ts.factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword))
|
|
932
963
|
]), void 0)
|
|
933
964
|
], ts.factory.createTypeReferenceNode("OperandExpression", [
|
|
934
965
|
ts.factory.createTypeReferenceNode(this.mapFieldTypeToTSType(field.type))
|
|
@@ -948,7 +979,7 @@ var TsSchemaGenerator = class {
|
|
|
948
979
|
}
|
|
949
980
|
return result;
|
|
950
981
|
}
|
|
951
|
-
createDataFieldObject(field, contextModel) {
|
|
982
|
+
createDataFieldObject(field, contextModel, lite) {
|
|
952
983
|
const objectFields = [
|
|
953
984
|
// name
|
|
954
985
|
ts.factory.createPropertyAssignment("name", ts.factory.createStringLiteral(field.name)),
|
|
@@ -977,22 +1008,24 @@ var TsSchemaGenerator = class {
|
|
|
977
1008
|
if (this.isDiscriminatorField(field)) {
|
|
978
1009
|
objectFields.push(ts.factory.createPropertyAssignment("isDiscriminator", ts.factory.createTrue()));
|
|
979
1010
|
}
|
|
980
|
-
if (field.attributes.length > 0) {
|
|
1011
|
+
if (!lite && field.attributes.length > 0) {
|
|
981
1012
|
objectFields.push(ts.factory.createPropertyAssignment("attributes", ts.factory.createArrayLiteralExpression(field.attributes.map((attr) => this.createAttributeObject(attr)))));
|
|
982
1013
|
}
|
|
983
1014
|
const defaultValue = this.getFieldMappedDefault(field);
|
|
984
1015
|
if (defaultValue !== void 0) {
|
|
985
1016
|
if (typeof defaultValue === "object" && !Array.isArray(defaultValue)) {
|
|
986
1017
|
if ("call" in defaultValue) {
|
|
987
|
-
objectFields.push(ts.factory.createPropertyAssignment("default",
|
|
1018
|
+
objectFields.push(ts.factory.createPropertyAssignment("default", this.createExpressionUtilsCall("call", [
|
|
988
1019
|
ts.factory.createStringLiteral(defaultValue.call),
|
|
989
1020
|
...defaultValue.args.length > 0 ? [
|
|
990
|
-
ts.factory.createArrayLiteralExpression(defaultValue.args.map((arg) => this.
|
|
1021
|
+
ts.factory.createArrayLiteralExpression(defaultValue.args.map((arg) => this.createExpressionUtilsCall("literal", [
|
|
1022
|
+
this.createLiteralNode(arg)
|
|
1023
|
+
])))
|
|
991
1024
|
] : []
|
|
992
1025
|
])));
|
|
993
1026
|
} else if ("authMember" in defaultValue) {
|
|
994
|
-
objectFields.push(ts.factory.createPropertyAssignment("default",
|
|
995
|
-
|
|
1027
|
+
objectFields.push(ts.factory.createPropertyAssignment("default", this.createExpressionUtilsCall("member", [
|
|
1028
|
+
this.createExpressionUtilsCall("call", [
|
|
996
1029
|
ts.factory.createStringLiteral("auth")
|
|
997
1030
|
]),
|
|
998
1031
|
ts.factory.createArrayLiteralExpression(defaultValue.authMember.map((m) => ts.factory.createStringLiteral(m)))
|
|
@@ -1102,12 +1135,16 @@ var TsSchemaGenerator = class {
|
|
|
1102
1135
|
relationFields.push(ts.factory.createPropertyAssignment("name", ts.factory.createStringLiteral(relationName)));
|
|
1103
1136
|
}
|
|
1104
1137
|
const relation = getAttribute(field, "@relation");
|
|
1138
|
+
const fkFields = [];
|
|
1105
1139
|
if (relation) {
|
|
1106
1140
|
for (const arg of relation.args) {
|
|
1107
1141
|
const param = arg.$resolvedParam.name;
|
|
1108
1142
|
if (param === "fields" || param === "references") {
|
|
1109
1143
|
const fieldNames = this.getReferenceNames(arg.value);
|
|
1110
1144
|
if (fieldNames) {
|
|
1145
|
+
if (param === "fields") {
|
|
1146
|
+
fkFields.push(...fieldNames);
|
|
1147
|
+
}
|
|
1111
1148
|
relationFields.push(ts.factory.createPropertyAssignment(param, ts.factory.createArrayLiteralExpression(fieldNames.map((el) => ts.factory.createStringLiteral(el)))));
|
|
1112
1149
|
}
|
|
1113
1150
|
}
|
|
@@ -1117,6 +1154,15 @@ var TsSchemaGenerator = class {
|
|
|
1117
1154
|
}
|
|
1118
1155
|
}
|
|
1119
1156
|
}
|
|
1157
|
+
if (fkFields.length > 0) {
|
|
1158
|
+
const allHaveDefault = fkFields.every((fieldName) => {
|
|
1159
|
+
const fieldDef = field.$container.fields.find((f) => f.name === fieldName);
|
|
1160
|
+
return fieldDef && hasAttribute(fieldDef, "@default");
|
|
1161
|
+
});
|
|
1162
|
+
if (allHaveDefault) {
|
|
1163
|
+
relationFields.push(ts.factory.createPropertyAssignment("hasDefault", ts.factory.createTrue()));
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1120
1166
|
return ts.factory.createObjectLiteralExpression(relationFields);
|
|
1121
1167
|
}
|
|
1122
1168
|
getReferenceNames(expr) {
|
|
@@ -1306,7 +1352,7 @@ var TsSchemaGenerator = class {
|
|
|
1306
1352
|
});
|
|
1307
1353
|
}
|
|
1308
1354
|
createThisExpression() {
|
|
1309
|
-
return
|
|
1355
|
+
return this.createExpressionUtilsCall("_this");
|
|
1310
1356
|
}
|
|
1311
1357
|
createMemberExpression(expr) {
|
|
1312
1358
|
const members = [];
|
|
@@ -1320,32 +1366,32 @@ var TsSchemaGenerator = class {
|
|
|
1320
1366
|
this.createExpression(receiver),
|
|
1321
1367
|
ts.factory.createArrayLiteralExpression(members.map((m) => ts.factory.createStringLiteral(m)))
|
|
1322
1368
|
];
|
|
1323
|
-
return
|
|
1369
|
+
return this.createExpressionUtilsCall("member", args);
|
|
1324
1370
|
}
|
|
1325
1371
|
createNullExpression() {
|
|
1326
|
-
return
|
|
1372
|
+
return this.createExpressionUtilsCall("_null");
|
|
1327
1373
|
}
|
|
1328
1374
|
createBinaryExpression(expr) {
|
|
1329
|
-
return
|
|
1375
|
+
return this.createExpressionUtilsCall("binary", [
|
|
1330
1376
|
this.createExpression(expr.left),
|
|
1331
1377
|
this.createLiteralNode(expr.operator),
|
|
1332
1378
|
this.createExpression(expr.right)
|
|
1333
1379
|
]);
|
|
1334
1380
|
}
|
|
1335
1381
|
createUnaryExpression(expr) {
|
|
1336
|
-
return
|
|
1382
|
+
return this.createExpressionUtilsCall("unary", [
|
|
1337
1383
|
this.createLiteralNode(expr.operator),
|
|
1338
1384
|
this.createExpression(expr.operand)
|
|
1339
1385
|
]);
|
|
1340
1386
|
}
|
|
1341
1387
|
createArrayExpression(expr) {
|
|
1342
|
-
return
|
|
1388
|
+
return this.createExpressionUtilsCall("array", [
|
|
1343
1389
|
ts.factory.createArrayLiteralExpression(expr.items.map((item) => this.createExpression(item)))
|
|
1344
1390
|
]);
|
|
1345
1391
|
}
|
|
1346
1392
|
createRefExpression(expr) {
|
|
1347
1393
|
if (isDataField(expr.target.ref)) {
|
|
1348
|
-
return
|
|
1394
|
+
return this.createExpressionUtilsCall("field", [
|
|
1349
1395
|
this.createLiteralNode(expr.target.$refText)
|
|
1350
1396
|
]);
|
|
1351
1397
|
} else if (isEnumField(expr.target.ref)) {
|
|
@@ -1355,7 +1401,7 @@ var TsSchemaGenerator = class {
|
|
|
1355
1401
|
}
|
|
1356
1402
|
}
|
|
1357
1403
|
createCallExpression(expr) {
|
|
1358
|
-
return
|
|
1404
|
+
return this.createExpressionUtilsCall("call", [
|
|
1359
1405
|
ts.factory.createStringLiteral(expr.function.$refText),
|
|
1360
1406
|
...expr.args.length > 0 ? [
|
|
1361
1407
|
ts.factory.createArrayLiteralExpression(expr.args.map((arg) => this.createExpression(arg.value)))
|
|
@@ -1363,25 +1409,25 @@ var TsSchemaGenerator = class {
|
|
|
1363
1409
|
]);
|
|
1364
1410
|
}
|
|
1365
1411
|
createLiteralExpression(type, value) {
|
|
1366
|
-
return match2(type).with("BooleanLiteral", () =>
|
|
1412
|
+
return match2(type).with("BooleanLiteral", () => this.createExpressionUtilsCall("literal", [
|
|
1367
1413
|
this.createLiteralNode(value)
|
|
1368
|
-
])).with("NumberLiteral", () =>
|
|
1414
|
+
])).with("NumberLiteral", () => this.createExpressionUtilsCall("literal", [
|
|
1369
1415
|
ts.factory.createIdentifier(value)
|
|
1370
|
-
])).with("StringLiteral", () =>
|
|
1416
|
+
])).with("StringLiteral", () => this.createExpressionUtilsCall("literal", [
|
|
1371
1417
|
this.createLiteralNode(value)
|
|
1372
1418
|
])).otherwise(() => {
|
|
1373
1419
|
throw new Error(`Unsupported literal type: ${type}`);
|
|
1374
1420
|
});
|
|
1375
1421
|
}
|
|
1376
|
-
generateModelsAndTypeDefs(model,
|
|
1422
|
+
generateModelsAndTypeDefs(model, options) {
|
|
1377
1423
|
const statements = [];
|
|
1378
|
-
statements.push(this.generateSchemaImport(model, true, true));
|
|
1424
|
+
statements.push(this.generateSchemaImport(model, true, true, !!(options.lite || options.liteOnly)));
|
|
1379
1425
|
statements.push(ts.factory.createImportDeclaration(void 0, ts.factory.createImportClause(false, void 0, ts.factory.createNamedImports([
|
|
1380
1426
|
ts.factory.createImportSpecifier(true, void 0, ts.factory.createIdentifier(`ModelResult as $ModelResult`)),
|
|
1381
|
-
...model.declarations.some(
|
|
1427
|
+
...model.declarations.some(isTypeDef3) ? [
|
|
1382
1428
|
ts.factory.createImportSpecifier(true, void 0, ts.factory.createIdentifier(`TypeDefResult as $TypeDefResult`))
|
|
1383
1429
|
] : []
|
|
1384
|
-
])), ts.factory.createStringLiteral("@zenstackhq/
|
|
1430
|
+
])), ts.factory.createStringLiteral("@zenstackhq/orm")));
|
|
1385
1431
|
const dataModels = model.declarations.filter(isDataModel3);
|
|
1386
1432
|
for (const dm of dataModels) {
|
|
1387
1433
|
let modelType = ts.factory.createTypeAliasDeclaration([
|
|
@@ -1395,7 +1441,7 @@ var TsSchemaGenerator = class {
|
|
|
1395
1441
|
}
|
|
1396
1442
|
statements.push(modelType);
|
|
1397
1443
|
}
|
|
1398
|
-
const typeDefs = model.declarations.filter(
|
|
1444
|
+
const typeDefs = model.declarations.filter(isTypeDef3);
|
|
1399
1445
|
for (const td of typeDefs) {
|
|
1400
1446
|
let typeDef = ts.factory.createTypeAliasDeclaration([
|
|
1401
1447
|
ts.factory.createModifier(ts.SyntaxKind.ExportKeyword)
|
|
@@ -1428,13 +1474,13 @@ var TsSchemaGenerator = class {
|
|
|
1428
1474
|
statements.push(typeAlias);
|
|
1429
1475
|
}
|
|
1430
1476
|
this.generateBannerComments(statements);
|
|
1431
|
-
const outputFile = path.join(
|
|
1477
|
+
const outputFile = path.join(options.outDir, "models.ts");
|
|
1432
1478
|
const sourceFile = ts.createSourceFile(outputFile, "", ts.ScriptTarget.ESNext, false, ts.ScriptKind.TS);
|
|
1433
1479
|
const printer = ts.createPrinter();
|
|
1434
1480
|
const result = printer.printList(ts.ListFormat.MultiLine, ts.factory.createNodeArray(statements), sourceFile);
|
|
1435
1481
|
fs.writeFileSync(outputFile, result);
|
|
1436
1482
|
}
|
|
1437
|
-
generateSchemaImport(model, schemaObject, schemaType) {
|
|
1483
|
+
generateSchemaImport(model, schemaObject, schemaType, useLite) {
|
|
1438
1484
|
const importSpecifiers = [];
|
|
1439
1485
|
if (schemaObject) {
|
|
1440
1486
|
if (model.declarations.some(isEnum)) {
|
|
@@ -1444,17 +1490,17 @@ var TsSchemaGenerator = class {
|
|
|
1444
1490
|
if (schemaType) {
|
|
1445
1491
|
importSpecifiers.push(ts.factory.createImportSpecifier(true, ts.factory.createIdentifier("SchemaType"), ts.factory.createIdentifier("$Schema")));
|
|
1446
1492
|
}
|
|
1447
|
-
return ts.factory.createImportDeclaration(void 0, ts.factory.createImportClause(false, void 0, ts.factory.createNamedImports(importSpecifiers)), ts.factory.createStringLiteral("./schema"));
|
|
1493
|
+
return ts.factory.createImportDeclaration(void 0, ts.factory.createImportClause(false, void 0, ts.factory.createNamedImports(importSpecifiers)), ts.factory.createStringLiteral(useLite ? "./schema-lite" : "./schema"));
|
|
1448
1494
|
}
|
|
1449
1495
|
generateDocs(tsDecl, decl) {
|
|
1450
1496
|
return ts.addSyntheticLeadingComment(tsDecl, ts.SyntaxKind.MultiLineCommentTrivia, `*
|
|
1451
1497
|
* ${decl.comments.map((c) => c.replace(/^\s*\/*\s*/, "")).join("\n * ")}
|
|
1452
1498
|
`, true);
|
|
1453
1499
|
}
|
|
1454
|
-
generateInputTypes(model,
|
|
1500
|
+
generateInputTypes(model, options) {
|
|
1455
1501
|
const dataModels = model.declarations.filter(isDataModel3);
|
|
1456
1502
|
const statements = [];
|
|
1457
|
-
statements.push(this.generateSchemaImport(model, false, true));
|
|
1503
|
+
statements.push(this.generateSchemaImport(model, false, true, !!(options.lite || options.liteOnly)));
|
|
1458
1504
|
const inputTypes = [
|
|
1459
1505
|
"FindManyArgs",
|
|
1460
1506
|
"FindUniqueArgs",
|
|
@@ -1481,11 +1527,11 @@ var TsSchemaGenerator = class {
|
|
|
1481
1527
|
IncludeInput: "Include",
|
|
1482
1528
|
OmitInput: "Omit"
|
|
1483
1529
|
};
|
|
1484
|
-
statements.push(ts.factory.createImportDeclaration(void 0, ts.factory.createImportClause(true, void 0, ts.factory.createNamedImports(inputTypes.map((inputType) => ts.factory.createImportSpecifier(false, void 0, ts.factory.createIdentifier(`${inputType} as $${inputType}`))))), ts.factory.createStringLiteral("@zenstackhq/
|
|
1530
|
+
statements.push(ts.factory.createImportDeclaration(void 0, ts.factory.createImportClause(true, void 0, ts.factory.createNamedImports(inputTypes.map((inputType) => ts.factory.createImportSpecifier(false, void 0, ts.factory.createIdentifier(`${inputType} as $${inputType}`))))), ts.factory.createStringLiteral("@zenstackhq/orm")));
|
|
1485
1531
|
statements.push(ts.factory.createImportDeclaration(void 0, ts.factory.createImportClause(true, void 0, ts.factory.createNamedImports([
|
|
1486
1532
|
ts.factory.createImportSpecifier(false, void 0, ts.factory.createIdentifier("SimplifiedModelResult as $SimplifiedModelResult")),
|
|
1487
1533
|
ts.factory.createImportSpecifier(false, void 0, ts.factory.createIdentifier("SelectIncludeOmit as $SelectIncludeOmit"))
|
|
1488
|
-
])), ts.factory.createStringLiteral("@zenstackhq/
|
|
1534
|
+
])), ts.factory.createStringLiteral("@zenstackhq/orm")));
|
|
1489
1535
|
for (const dm of dataModels) {
|
|
1490
1536
|
for (const inputType of inputTypes) {
|
|
1491
1537
|
const exportName = inputTypeNameFixes[inputType] ? `${dm.name}${inputTypeNameFixes[inputType]}` : `${dm.name}${inputType}`;
|
|
@@ -1511,517 +1557,16 @@ var TsSchemaGenerator = class {
|
|
|
1511
1557
|
])));
|
|
1512
1558
|
}
|
|
1513
1559
|
this.generateBannerComments(statements);
|
|
1514
|
-
const outputFile = path.join(
|
|
1560
|
+
const outputFile = path.join(options.outDir, "input.ts");
|
|
1515
1561
|
const sourceFile = ts.createSourceFile(outputFile, "", ts.ScriptTarget.ESNext, false, ts.ScriptKind.TS);
|
|
1516
1562
|
const printer = ts.createPrinter();
|
|
1517
1563
|
const result = printer.printList(ts.ListFormat.MultiLine, ts.factory.createNodeArray(statements), sourceFile);
|
|
1518
1564
|
fs.writeFileSync(outputFile, result);
|
|
1519
1565
|
}
|
|
1520
1566
|
};
|
|
1521
|
-
|
|
1522
|
-
// src/zmodel-code-generator.ts
|
|
1523
|
-
import { ArrayExpr, Attribute, AttributeArg as AttributeArg2, AttributeParam, AttributeParamType, BinaryExpr, BinaryExprOperatorPriority, BooleanLiteral as BooleanLiteral2, ConfigArrayExpr, ConfigField, ConfigInvocationExpr, DataField, DataFieldAttribute, DataModel as DataModel2, DataModelAttribute, DataSource as DataSource3, Enum as Enum3, EnumField as EnumField2, FunctionDecl, FunctionParam, FunctionParamType, GeneratorDecl as GeneratorDecl2, InvocationExpr, LiteralExpr, MemberAccessExpr, Model as Model2, NullExpr, NumberLiteral as NumberLiteral2, ObjectExpr, Plugin, PluginField, ReferenceArg, ReferenceExpr, StringLiteral as StringLiteral2, ThisExpr, TypeDef, UnaryExpr } from "@zenstackhq/language/ast";
|
|
1524
|
-
function _ts_decorate(decorators, target, key, desc) {
|
|
1525
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1526
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1527
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1528
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1529
|
-
}
|
|
1530
|
-
__name(_ts_decorate, "_ts_decorate");
|
|
1531
|
-
function _ts_metadata(k, v) {
|
|
1532
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1533
|
-
}
|
|
1534
|
-
__name(_ts_metadata, "_ts_metadata");
|
|
1535
|
-
var generationHandlers = /* @__PURE__ */ new Map();
|
|
1536
|
-
function gen(name) {
|
|
1537
|
-
return function(_target, _propertyKey, descriptor) {
|
|
1538
|
-
if (!generationHandlers.get(name)) {
|
|
1539
|
-
generationHandlers.set(name, descriptor);
|
|
1540
|
-
}
|
|
1541
|
-
return descriptor;
|
|
1542
|
-
};
|
|
1543
|
-
}
|
|
1544
|
-
__name(gen, "gen");
|
|
1545
|
-
var ZModelCodeGenerator = class {
|
|
1546
|
-
static {
|
|
1547
|
-
__name(this, "ZModelCodeGenerator");
|
|
1548
|
-
}
|
|
1549
|
-
options;
|
|
1550
|
-
constructor(options) {
|
|
1551
|
-
this.options = {
|
|
1552
|
-
binaryExprNumberOfSpaces: options?.binaryExprNumberOfSpaces ?? 1,
|
|
1553
|
-
unaryExprNumberOfSpaces: options?.unaryExprNumberOfSpaces ?? 0,
|
|
1554
|
-
indent: options?.indent ?? 4,
|
|
1555
|
-
quote: options?.quote ?? "single"
|
|
1556
|
-
};
|
|
1557
|
-
}
|
|
1558
|
-
/**
|
|
1559
|
-
* Generates ZModel source code from AST.
|
|
1560
|
-
*/
|
|
1561
|
-
generate(ast) {
|
|
1562
|
-
const handler = generationHandlers.get(ast.$type);
|
|
1563
|
-
if (!handler) {
|
|
1564
|
-
throw new Error(`No generation handler found for ${ast.$type}`);
|
|
1565
|
-
}
|
|
1566
|
-
return handler.value.call(this, ast);
|
|
1567
|
-
}
|
|
1568
|
-
_generateModel(ast) {
|
|
1569
|
-
return ast.declarations.map((d) => this.generate(d)).join("\n\n");
|
|
1570
|
-
}
|
|
1571
|
-
_generateDataSource(ast) {
|
|
1572
|
-
return `datasource ${ast.name} {
|
|
1573
|
-
${ast.fields.map((x) => this.indent + this.generate(x)).join("\n")}
|
|
1574
|
-
}`;
|
|
1575
|
-
}
|
|
1576
|
-
_generateEnum(ast) {
|
|
1577
|
-
return `enum ${ast.name} {
|
|
1578
|
-
${ast.fields.map((x) => this.indent + this.generate(x)).join("\n")}
|
|
1579
|
-
}`;
|
|
1580
|
-
}
|
|
1581
|
-
_generateEnumField(ast) {
|
|
1582
|
-
return `${ast.name}${ast.attributes.length > 0 ? " " + ast.attributes.map((x) => this.generate(x)).join(" ") : ""}`;
|
|
1583
|
-
}
|
|
1584
|
-
_generateGenerator(ast) {
|
|
1585
|
-
return `generator ${ast.name} {
|
|
1586
|
-
${ast.fields.map((x) => this.indent + this.generate(x)).join("\n")}
|
|
1587
|
-
}`;
|
|
1588
|
-
}
|
|
1589
|
-
_generateConfigField(ast) {
|
|
1590
|
-
return `${ast.name} = ${this.generate(ast.value)}`;
|
|
1591
|
-
}
|
|
1592
|
-
_generateConfigArrayExpr(ast) {
|
|
1593
|
-
return `[${ast.items.map((x) => this.generate(x)).join(", ")}]`;
|
|
1594
|
-
}
|
|
1595
|
-
_generateConfigInvocationExpr(ast) {
|
|
1596
|
-
if (ast.args.length === 0) {
|
|
1597
|
-
return ast.name;
|
|
1598
|
-
} else {
|
|
1599
|
-
return `${ast.name}(${ast.args.map((x) => (x.name ? x.name + ": " : "") + this.generate(x.value)).join(", ")})`;
|
|
1600
|
-
}
|
|
1601
|
-
}
|
|
1602
|
-
_generatePlugin(ast) {
|
|
1603
|
-
return `plugin ${ast.name} {
|
|
1604
|
-
${ast.fields.map((x) => this.indent + this.generate(x)).join("\n")}
|
|
1605
|
-
}`;
|
|
1606
|
-
}
|
|
1607
|
-
_generatePluginField(ast) {
|
|
1608
|
-
return `${ast.name} = ${this.generate(ast.value)}`;
|
|
1609
|
-
}
|
|
1610
|
-
_generateDataModel(ast) {
|
|
1611
|
-
return `${ast.isView ? "view" : "model"} ${ast.name}${ast.mixins.length > 0 ? " mixes " + ast.mixins.map((x) => x.ref?.name).join(", ") : ""} {
|
|
1612
|
-
${ast.fields.map((x) => this.indent + this.generate(x)).join("\n")}${ast.attributes.length > 0 ? "\n\n" + ast.attributes.map((x) => this.indent + this.generate(x)).join("\n") : ""}
|
|
1613
|
-
}`;
|
|
1614
|
-
}
|
|
1615
|
-
_generateDataField(ast) {
|
|
1616
|
-
return `${ast.name} ${this.fieldType(ast.type)}${ast.attributes.length > 0 ? " " + ast.attributes.map((x) => this.generate(x)).join(" ") : ""}`;
|
|
1617
|
-
}
|
|
1618
|
-
fieldType(type) {
|
|
1619
|
-
const baseType = type.type ? type.type : type.$type == "DataFieldType" && type.unsupported ? "Unsupported(" + this.generate(type.unsupported.value) + ")" : type.reference?.$refText;
|
|
1620
|
-
return `${baseType}${type.array ? "[]" : ""}${type.optional ? "?" : ""}`;
|
|
1621
|
-
}
|
|
1622
|
-
_generateDataModelAttribute(ast) {
|
|
1623
|
-
return this.attribute(ast);
|
|
1624
|
-
}
|
|
1625
|
-
_generateDataFieldAttribute(ast) {
|
|
1626
|
-
return this.attribute(ast);
|
|
1627
|
-
}
|
|
1628
|
-
attribute(ast) {
|
|
1629
|
-
const args = ast.args.length ? `(${ast.args.map((x) => this.generate(x)).join(", ")})` : "";
|
|
1630
|
-
return `${resolved(ast.decl).name}${args}`;
|
|
1631
|
-
}
|
|
1632
|
-
_generateAttributeArg(ast) {
|
|
1633
|
-
if (ast.name) {
|
|
1634
|
-
return `${ast.name}: ${this.generate(ast.value)}`;
|
|
1635
|
-
} else {
|
|
1636
|
-
return this.generate(ast.value);
|
|
1637
|
-
}
|
|
1638
|
-
}
|
|
1639
|
-
_generateObjectExpr(ast) {
|
|
1640
|
-
return `{ ${ast.fields.map((field) => this.objectField(field)).join(", ")} }`;
|
|
1641
|
-
}
|
|
1642
|
-
objectField(field) {
|
|
1643
|
-
return `${field.name}: ${this.generate(field.value)}`;
|
|
1644
|
-
}
|
|
1645
|
-
_generateArrayExpr(ast) {
|
|
1646
|
-
return `[${ast.items.map((item) => this.generate(item)).join(", ")}]`;
|
|
1647
|
-
}
|
|
1648
|
-
_generateLiteralExpr(ast) {
|
|
1649
|
-
return this.options.quote === "single" ? `'${ast.value}'` : `"${ast.value}"`;
|
|
1650
|
-
}
|
|
1651
|
-
_generateNumberLiteral(ast) {
|
|
1652
|
-
return ast.value.toString();
|
|
1653
|
-
}
|
|
1654
|
-
_generateBooleanLiteral(ast) {
|
|
1655
|
-
return ast.value.toString();
|
|
1656
|
-
}
|
|
1657
|
-
_generateUnaryExpr(ast) {
|
|
1658
|
-
return `${ast.operator}${this.unaryExprSpace}${this.generate(ast.operand)}`;
|
|
1659
|
-
}
|
|
1660
|
-
_generateBinaryExpr(ast) {
|
|
1661
|
-
const operator = ast.operator;
|
|
1662
|
-
const isCollectionPredicate = this.isCollectionPredicateOperator(operator);
|
|
1663
|
-
const rightExpr = this.generate(ast.right);
|
|
1664
|
-
const { left: isLeftParenthesis, right: isRightParenthesis } = this.isParenthesesNeededForBinaryExpr(ast);
|
|
1665
|
-
return `${isLeftParenthesis ? "(" : ""}${this.generate(ast.left)}${isLeftParenthesis ? ")" : ""}${isCollectionPredicate ? "" : this.binaryExprSpace}${operator}${isCollectionPredicate ? "" : this.binaryExprSpace}${isRightParenthesis ? "(" : ""}${isCollectionPredicate ? `[${rightExpr}]` : rightExpr}${isRightParenthesis ? ")" : ""}`;
|
|
1666
|
-
}
|
|
1667
|
-
_generateReferenceExpr(ast) {
|
|
1668
|
-
const args = ast.args.length ? `(${ast.args.map((x) => this.generate(x)).join(", ")})` : "";
|
|
1669
|
-
return `${ast.target.ref?.name}${args}`;
|
|
1670
|
-
}
|
|
1671
|
-
_generateReferenceArg(ast) {
|
|
1672
|
-
return `${ast.name}:${this.generate(ast.value)}`;
|
|
1673
|
-
}
|
|
1674
|
-
_generateMemberExpr(ast) {
|
|
1675
|
-
return `${this.generate(ast.operand)}.${ast.member.ref?.name}`;
|
|
1676
|
-
}
|
|
1677
|
-
_generateInvocationExpr(ast) {
|
|
1678
|
-
return `${ast.function.ref?.name}(${ast.args.map((x) => this.argument(x)).join(", ")})`;
|
|
1679
|
-
}
|
|
1680
|
-
_generateNullExpr() {
|
|
1681
|
-
return "null";
|
|
1682
|
-
}
|
|
1683
|
-
_generateThisExpr() {
|
|
1684
|
-
return "this";
|
|
1685
|
-
}
|
|
1686
|
-
_generateAttribute(ast) {
|
|
1687
|
-
return `attribute ${ast.name}(${ast.params.map((x) => this.generate(x)).join(", ")})`;
|
|
1688
|
-
}
|
|
1689
|
-
_generateAttributeParam(ast) {
|
|
1690
|
-
return `${ast.default ? "_ " : ""}${ast.name}: ${this.generate(ast.type)}`;
|
|
1691
|
-
}
|
|
1692
|
-
_generateAttributeParamType(ast) {
|
|
1693
|
-
return `${ast.type ?? ast.reference?.$refText}${ast.array ? "[]" : ""}${ast.optional ? "?" : ""}`;
|
|
1694
|
-
}
|
|
1695
|
-
_generateFunctionDecl(ast) {
|
|
1696
|
-
return `function ${ast.name}(${ast.params.map((x) => this.generate(x)).join(", ")}) ${ast.returnType ? ": " + this.generate(ast.returnType) : ""} {}`;
|
|
1697
|
-
}
|
|
1698
|
-
_generateFunctionParam(ast) {
|
|
1699
|
-
return `${ast.name}: ${this.generate(ast.type)}`;
|
|
1700
|
-
}
|
|
1701
|
-
_generateFunctionParamType(ast) {
|
|
1702
|
-
return `${ast.type ?? ast.reference?.$refText}${ast.array ? "[]" : ""}`;
|
|
1703
|
-
}
|
|
1704
|
-
_generateTypeDef(ast) {
|
|
1705
|
-
return `type ${ast.name} {
|
|
1706
|
-
${ast.fields.map((x) => this.indent + this.generate(x)).join("\n")}${ast.attributes.length > 0 ? "\n\n" + ast.attributes.map((x) => this.indent + this.generate(x)).join("\n") : ""}
|
|
1707
|
-
}`;
|
|
1708
|
-
}
|
|
1709
|
-
argument(ast) {
|
|
1710
|
-
return this.generate(ast.value);
|
|
1711
|
-
}
|
|
1712
|
-
get binaryExprSpace() {
|
|
1713
|
-
return " ".repeat(this.options.binaryExprNumberOfSpaces);
|
|
1714
|
-
}
|
|
1715
|
-
get unaryExprSpace() {
|
|
1716
|
-
return " ".repeat(this.options.unaryExprNumberOfSpaces);
|
|
1717
|
-
}
|
|
1718
|
-
get indent() {
|
|
1719
|
-
return " ".repeat(this.options.indent);
|
|
1720
|
-
}
|
|
1721
|
-
isParenthesesNeededForBinaryExpr(ast) {
|
|
1722
|
-
const result = {
|
|
1723
|
-
left: false,
|
|
1724
|
-
right: false
|
|
1725
|
-
};
|
|
1726
|
-
const operator = ast.operator;
|
|
1727
|
-
const isCollectionPredicate = this.isCollectionPredicateOperator(operator);
|
|
1728
|
-
const currentPriority = BinaryExprOperatorPriority[operator];
|
|
1729
|
-
if (ast.left.$type === BinaryExpr && BinaryExprOperatorPriority[ast.left["operator"]] < currentPriority) {
|
|
1730
|
-
result.left = true;
|
|
1731
|
-
}
|
|
1732
|
-
if (!isCollectionPredicate && ast.right.$type === BinaryExpr && BinaryExprOperatorPriority[ast.right["operator"]] <= currentPriority) {
|
|
1733
|
-
result.right = true;
|
|
1734
|
-
}
|
|
1735
|
-
return result;
|
|
1736
|
-
}
|
|
1737
|
-
isCollectionPredicateOperator(op) {
|
|
1738
|
-
return [
|
|
1739
|
-
"?",
|
|
1740
|
-
"!",
|
|
1741
|
-
"^"
|
|
1742
|
-
].includes(op);
|
|
1743
|
-
}
|
|
1744
|
-
};
|
|
1745
|
-
_ts_decorate([
|
|
1746
|
-
gen(Model2),
|
|
1747
|
-
_ts_metadata("design:type", Function),
|
|
1748
|
-
_ts_metadata("design:paramtypes", [
|
|
1749
|
-
typeof Model2 === "undefined" ? Object : Model2
|
|
1750
|
-
]),
|
|
1751
|
-
_ts_metadata("design:returntype", void 0)
|
|
1752
|
-
], ZModelCodeGenerator.prototype, "_generateModel", null);
|
|
1753
|
-
_ts_decorate([
|
|
1754
|
-
gen(DataSource3),
|
|
1755
|
-
_ts_metadata("design:type", Function),
|
|
1756
|
-
_ts_metadata("design:paramtypes", [
|
|
1757
|
-
typeof DataSource3 === "undefined" ? Object : DataSource3
|
|
1758
|
-
]),
|
|
1759
|
-
_ts_metadata("design:returntype", void 0)
|
|
1760
|
-
], ZModelCodeGenerator.prototype, "_generateDataSource", null);
|
|
1761
|
-
_ts_decorate([
|
|
1762
|
-
gen(Enum3),
|
|
1763
|
-
_ts_metadata("design:type", Function),
|
|
1764
|
-
_ts_metadata("design:paramtypes", [
|
|
1765
|
-
typeof Enum3 === "undefined" ? Object : Enum3
|
|
1766
|
-
]),
|
|
1767
|
-
_ts_metadata("design:returntype", void 0)
|
|
1768
|
-
], ZModelCodeGenerator.prototype, "_generateEnum", null);
|
|
1769
|
-
_ts_decorate([
|
|
1770
|
-
gen(EnumField2),
|
|
1771
|
-
_ts_metadata("design:type", Function),
|
|
1772
|
-
_ts_metadata("design:paramtypes", [
|
|
1773
|
-
typeof EnumField2 === "undefined" ? Object : EnumField2
|
|
1774
|
-
]),
|
|
1775
|
-
_ts_metadata("design:returntype", void 0)
|
|
1776
|
-
], ZModelCodeGenerator.prototype, "_generateEnumField", null);
|
|
1777
|
-
_ts_decorate([
|
|
1778
|
-
gen(GeneratorDecl2),
|
|
1779
|
-
_ts_metadata("design:type", Function),
|
|
1780
|
-
_ts_metadata("design:paramtypes", [
|
|
1781
|
-
typeof GeneratorDecl2 === "undefined" ? Object : GeneratorDecl2
|
|
1782
|
-
]),
|
|
1783
|
-
_ts_metadata("design:returntype", void 0)
|
|
1784
|
-
], ZModelCodeGenerator.prototype, "_generateGenerator", null);
|
|
1785
|
-
_ts_decorate([
|
|
1786
|
-
gen(ConfigField),
|
|
1787
|
-
_ts_metadata("design:type", Function),
|
|
1788
|
-
_ts_metadata("design:paramtypes", [
|
|
1789
|
-
typeof ConfigField === "undefined" ? Object : ConfigField
|
|
1790
|
-
]),
|
|
1791
|
-
_ts_metadata("design:returntype", void 0)
|
|
1792
|
-
], ZModelCodeGenerator.prototype, "_generateConfigField", null);
|
|
1793
|
-
_ts_decorate([
|
|
1794
|
-
gen(ConfigArrayExpr),
|
|
1795
|
-
_ts_metadata("design:type", Function),
|
|
1796
|
-
_ts_metadata("design:paramtypes", [
|
|
1797
|
-
typeof ConfigArrayExpr === "undefined" ? Object : ConfigArrayExpr
|
|
1798
|
-
]),
|
|
1799
|
-
_ts_metadata("design:returntype", void 0)
|
|
1800
|
-
], ZModelCodeGenerator.prototype, "_generateConfigArrayExpr", null);
|
|
1801
|
-
_ts_decorate([
|
|
1802
|
-
gen(ConfigInvocationExpr),
|
|
1803
|
-
_ts_metadata("design:type", Function),
|
|
1804
|
-
_ts_metadata("design:paramtypes", [
|
|
1805
|
-
typeof ConfigInvocationExpr === "undefined" ? Object : ConfigInvocationExpr
|
|
1806
|
-
]),
|
|
1807
|
-
_ts_metadata("design:returntype", void 0)
|
|
1808
|
-
], ZModelCodeGenerator.prototype, "_generateConfigInvocationExpr", null);
|
|
1809
|
-
_ts_decorate([
|
|
1810
|
-
gen(Plugin),
|
|
1811
|
-
_ts_metadata("design:type", Function),
|
|
1812
|
-
_ts_metadata("design:paramtypes", [
|
|
1813
|
-
typeof Plugin === "undefined" ? Object : Plugin
|
|
1814
|
-
]),
|
|
1815
|
-
_ts_metadata("design:returntype", void 0)
|
|
1816
|
-
], ZModelCodeGenerator.prototype, "_generatePlugin", null);
|
|
1817
|
-
_ts_decorate([
|
|
1818
|
-
gen(PluginField),
|
|
1819
|
-
_ts_metadata("design:type", Function),
|
|
1820
|
-
_ts_metadata("design:paramtypes", [
|
|
1821
|
-
typeof PluginField === "undefined" ? Object : PluginField
|
|
1822
|
-
]),
|
|
1823
|
-
_ts_metadata("design:returntype", void 0)
|
|
1824
|
-
], ZModelCodeGenerator.prototype, "_generatePluginField", null);
|
|
1825
|
-
_ts_decorate([
|
|
1826
|
-
gen(DataModel2),
|
|
1827
|
-
_ts_metadata("design:type", Function),
|
|
1828
|
-
_ts_metadata("design:paramtypes", [
|
|
1829
|
-
typeof DataModel2 === "undefined" ? Object : DataModel2
|
|
1830
|
-
]),
|
|
1831
|
-
_ts_metadata("design:returntype", void 0)
|
|
1832
|
-
], ZModelCodeGenerator.prototype, "_generateDataModel", null);
|
|
1833
|
-
_ts_decorate([
|
|
1834
|
-
gen(DataField),
|
|
1835
|
-
_ts_metadata("design:type", Function),
|
|
1836
|
-
_ts_metadata("design:paramtypes", [
|
|
1837
|
-
typeof DataField === "undefined" ? Object : DataField
|
|
1838
|
-
]),
|
|
1839
|
-
_ts_metadata("design:returntype", void 0)
|
|
1840
|
-
], ZModelCodeGenerator.prototype, "_generateDataField", null);
|
|
1841
|
-
_ts_decorate([
|
|
1842
|
-
gen(DataModelAttribute),
|
|
1843
|
-
_ts_metadata("design:type", Function),
|
|
1844
|
-
_ts_metadata("design:paramtypes", [
|
|
1845
|
-
typeof DataModelAttribute === "undefined" ? Object : DataModelAttribute
|
|
1846
|
-
]),
|
|
1847
|
-
_ts_metadata("design:returntype", void 0)
|
|
1848
|
-
], ZModelCodeGenerator.prototype, "_generateDataModelAttribute", null);
|
|
1849
|
-
_ts_decorate([
|
|
1850
|
-
gen(DataFieldAttribute),
|
|
1851
|
-
_ts_metadata("design:type", Function),
|
|
1852
|
-
_ts_metadata("design:paramtypes", [
|
|
1853
|
-
typeof DataFieldAttribute === "undefined" ? Object : DataFieldAttribute
|
|
1854
|
-
]),
|
|
1855
|
-
_ts_metadata("design:returntype", void 0)
|
|
1856
|
-
], ZModelCodeGenerator.prototype, "_generateDataFieldAttribute", null);
|
|
1857
|
-
_ts_decorate([
|
|
1858
|
-
gen(AttributeArg2),
|
|
1859
|
-
_ts_metadata("design:type", Function),
|
|
1860
|
-
_ts_metadata("design:paramtypes", [
|
|
1861
|
-
typeof AttributeArg2 === "undefined" ? Object : AttributeArg2
|
|
1862
|
-
]),
|
|
1863
|
-
_ts_metadata("design:returntype", void 0)
|
|
1864
|
-
], ZModelCodeGenerator.prototype, "_generateAttributeArg", null);
|
|
1865
|
-
_ts_decorate([
|
|
1866
|
-
gen(ObjectExpr),
|
|
1867
|
-
_ts_metadata("design:type", Function),
|
|
1868
|
-
_ts_metadata("design:paramtypes", [
|
|
1869
|
-
typeof ObjectExpr === "undefined" ? Object : ObjectExpr
|
|
1870
|
-
]),
|
|
1871
|
-
_ts_metadata("design:returntype", void 0)
|
|
1872
|
-
], ZModelCodeGenerator.prototype, "_generateObjectExpr", null);
|
|
1873
|
-
_ts_decorate([
|
|
1874
|
-
gen(ArrayExpr),
|
|
1875
|
-
_ts_metadata("design:type", Function),
|
|
1876
|
-
_ts_metadata("design:paramtypes", [
|
|
1877
|
-
typeof ArrayExpr === "undefined" ? Object : ArrayExpr
|
|
1878
|
-
]),
|
|
1879
|
-
_ts_metadata("design:returntype", void 0)
|
|
1880
|
-
], ZModelCodeGenerator.prototype, "_generateArrayExpr", null);
|
|
1881
|
-
_ts_decorate([
|
|
1882
|
-
gen(StringLiteral2),
|
|
1883
|
-
_ts_metadata("design:type", Function),
|
|
1884
|
-
_ts_metadata("design:paramtypes", [
|
|
1885
|
-
typeof LiteralExpr === "undefined" ? Object : LiteralExpr
|
|
1886
|
-
]),
|
|
1887
|
-
_ts_metadata("design:returntype", void 0)
|
|
1888
|
-
], ZModelCodeGenerator.prototype, "_generateLiteralExpr", null);
|
|
1889
|
-
_ts_decorate([
|
|
1890
|
-
gen(NumberLiteral2),
|
|
1891
|
-
_ts_metadata("design:type", Function),
|
|
1892
|
-
_ts_metadata("design:paramtypes", [
|
|
1893
|
-
typeof NumberLiteral2 === "undefined" ? Object : NumberLiteral2
|
|
1894
|
-
]),
|
|
1895
|
-
_ts_metadata("design:returntype", void 0)
|
|
1896
|
-
], ZModelCodeGenerator.prototype, "_generateNumberLiteral", null);
|
|
1897
|
-
_ts_decorate([
|
|
1898
|
-
gen(BooleanLiteral2),
|
|
1899
|
-
_ts_metadata("design:type", Function),
|
|
1900
|
-
_ts_metadata("design:paramtypes", [
|
|
1901
|
-
typeof BooleanLiteral2 === "undefined" ? Object : BooleanLiteral2
|
|
1902
|
-
]),
|
|
1903
|
-
_ts_metadata("design:returntype", void 0)
|
|
1904
|
-
], ZModelCodeGenerator.prototype, "_generateBooleanLiteral", null);
|
|
1905
|
-
_ts_decorate([
|
|
1906
|
-
gen(UnaryExpr),
|
|
1907
|
-
_ts_metadata("design:type", Function),
|
|
1908
|
-
_ts_metadata("design:paramtypes", [
|
|
1909
|
-
typeof UnaryExpr === "undefined" ? Object : UnaryExpr
|
|
1910
|
-
]),
|
|
1911
|
-
_ts_metadata("design:returntype", void 0)
|
|
1912
|
-
], ZModelCodeGenerator.prototype, "_generateUnaryExpr", null);
|
|
1913
|
-
_ts_decorate([
|
|
1914
|
-
gen(BinaryExpr),
|
|
1915
|
-
_ts_metadata("design:type", Function),
|
|
1916
|
-
_ts_metadata("design:paramtypes", [
|
|
1917
|
-
typeof BinaryExpr === "undefined" ? Object : BinaryExpr
|
|
1918
|
-
]),
|
|
1919
|
-
_ts_metadata("design:returntype", void 0)
|
|
1920
|
-
], ZModelCodeGenerator.prototype, "_generateBinaryExpr", null);
|
|
1921
|
-
_ts_decorate([
|
|
1922
|
-
gen(ReferenceExpr),
|
|
1923
|
-
_ts_metadata("design:type", Function),
|
|
1924
|
-
_ts_metadata("design:paramtypes", [
|
|
1925
|
-
typeof ReferenceExpr === "undefined" ? Object : ReferenceExpr
|
|
1926
|
-
]),
|
|
1927
|
-
_ts_metadata("design:returntype", void 0)
|
|
1928
|
-
], ZModelCodeGenerator.prototype, "_generateReferenceExpr", null);
|
|
1929
|
-
_ts_decorate([
|
|
1930
|
-
gen(ReferenceArg),
|
|
1931
|
-
_ts_metadata("design:type", Function),
|
|
1932
|
-
_ts_metadata("design:paramtypes", [
|
|
1933
|
-
typeof ReferenceArg === "undefined" ? Object : ReferenceArg
|
|
1934
|
-
]),
|
|
1935
|
-
_ts_metadata("design:returntype", void 0)
|
|
1936
|
-
], ZModelCodeGenerator.prototype, "_generateReferenceArg", null);
|
|
1937
|
-
_ts_decorate([
|
|
1938
|
-
gen(MemberAccessExpr),
|
|
1939
|
-
_ts_metadata("design:type", Function),
|
|
1940
|
-
_ts_metadata("design:paramtypes", [
|
|
1941
|
-
typeof MemberAccessExpr === "undefined" ? Object : MemberAccessExpr
|
|
1942
|
-
]),
|
|
1943
|
-
_ts_metadata("design:returntype", void 0)
|
|
1944
|
-
], ZModelCodeGenerator.prototype, "_generateMemberExpr", null);
|
|
1945
|
-
_ts_decorate([
|
|
1946
|
-
gen(InvocationExpr),
|
|
1947
|
-
_ts_metadata("design:type", Function),
|
|
1948
|
-
_ts_metadata("design:paramtypes", [
|
|
1949
|
-
typeof InvocationExpr === "undefined" ? Object : InvocationExpr
|
|
1950
|
-
]),
|
|
1951
|
-
_ts_metadata("design:returntype", void 0)
|
|
1952
|
-
], ZModelCodeGenerator.prototype, "_generateInvocationExpr", null);
|
|
1953
|
-
_ts_decorate([
|
|
1954
|
-
gen(NullExpr),
|
|
1955
|
-
_ts_metadata("design:type", Function),
|
|
1956
|
-
_ts_metadata("design:paramtypes", []),
|
|
1957
|
-
_ts_metadata("design:returntype", void 0)
|
|
1958
|
-
], ZModelCodeGenerator.prototype, "_generateNullExpr", null);
|
|
1959
|
-
_ts_decorate([
|
|
1960
|
-
gen(ThisExpr),
|
|
1961
|
-
_ts_metadata("design:type", Function),
|
|
1962
|
-
_ts_metadata("design:paramtypes", []),
|
|
1963
|
-
_ts_metadata("design:returntype", void 0)
|
|
1964
|
-
], ZModelCodeGenerator.prototype, "_generateThisExpr", null);
|
|
1965
|
-
_ts_decorate([
|
|
1966
|
-
gen(Attribute),
|
|
1967
|
-
_ts_metadata("design:type", Function),
|
|
1968
|
-
_ts_metadata("design:paramtypes", [
|
|
1969
|
-
typeof Attribute === "undefined" ? Object : Attribute
|
|
1970
|
-
]),
|
|
1971
|
-
_ts_metadata("design:returntype", void 0)
|
|
1972
|
-
], ZModelCodeGenerator.prototype, "_generateAttribute", null);
|
|
1973
|
-
_ts_decorate([
|
|
1974
|
-
gen(AttributeParam),
|
|
1975
|
-
_ts_metadata("design:type", Function),
|
|
1976
|
-
_ts_metadata("design:paramtypes", [
|
|
1977
|
-
typeof AttributeParam === "undefined" ? Object : AttributeParam
|
|
1978
|
-
]),
|
|
1979
|
-
_ts_metadata("design:returntype", void 0)
|
|
1980
|
-
], ZModelCodeGenerator.prototype, "_generateAttributeParam", null);
|
|
1981
|
-
_ts_decorate([
|
|
1982
|
-
gen(AttributeParamType),
|
|
1983
|
-
_ts_metadata("design:type", Function),
|
|
1984
|
-
_ts_metadata("design:paramtypes", [
|
|
1985
|
-
typeof AttributeParamType === "undefined" ? Object : AttributeParamType
|
|
1986
|
-
]),
|
|
1987
|
-
_ts_metadata("design:returntype", void 0)
|
|
1988
|
-
], ZModelCodeGenerator.prototype, "_generateAttributeParamType", null);
|
|
1989
|
-
_ts_decorate([
|
|
1990
|
-
gen(FunctionDecl),
|
|
1991
|
-
_ts_metadata("design:type", Function),
|
|
1992
|
-
_ts_metadata("design:paramtypes", [
|
|
1993
|
-
typeof FunctionDecl === "undefined" ? Object : FunctionDecl
|
|
1994
|
-
]),
|
|
1995
|
-
_ts_metadata("design:returntype", void 0)
|
|
1996
|
-
], ZModelCodeGenerator.prototype, "_generateFunctionDecl", null);
|
|
1997
|
-
_ts_decorate([
|
|
1998
|
-
gen(FunctionParam),
|
|
1999
|
-
_ts_metadata("design:type", Function),
|
|
2000
|
-
_ts_metadata("design:paramtypes", [
|
|
2001
|
-
typeof FunctionParam === "undefined" ? Object : FunctionParam
|
|
2002
|
-
]),
|
|
2003
|
-
_ts_metadata("design:returntype", void 0)
|
|
2004
|
-
], ZModelCodeGenerator.prototype, "_generateFunctionParam", null);
|
|
2005
|
-
_ts_decorate([
|
|
2006
|
-
gen(FunctionParamType),
|
|
2007
|
-
_ts_metadata("design:type", Function),
|
|
2008
|
-
_ts_metadata("design:paramtypes", [
|
|
2009
|
-
typeof FunctionParamType === "undefined" ? Object : FunctionParamType
|
|
2010
|
-
]),
|
|
2011
|
-
_ts_metadata("design:returntype", void 0)
|
|
2012
|
-
], ZModelCodeGenerator.prototype, "_generateFunctionParamType", null);
|
|
2013
|
-
_ts_decorate([
|
|
2014
|
-
gen(TypeDef),
|
|
2015
|
-
_ts_metadata("design:type", Function),
|
|
2016
|
-
_ts_metadata("design:paramtypes", [
|
|
2017
|
-
typeof TypeDef === "undefined" ? Object : TypeDef
|
|
2018
|
-
]),
|
|
2019
|
-
_ts_metadata("design:returntype", void 0)
|
|
2020
|
-
], ZModelCodeGenerator.prototype, "_generateTypeDef", null);
|
|
2021
1567
|
export {
|
|
2022
1568
|
model_utils_exports as ModelUtils,
|
|
2023
1569
|
PrismaSchemaGenerator,
|
|
2024
|
-
TsSchemaGenerator
|
|
2025
|
-
ZModelCodeGenerator
|
|
1570
|
+
TsSchemaGenerator
|
|
2026
1571
|
};
|
|
2027
1572
|
//# sourceMappingURL=index.js.map
|