tina4-nodejs 3.13.160 → 3.13.161

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 CHANGED
@@ -14,13 +14,13 @@ Even if the skill text is not currently loaded, these are non-negotiable:
14
14
 
15
15
  The full discipline lives in `.claude/skills/tina4-maintainer/SKILL.md`; this block is the always-on floor.
16
16
 
17
- # CLAUDE.md - AI Developer Guide for tina4-nodejs (v3.13.160)
17
+ # CLAUDE.md - AI Developer Guide for tina4-nodejs (v3.13.161)
18
18
 
19
19
  > This file helps AI assistants (Claude, Copilot, Cursor, etc.) understand and work on this codebase effectively.
20
20
 
21
21
  ## What This Project Is
22
22
 
23
- Tina4 for Node.js/TypeScript v3.13.160 - The Intelligent Native Application 4ramework. A convention-over-configuration structural paradigm. The developer writes TypeScript; Tina4 is invisible infrastructure.
23
+ Tina4 for Node.js/TypeScript v3.13.161 - The Intelligent Native Application 4ramework. A convention-over-configuration structural paradigm. The developer writes TypeScript; Tina4 is invisible infrastructure.
24
24
 
25
25
  The philosophy: zero ceremony, batteries included, file system as source of truth.
26
26
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tina4-nodejs",
3
- "version": "3.13.160",
3
+ "version": "3.13.161",
4
4
  "type": "module",
5
5
  "description": "Tina4 for Node.js/TypeScript - native TypeScript conventions and shared Tina4 contracts",
