@contractspec/lib.schema 1.57.0 → 1.58.0

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.
Files changed (96) hide show
  1. package/dist/EnumType.d.ts +29 -31
  2. package/dist/EnumType.d.ts.map +1 -1
  3. package/dist/EnumType.js +38 -54
  4. package/dist/EnumType.test.d.ts +2 -0
  5. package/dist/EnumType.test.d.ts.map +1 -0
  6. package/dist/FieldType.d.ts +19 -23
  7. package/dist/FieldType.d.ts.map +1 -1
  8. package/dist/FieldType.js +41 -47
  9. package/dist/FieldType.test.d.ts +2 -0
  10. package/dist/FieldType.test.d.ts.map +1 -0
  11. package/dist/GraphQLSchemaType.d.ts +8 -12
  12. package/dist/GraphQLSchemaType.d.ts.map +1 -1
  13. package/dist/GraphQLSchemaType.js +16 -18
  14. package/dist/GraphQLSchemaType.test.d.ts +2 -0
  15. package/dist/GraphQLSchemaType.test.d.ts.map +1 -0
  16. package/dist/JsonSchemaType.d.ts +67 -63
  17. package/dist/JsonSchemaType.d.ts.map +1 -1
  18. package/dist/JsonSchemaType.js +73 -123
  19. package/dist/JsonSchemaType.test.d.ts +2 -0
  20. package/dist/JsonSchemaType.test.d.ts.map +1 -0
  21. package/dist/ScalarTypeEnum.d.ts +23 -27
  22. package/dist/ScalarTypeEnum.d.ts.map +1 -1
  23. package/dist/ScalarTypeEnum.js +235 -235
  24. package/dist/ScalarTypeEnum.test.d.ts +2 -0
  25. package/dist/ScalarTypeEnum.test.d.ts.map +1 -0
  26. package/dist/SchemaModel.d.ts +38 -39
  27. package/dist/SchemaModel.d.ts.map +1 -1
  28. package/dist/SchemaModel.js +28 -55
  29. package/dist/SchemaModel.test.d.ts +2 -0
  30. package/dist/SchemaModel.test.d.ts.map +1 -0
  31. package/dist/SchemaModelType.d.ts +28 -24
  32. package/dist/SchemaModelType.d.ts.map +1 -1
  33. package/dist/SchemaModelType.js +6 -19
  34. package/dist/SchemaModelType.test.d.ts +2 -0
  35. package/dist/SchemaModelType.test.d.ts.map +1 -0
  36. package/dist/ZodSchemaType.d.ts +44 -40
  37. package/dist/ZodSchemaType.d.ts.map +1 -1
  38. package/dist/ZodSchemaType.js +30 -101
  39. package/dist/ZodSchemaType.test.d.ts +2 -0
  40. package/dist/ZodSchemaType.test.d.ts.map +1 -0
  41. package/dist/browser/EnumType.js +40 -0
  42. package/dist/browser/FieldType.js +43 -0
  43. package/dist/browser/GraphQLSchemaType.js +18 -0
  44. package/dist/browser/JsonSchemaType.js +74 -0
  45. package/dist/browser/ScalarTypeEnum.js +236 -0
  46. package/dist/browser/SchemaModel.js +30 -0
  47. package/dist/browser/SchemaModelType.js +7 -0
  48. package/dist/browser/ZodSchemaType.js +31 -0
  49. package/dist/browser/entity/defineEntity.js +128 -0
  50. package/dist/browser/entity/generator.js +283 -0
  51. package/dist/browser/entity/index.js +410 -0
  52. package/dist/browser/entity/types.js +0 -0
  53. package/dist/browser/index.js +840 -0
  54. package/dist/entity/defineEntity.d.ts +55 -34
  55. package/dist/entity/defineEntity.d.ts.map +1 -1
  56. package/dist/entity/defineEntity.js +123 -231
  57. package/dist/entity/defineEntity.test.d.ts +2 -0
  58. package/dist/entity/defineEntity.test.d.ts.map +1 -0
  59. package/dist/entity/generator.d.ts +16 -20
  60. package/dist/entity/generator.d.ts.map +1 -1
  61. package/dist/entity/generator.js +262 -196
  62. package/dist/entity/generator.test.d.ts +2 -0
  63. package/dist/entity/generator.test.d.ts.map +1 -0
  64. package/dist/entity/index.d.ts +4 -4
  65. package/dist/entity/index.d.ts.map +1 -0
  66. package/dist/entity/index.js +410 -4
  67. package/dist/entity/types.d.ts +99 -103
  68. package/dist/entity/types.d.ts.map +1 -1
  69. package/dist/entity/types.js +1 -1
  70. package/dist/index.d.ts +10 -13
  71. package/dist/index.d.ts.map +1 -0
  72. package/dist/index.js +841 -13
  73. package/dist/node/EnumType.js +40 -0
  74. package/dist/node/FieldType.js +43 -0
  75. package/dist/node/GraphQLSchemaType.js +18 -0
  76. package/dist/node/JsonSchemaType.js +74 -0
  77. package/dist/node/ScalarTypeEnum.js +236 -0
  78. package/dist/node/SchemaModel.js +30 -0
  79. package/dist/node/SchemaModelType.js +7 -0
  80. package/dist/node/ZodSchemaType.js +31 -0
  81. package/dist/node/entity/defineEntity.js +128 -0
  82. package/dist/node/entity/generator.js +283 -0
  83. package/dist/node/entity/index.js +410 -0
  84. package/dist/node/entity/types.js +0 -0
  85. package/dist/node/index.js +840 -0
  86. package/package.json +123 -25
  87. package/dist/EnumType.js.map +0 -1
  88. package/dist/FieldType.js.map +0 -1
  89. package/dist/GraphQLSchemaType.js.map +0 -1
  90. package/dist/JsonSchemaType.js.map +0 -1
  91. package/dist/ScalarTypeEnum.js.map +0 -1
  92. package/dist/SchemaModel.js.map +0 -1
  93. package/dist/SchemaModelType.js.map +0 -1
  94. package/dist/ZodSchemaType.js.map +0 -1
  95. package/dist/entity/defineEntity.js.map +0 -1
  96. package/dist/entity/generator.js.map +0 -1
