tina4-nodejs 3.13.142 → 3.13.144
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.
- package/CLAUDE.md +28 -2
- package/package.json +1 -1
- package/packages/cli/dist/bin.js +379 -85
- package/packages/cli/src/commands/generate.ts +7 -2
- package/packages/cli/src/commands/init.ts +18 -8
- package/packages/core/dist/index.js +377 -78
- package/packages/core/gallery/auth/src/routes/gallery/auth/get.ts +27 -11
- package/packages/core/gallery/queue/src/routes/gallery/queue/get.ts +20 -7
- package/packages/core/gallery/templates/src/templates/gallery_page.twig +34 -15
- package/packages/core/src/csp.ts +138 -0
- package/packages/core/src/errorOverlay.ts +80 -37
- package/packages/core/src/index.ts +10 -0
- package/packages/core/src/middleware.ts +20 -6
- package/packages/core/src/response.ts +14 -3
- package/packages/core/src/server.ts +52 -15
- package/packages/core/src/session.ts +154 -7
- package/packages/core/src/sso.ts +1 -1
- package/packages/core/src/types.ts +8 -0
- package/packages/core/templates/errors/302.twig +1 -1
- package/packages/core/templates/errors/401.twig +2 -2
- package/packages/core/templates/errors/403.twig +1 -1
- package/packages/core/templates/errors/404.twig +1 -1
- package/packages/core/templates/errors/500.twig +1 -1
- package/packages/core/templates/errors/502.twig +2 -2
- package/packages/core/templates/errors/503.twig +2 -2
- package/packages/core/templates/errors/base.twig +4 -1
- package/packages/frond/dist/index.js +2 -0
- package/packages/frond/src/engine.ts +23 -0
- package/packages/orm/dist/index.js +378 -87
- package/packages/swagger/dist/index.js +4 -4
- package/packages/swagger/src/ui.ts +7 -4
- package/types/core/src/csp.d.ts +42 -0
- package/types/core/src/index.d.ts +1 -0
- package/types/core/src/middleware.d.ts +6 -0
- package/types/core/src/session.d.ts +62 -2
- package/types/core/src/types.d.ts +8 -0
- package/types/frond/src/engine.d.ts +7 -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.
|
|
16
|
+
# CLAUDE.md - AI Developer Guide for tina4-nodejs (v3.13.144)
|
|
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.
|
|
22
|
+
Tina4 for Node.js/TypeScript v3.13.144 - 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
|
|
|
@@ -948,6 +948,32 @@ frond.unsandbox();
|
|
|
948
948
|
- **Raw blocks** — `{% raw %}...{% endraw %}` outputs literal template syntax.
|
|
949
949
|
- **Pre-compiled regexes** + token caching (cleared on file mtime change in dev mode) for ~2.8x render improvement over the naive path.
|
|
950
950
|
|
|
951
|
+
### Inline `<style>` / `<script>` under the default CSP — use `csp_nonce()` (ADR-0088)
|
|
952
|
+
|
|
953
|
+
Tina4 serves a strict default Content-Security-Policy (`default-src 'self'`). A
|
|
954
|
+
browser refuses any inline `<style>` or `<script>` under that policy unless the
|
|
955
|
+
element carries a nonce the CSP header also names. The framework mints one nonce
|
|
956
|
+
per response, injects `'nonce-<X>'` into `style-src` and `script-src`, and exposes
|
|
957
|
+
the value as the Frond global `csp_nonce()` (and as `res.cspNonce` in a route). So
|
|
958
|
+
a template that needs an inline block stamps the nonce on it:
|
|
959
|
+
|
|
960
|
+
```twig
|
|
961
|
+
<style nonce="{{ csp_nonce() }}">.badge{color:var(--primary)}</style>
|
|
962
|
+
<script nonce="{{ csp_nonce() }}">console.log("ready");</script>
|
|
963
|
+
```
|
|
964
|
+
|
|
965
|
+
Two rules the nonce does NOT cover, so prefer classes and `addEventListener`:
|
|
966
|
+
- **No `style="..."` attributes** — a nonce covers a `<style>` ELEMENT, never a
|
|
967
|
+
style attribute. Move inline styles into a nonce'd `<style>` block or an external
|
|
968
|
+
stylesheet (same-origin `'self'` is already allowed).
|
|
969
|
+
- **No inline `onclick=` / `on*=` handlers** — bind them in a nonce'd `<script>`
|
|
970
|
+
with `addEventListener` instead.
|
|
971
|
+
|
|
972
|
+
An external `<script src="...">` or `<link rel="stylesheet">` needs no nonce
|
|
973
|
+
(same-origin `'self'` already allows it). A **static** HTML file cannot carry a
|
|
974
|
+
per-response nonce, so keep static pages free of inline blocks (use an external
|
|
975
|
+
stylesheet); render a page that needs an inline block through a Frond template.
|
|
976
|
+
|
|
951
977
|
## Module: Api (`packages/core/src/api.ts`)
|
|
952
978
|
|
|
953
979
|
Zero-dep HTTP client over `node:http` / `node:https`. Used by integrations, queue producers, health checks, and tests.
|