tina4-nodejs 3.9.2 → 3.9.3

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 (2) hide show
  1. package/CLAUDE.md +17 -12
  2. package/package.json +1 -1
package/CLAUDE.md CHANGED
@@ -1,10 +1,10 @@
1
- # CLAUDE.md — AI Developer Guide for tina4-nodejs (v3.9.1)
1
+ # CLAUDE.md — AI Developer Guide for tina4-nodejs (v3.9.2)
2
2
 
3
3
  > This file helps AI assistants (Claude, Copilot, Cursor, etc.) understand and work on this codebase effectively.
4
4
 
5
5
  ## What This Project Is
6
6
 
7
- Tina4 for Node.js/TypeScript v3.9.1 — a convention-over-configuration structural paradigm. **Not a framework.** The developer writes TypeScript; Tina4 is invisible infrastructure.
7
+ Tina4 for Node.js/TypeScript v3.9.2 — a convention-over-configuration structural paradigm. **Not a framework.** The developer writes TypeScript; Tina4 is invisible infrastructure.
8
8
 
9
9
  The philosophy: zero ceremony, batteries included, file system as source of truth.
10
10
 
@@ -38,12 +38,12 @@ tina4-nodejs/
38
38
  service.ts # Service layer helpers
39
39
  session.ts # Session management
40
40
  testing.ts # Inline testing framework (attach tests to functions)
41
- websocket.ts # WebSocket support
41
+ websocket.ts # WebSocket support (with backplane)
42
42
  wsdl.ts # WSDL / SOAP support
43
43
  orm/ # Database adapters, models, auto-CRUD, query builder, seeding
44
44
  src/
45
45
  adapters/
46
- sqlite.ts # SQLite via better-sqlite3 (default)
46
+ sqlite.ts # SQLite via node:sqlite (default)
47
47
  postgres.ts # PostgreSQL adapter
48
48
  mysql.ts # MySQL adapter
49
49
  mssql.ts # MSSQL / SQL Server adapter
@@ -69,7 +69,7 @@ This is an **npm workspaces monorepo**. All packages are in `packages/*`.
69
69
  - **Language:** TypeScript (strict mode, ES2022 target, Node16 module resolution)
70
70
  - **Runtime:** Node.js 20+ (ESM only, `"type": "module"` everywhere)
71
71
  - **HTTP:** Native `node:http` — no Express, no Fastify
72
- - **Database:** SQLite via `better-sqlite3` (default), with adapters for Postgres, MySQL, MSSQL/SQL Server, and Firebird
72
+ - **Database:** SQLite via `node:sqlite` (default), with adapters for Postgres, MySQL, MSSQL/SQL Server, and Firebird
73
73
  - **Templates:** Twig via `twig` npm package (optional)
74
74
  - **Dev tooling:** `tsx` for runtime TS execution, `esbuild` for builds
75
75
  - **Testing:** 43 test files via `tsx test/run-all.ts`
@@ -120,8 +120,8 @@ The HTTP foundation. Handles request/response lifecycle, route matching, middlew
120
120
  - `devAdmin.ts` — Dev toolbar (fixed bottom bar injected into HTML pages) and admin dashboard at `/_dev/`
121
121
  - `auth.ts` — Authentication helpers
122
122
  - `cache.ts` — In-memory caching
123
- - `session.ts` — Session management with pluggable handlers
124
- - `websocket.ts` — WebSocket support
123
+ - `session.ts` — Session management with pluggable handlers. `TINA4_SESSION_SAMESITE` env var (default: Lax)
124
+ - `websocket.ts` — WebSocket support with backplane for scaling via Redis pub/sub (`TINA4_WS_BACKPLANE`, `TINA4_WS_BACKPLANE_URL`)
125
125
  - `queue.ts` — Queue system with pluggable backends
126
126
  - `graphql.ts` — GraphQL engine
127
127
  - `i18n.ts` — Internationalization / localization
@@ -139,7 +139,7 @@ Database layer with auto-CRUD generation, seeding, fake data, and SQL translatio
139
139
 
140
140
  **Key files:**
141
141
  - `database.ts` — Adapter manager, `initDatabase()` factory
142
- - `adapters/sqlite.ts` — `better-sqlite3` implementation of `DatabaseAdapter` interface
142
+ - `adapters/sqlite.ts` — `node:sqlite` implementation of `DatabaseAdapter` interface
143
143
  - `adapters/postgres.ts` — PostgreSQL adapter
144
144
  - `adapters/mysql.ts` — MySQL adapter
145
145
  - `adapters/mssql.ts` — MSSQL / SQL Server adapter (`mssql` or `sqlserver` scheme)
@@ -153,6 +153,7 @@ Database layer with auto-CRUD generation, seeding, fake data, and SQL translatio
153
153
  - `fakeData.ts` — ORM-aware fake data extending core (adds `forField()` with column-name heuristics)