@@ -1,218 +1,284 @@
1
- //#region src/entity/generator.ts
2
- /**
3
- * Generate Prisma schema content from entity specifications.
4
- */
1
+ // @bun
2
+ // src/entity/generator.ts
5
3
  function generatePrismaSchema(entities, options = {}) {
6
- const { provider = "postgresql", clientOutput = "../../src/generated/prisma", includePothos = true, pothosOutput = "../../src/generated/pothos-types.ts" } = options;
7
- const lines = [];
8
- const schemas = /* @__PURE__ */ new Set();
9
- entities.forEach((entity) => {
10
- if (entity.schema) schemas.add(entity.schema);
11
- });
12
- const schemaList = schemas.size > 0 ? Array.from(schemas) : ["public"];
13
- lines.push("datasource db {");
14
- lines.push(` provider = "${provider}"`);
15
- if (schemas.size > 0) lines.push(` schemas = [${schemaList.map((s) => `"${s}"`).join(", ")}]`);
16
- lines.push("}");
17
- lines.push("");
18
- lines.push("generator client {");
19
- lines.push(" provider = \"prisma-client\"");
20
- lines.push(` output = "${clientOutput}"`);
21
- lines.push("");
22
- lines.push(" engineType = \"client\"");
23
- lines.push(" runtime = \"bun\"");
24
- lines.push(" moduleFormat = \"esm\"");
25
- lines.push(" generatedFileExtension = \"ts\"");
26
- lines.push(" importFileExtension = \"ts\"");
27
- lines.push("}");
28
- lines.push("");
29
- if (includePothos) {
30
- lines.push("generator pothos {");
31
- lines.push(" provider = \"prisma-pothos-types\"");
32
- lines.push(" clientOutput = \"./prisma\"");
33
- lines.push(` output = "${pothosOutput}"`);
34
- lines.push(" generateDatamodel = true");
35
- lines.push(" documentation = false");
36
- lines.push("}");
37
- lines.push("");
38
- }
39
- const enumMap = /* @__PURE__ */ new Map();
40
- entities.forEach((entity) => {
41
- entity.enums?.forEach((enumDef) => {
42
- if (!enumMap.has(enumDef.name)) enumMap.set(enumDef.name, enumDef);
43
- });
44
- Object.values(entity.fields).forEach((field) => {
45
- if (field.kind === "enum" && field.values && !enumMap.has(field.enumName)) enumMap.set(field.enumName, {
46
- name: field.enumName,
47
- values: field.values,
48
- schema: entity.schema
49
- });
50
- });
51
- });
52
- enumMap.forEach((enumDef) => {
53
- lines.push(...generateEnumBlock(enumDef));
54
- lines.push("");
55
- });
56
- entities.forEach((entity) => {
57
- lines.push(...generateModelBlock(entity));
58
- lines.push("");
59
- });
60
- return lines.join("\n");
4
+ const {
5
+ provider = "postgresql",
6
+ clientOutput = "../../src/generated/prisma",
7
+ includePothos = true,
8
+ pothosOutput = "../../src/generated/pothos-types.ts"
9
+ } = options;
10
+ const lines = [];
11
+ const schemas = new Set;
12
+ entities.forEach((entity) => {
13
+ if (entity.schema) {
14
+ schemas.add(entity.schema);
15
+ }
16
+ });
17
+ const schemaList = schemas.size > 0 ? Array.from(schemas) : ["public"];
18
+ lines.push("datasource db {");
19
+ lines.push(` provider = "${provider}"`);
20
+ if (schemas.size > 0) {
21
+ lines.push(` schemas = [${schemaList.map((s) => `"${s}"`).join(", ")}]`);
22
+ }
23
+ lines.push("}");
24
+ lines.push("");
25
+ lines.push("generator client {");
26
+ lines.push(' provider = "prisma-client"');
27
+ lines.push(` output = "${clientOutput}"`);
28
+ lines.push("");
29
+ lines.push(' engineType = "client"');
30
+ lines.push(' runtime = "bun"');
31
+ lines.push(' moduleFormat = "esm"');
32
+ lines.push(' generatedFileExtension = "ts"');
33
+ lines.push(' importFileExtension = "ts"');
34
+ lines.push("}");
35
+ lines.push("");
36
+ if (includePothos) {
37
+ lines.push("generator pothos {");
38
+ lines.push(' provider = "prisma-pothos-types"');
39
+ lines.push(' clientOutput = "./prisma"');
40
+ lines.push(` output = "${pothosOutput}"`);
41
+ lines.push(" generateDatamodel = true");
42
+ lines.push(" documentation = false");
43
+ lines.push("}");
44
+ lines.push("");
45
+ }
46
+ const enumMap = new Map;
47
+ entities.forEach((entity) => {
48
+ entity.enums?.forEach((enumDef) => {
49
+ if (!enumMap.has(enumDef.name)) {
50
+ enumMap.set(enumDef.name, enumDef);
51
+ }
52
+ });
53
+ Object.values(entity.fields).forEach((field) => {
54
+ if (field.kind === "enum" && field.values && !enumMap.has(field.enumName)) {
55
+ enumMap.set(field.enumName, {
56
+ name: field.enumName,
57
+ values: field.values,
58
+ schema: entity.schema
59
+ });
60
+ }
61
+ });
62
+ });
63
+ enumMap.forEach((enumDef) => {
64
+ lines.push(...generateEnumBlock(enumDef));
65
+ lines.push("");
66
+ });
67
+ entities.forEach((entity) => {
68
+ lines.push(...generateModelBlock(entity));
69
+ lines.push("");
70
+ });
71
+ return lines.join(`
72
+ `);
61
73
  }
