@quatronic/qore 0.1.7 → 0.1.9

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 +83 -2
  2. package/dist/cli.js +1947 -1142
  3. package/package.json +24 -5
  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
@@ -23,6 +23,8 @@ qore version # CLI + portal version info
23
23
 
24
24
  qore env pull # write this module's local secrets into an env file
25
25
  qore run -- <command> # run a command with those secrets in its environment
26
+ qore roles list # roles in your code, on local, and yours there
27
+ qore roles use <role…> # announce your code's roles for local and take these
26
28
 
27
29
  qore errors --env stag # recent unresolved errors
28
30
  qore errors FRONTEND-1A --env prod --with trace,logs # one error, its trace and logs
@@ -55,8 +57,9 @@ Outside a repository, with a projects folder set (see `qore init`), the
55
57
  order is: the project you are standing in; else `[project]` /
56
58
  `--project <ref>` (`app`, `app/module`, `tenant/app` or `tenant/app/module`,
57
59
  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`
60
+ and `qore db erd` take the reference as an argument (`qore dev <app>`); `qore
61
+ dev`, `qore db erd`, `qore env pull`, `qore run` and `qore status` take
62
+ `--project`. `qore run --project`
60
63
  only chooses which module's secrets are used; the command still runs in the
61
64
  current directory. `qore env pull --project` writes into the located module,
62
65
  and a relative `--target` then resolves against that project directory, not
@@ -144,6 +147,17 @@ not in the interactive conflict prompt, not in `--verbose` logs, and not in
144
147
  the portal's own audit trail, which records key names only (see
145
148
  `app.local_env.fetched`).
146
149
 
150
+ #### `qore roles`
151
+
152
+ Run in the app's frontend module. `qore roles use inspector` reads the roles in
153
+ `src/lib/permissions.ts`, tells the portal they exist on `local` (only there —
154
+ staging and production learn roles from the code that environment deploys:
155
+ `main` for staging, the `production` branch for production), and makes exactly
156
+ the named roles yours on `local`. Sign out and back in to the local app
157
+ afterwards. `qore roles list` shows the roles in your code, the ones `local`
158
+ knows, and yours. Needs write on the module, like `qore env pull`. An announced
159
+ role stays on `local`; nothing removes it automatically.
160
+
147
161
  #### `qore run`
148
162
 
149
163
  Runs a command with this module's local secrets injected into its
@@ -284,6 +298,73 @@ qore doctor
284
298
  names only the first failing check. A check that throws still lets the
285
299
  rest run; it just becomes a `fail` with that error attached.
286
300
 
301
+ #### `qore db erd`
302
+
303
+ Opens this module's data model — tables, columns, keys and the relations
304
+ between them — in your browser, read live from the module's **local**
305
+ Postgres:
306
+
307
+ ```sh
308
+ qore db erd
309
+ qore db erd shop # from anywhere (see qore init); no ref → a pick
310
+ qore db erd --no-open # just print the URL
311
+ qore db erd --port 4100
312
+ qore db erd --json > model.json
313
+ ```
314
+
315
+ - **Context + trust**, like `qore run`: the same `--module`/`--app`
316
+ resolution and the same trust-on-first-use prompt (`--yes` to skip it).
317
+ - **In a workspace root** it shows the whole app; **in a module checkout of
318
+ a workspace** it asks whether you want the whole app or only that module
319
+ (without a terminal, or with `--module`, it stays the module).
320
+ - **Where the database comes from:** `DATABASE_URL` in the module's env file
321
+ (`.env.local` for a frontend module, otherwise `.env`; or the `envFile`
322
+ named in `.qore.json`); when that file is missing or has no (or a blank)
323
+ `DATABASE_URL`, it is fetched from the portal for this run only — never
324
+ written. A module with no `DATABASE_URL` in either has no database to show.
325
+ The URL is whatever the env file holds, or what the portal's local-env
326
+ endpoint returns (the local development database).
327
+ - **Read-only.** The session is opened with `default_transaction_read_only`
328
+ on; the viewer has no write route; only structure is read — never rows.
329
+ - **Local only.** The server listens on `127.0.0.1` on a free port (or
330
+ `--port`) and refuses requests whose `Host` is not `127.0.0.1:<port>` or
331
+ `localhost:<port>`. Stop it with Ctrl+C (exit code 130).
332
+ - **Fresh on every load.** Each page load opens a new connection and
333
+ introspects again, so after a migration — or a database reset or restart —
334
+ a refresh is enough.
335
+ - **The viewer** is qore's own, bundled with the CLI and fully offline.
336
+ Tables are listed in a palette on the left: drag one onto the canvas, or
337
+ click it, to place it, and use `+ N related` to pull in the tables it
338
+ references or is referenced by. Switch between Keys only and All columns,
339
+ Tidy up to re-layout, Fit to frame everything. `/` searches, `Delete`
340
+ removes the selected table, `R` adds its related tables, `Esc` deselects.
341
+ The URL hash is the canvas: a link only opens again on the same port, so
342
+ share it with a fixed `--port`, or copy just the `#…` part. The reload
343
+ button in the top strip re-reads the database without losing the canvas.
344
+ Light or dark follows the system, with a toggle.
345
+ - **A whole app.** In an app's workspace root (the folder with
346
+ `qore.workspace.json`, no `--module`) the canvas shows every module's
347
+ database at once: one lane per database (modules that share a database
348
+ share a lane), ordered so that what others build on sits left. Foreign keys
349
+ stay inside a lane; a reference that crosses databases cannot be a foreign
350
+ key, so it is declared as a comment on the column that holds the id:
351
+ `COMMENT ON COLUMN app.favourite_spots.spot_id IS '-> api:public.spots.id'`
352
+ (the `module:` part is optional, free text may follow). The viewer draws it
353
+ as a dashed cable and names the owning lane in the detail pane. A module
354
+ without a database has no lane; a database that is down leaves the others
355
+ on the canvas, with the error in its lane head.
356
+ - `--json` prints `{"ok":true,"data":{"context","source","model"}}`, where
357
+ `data.model` is the database model the viewer loads and `data.source` is
358
+ `env-file` or `portal`, and starts nothing;
359
+ combining it with `--port` or `--no-open` is a usage error (exit 2). In a
360
+ workspace root it is `{"ok":true,"data":{"context","databases","model"}}`:
361
+ `context.module` is `null`, `context.modules` lists every module with its
362
+ lane, `databases` holds one entry per lane with its source, and the model
363
+ carries `database` on every table plus `databases` and `refs`. It needs every
364
+ database to be reachable.
365
+ - Not reachable: `QORE_SERVICE_UNHEALTHY` naming the port and the fix
366
+ (`qore dev` / `pnpm db:up`); a taken (or reserved) `--port`: `QORE_PORT_IN_USE`.
367
+
287
368
  #### `.qore.json`
288
369
 
289
370
  An optional file at the repository root that configures `qore env pull`