tina4-nodejs 3.13.164 → 3.13.166

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 (46) hide show
  1. package/CLAUDE.md +12 -5
  2. package/package.json +1 -1
  3. package/packages/cli/dist/bin.js +1312 -979
  4. package/packages/cli/src/bin.ts +5 -2
  5. package/packages/cli/src/commands/lint.ts +3 -1
  6. package/packages/cli/src/commands/seed.ts +10 -11
  7. package/packages/core/dist/index.js +1232 -897
  8. package/packages/core/src/batchSpawn.ts +129 -0
  9. package/packages/core/src/connectionUrl.ts +242 -0
  10. package/packages/core/src/devAdmin.ts +25 -11
  11. package/packages/core/src/fakeData.ts +51 -13
  12. package/packages/core/src/index.ts +1 -1
  13. package/packages/core/src/mcp.ts +4 -1
  14. package/packages/core/src/mqtt.ts +24 -48
  15. package/packages/core/src/portTakeover.ts +31 -13
  16. package/packages/core/src/projectIndex.ts +3 -4
  17. package/packages/core/src/projectIndexStorage.ts +9 -1
  18. package/packages/core/src/queueBackends/rabbitmqBackend.ts +32 -20
  19. package/packages/core/src/response.ts +4 -1
  20. package/packages/core/src/routeDiscovery.ts +8 -2
  21. package/packages/core/src/router.ts +44 -30
  22. package/packages/core/src/server.ts +53 -33
  23. package/packages/core/src/session.ts +5 -0
  24. package/packages/core/src/sessionHandlers/databaseHandler.ts +16 -0
  25. package/packages/core/src/urlRedaction.ts +252 -0
  26. package/packages/core/src/websocketBackplane.ts +15 -3
  27. package/packages/orm/dist/index.js +1259 -925
  28. package/packages/orm/src/database.ts +7 -1
  29. package/packages/orm/src/databaseUrl.ts +73 -190
  30. package/packages/orm/src/docstore.ts +8 -1
  31. package/packages/orm/src/graph/graphUrl.ts +43 -7
  32. package/packages/orm/src/model.ts +2 -1
  33. package/types/core/src/batchSpawn.d.ts +28 -0
  34. package/types/core/src/connectionUrl.d.ts +61 -0
  35. package/types/core/src/fakeData.d.ts +11 -2
  36. package/types/core/src/index.d.ts +1 -1
  37. package/types/core/src/portTakeover.d.ts +15 -0
  38. package/types/core/src/projectIndexStorage.d.ts +5 -0
  39. package/types/core/src/queueBackends/rabbitmqBackend.d.ts +0 -7
  40. package/types/core/src/router.d.ts +17 -2
  41. package/types/core/src/server.d.ts +13 -0
  42. package/types/core/src/session.d.ts +5 -0
  43. package/types/core/src/sessionHandlers/databaseHandler.d.ts +8 -0
  44. package/types/core/src/urlRedaction.d.ts +61 -0
  45. package/types/orm/src/databaseUrl.d.ts +18 -19
  46. package/types/orm/src/graph/graphUrl.d.ts +18 -0
@@ -19,7 +19,7 @@ import { generate, GENERATORS, RESOLUTION_ENVELOPE_VERSION, RESOLUTION_FLAGS } f
19
19
  import { runSeeds } from "./commands/seed.js";
20
20
  import { queueCommand, QUEUE_FLAGS, QUEUE_SUBCOMMAND_NAMES } from "./commands/queue.js";
21
21
  import { buildImage } from "./commands/build.js";
22
- import { spawnSync } from "node:child_process";
22
+ import { spawnSyncAllowingBatch } from "../../core/src/batchSpawn.js";
23
23
  import { existsSync, readFileSync } from "node:fs";
24
24
  import { dirname, join } from "node:path";
25
25
  import { findOnPath } from "./util.js";
