hekireki 0.8.0 → 0.8.1

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/bin/ajv.js CHANGED
@@ -1,8 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { t as registerGenerator } from "../bin-BDZ9aq7E.js";
3
-
2
+ import { t as registerGenerator } from "../bin-BqlsEIc6.js";
4
3
  //#region src/bin/ajv.ts
5
4
  registerGenerator("ajv");
6
-
7
5
  //#endregion
8
- export { };
6
+ export {};
@@ -1,8 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { t as registerGenerator } from "../bin-BDZ9aq7E.js";
3
-
2
+ import { t as registerGenerator } from "../bin-BqlsEIc6.js";
4
3
  //#region src/bin/arktype.ts
5
4
  registerGenerator("arktype");
6
-
7
5
  //#endregion
8
- export { };
6
+ export {};
package/dist/bin/dbml.js CHANGED
@@ -1,8 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { t as registerGenerator } from "../bin-BDZ9aq7E.js";
3
-
2
+ import { t as registerGenerator } from "../bin-BqlsEIc6.js";
4
3
  //#region src/bin/dbml.ts
5
4
  registerGenerator("dbml");
6
-
7
5
  //#endregion
8
- export { };
6
+ export {};
package/dist/bin/docs.js CHANGED
@@ -1,8 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { t as registerGenerator } from "../bin-BDZ9aq7E.js";
3
-
2
+ import { t as registerGenerator } from "../bin-BqlsEIc6.js";
4
3
  //#region src/bin/docs.ts
5
4
  registerGenerator("docs");
6
-
7
5
  //#endregion
8
- export { };
6
+ export {};
@@ -1,8 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { t as registerGenerator } from "../bin-BDZ9aq7E.js";
3
-
2
+ import { t as registerGenerator } from "../bin-BqlsEIc6.js";
4
3
  //#region src/bin/drizzle.ts
5
4
  registerGenerator("drizzle");
6
-
7
5
  //#endregion
8
- export { };
6
+ export {};
package/dist/bin/ecto.js CHANGED
@@ -1,8 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { t as registerGenerator } from "../bin-BDZ9aq7E.js";
3
-
2
+ import { t as registerGenerator } from "../bin-BqlsEIc6.js";
4
3
  //#region src/bin/ecto.ts
5
4
  registerGenerator("ecto");
6
-
7
5
  //#endregion
8
- export { };
6
+ export {};
@@ -1,8 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { t as registerGenerator } from "../bin-BDZ9aq7E.js";
3
-
2
+ import { t as registerGenerator } from "../bin-BqlsEIc6.js";
4
3
  //#region src/bin/effect.ts
5
4
  registerGenerator("effect");
6
-
7
5
  //#endregion
8
- export { };
6
+ export {};
package/dist/bin/gorm.js CHANGED
@@ -1,8 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { t as registerGenerator } from "../bin-BDZ9aq7E.js";
3
-
2
+ import { t as registerGenerator } from "../bin-BqlsEIc6.js";
4
3
  //#region src/bin/gorm.ts
5
4
  registerGenerator("gorm");
6
-
7
5
  //#endregion
8
- export { };
6
+ export {};
@@ -1,8 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { t as registerGenerator } from "../bin-BDZ9aq7E.js";
3
-
2
+ import { t as registerGenerator } from "../bin-BqlsEIc6.js";
4
3
  //#region src/bin/mermaid-er.ts
5
4
  registerGenerator("mermaid-er");
6
-
7
5
  //#endregion
8
- export { };
6
+ export {};
@@ -1,8 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { t as registerGenerator } from "../bin-BDZ9aq7E.js";
3
-
2
+ import { t as registerGenerator } from "../bin-BqlsEIc6.js";
4
3
  //#region src/bin/sea-orm.ts
5
4
  registerGenerator("sea-orm");
6
-
7
5
  //#endregion
8
- export { };
6
+ export {};
@@ -1,8 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { t as registerGenerator } from "../bin-BDZ9aq7E.js";
3
-
2
+ import { t as registerGenerator } from "../bin-BqlsEIc6.js";
4
3
  //#region src/bin/sqlalchemy.ts
5
4
  registerGenerator("sqlalchemy");
6
-
7
5
  //#endregion
8
- export { };
6
+ export {};
@@ -1,8 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { t as registerGenerator } from "../bin-BDZ9aq7E.js";
3
-
2
+ import { t as registerGenerator } from "../bin-BqlsEIc6.js";
4
3
  //#region src/bin/typebox.ts
5
4
  registerGenerator("typebox");
6
-
7
5
  //#endregion