6
6
  "keywords": [
@@ -51154,6 +51154,7 @@ var init_testClient = __esm({
51154
51154
  "use strict";
51155
51155
  init_router();
51156
51156
  init_server();
51157
+ init_dotenv();
51157
51158
  TestResponse = class {
51158
51159
  status;
51159
51160
  body;
@@ -51169,7 +51170,18 @@ var init_testClient = __esm({
51169
51170
  for (const [name, values] of Object.entries(headerList)) {
51170
51171
  if (values.length > 0) flat[name] = values[values.length - 1];
51171
51172
  }
51172
- this.headers = flat;
51173
+ this.headers = new Proxy(flat, {
51174
+ get(target, prop, receiver) {
51175
+ if (typeof prop === "string" && !(prop in target) && prop.toLowerCase() in target) {
51176
+ return target[prop.toLowerCase()];
51177
+ }
51178
+ return Reflect.get(target, prop, receiver);
51179
+ },
51180
+ has(target, prop) {
51181
+ if (typeof prop === "string" && prop.toLowerCase() in target) return true;
51182
+ return Reflect.has(target, prop);
51183
+ }
51184
+ });
51173
51185
  this.contentType = this.headers["content-type"] ?? "";
51174
51186
  }
51175
51187
  /**
@@ -51206,6 +51218,10 @@ var init_testClient = __esm({
51206
51218
  ctxPromise = null;
51207
51219
  constructor(router) {
51208
51220
  this.explicitRouter = router;
51221
+ try {
51222
+ loadEnv();
51223
+ } catch {
51224
+ }
51209
51225
  }
51210
51226
  /**
51211
51227
  * Resolve (and memoise) the DispatchContext this client dispatches
@@ -51092,6 +51092,7 @@ var init_testClient = __esm({
51092
51092
  "use strict";
51093
51093
  init_router();
51094
51094
  init_server();
51095
+ init_dotenv();
51095
51096
  TestResponse = class {
51096
51097
  status;
51097
51098
  body;
@@ -51107,7 +51108,18 @@ var init_testClient = __esm({
51107
51108
  for (const [name, values] of Object.entries(headerList)) {
51108
51109
  if (values.length > 0) flat[name] = values[values.length - 1];
51109
51110
  }
51110
- this.headers = flat;
51111
+ this.headers = new Proxy(flat, {
51112
+ get(target, prop, receiver) {
51113
+ if (typeof prop === "string" && !(prop in target) && prop.toLowerCase() in target) {
51114
+ return target[prop.toLowerCase()];
51115
+ }
51116
+ return Reflect.get(target, prop, receiver);
51117
+ },
51118
+ has(target, prop) {
51119
+ if (typeof prop === "string" && prop.toLowerCase() in target) return true;
51120
+ return Reflect.has(target, prop);
51121
+ }
51122
+ });
51111
51123
  this.contentType = this.headers["content-type"] ?? "";
51112
51124
  }
51113
51125
  /**
@@ -51144,6 +51156,10 @@ var init_testClient = __esm({
51144
51156
  ctxPromise = null;
51145
51157
  constructor(router) {
51146
51158
  this.explicitRouter = router;
51159
+ try {
51160
+ loadEnv();
51161
+ } catch {
51162
+ }
51147
51163
  }
51148
51164
  /**
51149
51165
  * Resolve (and memoise) the DispatchContext this client dispatches
@@ -48,6 +48,7 @@ import { IncomingMessage, ServerResponse } from "node:http";
48
48
  import { Socket } from "node:net";
49
49
  import { defaultRouter, Router } from "./router.js";
50
50
  import { runDispatch, buildDispatchContext, getLiveDispatchContext, type DispatchContext } from "./server.js";
51
+ import { loadEnv } from "./dotenv.js";
51
52
 
52
53
  export class TestResponse {
53
54
  public readonly status: number;
@@ -74,7 +75,25 @@ export class TestResponse {
74
75
  for (const [name, values] of Object.entries(headerList)) {
75
76
  if (values.length > 0) flat[name] = values[values.length - 1]!;
76
77
  }
77
- this.headers = flat;
78
+ // #300: HTTP header names are case-insensitive (RFC 9110), and
79
+ // getHeaderList() already treats them that way. Keys are STORED lower case,
80
+ // so Object.keys / spread / JSON.stringify are all unchanged — every reader
81
+ // sees the same object. A Proxy lowercases only the LOOKUP, so
82
+ // headers["Location"] finds a header emitted as "location" instead of
83
+ // undefined, while a real own/inherited member (toString, hasOwnProperty…)
84
+ // is left untouched.
85
+ this.headers = new Proxy(flat, {
86
+ get(target, prop, receiver) {
87
+ if (typeof prop === "string" && !(prop in target) && prop.toLowerCase() in target) {
88
+ return target[prop.toLowerCase()];
89
+ }
90
+ return Reflect.get(target, prop, receiver);
91
+ },
92
+ has(target, prop) {
93
+ if (typeof prop === "string" && prop.toLowerCase() in target) return true;
94
+ return Reflect.has(target, prop);
95
+ },
96
+ }) as Record<string, string>;
78
97
  this.contentType = this.headers["content-type"] ?? "";
79
98
  }
80
99
 
@@ -123,6 +142,16 @@ export class TestClient {
123
142
 
124
143
  constructor(router?: Router) {
125
144
  this.explicitRouter = router;
145
+
146
+ // #296: load .env the way startServer does, so a TestClient test that never
147
+ // started a server still sees TINA4_SECRET etc. loadEnv is override=false
148
+ // (first-wins, .env.local then .env), so a value the test set in the real
149
+ // environment is never clobbered — the test still wins.
150
+ try {
151
+ loadEnv();
152
+ } catch {
153
+ // A missing or unreadable .env must never stop a test from running.
154
+ }
126
155
  }
127
156
 
128
157
  /**
@@ -38506,6 +38506,7 @@ var init_testClient = __esm({
38506
38506
  "use strict";
38507
38507
  init_router();
38508
38508
  init_server();
38509
+ init_dotenv();
38509
38510
  TestResponse = class {
38510
38511
  status;
38511
38512
  body;
@@ -38521,7 +38522,18 @@ var init_testClient = __esm({
38521
38522
  for (const [name, values] of Object.entries(headerList)) {
38522
38523
  if (values.length > 0) flat[name] = values[values.length - 1];
38523
38524
  }
38524
- this.headers = flat;
38525
+ this.headers = new Proxy(flat, {
38526
+ get(target, prop, receiver) {
38527
+ if (typeof prop === "string" && !(prop in target) && prop.toLowerCase() in target) {
38528
+ return target[prop.toLowerCase()];
38529
+ }
38530
+ return Reflect.get(target, prop, receiver);
38531
+ },
38532
+ has(target, prop) {
38533
+ if (typeof prop === "string" && prop.toLowerCase() in target) return true;
38534
+ return Reflect.has(target, prop);
38535
+ }
38536
+ });
38525
38537
  this.contentType = this.headers["content-type"] ?? "";
38526
38538
  }
38527
38539
  /**
@@ -38558,6 +38570,10 @@ var init_testClient = __esm({
38558
38570
  ctxPromise = null;
38559
38571
  constructor(router) {
38560
38572
  this.explicitRouter = router;
38573
+ try {
38574
+ loadEnv();
38575
+ } catch {
38576
+ }
38561
38577
  }
38562
38578
  /**
38563
38579
  * Resolve (and memoise) the DispatchContext this client dispatches