62
- /**
63
- * Generate Prisma enum block.
64
- */
65
74
  function generateEnumBlock(enumDef) {
66
- const lines = [];
67
- if (enumDef.description) lines.push(`/// ${enumDef.description}`);
68
- lines.push(`enum ${enumDef.name} {`);
69
- enumDef.values.forEach((value) => {
70
- lines.push(` ${value}`);
71
- });
72
- lines.push("");
73
- if (enumDef.schema) lines.push(` @@schema("${enumDef.schema}")`);
74
- lines.push("}");
75
- return lines;
75
+ const lines = [];
76
+ if (enumDef.description) {
77
+ lines.push(`/// ${enumDef.description}`);
78
+ }
79
+ lines.push(`enum ${enumDef.name} {`);
80
+ enumDef.values.forEach((value) => {
81
+ lines.push(` ${value}`);
82
+ });
83
+ lines.push("");
84
+ if (enumDef.schema) {
85
+ lines.push(` @@schema("${enumDef.schema}")`);
86
+ }
87
+ lines.push("}");
88
+ return lines;
76
89
  }
77
- /**
78
- * Generate Prisma model block from entity spec.
79
- */
80
90
  function generateModelBlock(entity) {
81
- const lines = [];
82
- if (entity.description) lines.push(`/// ${entity.description}`);
83
- lines.push(`model ${entity.name} {`);
84
- Object.entries(entity.fields).forEach(([fieldName, field]) => {
85
- const fieldLine = generateFieldLine(fieldName, field);
86
- if (field.description) lines.push(` /// ${field.description}`);
87
- lines.push(` ${fieldLine}`);
88
- });
89
- if (entity.indexes && entity.indexes.length > 0) {
90
- lines.push("");
91
- entity.indexes.forEach((idx) => {
92
- lines.push(` ${generateIndexLine(idx)}`);
93
- });
94
- }
95
- if (entity.map) lines.push(` @@map("${entity.map}")`);
96
- if (entity.schema) lines.push(` @@schema("${entity.schema}")`);
97
- lines.push("}");
98
- return lines;
91
+ const lines = [];
92
+ if (entity.description) {
93
+ lines.push(`/// ${entity.description}`);
94
+ }
95
+ lines.push(`model ${entity.name} {`);
96
+ Object.entries(entity.fields).forEach(([fieldName, field]) => {
97
+ const fieldLine = generateFieldLine(fieldName, field);
98
+ if (field.description) {
99
+ lines.push(` /// ${field.description}`);
100
+ }
101
+ lines.push(` ${fieldLine}`);
102
+ });
103
+ if (entity.indexes && entity.indexes.length > 0) {
104
+ lines.push("");
105
+ entity.indexes.forEach((idx) => {
106
+ lines.push(` ${generateIndexLine(idx)}`);
107
+ });
108
+ }
109
+ if (entity.map) {
110
+ lines.push(` @@map("${entity.map}")`);
111
+ }
112
+ if (entity.schema) {
113
+ lines.push(` @@schema("${entity.schema}")`);
114
+ }
115
+ lines.push("}");
116
+ return lines;
99
117
  }