8
- export { };
6
+ export {};
@@ -1,8 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { t as registerGenerator } from "../bin-BDZ9aq7E.js";
3
-
2
+ import { t as registerGenerator } from "../bin-BqlsEIc6.js";
4
3
  //#region src/bin/valibot.ts
5
4
  registerGenerator("valibot");
6
-
7
5
  //#endregion
8
- export { };
6
+ export {};
package/dist/bin/zod.js CHANGED
@@ -1,8 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { t as registerGenerator } from "../bin-BDZ9aq7E.js";
3
-
2
+ import { t as registerGenerator } from "../bin-BqlsEIc6.js";
4
3
  //#region src/bin/zod.ts
5
4
  registerGenerator("zod");
6
-
7
5
  //#endregion
8
- export { };
6
+ export {};
@@ -1,4 +1,4 @@
1
- import fs from "node:fs";
1
+ import "node:fs";
2
2
  import path from "node:path";
3
3
  import pkg from "@prisma/generator-helper";
4
4
  import { format } from "oxfmt";
@@ -8,7 +8,6 @@ import { run } from "@softwaretechnik/dbml-renderer";
8
8
  import { Style, css } from "hono/css";
9
9
  import { raw } from "hono/html";
10
10
  import { Fragment, jsx, jsxs } from "hono/jsx/jsx-runtime";
11
-
12
11
  //#region src/format/index.ts
13
12
  async function fmt(input) {
14
13
  const { code, errors } = await format("<stdin>.ts", input, {
@@ -25,7 +24,6 @@ async function fmt(input) {
25
24
  value: code
26
25
  };
27
26
  }
28
-
29
27
  //#endregion
30
28
  //#region src/fsp/index.ts
31
29
  async function mkdir(dir) {
@@ -70,7 +68,6 @@ async function writeFileBinary(path, data) {
70
68
  };
71
69
  }
72
70
  }
73
-
74
71
  //#endregion
75
72
  //#region src/emit/index.ts
76
73
  async function emit(code, dir, output) {
@@ -125,28 +122,6 @@ async function emitMany(files, dir) {
125
122
  value: void 0
126
123
  };
127
124
  }
128
-
129
- //#endregion
130
- //#region src/helper/extract-relations.ts
131
- function collectRelationProps(models) {
132
- return models.flatMap((m) => m.fields.filter((f) => f.kind === "object").map((f) => ({
133
- model: m.name,
134
- key: f.name,
135
- targetModel: f.type,
136
- isMany: f.isList
137
- })));
138
- }
139
- function makeRelationsOnly(dmmf, includeType, makeRelations) {
140
- const models = dmmf.datamodel.models;
141
- const relIndex = collectRelationProps(models);
142
- const relByModel = Object.groupBy(relIndex, (r) => r.model);
143
- return models.map((model) => makeRelations(model, (relByModel[model.name] ?? []).map(({ key, targetModel, isMany }) => ({
144
- key,
145
- targetModel,
146
- isMany
147
- })), { includeType })).filter((code) => Boolean(code)).join("\n\n");
148
- }
149
-
150
125
  //#endregion
151
126
  //#region src/utils/index.ts
152
127
  function getString(v, fallback) {
@@ -245,7 +220,6 @@ function schemaFromFields(modelFields, comment, schemaBuilder, propertiesGenerat
245
220
  const modelName = modelFields[0].modelName;
246
221
  return schemaBuilder(modelName, propertiesGenerator(modelFields, comment), objectType);
247
222
  }
248
-
249
223
  //#endregion
250
224
  //#region src/helper/validation-schema.ts
251
225
  function validationSchemas(models, type, comment, config) {
@@ -300,9 +274,8 @@ function validationSchemas(models, type, comment, config) {
300
274
  schemas
301
275
  ].join("\n") : schemas;
302
276
  }
303
-
304
277
  //#endregion
305
- //#region src/core/ajv.ts
278
+ //#region src/helper/ajv.ts
306
279
  function makeAjvInfer(modelName) {
307
280
  return `export type ${modelName} = FromSchema<typeof ${modelName}Schema>`;
308
281
  }
@@ -348,9 +321,33 @@ function ajvSchemaCode(models, type, comment, enums) {
348
321
  formatEnum: makeAjvEnumExpression
349
322
  });
350
323
  }
