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