@@ -557,7 +557,10 @@ export function delegateToClient(command: string, args: string[]): number {
557
557
 
558
558
  // stdio is inherited, so the client's interactive prompts (setup) and colour
559
559
  // output work exactly as if it had been invoked directly.
560
- const result = spawnSync(client, [command, ...args], {
560
+ // A tina4.cmd / tina4.bat client is accepted above, so it must be startable:
561
+ // Node will not spawn a batch file without a shell, and a plain shell would
562
+ // not escape the user's arguments.
563
+ const result = spawnSyncAllowingBatch(client, [command, ...args], {
561
564
  stdio: "inherit",
562
565
  env: { ...process.env, [DELEGATION_GUARD_ENV]: command },
563
566
  });
@@ -46,6 +46,7 @@ import { createRequire } from "node:module";
46
46
  import { dirname, join, relative } from "node:path";
47
47
  import { findOnPath } from "../util.js";
48
48
  import { spawnSync } from "node:child_process";
49
+ import { spawnSyncAllowingBatch } from "../../../core/src/batchSpawn.js";
49
50
 
50
51
  // Source extensions we count as lintable app code. `.d.ts` declaration files are
51
52
  // deliberately excluded — they carry no runnable code for `node --check` and are
@@ -237,7 +238,8 @@ function bootstrapEslint(cwd: string, noInstall: boolean): EslintSetup {
237
238
  }
238
239
  if (!bin) {
239
240
  console.log(" · installing eslint (npm i -D eslint @eslint/js typescript-eslint)...");
240
- const rc = spawnSync(npm, ["install", "-D", "eslint", "@eslint/js", "typescript-eslint"], { cwd, stdio: "inherit" }).status;
241
+ // On Windows npm is npm.cmd, which Node will not spawn without a shell.
242
+ const rc = spawnSyncAllowingBatch(npm, ["install", "-D", "eslint", "@eslint/js", "typescript-eslint"], { cwd, stdio: "inherit" }).status;
241
243
  if (rc === 0) bin = resolveEslintBin(cwd);
242
244
  else console.log(" · could not install eslint — using the zero-dependency baseline.");
243
245
  }
@@ -12,7 +12,7 @@ file, You can obtain one at https://mozilla.org/MPL/2.0/.
12
12
  * Scans src/seeds/ for .ts files and executes them with tsx in alphabetical order.
13
13
  */
14
14
  import { existsSync, readdirSync } from "node:fs";
15
- import { resolve, join } from "node:path";
15
+ import { resolve, join, relative, basename } from "node:path";
16
16
  import { execSync } from "node:child_process";
17
17
 
18
18
  export async function runSeeds(seedPath?: string): Promise<void> {
@@ -44,8 +44,10 @@ export async function runSeeds(seedPath?: string): Promise<void> {
44
44
 
45
45
  let seedFiles: string[];
46
46
  try {
47
+ // Same selection as FakeData.seedDir (ADR-0108): .ts/.js in name order,
48
+ // skipping files whose name starts with "_".
47
49
  seedFiles = readdirSync(seedDir)
48
- .filter((f) => f.endsWith(".ts"))
50
+ .filter((f) => (f.endsWith(".ts") || f.endsWith(".js")) && !f.startsWith("_"))
49
51
  .sort()
50
52
  .map((f) => join(seedDir, f));
51
53
  } catch {
@@ -60,21 +62,18 @@ export async function runSeeds(seedPath?: string): Promise<void> {
60
62
 
61
63
  console.log(` Found ${seedFiles.length} seed file(s)\n`);
62
64
 
63
- let failed = false;
65
+ // ADR-0108: the first seed file that fails stops the run and exits 1, so a
66
+ // failed seeder fails `tina4 seed` (the client propagates the code). Later
67
+ // files are not run: they usually build on the rows the failed one owed.
64
68
  for (const file of seedFiles) {
65
- const relative = file.replace(cwd + "/", "");
66
- console.log(` Seeding: ${relative}`);
69
+ console.log(` Seeding: ${relative(cwd, file)}`);
67
70
  try {
68
71
  execSync(`npx tsx "${file}"`, { cwd, stdio: "inherit" });
69
72
  } catch {
70
- failed = true;
73
+ console.error(`\n Seed file failed: ${basename(file)} - seeding stopped.`);
74
+ process.exit(1);
71
75
  }
72
76
  }
73
77
 
74
- if (failed) {
75
- console.error("\n Some seeds failed.");
76
- process.exit(1);
77
- }
78
-
79
78
  console.log("\n All seeds completed.");
80
79
  }