tina4-nodejs 3.13.148 → 3.13.149

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 (42) hide show
  1. package/CLAUDE.md +4 -3
  2. package/package.json +1 -1
  3. package/packages/cli/dist/bin.js +10875 -9847
  4. package/packages/cli/src/commands/generate.ts +184 -25
  5. package/packages/core/dist/index.js +10848 -9820
  6. package/packages/core/src/devAdmin.ts +72 -1
  7. package/packages/core/src/index.ts +3 -0
  8. package/packages/core/src/messenger.ts +57 -1
  9. package/packages/core/src/router.ts +11 -1
  10. package/packages/core/src/server.ts +5 -2
  11. package/packages/core/templates/crud/form.twig +26 -0
  12. package/packages/core/templates/crud/modals.twig +31 -0
  13. package/packages/core/templates/crud/page.twig +401 -0
  14. package/packages/core/templates/crud/table.twig +69 -0
  15. package/packages/frond/dist/index.js +9 -1
  16. package/packages/frond/src/engine.ts +9 -0
  17. package/packages/frond/src/index.ts +1 -1
  18. package/packages/orm/dist/index.js +1255 -217
  19. package/packages/orm/src/adapters/mongodb.ts +209 -34
  20. package/packages/orm/src/autoCrud.ts +9 -0
  21. package/packages/orm/src/crud.ts +273 -0
  22. package/packages/orm/src/crudHelpers.ts +194 -0
  23. package/packages/orm/src/crudRender.ts +202 -0
  24. package/packages/orm/src/crudTable.ts +171 -0
  25. package/packages/orm/src/index.ts +7 -1
  26. package/packages/orm/src/migration.ts +167 -4
  27. package/packages/orm/src/query.ts +99 -40
  28. package/packages/orm/src/sqlTranslator.ts +8 -1
  29. package/packages/orm/src/types.ts +19 -0
  30. package/types/core/src/devAdmin.d.ts +23 -0
  31. package/types/core/src/messenger.d.ts +4 -0
  32. package/types/core/src/router.d.ts +0 -5
  33. package/types/frond/src/engine.d.ts +6 -0
  34. package/types/frond/src/index.d.ts +1 -1
  35. package/types/orm/src/crud.d.ts +82 -0
  36. package/types/orm/src/crudHelpers.d.ts +63 -0
  37. package/types/orm/src/crudRender.d.ts +38 -0
  38. package/types/orm/src/crudTable.d.ts +45 -0
  39. package/types/orm/src/index.d.ts +3 -1
  40. package/types/orm/src/migration.d.ts +0 -18
  41. package/types/orm/src/query.d.ts +0 -12
  42. package/types/orm/src/types.d.ts +19 -0
package/CLAUDE.md CHANGED
@@ -13,13 +13,13 @@ Even if the skill text is not currently loaded, these are non-negotiable:
13
13
 
14
14
  The full discipline lives in `.claude/skills/tina4-maintainer/SKILL.md`; this block is the always-on floor.
15
15
 
16
- # CLAUDE.md - AI Developer Guide for tina4-nodejs (v3.13.148)
16
+ # CLAUDE.md - AI Developer Guide for tina4-nodejs (v3.13.149)
17
17
 
18
18
  > This file helps AI assistants (Claude, Copilot, Cursor, etc.) understand and work on this codebase effectively.
19
19
 
20
20
  ## What This Project Is
21
21
 
22
- Tina4 for Node.js/TypeScript v3.13.148 - The Intelligent Native Application 4ramework. A convention-over-configuration structural paradigm. The developer writes TypeScript; Tina4 is invisible infrastructure.
22
+ Tina4 for Node.js/TypeScript v3.13.149 - The Intelligent Native Application 4ramework. A convention-over-configuration structural paradigm. The developer writes TypeScript; Tina4 is invisible infrastructure.
23
23
 
24
24
  The philosophy: zero ceremony, batteries included, file system as source of truth.
25
25
 
@@ -135,6 +135,7 @@ The HTTP foundation. Handles request/response lifecycle, route matching, middlew
135
135
  - `TINA4_MCP` / `TINA4_DEBUG` - capability gate (whether MCP is enabled at all). Explicit `TINA4_MCP` true/false wins on any host; else `TINA4_DEBUG=true` enables it.
