hekireki 0.20.2 → 0.21.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.
package/README.md CHANGED
@@ -24,7 +24,8 @@ npm install -D hekireki
24
24
 
25
25
  Each generator is a `generator` block in `schema.prisma`. `output` is **required**: point it at a
26
26
  directory to get the default file name of that generator, or at a path with an extension to name
27
- the file yourself.
27
+ the file yourself. `hekireki-er` is the exception: it has no default file name, so it only takes
28
+ paths to files, extension included (see [ER diagrams](#er-diagrams)).
28
29
 
29
30
  ```prisma
30
31
  datasource db {
@@ -170,7 +171,7 @@ model Post {
170
171
  | `hekireki-activerecord` | Ruby (Rails ≥ 7.1) | one `.rb` per model | — |
171
172
  | `hekireki-eloquent` | PHP (Laravel, PHP ≥ 8.1) | one `.php` per model and enum | `namespace` |
172
173
  | `hekireki-atlas` | Atlas HCL | `schema.hcl` | `schemaName`, `comment` |
173
- | `hekireki-er` | Mermaid / DBML / PNG / SVG | — (see [ER diagrams](#er-diagrams)) | `outputs`, `mapToDbSchema`, `theme` |
174
+ | `hekireki-er` | Mermaid / DBML / PNG / SVG | — ([extension required](#er-diagrams)) | `outputs`, `theme` |
174
175
 
175
176
  ## Configuration
176
177
 
@@ -237,25 +238,55 @@ generator Hekireki-Eloquent {
237
238
  namespace = "App.Models" // PHP namespace, "." becomes "\" (default: App\Models)
238
239
  }
239
240
 
241
+ // ER takes output or outputs (not both). Every path is a file ending in .md, .dbml, .png or .svg,
242
+ // never a directory, and its extension picks the format (see ER diagrams).
240
243
  generator Hekireki-ER {
241
- provider = "hekireki-er"
242
- output = "docs" // The directory the files in outputs go in
243
- outputs = ["er.md", "schema.dbml", "er.svg"] // .md, .dbml, .png or .svg (optional)
244
- mapToDbSchema = true // .dbml only. @@map/@map names (default: true)
245
- theme = "light" // .png / .svg only. "light" (default) or "dark"
244
+ provider = "hekireki-er"
245
+ // output = "docs/er.md" // One file: output alone is enough
246
+ outputs = ["docs/er.md", "docs/schema.dbml", "docs/er.svg"] // Several files: list them here
247
+ theme = "light" // .png / .svg only. "light" (default) or "dark"
246
248
  }
247
249
  ```
248
250
 
249
251
  ## ER diagrams
250
252
 
251
253
  `hekireki-er` writes the ER model of the schema in four formats, and the extension of each file
252
- picks which — so the file you name is the file you get, and an extension it has no format for is an
253
- error rather than a guess. `outputs` is the list of files and `output` the directory they go in; for
254
- a single file, point `output` straight at it and leave `outputs` out.
254
+ picks which — so the file you name is the file you get. Unlike the other generators it has no
255
+ default file name, so every file has to be named with one of these extensions:
255
256
 
256
- Every option belongs to a format (`mapToDbSchema` to `.dbml`, `theme` to `.png` and `.svg`), and
257
- setting one that no chosen format reads is an error — so an option never looks like it did something
258
- it did not.
257
+ | Extension | Writes |
258
+ | --------- | ---------------------- |
259
+ | `.md` | A Mermaid `erDiagram` |
260
+ | `.dbml` | DBML |
261
+ | `.png` | The diagram, as a PNG |
262
+ | `.svg` | The diagram, as an SVG |
263
+
264
+ Name the files with `output` or with `outputs` — one of the two, not both. When one file is all
265
+ you need, `output` alone is enough:
266
+
267
+ ```prisma
268
+ generator Hekireki-ER {
269
+ provider = "hekireki-er"
270
+ output = "docs/er.md" // Writes docs/er.md
271
+ }
272
+ ```
273
+
274
+ For several formats at once, list them in `outputs` instead:
275
+
276
+ ```prisma
277
+ generator Hekireki-ER {
278
+ provider = "hekireki-er"
279
+ outputs = ["docs/er.md", "docs/er.svg"] // Writes docs/er.md and docs/er.svg
280
+ }
281
+ ```
282
+
283
+ Every path is a whole file, directory and extension included, resolved the way Prisma resolves any
284
+ `output`: against the directory of the schema file that declares the generator. Neither ever names
285
+ a directory, so a path with no extension, or with one outside the four, is an error rather than a
286
+ guess — `output = "docs"` fails.
287
+
288
+ Every option belongs to a format (`theme` to `.png` and `.svg`), and setting one that no chosen
289
+ format reads is an error — so an option never looks like it did something it did not.
259
290
 
260
291
  `.md` writes a Mermaid diagram:
261
292
 
@@ -273,7 +304,9 @@ erDiagram
273
304
  }
274
305
  ```
275
306
 
276
- `.dbml` writes the same model for [dbdiagram.io](https://dbml.dbdiagram.io/); `.png` and `.svg`
307
+ `.dbml` writes the same model for [dbdiagram.io](https://dbml.dbdiagram.io/) as the database
308
+ names it: tables, columns, enums and enum values under their `@@map` / `@map` names wherever the
309
+ schema declares one. `.png` and `.svg`
277
310
  draw the diagram Hekireki Studio shows, laid out automatically: a card per model and enum, its
278
311
  fields with `🔑` / `🔗` / `UK` marks, the attributes and `///` prose under each, the `@@id` /
279
312
  `@@unique` / `@@index` block attributes, and an edge per relation in crow's-foot notation captioned
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as registerGenerator } from "../bin-CjbhMZs0.js";
2
+ import { t as registerGenerator } from "../bin-Ca0TR-Zh.js";
3
3
  //#region src/bin/activerecord.ts