324
+ //#endregion
325
+ //#region src/helper/extract-relations.ts
326
+ function collectRelationProps(models) {
327
+ return models.flatMap((m) => m.fields.filter((f) => f.kind === "object").map((f) => ({
328
+ model: m.name,
329
+ key: f.name,
330
+ targetModel: f.type,
331
+ isMany: f.isList
332
+ })));
333
+ }
334
+ function makeRelationsOnly(dmmf, includeType, makeRelations) {
335
+ const models = dmmf.datamodel.models;
336
+ const relIndex = collectRelationProps(models);
337
+ const relByModel = Object.groupBy(relIndex, (r) => r.model);
338
+ return models.map((model) => makeRelations(model, (relByModel[model.name] ?? []).map(({ key, targetModel, isMany }) => ({
339
+ key,
340
+ targetModel,
341
+ isMany
342
+ })), { includeType })).filter((code) => Boolean(code)).join("\n\n");
343
+ }
344
+ //#endregion
345
+ //#region src/generator/ajv.ts
351
346
  function ajvCode(dmmf, type, comment, relation) {
352
347
  return [ajvSchemaCode(dmmf.datamodel.models, type, comment, dmmf.datamodel.enums), relation ? makeRelationsOnly(dmmf, type, makeAjvRelations) : ""].filter(Boolean).join("\n\n");
353
348
  }
349
+ //#endregion
350
+ //#region src/core/ajv.ts
354
351
  async function ajv(options) {
355
352
  if (!(options.generator.isCustomOutput && options.generator.output?.value)) return {
356
353
  ok: false,
@@ -366,9 +363,8 @@ async function ajv(options) {
366
363
  };
367
364
  return emit(ajvCode(options.dmmf, getBool(options.generator.config?.type), getBool(options.generator.config?.comment), getBool(options.generator.config?.relation)), resolved.dir, resolved.file);
368
365
  }
369
-
370
366
  //#endregion
371
- //#region src/core/arktype.ts
367
+ //#region src/helper/arktype.ts
372
368
  function makeArktypeInfer(modelName) {
373
369
  return `export type ${modelName} = typeof ${modelName}Schema.infer`;
374
370
  }
@@ -417,9 +413,13 @@ function arktypeSchemaCode(models, type, comment, enums) {
417
413
  formatEnum: makeArktypeEnumExpression
418
414
  });
419
415
  }
416
+ //#endregion
417
+ //#region src/generator/arktype.ts
420
418
  function arktypeCode(dmmf, type, comment, relation) {
421
419
  return [arktypeSchemaCode(dmmf.datamodel.models, type, comment, dmmf.datamodel.enums), relation ? makeRelationsOnly(dmmf, type, makeArktypeRelations) : ""].filter(Boolean).join("\n\n");
422
420
  }
421
+ //#endregion
422
+ //#region src/core/arktype.ts
423
423
  async function arktype(options) {
424
424
  if (!(options.generator.isCustomOutput && options.generator.output?.value)) return {
425
425
  ok: false,
@@ -435,9 +435,8 @@ async function arktype(options) {
435
435
  };
436
436
  return emit(arktypeCode(options.dmmf, getBool(options.generator.config?.type), getBool(options.generator.config?.comment), getBool(options.generator.config?.relation)), resolved.dir, resolved.file);
437
437
  }
438
-
439
438
  //#endregion
440
- //#region src/core/dbml.ts
439
+ //#region src/helper/dbml.ts
441
440
  function escapeNote(str) {
442
441
  return str.replace(/'/g, "\\'");
443
442
  }
@@ -553,6 +552,8 @@ function makeRelations$1(models, mapToDbSchema = false) {
553
552
  });
554
553
  }));
555
554
  }
