hekireki 0.39.0 → 0.40.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 +53 -148
- package/dist/bin/activerecord.js +2 -3
- package/dist/bin/ajv.js +2 -3
- package/dist/bin/arktype.js +2 -3
- package/dist/bin/atlas.js +2 -3
- package/dist/bin/django.js +2 -3
- package/dist/bin/drizzle.js +2 -3
- package/dist/bin/ecto.js +2 -3
- package/dist/bin/efcore.js +2 -3
- package/dist/bin/effect.js +2 -3
- package/dist/bin/eloquent.js +2 -3
- package/dist/bin/er.js +2 -3
- package/dist/bin/exposed.js +2 -3
- package/dist/bin/gorm.js +2 -3
- package/dist/bin/hekireki.js +12 -18
- package/dist/bin/kysely.js +2 -3
- package/dist/bin/openapi.d.ts +1 -0
- package/dist/bin/openapi.js +5 -0
- package/dist/bin/pydantic.js +2 -3
- package/dist/bin/sea-orm.js +2 -3
- package/dist/bin/seed.js +2 -3
- package/dist/bin/sqlalchemy.js +2 -3
- package/dist/bin/typebox.js +2 -3
- package/dist/bin/valibot.js +2 -3
- package/dist/bin/zod.js +2 -3
- package/dist/{bin-BqUSO3tD.js → bin-CVNnCHYf.js} +563 -181
- package/dist/{discover-taxa67WN.js → discover-BJMo8i2-.js} +2 -3
- package/dist/{emit-D6EafjQn.js → emit-C4CeSye3.js} +3 -4
- package/dist/{file-BTbZL3ea.js → file-BAVQ-zst.js} +1 -2
- package/dist/index.d.ts +0 -2
- package/dist/index.js +1 -2
- package/dist/{migrate-BS2daXFS.js → migrate-BhCE-YSd.js} +7 -10
- package/dist/{plan-BtHvkK4c.js → plan-D9axVHFD.js} +40 -76
- package/dist/{prisma-model-bvolNNow.js → prisma-model-DFq7AQgV.js} +3 -6
- package/dist/{run-C7QR2qhb.js → run-Be-2eG1y.js} +21 -36
- package/dist/{schema-DaaMSqfw.js → schema-CfxnFLAw.js} +3 -5
- package/dist/{sql-BGnCCgBa.js → sql-FGRCF9o4.js} +12 -22
- package/dist/{start-AZKmzv5G.js → start-9gS-ABI-.js} +49 -92
- package/dist/studio/assets/{chip-qtq7V4Rg.js → chip-5pFaNmwL.js} +1 -1
- package/dist/studio/assets/{client-CrHiNQcn.js → client-Cn44j_II.js} +1 -1
- package/dist/studio/assets/{code-block-CMwrS7oX.js → code-block-B1wLRka8.js} +1 -1
- package/dist/studio/assets/{confirm-dialog-D-QpTAoA.js → confirm-dialog-C84-yLfM.js} +1 -1
- package/dist/studio/assets/{copy-CxzC330n.js → copy-DvJVuM56.js} +1 -1
- package/dist/studio/assets/{copy-button-BdkKLTkw.js → copy-button-D4zjbBc-.js} +1 -1
- package/dist/studio/assets/dist-DEp-MbCs.js +13 -0
- package/dist/studio/assets/{docs-C7LO1TRA.js → docs-Cg9xqNoX.js} +1 -1
- package/dist/studio/assets/{editor.worker-BmdWdrHZ.js → editor.worker-CRz__AKW.js} +1 -1
- package/dist/studio/assets/{enums._name-39GUOK93.js → enums._name-BhNYpcT7.js} +1 -1
- package/dist/studio/assets/{field-icon-7dg1DynP.js → field-icon-j33Axyq4.js} +2 -2
- package/dist/studio/assets/{hooks-zIaThymT.js → hooks-vFvEnsyJ.js} +2 -2
- package/dist/studio/assets/{index-CkssgCVw.js → index-Cjy--gYX.js} +4 -4
- package/dist/studio/assets/labels-Db1CHOpt.js +2 -0
- package/dist/studio/assets/{lazyRouteComponent-65jX9pcP.js → lazyRouteComponent-TkAX4iEA.js} +1 -1
- package/dist/studio/assets/{lu-CMRQv6zo.js → lu-CUfSReIi.js} +2 -2
- package/dist/studio/assets/{marked-text-CZD1SIT9.js → marked-text-BNzjDVlk.js} +1 -1
- package/dist/studio/assets/{models._name-CHe0Do2Y.js → models._name-BgiyfSuj.js} +1 -1
- package/dist/studio/assets/{monaco-XesTiddK.js → monaco-BoT_UVCW.js} +17 -17
- package/dist/studio/assets/{monaco-CTrNbz9K.js → monaco-DFkSQFp9.js} +1 -1
- package/dist/studio/assets/{not-found-CMgHbtIb.js → not-found-CTsERB3d.js} +1 -1
- package/dist/studio/assets/{prisma-BRcayuiL.js → prisma-DZMNzXN7.js} +1 -1
- package/dist/studio/assets/{result-table-BINfktPB.js → result-table-zFoiQlAu.js} +1 -1
- package/dist/studio/assets/routes-Dpy0uL8H.js +1 -0
- package/dist/studio/assets/{schema-gate-CJc_mlpl.js → schema-gate-CXYSsT5T.js} +1 -1
- package/dist/studio/assets/schema-view-wADoyIFc.js +9 -0
- package/dist/studio/assets/{search-field-Cch08a8e.js → search-field-Dshrbbug.js} +2 -2
- package/dist/studio/assets/{sql-D1dfGXuK.js → sql-0uoTjX3O.js} +1 -1
- package/dist/studio/assets/table-5cZklaSq.js +1 -0
- package/dist/studio/assets/{tabs-Bn62CRYV.js → tabs-B7UQa0vf.js} +1 -1
- package/dist/studio/assets/{useFormValidation-Bj-3Yj3r.js → useFormValidation-D0dsTzOi.js} +1 -1
- package/dist/studio/assets/{useMatch-C20PphzP.js → useMatch-wXiBv0wx.js} +1 -1
- package/dist/studio/assets/useMultipleSelectionState-CyThblbT.js +1 -0
- package/dist/studio/index.html +10 -10
- package/package.json +23 -20
- package/dist/studio/assets/dist-BxXzo21y.js +0 -13
- package/dist/studio/assets/labels-Kd2QEwTC.js +0 -2
- package/dist/studio/assets/routes-BzUMSxYJ.js +0 -1
- package/dist/studio/assets/schema-view-D6zy0-V7.js +0 -9
- package/dist/studio/assets/table-Dd2Yy1pw.js +0 -1
- package/dist/studio/assets/useMultipleSelectionState-DaV9XbLV.js +0 -1
package/README.md
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
# Hekireki
|
|
4
4
|
|
|
5
5
|
**[Hekireki](https://www.npmjs.com/package/hekireki)** reads a [Prisma](https://www.prisma.io/)
|
|
6
|
-
schema and writes what the rest of the project needs from it: validation schemas, ORM models
|
|
7
|
-
|
|
6
|
+
schema and writes what the rest of the project needs from it: validation schemas, ORM models, an
|
|
7
|
+
OpenAPI document, an ER diagram and seed data. It also comes with a Studio for the schema and its
|
|
8
8
|
database.
|
|
9
9
|
|
|
10
10
|
## Installation
|
|
@@ -25,13 +25,9 @@ generator Hekireki-Zod {
|
|
|
25
25
|
}
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
A `///` comment on a field can carry a line for one of the validation generators, which uses it
|
|
33
|
-
as it is. The prefix says which: `@z.` for Zod, `@v.` Valibot, `@a.` ArkType, `@e.` Effect
|
|
34
|
-
Schema, `@t.` TypeBox, `@j.` AJV, `@p.` Pydantic, `@ar.` Active Record and `@ecto.` Ecto.
|
|
28
|
+
A `///` comment on a field can carry a line for a validation generator, which uses it as it is.
|
|
29
|
+
The prefix says which: `@z.` Zod, `@v.` Valibot, `@a.` ArkType, `@e.` Effect Schema, `@t.`
|
|
30
|
+
TypeBox, `@j.` AJV, `@p.` Pydantic, `@ar.` Active Record, `@ecto.` Ecto.
|
|
35
31
|
|
|
36
32
|
```prisma
|
|
37
33
|
model User {
|
|
@@ -43,100 +39,60 @@ model User {
|
|
|
43
39
|
|
|
44
40
|
## Generators
|
|
45
41
|
|
|
46
|
-
The `provider` of the generator block picks the output.
|
|
47
|
-
section below says otherwise.
|
|
42
|
+
The `provider` of the generator block picks the output. Every option is optional.
|
|
48
43
|
|
|
49
44
|
### Validation schemas
|
|
50
45
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
46
|
+
| Provider | Writes | Options |
|
|
47
|
+
| ------------------- | ------------- | ------------------------------------------------------------------- |
|
|
48
|
+
| `hekireki-zod` | Zod | `type`, `relation`, `zod` (`"v4"`, `"mini"`, `"@hono/zod-openapi"`) |
|
|
49
|
+
| `hekireki-valibot` | Valibot | `type`, `relation` |
|
|
50
|
+
| `hekireki-arktype` | ArkType | `type`, `relation` |
|
|
51
|
+
| `hekireki-effect` | Effect Schema | `type`, `relation` |
|
|
52
|
+
| `hekireki-typebox` | TypeBox | `type`, `relation` |
|
|
53
|
+
| `hekireki-ajv` | AJV | `type`, `relation` |
|
|
54
|
+
| `hekireki-pydantic` | Pydantic | `relation` |
|
|
55
|
+
|
|
56
|
+
`type` also exports the TypeScript type of each schema; `relation` adds a schema per relation.
|
|
58
57
|
|
|
59
58
|
### ORM models
|
|
60
59
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
a `TIMESTAMP` through the connection's `time_zone`. Set it to `'+00:00'` on drizzle's connection,
|
|
98
|
-
as Prisma's adapter does on its own, or the two see times that differ by the offset.
|
|
99
|
-
|
|
100
|
-
On CockroachDB it writes the PostgreSQL schema, for node-postgres, and an `Int` key with
|
|
101
|
-
`@default(sequence())` is an identity column, as Prisma makes it. Keep the session's `TimeZone` at
|
|
102
|
-
UTC there, as on PostgreSQL, for a `dbgenerated("CURRENT_TIMESTAMP")` default to be UTC.
|
|
103
|
-
|
|
104
|
-
### Kysely
|
|
105
|
-
|
|
106
|
-
`hekireki-kysely` writes one `DB` interface, each column typed as the driver of the datasource
|
|
107
|
-
reads and binds it: better-sqlite3 on SQLite, pg on PostgreSQL, mysql2 on MySQL. Kysely converts
|
|
108
|
-
nothing and runs no hook, so what the types cannot say is the caller's:
|
|
109
|
-
|
|
110
|
-
- On SQLite a `DateTime` is text, compared as text: write it as Prisma does,
|
|
111
|
-
`date.toISOString().replace('Z', '+00:00')`, or `=`, `@unique` and `@@id` do not meet Prisma's
|
|
112
|
-
rows. A `DateTime` with `now()` or a literal default is asked for on insert there, as Prisma
|
|
113
|
-
Client writes it itself: SQLite's own default is other text (`CURRENT_TIMESTAMP` sorts before
|
|
114
|
-
Prisma's rows, and Prisma reads the literal as an Invalid Date).
|
|
115
|
-
- pg and mysql2 read a column without a zone in the process's zone, Prisma in UTC: set pg's type
|
|
116
|
-
parsers 1114, 1082, 1115 and 1182 to UTC with `pg.defaults.parseInputDatesAsUTC = true`, and
|
|
117
|
-
give mysql2 `timezone: 'Z'`. MySQL refuses ISO text with a `Z`; write a `Date` or MySQL's
|
|
118
|
-
`2030-01-02 03:04:05.678901`.
|
|
119
|
-
- `@db.Time` and `@db.Timetz` are `string`, the time of day the drivers read.
|
|
120
|
-
- `@updatedAt` is asked for on insert, optional or not, and must be set on every update.
|
|
121
|
-
|
|
122
|
-
`examples/kysely` in the repository runs a schema against Kysely on SQLite.
|
|
123
|
-
|
|
124
|
-
### Django
|
|
125
|
-
|
|
126
|
-
`hekireki-django` keeps a `DateTime` as Prisma Client keeps it:
|
|
127
|
-
|
|
128
|
-
- A column without a zone is declared with the `UtcDateTimeField` written into `models.py`. It
|
|
129
|
-
stores the UTC instant (on SQLite Prisma's text, `2030-01-02T03:04:05.678+00:00`) and reads it
|
|
130
|
-
back as UTC, aware under `USE_TZ = True` and in `TIME_ZONE` under `False`. A `@db.Timestamptz`
|
|
131
|
-
is Django's own field.
|
|
132
|
-
- `now()` is filled in by the model, in UTC (the UTC date or time on `@db.Date` and `@db.Time`),
|
|
133
|
-
and a literal default on a date or time column is its UTC date or time.
|
|
134
|
-
- An `@updatedAt` on a date or time column stamps the UTC date or time (`UtcDateField`,
|
|
135
|
-
`UtcTimeField`) where Django's `auto_now` would take the local one. A model with `@updatedAt`
|
|
136
|
-
is managed by `AutoNowQuerySet`, so `QuerySet.update()` bumps it as `updateMany` does.
|
|
137
|
-
|
|
138
|
-
Keep `USE_TZ = True`, Django's default: with `False`, Django sets a PostgreSQL session to
|
|
139
|
-
`TIME_ZONE`, and a `dbgenerated()` default such as `CURRENT_TIMESTAMP` is evaluated in that zone.
|
|
60
|
+
| Provider | Writes | Options |
|
|
61
|
+
| ----------------------- | ----------------------------- | -------------------------------------------------- |
|
|
62
|
+
| `hekireki-drizzle` | Drizzle tables | |
|
|
63
|
+
| `hekireki-kysely` | Kysely `DB` interface | |
|
|
64
|
+
| `hekireki-sqlalchemy` | SQLAlchemy models | |
|
|
65
|
+
| `hekireki-django` | Django models | |
|
|
66
|
+
| `hekireki-activerecord` | Rails models | `locales`: directory of the translated messages |
|
|
67
|
+
| `hekireki-gorm` | GORM structs | `package` (`model`) |
|
|
68
|
+
| `hekireki-sea-orm` | SeaORM entities | `renameAll`: serde's `rename_all` |
|
|
69
|
+
| `hekireki-ecto` | Ecto schemas | `app` (`MyApp`) |
|
|
70
|
+
| `hekireki-eloquent` | Eloquent models | `namespace` (`App\Models`) |
|
|
71
|
+
| `hekireki-efcore` | EF Core entities, `DbContext` | `namespace` (`Models`), `context` (`AppDbContext`) |
|
|
72
|
+
| `hekireki-exposed` | Exposed tables | `package` (`models`), `dao` (`true`) |
|
|
73
|
+
|
|
74
|
+
Every ORM generator stores a `DateTime` as Prisma Client stores it, so the ORM and Prisma read
|
|
75
|
+
each other's rows alike.
|
|
76
|
+
|
|
77
|
+
### Database and documents
|
|
78
|
+
|
|
79
|
+
| Provider | Writes | Options |
|
|
80
|
+
| ------------------ | --------------------------------- | ----------------------------------------------------------------------------------------------- |
|
|
81
|
+
| `hekireki-atlas` | Atlas HCL | `schemaName` (`public`, `main` on SQLite) |
|
|
82
|
+
| `hekireki-openapi` | OpenAPI 3.1 (`.yaml`, `.json`) | `title`, `version`, `paths`: the CRUD of each model |
|
|
83
|
+
| `hekireki-er` | ER diagram | `outputs`: files, one per extension (`.md`, `.dbml`, `.png`, `.svg`); `theme` (`light`, `dark`) |
|
|
84
|
+
| `hekireki-seed` | Schema module for `hekireki seed` | |
|
|
85
|
+
|
|
86
|
+
`hekireki-atlas` writes the tables as Prisma Migrate makes them, so `atlas schema diff` against a
|
|
87
|
+
database Prisma made has nothing to change. `hekireki-openapi` writes them as the
|
|
88
|
+
`components.schemas` Atlas's template writes, `///` comments as descriptions; with `paths`, each
|
|
89
|
+
model gets `GET` and `POST /users` and `GET`, `PATCH` and `DELETE /users/{id}`.
|
|
90
|
+
|
|
91
|
+
Every generator keeps Prisma's names: a model or field without `@map` keeps the name it has in the
|
|
92
|
+
schema, and each ORM is told so where its own convention would say otherwise. What each generator
|
|
93
|
+
does beyond that, and what it leaves to the caller, is in
|
|
94
|
+
[docs/generators.md](https://github.com/nakita628/hekireki/blob/main/packages/hekireki/docs/generators.md).
|
|
95
|
+
Active Record and Ecto take `///` lines of their own, so they are here.
|
|
140
96
|
|
|
141
97
|
### Active Record
|
|
142
98
|
|
|
@@ -298,57 +254,6 @@ the module's documentation names the session time zone a `@db.Timestamptz`, `@db
|
|
|
298
254
|
|
|
299
255
|
`examples/ecto` in the repository runs a schema against Ecto on SQLite.
|
|
300
256
|
|
|
301
|
-
### Exposed
|
|
302
|
-
|
|
303
|
-
`hekireki-exposed` keeps a `DateTime` as Prisma Client keeps it, with no conversion through the
|
|
304
|
-
JVM's zone: an `Instant` bound and read as the UTC instant, to the millisecond (a finer value is
|
|
305
|
-
truncated, as a JavaScript Date holds it, in every native type), the UTC date of a `@db.Date`, the
|
|
306
|
-
UTC time of a `@db.Time`, and a `@db.Timetz` at offset zero.
|
|
307
|
-
|
|
308
|
-
`now()`, literal defaults and every `@updatedAt` are filled in by the client on a DAO or DSL
|
|
309
|
-
insert, and the DAO bumps `@updatedAt` on update. A DSL `Table.update` has no such hook, so set it
|
|
310
|
-
there yourself: `it[updatedAt] = Instant.now()`.
|
|
311
|
-
|
|
312
|
-
pgjdbc sets the session to the JVM's zone, so open the connection in UTC, as Prisma's is, for a
|
|
313
|
-
`dbgenerated("CURRENT_TIMESTAMP")` default or `now()` in SQL:
|
|
314
|
-
|
|
315
|
-
```kotlin
|
|
316
|
-
Database.connect(url, setupConnection = { it.createStatement().use { s -> s.execute("SET TIME ZONE 'UTC'") } })
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
### EF Core
|
|
320
|
-
|
|
321
|
-
`hekireki-efcore` stores a `DateTime` as Prisma Client does, whatever its `DateTimeKind`: the UTC
|
|
322
|
-
instant (a `Local` value converted), read back as `Utc`, in Prisma's text form on SQLite, and
|
|
323
|
-
`now()` filled in by EF Core rather than by the database's clock. It takes Npgsql's legacy
|
|
324
|
-
timestamp behaviour to be off.
|
|
325
|
-
|
|
326
|
-
On MySQL, compare a `@db.Time` column with a parameter rather than a constant:
|
|
327
|
-
MySql.EntityFrameworkCore writes a constant `TimeSpan` as `TIME '03:04:05'`, without its fraction.
|
|
328
|
-
|
|
329
|
-
### SeaORM
|
|
330
|
-
|
|
331
|
-
`hekireki-sea-orm` writes one entity per model into a directory, with a `mod.rs` and a
|
|
332
|
-
`prelude.rs`. A `DateTime` is kept as Prisma Client keeps it:
|
|
333
|
-
|
|
334
|
-
- `now()`, `@updatedAt` and a literal default are filled by `ActiveModelBehavior::before_save`, in
|
|
335
|
-
UTC with milliseconds, so the crate needs `chrono` and `async-trait` beside `sea-orm`.
|
|
336
|
-
- On SQLite every `DateTime` is a `PrismaDateTime` (written into `prisma_date_time.rs`), which
|
|
337
|
-
binds Prisma's text, `2030-01-02T03:04:05.000+00:00`: filter with
|
|
338
|
-
`Column::At.eq(PrismaDateTime(instant))`, not a bare `DateTimeUtc`, which sqlx writes without
|
|
339
|
-
the `.000` of a whole second.
|
|
340
|
-
- On PostgreSQL and MySQL a `DateTime` is a `NaiveDateTime` in UTC, `@db.Timestamptz` a
|
|
341
|
-
`DateTimeWithTimeZone`, a MySQL `@db.Timestamp` a `DateTimeUtc`. `@db.Timetz` is refused: sqlx
|
|
342
|
-
has no type to read it into.
|
|
343
|
-
|
|
344
|
-
`examples/sea-orm` in the repository runs a schema against SeaORM on SQLite, PostgreSQL and MySQL.
|
|
345
|
-
|
|
346
|
-
### Atlas
|
|
347
|
-
|
|
348
|
-
`hekireki-atlas` writes the tables as Prisma Migrate makes them, so that `atlas schema diff`
|
|
349
|
-
against a database Prisma made has nothing to change. Its `schemaName` is `public` unless given
|
|
350
|
-
(`main` on SQLite): on MySQL, where the schema is the database, give the database's name.
|
|
351
|
-
|
|
352
257
|
## Studio
|
|
353
258
|
|
|
354
259
|
```bash
|
package/dist/bin/activerecord.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { t as registerGenerator } from "../bin-
|
|
3
|
-
|
|
2
|
+
import { t as registerGenerator } from "../bin-CVNnCHYf.js";
|
|
3
|
+
// src/bin/activerecord.ts
|
|
4
4
|
registerGenerator("activerecord");
|
|
5
|
-
//#endregion
|
|
6
5
|
export {};
|
package/dist/bin/ajv.js
CHANGED
package/dist/bin/arktype.js
CHANGED
package/dist/bin/atlas.js
CHANGED
package/dist/bin/django.js
CHANGED
package/dist/bin/drizzle.js
CHANGED
package/dist/bin/ecto.js
CHANGED
package/dist/bin/efcore.js
CHANGED
package/dist/bin/effect.js
CHANGED
package/dist/bin/eloquent.js
CHANGED
package/dist/bin/er.js
CHANGED
package/dist/bin/exposed.js
CHANGED
package/dist/bin/gorm.js
CHANGED
package/dist/bin/hekireki.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { s as readFile, t as exists } from "../file-
|
|
2
|
+
import { s as readFile, t as exists } from "../file-BAVQ-zst.js";
|
|
3
3
|
import { runMain } from "@effect/platform-node/NodeRuntime";
|
|
4
4
|
import { layer } from "@effect/platform-node/NodeServices";
|
|
5
5
|
import { Console, Data, Effect, Schema } from "effect";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { CliError, Command, Flag } from "effect/cli";
|
|
8
|
-
|
|
9
|
-
var version = "0.
|
|
10
|
-
|
|
11
|
-
//#region src/schema/path.ts
|
|
8
|
+
// package.json
|
|
9
|
+
var version = "0.40.0";
|
|
10
|
+
// src/schema/path.ts
|
|
12
11
|
/** Where Prisma looks for a schema when neither the command nor prisma.config.ts names one. */
|
|
13
12
|
const DEFAULT_SCHEMA_PATHS = ["prisma/schema.prisma", "schema.prisma"];
|
|
14
13
|
const CONFIG_EXTENSIONS = [
|
|
@@ -64,8 +63,7 @@ function prismaSchemaPath(dir) {
|
|
|
64
63
|
return null;
|
|
65
64
|
});
|
|
66
65
|
}
|
|
67
|
-
|
|
68
|
-
//#region src/studio/server/constants/index.ts
|
|
66
|
+
// src/studio/server/constants/index.ts
|
|
69
67
|
/** Studio only listens on loopback: the API serves the raw schema and runs SQL without authentication. */
|
|
70
68
|
const STUDIO_HOSTNAME = "127.0.0.1";
|
|
71
69
|
const DEFAULT_PORT = 5555;
|
|
@@ -76,8 +74,7 @@ const SSE_PING_MS = 15e3;
|
|
|
76
74
|
const PRISMA_FILE_URI = "file:///schema.prisma";
|
|
77
75
|
/** How often the migrations directory is read for a change. */
|
|
78
76
|
const MIGRATIONS_POLL_MS = 1e3;
|
|
79
|
-
|
|
80
|
-
//#region src/studio/server/errors/index.ts
|
|
77
|
+
// src/studio/server/errors/index.ts
|
|
81
78
|
var UnknownModelError = class extends Data.TaggedError("UnknownModelError") {};
|
|
82
79
|
var UnknownFileError = class extends Data.TaggedError("UnknownFileError") {};
|
|
83
80
|
var FileWriteError = class extends Data.TaggedError("FileWriteError") {};
|
|
@@ -91,8 +88,7 @@ var ContractViolationError = class extends Data.TaggedError("ContractViolationEr
|
|
|
91
88
|
var SchemaLoadError = class extends Data.TaggedError("SchemaLoadError") {};
|
|
92
89
|
var SchemaParseError = class extends Data.TaggedError("SchemaParseError") {};
|
|
93
90
|
var ServerListenError = class extends Data.TaggedError("ServerListenError") {};
|
|
94
|
-
|
|
95
|
-
//#region src/cli/index.ts
|
|
91
|
+
// src/cli/index.ts
|
|
96
92
|
const COMMAND_NAME = "hekireki";
|
|
97
93
|
const STATIC_DIR = path.resolve(import.meta.dirname, "../studio");
|
|
98
94
|
const DatabaseUrl = Schema.String.pipe(Schema.check(Schema.isPattern(/^(?:postgres|postgresql|mysql|file):/u, { message: "a postgres://, postgresql://, mysql:// or file: connection string" })));
|
|
@@ -140,7 +136,7 @@ const studioFlags = {
|
|
|
140
136
|
function runStudio(args) {
|
|
141
137
|
return Effect.gen(function* () {
|
|
142
138
|
const schemaPath = yield* resolveSchemaPath(args.schema, [COMMAND_NAME, "studio"]);
|
|
143
|
-
const { startStudioServer } = yield* Effect.promise(() => import("../start-
|
|
139
|
+
const { startStudioServer } = yield* Effect.promise(() => import("../start-9gS-ABI-.js"));
|
|
144
140
|
const started = yield* startStudioServer({
|
|
145
141
|
schemaPath,
|
|
146
142
|
port: args.port,
|
|
@@ -188,7 +184,7 @@ const seedFlags = {
|
|
|
188
184
|
};
|
|
189
185
|
function runSeedCommand(args) {
|
|
190
186
|
return Effect.gen(function* () {
|
|
191
|
-
const { runSeed, seedBanner } = yield* Effect.promise(() => import("../run-
|
|
187
|
+
const { runSeed, seedBanner } = yield* Effect.promise(() => import("../run-Be-2eG1y.js"));
|
|
192
188
|
const report = yield* runSeed(args, process.cwd()).pipe(Effect.mapError((error) => new CliError.UserError({ cause: error.message })));
|
|
193
189
|
yield* Console.log(seedBanner(report));
|
|
194
190
|
});
|
|
@@ -231,7 +227,7 @@ function runMigrateCheckCommand(args) {
|
|
|
231
227
|
"migrate",
|
|
232
228
|
"check"
|
|
233
229
|
]);
|
|
234
|
-
const { checkBanner, checkJson, runMigrateCheck, summarize } = yield* Effect.promise(() => import("../migrate-
|
|
230
|
+
const { checkBanner, checkJson, runMigrateCheck, summarize } = yield* Effect.promise(() => import("../migrate-BhCE-YSd.js"));
|
|
235
231
|
const report = yield* runMigrateCheck({
|
|
236
232
|
...args,
|
|
237
233
|
schemaPath,
|
|
@@ -278,7 +274,7 @@ function runMigratePlanCommand(args) {
|
|
|
278
274
|
"migrate",
|
|
279
275
|
"plan"
|
|
280
276
|
]);
|
|
281
|
-
const { checkBanner, planSql, readMigration, runMigrateCheck, summarize, writePlan } = yield* Effect.promise(() => import("../migrate-
|
|
277
|
+
const { checkBanner, planSql, readMigration, runMigrateCheck, summarize, writePlan } = yield* Effect.promise(() => import("../migrate-BhCE-YSd.js"));
|
|
282
278
|
const report = yield* runMigrateCheck({
|
|
283
279
|
...args,
|
|
284
280
|
schemaPath,
|
|
@@ -335,8 +331,6 @@ function cli() {
|
|
|
335
331
|
function hekireki() {
|
|
336
332
|
return Command.run(cli(), { version });
|
|
337
333
|
}
|
|
338
|
-
|
|
339
|
-
//#region src/bin/hekireki.ts
|
|
334
|
+
// src/bin/hekireki.ts
|
|
340
335
|
runMain(hekireki().pipe(Effect.provide(layer)));
|
|
341
|
-
//#endregion
|
|
342
336
|
export { SSE_PING_MS as _, DatabaseUnavailableError as a, prismaSchemaPath as b, InvalidInputError as c, ServerListenError as d, UnknownFileError as f, PRISMA_FILE_URI as g, MIGRATIONS_POLL_MS as h, DatabaseError as i, SchemaLoadError as l, FORBIDDEN_HOST_MESSAGE as m, ClientUnavailableError as n, FileWriteError as o, UnknownModelError as p, ContractViolationError as r, FormatError as s, ClientQueryError as t, SchemaParseError as u, STUDIO_HOSTNAME as v, readPrismaConfig as x, DEFAULT_SCHEMA_PATHS as y };
|
package/dist/bin/kysely.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
package/dist/bin/pydantic.js
CHANGED
package/dist/bin/sea-orm.js
CHANGED
package/dist/bin/seed.js
CHANGED
package/dist/bin/sqlalchemy.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { t as registerGenerator } from "../bin-
|
|
3
|
-
|
|
2
|
+
import { t as registerGenerator } from "../bin-CVNnCHYf.js";
|
|
3
|
+
// src/bin/sqlalchemy.ts
|
|
4
4
|
registerGenerator("sqlalchemy");
|
|
5
|
-
//#endregion
|
|
6
5
|
export {};
|
package/dist/bin/typebox.js
CHANGED
package/dist/bin/valibot.js
CHANGED
package/dist/bin/zod.js
CHANGED