@zenstackhq/sdk 3.0.0-alpha.0 → 3.0.0-alpha.10

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.d.cts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as _zenstackhq_language_ast from '@zenstackhq/language/ast';
2
2
  import { DataModelField, DataModel, TypeDef, Enum, EnumField, FunctionDecl, Attribute, AttributeParam, TypeDefField, DataModelFieldAttribute, DataModelAttribute, AstNode, Model, Reference, InvocationExpr } from '@zenstackhq/language/ast';
3
+ import { MaybePromise } from 'langium';
3
4
 
4
5
  declare function isIdField(field: DataModelField): boolean;
5
6
  declare function hasAttribute(decl: DataModel | TypeDef | DataModelField | Enum | EnumField | FunctionDecl | Attribute | AttributeParam, name: string): boolean;
@@ -36,6 +37,13 @@ declare namespace modelUtils {
36
37
  export { modelUtils_getAttribute as getAttribute, modelUtils_getAuthDecl as getAuthDecl, modelUtils_getContainingModel as getContainingModel, modelUtils_getModelIdFields as getModelIdFields, modelUtils_getModelUniqueFields as getModelUniqueFields, modelUtils_getRecursiveBases as getRecursiveBases, modelUtils_hasAttribute as hasAttribute, modelUtils_isDelegateModel as isDelegateModel, modelUtils_isFromStdlib as isFromStdlib, modelUtils_isIdField as isIdField, modelUtils_isUniqueField as isUniqueField, modelUtils_resolved as resolved };
37
38
  }
38
39
 