4
4
  registerGenerator("activerecord");
5
5
  //#endregion
package/dist/bin/ajv.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as registerGenerator } from "../bin-CjbhMZs0.js";
2
+ import { t as registerGenerator } from "../bin-Ca0TR-Zh.js";
3
3
  //#region src/bin/ajv.ts
4
4
  registerGenerator("ajv");
5
5
  //#endregion
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as registerGenerator } from "../bin-CjbhMZs0.js";
2
+ import { t as registerGenerator } from "../bin-Ca0TR-Zh.js";
3
3
  //#region src/bin/arktype.ts
4
4
  registerGenerator("arktype");
5
5
  //#endregion
package/dist/bin/atlas.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as registerGenerator } from "../bin-CjbhMZs0.js";
2
+ import { t as registerGenerator } from "../bin-Ca0TR-Zh.js";
3
3
  //#region src/bin/atlas.ts
4
4
  registerGenerator("atlas");
5
5
  //#endregion
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as registerGenerator } from "../bin-CjbhMZs0.js";
2
+ import { t as registerGenerator } from "../bin-Ca0TR-Zh.js";
3
3
  //#region src/bin/django.ts
4
4
  registerGenerator("django");
5
5
  //#endregion
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as registerGenerator } from "../bin-CjbhMZs0.js";
2
+ import { t as registerGenerator } from "../bin-Ca0TR-Zh.js";
3
3
  //#region src/bin/drizzle.ts
4
4
  registerGenerator("drizzle");
5
5
  //#endregion
package/dist/bin/ecto.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as registerGenerator } from "../bin-CjbhMZs0.js";
2
+ import { t as registerGenerator } from "../bin-Ca0TR-Zh.js";
3
3
  //#region src/bin/ecto.ts
4
4
  registerGenerator("ecto");
5
5
  //#endregion
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as registerGenerator } from "../bin-CjbhMZs0.js";
2
+ import { t as registerGenerator } from "../bin-Ca0TR-Zh.js";
3
3
  //#region src/bin/effect.ts
4
4
  registerGenerator("effect");
5
5
  //#endregion
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as registerGenerator } from "../bin-CjbhMZs0.js";
2
+ import { t as registerGenerator } from "../bin-Ca0TR-Zh.js";
3
3
  //#region src/bin/eloquent.ts
4
4
  registerGenerator("eloquent");
5
5
  //#endregion
package/dist/bin/er.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as registerGenerator } from "../bin-CjbhMZs0.js";
2
+ import { t as registerGenerator } from "../bin-Ca0TR-Zh.js";
3
3
  //#region src/bin/er.ts
4
4
  registerGenerator("er");
5
5
  //#endregion