100
- /**
101
- * Generate a single field line.
102
- */
103
118
  function generateFieldLine(fieldName, field) {
104
- if (field.kind === "scalar") return generateScalarFieldLine(fieldName, field);
105
- else if (field.kind === "enum") return generateEnumFieldLine(fieldName, field);
106
- else if (field.kind === "relation") return generateRelationFieldLine(fieldName, field);
107
- throw new Error(`Unknown field kind: ${field.kind}`);
119
+ if (field.kind === "scalar") {
120
+ return generateScalarFieldLine(fieldName, field);
121
+ } else if (field.kind === "enum") {
122
+ return generateEnumFieldLine(fieldName, field);
123
+ } else if (field.kind === "relation") {
124
+ return generateRelationFieldLine(fieldName, field);
125
+ }
126
+ throw new Error(`Unknown field kind: ${field.kind}`);
108
127
  }
109
- /**
110
- * Generate scalar field line.
111
- */
112
128
  function generateScalarFieldLine(fieldName, field) {
113
- const parts = [fieldName];
114
- let typeStr = field.type;
115
- if (field.isArray) typeStr += "[]";
116
- if (field.isOptional) typeStr += "?";
117
- parts.push(typeStr);
118
- const attrs = [];
119
- if (field.isId) attrs.push("@id");
120
- if (field.default !== void 0) if (typeof field.default === "string" && field.default.includes("(")) attrs.push(`@default(${field.default})`);
121
- else if (typeof field.default === "boolean") attrs.push(`@default(${field.default})`);
122
- else if (typeof field.default === "number") attrs.push(`@default(${field.default})`);
123
- else attrs.push(`@default("${field.default}")`);
124
- if (field.updatedAt) attrs.push("@updatedAt");
125
- if (field.isUnique) attrs.push("@unique");
126
- if (field.map) attrs.push(`@map("${field.map}")`);
127
- if (field.dbType) attrs.push(`@db.${field.dbType}`);
128
- if (attrs.length > 0) parts.push(attrs.join(" "));
129
- return parts.join(" ");
129
+ const parts = [fieldName];
130
+ let typeStr = field.type;
131
+ if (field.isArray) {
132
+ typeStr += "[]";
133
+ }
134
+ if (field.isOptional) {
135
+ typeStr += "?";
136
+ }
137
+ parts.push(typeStr);
138
+ const attrs = [];
139
+ if (field.isId) {
140
+ attrs.push("@id");
141
+ }
142
+ if (field.default !== undefined) {
143
+ if (typeof field.default === "string" && field.default.includes("(")) {
144
+ attrs.push(`@default(${field.default})`);
145
+ } else if (typeof field.default === "boolean") {
146
+ attrs.push(`@default(${field.default})`);
147
+ } else if (typeof field.default === "number") {
148
+ attrs.push(`@default(${field.default})`);
149
+ } else {
150
+ attrs.push(`@default("${field.default}")`);
151
+ }
152
+ }
153
+ if (field.updatedAt) {
154
+ attrs.push("@updatedAt");
155
+ }
156
+ if (field.isUnique) {
157
+ attrs.push("@unique");
158
+ }
159
+ if (field.map) {
160
+ attrs.push(`@map("${field.map}")`);
161
+ }
162
+ if (field.dbType) {
163
+ attrs.push(`@db.${field.dbType}`);
164
+ }
165
+ if (attrs.length > 0) {
166
+ parts.push(attrs.join(" "));
167
+ }
168
+ return parts.join(" ");
130
169
  }