40
+ type CliGeneratorContext = {
41
+ model: Model;
42
+ outputPath: string;
43
+ tsSchemaFile: string;
44
+ };
45
+ type CliGenerator = (context: CliGeneratorContext) => MaybePromise<void>;
46
+
39
47
  declare class FunctionCall {
40
48
  func: string;
41
49
  args: FunctionCallArg[];
@@ -92,10 +100,11 @@ declare class TsSchemaGenerator {
92
100
  private createModelsObject;
93
101
  private createDataModelObject;
94
102
  private createComputedFieldsObject;
95
- private mapTypeToTSSyntaxKeyword;
103
+ private mapFieldTypeToTSType;
96
104
  private createDataModelFieldObject;
97
105
  private getDataSourceProvider;
98
- private getMappedDefault;
106
+ private getFieldMappedDefault;
107
+ private getMappedValue;
99
108
  private getMemberAccessChain;
100
109
  private isAuthMemberAccess;
101
110
  private isAuthInvocation;
@@ -106,10 +115,10 @@ declare class TsSchemaGenerator {
106
115
  private getRelationName;
107
116
  private getIdFields;
108
117
  private createUniqueFieldsObject;
118
+ private generateFieldTypeLiteral;
109
119
  private createEnumObject;
110
120
  private getLiteral;
111
121
  private createLiteralNode;
112
- private createDialectConfigProvider;
113
122
  private createProceduresObject;
114
123
  private createProcedureObject;
115
124
  private generateBannerComments;
@@ -193,4 +202,4 @@ declare class ZModelCodeGenerator {
193
202
  private isCollectionPredicateOperator;
194
203
  }
195
204
 
196
- export { modelUtils as ModelUtils, PrismaSchemaGenerator, TsSchemaGenerator, ZModelCodeGenerator, type ZModelCodeOptions };
205
+ export { type CliGenerator, type CliGeneratorContext, modelUtils as ModelUtils, PrismaSchemaGenerator, TsSchemaGenerator, ZModelCodeGenerator, type ZModelCodeOptions };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as _zenstackhq_language_ast from '@zenstackhq/language/ast';
2
2
  import { DataModelField, DataModel, TypeDef, Enum, EnumField, FunctionDecl, Attribute, AttributeParam, TypeDefField, DataModelFieldAttribute, DataModelAttribute, AstNode, Model, Reference, InvocationExpr } from '@zenstackhq/language/ast';
3
+ import { MaybePromise } from 'langium';
3
4
 
4
5
  declare function isIdField(field: DataModelField): boolean;
5
6
  declare function hasAttribute(decl: DataModel | TypeDef | DataModelField | Enum | EnumField | FunctionDecl | Attribute | AttributeParam, name: string): boolean;
@@ -36,6 +37,13 @@ declare namespace modelUtils {
36
37
  export { modelUtils_getAttribute as getAttribute, modelUtils_getAuthDecl as getAuthDecl, modelUtils_getContainingModel as getContainingModel, modelUtils_getModelIdFields as getModelIdFields, modelUtils_getModelUniqueFields as getModelUniqueFields, modelUtils_getRecursiveBases as getRecursiveBases, modelUtils_hasAttribute as hasAttribute, modelUtils_isDelegateModel as isDelegateModel, modelUtils_isFromStdlib as isFromStdlib, modelUtils_isIdField as isIdField, modelUtils_isUniqueField as isUniqueField, modelUtils_resolved as resolved };
37
38
  }
38
39
 
40
+ type CliGeneratorContext = {
41
+ model: Model;
42
+ outputPath: string;
43
+ tsSchemaFile: string;
44
+ };
45
+ type CliGenerator = (context: CliGeneratorContext) => MaybePromise<void>;
46
+
39
47
  declare class FunctionCall {
40
48
  func: string;
41
49
  args: FunctionCallArg[];
@@ -92,10 +100,11 @@ declare class TsSchemaGenerator {
92
100
  private createModelsObject;
93
101
  private createDataModelObject;
94
102
  private createComputedFieldsObject;
95
- private mapTypeToTSSyntaxKeyword;
103
+ private mapFieldTypeToTSType;
96
104
  private createDataModelFieldObject;
97
105
  private getDataSourceProvider;
98
- private getMappedDefault;
106
+ private getFieldMappedDefault;
107
+ private getMappedValue;
99
108
  private getMemberAccessChain;
100
109
  private isAuthMemberAccess;
101
110
  private isAuthInvocation;
@@ -106,10 +115,10 @@ declare class TsSchemaGenerator {
106
115
  private getRelationName;
107
116
  private getIdFields;
108
117
  private createUniqueFieldsObject;
118
+ private generateFieldTypeLiteral;
109
119
  private createEnumObject;
110
120
  private getLiteral;
111
121
  private createLiteralNode;
112
- private createDialectConfigProvider;
113
122
  private createProceduresObject;
114
123
  private createProcedureObject;
115
124
  private generateBannerComments;
@@ -193,4 +202,4 @@ declare class ZModelCodeGenerator {
193
202
  private isCollectionPredicateOperator;
194
203
  }
195
204
 
196
- export { modelUtils as ModelUtils, PrismaSchemaGenerator, TsSchemaGenerator, ZModelCodeGenerator, type ZModelCodeOptions };
205
+ export { type CliGenerator, type CliGeneratorContext, modelUtils as ModelUtils, PrismaSchemaGenerator, TsSchemaGenerator, ZModelCodeGenerator, type ZModelCodeOptions };
package/dist/index.js CHANGED
@@ -285,9 +285,9 @@ var Model = class extends ContainerDeclaration {
285
285
  }
286
286
  name;
287
287
  isView;
288
- fields;
288
+ fields = [];
289
289
  constructor(name, isView, documentations = []) {
290
- super(documentations), this.name = name, this.isView = isView, this.fields = [];
290
+ super(documentations), this.name = name, this.isView = isView;
291
291
  }
292
292
  addField(name, type, attributes = [], documentations = [], addToFront = false) {
293
293
  const field = new ModelField(name, type, attributes, documentations);
@@ -507,9 +507,9 @@ var Enum = class extends ContainerDeclaration {
507
507
  __name(this, "Enum");
508
508
  }
509
509
  name;
510
- fields;
510
+ fields = [];
511
511
  constructor(name, documentations = []) {
512
- super(documentations), this.name = name, this.fields = [];
512
+ super(documentations), this.name = name;
513
513
  }
514
514
  addField(name, attributes = [], documentations = []) {
515
515
  const field = new EnumField(name, attributes, documentations);
@@ -558,15 +558,14 @@ var PrismaSchemaGenerator = class {
558
558
  __name(this, "PrismaSchemaGenerator");
559
559
  }
560
560
  zmodel;
561
- PRELUDE;
562
- constructor(zmodel) {
563
- this.zmodel = zmodel;
564
- this.PRELUDE = `//////////////////////////////////////////////////////////////////////////////////////////////
561
+ PRELUDE = `//////////////////////////////////////////////////////////////////////////////////////////////
565
562
  // DO NOT MODIFY THIS FILE //
566
563
  // This file is automatically generated by ZenStack CLI and should not be manually updated. //
567
564
  //////////////////////////////////////////////////////////////////////////////////////////////
568
565
 
569
566
  `;
567
+ constructor(zmodel) {
568
+ this.zmodel = zmodel;
570
569
  }
571
570
  async generate() {
572
571
  const prisma = new PrismaModel();
@@ -777,11 +776,11 @@ var PrismaSchemaGenerator = class {
777
776
  };
778
777
 
779
778
  // src/ts-schema-generator.ts
779
+ import { invariant } from "@zenstackhq/common-helpers";
780
780
  import { loadDocument } from "@zenstackhq/language";
781
781
  import { isArrayExpr as isArrayExpr3, isBinaryExpr, isDataModel as isDataModel2, isDataModelField, isDataSource, isEnum, isEnumField, isInvocationExpr as isInvocationExpr2, isLiteralExpr as isLiteralExpr3, isMemberAccessExpr, isNullExpr as isNullExpr2, isProcedure, isReferenceExpr as isReferenceExpr3, isThisExpr, isUnaryExpr } from "@zenstackhq/language/ast";
782
- import fs from "node:fs";
783
- import path from "node:path";
784
- import invariant from "tiny-invariant";
782
+ import fs from "fs";
783
+ import path from "path";
785
784
  import { match as match2 } from "ts-pattern";
786
785
  import * as ts from "typescript";
787
786
  var TsSchemaGenerator = class {
@@ -819,27 +818,6 @@ var TsSchemaGenerator = class {
819
818
  ts.factory.createImportSpecifier(false, void 0, ts.factory.createIdentifier("ExpressionUtils"))
820
819
  ])), ts.factory.createStringLiteral("@zenstackhq/runtime/schema"));
821
820
  statements.push(runtimeImportDecl);
822
- const { type: providerType } = this.getDataSourceProvider(model);
823
- switch (providerType) {
824
- case "sqlite": {
825
- const pathImportDecl = ts.factory.createImportDeclaration(void 0, ts.factory.createImportClause(false, ts.factory.createIdentifier("path"), void 0), ts.factory.createStringLiteral("node:path"));
826
- statements.push(pathImportDecl);
827
- const urlImportDecl = ts.factory.createImportDeclaration(void 0, ts.factory.createImportClause(false, ts.factory.createIdentifier("url"), void 0), ts.factory.createStringLiteral("node:url"));
828
- statements.push(urlImportDecl);
829
- const dialectConfigImportDecl = ts.factory.createImportDeclaration(void 0, ts.factory.createImportClause(false, void 0, ts.factory.createNamedImports([
830
- ts.factory.createImportSpecifier(false, void 0, ts.factory.createIdentifier("toDialectConfig"))
831
- ])), ts.factory.createStringLiteral("@zenstackhq/runtime/utils/sqlite-utils"));
832
- statements.push(dialectConfigImportDecl);
833
- break;
834
- }
835
- case "postgresql": {
836
- const dialectConfigImportDecl = ts.factory.createImportDeclaration(void 0, ts.factory.createImportClause(false, void 0, ts.factory.createNamedImports([
837
- ts.factory.createImportSpecifier(false, void 0, ts.factory.createIdentifier("toDialectConfig"))
838
- ])), ts.factory.createStringLiteral("@zenstackhq/runtime/utils/pg-utils"));
839
- statements.push(dialectConfigImportDecl);
840
- break;
841
- }
842
- }
843
821
  const declaration = ts.factory.createVariableStatement([
844
822
  ts.factory.createModifier(ts.SyntaxKind.ExportKeyword)
845
823
  ], ts.factory.createVariableDeclarationList([
@@ -876,8 +854,7 @@ var TsSchemaGenerator = class {
876
854
  createProviderObject(model) {
877
855
  const dsProvider = this.getDataSourceProvider(model);
878
856
  return ts.factory.createObjectLiteralExpression([
879
- ts.factory.createPropertyAssignment("type", ts.factory.createStringLiteral(dsProvider.type)),
880
- ts.factory.createPropertyAssignment("dialectConfigProvider", this.createDialectConfigProvider(dsProvider))
857
+ ts.factory.createPropertyAssignment("type", ts.factory.createStringLiteral(dsProvider.type))
881
858
  ], true);
882
859
  }
883
860
  createModelsObject(model) {
@@ -904,19 +881,26 @@ var TsSchemaGenerator = class {
904
881
  }
905
882
  createComputedFieldsObject(fields) {
906
883
  return ts.factory.createObjectLiteralExpression(fields.map((field) => ts.factory.createMethodDeclaration(void 0, void 0, field.name, void 0, void 0, [], ts.factory.createTypeReferenceNode("OperandExpression", [
907
- ts.factory.createKeywordTypeNode(this.mapTypeToTSSyntaxKeyword(field.type.type))
884
+ ts.factory.createTypeReferenceNode(this.mapFieldTypeToTSType(field.type))
908
885
  ]), ts.factory.createBlock([
909
886
  ts.factory.createThrowStatement(ts.factory.createNewExpression(ts.factory.createIdentifier("Error"), void 0, [
910
887
  ts.factory.createStringLiteral("This is a stub for computed field")
911
888
  ]))
912
889
  ], true))), true);
913
890
  }
914
- mapTypeToTSSyntaxKeyword(type) {
915
- return match2(type).with("String", () => ts.SyntaxKind.StringKeyword).with("Boolean", () => ts.SyntaxKind.BooleanKeyword).with("Int", () => ts.SyntaxKind.NumberKeyword).with("Float", () => ts.SyntaxKind.NumberKeyword).with("BigInt", () => ts.SyntaxKind.BigIntKeyword).with("Decimal", () => ts.SyntaxKind.NumberKeyword).otherwise(() => ts.SyntaxKind.UnknownKeyword);
891
+ mapFieldTypeToTSType(type) {
892
+ let result = match2(type.type).with("String", () => "string").with("Boolean", () => "boolean").with("Int", () => "number").with("Float", () => "number").with("BigInt", () => "bigint").with("Decimal", () => "number").otherwise(() => "unknown");
893
+ if (type.array) {
894
+ result = `${result}[]`;
895
+ }
896
+ if (type.optional) {
897
+ result = `${result} | null`;
898
+ }
899
+ return result;
916
900
  }
917
901
  createDataModelFieldObject(field) {
918
902
  const objectFields = [
919
- ts.factory.createPropertyAssignment("type", ts.factory.createStringLiteral(field.type.type ?? field.type.reference.$refText))
903
+ ts.factory.createPropertyAssignment("type", this.generateFieldTypeLiteral(field))
920
904
  ];
921
905
  if (isIdField(field)) {
922
906
  objectFields.push(ts.factory.createPropertyAssignment("id", ts.factory.createTrue()));
@@ -936,9 +920,9 @@ var TsSchemaGenerator = class {
936
920
  if (field.attributes.length > 0) {
937
921
  objectFields.push(ts.factory.createPropertyAssignment("attributes", ts.factory.createArrayLiteralExpression(field.attributes.map((attr) => this.createAttributeObject(attr)))));
938
922
  }
939
- const defaultValue = this.getMappedDefault(field);
923
+ const defaultValue = this.getFieldMappedDefault(field);
940
924
  if (defaultValue !== void 0) {
941
- if (typeof defaultValue === "object") {
925
+ if (typeof defaultValue === "object" && !Array.isArray(defaultValue)) {
942
926
  if ("call" in defaultValue) {
943
927
  objectFields.push(ts.factory.createPropertyAssignment("default", ts.factory.createCallExpression(ts.factory.createIdentifier("ExpressionUtils.call"), void 0, [
944
928
  ts.factory.createStringLiteral(defaultValue.call),
@@ -957,7 +941,11 @@ var TsSchemaGenerator = class {
957
941
  throw new Error(`Unsupported default value type for field ${field.name}`);
958
942
  }
959
943
  } else {
960
- objectFields.push(ts.factory.createPropertyAssignment("default", typeof defaultValue === "string" ? ts.factory.createStringLiteral(defaultValue) : typeof defaultValue === "number" ? ts.factory.createNumericLiteral(defaultValue) : defaultValue === true ? ts.factory.createTrue() : ts.factory.createFalse()));
944
+ if (Array.isArray(defaultValue)) {
945
+ objectFields.push(ts.factory.createPropertyAssignment("default", ts.factory.createArrayLiteralExpression(defaultValue.map((item) => this.createLiteralNode(item)))));
946
+ } else {
947
+ objectFields.push(ts.factory.createPropertyAssignment("default", this.createLiteralNode(defaultValue)));
948
+ }
961
949
  }
962
950
  }
963
951
  if (hasAttribute(field, "@computed")) {
@@ -998,34 +986,39 @@ var TsSchemaGenerator = class {
998
986
  throw new Error("Unsupported URL type");
999
987
  }
1000
988
  }
1001
- getMappedDefault(field) {
989
+ getFieldMappedDefault(field) {
1002
990
  const defaultAttr = getAttribute(field, "@default");
1003
991
  if (!defaultAttr) {
1004
992
  return void 0;
1005
993
  }
1006
994
  const defaultValue = defaultAttr.args[0]?.value;
1007
995
  invariant(defaultValue, "Expected a default value");
1008
- if (isLiteralExpr3(defaultValue)) {
1009
- const lit = defaultValue.value;
1010
- return field.type.type === "Boolean" ? lit : [
996
+ return this.getMappedValue(defaultValue, field.type);
997
+ }
998
+ getMappedValue(expr, fieldType) {
999
+ if (isLiteralExpr3(expr)) {
1000
+ const lit = expr.value;
1001
+ return fieldType.type === "Boolean" ? lit : [
1011
1002
  "Int",
1012
1003
  "Float",
1013
1004
  "Decimal",
1014
1005
  "BigInt"
1015
- ].includes(field.type.type) ? Number(lit) : lit;
1016
- } else if (isReferenceExpr3(defaultValue) && isEnumField(defaultValue.target.ref)) {
1017
- return defaultValue.target.ref.name;
1018
- } else if (isInvocationExpr2(defaultValue)) {
1006
+ ].includes(fieldType.type) ? Number(lit) : lit;
1007
+ } else if (isArrayExpr3(expr)) {
1008
+ return expr.items.map((item) => this.getMappedValue(item, fieldType));
1009
+ } else if (isReferenceExpr3(expr) && isEnumField(expr.target.ref)) {
1010
+ return expr.target.ref.name;
1011
+ } else if (isInvocationExpr2(expr)) {
1019
1012
  return {
1020
- call: defaultValue.function.$refText,
1021
- args: defaultValue.args.map((arg) => this.getLiteral(arg.value))
1013
+ call: expr.function.$refText,
1014
+ args: expr.args.map((arg) => this.getLiteral(arg.value))
1022
1015
  };
1023
- } else if (this.isAuthMemberAccess(defaultValue)) {
1016
+ } else if (this.isAuthMemberAccess(expr)) {
1024
1017
  return {
1025
- authMember: this.getMemberAccessChain(defaultValue)
1018
+ authMember: this.getMemberAccessChain(expr)
1026
1019
  };
1027
1020
  } else {
1028
- throw new Error(`Unsupported default value type for field ${field.name}`);
1021
+ throw new Error(`Unsupported default value type for ${expr.$type}`);
1029
1022
  }
1030
1023
  }
1031
1024
  getMemberAccessChain(expr) {
@@ -1138,10 +1131,11 @@ var TsSchemaGenerator = class {
1138
1131
  for (const field of dm.fields) {
1139
1132
  if (hasAttribute(field, "@id") || hasAttribute(field, "@unique")) {
1140
1133
  properties.push(ts.factory.createPropertyAssignment(field.name, ts.factory.createObjectLiteralExpression([
1141
- ts.factory.createPropertyAssignment("type", ts.factory.createStringLiteral(field.type.type))
1134
+ ts.factory.createPropertyAssignment("type", this.generateFieldTypeLiteral(field))
1142
1135
  ])));
1143
1136
  }
1144
1137
  }
1138
+ const seenKeys = /* @__PURE__ */ new Set();
1145
1139
  for (const attr of dm.attributes) {
1146
1140
  if (attr.decl.$refText === "@@id" || attr.decl.$refText === "@@unique") {
1147
1141
  const fieldNames = this.getReferenceNames(attr.args[0].value);
@@ -1151,13 +1145,18 @@ var TsSchemaGenerator = class {
1151
1145
  if (fieldNames.length === 1) {
1152
1146
  const fieldDef = dm.fields.find((f) => f.name === fieldNames[0]);
1153
1147
  properties.push(ts.factory.createPropertyAssignment(fieldNames[0], ts.factory.createObjectLiteralExpression([
1154
- ts.factory.createPropertyAssignment("type", ts.factory.createStringLiteral(fieldDef.type.type))
1148
+ ts.factory.createPropertyAssignment("type", this.generateFieldTypeLiteral(fieldDef))
1155
1149
  ])));
1156
1150
  } else {
1151
+ const key = fieldNames.join("_");
1152
+ if (seenKeys.has(key)) {
1153
+ continue;
1154
+ }
1155
+ seenKeys.add(key);
1157
1156
  properties.push(ts.factory.createPropertyAssignment(fieldNames.join("_"), ts.factory.createObjectLiteralExpression(fieldNames.map((field) => {
1158
1157
  const fieldDef = dm.fields.find((f) => f.name === field);
1159
1158
  return ts.factory.createPropertyAssignment(field, ts.factory.createObjectLiteralExpression([
1160
- ts.factory.createPropertyAssignment("type", ts.factory.createStringLiteral(fieldDef.type.type))
1159
+ ts.factory.createPropertyAssignment("type", this.generateFieldTypeLiteral(fieldDef))
1161
1160
  ]));
1162
1161
  }))));
1163
1162
  }
@@ -1165,6 +1164,10 @@ var TsSchemaGenerator = class {
1165
1164
  }
1166
1165
  return ts.factory.createObjectLiteralExpression(properties, true);
1167
1166
  }
1167
+ generateFieldTypeLiteral(field) {
1168
+ invariant(field.type.type || field.type.reference || field.type.unsupported, "Field type must be a primitive, reference, or Unsupported");
1169
+ return field.type.type ? ts.factory.createStringLiteral(field.type.type) : field.type.reference ? ts.factory.createStringLiteral(field.type.reference.$refText) : ts.factory.createStringLiteral("Unsupported");
1170
+ }
1168
1171
  createEnumObject(e) {
1169
1172
  return ts.factory.createObjectLiteralExpression(e.fields.map((field) => ts.factory.createPropertyAssignment(field.name, ts.factory.createStringLiteral(field.name))), true);
1170
1173
  }
@@ -1185,44 +1188,6 @@ var TsSchemaGenerator = class {
1185
1188
  createLiteralNode(arg) {
1186
1189
  return arg === null ? ts.factory.createNull() : typeof arg === "string" ? ts.factory.createStringLiteral(arg) : typeof arg === "number" ? ts.factory.createNumericLiteral(arg) : arg === true ? ts.factory.createTrue() : arg === false ? ts.factory.createFalse() : void 0;
1187
1190
  }
1188
- createDialectConfigProvider(dsProvider) {
1189
- const type = dsProvider.type;
1190
- let urlExpr;
1191
- if (dsProvider.env !== void 0) {
1192
- urlExpr = ts.factory.createIdentifier(`process.env['${dsProvider.env}']`);
1193
- } else {
1194
- urlExpr = ts.factory.createStringLiteral(dsProvider.url);
1195
- if (type === "sqlite") {
1196
- let parsedUrl;
1197
- try {
1198
- parsedUrl = new URL(dsProvider.url);
1199
- } catch {
1200
- }
1201
- if (parsedUrl) {
1202
- if (parsedUrl.protocol !== "file:") {
1203
- throw new Error("Invalid SQLite URL: only file protocol is supported");
1204
- }
1205
- urlExpr = ts.factory.createStringLiteral(dsProvider.url.replace(/^file:/, ""));
1206
- }
1207
- }
1208
- }
1209
- return match2(type).with("sqlite", () => {
1210
- return ts.factory.createFunctionExpression(void 0, void 0, void 0, void 0, void 0, void 0, ts.factory.createBlock([
1211
- ts.factory.createReturnStatement(ts.factory.createCallExpression(ts.factory.createIdentifier("toDialectConfig"), void 0, [
1212
- urlExpr,
1213
- ts.factory.createIdentifier(`typeof __dirname !== 'undefined' ? __dirname : path.dirname(url.fileURLToPath(import.meta.url))`)
1214
- ]))
1215
- ], true));
1216
- }).with("postgresql", () => {
1217
- return ts.factory.createFunctionExpression(void 0, void 0, void 0, void 0, void 0, void 0, ts.factory.createBlock([
1218
- ts.factory.createReturnStatement(ts.factory.createCallExpression(ts.factory.createIdentifier("toDialectConfig"), void 0, [
1219
- urlExpr
1220
- ]))
1221
- ], true));
1222
- }).otherwise(() => {
1223
- throw new Error(`Unsupported provider: ${type}`);
1224
- });
1225
- }
1226
1191
  createProceduresObject(procedures) {
1227
1192
  return ts.factory.createObjectLiteralExpression(procedures.map((proc) => ts.factory.createPropertyAssignment(proc.name, this.createProcedureObject(proc))), true);
1228
1193
  }
@@ -1257,6 +1222,8 @@ var TsSchemaGenerator = class {
1257
1222
  // This file is automatically generated by ZenStack CLI and should not be manually updated. //
1258
1223
  //////////////////////////////////////////////////////////////////////////////////////////////
1259
1224
 
1225
+ /* eslint-disable */
1226
+
1260
1227
  `;
1261
1228
  ts.addSyntheticLeadingComment(statements[0], ts.SyntaxKind.SingleLineCommentTrivia, banner);
1262
1229
  }