hekireki 0.21.0 → 0.22.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 (50) hide show
  1. package/README.md +60 -344
  2. package/dist/bin/activerecord.js +1 -1
  3. package/dist/bin/ajv.js +1 -1
  4. package/dist/bin/arktype.js +1 -1
  5. package/dist/bin/atlas.js +1 -1
  6. package/dist/bin/django.js +1 -1
  7. package/dist/bin/drizzle.js +1 -1
  8. package/dist/bin/ecto.js +1 -1
  9. package/dist/bin/efcore.d.ts +1 -0
  10. package/dist/bin/efcore.js +6 -0
  11. package/dist/bin/effect.js +1 -1
  12. package/dist/bin/eloquent.js +1 -1
  13. package/dist/bin/er.js +1 -1
  14. package/dist/bin/gorm.js +1 -1
  15. package/dist/bin/hekireki.js +1 -1
  16. package/dist/bin/kysely.js +1 -1
  17. package/dist/bin/pydantic.js +1 -1
  18. package/dist/bin/sea-orm.js +1 -1
  19. package/dist/bin/sqlalchemy.js +1 -1
  20. package/dist/bin/typebox.js +1 -1
  21. package/dist/bin/valibot.js +1 -1
  22. package/dist/bin/zod.js +1 -1
  23. package/dist/{bin-Ca0TR-Zh.js → bin-DxYpJikH.js} +1409 -10
  24. package/dist/studio/assets/{chip-CLdO-gL5.js → chip-B9UolvIl.js} +1 -1
  25. package/dist/studio/assets/{copy-CcAufM8p.js → copy-DiFFafx_.js} +1 -1
  26. package/dist/studio/assets/{debounce-T36H3Pq5.js → debounce-WjLaYdFF.js} +1 -1
  27. package/dist/studio/assets/{docs-DW8-viIy.js → docs-D2Vpbqbg.js} +1 -1
  28. package/dist/studio/assets/{enums._name-C2s5pbQ3.js → enums._name-t90NJ6-H.js} +1 -1
  29. package/dist/studio/assets/hooks-UJuF1mqe.js +1 -0
  30. package/dist/studio/assets/{index-BP1uJf2T.js → index-C29_CUjj.js} +3 -3
  31. package/dist/studio/assets/{labels-BXtM_faz.js → labels-D0IhxSmD.js} +1 -1
  32. package/dist/studio/assets/{lazyRouteComponent-C6zg30cR.js → lazyRouteComponent-G8mNaW9J.js} +1 -1
  33. package/dist/studio/assets/{lu-BKd2Ee9U.js → lu-DvK-u3Mx.js} +1 -1
  34. package/dist/studio/assets/{models._name-BgQ9M7k3.js → models._name-DUEsQrdC.js} +1 -1
  35. package/dist/studio/assets/{not-found-OmQoujxN.js → not-found-Dr2QuAjv.js} +1 -1
  36. package/dist/studio/assets/{prisma-BbI26USq.js → prisma-Co828tLd.js} +1 -1
  37. package/dist/studio/assets/routes-BIbzUF01.js +1 -0
  38. package/dist/studio/assets/{schema-gate-Dq_XVfAD.js → schema-gate-Bad9LKCZ.js} +1 -1
  39. package/dist/studio/assets/{schema-view-BuWOw5GX.js → schema-view-nCetSUyn.js} +1 -1
  40. package/dist/studio/assets/{sql--CSU_IR2.js → sql-Db9voX3l.js} +1 -1
  41. package/dist/studio/assets/{table-Dfy6EciQ.js → table-BfaXyuqp.js} +1 -1
  42. package/dist/studio/assets/{tabs-Ce14hvOa.js → tabs-BXvBDUhR.js} +1 -1
  43. package/dist/studio/assets/{useFormValidation-gdk4CRGT.js → useFormValidation-D6Nfw1Ec.js} +1 -1
  44. package/dist/studio/assets/{useMatch-CdyJXF1Q.js → useMatch-BZSBUGcY.js} +1 -1
  45. package/dist/studio/assets/{useMultipleSelectionState-a9-PqoPk.js → useMultipleSelectionState-Bz2aFLv7.js} +1 -1
  46. package/dist/studio/assets/{useOverlayTriggerState-DCPjC07T.js → useOverlayTriggerState-C-S92dgf.js} +1 -1
  47. package/dist/studio/index.html +8 -8
  48. package/package.json +6 -2
  49. package/dist/studio/assets/hooks-Ctp_pGlY.js +0 -1
  50. package/dist/studio/assets/routes-Bp4Bkwc2.js +0 -1