136
136
  - `TINA4_MCP_TOKEN` - bearer token authorising a REMOTE MCP request (fallback `TINA4_API_KEY`). Accepted as `Authorization: Bearer`, `X-MCP-Token`, or `X-Api-Key`. With no token configured a remote caller is always denied. Loopback callers never need it.
137
137
  - `TINA4_MCP_REMOTE` - set `true` to allow non-loopback MCP callers at all (still requires a valid token).
138
+ - `TINA4_DEV_ALLOWED_PEERS` - opt-in comma-separated IP/CIDR allow-list of RAW socket peers admitted to `/__dev` (v4/v6 via `net.BlockList`; never a forwarded header). Default none. The documented way to reach the dev dashboard from a Docker dev box, where requests arrive from the container-network gateway, e.g. `TINA4_DEV_ALLOWED_PEERS=172.16.0.0/12` (#279). `/__dev/toolbar.css` and `/__dev/toolbar.js` are static and always load; a viewer the gate would refuse gets no toolbar injected.
138
139
  - `auth.ts` — Authentication helpers
139
140
  - `cache.ts` — In-memory caching
140
141
  - `session.ts` — Session management with pluggable handlers. `TINA4_SESSION_SAMESITE` env var (default: Lax)
@@ -895,7 +896,7 @@ const adults = User.query().where("age > ?", [18]).orderBy("name").get();
895
896
 
896
897
  SQL-file based migrations under `migrations/`. The framework runs pending migrations on startup; the helpers here are for programmatic control (CLI, scripts, tests).
897
898
 
898
- **Auto-run on startup (`TINA4_AUTO_MIGRATE`, default on).** `startServer()` calls `autoMigrateOnStartup()` (in `server.ts`) AFTER `initDatabase()`/model sync and BEFORE the server listens. When a `migrations/` folder with at least one `.sql` file exists, `TINA4_AUTO_MIGRATE` is not falsy (default `"true"`; `false`/`0`/`no`/`off` disable), and a DB adapter is resolvable, it runs the existing `migrate()` runner so the schema is current with no manual `tina4 migrate` step. It is **non-breaking**: a failure is logged via `Log.error` and the service still starts (a bad migration must never take the backend down). The runner is wrapped in try/catch and `autoMigrateOnStartup()` never rejects/throws out of the boot path. Set `TINA4_AUTO_MIGRATE=false` to disable (e.g. multi-instance production that migrates as a separate deploy step — concurrent first-apply can race). The explicit `tina4 migrate` CLI (`packages/cli/src/commands/migrate.ts`) is unaffected and stays **fail-fast** (`process.exit(1)` on a statement error) so CI keeps the non-zero exit code.
899
+ **Auto-run on startup (`TINA4_AUTO_MIGRATE`, default on).** `startServer()` calls `autoMigrateOnStartup()` (in `server.ts`) AFTER `initDatabase()`/model sync and BEFORE the server listens. When a `migrations/` folder with at least one `.sql` file exists, `TINA4_AUTO_MIGRATE` is not falsy (default `"true"`; `false`/`0`/`no`/`off` disable), and a DB adapter is resolvable, it runs the existing `migrate()` runner so the schema is current with no manual `tina4 migrate` step. It is **non-breaking**: a failure is logged via `Log.error` and the service still starts (a bad migration must never take the backend down). The runner is wrapped in try/catch and `autoMigrateOnStartup()` never rejects/throws out of the boot path. Concurrent startup migrations are serialized by a run-wide lock in `migrate()` (PostgreSQL/MySQL/MSSQL advisory lock; an atomic exclusive-file lock for SQLite/Firebird, since Node core has no flock), so several workers/instances booting at once each apply every migration exactly once (#277) — the lock serializes per-DB (advisory) or per-host (file lock). Set `TINA4_AUTO_MIGRATE=false` to disable; a cross-HOST fleet that boots simultaneously should set it off and run one `tina4 migrate` per deploy. The explicit `tina4 migrate` CLI (`packages/cli/src/commands/migrate.ts`) is unaffected and stays **fail-fast** (`process.exit(1)` on a statement error) so CI keeps the non-zero exit code.
899
900
 
900
901
  ```typescript
901
902
  import {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tina4-nodejs",
3
- "version": "3.13.148",
3
+ "version": "3.13.149",
4
4
  "type": "module",
5
5
  "description": "Tina4 for Node.js/TypeScript - native TypeScript conventions and shared Tina4 contracts",
6
6
  "keywords": [