131
- /**
132
- * Generate enum field line.
133
- */
134
170
  function generateEnumFieldLine(fieldName, field) {
135
- const parts = [fieldName];
136
- let typeStr = field.enumName;
137
- if (field.isArray) typeStr += "[]";
138
- if (field.isOptional) typeStr += "?";
139
- parts.push(typeStr);
140
- const attrs = [];
141
- if (field.default !== void 0) attrs.push(`@default(${field.default})`);
142
- if (field.isUnique) attrs.push("@unique");
143
- if (field.map) attrs.push(`@map("${field.map}")`);
144
- if (attrs.length > 0) parts.push(attrs.join(" "));
145
- return parts.join(" ");
171
+ const parts = [fieldName];
172
+ let typeStr = field.enumName;
173
+ if (field.isArray) {
174
+ typeStr += "[]";
175
+ }
176
+ if (field.isOptional) {
177
+ typeStr += "?";
178
+ }
179
+ parts.push(typeStr);
180
+ const attrs = [];
181
+ if (field.default !== undefined) {
182
+ attrs.push(`@default(${field.default})`);
183
+ }
184
+ if (field.isUnique) {
185
+ attrs.push("@unique");
186
+ }
187
+ if (field.map) {
188
+ attrs.push(`@map("${field.map}")`);
189
+ }
190
+ if (attrs.length > 0) {
191
+ parts.push(attrs.join(" "));
192
+ }
193
+ return parts.join(" ");
146
194
  }