555
+ //#endregion
556
+ //#region src/generator/dbml.ts
556
557
  function dbmlContent(datamodel, mapToDbSchema = false) {
557
558
  const tables = makeTables(datamodel.models, mapToDbSchema);
558
559
  const enums = makeEnums(datamodel.enums);
@@ -566,6 +567,8 @@ function dbmlContent(datamodel, mapToDbSchema = false) {
566
567
  function dbmlToPng(dbml) {
567
568
  return new Resvg(run(dbml, "svg"), { font: { loadSystemFonts: true } }).render().asPng();
568
569
  }
570
+ //#endregion
571
+ //#region src/core/dbml.ts
569
572
  function resolveOutPath(output) {
570
573
  if (path.extname(output)) return output;
571
574
  return path.join(output, "schema.dbml");
@@ -581,9 +584,8 @@ async function dbml(options) {
581
584
  const outPath = resolveOutPath(output);
582
585
  return emitRaw(outPath.endsWith(".png") ? dbmlToPng(content) : content, path.dirname(outPath), outPath);
583
586
  }
584
-
585
587
  //#endregion
586
- //#region src/core/docs/generator/transformDMMF.ts
588
+ //#region src/helper/docs/generator/transformDMMF.ts
587
589
  const getMappings = (mappings, datamodel) => {
588
590
  return mappings.modelOperations.filter((mapping) => {
589
591
  const model = datamodel.models.find((m) => m.name === mapping.model);
@@ -609,9 +611,8 @@ const transformDMMF = (dmmf) => {
609
611
  mappings: getMappings(dmmf.mappings, dmmf.datamodel)
610
612
  };
611
613
  };
612
-
613
614
  //#endregion
614
- //#region src/core/docs/styles.ts
615
+ //#region src/helper/docs/styles.ts
615
616
  const globalCss = css`
616
617
  :-hono-global {
617
618
  :root {
@@ -831,9 +832,8 @@ const mb2Class = css`
831
832
  const ml4Class = css`
832
833
  margin-left: 1rem;
833
834
  `;
834
-
835
835
  //#endregion
836
- //#region src/core/docs/generator/helpers.ts
836
+ //#region src/helper/docs/generator/helpers.ts
837
837
  const capitalize = (str) => str[0].toUpperCase() + str.slice(1);
838
838
  const lowerCase = (name) => name.substring(0, 1).toLowerCase() + name.substring(1);
839
839
  const primitiveTypes = [
@@ -846,9 +846,8 @@ const primitiveTypes = [
846
846
  "Null"
847
847
  ];
848
848
  const isScalarType = (type) => primitiveTypes.includes(type);
849
-
850
849
  //#endregion
851
- //#region src/core/docs/generator/apitypes.tsx
850
+ //#region src/helper/docs/generator/apitypes.tsx
852
851
  const TypeRefLink = ({ typeRef, kind }) => {
853
852
  const typeName = typeRef.type;
854
853
  if (isScalarType(typeName)) return /* @__PURE__ */ jsx(Fragment, { children: typeName });
@@ -946,9 +945,8 @@ const getTypesData = (d) => {
946
945
  const createTypes = (d) => {
947
946
  return /* @__PURE__ */ jsx(TypesSection, { data: getTypesData(d) });
948
947
  };
949
-
950
948
  //#endregion
951
- //#region src/core/docs/generator/model.tsx
949
+ //#region src/helper/docs/generator/model.tsx
952
950
  const ModelAction = {
953
951
  create: "create",
954
952
  deleteMany: "deleteMany",
@@ -1312,9 +1310,8 @@ const getModelData = (d) => ({ models: getModels$1(d) });
1312
1310
  const createModels = (d) => {
1313
1311
  return /* @__PURE__ */ jsx(ModelsSection, { data: getModelData(d) });
1314
1312
  };
1315
-
1316
1313
  //#endregion
1317
- //#region src/core/docs/generator/toc.tsx
1314
+ //#region src/helper/docs/generator/toc.tsx
1318
1315
  const TOCSubHeader = ({ name }) => /* @__PURE__ */ jsx("div", {
1319
1316
  class: tocSubHeaderClass,
1320
1317
  children: /* @__PURE__ */ jsx("a", {
@@ -1442,9 +1439,8 @@ const getTOCData = (d) => ({
1442
1439
  const createTOC = (d) => {
1443
1440
  return /* @__PURE__ */ jsx(TOCComponent, { data: getTOCData(d) });
1444
1441
  };
1445
-
1446
1442
  //#endregion
1447
- //#region src/core/docs/printer/index.tsx
1443
+ //#region src/helper/docs/printer/index.tsx
1448
1444
  const HekirekiLogo = () => /* @__PURE__ */ jsxs("svg", {
1449
1445
  width: "40",
1450
1446
  height: "40",
@@ -1535,7 +1531,11 @@ const generateHTML = (data) => {
1535
1531
  })]
1536
1532
  }) })).toString()}`;
1537
1533
  };
1538
-
1534
+ //#endregion
1535
+ //#region src/generator/docs.ts
1536
+ function docsHTML(dmmf) {
1537
+ return generateHTML(transformDMMF(dmmf));
1538
+ }
1539
1539
  //#endregion
1540
1540
  //#region src/core/docs.ts
1541
1541
  async function docs(options) {
@@ -1544,11 +1544,10 @@ async function docs(options) {
1544
1544
  error: "output is required for Hekireki-Docs. Please specify output in your generator config."
1545
1545
  };
1546
1546
  const output = options.generator.output.value;
1547
- return emitRaw(generateHTML(transformDMMF(options.dmmf)), output, path.join(output, "index.html"));
1547
+ return emitRaw(docsHTML(options.dmmf), output, path.join(output, "index.html"));
1548
1548
  }
1549
-
1550
1549
  //#endregion
1551
- //#region src/core/drizzle.ts
1550
+ //#region src/helper/drizzle.ts
1552
1551
  function resolveDbProvider(provider) {
1553
1552
  switch (provider) {
1554
1553
  case "postgresql":
@@ -1906,6 +1905,8 @@ function makeRelations(models, imports) {
1906
1905
  return `export const ${modelVar}Relations = relations(${modelVar}, ({ ${[needsOne ? "one" : "", needsMany ? "many" : ""].filter(Boolean).join(", ")} }) => ({ ${fieldLines} }))`;
1907
1906
  });
1908
1907
  }
1908
+ //#endregion
1909
+ //#region src/generator/drizzle.ts
1909
1910
  function drizzleSchema(datamodel, provider, indexes) {
1910
1911
  const db = resolveDbProvider(provider);
1911
1912
  const imports = createImports();
@@ -1930,6 +1931,8 @@ function parsePrismaProvider(raw) {
1930
1931
  error: `Unsupported provider: ${raw}`
1931
1932
  };
1932
1933
  }
1934
+ //#endregion
1935
+ //#region src/core/drizzle.ts
1933
1936
  async function drizzle(options) {
1934
1937
  if (!(options.generator.isCustomOutput && options.generator.output?.value)) return {
1935
1938
  ok: false,
@@ -1947,9 +1950,8 @@ async function drizzle(options) {
1947
1950
  };
1948
1951
  return emit(drizzleSchema(options.dmmf.datamodel, providerResult.value, options.dmmf.datamodel.indexes), resolved.dir, resolved.file);
1949
1952
  }
1950
-
1951
1953
  //#endregion
1952
- //#region src/core/ecto.ts
1954
+ //#region src/helper/ecto.ts
1953
1955
  function prismaTypeToEctoType(type) {
1954
1956
  if (type === "Int") return "integer";
1955
1957
  if (type === "BigInt") return "integer";
@@ -2210,12 +2212,16 @@ function ectoSchemas(models, app, allModels, enums) {
2210
2212
  ].join("\n");
2211
2213
  }).filter(Boolean).join("\n\n");
2212
2214
  }
2215
+ //#endregion
2216
+ //#region src/generator/ecto.ts
2213
2217
  function ectoSchemaFiles(models, app, enums) {
2214
2218
  return models.map((model) => ({
2215
2219
  fileName: `${makeSnakeCase(model.name)}.ex`,
2216
2220
  code: ectoSchemas([model], app, models, enums)
2217
2221
  })).filter((entry) => entry.code.trim().length > 0);
2218
2222
  }
2223
+ //#endregion
2224
+ //#region src/core/ecto.ts
2219
2225
  async function ecto(options) {
2220
2226
  if (!(options.generator.isCustomOutput && options.generator.output?.value)) return {
2221
2227
  ok: false,
@@ -2226,9 +2232,8 @@ async function ecto(options) {
2226
2232
  const enums = options.dmmf.datamodel.enums;
2227
2233
  return emitMany(ectoSchemaFiles(options.dmmf.datamodel.models, app, enums), outDir);
2228
2234
  }
2229
-
2230
2235
  //#endregion
2231
- //#region src/core/effect.ts
2236
+ //#region src/helper/effect.ts
2232
2237
  function makeEffectInfer(modelName) {
2233
2238
  return `export type ${modelName}Encoded = typeof ${modelName}Schema.Encoded`;
2234
2239
  }
@@ -2277,9 +2282,13 @@ function effectSchemaCode(models, type, comment, enums) {
2277
2282
  formatEnum: makeEffectEnumExpression
2278
2283
  });
2279
2284
  }
2285
+ //#endregion
2286
+ //#region src/generator/effect.ts
2280
2287
  function effectCode(dmmf, type, comment, relation) {
2281
2288
  return [effectSchemaCode(dmmf.datamodel.models, type, comment, dmmf.datamodel.enums), relation ? makeRelationsOnly(dmmf, type, makeEffectRelations) : ""].filter(Boolean).join("\n\n");
2282
2289
  }
2290
+ //#endregion
2291
+ //#region src/core/effect.ts
2283
2292
  async function effect(options) {
2284
2293
  if (!(options.generator.isCustomOutput && options.generator.output?.value)) return {
2285
2294
  ok: false,
@@ -2295,9 +2304,8 @@ async function effect(options) {
2295
2304
  };
2296
2305
  return emit(effectCode(options.dmmf, getBool(options.generator.config?.type), getBool(options.generator.config?.comment), getBool(options.generator.config?.relation)), resolved.dir, resolved.file);
2297
2306
  }
2298
-
2299
2307
  //#endregion
2300
- //#region src/core/gorm.ts
2308
+ //#region src/helper/gorm.ts
2301
2309
  const PRISMA_TO_GO = {
2302
2310
  String: "string",
2303
2311
  Int: "int",
@@ -2586,6 +2594,8 @@ function formatImports(imports) {
2586
2594
  ")"
2587
2595
  ];
2588
2596
  }
2597
+ //#endregion
2598
+ //#region src/generator/gorm.ts
2589
2599
  function generateGormModels(models, enums, indexes, packageName = "model") {
2590
2600
  const idx = indexes ?? [];
2591
2601
  const modelBodies = models.map((model) => generateModelStruct(model, models, enums, idx)).filter((body) => body !== null);
@@ -2597,6 +2607,8 @@ function generateGormModels(models, enums, indexes, packageName = "model") {
2597
2607
  ""
2598
2608
  ].join("\n");
2599
2609
  }
2610
+ //#endregion
2611
+ //#region src/core/gorm.ts
2600
2612
  async function gorm(options) {
2601
2613
  if (!(options.generator.isCustomOutput && options.generator.output?.value)) return {
2602
2614
  ok: false,
@@ -2609,9 +2621,8 @@ async function gorm(options) {
2609
2621
  const indexes = options.dmmf.datamodel.indexes;
2610
2622
  return emitRaw(generateGormModels(options.dmmf.datamodel.models, enums, indexes, packageName), path.dirname(outPath), outPath);
2611
2623
  }
2612
-
2613
2624
  //#endregion
2614
- //#region src/core/mermaid-er.ts
2625
+ //#region src/helper/mermaid-er.ts
2615
2626
  function removeDuplicateRelations(relations) {
2616
2627
  return [...new Set(relations)];
2617
2628
  }
@@ -2648,6 +2659,8 @@ function extractRelationsFromDmmf(models) {
2648
2659
  return ` ${fromModel} ${RELATIONSHIPS.one}--${RELATIONSHIPS[toCardinality]} ${toModel} : "(${fromField}) - (${toField})"`;
2649
2660
  }));
2650
2661
  }
2662
+ //#endregion
2663
+ //#region src/generator/mermaid-er.ts
2651
2664
  const ER_HEADER = ["```mermaid", "erDiagram"];
2652
2665
  const ER_FOOTER = ["```"];
2653
2666
  function erContent(models) {
@@ -2660,6 +2673,8 @@ function erContent(models) {
2660
2673
  ...ER_FOOTER
2661
2674
  ];
2662
2675
  }
2676
+ //#endregion
2677
+ //#region src/core/mermaid-er.ts
2663
2678
  async function mermaidEr(options) {
2664
2679
  if (!(options.generator.isCustomOutput && options.generator.output?.value)) return {
2665
2680
  ok: false,
@@ -2676,9 +2691,8 @@ async function mermaidEr(options) {
2676
2691
  };
2677
2692
  return emitRaw(content.join("\n"), resolved.dir, resolved.file);
2678
2693
  }
2679
-
2680
2694
  //#endregion
2681
- //#region src/core/sea-orm.ts
2695
+ //#region src/helper/sea-orm.ts
2682
2696
  const PRISMA_TO_RUST = {
2683
2697
  String: "String",
2684
2698
  Int: "i32",
@@ -3034,6 +3048,8 @@ function collectM2MPairs(models) {
3034
3048
  return true;
3035
3049
  });
3036
3050
  }
3051
+ //#endregion
3052
+ //#region src/generator/sea-orm.ts
3037
3053
  function seaOrmFiles(models, enums, serde = {}) {
3038
3054
  const useLines = ["use sea_orm::entity::prelude::*;", "use serde::{Deserialize, Serialize};"];
3039
3055
  const enumFiles = enums.map((e) => ({
@@ -3079,6 +3095,8 @@ function seaOrmFiles(models, enums, serde = {}) {
3079
3095
  code
3080
3096
  })), modEntry];
3081
3097
  }
3098
+ //#endregion
3099
+ //#region src/core/sea-orm.ts
3082
3100
  async function seaOrm(options) {
3083
3101
  if (!(options.generator.isCustomOutput && options.generator.output?.value)) return {
3084
3102
  ok: false,
@@ -3089,9 +3107,8 @@ async function seaOrm(options) {
3089
3107
  const enums = options.dmmf.datamodel.enums;
3090
3108
  return emitMany(seaOrmFiles(options.dmmf.datamodel.models, enums, serde), outDir);
3091
3109
  }
3092
-
3093
3110
  //#endregion
3094
- //#region src/core/sqlalchemy.ts
3111
+ //#region src/helper/sqlalchemy.ts
3095
3112
  const PRISMA_TO_PYTHON = {
3096
3113
  String: "str",
3097
3114
  Int: "int",
@@ -3491,6 +3508,8 @@ function collectGlobalImports(models, _enums, indexes, m2mTables) {
3491
3508
  if (needsUuid) lines.push("import uuid as uuid_mod");
3492
3509
  return lines;
3493
3510
  }
3511
+ //#endregion
3512
+ //#region src/generator/sqlalchemy.ts
3494
3513
  function generateSingleFile(models, enums, indexes) {
3495
3514
  const idx = indexes ?? [];
3496
3515
  const m2mTables = collectManyToManyTables(models);
@@ -3510,6 +3529,8 @@ function generateSingleFile(models, enums, indexes) {
3510
3529
  ""
3511
3530
  ].join("\n");
3512
3531
  }
3532
+ //#endregion
3533
+ //#region src/core/sqlalchemy.ts
3513
3534
  async function sqlalchemy(options) {
3514
3535
  if (!(options.generator.isCustomOutput && options.generator.output?.value)) return {
3515
3536
  ok: false,
@@ -3521,9 +3542,8 @@ async function sqlalchemy(options) {
3521
3542
  const indexes = options.dmmf.datamodel.indexes;
3522
3543
  return emitRaw(generateSingleFile(options.dmmf.datamodel.models, enums, indexes), path.dirname(outPath), outPath);
3523
3544
  }
3524
-
3525
3545
  //#endregion
3526
- //#region src/core/typebox.ts
3546
+ //#region src/helper/typebox.ts
3527
3547
  function makeTypeBoxInfer(modelName) {
3528
3548
  return `export type ${modelName} = Static<typeof ${modelName}Schema>`;
3529
3549
  }
@@ -3576,9 +3596,13 @@ function typeboxSchemaCode(models, type, comment, enums) {
3576
3596
  formatEnum: makeTypeBoxEnumExpression
3577
3597
  });
3578
3598
  }
3599
+ //#endregion
3600
+ //#region src/generator/typebox.ts
3579
3601
  function typeboxCode(dmmf, type, comment, relation) {
3580
3602
  return [typeboxSchemaCode(dmmf.datamodel.models, type, comment, dmmf.datamodel.enums), relation ? makeRelationsOnly(dmmf, type, makeTypeBoxRelations) : ""].filter(Boolean).join("\n\n");
3581
3603
  }
3604
+ //#endregion
3605
+ //#region src/core/typebox.ts
3582
3606
  async function typebox(options) {
3583
3607
  if (!(options.generator.isCustomOutput && options.generator.output?.value)) return {
3584
3608
  ok: false,
@@ -3594,9 +3618,8 @@ async function typebox(options) {
3594
3618
  };
3595
3619
  return emit(typeboxCode(options.dmmf, getBool(options.generator.config?.type), getBool(options.generator.config?.comment), getBool(options.generator.config?.relation)), resolved.dir, resolved.file);
3596
3620
  }
3597
-
3598
3621
  //#endregion
3599
- //#region src/core/valibot.ts
3622
+ //#region src/helper/valibot.ts
3600
3623
  function makeValibotInfer(modelName) {
3601
3624
  return `export type ${modelName} = v.InferOutput<typeof ${modelName}Schema>`;
3602
3625
  }
@@ -3640,9 +3663,13 @@ function valibotSchemaCode(models, type, comment, enums) {
3640
3663
  formatEnum: makeValibotEnumExpression
3641
3664
  });
3642
3665
  }
3666
+ //#endregion
3667
+ //#region src/generator/valibot.ts
3643
3668
  function valibotCode(dmmf, type, comment, relation) {
3644
3669
  return [valibotSchemaCode(dmmf.datamodel.models, type, comment, dmmf.datamodel.enums), relation ? makeRelationsOnly(dmmf, type, makeValibotRelations) : ""].filter(Boolean).join("\n\n");
3645
3670
  }
3671
+ //#endregion
3672
+ //#region src/core/valibot.ts
3646
3673
  async function valibot(options) {
3647
3674
  if (!(options.generator.isCustomOutput && options.generator.output?.value)) return {
3648
3675
  ok: false,
@@ -3658,9 +3685,8 @@ async function valibot(options) {
3658
3685
  };
3659
3686
  return emit(valibotCode(options.dmmf, getBool(options.generator.config?.type), getBool(options.generator.config?.comment), getBool(options.generator.config?.relation)), resolved.dir, resolved.file);
3660
3687
  }
3661
-
3662
3688
  //#endregion
3663
- //#region src/core/zod.ts
3689
+ //#region src/helper/zod.ts
3664
3690
  function makeZodInfer(modelName) {
3665
3691
  return `export type ${modelName} = z.infer<typeof ${modelName}Schema>`;
3666
3692
  }
@@ -3704,9 +3730,13 @@ function zodSchemaCode(models, type, comment, zodVersion, enums) {
3704
3730
  formatEnum: makeZodEnumExpression
3705
3731
  });
3706
3732
  }
3733
+ //#endregion
3734
+ //#region src/generator/zod.ts
3707
3735
  function zodCode(dmmf, type, comment, relation, version) {
3708
3736
  return [zodSchemaCode(dmmf.datamodel.models, type, comment, version, dmmf.datamodel.enums), relation ? makeRelationsOnly(dmmf, type, makeZodRelations) : ""].filter(Boolean).join("\n\n");
3709
3737
  }
3738
+ //#endregion
3739
+ //#region src/core/zod.ts
3710
3740
  async function zod(options) {
3711
3741
  if (!(options.generator.isCustomOutput && options.generator.output?.value)) return {
3712
3742
  ok: false,
@@ -3722,7 +3752,6 @@ async function zod(options) {
3722
3752
  };
3723
3753
  return emit(zodCode(options.dmmf, getBool(options.generator.config?.type), getBool(options.generator.config?.comment), getBool(options.generator.config?.relation), getString(options.generator.config?.zod, "v4")), resolved.dir, resolved.file);
3724
3754
  }
3725
-
3726
3755
  //#endregion
3727
3756
  //#region src/bin/index.ts
3728
3757
  const GENERATORS = {
@@ -3798,6 +3827,5 @@ function registerGenerator(name) {
3798
3827
  }
3799
3828
  });
3800
3829
  }
3801
-
3802
3830
  //#endregion
3803
- export { registerGenerator as t };
3831
+ export { registerGenerator as t };
package/dist/cli/index.js CHANGED
@@ -4,7 +4,6 @@ import path from "node:path";
4
4
  import { serve } from "@hono/node-server";
5
5
  import { serveStatic } from "@hono/node-server/serve-static";
6
6
  import { Hono } from "hono";
7
-
8
7
  //#region src/cli/index.ts
9
8
  const HELP_TEXT = `⚡️ hekireki - Prisma schema tools
10
9
 
@@ -131,6 +130,5 @@ else {
131
130
  console.error(result.error);
132
131
  process.exit(1);
133
132
  }
134
-
135
133
  //#endregion
136
- export { DOCS_HELP_TEXT, HELP_TEXT, handleDocs, hekireki, parsePort };
134
+ export { DOCS_HELP_TEXT, HELP_TEXT, handleDocs, hekireki, parsePort };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hekireki",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "Hekireki is a tool that generates validation schemas for Zod, Valibot, ArkType, and Effect Schema, as well as ER diagrams and DBML, from Prisma schemas annotated with comments.",
5
5
  "keywords": [
6
6
  "ajv",
@@ -61,31 +61,31 @@
61
61
  "release": "npm pkg fix && pnpm build && npm publish"
62
62
  },
63
63
  "dependencies": {
64
- "@hono/node-server": "^1.19.9",
65
- "@prisma/generator-helper": "^7.4.0",
64
+ "@hono/node-server": "^2.0.1",
65
+ "@prisma/generator-helper": "^7.8.0",
66
66
  "@resvg/resvg-js": "^2.6.2",
67
67
  "@softwaretechnik/dbml-renderer": "^1.0.31",
68
- "hono": "^4.11.9",
69
- "oxfmt": "^0.33.0"
68
+ "hono": "^4.12.16",
69
+ "oxfmt": "^0.47.0"
70
70
  },
71
71
  "devDependencies": {
72
- "@paralleldrive/cuid2": "^2.3.1",
73
- "@prisma/client": "^7.4.0",
74
- "@sinclair/typebox": "^0.34.33",
75
- "@types/node": "^25.2.3",
76
- "@typescript/native-preview": "7.0.0-dev.20260218.1",
77
- "ajv": "^8.17.1",
78
- "arktype": "^2.1.29",
79
- "better-auth": "^1.5.5",
80
- "drizzle-kit": "^0.31.9",
81
- "drizzle-orm": "^0.45.1",
82
- "effect": "^3.19.18",
72
+ "@paralleldrive/cuid2": "^3.3.0",
73
+ "@prisma/client": "^7.8.0",
74
+ "@sinclair/typebox": "^0.34.49",
75
+ "@types/node": "^25.6.0",
76
+ "@typescript/native-preview": "7.0.0-dev.20260504.1",
77
+ "ajv": "^8.20.0",
78
+ "arktype": "^2.2.0",
79
+ "better-auth": "^1.6.9",
80
+ "drizzle-kit": "^0.31.10",
81
+ "drizzle-orm": "^0.45.2",
82
+ "effect": "^3.21.2",
83
83
  "json-schema-to-ts": "^3.1.1",
84
- "prisma": "^7.4.0",
85
- "tsdown": "^0.20.3",
84
+ "prisma": "^7.8.0",
85
+ "tsdown": "^0.21.10",
86
86
  "tsx": "^4.21.0",
87
- "typescript": "^5.9.3",
88
- "valibot": "1.2.0",
89
- "zod": "^4.3.6"
87
+ "typescript": "^6.0.3",
88
+ "valibot": "1.3.1",
89
+ "zod": "^4.4.3"
90
90
  }
91
91
  }