package/dist/bin/gorm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as registerGenerator } from "../bin-CjbhMZs0.js";
2
+ import { t as registerGenerator } from "../bin-Ca0TR-Zh.js";
3
3
  //#region src/bin/gorm.ts
4
4
  registerGenerator("gorm");
5
5
  //#endregion
@@ -5,7 +5,7 @@ import { Config, Console, Data, Effect, Option, Schema, Stdio } from "effect";
5
5
  import path from "node:path";
6
6
  import { CliError, Command, Flag } from "effect/unstable/cli";
7
7
  //#region package.json
8
- var version = "0.20.2";
8
+ var version = "0.21.0";
9
9
  //#endregion
10
10
  //#region src/studio/server/constants/index.ts
11
11
  /** Studio only listens on loopback: the API serves the raw schema and runs SQL without authentication. */
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as registerGenerator } from "../bin-CjbhMZs0.js";
2
+ import { t as registerGenerator } from "../bin-Ca0TR-Zh.js";
3
3
  //#region src/bin/kysely.ts
4
4
  registerGenerator("kysely");
5
5
  //#endregion
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as registerGenerator } from "../bin-CjbhMZs0.js";
2
+ import { t as registerGenerator } from "../bin-Ca0TR-Zh.js";
3
3
  //#region src/bin/pydantic.ts
4
4
  registerGenerator("pydantic");
5
5
  //#endregion
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as registerGenerator } from "../bin-CjbhMZs0.js";
2
+ import { t as registerGenerator } from "../bin-Ca0TR-Zh.js";
3
3
  //#region src/bin/sea-orm.ts
4
4
  registerGenerator("sea-orm");
5
5
  //#endregion
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as registerGenerator } from "../bin-CjbhMZs0.js";
2
+ import { t as registerGenerator } from "../bin-Ca0TR-Zh.js";
3
3
  //#region src/bin/sqlalchemy.ts
4
4
  registerGenerator("sqlalchemy");
5
5
  //#endregion
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as registerGenerator } from "../bin-CjbhMZs0.js";
2
+ import { t as registerGenerator } from "../bin-Ca0TR-Zh.js";
3
3
  //#region src/bin/typebox.ts
4
4
  registerGenerator("typebox");
5
5
  //#endregion
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as registerGenerator } from "../bin-CjbhMZs0.js";
2
+ import { t as registerGenerator } from "../bin-Ca0TR-Zh.js";
3
3
  //#region src/bin/valibot.ts
4
4
  registerGenerator("valibot");
5
5
  //#endregion
package/dist/bin/zod.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as registerGenerator } from "../bin-CjbhMZs0.js";
2
+ import { t as registerGenerator } from "../bin-Ca0TR-Zh.js";
3
3
  //#region src/bin/zod.ts
4
4
  registerGenerator("zod");
5
5
  //#endregion
@@ -3812,20 +3812,39 @@ function makePrismaColumn(column) {
3812
3812
  ].filter((c) => Boolean(c));
3813
3813
  return ` ${column.name} ${column.type}${formatConstraints(constraints)}`;
3814
3814
  }
3815
+ /**
3816
+ * The name a model, field, enum or enum value has in the database: its `@map` / `@@map` when it
3817
+ * has one, its Prisma name otherwise. DBML describes the database, so every name it writes is this.
3818
+ */
3819
+ function dbNameOf(item) {
3820
+ return item.dbName ?? item.name;
3821
+ }
3822
+ /** The column a Prisma field of `model` is stored in. */
3823
+ function columnOf(model, field) {
3824
+ const found = model?.fields.find((f) => f.name === field);
3825
+ return found ? dbNameOf(found) : field;
3826
+ }
3815
3827
  function isFunctionDefault$4(def) {
3816
3828
  return def !== null && typeof def === "object" && "name" in def;
3817
3829
  }
