@quatronic/qore 0.1.7 → 0.1.8

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 (76) hide show
  1. package/README.md +70 -2
  2. package/dist/cli.js +1720 -1089
  3. package/package.json +23 -4
  4. package/viewer/dist/assets/elk.bundled-C8gcDXx2.js +24 -0
  5. package/viewer/dist/assets/index-BRgYtLRN.css +1 -0
  6. package/viewer/dist/assets/index-VDGZO23h.js +15 -0
  7. package/viewer/dist/assets/inter-cyrillic-400-normal-HOLc17fK.woff +0 -0
  8. package/viewer/dist/assets/inter-cyrillic-400-normal-obahsSVq.woff2 +0 -0
  9. package/viewer/dist/assets/inter-cyrillic-500-normal-BasfLYem.woff2 +0 -0
  10. package/viewer/dist/assets/inter-cyrillic-500-normal-CxZf_p3X.woff +0 -0
  11. package/viewer/dist/assets/inter-cyrillic-600-normal-4D_pXhcN.woff +0 -0
  12. package/viewer/dist/assets/inter-cyrillic-600-normal-CWCymEST.woff2 +0 -0
  13. package/viewer/dist/assets/inter-cyrillic-ext-400-normal-BQZuk6qB.woff2 +0 -0
  14. package/viewer/dist/assets/inter-cyrillic-ext-400-normal-DQukG94-.woff +0 -0
  15. package/viewer/dist/assets/inter-cyrillic-ext-500-normal-B0yAr1jD.woff2 +0 -0
  16. package/viewer/dist/assets/inter-cyrillic-ext-500-normal-BmqWE9Dz.woff +0 -0
  17. package/viewer/dist/assets/inter-cyrillic-ext-600-normal-Bcila6Z-.woff +0 -0
  18. package/viewer/dist/assets/inter-cyrillic-ext-600-normal-Dfes3d0z.woff2 +0 -0
  19. package/viewer/dist/assets/inter-greek-400-normal-B4URO6DV.woff2 +0 -0
  20. package/viewer/dist/assets/inter-greek-400-normal-q2sYcFCs.woff +0 -0
  21. package/viewer/dist/assets/inter-greek-500-normal-BIZE56-Y.woff2 +0 -0
  22. package/viewer/dist/assets/inter-greek-500-normal-Xzm54t5V.woff +0 -0
  23. package/viewer/dist/assets/inter-greek-600-normal-BZpKdvQh.woff +0 -0
  24. package/viewer/dist/assets/inter-greek-600-normal-plRanbMR.woff2 +0 -0
  25. package/viewer/dist/assets/inter-greek-ext-400-normal-DGGRlc-M.woff2 +0 -0
  26. package/viewer/dist/assets/inter-greek-ext-400-normal-KugGGMne.woff +0 -0
  27. package/viewer/dist/assets/inter-greek-ext-500-normal-2j5mBUwD.woff +0 -0
  28. package/viewer/dist/assets/inter-greek-ext-500-normal-C4iEst2y.woff2 +0 -0
  29. package/viewer/dist/assets/inter-greek-ext-600-normal-B8X0CLgF.woff +0 -0
  30. package/viewer/dist/assets/inter-greek-ext-600-normal-DRtmH8MT.woff2 +0 -0
  31. package/viewer/dist/assets/inter-latin-400-normal-C38fXH4l.woff2 +0 -0
  32. package/viewer/dist/assets/inter-latin-400-normal-CyCys3Eg.woff +0 -0
  33. package/viewer/dist/assets/inter-latin-500-normal-BL9OpVg8.woff +0 -0
  34. package/viewer/dist/assets/inter-latin-500-normal-Cerq10X2.woff2 +0 -0
  35. package/viewer/dist/assets/inter-latin-600-normal-CiBQ2DWP.woff +0 -0
  36. package/viewer/dist/assets/inter-latin-600-normal-LgqL8muc.woff2 +0 -0
  37. package/viewer/dist/assets/inter-latin-ext-400-normal-77YHD8bZ.woff +0 -0
  38. package/viewer/dist/assets/inter-latin-ext-400-normal-C1nco2VV.woff2 +0 -0
  39. package/viewer/dist/assets/inter-latin-ext-500-normal-BxGbmqWO.woff +0 -0
  40. package/viewer/dist/assets/inter-latin-ext-500-normal-CV4jyFjo.woff2 +0 -0
  41. package/viewer/dist/assets/inter-latin-ext-600-normal-CIVaiw4L.woff +0 -0
  42. package/viewer/dist/assets/inter-latin-ext-600-normal-D2bJ5OIk.woff2 +0 -0
  43. package/viewer/dist/assets/inter-vietnamese-400-normal-Bbgyi5SW.woff +0 -0
  44. package/viewer/dist/assets/inter-vietnamese-400-normal-DMkecbls.woff2 +0 -0
  45. package/viewer/dist/assets/inter-vietnamese-500-normal-DOriooB6.woff2 +0 -0
  46. package/viewer/dist/assets/inter-vietnamese-500-normal-mJboJaSs.woff +0 -0
  47. package/viewer/dist/assets/inter-vietnamese-600-normal-BuLX-rYi.woff +0 -0
  48. package/viewer/dist/assets/inter-vietnamese-600-normal-Cc8MFFhd.woff2 +0 -0
  49. package/viewer/dist/assets/jetbrains-mono-cyrillic-400-normal-BEIGL1Tu.woff2 +0 -0
  50. package/viewer/dist/assets/jetbrains-mono-cyrillic-400-normal-ugxPyKxw.woff +0 -0
  51. package/viewer/dist/assets/jetbrains-mono-cyrillic-500-normal-DJqRU3vO.woff +0 -0
  52. package/viewer/dist/assets/jetbrains-mono-cyrillic-500-normal-DmUKJPL_.woff2 +0 -0
  53. package/viewer/dist/assets/jetbrains-mono-cyrillic-600-normal-8K4wrrwR.woff +0 -0
  54. package/viewer/dist/assets/jetbrains-mono-cyrillic-600-normal-EVf6-Yzo.woff2 +0 -0
  55. package/viewer/dist/assets/jetbrains-mono-greek-400-normal-B9oWc5Lo.woff +0 -0
  56. package/viewer/dist/assets/jetbrains-mono-greek-400-normal-C190GLew.woff2 +0 -0
  57. package/viewer/dist/assets/jetbrains-mono-greek-500-normal-D7SFKleX.woff +0 -0
  58. package/viewer/dist/assets/jetbrains-mono-greek-500-normal-JpySY46c.woff2 +0 -0
  59. package/viewer/dist/assets/jetbrains-mono-greek-600-normal-H7WoG9Et.woff2 +0 -0
  60. package/viewer/dist/assets/jetbrains-mono-greek-600-normal-mc2nkWzM.woff +0 -0
  61. package/viewer/dist/assets/jetbrains-mono-latin-400-normal-6-qcROiO.woff +0 -0
  62. package/viewer/dist/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
  63. package/viewer/dist/assets/jetbrains-mono-latin-500-normal-BWZEU5yA.woff2 +0 -0
  64. package/viewer/dist/assets/jetbrains-mono-latin-500-normal-CJOVTJB7.woff +0 -0
  65. package/viewer/dist/assets/jetbrains-mono-latin-600-normal-BfsvjouI.woff +0 -0
  66. package/viewer/dist/assets/jetbrains-mono-latin-600-normal-C8RAYTDA.woff2 +0 -0
  67. package/viewer/dist/assets/jetbrains-mono-latin-ext-400-normal-Bc8Ftmh3.woff2 +0 -0
  68. package/viewer/dist/assets/jetbrains-mono-latin-ext-400-normal-fXTG6kC5.woff +0 -0
  69. package/viewer/dist/assets/jetbrains-mono-latin-ext-500-normal-Cut-4mMH.woff2 +0 -0
  70. package/viewer/dist/assets/jetbrains-mono-latin-ext-500-normal-ckzbgY84.woff +0 -0
  71. package/viewer/dist/assets/jetbrains-mono-latin-ext-600-normal-BfB_LPfz.woff2 +0 -0
  72. package/viewer/dist/assets/jetbrains-mono-latin-ext-600-normal-DObL3zCW.woff +0 -0
  73. package/viewer/dist/assets/jetbrains-mono-vietnamese-400-normal-CqNFfHCs.woff +0 -0
  74. package/viewer/dist/assets/jetbrains-mono-vietnamese-500-normal-DNRqzVM1.woff +0 -0
  75. package/viewer/dist/assets/jetbrains-mono-vietnamese-600-normal-OWROknRo.woff +0 -0
  76. package/viewer/dist/index.html +13 -0
