@voltro/cli 0.43.0 → 0.43.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 +100 -0
- package/dist/{apiBuild-DF0f69Gf.js → apiBuild-BWuw8ZXS.js} +1 -1
- package/dist/apiBuild-Cw2-TEXW.js +2 -0
- package/dist/bin.js +1 -1
- package/dist/{build-LC_IJaHL.js → build-CGBs4ZOv.js} +6 -6
- package/dist/{checkCommand-DDxwJCja.js → checkCommand-BFtFBsqL.js} +2 -2
- package/dist/{checkCommand-DBpTSK8d.js → checkCommand-lTPSN3EQ.js} +1 -1
- package/dist/{codegenCommand-LjxfK4Am.js → codegenCommand-BJeyFlip.js} +1 -1
- package/dist/{commands-CbQcuWsE.js → commands-pEDOcOo2.js} +15 -15
- package/dist/{dashboardCommand-CAHjCe_9.js → dashboardCommand-Bt2hHMro.js} +1 -1
- package/dist/{dataCommand-CrqvbVOv.js → dataCommand-DD2bRHCu.js} +377 -208
- package/dist/{dev-D0E5x2Ue.js → dev-DMx-MF2s.js} +1 -1
- package/dist/{dev-B2rZfqxw.js → dev-wumUfDm1.js} +922 -912
- package/dist/doctorCommand-FOXTTaGp.js +2 -0
- package/dist/{doctorCommand-Ct_3BHgd.js → doctorCommand-RFKpnLih.js} +9 -9
- package/dist/{dormancyCommand-D1DKnYce.js → dormancyCommand-EFDQWiUw.js} +1 -1
- package/dist/{embeddingsCommand-1sZRBKlM.js → embeddingsCommand-OeYp3qSq.js} +1 -1
- package/dist/{envCommand-7qjlQgLD.js → envCommand-CKgBZK7x.js} +1 -1
- package/dist/{evolveCommand-D5opB48I.js → evolveCommand-ClQlAH0j.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/{runtimeTrace-Wmi7V-wN.js → runtimeTrace-CgpAD9wL.js} +1 -1
- package/dist/{sdkgen-DbTFGCjg.js → sdkgen-Ca2zj4cd.js} +1 -1
- package/dist/{serveCommand-C8xzYCwa.js → serveCommand-CgK7Kj6j.js} +472 -368
- package/dist/serveCommand-DUm2-ikx.js +2 -0
- package/dist/serveEntry.js +1 -1
- package/dist/{webhooksCommand-BXUP5YjW.js → webhooksCommand-BVNtNsI0.js} +1 -1
- package/package.json +17 -17
- package/templates/AGENTS.md +1 -1
- package/templates/agent-docs/_index.md +1 -1
- package/templates/agent-docs/cli.md +126 -2
- package/templates/agent-docs/database/seedsdialects.md +12 -0
- package/templates/agent-docs/whats-new.md +14 -74
- 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-sqlite/package.json +8 -8
- package/templates/apps/api-backend-storage/package.json +8 -8
- package/templates/apps/api-cms/package.json +10 -10
- package/templates/apps/api-collab/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-saas-starter/package.json +10 -10
- package/templates/apps/api-search/package.json +8 -8
- package/templates/apps/api-status/package.json +8 -8
- package/templates/apps/api-versioning/package.json +8 -8
- package/templates/apps/api-webhooks/package.json +9 -9
- 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 +9 -9
- package/templates/apps/frontend-auth/package.json +8 -8
- package/templates/apps/frontend-blank/package.json +7 -7
- package/templates/apps/frontend-cms/package.json +9 -9
- package/templates/apps/frontend-collab/package.json +10 -10
- 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-portal/package.json +8 -8
- package/templates/apps/frontend-saas/package.json +8 -8
- 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/apps/frontend-status/package.json +8 -8
- package/templates/apps/mobile-app/package.json +4 -4
- package/dist/apiBuild-B7NgSMhX.js +0 -2
- package/dist/doctorCommand-CdsctSwg.js +0 -2
- package/dist/serveCommand-CGNTXafv.js +0 -2
|
@@ -3,7 +3,7 @@ import { t } from "./frameworkInspectState-CX2250XB.js";
|
|
|
3
3
|
import { r as n, t as r } from "./appModuleLoader-C9r9mxZt.js";
|
|
4
4
|
import { t as i } from "./bootRefusal-pgvDxlrU.js";
|
|
5
5
|
import { n as a, r as o } from "./startupRunner-CEqQq7ax.js";
|
|
6
|
-
import { $ as s, $t as ee, A as c, At as l, B as u, C as
|
|
6
|
+
import { $ as s, $t as ee, A as c, At as l, B as u, C as d, Ct as f, D as te, Dt as ne, E as re, Et as p, F as ie, Ft as m, G as h, Gt as ae, H as oe, I as se, It as ce, J as le, Jt as g, K as ue, Kt as _, L as de, Lt as fe, M as pe, Mt as v, N as me, Nt as he, O as ge, Ot as _e, P as ve, Pt as ye, Q as be, Qt as xe, R as Se, Rt as y, S as Ce, Sn as we, St as Te, T as Ee, Tt as De, U as Oe, Ut as b, V as ke, Vt as Ae, W as je, Wt as Me, X as Ne, Xt as Pe, Y as Fe, Yt as Ie, Z as Le, Zt as x, _ as Re, _n as ze, _t as S, an as Be, at as C, b as Ve, bn as He, bt as Ue, c as We, cn as w, ct as Ge, dn as Ke, dt as qe, en as Je, et as Ye, f as T, fn as E, ft as Xe, g as Ze, gn as Qe, gt as $e, h as et, ht as tt, i as nt, in as rt, it, j as at, jt as ot, k as st, kt as ct, ln as D, lt, m as ut, mn as dt, mt as O, nn as k, nt as ft, o as A, on as pt, ot as mt, p as ht, pn as gt, pt as _t, q as vt, qt as yt, r as bt, rn as xt, rt as St, sn as Ct, st as wt, t as Tt, tn as Et, tt as Dt, u as Ot, un as kt, ut as At, v as jt, vn as j, vt as M, w as N, wt as Mt, x as Nt, xn as Pt, xt as Ft, y as It, yn as Lt, yt as Rt, zt } from "./dev-wumUfDm1.js";
|
|
7
7
|
import { n as Bt } from "./cliArgs-D4p8n7EE.js";
|
|
8
8
|
import { r as Vt } from "./appPort-B_HpJ_ck.js";
|
|
9
9
|
import { ht as Ht, pt as P } from "./webDev-101csg6Q.js";
|
|
@@ -16,31 +16,33 @@ import { h as un, o as dn } from "./inspect-B7U7Cl_Z.js";
|
|
|
16
16
|
import { n as fn } from "./mssqlClusterPatch-_4cE_nun.js";
|
|
17
17
|
import { i as pn, n as mn, r as hn, t as gn } from "./webhookDiscovery-CphsQe59.js";
|
|
18
18
|
import { t as _n } from "./inspectMetrics-CfdKLh6t.js";
|
|
19
|
-
import { r as vn, u as yn } from "./apiBuild-
|
|
19
|
+
import { r as vn, u as yn } from "./apiBuild-BWuw8ZXS.js";
|
|
20
20
|
import { t as bn } from "./bootTiming-BdyP9nYw.js";
|
|
21
21
|
import { t as xn } from "./dataProfile-Cm0YVKSy.js";
|
|
22
|
-
import { basename as
|
|
23
|
-
import { existsSync as
|
|
24
|
-
import { pathToFileURL as
|
|
22
|
+
import Sn, { basename as Cn, join as wn } from "node:path";
|
|
23
|
+
import { createWriteStream as Tn, existsSync as En } from "node:fs";
|
|
24
|
+
import { pathToFileURL as Dn } from "node:url";
|
|
25
25
|
import { createLogger as L } from "@voltro/logger";
|
|
26
|
-
import { AuthMiddleware as
|
|
27
|
-
import { Cause as
|
|
28
|
-
import { SqlClient as
|
|
29
|
-
import { declaredSnapshot as
|
|
30
|
-
import
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
26
|
+
import { AuthMiddleware as On, ConnectionInfoMiddleware as kn, actionToRpc as R, anonymousSubject as An, isWireReachable as jn, mutationToRpc as Mn, queryToRpc as z, streamToRpc as Nn, wireErrorUnion as Pn, workflowCancelDescriptor as Fn, workflowDomainEventsQueryDescriptor as B, workflowEventDeliveriesQueryDescriptor as V, workflowResumeDescriptor as In, workflowRunEventsQueryDescriptor as Ln, workflowRunQueryDescriptor as Rn, workflowRunStepsQueryDescriptor as zn, workflowRunsQueryDescriptor as Bn, workflowSignalDescriptor as Vn, workflowUpdateDescriptor as Hn } from "@voltro/protocol";
|
|
27
|
+
import { Cause as Un, Effect as H, Layer as U, ManagedRuntime as Wn } from "effect";
|
|
28
|
+
import { SqlClient as Gn } from "@effect/sql";
|
|
29
|
+
import { declaredSnapshot as Kn, describeOutcome as qn, pendingFileMigrationIds as Jn, runPlannedMigrations as Yn } from "@voltro/database/sql";
|
|
30
|
+
import W from "node:os";
|
|
31
|
+
import { RpcGroup as Xn } from "@effect/rpc";
|
|
32
|
+
import { allRegisteredTables as Zn, and as Qn, connectionIdentity as $n, ensureTableRegistered as er, eq as G, or as tr } from "@voltro/database";
|
|
33
|
+
import { AggregateRegistry as nr, CostRegistry as K, DORMANCY_WAKEUP_TENANT as rr, Dispatcher as ir, ExpectationRegistry as ar, ExperimentRegistry as or, apiKeyManagementRoutes as sr, attachAnalyticsMirror as cr, attachExpectations as lr, attachExperiments as ur, attachFinops as dr, awaitServerListening as fr, bindMutation as q, bindStream as pr, bindSubscription as J, buildTracingLayer as mr, cancelWakeup as hr, compileCron as gr, dataStoreApiKeyStore as _r, formatServerOnlyLeaks as vr, formatUnresolvedSources as yr, frameworkApiKeyStrategy as br, getResourcePolicy as xr, installPolicyGuardResolver as Sr, loadResourceTuples as Cr, makeActionRunner as wr, makeAdvisoryLockCoordinator as Tr, makeApiKeyService as Er, makeApiKeyUsageBuffer as Dr, makeApiKeyUsageFlusher as Or, makeAsyncKv as kr, makeAuthMiddlewareLayers as Ar, makeCoordinatedScheduler as jr, makeEffectStoreLayer as Mr, makeLazyWorkflowFacade as Nr, makeMutationOutputCodec as Pr, makeMutationRunner as Fr, makeOneShotQueryRunner as Ir, makeQueryDescriptorProducer as Lr, makeQueryFinalizer as Rr, makeQueryReauthorizer as Y, makeQuerySubscriber as zr, makeSchemaRegistry as Br, makeWorkflowFacade as Vr, makeWorkflowFacadeWithCallerContext as Hr, makeWorkflowLayers as Ur, noopKv as Wr, onProcessShutdown as Gr, recordSubscriptionDelivery as Kr, recordWorkflowRun as qr, registerDefaultTupleSource as X, registerWakeup as Jr, resolveSecretsBackend as Yr, runProvidedEffect as Xr, setSecretsBackend as Zr, setSystemStoreHandle as Qr, shutdownGraceMsFromEnv as $r, singleCoordinator as ei, startRpcServer as ti, startScheduler as ni, stripForbiddenForWire as ri, undoCaptureEnabled as ii, unresolvedSources as ai, withScopedRequest as oi, workflowToRpc as si, wrapStoreWithBootCodec as ci } from "@voltro/runtime";
|
|
34
|
+
import { appStorageProvider as li, fromNodeReadable as ui, getObjectStream as di, putObjectStream as fi, toNodeReadable as pi } from "@voltro/plugin-storage";
|
|
35
|
+
import { isEnvContract as mi } from "@voltro/env";
|
|
36
|
+
import { assertProductionSessionSecret as hi } from "@voltro/protocol/session";
|
|
37
|
+
import Z from "node:fs/promises";
|
|
38
|
+
import { createHash as gi, timingSafeEqual as _i } from "node:crypto";
|
|
39
|
+
import { buildDeliverWebhookExecute as vi, buildWebhooksService as yi, defaultIncomingPath as bi, deliverWebhookWorkflow as xi, makeDeferredEmitHandler as Si, mountIncomingWebhook as Ci } from "@voltro/plugin-webhooks";
|
|
40
|
+
import { getAuthSessionStrategy as wi } from "@voltro/plugin-auth";
|
|
41
|
+
import { registerEmailTemplates as Ti } from "@voltro/plugin-mail";
|
|
42
|
+
import { channelFor as Ei, getBroadcastPlugin as Di } from "@voltro/plugin-broadcast";
|
|
43
|
+
import { packBundle as Oi, runExport as ki, runImport as Ai, storageBlobSink as ji, storageRefsBlobSource as Mi, unpackBundle as Ni, unpackBundleToDir as Pi } from "@voltro/data-transfer";
|
|
42
44
|
//#region src/serveDrain.ts
|
|
43
|
-
var
|
|
45
|
+
var Fi = () => Math.max(500, Math.floor($r() * .6)), Ii = (e) => new Promise((t) => setTimeout(t, e)), Li = (e) => {
|
|
44
46
|
let t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set(), r = 0;
|
|
45
47
|
e.on("connection", (e) => {
|
|
46
48
|
t.add(e), e.once("close", () => {
|
|
@@ -54,14 +56,14 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
54
56
|
});
|
|
55
57
|
});
|
|
56
58
|
let i, a = async (t = {}) => {
|
|
57
|
-
let n = t.budgetMs ??
|
|
59
|
+
let n = t.budgetMs ?? Fi();
|
|
58
60
|
i ??= new Promise((t) => {
|
|
59
61
|
e.close(() => {
|
|
60
62
|
t();
|
|
61
63
|
});
|
|
62
64
|
}), e.closeIdleConnections();
|
|
63
65
|
let a = Date.now() + n;
|
|
64
|
-
for (; r > 0 && Date.now() < a;) await
|
|
66
|
+
for (; r > 0 && Date.now() < a;) await Ii(25), e.closeIdleConnections();
|
|
65
67
|
e.closeIdleConnections();
|
|
66
68
|
}, o = async () => {
|
|
67
69
|
i ??= new Promise((t) => {
|
|
@@ -78,7 +80,7 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
78
80
|
]));
|
|
79
81
|
} catch {}
|
|
80
82
|
else e.destroy();
|
|
81
|
-
for (let e = 0; t.size > 0 && e < 250; e += 25) await
|
|
83
|
+
for (let e = 0; t.size > 0 && e < 250; e += 25) await Ii(25);
|
|
82
84
|
for (let e of t) e.destroy();
|
|
83
85
|
await i;
|
|
84
86
|
};
|
|
@@ -90,25 +92,115 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
90
92
|
await a(e), await o();
|
|
91
93
|
}
|
|
92
94
|
};
|
|
93
|
-
},
|
|
95
|
+
}, Ri = "/_voltro/admin/import", zi = "/_voltro/admin/export", Q = (e, t) => ({
|
|
94
96
|
status: e,
|
|
95
97
|
contentType: "application/json; charset=utf-8",
|
|
96
98
|
body: JSON.stringify(t)
|
|
97
|
-
}),
|
|
99
|
+
}), Bi = (e) => {
|
|
98
100
|
let t = e.authorization ?? e.Authorization, n = t ? /^Bearer\s+(.+)$/i.exec(t) : null;
|
|
99
101
|
return n ? n[1] : null;
|
|
100
|
-
},
|
|
102
|
+
}, Vi = (e, t) => _i(gi("sha256").update(e).digest(), gi("sha256").update(t).digest()), Hi = (e, t) => {
|
|
101
103
|
if (e.method.toUpperCase() !== "POST") return Q(405, { error: "method not allowed" });
|
|
102
104
|
if (!t || t.length < 16) return Q(503, { error: "data transfer misconfigured (no/weak secret)" });
|
|
103
|
-
let n =
|
|
104
|
-
return !n || !
|
|
105
|
-
},
|
|
105
|
+
let n = Bi(e.headers);
|
|
106
|
+
return !n || !Vi(n, t) ? Q(401, { error: "unauthorized" }) : null;
|
|
107
|
+
}, Ui = /^[A-Za-z0-9_-]{8,64}$/, Wi = (e) => Ui.test(e), Gi = () => Sn.join(W.tmpdir(), "voltro-import-uploads"), Ki = (e) => Sn.join(Gi(), e), qi = (e) => Sn.join(Ki(e), "archive.bin"), Ji = (e) => Sn.join(Ki(e), "meta.json"), Yi = async (e = Date.now()) => {
|
|
108
|
+
let t = 0;
|
|
109
|
+
try {
|
|
110
|
+
for (let n of await Z.readdir(Gi())) {
|
|
111
|
+
let r = await Z.stat(Ki(n)).catch(() => null);
|
|
112
|
+
r !== null && (e - r.mtimeMs <= 864e5 || (await Z.rm(Ki(n), {
|
|
113
|
+
recursive: !0,
|
|
114
|
+
force: !0
|
|
115
|
+
}).catch(() => void 0), t++));
|
|
116
|
+
}
|
|
117
|
+
} catch {}
|
|
118
|
+
return t;
|
|
119
|
+
}, Xi = async (e) => {
|
|
120
|
+
if (!Wi(e)) return {
|
|
121
|
+
bytes: 0,
|
|
122
|
+
key: null
|
|
123
|
+
};
|
|
124
|
+
let t = await Z.stat(qi(e)).catch(() => null);
|
|
125
|
+
if (t === null) return {
|
|
126
|
+
bytes: 0,
|
|
127
|
+
key: null
|
|
128
|
+
};
|
|
129
|
+
let n = await Z.readFile(Ji(e), "utf8").then((e) => JSON.parse(e), () => ({}));
|
|
130
|
+
return {
|
|
131
|
+
bytes: t.size,
|
|
132
|
+
key: n.key ?? null
|
|
133
|
+
};
|
|
134
|
+
}, Zi = async (e) => {
|
|
135
|
+
if (!Wi(e.id)) return {
|
|
136
|
+
reason: "bad-id",
|
|
137
|
+
message: `upload id must match ${String(Ui)}`
|
|
138
|
+
};
|
|
139
|
+
let t = await Xi(e.id);
|
|
140
|
+
return t.key !== null && t.key !== e.key ? {
|
|
141
|
+
reason: "key-mismatch",
|
|
142
|
+
message: "this upload id already holds a different bundle. Use a new upload id, or delete the partial upload."
|
|
143
|
+
} : e.offset === t.bytes ? (await Z.mkdir(Ki(e.id), { recursive: !0 }), t.key === null && await Z.writeFile(Ji(e.id), JSON.stringify({
|
|
144
|
+
key: e.key,
|
|
145
|
+
startedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
146
|
+
})), await new Promise((t, n) => {
|
|
147
|
+
let r = Tn(qi(e.id), { flags: "a" });
|
|
148
|
+
r.on("error", n), r.on("finish", () => t()), r.end(Buffer.from(e.bytes));
|
|
149
|
+
}), { total: t.bytes + e.bytes.byteLength }) : {
|
|
150
|
+
reason: "offset-mismatch",
|
|
151
|
+
message: `chunk starts at ${e.offset} but the server holds ${t.bytes} byte(s)`,
|
|
152
|
+
expectedOffset: t.bytes
|
|
153
|
+
};
|
|
154
|
+
}, Qi = async (e) => {
|
|
155
|
+
let t = await Z.stat(qi(e));
|
|
156
|
+
return {
|
|
157
|
+
path: qi(e),
|
|
158
|
+
bytes: t.size
|
|
159
|
+
};
|
|
160
|
+
}, $i = async (e) => {
|
|
161
|
+
Wi(e) && await Z.rm(Ki(e), {
|
|
162
|
+
recursive: !0,
|
|
163
|
+
force: !0
|
|
164
|
+
}).catch(() => void 0);
|
|
165
|
+
}, ea = L({ scope: "voltro:admin-import" }), ta = "VBUNDLE2", na = async function* (e) {
|
|
106
166
|
yield e;
|
|
107
|
-
},
|
|
108
|
-
let n =
|
|
167
|
+
}, ra = (e) => async (t) => {
|
|
168
|
+
let n = Hi(t, e.secret);
|
|
109
169
|
if (n) return n;
|
|
110
|
-
let r = t.headers["x-import-mode"], i = t.headers["x-import-on-conflict"], a = t.headers["x-import-atomic"] === "1" || t.headers["x-import-atomic"] === "true", o = t.headers["x-import-force"] === "1" || t.headers["x-import-force"] === "true", s = t.headers["x-import-dry-run"] === "1" || t.headers["x-import-dry-run"] === "true", ee = (t.headers["x-import-tables"] ?? "").split(",").map((e) => e.trim()).filter(Boolean), c = t.
|
|
111
|
-
if (c
|
|
170
|
+
let r = t.headers["x-import-mode"], i = t.headers["x-import-on-conflict"], a = t.headers["x-import-atomic"] === "1" || t.headers["x-import-atomic"] === "true", o = t.headers["x-import-force"] === "1" || t.headers["x-import-force"] === "true", s = t.headers["x-import-dry-run"] === "1" || t.headers["x-import-dry-run"] === "true", ee = (t.headers["x-import-tables"] ?? "").split(",").map((e) => e.trim()).filter(Boolean), c = t.headers["x-import-upload-id"], l;
|
|
171
|
+
if (c !== void 0 && c !== "") {
|
|
172
|
+
if (Yi(), t.headers["x-import-probe"] === "1") return Q(200, {
|
|
173
|
+
uploadId: c,
|
|
174
|
+
bytes: (await Xi(c)).bytes
|
|
175
|
+
});
|
|
176
|
+
let e = t.headers["x-import-upload-key"] ?? "", n = Number(t.headers["x-import-chunk-offset"] ?? "0");
|
|
177
|
+
if (e === "" || !Number.isFinite(n) || n < 0) return Q(400, { error: "a chunked upload needs x-import-upload-key and a numeric x-import-chunk-offset" });
|
|
178
|
+
let r = await Zi({
|
|
179
|
+
id: c,
|
|
180
|
+
key: e,
|
|
181
|
+
offset: n,
|
|
182
|
+
bytes: t.rawBody
|
|
183
|
+
});
|
|
184
|
+
if ("reason" in r) return ea.warn("admin.import chunk refused", {
|
|
185
|
+
uploadId: c,
|
|
186
|
+
reason: r.reason
|
|
187
|
+
}), Q(409, {
|
|
188
|
+
error: "chunk refused",
|
|
189
|
+
reason: r.reason,
|
|
190
|
+
message: r.message,
|
|
191
|
+
...r.expectedOffset === void 0 ? {} : { expectedOffset: r.expectedOffset }
|
|
192
|
+
});
|
|
193
|
+
if (t.headers["x-import-chunk-final"] !== "1") return Q(202, {
|
|
194
|
+
uploadId: c,
|
|
195
|
+
bytes: r.total
|
|
196
|
+
});
|
|
197
|
+
l = (await Qi(c)).path;
|
|
198
|
+
}
|
|
199
|
+
let u = t.rawBody.byteLength >= 8 && Buffer.from(t.rawBody.subarray(0, 8)).toString("latin1") === ta, d, f;
|
|
200
|
+
if (l !== void 0) {
|
|
201
|
+
let { createReadStream: e } = await import("node:fs");
|
|
202
|
+
d = e(l), f = "chunked";
|
|
203
|
+
} else if (u) d = na(t.rawBody), f = "upload";
|
|
112
204
|
else {
|
|
113
205
|
let n;
|
|
114
206
|
try {
|
|
@@ -118,17 +210,17 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
118
210
|
}
|
|
119
211
|
if (typeof n.bundleKey != "string" || !n.bundleKey) return Q(400, { error: "body.bundleKey (string) is required for the storage transport" });
|
|
120
212
|
if (!e.openArchive) return Q(501, { error: "storage transport not configured on this instance" });
|
|
121
|
-
|
|
213
|
+
d = e.openArchive(n.bundleKey), f = "storage";
|
|
122
214
|
}
|
|
123
|
-
let te = await import("node:os"),
|
|
215
|
+
let te = await import("node:os"), ne = await import("node:fs/promises"), re = await import("node:path"), p = await ne.mkdtemp(re.join(te.tmpdir(), "voltro-admin-import-"));
|
|
124
216
|
try {
|
|
125
|
-
e.assetSink ? await
|
|
126
|
-
dir:
|
|
217
|
+
e.assetSink ? await Ni(d, {
|
|
218
|
+
dir: p,
|
|
127
219
|
blobs: e.assetSink
|
|
128
|
-
}) : await
|
|
129
|
-
let t = await
|
|
220
|
+
}) : await Pi(d, p);
|
|
221
|
+
let t = await H.runPromiseExit(Ai({
|
|
130
222
|
store: e.store,
|
|
131
|
-
bundleDir:
|
|
223
|
+
bundleDir: p,
|
|
132
224
|
...r ? { mode: r } : {},
|
|
133
225
|
...i ? { onConflict: i } : {},
|
|
134
226
|
...a ? { atomic: a } : {},
|
|
@@ -136,15 +228,15 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
136
228
|
...ee.length > 0 ? { tables: ee } : {},
|
|
137
229
|
...e.snapshot ? { targetSnapshot: e.snapshot } : {},
|
|
138
230
|
force: o,
|
|
139
|
-
onWarn: (e) =>
|
|
231
|
+
onWarn: (e) => ea.warn("admin.import", { message: e }),
|
|
140
232
|
...e.assetSink ? { assetsAlreadyRestored: !0 } : {}
|
|
141
233
|
}));
|
|
142
234
|
if (t._tag === "Failure") {
|
|
143
235
|
let e = t.cause._tag === "Fail" ? t.cause.error : void 0;
|
|
144
236
|
if (e && e._tag === "SchemaDriftError") {
|
|
145
237
|
let t = e;
|
|
146
|
-
return
|
|
147
|
-
transport:
|
|
238
|
+
return ea.warn("admin.import refused (schema drift)", {
|
|
239
|
+
transport: f,
|
|
148
240
|
bundle: t.bundleFingerprint.slice(0, 16),
|
|
149
241
|
target: t.targetFingerprint.slice(0, 16)
|
|
150
242
|
}), Q(409, {
|
|
@@ -155,50 +247,59 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
155
247
|
hint: "each line above would break the load: a table or column the bundle carries that the target cannot take, or a column the target requires that the bundle has no value for. Fix the target schema, re-export against it, or resend with x-import-force: 1 to write anyway."
|
|
156
248
|
});
|
|
157
249
|
}
|
|
158
|
-
|
|
250
|
+
let n = typeof e?.reason == "string" ? e.reason : void 0;
|
|
251
|
+
if (n !== void 0 && e._tag === "ImportModeError") return ea.warn("admin.import refused (mode)", {
|
|
252
|
+
transport: f,
|
|
253
|
+
mode: e.mode
|
|
254
|
+
}), Q(409, {
|
|
255
|
+
error: "import mode refused",
|
|
256
|
+
mode: e.mode,
|
|
257
|
+
message: n
|
|
258
|
+
});
|
|
259
|
+
throw Error(n ?? String(e?.message ?? e ?? "import failed"));
|
|
159
260
|
}
|
|
160
261
|
let n = t.value, c = n.tables.reduce((e, t) => e + t.rowCount, 0);
|
|
161
|
-
return
|
|
162
|
-
transport:
|
|
262
|
+
return ea.info(s ? "admin.import (dry run — nothing written)" : "admin.import", {
|
|
263
|
+
transport: f,
|
|
163
264
|
tables: n.tables.length,
|
|
164
265
|
rows: c,
|
|
165
266
|
mode: r ?? "upsert",
|
|
166
267
|
atomic: a
|
|
167
|
-
}), Q(200, {
|
|
268
|
+
}), s || e.refreshSubscriptions?.(`data import: ${n.tables.length} table(s), mode ${r ?? "upsert"}`), Q(200, {
|
|
168
269
|
tables: n.tables.length,
|
|
169
270
|
rows: c,
|
|
170
|
-
transport:
|
|
271
|
+
transport: f,
|
|
171
272
|
...s ? {
|
|
172
273
|
dryRun: !0,
|
|
173
274
|
wrote: !1
|
|
174
275
|
} : {}
|
|
175
276
|
});
|
|
176
277
|
} catch (e) {
|
|
177
|
-
return
|
|
178
|
-
transport:
|
|
278
|
+
return ea.warn("admin.import failed", {
|
|
279
|
+
transport: f,
|
|
179
280
|
error: e?.message ?? String(e)
|
|
180
281
|
}), Q(500, {
|
|
181
282
|
error: "import failed",
|
|
182
283
|
message: e?.message ?? String(e)
|
|
183
284
|
});
|
|
184
285
|
} finally {
|
|
185
|
-
await
|
|
286
|
+
await ne.rm(p, {
|
|
186
287
|
recursive: !0,
|
|
187
288
|
force: !0
|
|
188
|
-
});
|
|
289
|
+
}), c !== void 0 && c !== "" && l !== void 0 && await $i(c);
|
|
189
290
|
}
|
|
190
|
-
},
|
|
291
|
+
}, ia = L({ scope: "voltro:admin-export" }), aa = async (e) => {
|
|
191
292
|
let t = [];
|
|
192
293
|
for await (let n of e) t.push(Buffer.from(n));
|
|
193
294
|
return new Uint8Array(Buffer.concat(t));
|
|
194
|
-
},
|
|
295
|
+
}, oa = (e) => typeof e.tenant == "string" && e.tenant ? {
|
|
195
296
|
kind: "tenant",
|
|
196
297
|
tenantId: e.tenant
|
|
197
298
|
} : Array.isArray(e.tables) && e.tables.length ? {
|
|
198
299
|
kind: "tables",
|
|
199
300
|
tables: e.tables.filter((e) => typeof e == "string")
|
|
200
|
-
} : { kind: "all" },
|
|
201
|
-
let n =
|
|
301
|
+
} : { kind: "all" }, sa = (e) => async (t) => {
|
|
302
|
+
let n = Hi(t, e.secret);
|
|
202
303
|
if (n) return n;
|
|
203
304
|
let r;
|
|
204
305
|
try {
|
|
@@ -218,13 +319,13 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
218
319
|
});
|
|
219
320
|
}
|
|
220
321
|
}
|
|
221
|
-
let a = r.consistency === "snapshot" ? "snapshot" : i.consistency ?? "live", o = (typeof r.compression == "string" ? r.compression : void 0) ?? i.compression, s = i.scope ??
|
|
322
|
+
let a = r.consistency === "snapshot" ? "snapshot" : i.consistency ?? "live", o = (typeof r.compression == "string" ? r.compression : void 0) ?? i.compression, s = i.scope ?? oa(r), ee = typeof r.bundleKey == "string" && r.bundleKey.length > 0, c = r.assets === !0 && e.assetSource ? { blobs: e.assetSource } : {}, l = await import("node:os"), u = await import("node:fs/promises"), d = await import("node:path"), f = await u.mkdtemp(d.join(l.tmpdir(), "voltro-admin-export-"));
|
|
222
323
|
try {
|
|
223
|
-
let t = await
|
|
324
|
+
let t = await H.runPromise(ki({
|
|
224
325
|
store: e.store,
|
|
225
326
|
snapshot: e.snapshot,
|
|
226
327
|
dialect: e.dialect,
|
|
227
|
-
outDir:
|
|
328
|
+
outDir: f,
|
|
228
329
|
...i.subset ? { subset: i.subset } : {
|
|
229
330
|
scope: s,
|
|
230
331
|
...e.tenantTables && e.tenantTables.length > 0 ? { tenantTables: e.tenantTables } : {}
|
|
@@ -236,10 +337,10 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
236
337
|
if (ee) {
|
|
237
338
|
if (!e.putArchive) return Q(501, { error: "storage transport not configured on this instance" });
|
|
238
339
|
let i = r.bundleKey;
|
|
239
|
-
return await e.putArchive(i, () =>
|
|
240
|
-
dir:
|
|
340
|
+
return await e.putArchive(i, () => Oi({
|
|
341
|
+
dir: f,
|
|
241
342
|
...c
|
|
242
|
-
})),
|
|
343
|
+
})), ia.info("admin.export", {
|
|
243
344
|
transport: "storage",
|
|
244
345
|
tables: t.tables.length,
|
|
245
346
|
rows: n,
|
|
@@ -253,11 +354,11 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
253
354
|
transport: "storage"
|
|
254
355
|
});
|
|
255
356
|
}
|
|
256
|
-
let u = await
|
|
257
|
-
dir:
|
|
357
|
+
let u = await aa(Oi({
|
|
358
|
+
dir: f,
|
|
258
359
|
...c
|
|
259
360
|
}));
|
|
260
|
-
return
|
|
361
|
+
return ia.info("admin.export", {
|
|
261
362
|
transport: "download",
|
|
262
363
|
tables: t.tables.length,
|
|
263
364
|
rows: n,
|
|
@@ -274,18 +375,18 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
274
375
|
}
|
|
275
376
|
};
|
|
276
377
|
} catch (e) {
|
|
277
|
-
return
|
|
378
|
+
return ia.warn("admin.export failed", { error: e?.message ?? String(e) }), Q(500, {
|
|
278
379
|
error: "export failed",
|
|
279
380
|
message: e?.message ?? String(e)
|
|
280
381
|
});
|
|
281
382
|
} finally {
|
|
282
|
-
await u.rm(
|
|
383
|
+
await u.rm(f, {
|
|
283
384
|
recursive: !0,
|
|
284
385
|
force: !0
|
|
285
386
|
});
|
|
286
387
|
}
|
|
287
|
-
},
|
|
288
|
-
let r = await
|
|
388
|
+
}, ca = (e, t, n = {}) => (async function* () {
|
|
389
|
+
let r = await H.runPromise(di(e, t).pipe(H.timeout(n.openTimeout ?? "30 seconds"))), i = await pi(r.stream), a = n.stallMs ?? 12e4, o, s = () => {
|
|
289
390
|
o && clearTimeout(o), o = setTimeout(() => i.destroy(/* @__PURE__ */ Error(`storage read stalled for ${a}ms reading '${t}'`)), a);
|
|
290
391
|
};
|
|
291
392
|
try {
|
|
@@ -294,7 +395,7 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
294
395
|
} finally {
|
|
295
396
|
o && clearTimeout(o), i.destroy();
|
|
296
397
|
}
|
|
297
|
-
})(),
|
|
398
|
+
})(), la = {
|
|
298
399
|
get: async () => void 0,
|
|
299
400
|
set: async () => {},
|
|
300
401
|
setWithTags: async () => {},
|
|
@@ -303,26 +404,26 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
303
404
|
clear: async () => {},
|
|
304
405
|
invalidateTag: async () => 0,
|
|
305
406
|
wrap: async (e, t, n) => n()
|
|
306
|
-
},
|
|
407
|
+
}, ua = async (e) => {
|
|
307
408
|
zt(e.appProcedures ?? e.discovered, {
|
|
308
409
|
defaultDeny: e.security?.defaultDeny ?? !0,
|
|
309
410
|
commandHint: "`voltro serve`"
|
|
310
|
-
}),
|
|
411
|
+
}), Qr({
|
|
311
412
|
dataStore: e.store,
|
|
312
413
|
schemaRegistry: e.schemaRegistry
|
|
313
414
|
});
|
|
314
|
-
let t = (e.discovered.budgets?.length ?? 0) > 0, n, r = new
|
|
415
|
+
let t = (e.discovered.budgets?.length ?? 0) > 0, n, r = new ir({
|
|
315
416
|
store: e.store,
|
|
316
417
|
...e.snapshotCache ? { cache: e.snapshotCache } : {},
|
|
317
418
|
...e.reactive === void 0 ? {} : { reactive: e.reactive },
|
|
318
419
|
...t ? { recordCost: (e) => n?.record(e) } : {},
|
|
319
|
-
recordDelivery: (e) =>
|
|
420
|
+
recordDelivery: (e) => Kr({
|
|
320
421
|
label: e.label,
|
|
321
422
|
kind: e.kind,
|
|
322
423
|
durationMs: e.durationMs,
|
|
323
424
|
rowCount: e.rowCount
|
|
324
425
|
})
|
|
325
|
-
}), i = e.cache ??
|
|
426
|
+
}), i = e.cache ?? la, a = e.kv ?? Wr, o, ee = () => void 0, c, d, f, te, ne, re, ce, le = ae({
|
|
326
427
|
store: e.store,
|
|
327
428
|
warn: (e, t) => {
|
|
328
429
|
process.stderr.write(`[workflow] ${e} ${JSON.stringify(t)}\n`);
|
|
@@ -330,7 +431,7 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
330
431
|
}), ue = le.remember, de = le.resolve, fe = _({
|
|
331
432
|
authority: e.authority,
|
|
332
433
|
getStore: () => e.store
|
|
333
|
-
}), v = (e.discovered.workflows?.length ?? 0) > 0 ?
|
|
434
|
+
}), v = (e.discovered.workflows?.length ?? 0) > 0 ? Nr(() => o) : void 0, he = (e.discovered.workflows?.length ?? 0) > 0 || (e.discovered.eventTriggers?.length ?? 0) > 0, ge = he || (e.discovered.workflowWorkers?.length ?? 0) > 0 || e.scheduleCoordination === "cluster", _e = e.tenantIsolation === "namespace", ve = (e.log ?? L({ scope: "voltro:serve" })).child("webhooks"), xe, Se, y = e.discovered.webhooks;
|
|
334
435
|
if (y && y.outgoing.length > 0 && e.workflowEngineLayer !== void 0) {
|
|
335
436
|
e.workflowEngineLayer;
|
|
336
437
|
let t = w({
|
|
@@ -339,8 +440,8 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
339
440
|
cache: i,
|
|
340
441
|
kv: a
|
|
341
442
|
}), n = y.outgoing.map((e) => e.descriptor);
|
|
342
|
-
Se =
|
|
343
|
-
let t =
|
|
443
|
+
Se = xi.toLayer(vi(t, { events: n })), xe = yi(t, async (e) => {
|
|
444
|
+
let t = f;
|
|
344
445
|
if (t === void 0) {
|
|
345
446
|
ve.error("webhook delivery skipped — the workflow runtime was never built. This is a framework defect, not a configuration problem: report it with your engine setting. Deliveries are NOT queued and will not be retried.", {
|
|
346
447
|
deliveryId: e.deliveryId,
|
|
@@ -348,7 +449,7 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
348
449
|
});
|
|
349
450
|
return;
|
|
350
451
|
}
|
|
351
|
-
t.runPromise(
|
|
452
|
+
t.runPromise(xi.execute(e)).catch((t) => {
|
|
352
453
|
ve.error("deliverWebhook workflow crashed", {
|
|
353
454
|
deliveryId: e.deliveryId,
|
|
354
455
|
targetId: e.targetId
|
|
@@ -358,9 +459,9 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
358
459
|
}
|
|
359
460
|
let Ce = /* @__PURE__ */ new Map();
|
|
360
461
|
if (y) for (let e of y.incoming) {
|
|
361
|
-
let t = e.descriptor.path ??
|
|
462
|
+
let t = e.descriptor.path ?? bi(e.descriptor.id), n = `VOLTRO_WEBHOOK_SECRET_${e.descriptor.id.toUpperCase().replace(/[^A-Z0-9]/g, "_")}`, r = Ci(e.descriptor, {
|
|
362
463
|
resolveSecret: async () => process.env[n] ?? null,
|
|
363
|
-
resolveWorkflows: () => v === void 0 ? void 0 :
|
|
464
|
+
resolveWorkflows: () => v === void 0 ? void 0 : Hr(v, {
|
|
364
465
|
traceId: `incoming:${e.descriptor.id}`,
|
|
365
466
|
source: `incoming:${e.descriptor.id}`
|
|
366
467
|
}),
|
|
@@ -377,11 +478,11 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
377
478
|
});
|
|
378
479
|
Ce.set(t, { handle: r });
|
|
379
480
|
}
|
|
380
|
-
|
|
481
|
+
Sr(), X((t) => Cr(e.store, t.subjectId, t.resourceType, t.resourceId)) || L({ scope: "voltro:serve" }).info("policy guards: using the app-registered tuple source");
|
|
381
482
|
let we = [], Te = [...e.discovered.outboxHandlers ?? [], ...mn((y?.outgoing.length ?? 0) + (y?.incoming.length ?? 0) + (y?.providers.length ?? 0), []) ? [{
|
|
382
483
|
file: "<framework>/webhooks",
|
|
383
484
|
id: "voltro-webhook-emit",
|
|
384
|
-
definition:
|
|
485
|
+
definition: Si(() => xe)
|
|
385
486
|
}] : []], Ee = Te.length > 0 ? Pe({
|
|
386
487
|
handlers: Te,
|
|
387
488
|
store: e.store,
|
|
@@ -431,17 +532,17 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
431
532
|
...Ee === void 0 ? {} : { outbox: { nudge: Ee.nudge } },
|
|
432
533
|
...b.active ? { connections: { registry: b.registry } } : {},
|
|
433
534
|
eventBus: S.bus
|
|
434
|
-
}), Ve =
|
|
435
|
-
let r = t.pipe(
|
|
436
|
-
return (e.baseLayer ? r.pipe(
|
|
535
|
+
}), Ve = U.succeed(nr, p), He = U.succeed(ar, Ue), We = U.succeed(K, Rt), Ke = U.succeed(or, Ft), Je = (t, n) => {
|
|
536
|
+
let r = t.pipe(H.provide(Mr(n)));
|
|
537
|
+
return (e.baseLayer ? r.pipe(H.provide(e.baseLayer)) : r).pipe(H.provide(Ve)).pipe(H.provide(He)).pipe(H.provide(We)).pipe(H.provide(Ke));
|
|
437
538
|
}, Ye = (e, t) => {
|
|
438
539
|
let n = Je(e, t);
|
|
439
|
-
return
|
|
540
|
+
return Xr(n);
|
|
440
541
|
}, T = _n(), E = vt(e.plugins ?? [], T), Xe = u({
|
|
441
542
|
plugins: e.plugins ?? [],
|
|
442
543
|
metrics: T,
|
|
443
544
|
log: e.log ?? L({ scope: "voltro:serve" })
|
|
444
|
-
}), Qe = h(e.plugins ?? [], T), $e = e.security?.defaultDeny ?? !0, et =
|
|
545
|
+
}), Qe = h(e.plugins ?? [], T), $e = e.security?.defaultDeny ?? !0, et = Fr({
|
|
445
546
|
store: e.store,
|
|
446
547
|
defaultDeny: $e,
|
|
447
548
|
recordMetric: (e) => {
|
|
@@ -459,7 +560,7 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
459
560
|
let rt = Ne({
|
|
460
561
|
store: e.store,
|
|
461
562
|
...e.approvals === void 0 ? {} : { defaultExpiryMs: e.approvals.defaultExpiryMs }
|
|
462
|
-
}), it =
|
|
563
|
+
}), it = wr({
|
|
463
564
|
defaultDeny: $e,
|
|
464
565
|
buildContext: (e) => C(e),
|
|
465
566
|
runEffect: Ye,
|
|
@@ -467,7 +568,7 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
467
568
|
T.record(e);
|
|
468
569
|
},
|
|
469
570
|
...E.action === void 0 ? {} : { interceptor: E.action }
|
|
470
|
-
}), st =
|
|
571
|
+
}), st = Rr({
|
|
471
572
|
tenantScopedTables: e.tenantScopedTables,
|
|
472
573
|
softDeleteScopedTables: e.softDeleteScopedTables
|
|
473
574
|
}), ct = {
|
|
@@ -476,32 +577,32 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
476
577
|
finalize: (e, t) => st(e, t.subject),
|
|
477
578
|
provideEffect: Je,
|
|
478
579
|
...E.query === void 0 ? {} : { interceptor: E.query }
|
|
479
|
-
}, D =
|
|
580
|
+
}, D = Lr(ct), ut = Ir({
|
|
480
581
|
...ct,
|
|
481
|
-
queryRows: (t, n) => e.store.query(t).then((e) =>
|
|
482
|
-
}), dt =
|
|
582
|
+
queryRows: (t, n) => e.store.query(t).then((e) => ri(t.table, e, n.subject))
|
|
583
|
+
}), dt = zr({
|
|
483
584
|
...ct,
|
|
484
585
|
subscribeDescriptor: (e, t, n) => r.subscribe(e, t, n),
|
|
485
586
|
subscribeComputed: (e, t, n) => r.subscribeComputed(e, t, n)
|
|
486
|
-
}), O = (e) => e.filter((e) =>
|
|
587
|
+
}), O = (e) => e.filter((e) => jn(e.descriptor)), k = {};
|
|
487
588
|
for (let t of [
|
|
488
589
|
...O(e.discovered.queries),
|
|
489
590
|
...nt.queries,
|
|
490
591
|
...rt.queries,
|
|
491
592
|
...b.queries
|
|
492
|
-
]) k[t.descriptor.name] = (e) =>
|
|
593
|
+
]) k[t.descriptor.name] = (e) => J(D(t, e), r, `subscription.${t.descriptor.name}`, void 0, void 0, Y(t, e));
|
|
493
594
|
for (let t of [
|
|
494
595
|
...O(e.discovered.mutations),
|
|
495
596
|
...nt.mutations,
|
|
496
597
|
...rt.mutations,
|
|
497
598
|
...b.mutations
|
|
498
599
|
]) {
|
|
499
|
-
let n =
|
|
500
|
-
k[t.descriptor.name] = (r) =>
|
|
600
|
+
let n = Pr(t.descriptor.output);
|
|
601
|
+
k[t.descriptor.name] = (r) => q(async (e, n) => et(t, e, n), r, `mutation.${t.descriptor.name}`, n, e.idempotency, Pn(t.descriptor, "mutation"));
|
|
501
602
|
}
|
|
502
603
|
for (let t of [...O(e.discovered.actions), ...b.actions]) {
|
|
503
|
-
let n =
|
|
504
|
-
k[t.descriptor.name] = (r) =>
|
|
604
|
+
let n = Pr(t.descriptor.output);
|
|
605
|
+
k[t.descriptor.name] = (r) => q(async (e, n) => it(t, e, n), r, `action.${t.descriptor.name}`, n, e.idempotency, Pn(t.descriptor, "action"));
|
|
505
606
|
}
|
|
506
607
|
let ft = () => `public-${Math.random().toString(36).slice(2, 10)}`, A = [
|
|
507
608
|
...e.discovered.queries.filter((e) => e.descriptor.publicApi !== void 0).map((e) => ({
|
|
@@ -551,28 +652,31 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
551
652
|
log: e.log ?? L({ scope: "voltro:serve" })
|
|
552
653
|
}), gt = e.dataTransferSecret ?? process.env.VOLTRO_DATA_TRANSFER_SECRET, _t = gt && gt.length >= 16 ? [{
|
|
553
654
|
method: "POST",
|
|
554
|
-
path:
|
|
555
|
-
handle:
|
|
655
|
+
path: Ri,
|
|
656
|
+
handle: ra({
|
|
556
657
|
secret: gt,
|
|
557
658
|
store: e.store,
|
|
558
659
|
...e.dataTransferSnapshot ? { snapshot: e.dataTransferSnapshot } : {},
|
|
559
|
-
assetSink:
|
|
560
|
-
openArchive: (e) =>
|
|
660
|
+
assetSink: ji(li()),
|
|
661
|
+
openArchive: (e) => ca(li(), e),
|
|
662
|
+
refreshSubscriptions: (e) => {
|
|
663
|
+
r.refreshAll(e);
|
|
664
|
+
}
|
|
561
665
|
})
|
|
562
666
|
}, {
|
|
563
667
|
method: "POST",
|
|
564
|
-
path:
|
|
565
|
-
handle:
|
|
668
|
+
path: zi,
|
|
669
|
+
handle: sa({
|
|
566
670
|
secret: gt,
|
|
567
671
|
store: e.store,
|
|
568
672
|
snapshot: e.dataTransferSnapshot ?? { tables: [] },
|
|
569
673
|
dialect: e.dataTransferDialect ?? "memory",
|
|
570
674
|
tenantTables: [...e.tenantScopedTables],
|
|
571
675
|
loadProfile: xn,
|
|
572
|
-
assetSource:
|
|
676
|
+
assetSource: Mi(li(), e.store),
|
|
573
677
|
putArchive: async (e, t) => {
|
|
574
|
-
let { Readable: n } = await import("node:stream"), r =
|
|
575
|
-
await
|
|
678
|
+
let { Readable: n } = await import("node:stream"), r = li(), i = ui("storage", () => n.from(t()));
|
|
679
|
+
await H.runPromise(fi(r, e, i, { contentType: "application/octet-stream" }));
|
|
576
680
|
}
|
|
577
681
|
})
|
|
578
682
|
}] : [], bt = [
|
|
@@ -582,24 +686,24 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
582
686
|
...b.httpRoutes
|
|
583
687
|
];
|
|
584
688
|
Object.assign(k, S.handlers);
|
|
585
|
-
for (let t of O(e.discovered.streams ?? [])) k[t.descriptor.name] = (n) =>
|
|
689
|
+
for (let t of O(e.discovered.streams ?? [])) k[t.descriptor.name] = (n) => pr((r) => oi(r, (r) => {
|
|
586
690
|
let i = C(r), a = t.executor(n, i);
|
|
587
|
-
if (
|
|
588
|
-
let t = a.pipe(
|
|
589
|
-
return (e.baseLayer ? t.pipe(
|
|
691
|
+
if (H.isEffect(a)) {
|
|
692
|
+
let t = a.pipe(H.provide(Mr(i.store)));
|
|
693
|
+
return (e.baseLayer ? t.pipe(H.provide(e.baseLayer)) : t).pipe(H.provide(Ve)).pipe(H.provide(He)).pipe(H.provide(We)).pipe(H.provide(Ke));
|
|
590
694
|
}
|
|
591
|
-
return typeof a == "object" && a && typeof a.then == "function" ?
|
|
695
|
+
return typeof a == "object" && a && typeof a.then == "function" ? H.promise(() => a) : a;
|
|
592
696
|
}), `stream.${t.descriptor.name}`);
|
|
593
|
-
for (let t of e.discovered.workflows ?? []) k[t.definition.name] = (e) =>
|
|
697
|
+
for (let t of e.discovered.workflows ?? []) k[t.definition.name] = (e) => q(async (e, n) => {
|
|
594
698
|
let r = n;
|
|
595
|
-
return
|
|
699
|
+
return Hr(v, {
|
|
596
700
|
subject: r.subject,
|
|
597
701
|
traceId: r.traceId,
|
|
598
702
|
source: "workflow-rpc"
|
|
599
703
|
}).start(t.definition.name, e);
|
|
600
704
|
}, e, `workflow.${t.definition.name}`);
|
|
601
|
-
he && (k[
|
|
602
|
-
descriptor:
|
|
705
|
+
he && (k[Rn.name] = (e) => J(D({
|
|
706
|
+
descriptor: Rn,
|
|
603
707
|
executor: (e) => {
|
|
604
708
|
let t = e.id;
|
|
605
709
|
return {
|
|
@@ -608,30 +712,30 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
608
712
|
column: "startedAt",
|
|
609
713
|
direction: "desc"
|
|
610
714
|
}],
|
|
611
|
-
predicate:
|
|
715
|
+
predicate: tr(G("id", t), G("executionId", t)),
|
|
612
716
|
take: 1,
|
|
613
717
|
skip: void 0,
|
|
614
718
|
projection: void 0
|
|
615
719
|
};
|
|
616
720
|
}
|
|
617
|
-
}, e), r, `subscription.${
|
|
618
|
-
descriptor:
|
|
721
|
+
}, e), r, `subscription.${Rn.name}`), k[Bn.name] = (e) => J(D({
|
|
722
|
+
descriptor: Bn,
|
|
619
723
|
executor: (e) => {
|
|
620
|
-
let t = e, n = [...t.tag === void 0 ? [] : [
|
|
724
|
+
let t = e, n = [...t.tag === void 0 ? [] : [G("tag", t.tag)], ...t.status === void 0 ? [] : [G("status", t.status)]], r = Number.isFinite(t.limit) && t.limit !== void 0 ? Math.min(Math.max(Math.floor(t.limit), 1), 500) : 100;
|
|
621
725
|
return {
|
|
622
726
|
table: "_voltro_workflow_runs",
|
|
623
727
|
order: [{
|
|
624
728
|
column: "startedAt",
|
|
625
729
|
direction: "desc"
|
|
626
730
|
}],
|
|
627
|
-
predicate: n.length === 0 ? void 0 : n.length === 1 ? n[0] :
|
|
731
|
+
predicate: n.length === 0 ? void 0 : n.length === 1 ? n[0] : Qn(...n),
|
|
628
732
|
take: r,
|
|
629
733
|
skip: void 0,
|
|
630
734
|
projection: void 0
|
|
631
735
|
};
|
|
632
736
|
}
|
|
633
|
-
}, e), r, `subscription.${
|
|
634
|
-
descriptor:
|
|
737
|
+
}, e), r, `subscription.${Bn.name}`), k[zn.name] = (e) => J(D({
|
|
738
|
+
descriptor: zn,
|
|
635
739
|
executor: (e) => {
|
|
636
740
|
let t = e.runId;
|
|
637
741
|
return {
|
|
@@ -640,14 +744,14 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
640
744
|
column: "startedAt",
|
|
641
745
|
direction: "asc"
|
|
642
746
|
}],
|
|
643
|
-
predicate:
|
|
747
|
+
predicate: G("runId", t),
|
|
644
748
|
take: 1e3,
|
|
645
749
|
skip: void 0,
|
|
646
750
|
projection: void 0
|
|
647
751
|
};
|
|
648
752
|
}
|
|
649
|
-
}, e), r, `subscription.${
|
|
650
|
-
descriptor:
|
|
753
|
+
}, e), r, `subscription.${zn.name}`), k[Ln.name] = (e) => J(D({
|
|
754
|
+
descriptor: Ln,
|
|
651
755
|
executor: (e) => {
|
|
652
756
|
let t = e.runId;
|
|
653
757
|
return {
|
|
@@ -656,14 +760,14 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
656
760
|
column: "occurredAt",
|
|
657
761
|
direction: "asc"
|
|
658
762
|
}],
|
|
659
|
-
predicate:
|
|
763
|
+
predicate: G("runId", t),
|
|
660
764
|
take: 1e3,
|
|
661
765
|
skip: void 0,
|
|
662
766
|
projection: void 0
|
|
663
767
|
};
|
|
664
768
|
}
|
|
665
|
-
}, e), r, `subscription.${
|
|
666
|
-
descriptor:
|
|
769
|
+
}, e), r, `subscription.${Ln.name}`), k[B.name] = (e) => J(D({
|
|
770
|
+
descriptor: B,
|
|
667
771
|
executor: (e) => {
|
|
668
772
|
let t = e;
|
|
669
773
|
return {
|
|
@@ -672,14 +776,14 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
672
776
|
column: "occurredAt",
|
|
673
777
|
direction: "desc"
|
|
674
778
|
}],
|
|
675
|
-
predicate: t.name === void 0 ? void 0 :
|
|
779
|
+
predicate: t.name === void 0 ? void 0 : G("name", t.name),
|
|
676
780
|
take: Math.max(1, Math.min(500, t.limit ?? 100)),
|
|
677
781
|
skip: void 0,
|
|
678
782
|
projection: void 0
|
|
679
783
|
};
|
|
680
784
|
}
|
|
681
|
-
}, e), r, `subscription.${
|
|
682
|
-
descriptor:
|
|
785
|
+
}, e), r, `subscription.${B.name}`), k[V.name] = (e) => J(D({
|
|
786
|
+
descriptor: V,
|
|
683
787
|
executor: (e) => {
|
|
684
788
|
let t = e.eventId;
|
|
685
789
|
return {
|
|
@@ -688,59 +792,59 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
688
792
|
column: "createdAt",
|
|
689
793
|
direction: "asc"
|
|
690
794
|
}],
|
|
691
|
-
predicate:
|
|
795
|
+
predicate: G("eventId", t),
|
|
692
796
|
take: 500,
|
|
693
797
|
skip: void 0,
|
|
694
798
|
projection: void 0
|
|
695
799
|
};
|
|
696
800
|
}
|
|
697
|
-
}, e), r, `subscription.${
|
|
801
|
+
}, e), r, `subscription.${V.name}`), k[Fn.name] = (t) => q(async (t, n) => {
|
|
698
802
|
let r = t;
|
|
699
803
|
return await pt(e.store, n.subject, { executionId: r.executionId }), await v.cancel(r.workflowName, r.executionId), await Nt(r.workflowName, r.executionId, "workflow.cancel"), { ok: !0 };
|
|
700
|
-
}, t, `action.${
|
|
804
|
+
}, t, `action.${Fn.name}`), k[In.name] = (t) => q(async (t, n) => {
|
|
701
805
|
let r = t;
|
|
702
806
|
return await pt(e.store, n.subject, { executionId: r.executionId }), await v.resume(r.workflowName, r.executionId), { ok: !0 };
|
|
703
|
-
}, t, `action.${
|
|
807
|
+
}, t, `action.${In.name}`), k[Vn.name] = (t) => q(async (t, n) => {
|
|
704
808
|
let r = t;
|
|
705
809
|
return await pt(e.store, n.subject, { id: r.id }), v.signal({ id: r.id }, r.signalName, r.payload);
|
|
706
|
-
}, t, `action.${
|
|
810
|
+
}, t, `action.${Vn.name}`), k[Hn.name] = (t) => q(async (t, n) => {
|
|
707
811
|
let r = t;
|
|
708
812
|
return await pt(e.store, n.subject, { id: r.id }), v.update({ id: r.id }, r.updateName, r.payload, r.timeoutMs === void 0 ? void 0 : { timeoutMs: r.timeoutMs });
|
|
709
|
-
}, t, `action.${
|
|
813
|
+
}, t, `action.${Hn.name}`));
|
|
710
814
|
let St = [
|
|
711
|
-
...O(e.discovered.queries).map((e) =>
|
|
712
|
-
...O(e.discovered.mutations).map((e) =>
|
|
815
|
+
...O(e.discovered.queries).map((e) => z(e.descriptor)),
|
|
816
|
+
...O(e.discovered.mutations).map((e) => Mn(e.descriptor)),
|
|
713
817
|
...O(e.discovered.actions).map((e) => R(e.descriptor)),
|
|
714
|
-
...nt.queries.map((e) =>
|
|
715
|
-
...nt.mutations.map((e) =>
|
|
716
|
-
...rt.queries.map((e) =>
|
|
717
|
-
...rt.mutations.map((e) =>
|
|
718
|
-
...b.queries.map((e) =>
|
|
719
|
-
...b.mutations.map((e) =>
|
|
818
|
+
...nt.queries.map((e) => z(e.descriptor)),
|
|
819
|
+
...nt.mutations.map((e) => Mn(e.descriptor)),
|
|
820
|
+
...rt.queries.map((e) => z(e.descriptor)),
|
|
821
|
+
...rt.mutations.map((e) => Mn(e.descriptor)),
|
|
822
|
+
...b.queries.map((e) => z(e.descriptor)),
|
|
823
|
+
...b.mutations.map((e) => Mn(e.descriptor)),
|
|
720
824
|
...b.actions.map((e) => R(e.descriptor)),
|
|
721
|
-
...O(e.discovered.streams ?? []).map((e) =>
|
|
825
|
+
...O(e.discovered.streams ?? []).map((e) => Nn(e.descriptor)),
|
|
722
826
|
...S.rpcs,
|
|
723
|
-
...(e.discovered.workflows ?? []).map((e) =>
|
|
827
|
+
...(e.discovered.workflows ?? []).map((e) => si(e.definition)),
|
|
724
828
|
...he ? [
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
B
|
|
730
|
-
|
|
731
|
-
R(
|
|
732
|
-
R(
|
|
733
|
-
R(
|
|
734
|
-
R(
|
|
829
|
+
z(Rn),
|
|
830
|
+
z(Bn),
|
|
831
|
+
z(zn),
|
|
832
|
+
z(Ln),
|
|
833
|
+
z(B),
|
|
834
|
+
z(V),
|
|
835
|
+
R(Fn),
|
|
836
|
+
R(In),
|
|
837
|
+
R(Vn),
|
|
838
|
+
R(Hn)
|
|
735
839
|
] : []
|
|
736
|
-
], Tt =
|
|
737
|
-
register: (t, n, r) =>
|
|
840
|
+
], Tt = Xn.make(...St).middleware(On).middleware(kn), Dt = Ar({ resolveSubject: ({ headers: t, clientId: n }) => e.resolveSubject(t, n) }), Ot = e.dormancyTenantId ?? rr, kt = e.dormancy === "sleep" ? {
|
|
841
|
+
register: (t, n, r) => Jr(e.store, {
|
|
738
842
|
tenantId: r ?? Ot,
|
|
739
843
|
kind: "workflow",
|
|
740
844
|
refId: t,
|
|
741
845
|
wakeAt: n
|
|
742
846
|
}),
|
|
743
|
-
cancel: (t, n) =>
|
|
847
|
+
cancel: (t, n) => hr(e.store, {
|
|
744
848
|
tenantId: n ?? Ot,
|
|
745
849
|
kind: "workflow",
|
|
746
850
|
refId: t
|
|
@@ -761,15 +865,15 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
761
865
|
interruptChild: async (t, n) => {
|
|
762
866
|
let r = (e.discovered.workflows ?? []).find((e) => e.definition.name === t);
|
|
763
867
|
if (!r) throw Error(`Unknown child workflow: ${t}`);
|
|
764
|
-
if (!
|
|
765
|
-
await
|
|
868
|
+
if (!f) throw Error("Workflow runtime is not ready");
|
|
869
|
+
await f.runPromise(r.definition.interrupt(n));
|
|
766
870
|
}
|
|
767
871
|
});
|
|
768
872
|
}, Nt = async (t, n, r) => {
|
|
769
873
|
let i = (await e.store.query({
|
|
770
874
|
table: "_voltro_workflow_runs",
|
|
771
875
|
order: [],
|
|
772
|
-
predicate:
|
|
876
|
+
predicate: G("executionId", n),
|
|
773
877
|
projection: void 0,
|
|
774
878
|
skip: void 0,
|
|
775
879
|
take: 1
|
|
@@ -791,7 +895,7 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
791
895
|
}
|
|
792
896
|
}), a && await Mt(n, "cancelled");
|
|
793
897
|
}, Pt = [
|
|
794
|
-
...
|
|
898
|
+
...Ur(e.discovered.workflows ?? [], {
|
|
795
899
|
buildContext: (t, n) => e.buildContextForWorkflow?.(t, n) ?? C({
|
|
796
900
|
subject: t.subject,
|
|
797
901
|
traceId: t.traceId
|
|
@@ -814,33 +918,33 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
814
918
|
onParentClose: ({ executionId: e, status: t }) => Mt(e, t),
|
|
815
919
|
...Ge(t.definition),
|
|
816
920
|
onTerminal: async ({ executionId: e }) => {
|
|
817
|
-
await
|
|
921
|
+
await d?.gate.release(e);
|
|
818
922
|
},
|
|
819
923
|
recorder: N,
|
|
820
924
|
pluginWorkflowStepLayer: Qe,
|
|
821
|
-
recordRun:
|
|
925
|
+
recordRun: qr
|
|
822
926
|
}, n);
|
|
823
927
|
}),
|
|
824
928
|
...e.discovered.workflowWorkers ?? [],
|
|
825
929
|
...Se === void 0 ? [] : [Se]
|
|
826
|
-
], It = [...(e.discovered.workflows ?? []).map((e) => e.definition.name).filter(Boolean), ...Se === void 0 ? [] : ["voltro.deliverWebhook"]], Lt = Pt.length > 0 ?
|
|
930
|
+
], It = [...(e.discovered.workflows ?? []).map((e) => e.definition.name).filter(Boolean), ...Se === void 0 ? [] : ["voltro.deliverWebhook"]], Lt = Pt.length > 0 ? U.mergeAll(...Pt) : U.empty;
|
|
827
931
|
if (((e.discovered.workflows?.length ?? 0) > 0 || (e.discovered.workflowWorkers?.length ?? 0) > 0 || e.scheduleCoordination === "cluster" || Se !== void 0) && e.workflowEngineLayer !== void 0) {
|
|
828
|
-
let t = Lt.pipe(
|
|
829
|
-
|
|
830
|
-
let n = await import("@voltro/workflow/cluster"), r = (e) =>
|
|
932
|
+
let t = Lt.pipe(U.provideMerge(e.workflowEngineLayer));
|
|
933
|
+
f = Wn.make(e.baseLayer === void 0 ? t : t.pipe(U.provideMerge(e.baseLayer))), await f.runPromise(H.void), (e.log ?? L({ scope: "voltro:serve" })).child("workflow").info(`workflow runtime ready — ${It.length} entity type(s) registered`, { entities: It });
|
|
934
|
+
let n = await import("@voltro/workflow/cluster"), r = (e) => f.runPromise(n.redriveFailedRun(e)), i = (e) => f.runPromise(n.resumeRunFromStep(e));
|
|
831
935
|
re = await j({
|
|
832
|
-
provider:
|
|
833
|
-
crossReplica:
|
|
936
|
+
provider: Di(e.plugins ?? [])?.broadcast?.provider,
|
|
937
|
+
crossReplica: Di(e.plugins ?? [])?.broadcast?.crossReplica ?? !1,
|
|
834
938
|
namespace: Me,
|
|
835
939
|
replicaId: crypto.randomUUID(),
|
|
836
|
-
pollStorage: () =>
|
|
940
|
+
pollStorage: () => f.runPromise(n.pollWorkflowStorage),
|
|
837
941
|
onChange: (t) => e.store.onChange((e) => t({
|
|
838
942
|
table: e.table,
|
|
839
943
|
op: e.op,
|
|
840
944
|
...e.origin === void 0 ? {} : { origin: e.origin }
|
|
841
945
|
})),
|
|
842
946
|
log: (e.log ?? L({ scope: "voltro:serve" })).child("workflow")
|
|
843
|
-
}),
|
|
947
|
+
}), te = async (t) => {
|
|
844
948
|
let n = await oe({
|
|
845
949
|
store: e.store,
|
|
846
950
|
workflows: e.discovered.workflows ?? [],
|
|
@@ -858,7 +962,7 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
858
962
|
activitiesReset: n.outcome.activitiesReset,
|
|
859
963
|
reason: n.outcome.reason
|
|
860
964
|
};
|
|
861
|
-
},
|
|
965
|
+
}, ne = async (t) => {
|
|
862
966
|
let n = await Oe({
|
|
863
967
|
store: e.store,
|
|
864
968
|
workflows: e.discovered.workflows ?? [],
|
|
@@ -879,7 +983,7 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
879
983
|
reason: n.outcome.reason
|
|
880
984
|
};
|
|
881
985
|
};
|
|
882
|
-
let a = (e.scheduleCoordination ?? "single") === "advisoryLock" ?
|
|
986
|
+
let a = (e.scheduleCoordination ?? "single") === "advisoryLock" ? Tr(e.store, e.scheduleReplicaId ?? `pid-${process.pid}`) : ei, s = jr({
|
|
883
987
|
coordinator: a,
|
|
884
988
|
replicaId: e.scheduleReplicaId ?? `pid-${process.pid}`
|
|
885
989
|
}), l = {
|
|
@@ -899,12 +1003,12 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
899
1003
|
log: I,
|
|
900
1004
|
workflows: e.discovered.workflows ?? [],
|
|
901
1005
|
workflowsProxy: o,
|
|
902
|
-
workflowRuntime:
|
|
1006
|
+
workflowRuntime: f,
|
|
903
1007
|
workflowRunRecorder: N,
|
|
904
1008
|
closeChildrenForParent: Mt
|
|
905
1009
|
}), u;
|
|
906
1010
|
};
|
|
907
|
-
ee = p,
|
|
1011
|
+
ee = p, d = tt({
|
|
908
1012
|
store: e.store,
|
|
909
1013
|
onChange: (t) => e.store.onChange((e) => t({
|
|
910
1014
|
table: e.table,
|
|
@@ -933,8 +1037,8 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
933
1037
|
},
|
|
934
1038
|
log: l
|
|
935
1039
|
});
|
|
936
|
-
let m =
|
|
937
|
-
m !== void 0 &&
|
|
1040
|
+
let m = d;
|
|
1041
|
+
m !== void 0 && Gr(() => m.stop()), c = qe({
|
|
938
1042
|
store: e.store,
|
|
939
1043
|
onChange: (t) => e.store.onChange((e) => t({
|
|
940
1044
|
table: e.table,
|
|
@@ -945,22 +1049,22 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
945
1049
|
tickIntervalMs: e.scheduling.inferenceTickMs
|
|
946
1050
|
},
|
|
947
1051
|
enabled: (e.discovered.workflows?.length ?? 0) > 0,
|
|
948
|
-
resumeSignal: () =>
|
|
949
|
-
await
|
|
1052
|
+
resumeSignal: () => f === void 0 || M === void 0 ? void 0 : async ({ executionId: t, workflowName: n, signalName: r, payload: i }) => {
|
|
1053
|
+
await f.runPromise(M.completeSuspendingSignal({
|
|
950
1054
|
store: e.store,
|
|
951
1055
|
target: At(t, n),
|
|
952
1056
|
signalName: r,
|
|
953
1057
|
payload: i
|
|
954
1058
|
}));
|
|
955
1059
|
},
|
|
956
|
-
runEffect: (e) =>
|
|
1060
|
+
runEffect: (e) => f.runPromise(e),
|
|
957
1061
|
scheduleCoordinated: s,
|
|
958
1062
|
log: l
|
|
959
1063
|
});
|
|
960
1064
|
let h = c;
|
|
961
|
-
h !== void 0 &&
|
|
1065
|
+
h !== void 0 && Gr(() => h.stop()), o = (e.discovered.workflows?.length ?? 0) > 0 ? Vr({
|
|
962
1066
|
workflows: e.discovered.workflows ?? [],
|
|
963
|
-
runEffect: (e) =>
|
|
1067
|
+
runEffect: (e) => f.runPromise(e),
|
|
964
1068
|
onEnqueue: () => re?.publishWake(),
|
|
965
1069
|
...m === void 0 ? {} : {
|
|
966
1070
|
admitStart: m.gate.admitStart,
|
|
@@ -976,7 +1080,7 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
976
1080
|
signalName: n,
|
|
977
1081
|
payload: r
|
|
978
1082
|
});
|
|
979
|
-
return await
|
|
1083
|
+
return await f.runPromise(M.completeSuspendingSignal({
|
|
980
1084
|
store: e.store,
|
|
981
1085
|
target: t,
|
|
982
1086
|
signalName: n,
|
|
@@ -995,7 +1099,7 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
995
1099
|
retry: (t, n) => je({
|
|
996
1100
|
store: e.store,
|
|
997
1101
|
workflows: e.discovered.workflows ?? [],
|
|
998
|
-
runPromise: (e) =>
|
|
1102
|
+
runPromise: (e) => f.runPromise(e)
|
|
999
1103
|
}, t, n),
|
|
1000
1104
|
redrive: (t) => oe({
|
|
1001
1105
|
store: e.store,
|
|
@@ -1004,13 +1108,13 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
1004
1108
|
}, t).then((e) => e.outcome)
|
|
1005
1109
|
}) : void 0;
|
|
1006
1110
|
}
|
|
1007
|
-
let Bt =
|
|
1111
|
+
let Bt = U.mergeAll(Tt.toLayer(k), Dt), Vt = xt(k, e.discovered.queries.map((e) => e.descriptor.name), he), Ht = U.mergeAll(Tt.toLayer(Vt), Dt), P = e.observability, F = await mr({
|
|
1008
1112
|
...e.appName === void 0 ? {} : { serviceName: e.appName },
|
|
1009
1113
|
...P && P.spanProcessors.length > 0 ? { extraSpanProcessors: P.spanProcessors } : {},
|
|
1010
1114
|
...P && P.metricReaders.length > 0 ? { extraMetricReaders: P.metricReaders } : {},
|
|
1011
1115
|
...P && Object.keys(P.resourceAttributes).length > 0 ? { resourceAttributes: P.resourceAttributes } : {},
|
|
1012
1116
|
...P && P.sampler !== void 0 ? { sampler: P.sampler } : {}
|
|
1013
|
-
}), Ut = !1, Wt = e.store.ping ? () => e.store.ping().then(() => !0).catch(() => !1) : void 0, { server: Gt, shutdown: Kt } =
|
|
1117
|
+
}), Ut = !1, Wt = e.store.ping ? () => e.store.ping().then(() => !0).catch(() => !1) : void 0, { server: Gt, shutdown: Kt } = ti({
|
|
1014
1118
|
group: Tt,
|
|
1015
1119
|
handlersLayer: Bt,
|
|
1016
1120
|
httpHandlersLayer: Ht,
|
|
@@ -1028,10 +1132,10 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
1028
1132
|
...e.getStore === void 0 ? {} : { getStore: e.getStore },
|
|
1029
1133
|
...Ce.size > 0 ? { webhookRoutes: Ce } : {},
|
|
1030
1134
|
...e.inspectRoute === void 0 ? {} : { inspectRoute: e.inspectRoute }
|
|
1031
|
-
}), qt =
|
|
1032
|
-
if (await
|
|
1033
|
-
let t = (e.scheduleCoordination ?? "single") === "advisoryLock" ?
|
|
1034
|
-
ce = await
|
|
1135
|
+
}), qt = Li(Gt);
|
|
1136
|
+
if (await fr(Gt), (e.discovered.schedules?.length ?? 0) > 0) {
|
|
1137
|
+
let t = (e.scheduleCoordination ?? "single") === "advisoryLock" ? Tr(e.store, e.scheduleReplicaId ?? `pid-${process.pid}`) : ei;
|
|
1138
|
+
ce = await ni(e.discovered.schedules ?? [], {
|
|
1035
1139
|
store: e.store,
|
|
1036
1140
|
coordinator: t,
|
|
1037
1141
|
defaultTrigger: e.scheduleDefaultTrigger ?? "self",
|
|
@@ -1068,7 +1172,7 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
1068
1172
|
return;
|
|
1069
1173
|
}
|
|
1070
1174
|
let e = n.payload === void 0 ? r.new ?? r.old ?? {} : n.payload(r);
|
|
1071
|
-
await
|
|
1175
|
+
await Hr(v, {
|
|
1072
1176
|
traceId: `reaction:${n.workflow}`,
|
|
1073
1177
|
source: `reaction:${n.workflow}`
|
|
1074
1178
|
}).start(n.workflow, e);
|
|
@@ -1077,14 +1181,14 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
1077
1181
|
await ot(n.agent, r, {
|
|
1078
1182
|
findAgentSend: (t) => e.discovered.actions.find((e) => e.descriptor.name === `${t}.send`),
|
|
1079
1183
|
runAction: (e, t, n) => Promise.resolve(it(e, t, n)),
|
|
1080
|
-
makeSubject: (e) =>
|
|
1184
|
+
makeSubject: (e) => An(e),
|
|
1081
1185
|
now: () => Date.now(),
|
|
1082
1186
|
log: t
|
|
1083
1187
|
});
|
|
1084
1188
|
}, r = async (n, r) => {
|
|
1085
1189
|
try {
|
|
1086
1190
|
let { requireAiBudget: t } = await import("@voltro/ai");
|
|
1087
|
-
return (await
|
|
1191
|
+
return (await H.runPromise(H.either(t(e.store, {
|
|
1088
1192
|
tenantId: n,
|
|
1089
1193
|
limitUsd: r
|
|
1090
1194
|
}))))._tag === "Right";
|
|
@@ -1106,22 +1210,22 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
1106
1210
|
...e.analytics === void 0 ? {} : { analytics: e.analytics },
|
|
1107
1211
|
...e.aggregateStorage === void 0 ? {} : { storage: e.aggregateStorage },
|
|
1108
1212
|
...e.aggregateCoordinator === void 0 ? {} : { coordinator: e.aggregateCoordinator }
|
|
1109
|
-
}), Ve =
|
|
1213
|
+
}), Ve = U.succeed(nr, Xt.registry));
|
|
1110
1214
|
let Zt;
|
|
1111
|
-
(e.discovered.expectations?.length ?? 0) > 0 && (Zt =
|
|
1215
|
+
(e.discovered.expectations?.length ?? 0) > 0 && (Zt = lr({
|
|
1112
1216
|
discovered: e.discovered.expectations ?? [],
|
|
1113
1217
|
store: e.store,
|
|
1114
1218
|
log: I.child("expectation")
|
|
1115
|
-
}), He =
|
|
1219
|
+
}), He = U.succeed(ar, Zt.registry)), (e.discovered.budgets?.length ?? 0) > 0 && (n = dr({
|
|
1116
1220
|
discovered: e.discovered.budgets ?? [],
|
|
1117
1221
|
log: I.child("finops")
|
|
1118
|
-
}), We =
|
|
1222
|
+
}), We = U.succeed(K, n.registry));
|
|
1119
1223
|
let Qt;
|
|
1120
|
-
return (e.discovered.experiments?.length ?? 0) > 0 && (Qt =
|
|
1224
|
+
return (e.discovered.experiments?.length ?? 0) > 0 && (Qt = ur({
|
|
1121
1225
|
discovered: e.discovered.experiments ?? [],
|
|
1122
1226
|
store: e.store,
|
|
1123
1227
|
log: I.child("experiment")
|
|
1124
|
-
}), Ke =
|
|
1228
|
+
}), Ke = U.succeed(or, Qt.registry)), Ut = !0, e.bootTiming?.mark("ready"), {
|
|
1125
1229
|
dispatcher: r,
|
|
1126
1230
|
server: Gt,
|
|
1127
1231
|
scheduler: ce,
|
|
@@ -1134,19 +1238,19 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
1134
1238
|
rpcMetrics: () => T,
|
|
1135
1239
|
webhooksService: () => xe,
|
|
1136
1240
|
runCanceller: () => ee(),
|
|
1137
|
-
flowControlHealth: () =>
|
|
1241
|
+
flowControlHealth: () => d?.cancelHealth(),
|
|
1138
1242
|
inferenceHealth: () => c?.health(),
|
|
1139
1243
|
workflowWriteActions: () => v === void 0 || N === void 0 ? void 0 : se({
|
|
1140
1244
|
store: e.store,
|
|
1141
1245
|
log: I,
|
|
1142
1246
|
workflows: e.discovered.workflows ?? [],
|
|
1143
1247
|
workflowsProxy: o,
|
|
1144
|
-
workflowRuntime:
|
|
1248
|
+
workflowRuntime: f,
|
|
1145
1249
|
workflowRunRecorder: N,
|
|
1146
1250
|
closeChildrenForParent: Mt
|
|
1147
1251
|
}),
|
|
1148
|
-
redriveWorkflowRun: (e) =>
|
|
1149
|
-
resumeWorkflowRunFromStep: (e) =>
|
|
1252
|
+
redriveWorkflowRun: (e) => te ? te(e) : Promise.reject(/* @__PURE__ */ Error("redrive: this app registers no workflows")),
|
|
1253
|
+
resumeWorkflowRunFromStep: (e) => ne ? ne(e) : Promise.reject(/* @__PURE__ */ Error("resume-from-step: this app registers no workflows")),
|
|
1150
1254
|
close: async () => {
|
|
1151
1255
|
Ut = !1, await qt.drainRequests();
|
|
1152
1256
|
for (let e of we) try {
|
|
@@ -1154,27 +1258,27 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
1154
1258
|
} catch (e) {
|
|
1155
1259
|
I.warn("serve: teardown step failed", {}, e);
|
|
1156
1260
|
}
|
|
1157
|
-
await Be?.detach(), await ze.detach(), Xt?.detach(), Zt?.detach(), n?.detach(), Qt?.detach(), Yt?.(), Jt?.(), await ce?.shutdown(), r.close(), await re?.detach(), await
|
|
1261
|
+
await Be?.detach(), await ze.detach(), Xt?.detach(), Zt?.detach(), n?.detach(), Qt?.detach(), Yt?.(), Jt?.(), await ce?.shutdown(), r.close(), await re?.detach(), await f?.dispose(), await Kt(), await qt.finish();
|
|
1158
1262
|
}
|
|
1159
1263
|
};
|
|
1160
|
-
}, $ = L({ scope: "voltro:serve" }),
|
|
1264
|
+
}, $ = L({ scope: "voltro:serve" }), da = (e, t, n) => (e === "production" || e === "staging") && t !== "memory" && n !== "0", fa = Bt, pa = async (e) => {
|
|
1161
1265
|
let t = yn(process.cwd());
|
|
1162
|
-
if (
|
|
1266
|
+
if (En(t)) {
|
|
1163
1267
|
let n;
|
|
1164
1268
|
try {
|
|
1165
|
-
let e = await import(
|
|
1269
|
+
let e = await import(Dn(t).href);
|
|
1166
1270
|
typeof e.runServe == "function" ? n = e.runServe : $.warn("serve bundle has no runServe export — using the standard serve path");
|
|
1167
1271
|
} catch (e) {
|
|
1168
1272
|
$.warn("serve bundle failed to load — using the standard serve path", {}, e);
|
|
1169
1273
|
}
|
|
1170
1274
|
if (n) return $.info("serve: booting from the precompiled serve bundle"), n(e);
|
|
1171
1275
|
}
|
|
1172
|
-
return
|
|
1173
|
-
},
|
|
1276
|
+
return ma(e);
|
|
1277
|
+
}, ma = async (s) => {
|
|
1174
1278
|
let l = bn();
|
|
1175
1279
|
e("serve");
|
|
1176
1280
|
try {
|
|
1177
|
-
|
|
1281
|
+
hi();
|
|
1178
1282
|
} catch (e) {
|
|
1179
1283
|
throw i(e instanceof Error ? e.message : String(e));
|
|
1180
1284
|
}
|
|
@@ -1182,11 +1286,11 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
1182
1286
|
kind: "api",
|
|
1183
1287
|
configPort: p?.port,
|
|
1184
1288
|
env: process.env,
|
|
1185
|
-
flagPort:
|
|
1289
|
+
flagPort: fa(s, "--port")
|
|
1186
1290
|
});
|
|
1187
1291
|
for (let e of ie.warnings) $.warn(e);
|
|
1188
1292
|
let m = ie.port;
|
|
1189
|
-
|
|
1293
|
+
Zr(Yr(p?.secrets)), await Ht({
|
|
1190
1294
|
rawEnv: p?.env,
|
|
1191
1295
|
appType: "api",
|
|
1192
1296
|
root: u,
|
|
@@ -1194,11 +1298,11 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
1194
1298
|
generateTypes: !1
|
|
1195
1299
|
}), l.mark("config");
|
|
1196
1300
|
let h = (process.env.DB_DIALECT ?? p?.store ?? "memory").toLowerCase(), ae = (h === "mariadb" || h === "postgres" || h === "mssql") && (process.env.CDC ?? "1") !== "0", oe = h === "mariadb" ? "mariadb" : h === "mssql" ? "mssql" : void 0, se = vn(u);
|
|
1197
|
-
if (!r() &&
|
|
1198
|
-
let e = await import(
|
|
1301
|
+
if (!r() && En(se)) try {
|
|
1302
|
+
let e = await import(Dn(se).href);
|
|
1199
1303
|
if (e.modules) {
|
|
1200
1304
|
let t = {};
|
|
1201
|
-
for (let [n, r] of Object.entries(e.modules)) t[
|
|
1305
|
+
for (let [n, r] of Object.entries(e.modules)) t[wn(u, n)] = r;
|
|
1202
1306
|
n(t), $.info("precompiled api bundle loaded", { modules: Object.keys(t).length });
|
|
1203
1307
|
}
|
|
1204
1308
|
} catch (e) {
|
|
@@ -1217,7 +1321,7 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
1217
1321
|
..._.actions.map((e) => e.descriptor.name),
|
|
1218
1322
|
..._.streams.map((e) => e.descriptor.name)
|
|
1219
1323
|
], e);
|
|
1220
|
-
let t = Me(_.serverOnlyLeaks, b(process.env, "strict"),
|
|
1324
|
+
let t = Me(_.serverOnlyLeaks, b(process.env, "strict"), vr, "`voltro serve`");
|
|
1221
1325
|
if (t.action === "fail") throw i(t.message ?? "");
|
|
1222
1326
|
t.action === "warn" && $.warn(t.message ?? "");
|
|
1223
1327
|
}
|
|
@@ -1236,7 +1340,7 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
1236
1340
|
gates: ke,
|
|
1237
1341
|
runtime: {
|
|
1238
1342
|
traces: ve(),
|
|
1239
|
-
undo:
|
|
1343
|
+
undo: ii()
|
|
1240
1344
|
}
|
|
1241
1345
|
});
|
|
1242
1346
|
if (je !== void 0) throw i(`serve: ${je}`);
|
|
@@ -1254,9 +1358,9 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
1254
1358
|
for (let n of [...Ne, ...Le.tables]) e.has(n.tableName) || (e.add(n.tableName), t.push(n));
|
|
1255
1359
|
return t;
|
|
1256
1360
|
})();
|
|
1257
|
-
for (let e of x)
|
|
1361
|
+
for (let e of x) er(e);
|
|
1258
1362
|
{
|
|
1259
|
-
let e =
|
|
1363
|
+
let e = yr(ai(_.queries.map((e) => ({
|
|
1260
1364
|
name: e.descriptor.name,
|
|
1261
1365
|
source: e.descriptor.source
|
|
1262
1366
|
})), new Set(x.flatMap((e) => {
|
|
@@ -1266,20 +1370,20 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
1266
1370
|
e !== void 0 && $.warn(e);
|
|
1267
1371
|
}
|
|
1268
1372
|
let Re = (process.env.NODE_ENV ?? "").toLowerCase();
|
|
1269
|
-
if (
|
|
1270
|
-
let e = (await F(h)).makeSqlLayer(A()), t = await
|
|
1373
|
+
if (da(Re, h, process.env.VOLTRO_AUTO_MIGRATE)) {
|
|
1374
|
+
let e = (await F(h)).makeSqlLayer(A()), t = await H.runPromise(Gn.SqlClient.pipe(H.flatMap((e) => Jn(e, u)), H.provide(e), H.catchAll(() => H.succeed([]))));
|
|
1271
1375
|
t.length > 0 && ($.error(`serve: refusing to boot — ${t.length} pending file-based migration(s) have never run against this database. They perform the changes a schema diff cannot infer (data moves, backfills, table splits), so the declarative fingerprint check below cannot see them and would have let this process serve un-migrated data.`, { pending: t }), $.error("Run them from your pre-deploy job — `voltro db migrate .` (schema + files) or `voltro db files .` (files alone) — or set VOLTRO_AUTO_MIGRATE=0 to bypass every boot schema check. `voltro serve` never applies them itself: a rolling deploy would start N replicas and each would try."), process.exit(1));
|
|
1272
|
-
let n = await
|
|
1376
|
+
let n = await H.runPromise(Gn.SqlClient.pipe(H.flatMap((e) => Yn(e, x, {
|
|
1273
1377
|
appliedBy: `serve:${Re}`,
|
|
1274
1378
|
environment: "prod",
|
|
1275
1379
|
dialectId: h
|
|
1276
|
-
})),
|
|
1277
|
-
n.kind === "prod-mismatch" && ($.error(
|
|
1380
|
+
})), H.provide(e)));
|
|
1381
|
+
n.kind === "prod-mismatch" && ($.error(qn(n, h)), $.error(Qt({
|
|
1278
1382
|
gates: ke,
|
|
1279
1383
|
nodeEnv: process.env.NODE_ENV,
|
|
1280
1384
|
cdcDialect: oe,
|
|
1281
1385
|
declared: p?.schema
|
|
1282
|
-
})), $.error("serve: refusing to boot — apply the schema first (voltro db apply in a pre-deploy step), or set VOLTRO_AUTO_MIGRATE=0 to bypass this check."), process.exit(1)), $.info(
|
|
1386
|
+
})), $.error("serve: refusing to boot — apply the schema first (voltro db apply in a pre-deploy step), or set VOLTRO_AUTO_MIGRATE=0 to bypass this check."), process.exit(1)), $.info(qn(n, h));
|
|
1283
1387
|
}
|
|
1284
1388
|
await qt({
|
|
1285
1389
|
dialectId: h,
|
|
@@ -1292,14 +1396,14 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
1292
1396
|
warn: (e, t) => $.warn(e, t ?? {})
|
|
1293
1397
|
}
|
|
1294
1398
|
});
|
|
1295
|
-
let Ue =
|
|
1399
|
+
let Ue = Br(x);
|
|
1296
1400
|
l.mark("discover");
|
|
1297
|
-
let w = await nt(p, void 0), Ge =
|
|
1401
|
+
let w = await nt(p, void 0), Ge = ci(w, h);
|
|
1298
1402
|
for (let e of dt({
|
|
1299
1403
|
dialect: String(p?.store ?? process.env.DB_DIALECT ?? "postgres"),
|
|
1300
1404
|
changeStrategy: (process.env.CDC ?? "1") === "0" ? "inline" : "cdc",
|
|
1301
1405
|
dbUrl: process.env.DB_URL,
|
|
1302
|
-
crossReplicaBus:
|
|
1406
|
+
crossReplicaBus: Di(p?.plugins ?? [])?.broadcast.crossReplica === !0,
|
|
1303
1407
|
tables: _.tables.map((e) => ({
|
|
1304
1408
|
tableName: e.tableName,
|
|
1305
1409
|
isReactive: e.isReactive === !0
|
|
@@ -1311,7 +1415,7 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
1311
1415
|
})) e.level === "warn" ? $.warn(e.message) : $.info(e.message);
|
|
1312
1416
|
{
|
|
1313
1417
|
let e = E({
|
|
1314
|
-
tables:
|
|
1418
|
+
tables: Zn().map((e) => ({ tableName: e.tableName })),
|
|
1315
1419
|
queries: _.queries.map((e) => ({
|
|
1316
1420
|
name: e.descriptor.name,
|
|
1317
1421
|
source: e.descriptor.source
|
|
@@ -1325,7 +1429,7 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
1325
1429
|
semantic: p?.cacheSemantic ?? !1
|
|
1326
1430
|
});
|
|
1327
1431
|
lt !== void 0 && $.info("semantic cache enabled — reactive eviction on live writes"), $.info(`cache backend resolved: ${vt}` + (vt === "redis" ? ` (driver ${process.env.CACHE_REDIS_DRIVER ?? "resp"})` : " — in-process, not cross-instance")), w.onChange((e) => {
|
|
1328
|
-
if (
|
|
1432
|
+
if (H.runFork(tt.publish(e.table)), pt !== void 0) {
|
|
1329
1433
|
let t = (e.new ?? e.old)?.id;
|
|
1330
1434
|
pt({
|
|
1331
1435
|
table: e.table,
|
|
@@ -1334,7 +1438,7 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
1334
1438
|
});
|
|
1335
1439
|
}
|
|
1336
1440
|
}), p?.kv && !process.env.KV_BACKEND && (process.env.KV_BACKEND = p.kv), p?.kvRedisUrl && !process.env.KV_REDIS_URL && (process.env.KV_REDIS_URL = p.kvRedisUrl), p?.kvKeyPrefix && !process.env.KV_KEY_PREFIX && (process.env.KV_KEY_PREFIX = p.kvKeyPrefix);
|
|
1337
|
-
let { kv: Ct, service: wt } = await
|
|
1441
|
+
let { kv: Ct, service: wt } = await kr({ store: w });
|
|
1338
1442
|
He({
|
|
1339
1443
|
log: $,
|
|
1340
1444
|
max: Wt(),
|
|
@@ -1342,7 +1446,7 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
1342
1446
|
readPools: t.replicationSnapshot()?.replicaCount ?? 0,
|
|
1343
1447
|
always: !0
|
|
1344
1448
|
}), l.mark("store");
|
|
1345
|
-
let Et =
|
|
1449
|
+
let Et = cr({
|
|
1346
1450
|
store: w,
|
|
1347
1451
|
sink: Le.sink,
|
|
1348
1452
|
log: $
|
|
@@ -1351,79 +1455,79 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
1351
1455
|
dialect: h,
|
|
1352
1456
|
log: { info: (e) => $.info(e) }
|
|
1353
1457
|
}), j = p?.plugins ?? [], Ft = process.env.POD_NAME ?? process.env.HOSTNAME ?? `serve-${process.pid}`, Rt, zt;
|
|
1354
|
-
h !== "memory" && (Rt =
|
|
1458
|
+
h !== "memory" && (Rt = Wn.make((await F(h)).makeSqlLayer(A())), zt = await Rt.runPromise(Gn.SqlClient));
|
|
1355
1459
|
let Bt = [
|
|
1356
1460
|
"postgres",
|
|
1357
1461
|
"mariadb",
|
|
1358
1462
|
"mysql",
|
|
1359
1463
|
"mssql"
|
|
1360
|
-
].includes(h) ?
|
|
1464
|
+
].includes(h) ? Tr(w, Ft, $) : ei, mn = S(p?.scheduling), yn = jr({
|
|
1361
1465
|
maxIdleIntervalMs: mn.pollCeilingMs,
|
|
1362
1466
|
coordinator: Bt,
|
|
1363
1467
|
replicaId: Ft,
|
|
1364
1468
|
log: $
|
|
1365
|
-
}), xn = [],
|
|
1469
|
+
}), xn = [], Sn = process.env.POD_NAME ?? process.env.HOSTNAME ?? `serve-${process.pid}`, Tn = Di(p?.plugins ?? [])?.broadcast?.provider, L = Ze(p?.plugins, p?.name ?? Cn(u));
|
|
1366
1470
|
{
|
|
1367
|
-
let e = et(p?.plugins, p?.name ??
|
|
1471
|
+
let e = et(p?.plugins, p?.name ?? Cn(u));
|
|
1368
1472
|
e !== void 0 && $.warn(e);
|
|
1369
1473
|
}
|
|
1370
|
-
let
|
|
1371
|
-
instanceId:
|
|
1372
|
-
namespace:
|
|
1474
|
+
let On = jt(p?.plugins, {
|
|
1475
|
+
instanceId: Sn,
|
|
1476
|
+
namespace: L,
|
|
1373
1477
|
meta: { mode: "serve" },
|
|
1374
1478
|
logger: $
|
|
1375
|
-
}),
|
|
1479
|
+
}), kn = {
|
|
1376
1480
|
...zt ? { sql: zt } : {},
|
|
1377
|
-
instanceId:
|
|
1378
|
-
membership:
|
|
1379
|
-
...
|
|
1380
|
-
broadcastChannels: { presence:
|
|
1481
|
+
instanceId: Sn,
|
|
1482
|
+
membership: On.membership,
|
|
1483
|
+
...Tn === void 0 ? {} : { broadcast: Tn },
|
|
1484
|
+
broadcastChannels: { presence: Ei(L, "presence") },
|
|
1381
1485
|
scheduleCoordinated: (e, t, n) => {
|
|
1382
1486
|
let r = yn(e, t, n);
|
|
1383
1487
|
return xn.push(r), r;
|
|
1384
1488
|
}
|
|
1385
1489
|
};
|
|
1386
|
-
for (let e of j) e.bindDataStore?.(Ge,
|
|
1490
|
+
for (let e of j) e.bindDataStore?.(Ge, kn);
|
|
1387
1491
|
c({
|
|
1388
1492
|
store: w,
|
|
1389
1493
|
...st(),
|
|
1390
1494
|
log: $
|
|
1391
1495
|
});
|
|
1392
|
-
let
|
|
1393
|
-
if (
|
|
1496
|
+
let R = j.filter((e) => typeof e.onChangeEvent == "function");
|
|
1497
|
+
if (R.length > 0) {
|
|
1394
1498
|
let e = w.changeScope ?? "local";
|
|
1395
1499
|
w.onChange((t) => {
|
|
1396
1500
|
let n = he(t, e);
|
|
1397
|
-
for (let e of
|
|
1501
|
+
for (let e of R) H.runFork(e.onChangeEvent(n).pipe(H.catchAllCause((t) => H.sync(() => $.warn(`plugin ${e.name} onChangeEvent failed`, { error: Un.pretty(t) })))));
|
|
1398
1502
|
});
|
|
1399
1503
|
}
|
|
1400
|
-
let
|
|
1504
|
+
let An = le({
|
|
1401
1505
|
plugins: j,
|
|
1402
1506
|
appName: p?.name ?? "voltro-api",
|
|
1403
1507
|
appType: "api",
|
|
1404
1508
|
voltroVersion: process.env.npm_package_version ?? "0.0.0",
|
|
1405
1509
|
log: $
|
|
1406
1510
|
});
|
|
1407
|
-
j.length && await
|
|
1408
|
-
let
|
|
1511
|
+
j.length && await An.activate(), l.mark("plugins");
|
|
1512
|
+
let jn = await An.gatherObservability(), Mn = {
|
|
1409
1513
|
info: (e, t) => process.stdout.write(`[broadcast] ${e} ${t ? JSON.stringify(t) : ""}\n`),
|
|
1410
1514
|
warn: (e, t) => process.stderr.write(`[broadcast] ${e} ${t ? JSON.stringify(t) : ""}\n`),
|
|
1411
1515
|
debug: () => {}
|
|
1412
|
-
},
|
|
1413
|
-
|
|
1414
|
-
}),
|
|
1415
|
-
|
|
1416
|
-
let
|
|
1417
|
-
prefix:
|
|
1418
|
-
...
|
|
1419
|
-
}) : void 0,
|
|
1516
|
+
}, z, Nn = await ht(w, p, h, L, Mn, (e, t) => {
|
|
1517
|
+
z?.refreshAll(`broadcast gap: missed ${t} change(s) from ${e}`);
|
|
1518
|
+
}), Pn = p?.apiKeys, Fn = (typeof Pn == "object" ? Pn.prefix : void 0) ?? "voltro_", B = Pn ? _r(w) : void 0, V = B ? Dr({ flush: Or(B) }) : void 0;
|
|
1519
|
+
V && Gr(() => V.shutdown());
|
|
1520
|
+
let In = B ? Er(B, {
|
|
1521
|
+
prefix: Fn,
|
|
1522
|
+
...V ? { usage: V } : {}
|
|
1523
|
+
}) : void 0, Ln = In ? [br(In, { prefix: Fn })] : [], Rn = bt([...p?.auth?.strategies ?? [], ...Ln], wi(p?.plugins ?? []), p?.auth?.anonymousTenantRequired ?? !1, p?.auth, () => Ge), zn = [...p?.restRoutes ?? [], ...In ? sr(In, (typeof Pn == "object" ? Pn.managementPath : void 0) ?? "/v1/api-keys") : []], Bn = k(p?.idempotency, w), Vn = j.map((e) => e.services).filter((e) => e !== void 0), Hn = U.mergeAll(Be({
|
|
1420
1524
|
analyticsLayer: Le.layer,
|
|
1421
1525
|
cacheService: qe,
|
|
1422
1526
|
kvService: wt,
|
|
1423
1527
|
...lt === void 0 ? {} : { semanticCache: lt },
|
|
1424
|
-
pluginServices:
|
|
1528
|
+
pluginServices: Vn,
|
|
1425
1529
|
userLayers: p?.layers ?? []
|
|
1426
|
-
}), rt(p?.http ?? {})),
|
|
1530
|
+
}), rt(p?.http ?? {})), W = await it({
|
|
1427
1531
|
files: g,
|
|
1428
1532
|
store: w,
|
|
1429
1533
|
log: $,
|
|
@@ -1435,47 +1539,47 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
1435
1539
|
runStartups: o,
|
|
1436
1540
|
emailPattern: C,
|
|
1437
1541
|
loadEmailFiles: mt,
|
|
1438
|
-
registerEmailTemplates:
|
|
1542
|
+
registerEmailTemplates: Ti
|
|
1439
1543
|
});
|
|
1440
|
-
(
|
|
1441
|
-
startups:
|
|
1442
|
-
emailTemplates:
|
|
1443
|
-
}),
|
|
1444
|
-
await
|
|
1544
|
+
(W.startupCount > 0 || W.emailCount > 0) && $.info("boot lifecycle", {
|
|
1545
|
+
startups: W.startupCount,
|
|
1546
|
+
emailTemplates: W.emailCount
|
|
1547
|
+
}), W.startups !== void 0 && Gr(async () => {
|
|
1548
|
+
await W.startups.stop();
|
|
1445
1549
|
}), ce({
|
|
1446
1550
|
demands: fe(pe),
|
|
1447
|
-
isRegistered: (e) =>
|
|
1551
|
+
isRegistered: (e) => xr(e) !== void 0
|
|
1448
1552
|
});
|
|
1449
|
-
let
|
|
1553
|
+
let Xn = ft({
|
|
1450
1554
|
schedules: St({
|
|
1451
1555
|
schedules: _.schedules,
|
|
1452
|
-
seeds:
|
|
1556
|
+
seeds: W.seeds,
|
|
1453
1557
|
store: w,
|
|
1454
1558
|
log: $.child("seeds")
|
|
1455
1559
|
}),
|
|
1456
1560
|
workflows: _.workflows ?? [],
|
|
1457
1561
|
log: $.child("workflow-schedules")
|
|
1458
|
-
}), Qn = p?.scheduling ?? {},
|
|
1562
|
+
}), Qn = p?.scheduling ?? {}, G = Qn.trigger ?? "self", tr = /* @__PURE__ */ new Set([
|
|
1459
1563
|
"postgres",
|
|
1460
1564
|
"mysql",
|
|
1461
1565
|
"mariadb",
|
|
1462
1566
|
"mssql"
|
|
1463
|
-
]),
|
|
1464
|
-
|
|
1465
|
-
let
|
|
1466
|
-
if (
|
|
1567
|
+
]), nr = Qn.coordination ?? (tr.has(h) ? "advisoryLock" : "single"), K = nr === "cluster" && tr.has(h), rr = K ? "cluster" : nr === "advisoryLock" && tr.has(h) ? "advisoryLock" : "single";
|
|
1568
|
+
nr === "cluster" && !K && $.warn("scheduling.coordination=cluster needs a sql-backed store except sqlite — falling back to single"), nr === "advisoryLock" && !tr.has(h) && $.warn("scheduling.coordination=advisoryLock needs a SQL store (the claim-row gate) — falling back to single");
|
|
1569
|
+
let ir, ar = _.workflows.length > 0 || _.workflowWorkers.length > 0 || _.eventTriggers.length > 0 || (Oe?.outgoing.length ?? 0) > 0 || K, or;
|
|
1570
|
+
if (ar) {
|
|
1467
1571
|
if (h === "mssql") {
|
|
1468
1572
|
let e = await fn(process.cwd());
|
|
1469
1573
|
e && $.warn(e);
|
|
1470
1574
|
}
|
|
1471
|
-
let [{ WorkflowEngine: e }, { makeClusterCronLayer: t, workflowEngineLayer: n, resolveRunnerStorage: r, resolveFailoverTuning: i }] = await Promise.all([import("@effect/workflow"), import("@voltro/workflow/cluster")]), a =
|
|
1575
|
+
let [{ WorkflowEngine: e }, { makeClusterCronLayer: t, workflowEngineLayer: n, resolveRunnerStorage: r, resolveFailoverTuning: i }] = await Promise.all([import("@effect/workflow"), import("@voltro/workflow/cluster")]), a = K ? Xn.filter((e) => (e.trigger ?? G) === "self").map((e) => t({
|
|
1472
1576
|
name: e.name,
|
|
1473
|
-
cron:
|
|
1577
|
+
cron: gr(e),
|
|
1474
1578
|
execute: async () => {
|
|
1475
|
-
await
|
|
1579
|
+
await ir?.fireFromCluster(e.name);
|
|
1476
1580
|
}
|
|
1477
1581
|
})) : [];
|
|
1478
|
-
|
|
1582
|
+
or = h === "memory" ? e.layerMemory : await (async () => {
|
|
1479
1583
|
let e = await F(h), t = r({ sqliteFamily: e.id === "sqlite" || e.id === "turso" });
|
|
1480
1584
|
return $.info(`workflow engine: cluster-${t}, dialect=${e.id}` + (t === "memory" ? " — single-process durable replay, no cross-pod shard handoff" + (e.id !== "sqlite" && e.id !== "turso" ? " (VOLTRO_WORKFLOW_RUNNER_STORAGE=memory: SqlRunnerStorage/cluster_runners + GET_LOCK skipped)" : "") : "")), n({
|
|
1481
1585
|
sqlClientLayer: e.makeSqlLayer(A()),
|
|
@@ -1487,19 +1591,19 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
1487
1591
|
});
|
|
1488
1592
|
})();
|
|
1489
1593
|
}
|
|
1490
|
-
let
|
|
1491
|
-
if (
|
|
1594
|
+
let lr = ue(j, _n()), ur = g.filter((e) => /\.subscribe\.tsx?$/.test(e)), dr = ur.length > 0 ? await xe(ur, $) : [], fr = g.filter((e) => /\.reaction\.tsx?$/.test(e)), q = fr.length > 0 ? await v(fr, $) : [], pr = g.filter((e) => sn.test(e)), J = pr.length > 0 ? await Ie(pr, $) : [], mr = g.filter((e) => /\.aggregate\.tsx?$/.test(e)), hr = mr.length > 0 ? await ne(mr, $) : [], Sr = _e();
|
|
1595
|
+
if (hr.length > 0 && h !== "memory") try {
|
|
1492
1596
|
let e = (await F(h)).makeSqlLayer(A());
|
|
1493
|
-
|
|
1597
|
+
Sr = ct(e);
|
|
1494
1598
|
} catch (e) {
|
|
1495
1599
|
$.warn("aggregate: SQL storage init failed — falling back to in-process", { err: String(e) });
|
|
1496
1600
|
}
|
|
1497
|
-
let
|
|
1601
|
+
let Cr = h === "memory" ? ei : Tr(w, `aggregate@${process.pid}`, $), wr = g.filter((e) => cn.test(e)), Ar = wr.length > 0 ? await f(wr, $) : [], Mr = g.filter((e) => on.test(e)), Nr = Mr.length > 0 ? await Te(Mr, $) : [], Pr = g.filter((e) => an.test(e)), Fr = Pr.length > 0 ? await Mt(Pr, $) : [], Ir = [], Lr = [], Rr = g.filter((e) => $t.test(e));
|
|
1498
1602
|
if (Rr.length > 0) {
|
|
1499
1603
|
let e = $.child("agent"), t = g.filter((e) => Zt.test(e));
|
|
1500
1604
|
t.length > 0 && await nn(t, e);
|
|
1501
1605
|
let n = await Yt(Rr, e);
|
|
1502
|
-
for (let e of n.agents) for (let t of Ye(e)) (t.kind === "action" ?
|
|
1606
|
+
for (let e of n.agents) for (let t of Ye(e)) (t.kind === "action" ? Ir : Lr).push({
|
|
1503
1607
|
file: t.file,
|
|
1504
1608
|
descriptor: t.descriptor,
|
|
1505
1609
|
executor: t.executor
|
|
@@ -1507,15 +1611,15 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
1507
1611
|
n.agents.length > 0 && e.info("synthesized agent routes", { agents: n.agents.map((e) => e.descriptor.name) });
|
|
1508
1612
|
}
|
|
1509
1613
|
l.mark("workflow");
|
|
1510
|
-
let
|
|
1511
|
-
let e =
|
|
1614
|
+
let Y = () => {
|
|
1615
|
+
let e = X.workflowWriteActions();
|
|
1512
1616
|
if (e === void 0) throw Error("workflow actions: this app registers no workflows");
|
|
1513
1617
|
return e;
|
|
1514
|
-
}, zr =
|
|
1618
|
+
}, zr = $n({
|
|
1515
1619
|
dialect: h,
|
|
1516
1620
|
...A()
|
|
1517
|
-
}),
|
|
1518
|
-
sqlLayer:
|
|
1621
|
+
}), Vr = h === "memory" ? void 0 : (await F(h)).makeSqlLayer(A()), Hr = async () => Dt({
|
|
1622
|
+
sqlLayer: Vr,
|
|
1519
1623
|
declared: x,
|
|
1520
1624
|
log: $
|
|
1521
1625
|
}), Ur = {
|
|
@@ -1532,8 +1636,8 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
1532
1636
|
rpc: Qe(_, u),
|
|
1533
1637
|
workflows: ze(_, u),
|
|
1534
1638
|
migrations: Hr,
|
|
1535
|
-
events: () =>
|
|
1536
|
-
agentTools: () =>
|
|
1639
|
+
events: () => X.eventsSnapshot(),
|
|
1640
|
+
agentTools: () => X.agentTools(),
|
|
1537
1641
|
invariantChecks: () => ({
|
|
1538
1642
|
mode: "serve",
|
|
1539
1643
|
accessGate: pe,
|
|
@@ -1541,80 +1645,80 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
1541
1645
|
serverOnlyLeaks: _.serverOnlyLeaks,
|
|
1542
1646
|
migrations: Hr
|
|
1543
1647
|
}),
|
|
1544
|
-
members: () =>
|
|
1648
|
+
members: () => X.membersSnapshot(),
|
|
1545
1649
|
inspectFireSchedule: async ({ name: e, trigger: t }) => {
|
|
1546
|
-
if (!
|
|
1547
|
-
return { runId: await
|
|
1650
|
+
if (!ir) throw Error("scheduler not started — this app registers no self-triggered schedules (all schedules are trigger:'external', or there are none).");
|
|
1651
|
+
return { runId: await ir.fireNow(e, t) ?? null };
|
|
1548
1652
|
},
|
|
1549
1653
|
inspectBackfillSchedule: re({
|
|
1550
|
-
getHandle: () =>
|
|
1551
|
-
getSchedules: () =>
|
|
1654
|
+
getHandle: () => ir,
|
|
1655
|
+
getSchedules: () => Xn
|
|
1552
1656
|
}),
|
|
1553
1657
|
...Oe === void 0 ? {} : { webhooks: () => ge({
|
|
1554
1658
|
store: w,
|
|
1555
1659
|
discoveredWebhooks: Oe
|
|
1556
1660
|
}) },
|
|
1557
1661
|
plugins: () => ({
|
|
1558
|
-
plugins:
|
|
1662
|
+
plugins: An.snapshot(),
|
|
1559
1663
|
capturedAt: Date.now()
|
|
1560
1664
|
}),
|
|
1561
|
-
env: () => P(p?.name ??
|
|
1562
|
-
...p?.env !== void 0 &&
|
|
1665
|
+
env: () => P(p?.name ?? Cn(u), {
|
|
1666
|
+
...p?.env !== void 0 && mi(p.env) ? { contract: p.env } : {},
|
|
1563
1667
|
plugins: p?.plugins ?? []
|
|
1564
1668
|
}),
|
|
1565
1669
|
dataCache: () => Ve({
|
|
1566
1670
|
stats: yt,
|
|
1567
1671
|
backendKind: vt
|
|
1568
1672
|
}),
|
|
1569
|
-
subscriptions: () => Nt(() =>
|
|
1673
|
+
subscriptions: () => Nt(() => z),
|
|
1570
1674
|
inspectTables: () => de(_.tables),
|
|
1571
1675
|
inspectRows: Se({
|
|
1572
1676
|
store: w,
|
|
1573
1677
|
tables: _.tables,
|
|
1574
1678
|
mask: !0
|
|
1575
1679
|
}),
|
|
1576
|
-
metrics: (e) =>
|
|
1680
|
+
metrics: (e) => X.rpcMetrics().snapshot(e),
|
|
1577
1681
|
cluster: () => It({
|
|
1578
1682
|
store: w,
|
|
1579
1683
|
dialect: h,
|
|
1580
|
-
useClusterCron:
|
|
1581
|
-
scheduleCoordChoice:
|
|
1684
|
+
useClusterCron: K,
|
|
1685
|
+
scheduleCoordChoice: nr
|
|
1582
1686
|
}),
|
|
1583
1687
|
inspectSchedules: () => Ee({
|
|
1584
|
-
schedules:
|
|
1585
|
-
defaultTrigger:
|
|
1586
|
-
coordination:
|
|
1688
|
+
schedules: Xn,
|
|
1689
|
+
defaultTrigger: G,
|
|
1690
|
+
coordination: rr
|
|
1587
1691
|
}),
|
|
1588
1692
|
inspectScheduleRuns: (e) => N(w, e),
|
|
1589
|
-
...
|
|
1693
|
+
...d(w, {
|
|
1590
1694
|
controls: O(_.workflows ?? []),
|
|
1591
1695
|
active: (_.workflows?.length ?? 0) > 0,
|
|
1592
|
-
cancellation: () =>
|
|
1696
|
+
cancellation: () => X.flowControlHealth()
|
|
1593
1697
|
}),
|
|
1594
|
-
webhookActions: Ce(() =>
|
|
1595
|
-
inspectStartWorkflow: (e) =>
|
|
1596
|
-
inspectCancelWorkflowRun: (e) =>
|
|
1597
|
-
inspectSuspendWorkflowRun: (e) =>
|
|
1598
|
-
inspectResumeWorkflowRun: (e) =>
|
|
1599
|
-
inspectDiscardWorkflowRun: (e) =>
|
|
1600
|
-
inspectRetryWorkflowRun: (e) =>
|
|
1601
|
-
inspectSignalWorkflowRun: (e) =>
|
|
1602
|
-
inspectUpdateWorkflowRun: (e) =>
|
|
1698
|
+
webhookActions: Ce(() => X.webhooksService()),
|
|
1699
|
+
inspectStartWorkflow: (e) => Y().inspectStartWorkflow(e),
|
|
1700
|
+
inspectCancelWorkflowRun: (e) => Y().inspectCancelWorkflowRun(e),
|
|
1701
|
+
inspectSuspendWorkflowRun: (e) => Y().inspectSuspendWorkflowRun(e),
|
|
1702
|
+
inspectResumeWorkflowRun: (e) => Y().inspectResumeWorkflowRun(e),
|
|
1703
|
+
inspectDiscardWorkflowRun: (e) => Y().inspectDiscardWorkflowRun(e),
|
|
1704
|
+
inspectRetryWorkflowRun: (e) => Y().inspectRetryWorkflowRun(e),
|
|
1705
|
+
inspectSignalWorkflowRun: (e) => Y().inspectSignalWorkflowRun(e),
|
|
1706
|
+
inspectUpdateWorkflowRun: (e) => Y().inspectUpdateWorkflowRun(e),
|
|
1603
1707
|
inspectInferences: (e) => Xe({
|
|
1604
1708
|
store: w,
|
|
1605
1709
|
active: (_.workflows?.length ?? 0) > 0,
|
|
1606
|
-
dispatcher: () =>
|
|
1710
|
+
dispatcher: () => X.inferenceHealth()
|
|
1607
1711
|
}, e.limit === void 0 ? {} : { limit: e.limit }),
|
|
1608
1712
|
..._t({
|
|
1609
1713
|
store: w,
|
|
1610
|
-
cancelRun: async (e) => await
|
|
1611
|
-
retryRun: async (e) =>
|
|
1612
|
-
redriveRun: async (e) =>
|
|
1714
|
+
cancelRun: async (e) => await X.runCanceller()?.(e) ?? !1,
|
|
1715
|
+
retryRun: async (e) => Y().inspectRetryWorkflowRun({ runId: e }),
|
|
1716
|
+
redriveRun: async (e) => X.redriveWorkflowRun({ runId: e }),
|
|
1613
1717
|
log: $
|
|
1614
1718
|
}),
|
|
1615
|
-
inspectRedriveWorkflowRun: (e) =>
|
|
1616
|
-
inspectResumeWorkflowRunFromStep: (e) =>
|
|
1617
|
-
}, Wr = (process.env.VOLTRO_TENANT_ISOLATION ?? p?.tenancy?.isolation) === "namespace",
|
|
1719
|
+
inspectRedriveWorkflowRun: (e) => X.redriveWorkflowRun(e),
|
|
1720
|
+
inspectResumeWorkflowRunFromStep: (e) => X.resumeWorkflowRunFromStep(e)
|
|
1721
|
+
}, Wr = (process.env.VOLTRO_TENANT_ISOLATION ?? p?.tenancy?.isolation) === "namespace", Kr = Wr && h !== "memory" ? await (async () => {
|
|
1618
1722
|
let e = await F(h);
|
|
1619
1723
|
return D({
|
|
1620
1724
|
tables: x,
|
|
@@ -1635,12 +1739,12 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
1635
1739
|
warn: (e, t) => $.warn(e, t)
|
|
1636
1740
|
}
|
|
1637
1741
|
});
|
|
1638
|
-
qr !== void 0 &&
|
|
1742
|
+
qr !== void 0 && Gr(async () => {
|
|
1639
1743
|
await qr.close();
|
|
1640
1744
|
});
|
|
1641
|
-
let
|
|
1745
|
+
let X = await ua({
|
|
1642
1746
|
bootTiming: l,
|
|
1643
|
-
broadcastNamespace:
|
|
1747
|
+
broadcastNamespace: L,
|
|
1644
1748
|
scheduling: (() => {
|
|
1645
1749
|
let e = mn;
|
|
1646
1750
|
return {
|
|
@@ -1650,7 +1754,7 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
1650
1754
|
stalenessSweepMs: e.stalenessSweepMs,
|
|
1651
1755
|
disarmWhenIdle: $e({
|
|
1652
1756
|
changeScope: w.changeScope,
|
|
1653
|
-
broadcastAttached:
|
|
1757
|
+
broadcastAttached: Nn !== void 0
|
|
1654
1758
|
})
|
|
1655
1759
|
};
|
|
1656
1760
|
})(),
|
|
@@ -1658,8 +1762,8 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
1658
1762
|
...p?.workflows?.suspendSignalHintMs === void 0 ? {} : { workflowSuspendSignalHintMs: p.workflows.suspendSignalHintMs },
|
|
1659
1763
|
workflowRecording: M(p?.workflows?.recording),
|
|
1660
1764
|
membership: {
|
|
1661
|
-
...
|
|
1662
|
-
instanceId:
|
|
1765
|
+
...On,
|
|
1766
|
+
instanceId: Sn
|
|
1663
1767
|
},
|
|
1664
1768
|
security: {
|
|
1665
1769
|
defaultDeny: Ae(p),
|
|
@@ -1667,33 +1771,33 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
1667
1771
|
},
|
|
1668
1772
|
approvals: { defaultExpiryMs: Fe(p) },
|
|
1669
1773
|
...p?.plugins === void 0 ? {} : { plugins: p.plugins },
|
|
1670
|
-
...
|
|
1671
|
-
restRoutes:
|
|
1774
|
+
...Bn ? { idempotency: Bn } : {},
|
|
1775
|
+
restRoutes: zn,
|
|
1672
1776
|
appProcedures: pe,
|
|
1673
1777
|
discovered: {
|
|
1674
|
-
queries: [..._.queries, ...
|
|
1778
|
+
queries: [..._.queries, ...Lr],
|
|
1675
1779
|
mutations: _.mutations,
|
|
1676
|
-
actions: [..._.actions, ...
|
|
1780
|
+
actions: [..._.actions, ...Ir],
|
|
1677
1781
|
streams: _.streams,
|
|
1678
1782
|
events: _.events,
|
|
1679
1783
|
workflows: _.workflows,
|
|
1680
1784
|
workflowWorkers: _.workflowWorkers,
|
|
1681
1785
|
eventTriggers: _.eventTriggers,
|
|
1682
|
-
schedules:
|
|
1683
|
-
subscribers:
|
|
1684
|
-
outboxHandlers:
|
|
1786
|
+
schedules: Xn,
|
|
1787
|
+
subscribers: dr,
|
|
1788
|
+
outboxHandlers: J,
|
|
1685
1789
|
connections: _.connections,
|
|
1686
|
-
reactions:
|
|
1687
|
-
aggregates:
|
|
1790
|
+
reactions: q,
|
|
1791
|
+
aggregates: hr,
|
|
1688
1792
|
expectations: Ar,
|
|
1689
|
-
budgets:
|
|
1690
|
-
experiments:
|
|
1793
|
+
budgets: Nr,
|
|
1794
|
+
experiments: Fr,
|
|
1691
1795
|
...Oe === void 0 ? {} : { webhooks: Oe }
|
|
1692
1796
|
},
|
|
1693
1797
|
log: $,
|
|
1694
1798
|
analytics: Le.sink,
|
|
1695
|
-
aggregateStorage:
|
|
1696
|
-
aggregateCoordinator:
|
|
1799
|
+
aggregateStorage: Sr,
|
|
1800
|
+
aggregateCoordinator: Cr,
|
|
1697
1801
|
store: w,
|
|
1698
1802
|
kv: Ct,
|
|
1699
1803
|
cache: ot,
|
|
@@ -1702,12 +1806,12 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
1702
1806
|
schemaRegistry: Ue,
|
|
1703
1807
|
tenantScopedTables: _.tenantScopedTables,
|
|
1704
1808
|
softDeleteScopedTables: _.softDeleteScopedTables,
|
|
1705
|
-
dataTransferSnapshot:
|
|
1809
|
+
dataTransferSnapshot: Kn(x, h),
|
|
1706
1810
|
dataTransferDialect: h,
|
|
1707
|
-
...
|
|
1811
|
+
...Kr === void 0 ? {} : { ensureTenantProvisioned: Kr.ensure },
|
|
1708
1812
|
...qr === void 0 ? {} : { resolveResidentStore: qr.resolveStore },
|
|
1709
1813
|
tenantIsolation: (process.env.VOLTRO_TENANT_ISOLATION ?? p?.tenancy?.isolation) === "namespace" ? "namespace" : "shared-schema",
|
|
1710
|
-
resolveSubject: (e, t) =>
|
|
1814
|
+
resolveSubject: (e, t) => Rn({
|
|
1711
1815
|
headers: e,
|
|
1712
1816
|
clientId: t
|
|
1713
1817
|
}),
|
|
@@ -1715,18 +1819,18 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
1715
1819
|
...p?.agents === void 0 ? {} : { agents: p.agents },
|
|
1716
1820
|
httpRoutes: j.flatMap((e) => e.httpRoutes ?? []),
|
|
1717
1821
|
getStore: () => Ge,
|
|
1718
|
-
...
|
|
1719
|
-
...
|
|
1720
|
-
scheduleDefaultTrigger:
|
|
1721
|
-
scheduleCoordination:
|
|
1722
|
-
scheduleArmSelf: !
|
|
1822
|
+
...Hn ? { baseLayer: Hn } : {},
|
|
1823
|
+
...or === void 0 ? {} : { workflowEngineLayer: or },
|
|
1824
|
+
scheduleDefaultTrigger: G,
|
|
1825
|
+
scheduleCoordination: rr,
|
|
1826
|
+
scheduleArmSelf: !K,
|
|
1723
1827
|
dormancy: process.env.VOLTRO_DORMANCY === "sleep" || process.env.VOLTRO_DORMANCY === "always-on" ? process.env.VOLTRO_DORMANCY : p?.dormancy ?? "always-on",
|
|
1724
1828
|
scheduleReplicaId: process.env.HOSTNAME ?? `pid-${process.pid}`,
|
|
1725
|
-
...
|
|
1829
|
+
...lr === void 0 ? {} : { scheduleFireInterceptor: lr },
|
|
1726
1830
|
onSchedulerReady: (e) => {
|
|
1727
|
-
|
|
1831
|
+
ir = e;
|
|
1728
1832
|
},
|
|
1729
|
-
inspectRoute: { handle: async (e, t, n, r) => await
|
|
1833
|
+
inspectRoute: { handle: async (e, t, n, r) => await te(e, Ur, t, {
|
|
1730
1834
|
method: n,
|
|
1731
1835
|
...r === void 0 ? {} : { body: r }
|
|
1732
1836
|
}) || ((n === "GET" ? await dn(e, Ur, t, { method: n }) : null) ?? un(e, Ur, t, {
|
|
@@ -1738,11 +1842,11 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
1738
1842
|
body: JSON.stringify({ error: "not an inspect route" })
|
|
1739
1843
|
}) },
|
|
1740
1844
|
...p?.name === void 0 ? {} : { appName: p.name },
|
|
1741
|
-
observability:
|
|
1845
|
+
observability: jn,
|
|
1742
1846
|
port: m,
|
|
1743
1847
|
...p?.transport?.wsPath ? { path: p.transport.wsPath } : {}
|
|
1744
1848
|
});
|
|
1745
|
-
return
|
|
1849
|
+
return z = X.dispatcher, we(Pt([
|
|
1746
1850
|
_.queries,
|
|
1747
1851
|
_.mutations,
|
|
1748
1852
|
_.actions,
|
|
@@ -1757,13 +1861,13 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
1757
1861
|
streams: _.streams.length,
|
|
1758
1862
|
workflows: _.workflows.length,
|
|
1759
1863
|
workflowWorkers: _.workflowWorkers.length,
|
|
1760
|
-
schedules:
|
|
1761
|
-
scheduleCoordination:
|
|
1762
|
-
}), l.finish($),
|
|
1864
|
+
schedules: Xn.length,
|
|
1865
|
+
scheduleCoordination: rr
|
|
1866
|
+
}), l.finish($), Gr(async () => {
|
|
1763
1867
|
for (let e of xn) e.stop();
|
|
1764
1868
|
At.stop();
|
|
1765
1869
|
try {
|
|
1766
|
-
await
|
|
1870
|
+
await X.close(), xt(), Rt?.dispose(), await An.deactivate(), await Nn?.close(), await Je({
|
|
1767
1871
|
mirror: Et,
|
|
1768
1872
|
log: $
|
|
1769
1873
|
}), await Le.dispose(), await w.close?.();
|
|
@@ -1773,4 +1877,4 @@ var ji = () => Math.max(500, Math.floor(Yr() * .6)), Mi = (e) => new Promise((t)
|
|
|
1773
1877
|
}), await new Promise(() => {}), 0;
|
|
1774
1878
|
};
|
|
1775
1879
|
//#endregion
|
|
1776
|
-
export {
|
|
1880
|
+
export { pa as n, da as r, ma as t };
|