@voltro/cli 0.46.0 → 0.47.0
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 +30 -0
- package/dist/apiBuild-BsooZpw2.js +2 -0
- package/dist/{apiBuild-BKdd0I1Z.js → apiBuild-FpHCWiv6.js} +1 -1
- package/dist/bin.js +1 -1
- package/dist/{build-co6yadYz.js → build-zVygXxGB.js} +7 -7
- package/dist/{checkCommand-CXAXTjZL.js → checkCommand-B2Fw73lu.js} +1 -1
- package/dist/{checkCommand-B-eiW-G_.js → checkCommand-D0dAKciE.js} +4 -4
- package/dist/{codegen-sbN1Y8PB.js → codegen-CrMXs4hb.js} +176 -162
- package/dist/codegen-DiMn2KkZ.js +2 -0
- package/dist/{codegenCommand-CB6_3sX0.js → codegenCommand-BTtsnRus.js} +3 -3
- package/dist/{commands-C-hxgAGr.js → commands-BrFKxnYW.js} +18 -18
- package/dist/{dashboardCommand-CEVO0GWF.js → dashboardCommand-D9SjDc8E.js} +1 -1
- package/dist/{dataCommand-k0ezbQWa.js → dataCommand-Dl11q14e.js} +2 -2
- package/dist/dbCommand-BUD4Fd8v.js +2 -0
- package/dist/{dbCommand-BwkyNxn-.js → dbCommand-jbrmzwW_.js} +1 -1
- package/dist/{dev-DyoYst4j.js → dev-CaIfZnw5.js} +1 -1
- package/dist/{dev-8hTEnN6s.js → dev-RjB7eE_B.js} +2 -2
- package/dist/doctorCommand-5zv6PN-G.js +2 -0
- package/dist/{doctorCommand-B6D7HH1-.js → doctorCommand-D7X29cw6.js} +13 -13
- package/dist/{doctorSourceRelations-CPjSwYuZ.js → doctorSourceRelations-Dd48LPvO.js} +15 -10
- package/dist/{dormancyCommand-CrPAwOgo.js → dormancyCommand-BGOP27fz.js} +1 -1
- package/dist/{embeddingsCommand-DsSxsn_b.js → embeddingsCommand-D72E22bw.js} +1 -1
- package/dist/{envCommand-B_NPVGUf.js → envCommand-BHSxz6wC.js} +1 -1
- package/dist/{evolveCommand-DUuaCIyn.js → evolveCommand-C2ofGGlz.js} +1 -1
- package/dist/{frameworkTableAssembly-BPlPfU07.js → frameworkTableAssembly-BvZ0Lil_.js} +76 -72
- package/dist/frameworkTableAssembly-DDKtwsy2.js +2 -0
- package/dist/index.js +1 -1
- package/dist/{migrate-CM1qwalu.js → migrate-odCPGHPq.js} +2 -2
- package/dist/{runtimeTrace-BRNM06vK.js → runtimeTrace-C_OKr0jY.js} +1 -1
- package/dist/{sdkgen-CRCw_XcR.js → sdkgen-D9trW7sl.js} +1 -1
- package/dist/{serveCommand-CHOr74WM.js → serveCommand-BU0wfV6V.js} +388 -385
- package/dist/serveCommand-Bwrn_9Fn.js +2 -0
- package/dist/serveEntry.js +1 -1
- package/dist/{test-CHb7UwvE.js → test-rXFq4S76.js} +1 -1
- package/dist/{webhooksCommand-BRrG_sGf.js → webhooksCommand-BqcWcbuW.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 +28 -0
- package/templates/agent-docs/whats-new.md +14 -160
- 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-P2gewrfQ.js +0 -2
- package/dist/codegen-DcE2li1i.js +0 -2
- package/dist/dbCommand-C2XK63Dd.js +0 -2
- package/dist/doctorCommand-Btl2Jz1a.js +0 -2
- package/dist/frameworkTableAssembly-Bob3vj9R.js +0 -2
- package/dist/serveCommand-BNHMVXyp.js +0 -2
|
@@ -4,27 +4,27 @@ 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
6
|
import { t as ee } from "./interruptedReplace-C1ZI84xi.js";
|
|
7
|
-
import { $ as s, $t as c, A as l, At as u, Bt as d, C as f, Cn as p, Ct as m, D as h, Dt as g, E as _, En as te, Et as v, F as ne, Ft as re, G as ie, Gt as ae, H as y, Ht as oe, I as se, It as ce, J as le, Jt as b, K as x, Kt as ue, L as S, Lt as de, M as fe, Mt as pe, 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 C, Rt as Se, S as Ce, St as we, T as Te, Tn as Ee, Tt as w, U as De, V as Oe, W as ke, Wt as Ae, X as je, Xt as Me, Y as Ne, Yt as T, Z as Pe, Zt as Fe, _ as E, _n as Ie, _t as D, an as Le, at as Re, b as ze, bn as Be, bt as Ve, c as He, cn as Ue, ct as We, dn as Ge, dt as Ke, en as qe, et as Je, f as Ye, fn as Xe, ft as Ze, g as Qe, gt as $e, h as et, hn as tt, ht as nt, i as rt, in as it, it as at, j as ot, jt as st, k as ct, kt as lt, ln as ut, lt as dt, m as ft, mn as pt, mt, nn as ht, nt as
|
|
8
|
-
import { n as
|
|
9
|
-
import { r as
|
|
10
|
-
import { ht as
|
|
11
|
-
import { r as
|
|
12
|
-
import { i as
|
|
13
|
-
import { c as
|
|
14
|
-
import { C as
|
|
15
|
-
import { S as
|
|
16
|
-
import { h as
|
|
17
|
-
import { n as
|
|
18
|
-
import { i as
|
|
19
|
-
import { t as
|
|
20
|
-
import { r as
|
|
21
|
-
import { t as
|
|
22
|
-
import { t as
|
|
23
|
-
import
|
|
24
|
-
import { createWriteStream as
|
|
25
|
-
import { pathToFileURL as
|
|
26
|
-
import { createLogger as
|
|
27
|
-
import { AuthMiddleware as
|
|
7
|
+
import { $ as s, $t as c, A as l, At as u, Bt as d, C as f, Cn as p, Ct as m, D as h, Dt as g, E as _, En as te, Et as v, F as ne, Ft as re, G as ie, Gt as ae, H as y, Ht as oe, I as se, It as ce, J as le, Jt as b, K as x, Kt as ue, L as S, Lt as de, M as fe, Mt as pe, 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 C, Rt as Se, S as Ce, St as we, T as Te, Tn as Ee, Tt as w, U as De, V as Oe, W as ke, Wt as Ae, X as je, Xt as Me, Y as Ne, Yt as T, Z as Pe, Zt as Fe, _ as E, _n as Ie, _t as D, an as Le, at as Re, b as ze, bn as Be, bt as Ve, c as He, cn as Ue, ct as We, dn as Ge, dt as Ke, en as qe, et as Je, f as Ye, fn as Xe, ft as Ze, g as Qe, gt as $e, h as et, hn as tt, ht as nt, i as rt, in as it, it as at, j as ot, jt as st, k as ct, kt as lt, ln as ut, lt as dt, m as ft, mn as pt, mt, nn as ht, nt as gt, o as O, on as _t, ot as k, p as A, pn as vt, pt as yt, q as bt, qt as xt, r as St, rn as Ct, rt as wt, sn as j, st as Tt, t as Et, tn as Dt, tt as Ot, u as kt, un as At, ut as jt, v as Mt, vn as Nt, vt as M, w as N, wn as Pt, wt as Ft, x as It, xn as Lt, xt as Rt, y as zt, yn as Bt, yt as Vt, zt as Ht } from "./dev-RjB7eE_B.js";
|
|
8
|
+
import { n as Ut } from "./cliArgs-D4p8n7EE.js";
|
|
9
|
+
import { r as P } from "./appPort-B_HpJ_ck.js";
|
|
10
|
+
import { ht as Wt, pt as Gt } from "./webDev-B4IEMB0n.js";
|
|
11
|
+
import { r as F } from "./dialectDriver-czCHYpeH.js";
|
|
12
|
+
import { i as Kt, n as qt } from "./connectionConfig-Bk9IC7D0.js";
|
|
13
|
+
import { c as Jt, n as I, o as Yt } from "./seedRunner-Dgsiwk_e.js";
|
|
14
|
+
import { C as Xt, S as Zt, _ as Qt, d as $t, g as en, l as tn, m as nn, r as rn, u as an, v as on } from "./frameworkTableAssembly-BvZ0Lil_.js";
|
|
15
|
+
import { S as sn, c as cn, n as ln, p as un, s as dn, x as fn } from "./fileConventions-Cof68_BL.js";
|
|
16
|
+
import { h as pn, o as mn } from "./inspect-B7U7Cl_Z.js";
|
|
17
|
+
import { n as hn } from "./mssqlClusterPatch-_4cE_nun.js";
|
|
18
|
+
import { i as gn, n as _n, r as vn, t as yn } from "./webhookDiscovery-CphsQe59.js";
|
|
19
|
+
import { t as bn } from "./inspectMetrics-CfdKLh6t.js";
|
|
20
|
+
import { r as xn, u as Sn } from "./apiBuild-FpHCWiv6.js";
|
|
21
|
+
import { t as Cn } from "./bootTiming-BdyP9nYw.js";
|
|
22
|
+
import { t as wn } from "./dataProfile-Cm0YVKSy.js";
|
|
23
|
+
import Tn, { basename as En, join as Dn } from "node:path";
|
|
24
|
+
import { createWriteStream as On, existsSync as kn } from "node:fs";
|
|
25
|
+
import { pathToFileURL as An } from "node:url";
|
|
26
|
+
import { createLogger as L } from "@voltro/logger";
|
|
27
|
+
import { AuthMiddleware as jn, ConnectionInfoMiddleware as Mn, actionToRpc as R, anonymousSubject as Nn, isWireReachable as Pn, mutationToRpc as Fn, queryToRpc as z, streamToRpc as In, wireErrorUnion as Ln, workflowCancelDescriptor as Rn, workflowDomainEventsQueryDescriptor as B, workflowEventDeliveriesQueryDescriptor as V, workflowResumeDescriptor as zn, workflowRunEventsQueryDescriptor as Bn, workflowRunQueryDescriptor as Vn, workflowRunStepsQueryDescriptor as Hn, workflowRunsQueryDescriptor as Un, workflowSignalDescriptor as Wn, workflowUpdateDescriptor as Gn } from "@voltro/protocol";
|
|
28
28
|
import { allRegisteredTables as Kn, and as H, connectionIdentity as qn, ensureTableRegistered as Jn, eq as U, or as Yn } from "@voltro/database";
|
|
29
29
|
import { Cause as Xn, Effect as W, Layer as G, ManagedRuntime as Zn } from "effect";
|
|
30
30
|
import { SqlClient as Qn } from "@effect/sql";
|
|
@@ -32,18 +32,18 @@ import { declaredSnapshot as $n, describeOutcome as er, pendingFileMigrationIds
|
|
|
32
32
|
import { AggregateRegistry as rr, CostRegistry as ir, DORMANCY_WAKEUP_TENANT as ar, Dispatcher as or, ExpectationRegistry as sr, ExperimentRegistry as cr, apiKeyManagementRoutes as lr, attachAnalyticsMirror as ur, attachExpectations as dr, attachExperiments as fr, attachFinops as pr, awaitServerListening as mr, bindMutation as K, bindStream as hr, bindSubscription as q, buildTracingLayer as gr, cancelWakeup as _r, compileCron as vr, dataStoreApiKeyStore as yr, formatServerOnlyLeaks as br, formatUnresolvedSources as xr, frameworkApiKeyStrategy as Sr, getResourcePolicy as Cr, installPolicyGuardResolver as wr, loadResourceTuples as Tr, makeActionRunner as Er, makeAdvisoryLockCoordinator as Dr, makeApiKeyService as Or, makeApiKeyUsageBuffer as kr, makeApiKeyUsageFlusher as Ar, makeAsyncKv as jr, makeAuthMiddlewareLayers as Mr, makeCoordinatedScheduler as Nr, makeEffectStoreLayer as Pr, makeLazyWorkflowFacade as Fr, makeMutationOutputCodec as Ir, makeMutationRunner as Lr, makeOneShotQueryRunner as Rr, makeQueryDescriptorProducer as zr, makeQueryFinalizer as Br, makeQueryReauthorizer as Vr, makeQuerySubscriber as Hr, makeSchemaRegistry as Ur, makeWorkflowFacade as J, makeWorkflowFacadeWithCallerContext as Wr, makeWorkflowLayers as Gr, noopKv as Kr, onProcessShutdown as qr, recordSubscriptionDelivery as Jr, recordWorkflowRun as Yr, registerDefaultTupleSource as Xr, registerWakeup as Zr, resolveSecretsBackend as Qr, runProvidedEffect as Y, setSecretsBackend as $r, setSystemStoreHandle as ei, shutdownGraceMsFromEnv as ti, singleCoordinator as ni, startRpcServer as ri, startScheduler as ii, stripForbiddenForWire as ai, undoCaptureEnabled as oi, unresolvedSources as si, withScopedRequest as ci, workflowToRpc as li, wrapStoreWithBootCodec as ui } from "@voltro/runtime";
|
|
33
33
|
import di, { tmpdir as fi } from "node:os";
|
|
34
34
|
import { RpcGroup as pi } from "@effect/rpc";
|
|
35
|
-
import { appStorageProvider as mi,
|
|
36
|
-
import { isEnvContract as
|
|
37
|
-
import { assertProductionSessionSecret as
|
|
35
|
+
import { appStorageProvider as mi, durabilityNotice as hi, fromNodeReadable as gi, getObjectStream as _i, putObjectStream as vi, toNodeReadable as yi } from "@voltro/plugin-storage";
|
|
36
|
+
import { isEnvContract as bi } from "@voltro/env";
|
|
37
|
+
import { assertProductionSessionSecret as xi } from "@voltro/protocol/session";
|
|
38
38
|
import X from "node:fs/promises";
|
|
39
|
-
import { createHash as
|
|
40
|
-
import { buildDeliverWebhookExecute as
|
|
41
|
-
import { getAuthSessionStrategy as
|
|
42
|
-
import { registerEmailTemplates as
|
|
43
|
-
import { channelFor as
|
|
44
|
-
import { packBundle as
|
|
39
|
+
import { createHash as Si, timingSafeEqual as Ci } from "node:crypto";
|
|
40
|
+
import { buildDeliverWebhookExecute as wi, buildWebhooksService as Ti, defaultIncomingPath as Ei, deliverWebhookWorkflow as Di, makeDeferredEmitHandler as Oi, mountIncomingWebhook as ki } from "@voltro/plugin-webhooks";
|
|
41
|
+
import { getAuthSessionStrategy as Ai } from "@voltro/plugin-auth";
|
|
42
|
+
import { registerEmailTemplates as ji } from "@voltro/plugin-mail";
|
|
43
|
+
import { channelFor as Mi, getBroadcastPlugin as Ni } from "@voltro/plugin-broadcast";
|
|
44
|
+
import { packBundle as Pi, runExport as Fi, runImport as Ii, storageBlobSink as Li, storageRefsBlobSource as Ri, unpackBundle as zi, unpackBundleToDir as Bi } from "@voltro/data-transfer";
|
|
45
45
|
//#region src/serveDrain.ts
|
|
46
|
-
var
|
|
46
|
+
var Vi = () => Math.max(500, Math.floor(ti() * .6)), Hi = (e) => new Promise((t) => setTimeout(t, e)), Ui = (e) => {
|
|
47
47
|
let t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set(), r = 0;
|
|
48
48
|
e.on("connection", (e) => {
|
|
49
49
|
t.add(e), e.once("close", () => {
|
|
@@ -57,14 +57,14 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
57
57
|
});
|
|
58
58
|
});
|
|
59
59
|
let i, a = async (t = {}) => {
|
|
60
|
-
let n = t.budgetMs ??
|
|
60
|
+
let n = t.budgetMs ?? Vi();
|
|
61
61
|
i ??= new Promise((t) => {
|
|
62
62
|
e.close(() => {
|
|
63
63
|
t();
|
|
64
64
|
});
|
|
65
65
|
}), e.closeIdleConnections();
|
|
66
66
|
let a = Date.now() + n;
|
|
67
|
-
for (; r > 0 && Date.now() < a;) await
|
|
67
|
+
for (; r > 0 && Date.now() < a;) await Hi(25), e.closeIdleConnections();
|
|
68
68
|
e.closeIdleConnections();
|
|
69
69
|
}, o = async () => {
|
|
70
70
|
i ??= new Promise((t) => {
|
|
@@ -81,7 +81,7 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
81
81
|
]));
|
|
82
82
|
} catch {}
|
|
83
83
|
else e.destroy();
|
|
84
|
-
for (let e = 0; t.size > 0 && e < 250; e += 25) await
|
|
84
|
+
for (let e = 0; t.size > 0 && e < 250; e += 25) await Hi(25);
|
|
85
85
|
for (let e of t) e.destroy();
|
|
86
86
|
await i;
|
|
87
87
|
};
|
|
@@ -93,77 +93,77 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
93
93
|
await a(e), await o();
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
|
-
},
|
|
96
|
+
}, Wi = "/_voltro/admin/import", Gi = "/_voltro/admin/export", Z = (e, t) => ({
|
|
97
97
|
status: e,
|
|
98
98
|
contentType: "application/json; charset=utf-8",
|
|
99
99
|
body: JSON.stringify(t)
|
|
100
|
-
}),
|
|
100
|
+
}), Ki = (e) => {
|
|
101
101
|
let t = e.authorization ?? e.Authorization, n = t ? /^Bearer\s+(.+)$/i.exec(t) : null;
|
|
102
102
|
return n ? n[1] : null;
|
|
103
|
-
},
|
|
103
|
+
}, qi = (e, t) => Ci(Si("sha256").update(e).digest(), Si("sha256").update(t).digest()), Ji = (e, t) => {
|
|
104
104
|
if (e.method.toUpperCase() !== "POST") return Z(405, { error: "method not allowed" });
|
|
105
105
|
if (!t || t.length < 16) return Z(503, { error: "data transfer misconfigured (no/weak secret)" });
|
|
106
|
-
let n =
|
|
107
|
-
return !n || !
|
|
108
|
-
},
|
|
106
|
+
let n = Ki(e.headers);
|
|
107
|
+
return !n || !qi(n, t) ? Z(401, { error: "unauthorized" }) : null;
|
|
108
|
+
}, Yi = /^[A-Za-z0-9_-]{8,64}$/, Xi = (e) => Yi.test(e), Zi = () => Tn.join(di.tmpdir(), "voltro-import-uploads"), Qi = (e) => Tn.join(Zi(), e), $i = (e) => Tn.join(Qi(e), "archive.bin"), ea = (e) => Tn.join(Qi(e), "meta.json"), ta = async (e = Date.now()) => {
|
|
109
109
|
let t = 0;
|
|
110
110
|
try {
|
|
111
|
-
for (let n of await X.readdir(
|
|
112
|
-
let r = await X.stat(
|
|
113
|
-
r !== null && (e - r.mtimeMs <= 864e5 || (await X.rm(
|
|
111
|
+
for (let n of await X.readdir(Zi())) {
|
|
112
|
+
let r = await X.stat(Qi(n)).catch(() => null);
|
|
113
|
+
r !== null && (e - r.mtimeMs <= 864e5 || (await X.rm(Qi(n), {
|
|
114
114
|
recursive: !0,
|
|
115
115
|
force: !0
|
|
116
116
|
}).catch(() => void 0), t++));
|
|
117
117
|
}
|
|
118
118
|
} catch {}
|
|
119
119
|
return t;
|
|
120
|
-
},
|
|
121
|
-
if (!
|
|
120
|
+
}, na = async (e) => {
|
|
121
|
+
if (!Xi(e)) return {
|
|
122
122
|
bytes: 0,
|
|
123
123
|
key: null
|
|
124
124
|
};
|
|
125
|
-
let t = await X.stat(
|
|
125
|
+
let t = await X.stat($i(e)).catch(() => null);
|
|
126
126
|
if (t === null) return {
|
|
127
127
|
bytes: 0,
|
|
128
128
|
key: null
|
|
129
129
|
};
|
|
130
|
-
let n = await X.readFile(
|
|
130
|
+
let n = await X.readFile(ea(e), "utf8").then((e) => JSON.parse(e), () => ({}));
|
|
131
131
|
return {
|
|
132
132
|
bytes: t.size,
|
|
133
133
|
key: n.key ?? null
|
|
134
134
|
};
|
|
135
|
-
},
|
|
136
|
-
if (!
|
|
135
|
+
}, ra = async (e) => {
|
|
136
|
+
if (!Xi(e.id)) return {
|
|
137
137
|
reason: "bad-id",
|
|
138
|
-
message: `upload id must match ${String(
|
|
138
|
+
message: `upload id must match ${String(Yi)}`
|
|
139
139
|
};
|
|
140
|
-
let t = await
|
|
140
|
+
let t = await na(e.id);
|
|
141
141
|
return t.key !== null && t.key !== e.key ? {
|
|
142
142
|
reason: "key-mismatch",
|
|
143
143
|
message: "this upload id already holds a different bundle. Use a new upload id, or delete the partial upload."
|
|
144
|
-
} : e.offset === t.bytes ? (await X.mkdir(
|
|
144
|
+
} : e.offset === t.bytes ? (await X.mkdir(Qi(e.id), { recursive: !0 }), t.key === null && await X.writeFile(ea(e.id), JSON.stringify({
|
|
145
145
|
key: e.key,
|
|
146
146
|
startedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
147
147
|
})), await new Promise((t, n) => {
|
|
148
|
-
let r =
|
|
148
|
+
let r = On($i(e.id), { flags: "a" });
|
|
149
149
|
r.on("error", n), r.on("finish", () => t()), r.end(Buffer.from(e.bytes));
|
|
150
150
|
}), { total: t.bytes + e.bytes.byteLength }) : {
|
|
151
151
|
reason: "offset-mismatch",
|
|
152
152
|
message: `chunk starts at ${e.offset} but the server holds ${t.bytes} byte(s)`,
|
|
153
153
|
expectedOffset: t.bytes
|
|
154
154
|
};
|
|
155
|
-
},
|
|
156
|
-
let t = await X.stat(
|
|
155
|
+
}, ia = async (e) => {
|
|
156
|
+
let t = await X.stat($i(e));
|
|
157
157
|
return {
|
|
158
|
-
path:
|
|
158
|
+
path: $i(e),
|
|
159
159
|
bytes: t.size
|
|
160
160
|
};
|
|
161
|
-
},
|
|
162
|
-
|
|
161
|
+
}, aa = async (e) => {
|
|
162
|
+
Xi(e) && await X.rm(Qi(e), {
|
|
163
163
|
recursive: !0,
|
|
164
164
|
force: !0
|
|
165
165
|
}).catch(() => void 0);
|
|
166
|
-
}, Q =
|
|
166
|
+
}, Q = L({ scope: "voltro:admin-import" }), oa = "VBUNDLE2", sa = (e) => {
|
|
167
167
|
let t = e.req.headers["x-import-rollback-key"];
|
|
168
168
|
if (e.mode !== "replace") return { options: {} };
|
|
169
169
|
if (typeof t != "string" || t.length === 0) return Q.warn("admin.import: no rollback capture — this run empties the target first, and nothing was asked to be kept. Send `x-import-rollback-key: <storage key>` (voltro data import --rollback-key <key>) to have the instance store the target's current rows before deleting them."), { options: {} };
|
|
@@ -171,25 +171,26 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
171
171
|
options: {},
|
|
172
172
|
refusal: Z(409, {
|
|
173
173
|
error: "rollback capture requested but this instance has no object storage configured",
|
|
174
|
-
hint: "A capture written to the pod would not survive the failure it exists for. Configure storage (the same one the storage-push export uses), or re-send without `x-import-rollback-key` to accept that a run which does not finish can leave the target emptied."
|
|
174
|
+
hint: "A capture written to the pod would not survive the failure it exists for. Configure storage (the same one the storage-push export uses), or re-send without `x-import-rollback-key` to accept that a run which does not finish can leave the target emptied. Note that CONFIGURED is not the same question as SURVIVES: a `filesystem` provider pointed at a container directory with no volume behind it passes this check and dies with the pod. The run says so when it can observe it — the capture path being on the same filesystem as `/`."
|
|
175
175
|
})
|
|
176
176
|
};
|
|
177
|
-
let n =
|
|
177
|
+
let n = Dn(fi(), `voltro-rollback-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`), r = e.deps.putArchive;
|
|
178
178
|
return {
|
|
179
179
|
key: t,
|
|
180
180
|
options: {
|
|
181
181
|
rollbackDir: n,
|
|
182
182
|
onRollbackCaptured: async () => {
|
|
183
|
-
|
|
183
|
+
let e = hi(n);
|
|
184
|
+
e !== void 0 && Q.warn(`admin.import: ${e}`), await r(t, () => Pi({ dir: n })), Q.info("admin.import: rollback capture stored", { bundleKey: t });
|
|
184
185
|
}
|
|
185
186
|
}
|
|
186
187
|
};
|
|
187
|
-
},
|
|
188
|
+
}, ca = async function* (e) {
|
|
188
189
|
yield e;
|
|
189
|
-
},
|
|
190
|
-
let n =
|
|
190
|
+
}, la = (e) => async (t) => {
|
|
191
|
+
let n = Ji(t, e.secret);
|
|
191
192
|
if (n) return n;
|
|
192
|
-
let r = t.headers["x-import-mode"], i = t.headers["x-import-on-conflict"], a = t.headers["x-import-atomic"], o = a === "0" || a === "false" ? !1 : a === "1" || a === "true" || r === "replace", ee = t.headers["x-import-force"] === "1" || t.headers["x-import-force"] === "true", s =
|
|
193
|
+
let r = t.headers["x-import-mode"], i = t.headers["x-import-on-conflict"], a = t.headers["x-import-atomic"], o = a === "0" || a === "false" ? !1 : a === "1" || a === "true" || r === "replace", ee = t.headers["x-import-force"] === "1" || t.headers["x-import-force"] === "true", s = sa({
|
|
193
194
|
req: t,
|
|
194
195
|
mode: r,
|
|
195
196
|
deps: e
|
|
@@ -197,13 +198,13 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
197
198
|
if (s.refusal !== void 0) return s.refusal;
|
|
198
199
|
let c = t.headers["x-import-dry-run"] === "1" || t.headers["x-import-dry-run"] === "true", l = (t.headers["x-import-tables"] ?? "").split(",").map((e) => e.trim()).filter(Boolean), u = t.headers["x-import-upload-id"], d;
|
|
199
200
|
if (u !== void 0 && u !== "") {
|
|
200
|
-
if (
|
|
201
|
+
if (ta(), t.headers["x-import-probe"] === "1") return Z(200, {
|
|
201
202
|
uploadId: u,
|
|
202
|
-
bytes: (await
|
|
203
|
+
bytes: (await na(u)).bytes
|
|
203
204
|
});
|
|
204
205
|
let e = t.headers["x-import-upload-key"] ?? "", n = Number(t.headers["x-import-chunk-offset"] ?? "0");
|
|
205
206
|
if (e === "" || !Number.isFinite(n) || n < 0) return Z(400, { error: "a chunked upload needs x-import-upload-key and a numeric x-import-chunk-offset" });
|
|
206
|
-
let r = await
|
|
207
|
+
let r = await ra({
|
|
207
208
|
id: u,
|
|
208
209
|
key: e,
|
|
209
210
|
offset: n,
|
|
@@ -222,13 +223,13 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
222
223
|
uploadId: u,
|
|
223
224
|
bytes: r.total
|
|
224
225
|
});
|
|
225
|
-
d = (await
|
|
226
|
+
d = (await ia(u)).path;
|
|
226
227
|
}
|
|
227
|
-
let f = t.rawBody.byteLength >= 8 && Buffer.from(t.rawBody.subarray(0, 8)).toString("latin1") ===
|
|
228
|
+
let f = t.rawBody.byteLength >= 8 && Buffer.from(t.rawBody.subarray(0, 8)).toString("latin1") === oa, p, m;
|
|
228
229
|
if (d !== void 0) {
|
|
229
230
|
let { createReadStream: e } = await import("node:fs");
|
|
230
231
|
p = e(d), m = "chunked";
|
|
231
|
-
} else if (f) p =
|
|
232
|
+
} else if (f) p = ca(t.rawBody), m = "upload";
|
|
232
233
|
else {
|
|
233
234
|
let n;
|
|
234
235
|
try {
|
|
@@ -242,11 +243,11 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
242
243
|
}
|
|
243
244
|
let h = await import("node:os"), g = await import("node:fs/promises"), _ = await import("node:path"), te = await g.mkdtemp(_.join(h.tmpdir(), "voltro-admin-import-"));
|
|
244
245
|
try {
|
|
245
|
-
e.assetSink ? await
|
|
246
|
+
e.assetSink ? await zi(p, {
|
|
246
247
|
dir: te,
|
|
247
248
|
blobs: e.assetSink
|
|
248
|
-
}) : await
|
|
249
|
-
let t = await W.runPromiseExit(
|
|
249
|
+
}) : await Bi(p, te);
|
|
250
|
+
let t = await W.runPromiseExit(Ii({
|
|
250
251
|
store: e.store,
|
|
251
252
|
bundleDir: te,
|
|
252
253
|
...r ? { mode: r } : {},
|
|
@@ -258,6 +259,7 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
258
259
|
...c ? { dryRun: c } : {},
|
|
259
260
|
...l.length > 0 ? { tables: l } : {},
|
|
260
261
|
...e.snapshot ? { targetSnapshot: e.snapshot } : {},
|
|
262
|
+
...e.dialect ? { targetDialect: e.dialect } : {},
|
|
261
263
|
force: ee,
|
|
262
264
|
onWarn: (e) => Q.warn("admin.import", { message: e }),
|
|
263
265
|
...e.assetSink ? { assetsAlreadyRestored: !0 } : {}
|
|
@@ -328,20 +330,20 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
328
330
|
await g.rm(te, {
|
|
329
331
|
recursive: !0,
|
|
330
332
|
force: !0
|
|
331
|
-
}), u !== void 0 && u !== "" && d !== void 0 && await
|
|
333
|
+
}), u !== void 0 && u !== "" && d !== void 0 && await aa(u);
|
|
332
334
|
}
|
|
333
|
-
},
|
|
335
|
+
}, ua = L({ scope: "voltro:admin-export" }), da = async (e) => {
|
|
334
336
|
let t = [];
|
|
335
337
|
for await (let n of e) t.push(Buffer.from(n));
|
|
336
338
|
return new Uint8Array(Buffer.concat(t));
|
|
337
|
-
},
|
|
339
|
+
}, fa = (e) => typeof e.tenant == "string" && e.tenant ? {
|
|
338
340
|
kind: "tenant",
|
|
339
341
|
tenantId: e.tenant
|
|
340
342
|
} : Array.isArray(e.tables) && e.tables.length ? {
|
|
341
343
|
kind: "tables",
|
|
342
344
|
tables: e.tables.filter((e) => typeof e == "string")
|
|
343
|
-
} : { kind: "all" },
|
|
344
|
-
let n =
|
|
345
|
+
} : { kind: "all" }, pa = (e) => async (t) => {
|
|
346
|
+
let n = Ji(t, e.secret);
|
|
345
347
|
if (n) return n;
|
|
346
348
|
let r;
|
|
347
349
|
try {
|
|
@@ -361,9 +363,9 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
361
363
|
});
|
|
362
364
|
}
|
|
363
365
|
}
|
|
364
|
-
let a = r.consistency === "snapshot" ? "snapshot" : i.consistency ?? "live", o = (typeof r.compression == "string" ? r.compression : void 0) ?? i.compression, ee = i.scope ??
|
|
366
|
+
let a = r.consistency === "snapshot" ? "snapshot" : i.consistency ?? "live", o = (typeof r.compression == "string" ? r.compression : void 0) ?? i.compression, ee = i.scope ?? fa(r), s = 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-"));
|
|
365
367
|
try {
|
|
366
|
-
let t = await W.runPromise(
|
|
368
|
+
let t = await W.runPromise(Fi({
|
|
367
369
|
store: e.store,
|
|
368
370
|
snapshot: e.snapshot,
|
|
369
371
|
dialect: e.dialect,
|
|
@@ -379,10 +381,10 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
379
381
|
if (s) {
|
|
380
382
|
if (!e.putArchive) return Z(501, { error: "storage transport not configured on this instance" });
|
|
381
383
|
let i = r.bundleKey;
|
|
382
|
-
return await e.putArchive(i, () =>
|
|
384
|
+
return await e.putArchive(i, () => Pi({
|
|
383
385
|
dir: f,
|
|
384
386
|
...c
|
|
385
|
-
})),
|
|
387
|
+
})), ua.info("admin.export", {
|
|
386
388
|
transport: "storage",
|
|
387
389
|
tables: t.tables.length,
|
|
388
390
|
rows: n,
|
|
@@ -396,11 +398,11 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
396
398
|
transport: "storage"
|
|
397
399
|
});
|
|
398
400
|
}
|
|
399
|
-
let u = await
|
|
401
|
+
let u = await da(Pi({
|
|
400
402
|
dir: f,
|
|
401
403
|
...c
|
|
402
404
|
}));
|
|
403
|
-
return
|
|
405
|
+
return ua.info("admin.export", {
|
|
404
406
|
transport: "download",
|
|
405
407
|
tables: t.tables.length,
|
|
406
408
|
rows: n,
|
|
@@ -417,7 +419,7 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
417
419
|
}
|
|
418
420
|
};
|
|
419
421
|
} catch (e) {
|
|
420
|
-
return
|
|
422
|
+
return ua.warn("admin.export failed", { error: e?.message ?? String(e) }), Z(500, {
|
|
421
423
|
error: "export failed",
|
|
422
424
|
message: e?.message ?? String(e)
|
|
423
425
|
});
|
|
@@ -427,8 +429,8 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
427
429
|
force: !0
|
|
428
430
|
});
|
|
429
431
|
}
|
|
430
|
-
},
|
|
431
|
-
let r = await W.runPromise(
|
|
432
|
+
}, ma = (e, t, n = {}) => (async function* () {
|
|
433
|
+
let r = await W.runPromise(_i(e, t).pipe(W.timeout(n.openTimeout ?? "30 seconds"))), i = await yi(r.stream), a = n.stallMs ?? 12e4, o, ee = () => {
|
|
432
434
|
o && clearTimeout(o), o = setTimeout(() => i.destroy(/* @__PURE__ */ Error(`storage read stalled for ${a}ms reading '${t}'`)), a);
|
|
433
435
|
};
|
|
434
436
|
try {
|
|
@@ -437,7 +439,7 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
437
439
|
} finally {
|
|
438
440
|
o && clearTimeout(o), i.destroy();
|
|
439
441
|
}
|
|
440
|
-
})(),
|
|
442
|
+
})(), ha = {
|
|
441
443
|
get: async () => void 0,
|
|
442
444
|
set: async () => {},
|
|
443
445
|
setWithTags: async () => {},
|
|
@@ -446,7 +448,7 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
446
448
|
clear: async () => {},
|
|
447
449
|
invalidateTag: async () => 0,
|
|
448
450
|
wrap: async (e, t, n) => n()
|
|
449
|
-
},
|
|
451
|
+
}, ga = async (e) => {
|
|
450
452
|
d(e.appProcedures ?? e.discovered, {
|
|
451
453
|
defaultDeny: e.security?.defaultDeny ?? !0,
|
|
452
454
|
commandHint: "`voltro serve`"
|
|
@@ -465,15 +467,15 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
465
467
|
durationMs: e.durationMs,
|
|
466
468
|
rowCount: e.rowCount
|
|
467
469
|
})
|
|
468
|
-
}), i = e.cache ??
|
|
470
|
+
}), i = e.cache ?? ha, a = e.kv ?? Kr, o, ee = () => void 0, c, l, u, f, p, m, h, _ = ue({
|
|
469
471
|
store: e.store,
|
|
470
472
|
warn: (e, t) => {
|
|
471
473
|
process.stderr.write(`[workflow] ${e} ${JSON.stringify(t)}\n`);
|
|
472
474
|
}
|
|
473
|
-
}), te = _.remember, ae = _.resolve, oe =
|
|
475
|
+
}), te = _.remember, ae = _.resolve, oe = xt({
|
|
474
476
|
authority: e.authority,
|
|
475
477
|
getStore: () => e.store
|
|
476
|
-
}), S = (e.discovered.workflows?.length ?? 0) > 0 ? Fr(() => o) : void 0, de = (e.discovered.workflows?.length ?? 0) > 0 || (e.discovered.eventTriggers?.length ?? 0) > 0, he = de || (e.discovered.workflowWorkers?.length ?? 0) > 0 || e.scheduleCoordination === "cluster", ge = e.tenantIsolation === "namespace", _e = (e.log ??
|
|
478
|
+
}), S = (e.discovered.workflows?.length ?? 0) > 0 ? Fr(() => o) : void 0, de = (e.discovered.workflows?.length ?? 0) > 0 || (e.discovered.eventTriggers?.length ?? 0) > 0, he = de || (e.discovered.workflowWorkers?.length ?? 0) > 0 || e.scheduleCoordination === "cluster", ge = e.tenantIsolation === "namespace", _e = (e.log ?? L({ scope: "voltro:serve" })).child("webhooks"), ve, ye, C = e.discovered.webhooks;
|
|
477
479
|
if (C && C.outgoing.length > 0 && e.workflowEngineLayer !== void 0) {
|
|
478
480
|
e.workflowEngineLayer;
|
|
479
481
|
let t = ut({
|
|
@@ -482,7 +484,7 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
482
484
|
cache: i,
|
|
483
485
|
kv: a
|
|
484
486
|
}), n = C.outgoing.map((e) => e.descriptor);
|
|
485
|
-
ye =
|
|
487
|
+
ye = Di.toLayer(wi(t, { events: n })), ve = Ti(t, async (e) => {
|
|
486
488
|
let t = u;
|
|
487
489
|
if (t === void 0) {
|
|
488
490
|
_e.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.", {
|
|
@@ -491,7 +493,7 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
491
493
|
});
|
|
492
494
|
return;
|
|
493
495
|
}
|
|
494
|
-
t.runPromise(
|
|
496
|
+
t.runPromise(Di.execute(e)).catch((t) => {
|
|
495
497
|
_e.error("deliverWebhook workflow crashed", {
|
|
496
498
|
deliveryId: e.deliveryId,
|
|
497
499
|
targetId: e.targetId
|
|
@@ -501,7 +503,7 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
501
503
|
}
|
|
502
504
|
let Se = /* @__PURE__ */ new Map();
|
|
503
505
|
if (C) for (let e of C.incoming) {
|
|
504
|
-
let t = e.descriptor.path ??
|
|
506
|
+
let t = e.descriptor.path ?? Ei(e.descriptor.id), n = `VOLTRO_WEBHOOK_SECRET_${e.descriptor.id.toUpperCase().replace(/[^A-Z0-9]/g, "_")}`, r = ki(e.descriptor, {
|
|
505
507
|
resolveSecret: async () => process.env[n] ?? null,
|
|
506
508
|
resolveWorkflows: () => S === void 0 ? void 0 : Wr(S, {
|
|
507
509
|
traceId: `incoming:${e.descriptor.id}`,
|
|
@@ -520,15 +522,15 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
520
522
|
});
|
|
521
523
|
Se.set(t, { handle: r });
|
|
522
524
|
}
|
|
523
|
-
wr(), Xr((t) => Tr(e.store, t.subjectId, t.resourceType, t.resourceId)) ||
|
|
524
|
-
let Ce = [], Te = [...e.discovered.outboxHandlers ?? [], ...
|
|
525
|
+
wr(), Xr((t) => Tr(e.store, t.subjectId, t.resourceType, t.resourceId)) || L({ scope: "voltro:serve" }).info("policy guards: using the app-registered tuple source");
|
|
526
|
+
let Ce = [], Te = [...e.discovered.outboxHandlers ?? [], ..._n((C?.outgoing.length ?? 0) + (C?.incoming.length ?? 0) + (C?.providers.length ?? 0), []) ? [{
|
|
525
527
|
file: "<framework>/webhooks",
|
|
526
528
|
id: "voltro-webhook-emit",
|
|
527
|
-
definition:
|
|
529
|
+
definition: Oi(() => ve)
|
|
528
530
|
}] : []], Ee = Te.length > 0 ? Fe({
|
|
529
531
|
handlers: Te,
|
|
530
532
|
store: e.store,
|
|
531
|
-
log: (e.log ??
|
|
533
|
+
log: (e.log ?? L({ scope: "voltro:serve" })).child("outbox"),
|
|
532
534
|
onChange: (t) => e.store.onChange((e) => t({
|
|
533
535
|
table: e.table,
|
|
534
536
|
op: e.op
|
|
@@ -540,7 +542,7 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
540
542
|
definitions: (e.discovered.connections ?? []).map((e) => e.definition),
|
|
541
543
|
store: e.store,
|
|
542
544
|
publicUrl: b(e.port ?? 4e3),
|
|
543
|
-
log: (e.log ??
|
|
545
|
+
log: (e.log ?? L({ scope: "voltro:serve" })).child("connections")
|
|
544
546
|
});
|
|
545
547
|
ot({
|
|
546
548
|
events: e.discovered.events ?? [],
|
|
@@ -551,7 +553,7 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
551
553
|
...(e.discovered.streams ?? []).map((e) => e.descriptor.name)
|
|
552
554
|
]
|
|
553
555
|
});
|
|
554
|
-
let Ae = (e.log ??
|
|
556
|
+
let Ae = (e.log ?? L({ scope: "voltro:serve" })).child("events"), je = e.broadcastNamespace ?? Qe(e.plugins, void 0), Me = E(e.plugins, je, Ae), Ne = e.membership?.instanceId ?? process.env.POD_NAME ?? process.env.HOSTNAME ?? `serve-${process.pid}`, Ie = e.membership ?? Mt(e.plugins, {
|
|
555
557
|
instanceId: Ne,
|
|
556
558
|
namespace: je,
|
|
557
559
|
meta: { mode: "serve" },
|
|
@@ -574,16 +576,16 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
574
576
|
...Ee === void 0 ? {} : { outbox: { nudge: Ee.nudge } },
|
|
575
577
|
...w.active ? { connections: { registry: w.registry } } : {},
|
|
576
578
|
eventBus: D.bus
|
|
577
|
-
}), ze = G.succeed(rr, g), Be = G.succeed(sr,
|
|
579
|
+
}), ze = G.succeed(rr, g), Be = G.succeed(sr, Rt), He = G.succeed(ir, Ve), Ge = G.succeed(cr, we), qe = (t, n) => {
|
|
578
580
|
let r = t.pipe(W.provide(Pr(n)));
|
|
579
581
|
return (e.baseLayer ? r.pipe(W.provide(e.baseLayer)) : r).pipe(W.provide(ze)).pipe(W.provide(Be)).pipe(W.provide(He)).pipe(W.provide(Ge));
|
|
580
582
|
}, Ye = (e, t) => {
|
|
581
583
|
let n = qe(e, t);
|
|
582
584
|
return Y(n);
|
|
583
|
-
}, Xe =
|
|
585
|
+
}, Xe = bn(), et = le(e.plugins ?? [], Xe), tt = Oe({
|
|
584
586
|
plugins: e.plugins ?? [],
|
|
585
587
|
metrics: Xe,
|
|
586
|
-
log: e.log ??
|
|
588
|
+
log: e.log ?? L({ scope: "voltro:serve" })
|
|
587
589
|
}), nt = x(e.plugins ?? [], Xe), rt = e.security?.defaultDeny ?? !0, at = Lr({
|
|
588
590
|
store: e.store,
|
|
589
591
|
defaultDeny: rt,
|
|
@@ -597,7 +599,7 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
597
599
|
}), ct = be();
|
|
598
600
|
{
|
|
599
601
|
let t = Je();
|
|
600
|
-
t !== void 0 && (e.log ??
|
|
602
|
+
t !== void 0 && (e.log ?? L({ scope: "voltro:serve" })).info(t);
|
|
601
603
|
}
|
|
602
604
|
let lt = Pe({
|
|
603
605
|
store: e.store,
|
|
@@ -619,118 +621,119 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
619
621
|
finalize: (e, t) => pt(e, t.subject),
|
|
620
622
|
provideEffect: qe,
|
|
621
623
|
...et.query === void 0 ? {} : { interceptor: et.query }
|
|
622
|
-
},
|
|
624
|
+
}, gt = zr(mt), O = Rr({
|
|
623
625
|
...mt,
|
|
624
626
|
queryRows: (t, n) => e.store.query(t).then((e) => ai(t.table, e, n.subject))
|
|
625
|
-
}),
|
|
627
|
+
}), _t = Hr({
|
|
626
628
|
...mt,
|
|
627
629
|
subscribeDescriptor: (e, t, n) => r.subscribe(e, t, n),
|
|
628
630
|
subscribeComputed: (e, t, n) => r.subscribeComputed(e, t, n)
|
|
629
|
-
}),
|
|
631
|
+
}), k = (e) => e.filter((e) => Pn(e.descriptor)), A = {};
|
|
630
632
|
for (let t of [
|
|
631
|
-
...
|
|
633
|
+
...k(e.discovered.queries),
|
|
632
634
|
...ct.queries,
|
|
633
635
|
...lt.queries,
|
|
634
636
|
...w.queries
|
|
635
|
-
])
|
|
637
|
+
]) A[t.descriptor.name] = (e) => q(gt(t, e), r, `subscription.${t.descriptor.name}`, void 0, void 0, Vr(t, e));
|
|
636
638
|
for (let t of [
|
|
637
|
-
...
|
|
639
|
+
...k(e.discovered.mutations),
|
|
638
640
|
...ct.mutations,
|
|
639
641
|
...lt.mutations,
|
|
640
642
|
...w.mutations
|
|
641
643
|
]) {
|
|
642
644
|
let n = Ir(t.descriptor.output);
|
|
643
|
-
|
|
645
|
+
A[t.descriptor.name] = (r) => K(async (e, n) => at(t, e, n), r, `mutation.${t.descriptor.name}`, n, e.idempotency, Ln(t.descriptor, "mutation"));
|
|
644
646
|
}
|
|
645
|
-
for (let t of [...
|
|
647
|
+
for (let t of [...k(e.discovered.actions), ...w.actions]) {
|
|
646
648
|
let n = Ir(t.descriptor.output);
|
|
647
|
-
|
|
649
|
+
A[t.descriptor.name] = (r) => K(async (e, n) => ft(t, e, n), r, `action.${t.descriptor.name}`, n, e.idempotency, Ln(t.descriptor, "action"));
|
|
648
650
|
}
|
|
649
|
-
let
|
|
651
|
+
let vt = () => `public-${Math.random().toString(36).slice(2, 10)}`, yt = [
|
|
650
652
|
...e.discovered.queries.filter((e) => e.descriptor.publicApi !== void 0).map((e) => ({
|
|
651
653
|
descriptor: e.descriptor,
|
|
652
|
-
invoke: (t, n) =>
|
|
654
|
+
invoke: (t, n) => O(e, t, {
|
|
653
655
|
subject: n.subject,
|
|
654
|
-
traceId:
|
|
656
|
+
traceId: vt()
|
|
655
657
|
}),
|
|
656
|
-
subscribe: (t, n, r) =>
|
|
658
|
+
subscribe: (t, n, r) => _t(e, t, {
|
|
657
659
|
subject: n.subject,
|
|
658
|
-
traceId:
|
|
660
|
+
traceId: vt()
|
|
659
661
|
}, r)
|
|
660
662
|
})),
|
|
661
663
|
...e.discovered.mutations.filter((e) => e.descriptor.publicApi !== void 0).map((e) => ({
|
|
662
664
|
descriptor: e.descriptor,
|
|
663
665
|
invoke: (t, n) => at(e, t, {
|
|
664
666
|
subject: n.subject,
|
|
665
|
-
traceId:
|
|
667
|
+
traceId: vt()
|
|
666
668
|
})
|
|
667
669
|
})),
|
|
668
670
|
...e.discovered.actions.filter((e) => e.descriptor.publicApi !== void 0).map((e) => ({
|
|
669
671
|
descriptor: e.descriptor,
|
|
670
672
|
invoke: (t, n) => ft(e, t, {
|
|
671
673
|
subject: n.subject,
|
|
672
|
-
traceId:
|
|
674
|
+
traceId: vt()
|
|
673
675
|
})
|
|
674
676
|
}))
|
|
675
|
-
],
|
|
677
|
+
], bt = {
|
|
676
678
|
candidates: ce({
|
|
677
679
|
queries: e.discovered.queries,
|
|
678
680
|
mutations: e.discovered.mutations,
|
|
679
681
|
actions: e.discovered.actions,
|
|
680
682
|
descriptorOf: (e) => e.descriptor,
|
|
681
|
-
runQuery: (e, t, n) => Promise.resolve(
|
|
683
|
+
runQuery: (e, t, n) => Promise.resolve(O(e, t, n)),
|
|
682
684
|
runMutation: (e, t, n) => Promise.resolve(at(e, t, n)),
|
|
683
685
|
runAction: (e, t, n) => Promise.resolve(ft(e, t, n))
|
|
684
686
|
}),
|
|
685
687
|
policy: e.agents?.tools ?? {},
|
|
686
688
|
mcpEnabled: e.agents?.mcp === !0,
|
|
687
689
|
resolveSubject: (t) => e.resolveSubject(t, -1).then((e) => e.subject)
|
|
688
|
-
},
|
|
690
|
+
}, St = ht({
|
|
689
691
|
...e.restRoutes === void 0 ? {} : { restRoutes: e.restRoutes },
|
|
690
|
-
publicApiEntries:
|
|
692
|
+
publicApiEntries: yt,
|
|
691
693
|
store: e.store,
|
|
692
694
|
resolveSubject: (t) => e.resolveSubject(t, -1).then((e) => e.subject),
|
|
693
695
|
...e.idempotency === void 0 ? {} : { idempotency: e.idempotency },
|
|
694
|
-
log: e.log ??
|
|
695
|
-
}),
|
|
696
|
-
let { Readable: n } = await import("node:stream"), r = mi(), i =
|
|
697
|
-
await W.runPromise(
|
|
698
|
-
},
|
|
696
|
+
log: e.log ?? L({ scope: "voltro:serve" })
|
|
697
|
+
}), Ct = e.dataTransferSecret ?? process.env.VOLTRO_DATA_TRANSFER_SECRET, wt = async (e, t) => {
|
|
698
|
+
let { Readable: n } = await import("node:stream"), r = mi(), i = gi("storage", () => n.from(t()));
|
|
699
|
+
await W.runPromise(vi(r, e, i, { contentType: "application/octet-stream" }));
|
|
700
|
+
}, Tt = Ct && Ct.length >= 16 ? [{
|
|
699
701
|
method: "POST",
|
|
700
|
-
path:
|
|
701
|
-
handle:
|
|
702
|
-
secret:
|
|
702
|
+
path: Wi,
|
|
703
|
+
handle: la({
|
|
704
|
+
secret: Ct,
|
|
703
705
|
store: e.store,
|
|
704
706
|
...e.dataTransferSnapshot ? { snapshot: e.dataTransferSnapshot } : {},
|
|
705
|
-
|
|
706
|
-
|
|
707
|
+
...e.dataTransferDialect ? { dialect: e.dataTransferDialect } : {},
|
|
708
|
+
assetSink: Li(mi()),
|
|
709
|
+
openArchive: (e) => ma(mi(), e),
|
|
707
710
|
refreshSubscriptions: (e) => {
|
|
708
711
|
r.refreshAll(e);
|
|
709
712
|
},
|
|
710
|
-
putArchive:
|
|
713
|
+
putArchive: wt,
|
|
711
714
|
...e.dataTransferDialect ? { dialect: e.dataTransferDialect } : {}
|
|
712
715
|
})
|
|
713
716
|
}, {
|
|
714
717
|
method: "POST",
|
|
715
|
-
path:
|
|
716
|
-
handle:
|
|
717
|
-
secret:
|
|
718
|
+
path: Gi,
|
|
719
|
+
handle: pa({
|
|
720
|
+
secret: Ct,
|
|
718
721
|
store: e.store,
|
|
719
722
|
snapshot: e.dataTransferSnapshot ?? { tables: [] },
|
|
720
723
|
dialect: e.dataTransferDialect ?? "memory",
|
|
721
724
|
tenantTables: [...e.tenantScopedTables],
|
|
722
|
-
loadProfile:
|
|
723
|
-
assetSource:
|
|
724
|
-
putArchive:
|
|
725
|
+
loadProfile: wn,
|
|
726
|
+
assetSource: Ri(mi(), e.store),
|
|
727
|
+
putArchive: wt
|
|
725
728
|
})
|
|
726
|
-
}] : [],
|
|
729
|
+
}] : [], Et = [
|
|
727
730
|
...e.httpRoutes ?? [],
|
|
728
|
-
...
|
|
729
|
-
...
|
|
731
|
+
...St.httpRoutes,
|
|
732
|
+
...Tt,
|
|
730
733
|
...w.httpRoutes
|
|
731
734
|
];
|
|
732
|
-
Object.assign(
|
|
733
|
-
for (let t of
|
|
735
|
+
Object.assign(A, D.handlers);
|
|
736
|
+
for (let t of k(e.discovered.streams ?? [])) A[t.descriptor.name] = (n) => hr((r) => ci(r, (r) => {
|
|
734
737
|
let i = Re(r), a = t.executor(n, i);
|
|
735
738
|
if (W.isEffect(a)) {
|
|
736
739
|
let t = a.pipe(W.provide(Pr(i.store)));
|
|
@@ -738,7 +741,7 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
738
741
|
}
|
|
739
742
|
return typeof a == "object" && a && typeof a.then == "function" ? W.promise(() => a) : a;
|
|
740
743
|
}), `stream.${t.descriptor.name}`);
|
|
741
|
-
for (let t of e.discovered.workflows ?? [])
|
|
744
|
+
for (let t of e.discovered.workflows ?? []) A[t.definition.name] = (e) => K(async (e, n) => {
|
|
742
745
|
let r = n;
|
|
743
746
|
return Wr(S, {
|
|
744
747
|
subject: r.subject,
|
|
@@ -746,7 +749,7 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
746
749
|
source: "workflow-rpc"
|
|
747
750
|
}).start(t.definition.name, e);
|
|
748
751
|
}, e, `workflow.${t.definition.name}`);
|
|
749
|
-
de && (
|
|
752
|
+
de && (A[Vn.name] = (e) => q(gt({
|
|
750
753
|
descriptor: Vn,
|
|
751
754
|
executor: (e) => {
|
|
752
755
|
let t = e.id;
|
|
@@ -762,7 +765,7 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
762
765
|
projection: void 0
|
|
763
766
|
};
|
|
764
767
|
}
|
|
765
|
-
}, e), r, `subscription.${Vn.name}`),
|
|
768
|
+
}, e), r, `subscription.${Vn.name}`), A[Un.name] = (e) => q(gt({
|
|
766
769
|
descriptor: Un,
|
|
767
770
|
executor: (e) => {
|
|
768
771
|
let t = e, n = [...t.tag === void 0 ? [] : [U("tag", t.tag)], ...t.status === void 0 ? [] : [U("status", t.status)]], r = Number.isFinite(t.limit) && t.limit !== void 0 ? Math.min(Math.max(Math.floor(t.limit), 1), 500) : 100;
|
|
@@ -778,7 +781,7 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
778
781
|
projection: void 0
|
|
779
782
|
};
|
|
780
783
|
}
|
|
781
|
-
}, e), r, `subscription.${Un.name}`),
|
|
784
|
+
}, e), r, `subscription.${Un.name}`), A[Hn.name] = (e) => q(gt({
|
|
782
785
|
descriptor: Hn,
|
|
783
786
|
executor: (e) => {
|
|
784
787
|
let t = e.runId;
|
|
@@ -794,7 +797,7 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
794
797
|
projection: void 0
|
|
795
798
|
};
|
|
796
799
|
}
|
|
797
|
-
}, e), r, `subscription.${Hn.name}`),
|
|
800
|
+
}, e), r, `subscription.${Hn.name}`), A[Bn.name] = (e) => q(gt({
|
|
798
801
|
descriptor: Bn,
|
|
799
802
|
executor: (e) => {
|
|
800
803
|
let t = e.runId;
|
|
@@ -810,8 +813,8 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
810
813
|
projection: void 0
|
|
811
814
|
};
|
|
812
815
|
}
|
|
813
|
-
}, e), r, `subscription.${Bn.name}`),
|
|
814
|
-
descriptor:
|
|
816
|
+
}, e), r, `subscription.${Bn.name}`), A[B.name] = (e) => q(gt({
|
|
817
|
+
descriptor: B,
|
|
815
818
|
executor: (e) => {
|
|
816
819
|
let t = e;
|
|
817
820
|
return {
|
|
@@ -826,7 +829,7 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
826
829
|
projection: void 0
|
|
827
830
|
};
|
|
828
831
|
}
|
|
829
|
-
}, e), r, `subscription.${
|
|
832
|
+
}, e), r, `subscription.${B.name}`), A[V.name] = (e) => q(gt({
|
|
830
833
|
descriptor: V,
|
|
831
834
|
executor: (e) => {
|
|
832
835
|
let t = e.eventId;
|
|
@@ -842,67 +845,67 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
842
845
|
projection: void 0
|
|
843
846
|
};
|
|
844
847
|
}
|
|
845
|
-
}, e), r, `subscription.${V.name}`),
|
|
848
|
+
}, e), r, `subscription.${V.name}`), A[Rn.name] = (t) => K(async (t, n) => {
|
|
846
849
|
let r = t;
|
|
847
|
-
return await
|
|
848
|
-
}, t, `action.${
|
|
850
|
+
return await j(e.store, n.subject, { executionId: r.executionId }), await S.cancel(r.workflowName, r.executionId), await Ft(r.workflowName, r.executionId, "workflow.cancel"), { ok: !0 };
|
|
851
|
+
}, t, `action.${Rn.name}`), A[zn.name] = (t) => K(async (t, n) => {
|
|
849
852
|
let r = t;
|
|
850
|
-
return await
|
|
851
|
-
}, t, `action.${zn.name}`),
|
|
853
|
+
return await j(e.store, n.subject, { executionId: r.executionId }), await S.resume(r.workflowName, r.executionId), { ok: !0 };
|
|
854
|
+
}, t, `action.${zn.name}`), A[Wn.name] = (t) => K(async (t, n) => {
|
|
852
855
|
let r = t;
|
|
853
|
-
return await
|
|
854
|
-
}, t, `action.${Wn.name}`),
|
|
856
|
+
return await j(e.store, n.subject, { id: r.id }), S.signal({ id: r.id }, r.signalName, r.payload);
|
|
857
|
+
}, t, `action.${Wn.name}`), A[Gn.name] = (t) => K(async (t, n) => {
|
|
855
858
|
let r = t;
|
|
856
|
-
return await
|
|
859
|
+
return await j(e.store, n.subject, { id: r.id }), S.update({ id: r.id }, r.updateName, r.payload, r.timeoutMs === void 0 ? void 0 : { timeoutMs: r.timeoutMs });
|
|
857
860
|
}, t, `action.${Gn.name}`));
|
|
858
|
-
let
|
|
859
|
-
...
|
|
860
|
-
...
|
|
861
|
-
...
|
|
862
|
-
...ct.queries.map((e) =>
|
|
863
|
-
...ct.mutations.map((e) =>
|
|
864
|
-
...lt.queries.map((e) =>
|
|
865
|
-
...lt.mutations.map((e) =>
|
|
866
|
-
...w.queries.map((e) =>
|
|
867
|
-
...w.mutations.map((e) =>
|
|
868
|
-
...w.actions.map((e) =>
|
|
869
|
-
...
|
|
861
|
+
let Dt = [
|
|
862
|
+
...k(e.discovered.queries).map((e) => z(e.descriptor)),
|
|
863
|
+
...k(e.discovered.mutations).map((e) => Fn(e.descriptor)),
|
|
864
|
+
...k(e.discovered.actions).map((e) => R(e.descriptor)),
|
|
865
|
+
...ct.queries.map((e) => z(e.descriptor)),
|
|
866
|
+
...ct.mutations.map((e) => Fn(e.descriptor)),
|
|
867
|
+
...lt.queries.map((e) => z(e.descriptor)),
|
|
868
|
+
...lt.mutations.map((e) => Fn(e.descriptor)),
|
|
869
|
+
...w.queries.map((e) => z(e.descriptor)),
|
|
870
|
+
...w.mutations.map((e) => Fn(e.descriptor)),
|
|
871
|
+
...w.actions.map((e) => R(e.descriptor)),
|
|
872
|
+
...k(e.discovered.streams ?? []).map((e) => In(e.descriptor)),
|
|
870
873
|
...D.rpcs,
|
|
871
874
|
...(e.discovered.workflows ?? []).map((e) => li(e.definition)),
|
|
872
875
|
...de ? [
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
B
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
876
|
+
z(Vn),
|
|
877
|
+
z(Un),
|
|
878
|
+
z(Hn),
|
|
879
|
+
z(Bn),
|
|
880
|
+
z(B),
|
|
881
|
+
z(V),
|
|
882
|
+
R(Rn),
|
|
883
|
+
R(zn),
|
|
884
|
+
R(Wn),
|
|
885
|
+
R(Gn)
|
|
883
886
|
] : []
|
|
884
|
-
],
|
|
887
|
+
], Ot = pi.make(...Dt).middleware(jn).middleware(Mn), kt = Mr({ resolveSubject: ({ headers: t, clientId: n }) => e.resolveSubject(t, n) }), At = e.dormancyTenantId ?? ar, Nt = e.dormancy === "sleep" ? {
|
|
885
888
|
register: (t, n, r) => Zr(e.store, {
|
|
886
|
-
tenantId: r ??
|
|
889
|
+
tenantId: r ?? At,
|
|
887
890
|
kind: "workflow",
|
|
888
891
|
refId: t,
|
|
889
892
|
wakeAt: n
|
|
890
893
|
}),
|
|
891
894
|
cancel: (t, n) => _r(e.store, {
|
|
892
|
-
tenantId: n ??
|
|
895
|
+
tenantId: n ?? At,
|
|
893
896
|
kind: "workflow",
|
|
894
897
|
refId: t
|
|
895
898
|
}).then(() => {})
|
|
896
|
-
} : void 0,
|
|
899
|
+
} : void 0, M = he ? await import("@voltro/workflow") : void 0, N = M?.makeWorkflowRunRecorder({
|
|
897
900
|
store: e.store,
|
|
898
901
|
...e.workflowRecording === void 0 ? {} : { recording: e.workflowRecording },
|
|
899
|
-
...
|
|
900
|
-
}),
|
|
901
|
-
await
|
|
902
|
+
...Nt === void 0 ? {} : { wakeups: Nt }
|
|
903
|
+
}), Pt = async (t, n) => {
|
|
904
|
+
await M.closeWorkflowChildrenForParent({
|
|
902
905
|
store: e.store,
|
|
903
906
|
parentExecutionId: t,
|
|
904
907
|
parentStatus: n,
|
|
905
|
-
recorder:
|
|
908
|
+
recorder: N,
|
|
906
909
|
log: { warn: (e, t) => {
|
|
907
910
|
process.stderr.write(`[workflow] ${e} ${t ? JSON.stringify(t) : ""}\n`);
|
|
908
911
|
} },
|
|
@@ -913,7 +916,7 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
913
916
|
await u.runPromise(r.definition.interrupt(n));
|
|
914
917
|
}
|
|
915
918
|
});
|
|
916
|
-
},
|
|
919
|
+
}, Ft = async (t, n, r) => {
|
|
917
920
|
let i = (await e.store.query({
|
|
918
921
|
table: "_voltro_workflow_runs",
|
|
919
922
|
order: [],
|
|
@@ -928,7 +931,7 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
928
931
|
cancelled: !0,
|
|
929
932
|
completedAt: /* @__PURE__ */ new Date()
|
|
930
933
|
}), o = i.subject?.tenantId ?? void 0;
|
|
931
|
-
a && await
|
|
934
|
+
a && await N.recordEvent({
|
|
932
935
|
runId: i.id,
|
|
933
936
|
eventType: "run-cancelled",
|
|
934
937
|
payload: {
|
|
@@ -937,8 +940,8 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
937
940
|
executionId: n,
|
|
938
941
|
...o == null ? {} : { tenantId: o }
|
|
939
942
|
}
|
|
940
|
-
}), a && await
|
|
941
|
-
},
|
|
943
|
+
}), a && await Pt(n, "cancelled");
|
|
944
|
+
}, It = [
|
|
942
945
|
...Gr(e.discovered.workflows ?? [], {
|
|
943
946
|
buildContext: (t, n) => e.buildContextForWorkflow?.(t, n) ?? Re({
|
|
944
947
|
subject: t.subject,
|
|
@@ -947,8 +950,8 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
947
950
|
resolveStartContext: ae,
|
|
948
951
|
...oe === void 0 ? {} : { resolveAuthority: oe }
|
|
949
952
|
}, (t, n, r) => {
|
|
950
|
-
let i =
|
|
951
|
-
return
|
|
953
|
+
let i = M.getWorkflowVersionMetadata(t.definition);
|
|
954
|
+
return M.wrapWorkflowExecuteWithRunRecording({
|
|
952
955
|
name: t.definition.name,
|
|
953
956
|
store: e.store,
|
|
954
957
|
subject: r.subject,
|
|
@@ -959,26 +962,26 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
959
962
|
workflowPatches: i.patches,
|
|
960
963
|
parentExecutionId: r?.parentExecutionId ?? null,
|
|
961
964
|
parentClosePolicy: r?.parentClosePolicy ?? null,
|
|
962
|
-
onParentClose: ({ executionId: e, status: t }) =>
|
|
965
|
+
onParentClose: ({ executionId: e, status: t }) => Pt(e, t),
|
|
963
966
|
...dt(t.definition),
|
|
964
967
|
onTerminal: async ({ executionId: e }) => {
|
|
965
968
|
await l?.gate.release(e);
|
|
966
969
|
},
|
|
967
|
-
recorder:
|
|
970
|
+
recorder: N,
|
|
968
971
|
pluginWorkflowStepLayer: nt,
|
|
969
972
|
recordRun: Yr
|
|
970
973
|
}, n);
|
|
971
974
|
}),
|
|
972
975
|
...e.discovered.workflowWorkers ?? [],
|
|
973
976
|
...ye === void 0 ? [] : [ye]
|
|
974
|
-
],
|
|
977
|
+
], Lt = [...(e.discovered.workflows ?? []).map((e) => e.definition.name).filter(Boolean), ...ye === void 0 ? [] : ["voltro.deliverWebhook"]], zt = It.length > 0 ? G.mergeAll(...It) : G.empty;
|
|
975
978
|
if (((e.discovered.workflows?.length ?? 0) > 0 || (e.discovered.workflowWorkers?.length ?? 0) > 0 || e.scheduleCoordination === "cluster" || ye !== void 0) && e.workflowEngineLayer !== void 0) {
|
|
976
|
-
let t =
|
|
977
|
-
u = Zn.make(e.baseLayer === void 0 ? t : t.pipe(G.provideMerge(e.baseLayer))), await u.runPromise(W.void), (e.log ??
|
|
979
|
+
let t = zt.pipe(G.provideMerge(e.workflowEngineLayer));
|
|
980
|
+
u = Zn.make(e.baseLayer === void 0 ? t : t.pipe(G.provideMerge(e.baseLayer))), await u.runPromise(W.void), (e.log ?? L({ scope: "voltro:serve" })).child("workflow").info(`workflow runtime ready — ${Lt.length} entity type(s) registered`, { entities: Lt });
|
|
978
981
|
let n = await import("@voltro/workflow/cluster"), r = (e) => u.runPromise(n.redriveFailedRun(e)), i = (e) => u.runPromise(n.resumeRunFromStep(e));
|
|
979
|
-
m = await
|
|
980
|
-
provider:
|
|
981
|
-
crossReplica:
|
|
982
|
+
m = await Bt({
|
|
983
|
+
provider: Ni(e.plugins ?? [])?.broadcast?.provider,
|
|
984
|
+
crossReplica: Ni(e.plugins ?? [])?.broadcast?.crossReplica ?? !1,
|
|
982
985
|
namespace: je,
|
|
983
986
|
replicaId: crypto.randomUUID(),
|
|
984
987
|
pollStorage: () => u.runPromise(n.pollWorkflowStorage),
|
|
@@ -987,14 +990,14 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
987
990
|
op: e.op,
|
|
988
991
|
...e.origin === void 0 ? {} : { origin: e.origin }
|
|
989
992
|
})),
|
|
990
|
-
log: (e.log ??
|
|
993
|
+
log: (e.log ?? L({ scope: "voltro:serve" })).child("workflow")
|
|
991
994
|
}), f = async (t) => {
|
|
992
995
|
let n = await De({
|
|
993
996
|
store: e.store,
|
|
994
997
|
workflows: e.discovered.workflows ?? [],
|
|
995
998
|
runRedrive: r
|
|
996
999
|
}, t.runId);
|
|
997
|
-
return n.statusReset && await
|
|
1000
|
+
return n.statusReset && await N.recordEvent({
|
|
998
1001
|
runId: t.runId,
|
|
999
1002
|
eventType: "run-redriven",
|
|
1000
1003
|
payload: {
|
|
@@ -1012,7 +1015,7 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
1012
1015
|
workflows: e.discovered.workflows ?? [],
|
|
1013
1016
|
runResume: i
|
|
1014
1017
|
}, t.runId, t.step);
|
|
1015
|
-
return n.statusReset && await
|
|
1018
|
+
return n.statusReset && await N.recordEvent({
|
|
1016
1019
|
runId: t.runId,
|
|
1017
1020
|
eventType: "run-redriven",
|
|
1018
1021
|
payload: {
|
|
@@ -1042,14 +1045,14 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
1042
1045
|
}
|
|
1043
1046
|
}, h, g = () => {
|
|
1044
1047
|
if (h !== void 0) return h;
|
|
1045
|
-
if (o !== void 0 &&
|
|
1048
|
+
if (o !== void 0 && N !== void 0) return h = ne({
|
|
1046
1049
|
store: e.store,
|
|
1047
|
-
log:
|
|
1050
|
+
log: I,
|
|
1048
1051
|
workflows: e.discovered.workflows ?? [],
|
|
1049
1052
|
workflowsProxy: o,
|
|
1050
1053
|
workflowRuntime: u,
|
|
1051
|
-
workflowRunRecorder:
|
|
1052
|
-
closeChildrenForParent:
|
|
1054
|
+
workflowRunRecorder: N,
|
|
1055
|
+
closeChildrenForParent: Pt
|
|
1053
1056
|
}), h;
|
|
1054
1057
|
};
|
|
1055
1058
|
ee = g, l = $e({
|
|
@@ -1067,7 +1070,7 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
1067
1070
|
workflows: e.discovered.workflows ?? [],
|
|
1068
1071
|
facade: () => o,
|
|
1069
1072
|
cancelRunWithReason: g,
|
|
1070
|
-
recordRunEvent: () =>
|
|
1073
|
+
recordRunEvent: () => N?.recordEvent,
|
|
1071
1074
|
...e.workflowStaleness === void 0 ? {} : { staleness: e.workflowStaleness },
|
|
1072
1075
|
...e.workflowSuspendSignalHintMs === void 0 ? {} : { suspendSignalHintMs: e.workflowSuspendSignalHintMs },
|
|
1073
1076
|
scheduleCoordinated: s,
|
|
@@ -1093,8 +1096,8 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
1093
1096
|
tickIntervalMs: e.scheduling.inferenceTickMs
|
|
1094
1097
|
},
|
|
1095
1098
|
enabled: (e.discovered.workflows?.length ?? 0) > 0,
|
|
1096
|
-
resumeSignal: () => u === void 0 ||
|
|
1097
|
-
await u.runPromise(
|
|
1099
|
+
resumeSignal: () => u === void 0 || M === void 0 ? void 0 : async ({ executionId: t, workflowName: n, signalName: r, payload: i }) => {
|
|
1100
|
+
await u.runPromise(M.completeSuspendingSignal({
|
|
1098
1101
|
store: e.store,
|
|
1099
1102
|
target: Ke(t, n),
|
|
1100
1103
|
signalName: r,
|
|
@@ -1117,23 +1120,23 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
1117
1120
|
},
|
|
1118
1121
|
rememberStartContext: te,
|
|
1119
1122
|
signal: async (t, n, r) => {
|
|
1120
|
-
let i = await
|
|
1123
|
+
let i = await M.sendWorkflowSignal({
|
|
1121
1124
|
store: e.store,
|
|
1122
|
-
recorder:
|
|
1125
|
+
recorder: N,
|
|
1123
1126
|
target: t,
|
|
1124
1127
|
signalName: n,
|
|
1125
1128
|
payload: r
|
|
1126
1129
|
});
|
|
1127
|
-
return await u.runPromise(
|
|
1130
|
+
return await u.runPromise(M.completeSuspendingSignal({
|
|
1128
1131
|
store: e.store,
|
|
1129
1132
|
target: t,
|
|
1130
1133
|
signalName: n,
|
|
1131
1134
|
payload: r
|
|
1132
1135
|
})).catch(() => {}), i;
|
|
1133
1136
|
},
|
|
1134
|
-
update: (t, n, r, i) =>
|
|
1137
|
+
update: (t, n, r, i) => M.sendWorkflowUpdate({
|
|
1135
1138
|
store: e.store,
|
|
1136
|
-
recorder:
|
|
1139
|
+
recorder: N,
|
|
1137
1140
|
target: t,
|
|
1138
1141
|
updateName: n,
|
|
1139
1142
|
payload: r,
|
|
@@ -1152,32 +1155,32 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
1152
1155
|
}, t).then((e) => e.outcome)
|
|
1153
1156
|
}) : void 0;
|
|
1154
1157
|
}
|
|
1155
|
-
let
|
|
1158
|
+
let Vt = G.mergeAll(Ot.toLayer(A), kt), Ht = it(A, e.discovered.queries.map((e) => e.descriptor.name), de), Ut = G.mergeAll(Ot.toLayer(Ht), kt), P = e.observability, Wt = await gr({
|
|
1156
1159
|
...e.appName === void 0 ? {} : { serviceName: e.appName },
|
|
1157
|
-
...
|
|
1158
|
-
...
|
|
1159
|
-
...
|
|
1160
|
-
...
|
|
1161
|
-
}),
|
|
1162
|
-
group:
|
|
1163
|
-
handlersLayer:
|
|
1164
|
-
httpHandlersLayer:
|
|
1160
|
+
...P && P.spanProcessors.length > 0 ? { extraSpanProcessors: P.spanProcessors } : {},
|
|
1161
|
+
...P && P.metricReaders.length > 0 ? { extraMetricReaders: P.metricReaders } : {},
|
|
1162
|
+
...P && Object.keys(P.resourceAttributes).length > 0 ? { resourceAttributes: P.resourceAttributes } : {},
|
|
1163
|
+
...P && P.sampler !== void 0 ? { sampler: P.sampler } : {}
|
|
1164
|
+
}), Gt = !1, F = e.store.ping ? () => e.store.ping().then(() => !0).catch(() => !1) : void 0, { server: Kt, shutdown: qt } = ri({
|
|
1165
|
+
group: Ot,
|
|
1166
|
+
handlersLayer: Vt,
|
|
1167
|
+
httpHandlersLayer: Ut,
|
|
1165
1168
|
port: e.port ?? 4e3,
|
|
1166
1169
|
...e.host === void 0 ? {} : { host: e.host },
|
|
1167
1170
|
path: e.path ?? "/ws",
|
|
1168
|
-
tracerLayer:
|
|
1171
|
+
tracerLayer: Wt.layer,
|
|
1169
1172
|
security: re(e),
|
|
1170
1173
|
...tt,
|
|
1171
1174
|
healthCheck: {
|
|
1172
|
-
isReady: () =>
|
|
1173
|
-
...
|
|
1175
|
+
isReady: () => Gt,
|
|
1176
|
+
...F ? { ping: F } : {}
|
|
1174
1177
|
},
|
|
1175
|
-
...
|
|
1178
|
+
...Et.length > 0 ? { httpRoutes: Et } : {},
|
|
1176
1179
|
...e.getStore === void 0 ? {} : { getStore: e.getStore },
|
|
1177
1180
|
...Se.size > 0 ? { webhookRoutes: Se } : {},
|
|
1178
1181
|
...e.inspectRoute === void 0 ? {} : { inspectRoute: e.inspectRoute }
|
|
1179
|
-
}),
|
|
1180
|
-
if (await mr(
|
|
1182
|
+
}), Jt = Ui(Kt);
|
|
1183
|
+
if (await mr(Kt), (e.discovered.schedules?.length ?? 0) > 0) {
|
|
1181
1184
|
let t = (e.scheduleCoordination ?? "single") === "advisoryLock" ? Dr(e.store, e.scheduleReplicaId ?? `pid-${process.pid}`) : ni;
|
|
1182
1185
|
h = await ii(e.discovered.schedules ?? [], {
|
|
1183
1186
|
store: e.store,
|
|
@@ -1207,9 +1210,9 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
1207
1210
|
...e.onScheduleRunEvent === void 0 ? {} : { onRunEvent: e.onScheduleRunEvent }
|
|
1208
1211
|
}), e.onSchedulerReady?.(h);
|
|
1209
1212
|
}
|
|
1210
|
-
let
|
|
1211
|
-
if ((e.discovered.subscribers?.length ?? 0) > 0 && (
|
|
1212
|
-
let t =
|
|
1213
|
+
let I = e.log ?? L({ scope: "voltro:serve" }), Yt, Xt;
|
|
1214
|
+
if ((e.discovered.subscribers?.length ?? 0) > 0 && (Yt = xe(e.discovered.subscribers ?? [], e.store, I.child("subscribe"), e.schemaRegistry, D.bus)), (e.discovered.reactions?.length ?? 0) > 0) {
|
|
1215
|
+
let t = I.child("reaction"), n = async (n, r) => {
|
|
1213
1216
|
if (n.kind === "workflow") {
|
|
1214
1217
|
if (S === void 0) {
|
|
1215
1218
|
t.warn("reaction workflow act skipped — no workflow engine in this app", { workflow: n.workflow });
|
|
@@ -1225,7 +1228,7 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
1225
1228
|
await pe(n.agent, r, {
|
|
1226
1229
|
findAgentSend: (t) => e.discovered.actions.find((e) => e.descriptor.name === `${t}.send`),
|
|
1227
1230
|
runAction: (e, t, n) => Promise.resolve(ft(e, t, n)),
|
|
1228
|
-
makeSubject: (e) =>
|
|
1231
|
+
makeSubject: (e) => Nn(e),
|
|
1229
1232
|
now: () => Date.now(),
|
|
1230
1233
|
log: t
|
|
1231
1234
|
});
|
|
@@ -1239,127 +1242,127 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
1239
1242
|
} catch (e) {
|
|
1240
1243
|
return t.warn("reaction budget check failed — refusing the act", { tenantId: n }, e), !1;
|
|
1241
1244
|
}
|
|
1242
|
-
}, i =
|
|
1243
|
-
|
|
1245
|
+
}, i = jt(e.store, { onError: (e) => t.warn("reaction: rate-slot claim failed; refusing the act", { cause: String(e) }) });
|
|
1246
|
+
Xt = st(e.discovered.reactions ?? [], e.store, {
|
|
1244
1247
|
runAct: n,
|
|
1245
1248
|
checkBudget: r,
|
|
1246
1249
|
claimRateSlot: (e) => i.claim(e)
|
|
1247
1250
|
}, t);
|
|
1248
1251
|
}
|
|
1249
|
-
let
|
|
1250
|
-
(e.discovered.aggregates?.length ?? 0) > 0 && (
|
|
1252
|
+
let Zt;
|
|
1253
|
+
(e.discovered.aggregates?.length ?? 0) > 0 && (Zt = await v({
|
|
1251
1254
|
discovered: e.discovered.aggregates ?? [],
|
|
1252
1255
|
store: e.store,
|
|
1253
|
-
log:
|
|
1256
|
+
log: I.child("aggregate"),
|
|
1254
1257
|
...e.analytics === void 0 ? {} : { analytics: e.analytics },
|
|
1255
1258
|
...e.aggregateStorage === void 0 ? {} : { storage: e.aggregateStorage },
|
|
1256
1259
|
...e.aggregateCoordinator === void 0 ? {} : { coordinator: e.aggregateCoordinator }
|
|
1257
|
-
}), ze = G.succeed(rr,
|
|
1258
|
-
let
|
|
1259
|
-
(e.discovered.expectations?.length ?? 0) > 0 && (
|
|
1260
|
+
}), ze = G.succeed(rr, Zt.registry));
|
|
1261
|
+
let Qt;
|
|
1262
|
+
(e.discovered.expectations?.length ?? 0) > 0 && (Qt = dr({
|
|
1260
1263
|
discovered: e.discovered.expectations ?? [],
|
|
1261
1264
|
store: e.store,
|
|
1262
|
-
log:
|
|
1263
|
-
}), Be = G.succeed(sr,
|
|
1265
|
+
log: I.child("expectation")
|
|
1266
|
+
}), Be = G.succeed(sr, Qt.registry)), (e.discovered.budgets?.length ?? 0) > 0 && (n = pr({
|
|
1264
1267
|
discovered: e.discovered.budgets ?? [],
|
|
1265
|
-
log:
|
|
1268
|
+
log: I.child("finops")
|
|
1266
1269
|
}), He = G.succeed(ir, n.registry));
|
|
1267
|
-
let
|
|
1268
|
-
return (e.discovered.experiments?.length ?? 0) > 0 && (
|
|
1270
|
+
let $t;
|
|
1271
|
+
return (e.discovered.experiments?.length ?? 0) > 0 && ($t = fr({
|
|
1269
1272
|
discovered: e.discovered.experiments ?? [],
|
|
1270
1273
|
store: e.store,
|
|
1271
|
-
log:
|
|
1272
|
-
}), Ge = G.succeed(cr,
|
|
1274
|
+
log: I.child("experiment")
|
|
1275
|
+
}), Ge = G.succeed(cr, $t.registry)), Gt = !0, e.bootTiming?.mark("ready"), {
|
|
1273
1276
|
dispatcher: r,
|
|
1274
|
-
server:
|
|
1277
|
+
server: Kt,
|
|
1275
1278
|
scheduler: h,
|
|
1276
1279
|
eventsSnapshot: me(D.bus, D.declared),
|
|
1277
1280
|
membersSnapshot: () => ({
|
|
1278
1281
|
members: Ie.membership.list(),
|
|
1279
1282
|
capturedAt: Date.now()
|
|
1280
1283
|
}),
|
|
1281
|
-
agentTools: () =>
|
|
1284
|
+
agentTools: () => bt,
|
|
1282
1285
|
rpcMetrics: () => Xe,
|
|
1283
1286
|
webhooksService: () => ve,
|
|
1284
1287
|
runCanceller: () => ee(),
|
|
1285
1288
|
flowControlHealth: () => l?.cancelHealth(),
|
|
1286
1289
|
inferenceHealth: () => c?.health(),
|
|
1287
|
-
workflowWriteActions: () => S === void 0 ||
|
|
1290
|
+
workflowWriteActions: () => S === void 0 || N === void 0 ? void 0 : se({
|
|
1288
1291
|
store: e.store,
|
|
1289
|
-
log:
|
|
1292
|
+
log: I,
|
|
1290
1293
|
workflows: e.discovered.workflows ?? [],
|
|
1291
1294
|
workflowsProxy: o,
|
|
1292
1295
|
workflowRuntime: u,
|
|
1293
|
-
workflowRunRecorder:
|
|
1294
|
-
closeChildrenForParent:
|
|
1296
|
+
workflowRunRecorder: N,
|
|
1297
|
+
closeChildrenForParent: Pt
|
|
1295
1298
|
}),
|
|
1296
1299
|
redriveWorkflowRun: (e) => f ? f(e) : Promise.reject(/* @__PURE__ */ Error("redrive: this app registers no workflows")),
|
|
1297
1300
|
resumeWorkflowRunFromStep: (e) => p ? p(e) : Promise.reject(/* @__PURE__ */ Error("resume-from-step: this app registers no workflows")),
|
|
1298
1301
|
close: async () => {
|
|
1299
|
-
|
|
1302
|
+
Gt = !1, await Jt.drainRequests();
|
|
1300
1303
|
for (let e of Ce) try {
|
|
1301
1304
|
await e();
|
|
1302
1305
|
} catch (e) {
|
|
1303
|
-
|
|
1306
|
+
I.warn("serve: teardown step failed", {}, e);
|
|
1304
1307
|
}
|
|
1305
|
-
await Le?.detach(), await Ie.detach(),
|
|
1308
|
+
await Le?.detach(), await Ie.detach(), Zt?.detach(), Qt?.detach(), n?.detach(), $t?.detach(), Xt?.(), Yt?.(), await h?.shutdown(), r.close(), await m?.detach(), await u?.dispose(), await qt(), await Jt.finish();
|
|
1306
1309
|
}
|
|
1307
1310
|
};
|
|
1308
|
-
}, $ =
|
|
1309
|
-
let t =
|
|
1310
|
-
if (
|
|
1311
|
+
}, $ = L({ scope: "voltro:serve" }), _a = (e, t, n) => (e === "production" || e === "staging") && t !== "memory" && n !== "0", va = Ut, ya = async (e) => {
|
|
1312
|
+
let t = Sn(process.cwd());
|
|
1313
|
+
if (kn(t)) {
|
|
1311
1314
|
let n;
|
|
1312
1315
|
try {
|
|
1313
|
-
let e = await import(
|
|
1316
|
+
let e = await import(An(t).href);
|
|
1314
1317
|
typeof e.runServe == "function" ? n = e.runServe : $.warn("serve bundle has no runServe export — using the standard serve path");
|
|
1315
1318
|
} catch (e) {
|
|
1316
1319
|
$.warn("serve bundle failed to load — using the standard serve path", {}, e);
|
|
1317
1320
|
}
|
|
1318
1321
|
if (n) return $.info("serve: booting from the precompiled serve bundle"), n(e);
|
|
1319
1322
|
}
|
|
1320
|
-
return
|
|
1321
|
-
},
|
|
1322
|
-
let d =
|
|
1323
|
+
return ba(e);
|
|
1324
|
+
}, ba = async (s) => {
|
|
1325
|
+
let d = Cn();
|
|
1323
1326
|
e("serve");
|
|
1324
1327
|
try {
|
|
1325
|
-
|
|
1328
|
+
xi();
|
|
1326
1329
|
} catch (e) {
|
|
1327
1330
|
throw i(e instanceof Error ? e.message : String(e));
|
|
1328
1331
|
}
|
|
1329
|
-
let g = process.cwd(), v = await He(g), ne =
|
|
1332
|
+
let g = process.cwd(), v = await He(g), ne = P({
|
|
1330
1333
|
kind: "api",
|
|
1331
1334
|
configPort: v?.port,
|
|
1332
1335
|
env: process.env,
|
|
1333
|
-
flagPort:
|
|
1336
|
+
flagPort: va(s, "--port")
|
|
1334
1337
|
});
|
|
1335
1338
|
for (let e of ne.warnings) $.warn(e);
|
|
1336
1339
|
let ie = ne.port;
|
|
1337
|
-
$r(Qr(v?.secrets)), await
|
|
1340
|
+
$r(Qr(v?.secrets)), await Wt({
|
|
1338
1341
|
rawEnv: v?.env,
|
|
1339
1342
|
appType: "api",
|
|
1340
1343
|
root: g,
|
|
1341
1344
|
log: $,
|
|
1342
1345
|
generateTypes: !1
|
|
1343
1346
|
}), d.mark("config");
|
|
1344
|
-
let y = (process.env.DB_DIALECT ?? v?.store ?? "memory").toLowerCase(), se = (y === "mariadb" || y === "postgres" || y === "mssql") && (process.env.CDC ?? "1") !== "0", ce = y === "mariadb" ? "mariadb" : y === "mssql" ? "mssql" : void 0, le =
|
|
1345
|
-
if (!r() &&
|
|
1346
|
-
let e = await import(
|
|
1347
|
+
let y = (process.env.DB_DIALECT ?? v?.store ?? "memory").toLowerCase(), se = (y === "mariadb" || y === "postgres" || y === "mssql") && (process.env.CDC ?? "1") !== "0", ce = y === "mariadb" ? "mariadb" : y === "mssql" ? "mssql" : void 0, le = xn(g);
|
|
1348
|
+
if (!r() && kn(le)) try {
|
|
1349
|
+
let e = await import(An(le).href);
|
|
1347
1350
|
if (e.modules) {
|
|
1348
1351
|
let t = {};
|
|
1349
|
-
for (let [n, r] of Object.entries(e.modules)) t[
|
|
1352
|
+
for (let [n, r] of Object.entries(e.modules)) t[Dn(g, n)] = r;
|
|
1350
1353
|
n(t), $.info("precompiled api bundle loaded", { modules: Object.keys(t).length });
|
|
1351
1354
|
}
|
|
1352
1355
|
} catch (e) {
|
|
1353
1356
|
$.warn("precompiled api bundle failed to load — falling back to source", {}, e);
|
|
1354
1357
|
}
|
|
1355
|
-
let b = await Ye(g), x = await
|
|
1358
|
+
let b = await Ye(g), x = await kt(b, { cdc: se && ce !== void 0 }), ue = Ht(x);
|
|
1356
1359
|
{
|
|
1357
1360
|
let e = /* @__PURE__ */ new Set([
|
|
1358
1361
|
...x.queries.filter((e) => e.descriptor.overridesPlugin === !0).map((e) => e.descriptor.name),
|
|
1359
1362
|
...x.mutations.filter((e) => e.descriptor.overridesPlugin === !0).map((e) => e.descriptor.name),
|
|
1360
1363
|
...x.actions.filter((e) => e.descriptor.overridesPlugin === !0).map((e) => e.descriptor.name)
|
|
1361
1364
|
]);
|
|
1362
|
-
Xt(
|
|
1365
|
+
Zt(Xt(v?.plugins ?? []), [
|
|
1363
1366
|
...x.queries.map((e) => e.descriptor.name),
|
|
1364
1367
|
...x.mutations.map((e) => e.descriptor.name),
|
|
1365
1368
|
...x.actions.map((e) => e.descriptor.name),
|
|
@@ -1369,18 +1372,18 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
1369
1372
|
if (t.action === "fail") throw i(t.message ?? "");
|
|
1370
1373
|
t.action === "warn" && $.warn(t.message ?? "");
|
|
1371
1374
|
}
|
|
1372
|
-
let fe = b.filter((e) =>
|
|
1375
|
+
let fe = b.filter((e) => yn.test(e)), pe = fe.length > 0 ? await vn(fe, $.child("webhooks")) : {
|
|
1373
1376
|
outgoing: [],
|
|
1374
1377
|
incoming: [],
|
|
1375
1378
|
providers: []
|
|
1376
|
-
}, me =
|
|
1379
|
+
}, me = gn(x.events), be = pe.outgoing.length + pe.incoming.length + pe.providers.length + me.length === 0 ? void 0 : {
|
|
1377
1380
|
...pe,
|
|
1378
1381
|
outgoing: [...pe.outgoing, ...me]
|
|
1379
|
-
}, xe =
|
|
1382
|
+
}, xe = an({
|
|
1380
1383
|
nodeEnv: process.env.NODE_ENV,
|
|
1381
1384
|
cdcDialect: ce,
|
|
1382
1385
|
declared: v?.schema
|
|
1383
|
-
}), we =
|
|
1386
|
+
}), we = $t({
|
|
1384
1387
|
gates: xe,
|
|
1385
1388
|
runtime: {
|
|
1386
1389
|
traces: ve(),
|
|
@@ -1388,12 +1391,12 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
1388
1391
|
}
|
|
1389
1392
|
});
|
|
1390
1393
|
if (we !== void 0) throw i(`serve: ${we}`);
|
|
1391
|
-
let De =
|
|
1394
|
+
let De = rn({
|
|
1392
1395
|
mix: x.featureMix,
|
|
1393
1396
|
plugins: v?.plugins ?? [],
|
|
1394
1397
|
gates: xe,
|
|
1395
1398
|
...ce ? { cdcDialect: ce } : {}
|
|
1396
|
-
}), Oe = v?.analytics !== void 0 && v.analytics.kind !== "noop" && y !== "memory" ? (await
|
|
1399
|
+
}), Oe = v?.analytics !== void 0 && v.analytics.kind !== "noop" && y !== "memory" ? (await F(y)).makeSqlLayer(O()) : void 0, ke = await qe({
|
|
1397
1400
|
spec: v?.analytics,
|
|
1398
1401
|
sqlLayer: Oe,
|
|
1399
1402
|
log: $
|
|
@@ -1404,31 +1407,31 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
1404
1407
|
})();
|
|
1405
1408
|
for (let e of T) Jn(e);
|
|
1406
1409
|
{
|
|
1407
|
-
let e = xr(si(Be(x),
|
|
1410
|
+
let e = xr(si(Be(x), Lt(T)));
|
|
1408
1411
|
e !== void 0 && $.warn(e);
|
|
1409
1412
|
}
|
|
1410
1413
|
let Pe = (process.env.NODE_ENV ?? "").toLowerCase();
|
|
1411
|
-
if (
|
|
1412
|
-
let e = (await
|
|
1414
|
+
if (_a(Pe, y, process.env.VOLTRO_AUTO_MIGRATE)) {
|
|
1415
|
+
let e = (await F(y)).makeSqlLayer(O()), t = await W.runPromise(Qn.SqlClient.pipe(W.flatMap((e) => tr(e, g)), W.provide(e), W.catchAll(() => W.succeed([]))));
|
|
1413
1416
|
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));
|
|
1414
1417
|
let n = await W.runPromise(Qn.SqlClient.pipe(W.flatMap((e) => nr(e, T, {
|
|
1415
1418
|
appliedBy: `serve:${Pe}`,
|
|
1416
1419
|
environment: "prod",
|
|
1417
1420
|
dialectId: y
|
|
1418
1421
|
})), W.provide(e)));
|
|
1419
|
-
n.kind === "prod-mismatch" && ($.error(er(n, y)), $.error(
|
|
1422
|
+
n.kind === "prod-mismatch" && ($.error(er(n, y)), $.error(tn({
|
|
1420
1423
|
gates: xe,
|
|
1421
1424
|
nodeEnv: process.env.NODE_ENV,
|
|
1422
1425
|
cdcDialect: ce,
|
|
1423
1426
|
declared: v?.schema
|
|
1424
1427
|
})), $.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(er(n, y));
|
|
1425
1428
|
}
|
|
1426
|
-
await
|
|
1429
|
+
await Yt({
|
|
1427
1430
|
dialectId: y,
|
|
1428
1431
|
tables: T,
|
|
1429
|
-
mode:
|
|
1430
|
-
lockSchema:
|
|
1431
|
-
makeLayer: async () => (await
|
|
1432
|
+
mode: Jt(v?.reactiveTriggers),
|
|
1433
|
+
lockSchema: O().schema,
|
|
1434
|
+
makeLayer: async () => (await F(y)).makeSqlLayer(O()),
|
|
1432
1435
|
log: {
|
|
1433
1436
|
info: (e, t) => $.info(e, t ?? {}),
|
|
1434
1437
|
warn: (e, t) => $.warn(e, t ?? {})
|
|
@@ -1446,7 +1449,7 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
1446
1449
|
dialect: String(v?.store ?? process.env.DB_DIALECT ?? "postgres"),
|
|
1447
1450
|
changeStrategy: (process.env.CDC ?? "1") === "0" ? "inline" : "cdc",
|
|
1448
1451
|
dbUrl: process.env.DB_URL,
|
|
1449
|
-
crossReplicaBus:
|
|
1452
|
+
crossReplicaBus: Ni(v?.plugins ?? [])?.broadcast.crossReplica === !0,
|
|
1450
1453
|
tables: x.tables.map((e) => ({
|
|
1451
1454
|
tableName: e.tableName,
|
|
1452
1455
|
isReactive: e.isReactive === !0
|
|
@@ -1457,7 +1460,7 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
1457
1460
|
})
|
|
1458
1461
|
})) e.level === "warn" ? $.warn(e.message) : $.info(e.message);
|
|
1459
1462
|
{
|
|
1460
|
-
let e =
|
|
1463
|
+
let e = vt({
|
|
1461
1464
|
tables: Kn().map((e) => ({ tableName: e.tableName })),
|
|
1462
1465
|
queries: x.queries.map((e) => ({
|
|
1463
1466
|
name: e.descriptor.name,
|
|
@@ -1482,9 +1485,9 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
1482
1485
|
}
|
|
1483
1486
|
}), v?.kv && !process.env.KV_BACKEND && (process.env.KV_BACKEND = v.kv), v?.kvRedisUrl && !process.env.KV_REDIS_URL && (process.env.KV_REDIS_URL = v.kvRedisUrl), v?.kvKeyPrefix && !process.env.KV_KEY_PREFIX && (process.env.KV_KEY_PREFIX = v.kvKeyPrefix);
|
|
1484
1487
|
let { kv: ut, service: dt } = await jr({ store: E });
|
|
1485
|
-
|
|
1488
|
+
Pt({
|
|
1486
1489
|
log: $,
|
|
1487
|
-
max:
|
|
1490
|
+
max: qt(),
|
|
1488
1491
|
outOfPool: p(y, (process.env.CDC ?? "1") !== "0"),
|
|
1489
1492
|
readPools: t.replicationSnapshot()?.replicaCount ?? 0,
|
|
1490
1493
|
always: !0
|
|
@@ -1493,77 +1496,77 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
1493
1496
|
store: E,
|
|
1494
1497
|
sink: ke.sink,
|
|
1495
1498
|
log: $
|
|
1496
|
-
}),
|
|
1499
|
+
}), xt = Ge({
|
|
1497
1500
|
store: E,
|
|
1498
1501
|
dialect: y,
|
|
1499
1502
|
log: { info: (e) => $.info(e) }
|
|
1500
|
-
}),
|
|
1501
|
-
y !== "memory" && (
|
|
1502
|
-
let
|
|
1503
|
+
}), j = v?.plugins ?? [], jt = process.env.POD_NAME ?? process.env.HOSTNAME ?? `serve-${process.pid}`, Rt, Bt;
|
|
1504
|
+
y !== "memory" && (Rt = Zn.make((await F(y)).makeSqlLayer(O())), Bt = await Rt.runPromise(Qn.SqlClient));
|
|
1505
|
+
let Ut = [
|
|
1503
1506
|
"postgres",
|
|
1504
1507
|
"mariadb",
|
|
1505
1508
|
"mysql",
|
|
1506
1509
|
"mssql"
|
|
1507
|
-
].includes(y) ? Dr(E,
|
|
1508
|
-
maxIdleIntervalMs:
|
|
1509
|
-
coordinator:
|
|
1510
|
-
replicaId:
|
|
1510
|
+
].includes(y) ? Dr(E, jt, $) : ni, _n = M(v?.scheduling), Sn = Nr({
|
|
1511
|
+
maxIdleIntervalMs: _n.pollCeilingMs,
|
|
1512
|
+
coordinator: Ut,
|
|
1513
|
+
replicaId: jt,
|
|
1511
1514
|
log: $
|
|
1512
|
-
}),
|
|
1515
|
+
}), wn = [], Tn = process.env.POD_NAME ?? process.env.HOSTNAME ?? `serve-${process.pid}`, On = Ni(v?.plugins ?? [])?.broadcast?.provider, L = Qe(v?.plugins, v?.name ?? En(g));
|
|
1513
1516
|
{
|
|
1514
|
-
let e = et(v?.plugins, v?.name ??
|
|
1517
|
+
let e = et(v?.plugins, v?.name ?? En(g));
|
|
1515
1518
|
e !== void 0 && $.warn(e);
|
|
1516
1519
|
}
|
|
1517
|
-
let
|
|
1518
|
-
instanceId:
|
|
1519
|
-
namespace:
|
|
1520
|
+
let jn = Mt(v?.plugins, {
|
|
1521
|
+
instanceId: Tn,
|
|
1522
|
+
namespace: L,
|
|
1520
1523
|
meta: { mode: "serve" },
|
|
1521
1524
|
logger: $
|
|
1522
|
-
}),
|
|
1523
|
-
...
|
|
1524
|
-
instanceId:
|
|
1525
|
-
membership:
|
|
1526
|
-
...
|
|
1527
|
-
broadcastChannels: { presence:
|
|
1525
|
+
}), Mn = {
|
|
1526
|
+
...Bt ? { sql: Bt } : {},
|
|
1527
|
+
instanceId: Tn,
|
|
1528
|
+
membership: jn.membership,
|
|
1529
|
+
...On === void 0 ? {} : { broadcast: On },
|
|
1530
|
+
broadcastChannels: { presence: Mi(L, "presence") },
|
|
1528
1531
|
scheduleCoordinated: (e, t, n) => {
|
|
1529
|
-
let r =
|
|
1530
|
-
return
|
|
1532
|
+
let r = Sn(e, t, n);
|
|
1533
|
+
return wn.push(r), r;
|
|
1531
1534
|
}
|
|
1532
1535
|
};
|
|
1533
|
-
for (let e of
|
|
1536
|
+
for (let e of j) e.bindDataStore?.(Ve, Mn);
|
|
1534
1537
|
l({
|
|
1535
1538
|
store: E,
|
|
1536
1539
|
...ct(),
|
|
1537
1540
|
log: $
|
|
1538
1541
|
});
|
|
1539
|
-
let
|
|
1540
|
-
if (
|
|
1542
|
+
let R = j.filter((e) => typeof e.onChangeEvent == "function");
|
|
1543
|
+
if (R.length > 0) {
|
|
1541
1544
|
let e = E.changeScope ?? "local";
|
|
1542
1545
|
E.onChange((t) => {
|
|
1543
1546
|
let n = ye(t, e);
|
|
1544
|
-
for (let e of
|
|
1547
|
+
for (let e of R) W.runFork(e.onChangeEvent(n).pipe(W.catchAllCause((t) => W.sync(() => $.warn(`plugin ${e.name} onChangeEvent failed`, { error: Xn.pretty(t) })))));
|
|
1545
1548
|
});
|
|
1546
1549
|
}
|
|
1547
|
-
let
|
|
1548
|
-
plugins:
|
|
1550
|
+
let Nn = Ne({
|
|
1551
|
+
plugins: j,
|
|
1549
1552
|
appName: v?.name ?? "voltro-api",
|
|
1550
1553
|
appType: "api",
|
|
1551
1554
|
voltroVersion: process.env.npm_package_version ?? "0.0.0",
|
|
1552
1555
|
log: $
|
|
1553
1556
|
});
|
|
1554
|
-
|
|
1555
|
-
let
|
|
1557
|
+
j.length && await Nn.activate(), d.mark("plugins");
|
|
1558
|
+
let Pn = await Nn.gatherObservability(), Fn = {
|
|
1556
1559
|
info: (e, t) => process.stdout.write(`[broadcast] ${e} ${t ? JSON.stringify(t) : ""}\n`),
|
|
1557
1560
|
warn: (e, t) => process.stderr.write(`[broadcast] ${e} ${t ? JSON.stringify(t) : ""}\n`),
|
|
1558
1561
|
debug: () => {}
|
|
1559
|
-
},
|
|
1560
|
-
|
|
1561
|
-
}),
|
|
1562
|
+
}, z, In = await A(E, v, y, L, Fn, (e, t) => {
|
|
1563
|
+
z?.refreshAll(`broadcast gap: missed ${t} change(s) from ${e}`);
|
|
1564
|
+
}), Ln = v?.apiKeys, Rn = (typeof Ln == "object" ? Ln.prefix : void 0) ?? "voltro_", B = Ln ? yr(E) : void 0, V = B ? kr({ flush: Ar(B) }) : void 0;
|
|
1562
1565
|
V && qr(() => V.shutdown());
|
|
1563
|
-
let zn =
|
|
1564
|
-
prefix:
|
|
1566
|
+
let zn = B ? Or(B, {
|
|
1567
|
+
prefix: Rn,
|
|
1565
1568
|
...V ? { usage: V } : {}
|
|
1566
|
-
}) : void 0, Bn = zn ? [Sr(zn, { prefix:
|
|
1569
|
+
}) : void 0, Bn = zn ? [Sr(zn, { prefix: Rn })] : [], Vn = St([...v?.auth?.strategies ?? [], ...Bn], Ai(v?.plugins ?? []), v?.auth?.anonymousTenantRequired ?? !1, v?.auth, () => Ve), Hn = [...v?.restRoutes ?? [], ...zn ? lr(zn, (typeof Ln == "object" ? Ln.managementPath : void 0) ?? "/v1/api-keys") : []], Un = Ct(v?.idempotency, E), Wn = j.map((e) => e.services).filter((e) => e !== void 0), Gn = G.mergeAll(_t({
|
|
1567
1570
|
analyticsLayer: ke.layer,
|
|
1568
1571
|
cacheService: Ue,
|
|
1569
1572
|
kvService: dt,
|
|
@@ -1575,14 +1578,14 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
1575
1578
|
store: E,
|
|
1576
1579
|
log: $,
|
|
1577
1580
|
seedPolicy: "report",
|
|
1578
|
-
seedPattern:
|
|
1579
|
-
loadSeedFiles:
|
|
1580
|
-
startupPattern:
|
|
1581
|
+
seedPattern: fn,
|
|
1582
|
+
loadSeedFiles: I,
|
|
1583
|
+
startupPattern: sn,
|
|
1581
1584
|
loadStartupFiles: a,
|
|
1582
1585
|
runStartups: o,
|
|
1583
|
-
emailPattern:
|
|
1584
|
-
loadEmailFiles:
|
|
1585
|
-
registerEmailTemplates:
|
|
1586
|
+
emailPattern: k,
|
|
1587
|
+
loadEmailFiles: Tt,
|
|
1588
|
+
registerEmailTemplates: ji
|
|
1586
1589
|
});
|
|
1587
1590
|
(H.startupCount > 0 || H.emailCount > 0) && $.info("boot lifecycle", {
|
|
1588
1591
|
startups: H.startupCount,
|
|
@@ -1593,7 +1596,7 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
1593
1596
|
demands: Se(ue),
|
|
1594
1597
|
isRegistered: (e) => Cr(e) !== void 0
|
|
1595
1598
|
});
|
|
1596
|
-
let U =
|
|
1599
|
+
let U = wt({
|
|
1597
1600
|
schedules: at({
|
|
1598
1601
|
schedules: x.schedules,
|
|
1599
1602
|
seeds: H.seeds,
|
|
@@ -1612,7 +1615,7 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
1612
1615
|
let cr, dr = x.workflows.length > 0 || x.workflowWorkers.length > 0 || x.eventTriggers.length > 0 || (be?.outgoing.length ?? 0) > 0 || or, fr;
|
|
1613
1616
|
if (dr) {
|
|
1614
1617
|
if (y === "mssql") {
|
|
1615
|
-
let e = await
|
|
1618
|
+
let e = await hn(process.cwd());
|
|
1616
1619
|
e && $.warn(e);
|
|
1617
1620
|
}
|
|
1618
1621
|
let [{ WorkflowEngine: e }, { makeClusterCronLayer: t, workflowEngineLayer: n, resolveRunnerStorage: r, resolveFailoverTuning: i }] = await Promise.all([import("@effect/workflow"), import("@voltro/workflow/cluster")]), a = or ? U.filter((e) => (e.trigger ?? rr) === "self").map((e) => t({
|
|
@@ -1623,9 +1626,9 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
1623
1626
|
}
|
|
1624
1627
|
})) : [];
|
|
1625
1628
|
fr = y === "memory" ? e.layerMemory : await (async () => {
|
|
1626
|
-
let e = await
|
|
1629
|
+
let e = await F(y), t = r({ sqliteFamily: e.id === "sqlite" || e.id === "turso" });
|
|
1627
1630
|
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({
|
|
1628
|
-
sqlClientLayer: e.makeSqlLayer(
|
|
1631
|
+
sqlClientLayer: e.makeSqlLayer(O()),
|
|
1629
1632
|
runnerStorage: t,
|
|
1630
1633
|
dialectId: e.id,
|
|
1631
1634
|
...process.env.VOLTRO_WORKFLOW_RUNNER_PORT ? { runnerListenPort: Number(process.env.VOLTRO_WORKFLOW_RUNNER_PORT) } : {},
|
|
@@ -1634,24 +1637,24 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
1634
1637
|
});
|
|
1635
1638
|
})();
|
|
1636
1639
|
}
|
|
1637
|
-
let pr =
|
|
1640
|
+
let pr = bt(j, bn()), mr = b.filter((e) => /\.subscribe\.tsx?$/.test(e)), K = mr.length > 0 ? await c(mr, $) : [], hr = b.filter((e) => /\.reaction\.tsx?$/.test(e)), q = hr.length > 0 ? await he(hr, $) : [], gr = b.filter((e) => un.test(e)), _r = gr.length > 0 ? await Me(gr, $) : [], wr = b.filter((e) => /\.aggregate\.tsx?$/.test(e)), Tr = wr.length > 0 ? await _e(wr, $) : [];
|
|
1638
1641
|
{
|
|
1639
|
-
let e = xr(si(Be({ aggregates: Tr.map((e) => e.definition) }),
|
|
1642
|
+
let e = xr(si(Be({ aggregates: Tr.map((e) => e.definition) }), Lt(T)));
|
|
1640
1643
|
e !== void 0 && $.warn(e);
|
|
1641
1644
|
}
|
|
1642
1645
|
let Er = lt();
|
|
1643
1646
|
if (Tr.length > 0 && y !== "memory") try {
|
|
1644
|
-
let e = (await
|
|
1647
|
+
let e = (await F(y)).makeSqlLayer(O());
|
|
1645
1648
|
Er = u(e);
|
|
1646
1649
|
} catch (e) {
|
|
1647
1650
|
$.warn("aggregate: SQL storage init failed — falling back to in-process", { err: String(e) });
|
|
1648
1651
|
}
|
|
1649
|
-
let Mr = y === "memory" ? ni : Dr(E, `aggregate@${process.pid}`, $), Pr = b.filter((e) =>
|
|
1652
|
+
let Mr = y === "memory" ? ni : Dr(E, `aggregate@${process.pid}`, $), Pr = b.filter((e) => dn.test(e)), Fr = Pr.length > 0 ? await Ft(Pr, $) : [], Ir = b.filter((e) => ln.test(e)), Lr = Ir.length > 0 ? await m(Ir, $) : [], Rr = b.filter((e) => cn.test(e)), zr = Rr.length > 0 ? await w(Rr, $) : [], Br = [], Vr = [], Hr = b.filter((e) => nn.test(e));
|
|
1650
1653
|
if (Hr.length > 0) {
|
|
1651
|
-
let e = $.child("agent"), t = b.filter((e) =>
|
|
1652
|
-
t.length > 0 && await
|
|
1653
|
-
let n = await
|
|
1654
|
-
for (let e of n.agents) for (let t of
|
|
1654
|
+
let e = $.child("agent"), t = b.filter((e) => en.test(e));
|
|
1655
|
+
t.length > 0 && await on(t, e);
|
|
1656
|
+
let n = await Qt(Hr, e);
|
|
1657
|
+
for (let e of n.agents) for (let t of Ot(e)) (t.kind === "action" ? Br : Vr).push({
|
|
1655
1658
|
file: t.file,
|
|
1656
1659
|
descriptor: t.descriptor,
|
|
1657
1660
|
executor: t.executor
|
|
@@ -1665,8 +1668,8 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
1665
1668
|
return e;
|
|
1666
1669
|
}, Wr = qn({
|
|
1667
1670
|
dialect: y,
|
|
1668
|
-
...
|
|
1669
|
-
}), Gr = y === "memory" ? void 0 : (await
|
|
1671
|
+
...O()
|
|
1672
|
+
}), Gr = y === "memory" ? void 0 : (await F(y)).makeSqlLayer(O()), Kr = async () => gt({
|
|
1670
1673
|
sqlLayer: Gr,
|
|
1671
1674
|
declared: T,
|
|
1672
1675
|
log: $
|
|
@@ -1674,7 +1677,7 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
1674
1677
|
kind: "api",
|
|
1675
1678
|
meta: {
|
|
1676
1679
|
name: v?.name ?? "voltro-api",
|
|
1677
|
-
voltroVersion:
|
|
1680
|
+
voltroVersion: Et,
|
|
1678
1681
|
port: ie,
|
|
1679
1682
|
mode: "start",
|
|
1680
1683
|
store: y,
|
|
@@ -1682,7 +1685,7 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
1682
1685
|
...Wr === void 0 ? {} : { databaseId: Wr }
|
|
1683
1686
|
},
|
|
1684
1687
|
rpc: Ie(x, g),
|
|
1685
|
-
workflows:
|
|
1688
|
+
workflows: Nt(x, g),
|
|
1686
1689
|
migrations: Kr,
|
|
1687
1690
|
events: () => Y.eventsSnapshot(),
|
|
1688
1691
|
agentTools: () => Y.agentTools(),
|
|
@@ -1707,18 +1710,18 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
1707
1710
|
discoveredWebhooks: be
|
|
1708
1711
|
}) },
|
|
1709
1712
|
plugins: () => ({
|
|
1710
|
-
plugins:
|
|
1713
|
+
plugins: Nn.snapshot(),
|
|
1711
1714
|
capturedAt: Date.now()
|
|
1712
1715
|
}),
|
|
1713
|
-
env: () =>
|
|
1714
|
-
...v?.env !== void 0 &&
|
|
1716
|
+
env: () => Gt(v?.name ?? En(g), {
|
|
1717
|
+
...v?.env !== void 0 && bi(v.env) ? { contract: v.env } : {},
|
|
1715
1718
|
plugins: v?.plugins ?? []
|
|
1716
1719
|
}),
|
|
1717
1720
|
dataCache: () => ze({
|
|
1718
1721
|
stats: ot,
|
|
1719
1722
|
backendKind: it
|
|
1720
1723
|
}),
|
|
1721
|
-
subscriptions: () =>
|
|
1724
|
+
subscriptions: () => It(() => z),
|
|
1722
1725
|
inspectTables: () => S(x.tables),
|
|
1723
1726
|
inspectRows: C({
|
|
1724
1727
|
store: E,
|
|
@@ -1726,7 +1729,7 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
1726
1729
|
mask: !0
|
|
1727
1730
|
}),
|
|
1728
1731
|
metrics: (e) => Y.rpcMetrics().snapshot(e),
|
|
1729
|
-
cluster: () =>
|
|
1732
|
+
cluster: () => zt({
|
|
1730
1733
|
store: E,
|
|
1731
1734
|
dialect: y,
|
|
1732
1735
|
useClusterCron: or,
|
|
@@ -1737,7 +1740,7 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
1737
1740
|
defaultTrigger: rr,
|
|
1738
1741
|
coordination: sr
|
|
1739
1742
|
}),
|
|
1740
|
-
inspectScheduleRuns: (e) =>
|
|
1743
|
+
inspectScheduleRuns: (e) => N(E, e),
|
|
1741
1744
|
...f(E, {
|
|
1742
1745
|
controls: nt(x.workflows ?? []),
|
|
1743
1746
|
active: (x.workflows?.length ?? 0) > 0,
|
|
@@ -1752,7 +1755,7 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
1752
1755
|
inspectRetryWorkflowRun: (e) => J().inspectRetryWorkflowRun(e),
|
|
1753
1756
|
inspectSignalWorkflowRun: (e) => J().inspectSignalWorkflowRun(e),
|
|
1754
1757
|
inspectUpdateWorkflowRun: (e) => J().inspectUpdateWorkflowRun(e),
|
|
1755
|
-
inspectInferences: (e) =>
|
|
1758
|
+
inspectInferences: (e) => yt({
|
|
1756
1759
|
store: E,
|
|
1757
1760
|
active: (x.workflows?.length ?? 0) > 0,
|
|
1758
1761
|
dispatcher: () => Y.inferenceHealth()
|
|
@@ -1767,10 +1770,10 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
1767
1770
|
inspectRedriveWorkflowRun: (e) => Y.redriveWorkflowRun(e),
|
|
1768
1771
|
inspectResumeWorkflowRunFromStep: (e) => Y.resumeWorkflowRunFromStep(e)
|
|
1769
1772
|
}, Yr = (process.env.VOLTRO_TENANT_ISOLATION ?? v?.tenancy?.isolation) === "namespace", Xr = Yr && y !== "memory" ? await (async () => {
|
|
1770
|
-
let e = await
|
|
1771
|
-
return
|
|
1773
|
+
let e = await F(y);
|
|
1774
|
+
return At({
|
|
1772
1775
|
tables: T,
|
|
1773
|
-
sqlLayer: e.makeSqlLayer(
|
|
1776
|
+
sqlLayer: e.makeSqlLayer(O()),
|
|
1774
1777
|
dialect: y,
|
|
1775
1778
|
options: { retryFilter: e.retryFilter },
|
|
1776
1779
|
log: {
|
|
@@ -1781,7 +1784,7 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
1781
1784
|
})() : void 0, Zr = await ft({
|
|
1782
1785
|
input: v?.tenancy?.residency,
|
|
1783
1786
|
namespaceIsolationOn: Yr,
|
|
1784
|
-
makeStoreForUrl: (e, t) => rt(v, void 0,
|
|
1787
|
+
makeStoreForUrl: (e, t) => rt(v, void 0, Kt(O(), t)),
|
|
1785
1788
|
log: {
|
|
1786
1789
|
info: (e, t) => $.info(e, t),
|
|
1787
1790
|
warn: (e, t) => $.warn(e, t)
|
|
@@ -1790,11 +1793,11 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
1790
1793
|
Zr !== void 0 && qr(async () => {
|
|
1791
1794
|
await Zr.close();
|
|
1792
1795
|
});
|
|
1793
|
-
let Y = await
|
|
1796
|
+
let Y = await ga({
|
|
1794
1797
|
bootTiming: d,
|
|
1795
|
-
broadcastNamespace:
|
|
1798
|
+
broadcastNamespace: L,
|
|
1796
1799
|
scheduling: (() => {
|
|
1797
|
-
let e =
|
|
1800
|
+
let e = _n;
|
|
1798
1801
|
return {
|
|
1799
1802
|
admissionDrainMs: e.admissionDrainMs,
|
|
1800
1803
|
inferenceTickMs: e.inferenceTickMs,
|
|
@@ -1802,16 +1805,16 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
1802
1805
|
stalenessSweepMs: e.stalenessSweepMs,
|
|
1803
1806
|
disarmWhenIdle: D({
|
|
1804
1807
|
changeScope: E.changeScope,
|
|
1805
|
-
broadcastAttached:
|
|
1808
|
+
broadcastAttached: In !== void 0
|
|
1806
1809
|
})
|
|
1807
1810
|
};
|
|
1808
1811
|
})(),
|
|
1809
1812
|
...v?.workflows?.staleness === void 0 ? {} : { workflowStaleness: v.workflows.staleness },
|
|
1810
1813
|
...v?.workflows?.suspendSignalHintMs === void 0 ? {} : { workflowSuspendSignalHintMs: v.workflows.suspendSignalHintMs },
|
|
1811
|
-
workflowRecording:
|
|
1814
|
+
workflowRecording: Vt(v?.workflows?.recording),
|
|
1812
1815
|
membership: {
|
|
1813
|
-
...
|
|
1814
|
-
instanceId:
|
|
1816
|
+
...jn,
|
|
1817
|
+
instanceId: Tn
|
|
1815
1818
|
},
|
|
1816
1819
|
security: {
|
|
1817
1820
|
defaultDeny: oe(v),
|
|
@@ -1865,7 +1868,7 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
1865
1868
|
}),
|
|
1866
1869
|
...v?.auth === void 0 ? {} : { authority: v.auth },
|
|
1867
1870
|
...v?.agents === void 0 ? {} : { agents: v.agents },
|
|
1868
|
-
httpRoutes:
|
|
1871
|
+
httpRoutes: j.flatMap((e) => e.httpRoutes ?? []),
|
|
1869
1872
|
getStore: () => Ve,
|
|
1870
1873
|
...Gn ? { baseLayer: Gn } : {},
|
|
1871
1874
|
...fr === void 0 ? {} : { workflowEngineLayer: fr },
|
|
@@ -1881,7 +1884,7 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
1881
1884
|
inspectRoute: { handle: async (e, t, n, r) => await h(e, Jr, t, {
|
|
1882
1885
|
method: n,
|
|
1883
1886
|
...r === void 0 ? {} : { body: r }
|
|
1884
|
-
}) || ((n === "GET" ? await
|
|
1887
|
+
}) || ((n === "GET" ? await mn(e, Jr, t, { method: n }) : null) ?? pn(e, Jr, t, {
|
|
1885
1888
|
method: n,
|
|
1886
1889
|
...r === void 0 ? {} : { body: r }
|
|
1887
1890
|
}) ?? {
|
|
@@ -1890,11 +1893,11 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
1890
1893
|
body: JSON.stringify({ error: "not an inspect route" })
|
|
1891
1894
|
}) },
|
|
1892
1895
|
...v?.name === void 0 ? {} : { appName: v.name },
|
|
1893
|
-
observability:
|
|
1896
|
+
observability: Pn,
|
|
1894
1897
|
port: ie,
|
|
1895
1898
|
...v?.transport?.wsPath ? { path: v.transport.wsPath } : {}
|
|
1896
1899
|
});
|
|
1897
|
-
return
|
|
1900
|
+
return z = Y.dispatcher, te(Ee([
|
|
1898
1901
|
x.queries,
|
|
1899
1902
|
x.mutations,
|
|
1900
1903
|
x.actions,
|
|
@@ -1912,10 +1915,10 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
1912
1915
|
schedules: U.length,
|
|
1913
1916
|
scheduleCoordination: sr
|
|
1914
1917
|
}), d.finish($), qr(async () => {
|
|
1915
|
-
for (let e of
|
|
1916
|
-
|
|
1918
|
+
for (let e of wn) e.stop();
|
|
1919
|
+
xt.stop();
|
|
1917
1920
|
try {
|
|
1918
|
-
await Y.close(), st(),
|
|
1921
|
+
await Y.close(), st(), Rt?.dispose(), await Nn.deactivate(), await In?.close(), await Dt({
|
|
1919
1922
|
mirror: ht,
|
|
1920
1923
|
log: $
|
|
1921
1924
|
}), await ke.dispose(), await E.close?.();
|
|
@@ -1925,4 +1928,4 @@ var Bi = () => Math.max(500, Math.floor(ti() * .6)), Vi = (e) => new Promise((t)
|
|
|
1925
1928
|
}), await new Promise(() => {}), 0;
|
|
1926
1929
|
};
|
|
1927
1930
|
//#endregion
|
|
1928
|
-
export {
|
|
1931
|
+
export { ya as n, _a as r, ba as t };
|