147
- /**
148
- * Generate relation field line.
149
- */
150
195
  function generateRelationFieldLine(fieldName, field) {
151
- const parts = [fieldName];
152
- let typeStr = field.target;
153
- if (field.type === "hasMany") typeStr += "[]";
154
- if (field.type === "hasOne") typeStr += "?";
155
- parts.push(typeStr);
156
- const relationParts = [];
157
- if (field.name) relationParts.push(`name: "${field.name}"`);
158
- if (field.fields && field.fields.length > 0) relationParts.push(`fields: [${field.fields.join(", ")}]`);
159
- if (field.references && field.references.length > 0) relationParts.push(`references: [${field.references.join(", ")}]`);
160
- if (field.onDelete) relationParts.push(`onDelete: ${field.onDelete}`);
161
- if (field.onUpdate) relationParts.push(`onUpdate: ${field.onUpdate}`);
162
- if (relationParts.length > 0) parts.push(`@relation(${relationParts.join(", ")})`);
163
- return parts.join(" ");
196
+ const parts = [fieldName];
197
+ let typeStr = field.target;
198
+ if (field.type === "hasMany") {
199
+ typeStr += "[]";
200
+ }
201
+ if (field.type === "hasOne") {
202
+ typeStr += "?";
203
+ }
204
+ parts.push(typeStr);
205
+ const relationParts = [];
206
+ if (field.name) {
207
+ relationParts.push(`name: "${field.name}"`);
208
+ }
209
+ if (field.fields && field.fields.length > 0) {
210
+ relationParts.push(`fields: [${field.fields.join(", ")}]`);
211
+ }
212
+ if (field.references && field.references.length > 0) {
213
+ relationParts.push(`references: [${field.references.join(", ")}]`);
214
+ }
215
+ if (field.onDelete) {
216
+ relationParts.push(`onDelete: ${field.onDelete}`);
217
+ }
218
+ if (field.onUpdate) {
219
+ relationParts.push(`onUpdate: ${field.onUpdate}`);
220
+ }
221
+ if (relationParts.length > 0) {
222
+ parts.push(`@relation(${relationParts.join(", ")})`);
223
+ }
224
+ return parts.join(" ");
164
225
  }
165
- /**
166
- * Generate index line.
167
- */
168
226
  function generateIndexLine(idx) {
169
- const fieldList = idx.fields.join(", ");
170
- const parts = [];
171
- if (idx.unique) parts.push(`@@unique([${fieldList}]`);
172
- else parts.push(`@@index([${fieldList}]`);
173
- const options = [];
174
- if (idx.name) options.push(`name: "${idx.name}"`);
175
- if (idx.type) options.push(`type: ${idx.type}`);
176
- if (options.length > 0) parts[0] += `, ${options.join(", ")}`;
177
- parts[0] += ")";
178
- return parts.join("");
227
+ const fieldList = idx.fields.join(", ");
228
+ const parts = [];
229
+ if (idx.unique) {
230
+ parts.push(`@@unique([${fieldList}]`);
231
+ } else {
232
+ parts.push(`@@index([${fieldList}]`);
233
+ }
234
+ const options = [];
235
+ if (idx.name) {
236
+ options.push(`name: "${idx.name}"`);
237
+ }
238
+ if (idx.type) {
239
+ options.push(`type: ${idx.type}`);
240
+ }
241
+ if (options.length > 0) {
242
+ parts[0] += `, ${options.join(", ")}`;
243
+ }
244
+ parts[0] += ")";
245
+ return parts.join("");
179
246
  }