package/README.md CHANGED
@@ -55,8 +55,9 @@ Outside a repository, with a projects folder set (see `qore init`), the
55
55
  order is: the project you are standing in; else `[project]` /
56
56
  `--project <ref>` (`app`, `app/module`, `tenant/app` or `tenant/app/module`,
57
57
  matched against your local checkouts); else an interactive pick. `qore dev`
58
- takes the reference as an argument (`qore dev <app>`); `qore dev`, `qore env
59
- pull`, `qore run` and `qore status` take `--project`. `qore run --project`
58
+ and `qore db erd` take the reference as an argument (`qore dev <app>`); `qore
59
+ dev`, `qore db erd`, `qore env pull`, `qore run` and `qore status` take
60
+ `--project`. `qore run --project`
60
61
  only chooses which module's secrets are used; the command still runs in the
61
62
  current directory. `qore env pull --project` writes into the located module,
62
63
  and a relative `--target` then resolves against that project directory, not
@@ -284,6 +285,73 @@ qore doctor
284
285
  names only the first failing check. A check that throws still lets the
285
286
  rest run; it just becomes a `fail` with that error attached.
286
287
 
288
+ #### `qore db erd`
289
+
290
+ Opens this module's data model — tables, columns, keys and the relations
291
+ between them — in your browser, read live from the module's **local**
292
+ Postgres:
293
+
294
+ ```sh
295
+ qore db erd
296
+ qore db erd shop # from anywhere (see qore init); no ref → a pick
297
+ qore db erd --no-open # just print the URL
298
+ qore db erd --port 4100
299
+ qore db erd --json > model.json
300
+ ```
301
+
302
+ - **Context + trust**, like `qore run`: the same `--module`/`--app`
303
+ resolution and the same trust-on-first-use prompt (`--yes` to skip it).
304
+ - **In a workspace root** it shows the whole app; **in a module checkout of
305
+ a workspace** it asks whether you want the whole app or only that module
306
+ (without a terminal, or with `--module`, it stays the module).
307
+ - **Where the database comes from:** `DATABASE_URL` in the module's env file
308
+ (`.env.local` for a frontend module, otherwise `.env`; or the `envFile`
309
+ named in `.qore.json`); when that file is missing or has no (or a blank)
310
+ `DATABASE_URL`, it is fetched from the portal for this run only — never
311
+ written. A module with no `DATABASE_URL` in either has no database to show.
312
+ The URL is whatever the env file holds, or what the portal's local-env
313
+ endpoint returns (the local development database).
314
+ - **Read-only.** The session is opened with `default_transaction_read_only`
315
+ on; the viewer has no write route; only structure is read — never rows.
316
+ - **Local only.** The server listens on `127.0.0.1` on a free port (or
317
+ `--port`) and refuses requests whose `Host` is not `127.0.0.1:<port>` or
318
+ `localhost:<port>`. Stop it with Ctrl+C (exit code 130).
319
+ - **Fresh on every load.** Each page load opens a new connection and
320
+ introspects again, so after a migration — or a database reset or restart —
321
+ a refresh is enough.
322
+ - **The viewer** is qore's own, bundled with the CLI and fully offline.
323
+ Tables are listed in a palette on the left: drag one onto the canvas, or
324
+ click it, to place it, and use `+ N related` to pull in the tables it
325
+ references or is referenced by. Switch between Keys only and All columns,
326
+ Tidy up to re-layout, Fit to frame everything. `/` searches, `Delete`
327
+ removes the selected table, `R` adds its related tables, `Esc` deselects.
328
+ The URL hash is the canvas: a link only opens again on the same port, so
329
+ share it with a fixed `--port`, or copy just the `#…` part. The reload
330
+ button in the top strip re-reads the database without losing the canvas.
331
+ Light or dark follows the system, with a toggle.
332
+ - **A whole app.** In an app's workspace root (the folder with
333
+ `qore.workspace.json`, no `--module`) the canvas shows every module's
334
+ database at once: one lane per database (modules that share a database
335
+ share a lane), ordered so that what others build on sits left. Foreign keys
336
+ stay inside a lane; a reference that crosses databases cannot be a foreign
337
+ key, so it is declared as a comment on the column that holds the id:
338
+ `COMMENT ON COLUMN app.favourite_spots.spot_id IS '-> api:public.spots.id'`
339
+ (the `module:` part is optional, free text may follow). The viewer draws it
340
+ as a dashed cable and names the owning lane in the detail pane. A module
341
+ without a database has no lane; a database that is down leaves the others
342
+ on the canvas, with the error in its lane head.
343
+ - `--json` prints `{"ok":true,"data":{"context","source","model"}}`, where
344
+ `data.model` is the database model the viewer loads and `data.source` is
345
+ `env-file` or `portal`, and starts nothing;
346
+ combining it with `--port` or `--no-open` is a usage error (exit 2). In a
347
+ workspace root it is `{"ok":true,"data":{"context","databases","model"}}`:
348
+ `context.module` is `null`, `context.modules` lists every module with its
349
+ lane, `databases` holds one entry per lane with its source, and the model
350
+ carries `database` on every table plus `databases` and `refs`. It needs every
351
+ database to be reachable.
352
+ - Not reachable: `QORE_SERVICE_UNHEALTHY` naming the port and the fix
353
+ (`qore dev` / `pnpm db:up`); a taken (or reserved) `--port`: `QORE_PORT_IN_USE`.
354
+
287
355
  #### `.qore.json`
288
356
 
289
357
  An optional file at the repository root that configures `qore env pull`