@voltro/cli 0.2.1 → 0.2.2
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/CHANGELOG.md +16 -0
- package/bin/voltro.mjs +20 -1
- package/dist/apiBuild-OpZROja5.js +2 -0
- package/dist/apiBuild-o70rjpVJ.js +184 -0
- package/dist/bin.js +2 -2
- package/dist/{commands-BgOfGwLc.js → commands-DQy4812j.js} +1992 -3032
- package/dist/{dev-BGYmeKEx.js → dev--jHe1vcu.js} +599 -595
- package/dist/dev-BKkZglQV.js +2 -0
- package/dist/index.js +1 -1
- package/dist/serveCommand-93rRdEp0.js +1077 -0
- package/dist/serveEntry.d.ts +22 -0
- package/dist/serveEntry.js +4 -0
- package/dist/startup.js +1 -1
- package/dist/{startupRunner-DAexyPkM.js → startupRunner-DhlX9nqd.js} +21 -9
- package/package.json +22 -17
- package/templates/agent-docs/deployment.md +12 -1
- package/templates/apps/api-ai/package.json +7 -7
- package/templates/apps/api-auth/package.json +8 -8
- package/templates/apps/api-backend/package.json +7 -7
- package/templates/apps/api-backend-deactivation/package.json +7 -7
- package/templates/apps/api-backend-mail/package.json +8 -8
- package/templates/apps/api-backend-mariadb/package.json +9 -9
- package/templates/apps/api-backend-storage/package.json +8 -8
- package/templates/apps/api-data-advanced/package.json +8 -8
- package/templates/apps/api-durable/package.json +8 -8
- package/templates/apps/api-feature-flags/package.json +9 -9
- package/templates/apps/api-governance/package.json +8 -8
- package/templates/apps/api-kv/package.json +8 -8
- package/templates/apps/api-moderation/package.json +8 -8
- package/templates/apps/api-observability/package.json +8 -8
- package/templates/apps/api-ratelimit/package.json +8 -8
- package/templates/apps/api-rbac/package.json +8 -8
- package/templates/apps/api-rest/package.json +7 -7
- package/templates/apps/api-saas/package.json +11 -11
- package/templates/apps/api-search/package.json +8 -8
- package/templates/apps/api-versioning/package.json +8 -8
- package/templates/apps/api-webhooks/package.json +8 -8
- package/templates/apps/changelog/package.json +6 -6
- package/templates/apps/edge-functions/package.json +2 -2
- package/templates/apps/frontend-admin/package.json +8 -8
- package/templates/apps/frontend-app/package.json +8 -8
- package/templates/apps/frontend-blank/package.json +7 -7
- package/templates/apps/frontend-contact/package.json +7 -7
- package/templates/apps/frontend-dashboard/package.json +7 -7
- package/templates/apps/frontend-docs/package.json +7 -7
- package/templates/apps/frontend-i18n/package.json +6 -6
- package/templates/apps/frontend-landing/package.json +7 -7
- package/templates/apps/frontend-spa/package.json +7 -7
- package/templates/apps/frontend-ssr/package.json +7 -7
- package/templates/apps/frontend-ssr-api/package.json +8 -8
- package/templates/apps/frontend-static-blog/package.json +6 -6
- package/dist/apiBuild-B0dd-oDo.js +0 -62
- package/dist/apiBuild-D09wjKKO.js +0 -2
- package/dist/dev-DoTIxucX.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { i as e, n as t, t as n } from "./startupRunner-DhlX9nqd.js";
|
|
2
2
|
import { t as r } from "./frameworkInspectState-CX2250XB.js";
|
|
3
3
|
import { basename as i, dirname as a, isAbsolute as o, join as s, relative as c, resolve as l } from "node:path";
|
|
4
4
|
import { fileURLToPath as u, pathToFileURL as d } from "node:url";
|
|
@@ -4157,14 +4157,18 @@ ${a.join("\n\n")}\n`);
|
|
|
4157
4157
|
mariadb: "@voltro/sql-mysql",
|
|
4158
4158
|
mssql: "@voltro/sql-mssql",
|
|
4159
4159
|
turso: "@voltro/sql-turso"
|
|
4160
|
-
}, Rc = {
|
|
4160
|
+
}, Rc = [...new Set(Object.values(Lc))], zc = {
|
|
4161
4161
|
postgres: "postgresDialect",
|
|
4162
4162
|
sqlite: "sqliteDialect",
|
|
4163
4163
|
mysql: "mysqlDialect",
|
|
4164
4164
|
mariadb: "mariadbDialect",
|
|
4165
4165
|
mssql: "mssqlDialect",
|
|
4166
4166
|
turso: "tursoDialect"
|
|
4167
|
-
},
|
|
4167
|
+
}, Bc = /* @__PURE__ */ new Map(), Vc = (e, t) => {
|
|
4168
|
+
Bc.set(e, t);
|
|
4169
|
+
}, Hc = async (e) => {
|
|
4170
|
+
let t = Bc.get(e);
|
|
4171
|
+
if (t) return t;
|
|
4168
4172
|
try {
|
|
4169
4173
|
return await import(d(sn(s(process.cwd(), "package.json")).resolve(e)).href);
|
|
4170
4174
|
} catch {
|
|
@@ -4174,11 +4178,11 @@ ${a.join("\n\n")}\n`);
|
|
|
4174
4178
|
throw Error(`The '${e}' database driver is not installed.\n\nEvery Voltro app declares the driver for its DB dialect as a dependency (a memory store needs none). Install it in the app:\n\n pnpm add ${e}\n`);
|
|
4175
4179
|
}
|
|
4176
4180
|
}
|
|
4177
|
-
},
|
|
4181
|
+
}, Uc = async (e) => {
|
|
4178
4182
|
let t = Lc[e];
|
|
4179
4183
|
if (!t) throw Error(`Unsupported DB_DIALECT='${e}'. Supported: memory, postgres, sqlite, mysql, mariadb, mssql, turso.`);
|
|
4180
|
-
return (await
|
|
4181
|
-
},
|
|
4184
|
+
return (await Hc(t))[zc[e]];
|
|
4185
|
+
}, Wc = [
|
|
4182
4186
|
{
|
|
4183
4187
|
table: Kn,
|
|
4184
4188
|
when: "always"
|
|
@@ -4271,16 +4275,16 @@ ${a.join("\n\n")}\n`);
|
|
|
4271
4275
|
table: z,
|
|
4272
4276
|
when: "always"
|
|
4273
4277
|
}
|
|
4274
|
-
],
|
|
4275
|
-
let t =
|
|
4278
|
+
], Gc = (e) => {
|
|
4279
|
+
let t = Wc.filter((t) => t.when === "always" || t.when === "workflows" && e.workflows || t.when === "schedules" && e.schedules || t.when === "webhooks" && e.webhooks || t.when === "traces" && e.traces || t.when === "undo" && e.undo === !0).map((e) => e.table);
|
|
4276
4280
|
return e.cdc === !0 && t.push(e.cdcDialect === "mssql" ? qn : Un), t;
|
|
4277
|
-
},
|
|
4281
|
+
}, Kc = (e) => {
|
|
4278
4282
|
let t = e.startsWith("@") ? e.replace(/^@[^/]+\//, "") : e;
|
|
4279
4283
|
return (t.startsWith("plugin-") ? t.slice(7) : t).replace(/-([a-zA-Z0-9])/g, (e, t) => t.toUpperCase());
|
|
4280
|
-
},
|
|
4284
|
+
}, qc = (e) => {
|
|
4281
4285
|
let t = e.startsWith("@") ? e.replace(/^@[^/]+\//, "") : e;
|
|
4282
4286
|
return (t.startsWith("plugin-") ? t.slice(7) : t).replace(/#/g, "--").replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
4283
|
-
},
|
|
4287
|
+
}, Jc = (e, t) => t.name.includes(".") ? t.name : `${Kc(e.name)}.${t.name}`, Yc = (e, t, n) => {
|
|
4284
4288
|
switch (e) {
|
|
4285
4289
|
case "query": return Tr({
|
|
4286
4290
|
name: t,
|
|
@@ -4302,23 +4306,23 @@ ${a.join("\n\n")}\n`);
|
|
|
4302
4306
|
...n.error === void 0 ? {} : { error: n.error }
|
|
4303
4307
|
});
|
|
4304
4308
|
}
|
|
4305
|
-
},
|
|
4309
|
+
}, Xc = (e) => (t, n) => y.suspend(() => {
|
|
4306
4310
|
let r = { request: {
|
|
4307
4311
|
subject: n.request.subject,
|
|
4308
4312
|
traceId: n.request.traceId
|
|
4309
4313
|
} };
|
|
4310
4314
|
return e.execute(t, r);
|
|
4311
|
-
}),
|
|
4315
|
+
}), Zc = (e) => {
|
|
4312
4316
|
let t = [];
|
|
4313
4317
|
for (let n of e) {
|
|
4314
4318
|
let e = n.routes ?? [];
|
|
4315
4319
|
for (let r of e) {
|
|
4316
|
-
let e =
|
|
4320
|
+
let e = Jc(n, r), i = Yc(r.kind, e, r);
|
|
4317
4321
|
t.push({
|
|
4318
4322
|
kind: r.kind,
|
|
4319
4323
|
file: `plugin:${n.name}`,
|
|
4320
4324
|
descriptor: i,
|
|
4321
|
-
executor:
|
|
4325
|
+
executor: Xc(r),
|
|
4322
4326
|
plugin: {
|
|
4323
4327
|
name: n.name,
|
|
4324
4328
|
version: n.version
|
|
@@ -4327,7 +4331,7 @@ ${a.join("\n\n")}\n`);
|
|
|
4327
4331
|
}
|
|
4328
4332
|
}
|
|
4329
4333
|
return t;
|
|
4330
|
-
},
|
|
4334
|
+
}, Qc = (e, t) => {
|
|
4331
4335
|
let n = /* @__PURE__ */ new Map();
|
|
4332
4336
|
for (let e of t) n.set(e, "user-route");
|
|
4333
4337
|
for (let t of e) {
|
|
@@ -4335,9 +4339,9 @@ ${a.join("\n\n")}\n`);
|
|
|
4335
4339
|
if (r !== void 0) throw Error(`plugin route tag collision: "${e}" declared by plugin "${t.plugin.name}" but already claimed by ${r === "user-route" ? "a user-authored route" : `plugin "${r}"`}`);
|
|
4336
4340
|
n.set(e, t.plugin.name);
|
|
4337
4341
|
}
|
|
4338
|
-
},
|
|
4342
|
+
}, $c = "_voltro_plugin_migrations", el = () => y.gen(function* () {
|
|
4339
4343
|
yield* (yield* R.SqlClient).unsafe(`
|
|
4340
|
-
CREATE TABLE IF NOT EXISTS ${
|
|
4344
|
+
CREATE TABLE IF NOT EXISTS ${$c} (
|
|
4341
4345
|
id TEXT PRIMARY KEY,
|
|
4342
4346
|
plugin_name TEXT NOT NULL,
|
|
4343
4347
|
migration_id TEXT NOT NULL,
|
|
@@ -4345,25 +4349,25 @@ ${a.join("\n\n")}\n`);
|
|
|
4345
4349
|
applied_at TEXT NOT NULL
|
|
4346
4350
|
);
|
|
4347
4351
|
`).pipe(y.orDie);
|
|
4348
|
-
}),
|
|
4349
|
-
let e = yield* R.SqlClient, t = yield* e`SELECT id FROM ${e(
|
|
4352
|
+
}), tl = (e, t) => `${Kc(e)}__${t}`, nl = () => y.gen(function* () {
|
|
4353
|
+
let e = yield* R.SqlClient, t = yield* e`SELECT id FROM ${e($c)}`.pipe(y.orDie);
|
|
4350
4354
|
return new Set(t.map((e) => e.id));
|
|
4351
|
-
}),
|
|
4355
|
+
}), rl = (e) => y.gen(function* () {
|
|
4352
4356
|
let t = yield* R.SqlClient, n = (/* @__PURE__ */ new Date()).toISOString();
|
|
4353
4357
|
yield* t`
|
|
4354
|
-
INSERT INTO ${t(
|
|
4358
|
+
INSERT INTO ${t($c)} (id, plugin_name, migration_id, description, applied_at)
|
|
4355
4359
|
VALUES (${e.key}, ${e.pluginName}, ${e.migration.id}, ${e.migration.description ?? null}, ${n})
|
|
4356
4360
|
`.pipe(y.orDie);
|
|
4357
|
-
}),
|
|
4361
|
+
}), il = (e) => y.gen(function* () {
|
|
4358
4362
|
let t = e.flatMap((e) => (e.extendSchema?.migrations ?? []).map((t) => ({
|
|
4359
4363
|
plugin: e,
|
|
4360
4364
|
migration: t
|
|
4361
4365
|
})));
|
|
4362
4366
|
if (t.length === 0) return [];
|
|
4363
|
-
yield*
|
|
4364
|
-
let n = yield*
|
|
4367
|
+
yield* el();
|
|
4368
|
+
let n = yield* nl(), r = [];
|
|
4365
4369
|
for (let { plugin: e, migration: i } of t) {
|
|
4366
|
-
let t =
|
|
4370
|
+
let t = tl(e.name, i.id), a = Date.now();
|
|
4367
4371
|
if (n.has(t)) {
|
|
4368
4372
|
r.push({
|
|
4369
4373
|
pluginName: e.name,
|
|
@@ -4375,7 +4379,7 @@ ${a.join("\n\n")}\n`);
|
|
|
4375
4379
|
}
|
|
4376
4380
|
let o = yield* R.SqlClient;
|
|
4377
4381
|
try {
|
|
4378
|
-
yield* i.up(o).pipe(y.mapError((e) => e)), yield*
|
|
4382
|
+
yield* i.up(o).pipe(y.mapError((e) => e)), yield* rl({
|
|
4379
4383
|
key: t,
|
|
4380
4384
|
pluginName: e.name,
|
|
4381
4385
|
migration: i
|
|
@@ -4396,32 +4400,32 @@ ${a.join("\n\n")}\n`);
|
|
|
4396
4400
|
}
|
|
4397
4401
|
}
|
|
4398
4402
|
return r;
|
|
4399
|
-
}),
|
|
4403
|
+
}), al = (e) => e.filter((e) => e.extendSchema && (e.extendSchema.tables?.length ?? 0) + (e.extendSchema.migrations?.length ?? 0) > 0).map((e) => ({
|
|
4400
4404
|
pluginName: e.name,
|
|
4401
|
-
pluginAlias:
|
|
4405
|
+
pluginAlias: Kc(e.name),
|
|
4402
4406
|
tables: e.extendSchema.tables?.length ?? 0,
|
|
4403
4407
|
migrations: e.extendSchema.migrations?.length ?? 0
|
|
4404
|
-
})),
|
|
4408
|
+
})), ol = (e) => e.flatMap((e) => e.extendSchema?.tables ?? []), sl = /(?<!\.server)\.agent\.tsx?$/, cl = /\.agent\.server\.tsx?$/, ll = /\.tool\.tsx?$/, ul = async (t, n) => {
|
|
4405
4409
|
let r = 0;
|
|
4406
|
-
for (let i of
|
|
4407
|
-
let
|
|
4408
|
-
r += hn(
|
|
4410
|
+
for (let i of t) if (ll.test(i)) try {
|
|
4411
|
+
let t = await e(i);
|
|
4412
|
+
r += hn(t);
|
|
4409
4413
|
} catch (e) {
|
|
4410
4414
|
n.warn("tool: failed to import — handler not wired", { file: i }, e);
|
|
4411
4415
|
}
|
|
4412
4416
|
return r;
|
|
4413
|
-
},
|
|
4417
|
+
}, dl = (e) => e.replace(/\.agent\.(tsx?)$/, ".agent.server.$1"), fl = async (t, n) => {
|
|
4414
4418
|
let r = [], i = /* @__PURE__ */ new Set();
|
|
4415
|
-
for (let a of
|
|
4416
|
-
if (!
|
|
4417
|
-
let
|
|
4419
|
+
for (let a of t) {
|
|
4420
|
+
if (!sl.test(a)) continue;
|
|
4421
|
+
let t;
|
|
4418
4422
|
try {
|
|
4419
|
-
|
|
4423
|
+
t = await e(a);
|
|
4420
4424
|
} catch (e) {
|
|
4421
4425
|
n.warn("agent: failed to import descriptor", { file: a }, e);
|
|
4422
4426
|
continue;
|
|
4423
4427
|
}
|
|
4424
|
-
let o = Object.values(
|
|
4428
|
+
let o = Object.values(t).find(fn);
|
|
4425
4429
|
if (o === void 0) {
|
|
4426
4430
|
n.warn("agent: no defineAgent() descriptor export found", { file: a });
|
|
4427
4431
|
continue;
|
|
@@ -4433,9 +4437,9 @@ ${a.join("\n\n")}\n`);
|
|
|
4433
4437
|
});
|
|
4434
4438
|
continue;
|
|
4435
4439
|
}
|
|
4436
|
-
let s =
|
|
4440
|
+
let s = dl(a), c;
|
|
4437
4441
|
try {
|
|
4438
|
-
c = await
|
|
4442
|
+
c = await e(s);
|
|
4439
4443
|
} catch (e) {
|
|
4440
4444
|
n.warn("agent: no executor — expected a `*.agent.server.tsx` default-exporting defineAgentExecutor()", {
|
|
4441
4445
|
descriptor: a,
|
|
@@ -4460,24 +4464,24 @@ ${a.join("\n\n")}\n`);
|
|
|
4460
4464
|
});
|
|
4461
4465
|
}
|
|
4462
4466
|
return { agents: r };
|
|
4463
|
-
},
|
|
4467
|
+
}, pl = (e) => typeof e.attributes["framework.kind"] == "string" && e.attributes["framework.kind"].startsWith("subscription."), ml = (e) => {
|
|
4464
4468
|
if (e.name.includes("_voltro_traces")) return !0;
|
|
4465
4469
|
for (let t in e.attributes) {
|
|
4466
4470
|
let n = e.attributes[t];
|
|
4467
4471
|
if (typeof n == "string" && n.includes("_voltro_traces")) return !0;
|
|
4468
4472
|
}
|
|
4469
4473
|
return !1;
|
|
4470
|
-
},
|
|
4474
|
+
}, hl = (e) => typeof e.attributes["framework.kind"] == "string" && e.attributes["framework.kind"].startsWith("subscription"), gl = 1e3, _l = 500, vl = 50, yl = class {
|
|
4471
4475
|
capacity;
|
|
4472
4476
|
buffer = [];
|
|
4473
|
-
constructor(e =
|
|
4477
|
+
constructor(e = gl) {
|
|
4474
4478
|
this.capacity = e;
|
|
4475
4479
|
}
|
|
4476
4480
|
append(e) {
|
|
4477
4481
|
this.buffer.push(e), this.buffer.length > this.capacity && this.buffer.shift();
|
|
4478
4482
|
}
|
|
4479
4483
|
query(e = {}) {
|
|
4480
|
-
let t = e.since ?? 0, n = e.until ?? Date.now(), r = Math.min(e.max ??
|
|
4484
|
+
let t = e.since ?? 0, n = e.until ?? Date.now(), r = Math.min(e.max ?? _l, this.capacity), i = e.traceId, a = e.minDurationMs, o = e.status, s = e.name?.toLowerCase(), c = [];
|
|
4481
4485
|
for (let e = this.buffer.length - 1; e >= 0 && c.length < r; e--) {
|
|
4482
4486
|
let r = this.buffer[e];
|
|
4483
4487
|
r.startMs < t || r.startMs > n || i !== void 0 && r.traceId !== i || a !== void 0 && r.durationMs < a || o !== void 0 && r.status !== o || s !== void 0 && !r.name.toLowerCase().includes(s) || c.push(r);
|
|
@@ -4485,7 +4489,7 @@ ${a.join("\n\n")}\n`);
|
|
|
4485
4489
|
return c.reverse();
|
|
4486
4490
|
}
|
|
4487
4491
|
queryGrouped(e = {}) {
|
|
4488
|
-
let t = e.since ?? 0, n = e.maxTraces ??
|
|
4492
|
+
let t = e.since ?? 0, n = e.maxTraces ?? vl, r = e.onlyErrors ?? !1, i = /* @__PURE__ */ new Map();
|
|
4489
4493
|
for (let e of this.buffer) {
|
|
4490
4494
|
if (e.startMs < t) continue;
|
|
4491
4495
|
let n = i.get(e.traceId);
|
|
@@ -4496,7 +4500,7 @@ ${a.join("\n\n")}\n`);
|
|
|
4496
4500
|
t.sort((e, t) => e.startMs - t.startMs);
|
|
4497
4501
|
let n = t.some((e) => e.status === "error");
|
|
4498
4502
|
if (r && !n) continue;
|
|
4499
|
-
let i = t[0].startMs, o = t.reduce((e, t) => t.endMs > e ? t.endMs : e, i), s = t.filter(
|
|
4503
|
+
let i = t[0].startMs, o = t.reduce((e, t) => t.endMs > e ? t.endMs : e, i), s = t.filter(pl), c = s.length > 0 || t.some(hl), l = s.reduce((e, t) => e === void 0 || t.startMs > e.startMs ? t : e, void 0);
|
|
4500
4504
|
a.push({
|
|
4501
4505
|
traceId: e,
|
|
4502
4506
|
rootName: t[0].name,
|
|
@@ -4521,69 +4525,69 @@ ${a.join("\n\n")}\n`);
|
|
|
4521
4525
|
clear() {
|
|
4522
4526
|
this.buffer = [];
|
|
4523
4527
|
}
|
|
4524
|
-
},
|
|
4528
|
+
}, bl = null, xl = () => (bl === null && (bl = new yl()), bl), Sl = /* @__PURE__ */ new Set([
|
|
4525
4529
|
"off",
|
|
4526
4530
|
"errors",
|
|
4527
4531
|
"interesting",
|
|
4528
4532
|
"all"
|
|
4529
|
-
]),
|
|
4533
|
+
]), Cl = (e, t, n, r) => {
|
|
4530
4534
|
let i = Number(e);
|
|
4531
4535
|
return Number.isFinite(i) ? Math.min(r, Math.max(n, i)) : t;
|
|
4532
|
-
},
|
|
4536
|
+
}, wl = (e) => e !== void 0 && [
|
|
4533
4537
|
"1",
|
|
4534
4538
|
"true",
|
|
4535
4539
|
"yes",
|
|
4536
4540
|
"on"
|
|
4537
|
-
].includes(e.toLowerCase()),
|
|
4541
|
+
].includes(e.toLowerCase()), Tl = (e) => {
|
|
4538
4542
|
let t = Number(e);
|
|
4539
4543
|
return Number.isFinite(t) && t > 0 ? t : 24;
|
|
4540
|
-
},
|
|
4541
|
-
let t = (e.VOLTRO_TRACING_BUFFER ?? "").toLowerCase() === "off", n =
|
|
4544
|
+
}, El = (e = process.env) => {
|
|
4545
|
+
let t = (e.VOLTRO_TRACING_BUFFER ?? "").toLowerCase() === "off", n = Cl(e.VOLTRO_TRACING_SAMPLE, 1, 0, 1), r = (e.VOLTRO_TRACING_PERSIST ?? "").toLowerCase(), i = e.NODE_ENV === "production" ? "off" : "interesting";
|
|
4542
4546
|
return {
|
|
4543
|
-
mode:
|
|
4547
|
+
mode: Sl.has(r) ? r : n <= 0 ? "off" : i,
|
|
4544
4548
|
sampleRate: n,
|
|
4545
|
-
slowMs:
|
|
4546
|
-
ttlHours:
|
|
4547
|
-
persistDelivery:
|
|
4549
|
+
slowMs: Cl(e.VOLTRO_TRACING_SLOW_MS, 500, 0, 2 ** 53 - 1),
|
|
4550
|
+
ttlHours: Tl(e.VOLTRO_TRACING_TTL_HOURS),
|
|
4551
|
+
persistDelivery: wl(e.VOLTRO_TRACING_PERSIST_DELIVERY),
|
|
4548
4552
|
bufferDisabled: t
|
|
4549
4553
|
};
|
|
4550
|
-
},
|
|
4551
|
-
let t =
|
|
4554
|
+
}, Dl = (e = process.env) => {
|
|
4555
|
+
let t = El(e);
|
|
4552
4556
|
return !t.bufferDisabled && t.mode !== "off";
|
|
4553
|
-
},
|
|
4557
|
+
}, Ol = (e, t) => {
|
|
4554
4558
|
if (t >= 1) return !0;
|
|
4555
4559
|
if (t <= 0) return !1;
|
|
4556
4560
|
let n = 2166136261;
|
|
4557
4561
|
for (let t = 0; t < e.length; t++) n ^= e.charCodeAt(t), n = Math.imul(n, 16777619);
|
|
4558
4562
|
return (n >>> 0) % 1e3 < t * 1e3;
|
|
4559
|
-
},
|
|
4560
|
-
if (t.mode === "off" ||
|
|
4563
|
+
}, kl = (e, t) => {
|
|
4564
|
+
if (t.mode === "off" || ml(e) || pl(e) && !t.persistDelivery) return !1;
|
|
4561
4565
|
let n = e.status === "error";
|
|
4562
4566
|
if (t.mode === "errors") return n;
|
|
4563
4567
|
if (n) return !0;
|
|
4564
|
-
if (!
|
|
4568
|
+
if (!Ol(e.traceId, t.sampleRate)) return !1;
|
|
4565
4569
|
if (t.mode === "all") return !0;
|
|
4566
4570
|
let r = e.parentSpanId === null || e.parentSpanId === void 0 || e.parentSpanId === "", i = typeof e.durationMs == "number" && e.durationMs >= t.slowMs;
|
|
4567
4571
|
return r || i;
|
|
4568
|
-
},
|
|
4572
|
+
}, Al = (e) => {
|
|
4569
4573
|
if (e.bufferDisabled) return "durable traces: OFF (VOLTRO_TRACING_BUFFER=off)";
|
|
4570
4574
|
if (e.mode === "off") return "durable traces: OFF — _voltro_traces not created (prod default; set VOLTRO_TRACING_PERSIST=interesting to enable, or use OTLP)";
|
|
4571
4575
|
let t = e.mode === "interesting" ? ` (errors + slow≥${e.slowMs}ms + roots)` : e.mode === "errors" ? " (errors only)" : "";
|
|
4572
4576
|
return `durable traces: mode=${e.mode}${t}` + (e.sampleRate < 1 ? ` · sample=${e.sampleRate}` : "") + (e.persistDelivery ? " · +delivery" : "") + ` · ttl=${e.ttlHours}h`;
|
|
4573
|
-
},
|
|
4577
|
+
}, jl = (e = 30 * 6e4) => {
|
|
4574
4578
|
let t = /* @__PURE__ */ new Map();
|
|
4575
4579
|
return (n, r) => {
|
|
4576
4580
|
let i = t.get(n);
|
|
4577
4581
|
return i !== void 0 && r - i < e ? !1 : (t.set(n, r), !0);
|
|
4578
4582
|
};
|
|
4579
|
-
},
|
|
4580
|
-
let { store: t, log: n } = e, r = e.policy ??
|
|
4581
|
-
n.info(
|
|
4582
|
-
let i =
|
|
4583
|
+
}, Ml = (e) => {
|
|
4584
|
+
let { store: t, log: n } = e, r = e.policy ?? El();
|
|
4585
|
+
n.info(Al(r));
|
|
4586
|
+
let i = jl(), a = [], o = () => {};
|
|
4583
4587
|
if (r.mode !== "off") {
|
|
4584
4588
|
let e = [], s = 0;
|
|
4585
4589
|
o = (t) => {
|
|
4586
|
-
|
|
4590
|
+
kl(t, r) && (e.length >= 5e3 && (e.shift(), s += 1, i("flush-drop", Date.now()) && (n.warn(`trace flush queue saturated — dropping durable spans (${s}+ since last warning). Durable inflow exceeds write throughput; reduce it with VOLTRO_TRACING_PERSIST=errors|interesting or VOLTRO_TRACING_SAMPLE<1.`), s = 0)), e.push(t));
|
|
4587
4591
|
};
|
|
4588
4592
|
let c = async () => {
|
|
4589
4593
|
if (e.length === 0) return;
|
|
@@ -4649,7 +4653,7 @@ ${a.join("\n\n")}\n`);
|
|
|
4649
4653
|
for (let e of a) clearInterval(e);
|
|
4650
4654
|
}
|
|
4651
4655
|
};
|
|
4652
|
-
},
|
|
4656
|
+
}, Nl = /\.workflow\.tsx?$/, Pl = /\.trigger\.tsx?$/, Fl = /\.cron\.tsx?$/, Il = /\.webhook\.tsx?$/, Ll = async (e) => {
|
|
4653
4657
|
let t = !1, n = !1, r = !1, i = !1, a = async (e) => {
|
|
4654
4658
|
let o = await N.readdir(e, { withFileTypes: !0 }).catch(() => []);
|
|
4655
4659
|
for (let c of o) if (c.isDirectory()) {
|
|
@@ -4657,7 +4661,7 @@ ${a.join("\n\n")}\n`);
|
|
|
4657
4661
|
await a(s(e, c.name));
|
|
4658
4662
|
} else {
|
|
4659
4663
|
let e = c.name;
|
|
4660
|
-
(
|
|
4664
|
+
(Nl.test(e) || Pl.test(e)) && (t = !0), Fl.test(e) && (n = !0), Il.test(e) && (r = !0), sl.test(e) && (i = !0);
|
|
4661
4665
|
}
|
|
4662
4666
|
};
|
|
4663
4667
|
return await a(e), {
|
|
@@ -4666,37 +4670,37 @@ ${a.join("\n\n")}\n`);
|
|
|
4666
4670
|
webhooks: r,
|
|
4667
4671
|
agents: i
|
|
4668
4672
|
};
|
|
4669
|
-
},
|
|
4673
|
+
}, Rl = async (e) => {
|
|
4670
4674
|
try {
|
|
4671
4675
|
return (await import(d(s(e, "app.config.ts")).href)).default?.plugins ?? [];
|
|
4672
4676
|
} catch {
|
|
4673
4677
|
return [];
|
|
4674
4678
|
}
|
|
4675
|
-
},
|
|
4679
|
+
}, zl = (e) => {
|
|
4676
4680
|
let t = /* @__PURE__ */ new Map(), n = (e) => {
|
|
4677
4681
|
e?.tableName && !t.has(e.tableName) && t.set(e.tableName, e);
|
|
4678
4682
|
};
|
|
4679
|
-
for (let t of
|
|
4683
|
+
for (let t of Gc({
|
|
4680
4684
|
workflows: e.mix.workflows,
|
|
4681
4685
|
schedules: e.mix.schedules,
|
|
4682
4686
|
webhooks: e.mix.webhooks,
|
|
4683
|
-
traces:
|
|
4687
|
+
traces: Dl(),
|
|
4684
4688
|
cdc: e.cdc,
|
|
4685
4689
|
...e.cdcDialect ? { cdcDialect: e.cdcDialect } : {},
|
|
4686
4690
|
undo: Lt()
|
|
4687
4691
|
})) n(t);
|
|
4688
4692
|
e.mix.agents && (n(ln), n(cn), n(dn), n(un));
|
|
4689
|
-
for (let t of
|
|
4693
|
+
for (let t of ol(e.plugins)) n(t);
|
|
4690
4694
|
return [...t.values()];
|
|
4691
|
-
},
|
|
4692
|
-
let t = await
|
|
4693
|
-
return
|
|
4695
|
+
}, Bl = async (e) => {
|
|
4696
|
+
let t = await Ll(e.root), n = await Rl(e.root), r = (process.env.DB_DIALECT ?? "postgres").toLowerCase(), i = r === "mariadb" ? "mariadb" : r === "mssql" ? "mssql" : void 0;
|
|
4697
|
+
return zl({
|
|
4694
4698
|
mix: t,
|
|
4695
4699
|
plugins: n,
|
|
4696
4700
|
cdc: e.cdc ?? (i !== void 0 && (process.env.CDC ?? "1") !== "0"),
|
|
4697
4701
|
...i ? { cdcDialect: i } : {}
|
|
4698
4702
|
});
|
|
4699
|
-
},
|
|
4703
|
+
}, Vl = async ({ env: e = process.env } = {}) => {
|
|
4700
4704
|
let t = C.make(S.mergeAll(Zr.layer, Qr.Default)), n = await t.runPromise(Xr), r = await t.runPromise(Qr), i = (e.CACHE_BACKEND ?? "memory").toLowerCase();
|
|
4701
4705
|
return await t.runPromise(r.addSink((e) => n.invalidateTag(e))), {
|
|
4702
4706
|
service: n,
|
|
@@ -4729,7 +4733,7 @@ ${a.join("\n\n")}\n`);
|
|
|
4729
4733
|
stats: () => t.runSync(n.stats()),
|
|
4730
4734
|
dispose: () => t.dispose()
|
|
4731
4735
|
};
|
|
4732
|
-
},
|
|
4736
|
+
}, Hl = ({ store: e, dialect: t, env: n = process.env }) => {
|
|
4733
4737
|
if (t !== "postgres") return { stop: () => {} };
|
|
4734
4738
|
Ct({
|
|
4735
4739
|
table: "_voltro_schedule_runs",
|
|
@@ -4775,7 +4779,7 @@ ${a.join("\n\n")}\n`);
|
|
|
4775
4779
|
o();
|
|
4776
4780
|
}, 5 * 6e4);
|
|
4777
4781
|
return s.unref?.(), { stop: () => clearInterval(s) };
|
|
4778
|
-
},
|
|
4782
|
+
}, Ul = (e) => {
|
|
4779
4783
|
let { store: t, schemaRegistry: n, cache: r, kv: i, webhooksService: a, workflowsProxy: o, eventTriggers: s, namespaceIsolationOn: c, onEventEmit: l } = e, u = (e, t) => {
|
|
4780
4784
|
if (!c) return e;
|
|
4781
4785
|
if (e.withNamespace === void 0) throw Error("tenantIsolation=namespace is set but the active store has no physical-namespace support (withNamespace).");
|
|
@@ -4814,7 +4818,7 @@ ${a.join("\n\n")}\n`);
|
|
|
4814
4818
|
...h === void 0 ? {} : { workflows: d ? ot(h, d.afterCommit) : h }
|
|
4815
4819
|
};
|
|
4816
4820
|
};
|
|
4817
|
-
},
|
|
4821
|
+
}, Wl = async (e, t, n) => {
|
|
4818
4822
|
if (t.type === "anonymous" || t.id == null) throw new gr({ reason: "workflow control requires an authenticated subject" });
|
|
4819
4823
|
let r = "id" in n ? B("id", n.id) : B("executionId", n.executionId), i = (await e.query({
|
|
4820
4824
|
table: "_voltro_workflow_runs",
|
|
@@ -4825,7 +4829,7 @@ ${a.join("\n\n")}\n`);
|
|
|
4825
4829
|
take: 1
|
|
4826
4830
|
}))[0], a = i?.subject?.tenantId ?? null, o = t.tenantId ?? null;
|
|
4827
4831
|
if (i === void 0 || a !== o) throw new gr({ reason: "not authorized for this workflow run" });
|
|
4828
|
-
},
|
|
4832
|
+
}, Gl = L.pipe(S.provide(f.layer)), Kl = (e) => {
|
|
4829
4833
|
let t = S.succeed(Xr, e.cacheService), n = S.succeed($r, e.kvService), r = [
|
|
4830
4834
|
e.analyticsLayer,
|
|
4831
4835
|
t,
|
|
@@ -4834,47 +4838,47 @@ ${a.join("\n\n")}\n`);
|
|
|
4834
4838
|
...e.userLayers
|
|
4835
4839
|
];
|
|
4836
4840
|
return S.mergeAll(...r);
|
|
4837
|
-
},
|
|
4841
|
+
}, ql = [
|
|
4838
4842
|
Lr,
|
|
4839
4843
|
zr,
|
|
4840
4844
|
Rr,
|
|
4841
4845
|
Ir,
|
|
4842
4846
|
Nr,
|
|
4843
4847
|
Pr
|
|
4844
|
-
],
|
|
4848
|
+
], Jl = (e, t, n) => {
|
|
4845
4849
|
let r = new Set(t);
|
|
4846
|
-
if (n) for (let e of
|
|
4850
|
+
if (n) for (let e of ql) r.add(e.name);
|
|
4847
4851
|
let i = {};
|
|
4848
4852
|
for (let [t, n] of Object.entries(e)) i[t] = r.has(t) ? (e) => n(e).pipe(D.take(1)) : n;
|
|
4849
4853
|
return i;
|
|
4850
|
-
},
|
|
4854
|
+
}, Yl = O({ scope: "voltro:dev:supervisor" }), Xl = /\.generated\./, Zl = /\.([cm]?[jt]sx?|json)$/, Ql = (e) => {
|
|
4851
4855
|
let t = i(e);
|
|
4852
|
-
return !
|
|
4853
|
-
},
|
|
4856
|
+
return !Xl.test(t) && Zl.test(t);
|
|
4857
|
+
}, $l = (e) => e.startsWith("node_modules") || e.startsWith(".framework") || e.startsWith(".turbo") || e.startsWith(".vite") || e.startsWith("dist") || e.startsWith(".git"), eu = process.env.WATCH_POLL === "1" || process.env.CHOKIDAR_USEPOLLING === "1", tu = 1e3, nu = (e) => D.async((t) => {
|
|
4854
4858
|
let n = l(e), r = (e) => c(n, e), a = ri(n, {
|
|
4855
4859
|
persistent: !0,
|
|
4856
4860
|
ignoreInitial: !0,
|
|
4857
4861
|
atomic: !0,
|
|
4858
|
-
usePolling:
|
|
4859
|
-
interval:
|
|
4860
|
-
binaryInterval:
|
|
4862
|
+
usePolling: eu,
|
|
4863
|
+
interval: tu,
|
|
4864
|
+
binaryInterval: tu,
|
|
4861
4865
|
ignored: (e) => {
|
|
4862
4866
|
let t = r(e);
|
|
4863
|
-
return t === "" ? !1 :
|
|
4867
|
+
return t === "" ? !1 : $l(t) || Xl.test(i(e));
|
|
4864
4868
|
}
|
|
4865
4869
|
});
|
|
4866
4870
|
return a.on("all", (e, n) => {
|
|
4867
4871
|
let i = r(n);
|
|
4868
|
-
process.env.WATCH_DEBUG === "1" &&
|
|
4872
|
+
process.env.WATCH_DEBUG === "1" && Yl.trace("watcher fired", {
|
|
4869
4873
|
event: e,
|
|
4870
4874
|
file: i
|
|
4871
|
-
}),
|
|
4875
|
+
}), !$l(i) && Ql(i) && t.single({ file: i });
|
|
4872
4876
|
}), a.on("error", (e) => {
|
|
4873
|
-
|
|
4877
|
+
Yl.error("watcher error", { hint: eu ? void 0 : "on a bind-mount (k8s hostPath / Docker volume) set WATCH_POLL=1" }, e);
|
|
4874
4878
|
}), y.sync(() => {
|
|
4875
4879
|
a.close();
|
|
4876
4880
|
});
|
|
4877
|
-
}),
|
|
4881
|
+
}), ru = (e) => y.acquireUseRelease(y.sync(() => {
|
|
4878
4882
|
let t = process.argv[1] ?? "";
|
|
4879
4883
|
return $t(process.execPath, [
|
|
4880
4884
|
"--import",
|
|
@@ -4901,15 +4905,15 @@ ${a.join("\n\n")}\n`);
|
|
|
4901
4905
|
e.once("exit", () => {
|
|
4902
4906
|
clearTimeout(n), t(y.void);
|
|
4903
4907
|
});
|
|
4904
|
-
})),
|
|
4905
|
-
|
|
4908
|
+
})), iu = (e) => y.gen(function* () {
|
|
4909
|
+
Yl.info("supervisor active — watching project root", {
|
|
4906
4910
|
root: e.root,
|
|
4907
4911
|
patterns: ["**/*.{ts,tsx,mts,cts,js,jsx,mjs,cjs,json} (excl. *.generated.*)"],
|
|
4908
|
-
watcher:
|
|
4912
|
+
watcher: eu ? "chokidar (polling)" : "chokidar (native)",
|
|
4909
4913
|
hint: "WATCH=0 disables, WATCH_DEBUG=1 traces every event, WATCH_POLL=1 for bind-mounts (k8s/Docker)"
|
|
4910
4914
|
});
|
|
4911
4915
|
let t = yield* T.make(w.none()), n = y.gen(function* () {
|
|
4912
|
-
let n = yield* y.fork(
|
|
4916
|
+
let n = yield* y.fork(ru(e.root));
|
|
4913
4917
|
yield* T.set(t, w.some(n));
|
|
4914
4918
|
}), r = y.gen(function* () {
|
|
4915
4919
|
let e = yield* T.get(t);
|
|
@@ -4918,11 +4922,11 @@ ${a.join("\n\n")}\n`);
|
|
|
4918
4922
|
onSome: (e) => b.interrupt(e)
|
|
4919
4923
|
}), yield* T.set(t, w.none());
|
|
4920
4924
|
});
|
|
4921
|
-
return yield* n, yield*
|
|
4925
|
+
return yield* n, yield* nu(e.root).pipe(D.debounce(v.millis(80)), D.runForEach((e) => y.gen(function* () {
|
|
4922
4926
|
let t = Date.now();
|
|
4923
|
-
|
|
4927
|
+
Yl.info("file changed — restarting", { file: e.file }), yield* r, yield* n, Yl.info("restart complete", { ms: Date.now() - t });
|
|
4924
4928
|
}))), yield* y.never;
|
|
4925
|
-
}),
|
|
4929
|
+
}), au = async (e) => {
|
|
4926
4930
|
let t = e.spec ?? gt, n;
|
|
4927
4931
|
return t.kind !== "noop" && e.sqlLayer !== void 0 ? n = await y.runPromise(y.gen(function* () {
|
|
4928
4932
|
let n = yield* R.SqlClient, r = t.build(n);
|
|
@@ -4943,14 +4947,14 @@ ${a.join("\n\n")}\n`);
|
|
|
4943
4947
|
t.dispose && await y.runPromise(t.dispose(n).pipe(y.timeout("1200 millis"), y.ignore));
|
|
4944
4948
|
}
|
|
4945
4949
|
};
|
|
4946
|
-
},
|
|
4947
|
-
for (let e of
|
|
4948
|
-
throw Error(`@effect/cluster patch asset not found (looked in: ${
|
|
4949
|
-
},
|
|
4950
|
-
if (
|
|
4951
|
-
let t = ` '${
|
|
4950
|
+
}, ou = "@effect/cluster@0.59.0", su = "@effect__cluster@0.59.0.patch", cu = `patches/${su}`, lu = a(u(import.meta.url)), uu = [l(lu, "..", "templates", "patches", su), l(lu, "..", "..", "templates", "patches", su)], du = async () => {
|
|
4951
|
+
for (let e of uu) if (A(e)) return N.readFile(e, "utf8");
|
|
4952
|
+
throw Error(`@effect/cluster patch asset not found (looked in: ${uu.join(", ")}). This is a packaging bug — the CLI should ship it under templates/patches/.`);
|
|
4953
|
+
}, fu = (e) => RegExp(`['"]?${ou.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}['"]?\\s*:`).test(e), pu = (e) => {
|
|
4954
|
+
if (fu(e)) return null;
|
|
4955
|
+
let t = ` '${ou}': ${cu}`, n = /^patchedDependencies:[ \t]*\n/m;
|
|
4952
4956
|
return n.test(e) ? e.replace(n, (e) => `${e}${t}\n`) : `${e}${e.endsWith("\n") ? "" : "\n"}\npatchedDependencies:\n${t}\n`;
|
|
4953
|
-
},
|
|
4957
|
+
}, mu = (e) => {
|
|
4954
4958
|
let t = l(e);
|
|
4955
4959
|
for (let e = 0; e < 12; e++) {
|
|
4956
4960
|
if (A(s(t, "pnpm-workspace.yaml"))) return t;
|
|
@@ -4959,28 +4963,28 @@ ${a.join("\n\n")}\n`);
|
|
|
4959
4963
|
t = e;
|
|
4960
4964
|
}
|
|
4961
4965
|
return null;
|
|
4962
|
-
},
|
|
4963
|
-
let t =
|
|
4966
|
+
}, hu = async (e) => {
|
|
4967
|
+
let t = mu(e);
|
|
4964
4968
|
if (!t) return null;
|
|
4965
|
-
let n = await
|
|
4966
|
-
return n.fullyWired ? null : `mssql + durable cluster workflows need the @effect/cluster patch, which a plain install cannot carry. Run \`voltro add mssql\` then \`pnpm install\` to wire it (missing: ${[n.patchFilePresent ? null :
|
|
4967
|
-
},
|
|
4968
|
-
let t = A(s(e,
|
|
4969
|
+
let n = await gu(t);
|
|
4970
|
+
return n.fullyWired ? null : `mssql + durable cluster workflows need the @effect/cluster patch, which a plain install cannot carry. Run \`voltro add mssql\` then \`pnpm install\` to wire it (missing: ${[n.patchFilePresent ? null : cu, n.pnpmEntryPresent ? null : "patchedDependencies in pnpm-workspace.yaml"].filter(Boolean).join(" + ")}). Without it, workflow message/runner storage misbehaves on SQL Server.`;
|
|
4971
|
+
}, gu = async (e) => {
|
|
4972
|
+
let t = A(s(e, cu)), n = s(e, "pnpm-workspace.yaml"), r = A(n) && fu(await N.readFile(n, "utf8"));
|
|
4969
4973
|
return {
|
|
4970
4974
|
patchFilePresent: t,
|
|
4971
4975
|
pnpmEntryPresent: r,
|
|
4972
4976
|
fullyWired: t && r
|
|
4973
4977
|
};
|
|
4974
|
-
},
|
|
4975
|
-
let t = [], n = s(e,
|
|
4976
|
-
(A(n) ? await N.readFile(n, "utf8") : null) !== r && (await N.mkdir(a(n), { recursive: !0 }), await N.writeFile(n, r, "utf8"), t.push(`patch file → ${
|
|
4978
|
+
}, _u = async (e) => {
|
|
4979
|
+
let t = [], n = s(e, cu), r = await du();
|
|
4980
|
+
(A(n) ? await N.readFile(n, "utf8") : null) !== r && (await N.mkdir(a(n), { recursive: !0 }), await N.writeFile(n, r, "utf8"), t.push(`patch file → ${cu}`));
|
|
4977
4981
|
let i = s(e, "pnpm-workspace.yaml");
|
|
4978
4982
|
if (A(i)) {
|
|
4979
|
-
let e =
|
|
4980
|
-
e !== null && (await N.writeFile(i, e, "utf8"), t.push(`patchedDependencies['${
|
|
4983
|
+
let e = pu(await N.readFile(i, "utf8"));
|
|
4984
|
+
e !== null && (await N.writeFile(i, e, "utf8"), t.push(`patchedDependencies['${ou}'] → pnpm-workspace.yaml`));
|
|
4981
4985
|
}
|
|
4982
4986
|
return t;
|
|
4983
|
-
},
|
|
4987
|
+
}, vu = async (e, t) => {
|
|
4984
4988
|
let n = [];
|
|
4985
4989
|
for (let r of e) {
|
|
4986
4990
|
let e;
|
|
@@ -5003,7 +5007,7 @@ ${a.join("\n\n")}\n`);
|
|
|
5003
5007
|
});
|
|
5004
5008
|
}
|
|
5005
5009
|
return n;
|
|
5006
|
-
},
|
|
5010
|
+
}, yu = (e) => ({
|
|
5007
5011
|
query: (t) => e.query({
|
|
5008
5012
|
table: t.table,
|
|
5009
5013
|
order: [],
|
|
@@ -5012,7 +5016,7 @@ ${a.join("\n\n")}\n`);
|
|
|
5012
5016
|
insert: (t, n) => e.insert(t, n),
|
|
5013
5017
|
update: (t, n, r) => e.update(t, n, r),
|
|
5014
5018
|
delete: (t, n) => e.delete(t, n)
|
|
5015
|
-
}),
|
|
5019
|
+
}), bu = (e) => async (t, n, r) => {
|
|
5016
5020
|
let i = Object.keys(n);
|
|
5017
5021
|
if (i.length === 0) throw Error("upsertByUnique: matchFields must have at least one key");
|
|
5018
5022
|
let a;
|
|
@@ -5036,18 +5040,18 @@ ${a.join("\n\n")}\n`);
|
|
|
5036
5040
|
row: await e.insert(t, r),
|
|
5037
5041
|
created: !0
|
|
5038
5042
|
};
|
|
5039
|
-
},
|
|
5040
|
-
let n =
|
|
5043
|
+
}, xu = (e, t) => {
|
|
5044
|
+
let n = bu(e);
|
|
5041
5045
|
return {
|
|
5042
|
-
store:
|
|
5046
|
+
store: yu(e),
|
|
5043
5047
|
upsertByUnique: n,
|
|
5044
5048
|
progress: (e, n) => t.debug("seed progress", {
|
|
5045
5049
|
done: e,
|
|
5046
5050
|
total: n
|
|
5047
5051
|
})
|
|
5048
5052
|
};
|
|
5049
|
-
},
|
|
5050
|
-
let r = Date.now(), i =
|
|
5053
|
+
}, Su = async (e, t, n) => {
|
|
5054
|
+
let r = Date.now(), i = xu(t, n), a = 0;
|
|
5051
5055
|
for (let t of e.definition.steps) try {
|
|
5052
5056
|
let e = await t.body(i);
|
|
5053
5057
|
e && typeof e.rowsTouched == "number" && (a += e.rowsTouched);
|
|
@@ -5074,13 +5078,13 @@ ${a.join("\n\n")}\n`);
|
|
|
5074
5078
|
durationMs: Date.now() - r,
|
|
5075
5079
|
rowsTouched: a
|
|
5076
5080
|
};
|
|
5077
|
-
},
|
|
5081
|
+
}, Cu = async (e, t, n) => {
|
|
5078
5082
|
let r = e.filter((e) => e.definition.lifecycle === "boot");
|
|
5079
5083
|
if (r.length === 0) return [];
|
|
5080
5084
|
n.info("seeds: running boot-lifecycle seeds", { count: r.length });
|
|
5081
5085
|
let i = [];
|
|
5082
5086
|
for (let e of r) {
|
|
5083
|
-
let r = await
|
|
5087
|
+
let r = await Su(e, t, n);
|
|
5084
5088
|
r.status === "succeeded" && n.info(`seed "${r.seedId}" applied`, {
|
|
5085
5089
|
durationMs: r.durationMs,
|
|
5086
5090
|
rowsTouched: r.rowsTouched,
|
|
@@ -5088,21 +5092,21 @@ ${a.join("\n\n")}\n`);
|
|
|
5088
5092
|
}), i.push(r);
|
|
5089
5093
|
}
|
|
5090
5094
|
return i;
|
|
5091
|
-
},
|
|
5095
|
+
}, wu = async (e, t, n, r) => {
|
|
5092
5096
|
let i = e.find((e) => e.definition.id === t);
|
|
5093
5097
|
if (!i) throw Error(`seed not found: ${t}`);
|
|
5094
|
-
return
|
|
5095
|
-
},
|
|
5098
|
+
return Su(i, n, r);
|
|
5099
|
+
}, Tu = /\.seed\.ts$/, Eu = (e) => e.replace(/\.subscribe\.tsx?$/, ""), Du = async (t, n) => {
|
|
5096
5100
|
let r = [];
|
|
5097
|
-
for (let a of
|
|
5098
|
-
let
|
|
5101
|
+
for (let a of t) {
|
|
5102
|
+
let t;
|
|
5099
5103
|
try {
|
|
5100
|
-
|
|
5104
|
+
t = await e(a);
|
|
5101
5105
|
} catch (e) {
|
|
5102
5106
|
n.warn("subscriber: failed to import", { file: a }, e);
|
|
5103
5107
|
continue;
|
|
5104
5108
|
}
|
|
5105
|
-
let o =
|
|
5109
|
+
let o = t.default;
|
|
5106
5110
|
if (o === void 0 || typeof o != "object" || !o) {
|
|
5107
5111
|
n.warn("subscriber: missing or non-object default export — expected `defineSubscriber({...})`", { file: a });
|
|
5108
5112
|
continue;
|
|
@@ -5118,12 +5122,12 @@ ${a.join("\n\n")}\n`);
|
|
|
5118
5122
|
}
|
|
5119
5123
|
r.push({
|
|
5120
5124
|
file: a,
|
|
5121
|
-
id:
|
|
5125
|
+
id: Eu(i(a)),
|
|
5122
5126
|
definition: s
|
|
5123
5127
|
});
|
|
5124
5128
|
}
|
|
5125
5129
|
return r;
|
|
5126
|
-
},
|
|
5130
|
+
}, Ou = (e, t, n) => {
|
|
5127
5131
|
if (e.length === 0) return () => {};
|
|
5128
5132
|
let r = [];
|
|
5129
5133
|
for (let i of e) {
|
|
@@ -5174,17 +5178,17 @@ ${a.join("\n\n")}\n`);
|
|
|
5174
5178
|
e();
|
|
5175
5179
|
} catch {}
|
|
5176
5180
|
};
|
|
5177
|
-
},
|
|
5181
|
+
}, ku = (e) => e.replace(/\.reaction\.tsx?$/, ""), Au = async (t, n) => {
|
|
5178
5182
|
let r = [];
|
|
5179
|
-
for (let a of
|
|
5180
|
-
let
|
|
5183
|
+
for (let a of t) {
|
|
5184
|
+
let t;
|
|
5181
5185
|
try {
|
|
5182
|
-
|
|
5186
|
+
t = await e(a);
|
|
5183
5187
|
} catch (e) {
|
|
5184
5188
|
n.warn("reaction: failed to import (check defineReaction validation)", { file: a }, e);
|
|
5185
5189
|
continue;
|
|
5186
5190
|
}
|
|
5187
|
-
let o =
|
|
5191
|
+
let o = t.default;
|
|
5188
5192
|
if (o === void 0 || typeof o != "object" || !o) {
|
|
5189
5193
|
n.warn("reaction: missing or non-object default export — expected `defineReaction({...})`", { file: a });
|
|
5190
5194
|
continue;
|
|
@@ -5208,12 +5212,12 @@ ${a.join("\n\n")}\n`);
|
|
|
5208
5212
|
}
|
|
5209
5213
|
r.push({
|
|
5210
5214
|
file: a,
|
|
5211
|
-
id:
|
|
5215
|
+
id: ku(i(a)),
|
|
5212
5216
|
definition: s
|
|
5213
5217
|
});
|
|
5214
5218
|
}
|
|
5215
5219
|
return r;
|
|
5216
|
-
},
|
|
5220
|
+
}, ju = async (e, t, n) => {
|
|
5217
5221
|
let r = n.findAgentSend(e);
|
|
5218
5222
|
if (r === void 0) {
|
|
5219
5223
|
n.log.warn("reaction agent act — no synthesized agent found (declare a `*.agent.tsx` named this)", { agent: e });
|
|
@@ -5228,7 +5232,7 @@ ${a.join("\n\n")}\n`);
|
|
|
5228
5232
|
subject: n.makeSubject(a),
|
|
5229
5233
|
traceId: `reaction:${e}`
|
|
5230
5234
|
});
|
|
5231
|
-
},
|
|
5235
|
+
}, Mu = (e, t, n, r) => {
|
|
5232
5236
|
if (e.length === 0) return () => {};
|
|
5233
5237
|
let i = /* @__PURE__ */ new Set(), a = {
|
|
5234
5238
|
has: (e) => i.has(e),
|
|
@@ -5278,7 +5282,7 @@ ${a.join("\n\n")}\n`);
|
|
|
5278
5282
|
l();
|
|
5279
5283
|
} catch {}
|
|
5280
5284
|
};
|
|
5281
|
-
},
|
|
5285
|
+
}, Nu = "_voltro_aggregate_meta", Pu = "_voltro_aggregate_rows", Fu = () => {
|
|
5282
5286
|
let e = /* @__PURE__ */ new Map(), t = {
|
|
5283
5287
|
refreshedAt: null,
|
|
5284
5288
|
rowCount: 0,
|
|
@@ -5323,8 +5327,8 @@ ${a.join("\n\n")}\n`);
|
|
|
5323
5327
|
},
|
|
5324
5328
|
refreshMirror: async () => {}
|
|
5325
5329
|
};
|
|
5326
|
-
},
|
|
5327
|
-
CREATE TABLE IF NOT EXISTS ${
|
|
5330
|
+
}, Iu = `
|
|
5331
|
+
CREATE TABLE IF NOT EXISTS ${Nu} (
|
|
5328
5332
|
name TEXT PRIMARY KEY,
|
|
5329
5333
|
generation INTEGER NOT NULL DEFAULT 0,
|
|
5330
5334
|
refreshed_at TEXT,
|
|
@@ -5333,24 +5337,24 @@ ${a.join("\n\n")}\n`);
|
|
|
5333
5337
|
last_error TEXT,
|
|
5334
5338
|
next_refresh_at TEXT
|
|
5335
5339
|
);
|
|
5336
|
-
`.trim(),
|
|
5337
|
-
CREATE TABLE IF NOT EXISTS ${
|
|
5340
|
+
`.trim(), Lu = `
|
|
5341
|
+
CREATE TABLE IF NOT EXISTS ${Pu} (
|
|
5338
5342
|
aggregate_name TEXT NOT NULL,
|
|
5339
5343
|
generation INTEGER NOT NULL,
|
|
5340
5344
|
row_index INTEGER NOT NULL,
|
|
5341
5345
|
row_data TEXT NOT NULL,
|
|
5342
5346
|
PRIMARY KEY (aggregate_name, generation, row_index)
|
|
5343
5347
|
);
|
|
5344
|
-
`.trim(),
|
|
5345
|
-
CREATE INDEX IF NOT EXISTS ${
|
|
5346
|
-
ON ${
|
|
5347
|
-
`.trim(),
|
|
5348
|
+
`.trim(), Ru = `
|
|
5349
|
+
CREATE INDEX IF NOT EXISTS ${Pu}_lookup
|
|
5350
|
+
ON ${Pu} (aggregate_name, generation, row_index);
|
|
5351
|
+
`.trim(), zu = (e) => ({
|
|
5348
5352
|
refreshedAt: e.refreshed_at === null ? null : new Date(e.refreshed_at),
|
|
5349
5353
|
rowCount: e.row_count,
|
|
5350
5354
|
durationMs: e.duration_ms,
|
|
5351
5355
|
lastError: e.last_error,
|
|
5352
5356
|
nextRefreshAt: e.next_refresh_at === null ? null : new Date(e.next_refresh_at)
|
|
5353
|
-
}),
|
|
5357
|
+
}), Bu = (e) => {
|
|
5354
5358
|
let t = /* @__PURE__ */ new Map(), n = {
|
|
5355
5359
|
refreshedAt: null,
|
|
5356
5360
|
rowCount: 0,
|
|
@@ -5359,13 +5363,13 @@ ${a.join("\n\n")}\n`);
|
|
|
5359
5363
|
nextRefreshAt: null
|
|
5360
5364
|
}, r = (t) => y.runPromise(t.pipe(y.provide(e))), i = () => y.gen(function* () {
|
|
5361
5365
|
let e = yield* R.SqlClient;
|
|
5362
|
-
yield* e.unsafe(
|
|
5366
|
+
yield* e.unsafe(Iu).pipe(y.orDie), yield* e.unsafe(Lu).pipe(y.orDie), yield* e.unsafe(Ru).pipe(y.orDie);
|
|
5363
5367
|
}), a = () => y.gen(function* () {
|
|
5364
|
-
let e = yield* R.SqlClient, n = yield* e`SELECT * FROM ${e(
|
|
5368
|
+
let e = yield* R.SqlClient, n = yield* e`SELECT * FROM ${e(Nu)}`.pipe(y.orElseSucceed(() => []));
|
|
5365
5369
|
for (let r of n) {
|
|
5366
5370
|
let n = yield* e`
|
|
5367
5371
|
SELECT ${e("row_index")} AS row_index, ${e("row_data")} AS row_data
|
|
5368
|
-
FROM ${e(
|
|
5372
|
+
FROM ${e(Pu)}
|
|
5369
5373
|
WHERE ${e("aggregate_name")} = ${r.name}
|
|
5370
5374
|
AND ${e("generation")} = ${r.generation}
|
|
5371
5375
|
ORDER BY ${e("row_index")} ASC
|
|
@@ -5375,17 +5379,17 @@ ${a.join("\n\n")}\n`);
|
|
|
5375
5379
|
} catch {}
|
|
5376
5380
|
t.set(r.name, {
|
|
5377
5381
|
rows: i,
|
|
5378
|
-
meta:
|
|
5382
|
+
meta: zu(r)
|
|
5379
5383
|
});
|
|
5380
5384
|
}
|
|
5381
5385
|
}), o = (e, t) => y.gen(function* () {
|
|
5382
5386
|
let n = yield* R.SqlClient, r = (yield* n`
|
|
5383
5387
|
SELECT ${n("generation")} AS generation
|
|
5384
|
-
FROM ${n(
|
|
5388
|
+
FROM ${n(Nu)}
|
|
5385
5389
|
WHERE ${n("name")} = ${e}
|
|
5386
5390
|
`.pipe(y.orElseSucceed(() => [])))[0]?.generation ?? 0, i = r + 1;
|
|
5387
5391
|
yield* n`
|
|
5388
|
-
UPDATE ${n(
|
|
5392
|
+
UPDATE ${n(Nu)} SET
|
|
5389
5393
|
${n("generation")} = ${i},
|
|
5390
5394
|
${n("refreshed_at")} = ${t.meta.refreshedAt ? t.meta.refreshedAt.toISOString() : null},
|
|
5391
5395
|
${n("duration_ms")} = ${t.meta.durationMs},
|
|
@@ -5394,7 +5398,7 @@ ${a.join("\n\n")}\n`);
|
|
|
5394
5398
|
${n("next_refresh_at")} = ${t.meta.nextRefreshAt ? t.meta.nextRefreshAt.toISOString() : null}
|
|
5395
5399
|
WHERE ${n("name")} = ${e}
|
|
5396
5400
|
`.pipe(y.orDie), r === 0 && (yield* n`
|
|
5397
|
-
INSERT INTO ${n(
|
|
5401
|
+
INSERT INTO ${n(Nu)}
|
|
5398
5402
|
(${n("name")}, ${n("generation")}, ${n("refreshed_at")},
|
|
5399
5403
|
${n("duration_ms")}, ${n("row_count")}, ${n("last_error")}, ${n("next_refresh_at")})
|
|
5400
5404
|
VALUES
|
|
@@ -5405,21 +5409,21 @@ ${a.join("\n\n")}\n`);
|
|
|
5405
5409
|
for (let r = 0; r < t.rows.length; r++) {
|
|
5406
5410
|
let a = JSON.stringify(t.rows[r]);
|
|
5407
5411
|
yield* n`
|
|
5408
|
-
INSERT INTO ${n(
|
|
5412
|
+
INSERT INTO ${n(Pu)}
|
|
5409
5413
|
(${n("aggregate_name")}, ${n("generation")}, ${n("row_index")}, ${n("row_data")})
|
|
5410
5414
|
VALUES
|
|
5411
5415
|
(${e}, ${i}, ${r}, ${a})
|
|
5412
5416
|
`.pipe(y.orDie);
|
|
5413
5417
|
}
|
|
5414
5418
|
r > 0 && (yield* n`
|
|
5415
|
-
DELETE FROM ${n(
|
|
5419
|
+
DELETE FROM ${n(Pu)}
|
|
5416
5420
|
WHERE ${n("aggregate_name")} = ${e}
|
|
5417
5421
|
AND ${n("generation")} < ${i}
|
|
5418
5422
|
`.pipe(y.orDie));
|
|
5419
5423
|
}), s = (e, t) => y.gen(function* () {
|
|
5420
5424
|
let n = yield* R.SqlClient;
|
|
5421
5425
|
yield* n`
|
|
5422
|
-
UPDATE ${n(
|
|
5426
|
+
UPDATE ${n(Nu)} SET
|
|
5423
5427
|
${n("refreshed_at")} = ${t.refreshedAt ? t.refreshedAt.toISOString() : null},
|
|
5424
5428
|
${n("duration_ms")} = ${t.durationMs},
|
|
5425
5429
|
${n("row_count")} = ${t.rowCount},
|
|
@@ -5427,10 +5431,10 @@ ${a.join("\n\n")}\n`);
|
|
|
5427
5431
|
${n("next_refresh_at")} = ${t.nextRefreshAt ? t.nextRefreshAt.toISOString() : null}
|
|
5428
5432
|
WHERE ${n("name")} = ${e}
|
|
5429
5433
|
`.pipe(y.orDie), (yield* n`
|
|
5430
|
-
SELECT ${n("name")} FROM ${n(
|
|
5434
|
+
SELECT ${n("name")} FROM ${n(Nu)}
|
|
5431
5435
|
WHERE ${n("name")} = ${e}
|
|
5432
5436
|
`.pipe(y.orElseSucceed(() => []))).length === 0 && (yield* n`
|
|
5433
|
-
INSERT INTO ${n(
|
|
5437
|
+
INSERT INTO ${n(Nu)}
|
|
5434
5438
|
(${n("name")}, ${n("generation")}, ${n("refreshed_at")},
|
|
5435
5439
|
${n("duration_ms")}, ${n("row_count")}, ${n("last_error")}, ${n("next_refresh_at")})
|
|
5436
5440
|
VALUES
|
|
@@ -5479,13 +5483,13 @@ ${a.join("\n\n")}\n`);
|
|
|
5479
5483
|
refreshMirror: async (e) => {
|
|
5480
5484
|
await r(y.gen(function* () {
|
|
5481
5485
|
let n = yield* R.SqlClient, r = (yield* n`
|
|
5482
|
-
SELECT * FROM ${n(
|
|
5486
|
+
SELECT * FROM ${n(Nu)}
|
|
5483
5487
|
WHERE ${n("name")} = ${e}
|
|
5484
5488
|
`.pipe(y.orElseSucceed(() => [])))[0];
|
|
5485
5489
|
if (!r) return;
|
|
5486
5490
|
let i = yield* n`
|
|
5487
5491
|
SELECT ${n("row_index")} AS row_index, ${n("row_data")} AS row_data
|
|
5488
|
-
FROM ${n(
|
|
5492
|
+
FROM ${n(Pu)}
|
|
5489
5493
|
WHERE ${n("aggregate_name")} = ${e}
|
|
5490
5494
|
AND ${n("generation")} = ${r.generation}
|
|
5491
5495
|
ORDER BY ${n("row_index")} ASC
|
|
@@ -5495,22 +5499,22 @@ ${a.join("\n\n")}\n`);
|
|
|
5495
5499
|
} catch {}
|
|
5496
5500
|
t.set(e, {
|
|
5497
5501
|
rows: a,
|
|
5498
|
-
meta:
|
|
5502
|
+
meta: zu(r)
|
|
5499
5503
|
});
|
|
5500
5504
|
}));
|
|
5501
5505
|
}
|
|
5502
5506
|
};
|
|
5503
|
-
},
|
|
5507
|
+
}, Vu = (e) => e.replace(/\.aggregate\.tsx?$/, ""), Hu = async (t, n) => {
|
|
5504
5508
|
let r = [], a = /* @__PURE__ */ new Set();
|
|
5505
|
-
for (let o of
|
|
5506
|
-
let
|
|
5509
|
+
for (let o of t) {
|
|
5510
|
+
let t;
|
|
5507
5511
|
try {
|
|
5508
|
-
|
|
5512
|
+
t = await e(o);
|
|
5509
5513
|
} catch (e) {
|
|
5510
5514
|
n.warn("aggregate: failed to import", { file: o }, e);
|
|
5511
5515
|
continue;
|
|
5512
5516
|
}
|
|
5513
|
-
let s =
|
|
5517
|
+
let s = t.default;
|
|
5514
5518
|
if (!We(s)) {
|
|
5515
5519
|
n.warn("aggregate: default export is not a defineAggregate() result", { file: o });
|
|
5516
5520
|
continue;
|
|
@@ -5519,11 +5523,11 @@ ${a.join("\n\n")}\n`);
|
|
|
5519
5523
|
a.add(s.name), r.push({
|
|
5520
5524
|
file: o,
|
|
5521
5525
|
definition: s
|
|
5522
|
-
}),
|
|
5526
|
+
}), Vu(i(o));
|
|
5523
5527
|
}
|
|
5524
5528
|
return r;
|
|
5525
|
-
},
|
|
5526
|
-
let t =
|
|
5529
|
+
}, Uu = /^(\d+)(ms|s|m|h|d)$/, Wu = (e) => {
|
|
5530
|
+
let t = Uu.exec(e.trim());
|
|
5527
5531
|
if (!t) throw Error(`aggregate: invalid refresh interval '${e}' — expected '<n><ms|s|m|h|d>' (e.g. '5m', '1h', '500ms')`);
|
|
5528
5532
|
let n = Number(t[1]);
|
|
5529
5533
|
switch (t[2]) {
|
|
@@ -5534,18 +5538,18 @@ ${a.join("\n\n")}\n`);
|
|
|
5534
5538
|
case "d": return n * 864e5;
|
|
5535
5539
|
}
|
|
5536
5540
|
throw Error("unreachable");
|
|
5537
|
-
},
|
|
5541
|
+
}, Gu = (e, t, n) => {
|
|
5538
5542
|
if (t === void 0) return e;
|
|
5539
5543
|
let r = n === "desc" ? -1 : 1;
|
|
5540
5544
|
return [...e].sort((e, n) => {
|
|
5541
5545
|
let i = e[t], a = n[t];
|
|
5542
5546
|
return i === a ? 0 : i == null ? -1 * r : a == null ? 1 * r : i < a ? -1 * r : i > a ? 1 * r : 0;
|
|
5543
5547
|
});
|
|
5544
|
-
},
|
|
5548
|
+
}, Ku = (e, t, n) => {
|
|
5545
5549
|
if (n === void 0 && t === void 0) return e;
|
|
5546
5550
|
let r = n ?? 0, i = t === void 0 ? e.length : r + t;
|
|
5547
5551
|
return e.slice(r, i);
|
|
5548
|
-
},
|
|
5552
|
+
}, qu = (e, t) => {
|
|
5549
5553
|
let n = E.decodeUnknownEither(e.output), r = [];
|
|
5550
5554
|
for (let e = 0; e < t.length; e++) {
|
|
5551
5555
|
let i = n(t[e]);
|
|
@@ -5562,7 +5566,7 @@ ${a.join("\n\n")}\n`);
|
|
|
5562
5566
|
ok: !0,
|
|
5563
5567
|
rows: r
|
|
5564
5568
|
};
|
|
5565
|
-
},
|
|
5569
|
+
}, Ju = (e, t) => {
|
|
5566
5570
|
let n = e.refresh;
|
|
5567
5571
|
if (n.cron) {
|
|
5568
5572
|
let e = n.timezone ?? "UTC", r = _.unsafeParse(n.cron, e);
|
|
@@ -5573,7 +5577,7 @@ ${a.join("\n\n")}\n`);
|
|
|
5573
5577
|
};
|
|
5574
5578
|
}
|
|
5575
5579
|
if (n.interval) {
|
|
5576
|
-
let e =
|
|
5580
|
+
let e = Wu(n.interval);
|
|
5577
5581
|
return {
|
|
5578
5582
|
intervalMs: e,
|
|
5579
5583
|
nextAt: new Date(t.getTime() + e),
|
|
@@ -5589,7 +5593,7 @@ ${a.join("\n\n")}\n`);
|
|
|
5589
5593
|
nextAt: null,
|
|
5590
5594
|
kind: "none"
|
|
5591
5595
|
};
|
|
5592
|
-
},
|
|
5596
|
+
}, Yu = async (e) => {
|
|
5593
5597
|
let { definition: t, store: n, analytics: r, storage: i, coordinator: a, log: o, refreshState: s, scheduledAt: c } = e;
|
|
5594
5598
|
if (s.inFlight) {
|
|
5595
5599
|
o.warn("aggregate: refresh overlap, skipping", { name: t.name });
|
|
@@ -5600,7 +5604,7 @@ ${a.join("\n\n")}\n`);
|
|
|
5600
5604
|
try {
|
|
5601
5605
|
if (!await a.tryClaim(t.name, c)) {
|
|
5602
5606
|
l.info("refresh skipped — coordination claim lost");
|
|
5603
|
-
let { nextAt: e } =
|
|
5607
|
+
let { nextAt: e } = Ju(t, /* @__PURE__ */ new Date()), n = i.get(t.name);
|
|
5604
5608
|
await i.updateMeta(t.name, {
|
|
5605
5609
|
...n.meta,
|
|
5606
5610
|
nextRefreshAt: e
|
|
@@ -5612,7 +5616,7 @@ ${a.join("\n\n")}\n`);
|
|
|
5612
5616
|
analytics: r,
|
|
5613
5617
|
log: l,
|
|
5614
5618
|
id: t.name
|
|
5615
|
-
}), o =
|
|
5619
|
+
}), o = qu(t, e instanceof Promise ? await e : await y.runPromise(e));
|
|
5616
5620
|
if (!o.ok) throw Error(`output schema mismatch: ${o.reason}`);
|
|
5617
5621
|
let s = o.rows;
|
|
5618
5622
|
if (t.strategy === "merge") {
|
|
@@ -5638,7 +5642,7 @@ ${a.join("\n\n")}\n`);
|
|
|
5638
5642
|
droppedCount: a
|
|
5639
5643
|
}), s = Array.from(r.values());
|
|
5640
5644
|
}
|
|
5641
|
-
let d = Date.now() - u, { nextAt: f } =
|
|
5645
|
+
let d = Date.now() - u, { nextAt: f } = Ju(t, /* @__PURE__ */ new Date()), p = {
|
|
5642
5646
|
refreshedAt: /* @__PURE__ */ new Date(),
|
|
5643
5647
|
rowCount: s.length,
|
|
5644
5648
|
durationMs: d,
|
|
@@ -5655,7 +5659,7 @@ ${a.join("\n\n")}\n`);
|
|
|
5655
5659
|
durationMs: d
|
|
5656
5660
|
});
|
|
5657
5661
|
} catch (e) {
|
|
5658
|
-
let n = e instanceof Error ? `${e.name}: ${e.message}` : String(e), r = i.get(t.name), { nextAt: a } =
|
|
5662
|
+
let n = e instanceof Error ? `${e.name}: ${e.message}` : String(e), r = i.get(t.name), { nextAt: a } = Ju(t, /* @__PURE__ */ new Date());
|
|
5659
5663
|
await i.updateMeta(t.name, {
|
|
5660
5664
|
...r.meta,
|
|
5661
5665
|
lastError: n,
|
|
@@ -5668,23 +5672,23 @@ ${a.join("\n\n")}\n`);
|
|
|
5668
5672
|
} finally {
|
|
5669
5673
|
s.inFlight = !1;
|
|
5670
5674
|
}
|
|
5671
|
-
},
|
|
5675
|
+
}, Xu = (e) => {
|
|
5672
5676
|
let { definition: t, schedule: n } = e;
|
|
5673
5677
|
n.scheduleTimer !== null && clearTimeout(n.scheduleTimer);
|
|
5674
|
-
let r = /* @__PURE__ */ new Date(), { intervalMs: i, nextAt: a, kind: o } =
|
|
5678
|
+
let r = /* @__PURE__ */ new Date(), { intervalMs: i, nextAt: a, kind: o } = Ju(t, r);
|
|
5675
5679
|
if (o === "none" && !t.refresh.onChange) {
|
|
5676
5680
|
e.log.warn("aggregate: no refresh policy that auto-fires", { name: t.name });
|
|
5677
5681
|
return;
|
|
5678
5682
|
}
|
|
5679
5683
|
if (a === null) return;
|
|
5680
5684
|
let s = Math.max(0, a.getTime() - r.getTime()), c = setTimeout(async () => {
|
|
5681
|
-
await
|
|
5685
|
+
await Yu({
|
|
5682
5686
|
...e,
|
|
5683
5687
|
scheduledAt: a
|
|
5684
|
-
}),
|
|
5688
|
+
}), Xu(e);
|
|
5685
5689
|
}, s);
|
|
5686
5690
|
c.unref(), n.scheduleTimer = c;
|
|
5687
|
-
},
|
|
5691
|
+
}, Zu = (e) => {
|
|
5688
5692
|
let { definition: t, store: n, schedule: r, log: i } = e, a = t.refresh.onChange;
|
|
5689
5693
|
if (!a || a.length === 0) return;
|
|
5690
5694
|
let o = t.refresh.debounceMs ?? 3e4, s = new Set(a);
|
|
@@ -5692,7 +5696,7 @@ ${a.join("\n\n")}\n`);
|
|
|
5692
5696
|
if (!s.has(t.table)) return;
|
|
5693
5697
|
r.debounceTimer !== null && clearTimeout(r.debounceTimer);
|
|
5694
5698
|
let n = setTimeout(async () => {
|
|
5695
|
-
r.debounceTimer = null, await
|
|
5699
|
+
r.debounceTimer = null, await Yu({
|
|
5696
5700
|
...e,
|
|
5697
5701
|
scheduledAt: /* @__PURE__ */ new Date()
|
|
5698
5702
|
});
|
|
@@ -5703,7 +5707,7 @@ ${a.join("\n\n")}\n`);
|
|
|
5703
5707
|
tables: a,
|
|
5704
5708
|
debounceMs: o
|
|
5705
5709
|
});
|
|
5706
|
-
},
|
|
5710
|
+
}, Qu = (e) => {
|
|
5707
5711
|
let { definition: t, store: n, storage: r, log: i, schedule: a } = e, o = t.incremental;
|
|
5708
5712
|
if (o === void 0) return;
|
|
5709
5713
|
let s = i.child(`aggregate:${t.name}`), c = new F({
|
|
@@ -5718,7 +5722,7 @@ ${a.join("\n\n")}\n`);
|
|
|
5718
5722
|
skip: void 0,
|
|
5719
5723
|
projection: void 0
|
|
5720
5724
|
}), u = async () => {
|
|
5721
|
-
let e = c.materialize().map((e) => o.toRow(e)), n =
|
|
5725
|
+
let e = c.materialize().map((e) => o.toRow(e)), n = qu(t, e);
|
|
5722
5726
|
if (!n.ok) {
|
|
5723
5727
|
s.warn("incremental: output schema mismatch — keeping last-good", { reason: n.reason });
|
|
5724
5728
|
return;
|
|
@@ -5762,12 +5766,12 @@ ${a.join("\n\n")}\n`);
|
|
|
5762
5766
|
op: o.op
|
|
5763
5767
|
});
|
|
5764
5768
|
})();
|
|
5765
|
-
let p = t.refresh, m = p.interval === void 0 ? 5 * 6e4 :
|
|
5769
|
+
let p = t.refresh, m = p.interval === void 0 ? 5 * 6e4 : Wu(p.interval), h = setInterval(() => {
|
|
5766
5770
|
d().catch(() => void 0);
|
|
5767
5771
|
}, m);
|
|
5768
5772
|
h.unref(), a.scheduleTimer = h;
|
|
5769
|
-
},
|
|
5770
|
-
let t = e.storage ??
|
|
5773
|
+
}, $u = async (e) => {
|
|
5774
|
+
let t = e.storage ?? Fu(), n = e.coordinator ?? Mt, r = e.analytics ?? ht(), i = e.log;
|
|
5771
5775
|
await t.initialize();
|
|
5772
5776
|
let a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), c = {
|
|
5773
5777
|
refreshedAt: null,
|
|
@@ -5786,7 +5790,7 @@ ${a.join("\n\n")}\n`);
|
|
|
5786
5790
|
detachOnChange: null
|
|
5787
5791
|
};
|
|
5788
5792
|
a.set(u.name, f), u.incremental !== void 0 || (u.bootRefresh === "async" ? (await t.updateMeta(u.name, c), setImmediate(async () => {
|
|
5789
|
-
await
|
|
5793
|
+
await Yu({
|
|
5790
5794
|
definition: u,
|
|
5791
5795
|
store: e.store,
|
|
5792
5796
|
analytics: r,
|
|
@@ -5797,7 +5801,7 @@ ${a.join("\n\n")}\n`);
|
|
|
5797
5801
|
scheduledAt: /* @__PURE__ */ new Date()
|
|
5798
5802
|
});
|
|
5799
5803
|
})) : u.bootRefresh === "sync" ? l.push(async () => {
|
|
5800
|
-
await
|
|
5804
|
+
await Yu({
|
|
5801
5805
|
definition: u,
|
|
5802
5806
|
store: e.store,
|
|
5803
5807
|
analytics: r,
|
|
@@ -5808,7 +5812,7 @@ ${a.join("\n\n")}\n`);
|
|
|
5808
5812
|
scheduledAt: /* @__PURE__ */ new Date()
|
|
5809
5813
|
});
|
|
5810
5814
|
}) : await t.load(u.name) === null && setImmediate(async () => {
|
|
5811
|
-
await
|
|
5815
|
+
await Yu({
|
|
5812
5816
|
definition: u,
|
|
5813
5817
|
store: e.store,
|
|
5814
5818
|
analytics: r,
|
|
@@ -5818,7 +5822,7 @@ ${a.join("\n\n")}\n`);
|
|
|
5818
5822
|
refreshState: d,
|
|
5819
5823
|
scheduledAt: /* @__PURE__ */ new Date()
|
|
5820
5824
|
});
|
|
5821
|
-
})), u.incremental === void 0 ? (
|
|
5825
|
+
})), u.incremental === void 0 ? (Xu({
|
|
5822
5826
|
definition: u,
|
|
5823
5827
|
store: e.store,
|
|
5824
5828
|
analytics: r,
|
|
@@ -5827,7 +5831,7 @@ ${a.join("\n\n")}\n`);
|
|
|
5827
5831
|
log: i,
|
|
5828
5832
|
schedule: f,
|
|
5829
5833
|
refreshState: d
|
|
5830
|
-
}),
|
|
5834
|
+
}), Zu({
|
|
5831
5835
|
definition: u,
|
|
5832
5836
|
store: e.store,
|
|
5833
5837
|
analytics: r,
|
|
@@ -5836,7 +5840,7 @@ ${a.join("\n\n")}\n`);
|
|
|
5836
5840
|
log: i,
|
|
5837
5841
|
schedule: f,
|
|
5838
5842
|
refreshState: d
|
|
5839
|
-
})) :
|
|
5843
|
+
})) : Qu({
|
|
5840
5844
|
definition: u,
|
|
5841
5845
|
store: e.store,
|
|
5842
5846
|
storage: t,
|
|
@@ -5860,11 +5864,11 @@ ${a.join("\n\n")}\n`);
|
|
|
5860
5864
|
maxAgeMs: e.maxAgeMs
|
|
5861
5865
|
}));
|
|
5862
5866
|
}
|
|
5863
|
-
return
|
|
5867
|
+
return Ku(Gu(n.rows, e?.orderBy, e?.direction), e?.limit, e?.offset);
|
|
5864
5868
|
}),
|
|
5865
5869
|
meta: () => y.succeed(t.get(a.name).meta),
|
|
5866
5870
|
refresh: () => y.tryPromise({
|
|
5867
|
-
try: () =>
|
|
5871
|
+
try: () => Yu({
|
|
5868
5872
|
definition: s.get(a.name),
|
|
5869
5873
|
store: e.store,
|
|
5870
5874
|
analytics: r,
|
|
@@ -5892,7 +5896,7 @@ ${a.join("\n\n")}\n`);
|
|
|
5892
5896
|
})),
|
|
5893
5897
|
refreshByName: async (a) => {
|
|
5894
5898
|
let c = s.get(a);
|
|
5895
|
-
return c ? (await
|
|
5899
|
+
return c ? (await Yu({
|
|
5896
5900
|
definition: c,
|
|
5897
5901
|
store: e.store,
|
|
5898
5902
|
analytics: r,
|
|
@@ -5914,7 +5918,7 @@ ${a.join("\n\n")}\n`);
|
|
|
5914
5918
|
},
|
|
5915
5919
|
registered: Array.from(s.keys())
|
|
5916
5920
|
};
|
|
5917
|
-
},
|
|
5921
|
+
}, ed = {
|
|
5918
5922
|
getHandle: (e) => ({
|
|
5919
5923
|
read: () => y.fail(new de({ name: e.name })),
|
|
5920
5924
|
meta: () => y.succeed({
|
|
@@ -5928,52 +5932,52 @@ ${a.join("\n\n")}\n`);
|
|
|
5928
5932
|
}),
|
|
5929
5933
|
snapshot: () => [],
|
|
5930
5934
|
refreshByName: async () => !1
|
|
5931
|
-
},
|
|
5935
|
+
}, td = "/_voltro/inspect/aggregates", nd = /^\/_voltro\/inspect\/aggregates\/([^/]+)\/refresh$/, rd = (e, t, n) => ({
|
|
5932
5936
|
status: e,
|
|
5933
5937
|
contentType: "application/json; charset=utf-8",
|
|
5934
5938
|
body: JSON.stringify(t),
|
|
5935
5939
|
...n ? { headers: n } : {}
|
|
5936
|
-
}),
|
|
5940
|
+
}), id = (e) => ({
|
|
5937
5941
|
refreshedAt: e.refreshedAt === null ? null : e.refreshedAt.toISOString(),
|
|
5938
5942
|
rowCount: e.rowCount,
|
|
5939
5943
|
durationMs: e.durationMs,
|
|
5940
5944
|
lastError: e.lastError,
|
|
5941
5945
|
nextRefreshAt: e.nextRefreshAt === null ? null : e.nextRefreshAt.toISOString()
|
|
5942
|
-
}),
|
|
5943
|
-
if (!e.startsWith(
|
|
5946
|
+
}), ad = async (e, t, n, r) => {
|
|
5947
|
+
if (!e.startsWith(td)) return null;
|
|
5944
5948
|
if (t === "POST") {
|
|
5945
|
-
let t =
|
|
5949
|
+
let t = nd.exec(e);
|
|
5946
5950
|
if (t) {
|
|
5947
5951
|
let e = decodeURIComponent(t[1]);
|
|
5948
|
-
if (!await n.refreshByName(e)) return
|
|
5952
|
+
if (!await n.refreshByName(e)) return rd(404, {
|
|
5949
5953
|
error: "aggregate not found",
|
|
5950
5954
|
name: e
|
|
5951
5955
|
}, r);
|
|
5952
5956
|
let i = n.snapshot().find((t) => t.name === e);
|
|
5953
|
-
return
|
|
5957
|
+
return rd(200, {
|
|
5954
5958
|
ok: !0,
|
|
5955
5959
|
name: e,
|
|
5956
|
-
meta: i ?
|
|
5960
|
+
meta: i ? id(i.meta) : null
|
|
5957
5961
|
}, r);
|
|
5958
5962
|
}
|
|
5959
|
-
return
|
|
5963
|
+
return rd(405, {
|
|
5960
5964
|
error: "method not allowed",
|
|
5961
5965
|
allow: "GET, POST <name>/refresh"
|
|
5962
5966
|
}, r);
|
|
5963
5967
|
}
|
|
5964
|
-
return t === "GET" && (e ===
|
|
5968
|
+
return t === "GET" && (e === td || e.startsWith(`${td}?`)) ? rd(200, {
|
|
5965
5969
|
aggregates: n.snapshot().map((e) => ({
|
|
5966
5970
|
name: e.name,
|
|
5967
|
-
meta:
|
|
5971
|
+
meta: id(e.meta)
|
|
5968
5972
|
})),
|
|
5969
5973
|
capturedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
5970
5974
|
}, r) : null;
|
|
5971
|
-
},
|
|
5975
|
+
}, od = "/_voltro/inspect/analytics", sd = (e, t, n) => ({
|
|
5972
5976
|
status: e,
|
|
5973
5977
|
contentType: "application/json; charset=utf-8",
|
|
5974
5978
|
body: JSON.stringify(t),
|
|
5975
5979
|
...n ? { headers: n } : {}
|
|
5976
|
-
}),
|
|
5980
|
+
}), cd = (e, t) => {
|
|
5977
5981
|
let n = e.snapshot(t).buckets.filter((e) => e.kind === "plugin"), r = 0, i = 0, a = n.map((e) => (r += e.count, i += e.errorCount, {
|
|
5978
5982
|
tag: e.tag,
|
|
5979
5983
|
count: e.count,
|
|
@@ -5986,9 +5990,9 @@ ${a.join("\n\n")}\n`);
|
|
|
5986
5990
|
errorCount: i,
|
|
5987
5991
|
tags: a
|
|
5988
5992
|
};
|
|
5989
|
-
},
|
|
5990
|
-
if (e !==
|
|
5991
|
-
if (t !== "GET") return
|
|
5993
|
+
}, ld = (e, t, n, r) => {
|
|
5994
|
+
if (e !== od && !e.startsWith(`${od}?`)) return null;
|
|
5995
|
+
if (t !== "GET") return sd(405, {
|
|
5992
5996
|
error: "method not allowed",
|
|
5993
5997
|
allow: "GET"
|
|
5994
5998
|
}, r);
|
|
@@ -5997,8 +6001,8 @@ ${a.join("\n\n")}\n`);
|
|
|
5997
6001
|
if (e === null) return 6e4;
|
|
5998
6002
|
let t = Number(e);
|
|
5999
6003
|
return Number.isFinite(t) && t > 0 ? Math.min(t, 1440 * 6e4) : 6e4;
|
|
6000
|
-
})(), s =
|
|
6001
|
-
return
|
|
6004
|
+
})(), s = cd(n.metricsCollector, o);
|
|
6005
|
+
return sd(200, {
|
|
6002
6006
|
provider: n.sink.info.provider,
|
|
6003
6007
|
capabilities: n.sink.info.capabilities,
|
|
6004
6008
|
detail: n.sink.info.detail ?? null,
|
|
@@ -6010,40 +6014,40 @@ ${a.join("\n\n")}\n`);
|
|
|
6010
6014
|
},
|
|
6011
6015
|
capturedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
6012
6016
|
}, r);
|
|
6013
|
-
},
|
|
6017
|
+
}, ud = "/_voltro/inspect/timeline", dd = "/_voltro/inspect/timeline/replay", fd = (e, t, n) => ({
|
|
6014
6018
|
status: e,
|
|
6015
6019
|
contentType: "application/json; charset=utf-8",
|
|
6016
6020
|
body: JSON.stringify(t),
|
|
6017
6021
|
...n ? { headers: n } : {}
|
|
6018
|
-
}),
|
|
6022
|
+
}), pd = (e) => {
|
|
6019
6023
|
let t = e.indexOf("?");
|
|
6020
6024
|
return new URLSearchParams(t >= 0 ? e.slice(t + 1) : "");
|
|
6021
|
-
},
|
|
6025
|
+
}, md = (e, t) => {
|
|
6022
6026
|
let n = e.get(t);
|
|
6023
6027
|
if (n === null) return;
|
|
6024
6028
|
let r = Number(n);
|
|
6025
6029
|
return Number.isFinite(r) ? r : void 0;
|
|
6026
|
-
},
|
|
6027
|
-
if (!e.startsWith(
|
|
6028
|
-
if (t !== "GET") return
|
|
6030
|
+
}, hd = async (e, t, n, r) => {
|
|
6031
|
+
if (!e.startsWith(ud)) return null;
|
|
6032
|
+
if (t !== "GET") return fd(405, {
|
|
6029
6033
|
error: "method not allowed",
|
|
6030
6034
|
allow: "GET"
|
|
6031
6035
|
}, r);
|
|
6032
|
-
let i =
|
|
6033
|
-
if (e ===
|
|
6034
|
-
let e = i.get("table"), t =
|
|
6035
|
-
if (e === null || t === void 0) return
|
|
6036
|
+
let i = pd(e);
|
|
6037
|
+
if (e === dd || e.startsWith(`${dd}?`)) {
|
|
6038
|
+
let e = i.get("table"), t = md(i, "seq");
|
|
6039
|
+
if (e === null || t === void 0) return fd(400, { error: "replay requires ?table=<name>&seq=<n>" }, r);
|
|
6036
6040
|
let a;
|
|
6037
6041
|
try {
|
|
6038
6042
|
a = await n.readCurrentRows(e);
|
|
6039
6043
|
} catch (t) {
|
|
6040
|
-
return
|
|
6044
|
+
return fd(404, {
|
|
6041
6045
|
error: "unknown or unreadable table",
|
|
6042
6046
|
table: e,
|
|
6043
6047
|
reason: String(t?.message ?? t)
|
|
6044
6048
|
}, r);
|
|
6045
6049
|
}
|
|
6046
|
-
return
|
|
6050
|
+
return fd(200, {
|
|
6047
6051
|
table: e,
|
|
6048
6052
|
asOfSeq: t,
|
|
6049
6053
|
currentSeq: n.recorder.currentSeq(),
|
|
@@ -6051,15 +6055,15 @@ ${a.join("\n\n")}\n`);
|
|
|
6051
6055
|
capturedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
6052
6056
|
}, r);
|
|
6053
6057
|
}
|
|
6054
|
-
if (e ===
|
|
6055
|
-
let e = i.get("table"), t = i.get("tenantId"), a =
|
|
6058
|
+
if (e === ud || e.startsWith(`${ud}?`)) {
|
|
6059
|
+
let e = i.get("table"), t = i.get("tenantId"), a = md(i, "from"), o = md(i, "to"), s = md(i, "limit"), c = {
|
|
6056
6060
|
...e === null ? {} : { table: e },
|
|
6057
6061
|
...t === null ? {} : { tenantId: t },
|
|
6058
6062
|
...a === void 0 ? {} : { from: a },
|
|
6059
6063
|
...o === void 0 ? {} : { to: o },
|
|
6060
6064
|
...s === void 0 ? {} : { limit: s }
|
|
6061
6065
|
};
|
|
6062
|
-
return
|
|
6066
|
+
return fd(200, {
|
|
6063
6067
|
enabled: n.recorder.enabled,
|
|
6064
6068
|
currentSeq: n.recorder.currentSeq(),
|
|
6065
6069
|
events: n.recorder.snapshot(c),
|
|
@@ -6067,17 +6071,17 @@ ${a.join("\n\n")}\n`);
|
|
|
6067
6071
|
}, r);
|
|
6068
6072
|
}
|
|
6069
6073
|
return null;
|
|
6070
|
-
},
|
|
6074
|
+
}, gd = /\.webhook\.tsx?$/, _d = async (t, n) => {
|
|
6071
6075
|
let r = [], i = [], a = [];
|
|
6072
|
-
for (let o of
|
|
6073
|
-
let
|
|
6076
|
+
for (let o of t) {
|
|
6077
|
+
let t;
|
|
6074
6078
|
try {
|
|
6075
|
-
|
|
6079
|
+
t = await e(o);
|
|
6076
6080
|
} catch (e) {
|
|
6077
6081
|
n.warn("webhook: failed to import", { file: o }, e);
|
|
6078
6082
|
continue;
|
|
6079
6083
|
}
|
|
6080
|
-
let s = (
|
|
6084
|
+
let s = (t.default && li(t.default) ? t.default : void 0) ?? Object.values(t).find(li);
|
|
6081
6085
|
if (!s) {
|
|
6082
6086
|
n.warn("webhook: no descriptor default-exported", { file: o });
|
|
6083
6087
|
continue;
|
|
@@ -6108,7 +6112,7 @@ ${a.join("\n\n")}\n`);
|
|
|
6108
6112
|
incoming: i,
|
|
6109
6113
|
providers: a
|
|
6110
6114
|
};
|
|
6111
|
-
},
|
|
6115
|
+
}, vd = /\.email\.tsx?$/, yd = async (e, t) => {
|
|
6112
6116
|
let n = [];
|
|
6113
6117
|
for (let r of e) {
|
|
6114
6118
|
let e;
|
|
@@ -6129,7 +6133,7 @@ ${a.join("\n\n")}\n`);
|
|
|
6129
6133
|
});
|
|
6130
6134
|
}
|
|
6131
6135
|
return { templates: n };
|
|
6132
|
-
},
|
|
6136
|
+
}, bd = (e) => y.map(e, (e) => ({ text: e })), xd = (e) => {
|
|
6133
6137
|
let { descriptor: t, executor: n, file: r } = e, { send: i, messages: a } = vn(t);
|
|
6134
6138
|
return [{
|
|
6135
6139
|
kind: "action",
|
|
@@ -6146,7 +6150,7 @@ ${a.join("\n\n")}\n`);
|
|
|
6146
6150
|
store: t.store,
|
|
6147
6151
|
request: t.request
|
|
6148
6152
|
}
|
|
6149
|
-
}).pipe(
|
|
6153
|
+
}).pipe(bd);
|
|
6150
6154
|
}
|
|
6151
6155
|
}, {
|
|
6152
6156
|
kind: "query",
|
|
@@ -6154,28 +6158,28 @@ ${a.join("\n\n")}\n`);
|
|
|
6154
6158
|
descriptor: a,
|
|
6155
6159
|
executor: (e, t) => mn(t.store, e.threadId)
|
|
6156
6160
|
}];
|
|
6157
|
-
},
|
|
6161
|
+
}, Sd = "<builtin:undo>", Cd = () => Lt() ? {
|
|
6158
6162
|
queries: [{
|
|
6159
|
-
file:
|
|
6163
|
+
file: Sd,
|
|
6160
6164
|
descriptor: Ar,
|
|
6161
6165
|
executor: (e, t) => Rt(e, t)
|
|
6162
6166
|
}],
|
|
6163
6167
|
mutations: [{
|
|
6164
|
-
file:
|
|
6168
|
+
file: Sd,
|
|
6165
6169
|
descriptor: kr,
|
|
6166
6170
|
executor: (e, t) => Oe(e, t)
|
|
6167
6171
|
}, {
|
|
6168
|
-
file:
|
|
6172
|
+
file: Sd,
|
|
6169
6173
|
descriptor: jr,
|
|
6170
6174
|
executor: (e, t) => St(e, t)
|
|
6171
6175
|
}]
|
|
6172
6176
|
} : {
|
|
6173
6177
|
queries: [],
|
|
6174
6178
|
mutations: []
|
|
6175
|
-
},
|
|
6179
|
+
}, wd = () => Lt() ? (e) => lt(e) : (e) => ({
|
|
6176
6180
|
tx: e,
|
|
6177
6181
|
persist: async () => {}
|
|
6178
|
-
}),
|
|
6182
|
+
}), Td = {
|
|
6179
6183
|
interceptMutation: "rpc:intercept:mutation",
|
|
6180
6184
|
interceptQuery: "rpc:intercept:query",
|
|
6181
6185
|
interceptAction: "rpc:intercept:action",
|
|
@@ -6185,38 +6189,38 @@ ${a.join("\n\n")}\n`);
|
|
|
6185
6189
|
onChangeEvent: "store:changes:read",
|
|
6186
6190
|
inspectEndpoints: "inspect:read",
|
|
6187
6191
|
dashboard: "dashboard:mount"
|
|
6188
|
-
},
|
|
6192
|
+
}, Ed = {
|
|
6189
6193
|
tables: "store:write",
|
|
6190
6194
|
migrations: "migration:run"
|
|
6191
|
-
},
|
|
6195
|
+
}, Dd = (e) => {
|
|
6192
6196
|
let t = new Set(e.permissions ?? []), n = [];
|
|
6193
|
-
for (let [r, i] of Object.entries(
|
|
6197
|
+
for (let [r, i] of Object.entries(Td)) {
|
|
6194
6198
|
let a = e[r];
|
|
6195
6199
|
a !== void 0 && (Array.isArray(a) && a.length === 0 || t.has(i) || n.push({
|
|
6196
6200
|
hook: r,
|
|
6197
6201
|
required: i
|
|
6198
6202
|
}));
|
|
6199
6203
|
}
|
|
6200
|
-
return e.extendSchema !== void 0 && (e.extendSchema.tables && e.extendSchema.tables.length > 0 && (t.has(
|
|
6204
|
+
return e.extendSchema !== void 0 && (e.extendSchema.tables && e.extendSchema.tables.length > 0 && (t.has(Ed.tables) || n.push({
|
|
6201
6205
|
hook: "extendSchema.tables",
|
|
6202
|
-
required:
|
|
6203
|
-
})), e.extendSchema.migrations && e.extendSchema.migrations.length > 0 && (t.has(
|
|
6206
|
+
required: Ed.tables
|
|
6207
|
+
})), e.extendSchema.migrations && e.extendSchema.migrations.length > 0 && (t.has(Ed.migrations) || n.push({
|
|
6204
6208
|
hook: "extendSchema.migrations",
|
|
6205
|
-
required:
|
|
6209
|
+
required: Ed.migrations
|
|
6206
6210
|
}))), {
|
|
6207
6211
|
pluginName: e.name,
|
|
6208
6212
|
missing: n
|
|
6209
6213
|
};
|
|
6210
|
-
},
|
|
6211
|
-
let t = e.map(
|
|
6214
|
+
}, Od = (e) => {
|
|
6215
|
+
let t = e.map(Dd);
|
|
6212
6216
|
return {
|
|
6213
6217
|
ok: t.every((e) => e.missing.length === 0),
|
|
6214
6218
|
reports: t
|
|
6215
6219
|
};
|
|
6216
|
-
},
|
|
6220
|
+
}, kd = (e) => {
|
|
6217
6221
|
let t = e.reports.filter((e) => e.missing.length > 0);
|
|
6218
6222
|
return [`Plugin permission audit failed — ${t.length} plugin(s) ship hooks without the matching declared permission. Add the missing scopes to each plugin's manifest.permissions array:`, ...t.map((e) => ` • ${e.pluginName}:\n` + e.missing.map((e) => ` - ${e.hook} → needs '${e.required}'`).join("\n"))].join("\n");
|
|
6219
|
-
},
|
|
6223
|
+
}, Ad = 5e3, jd = 3e4, Md = async (e, t) => {
|
|
6220
6224
|
let n, r = new Promise((e) => {
|
|
6221
6225
|
n = setTimeout(() => e({ kind: "timeout" }), t);
|
|
6222
6226
|
});
|
|
@@ -6231,7 +6235,7 @@ ${a.join("\n\n")}\n`);
|
|
|
6231
6235
|
} finally {
|
|
6232
6236
|
n && clearTimeout(n);
|
|
6233
6237
|
}
|
|
6234
|
-
},
|
|
6238
|
+
}, Nd = async (e) => {
|
|
6235
6239
|
if (e !== void 0) {
|
|
6236
6240
|
if (typeof e == "object" && e && y.isEffect(e)) {
|
|
6237
6241
|
await y.runPromise(e);
|
|
@@ -6239,8 +6243,8 @@ ${a.join("\n\n")}\n`);
|
|
|
6239
6243
|
}
|
|
6240
6244
|
await Promise.resolve(e);
|
|
6241
6245
|
}
|
|
6242
|
-
},
|
|
6243
|
-
let t = e.deactivateTimeoutMs ??
|
|
6246
|
+
}, Pd = /* @__PURE__ */ new Set(), Fd = (e) => `${e.name}@${e.version ?? "*"}`, Id = (e) => {
|
|
6247
|
+
let t = e.deactivateTimeoutMs ?? Ad, n = e.deactivateTotalBudgetMs ?? jd, r = /* @__PURE__ */ new Set(), i = !1, a = /* @__PURE__ */ new Map();
|
|
6244
6248
|
for (let t of e.plugins) {
|
|
6245
6249
|
if (!t.configSchema) {
|
|
6246
6250
|
a.set(t.name, e.pluginConfigs?.[t.name]);
|
|
@@ -6266,9 +6270,9 @@ ${a.join("\n\n")}\n`);
|
|
|
6266
6270
|
});
|
|
6267
6271
|
return {
|
|
6268
6272
|
async activate() {
|
|
6269
|
-
let t =
|
|
6273
|
+
let t = Od(e.plugins);
|
|
6270
6274
|
if (!t.ok) {
|
|
6271
|
-
let n =
|
|
6275
|
+
let n = kd(t);
|
|
6272
6276
|
throw e.log.error(n), Error(n);
|
|
6273
6277
|
}
|
|
6274
6278
|
let n = (process.env.VOLTRO_STRICT_PLUGIN_COMPAT ?? "").toLowerCase(), i = n === "1" || n === "true";
|
|
@@ -6283,10 +6287,10 @@ ${a.join("\n\n")}\n`);
|
|
|
6283
6287
|
}
|
|
6284
6288
|
}
|
|
6285
6289
|
for (let t of e.plugins) {
|
|
6286
|
-
let n =
|
|
6287
|
-
if (!
|
|
6290
|
+
let n = Fd(t);
|
|
6291
|
+
if (!Pd.has(n) && typeof t.onInstall == "function") try {
|
|
6288
6292
|
let e = o(t);
|
|
6289
|
-
await Promise.resolve().then(() =>
|
|
6293
|
+
await Promise.resolve().then(() => Nd(t.onInstall(e))), Pd.add(n);
|
|
6290
6294
|
} catch (n) {
|
|
6291
6295
|
throw e.log.error("plugin onInstall threw — aborting boot", {
|
|
6292
6296
|
plugin: t.name,
|
|
@@ -6300,7 +6304,7 @@ ${a.join("\n\n")}\n`);
|
|
|
6300
6304
|
}
|
|
6301
6305
|
try {
|
|
6302
6306
|
let e = o(t);
|
|
6303
|
-
await Promise.resolve().then(() =>
|
|
6307
|
+
await Promise.resolve().then(() => Nd(t.onActivate(e))), r.add(t.name);
|
|
6304
6308
|
} catch (n) {
|
|
6305
6309
|
throw e.log.error("plugin onActivate threw — aborting boot", {
|
|
6306
6310
|
plugin: t.name,
|
|
@@ -6323,7 +6327,7 @@ ${a.join("\n\n")}\n`);
|
|
|
6323
6327
|
});
|
|
6324
6328
|
break;
|
|
6325
6329
|
}
|
|
6326
|
-
let c = o(i), l = i.onDeactivate, u = await
|
|
6330
|
+
let c = o(i), l = i.onDeactivate, u = await Md(Promise.resolve().then(() => Nd(l(c))), t);
|
|
6327
6331
|
u.kind === "rejected" ? e.log.warn("plugin onDeactivate threw", {
|
|
6328
6332
|
plugin: i.name,
|
|
6329
6333
|
err: u.err
|
|
@@ -6399,16 +6403,16 @@ ${a.join("\n\n")}\n`);
|
|
|
6399
6403
|
services: e.services !== void 0,
|
|
6400
6404
|
hasConfigSchema: e.configSchema !== void 0,
|
|
6401
6405
|
activated: r.has(e.name),
|
|
6402
|
-
installed:
|
|
6406
|
+
installed: Pd.has(Fd(e))
|
|
6403
6407
|
}));
|
|
6404
6408
|
}
|
|
6405
6409
|
};
|
|
6406
|
-
},
|
|
6410
|
+
}, Ld = {
|
|
6407
6411
|
mutation: "intercept-mutation",
|
|
6408
6412
|
query: "intercept-query",
|
|
6409
6413
|
action: "intercept-action"
|
|
6410
|
-
},
|
|
6411
|
-
let i =
|
|
6414
|
+
}, Rd = (e, t, n, r) => {
|
|
6415
|
+
let i = Ld[t], a = `plugin.${e}.${i}`, o = a;
|
|
6412
6416
|
return (t, s) => y.suspend(() => {
|
|
6413
6417
|
let c = Date.now();
|
|
6414
6418
|
return n(t, s).pipe(y.withSpan(a, { attributes: {
|
|
@@ -6432,17 +6436,17 @@ ${a.join("\n\n")}\n`);
|
|
|
6432
6436
|
});
|
|
6433
6437
|
})));
|
|
6434
6438
|
});
|
|
6435
|
-
},
|
|
6439
|
+
}, zd = (e, t, n) => {
|
|
6436
6440
|
let r = t === "mutation" ? "interceptMutation" : t === "query" ? "interceptQuery" : "interceptAction", i = [];
|
|
6437
6441
|
for (let a of e) {
|
|
6438
6442
|
let e = a[r];
|
|
6439
|
-
typeof e == "function" && i.push(
|
|
6443
|
+
typeof e == "function" && i.push(Rd(a.name, t, e, n));
|
|
6440
6444
|
}
|
|
6441
6445
|
return i;
|
|
6442
|
-
},
|
|
6446
|
+
}, Bd = `${ba}/plugins/`, Vd = (e) => e.startsWith("/") ? e : `/${e}`, Hd = (e) => {
|
|
6443
6447
|
let t = e.indexOf("?");
|
|
6444
6448
|
return t >= 0 ? e.slice(0, t) : e;
|
|
6445
|
-
},
|
|
6449
|
+
}, Ud = (e, t) => e.kind === "json" ? {
|
|
6446
6450
|
status: e.status ?? 200,
|
|
6447
6451
|
contentType: "application/json; charset=utf-8",
|
|
6448
6452
|
body: JSON.stringify(e.data),
|
|
@@ -6452,12 +6456,12 @@ ${a.join("\n\n")}\n`);
|
|
|
6452
6456
|
contentType: e.contentType ?? "text/plain; charset=utf-8",
|
|
6453
6457
|
body: e.body,
|
|
6454
6458
|
headers: t
|
|
6455
|
-
},
|
|
6459
|
+
}, Wd = (e) => {
|
|
6456
6460
|
let t = /* @__PURE__ */ new Map(), n = [];
|
|
6457
6461
|
for (let r of e) {
|
|
6458
|
-
let e = r.inspectEndpoints ?? [], i =
|
|
6462
|
+
let e = r.inspectEndpoints ?? [], i = qc(r.name);
|
|
6459
6463
|
for (let a of e) {
|
|
6460
|
-
let e = `${
|
|
6464
|
+
let e = `${Bd}${i}${Vd(a.path)}`, o = `${a.method} ${e}`, s = t.get(o);
|
|
6461
6465
|
if (s !== void 0) throw Error(`plugin inspect endpoint collision: "${a.method} ${e}" declared by plugin "${r.name}" but already claimed by ${s}`);
|
|
6462
6466
|
t.set(o, `plugin "${r.name}"`), n.push({
|
|
6463
6467
|
method: a.method,
|
|
@@ -6471,8 +6475,8 @@ ${a.join("\n\n")}\n`);
|
|
|
6471
6475
|
return {
|
|
6472
6476
|
endpoints: n,
|
|
6473
6477
|
async dispatch(e, t, r, i, a) {
|
|
6474
|
-
let o =
|
|
6475
|
-
if (!o.startsWith(
|
|
6478
|
+
let o = Hd(e);
|
|
6479
|
+
if (!o.startsWith(Bd)) return null;
|
|
6476
6480
|
let s = X(r.origin ?? r.Origin), c = t.toUpperCase();
|
|
6477
6481
|
if (c === "OPTIONS") return {
|
|
6478
6482
|
status: 204,
|
|
@@ -6499,7 +6503,7 @@ ${a.join("\n\n")}\n`);
|
|
|
6499
6503
|
let u = n.find((e) => e.method === c && e.path === o);
|
|
6500
6504
|
if (!u) return null;
|
|
6501
6505
|
try {
|
|
6502
|
-
return
|
|
6506
|
+
return Ud(await y.runPromise(u.handler({
|
|
6503
6507
|
method: c,
|
|
6504
6508
|
url: e,
|
|
6505
6509
|
headers: r,
|
|
@@ -6519,7 +6523,7 @@ ${a.join("\n\n")}\n`);
|
|
|
6519
6523
|
}
|
|
6520
6524
|
}
|
|
6521
6525
|
};
|
|
6522
|
-
},
|
|
6526
|
+
}, Gd = (e, t, n) => {
|
|
6523
6527
|
let r = `plugin.${e}.schedule-fire`;
|
|
6524
6528
|
return async (i, a) => {
|
|
6525
6529
|
let o = Date.now();
|
|
@@ -6547,9 +6551,9 @@ ${a.join("\n\n")}\n`);
|
|
|
6547
6551
|
}), e;
|
|
6548
6552
|
}
|
|
6549
6553
|
};
|
|
6550
|
-
},
|
|
6554
|
+
}, Kd = (e, t) => {
|
|
6551
6555
|
let n = [];
|
|
6552
|
-
for (let r of e) typeof r.onScheduleFire == "function" && n.push(
|
|
6556
|
+
for (let r of e) typeof r.onScheduleFire == "function" && n.push(Gd(r.name, r.onScheduleFire, t));
|
|
6553
6557
|
if (n.length !== 0) return async (e, t) => {
|
|
6554
6558
|
let r = e;
|
|
6555
6559
|
for (let e = n.length - 1; e >= 0; e--) {
|
|
@@ -6558,7 +6562,7 @@ ${a.join("\n\n")}\n`);
|
|
|
6558
6562
|
}
|
|
6559
6563
|
return r();
|
|
6560
6564
|
};
|
|
6561
|
-
},
|
|
6565
|
+
}, qd = (e, t, n) => ((r, i) => {
|
|
6562
6566
|
let a = `plugin.${e}.workflow-step`, o = a, s = Date.now();
|
|
6563
6567
|
return t(r, i).pipe(y.withSpan(a, { attributes: {
|
|
6564
6568
|
"plugin.name": e,
|
|
@@ -6581,16 +6585,16 @@ ${a.join("\n\n")}\n`);
|
|
|
6581
6585
|
status: "error"
|
|
6582
6586
|
});
|
|
6583
6587
|
})));
|
|
6584
|
-
}),
|
|
6588
|
+
}), Jd = (e, t) => {
|
|
6585
6589
|
let n = [];
|
|
6586
|
-
for (let r of e) typeof r.onWorkflowStep == "function" && n.push(
|
|
6590
|
+
for (let r of e) typeof r.onWorkflowStep == "function" && n.push(qd(r.name, r.onWorkflowStep, t));
|
|
6587
6591
|
return n.length === 0 ? S.succeed(Cn, { interceptor: ((e) => e) }) : S.succeed(Cn, { interceptor: ((e, t) => n.reduceRight((e, n) => n(e, t), e)) });
|
|
6588
|
-
},
|
|
6592
|
+
}, Yd = (e) => {
|
|
6589
6593
|
if (!e) return;
|
|
6590
6594
|
let t = e.workflowName ?? e.tag, n = [];
|
|
6591
6595
|
if (t !== void 0 && n.push(B("tag", t)), e.status !== void 0 && n.push(B("status", e.status)), n.length !== 0) return n.length === 1 ? n[0] : Zn(...n);
|
|
6592
|
-
},
|
|
6593
|
-
let n = Math.max(0, t?.offset ?? 0), r = Math.max(1, Math.min(500, t?.limit ?? 50)), i =
|
|
6596
|
+
}, Xd = async (e, t) => {
|
|
6597
|
+
let n = Math.max(0, t?.offset ?? 0), r = Math.max(1, Math.min(500, t?.limit ?? 50)), i = Yd(t);
|
|
6594
6598
|
return {
|
|
6595
6599
|
rows: await e.query({
|
|
6596
6600
|
table: "_voltro_workflow_runs",
|
|
@@ -6614,7 +6618,7 @@ ${a.join("\n\n")}\n`);
|
|
|
6614
6618
|
offset: n,
|
|
6615
6619
|
limit: r
|
|
6616
6620
|
};
|
|
6617
|
-
},
|
|
6621
|
+
}, Zd = (e) => ({
|
|
6618
6622
|
id: e.id,
|
|
6619
6623
|
workflowName: e.tag,
|
|
6620
6624
|
executionId: e.executionId,
|
|
@@ -6629,10 +6633,10 @@ ${a.join("\n\n")}\n`);
|
|
|
6629
6633
|
durationMs: e.durationMs,
|
|
6630
6634
|
traceId: e.traceId,
|
|
6631
6635
|
parentExecutionId: e.parentExecutionId
|
|
6632
|
-
}),
|
|
6633
|
-
let { rows: n } = await
|
|
6634
|
-
return n.map(
|
|
6635
|
-
},
|
|
6636
|
+
}), Qd = async (e, t) => {
|
|
6637
|
+
let { rows: n } = await Xd(e, t);
|
|
6638
|
+
return n.map(Zd);
|
|
6639
|
+
}, $d = async (e, t, n) => {
|
|
6636
6640
|
let r = (await e.store.query({
|
|
6637
6641
|
table: "_voltro_workflow_runs",
|
|
6638
6642
|
order: [],
|
|
@@ -6646,7 +6650,7 @@ ${a.join("\n\n")}\n`);
|
|
|
6646
6650
|
if (!i) throw Error(`retry: no workflow registered with tag '${r.tag}'`);
|
|
6647
6651
|
let a = n?.payloadOverride === void 0 ? r.payload : n.payloadOverride, o = await e.runPromise(i.definition.execute(a));
|
|
6648
6652
|
return { executionId: typeof o == "string" ? o : "started" };
|
|
6649
|
-
},
|
|
6653
|
+
}, ef = (e, t) => {
|
|
6650
6654
|
let n = e.filter((e) => typeof e.onHttpRequest == "function");
|
|
6651
6655
|
if (n.length !== 0) return n.reduceRight((e, n) => {
|
|
6652
6656
|
let r = n.onHttpRequest, i = `plugin.${n.name}.http-intercept`;
|
|
@@ -6667,12 +6671,12 @@ ${a.join("\n\n")}\n`);
|
|
|
6667
6671
|
}
|
|
6668
6672
|
};
|
|
6669
6673
|
}, (e) => e());
|
|
6670
|
-
},
|
|
6674
|
+
}, tf = (e) => {
|
|
6671
6675
|
let t = [];
|
|
6672
6676
|
for (let n of e) {
|
|
6673
6677
|
let e = n.dashboard ?? [];
|
|
6674
6678
|
if (e.length === 0) continue;
|
|
6675
|
-
let r =
|
|
6679
|
+
let r = Kc(n.name), i = /* @__PURE__ */ new Set();
|
|
6676
6680
|
for (let a of e) {
|
|
6677
6681
|
if (i.has(a.id)) throw Error(`plugin "${n.name}" declares duplicate dashboard mount id "${a.id}"`);
|
|
6678
6682
|
i.add(a.id), t.push({
|
|
@@ -6691,7 +6695,7 @@ ${a.join("\n\n")}\n`);
|
|
|
6691
6695
|
}
|
|
6692
6696
|
}
|
|
6693
6697
|
return t;
|
|
6694
|
-
},
|
|
6698
|
+
}, nf = /\.(query|mutation|action|stream)\.ts$/, rf = /\.(query|mutation|action|stream)\.server\.ts$/, af = /\.workflow\.tsx$/, of = /* @__PURE__ */ new Set([
|
|
6695
6699
|
"node_modules",
|
|
6696
6700
|
"dist",
|
|
6697
6701
|
"build",
|
|
@@ -6699,7 +6703,7 @@ ${a.join("\n\n")}\n`);
|
|
|
6699
6703
|
".vite",
|
|
6700
6704
|
".next",
|
|
6701
6705
|
".git"
|
|
6702
|
-
]),
|
|
6706
|
+
]), sf = async (e) => {
|
|
6703
6707
|
let t = [], n = async (e) => {
|
|
6704
6708
|
let r;
|
|
6705
6709
|
try {
|
|
@@ -6708,14 +6712,14 @@ ${a.join("\n\n")}\n`);
|
|
|
6708
6712
|
return;
|
|
6709
6713
|
}
|
|
6710
6714
|
for (let i of r) {
|
|
6711
|
-
if (
|
|
6715
|
+
if (of.has(i.name)) continue;
|
|
6712
6716
|
let r = s(e, i.name);
|
|
6713
|
-
i.isDirectory() ? await n(r) : i.isFile() && (
|
|
6717
|
+
i.isDirectory() ? await n(r) : i.isFile() && (nf.test(i.name) && !rf.test(i.name) || af.test(i.name)) && t.push(r);
|
|
6714
6718
|
}
|
|
6715
6719
|
};
|
|
6716
6720
|
return await n(e), t;
|
|
6717
|
-
},
|
|
6718
|
-
let t = await
|
|
6721
|
+
}, cf = async (e) => {
|
|
6722
|
+
let t = await sf(e), n = [];
|
|
6719
6723
|
for (let e of t) try {
|
|
6720
6724
|
let t = await import(d(e).href);
|
|
6721
6725
|
for (let r of Object.values(t)) {
|
|
@@ -6726,7 +6730,7 @@ ${a.join("\n\n")}\n`);
|
|
|
6726
6730
|
tag: e.name
|
|
6727
6731
|
});
|
|
6728
6732
|
}
|
|
6729
|
-
if (r && typeof r == "object" &&
|
|
6733
|
+
if (r && typeof r == "object" && af.test(e) && "name" in r) {
|
|
6730
6734
|
let e = r;
|
|
6731
6735
|
typeof e.name == "string" && n.push({
|
|
6732
6736
|
kind: "workflow",
|
|
@@ -6740,12 +6744,12 @@ ${a.join("\n\n")}\n`);
|
|
|
6740
6744
|
let t = `${e.kind}:${e.tag}`;
|
|
6741
6745
|
return r.has(t) ? !1 : (r.add(t), !0);
|
|
6742
6746
|
});
|
|
6743
|
-
},
|
|
6747
|
+
}, lf = async (e, t, n) => {
|
|
6744
6748
|
let r = e.filter((e) => typeof e.codegen == "function");
|
|
6745
6749
|
if (r.length === 0) return [];
|
|
6746
|
-
let i = await
|
|
6750
|
+
let i = await cf(n);
|
|
6747
6751
|
return r.map((e) => {
|
|
6748
|
-
let n =
|
|
6752
|
+
let n = Kc(e.name), r = {
|
|
6749
6753
|
pluginName: e.name,
|
|
6750
6754
|
pluginAlias: n,
|
|
6751
6755
|
apiName: t,
|
|
@@ -6757,19 +6761,19 @@ ${a.join("\n\n")}\n`);
|
|
|
6757
6761
|
emit: () => e.codegen(r)
|
|
6758
6762
|
};
|
|
6759
6763
|
});
|
|
6760
|
-
},
|
|
6764
|
+
}, uf = class extends Error {
|
|
6761
6765
|
constructor(e) {
|
|
6762
6766
|
super(e), this.name = "InspectQueryError";
|
|
6763
6767
|
}
|
|
6764
|
-
},
|
|
6768
|
+
}, df = /* @__PURE__ */ new Set([
|
|
6765
6769
|
"text",
|
|
6766
6770
|
"id",
|
|
6767
6771
|
"reference"
|
|
6768
|
-
]),
|
|
6772
|
+
]), ff = /* @__PURE__ */ new Set([
|
|
6769
6773
|
"integer",
|
|
6770
6774
|
"timestamp",
|
|
6771
6775
|
"date"
|
|
6772
|
-
]),
|
|
6776
|
+
]), pf = (e, t) => {
|
|
6773
6777
|
switch (e) {
|
|
6774
6778
|
case "isNull":
|
|
6775
6779
|
case "isNotNull":
|
|
@@ -6777,54 +6781,54 @@ ${a.join("\n\n")}\n`);
|
|
|
6777
6781
|
case "neq":
|
|
6778
6782
|
case "in":
|
|
6779
6783
|
case "notIn": return !0;
|
|
6780
|
-
case "contains": return
|
|
6784
|
+
case "contains": return df.has(t);
|
|
6781
6785
|
case "gt":
|
|
6782
6786
|
case "gte":
|
|
6783
6787
|
case "lt":
|
|
6784
|
-
case "lte": return
|
|
6788
|
+
case "lte": return ff.has(t);
|
|
6785
6789
|
}
|
|
6786
|
-
},
|
|
6790
|
+
}, mf = (e, t, n) => {
|
|
6787
6791
|
if (e == null) return e;
|
|
6788
6792
|
switch (t) {
|
|
6789
6793
|
case "integer": {
|
|
6790
6794
|
let t = typeof e == "number" ? e : Number(e);
|
|
6791
|
-
if (!Number.isFinite(t)) throw new
|
|
6795
|
+
if (!Number.isFinite(t)) throw new uf(`filter on "${n}": "${String(e)}" is not a number`);
|
|
6792
6796
|
return t;
|
|
6793
6797
|
}
|
|
6794
6798
|
case "boolean":
|
|
6795
6799
|
if (typeof e == "boolean") return e;
|
|
6796
6800
|
if (e === "true") return !0;
|
|
6797
6801
|
if (e === "false") return !1;
|
|
6798
|
-
throw new
|
|
6802
|
+
throw new uf(`filter on "${n}": "${String(e)}" is not a boolean`);
|
|
6799
6803
|
default: return e;
|
|
6800
6804
|
}
|
|
6801
|
-
},
|
|
6805
|
+
}, hf = (e, t) => {
|
|
6802
6806
|
let n = t.get(e.column);
|
|
6803
|
-
if (!n) throw new
|
|
6804
|
-
if (!
|
|
6807
|
+
if (!n) throw new uf(`unknown filter column "${e.column}"`);
|
|
6808
|
+
if (!pf(e.op, n.type)) throw new uf(`operator "${e.op}" is not valid for ${n.type} column "${e.column}"`);
|
|
6805
6809
|
if (e.op === "isNull" || e.op === "isNotNull") return {
|
|
6806
6810
|
column: e.column,
|
|
6807
6811
|
op: e.op
|
|
6808
6812
|
};
|
|
6809
6813
|
if (e.op === "in" || e.op === "notIn") {
|
|
6810
|
-
if (!Array.isArray(e.value)) throw new
|
|
6814
|
+
if (!Array.isArray(e.value)) throw new uf(`operator "${e.op}" on "${e.column}" requires an array value`);
|
|
6811
6815
|
return {
|
|
6812
6816
|
column: e.column,
|
|
6813
6817
|
op: e.op,
|
|
6814
|
-
value: e.value.map((t) =>
|
|
6818
|
+
value: e.value.map((t) => mf(t, n.type, e.column))
|
|
6815
6819
|
};
|
|
6816
6820
|
}
|
|
6817
6821
|
return {
|
|
6818
6822
|
column: e.column,
|
|
6819
6823
|
op: e.op,
|
|
6820
|
-
value:
|
|
6824
|
+
value: mf(e.value, n.type, e.column)
|
|
6821
6825
|
};
|
|
6822
|
-
},
|
|
6823
|
-
if (++n.n >
|
|
6824
|
-
if (e.kind === "leaf") return
|
|
6825
|
-
let r = e.children.map((e) =>
|
|
6826
|
+
}, gf = 200, _f = (e, t, n) => {
|
|
6827
|
+
if (++n.n > gf) throw new uf("filter tree too large");
|
|
6828
|
+
if (e.kind === "leaf") return hf(e, t);
|
|
6829
|
+
let r = e.children.map((e) => _f(e, t, n));
|
|
6826
6830
|
return e.kind === "and" ? { and: r } : { or: r };
|
|
6827
|
-
},
|
|
6831
|
+
}, vf = (e, t) => {
|
|
6828
6832
|
let n = e?.trim();
|
|
6829
6833
|
if (!n) return null;
|
|
6830
6834
|
let r = t.filter((e) => e.type === "text" || (e.oneOf?.length ?? 0) > 0);
|
|
@@ -6833,16 +6837,16 @@ ${a.join("\n\n")}\n`);
|
|
|
6833
6837
|
op: "contains",
|
|
6834
6838
|
value: n
|
|
6835
6839
|
})) };
|
|
6836
|
-
},
|
|
6840
|
+
}, yf = (e) => {
|
|
6837
6841
|
let t = new Map(e.columns.map((e) => [e.name, e])), n = [];
|
|
6838
|
-
e.filter && n.push(
|
|
6839
|
-
let r =
|
|
6842
|
+
e.filter && n.push(_f(e.filter, t, { n: 0 }));
|
|
6843
|
+
let r = vf(e.quickSearch, e.columns);
|
|
6840
6844
|
if (r && n.push(r), n.length !== 0) return n.length === 1 ? n[0] : { and: n };
|
|
6841
|
-
},
|
|
6845
|
+
}, bf = (e, t) => {
|
|
6842
6846
|
let n = new Set(t.map((e) => e.name)), r = [], i = /* @__PURE__ */ new Set();
|
|
6843
6847
|
for (let t of e ?? []) {
|
|
6844
|
-
if (!n.has(t.column)) throw new
|
|
6845
|
-
if (t.direction !== "asc" && t.direction !== "desc") throw new
|
|
6848
|
+
if (!n.has(t.column)) throw new uf(`unknown sort column "${t.column}"`);
|
|
6849
|
+
if (t.direction !== "asc" && t.direction !== "desc") throw new uf(`invalid sort direction "${t.direction}"`);
|
|
6846
6850
|
i.has(t.column) || (i.add(t.column), r.push({
|
|
6847
6851
|
column: t.column,
|
|
6848
6852
|
direction: t.direction
|
|
@@ -6852,16 +6856,16 @@ ${a.join("\n\n")}\n`);
|
|
|
6852
6856
|
column: "id",
|
|
6853
6857
|
direction: "asc"
|
|
6854
6858
|
}), r;
|
|
6855
|
-
},
|
|
6859
|
+
}, xf = 150, Sf = 200, Cf = (e) => e instanceof Date ? e.toISOString() : typeof e == "bigint" ? e.toString() : e, wf = (e) => {
|
|
6856
6860
|
if (!e) return null;
|
|
6857
6861
|
let t = {};
|
|
6858
|
-
for (let [n, r] of Object.entries(e)) t[n] =
|
|
6862
|
+
for (let [n, r] of Object.entries(e)) t[n] = Cf(r);
|
|
6859
6863
|
return t;
|
|
6860
|
-
},
|
|
6864
|
+
}, Tf = (e, t) => {
|
|
6861
6865
|
let n = /* @__PURE__ */ new Map(), r, i = () => {
|
|
6862
6866
|
r = void 0;
|
|
6863
6867
|
for (let [e, r] of n) {
|
|
6864
|
-
if (r.size >
|
|
6868
|
+
if (r.size > Sf) {
|
|
6865
6869
|
t.emit("cdc", {
|
|
6866
6870
|
op: "resync",
|
|
6867
6871
|
table: e
|
|
@@ -6883,17 +6887,17 @@ ${a.join("\n\n")}\n`);
|
|
|
6883
6887
|
let o = n.get(e.table);
|
|
6884
6888
|
o || (o = /* @__PURE__ */ new Map(), n.set(e.table, o)), o.set(a, {
|
|
6885
6889
|
op: e.op,
|
|
6886
|
-
row: e.op === "delete" ? null :
|
|
6887
|
-
}), r === void 0 && (r = setTimeout(i,
|
|
6890
|
+
row: e.op === "delete" ? null : wf(t)
|
|
6891
|
+
}), r === void 0 && (r = setTimeout(i, xf));
|
|
6888
6892
|
});
|
|
6889
6893
|
return () => {
|
|
6890
6894
|
r !== void 0 && clearTimeout(r), a();
|
|
6891
6895
|
};
|
|
6892
|
-
},
|
|
6896
|
+
}, Ef = [
|
|
6893
6897
|
"ok",
|
|
6894
6898
|
"error",
|
|
6895
6899
|
"unset"
|
|
6896
|
-
],
|
|
6900
|
+
], Df = (e, t) => {
|
|
6897
6901
|
let n = e.indexOf("?"), r = n === -1 ? new URLSearchParams() : new URLSearchParams(e.slice(n + 1)), i = (() => {
|
|
6898
6902
|
let e = r.get("since");
|
|
6899
6903
|
if (e === null) return;
|
|
@@ -6914,9 +6918,9 @@ ${a.join("\n\n")}\n`);
|
|
|
6914
6918
|
Number.isFinite(t) && (e.minDurationMs = t);
|
|
6915
6919
|
}
|
|
6916
6920
|
let s = r.get("status");
|
|
6917
|
-
s !== null &&
|
|
6921
|
+
s !== null && Ef.includes(s) && (e.status = s);
|
|
6918
6922
|
let c = t.query(e);
|
|
6919
|
-
return
|
|
6923
|
+
return Of({
|
|
6920
6924
|
capturedAt: Date.now(),
|
|
6921
6925
|
bufferCapacity: t.capacityHint(),
|
|
6922
6926
|
bufferSize: t.size(),
|
|
@@ -6928,18 +6932,18 @@ ${a.join("\n\n")}\n`);
|
|
|
6928
6932
|
let s = {};
|
|
6929
6933
|
i !== void 0 && (s.since = i), a !== void 0 && (s.maxTraces = a), r.get("onlyErrors") === "1" && (s.onlyErrors = !0);
|
|
6930
6934
|
let c = t.queryGrouped(s);
|
|
6931
|
-
return
|
|
6935
|
+
return Of({
|
|
6932
6936
|
capturedAt: Date.now(),
|
|
6933
6937
|
bufferCapacity: t.capacityHint(),
|
|
6934
6938
|
bufferSize: t.size(),
|
|
6935
6939
|
returned: c.length,
|
|
6936
6940
|
traces: c
|
|
6937
6941
|
});
|
|
6938
|
-
},
|
|
6942
|
+
}, Of = (e) => ({
|
|
6939
6943
|
status: 200,
|
|
6940
6944
|
contentType: "application/json; charset=utf-8",
|
|
6941
6945
|
body: JSON.stringify(e)
|
|
6942
|
-
}),
|
|
6946
|
+
}), kf = (e) => {
|
|
6943
6947
|
let t = e.now ?? Date.now, n = {
|
|
6944
6948
|
phase: "booting",
|
|
6945
6949
|
startedAt: t()
|
|
@@ -6996,19 +7000,19 @@ ${a.join("\n\n")}\n`);
|
|
|
6996
7000
|
r.removeListener("error", n), r.unref(), e.log?.info("dev health server listening", { port: e.port }), t(i(!0));
|
|
6997
7001
|
});
|
|
6998
7002
|
});
|
|
6999
|
-
},
|
|
7003
|
+
}, Af = Gl, $ = O({ scope: "voltro:dev" }), jf = await (async () => {
|
|
7000
7004
|
try {
|
|
7001
7005
|
let e = s(a(u(import.meta.url)), "..", "package.json"), t = await N.readFile(e, "utf8");
|
|
7002
7006
|
return JSON.parse(t).version ?? "0.0.0";
|
|
7003
7007
|
} catch {
|
|
7004
7008
|
return "0.0.0";
|
|
7005
7009
|
}
|
|
7006
|
-
})(),
|
|
7010
|
+
})(), Mf = process.env.TENANT ?? "acme", Nf = process.env.VOLTRO_SESSION_COOKIE ?? "voltro:session", Pf = {
|
|
7007
7011
|
id: "voltro-password",
|
|
7008
7012
|
resolve: (e) => {
|
|
7009
7013
|
let t = tn();
|
|
7010
7014
|
if (t.current.secret.length === 0) return { kind: "skip" };
|
|
7011
|
-
let n = en(e.headers.cookie ?? e.headers.Cookie,
|
|
7015
|
+
let n = en(e.headers.cookie ?? e.headers.Cookie, Nf);
|
|
7012
7016
|
if (!n) return { kind: "skip" };
|
|
7013
7017
|
let r = rn(n, t);
|
|
7014
7018
|
return r ? {
|
|
@@ -7016,20 +7020,20 @@ ${a.join("\n\n")}\n`);
|
|
|
7016
7020
|
subject: r.subject
|
|
7017
7021
|
} : { kind: "skip" };
|
|
7018
7022
|
}
|
|
7019
|
-
},
|
|
7023
|
+
}, Ff = (e = [], t, n = !1) => xr([t ?? Pf, ...e], n ? {
|
|
7020
7024
|
anonymousTenantRequired: !0,
|
|
7021
7025
|
onStrategyFailed: ({ strategyId: e, reason: t }) => {
|
|
7022
7026
|
$.warn(`auth strategy "${e}" rejected request: ${t}`);
|
|
7023
7027
|
}
|
|
7024
7028
|
} : {
|
|
7025
|
-
fallback: (e) => yr(e.headers["x-tenant"] ??
|
|
7029
|
+
fallback: (e) => yr(e.headers["x-tenant"] ?? Mf),
|
|
7026
7030
|
onStrategyFailed: ({ strategyId: e, reason: t }) => {
|
|
7027
7031
|
$.warn(`auth strategy "${e}" rejected request: ${t}`);
|
|
7028
7032
|
}
|
|
7029
|
-
}),
|
|
7033
|
+
}), If = (e) => S.succeed(mr, mr.of(({ headers: t, clientId: n }) => y.promise(async () => He(n) || e({
|
|
7030
7034
|
headers: t,
|
|
7031
7035
|
clientId: n
|
|
7032
|
-
})))),
|
|
7036
|
+
})))), Lf = S.succeed(hr, hr.of(({ clientId: e }) => y.succeed({ clientId: e }))), Rf = (e) => {
|
|
7033
7037
|
if (g.isCause(e)) return e;
|
|
7034
7038
|
if (typeof e != "object" || !e) return;
|
|
7035
7039
|
for (let t of Object.getOwnPropertySymbols(e)) if (t.description === "effect/Runtime/FiberFailure/Cause") {
|
|
@@ -7038,17 +7042,17 @@ ${a.join("\n\n")}\n`);
|
|
|
7038
7042
|
}
|
|
7039
7043
|
let t = e.cause;
|
|
7040
7044
|
return g.isCause(t) ? t : void 0;
|
|
7041
|
-
},
|
|
7042
|
-
let t =
|
|
7045
|
+
}, zf = (e) => {
|
|
7046
|
+
let t = Rf(e);
|
|
7043
7047
|
if (t === void 0) return;
|
|
7044
7048
|
let n = g.failureOption(t);
|
|
7045
7049
|
if (w.isSome(n)) return n.value;
|
|
7046
7050
|
let r = g.dieOption(t);
|
|
7047
7051
|
if (w.isSome(r)) return r.value;
|
|
7048
|
-
},
|
|
7052
|
+
}, Bf = (e) => {
|
|
7049
7053
|
if (e == null) return { message: "unknown error" };
|
|
7050
|
-
let t =
|
|
7051
|
-
if (t !== void 0 && t !== e) return
|
|
7054
|
+
let t = zf(e);
|
|
7055
|
+
if (t !== void 0 && t !== e) return Bf(t);
|
|
7052
7056
|
let n = Be(e), r = (n.dbCode ?? n.dbSqlState ?? n.dbErrno ?? n.dbConstraint) === void 0 ? {} : n;
|
|
7053
7057
|
if (typeof e == "object" && "_tag" in e) return {
|
|
7054
7058
|
...e,
|
|
@@ -7065,7 +7069,7 @@ ${a.join("\n\n")}\n`);
|
|
|
7065
7069
|
} catch {
|
|
7066
7070
|
return { message: String(e) };
|
|
7067
7071
|
}
|
|
7068
|
-
},
|
|
7072
|
+
}, Vf = /\.(query|mutation|action|stream)\.ts$/, Hf = /\.(query|mutation|action|stream)\.server\.ts$/, Uf = /\.workflow\.tsx$/, Wf = /\.workflow\.server\.tsx$/, Gf = /\.trigger\.tsx?$/, Kf = /\.seed\.ts$/, qf = /\.startup\.tsx?$/, Jf = /\.cron\.tsx?$/, Yf = /\.webhook\.tsx?$/, Xf = /\.subscribe\.tsx?$/, Zf = /\.reaction\.tsx?$/, Qf = /\.aggregate\.tsx?$/, $f = /\.entity\.ts$|\.schema\.ts$|^schema\.ts$/, ep = /\.relations\.ts$/, tp = /* @__PURE__ */ new Set([
|
|
7069
7073
|
"node_modules",
|
|
7070
7074
|
"dist",
|
|
7071
7075
|
"build",
|
|
@@ -7073,21 +7077,21 @@ ${a.join("\n\n")}\n`);
|
|
|
7073
7077
|
".vite",
|
|
7074
7078
|
".next",
|
|
7075
7079
|
".git"
|
|
7076
|
-
]),
|
|
7080
|
+
]), np = async (e) => {
|
|
7077
7081
|
let t = [], n = async (e) => {
|
|
7078
7082
|
let r = await N.readdir(e, { withFileTypes: !0 });
|
|
7079
7083
|
for (let i of r) {
|
|
7080
|
-
if (
|
|
7084
|
+
if (tp.has(i.name)) continue;
|
|
7081
7085
|
let r = s(e, i.name);
|
|
7082
|
-
i.isDirectory() ? await n(r) : i.isFile() && (
|
|
7086
|
+
i.isDirectory() ? await n(r) : i.isFile() && (Vf.test(i.name) && !Hf.test(i.name) || Hf.test(i.name) || Uf.test(i.name) || Wf.test(i.name) || Gf.test(i.name) || $f.test(i.name) || ep.test(i.name) || Kf.test(i.name) || qf.test(i.name) || Jf.test(i.name) || Yf.test(i.name) || vd.test(i.name) || sl.test(i.name) || cl.test(i.name) || Xf.test(i.name) || Zf.test(i.name) || Qf.test(i.name)) && t.push(r);
|
|
7083
7087
|
}
|
|
7084
7088
|
};
|
|
7085
7089
|
return await n(e), t;
|
|
7086
|
-
},
|
|
7090
|
+
}, rp = (e) => typeof e == "object" && !!e && "kind" in e && "name" in e && e.kind === "query", ip = (e) => typeof e == "object" && !!e && "kind" in e && "name" in e && e.kind === "mutation", ap = (e) => typeof e == "object" && !!e && "kind" in e && "name" in e && e.kind === "action", op = (e) => typeof e == "object" && !!e && "kind" in e && "name" in e && e.kind === "stream", sp = Symbol.for("@effect/workflow/Workflow"), cp = (e) => typeof e == "object" && !!e && sp in e, lp = (e) => {
|
|
7087
7091
|
let t = {};
|
|
7088
7092
|
for (let [n, r] of Object.entries(e)) r instanceof Date ? t[n] = r.toISOString() : typeof r == "bigint" ? t[n] = r.toString() : t[n] = r;
|
|
7089
7093
|
return t;
|
|
7090
|
-
},
|
|
7094
|
+
}, up = (e) => Object.entries(e.fields).map(([e, t]) => {
|
|
7091
7095
|
let n = t, r = n.references?.()?.tableName;
|
|
7092
7096
|
return {
|
|
7093
7097
|
name: e,
|
|
@@ -7098,11 +7102,11 @@ ${a.join("\n\n")}\n`);
|
|
|
7098
7102
|
...r === void 0 ? {} : { referencesTable: r },
|
|
7099
7103
|
...n.oneOf === void 0 ? {} : { oneOf: [...n.oneOf] }
|
|
7100
7104
|
};
|
|
7101
|
-
}),
|
|
7105
|
+
}), dp = (e) => e.some((e) => e.name === "id") ? "id" : e.find((e) => e.type === "id")?.name, fp = (e) => typeof e == "object" && !!e && "tableName" in e && "fields" in e && typeof e.tableName == "string" && typeof e.fields == "object" && e.fields !== null, pp = (e, t) => {
|
|
7102
7106
|
let n = /* @__PURE__ */ new Map();
|
|
7103
|
-
for (let e of t)
|
|
7107
|
+
for (let e of t) fp(e) && n.set(e.tableName, e);
|
|
7104
7108
|
let r = /* @__PURE__ */ new Set(), i = [], a = (e) => {
|
|
7105
|
-
if (!(!
|
|
7109
|
+
if (!(!fp(e) || r.has(e.tableName))) {
|
|
7106
7110
|
r.add(e.tableName);
|
|
7107
7111
|
for (let t of Object.values(e.fields)) {
|
|
7108
7112
|
let e = t.references?.()?.tableName;
|
|
@@ -7115,7 +7119,7 @@ ${a.join("\n\n")}\n`);
|
|
|
7115
7119
|
};
|
|
7116
7120
|
for (let t of e) a(t);
|
|
7117
7121
|
return i;
|
|
7118
|
-
},
|
|
7122
|
+
}, mp = "voltro/tenant", hp = (e) => fp(e) && (e.appliedMixins ?? []).some((e) => e.id === mp), gp = "voltro/softDelete", _p = (e) => fp(e) && (e.appliedMixins ?? []).some((e) => e.id === gp), vp = (e) => {
|
|
7119
7123
|
let t = e.traceId, n = e.spanId;
|
|
7120
7124
|
if (typeof t != "string" || typeof n != "string") return null;
|
|
7121
7125
|
let r = (e) => e instanceof Date ? e.getTime() : typeof e == "string" ? new Date(e).getTime() : typeof e == "number" ? e : 0, i = r(e.startedAt), a = r(e.endedAt);
|
|
@@ -7133,7 +7137,7 @@ ${a.join("\n\n")}\n`);
|
|
|
7133
7137
|
...typeof e.statusMessage == "string" ? { statusMessage: e.statusMessage } : {},
|
|
7134
7138
|
...Array.isArray(e.events) ? { events: e.events } : {}
|
|
7135
7139
|
};
|
|
7136
|
-
},
|
|
7140
|
+
}, yp = async (e, t, n) => {
|
|
7137
7141
|
let r = e.indexOf("?"), i = (r === -1 ? new URLSearchParams() : new URLSearchParams(e.slice(r + 1))).get("traceId"), a = [];
|
|
7138
7142
|
try {
|
|
7139
7143
|
a = await n.query({
|
|
@@ -7152,36 +7156,36 @@ ${a.join("\n\n")}\n`);
|
|
|
7152
7156
|
}
|
|
7153
7157
|
let o = /* @__PURE__ */ new Map();
|
|
7154
7158
|
for (let e of a) {
|
|
7155
|
-
let t =
|
|
7159
|
+
let t = vp(e);
|
|
7156
7160
|
t && o.set(`${t.traceId}:${t.spanId}`, t);
|
|
7157
7161
|
}
|
|
7158
7162
|
for (let e of t.query({ max: t.capacityHint() })) o.set(`${e.traceId}:${e.spanId}`, e);
|
|
7159
|
-
let s = new
|
|
7163
|
+
let s = new yl(Math.max(o.size + 16, 1024));
|
|
7160
7164
|
for (let e of [...o.values()].sort((e, t) => e.startMs - t.startMs)) s.append(e);
|
|
7161
7165
|
return s;
|
|
7162
|
-
},
|
|
7166
|
+
}, bp = async (t, n) => {
|
|
7163
7167
|
let r = [], a = [], o = [], s = [], c = [], l = [], u = [], d = [], f = /* @__PURE__ */ new Set(), p = /* @__PURE__ */ new Set(), m = /* @__PURE__ */ new Map(), h = [], g = /* @__PURE__ */ new Map();
|
|
7164
|
-
for (let n of
|
|
7165
|
-
let
|
|
7166
|
-
if (
|
|
7167
|
-
let
|
|
7168
|
-
for (let
|
|
7169
|
-
sr(
|
|
7168
|
+
for (let n of t) {
|
|
7169
|
+
let t = i(n);
|
|
7170
|
+
if ($f.test(t)) {
|
|
7171
|
+
let t = await e(n);
|
|
7172
|
+
for (let e of Object.values(t)) fp(e) && (m.set(e.tableName, e), hp(e) && f.add(e.tableName), _p(e) && p.add(e.tableName));
|
|
7173
|
+
sr(t);
|
|
7170
7174
|
continue;
|
|
7171
7175
|
}
|
|
7172
|
-
if (
|
|
7173
|
-
sr(await
|
|
7176
|
+
if (ep.test(t)) {
|
|
7177
|
+
sr(await e(n)) === 0 && $.warn("skipping relations file — no relations(...) export found", { file: n });
|
|
7174
7178
|
continue;
|
|
7175
7179
|
}
|
|
7176
|
-
if (
|
|
7177
|
-
let
|
|
7180
|
+
if (Uf.test(t)) {
|
|
7181
|
+
let t = await e(n), r = Object.values(t).find(cp);
|
|
7178
7182
|
if (!r) {
|
|
7179
7183
|
$.warn("skipping workflow — no workflow(...) export", { file: n });
|
|
7180
7184
|
continue;
|
|
7181
7185
|
}
|
|
7182
7186
|
let i = n.replace(/\.workflow\.tsx$/, ".workflow.server.tsx"), a;
|
|
7183
7187
|
try {
|
|
7184
|
-
a = await
|
|
7188
|
+
a = await e(i);
|
|
7185
7189
|
} catch {
|
|
7186
7190
|
$.warn("skipping workflow — missing paired executor", {
|
|
7187
7191
|
file: n,
|
|
@@ -7199,17 +7203,17 @@ ${a.join("\n\n")}\n`);
|
|
|
7199
7203
|
definition: r,
|
|
7200
7204
|
buildExecute: o
|
|
7201
7205
|
});
|
|
7202
|
-
for (let
|
|
7206
|
+
for (let e of [...Object.values(t), ...Object.values(a)]) jn(e) && l.push(e);
|
|
7203
7207
|
continue;
|
|
7204
7208
|
}
|
|
7205
|
-
if (
|
|
7206
|
-
let r = await
|
|
7209
|
+
if (Gf.test(t)) {
|
|
7210
|
+
let r = await e(n), i = r.default ?? Object.values(r).find(Ke);
|
|
7207
7211
|
if (!Ke(i)) {
|
|
7208
7212
|
$.warn("skipping trigger — default export is not triggerWorkflow(...)", { file: n });
|
|
7209
7213
|
continue;
|
|
7210
7214
|
}
|
|
7211
7215
|
u.push({
|
|
7212
|
-
id: i.id ??
|
|
7216
|
+
id: i.id ?? t.replace(/\.trigger\.tsx?$/, ""),
|
|
7213
7217
|
event: i.event,
|
|
7214
7218
|
workflow: i.workflow,
|
|
7215
7219
|
...i.filter === void 0 ? {} : { filter: i.filter },
|
|
@@ -7219,65 +7223,65 @@ ${a.join("\n\n")}\n`);
|
|
|
7219
7223
|
});
|
|
7220
7224
|
continue;
|
|
7221
7225
|
}
|
|
7222
|
-
if (
|
|
7223
|
-
let
|
|
7224
|
-
if (!Ge(
|
|
7226
|
+
if (Jf.test(t)) {
|
|
7227
|
+
let t = (await e(n)).default;
|
|
7228
|
+
if (!Ge(t)) {
|
|
7225
7229
|
$.warn("skipping cron — default export is not defineSchedule(...)", { file: n });
|
|
7226
7230
|
continue;
|
|
7227
7231
|
}
|
|
7228
|
-
if (d.some((
|
|
7232
|
+
if (d.some((e) => e.name === t.name)) {
|
|
7229
7233
|
$.warn("skipping cron — duplicate schedule name", {
|
|
7230
7234
|
file: n,
|
|
7231
|
-
name:
|
|
7235
|
+
name: t.name
|
|
7232
7236
|
});
|
|
7233
7237
|
continue;
|
|
7234
7238
|
}
|
|
7235
|
-
d.push(
|
|
7239
|
+
d.push(t);
|
|
7236
7240
|
continue;
|
|
7237
7241
|
}
|
|
7238
|
-
if (
|
|
7239
|
-
let
|
|
7240
|
-
g.set(
|
|
7242
|
+
if (Hf.test(t)) {
|
|
7243
|
+
let e = n.slice(0, -t.length), r = t.replace(/\.server\.ts$/, ".ts");
|
|
7244
|
+
g.set(e + r, n);
|
|
7241
7245
|
continue;
|
|
7242
7246
|
}
|
|
7243
|
-
if (
|
|
7247
|
+
if (Vf.test(t)) {
|
|
7244
7248
|
h.push(n);
|
|
7245
7249
|
continue;
|
|
7246
7250
|
}
|
|
7247
7251
|
}
|
|
7248
|
-
for (let
|
|
7249
|
-
let n = await t
|
|
7252
|
+
for (let t of h) {
|
|
7253
|
+
let n = await e(t), i = Object.values(n).find(rp) ?? Object.values(n).find(ip) ?? Object.values(n).find(ap) ?? Object.values(n).find(op);
|
|
7250
7254
|
if (!i) {
|
|
7251
|
-
$.warn("skipping procedure descriptor — no defineQuery / defineMutation / defineAction / defineStream export", { file:
|
|
7255
|
+
$.warn("skipping procedure descriptor — no defineQuery / defineMutation / defineAction / defineStream export", { file: t });
|
|
7252
7256
|
continue;
|
|
7253
7257
|
}
|
|
7254
|
-
let c = g.get(
|
|
7258
|
+
let c = g.get(t);
|
|
7255
7259
|
if (!c) {
|
|
7256
7260
|
$.warn("skipping procedure descriptor — missing sibling .server.ts executor", {
|
|
7257
|
-
descriptor:
|
|
7258
|
-
expected:
|
|
7261
|
+
descriptor: t,
|
|
7262
|
+
expected: t.replace(/\.ts$/, ".server.ts")
|
|
7259
7263
|
});
|
|
7260
7264
|
continue;
|
|
7261
7265
|
}
|
|
7262
|
-
let l = (await
|
|
7266
|
+
let l = (await e(c)).default;
|
|
7263
7267
|
if (typeof l != "function") {
|
|
7264
7268
|
$.warn("skipping procedure server executor — missing default export", { file: c });
|
|
7265
7269
|
continue;
|
|
7266
7270
|
}
|
|
7267
7271
|
i.kind === "query" ? r.push({
|
|
7268
|
-
file:
|
|
7272
|
+
file: t,
|
|
7269
7273
|
descriptor: i,
|
|
7270
7274
|
executor: l
|
|
7271
7275
|
}) : i.kind === "mutation" ? a.push({
|
|
7272
|
-
file:
|
|
7276
|
+
file: t,
|
|
7273
7277
|
descriptor: i,
|
|
7274
7278
|
executor: l
|
|
7275
7279
|
}) : i.kind === "action" ? o.push({
|
|
7276
|
-
file:
|
|
7280
|
+
file: t,
|
|
7277
7281
|
descriptor: i,
|
|
7278
7282
|
executor: l
|
|
7279
7283
|
}) : i.kind === "stream" && s.push({
|
|
7280
|
-
file:
|
|
7284
|
+
file: t,
|
|
7281
7285
|
descriptor: i,
|
|
7282
7286
|
executor: l
|
|
7283
7287
|
});
|
|
@@ -7291,8 +7295,8 @@ ${a.join("\n\n")}\n`);
|
|
|
7291
7295
|
let y = {
|
|
7292
7296
|
workflows: c.length > 0 || u.length > 0,
|
|
7293
7297
|
schedules: d.length > 0,
|
|
7294
|
-
webhooks:
|
|
7295
|
-
agents:
|
|
7298
|
+
webhooks: t.some((e) => Yf.test(i(e))),
|
|
7299
|
+
agents: t.some((e) => sl.test(i(e)))
|
|
7296
7300
|
};
|
|
7297
7301
|
return {
|
|
7298
7302
|
queries: r,
|
|
@@ -7308,16 +7312,16 @@ ${a.join("\n\n")}\n`);
|
|
|
7308
7312
|
tenantScopedTables: f,
|
|
7309
7313
|
softDeleteScopedTables: p
|
|
7310
7314
|
};
|
|
7311
|
-
},
|
|
7312
|
-
let n = s(
|
|
7315
|
+
}, xp = async (t) => {
|
|
7316
|
+
let n = s(t, "app.config.ts");
|
|
7313
7317
|
try {
|
|
7314
|
-
let
|
|
7315
|
-
return typeof
|
|
7318
|
+
let t = (await e(n)).default;
|
|
7319
|
+
return typeof t == "object" && t ? t : null;
|
|
7316
7320
|
} catch {
|
|
7317
7321
|
return null;
|
|
7318
7322
|
}
|
|
7319
|
-
},
|
|
7320
|
-
let e =
|
|
7323
|
+
}, Sp = () => {
|
|
7324
|
+
let e = wp(), t = process.env.DB_SCHEMA, n = t && t.length > 0 ? { schema: t } : {}, r = Cp(), i = r === void 0 ? {} : { ssl: r }, a = process.env.DB_URL ?? process.env.DB_PRIMARY_URL;
|
|
7321
7325
|
return a ? {
|
|
7322
7326
|
url: a,
|
|
7323
7327
|
...e === void 0 ? {} : { maxConnections: e },
|
|
@@ -7333,19 +7337,19 @@ ${a.join("\n\n")}\n`);
|
|
|
7333
7337
|
...i,
|
|
7334
7338
|
...n
|
|
7335
7339
|
};
|
|
7336
|
-
},
|
|
7340
|
+
}, Cp = () => {
|
|
7337
7341
|
let e = process.env.PG_SSL;
|
|
7338
7342
|
if (!(e === void 0 || e === "")) {
|
|
7339
7343
|
if (e === "require") return !0;
|
|
7340
7344
|
if (e === "disable") return !1;
|
|
7341
7345
|
throw Error(`PG_SSL '${e}' is not supported — use 'require' (TLS without certificate verification) or 'disable' (plaintext).`);
|
|
7342
7346
|
}
|
|
7343
|
-
},
|
|
7347
|
+
}, wp = () => {
|
|
7344
7348
|
let e = process.env.DB_MAX_CONNECTIONS ?? process.env.PG_MAX_CONNECTIONS;
|
|
7345
7349
|
if (e === void 0 || e === "") return;
|
|
7346
7350
|
let t = Number(e);
|
|
7347
7351
|
return Number.isInteger(t) && t > 0 ? t : void 0;
|
|
7348
|
-
},
|
|
7352
|
+
}, Tp = (e) => {
|
|
7349
7353
|
let t = process.env.DB_URL !== void 0 || process.env.DB_PRIMARY_URL !== void 0 || process.env.DB_HOST !== void 0 || process.env.PG_HOST !== void 0;
|
|
7350
7354
|
if ("url" in e && e.url) try {
|
|
7351
7355
|
let n = new URL(e.url), r = n.username ? `${n.username}@` : "", i = n.port ? `:${n.port}` : "";
|
|
@@ -7364,25 +7368,25 @@ ${a.join("\n\n")}\n`);
|
|
|
7364
7368
|
summary: `postgres://${n.username}@${n.host}:${n.port}/${n.database}`,
|
|
7365
7369
|
fromEnv: t
|
|
7366
7370
|
};
|
|
7367
|
-
},
|
|
7371
|
+
}, Ep = () => {
|
|
7368
7372
|
let e = process.env.DB_REPLICA_URLS;
|
|
7369
7373
|
return e === void 0 || e.trim() === "" ? [] : e.split(",").map((e) => e.trim()).filter((e) => e.length > 0);
|
|
7370
|
-
},
|
|
7374
|
+
}, Dp = (e) => {
|
|
7371
7375
|
let t = 2166136261;
|
|
7372
7376
|
for (let n = 0; n < e.length; n++) t ^= e.charCodeAt(n), t = Math.imul(t, 16777619);
|
|
7373
7377
|
return 1e3 + (t >>> 0) % 2147482647;
|
|
7374
|
-
},
|
|
7375
|
-
let n =
|
|
7378
|
+
}, Op = (e) => (process.env.DB_DIALECT ?? e?.store ?? "memory").toLowerCase(), kp = async (e, t) => {
|
|
7379
|
+
let n = Op(e);
|
|
7376
7380
|
if (n === "memory") return $.info("sql dialect resolved: memory — in-process store, no persistence"), new ge({});
|
|
7377
|
-
let i = (process.env.CDC ?? "1") !== "0", a = await
|
|
7381
|
+
let i = (process.env.CDC ?? "1") !== "0", a = await Uc(n), o = a.id === "postgres" ? "LISTEN/NOTIFY" : rr(a.id) ? "in-process bus" : a.id === "mariadb" ? "binlog CDC (ROW)" : a.id === "mssql" ? "Change Tracking (polled)" : a.id === "mysql" ? "binlog CDC (ROW)" : "inline only", s = a.id === "postgres" ? "native" : a.id === "mysql" ? "INSERT/UPDATE/DELETE then SELECT (no RETURNING)" : a.id === "mariadb" ? "native (INSERT/DELETE); UPDATE then SELECT" : a.id === "mssql" ? "OUTPUT INSERTED/DELETED" : rr(a.id) ? "native" : "unknown";
|
|
7378
7382
|
$.info(`sql dialect resolved: ${a.id} — CDC: ${i ? o : "inline emit (CDC=0)"}, RETURNING: ${s}`);
|
|
7379
|
-
let c =
|
|
7383
|
+
let c = Sp(), { summary: l, fromEnv: u } = Tp(c);
|
|
7380
7384
|
$.info(`db connection: ${l}${u ? "" : " (DEFAULT FALLBACK — no DB_URL / PG_HOST set)"}`), u || $.warn("db connection: falling back to localhost:5432/app — no DB_URL or PG_HOST env var set.\n If this app should run against its OWN postgres (e.g. its docker-compose), set DB_URL.\n Copy `.env.example` to `.env` in the app dir, or set DB_URL in the shell.\n Otherwise this app is silently using whatever DB is at localhost:5432/app — which is\n voltro-starter's docker default + may carry foreign tables that confuse the planner.");
|
|
7381
7385
|
let d;
|
|
7382
7386
|
if (i && (a.id === "mysql" || a.id === "mariadb")) {
|
|
7383
|
-
let { connectionFromConfig: e } = await
|
|
7387
|
+
let { connectionFromConfig: e } = await Hc("@voltro/sql-mysql"), t = process.env.POD_NAME ?? process.env.HOSTNAME ?? `dev-${process.pid}`, n = Xn().map((e) => e.tableName).filter((e) => !e.startsWith("_voltro_"));
|
|
7384
7388
|
d = {
|
|
7385
|
-
serverId:
|
|
7389
|
+
serverId: Dp(t),
|
|
7386
7390
|
replicaId: t,
|
|
7387
7391
|
connection: e(c),
|
|
7388
7392
|
...n.length > 0 ? { includeTables: n } : {}
|
|
@@ -7392,7 +7396,7 @@ ${a.join("\n\n")}\n`);
|
|
|
7392
7396
|
reactiveTables: n.length
|
|
7393
7397
|
});
|
|
7394
7398
|
} else if (i && a.id === "mssql") {
|
|
7395
|
-
let { connectionFromConfig: e } = await
|
|
7399
|
+
let { connectionFromConfig: e } = await Hc("@voltro/sql-mssql"), t = e(c), n = process.env.POD_NAME ?? process.env.HOSTNAME ?? `dev-${process.pid}`, r = Xn().map((e) => e.tableName).filter((e) => !e.startsWith("_voltro_"));
|
|
7396
7400
|
d = {
|
|
7397
7401
|
serverId: 0,
|
|
7398
7402
|
replicaId: n,
|
|
@@ -7414,7 +7418,7 @@ ${a.join("\n\n")}\n`);
|
|
|
7414
7418
|
...t ? { tracerLayer: t } : {},
|
|
7415
7419
|
changeStrategy: i ? "cdc" : "inline",
|
|
7416
7420
|
...d ? { cdcConfig: d } : {}
|
|
7417
|
-
}), p =
|
|
7421
|
+
}), p = Ep();
|
|
7418
7422
|
if (p.length === 0) return $.info("read replicas: none configured (DB_REPLICA_URLS unset) — all queries → primary"), r.recordReplication({
|
|
7419
7423
|
replicaCount: 0,
|
|
7420
7424
|
rywPolicy: "off",
|
|
@@ -7429,7 +7433,7 @@ ${a.join("\n\n")}\n`);
|
|
|
7429
7433
|
region: null,
|
|
7430
7434
|
localityEnabled: !1
|
|
7431
7435
|
}), f;
|
|
7432
|
-
let m = await
|
|
7436
|
+
let m = await Pp(a.id);
|
|
7433
7437
|
if (m === null) return $.warn(`read replicas: no replication adapter for dialect ${a.id}; falling back to primary-only routing`), r.recordReplication({
|
|
7434
7438
|
replicaCount: 0,
|
|
7435
7439
|
rywPolicy: "off",
|
|
@@ -7455,15 +7459,15 @@ ${a.join("\n\n")}\n`);
|
|
|
7455
7459
|
v = xt({
|
|
7456
7460
|
client: n,
|
|
7457
7461
|
subscriber: n.duplicate()
|
|
7458
|
-
}), y = "redis", $.info(`read replicas: ryw store = redis @ ${
|
|
7462
|
+
}), y = "redis", $.info(`read replicas: ryw store = redis @ ${jp(e)}`);
|
|
7459
7463
|
} catch (e) {
|
|
7460
7464
|
$.warn("RYW_STORE=redis but ioredis import / connect failed — falling back to memory store", { err: e });
|
|
7461
7465
|
}
|
|
7462
7466
|
}
|
|
7463
7467
|
v ||= pt();
|
|
7464
|
-
let b =
|
|
7468
|
+
let b = Mp(p.length), x = Tt(), S = x && b.length > 0 ? Ye({
|
|
7465
7469
|
currentRegion: x,
|
|
7466
|
-
replicaRegions:
|
|
7470
|
+
replicaRegions: Np(h, b),
|
|
7467
7471
|
inner: _t()
|
|
7468
7472
|
}) : _t();
|
|
7469
7473
|
return $.info(`read replicas: ${h.length} configured, ryw policy '${g}', dialect=${a.id}, region=${x ?? "unknown"}` + (b.length > 0 ? ", replica-locality=on" : "")), r.recordReplication({
|
|
@@ -7480,7 +7484,7 @@ ${a.join("\n\n")}\n`);
|
|
|
7480
7484
|
rywStore: v,
|
|
7481
7485
|
replicaSelector: S
|
|
7482
7486
|
});
|
|
7483
|
-
},
|
|
7487
|
+
}, Ap = async (e, t, n, r) => {
|
|
7484
7488
|
let i = mi(t?.plugins ?? []), a = n === "postgres" || n === "mysql" || n === "mariadb", o = n === "postgres" ? "LISTEN/NOTIFY" : "binlog CDC";
|
|
7485
7489
|
if (!i) return n === "memory" || n === "sqlite" || n === "turso" ? r.info(`reactivity: single-instance (${n}) — no cross-replica fan-out needed`) : a ? r.info(`reactivity: cross-instance via native ${o} (${n})`) : r.warn(`reactivity: cross-instance fan-out is OFF for dialect '${n}'. A write on one replica will NOT reach clients on other replicas. Add @voltro/plugin-broadcast (Redis / NATS) to close the gap, or use postgres (LISTEN/NOTIFY) / mariadb (binlog CDC).`), null;
|
|
7486
7490
|
let s = process.env.POD_NAME ?? process.env.HOSTNAME ?? `dev-${process.pid}`;
|
|
@@ -7490,35 +7494,35 @@ ${a.join("\n\n")}\n`);
|
|
|
7490
7494
|
replicaId: s,
|
|
7491
7495
|
logger: r
|
|
7492
7496
|
});
|
|
7493
|
-
},
|
|
7497
|
+
}, jp = (e) => {
|
|
7494
7498
|
try {
|
|
7495
7499
|
let t = new URL(e);
|
|
7496
7500
|
return t.password &&= "***", t.toString();
|
|
7497
7501
|
} catch {
|
|
7498
7502
|
return "***";
|
|
7499
7503
|
}
|
|
7500
|
-
},
|
|
7504
|
+
}, Mp = (e) => {
|
|
7501
7505
|
let t = process.env.DB_REPLICA_REGIONS;
|
|
7502
7506
|
if (!t) return [];
|
|
7503
7507
|
let n = t.split(",").map((e) => e.trim()).filter((e) => e.length > 0);
|
|
7504
7508
|
return n.length === e ? n : ($.warn(`DB_REPLICA_REGIONS has ${n.length} entries but DB_REPLICA_URLS has ${e} — region awareness disabled. Provide one region per replica in the same order.`), []);
|
|
7505
|
-
},
|
|
7509
|
+
}, Np = (e, t) => {
|
|
7506
7510
|
let n = /* @__PURE__ */ new Map();
|
|
7507
7511
|
for (let r = 0; r < e.length && r < t.length; r++) n.set(e[r], t[r]);
|
|
7508
7512
|
return n;
|
|
7509
|
-
},
|
|
7513
|
+
}, Pp = async (e) => {
|
|
7510
7514
|
switch (e) {
|
|
7511
|
-
case "postgres": return (await
|
|
7515
|
+
case "postgres": return (await Hc("@voltro/sql-postgres")).postgresReplicationAdapter();
|
|
7512
7516
|
case "mysql":
|
|
7513
|
-
case "mariadb": return (await
|
|
7514
|
-
case "mssql": return (await
|
|
7517
|
+
case "mariadb": return (await Hc("@voltro/sql-mysql")).mysqlReplicationAdapter();
|
|
7518
|
+
case "mssql": return (await Hc("@voltro/sql-mssql")).mssqlReplicationAdapter();
|
|
7515
7519
|
default: return null;
|
|
7516
7520
|
}
|
|
7517
|
-
},
|
|
7521
|
+
}, Fp = async (e) => {
|
|
7518
7522
|
let t = l(e.find((e) => !e.startsWith("-")) ?? process.cwd()), n = await Qs(t);
|
|
7519
|
-
return n.ran ? n.exitCode : process.env.FRAMEWORK_DEV_INNER !== "1" && process.env.WATCH !== "0" ? (yi(
|
|
7520
|
-
},
|
|
7521
|
-
let a = Date.now(), o = await
|
|
7523
|
+
return n.ran ? n.exitCode : process.env.FRAMEWORK_DEV_INNER !== "1" && process.env.WATCH !== "0" ? (yi(iu({ root: t }), { scope: "voltro:dev" }), new Promise(() => {})) : Ip(t);
|
|
7524
|
+
}, Ip = async (e) => {
|
|
7525
|
+
let a = Date.now(), o = await xp(e), l = Number(process.env.PORT ?? o?.port ?? 4e3), u = o?.name ?? i(e), d = Ko("api", u, l), f = es(u);
|
|
7522
7526
|
await Wo({
|
|
7523
7527
|
id: d,
|
|
7524
7528
|
name: u,
|
|
@@ -7530,18 +7534,18 @@ ${a.join("\n\n")}\n`);
|
|
|
7530
7534
|
}).catch(() => {});
|
|
7531
7535
|
let p = Ka();
|
|
7532
7536
|
no(p), $.info("booting voltro dev", {
|
|
7533
|
-
root:
|
|
7534
|
-
version:
|
|
7537
|
+
root: e,
|
|
7538
|
+
version: jf,
|
|
7535
7539
|
logFile: f.path
|
|
7536
7540
|
});
|
|
7537
7541
|
let m = process.env.VOLTRO_DEV_HEALTH_PORT, h = m === void 0 ? l + 1 : Number(m), _;
|
|
7538
|
-
h > 0 && Number.isFinite(h) && (_ = await
|
|
7542
|
+
h > 0 && Number.isFinite(h) && (_ = await kf({
|
|
7539
7543
|
port: h,
|
|
7540
7544
|
log: {
|
|
7541
7545
|
info: (e, t) => $.debug(e, t),
|
|
7542
7546
|
warn: (e, t) => $.warn(e, t)
|
|
7543
7547
|
}
|
|
7544
|
-
})), Hi(
|
|
7548
|
+
})), Hi(e).then((e) => {
|
|
7545
7549
|
for (let t of e.files) if (t.action === "created") {
|
|
7546
7550
|
let e = t.path.split("/").slice(-2).join("/");
|
|
7547
7551
|
$.info(`${e} seeded`, { path: t.path });
|
|
@@ -7549,30 +7553,30 @@ ${a.join("\n\n")}\n`);
|
|
|
7549
7553
|
}).catch((e) => {
|
|
7550
7554
|
$.warn("agent-instructions seed failed (non-fatal)", {}, e);
|
|
7551
7555
|
});
|
|
7552
|
-
let v = await
|
|
7556
|
+
let v = await np(e);
|
|
7553
7557
|
$.info(`discovered ${v.length} files`, { count: v.length });
|
|
7554
|
-
let b = await
|
|
7558
|
+
let b = await lf(o?.plugins ?? [], o?.name ?? i(e), e), w = (o?.plugins ?? []).flatMap((e) => (e.errorSchemas ?? []).map((e) => e.import)), T = (o?.plugins ?? []).flatMap((e) => (e.rpcClientDescriptors ?? []).map((e) => ({
|
|
7555
7559
|
tag: e.tag,
|
|
7556
7560
|
kind: e.kind,
|
|
7557
7561
|
module: e.import.module,
|
|
7558
7562
|
name: e.import.name
|
|
7559
7563
|
}))), E = await Pc({
|
|
7560
|
-
root:
|
|
7564
|
+
root: e,
|
|
7561
7565
|
...b.length > 0 ? { pluginContributions: b } : {},
|
|
7562
7566
|
...w.length > 0 ? { pluginErrorImports: w } : {},
|
|
7563
7567
|
...T.length > 0 ? { pluginRpcImports: T } : {},
|
|
7564
7568
|
...o?.name === void 0 ? {} : { apiName: o.name }
|
|
7565
7569
|
});
|
|
7566
|
-
E ? ($.info("codegen wrote rpcGroup", { path: c(
|
|
7567
|
-
let D =
|
|
7570
|
+
E ? ($.info("codegen wrote rpcGroup", { path: c(e, E) }), await gc(E)) : $.debug("codegen skipped — no descriptors discovered");
|
|
7571
|
+
let D = Op(o ?? null), ee = D === "mariadb" ? "mariadb" : D === "mssql" ? "mssql" : void 0, te = ee !== void 0 && (process.env.CDC ?? "1") !== "0", { queries: O, mutations: k, actions: A, streams: j, workflows: M, workflowWorkers: ie, eventTriggers: ae, schedules: P, tables: oe, featureMix: se, tenantScopedTables: ce, softDeleteScopedTables: le } = await bp(v, { cdc: te }), ue = M.length > 0 || ae.length > 0, F = await xp(e);
|
|
7568
7572
|
jt(Dt(F?.secrets)), await Qi({
|
|
7569
7573
|
rawEnv: F?.env,
|
|
7570
7574
|
appType: "api",
|
|
7571
|
-
root:
|
|
7575
|
+
root: e,
|
|
7572
7576
|
log: $,
|
|
7573
7577
|
generateTypes: !0
|
|
7574
7578
|
});
|
|
7575
|
-
let de = F?.apiKeys, pe = (typeof de == "object" ? de.prefix : void 0) ?? "voltro_", me, ge = de ? [Ve({ resolveByHash: (e, t) => me ? me.resolveByHash(e, t) : Promise.resolve(null) }, { prefix: pe })] : [], _e =
|
|
7579
|
+
let de = F?.apiKeys, pe = (typeof de == "object" ? de.prefix : void 0) ?? "voltro_", me, ge = de ? [Ve({ resolveByHash: (e, t) => me ? me.resolveByHash(e, t) : Promise.resolve(null) }, { prefix: pe })] : [], _e = Ff([...F?.auth?.strategies ?? [], ...ge], ei(F?.plugins ?? []), F?.auth?.anonymousTenantRequired ?? !1), ve = If(_e), ye = zl({
|
|
7576
7580
|
mix: se,
|
|
7577
7581
|
plugins: F?.plugins ?? [],
|
|
7578
7582
|
cdc: te,
|
|
@@ -7586,29 +7590,29 @@ ${a.join("\n\n")}\n`);
|
|
|
7586
7590
|
return t;
|
|
7587
7591
|
})();
|
|
7588
7592
|
for (let e of I) er(e);
|
|
7589
|
-
let xe =
|
|
7593
|
+
let xe = Id({
|
|
7590
7594
|
plugins: F?.plugins ?? [],
|
|
7591
|
-
appName: F?.name ?? i(
|
|
7595
|
+
appName: F?.name ?? i(e),
|
|
7592
7596
|
appType: "api",
|
|
7593
7597
|
voltroVersion: process.env.npm_package_version ?? "0.0.0",
|
|
7594
7598
|
log: $
|
|
7595
7599
|
});
|
|
7596
7600
|
F?.plugins?.length && ($.info("plugins loaded", { plugins: F.plugins.map((e) => e.name) }), await xe.activate());
|
|
7597
|
-
let Se = await xe.gatherObservability(), Ce =
|
|
7601
|
+
let Se = await xe.gatherObservability(), Ce = Wd(F?.plugins ?? []);
|
|
7598
7602
|
Ce.endpoints.length > 0 && $.info("plugin inspect endpoints registered", {
|
|
7599
7603
|
count: Ce.endpoints.length,
|
|
7600
7604
|
endpoints: Ce.endpoints.map((e) => `${e.method} ${e.path}`)
|
|
7601
7605
|
});
|
|
7602
|
-
let we =
|
|
7606
|
+
let we = tf(F?.plugins ?? []);
|
|
7603
7607
|
we.length > 0 && $.info("plugin dashboard mounts registered", {
|
|
7604
7608
|
count: we.length,
|
|
7605
7609
|
mounts: we.map((e) => `${e.fullId} (${e.slot})`)
|
|
7606
7610
|
});
|
|
7607
|
-
let Oe =
|
|
7611
|
+
let Oe = al(F?.plugins ?? []);
|
|
7608
7612
|
Oe.length > 0 && $.info("plugin schema contributions", { plugins: Oe.map((e) => `${e.pluginName}: ${e.tables}t/${e.migrations}m`) });
|
|
7609
|
-
let Le =
|
|
7613
|
+
let Le = Zc(F?.plugins ?? []);
|
|
7610
7614
|
if (Le.length > 0) {
|
|
7611
|
-
|
|
7615
|
+
Qc(Le, [
|
|
7612
7616
|
...O.map((e) => e.descriptor.name),
|
|
7613
7617
|
...k.map((e) => e.descriptor.name),
|
|
7614
7618
|
...A.map((e) => e.descriptor.name),
|
|
@@ -7632,16 +7636,16 @@ ${a.join("\n\n")}\n`);
|
|
|
7632
7636
|
routes: Le.map((e) => `${e.plugin.name}:${e.descriptor.name} (${e.kind})`)
|
|
7633
7637
|
});
|
|
7634
7638
|
}
|
|
7635
|
-
let Be = $.child("agent"), He = v.filter((e) =>
|
|
7639
|
+
let Be = $.child("agent"), He = v.filter((e) => ll.test(i(e)));
|
|
7636
7640
|
if (He.length > 0) {
|
|
7637
|
-
let e = await
|
|
7641
|
+
let e = await ul(He, Be);
|
|
7638
7642
|
e > 0 && Be.info("wired tool handlers", { tools: e });
|
|
7639
7643
|
}
|
|
7640
|
-
let We = v.filter((e) =>
|
|
7644
|
+
let We = v.filter((e) => sl.test(i(e))), Ge = [];
|
|
7641
7645
|
if (We.length > 0) {
|
|
7642
|
-
let e = await
|
|
7646
|
+
let e = await fl(We, Be);
|
|
7643
7647
|
Ge = e.agents.map((e) => e.descriptor.name);
|
|
7644
|
-
for (let t of e.agents) for (let e of
|
|
7648
|
+
for (let t of e.agents) for (let e of xd(t)) e.kind === "action" ? A.push({
|
|
7645
7649
|
file: e.file,
|
|
7646
7650
|
descriptor: e.descriptor,
|
|
7647
7651
|
executor: e.executor
|
|
@@ -7655,15 +7659,15 @@ ${a.join("\n\n")}\n`);
|
|
|
7655
7659
|
routes: e.agents.flatMap((e) => [`${e.descriptor.name}.send`, `${e.descriptor.name}.messages`])
|
|
7656
7660
|
});
|
|
7657
7661
|
}
|
|
7658
|
-
let Ke =
|
|
7662
|
+
let Ke = Cd();
|
|
7659
7663
|
(Ke.queries.length > 0 || Ke.mutations.length > 0) && (O.push(...Ke.queries), k.push(...Ke.mutations), $.info("undo built-ins registered", { routes: [
|
|
7660
7664
|
"__voltro.undo.log",
|
|
7661
7665
|
"__voltro.undo.apply",
|
|
7662
7666
|
"__voltro.undo.redo"
|
|
7663
7667
|
] }));
|
|
7664
|
-
let qe = $.child("aggregate"), Je = v.filter((e) =>
|
|
7668
|
+
let qe = $.child("aggregate"), Je = v.filter((e) => Qf.test(e)), Ye = Je.length > 0 ? await Hu(Je, qe) : [], rt = Ye.map((e) => e.definition.name);
|
|
7665
7669
|
for (let e of $n()) $.warn(`identifier length · ${e}`);
|
|
7666
|
-
let ot = F?.restRoutes ?? [], lt = v.filter((e) =>
|
|
7670
|
+
let ot = F?.restRoutes ?? [], lt = v.filter((e) => Xf.test(e)).length, pt = v.filter((e) => qf.test(e)).length, ht = v.filter((e) => /\.seed\.ts$/.test(e)).length, gt = v.filter((e) => Yf.test(e)).length, _t = v.filter((e) => vd.test(e)).length;
|
|
7667
7671
|
$.info("app surface", {
|
|
7668
7672
|
queryCount: O.length,
|
|
7669
7673
|
mutationCount: k.length,
|
|
@@ -7683,7 +7687,7 @@ ${a.join("\n\n")}\n`);
|
|
|
7683
7687
|
emailCount: _t,
|
|
7684
7688
|
tenantTables: [...ce]
|
|
7685
7689
|
}), ne({
|
|
7686
|
-
appName: F?.name ?? i(
|
|
7690
|
+
appName: F?.name ?? i(e),
|
|
7687
7691
|
queries: O.map((e) => e.descriptor.name),
|
|
7688
7692
|
mutations: k.map((e) => e.descriptor.name),
|
|
7689
7693
|
actions: A.map((e) => e.descriptor.name),
|
|
@@ -7703,12 +7707,12 @@ ${a.join("\n\n")}\n`);
|
|
|
7703
7707
|
},
|
|
7704
7708
|
tenantTables: [...ce]
|
|
7705
7709
|
});
|
|
7706
|
-
let vt =
|
|
7710
|
+
let vt = xl(), xt = (process.env.VOLTRO_TRACING_BUFFER ?? "").toLowerCase() === "off", St = (process.env.VOLTRO_TRACING_STREAM ?? "").toLowerCase() === "all", Ct = () => {}, Tt = (e) => {
|
|
7707
7711
|
if (!e.name.startsWith("http.server")) return !1;
|
|
7708
7712
|
let t = e.attributes, n = String(t["url.path"] ?? t["http.route"] ?? t["http.target"] ?? "");
|
|
7709
7713
|
return n.startsWith("/_voltro/") || n === "/ws" || n.startsWith("/ws/") || n.startsWith("/ws?");
|
|
7710
7714
|
}, Et = (e) => {
|
|
7711
|
-
Tt(e) ||
|
|
7715
|
+
Tt(e) || ml(e) || e.name.startsWith("RpcServer.") || (vt.append(e), (St || e.status === "error") && p.emit("trace", e), Ct(e));
|
|
7712
7716
|
}, Ot = xt ? void 0 : et(Et), At = await Pe({
|
|
7713
7717
|
serviceName: process.env.OTEL_SERVICE_NAME ?? F?.name ?? "voltro-api",
|
|
7714
7718
|
...Ot ? { traceSink: Ot } : {},
|
|
@@ -7718,12 +7722,12 @@ ${a.join("\n\n")}\n`);
|
|
|
7718
7722
|
...Se.sampler === void 0 ? {} : { sampler: Se.sampler }
|
|
7719
7723
|
});
|
|
7720
7724
|
At.mode === "off" ? At.bufferOnly || $.info("tracing disabled", { reason: "buffer off" }) : $.info("tracing enabled", { mode: At.mode });
|
|
7721
|
-
let It = At.mode === "off" && At.bufferOnly === !1 ? void 0 : At.layer, L = await
|
|
7725
|
+
let It = At.mode === "off" && At.bufferOnly === !1 ? void 0 : At.layer, L = await kp(F, It);
|
|
7722
7726
|
de && (me = Qe(Re(L), { prefix: pe }), $.info("api keys active", { prefix: pe }));
|
|
7723
|
-
let Lt =
|
|
7727
|
+
let Lt = Op(F), Rt = process.env.POD_NAME ?? process.env.HOSTNAME ?? `dev-${process.pid}`, Bt, Vt;
|
|
7724
7728
|
if (Lt !== "memory") {
|
|
7725
|
-
let e = await
|
|
7726
|
-
Bt = C.make(e.makeSqlLayer(
|
|
7729
|
+
let e = await Uc(Lt);
|
|
7730
|
+
Bt = C.make(e.makeSqlLayer(Sp())), Vt = await Bt.runPromise(R.SqlClient);
|
|
7727
7731
|
}
|
|
7728
7732
|
let Ht = tt({
|
|
7729
7733
|
coordinator: [
|
|
@@ -7742,13 +7746,13 @@ ${a.join("\n\n")}\n`);
|
|
|
7742
7746
|
}
|
|
7743
7747
|
};
|
|
7744
7748
|
for (let e of F?.plugins ?? []) e.bindDataStore?.(L, Wt);
|
|
7745
|
-
let Gt = await
|
|
7749
|
+
let Gt = await Ap(L, F, Op(F), $);
|
|
7746
7750
|
F?.cache && !process.env.CACHE_BACKEND && (process.env.CACHE_BACKEND = F.cache), F?.cacheRedisUrl && !process.env.CACHE_REDIS_URL && (process.env.CACHE_REDIS_URL = F.cacheRedisUrl), F?.cacheRedisDriver && !process.env.CACHE_REDIS_DRIVER && (process.env.CACHE_REDIS_DRIVER = F.cacheRedisDriver), F?.cacheKeyPrefix && !process.env.CACHE_KEY_PREFIX && (process.env.CACHE_KEY_PREFIX = F.cacheKeyPrefix);
|
|
7747
|
-
let { service: Kt, invalidationBus: Jt, snapshotCache: Yt, cache: Xt, backend: Zt, stats: Qt, dispose: $t } = await
|
|
7751
|
+
let { service: Kt, invalidationBus: Jt, snapshotCache: Yt, cache: Xt, backend: Zt, stats: Qt, dispose: $t } = await Vl({ env: process.env });
|
|
7748
7752
|
$.info(`cache backend resolved: ${Zt}` + (Zt === "redis" ? ` (driver ${process.env.CACHE_REDIS_DRIVER ?? "resp"})` : " — in-process, not cross-instance")), F?.kv && !process.env.KV_BACKEND && (process.env.KV_BACKEND = F.kv), F?.kvRedisUrl && !process.env.KV_REDIS_URL && (process.env.KV_REDIS_URL = F.kvRedisUrl), F?.kvKeyPrefix && !process.env.KV_KEY_PREFIX && (process.env.KV_KEY_PREFIX = F.kvKeyPrefix);
|
|
7749
7753
|
let { kv: en, service: tn, backend: nn } = await $e({ store: L });
|
|
7750
7754
|
$.info(`kv backend resolved: ${nn}` + (nn === "database" ? " (durable, _voltro_kv)" : nn === "memory" ? " — in-process, non-durable" : ` (driver ${process.env.KV_REDIS_DRIVER ?? "resp"}, non-durable)`));
|
|
7751
|
-
let rn =
|
|
7755
|
+
let rn = Op(F), an = F?.analytics !== void 0 && F.analytics.kind !== "noop" && rn !== "memory" ? (await Uc(rn)).makeSqlLayer(Sp()) : void 0, on = await au({
|
|
7752
7756
|
spec: F?.analytics,
|
|
7753
7757
|
sqlLayer: an,
|
|
7754
7758
|
log: $
|
|
@@ -7765,9 +7769,9 @@ ${a.join("\n\n")}\n`);
|
|
|
7765
7769
|
}), process.on("beforeExit", () => {
|
|
7766
7770
|
cn.detach();
|
|
7767
7771
|
});
|
|
7768
|
-
let ln = on.dispose, un =
|
|
7772
|
+
let ln = on.dispose, un = Op(F), dn;
|
|
7769
7773
|
if (un !== "memory" && process.env.VOLTRO_AUTO_MIGRATE !== "0") {
|
|
7770
|
-
let
|
|
7774
|
+
let t = Date.now(), n = (process.env.NODE_ENV ?? "").toLowerCase() === "production" ? "prod" : (process.env.NODE_ENV ?? "").toLowerCase() === "staging" ? "staging" : "dev";
|
|
7771
7775
|
$.info("auto-migrate: planning schema", {
|
|
7772
7776
|
dialect: un,
|
|
7773
7777
|
env: n,
|
|
@@ -7777,10 +7781,10 @@ ${a.join("\n\n")}\n`);
|
|
|
7777
7781
|
tablesTotal: I.length
|
|
7778
7782
|
});
|
|
7779
7783
|
try {
|
|
7780
|
-
let r = await
|
|
7781
|
-
dn = i, await Jr(
|
|
7782
|
-
let a = await y.runPromise(R.SqlClient.pipe(y.flatMap((
|
|
7783
|
-
projectRoot:
|
|
7784
|
+
let r = await Uc(un), i = r.makeSqlLayer(Sp());
|
|
7785
|
+
dn = i, await Jr(pp(I.filter((e) => e.tableName.startsWith("_voltro_") || e.tableName === "voltro_isr_cache"), I), i, r.id);
|
|
7786
|
+
let a = await y.runPromise(R.SqlClient.pipe(y.flatMap((t) => qr(t, {
|
|
7787
|
+
projectRoot: e,
|
|
7784
7788
|
env: n,
|
|
7785
7789
|
appliedBy: `boot:${n}`
|
|
7786
7790
|
})), y.provide(i)));
|
|
@@ -7791,7 +7795,7 @@ ${a.join("\n\n")}\n`);
|
|
|
7791
7795
|
dialectId: r.id
|
|
7792
7796
|
})), y.provide(i)));
|
|
7793
7797
|
if (o.kind === "refused-blocked" || o.kind === "prod-mismatch") throw $.error(Ur(o, r.id)), Error("auto-migrate refused — see error above");
|
|
7794
|
-
$.info(Ur(o, r.id), { durationMs: Date.now() -
|
|
7798
|
+
$.info(Ur(o, r.id), { durationMs: Date.now() - t });
|
|
7795
7799
|
} catch (e) {
|
|
7796
7800
|
throw $.error("auto-migrate failed — aborting boot", { err: e }), _?.set({
|
|
7797
7801
|
phase: "error",
|
|
@@ -7799,11 +7803,11 @@ ${a.join("\n\n")}\n`);
|
|
|
7799
7803
|
}), e;
|
|
7800
7804
|
}
|
|
7801
7805
|
} else un !== "memory" && $.info("auto-migrate: skipped (VOLTRO_AUTO_MIGRATE=0)");
|
|
7802
|
-
let fn =
|
|
7806
|
+
let fn = Op(F);
|
|
7803
7807
|
if ((F?.plugins ?? []).some((e) => (e.extendSchema?.migrations?.length ?? 0) > 0) && fn !== "memory") {
|
|
7804
|
-
let e = (await
|
|
7808
|
+
let e = (await Uc(fn)).makeSqlLayer(Sp());
|
|
7805
7809
|
try {
|
|
7806
|
-
let t = await y.runPromise(
|
|
7810
|
+
let t = await y.runPromise(il(F.plugins).pipe(y.provide(e))), n = t.filter((e) => e.status === "applied"), r = t.filter((e) => e.status === "skipped");
|
|
7807
7811
|
$.info("plugin migrations complete", {
|
|
7808
7812
|
applied: n.map((e) => `${e.pluginName}:${e.migrationId} (${e.durationMs}ms)`),
|
|
7809
7813
|
skippedCount: r.length
|
|
@@ -7812,34 +7816,34 @@ ${a.join("\n\n")}\n`);
|
|
|
7812
7816
|
throw $.error("plugin migrations failed — aborting boot", { err: e }), e;
|
|
7813
7817
|
}
|
|
7814
7818
|
}
|
|
7815
|
-
let pn =
|
|
7819
|
+
let pn = Tf(L, p);
|
|
7816
7820
|
process.on("beforeExit", () => {
|
|
7817
7821
|
pn();
|
|
7818
7822
|
});
|
|
7819
|
-
let mn = $.child("seeds"), hn = v.filter((e) => /\.seed\.ts$/.test(e)), gn = hn.length > 0 ? await
|
|
7823
|
+
let mn = $.child("seeds"), hn = v.filter((e) => /\.seed\.ts$/.test(e)), gn = hn.length > 0 ? await vu(hn, mn) : [];
|
|
7820
7824
|
if (gn.length > 0) {
|
|
7821
7825
|
mn.info("discovered seeds", { ids: gn.map((e) => e.definition.id) });
|
|
7822
7826
|
for (let e of gn) r.registerSeed(e);
|
|
7823
|
-
let e = await
|
|
7827
|
+
let e = await Cu(gn, L, mn);
|
|
7824
7828
|
for (let t of e) r.recordSeedResult(t);
|
|
7825
7829
|
let t = e.filter((e) => e.status === "failed");
|
|
7826
7830
|
t.length > 0 && mn.warn("one or more seeds failed (server continues)", { failedIds: t.map((e) => e.seedId) });
|
|
7827
7831
|
}
|
|
7828
|
-
let _n = $.child("startup"), vn = v.filter((e) =>
|
|
7829
|
-
yn.length > 0 && (_n.info("discovered startups", { ids: yn.map((e) => e.id) }), Cn = await
|
|
7832
|
+
let _n = $.child("startup"), vn = v.filter((e) => qf.test(e)), yn = vn.length > 0 ? await n(vn, _n) : [], Cn;
|
|
7833
|
+
yn.length > 0 && (_n.info("discovered startups", { ids: yn.map((e) => e.id) }), Cn = await t(yn, L, _n)), Cn && process.on("beforeExit", () => {
|
|
7830
7834
|
Cn.shutdown();
|
|
7831
7835
|
});
|
|
7832
|
-
let wn = $.child("subscribe"), Tn = v.filter((e) =>
|
|
7833
|
-
En.length > 0 && (wn.info("discovered subscribers", { subscribers: En.map((e) => `${e.id}@${e.definition.table}`) }), Dn =
|
|
7836
|
+
let wn = $.child("subscribe"), Tn = v.filter((e) => Xf.test(e)), En = Tn.length > 0 ? await Du(Tn, wn) : [], Dn;
|
|
7837
|
+
En.length > 0 && (wn.info("discovered subscribers", { subscribers: En.map((e) => `${e.id}@${e.definition.table}`) }), Dn = Ou(En, L, wn)), Dn && process.on("beforeExit", () => {
|
|
7834
7838
|
Dn();
|
|
7835
7839
|
});
|
|
7836
|
-
let jn =
|
|
7840
|
+
let jn = Fu(), Hn = Op(F);
|
|
7837
7841
|
if (Ye.length > 0 && Hn !== "memory") try {
|
|
7838
|
-
jn =
|
|
7842
|
+
jn = Bu((await Uc(Hn)).makeSqlLayer(Sp()));
|
|
7839
7843
|
} catch (e) {
|
|
7840
7844
|
qe.warn("aggregate: SQL storage init failed — falling back to in-process", { err: e });
|
|
7841
7845
|
}
|
|
7842
|
-
let Un = Hn === "memory" ? Mt : Ze(L, `aggregate@${process.pid}`, qe), Wn = Ye.length > 0 ? await
|
|
7846
|
+
let Un = Hn === "memory" ? Mt : Ze(L, `aggregate@${process.pid}`, qe), Wn = Ye.length > 0 ? await $u({
|
|
7843
7847
|
discovered: Ye,
|
|
7844
7848
|
store: L,
|
|
7845
7849
|
analytics: sn,
|
|
@@ -7847,7 +7851,7 @@ ${a.join("\n\n")}\n`);
|
|
|
7847
7851
|
coordinator: Un,
|
|
7848
7852
|
log: qe
|
|
7849
7853
|
}) : {
|
|
7850
|
-
registry:
|
|
7854
|
+
registry: ed,
|
|
7851
7855
|
detach: () => {},
|
|
7852
7856
|
registered: []
|
|
7853
7857
|
};
|
|
@@ -7858,7 +7862,7 @@ ${a.join("\n\n")}\n`);
|
|
|
7858
7862
|
}), process.on("beforeExit", () => {
|
|
7859
7863
|
Wn.detach();
|
|
7860
7864
|
});
|
|
7861
|
-
let z =
|
|
7865
|
+
let z = Op(F), Gn, Kn = F?.scheduling ?? {}, qn = Kn.trigger ?? "self", Jn = Kn.coordination ?? ([
|
|
7862
7866
|
"postgres",
|
|
7863
7867
|
"mariadb",
|
|
7864
7868
|
"mysql",
|
|
@@ -7876,9 +7880,9 @@ ${a.join("\n\n")}\n`);
|
|
|
7876
7880
|
}
|
|
7877
7881
|
})) : [], nr = await (async () => {
|
|
7878
7882
|
if (z === "memory") return Sn.layerMemory;
|
|
7879
|
-
let e = await
|
|
7883
|
+
let e = await Uc(z), t = e.makeSqlLayer(Sp()), n = Bn({ sqliteFamily: rr(e.id) });
|
|
7880
7884
|
if ($.info(`workflow engine: cluster-${n}, dialect=${e.id}` + (n === "memory" ? " — single-process durable replay, no horizontal scaling" + (rr(e.id) ? "" : " (VOLTRO_WORKFLOW_RUNNER_STORAGE=memory: SqlRunnerStorage/cluster_runners + GET_LOCK skipped)") : "")), e.id === "mssql") {
|
|
7881
|
-
let e = await
|
|
7885
|
+
let e = await hu(process.cwd());
|
|
7882
7886
|
e && $.warn(e);
|
|
7883
7887
|
}
|
|
7884
7888
|
return Vn({
|
|
@@ -7959,7 +7963,7 @@ ${a.join("\n\n")}\n`);
|
|
|
7959
7963
|
});
|
|
7960
7964
|
return;
|
|
7961
7965
|
}
|
|
7962
|
-
}, V = M.length > 0 ? it(() => ir) : void 0, dr = $.child("webhooks"), fr = v.filter((e) =>
|
|
7966
|
+
}, V = M.length > 0 ? it(() => ir) : void 0, dr = $.child("webhooks"), fr = v.filter((e) => Yf.test(e)), H = fr.length > 0 ? await _d(fr, dr) : {
|
|
7963
7967
|
outgoing: [],
|
|
7964
7968
|
incoming: [],
|
|
7965
7969
|
providers: []
|
|
@@ -7969,9 +7973,9 @@ ${a.join("\n\n")}\n`);
|
|
|
7969
7973
|
incoming: H.incoming.map((e) => e.descriptor.id),
|
|
7970
7974
|
providers: H.providers.map((e) => e.descriptor.id)
|
|
7971
7975
|
});
|
|
7972
|
-
let pr = v.filter((e) =>
|
|
7976
|
+
let pr = v.filter((e) => vd.test(e));
|
|
7973
7977
|
if (pr.length > 0) {
|
|
7974
|
-
let e = $.child("mail"), t = await
|
|
7978
|
+
let e = $.child("mail"), t = await yd(pr, e);
|
|
7975
7979
|
t.templates.length > 0 && (fi(t.templates.map((e) => e.template)), e.info("discovered email templates", { templates: t.templates.map((e) => e.template.name) }));
|
|
7976
7980
|
}
|
|
7977
7981
|
let gr = /* @__PURE__ */ new Map();
|
|
@@ -7999,8 +8003,8 @@ ${a.join("\n\n")}\n`);
|
|
|
7999
8003
|
secretEnvKey: n
|
|
8000
8004
|
});
|
|
8001
8005
|
}
|
|
8002
|
-
let br = $.child("reaction"), xr = v.filter((e) =>
|
|
8003
|
-
Cr.length > 0 && (br.info("discovered reactions", { reactions: Cr.map((e) => `${e.definition.name}@${e.definition.watch.table}`) }), wr =
|
|
8006
|
+
let br = $.child("reaction"), xr = v.filter((e) => Zf.test(e)), Cr = xr.length > 0 ? await Au(xr, br) : [], wr;
|
|
8007
|
+
Cr.length > 0 && (br.info("discovered reactions", { reactions: Cr.map((e) => `${e.definition.name}@${e.definition.watch.table}`) }), wr = Mu(Cr, L, {
|
|
8004
8008
|
runAct: async (e, t) => {
|
|
8005
8009
|
if (e.kind === "workflow") {
|
|
8006
8010
|
if (V === void 0) {
|
|
@@ -8014,7 +8018,7 @@ ${a.join("\n\n")}\n`);
|
|
|
8014
8018
|
}).start(e.workflow, n);
|
|
8015
8019
|
return;
|
|
8016
8020
|
}
|
|
8017
|
-
await
|
|
8021
|
+
await ju(e.agent, t, {
|
|
8018
8022
|
findAgentSend: (e) => A.find((t) => t.descriptor.name === `${e}.send`),
|
|
8019
8023
|
runAction: (e, t, n) => Promise.resolve(Pi(e, t, n)),
|
|
8020
8024
|
makeSubject: (e) => yr(e),
|
|
@@ -8131,7 +8135,7 @@ ${a.join("\n\n")}\n`);
|
|
|
8131
8135
|
...j.map((e) => Or(e.descriptor, ri)),
|
|
8132
8136
|
...Zr,
|
|
8133
8137
|
...Qr
|
|
8134
|
-
], li = xn.make(...ii).middleware(mr).middleware(hr), di = F?.layers ?? [], pi = (F?.plugins ?? []).map((e) => e.services).filter((e) => e !== void 0), mi = S.succeed(fe, Wn.registry), gi = S.mergeAll(
|
|
8138
|
+
], li = xn.make(...ii).middleware(mr).middleware(hr), di = F?.layers ?? [], pi = (F?.plugins ?? []).map((e) => e.services).filter((e) => e !== void 0), mi = S.succeed(fe, Wn.registry), gi = S.mergeAll(Kl({
|
|
8135
8139
|
analyticsLayer: on.layer,
|
|
8136
8140
|
cacheService: Kt,
|
|
8137
8141
|
kvService: tn,
|
|
@@ -8142,7 +8146,7 @@ ${a.join("\n\n")}\n`);
|
|
|
8142
8146
|
userLayers: di.length,
|
|
8143
8147
|
pluginLayers: pi.length
|
|
8144
8148
|
});
|
|
8145
|
-
let _i = (e, t) => kt(e.pipe(y.provide(nt(t)), y.provide(gi), y.provide(
|
|
8149
|
+
let _i = (e, t) => kt(e.pipe(y.provide(nt(t)), y.provide(gi), y.provide(Af))), vi = ct(I);
|
|
8146
8150
|
if ((process.env.VOLTRO_INDEX_AUDIT ?? "on") !== "off") {
|
|
8147
8151
|
let e = Qn(I), t = process.stdout.isTTY === !0 && (process.env.NO_COLOR ?? "") === "";
|
|
8148
8152
|
for (let n of e) $.warn("\n" + tr(n, {
|
|
@@ -8176,7 +8180,7 @@ ${a.join("\n\n")}\n`);
|
|
|
8176
8180
|
}
|
|
8177
8181
|
let yi = (process.env.VOLTRO_TENANT_ISOLATION ?? F?.tenancy?.isolation) === "namespace";
|
|
8178
8182
|
yi && $.info("multi-tenancy: PHYSICAL namespace isolation ON — each request runs against its tenant's own namespace (schema/database/attached file). Requests without a resolvable tenant fail closed.");
|
|
8179
|
-
let bi =
|
|
8183
|
+
let bi = Ul({
|
|
8180
8184
|
store: L,
|
|
8181
8185
|
schemaRegistry: vi,
|
|
8182
8186
|
cache: Xt,
|
|
@@ -8193,7 +8197,7 @@ ${a.join("\n\n")}\n`);
|
|
|
8193
8197
|
info: (e, t) => $.info(e, t ?? {}),
|
|
8194
8198
|
warn: (e, t) => $.warn(e, t ?? {})
|
|
8195
8199
|
}) : t = Mt;
|
|
8196
|
-
let n =
|
|
8200
|
+
let n = Kd(F?.plugins ?? [], Oi);
|
|
8197
8201
|
Gn = await Ft(P, {
|
|
8198
8202
|
store: L,
|
|
8199
8203
|
coordinator: t,
|
|
@@ -8201,9 +8205,9 @@ ${a.join("\n\n")}\n`);
|
|
|
8201
8205
|
replicaId: e,
|
|
8202
8206
|
armSelf: !Yn,
|
|
8203
8207
|
dormancy: F?.dormancy ?? "always-on",
|
|
8204
|
-
dormancyTenantId:
|
|
8208
|
+
dormancyTenantId: Mf,
|
|
8205
8209
|
buildContext: ({ traceId: e, scheduleName: t }) => bi({
|
|
8206
|
-
subject: yr(
|
|
8210
|
+
subject: yr(Mf),
|
|
8207
8211
|
traceId: e
|
|
8208
8212
|
}, L, void 0, `schedule:${t}`),
|
|
8209
8213
|
log: {
|
|
@@ -8253,13 +8257,13 @@ ${a.join("\n\n")}\n`);
|
|
|
8253
8257
|
scope: n.scope,
|
|
8254
8258
|
baseKey: `q:${e.name}:${Ei(t)}`
|
|
8255
8259
|
};
|
|
8256
|
-
}, Oi = ic(), ki = F?.plugins ?? [], Ai = Sr(
|
|
8260
|
+
}, Oi = ic(), ki = F?.plugins ?? [], Ai = Sr(zd(ki, "mutation", Oi)), ji = Sr(zd(ki, "action", Oi)), Mi = Sr(zd(ki, "query", Oi)), Ni = at({
|
|
8257
8261
|
store: L,
|
|
8258
8262
|
buildContext: (e, t, n) => bi(e, t, n),
|
|
8259
8263
|
runEffect: (e, t) => _i(e, t),
|
|
8260
8264
|
...Ai ? { interceptor: Ai } : {},
|
|
8261
8265
|
recordMetric: (e) => Oi.record(e),
|
|
8262
|
-
undoCapture:
|
|
8266
|
+
undoCapture: wd()
|
|
8263
8267
|
}), Pi = Xe({
|
|
8264
8268
|
buildContext: (e) => bi(e),
|
|
8265
8269
|
runEffect: (e, t) => _i(e, t),
|
|
@@ -8271,7 +8275,7 @@ ${a.join("\n\n")}\n`);
|
|
|
8271
8275
|
let n = Si(e, t);
|
|
8272
8276
|
return wi(n), n;
|
|
8273
8277
|
},
|
|
8274
|
-
provideEffect: (e, t) => e.pipe(y.provide(nt(t)), y.provide(
|
|
8278
|
+
provideEffect: (e, t) => e.pipe(y.provide(nt(t)), y.provide(Af)),
|
|
8275
8279
|
...Mi ? { interceptor: Mi } : {}
|
|
8276
8280
|
});
|
|
8277
8281
|
for (let e of O) G[e.descriptor.name] = (t) => Ne(Fi(e, t), U, `subscription.${e.descriptor.name}`, Ti, Di(e.descriptor, t));
|
|
@@ -8287,7 +8291,7 @@ ${a.join("\n\n")}\n`);
|
|
|
8287
8291
|
let t = `stream.${e.descriptor.name}`;
|
|
8288
8292
|
G[e.descriptor.name] = (n) => Me((t) => {
|
|
8289
8293
|
let r = bi(t), i = e.executor(n, r);
|
|
8290
|
-
return y.isEffect(i) ? i.pipe(y.provide(nt(r.store)), y.provide(gi), y.provide(
|
|
8294
|
+
return y.isEffect(i) ? i.pipe(y.provide(nt(r.store)), y.provide(gi), y.provide(Af)) : typeof i == "object" && i && typeof i.then == "function" ? y.promise(() => i) : i;
|
|
8291
8295
|
}, t);
|
|
8292
8296
|
}
|
|
8293
8297
|
ue && (G[Lr.name] = (e) => Ne(Fi({
|
|
@@ -8388,16 +8392,16 @@ ${a.join("\n\n")}\n`);
|
|
|
8388
8392
|
}
|
|
8389
8393
|
}, e), U, `subscription.${Pr.name}`), G[Mr.name] = (e) => je(async (e, t) => {
|
|
8390
8394
|
let n = e;
|
|
8391
|
-
return await
|
|
8395
|
+
return await Wl(L, t.subject, { executionId: n.executionId }), await V.cancel(n.workflowName, n.executionId), await Gi(n.workflowName, n.executionId, "workflow.cancel"), { ok: !0 };
|
|
8392
8396
|
}, e, `action.${Mr.name}`), G[Fr.name] = (e) => je(async (e, t) => {
|
|
8393
8397
|
let n = e;
|
|
8394
|
-
return await
|
|
8398
|
+
return await Wl(L, t.subject, { executionId: n.executionId }), await V.resume(n.workflowName, n.executionId), { ok: !0 };
|
|
8395
8399
|
}, e, `action.${Fr.name}`), G[Br.name] = (e) => je(async (e, t) => {
|
|
8396
8400
|
let n = e;
|
|
8397
|
-
return await
|
|
8401
|
+
return await Wl(L, t.subject, { id: n.id }), V.signal({ id: n.id }, n.signalName, n.payload);
|
|
8398
8402
|
}, e, `action.${Br.name}`), G[Vr.name] = (e) => je(async (e, t) => {
|
|
8399
8403
|
let n = e;
|
|
8400
|
-
return await
|
|
8404
|
+
return await Wl(L, t.subject, { id: n.id }), V.update({ id: n.id }, n.updateName, n.payload, n.timeoutMs === void 0 ? void 0 : { timeoutMs: n.timeoutMs });
|
|
8401
8405
|
}, e, `action.${Vr.name}`));
|
|
8402
8406
|
for (let e of M) G[e.definition.name] = (t) => je(async (t, n) => {
|
|
8403
8407
|
let r = n;
|
|
@@ -8407,18 +8411,18 @@ ${a.join("\n\n")}\n`);
|
|
|
8407
8411
|
source: "workflow-rpc"
|
|
8408
8412
|
}).start(e.definition.name, t);
|
|
8409
8413
|
}, t, `workflow.${e.definition.name}`);
|
|
8410
|
-
let Ii = yr(
|
|
8414
|
+
let Ii = yr(Mf), Li = (e, t) => bi({
|
|
8411
8415
|
subject: e?.subject ?? Ii,
|
|
8412
8416
|
traceId: e?.traceId ?? "workflow-bootstrap"
|
|
8413
|
-
}, L, void 0, `workflow:${t.workflowName}`, { parentExecutionId: t.executionId }), Ri =
|
|
8417
|
+
}, L, void 0, `workflow:${t.workflowName}`, { parentExecutionId: t.executionId }), Ri = Jd(F?.plugins ?? [], Oi), zi = Fn, Bi = (e, t) => p.emit(e, t), Vi = F?.dormancy === "sleep" ? {
|
|
8414
8418
|
register: (e, t, n) => wt(L, {
|
|
8415
|
-
tenantId: n ??
|
|
8419
|
+
tenantId: n ?? Mf,
|
|
8416
8420
|
kind: "workflow",
|
|
8417
8421
|
refId: e,
|
|
8418
8422
|
wakeAt: t
|
|
8419
8423
|
}),
|
|
8420
8424
|
cancel: (e, t) => Fe(L, {
|
|
8421
|
-
tenantId: t ??
|
|
8425
|
+
tenantId: t ?? Mf,
|
|
8422
8426
|
kind: "workflow",
|
|
8423
8427
|
refId: e
|
|
8424
8428
|
}).then(() => {})
|
|
@@ -8528,22 +8532,22 @@ ${a.join("\n\n")}\n`);
|
|
|
8528
8532
|
payload: n,
|
|
8529
8533
|
...r === void 0 ? {} : { options: r }
|
|
8530
8534
|
}),
|
|
8531
|
-
listRuns: (e) =>
|
|
8532
|
-
retry: (e, t) =>
|
|
8535
|
+
listRuns: (e) => Qd(L, e),
|
|
8536
|
+
retry: (e, t) => $d({
|
|
8533
8537
|
store: L,
|
|
8534
8538
|
workflows: M,
|
|
8535
8539
|
runPromise: (e) => Yi.runPromise(e)
|
|
8536
8540
|
}, e, t)
|
|
8537
8541
|
}) : void 0;
|
|
8538
|
-
let Xi = S.mergeAll(li.toLayer(G), ve,
|
|
8539
|
-
if (ea === "postgres" &&
|
|
8540
|
-
let e =
|
|
8542
|
+
let Xi = S.mergeAll(li.toLayer(G), ve, Lf), Zi = Jl(G, O.map((e) => e.descriptor.name), ue), $i = S.mergeAll(li.toLayer(Zi), ve, Lf), ea = z, ta = (ea === "postgres" || ea === "mysql" || ea === "mariadb" || ea === "mssql") && (process.env.CDC ?? "1") !== "0";
|
|
8543
|
+
if (ea === "postgres" && Dl()) {
|
|
8544
|
+
let e = Ml({
|
|
8541
8545
|
store: L,
|
|
8542
8546
|
log: $
|
|
8543
8547
|
});
|
|
8544
8548
|
Ct = e.persistTraceSpan, process.on("beforeExit", e.stop);
|
|
8545
8549
|
}
|
|
8546
|
-
let na =
|
|
8550
|
+
let na = Hl({
|
|
8547
8551
|
store: L,
|
|
8548
8552
|
dialect: ea
|
|
8549
8553
|
});
|
|
@@ -8584,26 +8588,26 @@ ${a.join("\n\n")}\n`);
|
|
|
8584
8588
|
let c = e.exposeAsTool;
|
|
8585
8589
|
return c === !0 ? i.exposeAsTool = { enabled: !0 } : typeof c == "object" && c && (i.exposeAsTool = c), i;
|
|
8586
8590
|
}, oa = [
|
|
8587
|
-
...O.map((
|
|
8588
|
-
...k.map((
|
|
8589
|
-
...A.map((
|
|
8590
|
-
...j.map((
|
|
8591
|
-
name:
|
|
8592
|
-
input:
|
|
8593
|
-
output:
|
|
8594
|
-
error:
|
|
8595
|
-
}, "stream", c(
|
|
8596
|
-
], sa = M.map((
|
|
8597
|
-
tag:
|
|
8598
|
-
file: c(
|
|
8591
|
+
...O.map((t) => aa(t.descriptor, "query", c(e, t.file))),
|
|
8592
|
+
...k.map((t) => aa(t.descriptor, "mutation", c(e, t.file))),
|
|
8593
|
+
...A.map((t) => aa(t.descriptor, "action", c(e, t.file))),
|
|
8594
|
+
...j.map((t) => aa({
|
|
8595
|
+
name: t.descriptor.name,
|
|
8596
|
+
input: t.descriptor.input,
|
|
8597
|
+
output: t.descriptor.element,
|
|
8598
|
+
error: t.descriptor.error
|
|
8599
|
+
}, "stream", c(e, t.file)))
|
|
8600
|
+
], sa = M.map((t) => ({
|
|
8601
|
+
tag: t.definition.name,
|
|
8602
|
+
file: c(e, t.file)
|
|
8599
8603
|
}));
|
|
8600
|
-
N.writeFile(s(
|
|
8601
|
-
let
|
|
8604
|
+
N.writeFile(s(e, "app.manifest.generated.json"), `${JSON.stringify(wa(oa, sa), null, 2)}\n`, "utf8").catch(() => {}), (async () => {
|
|
8605
|
+
let t = s(e, ".gitignore"), n = "";
|
|
8602
8606
|
try {
|
|
8603
|
-
n = await N.readFile(
|
|
8607
|
+
n = await N.readFile(t, "utf8");
|
|
8604
8608
|
} catch {}
|
|
8605
8609
|
let r = n.split("\n").filter((e) => e.trim() !== "");
|
|
8606
|
-
r.includes("app.manifest.generated.json") || (r.push("app.manifest.generated.json"), await N.writeFile(
|
|
8610
|
+
r.includes("app.manifest.generated.json") || (r.push("app.manifest.generated.json"), await N.writeFile(t, `${r.join("\n")}\n`, "utf8"));
|
|
8607
8611
|
})().catch(() => {});
|
|
8608
8612
|
let ca = /* @__PURE__ */ new Map();
|
|
8609
8613
|
for (let e of k) ca.set(e.descriptor.name, async (t, n) => {
|
|
@@ -8620,7 +8624,7 @@ ${a.join("\n\n")}\n`);
|
|
|
8620
8624
|
result: await Ni(e, t, r)
|
|
8621
8625
|
};
|
|
8622
8626
|
} catch (t) {
|
|
8623
|
-
let n =
|
|
8627
|
+
let n = Bf(t);
|
|
8624
8628
|
return $.warn(`inspect invoke failed: ${e.descriptor.name}`, {
|
|
8625
8629
|
tag: e.descriptor.name,
|
|
8626
8630
|
error: n
|
|
@@ -8644,7 +8648,7 @@ ${a.join("\n\n")}\n`);
|
|
|
8644
8648
|
result: await Pi(e, t, r)
|
|
8645
8649
|
};
|
|
8646
8650
|
} catch (t) {
|
|
8647
|
-
let n =
|
|
8651
|
+
let n = Bf(t);
|
|
8648
8652
|
return $.warn(`inspect invoke failed: ${e.descriptor.name}`, {
|
|
8649
8653
|
tag: e.descriptor.name,
|
|
8650
8654
|
error: n
|
|
@@ -8764,8 +8768,8 @@ ${a.join("\n\n")}\n`);
|
|
|
8764
8768
|
}, K = {
|
|
8765
8769
|
kind: "api",
|
|
8766
8770
|
meta: {
|
|
8767
|
-
name: F?.name ?? i(
|
|
8768
|
-
voltroVersion:
|
|
8771
|
+
name: F?.name ?? i(e),
|
|
8772
|
+
voltroVersion: jf,
|
|
8769
8773
|
port: l,
|
|
8770
8774
|
mode: "dev",
|
|
8771
8775
|
store: ea,
|
|
@@ -8790,7 +8794,7 @@ ${a.join("\n\n")}\n`);
|
|
|
8790
8794
|
plugins: xe.snapshot(),
|
|
8791
8795
|
capturedAt: Date.now()
|
|
8792
8796
|
}),
|
|
8793
|
-
env: () => va(F?.name ?? i(
|
|
8797
|
+
env: () => va(F?.name ?? i(e), {
|
|
8794
8798
|
contract: qt(F?.env) ? F.env : void 0,
|
|
8795
8799
|
plugins: F?.plugins ?? []
|
|
8796
8800
|
}),
|
|
@@ -8816,7 +8820,7 @@ ${a.join("\n\n")}\n`);
|
|
|
8816
8820
|
database: la,
|
|
8817
8821
|
migrations: async () => ua(),
|
|
8818
8822
|
inspectTables: () => ({ tables: I.map((e) => {
|
|
8819
|
-
let t =
|
|
8823
|
+
let t = up(e), n = dp(t);
|
|
8820
8824
|
return {
|
|
8821
8825
|
name: e.tableName,
|
|
8822
8826
|
isFrameworkTable: e.tableName.startsWith("_voltro_"),
|
|
@@ -8829,11 +8833,11 @@ ${a.join("\n\n")}\n`);
|
|
|
8829
8833
|
inspectRows: async (e) => {
|
|
8830
8834
|
let t = Math.max(0, e.offset ?? 0), n = Math.max(1, Math.min(500, e.limit ?? 50)), r = I.find((t) => t.tableName === e.table);
|
|
8831
8835
|
if (!r) throw Error(`unknown table: ${e.table}`);
|
|
8832
|
-
let i =
|
|
8836
|
+
let i = up(r), a = yf({
|
|
8833
8837
|
filter: e.filter,
|
|
8834
8838
|
quickSearch: e.quickSearch,
|
|
8835
8839
|
columns: i
|
|
8836
|
-
}), o =
|
|
8840
|
+
}), o = bf(e.sort, i), s = await L.query({
|
|
8837
8841
|
table: e.table,
|
|
8838
8842
|
order: o,
|
|
8839
8843
|
skip: t,
|
|
@@ -8849,7 +8853,7 @@ ${a.join("\n\n")}\n`);
|
|
|
8849
8853
|
skip: void 0,
|
|
8850
8854
|
take: void 0
|
|
8851
8855
|
})).length, u = "exact"), {
|
|
8852
|
-
rows: s.map(
|
|
8856
|
+
rows: s.map(lp),
|
|
8853
8857
|
total: l,
|
|
8854
8858
|
countMode: u,
|
|
8855
8859
|
offset: t,
|
|
@@ -8863,7 +8867,7 @@ ${a.join("\n\n")}\n`);
|
|
|
8863
8867
|
return $.info("inspect.data.insert", {
|
|
8864
8868
|
table: e.table,
|
|
8865
8869
|
id: t?.id ?? null
|
|
8866
|
-
}), { row:
|
|
8870
|
+
}), { row: lp(t) };
|
|
8867
8871
|
},
|
|
8868
8872
|
inspectUpdateRow: async (e) => {
|
|
8869
8873
|
if (e.table.startsWith("_voltro_")) throw Error(`inspect data viewer cannot write to framework-internal table: ${e.table}`);
|
|
@@ -8873,7 +8877,7 @@ ${a.join("\n\n")}\n`);
|
|
|
8873
8877
|
table: e.table,
|
|
8874
8878
|
id: e.id,
|
|
8875
8879
|
patch: Object.keys(e.patch)
|
|
8876
|
-
}), { row: t ?
|
|
8880
|
+
}), { row: t ? lp(t) : null };
|
|
8877
8881
|
},
|
|
8878
8882
|
inspectDeleteRow: async (e) => {
|
|
8879
8883
|
if (e.table.startsWith("_voltro_")) throw Error(`inspect data viewer cannot delete from framework-internal table: ${e.table}`);
|
|
@@ -8912,7 +8916,7 @@ ${a.join("\n\n")}\n`);
|
|
|
8912
8916
|
}).start(e.name, e.payload);
|
|
8913
8917
|
},
|
|
8914
8918
|
inspectWorkflowRuns: async (e) => {
|
|
8915
|
-
let { rows: t, total: n, offset: r, limit: i } = await
|
|
8919
|
+
let { rows: t, total: n, offset: r, limit: i } = await Xd(L, {
|
|
8916
8920
|
...e.tag === void 0 ? {} : { tag: e.tag },
|
|
8917
8921
|
...e.status === void 0 ? {} : { status: e.status },
|
|
8918
8922
|
...e.offset === void 0 ? {} : { offset: e.offset },
|
|
@@ -9197,7 +9201,7 @@ ${a.join("\n\n")}\n`);
|
|
|
9197
9201
|
inspectRetryWorkflowRun: async (e) => {
|
|
9198
9202
|
let t = e.payloadOverride !== void 0;
|
|
9199
9203
|
try {
|
|
9200
|
-
let n = await
|
|
9204
|
+
let n = await $d({
|
|
9201
9205
|
store: L,
|
|
9202
9206
|
workflows: M,
|
|
9203
9207
|
runPromise: (e) => Yi.runPromise(e)
|
|
@@ -9308,7 +9312,7 @@ ${a.join("\n\n")}\n`);
|
|
|
9308
9312
|
let e = process.env.POD_NAME ?? process.env.HOSTNAME ?? `dev-${process.pid}`, t = z, n = t === "memory", r = n ? "none" : Bn({ sqliteFamily: t === "sqlite" || t === "turso" }), i = zn({
|
|
9309
9313
|
runnerStorage: r === "sql" ? "sql" : "memory",
|
|
9310
9314
|
...process.env.VOLTRO_WORKFLOW_RUNNER_PORT ? { runnerListenPort: Number(process.env.VOLTRO_WORKFLOW_RUNNER_PORT) } : {}
|
|
9311
|
-
}), a = !n && (process.env.CDC ?? "1") !== "0", o = t === "postgres" ? "LISTEN/NOTIFY" : t === "sqlite" || t === "turso" ? "in-process bus" : t === "mariadb" || t === "mysql" ? "binlog CDC (ROW)" : t === "mssql" ? "inline only" : t === "memory" ? "none (single-process)" : "inline only", s = t === "postgres" || t === "mariadb" || t === "mssql" ? "full" : t === "mysql" ? "inline-only" : t === "sqlite" || t === "turso" ? "single-process" : "none", c = Yn ? "cluster" : Jn === "advisoryLock" && z === "postgres" ? "advisoryLock" : "single", l = a && t === "mariadb" ?
|
|
9315
|
+
}), a = !n && (process.env.CDC ?? "1") !== "0", o = t === "postgres" ? "LISTEN/NOTIFY" : t === "sqlite" || t === "turso" ? "in-process bus" : t === "mariadb" || t === "mysql" ? "binlog CDC (ROW)" : t === "mssql" ? "inline only" : t === "memory" ? "none (single-process)" : "inline only", s = t === "postgres" || t === "mariadb" || t === "mssql" ? "full" : t === "mysql" ? "inline-only" : t === "sqlite" || t === "turso" ? "single-process" : "none", c = Yn ? "cluster" : Jn === "advisoryLock" && z === "postgres" ? "advisoryLock" : "single", l = a && t === "mariadb" ? Dp(e) : void 0, u = {
|
|
9312
9316
|
replicaId: e,
|
|
9313
9317
|
dialect: t,
|
|
9314
9318
|
runnerHost: i.host,
|
|
@@ -9371,7 +9375,7 @@ ${a.join("\n\n")}\n`);
|
|
|
9371
9375
|
};
|
|
9372
9376
|
},
|
|
9373
9377
|
runSeed: async (e) => {
|
|
9374
|
-
let t = await
|
|
9378
|
+
let t = await wu(gn, e, L, mn);
|
|
9375
9379
|
return r.recordSeedResult(t), la();
|
|
9376
9380
|
},
|
|
9377
9381
|
rollbackMigration: async (e) => (mn.warn("rollbackMigration called but only memory store is wired — no-op"), la()),
|
|
@@ -9441,7 +9445,7 @@ ${a.join("\n\n")}\n`);
|
|
|
9441
9445
|
replay: (e) => W.replay(e),
|
|
9442
9446
|
updateTargetPayloadVersion: (e, t) => W.updateTargetPayloadVersion(e, t)
|
|
9443
9447
|
} }
|
|
9444
|
-
}, da =
|
|
9448
|
+
}, da = ef(F?.plugins ?? [], Oi);
|
|
9445
9449
|
da !== void 0 && $.info("plugin http-request interceptor active", { plugins: (F?.plugins ?? []).filter((e) => typeof e.onHttpRequest == "function").map((e) => e.name) });
|
|
9446
9450
|
let fa = (F?.plugins ?? []).flatMap((e) => e.httpRoutes ?? []), pa = typeof de == "object" ? de.managementPath : void 0, ma = () => `public-${Math.random().toString(36).slice(2, 10)}`, ha = ti([...k.filter((e) => e.descriptor.publicApi !== void 0).map((e) => ({
|
|
9447
9451
|
descriptor: e.descriptor,
|
|
@@ -9514,9 +9518,9 @@ ${a.join("\n\n")}\n`);
|
|
|
9514
9518
|
headers: X(t.origin)
|
|
9515
9519
|
};
|
|
9516
9520
|
if (n === "GET" && (e === "/_voltro/inspect/traces" || e.startsWith("/_voltro/inspect/traces?"))) {
|
|
9517
|
-
let n =
|
|
9521
|
+
let n = xl();
|
|
9518
9522
|
return {
|
|
9519
|
-
...
|
|
9523
|
+
...Df(e, ea === "postgres" && Dl() ? await yp(e, n, L) : n),
|
|
9520
9524
|
headers: X(t.origin)
|
|
9521
9525
|
};
|
|
9522
9526
|
}
|
|
@@ -9577,11 +9581,11 @@ ${a.join("\n\n")}\n`);
|
|
|
9577
9581
|
if (r) return r;
|
|
9578
9582
|
}
|
|
9579
9583
|
if (e.startsWith("/_voltro/inspect/aggregates")) {
|
|
9580
|
-
let r = await
|
|
9584
|
+
let r = await ad(e, n, Wn.registry, X(t.origin));
|
|
9581
9585
|
if (r) return r;
|
|
9582
9586
|
}
|
|
9583
9587
|
if (e.startsWith("/_voltro/inspect/timeline")) {
|
|
9584
|
-
let r = await
|
|
9588
|
+
let r = await hd(e, n, {
|
|
9585
9589
|
recorder: Ue(),
|
|
9586
9590
|
readCurrentRows: async (e) => K.inspectRows === void 0 ? [] : (await K.inspectRows({
|
|
9587
9591
|
table: e,
|
|
@@ -9593,7 +9597,7 @@ ${a.join("\n\n")}\n`);
|
|
|
9593
9597
|
if (r) return r;
|
|
9594
9598
|
}
|
|
9595
9599
|
if (e.startsWith("/_voltro/inspect/analytics")) {
|
|
9596
|
-
let r =
|
|
9600
|
+
let r = ld(e, n, {
|
|
9597
9601
|
sink: sn,
|
|
9598
9602
|
metricsCollector: Oi
|
|
9599
9603
|
}, X(t.origin));
|
|
@@ -9652,10 +9656,10 @@ ${a.join("\n\n")}\n`);
|
|
|
9652
9656
|
status: "live",
|
|
9653
9657
|
logFile: f.path
|
|
9654
9658
|
});
|
|
9655
|
-
let
|
|
9656
|
-
if (
|
|
9657
|
-
let
|
|
9658
|
-
|
|
9659
|
+
let t = as(e);
|
|
9660
|
+
if (t) {
|
|
9661
|
+
let e = await hs({ dashboardAppPath: t });
|
|
9662
|
+
e.status === "launched" ? $.info(`dashboard launched at http://localhost:${e.port}`, { port: e.port }) : e.status === "already-running" && $.debug(`dashboard already running on :${e.port}`, { port: e.port });
|
|
9659
9663
|
}
|
|
9660
9664
|
setInterval(() => {
|
|
9661
9665
|
Wo({
|
|
@@ -9689,7 +9693,7 @@ ${a.join("\n\n")}\n`);
|
|
|
9689
9693
|
$.warn("runtime-registry write failed", {}, e);
|
|
9690
9694
|
}
|
|
9691
9695
|
return Eo(Co, $, {
|
|
9692
|
-
root:
|
|
9696
|
+
root: e,
|
|
9693
9697
|
onBeforeRestart: () => {
|
|
9694
9698
|
try {
|
|
9695
9699
|
Z.closeAllConnections?.();
|
|
@@ -9708,4 +9712,4 @@ ${a.join("\n\n")}\n`);
|
|
|
9708
9712
|
}), new Promise(() => {});
|
|
9709
9713
|
};
|
|
9710
9714
|
//#endregion
|
|
9711
|
-
export {
|
|
9715
|
+
export { Gc as $, Ou as A, wo as At, Gl as B, Ta as Bt, ed as C, Go as Ct, Mu as D, No as Dt, Bu as E, Mo as Et, wu as F, qa as Ft, Vl as G, ga as Gt, Wl as H, q as Ht, _u as I, Ka as It, Dl as J, Yi as Jt, Bl as K, Qi as Kt, hu as L, Ja as Lt, Tu as M, go as Mt, vu as N, no as Nt, ju as O, ko as Ot, Cu as P, eo as Pt, ul as Q, W as Qt, au as R, ba as Rt, $u as S, Uo as St, Fu as T, jo as Tt, Ul as U, va as Ut, Kl as V, X as Vt, Hl as W, ya as Wt, ll as X, Hi as Xt, sl as Y, Gi as Yt, fl as Z, Ui as Zt, Cd as _, as as _t, Bf as a, qs as at, gd as b, ts as bt, wp as c, Zs as ct, np as d, Ds as dt, Rc as et, Ap as f, Ps as ft, Id as g, hs as gt, Kd as h, is as ht, Sp as i, ic as it, Du as j, xo as jt, Au as k, Ao as kt, Fp as l, Ks as lt, $d as m, os as mt, kp as n, Vc as nt, xp as o, Js as ot, Qd as p, Ys as pt, zl as q, Xi as qt, pp as r, Ic as rt, bp as s, Fs as st, Ff as t, Uc as tt, Cp as u, $s as ut, wd as v, $o as vt, Hu as w, Wo as wt, _d as x, Ko as xt, xd as y, es as yt, Jl as z, J as zt };
|