3818
- function toDBMLColumn(field, models, mapToDbSchema) {
3830
+ function toDBMLColumn(field, enums) {
3819
3831
  const defaultName = isFunctionDefault$4(field.default) ? field.default.name : void 0;
3820
- const baseType = mapToDbSchema ? models.find((m) => m.name === field.type)?.dbName ?? field.type : field.type;
3832
+ const enumDef = field.kind === "enum" ? enums.find((e) => e.name === field.type) : void 0;
3833
+ const baseType = enumDef ? dbNameOf(enumDef) : field.type;
3821
3834
  const type = field.isList && !field.relationName ? `${baseType}[]` : baseType;
3822
3835
  const defaultValue = (() => {
3823
3836
  if (defaultName === "autoincrement") return void 0;
3824
3837
  if (defaultName === "now") return "`now()`";
3825
- if (field.hasDefaultValue && typeof field.default !== "object") return field.type === "String" || field.type === "Json" || field.kind === "enum" ? `'${field.default}'` : String(field.default);
3838
+ if (field.hasDefaultValue && typeof field.default !== "object") {
3839
+ if (field.kind === "enum") {
3840
+ const value = enumDef?.values.find((v) => v.name === field.default);
3841
+ return `'${value ? dbNameOf(value) : String(field.default)}'`;
3842
+ }
3843
+ return field.type === "String" || field.type === "Json" ? `'${field.default}'` : String(field.default);
3844
+ }
3826
3845
  })();
3827
3846
  return {
3828
- name: field.name,
3847
+ name: dbNameOf(field),
3829
3848
  type,
3830
3849
  isPrimaryKey: field.isId,
3831
3850
  isIncrement: defaultName === "autoincrement",
@@ -3835,15 +3854,16 @@ function toDBMLColumn(field, models, mapToDbSchema) {
3835
3854
  note: stripAnnotations(field.documentation)
3836
3855
  };
3837
3856
  }
3838
- function makeTables(models, mapToDbSchema = false) {
3857
+ function makeTables(models, enums = []) {
3839
3858
  return models.map((model) => {
3840
- const modelName = mapToDbSchema && model.dbName ? model.dbName : model.name;
3841
- const columnLines = model.fields.filter((field) => !field.relationName).map((field) => toDBMLColumn(field, models, mapToDbSchema)).map(makePrismaColumn).join("\n");
3859
+ const modelName = dbNameOf(model);
3860
+ const columnLines = model.fields.filter((field) => !field.relationName).map((field) => toDBMLColumn(field, enums)).map(makePrismaColumn).join("\n");
3861
+ const columnsOf = (fields) => fields.map((f) => columnOf(model, f));
3842
3862
  const indexes = [...model.primaryKey?.fields && model.primaryKey.fields.length > 0 ? [{
3843
- columns: model.primaryKey.fields,
3863
+ columns: columnsOf(model.primaryKey.fields),
3844
3864
  isPrimaryKey: true
3845
3865
  }] : [], ...model.uniqueFields.filter((c) => c.length > 1).map((c) => ({
3846
- columns: c,
3866
+ columns: columnsOf(c),
3847
3867
  isUnique: true
3848
3868
  }))];
3849
3869
  const indexBlock = indexes.length > 0 ? `\n\n indexes {\n${indexes.map(makeIndex).join("\n")}\n }` : "";
@@ -3853,19 +3873,19 @@ function makeTables(models, mapToDbSchema = false) {
3853
3873
  }
3854
3874
  function makeEnums(enums) {
3855
3875
  return enums.map((e) => makeEnum({
3856
- name: e.name,
3857
- values: e.values.map((v) => v.name)
3876
+ name: dbNameOf(e),
3877
+ values: e.values.map(dbNameOf)
3858
3878
  }));
3859
3879
  }
3860
- function makeRelations(models, mapToDbSchema = false) {
3880
+ function makeRelations(models) {
3861
3881
  return models.flatMap((model) => model.fields.filter((field) => field.relationName && field.relationToFields?.length && field.relationFromFields?.length).map((field) => {
3862
3882
  const relationTo = field.type;
3863
3883
  const toModel = models.find((m) => m.name === relationTo);
3864
3884
  const operator = (toModel?.fields.find((f) => f.kind === "object" && f.relationName === field.relationName && !(toModel.name === model.name && f.name === field.name)))?.isList ? ">" : "-";
3865
- const relationFromName = mapToDbSchema && model.dbName ? model.dbName : model.name;
3866
- const relationToName = mapToDbSchema && toModel?.dbName ? toModel.dbName : relationTo;
3867
- const fromColumn = combineKeys(field.relationFromFields ?? []);
3868
- const toColumn = combineKeys(field.relationToFields ?? []);
3885
+ const relationFromName = dbNameOf(model);
3886
+ const relationToName = toModel ? dbNameOf(toModel) : relationTo;
3887
+ const fromColumn = combineKeys((field.relationFromFields ?? []).map((f) => columnOf(model, f)));
3888
+ const toColumn = combineKeys((field.relationToFields ?? []).map((f) => columnOf(toModel, f)));
3869
3889
  return makeRef({
3870
3890
  name: `${relationFromName}_${fromColumn}_fk`,
3871
3891
  fromTable: relationFromName,
@@ -3889,19 +3909,27 @@ function dbmlOperator(leftMany, rightMany) {
3889
3909
  }
3890
3910
  function annotatedDbmlRefs(models) {
3891
3911
  const inferredKeys = new Set(inferredERRelations(models).map(erKey));
3912
+ const end = (side) => {
3913
+ const model = models.find((m) => m.name === side.model);
3914
+ return {
3915
+ table: model ? dbNameOf(model) : side.model,
3916
+ column: columnOf(model, side.field)
3917
+ };
3918
+ };
3892
3919
  return annotatedERRelations(models).filter((relation) => !inferredKeys.has(erKey(relation))).map((relation) => {
3893
- const left = `${relation.to.model}.${relation.to.field}`;
3894
- const right = `${relation.from.model}.${relation.from.field}`;
3920
+ const to = end(relation.to);
3921
+ const from = end(relation.from);
3895
3922
  const operator = dbmlOperator(isMany(relation.to.cardinality), isMany(relation.from.cardinality));
3896
- return `Ref ${`${relation.to.model}_${relation.to.field}_${relation.from.model}_${relation.from.field}`}: ${left} ${operator} ${right}`;
3923
+ return `Ref ${`${to.table}_${to.column}_${from.table}_${from.column}`}: ${to.table}.${to.column} ${operator} ${from.table}.${from.column}`;
3897
3924
  });
3898
3925
  }
3899
3926
  //#endregion
3900
3927
  //#region src/generator/dbml.ts
3901
- function dbmlContent(datamodel, mapToDbSchema = false) {
3902
- const tables = makeTables(datamodel.models, mapToDbSchema);
3928
+ /** The schema as DBML, named as the database names it: every `@map` / `@@map` applied. */
3929
+ function dbmlContent(datamodel) {
3930
+ const tables = makeTables(datamodel.models, datamodel.enums);
3903
3931
  const enums = makeEnums(datamodel.enums);
3904
- const refs = makeRelations(datamodel.models, mapToDbSchema);
3932
+ const refs = makeRelations(datamodel.models);
3905
3933
  const logicalRefs = annotatedDbmlRefs(datamodel.models);
3906
3934
  return [
3907
3935
  ...enums,
@@ -4011,8 +4039,8 @@ const FORMATS = {
4011
4039
  render: (options) => erContent(options.dmmf.datamodel.models).join("\n")
4012
4040
  },
4013
4041
  ".dbml": {
4014
- options: ["mapToDbSchema"],
4015
- render: (options) => dbmlContent(options.dmmf.datamodel, getString(options.generator.config?.mapToDbSchema) !== "false")
4042
+ options: [],
4043
+ render: (options) => dbmlContent(options.dmmf.datamodel)
4016
4044
  },
4017
4045
  ".png": {
4018
4046
  options: ["theme"],
@@ -4037,28 +4065,33 @@ function endsIn(name) {
4037
4065
  return extension === "" ? "nothing" : `"${extension}"`;
4038
4066
  }
4039
4067
  /**
4040
- * The files to write, from `output` alone or from the names `outputs` lists inside it.
4068
+ * The files to write: the one `output` names, or every one `outputs` lists.
4041
4069
  *
4042
- * One block writes as many files as it names, so a schema that wants the ER model in several
4043
- * formats declares `Hekireki-ER` once — `outputs` is the list, `output` the directory it fills.
4070
+ * Neither ever names a directory — each entry is a whole path, extension included — so the file
4071
+ * the caller writes is the file they get. A schema that wants the ER model in several formats
4072
+ * declares `Hekireki-ER` once and lists them in `outputs`, each resolved the way Prisma resolves
4073
+ * `output`: against the directory of the schema file that declares the block.
4044
4074
  */
4045
- function filesOf(output, outputs) {
4075
+ function filesOf(options, outputs) {
4046
4076
  return Effect.gen(function* () {
4047
- if (outputs === void 0) {
4077
+ const output = options.generator.isCustomOutput ? options.generator.output?.value : void 0;
4078
+ if (output && outputs !== void 0) return yield* new GeneratorConfigError({ message: "Hekireki-ER takes output or outputs, not both: output names one file, outputs lists several." });
4079
+ if (output) {
4048
4080
  const extension = path.extname(output).toLowerCase();
4049
- if (!isFormat(extension)) return yield* new GeneratorConfigError({ message: `output for Hekireki-ER has to name a file ending in ${EXTENSIONS}; "${output}" ends in ${endsIn(output)}.` });
4081
+ if (!isFormat(extension)) return yield* new GeneratorConfigError({ message: `output for Hekireki-ER has to name a file ending in ${EXTENSIONS}, not a directory; "${output}" ends in ${endsIn(output)}.` });
4050
4082
  return [{
4051
4083
  file: output,
4052
4084
  extension
4053
4085
  }];
4054
4086
  }
4087
+ if (outputs === void 0) return yield* new GeneratorConfigError({ message: `output or outputs is required for Hekireki-ER: output names one file, outputs lists several, each ending in ${EXTENSIONS}.` });
4055
4088
  if (outputs.length === 0) return yield* new GeneratorConfigError({ message: "outputs for Hekireki-ER has to name at least one file." });
4056
- if (path.extname(output) !== "") return yield* new GeneratorConfigError({ message: `output for Hekireki-ER names the directory the files in outputs go in, so it cannot name a file; "${output}" ends in ${endsIn(output)}.` });
4089
+ const base = path.dirname(options.generator.sourceFilePath);
4057
4090
  return yield* Effect.forEach(outputs, (name) => {
4058
4091
  const extension = path.extname(name).toLowerCase();
4059
4092
  if (!isFormat(extension)) return new GeneratorConfigError({ message: `outputs for Hekireki-ER has to name files ending in ${EXTENSIONS}; "${name}" ends in ${endsIn(name)}.` });
4060
4093
  return Effect.succeed({
4061
- file: path.resolve(output, name),
4094
+ file: path.resolve(base, name),
4062
4095
  extension
4063
4096
  });
4064
4097
  });
@@ -4066,10 +4099,9 @@ function filesOf(output, outputs) {
4066
4099
  }
4067
4100
  function er(options) {
4068
4101
  return Effect.gen(function* () {
4069
- if (!(options.generator.isCustomOutput && options.generator.output?.value)) return yield* new GeneratorConfigError({ message: "output is required for Hekireki-ER. Please specify output in your generator config." });
4070
4102
  const config = options.generator.config ?? {};
4071
4103
  const outputs = getStrings(config.outputs);
4072
- const files = yield* filesOf(options.generator.output.value, outputs);
4104
+ const files = yield* filesOf(options, outputs);
4073
4105
  const read = new Set(outputs === void 0 ? [] : ["outputs"]);
4074
4106
  for (const { extension } of files) for (const option of FORMATS[extension].options) read.add(option);
4075
4107
  const unread = Object.keys(config).filter((name) => !read.has(name));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hekireki",
3
- "version": "0.20.2",
3
+ "version": "0.21.0",
4
4
  "description": "Hekireki is a code generator from Prisma schema to validation schemas, ORM models and ER diagrams, with a Studio for your schema and its data",
5
5
  "keywords": [
6
6
  "activerecord",
@@ -115,10 +115,10 @@
115
115
  "@types/react": "^19.2.17",
116
116
  "@types/react-dom": "^19.2.5",
117
117
  "@typescript/native-preview": "7.0.0-dev.20260707.2",
118
- "@typespec/compiler": "^1.15.0",
119
- "@typespec/http": "^1.15.0",
120
- "@typespec/openapi": "^1.15.0",
121
- "@typespec/openapi3": "^1.15.0",
118
+ "@typespec/compiler": "^1.16.0",
119
+ "@typespec/http": "^1.16.0",
120
+ "@typespec/openapi": "^1.16.0",
121
+ "@typespec/openapi3": "^1.16.0",
122
122
  "@vitejs/plugin-react": "^6.1.1",
123
123
  "@xyflow/react": "^12.11.5",
124
124
  "arktype": "^2.2.3",