180
- /**
181
- * Compose multiple module schema contributions into a single schema.
182
- */
183
247
  function composeModuleSchemas(contributions, options = {}) {
184
- const allEntities = [];
185
- const allEnums = /* @__PURE__ */ new Map();
186
- contributions.forEach((contrib) => {
187
- contrib.entities.forEach((entity) => {
188
- allEntities.push({
189
- ...entity,
190
- module: contrib.moduleId
191
- });
192
- });
193
- contrib.enums?.forEach((enumDef) => {
194
- if (!allEnums.has(enumDef.name)) allEnums.set(enumDef.name, enumDef);
195
- });
196
- });
197
- if (allEntities[0] && allEnums.size > 0) allEntities[0] = {
198
- ...allEntities[0],
199
- enums: [...allEntities[0].enums ?? [], ...allEnums.values()]
200
- };
201
- return generatePrismaSchema(allEntities, options);
248
+ const allEntities = [];
249
+ const allEnums = new Map;
250
+ contributions.forEach((contrib) => {
251
+ contrib.entities.forEach((entity) => {
252
+ allEntities.push({
253
+ ...entity,
254
+ module: contrib.moduleId
255
+ });
256
+ });
257
+ contrib.enums?.forEach((enumDef) => {
258
+ if (!allEnums.has(enumDef.name)) {
259
+ allEnums.set(enumDef.name, enumDef);
260
+ }
261
+ });
262
+ });
263
+ if (allEntities[0] && allEnums.size > 0) {
264
+ allEntities[0] = {
265
+ ...allEntities[0],
266
+ enums: [...allEntities[0].enums ?? [], ...allEnums.values()]
267
+ };
268
+ }
269
+ return generatePrismaSchema(allEntities, options);
202
270
  }
203
- /**
204
- * Generate a single entity's Prisma schema fragment (for modular output).
205
- */
206
271
  function generateEntityFragment(entity) {
207
- return generateModelBlock(entity).join("\n");
272
+ return generateModelBlock(entity).join(`
273
+ `);
208
274
  }
209
- /**
210
- * Generate a single enum's Prisma schema fragment (for modular output).
211
- */
212
275
  function generateEnumFragment(enumDef) {
213
- return generateEnumBlock(enumDef).join("\n");
276
+ return generateEnumBlock(enumDef).join(`
277
+ `);
214
278
  }
215
-
216
- //#endregion
217
- export { composeModuleSchemas, generateEntityFragment, generateEnumFragment, generatePrismaSchema };
218
- //# sourceMappingURL=generator.js.map
279
+ export {
280
+ generatePrismaSchema,
281
+ generateEnumFragment,
282
+ generateEntityFragment,
283
+ composeModuleSchemas
284
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=generator.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.test.d.ts","sourceRoot":"","sources":["../../src/entity/generator.test.ts"],"names":[],"mappings":""}
@@ -1,4 +1,4 @@
1
- import { EntityEnumDef, EntityEnumField, EntityField, EntityIndex, EntityRelationField, EntityScalarField, EntitySpec, ModuleSchemaContribution, PrismaFieldModifiers, PrismaScalarType, RelationType } from "./types.js";
2
- import { defineEntity, defineEntityEnum, field, index } from "./defineEntity.js";
3
- import { PrismaGeneratorOptions, composeModuleSchemas, generateEntityFragment, generateEnumFragment, generatePrismaSchema } from "./generator.js";
4
- export { EntityEnumDef, EntityEnumField, EntityField, EntityIndex, EntityRelationField, EntityScalarField, EntitySpec, ModuleSchemaContribution, PrismaFieldModifiers, PrismaGeneratorOptions, PrismaScalarType, RelationType, composeModuleSchemas, defineEntity, defineEntityEnum, field, generateEntityFragment, generateEnumFragment, generatePrismaSchema, index };
1
+ export * from './types';
2
+ export * from './defineEntity';
3
+ export * from './generator';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/entity/index.ts"],"names":[],"mappings":"AACA,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC"}