tina4-nodejs 3.13.165 → 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.
- package/CLAUDE.md +12 -5
- package/package.json +1 -1
- package/packages/cli/dist/bin.js +596 -342
- package/packages/cli/src/commands/seed.ts +10 -11
- package/packages/core/dist/index.js +586 -328
- package/packages/core/src/connectionUrl.ts +242 -0
- package/packages/core/src/devAdmin.ts +18 -3
- package/packages/core/src/fakeData.ts +47 -12
- package/packages/core/src/index.ts +1 -1
- package/packages/core/src/mqtt.ts +24 -48
- package/packages/core/src/queueBackends/rabbitmqBackend.ts +32 -20
- package/packages/core/src/router.ts +44 -30
- package/packages/core/src/server.ts +35 -18
- package/packages/core/src/urlRedaction.ts +252 -0
- package/packages/core/src/websocketBackplane.ts +15 -3
- package/packages/orm/dist/index.js +577 -320
- package/packages/orm/src/database.ts +7 -1
- package/packages/orm/src/databaseUrl.ts +73 -190
- package/packages/orm/src/docstore.ts +8 -1
- package/packages/orm/src/graph/graphUrl.ts +43 -7
- package/types/core/src/connectionUrl.d.ts +61 -0
- package/types/core/src/fakeData.d.ts +11 -2
- package/types/core/src/index.d.ts +1 -1
- package/types/core/src/queueBackends/rabbitmqBackend.d.ts +0 -7
- package/types/core/src/router.d.ts +17 -2
- package/types/core/src/server.d.ts +13 -0
- package/types/core/src/urlRedaction.d.ts +61 -0
- package/types/orm/src/databaseUrl.d.ts +18 -19
- package/types/orm/src/graph/graphUrl.d.ts +18 -0
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
}
|