package/README.md CHANGED
@@ -3,16 +3,8 @@
3
3
  # Hekireki
4
4
 
5
5
  **[Hekireki](https://www.npmjs.com/package/hekireki)** generates validation schemas, ORM models and
6
- ER diagrams from a [Prisma](https://www.prisma.io/) schema — for TypeScript, Python, Go, Rust,
7
- Elixir, Ruby and PHP — and opens the schema, its documentation and its data in the browser with
8
- [Hekireki Studio](#studio).
9
-
10
- ## Features
11
-
12
- - **Validation schemas** — [Zod](https://zod.dev/), [Valibot](https://valibot.dev/), [ArkType](https://arktype.io/), [Effect Schema](https://effect.website/docs/schema/introduction/), [TypeBox](https://github.com/sinclairzx81/typebox), [AJV](https://ajv.js.org/) (JSON Schema) and [Pydantic](https://docs.pydantic.dev/) v2, written from the `///` [annotations](#annotations) on each field
13
- - **ORM models and DDL** — [Drizzle](https://orm.drizzle.team/), [Kysely](https://kysely.dev/), [SQLAlchemy](https://www.sqlalchemy.org/), [Django](https://www.djangoproject.com/), [GORM](https://gorm.io/), [Sea-ORM](https://www.sea-ql.org/SeaORM/), [Ecto](https://hexdocs.pm/ecto/Ecto.Schema.html), [Active Record](https://guides.rubyonrails.org/active_record_basics.html), [Eloquent](https://laravel.com/docs/eloquent) and [Atlas](https://atlasgo.io/) HCL — with relations, enums, composite keys, indexes and `@@map` / `@map` throughout
14
- - **ER diagrams** — [Mermaid](https://mermaid.js.org/), [DBML](https://dbml.dbdiagram.io/), PNG and SVG from one generator block, with crow's-foot cardinality and `PK` / `FK` / `UK` markers
15
- - **[Hekireki Studio](#studio)** — the ER diagram, a reference docs page, every model's data, a Prisma editor and a SQL console, live from `schema.prisma`
6
+ ER diagrams from a [Prisma](https://www.prisma.io/) schema, and opens the schema and its data in the
7
+ browser with Hekireki Studio.
16
8
 
17
9
  ## Installation
18
10
 
@@ -22,381 +14,105 @@ npm install -D hekireki
22
14
 
23
15
  ## Usage
24
16
 
25
- Each generator is a `generator` block in `schema.prisma`. `output` is **required**: point it at a
26
- directory to get the default file name of that generator, or at a path with an extension to name
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)).
17
+ Add a generator to `schema.prisma` and run `npx prisma generate`. `output` is required.
29
18
 
30
19
  ```prisma
31
- datasource db {
32
- provider = "sqlite"
33
- }
34
-
35
20
  generator Hekireki-Zod {
36
21
  provider = "hekireki-zod"
37
22
  output = "./zod"
38
- type = true
39
- comment = true
40
- relation = true
41
- }
42
-
43
- model User {
44
- /// Primary key
45
- /// @z.uuid()
46
- id String @id @default(uuid())
47
- /// Display name
48
- /// @z.string().min(1).max(50)
49
- name String
50
- posts Post[]
51
- }
52
-
53
- model Post {
54
- /// Primary key
55
- /// @z.uuid()
56
- id String @id @default(uuid())
57
- /// Article title
58
- /// @z.string().min(1).max(100)
59
- title String
60
- /// Foreign key referencing User.id
61
- /// @z.uuid()
62
- userId String
63
- user User @relation(fields: [userId], references: [id])
64
23
  }
65
24
  ```
66
25
 
67
- `npx prisma generate` writes `./zod/index.ts`:
68
-
69
- ```ts
70
- import * as z from 'zod'
71
-
72
- export const UserSchema = z.object({
73
- /**
74
- * Primary key
75
- */
76
- id: z.uuid(),
77
- /**
78
- * Display name
79
- */
80
- name: z.string().min(1).max(50),
81
- })
82
-
83
- export type User = z.infer<typeof UserSchema>
84
-
85
- export const PostSchema = z.object({
86
- /**
87
- * Primary key
88
- */
89
- id: z.uuid(),
90
- /**
91
- * Article title
92
- */
93
- title: z.string().min(1).max(100),
94
- /**
95
- * Foreign key referencing User.id
96
- */
97
- userId: z.uuid(),
98
- })
99
-
100
- export type Post = z.infer<typeof PostSchema>
101
-
102
- export const UserRelationsSchema = z.object({
103
- ...UserSchema.shape,
104
- posts: z.array(PostSchema),
105
- })
106
-
107
- export type UserRelations = z.infer<typeof UserRelationsSchema>
108
-
109
- export const PostRelationsSchema = z.object({
110
- ...PostSchema.shape,
111
- user: UserSchema,
112
- })
113
-
114
- export type PostRelations = z.infer<typeof PostRelationsSchema>
115
- ```
116
-
117
- Every other generator reads the same schema. What each one writes is easiest to read as real
118
- output: [`example/schema.prisma`](https://github.com/nakita628/hekireki/blob/main/example/schema.prisma)
119
- exercises all of them at once — enums, `@@map`, composite keys, self-relations, implicit
120
- many-to-many, native `@db.*` types — and the output of every generator for it is committed under
121
- [`example/generated/`](https://github.com/nakita628/hekireki/tree/main/example/generated).
122
-
123
- ## Annotations
124
-
125
- A `///` comment on a field is its documentation. A `///` line that begins with one of the prefixes
126
- below is the validation the matching generator emits for that field, used verbatim:
26
+ ## Generators
127
27
 
128
- | Prefix | Generator | Example |
129
- | ------ | ----------------- | ----------------------------------------- |
130
- | `@z.` | Zod | `/// @z.string().min(1).max(50)` |
131
- | `@v.` | Valibot | `/// @v.pipe(v.string(), v.minLength(1))` |
132
- | `@a.` | ArkType | `/// @a."1 <= string <= 50"` |
133
- | `@e.` | Effect Schema | `/// @e.Schema.UUID` |
134
- | `@t.` | TypeBox | `/// @t.Type.String({ format: 'uuid' })` |
135
- | `@j.` | AJV / JSON Schema | `/// @j.{ type: 'string' as const }` |
136
- | `@p.` | Pydantic | `/// @p.EmailStr` |
28
+ ### Validation schemas
137
29
 
138
- A field without an annotation falls back to the Prisma type. `@p.ConfigDict(...)` on a **model** is
139
- passed through as Pydantic's `model_config`.
30
+ - `hekireki-zod` — [Zod](https://zod.dev/)
31
+ - `hekireki-valibot` — [Valibot](https://valibot.dev/)
32
+ - `hekireki-arktype` — [ArkType](https://arktype.io/)
33
+ - `hekireki-effect` — [Effect Schema](https://effect.website/docs/schema/introduction/)
34
+ - `hekireki-typebox` — [TypeBox](https://github.com/sinclairzx81/typebox)
35
+ - `hekireki-ajv` — [AJV](https://ajv.js.org/)
36
+ - `hekireki-pydantic` — [Pydantic](https://docs.pydantic.dev/)
140
37
 
141
- `/// @relation <Parent>.<field> <Child>.<field> <cardinality>` on a **model** declares a relation
142
- that has no physical foreign key — it is drawn in the Mermaid, DBML and image output (dashed in the
143
- drawing) even though the column carries no `@relation(...)`:
38
+ ### ORM models
144
39
 
145
- ```prisma
146
- /// @relation User.id Post.userId one-to-many
147
- model Post {
148
- id String @id @default(uuid())
149
- userId String
150
- }
151
- ```
40
+ - `hekireki-drizzle` — [Drizzle](https://orm.drizzle.team/)
41
+ - `hekireki-kysely` — [Kysely](https://kysely.dev/)
42
+ - `hekireki-sqlalchemy` — [SQLAlchemy](https://www.sqlalchemy.org/)
43
+ - `hekireki-django` — [Django](https://www.djangoproject.com/)
44
+ - `hekireki-gorm` — [GORM](https://gorm.io/)
45
+ - `hekireki-sea-orm` — [SeaORM](https://www.sea-ql.org/SeaORM/)
46
+ - `hekireki-ecto` — [Ecto](https://hexdocs.pm/ecto/Ecto.Schema.html)
47
+ - `hekireki-activerecord` — [Active Record](https://guides.rubyonrails.org/active_record_basics.html)
48
+ - `hekireki-eloquent` — [Eloquent](https://laravel.com/docs/eloquent)
49
+ - `hekireki-efcore` — [EF Core](https://learn.microsoft.com/ef/core/)
50
+ - `hekireki-atlas` — [Atlas](https://atlasgo.io/) HCL
152
51
 
153
- ## Generators
52
+ ### ER diagrams
154
53
 
155
- | `provider` | Target | Default output | Options |
156
- | ----------------------- | -------------------------- | ------------------------------------------- | ------------------------------------ |
157
- | `hekireki-zod` | TypeScript | `index.ts` | `type`, `comment`, `relation`, `zod` |
158
- | `hekireki-valibot` | TypeScript | `index.ts` | `type`, `comment`, `relation` |
159
- | `hekireki-arktype` | TypeScript | `index.ts` | `type`, `comment`, `relation` |
160
- | `hekireki-effect` | TypeScript | `index.ts` | `type`, `comment`, `relation` |
161
- | `hekireki-typebox` | TypeScript | `index.ts` | `type`, `comment`, `relation` |
162
- | `hekireki-ajv` | TypeScript | `index.ts` | `type`, `comment`, `relation` |
163
- | `hekireki-drizzle` | TypeScript | `schema.ts` | — |
164
- | `hekireki-kysely` | TypeScript | `types.ts` | — |
165
- | `hekireki-pydantic` | Python | `models.py` | `comment`, `relation` |
166
- | `hekireki-sqlalchemy` | Python | `models.py` | — |
167
- | `hekireki-django` | Python (Django ≥ 5.2) | `models.py` | — |
168
- | `hekireki-gorm` | Go | `models.go` | `package` |
169
- | `hekireki-sea-orm` | Rust | one `.rs` per model, `mod.rs`, `prelude.rs` | `renameAll` |
170
- | `hekireki-ecto` | Elixir | one `.ex` per model | `app` |
171
- | `hekireki-activerecord` | Ruby (Rails ≥ 7.1) | one `.rb` per model | — |
172
- | `hekireki-eloquent` | PHP (Laravel, PHP ≥ 8.1) | one `.php` per model and enum | `namespace` |
173
- | `hekireki-atlas` | Atlas HCL | `schema.hcl` | `schemaName`, `comment` |
174
- | `hekireki-er` | Mermaid / DBML / PNG / SVG | — ([extension required](#er-diagrams)) | `outputs`, `theme` |
54
+ - `hekireki-er` — Mermaid, DBML, PNG and SVG
175
55
 
176
- ## Configuration
56
+ ## Options
177
57
 
178
58
  ```prisma
179
59
  generator Hekireki-Zod {
180
60
  provider = "hekireki-zod"
181
- output = "./zod" // Required. A directory here yields ./zod/index.ts
182
- type = true // TypeScript types (default: false)
183
- comment = true // /// comments as doc comments (default: false)
184
- relation = true // <Model>Relations schemas (default: false)
185
- zod = "v4" // "v4" | "mini" | "@hono/zod-openapi" (default: v4)
186
- }
187
-
188
- // Valibot, ArkType, Effect Schema, TypeBox and AJV take the same type / comment / relation options.
189
- generator Hekireki-Valibot {
190
- provider = "hekireki-valibot"
191
- output = "./valibot"
192
- type = true
193
- comment = true
194
- relation = true
195
- }
196
-
197
- generator Hekireki-Pydantic {
198
- provider = "hekireki-pydantic"
199
- output = "./pydantic" // A directory here yields ./pydantic/models.py
200
- comment = true // /// comments as docstrings (default: false)
201
- relation = true // <Model>Relations subclasses (default: false)
202
- }
203
-
204
- // Drizzle, Kysely, SQLAlchemy, Django and Active Record take output alone.
205
- generator Hekireki-Drizzle {
206
- provider = "hekireki-drizzle"
207
- output = "./drizzle" // A directory here yields ./drizzle/schema.ts
208
- }
209
-
210
- generator Hekireki-Atlas {
211
- provider = "hekireki-atlas"
212
- output = "./atlas" // A directory here yields ./atlas/schema.hcl
213
- schemaName = "public" // Schema label (default: postgresql/mysql "public", sqlite "main")
214
- comment = true // /// comments as comment attributes (default: false)
215
- }
216
-
217
- generator Hekireki-GORM {
218
- provider = "hekireki-gorm"
219
- output = "./gorm" // A directory here yields ./gorm/models.go
220
- package = "model" // Go package name (default: model)
221
- }
222
-
223
- generator Hekireki-SeaORM {
224
- provider = "hekireki-sea-orm"
225
- output = "./sea_orm"
226
- renameAll = "camelCase" // #[serde(rename_all = "...")] (optional)
227
- }
228
-
229
- generator Hekireki-Ecto {
230
- provider = "hekireki-ecto"
231
- output = "./ecto"
232
- app = "MyApp" // Module prefix (default: MyApp)
233
- }
234
-
235
- generator Hekireki-Eloquent {
236
- provider = "hekireki-eloquent"
237
- output = "./eloquent"
238
- namespace = "App.Models" // PHP namespace, "." becomes "\" (default: App\Models)
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).
243
- generator Hekireki-ER {
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"
61
+ output = "./zod"
62
+ type = true // Export TypeScript types
63
+ comment = true // Keep /// comments
64
+ relation = true // Add <Model>Relations schemas
65
+ zod = "v4" // "v4" (default), "mini" or "@hono/zod-openapi"
248
66
  }
249
67
  ```
250
68
 
251
- ## ER diagrams
252
-
253
- `hekireki-er` writes the ER model of the schema in four formats, and the extension of each file
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:
69
+ - `type`, `comment`, `relation` — every validation schema generator (Pydantic: `comment`, `relation`)
70
+ - `package` — GORM package name (default: `model`)
71
+ - `renameAll` — SeaORM `#[serde(rename_all = "...")]`
72
+ - `app` — Ecto module prefix (default: `MyApp`)
73
+ - `namespace` — Eloquent (default: `App\Models`) and EF Core (default: `Models`)
74
+ - `context` — EF Core `DbContext` class name (default: `AppDbContext`)
75
+ - `schemaName`, `comment` — Atlas
76
+ - `outputs`, `theme` — ER
256
77
 
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 |
78
+ ## Annotations
263
79
 
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:
80
+ A `///` line starting with `@z.`, `@v.`, `@a.`, `@e.`, `@t.`, `@j.` or `@p.` is used as-is by Zod,
81
+ Valibot, ArkType, Effect Schema, TypeBox, AJV or Pydantic. Any other `///` line is documentation.
266
82
 
267
83
  ```prisma
268
- generator Hekireki-ER {
269
- provider = "hekireki-er"
270
- output = "docs/er.md" // Writes docs/er.md
84
+ model User {
85
+ /// Display name
86
+ /// @z.string().min(1).max(50)
87
+ /// @v.pipe(v.string(), v.minLength(1), v.maxLength(50))
88
+ name String
271
89
  }
272
90
  ```
273
91
 
274
- For several formats at once, list them in `outputs` instead:
92
+ ## ER diagrams
93
+
94
+ The extension of each path picks the format: `.md` (Mermaid), `.dbml`, `.png` or `.svg`.
275
95
 
276
96
  ```prisma
277
97
  generator Hekireki-ER {
278
98
  provider = "hekireki-er"
279
- outputs = ["docs/er.md", "docs/er.svg"] // Writes docs/er.md and docs/er.svg
99
+ outputs = ["docs/er.md", "docs/er.svg"] // One file: output = "docs/er.md"
100
+ theme = "dark" // .png / .svg: "light" (default) or "dark"
280
101
  }
281
102
  ```
282
103
 
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.
290
-
291
- `.md` writes a Mermaid diagram:
292
-
293
- ```mermaid
294
- erDiagram
295
- User ||--o{ Post : "(id) - (userId)"
296
- User {
297
- string id PK "Primary key"
298
- string name "Display name"
299
- }
300
- Post {
301
- string id PK "Primary key"
302
- string title "Article title"
303
- string userId FK "Foreign key referencing User.id"
304
- }
305
- ```
306
-
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`
310
- draw the diagram Hekireki Studio shows, laid out automatically: a card per model and enum, its
311
- fields with `🔑` / `🔗` / `UK` marks, the attributes and `///` prose under each, the `@@id` /
312
- `@@unique` / `@@index` block attributes, and an edge per relation in crow's-foot notation captioned
313
- with its cardinality and referential action. No external renderer is involved, and the PNG is
314
- rasterised at 2x. Use `.svg` for files in the repository and `.png` where images are embedded.
315
- Studio's Schema page exports both with the models where you dragged them.
316
-
317
104
  ## Studio
318
105
 
319
- `hekireki studio` opens the schema in the browser, served locally by [Hono](https://hono.dev/).
320
- Nothing is generated first — Studio reads `schema.prisma` itself and reloads on every edit to it:
321
-
322
106
  ```bash
323
- # Open ./prisma/schema.prisma, then ./schema.prisma (default: http://localhost:5555)
324
- hekireki studio
325
-
326
- # Read a multi-file schema: every .prisma file directly in the directory, together
327
- hekireki studio --schema prisma/schema
328
-
329
- # Browse a database of your choosing
330
- hekireki studio --url file:./dev.db
331
-
332
- # Listen on another port
333
- hekireki studio -p 3000
107
+ hekireki studio # ./prisma/schema.prisma or ./schema.prisma
108
+ hekireki studio --schema prisma/schema # A multi-file schema
109
+ hekireki studio --url file:./dev.db # A database of your choice
110
+ hekireki studio -p 3000 # Another port (default: 5555)
334
111
  ```
335
112
 
336
- | Page | What it is |
337
- | ---------------- | --------------------------------------------------------------------------------- |
338
- | `/` — Schema | The ER diagram, laid out automatically, with **PNG** / **SVG** export |
339
- | `/docs` — Docs | The reference page: every model and enum with its fields, attributes and comments |
340
- | `/models/<name>` | A model's rows, editable, next to its fields |
341
- | `/enums/<name>` | An enum with its members and the fields that hold it |
342
- | `/prisma` | The schema in a Prisma editor, with the language server's diagnostics |
343
- | `/sql` | A SQL console: completion from the schema, a data-flow picture, the query plan |
344
-
345
- **⌘K** / **Ctrl+K** opens a search over the whole schema — every page, model, enum and field, by
346
- the letters of its name in order, so `usemail` finds `User.email`. Following a field opens its
347
- model on that row.
348
-
349
- On a model's page, **/** puts the cursor in the search box and every column is searched as you
350
- type, with what matched marked in the rows that come back. Clicking a cell picks it and nothing
351
- more; the two buttons that appear on it copy just that value or open it for editing, and **⌘C** /
352
- **Ctrl+C** copies the picked cell. Tick rows to act on them together: **Copy** takes them as
353
- tab-separated text — what a spreadsheet pastes — and **Delete** asks first, naming the rows it is
354
- about to remove. **Export** downloads or copies the page as CSV or JSON. A SQL result is sorted and narrowed in the browser,
355
- without asking the database a second question.
356
-
357
- The SQL page completes table and column names from the schema — `@@map` / `@map` names, as the
358
- database knows them — and reads the statement as you type: **Flow** draws where its rows come from
359
- (every table, join, filter, grouping and the projection), **Columns** traces each result column back
360
- to the base tables and lists every table touched with its alias and the columns read, and **Type**
361
- shows the row and parameter types as TypeScript, and **Plan** asks the database for its execution
362
- plan (`EXPLAIN`) as a tree. The models the statement touches light up on the
363
- schema beside it, with the columns it reads marked; a `?` or `$1` placeholder gets a field typed
364
- from the column it is compared with, and a name the schema does not know is underlined.
365
-
366
- **Columns** in the toolbar says which columns the grid draws, remembered per model; what is on
367
- screen is what **Copy** and **Export** take, so a copy of two columns out of forty is two ticks
368
- away. A row is still written whole, so the Add row form brings every column back for as long as it
369
- is open.
370
-
371
- `--schema` takes either a `schema.prisma` file or a directory — every `.prisma` file directly in the
372
- directory (subdirectories are not descended into) is read as one schema, which is how Prisma's
373
- [multi-file schema](https://www.prisma.io/docs/orm/prisma-schema/overview/location#multi-file-prisma-schema)
374
- (`prisma/schema/`) is opened. Without the flag, `./prisma/schema.prisma` then `./schema.prisma` are
375
- looked for — the same two paths the Prisma CLI defaults to. Either way the whole directory is
376
- watched, so a `.prisma` file added to it appears in Studio without a restart.
377
-
378
- The database is the one `--url` names, or `DATABASE_URL` from the environment or `.env`, then
379
- `datasource.url` in `prisma.config.ts`; `postgres://`, `mysql://` and `file:` are understood. A
380
- relative `file:` path is resolved from the schema directory, as Prisma resolves it — with the
381
- default `prisma/schema.prisma`, `file:./dev.db` is `prisma/dev.db`. Without a database, Studio
382
- serves the schema alone — the diagram, the docs and the editor still work.
383
-
384
- The HTTP API behind it is documented in [docs/studio-api.md](https://github.com/nakita628/hekireki/blob/main/packages/hekireki/docs/studio-api.md).
385
-
386
- ## Notes
387
-
388
- - **Atlas** — declarative `atlas schema apply` drops whatever is missing from the HCL, and Prisma's
389
- `_prisma_migrations` table, `@ignore`d columns and `Unsupported(...)` types can never appear in it.
390
- Dry-run first and exclude the migrations table: `--exclude '_prisma_migrations'`.
391
- - **Kysely** — only **database-side** defaults become `Generated<T>`. `uuid()`, `cuid()`, `ulid()`
392
- and `nanoid()` are evaluated by the Prisma Client, so a raw Kysely insert must still supply them.
393
- - **Django** — enums become `TextChoices` + `TextField(choices=…)` (Django has no native PostgreSQL
394
- enum type), a foreign key to a composite `@@id` / `@@unique` is emitted as the scalar columns
395
- without a relation, `onUpdate` is dropped, and a plain `DateTime` maps to `DateTimeField` while
396
- Prisma stores `timestamp` — annotate it `@db.Timestamptz` to keep `USE_TZ = True` reads aware.
397
- - **Eloquent** — a composite primary key is emitted as `protected $primaryKey = null;`, because
398
- Eloquent has no native support for one. Active Record writes the real
399
- `self.primary_key = [...]` (Rails ≥ 7.1).
113
+ Studio shows the ER diagram, the docs, each model's rows, a Prisma editor and a SQL console, and
114
+ reloads when the schema changes. The database comes from `--url`, `DATABASE_URL` or
115
+ `prisma.config.ts`.
400
116
 
401
117
  ## License
402
118
 
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as registerGenerator } from "../bin-Ca0TR-Zh.js";
2
+ import { t as registerGenerator } from "../bin-DxYpJikH.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-Ca0TR-Zh.js";
2
+ import { t as registerGenerator } from "../bin-DxYpJikH.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-Ca0TR-Zh.js";
2
+ import { t as registerGenerator } from "../bin-DxYpJikH.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-Ca0TR-Zh.js";
2
+ import { t as registerGenerator } from "../bin-DxYpJikH.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-Ca0TR-Zh.js";
2
+ import { t as registerGenerator } from "../bin-DxYpJikH.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-Ca0TR-Zh.js";
2
+ import { t as registerGenerator } from "../bin-DxYpJikH.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-Ca0TR-Zh.js";
2
+ import { t as registerGenerator } from "../bin-DxYpJikH.js";
3
3
  //#region src/bin/ecto.ts
4
4
  registerGenerator("ecto");
5
5
  //#endregion
@@ -0,0 +1 @@
1
+ export {}
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ import { t as registerGenerator } from "../bin-DxYpJikH.js";
3
+ //#region src/bin/efcore.ts
4
+ registerGenerator("efcore");
5
+ //#endregion
6
+ export {};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as registerGenerator } from "../bin-Ca0TR-Zh.js";
2
+ import { t as registerGenerator } from "../bin-DxYpJikH.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-Ca0TR-Zh.js";
2
+ import { t as registerGenerator } from "../bin-DxYpJikH.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-Ca0TR-Zh.js";
2
+ import { t as registerGenerator } from "../bin-DxYpJikH.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-Ca0TR-Zh.js";
2
+ import { t as registerGenerator } from "../bin-DxYpJikH.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.21.0";
8
+ var version = "0.22.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-Ca0TR-Zh.js";
2
+ import { t as registerGenerator } from "../bin-DxYpJikH.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-Ca0TR-Zh.js";
2
+ import { t as registerGenerator } from "../bin-DxYpJikH.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-Ca0TR-Zh.js";
2
+ import { t as registerGenerator } from "../bin-DxYpJikH.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-Ca0TR-Zh.js";
2
+ import { t as registerGenerator } from "../bin-DxYpJikH.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-Ca0TR-Zh.js";
2
+ import { t as registerGenerator } from "../bin-DxYpJikH.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-Ca0TR-Zh.js";
2
+ import { t as registerGenerator } from "../bin-DxYpJikH.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-Ca0TR-Zh.js";
2
+ import { t as registerGenerator } from "../bin-DxYpJikH.js";
3
3
  //#region src/bin/zod.ts
4
4
  registerGenerator("zod");
5
5
  //#endregion