154
154
  - `seeder.ts` — Database seeding (`seedTable` for raw SQL, `seedOrm` for model-based)
155
155
  - `sqlTranslation.ts` — Cross-engine SQL translator (`SQLTranslator`) and TTL query cache (`QueryCache`)
156
+ - QueryBuilder supports `toMongo()` for generating MongoDB query documents from the same fluent API
156
157
 
157
158
  ### @tina4/swagger (`packages/swagger/`)
158
159
  Auto-generates OpenAPI 3.0 docs.
@@ -173,7 +174,7 @@ Developer-facing CLI commands.
173
174
 
174
175
  **Key files:**
175
176
  - `bin.ts` — Entry point, command dispatch (`init`, `serve`, `--help`)
176
- - `commands/init.ts` — Scaffolds a new project directory with sample files
177
+ - `commands/init.ts` — Scaffolds a new project directory with sample files, Dockerfile, and .dockerignore
177
178
  - `commands/serve.ts` — Starts dev server with hot-reload via `@tina4/core`
178
179
 
179
180
  ## Module: Events (`packages/core/src/events.ts`)
@@ -469,7 +470,7 @@ import { Router } from "./router.js"; // .js even though the file is .ts
469
470
  3. **Convention-based models** — `static fields = {}` over decorators. No special TypeScript config needed.
470
471
  4. **CDN for Swagger UI** — Keeps install under 8MB. Single HTML file loads from unpkg.com.
471
472
  5. **Process restart for hot-reload** — Simpler and more reliable than HMR with ESM.
472
- 6. **SQLite default** — `better-sqlite3` is synchronous and fast. Full adapters for Postgres, MySQL, MSSQL/SQL Server, and Firebird.
473
+ 6. **SQLite default** — `node:sqlite` is synchronous and fast. Full adapters for Postgres, MySQL, MSSQL/SQL Server, and Firebird.
473
474
  7. **CLI named `tina4nodejs`** (primary) with `tina4` as alias — So `npx tina4nodejs init` or `npx tina4 init` both work.
474
475
  8. **Event system** — Static `Events` class, synchronous dispatch, priority ordering, zero deps.
475
476
  9. **Inline testing** — Tests as decorators on functions, no external test runner for unit-level checks.
@@ -531,7 +532,7 @@ await initDatabase({ type: "postgres", host: "localhost", port: 5432, database:
531
532
  ### Available adapters
532
533
  | Adapter | Scheme(s) | Package |
533
534
  |---------|-----------|---------|
534
- | SQLite | `sqlite://` | `better-sqlite3` |
535
+ | SQLite | `sqlite://` | `node:sqlite` |
535
536
  | PostgreSQL | `postgres://`, `postgresql://` | `pg` |
536
537
  | MySQL | `mysql://` | `mysql2` |
537
538
  | MSSQL | `mssql://`, `sqlserver://` | `tedious` |
@@ -586,12 +587,16 @@ When adding new features, add a corresponding `test/<feature>.test.ts` file.
586
587
  - **Production server auto-detect**: `npx tina4nodejs serve --production` auto-uses cluster mode
587
588
  - **`npx tina4nodejs generate`**: model, route, migration, middleware scaffolding
588
589
  - **Database**: 5 engines (SQLite, PostgreSQL, MySQL, MSSQL, Firebird), query caching (`TINA4_DB_CACHE=true`)
589
- - **Sessions**: file backend (default)
590
+ - **Sessions**: file backend (default). `TINA4_SESSION_SAMESITE` env var (default: Lax)
590
591
  - **Queue**: file/RabbitMQ/Kafka/MongoDB backends, configured via env vars
591
592
  - **Cache**: memory/Redis/file backends
592
593
  - **Messenger**: .env driven SMTP/IMAP
593
594
  - **ORM relationships**: `hasMany`, `hasOne`, `belongsTo` with eager loading (`include`)
594
595
  - **Frond pre-compilation**: 2.8x template render improvement
596
+ - **QueryBuilder** with NoSQL/MongoDB support (`toMongo()`)
597
+ - **WebSocket backplane** (Redis pub/sub) for horizontal scaling
598
+ - **SameSite=Lax** default on session cookies (`TINA4_SESSION_SAMESITE`)
599
+ - **`tina4 init`** generates Dockerfile and .dockerignore
595
600
  - **Gallery**: 7 interactive examples with Try It deploy at `/_dev/`
596
601
 
597
602
  ## Don'ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tina4-nodejs",
3
- "version": "3.9.2",
3
+ "version": "3.9.3",
4
4
  "type": "module",
5
5
  "description": "This is not a framework. Tina4 for Node.js/TypeScript — zero deps, 38 built-in features.",
6
6
  "keywords": ["tina4", "framework", "web", "api", "orm", "graphql", "websocket", "typescript"],