@voltro/cli 0.56.0 → 0.57.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 +194 -0
- package/dist/apiBuild-B83Cb2Rv.js +2 -0
- package/dist/{apiBuild-Bdaetr37.js → apiBuild-DDr2aNFd.js} +2 -2
- package/dist/bin.js +1 -1
- package/dist/{build-CI36wL4R.js → build-QKP6Bm0J.js} +191 -187
- package/dist/{checkCommand-D0QV_zM_.js → checkCommand-BISqx1OJ.js} +1 -1
- package/dist/{checkCommand-CAwFXrxA.js → checkCommand-DUtMWjcR.js} +4 -4
- package/dist/{codegenCommand-CidbQzbv.js → codegenCommand-DnVuDxwT.js} +10 -10
- package/dist/{commands-CWjfThXv.js → commands-CRbxgxv0.js} +22 -22
- package/dist/{dashboardCommand-BekcY5Ls.js → dashboardCommand-Bf_-Ne3P.js} +5 -5
- package/dist/{dataCommand-2pccgbIy.js → dataCommand-BoBJJ-Gb.js} +2 -2
- package/dist/{dbCommand-DpK_vQET.js → dbCommand-CMAIz-Bf.js} +3 -3
- package/dist/dbCommand-DHi_RuDl.js +2 -0
- package/dist/dev-Bl9HqtV7.js +3 -0
- package/dist/{dev-Dw263KPu.js → dev-DOEJXicj.js} +2109 -2092
- package/dist/{doctorCommand-aR_bFmIi.js → doctorCommand-BrWu67JZ.js} +331 -189
- package/dist/doctorCommand-DrQv9SL3.js +2 -0
- package/dist/{dormancyCommand-eXTQMbHU.js → dormancyCommand-xn2y-pJm.js} +1 -1
- package/dist/{embeddingsCommand-CTmiQvwa.js → embeddingsCommand-Cn5MbRDM.js} +1 -1
- package/dist/emptyResultHeadline-Csa5fZOF.js +18 -0
- package/dist/{envCommand-BDUgV7EM.js → envCommand-UJmJIbs9.js} +8 -8
- package/dist/{evolveCommand-YV8qW1LU.js → evolveCommand-Db30twUy.js} +1 -1
- package/dist/frameworkTableAssembly-B96WCNJA.js +2 -0
- package/dist/{frameworkTableAssembly-DNOFXfEQ.js → frameworkTableAssembly-vfkzuzEo.js} +104 -85
- package/dist/index.js +1 -1
- package/dist/inspect-B0hL41s0.js +2 -0
- package/dist/{inspect-CNYvNXPU.js → inspect-DZnan87F.js} +68 -52
- package/dist/{logsCmd-BU8uCdys.js → logsCmd-C5y9HyrG.js} +58 -53
- package/dist/{manifestBuild-CEkjfpwc.js → manifestBuild-DnbFKF6w.js} +1 -1
- package/dist/manifestBuild-UXrnUcXP.js +2 -0
- package/dist/{migrate-SICulyz1.js → migrate-DtC3lu7H.js} +4 -4
- package/dist/{probeCommand-6HxEkNDG.js → probeCommand-C5fuN6Z2.js} +1 -1
- package/dist/{runtimeTrace-DgYMc09E.js → runtimeTrace-BQL_lfz6.js} +1 -1
- package/dist/{sdkgen-PY-umd6O.js → sdkgen-CMUPrDjH.js} +1 -1
- package/dist/{serveCommand-DIJ3ma76.js → serveCommand-B_w-Mpb_.js} +1013 -954
- package/dist/serveCommand-Dtb48ffg.js +2 -0
- package/dist/serveEntry.js +1 -1
- package/dist/{start-B9NGB8gn.js → start-YaUehtDV.js} +564 -571
- package/dist/{start-BFQQkL1i.js → start-s25GAIgn.js} +1 -1
- package/dist/startEntry.js +1 -1
- package/dist/{tracesCmd-BWYDqMy6.js → tracesCmd-C1qKa94g.js} +68 -63
- package/dist/{webDev-C2dRz9s5.js → webDev-B6ZMX42w.js} +1 -1
- package/dist/{webDev-C53hJdcL.js → webDev-BgdkyjP6.js} +881 -774
- package/dist/{webhooksCommand-uuPu8qQX.js → webhooksCommand-CYXTNvXq.js} +2 -2
- package/package.json +19 -19
- package/templates/AGENTS.md +1 -1
- package/templates/agent-docs/_index.md +1 -1
- package/templates/agent-docs/_manifest.json +1 -1
- package/templates/agent-docs/ai.md +1 -1
- package/templates/agent-docs/authentication.md +34 -19
- package/templates/agent-docs/cli.md +48 -0
- package/templates/agent-docs/configuration.md +29 -4
- package/templates/agent-docs/database/scaling.md +10 -1
- package/templates/agent-docs/deployment.md +22 -0
- package/templates/agent-docs/plugins/audit.md +21 -5
- package/templates/agent-docs/plugins/billing.md +2 -0
- package/templates/agent-docs/reference.md +1 -0
- package/templates/agent-docs/scheduling.md +23 -0
- package/templates/agent-docs/schema-driven-ui.md +81 -0
- package/templates/agent-docs/whats-new.md +100 -403
- package/templates/apps/api-ai/package.json +6 -6
- 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 +9 -9
- 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-row-history/package.json +8 -8
- 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-webhooks/package.json +9 -9
- package/templates/apps/changelog/package.json +7 -7
- package/templates/apps/edge-functions/package.json +2 -2
- package/templates/apps/frontend-admin/package.json +7 -7
- package/templates/apps/frontend-app/package.json +8 -8
- package/templates/apps/frontend-auth/package.json +7 -7
- package/templates/apps/frontend-blank/package.json +6 -6
- package/templates/apps/frontend-cms/package.json +8 -8
- package/templates/apps/frontend-collab/package.json +9 -9
- package/templates/apps/frontend-contact/package.json +7 -7
- package/templates/apps/frontend-dashboard/package.json +6 -6
- package/templates/apps/frontend-docs/package.json +8 -8
- 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 +7 -7
- package/templates/apps/frontend-saas/package.json +7 -7
- package/templates/apps/frontend-spa/package.json +6 -6
- package/templates/apps/frontend-ssr/package.json +6 -6
- package/templates/apps/frontend-ssr-api/package.json +7 -7
- package/templates/apps/frontend-static-blog/package.json +8 -8
- package/templates/apps/frontend-status/package.json +7 -7
- package/templates/apps/mobile-app/package.json +4 -4
- package/dist/apiBuild-Vw1figjO.js +0 -2
- package/dist/dbCommand-DrycGWWt.js +0 -2
- package/dist/dev-B9Gz0k85.js +0 -3
- package/dist/doctorCommand-BMWs6aVm.js +0 -2
- package/dist/frameworkTableAssembly-CGNC0qr7.js +0 -2
- package/dist/inspect-S2rWy1Ys.js +0 -2
- package/dist/manifestBuild-DIa_s6u0.js +0 -2
- package/dist/serveCommand-BITS8Hpj.js +0 -2
|
@@ -4,51 +4,51 @@ 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 { n as s, t as c } from "./interruptedReplace-CwnkBb2X.js";
|
|
7
|
-
import { $ as l, $t as u, A as d,
|
|
8
|
-
import { Kt as
|
|
9
|
-
import { g as
|
|
10
|
-
import { n as
|
|
11
|
-
import { r as
|
|
12
|
-
import { r as
|
|
13
|
-
import { r as
|
|
14
|
-
import { i as
|
|
15
|
-
import { c as
|
|
16
|
-
import {
|
|
17
|
-
import { n as
|
|
18
|
-
import { C as
|
|
19
|
-
import { i as
|
|
20
|
-
import { n as
|
|
21
|
-
import { i as
|
|
22
|
-
import { t as
|
|
23
|
-
import { a as
|
|
24
|
-
import
|
|
25
|
-
import { createWriteStream as
|
|
26
|
-
import { pathToFileURL as
|
|
27
|
-
import { LoggerLayer as
|
|
28
|
-
import { AuthMiddleware as
|
|
29
|
-
import { DATA_TRANSFERS_TABLE as
|
|
30
|
-
import { appMode as
|
|
31
|
-
import { AggregateRegistry as
|
|
32
|
-
import { assertProductionSessionSecret as
|
|
33
|
-
import { Cause as
|
|
34
|
-
import { SqlClient as
|
|
35
|
-
import { declaredSnapshot as
|
|
36
|
-
import
|
|
37
|
-
import { RpcGroup as
|
|
38
|
-
import { appStorageProvider as
|
|
39
|
-
import { isEnvContract as
|
|
7
|
+
import { $ as l, $t as u, A as d, An as f, At as p, Bn as ee, Bt as te, C as ne, Cn as m, Ct as h, D as re, Dn as g, Dt as ie, E as ae, En as oe, Et as se, F as ce, Fn as le, Ft as _, G as ue, Gt as de, H as v, Hn as fe, Ht as pe, I as me, It as he, J as ge, Kt as _e, L as y, Ln as ve, Lt as ye, M as be, Mn as xe, Mt as b, N as Se, Nn as Ce, Nt as x, O as we, On as Te, Ot as S, P as Ee, Pn as De, Pt as Oe, Q as ke, Qt as Ae, R as je, Rn as Me, Rt as Ne, S as C, Sn as Pe, St as Fe, T as Ie, Tn as Le, Tt as Re, U as ze, Ut as Be, V as Ve, Vn as He, Vt as Ue, W as We, Wt as Ge, X as Ke, Y as qe, Yt as Je, Z as Ye, Zt as Xe, _ as Ze, _n as Qe, _t as $e, an as w, at as et, b as tt, bn as nt, bt as rt, c as it, cn as T, ct as at, d as ot, dn as st, dt as ct, en as lt, et as E, fn as ut, ft as dt, g as D, gn as O, gt as ft, h as pt, hn as mt, ht, i as gt, in as _t, it as k, j as vt, jn as yt, jt as bt, k as xt, kt as St, ln as Ct, lt as wt, m as Tt, mn as Et, mt as Dt, nn as Ot, nt as A, o as j, on as kt, ot as At, p as jt, pn as Mt, pt as Nt, qt as Pt, r as Ft, rn as It, rt as Lt, sn as Rt, st as zt, t as Bt, tn as Vt, tt as Ht, u as Ut, un as M, ut as Wt, v as Gt, vn as N, vt as Kt, w as qt, wn as Jt, wt as Yt, x as Xt, xn as Zt, xt as P, y as F, yn as Qt, yt as $t, z as en, zn as tn, zt as nn } from "./dev-DOEJXicj.js";
|
|
8
|
+
import { Kt as rn, Wt as an, Zt as on, dt as sn, ft as cn, lt as ln, ot as un, ut as dn } from "./webDev-BgdkyjP6.js";
|
|
9
|
+
import { g as fn, s as pn } from "./inspect-DZnan87F.js";
|
|
10
|
+
import { n as mn } from "./cliArgs-D4p8n7EE.js";
|
|
11
|
+
import { r as hn } from "./appPort-B_HpJ_ck.js";
|
|
12
|
+
import { r as gn, u as _n } from "./apiBuild-DDr2aNFd.js";
|
|
13
|
+
import { r as vn } from "./dialectDriver-czCHYpeH.js";
|
|
14
|
+
import { i as yn, n as bn } from "./connectionConfig-Bk9IC7D0.js";
|
|
15
|
+
import { c as xn, n as Sn, o as Cn } from "./seedRunner-DISBKow-.js";
|
|
16
|
+
import { f as wn, g as Tn, h as En, m as Dn, r as On } from "./frameworkTableAssembly-vfkzuzEo.js";
|
|
17
|
+
import { n as kn, r as An, t as jn } from "./declaredSchemaGates-BlcwObhb.js";
|
|
18
|
+
import { C as Mn, a as Nn, h as Pn, l as Fn, n as In, u as Ln, w as Rn } from "./fileConventions-l-RIXbx8.js";
|
|
19
|
+
import { i as zn, n as Bn, t as Vn } from "./inspectMetrics-BY0Sjb2F.js";
|
|
20
|
+
import { n as Hn } from "./mssqlClusterPatch-_4cE_nun.js";
|
|
21
|
+
import { i as Un, n as Wn, r as Gn, t as Kn } from "./webhookDiscovery-CphsQe59.js";
|
|
22
|
+
import { t as qn } from "./bootTiming-BdyP9nYw.js";
|
|
23
|
+
import { a as Jn, o as Yn, t as Xn } from "./dataProfile-Du3ztYxv.js";
|
|
24
|
+
import I, { basename as Zn, join as Qn } from "node:path";
|
|
25
|
+
import { createWriteStream as $n, existsSync as er } from "node:fs";
|
|
26
|
+
import { pathToFileURL as tr } from "node:url";
|
|
27
|
+
import { LoggerLayer as nr, createLogger as L } from "@voltro/logger";
|
|
28
|
+
import { AuthMiddleware as rr, ConnectionInfoMiddleware as R, actionToRpc as z, anonymousSubject as ir, isWireReachable as ar, mutationToRpc as or, queryToRpc as B, streamToRpc as sr, wireErrorUnion as cr, workflowCancelDescriptor as lr, workflowDomainEventsQueryDescriptor as ur, workflowEventDeliveriesQueryDescriptor as dr, workflowResumeDescriptor as fr, workflowRunEventsQueryDescriptor as pr, workflowRunQueryDescriptor as mr, workflowRunStepsQueryDescriptor as hr, workflowRunsQueryDescriptor as gr, workflowSignalDescriptor as _r, workflowUpdateDescriptor as vr } from "@voltro/protocol";
|
|
29
|
+
import { DATA_TRANSFERS_TABLE as V, _voltroDataTransfersTable as yr, allRegisteredTables as br, and as xr, connectionIdentity as Sr, derivedRowId as Cr, describeTransferRun as wr, ensureTableRegistered as Tr, eq as H, or as Er } from "@voltro/database";
|
|
30
|
+
import { appMode as Dr, frameworkVersion as Or, instanceId as kr, replicaId as Ar, resolveAdvertisedHost as jr, setProcessAdvertisedAddress as Mr, setProcessBootPath as Nr } from "@voltro/protocol/identity";
|
|
31
|
+
import { AggregateRegistry as Pr, CostRegistry as U, DORMANCY_WAKEUP_TENANT as Fr, Dispatcher as Ir, ExpectationRegistry as Lr, ExperimentRegistry as Rr, apiKeyManagementRoutes as zr, attachAnalyticsMirror as Br, attachExpectations as Vr, attachExperiments as Hr, attachFinops as Ur, awaitServerListening as Wr, bindMutation as Gr, bindStream as Kr, bindSubscription as W, buildTracingLayer as qr, cancelWakeup as Jr, compileCron as Yr, dataStoreApiKeyStore as Xr, formatServerOnlyLeaks as Zr, formatUnresolvedSources as Qr, frameworkApiKeyStrategy as $r, getResourcePolicy as ei, installPolicyGuardResolver as ti, loadResourceTuples as ni, makeActionRunner as ri, makeAdvisoryLockCoordinator as ii, makeApiKeyService as ai, makeApiKeyUsageBuffer as oi, makeApiKeyUsageFlusher as si, makeAsyncKv as ci, makeAuthMiddlewareLayers as li, makeBufferingSpanProcessor as ui, makeCoordinatedScheduler as di, makeEffectStoreLayer as fi, makeLazyWorkflowFacade as pi, makeMutationOutputCodec as mi, makeMutationRunner as hi, makeOneShotQueryRunner as gi, makeQueryDescriptorProducer as _i, makeQueryFinalizer as vi, makeQueryReauthorizer as yi, makeQuerySubscriber as bi, makeSchemaRegistry as xi, makeWorkflowFacade as Si, makeWorkflowFacadeWithCallerContext as Ci, makeWorkflowLayers as wi, noopKv as Ti, onProcessShutdown as G, recordSubscriptionDelivery as K, recordWorkflowRun as Ei, registerDefaultTupleSource as Di, registerWakeup as Oi, resolveSecretsBackend as ki, runProvidedEffect as Ai, setSecretsBackend as ji, setSystemStoreHandle as Mi, shutdownGraceMsFromEnv as Ni, singleCoordinator as Pi, startRpcServer as Fi, startScheduler as q, stripForbiddenForWire as Ii, undoCaptureEnabled as Li, unresolvedSources as Ri, withScopedRequest as zi, workflowToRpc as Bi, wrapStoreWithBootCodec as Vi } from "@voltro/runtime";
|
|
32
|
+
import { assertProductionSessionSecret as Hi } from "@voltro/protocol/session";
|
|
33
|
+
import { Cause as Ui, Effect as J, Layer as Y, ManagedRuntime as Wi } from "effect";
|
|
34
|
+
import { SqlClient as Gi } from "@effect/sql";
|
|
35
|
+
import { declaredSnapshot as Ki, describeOutcome as qi, pendingFileMigrationIds as Ji, runPlannedMigrations as Yi } from "@voltro/database/sql";
|
|
36
|
+
import Xi, { tmpdir as Zi } from "node:os";
|
|
37
|
+
import { RpcGroup as Qi } from "@effect/rpc";
|
|
38
|
+
import { appStorageProvider as $i, durabilityNotice as ea, fromNodeReadable as ta, getObjectStream as na, putObjectStream as ra, toNodeReadable as ia } from "@voltro/plugin-storage";
|
|
39
|
+
import { isEnvContract as aa } from "@voltro/env";
|
|
40
40
|
import X from "node:fs/promises";
|
|
41
|
-
import { createHash as
|
|
42
|
-
import { channelFor as
|
|
43
|
-
import { buildDeliverWebhookExecute as
|
|
44
|
-
import { getAuthSessionStrategy as
|
|
45
|
-
import { registerEmailTemplates as
|
|
46
|
-
import { checkSchemaDrift as
|
|
41
|
+
import { createHash as oa, timingSafeEqual as sa } from "node:crypto";
|
|
42
|
+
import { channelFor as ca, getBroadcastPlugin as la } from "@voltro/plugin-broadcast";
|
|
43
|
+
import { buildDeliverWebhookExecute as ua, buildWebhooksService as da, defaultIncomingPath as fa, deliverWebhookWorkflow as pa, makeDeferredEmitHandler as ma, mountIncomingWebhook as ha } from "@voltro/plugin-webhooks";
|
|
44
|
+
import { getAuthSessionStrategy as ga } from "@voltro/plugin-auth";
|
|
45
|
+
import { registerEmailTemplates as _a } from "@voltro/plugin-mail";
|
|
46
|
+
import { checkSchemaDrift as va, decideStaging as ya, isEnvironmentLocal as ba, packBundle as xa, peekBundle as Sa, runExport as Ca, runImport as wa, storageBlobSink as Ta, storageRefsBlobSource as Ea, unpackBundle as Da, unpackBundleToDir as Oa } from "@voltro/data-transfer";
|
|
47
47
|
//#region \0rolldown/runtime.js
|
|
48
|
-
var
|
|
48
|
+
var ka = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
|
|
49
49
|
if (typeof require < "u") return require.apply(this, arguments);
|
|
50
50
|
throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
51
|
-
}),
|
|
51
|
+
}), Aa = () => Math.max(500, Math.floor(Ni() * .6)), ja = (e) => new Promise((t) => setTimeout(t, e)), Ma = (e) => {
|
|
52
52
|
let t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set(), r = 0;
|
|
53
53
|
e.on("connection", (e) => {
|
|
54
54
|
t.add(e), e.once("close", () => {
|
|
@@ -62,14 +62,14 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
62
62
|
});
|
|
63
63
|
});
|
|
64
64
|
let i, a = async (t = {}) => {
|
|
65
|
-
let n = t.budgetMs ??
|
|
65
|
+
let n = t.budgetMs ?? Aa();
|
|
66
66
|
i ??= new Promise((t) => {
|
|
67
67
|
e.close(() => {
|
|
68
68
|
t();
|
|
69
69
|
});
|
|
70
70
|
}), e.closeIdleConnections();
|
|
71
71
|
let a = Date.now() + n;
|
|
72
|
-
for (; r > 0 && Date.now() < a;) await
|
|
72
|
+
for (; r > 0 && Date.now() < a;) await ja(25), e.closeIdleConnections();
|
|
73
73
|
e.closeIdleConnections();
|
|
74
74
|
}, o = async () => {
|
|
75
75
|
i ??= new Promise((t) => {
|
|
@@ -86,7 +86,7 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
86
86
|
]));
|
|
87
87
|
} catch {}
|
|
88
88
|
else e.destroy();
|
|
89
|
-
for (let e = 0; t.size > 0 && e < 250; e += 25) await
|
|
89
|
+
for (let e = 0; t.size > 0 && e < 250; e += 25) await ja(25);
|
|
90
90
|
for (let e of t) e.destroy();
|
|
91
91
|
await i;
|
|
92
92
|
};
|
|
@@ -98,83 +98,83 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
98
98
|
await a(e), await o();
|
|
99
99
|
}
|
|
100
100
|
};
|
|
101
|
-
},
|
|
101
|
+
}, Na = "/_voltro/admin/import", Pa = "/_voltro/admin/import/start", Fa = "/_voltro/admin/export", Ia = "/_voltro/admin/export/download", La = "/_voltro/admin/transfers", Z = (e, t) => ({
|
|
102
102
|
status: e,
|
|
103
103
|
contentType: "application/json; charset=utf-8",
|
|
104
104
|
body: JSON.stringify(t)
|
|
105
|
-
}),
|
|
105
|
+
}), Ra = (e) => {
|
|
106
106
|
let t = e.authorization ?? e.Authorization, n = t ? /^Bearer\s+(.+)$/i.exec(t) : null;
|
|
107
107
|
return n ? n[1] : null;
|
|
108
|
-
},
|
|
108
|
+
}, za = (e, t) => sa(oa("sha256").update(e).digest(), oa("sha256").update(t).digest()), Ba = (e, t, n = "POST") => {
|
|
109
109
|
if (e.method.toUpperCase() !== n) return Z(405, { error: "method not allowed" });
|
|
110
110
|
if (!t || t.length < 16) return Z(503, { error: "data transfer misconfigured (no/weak secret)" });
|
|
111
|
-
let r =
|
|
112
|
-
return !r || !
|
|
113
|
-
},
|
|
111
|
+
let r = Ra(e.headers);
|
|
112
|
+
return !r || !za(r, t) ? Z(401, { error: "unauthorized" }) : null;
|
|
113
|
+
}, Va = /^[A-Za-z0-9_-]{8,64}$/, Ha = (e) => Va.test(e), Ua = () => process.env.VOLTRO_IMPORT_UPLOAD_DIR ?? I.join(Xi.tmpdir(), "voltro-import-uploads"), Wa = (e) => I.join(Ua(), e), Ga = (e) => I.join(Wa(e), "archive.bin"), Ka = (e) => I.join(Wa(e), "meta.json"), qa = async (e = Date.now()) => {
|
|
114
114
|
let t = 0;
|
|
115
115
|
try {
|
|
116
|
-
for (let n of await X.readdir(
|
|
116
|
+
for (let n of await X.readdir(Ua())) {
|
|
117
117
|
if (n === ".runs") continue;
|
|
118
|
-
let r = await X.stat(
|
|
119
|
-
r !== null && (e - r.mtimeMs <= 864e5 || (await X.rm(
|
|
118
|
+
let r = await X.stat(Wa(n)).catch(() => null);
|
|
119
|
+
r !== null && (e - r.mtimeMs <= 864e5 || (await X.rm(Wa(n), {
|
|
120
120
|
recursive: !0,
|
|
121
121
|
force: !0
|
|
122
122
|
}).catch(() => void 0), t++));
|
|
123
123
|
}
|
|
124
124
|
} catch {}
|
|
125
125
|
return t;
|
|
126
|
-
},
|
|
127
|
-
if (!
|
|
126
|
+
}, Ja = async (e) => {
|
|
127
|
+
if (!Ha(e)) return {
|
|
128
128
|
bytes: 0,
|
|
129
129
|
key: null,
|
|
130
130
|
runId: null
|
|
131
131
|
};
|
|
132
|
-
let t = await X.stat(
|
|
132
|
+
let t = await X.stat(Ga(e)).catch(() => null);
|
|
133
133
|
if (t === null) return {
|
|
134
134
|
bytes: 0,
|
|
135
135
|
key: null,
|
|
136
136
|
runId: null
|
|
137
137
|
};
|
|
138
|
-
let n = await
|
|
138
|
+
let n = await Ya(e);
|
|
139
139
|
return {
|
|
140
140
|
bytes: t.size,
|
|
141
141
|
key: n.key ?? null,
|
|
142
142
|
runId: n.runId ?? null
|
|
143
143
|
};
|
|
144
|
-
},
|
|
144
|
+
}, Ya = async (e) => {
|
|
145
145
|
try {
|
|
146
|
-
let t = await X.readFile(
|
|
146
|
+
let t = await X.readFile(Ka(e), "utf8");
|
|
147
147
|
return JSON.parse(t);
|
|
148
148
|
} catch {
|
|
149
149
|
return {};
|
|
150
150
|
}
|
|
151
|
-
},
|
|
152
|
-
let n =
|
|
151
|
+
}, Xa = async (e, t) => {
|
|
152
|
+
let n = Ka(e), r = `${n}.${process.pid}.${Math.random().toString(36).slice(2, 8)}.tmp`;
|
|
153
153
|
await X.writeFile(r, JSON.stringify(t)), await X.rename(r, n);
|
|
154
|
-
},
|
|
155
|
-
if (!
|
|
156
|
-
await X.mkdir(
|
|
157
|
-
let r = await
|
|
158
|
-
return i !== null && n?.takeOver !== !0 ? i : (await
|
|
154
|
+
}, Za = async (e, t, n) => {
|
|
155
|
+
if (!Ha(e)) return t;
|
|
156
|
+
await X.mkdir(Wa(e), { recursive: !0 });
|
|
157
|
+
let r = await Ya(e), i = typeof r.runId == "string" && r.runId.length > 0 ? r.runId : null;
|
|
158
|
+
return i !== null && n?.takeOver !== !0 ? i : (await Xa(e, {
|
|
159
159
|
...r,
|
|
160
160
|
runId: t
|
|
161
161
|
}), t);
|
|
162
|
-
},
|
|
163
|
-
if (!
|
|
164
|
-
let t = await
|
|
162
|
+
}, Qa = async (e) => {
|
|
163
|
+
if (!Ha(e)) return;
|
|
164
|
+
let t = await Ya(e);
|
|
165
165
|
if (t.runId === void 0) return;
|
|
166
166
|
let { runId: n, ...r } = t;
|
|
167
|
-
await
|
|
168
|
-
},
|
|
169
|
-
...await
|
|
167
|
+
await Xa(e, r).catch(() => void 0);
|
|
168
|
+
}, $a = async (e, t, n) => (await X.mkdir(Wa(e), { recursive: !0 }), await X.writeFile(Ga(e), Buffer.from(t)), await Xa(e, {
|
|
169
|
+
...await Ya(e),
|
|
170
170
|
key: n,
|
|
171
171
|
startedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
172
|
-
}), t.byteLength),
|
|
173
|
-
if (!
|
|
172
|
+
}), t.byteLength), eo = (e) => `up-${oa("sha256").update(e).digest("hex").slice(0, 32)}`, to = async (e) => {
|
|
173
|
+
if (!Ha(e.id)) return {
|
|
174
174
|
reason: "bad-id",
|
|
175
|
-
message: `upload id must match ${String(
|
|
175
|
+
message: `upload id must match ${String(Va)}`
|
|
176
176
|
};
|
|
177
|
-
let t = await
|
|
177
|
+
let t = await Ja(e.id);
|
|
178
178
|
if (t.key !== null && t.key !== e.key) return {
|
|
179
179
|
reason: "key-mismatch",
|
|
180
180
|
message: "this upload id already holds a different bundle. Use a new upload id, or delete the partial upload."
|
|
@@ -184,34 +184,34 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
184
184
|
message: `chunk starts at ${e.offset} but the server holds ${t.bytes} byte(s)`,
|
|
185
185
|
expectedOffset: t.bytes
|
|
186
186
|
};
|
|
187
|
-
if (await X.mkdir(
|
|
188
|
-
let t = await
|
|
189
|
-
await
|
|
187
|
+
if (await X.mkdir(Wa(e.id), { recursive: !0 }), t.key === null) {
|
|
188
|
+
let t = await Ya(e.id);
|
|
189
|
+
await Xa(e.id, {
|
|
190
190
|
...t,
|
|
191
191
|
key: e.key,
|
|
192
192
|
startedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
193
193
|
});
|
|
194
194
|
}
|
|
195
195
|
return await new Promise((t, n) => {
|
|
196
|
-
let r =
|
|
196
|
+
let r = $n(Ga(e.id), { flags: "a" });
|
|
197
197
|
r.on("error", n), r.on("finish", () => t()), r.end(Buffer.from(e.bytes));
|
|
198
198
|
}), { total: t.bytes + e.bytes.byteLength };
|
|
199
|
-
},
|
|
200
|
-
let t = await X.stat(
|
|
199
|
+
}, no = async (e) => {
|
|
200
|
+
let t = await X.stat(Ga(e));
|
|
201
201
|
return {
|
|
202
|
-
path:
|
|
202
|
+
path: Ga(e),
|
|
203
203
|
bytes: t.size
|
|
204
204
|
};
|
|
205
|
-
},
|
|
206
|
-
if (!
|
|
207
|
-
let n =
|
|
205
|
+
}, ro = () => I.join(Ua(), ".runs"), io = (e) => I.join(ro(), `${e}.bin`), ao = async (e, t) => {
|
|
206
|
+
if (!Ha(e)) return null;
|
|
207
|
+
let n = Ga(e), r = await X.stat(n).catch(() => null);
|
|
208
208
|
if (r === null || r.size === 0) return null;
|
|
209
|
-
await X.mkdir(
|
|
210
|
-
let i =
|
|
209
|
+
await X.mkdir(ro(), { recursive: !0 });
|
|
210
|
+
let i = io(t);
|
|
211
211
|
return await X.rename(n, i), i;
|
|
212
|
-
},
|
|
213
|
-
await X.rm(
|
|
214
|
-
}, Q =
|
|
212
|
+
}, oo = async (e) => {
|
|
213
|
+
await X.rm(io(e), { force: !0 }).catch(() => void 0);
|
|
214
|
+
}, Q = L({ scope: "voltro:admin-import" }), so = "VBUNDLE2", co = (e) => {
|
|
215
215
|
let t = e.req.headers["x-import-rollback-key"];
|
|
216
216
|
if (e.mode !== "replace") return { options: {} };
|
|
217
217
|
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: {} };
|
|
@@ -222,18 +222,18 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
222
222
|
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 `/`."
|
|
223
223
|
})
|
|
224
224
|
};
|
|
225
|
-
let n =
|
|
225
|
+
let n = Qn(Zi(), `voltro-rollback-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`), r = e.deps.putArchive;
|
|
226
226
|
return {
|
|
227
227
|
key: t,
|
|
228
228
|
options: {
|
|
229
229
|
rollbackDir: n,
|
|
230
230
|
onRollbackCaptured: async () => {
|
|
231
|
-
let e =
|
|
232
|
-
e !== void 0 && Q.warn(`admin.import: ${e}`), await r(t, () =>
|
|
231
|
+
let e = ea(n);
|
|
232
|
+
e !== void 0 && Q.warn(`admin.import: ${e}`), await r(t, () => xa({ dir: n })), Q.info("admin.import: rollback capture stored", { bundleKey: t });
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
235
|
};
|
|
236
|
-
},
|
|
236
|
+
}, lo = (e) => {
|
|
237
237
|
let t = e["x-import-mode"], n = e["x-import-atomic"];
|
|
238
238
|
return {
|
|
239
239
|
mode: t,
|
|
@@ -243,34 +243,34 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
243
243
|
dryRun: e["x-import-dry-run"] === "1" || e["x-import-dry-run"] === "true",
|
|
244
244
|
tables: (e["x-import-tables"] ?? "").split(",").map((e) => e.trim()).filter(Boolean)
|
|
245
245
|
};
|
|
246
|
-
},
|
|
246
|
+
}, uo = async (e, t) => {
|
|
247
247
|
if (typeof t.bundleKey == "string" && t.bundleKey !== "") {
|
|
248
248
|
if (!e.openArchive) return { refusal: Z(501, { error: "storage transport not configured on this instance" }) };
|
|
249
249
|
let n = e.openArchive, r = t.bundleKey;
|
|
250
250
|
return {
|
|
251
251
|
source: () => n(r),
|
|
252
252
|
transport: "storage",
|
|
253
|
-
uploadId:
|
|
253
|
+
uploadId: eo(r)
|
|
254
254
|
};
|
|
255
255
|
}
|
|
256
256
|
let n = t.uploadId;
|
|
257
|
-
if (typeof n != "string" || !
|
|
258
|
-
let r = await
|
|
257
|
+
if (typeof n != "string" || !Ha(n)) return { refusal: Z(400, { error: "start needs { uploadId } from an upload, or { bundleKey } for the storage transport" }) };
|
|
258
|
+
let r = await no(n).catch(() => null);
|
|
259
259
|
return r === null || r.bytes === 0 ? { refusal: Z(409, {
|
|
260
260
|
error: "no such upload",
|
|
261
261
|
message: `this instance holds no bytes for upload '${n}'. Upload the bundle first, or re-upload if it has expired.`
|
|
262
262
|
}) } : {
|
|
263
|
-
source: () =>
|
|
263
|
+
source: () => fo(r.path),
|
|
264
264
|
transport: "upload",
|
|
265
265
|
uploadId: n
|
|
266
266
|
};
|
|
267
|
-
},
|
|
268
|
-
let { createReadStream: t } =
|
|
267
|
+
}, fo = (e) => {
|
|
268
|
+
let { createReadStream: t } = ka("node:fs");
|
|
269
269
|
return t(e);
|
|
270
|
-
},
|
|
271
|
-
let n =
|
|
270
|
+
}, po = (e) => async (t) => {
|
|
271
|
+
let n = Ba(t, e.secret);
|
|
272
272
|
if (n) return n;
|
|
273
|
-
let r =
|
|
273
|
+
let r = lo(t.headers), i = co({
|
|
274
274
|
req: t,
|
|
275
275
|
mode: r.mode,
|
|
276
276
|
deps: e
|
|
@@ -284,16 +284,16 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
284
284
|
return Z(400, { error: "a preflight body must be JSON: { tables: string[] } or { bundleKey: string }" });
|
|
285
285
|
}
|
|
286
286
|
let a = Array.isArray(n.tables) ? n.tables.filter((e) => typeof e == "string") : [];
|
|
287
|
-
if (a.length === 0 && typeof n.bundleKey == "string" && n.bundleKey !== "" && e.openArchive && (a = [...await
|
|
287
|
+
if (a.length === 0 && typeof n.bundleKey == "string" && n.bundleKey !== "" && e.openArchive && (a = [...await mo(e.openArchive(n.bundleKey))]), a.length === 0) return Z(400, {
|
|
288
288
|
error: "a preflight needs { tables: string[] } — the bundle's table names, so the staging decision can be made against them",
|
|
289
289
|
hint: "or { bundleKey } on an instance with storage configured, where this endpoint reads the table list out of the archive itself"
|
|
290
290
|
});
|
|
291
|
-
let o =
|
|
291
|
+
let o = ya({
|
|
292
292
|
mode: r.mode ?? "upsert",
|
|
293
293
|
...e.dialect === void 0 ? {} : { targetDialect: e.dialect },
|
|
294
294
|
...e.snapshot === void 0 ? {} : { targetSnapshot: e.snapshot },
|
|
295
295
|
bundleTables: a,
|
|
296
|
-
isSkipped:
|
|
296
|
+
isSkipped: ba,
|
|
297
297
|
canRunSql: !0
|
|
298
298
|
});
|
|
299
299
|
return Z(200, {
|
|
@@ -312,8 +312,8 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
312
312
|
}
|
|
313
313
|
let a = t.headers["x-import-upload-id"];
|
|
314
314
|
if (a !== void 0 && a !== "") {
|
|
315
|
-
if (
|
|
316
|
-
let e = await
|
|
315
|
+
if (qa(), t.headers["x-import-probe"] === "1") {
|
|
316
|
+
let e = await Ja(a);
|
|
317
317
|
return Z(200, {
|
|
318
318
|
uploadId: a,
|
|
319
319
|
bytes: e.bytes,
|
|
@@ -322,7 +322,7 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
322
322
|
}
|
|
323
323
|
let e = t.headers["x-import-upload-key"] ?? "", n = Number(t.headers["x-import-chunk-offset"] ?? "0");
|
|
324
324
|
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" });
|
|
325
|
-
let r = await
|
|
325
|
+
let r = await to({
|
|
326
326
|
id: a,
|
|
327
327
|
key: e,
|
|
328
328
|
offset: n,
|
|
@@ -344,12 +344,12 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
344
344
|
complete: i
|
|
345
345
|
});
|
|
346
346
|
}
|
|
347
|
-
if (t.rawBody.byteLength >= 8 && Buffer.from(t.rawBody.subarray(0, 8)).toString("latin1") ===
|
|
348
|
-
|
|
349
|
-
let e =
|
|
347
|
+
if (t.rawBody.byteLength >= 8 && Buffer.from(t.rawBody.subarray(0, 8)).toString("latin1") === so) {
|
|
348
|
+
qa();
|
|
349
|
+
let e = oa("sha256").update(Buffer.from(t.rawBody)).digest("hex"), n = eo(e);
|
|
350
350
|
return Z(202, {
|
|
351
351
|
uploadId: n,
|
|
352
|
-
bytes: await
|
|
352
|
+
bytes: await $a(n, t.rawBody, e),
|
|
353
353
|
complete: !0
|
|
354
354
|
});
|
|
355
355
|
}
|
|
@@ -360,22 +360,22 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
360
360
|
return Z(400, { error: "body must be a packed bundle archive or { bundleKey } JSON" });
|
|
361
361
|
}
|
|
362
362
|
return typeof o.bundleKey != "string" || !o.bundleKey ? Z(400, { error: "body.bundleKey (string) is required for the storage transport" }) : e.openArchive ? Z(202, {
|
|
363
|
-
uploadId:
|
|
363
|
+
uploadId: eo(o.bundleKey),
|
|
364
364
|
bundleKey: o.bundleKey,
|
|
365
365
|
complete: !0
|
|
366
366
|
}) : Z(501, { error: "storage transport not configured on this instance" });
|
|
367
|
-
},
|
|
368
|
-
let t = await
|
|
367
|
+
}, mo = async (e) => {
|
|
368
|
+
let t = await Sa(e, ["manifest.json"]).then((e) => e.get("manifest.json"), () => void 0);
|
|
369
369
|
if (t === void 0) return [];
|
|
370
370
|
try {
|
|
371
371
|
return (JSON.parse(Buffer.from(t).toString("utf8")).tables ?? []).map((e) => e.name).filter((e) => typeof e == "string");
|
|
372
372
|
} catch {
|
|
373
373
|
return [];
|
|
374
374
|
}
|
|
375
|
-
},
|
|
376
|
-
let n =
|
|
375
|
+
}, ho = (e) => async (t) => {
|
|
376
|
+
let n = Ba(t, e.secret);
|
|
377
377
|
if (n) return n;
|
|
378
|
-
let r =
|
|
378
|
+
let r = lo(t.headers), i = co({
|
|
379
379
|
req: t,
|
|
380
380
|
mode: r.mode,
|
|
381
381
|
deps: e
|
|
@@ -387,12 +387,12 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
387
387
|
} catch {
|
|
388
388
|
return Z(400, { error: "body must be JSON: { uploadId } or { bundleKey }" });
|
|
389
389
|
}
|
|
390
|
-
let o = typeof a.bundleKey == "string" && a.bundleKey !== "" ?
|
|
391
|
-
if (!
|
|
392
|
-
let s =
|
|
390
|
+
let o = typeof a.bundleKey == "string" && a.bundleKey !== "" ? eo(a.bundleKey) : typeof a.uploadId == "string" ? a.uploadId : "";
|
|
391
|
+
if (!Ha(o)) return Z(400, { error: "start needs { uploadId } from an upload, or { bundleKey } for the storage transport" });
|
|
392
|
+
let s = Cr("dimp", `${o}-${Date.now()}-${Math.random()}`), c = await Za(o, s);
|
|
393
393
|
if (c !== s) {
|
|
394
|
-
let t = await
|
|
395
|
-
if (
|
|
394
|
+
let t = await Jn(e.store, c);
|
|
395
|
+
if (Yn(t) === void 0 && t !== null) return Q.info("admin.import start: already running", {
|
|
396
396
|
uploadId: o,
|
|
397
397
|
runId: c
|
|
398
398
|
}), Z(202, {
|
|
@@ -403,18 +403,18 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
403
403
|
Q.info("admin.import start: taking over a claim whose run is not running", {
|
|
404
404
|
uploadId: o,
|
|
405
405
|
staleRunId: c,
|
|
406
|
-
outcome:
|
|
407
|
-
}), c = await
|
|
406
|
+
outcome: Yn(t) ?? "no record"
|
|
407
|
+
}), c = await Za(o, s, { takeOver: !0 });
|
|
408
408
|
}
|
|
409
|
-
let l = async (e) => (await
|
|
409
|
+
let l = async (e) => (await Qa(o).catch(() => void 0), e), u = await uo(e, {
|
|
410
410
|
...typeof a.uploadId == "string" ? { uploadId: a.uploadId } : {},
|
|
411
411
|
...typeof a.bundleKey == "string" ? { bundleKey: a.bundleKey } : {}
|
|
412
412
|
});
|
|
413
413
|
if ("refusal" in u) return l(u.refusal);
|
|
414
414
|
if (e.snapshot !== void 0 && !r.force) {
|
|
415
|
-
let t = await
|
|
415
|
+
let t = await go(u.source());
|
|
416
416
|
if (t !== null) {
|
|
417
|
-
let n =
|
|
417
|
+
let n = va(t.source?.schemaFingerprint ?? "", e.snapshot, _o(t));
|
|
418
418
|
if (n.drifted) return Q.warn("admin.import refused (schema drift)", {
|
|
419
419
|
transport: u.transport,
|
|
420
420
|
bundle: n.bundleFingerprint.slice(0, 16),
|
|
@@ -429,17 +429,17 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
429
429
|
}
|
|
430
430
|
}
|
|
431
431
|
let d = null;
|
|
432
|
-
if (u.transport === "upload" && (d = await
|
|
432
|
+
if (u.transport === "upload" && (d = await ao(u.uploadId, c), d === null)) return l(Z(409, {
|
|
433
433
|
error: "no such upload",
|
|
434
434
|
message: `the bytes for upload '${u.uploadId}' are gone. Re-upload the bundle.`
|
|
435
435
|
}));
|
|
436
|
-
let f = await
|
|
436
|
+
let f = await vo(e.store, {
|
|
437
437
|
runId: c,
|
|
438
438
|
mode: r.mode ?? "upsert",
|
|
439
439
|
via: "api",
|
|
440
440
|
bundle: u.transport === "storage" ? String(a.bundleKey) : u.uploadId
|
|
441
441
|
});
|
|
442
|
-
return
|
|
442
|
+
return yo({
|
|
443
443
|
deps: e,
|
|
444
444
|
opts: r,
|
|
445
445
|
rollback: i,
|
|
@@ -447,7 +447,7 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
447
447
|
traced: f,
|
|
448
448
|
resolved: d === null ? u : {
|
|
449
449
|
...u,
|
|
450
|
-
source: () =>
|
|
450
|
+
source: () => fo(d)
|
|
451
451
|
}
|
|
452
452
|
}), Q.info("admin.import started", {
|
|
453
453
|
runId: c,
|
|
@@ -466,15 +466,15 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
466
466
|
recorded: f,
|
|
467
467
|
outcome: "poll /_voltro/admin/transfers for this runId — a 202 means started, not finished"
|
|
468
468
|
});
|
|
469
|
-
},
|
|
470
|
-
let t = await
|
|
469
|
+
}, go = async (e) => {
|
|
470
|
+
let t = await Sa(e, ["manifest.json"]).then((e) => e.get("manifest.json"), () => null);
|
|
471
471
|
if (t == null) return null;
|
|
472
472
|
try {
|
|
473
473
|
return JSON.parse(Buffer.from(t).toString("utf8"));
|
|
474
474
|
} catch {
|
|
475
475
|
return null;
|
|
476
476
|
}
|
|
477
|
-
},
|
|
477
|
+
}, _o = (e) => ({ tables: (e.tables ?? []).map((e) => ({
|
|
478
478
|
name: e.name,
|
|
479
479
|
indexes: [],
|
|
480
480
|
columns: Object.entries(e.columnTypes ?? {}).map(([e, t]) => ({
|
|
@@ -484,9 +484,9 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
484
484
|
unique: !1,
|
|
485
485
|
hasDefault: !1
|
|
486
486
|
}))
|
|
487
|
-
})) }),
|
|
487
|
+
})) }), vo = async (e, t) => {
|
|
488
488
|
try {
|
|
489
|
-
return
|
|
489
|
+
return Tr(yr), await e.insert(V, {
|
|
490
490
|
id: t.runId,
|
|
491
491
|
direction: "import",
|
|
492
492
|
startedAt: /* @__PURE__ */ new Date(),
|
|
@@ -506,23 +506,23 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
506
506
|
error: e?.message ?? String(e)
|
|
507
507
|
}), !1;
|
|
508
508
|
}
|
|
509
|
-
},
|
|
509
|
+
}, yo = async (e) => {
|
|
510
510
|
let { deps: t, opts: n, rollback: r, resolved: i, runId: a } = e, o = await import("node:os"), s = await import("node:fs/promises"), c = await import("node:path"), l = await s.mkdtemp(c.join(o.tmpdir(), "voltro-admin-import-")), u = async (n) => {
|
|
511
511
|
Q.warn("admin.import failed", {
|
|
512
512
|
runId: a,
|
|
513
513
|
transport: i.transport,
|
|
514
514
|
error: n
|
|
515
|
-
}), e.traced && await t.store.update(
|
|
515
|
+
}), e.traced && await t.store.update(V, a, {
|
|
516
516
|
failure: n,
|
|
517
517
|
finishedAt: null
|
|
518
518
|
}).then(() => void 0, () => void 0);
|
|
519
519
|
};
|
|
520
520
|
try {
|
|
521
|
-
t.assetSink ? await
|
|
521
|
+
t.assetSink ? await Da(i.source(), {
|
|
522
522
|
dir: l,
|
|
523
523
|
blobs: t.assetSink
|
|
524
|
-
}) : await
|
|
525
|
-
let o = await J.runPromiseExit(
|
|
524
|
+
}) : await Oa(i.source(), l);
|
|
525
|
+
let o = await J.runPromiseExit(wa({
|
|
526
526
|
store: t.store,
|
|
527
527
|
bundleDir: l,
|
|
528
528
|
...n.mode ? { mode: n.mode } : {},
|
|
@@ -567,24 +567,24 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
567
567
|
await s.rm(l, {
|
|
568
568
|
recursive: !0,
|
|
569
569
|
force: !0
|
|
570
|
-
}).catch(() => void 0), await
|
|
570
|
+
}).catch(() => void 0), await oo(a).catch(() => void 0), await Qa(i.uploadId).catch(() => void 0);
|
|
571
571
|
}
|
|
572
|
-
},
|
|
572
|
+
}, bo = /^[A-Za-z0-9_-]{8,64}$/, xo = (e) => bo.test(e), So = () => process.env.VOLTRO_EXPORT_ARTIFACT_DIR ?? I.join(Xi.tmpdir(), "voltro-export-artifacts"), Co = (e) => I.join(So(), e), wo = (e) => I.join(Co(e), "archive.bin"), To = async (e = Date.now()) => {
|
|
573
573
|
let t = 0;
|
|
574
574
|
try {
|
|
575
|
-
for (let n of await X.readdir(
|
|
576
|
-
let r = await X.stat(
|
|
577
|
-
r !== null && (e - r.mtimeMs <= 864e5 || (await X.rm(
|
|
575
|
+
for (let n of await X.readdir(So())) {
|
|
576
|
+
let r = await X.stat(Co(n)).catch(() => null);
|
|
577
|
+
r !== null && (e - r.mtimeMs <= 864e5 || (await X.rm(Co(n), {
|
|
578
578
|
recursive: !0,
|
|
579
579
|
force: !0
|
|
580
580
|
}).catch(() => void 0), t++));
|
|
581
581
|
}
|
|
582
582
|
} catch {}
|
|
583
583
|
return t;
|
|
584
|
-
},
|
|
585
|
-
if (!
|
|
586
|
-
await X.mkdir(
|
|
587
|
-
let { createWriteStream: n } = await import("node:fs"), r = n(
|
|
584
|
+
}, Eo = async (e, t) => {
|
|
585
|
+
if (!xo(e)) throw Error(`invalid run id: ${e}`);
|
|
586
|
+
await X.mkdir(Co(e), { recursive: !0 });
|
|
587
|
+
let { createWriteStream: n } = await import("node:fs"), r = n(wo(e)), i = 0;
|
|
588
588
|
try {
|
|
589
589
|
for await (let e of t) i += e.byteLength, r.write(Buffer.from(e)) || await new Promise((e, t) => {
|
|
590
590
|
r.once("drain", e), r.once("error", t);
|
|
@@ -595,18 +595,18 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
595
595
|
});
|
|
596
596
|
}
|
|
597
597
|
return i;
|
|
598
|
-
},
|
|
599
|
-
if (!
|
|
600
|
-
let t = await X.stat(
|
|
598
|
+
}, Do = async (e) => {
|
|
599
|
+
if (!xo(e)) return null;
|
|
600
|
+
let t = await X.stat(wo(e)).catch(() => null);
|
|
601
601
|
return t === null ? null : t.size;
|
|
602
|
-
},
|
|
603
|
-
let r = await
|
|
602
|
+
}, Oo = async (e, t, n) => {
|
|
603
|
+
let r = await Do(e);
|
|
604
604
|
if (r === null) return null;
|
|
605
605
|
if (t >= r) return {
|
|
606
606
|
bytes: Buffer.alloc(0),
|
|
607
607
|
total: r
|
|
608
608
|
};
|
|
609
|
-
let i = await X.open(
|
|
609
|
+
let i = await X.open(wo(e), "r");
|
|
610
610
|
try {
|
|
611
611
|
let e = Math.max(0, Math.min(n, r - t)), a = Buffer.alloc(e);
|
|
612
612
|
return await i.read(a, 0, e, t), {
|
|
@@ -616,27 +616,27 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
616
616
|
} finally {
|
|
617
617
|
await i.close();
|
|
618
618
|
}
|
|
619
|
-
},
|
|
620
|
-
|
|
619
|
+
}, ko = async (e) => {
|
|
620
|
+
xo(e) && await X.rm(Co(e), {
|
|
621
621
|
recursive: !0,
|
|
622
622
|
force: !0
|
|
623
623
|
}).catch(() => void 0);
|
|
624
|
-
},
|
|
624
|
+
}, Ao = L({ scope: "voltro:admin-export" }), jo = (e) => Array.isArray(e) ? e.filter((e) => typeof e == "string") : [], Mo = (e) => {
|
|
625
625
|
if (typeof e.tenant == "string" && e.tenant) return {
|
|
626
626
|
kind: "tenant",
|
|
627
627
|
tenantId: e.tenant
|
|
628
628
|
};
|
|
629
629
|
if (Array.isArray(e.tables) && e.tables.length) return {
|
|
630
630
|
kind: "tables",
|
|
631
|
-
tables:
|
|
631
|
+
tables: jo(e.tables)
|
|
632
632
|
};
|
|
633
|
-
let t =
|
|
633
|
+
let t = jo(e.exclude);
|
|
634
634
|
return t.length > 0 ? {
|
|
635
635
|
kind: "all",
|
|
636
636
|
exclude: t
|
|
637
637
|
} : { kind: "all" };
|
|
638
|
-
},
|
|
639
|
-
let n =
|
|
638
|
+
}, No = (e) => async (t) => {
|
|
639
|
+
let n = Ba(t, e.secret);
|
|
640
640
|
if (n) return n;
|
|
641
641
|
let r;
|
|
642
642
|
try {
|
|
@@ -656,12 +656,12 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
656
656
|
});
|
|
657
657
|
}
|
|
658
658
|
}
|
|
659
|
-
let a = r.consistency === "snapshot" ? "snapshot" : i.consistency ?? "live", o = (typeof r.compression == "string" ? r.compression : void 0) ?? i.compression, s = i.scope ??
|
|
659
|
+
let a = r.consistency === "snapshot" ? "snapshot" : i.consistency ?? "live", o = (typeof r.compression == "string" ? r.compression : void 0) ?? i.compression, s = i.scope ?? Mo(r), c = typeof r.bundleKey == "string" && r.bundleKey.length > 0, l = r.assets === !0 && e.assetSource ? { blobs: e.assetSource } : {}, u = Cr("dexp", `${Date.now()}-${Math.random()}`), d = await Po(e.store, {
|
|
660
660
|
runId: u,
|
|
661
661
|
mode: i.subset ? "subset" : s.kind,
|
|
662
662
|
bundle: c ? String(r.bundleKey) : null
|
|
663
663
|
});
|
|
664
|
-
return
|
|
664
|
+
return Fo({
|
|
665
665
|
deps: e,
|
|
666
666
|
runId: u,
|
|
667
667
|
recorded: d,
|
|
@@ -671,7 +671,7 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
671
671
|
blobs: l,
|
|
672
672
|
...o ? { compression: o } : {},
|
|
673
673
|
...c ? { bundleKey: String(r.bundleKey) } : {}
|
|
674
|
-
}),
|
|
674
|
+
}), To(), Ao.info("admin.export started", {
|
|
675
675
|
runId: u,
|
|
676
676
|
scope: s.kind,
|
|
677
677
|
storage: c
|
|
@@ -682,9 +682,9 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
682
682
|
recorded: d,
|
|
683
683
|
outcome: "poll /_voltro/admin/transfers for this runId; fetch the bytes from /_voltro/admin/export/download"
|
|
684
684
|
});
|
|
685
|
-
},
|
|
685
|
+
}, Po = async (e, t) => {
|
|
686
686
|
try {
|
|
687
|
-
return
|
|
687
|
+
return Tr(yr), await e.insert(V, {
|
|
688
688
|
id: t.runId,
|
|
689
689
|
direction: "export",
|
|
690
690
|
startedAt: /* @__PURE__ */ new Date(),
|
|
@@ -699,17 +699,17 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
699
699
|
staged: null
|
|
700
700
|
}), !0;
|
|
701
701
|
} catch (e) {
|
|
702
|
-
return
|
|
702
|
+
return Ao.warn("admin.export: the run could not be recorded", {
|
|
703
703
|
runId: t.runId,
|
|
704
704
|
error: e?.message ?? String(e)
|
|
705
705
|
}), !1;
|
|
706
706
|
}
|
|
707
|
-
},
|
|
707
|
+
}, Fo = async (e) => {
|
|
708
708
|
let { deps: t, runId: n } = e, r = await import("node:os"), i = await import("node:fs/promises"), a = await import("node:path"), o = await i.mkdtemp(a.join(r.tmpdir(), "voltro-admin-export-")), s = async (r) => {
|
|
709
|
-
e.recorded && await t.store.update(
|
|
709
|
+
e.recorded && await t.store.update(V, n, r).then(() => void 0, () => void 0);
|
|
710
710
|
};
|
|
711
711
|
try {
|
|
712
|
-
let r = await J.runPromise(
|
|
712
|
+
let r = await J.runPromise(Ca({
|
|
713
713
|
store: t.store,
|
|
714
714
|
snapshot: t.snapshot,
|
|
715
715
|
dialect: t.dialect,
|
|
@@ -724,16 +724,16 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
724
724
|
})), i = r.tables.reduce((e, t) => e + t.rowCount, 0), a = r.masking?.transformed.length ?? 0;
|
|
725
725
|
if (e.bundleKey !== void 0) {
|
|
726
726
|
if (!t.putArchive) throw Error("storage transport not configured on this instance");
|
|
727
|
-
await t.putArchive(e.bundleKey, () =>
|
|
727
|
+
await t.putArchive(e.bundleKey, () => xa({
|
|
728
728
|
dir: o,
|
|
729
729
|
...e.blobs
|
|
730
730
|
}));
|
|
731
731
|
}
|
|
732
|
-
let c = await
|
|
732
|
+
let c = await Eo(n, xa({
|
|
733
733
|
dir: o,
|
|
734
734
|
...e.blobs
|
|
735
735
|
}));
|
|
736
|
-
|
|
736
|
+
Ao.info("admin.export complete", {
|
|
737
737
|
runId: n,
|
|
738
738
|
tables: r.tables.length,
|
|
739
739
|
rows: i,
|
|
@@ -749,25 +749,25 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
749
749
|
});
|
|
750
750
|
} catch (e) {
|
|
751
751
|
let t = e?.message ?? String(e);
|
|
752
|
-
|
|
752
|
+
Ao.warn("admin.export failed", {
|
|
753
753
|
runId: n,
|
|
754
754
|
error: t
|
|
755
755
|
}), await s({
|
|
756
756
|
failure: t,
|
|
757
757
|
finishedAt: null
|
|
758
|
-
}), await
|
|
758
|
+
}), await ko(n);
|
|
759
759
|
} finally {
|
|
760
760
|
await i.rm(o, {
|
|
761
761
|
recursive: !0,
|
|
762
762
|
force: !0
|
|
763
763
|
}).catch(() => void 0);
|
|
764
764
|
}
|
|
765
|
-
},
|
|
766
|
-
let n =
|
|
765
|
+
}, Io = (e) => async (t) => {
|
|
766
|
+
let n = Ba(t, e.secret, "GET");
|
|
767
767
|
if (n) return n;
|
|
768
768
|
let r = new URLSearchParams(t.query ?? ""), i = r.get("runId") ?? "";
|
|
769
|
-
if (!
|
|
770
|
-
let a = Math.max(0, Number(r.get("offset") ?? "0") || 0), o = Number(r.get("length") ?? "8388608"), s = await
|
|
769
|
+
if (!xo(i)) return Z(400, { error: "download needs ?runId=<id> from the 202 the export answered with" });
|
|
770
|
+
let a = Math.max(0, Number(r.get("offset") ?? "0") || 0), o = Number(r.get("length") ?? "8388608"), s = await Oo(i, a, Number.isFinite(o) && o > 0 ? Math.min(o, Ro) : Lo);
|
|
771
771
|
return s === null ? Z(404, {
|
|
772
772
|
error: "no artefact",
|
|
773
773
|
message: `this instance holds no produced bundle for run '${i}'. It may have expired, or the export may still be running — poll the run first.`
|
|
@@ -781,8 +781,8 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
781
781
|
"x-export-length": String(s.bytes.byteLength)
|
|
782
782
|
}
|
|
783
783
|
};
|
|
784
|
-
},
|
|
785
|
-
table:
|
|
784
|
+
}, Lo = 8388608, Ro = 33554432, zo = async (e, t) => await e.query({
|
|
785
|
+
table: V,
|
|
786
786
|
order: [{
|
|
787
787
|
column: "startedAt",
|
|
788
788
|
direction: "desc"
|
|
@@ -791,23 +791,23 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
791
791
|
projection: void 0,
|
|
792
792
|
skip: 0,
|
|
793
793
|
take: t
|
|
794
|
-
}),
|
|
794
|
+
}), Bo = (e) => {
|
|
795
795
|
let t = new Date(e);
|
|
796
796
|
return Number.isFinite(t.getTime()) ? t : /* @__PURE__ */ new Date(0);
|
|
797
|
-
},
|
|
797
|
+
}, Vo = (e) => ({
|
|
798
798
|
...e,
|
|
799
|
-
startedAt:
|
|
800
|
-
finishedAt: e.finishedAt === null || e.finishedAt === void 0 ? null :
|
|
801
|
-
}),
|
|
802
|
-
let n =
|
|
799
|
+
startedAt: Bo(e.startedAt),
|
|
800
|
+
finishedAt: e.finishedAt === null || e.finishedAt === void 0 ? null : Bo(e.finishedAt)
|
|
801
|
+
}), Ho = (e) => async (t) => {
|
|
802
|
+
let n = Ba(t, e.secret, "GET");
|
|
803
803
|
if (n) return n;
|
|
804
804
|
let r = Number(new URLSearchParams(t.query ?? "").get("limit") ?? "20"), i = Number.isFinite(r) ? Math.max(1, Math.min(200, Math.trunc(r))) : 20, a;
|
|
805
805
|
try {
|
|
806
|
-
a = (await
|
|
806
|
+
a = (await zo(e.store, i)).map(Vo);
|
|
807
807
|
} catch (e) {
|
|
808
808
|
return Z(409, {
|
|
809
809
|
error: "no import history",
|
|
810
|
-
message: `this instance has no \`${
|
|
810
|
+
message: `this instance has no \`${V}\` table, so no import has been recorded. Run \`voltro db apply\` against it; imports themselves are unaffected.`,
|
|
811
811
|
detail: e?.message ?? String(e)
|
|
812
812
|
});
|
|
813
813
|
}
|
|
@@ -826,11 +826,11 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
826
826
|
direction: e.direction,
|
|
827
827
|
failure: e.failure,
|
|
828
828
|
staged: e.staged,
|
|
829
|
-
line:
|
|
829
|
+
line: wr(e)
|
|
830
830
|
}))
|
|
831
831
|
});
|
|
832
|
-
},
|
|
833
|
-
let r = await J.runPromise(
|
|
832
|
+
}, Uo = (e, t, n = {}) => (async function* () {
|
|
833
|
+
let r = await J.runPromise(na(e, t).pipe(J.timeout(n.openTimeout ?? "30 seconds"))), i = await ia(r.stream), a = n.stallMs ?? 12e4, o, s = () => {
|
|
834
834
|
o && clearTimeout(o), o = setTimeout(() => i.destroy(/* @__PURE__ */ Error(`storage read stalled for ${a}ms reading '${t}'`)), a);
|
|
835
835
|
};
|
|
836
836
|
try {
|
|
@@ -839,7 +839,7 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
839
839
|
} finally {
|
|
840
840
|
o && clearTimeout(o), i.destroy();
|
|
841
841
|
}
|
|
842
|
-
})(),
|
|
842
|
+
})(), Wo = {
|
|
843
843
|
get: async () => void 0,
|
|
844
844
|
set: async () => {},
|
|
845
845
|
setWithTags: async () => {},
|
|
@@ -848,63 +848,63 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
848
848
|
clear: async () => {},
|
|
849
849
|
invalidateTag: async () => 0,
|
|
850
850
|
wrap: async (e, t, n) => n()
|
|
851
|
-
},
|
|
852
|
-
|
|
851
|
+
}, Go = async (e) => {
|
|
852
|
+
Pt(e.appProcedures ?? e.discovered, {
|
|
853
853
|
defaultDeny: e.security?.defaultDeny ?? !0,
|
|
854
854
|
commandHint: "`voltro serve`"
|
|
855
|
-
}),
|
|
855
|
+
}), Mi({
|
|
856
856
|
dataStore: e.store,
|
|
857
857
|
schemaRegistry: e.schemaRegistry
|
|
858
858
|
});
|
|
859
|
-
let t = (e.discovered.budgets?.length ?? 0) > 0, n, r = new
|
|
859
|
+
let t = (e.discovered.budgets?.length ?? 0) > 0, n, r = new Ir({
|
|
860
860
|
crdtColumnsOf: (t) => e.schemaRegistry.crdtColumns(t),
|
|
861
861
|
store: e.store,
|
|
862
862
|
...e.snapshotCache ? { cache: e.snapshotCache } : {},
|
|
863
863
|
...e.reactive === void 0 ? {} : { reactive: e.reactive },
|
|
864
864
|
...t ? { recordCost: (e) => n?.record(e) } : {},
|
|
865
|
-
recordDelivery: (e) =>
|
|
865
|
+
recordDelivery: (e) => K({
|
|
866
866
|
label: e.label,
|
|
867
867
|
kind: e.kind,
|
|
868
868
|
durationMs: e.durationMs,
|
|
869
869
|
rowCount: e.rowCount
|
|
870
870
|
})
|
|
871
|
-
}), i = e.cache ??
|
|
871
|
+
}), i = e.cache ?? Wo, a = e.kv ?? Ti, o, s = () => void 0, c, d, p, ee, te, ne, m, re = L({ scope: "voltro:workflow" }), g = L({ scope: "voltro:schedule" }), ae = u({
|
|
872
872
|
store: e.store,
|
|
873
|
-
warn: (e, t) =>
|
|
874
|
-
}),
|
|
873
|
+
warn: (e, t) => re.warn(e, t)
|
|
874
|
+
}), oe = ae.remember, se = ae.resolve, le = lt({
|
|
875
875
|
authority: e.authority,
|
|
876
876
|
getStore: () => e.store
|
|
877
|
-
}), _ = (e.discovered.workflows?.length ?? 0) > 0 ?
|
|
878
|
-
if (
|
|
877
|
+
}), _ = (e.discovered.workflows?.length ?? 0) > 0 ? pi(() => o) : void 0, ue = (e.discovered.workflows?.length ?? 0) > 0 || (e.discovered.eventTriggers?.length ?? 0) > 0, de = ue || (e.discovered.workflowWorkers?.length ?? 0) > 0 || e.scheduleCoordination === "cluster", fe = e.tenantIsolation === "namespace", me = (e.log ?? L({ scope: "voltro:serve" })).child("webhooks"), he, _e, y = e.discovered.webhooks;
|
|
878
|
+
if (y && y.outgoing.length > 0 && e.workflowEngineLayer !== void 0) {
|
|
879
879
|
e.workflowEngineLayer;
|
|
880
|
-
let t =
|
|
880
|
+
let t = nt({
|
|
881
881
|
store: e.store,
|
|
882
882
|
schemaRegistry: e.schemaRegistry,
|
|
883
883
|
cache: i,
|
|
884
884
|
kv: a
|
|
885
|
-
}), n =
|
|
886
|
-
|
|
887
|
-
let t =
|
|
885
|
+
}), n = y.outgoing.map((e) => e.descriptor);
|
|
886
|
+
_e = pa.toLayer(ua(t, { events: n })), he = da(t, async (e) => {
|
|
887
|
+
let t = p;
|
|
888
888
|
if (t === void 0) {
|
|
889
|
-
|
|
889
|
+
me.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.", {
|
|
890
890
|
deliveryId: e.deliveryId,
|
|
891
891
|
targetId: e.targetId
|
|
892
892
|
});
|
|
893
893
|
return;
|
|
894
894
|
}
|
|
895
|
-
t.runPromise(
|
|
896
|
-
|
|
895
|
+
t.runPromise(pa.execute(e)).catch((t) => {
|
|
896
|
+
me.error("deliverWebhook workflow crashed", {
|
|
897
897
|
deliveryId: e.deliveryId,
|
|
898
898
|
targetId: e.targetId
|
|
899
899
|
}, t);
|
|
900
900
|
});
|
|
901
901
|
}, { events: n });
|
|
902
902
|
}
|
|
903
|
-
let
|
|
904
|
-
if (
|
|
905
|
-
let t = e.descriptor.path ??
|
|
903
|
+
let ve = /* @__PURE__ */ new Map();
|
|
904
|
+
if (y) for (let e of y.incoming) {
|
|
905
|
+
let t = e.descriptor.path ?? fa(e.descriptor.id), n = `VOLTRO_WEBHOOK_SECRET_${e.descriptor.id.toUpperCase().replace(/[^A-Z0-9]/g, "_")}`, r = ha(e.descriptor, {
|
|
906
906
|
resolveSecret: async () => process.env[n] ?? null,
|
|
907
|
-
resolveWorkflows: () => _ === void 0 ? void 0 :
|
|
907
|
+
resolveWorkflows: () => _ === void 0 ? void 0 : Ci(_, {
|
|
908
908
|
traceId: `incoming:${e.descriptor.id}`,
|
|
909
909
|
source: `incoming:${e.descriptor.id}`
|
|
910
910
|
}),
|
|
@@ -916,34 +916,34 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
916
916
|
idempotency: e.idempotency,
|
|
917
917
|
durationMs: e.durationMs
|
|
918
918
|
};
|
|
919
|
-
e.status >= 500 ?
|
|
919
|
+
e.status >= 500 ? me.error("incoming delivery failed", t) : e.status >= 400 ? me.warn("incoming delivery rejected", t) : me.info("incoming delivery handled", t);
|
|
920
920
|
}
|
|
921
921
|
});
|
|
922
|
-
|
|
922
|
+
ve.set(t, { handle: r });
|
|
923
923
|
}
|
|
924
|
-
|
|
925
|
-
let
|
|
924
|
+
ti(), Di((t) => ni(e.store, t.subjectId, t.resourceType, t.resourceId)) || L({ scope: "voltro:serve" }).info("policy guards: using the app-registered tuple source");
|
|
925
|
+
let ye = [], be = [...e.discovered.outboxHandlers ?? [], ...Wn((y?.outgoing.length ?? 0) + (y?.incoming.length ?? 0) + (y?.providers.length ?? 0), []) ? [{
|
|
926
926
|
file: "<framework>/webhooks",
|
|
927
927
|
id: "voltro-webhook-emit",
|
|
928
|
-
definition:
|
|
929
|
-
}] : []],
|
|
930
|
-
handlers:
|
|
928
|
+
definition: ma(() => he)
|
|
929
|
+
}] : []], xe = be.length > 0 ? w({
|
|
930
|
+
handlers: be,
|
|
931
931
|
store: e.store,
|
|
932
|
-
log: (e.log ??
|
|
932
|
+
log: (e.log ?? L({ scope: "voltro:serve" })).child("outbox"),
|
|
933
933
|
onChange: (t) => e.store.onChange((e) => t({
|
|
934
934
|
table: e.table,
|
|
935
935
|
op: e.op
|
|
936
936
|
})),
|
|
937
937
|
onShutdown: (e) => {
|
|
938
|
-
|
|
938
|
+
ye.push(e);
|
|
939
939
|
}
|
|
940
|
-
}) : void 0,
|
|
940
|
+
}) : void 0, b = Ot({
|
|
941
941
|
definitions: (e.discovered.connections ?? []).map((e) => e.definition),
|
|
942
942
|
store: e.store,
|
|
943
|
-
publicUrl:
|
|
944
|
-
log: (e.log ??
|
|
943
|
+
publicUrl: Vt(e.port ?? 4e3),
|
|
944
|
+
log: (e.log ?? L({ scope: "voltro:serve" })).child("connections")
|
|
945
945
|
});
|
|
946
|
-
|
|
946
|
+
Se({
|
|
947
947
|
events: e.discovered.events ?? [],
|
|
948
948
|
rpcTags: [
|
|
949
949
|
...e.discovered.queries.map((e) => e.descriptor.name),
|
|
@@ -952,136 +952,136 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
952
952
|
...(e.discovered.streams ?? []).map((e) => e.descriptor.name)
|
|
953
953
|
]
|
|
954
954
|
});
|
|
955
|
-
let
|
|
956
|
-
instanceId:
|
|
957
|
-
namespace:
|
|
955
|
+
let we = (e.log ?? L({ scope: "voltro:serve" })).child("events"), Te = e.broadcastNamespace ?? Gt(e.plugins, void 0), De = F(e.plugins, Te, we), Ae = e.membership?.instanceId ?? Ar(), je = kr(), Me = e.membership ?? tt(e.plugins, {
|
|
956
|
+
instanceId: Ae,
|
|
957
|
+
namespace: Te,
|
|
958
958
|
meta: { mode: "serve" },
|
|
959
|
-
logger:
|
|
960
|
-
}),
|
|
959
|
+
logger: we
|
|
960
|
+
}), C = Ee({
|
|
961
961
|
events: e.discovered.events ?? [],
|
|
962
|
-
origin:
|
|
963
|
-
...
|
|
964
|
-
}),
|
|
962
|
+
origin: je,
|
|
963
|
+
...De.publishRemote === void 0 ? {} : { publishRemote: De.publishRemote }
|
|
964
|
+
}), Pe = (e.discovered.events ?? []).length > 0 ? await De.attach(C.bus) : null, Fe = Qt({
|
|
965
965
|
store: e.store,
|
|
966
966
|
schemaRegistry: e.schemaRegistry,
|
|
967
967
|
cache: i,
|
|
968
968
|
kv: a,
|
|
969
|
-
...
|
|
969
|
+
...he === void 0 ? {} : { webhooksService: he },
|
|
970
970
|
..._ === void 0 ? {} : { workflowsProxy: _ },
|
|
971
971
|
eventTriggers: e.discovered.eventTriggers ?? [],
|
|
972
|
-
namespaceIsolationOn:
|
|
972
|
+
namespaceIsolationOn: fe,
|
|
973
973
|
...e.ensureTenantProvisioned === void 0 ? {} : { ensureTenantProvisioned: e.ensureTenantProvisioned },
|
|
974
974
|
...e.resolveResidentStore === void 0 ? {} : { resolveResidentStore: e.resolveResidentStore },
|
|
975
|
-
...
|
|
976
|
-
...
|
|
977
|
-
eventBus:
|
|
978
|
-
}),
|
|
979
|
-
let r = t.pipe(J.provide(
|
|
980
|
-
return (e.baseLayer ? r.pipe(J.provide(e.baseLayer)) : r).pipe(J.provide(
|
|
981
|
-
},
|
|
982
|
-
let n =
|
|
983
|
-
return
|
|
984
|
-
},
|
|
975
|
+
...xe === void 0 ? {} : { outbox: { nudge: xe.nudge } },
|
|
976
|
+
...b.active ? { connections: { registry: b.registry } } : {},
|
|
977
|
+
eventBus: C.bus
|
|
978
|
+
}), Ie = Y.succeed(Pr, Oe), Le = Y.succeed(Lr, S), Re = Y.succeed(U, ie), Ve = Y.succeed(Rr, St), He = (t, n) => {
|
|
979
|
+
let r = t.pipe(J.provide(fi(n)));
|
|
980
|
+
return (e.baseLayer ? r.pipe(J.provide(e.baseLayer)) : r).pipe(J.provide(Ie)).pipe(J.provide(Le)).pipe(J.provide(Re)).pipe(J.provide(Ve));
|
|
981
|
+
}, Ue = (e, t) => {
|
|
982
|
+
let n = He(e, t);
|
|
983
|
+
return Ai(n);
|
|
984
|
+
}, We = Vn(), Ge = Ht(e.plugins ?? [], We), Je = ge({
|
|
985
985
|
plugins: e.plugins ?? [],
|
|
986
|
-
metrics:
|
|
987
|
-
log: e.log ??
|
|
988
|
-
}),
|
|
986
|
+
metrics: We,
|
|
987
|
+
log: e.log ?? L({ scope: "voltro:serve" })
|
|
988
|
+
}), Xe = l(e.plugins ?? [], We), Ze = e.security?.defaultDeny ?? !0, Qe = hi({
|
|
989
989
|
store: e.store,
|
|
990
|
-
defaultDeny:
|
|
990
|
+
defaultDeny: Ze,
|
|
991
991
|
recordMetric: (e) => {
|
|
992
|
-
|
|
992
|
+
We.record(e);
|
|
993
993
|
},
|
|
994
|
-
|
|
995
|
-
buildContext: (e, t, n) =>
|
|
996
|
-
runEffect:
|
|
997
|
-
undoCapture:
|
|
998
|
-
}),
|
|
994
|
+
...Ge.mutation === void 0 ? {} : { interceptor: Ge.mutation },
|
|
995
|
+
buildContext: (e, t, n) => Fe(e, t, n),
|
|
996
|
+
runEffect: Ue,
|
|
997
|
+
undoCapture: zt((t) => e.schemaRegistry.crdtColumns(t))
|
|
998
|
+
}), rt = At();
|
|
999
999
|
{
|
|
1000
|
-
let t =
|
|
1001
|
-
t !== void 0 && (e.log ??
|
|
1000
|
+
let t = at();
|
|
1001
|
+
t !== void 0 && (e.log ?? L({ scope: "voltro:serve" })).info(t);
|
|
1002
1002
|
}
|
|
1003
|
-
let
|
|
1003
|
+
let it = et({
|
|
1004
1004
|
store: e.store,
|
|
1005
1005
|
...e.approvals === void 0 ? {} : { defaultExpiryMs: e.approvals.defaultExpiryMs }
|
|
1006
|
-
}),
|
|
1007
|
-
defaultDeny:
|
|
1008
|
-
buildContext: (e) =>
|
|
1009
|
-
runEffect:
|
|
1006
|
+
}), ot = ri({
|
|
1007
|
+
defaultDeny: Ze,
|
|
1008
|
+
buildContext: (e) => Fe(e),
|
|
1009
|
+
runEffect: Ue,
|
|
1010
1010
|
recordMetric: (e) => {
|
|
1011
|
-
|
|
1011
|
+
We.record(e);
|
|
1012
1012
|
},
|
|
1013
|
-
|
|
1014
|
-
}),
|
|
1013
|
+
...Ge.action === void 0 ? {} : { interceptor: Ge.action }
|
|
1014
|
+
}), st = vi({
|
|
1015
1015
|
tenantScopedTables: e.tenantScopedTables,
|
|
1016
1016
|
softDeleteScopedTables: e.softDeleteScopedTables
|
|
1017
|
-
}),
|
|
1018
|
-
defaultDeny:
|
|
1019
|
-
buildContext: (e) =>
|
|
1020
|
-
finalize: (e, t) =>
|
|
1021
|
-
provideEffect:
|
|
1022
|
-
|
|
1023
|
-
},
|
|
1024
|
-
...
|
|
1025
|
-
queryRows: (t, n) => e.store.query(t).then((e) =>
|
|
1026
|
-
}),
|
|
1027
|
-
...
|
|
1017
|
+
}), ct = {
|
|
1018
|
+
defaultDeny: Ze,
|
|
1019
|
+
buildContext: (e) => Fe(e),
|
|
1020
|
+
finalize: (e, t) => st(e, t.subject),
|
|
1021
|
+
provideEffect: He,
|
|
1022
|
+
...Ge.query === void 0 ? {} : { interceptor: Ge.query }
|
|
1023
|
+
}, E = _i(ct), ut = gi({
|
|
1024
|
+
...ct,
|
|
1025
|
+
queryRows: (t, n) => e.store.query(t).then((e) => Ii(t.table, e, n.subject))
|
|
1026
|
+
}), dt = bi({
|
|
1027
|
+
...ct,
|
|
1028
1028
|
subscribeDescriptor: (e, t, n, i, a) => r.subscribe(e, t, n, void 0, void 0, void 0, i, a),
|
|
1029
1029
|
subscribeComputed: (e, t, n) => r.subscribeComputed(e, t, n)
|
|
1030
|
-
}),
|
|
1030
|
+
}), D = (e) => e.filter((e) => ar(e.descriptor)), O = {};
|
|
1031
1031
|
for (let t of [
|
|
1032
|
-
...
|
|
1033
|
-
...
|
|
1034
|
-
...
|
|
1035
|
-
...
|
|
1036
|
-
])
|
|
1032
|
+
...D(e.discovered.queries),
|
|
1033
|
+
...rt.queries,
|
|
1034
|
+
...it.queries,
|
|
1035
|
+
...b.queries
|
|
1036
|
+
]) O[t.descriptor.name] = (e) => W(E(t, e), r, `subscription.${t.descriptor.name}`, void 0, void 0, yi(t, e));
|
|
1037
1037
|
for (let t of [
|
|
1038
|
-
...
|
|
1039
|
-
...
|
|
1040
|
-
...
|
|
1041
|
-
...
|
|
1038
|
+
...D(e.discovered.mutations),
|
|
1039
|
+
...rt.mutations,
|
|
1040
|
+
...it.mutations,
|
|
1041
|
+
...b.mutations
|
|
1042
1042
|
]) {
|
|
1043
|
-
let n =
|
|
1044
|
-
|
|
1043
|
+
let n = mi(t.descriptor.output);
|
|
1044
|
+
O[t.descriptor.name] = (r) => Gr(async (e, n) => Qe(t, e, n), r, `mutation.${t.descriptor.name}`, n, e.idempotency, cr(t.descriptor, "mutation"));
|
|
1045
1045
|
}
|
|
1046
|
-
for (let t of [...
|
|
1047
|
-
let n =
|
|
1048
|
-
|
|
1046
|
+
for (let t of [...D(e.discovered.actions), ...b.actions]) {
|
|
1047
|
+
let n = mi(t.descriptor.output);
|
|
1048
|
+
O[t.descriptor.name] = (r) => Gr(async (e, n) => ot(t, e, n), r, `action.${t.descriptor.name}`, n, e.idempotency, cr(t.descriptor, "action"));
|
|
1049
1049
|
}
|
|
1050
|
-
let
|
|
1050
|
+
let pt = () => `public-${Math.random().toString(36).slice(2, 10)}`, ht = [
|
|
1051
1051
|
...e.discovered.queries.filter((e) => e.descriptor.publicApi !== void 0).map((e) => ({
|
|
1052
1052
|
descriptor: e.descriptor,
|
|
1053
|
-
invoke: (t, n) =>
|
|
1053
|
+
invoke: (t, n) => ut(e, t, {
|
|
1054
1054
|
subject: n.subject,
|
|
1055
|
-
traceId:
|
|
1055
|
+
traceId: pt()
|
|
1056
1056
|
}),
|
|
1057
|
-
subscribe: (t, n, r) =>
|
|
1057
|
+
subscribe: (t, n, r) => dt(e, t, {
|
|
1058
1058
|
subject: n.subject,
|
|
1059
|
-
traceId:
|
|
1059
|
+
traceId: pt()
|
|
1060
1060
|
}, r)
|
|
1061
1061
|
})),
|
|
1062
1062
|
...e.discovered.mutations.filter((e) => e.descriptor.publicApi !== void 0).map((e) => ({
|
|
1063
1063
|
descriptor: e.descriptor,
|
|
1064
|
-
invoke: (t, n) =>
|
|
1064
|
+
invoke: (t, n) => Qe(e, t, {
|
|
1065
1065
|
subject: n.subject,
|
|
1066
|
-
traceId:
|
|
1066
|
+
traceId: pt()
|
|
1067
1067
|
})
|
|
1068
1068
|
})),
|
|
1069
1069
|
...e.discovered.actions.filter((e) => e.descriptor.publicApi !== void 0).map((e) => ({
|
|
1070
1070
|
descriptor: e.descriptor,
|
|
1071
|
-
invoke: (t, n) =>
|
|
1071
|
+
invoke: (t, n) => ot(e, t, {
|
|
1072
1072
|
subject: n.subject,
|
|
1073
|
-
traceId:
|
|
1073
|
+
traceId: pt()
|
|
1074
1074
|
})
|
|
1075
1075
|
}))
|
|
1076
|
-
],
|
|
1077
|
-
candidates:
|
|
1076
|
+
], gt = {
|
|
1077
|
+
candidates: Be({
|
|
1078
1078
|
queries: e.discovered.queries,
|
|
1079
1079
|
mutations: e.discovered.mutations,
|
|
1080
1080
|
actions: e.discovered.actions,
|
|
1081
1081
|
descriptorOf: (e) => e.descriptor,
|
|
1082
|
-
runQuery: (e, t, n) => Promise.resolve(
|
|
1083
|
-
runMutation: (e, t, n) => Promise.resolve(
|
|
1084
|
-
runAction: (e, t, n) => Promise.resolve(
|
|
1082
|
+
runQuery: (e, t, n) => Promise.resolve(ut(e, t, n)),
|
|
1083
|
+
runMutation: (e, t, n) => Promise.resolve(Qe(e, t, n)),
|
|
1084
|
+
runAction: (e, t, n) => Promise.resolve(ot(e, t, n))
|
|
1085
1085
|
}),
|
|
1086
1086
|
policy: e.agents?.tools ?? {},
|
|
1087
1087
|
mcpEnabled: e.agents?.mcp === !0,
|
|
@@ -1094,12 +1094,12 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
1094
1094
|
kind: "query",
|
|
1095
1095
|
input: e.descriptor.input,
|
|
1096
1096
|
output: e.descriptor.output,
|
|
1097
|
-
invoke: (n, r, i) =>
|
|
1097
|
+
invoke: (n, r, i) => ut(e, n, {
|
|
1098
1098
|
subject: r.subject,
|
|
1099
1099
|
traceId: t(),
|
|
1100
1100
|
signal: i
|
|
1101
1101
|
}),
|
|
1102
|
-
subscribe: (n, r, i) =>
|
|
1102
|
+
subscribe: (n, r, i) => dt(e, n, {
|
|
1103
1103
|
subject: r.subject,
|
|
1104
1104
|
traceId: t()
|
|
1105
1105
|
}, i)
|
|
@@ -1109,7 +1109,7 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
1109
1109
|
kind: "mutation",
|
|
1110
1110
|
input: e.descriptor.input,
|
|
1111
1111
|
output: e.descriptor.output,
|
|
1112
|
-
invoke: (n, r, i) =>
|
|
1112
|
+
invoke: (n, r, i) => Qe(e, n, {
|
|
1113
1113
|
subject: r.subject,
|
|
1114
1114
|
traceId: t(),
|
|
1115
1115
|
signal: i
|
|
@@ -1120,14 +1120,14 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
1120
1120
|
kind: "action",
|
|
1121
1121
|
input: e.descriptor.input,
|
|
1122
1122
|
output: e.descriptor.output,
|
|
1123
|
-
invoke: async (n, r, i) =>
|
|
1123
|
+
invoke: async (n, r, i) => ot(e, n, {
|
|
1124
1124
|
subject: r.subject,
|
|
1125
1125
|
traceId: t(),
|
|
1126
1126
|
signal: i
|
|
1127
1127
|
})
|
|
1128
1128
|
}))
|
|
1129
1129
|
];
|
|
1130
|
-
await
|
|
1130
|
+
await f({
|
|
1131
1131
|
config: e.grpc.config,
|
|
1132
1132
|
candidates: n,
|
|
1133
1133
|
resolveSubject: async (t) => {
|
|
@@ -1139,106 +1139,106 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
1139
1139
|
},
|
|
1140
1140
|
store: e.store,
|
|
1141
1141
|
root: e.grpc.root,
|
|
1142
|
-
log: e.log ??
|
|
1143
|
-
onShutdown: (e) =>
|
|
1142
|
+
log: e.log ?? L({ scope: "voltro:serve" }),
|
|
1143
|
+
onShutdown: (e) => G(e)
|
|
1144
1144
|
});
|
|
1145
1145
|
}
|
|
1146
|
-
let
|
|
1146
|
+
let _t = Mt({
|
|
1147
1147
|
...e.restRoutes === void 0 ? {} : { restRoutes: e.restRoutes },
|
|
1148
|
-
publicApiEntries:
|
|
1148
|
+
publicApiEntries: ht,
|
|
1149
1149
|
store: e.store,
|
|
1150
1150
|
resolveSubject: (t) => e.resolveSubject(t, -1).then((e) => e.subject),
|
|
1151
1151
|
...e.idempotency === void 0 ? {} : { idempotency: e.idempotency },
|
|
1152
|
-
log: e.log ??
|
|
1153
|
-
}),
|
|
1154
|
-
let { Readable: n } = await import("node:stream"), r =
|
|
1155
|
-
await J.runPromise(
|
|
1156
|
-
},
|
|
1152
|
+
log: e.log ?? L({ scope: "voltro:serve" })
|
|
1153
|
+
}), k = e.dataTransferSecret ?? process.env.VOLTRO_DATA_TRANSFER_SECRET, vt = async (e, t) => {
|
|
1154
|
+
let { Readable: n } = await import("node:stream"), r = $i(), i = ta("storage", () => n.from(t()));
|
|
1155
|
+
await J.runPromise(ra(r, e, i, { contentType: "application/octet-stream" }));
|
|
1156
|
+
}, yt = k && k.length >= 16 ? [
|
|
1157
1157
|
{
|
|
1158
1158
|
method: "POST",
|
|
1159
|
-
path:
|
|
1160
|
-
handle:
|
|
1161
|
-
secret:
|
|
1159
|
+
path: Na,
|
|
1160
|
+
handle: po({
|
|
1161
|
+
secret: k,
|
|
1162
1162
|
store: e.store,
|
|
1163
1163
|
...e.dataTransferSnapshot ? { snapshot: e.dataTransferSnapshot } : {},
|
|
1164
1164
|
...e.dataTransferDialect ? { dialect: e.dataTransferDialect } : {},
|
|
1165
|
-
assetSink:
|
|
1166
|
-
openArchive: (e) =>
|
|
1165
|
+
assetSink: Ta($i()),
|
|
1166
|
+
openArchive: (e) => Uo($i(), e),
|
|
1167
1167
|
refreshSubscriptions: (e) => {
|
|
1168
1168
|
r.refreshAll(e);
|
|
1169
1169
|
},
|
|
1170
|
-
putArchive:
|
|
1170
|
+
putArchive: vt,
|
|
1171
1171
|
...e.dataTransferDialect ? { dialect: e.dataTransferDialect } : {}
|
|
1172
1172
|
})
|
|
1173
1173
|
},
|
|
1174
1174
|
{
|
|
1175
1175
|
method: "POST",
|
|
1176
|
-
path:
|
|
1177
|
-
handle:
|
|
1178
|
-
secret:
|
|
1176
|
+
path: Pa,
|
|
1177
|
+
handle: ho({
|
|
1178
|
+
secret: k,
|
|
1179
1179
|
store: e.store,
|
|
1180
1180
|
...e.dataTransferSnapshot ? { snapshot: e.dataTransferSnapshot } : {},
|
|
1181
1181
|
...e.dataTransferDialect ? { dialect: e.dataTransferDialect } : {},
|
|
1182
|
-
assetSink:
|
|
1183
|
-
openArchive: (e) =>
|
|
1182
|
+
assetSink: Ta($i()),
|
|
1183
|
+
openArchive: (e) => Uo($i(), e),
|
|
1184
1184
|
refreshSubscriptions: (e) => {
|
|
1185
1185
|
r.refreshAll(e);
|
|
1186
1186
|
},
|
|
1187
|
-
putArchive:
|
|
1187
|
+
putArchive: vt
|
|
1188
1188
|
})
|
|
1189
1189
|
},
|
|
1190
1190
|
{
|
|
1191
1191
|
method: "GET",
|
|
1192
|
-
path:
|
|
1193
|
-
handle:
|
|
1194
|
-
secret:
|
|
1192
|
+
path: La,
|
|
1193
|
+
handle: Ho({
|
|
1194
|
+
secret: k,
|
|
1195
1195
|
store: e.store
|
|
1196
1196
|
})
|
|
1197
1197
|
},
|
|
1198
1198
|
{
|
|
1199
1199
|
method: "GET",
|
|
1200
|
-
path:
|
|
1201
|
-
handle:
|
|
1200
|
+
path: Ia,
|
|
1201
|
+
handle: Io({ secret: k })
|
|
1202
1202
|
},
|
|
1203
1203
|
{
|
|
1204
1204
|
method: "POST",
|
|
1205
|
-
path:
|
|
1206
|
-
handle:
|
|
1207
|
-
secret:
|
|
1205
|
+
path: Fa,
|
|
1206
|
+
handle: No({
|
|
1207
|
+
secret: k,
|
|
1208
1208
|
store: e.store,
|
|
1209
1209
|
snapshot: e.dataTransferSnapshot ?? { tables: [] },
|
|
1210
1210
|
dialect: e.dataTransferDialect ?? "memory",
|
|
1211
1211
|
tenantTables: [...e.tenantScopedTables],
|
|
1212
|
-
loadProfile:
|
|
1213
|
-
assetSource:
|
|
1214
|
-
putArchive:
|
|
1212
|
+
loadProfile: Xn,
|
|
1213
|
+
assetSource: Ea($i(), e.store),
|
|
1214
|
+
putArchive: vt
|
|
1215
1215
|
})
|
|
1216
1216
|
}
|
|
1217
|
-
] : [],
|
|
1217
|
+
] : [], bt = [
|
|
1218
1218
|
...e.httpRoutes ?? [],
|
|
1219
|
-
...
|
|
1220
|
-
...
|
|
1221
|
-
...
|
|
1219
|
+
..._t.httpRoutes,
|
|
1220
|
+
...yt,
|
|
1221
|
+
...b.httpRoutes
|
|
1222
1222
|
];
|
|
1223
|
-
Object.assign(
|
|
1224
|
-
for (let t of
|
|
1225
|
-
let i =
|
|
1223
|
+
Object.assign(O, C.handlers);
|
|
1224
|
+
for (let t of D(e.discovered.streams ?? [])) O[t.descriptor.name] = (n) => Kr((r) => zi(r, (r) => {
|
|
1225
|
+
let i = Fe(r), a = t.executor(n, i);
|
|
1226
1226
|
if (J.isEffect(a)) {
|
|
1227
|
-
let t = a.pipe(J.provide(
|
|
1228
|
-
return (e.baseLayer ? t.pipe(J.provide(e.baseLayer)) : t).pipe(J.provide(
|
|
1227
|
+
let t = a.pipe(J.provide(fi(i.store)));
|
|
1228
|
+
return (e.baseLayer ? t.pipe(J.provide(e.baseLayer)) : t).pipe(J.provide(Ie)).pipe(J.provide(Le)).pipe(J.provide(Re)).pipe(J.provide(Ve));
|
|
1229
1229
|
}
|
|
1230
1230
|
return typeof a == "object" && a && typeof a.then == "function" ? J.promise(() => a) : a;
|
|
1231
1231
|
}), `stream.${t.descriptor.name}`);
|
|
1232
|
-
for (let t of e.discovered.workflows ?? [])
|
|
1232
|
+
for (let t of e.discovered.workflows ?? []) O[t.definition.name] = (e) => Gr(async (e, n) => {
|
|
1233
1233
|
let r = n;
|
|
1234
|
-
return
|
|
1234
|
+
return Ci(_, {
|
|
1235
1235
|
subject: r.subject,
|
|
1236
1236
|
traceId: r.traceId,
|
|
1237
1237
|
source: "workflow-rpc"
|
|
1238
1238
|
}).start(t.definition.name, e);
|
|
1239
1239
|
}, e, `workflow.${t.definition.name}`);
|
|
1240
|
-
|
|
1241
|
-
descriptor:
|
|
1240
|
+
ue && (O[mr.name] = (e) => W(E({
|
|
1241
|
+
descriptor: mr,
|
|
1242
1242
|
executor: (e) => {
|
|
1243
1243
|
let t = e.id;
|
|
1244
1244
|
return {
|
|
@@ -1247,30 +1247,30 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
1247
1247
|
column: "startedAt",
|
|
1248
1248
|
direction: "desc"
|
|
1249
1249
|
}],
|
|
1250
|
-
predicate:
|
|
1250
|
+
predicate: Er(H("id", t), H("executionId", t)),
|
|
1251
1251
|
take: 1,
|
|
1252
1252
|
skip: void 0,
|
|
1253
1253
|
projection: void 0
|
|
1254
1254
|
};
|
|
1255
1255
|
}
|
|
1256
|
-
}, e), r, `subscription.${
|
|
1257
|
-
descriptor:
|
|
1256
|
+
}, e), r, `subscription.${mr.name}`), O[gr.name] = (e) => W(E({
|
|
1257
|
+
descriptor: gr,
|
|
1258
1258
|
executor: (e) => {
|
|
1259
|
-
let t = e, n = [...t.tag === void 0 ? [] : [
|
|
1259
|
+
let t = e, n = [...t.tag === void 0 ? [] : [H("tag", t.tag)], ...t.status === void 0 ? [] : [H("status", t.status)]], r = Number.isFinite(t.limit) && t.limit !== void 0 ? Math.min(Math.max(Math.floor(t.limit), 1), 500) : 100;
|
|
1260
1260
|
return {
|
|
1261
1261
|
table: "_voltro_workflow_runs",
|
|
1262
1262
|
order: [{
|
|
1263
1263
|
column: "startedAt",
|
|
1264
1264
|
direction: "desc"
|
|
1265
1265
|
}],
|
|
1266
|
-
predicate: n.length === 0 ? void 0 : n.length === 1 ? n[0] :
|
|
1266
|
+
predicate: n.length === 0 ? void 0 : n.length === 1 ? n[0] : xr(...n),
|
|
1267
1267
|
take: r,
|
|
1268
1268
|
skip: void 0,
|
|
1269
1269
|
projection: void 0
|
|
1270
1270
|
};
|
|
1271
1271
|
}
|
|
1272
|
-
}, e), r, `subscription.${
|
|
1273
|
-
descriptor:
|
|
1272
|
+
}, e), r, `subscription.${gr.name}`), O[hr.name] = (e) => W(E({
|
|
1273
|
+
descriptor: hr,
|
|
1274
1274
|
executor: (e) => {
|
|
1275
1275
|
let t = e.runId;
|
|
1276
1276
|
return {
|
|
@@ -1279,14 +1279,14 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
1279
1279
|
column: "startedAt",
|
|
1280
1280
|
direction: "asc"
|
|
1281
1281
|
}],
|
|
1282
|
-
predicate:
|
|
1282
|
+
predicate: H("runId", t),
|
|
1283
1283
|
take: 1e3,
|
|
1284
1284
|
skip: void 0,
|
|
1285
1285
|
projection: void 0
|
|
1286
1286
|
};
|
|
1287
1287
|
}
|
|
1288
|
-
}, e), r, `subscription.${
|
|
1289
|
-
descriptor:
|
|
1288
|
+
}, e), r, `subscription.${hr.name}`), O[pr.name] = (e) => W(E({
|
|
1289
|
+
descriptor: pr,
|
|
1290
1290
|
executor: (e) => {
|
|
1291
1291
|
let t = e.runId;
|
|
1292
1292
|
return {
|
|
@@ -1295,14 +1295,14 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
1295
1295
|
column: "occurredAt",
|
|
1296
1296
|
direction: "asc"
|
|
1297
1297
|
}],
|
|
1298
|
-
predicate:
|
|
1298
|
+
predicate: H("runId", t),
|
|
1299
1299
|
take: 1e3,
|
|
1300
1300
|
skip: void 0,
|
|
1301
1301
|
projection: void 0
|
|
1302
1302
|
};
|
|
1303
1303
|
}
|
|
1304
|
-
}, e), r, `subscription.${
|
|
1305
|
-
descriptor:
|
|
1304
|
+
}, e), r, `subscription.${pr.name}`), O[ur.name] = (e) => W(E({
|
|
1305
|
+
descriptor: ur,
|
|
1306
1306
|
executor: (e) => {
|
|
1307
1307
|
let t = e;
|
|
1308
1308
|
return {
|
|
@@ -1311,14 +1311,14 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
1311
1311
|
column: "occurredAt",
|
|
1312
1312
|
direction: "desc"
|
|
1313
1313
|
}],
|
|
1314
|
-
predicate: t.name === void 0 ? void 0 :
|
|
1314
|
+
predicate: t.name === void 0 ? void 0 : H("name", t.name),
|
|
1315
1315
|
take: Math.max(1, Math.min(500, t.limit ?? 100)),
|
|
1316
1316
|
skip: void 0,
|
|
1317
1317
|
projection: void 0
|
|
1318
1318
|
};
|
|
1319
1319
|
}
|
|
1320
|
-
}, e), r, `subscription.${
|
|
1321
|
-
descriptor:
|
|
1320
|
+
}, e), r, `subscription.${ur.name}`), O[dr.name] = (e) => W(E({
|
|
1321
|
+
descriptor: dr,
|
|
1322
1322
|
executor: (e) => {
|
|
1323
1323
|
let t = e.eventId;
|
|
1324
1324
|
return {
|
|
@@ -1327,86 +1327,86 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
1327
1327
|
column: "createdAt",
|
|
1328
1328
|
direction: "asc"
|
|
1329
1329
|
}],
|
|
1330
|
-
predicate:
|
|
1330
|
+
predicate: H("eventId", t),
|
|
1331
1331
|
take: 500,
|
|
1332
1332
|
skip: void 0,
|
|
1333
1333
|
projection: void 0
|
|
1334
1334
|
};
|
|
1335
1335
|
}
|
|
1336
|
-
}, e), r, `subscription.${
|
|
1336
|
+
}, e), r, `subscription.${dr.name}`), O[lr.name] = (t) => Gr(async (t, n) => {
|
|
1337
1337
|
let r = t;
|
|
1338
|
-
return await
|
|
1339
|
-
}, t, `action.${
|
|
1338
|
+
return await N(e.store, n.subject, { executionId: r.executionId }), await _.cancel(r.workflowName, r.executionId), await Nt(r.workflowName, r.executionId, "workflow.cancel"), { ok: !0 };
|
|
1339
|
+
}, t, `action.${lr.name}`), O[fr.name] = (t) => Gr(async (t, n) => {
|
|
1340
1340
|
let r = t;
|
|
1341
|
-
return await
|
|
1342
|
-
}, t, `action.${
|
|
1341
|
+
return await N(e.store, n.subject, { executionId: r.executionId }), await _.resume(r.workflowName, r.executionId), { ok: !0 };
|
|
1342
|
+
}, t, `action.${fr.name}`), O[_r.name] = (t) => Gr(async (t, n) => {
|
|
1343
1343
|
let r = t;
|
|
1344
|
-
return await
|
|
1345
|
-
}, t, `action.${
|
|
1344
|
+
return await N(e.store, n.subject, { id: r.id }), _.signal({ id: r.id }, r.signalName, r.payload);
|
|
1345
|
+
}, t, `action.${_r.name}`), O[vr.name] = (t) => Gr(async (t, n) => {
|
|
1346
1346
|
let r = t;
|
|
1347
|
-
return await
|
|
1348
|
-
}, t, `action.${
|
|
1349
|
-
let
|
|
1350
|
-
...
|
|
1351
|
-
...
|
|
1352
|
-
...
|
|
1353
|
-
...
|
|
1354
|
-
...
|
|
1355
|
-
...
|
|
1356
|
-
...
|
|
1357
|
-
...
|
|
1358
|
-
...
|
|
1359
|
-
...
|
|
1360
|
-
...
|
|
1361
|
-
...
|
|
1362
|
-
...(e.discovered.workflows ?? []).map((e) =>
|
|
1363
|
-
...
|
|
1364
|
-
B(
|
|
1365
|
-
B(
|
|
1366
|
-
B(
|
|
1367
|
-
B(
|
|
1368
|
-
B(
|
|
1369
|
-
B(
|
|
1370
|
-
z(
|
|
1371
|
-
z(
|
|
1372
|
-
z(
|
|
1373
|
-
z(
|
|
1347
|
+
return await N(e.store, n.subject, { id: r.id }), _.update({ id: r.id }, r.updateName, r.payload, r.timeoutMs === void 0 ? void 0 : { timeoutMs: r.timeoutMs });
|
|
1348
|
+
}, t, `action.${vr.name}`));
|
|
1349
|
+
let xt = [
|
|
1350
|
+
...D(e.discovered.queries).map((e) => B(e.descriptor)),
|
|
1351
|
+
...D(e.discovered.mutations).map((e) => or(e.descriptor)),
|
|
1352
|
+
...D(e.discovered.actions).map((e) => z(e.descriptor)),
|
|
1353
|
+
...rt.queries.map((e) => B(e.descriptor)),
|
|
1354
|
+
...rt.mutations.map((e) => or(e.descriptor)),
|
|
1355
|
+
...it.queries.map((e) => B(e.descriptor)),
|
|
1356
|
+
...it.mutations.map((e) => or(e.descriptor)),
|
|
1357
|
+
...b.queries.map((e) => B(e.descriptor)),
|
|
1358
|
+
...b.mutations.map((e) => or(e.descriptor)),
|
|
1359
|
+
...b.actions.map((e) => z(e.descriptor)),
|
|
1360
|
+
...D(e.discovered.streams ?? []).map((e) => sr(e.descriptor)),
|
|
1361
|
+
...C.rpcs,
|
|
1362
|
+
...(e.discovered.workflows ?? []).map((e) => Bi(e.definition)),
|
|
1363
|
+
...ue ? [
|
|
1364
|
+
B(mr),
|
|
1365
|
+
B(gr),
|
|
1366
|
+
B(hr),
|
|
1367
|
+
B(pr),
|
|
1368
|
+
B(ur),
|
|
1369
|
+
B(dr),
|
|
1370
|
+
z(lr),
|
|
1371
|
+
z(fr),
|
|
1372
|
+
z(_r),
|
|
1373
|
+
z(vr)
|
|
1374
1374
|
] : []
|
|
1375
|
-
],
|
|
1376
|
-
register: (t, n, r) =>
|
|
1377
|
-
tenantId: r ??
|
|
1375
|
+
], wt = Qi.make(...xt).middleware(rr).middleware(R), Tt = li({ resolveSubject: ({ headers: t, clientId: n }) => e.resolveSubject(t, n) }), Et = e.dormancyTenantId ?? Fr, Dt = e.dormancy === "sleep" ? {
|
|
1376
|
+
register: (t, n, r) => Oi(e.store, {
|
|
1377
|
+
tenantId: r ?? Et,
|
|
1378
1378
|
kind: "workflow",
|
|
1379
1379
|
refId: t,
|
|
1380
1380
|
wakeAt: n
|
|
1381
1381
|
}),
|
|
1382
|
-
cancel: (t, n) =>
|
|
1383
|
-
tenantId: n ??
|
|
1382
|
+
cancel: (t, n) => Jr(e.store, {
|
|
1383
|
+
tenantId: n ?? Et,
|
|
1384
1384
|
kind: "workflow",
|
|
1385
1385
|
refId: t
|
|
1386
1386
|
}).then(() => {})
|
|
1387
|
-
} : void 0, A =
|
|
1387
|
+
} : void 0, A = de ? await import("@voltro/workflow") : void 0, j = A?.makeWorkflowRunRecorder({
|
|
1388
1388
|
store: e.store,
|
|
1389
1389
|
...e.workflowRecording === void 0 ? {} : { recording: e.workflowRecording },
|
|
1390
|
-
...
|
|
1391
|
-
}),
|
|
1390
|
+
...Dt === void 0 ? {} : { wakeups: Dt }
|
|
1391
|
+
}), jt = async (t, n) => {
|
|
1392
1392
|
await A.closeWorkflowChildrenForParent({
|
|
1393
1393
|
store: e.store,
|
|
1394
1394
|
parentExecutionId: t,
|
|
1395
1395
|
parentStatus: n,
|
|
1396
1396
|
recorder: j,
|
|
1397
|
-
log: { warn: (e, t) =>
|
|
1397
|
+
log: { warn: (e, t) => re.warn(e, t ?? {}) },
|
|
1398
1398
|
interruptChild: async (t, n) => {
|
|
1399
1399
|
let r = (e.discovered.workflows ?? []).find((e) => e.definition.name === t);
|
|
1400
1400
|
if (!r) throw Error(`Unknown child workflow: ${t}`);
|
|
1401
|
-
if (!
|
|
1402
|
-
await
|
|
1401
|
+
if (!p) throw Error("Workflow runtime is not ready");
|
|
1402
|
+
await p.runPromise(r.definition.interrupt(n));
|
|
1403
1403
|
}
|
|
1404
1404
|
});
|
|
1405
|
-
},
|
|
1405
|
+
}, Nt = async (t, n, r) => {
|
|
1406
1406
|
let i = (await e.store.query({
|
|
1407
1407
|
table: "_voltro_workflow_runs",
|
|
1408
1408
|
order: [],
|
|
1409
|
-
predicate:
|
|
1409
|
+
predicate: H("executionId", n),
|
|
1410
1410
|
projection: void 0,
|
|
1411
1411
|
skip: void 0,
|
|
1412
1412
|
take: 1
|
|
@@ -1426,15 +1426,15 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
1426
1426
|
executionId: n,
|
|
1427
1427
|
...o == null ? {} : { tenantId: o }
|
|
1428
1428
|
}
|
|
1429
|
-
}), a && await
|
|
1430
|
-
},
|
|
1431
|
-
...
|
|
1432
|
-
buildContext: (t, n) => e.buildContextForWorkflow?.(t, n) ??
|
|
1429
|
+
}), a && await jt(n, "cancelled");
|
|
1430
|
+
}, Ft = [
|
|
1431
|
+
...wi(e.discovered.workflows ?? [], {
|
|
1432
|
+
buildContext: (t, n) => e.buildContextForWorkflow?.(t, n) ?? Fe({
|
|
1433
1433
|
subject: t.subject,
|
|
1434
1434
|
traceId: t.traceId
|
|
1435
1435
|
}, e.store, void 0, `workflow:${n.workflowName}`, { parentExecutionId: n.executionId }),
|
|
1436
|
-
resolveStartContext:
|
|
1437
|
-
...
|
|
1436
|
+
resolveStartContext: se,
|
|
1437
|
+
...le === void 0 ? {} : { resolveAuthority: le }
|
|
1438
1438
|
}, (t, n, r) => {
|
|
1439
1439
|
let i = A.getWorkflowVersionMetadata(t.definition);
|
|
1440
1440
|
return A.wrapWorkflowExecuteWithRunRecording({
|
|
@@ -1448,37 +1448,37 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
1448
1448
|
workflowPatches: i.patches,
|
|
1449
1449
|
parentExecutionId: r?.parentExecutionId ?? null,
|
|
1450
1450
|
parentClosePolicy: r?.parentClosePolicy ?? null,
|
|
1451
|
-
onParentClose: ({ executionId: e, status: t }) =>
|
|
1452
|
-
|
|
1451
|
+
onParentClose: ({ executionId: e, status: t }) => jt(e, t),
|
|
1452
|
+
...$e(t.definition),
|
|
1453
1453
|
onTerminal: async ({ executionId: e }) => {
|
|
1454
1454
|
await d?.gate.release(e);
|
|
1455
1455
|
},
|
|
1456
1456
|
recorder: j,
|
|
1457
|
-
pluginWorkflowStepLayer:
|
|
1458
|
-
recordRun:
|
|
1457
|
+
pluginWorkflowStepLayer: Xe,
|
|
1458
|
+
recordRun: Ei
|
|
1459
1459
|
}, n);
|
|
1460
1460
|
}),
|
|
1461
1461
|
...e.discovered.workflowWorkers ?? [],
|
|
1462
|
-
...
|
|
1463
|
-
],
|
|
1464
|
-
if (((e.discovered.workflows?.length ?? 0) > 0 || (e.discovered.workflowWorkers?.length ?? 0) > 0 || e.scheduleCoordination === "cluster" ||
|
|
1465
|
-
let t =
|
|
1466
|
-
|
|
1467
|
-
let n = await import("@voltro/workflow/cluster"), r = (e) =>
|
|
1468
|
-
ne = await
|
|
1469
|
-
provider:
|
|
1470
|
-
crossReplica:
|
|
1471
|
-
namespace:
|
|
1462
|
+
..._e === void 0 ? [] : [_e]
|
|
1463
|
+
], It = [...(e.discovered.workflows ?? []).map((e) => e.definition.name).filter(Boolean), ..._e === void 0 ? [] : ["voltro.deliverWebhook"]], Lt = Ft.length > 0 ? Y.mergeAll(...Ft) : Y.empty;
|
|
1464
|
+
if (((e.discovered.workflows?.length ?? 0) > 0 || (e.discovered.workflowWorkers?.length ?? 0) > 0 || e.scheduleCoordination === "cluster" || _e !== void 0) && e.workflowEngineLayer !== void 0) {
|
|
1465
|
+
let t = Lt.pipe(Y.provideMerge(e.workflowEngineLayer));
|
|
1466
|
+
p = Wi.make((e.baseLayer === void 0 ? t : t.pipe(Y.provideMerge(e.baseLayer))).pipe(Y.provideMerge(nr({})))), await p.runPromise(J.void), (e.log ?? L({ scope: "voltro:serve" })).child("workflow").info(`workflow runtime ready — ${It.length} entity type(s) registered`, { entities: It });
|
|
1467
|
+
let n = await import("@voltro/workflow/cluster"), r = (e) => p.runPromise(n.redriveFailedRun(e)), i = (e) => p.runPromise(n.resumeRunFromStep(e));
|
|
1468
|
+
ne = await Ce({
|
|
1469
|
+
provider: la(e.plugins ?? [])?.broadcast?.provider,
|
|
1470
|
+
crossReplica: la(e.plugins ?? [])?.broadcast?.crossReplica ?? !1,
|
|
1471
|
+
namespace: Te,
|
|
1472
1472
|
replicaId: crypto.randomUUID(),
|
|
1473
|
-
pollStorage: () =>
|
|
1473
|
+
pollStorage: () => p.runPromise(n.pollWorkflowStorage),
|
|
1474
1474
|
onChange: (t) => e.store.onChange((e) => t({
|
|
1475
1475
|
table: e.table,
|
|
1476
1476
|
op: e.op,
|
|
1477
1477
|
...e.origin === void 0 ? {} : { origin: e.origin }
|
|
1478
1478
|
})),
|
|
1479
|
-
log: (e.log ??
|
|
1479
|
+
log: (e.log ?? L({ scope: "voltro:serve" })).child("workflow")
|
|
1480
1480
|
}), ee = async (t) => {
|
|
1481
|
-
let n = await
|
|
1481
|
+
let n = await Ke({
|
|
1482
1482
|
store: e.store,
|
|
1483
1483
|
workflows: e.discovered.workflows ?? [],
|
|
1484
1484
|
runRedrive: r
|
|
@@ -1496,7 +1496,7 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
1496
1496
|
reason: n.outcome.reason
|
|
1497
1497
|
};
|
|
1498
1498
|
}, te = async (t) => {
|
|
1499
|
-
let n = await
|
|
1499
|
+
let n = await Ye({
|
|
1500
1500
|
store: e.store,
|
|
1501
1501
|
workflows: e.discovered.workflows ?? [],
|
|
1502
1502
|
runResume: i
|
|
@@ -1516,10 +1516,10 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
1516
1516
|
reason: n.outcome.reason
|
|
1517
1517
|
};
|
|
1518
1518
|
};
|
|
1519
|
-
let a = (e.scheduleCoordination ?? "single") === "advisoryLock" ?
|
|
1519
|
+
let a = (e.scheduleCoordination ?? "single") === "advisoryLock" ? ii(e.store, e.scheduleReplicaId ?? `pid-${process.pid}`) : Pi, l = di({
|
|
1520
1520
|
coordinator: a,
|
|
1521
1521
|
replicaId: e.scheduleReplicaId ?? `pid-${process.pid}`
|
|
1522
|
-
}), u =
|
|
1522
|
+
}), u = L({ scope: "voltro:flow-control" }), f = {
|
|
1523
1523
|
info: (e, t) => {
|
|
1524
1524
|
u.info(e, t);
|
|
1525
1525
|
},
|
|
@@ -1529,19 +1529,19 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
1529
1529
|
error: (e, t) => {
|
|
1530
1530
|
u.error(e, t ?? {});
|
|
1531
1531
|
}
|
|
1532
|
-
},
|
|
1533
|
-
if (
|
|
1534
|
-
if (o !== void 0 && j !== void 0) return
|
|
1532
|
+
}, m, re = () => {
|
|
1533
|
+
if (m !== void 0) return m;
|
|
1534
|
+
if (o !== void 0 && j !== void 0) return m = v({
|
|
1535
1535
|
store: e.store,
|
|
1536
1536
|
log: P,
|
|
1537
1537
|
workflows: e.discovered.workflows ?? [],
|
|
1538
1538
|
workflowsProxy: o,
|
|
1539
|
-
workflowRuntime:
|
|
1539
|
+
workflowRuntime: p,
|
|
1540
1540
|
workflowRunRecorder: j,
|
|
1541
|
-
closeChildrenForParent:
|
|
1542
|
-
}),
|
|
1541
|
+
closeChildrenForParent: jt
|
|
1542
|
+
}), m;
|
|
1543
1543
|
};
|
|
1544
|
-
s =
|
|
1544
|
+
s = re, d = h({
|
|
1545
1545
|
store: e.store,
|
|
1546
1546
|
onChange: (t) => e.store.onChange((e) => t({
|
|
1547
1547
|
table: e.table,
|
|
@@ -1555,23 +1555,23 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
1555
1555
|
},
|
|
1556
1556
|
workflows: e.discovered.workflows ?? [],
|
|
1557
1557
|
facade: () => o,
|
|
1558
|
-
cancelRunWithReason:
|
|
1558
|
+
cancelRunWithReason: re,
|
|
1559
1559
|
recordRunEvent: () => j?.recordEvent,
|
|
1560
1560
|
...e.workflowStaleness === void 0 ? {} : { staleness: e.workflowStaleness },
|
|
1561
1561
|
...e.workflowSuspendSignalHintMs === void 0 ? {} : { suspendSignalHintMs: e.workflowSuspendSignalHintMs },
|
|
1562
1562
|
scheduleCoordinated: l,
|
|
1563
1563
|
onAbandoned: async (t) => {
|
|
1564
|
-
await
|
|
1564
|
+
await ft({
|
|
1565
1565
|
workflows: e.discovered.workflows ?? [],
|
|
1566
1566
|
facade: () => o,
|
|
1567
|
-
log:
|
|
1567
|
+
log: f,
|
|
1568
1568
|
...t
|
|
1569
1569
|
});
|
|
1570
1570
|
},
|
|
1571
|
-
log:
|
|
1571
|
+
log: f
|
|
1572
1572
|
});
|
|
1573
|
-
let
|
|
1574
|
-
|
|
1573
|
+
let g = d;
|
|
1574
|
+
g !== void 0 && G(() => g.stop()), c = $t({
|
|
1575
1575
|
store: e.store,
|
|
1576
1576
|
onChange: (t) => e.store.onChange((e) => t({
|
|
1577
1577
|
table: e.table,
|
|
@@ -1582,29 +1582,29 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
1582
1582
|
tickIntervalMs: e.scheduling.inferenceTickMs
|
|
1583
1583
|
},
|
|
1584
1584
|
enabled: (e.discovered.workflows?.length ?? 0) > 0,
|
|
1585
|
-
resumeSignal: () =>
|
|
1586
|
-
await
|
|
1585
|
+
resumeSignal: () => p === void 0 || A === void 0 ? void 0 : async ({ executionId: t, workflowName: n, signalName: r, payload: i }) => {
|
|
1586
|
+
await p.runPromise(A.completeSuspendingSignal({
|
|
1587
1587
|
store: e.store,
|
|
1588
|
-
target:
|
|
1588
|
+
target: Kt(t, n),
|
|
1589
1589
|
signalName: r,
|
|
1590
1590
|
payload: i
|
|
1591
1591
|
}));
|
|
1592
1592
|
},
|
|
1593
|
-
runEffect: (e) =>
|
|
1593
|
+
runEffect: (e) => p.runPromise(e),
|
|
1594
1594
|
scheduleCoordinated: l,
|
|
1595
|
-
log:
|
|
1595
|
+
log: f
|
|
1596
1596
|
});
|
|
1597
|
-
let
|
|
1598
|
-
|
|
1597
|
+
let ie = c;
|
|
1598
|
+
ie !== void 0 && G(() => ie.stop()), o = (e.discovered.workflows?.length ?? 0) > 0 ? Si({
|
|
1599
1599
|
workflows: e.discovered.workflows ?? [],
|
|
1600
|
-
runEffect: (e) =>
|
|
1600
|
+
runEffect: (e) => p.runPromise(e),
|
|
1601
1601
|
onEnqueue: () => ne?.publishWake(),
|
|
1602
|
-
...
|
|
1603
|
-
admitStart:
|
|
1604
|
-
startPayloadSchema:
|
|
1605
|
-
parkDelayedStart:
|
|
1602
|
+
...g === void 0 ? {} : {
|
|
1603
|
+
admitStart: g.gate.admitStart,
|
|
1604
|
+
startPayloadSchema: g.gate.startPayloadSchema,
|
|
1605
|
+
parkDelayedStart: g.gate.parkDelayed
|
|
1606
1606
|
},
|
|
1607
|
-
rememberStartContext:
|
|
1607
|
+
rememberStartContext: oe,
|
|
1608
1608
|
signal: async (t, n, r) => {
|
|
1609
1609
|
let i = await A.sendWorkflowSignal({
|
|
1610
1610
|
store: e.store,
|
|
@@ -1613,7 +1613,7 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
1613
1613
|
signalName: n,
|
|
1614
1614
|
payload: r
|
|
1615
1615
|
});
|
|
1616
|
-
return await
|
|
1616
|
+
return await p.runPromise(A.completeSuspendingSignal({
|
|
1617
1617
|
store: e.store,
|
|
1618
1618
|
target: t,
|
|
1619
1619
|
signalName: n,
|
|
@@ -1628,35 +1628,36 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
1628
1628
|
payload: r,
|
|
1629
1629
|
...i === void 0 ? {} : { options: i }
|
|
1630
1630
|
}),
|
|
1631
|
-
listRuns: (t) =>
|
|
1632
|
-
retry: (t, n) =>
|
|
1631
|
+
listRuns: (t) => qe(e.store, t),
|
|
1632
|
+
retry: (t, n) => ke({
|
|
1633
1633
|
store: e.store,
|
|
1634
1634
|
workflows: e.discovered.workflows ?? [],
|
|
1635
|
-
runPromise: (e) =>
|
|
1635
|
+
runPromise: (e) => p.runPromise(e)
|
|
1636
1636
|
}, t, n),
|
|
1637
|
-
redrive: (t) =>
|
|
1637
|
+
redrive: (t) => Ke({
|
|
1638
1638
|
store: e.store,
|
|
1639
1639
|
workflows: e.discovered.workflows ?? [],
|
|
1640
1640
|
runRedrive: r
|
|
1641
1641
|
}, t).then((e) => e.outcome)
|
|
1642
1642
|
}) : void 0;
|
|
1643
1643
|
}
|
|
1644
|
-
let
|
|
1644
|
+
let Rt = Y.mergeAll(wt.toLayer(O), Tt), Bt = mt(O, e.discovered.queries.map((e) => e.descriptor.name), ue), Ut = Y.mergeAll(wt.toLayer(Bt), Tt), M = e.observability, Wt = await qr({
|
|
1645
|
+
...e.traceSink === void 0 ? {} : { traceSink: e.traceSink },
|
|
1645
1646
|
...e.appName === void 0 ? {} : { serviceName: e.appName },
|
|
1646
|
-
...
|
|
1647
|
-
...
|
|
1648
|
-
...
|
|
1649
|
-
...
|
|
1650
|
-
}),
|
|
1651
|
-
group:
|
|
1652
|
-
handlersLayer:
|
|
1653
|
-
httpHandlersLayer:
|
|
1647
|
+
...M && M.spanProcessors.length > 0 ? { extraSpanProcessors: M.spanProcessors } : {},
|
|
1648
|
+
...M && M.metricReaders.length > 0 ? { extraMetricReaders: M.metricReaders } : {},
|
|
1649
|
+
...M && Object.keys(M.resourceAttributes).length > 0 ? { resourceAttributes: M.resourceAttributes } : {},
|
|
1650
|
+
...M && M.sampler !== void 0 ? { sampler: M.sampler } : {}
|
|
1651
|
+
}), qt = !1, Jt = e.store.ping ? () => e.store.ping().then(() => !0).catch(() => !1) : void 0, { server: Yt, shutdown: Xt } = Fi({
|
|
1652
|
+
group: wt,
|
|
1653
|
+
handlersLayer: Rt,
|
|
1654
|
+
httpHandlersLayer: Ut,
|
|
1654
1655
|
port: e.port ?? 4e3,
|
|
1655
1656
|
...e.host === void 0 ? {} : { host: e.host },
|
|
1656
1657
|
path: e.path ?? "/ws",
|
|
1657
|
-
tracerLayer:
|
|
1658
|
-
security:
|
|
1659
|
-
...
|
|
1658
|
+
tracerLayer: Wt.layer,
|
|
1659
|
+
security: pe(e),
|
|
1660
|
+
...Bn(e),
|
|
1660
1661
|
...e.discovered.wsGateways !== void 0 && e.discovered.wsGateways.length > 0 ? { webSocketGateways: e.discovered.wsGateways } : {},
|
|
1661
1662
|
resolveGatewaySubject: async (t) => {
|
|
1662
1663
|
let n = await e.resolveSubject(t, -1);
|
|
@@ -1665,54 +1666,71 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
1665
1666
|
...n.credentialExpiresAt === void 0 ? {} : { credentialExpiresAt: n.credentialExpiresAt * 1e3 }
|
|
1666
1667
|
};
|
|
1667
1668
|
},
|
|
1668
|
-
...
|
|
1669
|
-
healthCheck: {
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1669
|
+
...Je,
|
|
1670
|
+
healthCheck: (() => {
|
|
1671
|
+
let t = e.health;
|
|
1672
|
+
if (t?.readiness !== void 0) {
|
|
1673
|
+
let e = t.readiness;
|
|
1674
|
+
return {
|
|
1675
|
+
isReady: () => qt,
|
|
1676
|
+
ping: async () => {
|
|
1677
|
+
try {
|
|
1678
|
+
return await e();
|
|
1679
|
+
} catch {
|
|
1680
|
+
return !1;
|
|
1681
|
+
}
|
|
1682
|
+
}
|
|
1683
|
+
};
|
|
1684
|
+
}
|
|
1685
|
+
return {
|
|
1686
|
+
isReady: () => qt,
|
|
1687
|
+
...Jt ? { ping: Jt } : {}
|
|
1688
|
+
};
|
|
1689
|
+
})(),
|
|
1690
|
+
...bt.length > 0 ? { httpRoutes: bt } : {},
|
|
1674
1691
|
...e.getStore === void 0 ? {} : { getStore: e.getStore },
|
|
1675
|
-
...
|
|
1692
|
+
...ve.size > 0 ? { webhookRoutes: ve } : {},
|
|
1676
1693
|
...e.inspectRoute === void 0 ? {} : { inspectRoute: e.inspectRoute },
|
|
1677
1694
|
...e.inspectStream === void 0 ? {} : { inspectStream: e.inspectStream }
|
|
1678
|
-
}),
|
|
1679
|
-
if (await
|
|
1680
|
-
let t = (e.scheduleCoordination ?? "single") === "advisoryLock" ?
|
|
1681
|
-
|
|
1695
|
+
}), Zt = Ma(Yt);
|
|
1696
|
+
if (await Wr(Yt), (e.discovered.schedules?.length ?? 0) > 0) {
|
|
1697
|
+
let t = (e.scheduleCoordination ?? "single") === "advisoryLock" ? ii(e.store, e.scheduleReplicaId ?? `pid-${process.pid}`) : Pi;
|
|
1698
|
+
m = await q(e.discovered.schedules ?? [], {
|
|
1682
1699
|
store: e.store,
|
|
1683
1700
|
coordinator: t,
|
|
1684
1701
|
defaultTrigger: e.scheduleDefaultTrigger ?? "self",
|
|
1685
1702
|
replicaId: e.scheduleReplicaId ?? `pid-${process.pid}`,
|
|
1686
1703
|
armSelf: e.scheduleArmSelf ?? !0,
|
|
1687
1704
|
dormancy: e.dormancy ?? "always-on",
|
|
1705
|
+
...e.scheduling === void 0 ? {} : { runHeartbeatMs: e.scheduling.scheduleHeartbeatMs },
|
|
1688
1706
|
...e.dormancyTenantId === void 0 ? {} : { dormancyTenantId: e.dormancyTenantId },
|
|
1689
|
-
buildContext: ({ traceId: t, scheduleName: n, subject: r }) =>
|
|
1707
|
+
buildContext: ({ traceId: t, scheduleName: n, subject: r }) => Fe({
|
|
1690
1708
|
subject: r,
|
|
1691
1709
|
traceId: t
|
|
1692
1710
|
}, e.store, void 0, `schedule:${n}`),
|
|
1693
1711
|
log: {
|
|
1694
1712
|
info: (e, t) => {
|
|
1695
|
-
|
|
1713
|
+
g.info(e, t);
|
|
1696
1714
|
},
|
|
1697
1715
|
warn: (e, t) => {
|
|
1698
|
-
|
|
1716
|
+
g.warn(e, t);
|
|
1699
1717
|
},
|
|
1700
1718
|
error: (e, t) => {
|
|
1701
|
-
|
|
1719
|
+
g.error(e, t ?? {});
|
|
1702
1720
|
},
|
|
1703
1721
|
debug: () => {}
|
|
1704
1722
|
},
|
|
1705
1723
|
...e.scheduleFireInterceptor === void 0 ? {} : { interceptFire: e.scheduleFireInterceptor },
|
|
1706
1724
|
...e.onScheduleRunEvent === void 0 ? {} : { onRunEvent: e.onScheduleRunEvent }
|
|
1707
|
-
}), e.onSchedulerReady?.(
|
|
1725
|
+
}), e.onSchedulerReady?.(m);
|
|
1708
1726
|
}
|
|
1709
|
-
let P = e.log ??
|
|
1710
|
-
if ((e.discovered.subscribers?.length ?? 0) > 0 && (
|
|
1711
|
-
eventBus:
|
|
1712
|
-
...
|
|
1727
|
+
let P = e.log ?? L({ scope: "voltro:serve" }), en, tn, rn = e.claimChange;
|
|
1728
|
+
if ((e.discovered.subscribers?.length ?? 0) > 0 && (en = kt(e.discovered.subscribers ?? [], e.store, P.child("subscribe"), e.schemaRegistry, {
|
|
1729
|
+
eventBus: C.bus,
|
|
1730
|
+
...rn === void 0 ? {} : { claimOnce: rn }
|
|
1713
1731
|
})), (e.discovered.reactions?.length ?? 0) > 0) {
|
|
1714
1732
|
let t = P.child("reaction");
|
|
1715
|
-
|
|
1733
|
+
tn = Ne(e.discovered.reactions ?? [], e.store, {
|
|
1716
1734
|
runAct: async (n, r) => {
|
|
1717
1735
|
if (n.kind === "workflow") {
|
|
1718
1736
|
if (_ === void 0) {
|
|
@@ -1720,16 +1738,16 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
1720
1738
|
return;
|
|
1721
1739
|
}
|
|
1722
1740
|
let e = n.payload === void 0 ? r.new ?? r.old ?? {} : n.payload(r);
|
|
1723
|
-
await
|
|
1741
|
+
await Ci(_, {
|
|
1724
1742
|
traceId: `reaction:${n.workflow}`,
|
|
1725
1743
|
source: `reaction:${n.workflow}`
|
|
1726
1744
|
}).start(n.workflow, e);
|
|
1727
1745
|
return;
|
|
1728
1746
|
}
|
|
1729
|
-
await
|
|
1747
|
+
await nn(n.agent, r, {
|
|
1730
1748
|
findAgentSend: (t) => e.discovered.actions.find((e) => e.descriptor.name === `${t}.send`),
|
|
1731
|
-
runAction: (e, t, n) => Promise.resolve(
|
|
1732
|
-
makeSubject: (e) =>
|
|
1749
|
+
runAction: (e, t, n) => Promise.resolve(ot(e, t, n)),
|
|
1750
|
+
makeSubject: (e) => ir(e),
|
|
1733
1751
|
now: () => Date.now(),
|
|
1734
1752
|
log: t
|
|
1735
1753
|
});
|
|
@@ -1745,425 +1763,463 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
1745
1763
|
return t.warn("reaction budget check failed — refusing the act", { tenantId: n }, e), !1;
|
|
1746
1764
|
}
|
|
1747
1765
|
},
|
|
1748
|
-
...
|
|
1749
|
-
...
|
|
1766
|
+
...rn === void 0 ? {} : { claimRateSlot: (e) => rn(Ct, e) },
|
|
1767
|
+
...rn === void 0 ? {} : { claimDedupe: (e) => rn(T, e) }
|
|
1750
1768
|
}, t);
|
|
1751
1769
|
}
|
|
1752
1770
|
let an;
|
|
1753
|
-
(e.discovered.aggregates?.length ?? 0) > 0 && (an = await
|
|
1771
|
+
(e.discovered.aggregates?.length ?? 0) > 0 && (an = await x({
|
|
1754
1772
|
discovered: e.discovered.aggregates ?? [],
|
|
1755
1773
|
store: e.store,
|
|
1756
1774
|
log: P.child("aggregate"),
|
|
1757
1775
|
...e.analytics === void 0 ? {} : { analytics: e.analytics },
|
|
1758
1776
|
...e.aggregateStorage === void 0 ? {} : { storage: e.aggregateStorage },
|
|
1759
1777
|
...e.aggregateCoordinator === void 0 ? {} : { coordinator: e.aggregateCoordinator }
|
|
1760
|
-
}),
|
|
1778
|
+
}), Ie = Y.succeed(Pr, an.registry));
|
|
1761
1779
|
let on;
|
|
1762
|
-
(e.discovered.expectations?.length ?? 0) > 0 && (on =
|
|
1780
|
+
(e.discovered.expectations?.length ?? 0) > 0 && (on = Vr({
|
|
1763
1781
|
discovered: e.discovered.expectations ?? [],
|
|
1764
1782
|
store: e.store,
|
|
1765
1783
|
log: P.child("expectation")
|
|
1766
|
-
}),
|
|
1784
|
+
}), Le = Y.succeed(Lr, on.registry)), (e.discovered.budgets?.length ?? 0) > 0 && (n = Ur({
|
|
1767
1785
|
discovered: e.discovered.budgets ?? [],
|
|
1768
1786
|
log: P.child("finops")
|
|
1769
|
-
}),
|
|
1787
|
+
}), Re = Y.succeed(U, n.registry));
|
|
1770
1788
|
let sn;
|
|
1771
|
-
return (e.discovered.experiments?.length ?? 0) > 0 && (sn =
|
|
1789
|
+
return (e.discovered.experiments?.length ?? 0) > 0 && (sn = Hr({
|
|
1772
1790
|
discovered: e.discovered.experiments ?? [],
|
|
1773
1791
|
store: e.store,
|
|
1774
1792
|
log: P.child("experiment")
|
|
1775
|
-
}),
|
|
1793
|
+
}), Ve = Y.succeed(Rr, sn.registry)), qt = !0, e.bootTiming?.mark("ready"), {
|
|
1776
1794
|
dispatcher: r,
|
|
1777
|
-
server:
|
|
1778
|
-
scheduler:
|
|
1779
|
-
eventsSnapshot:
|
|
1795
|
+
server: Yt,
|
|
1796
|
+
scheduler: m,
|
|
1797
|
+
eventsSnapshot: ce(C.bus, C.declared),
|
|
1780
1798
|
membersSnapshot: () => ({
|
|
1781
|
-
members:
|
|
1799
|
+
members: Me.membership.list(),
|
|
1782
1800
|
capturedAt: Date.now()
|
|
1783
1801
|
}),
|
|
1784
|
-
agentTools: () =>
|
|
1785
|
-
rpcMetrics: () =>
|
|
1786
|
-
webhooksService: () =>
|
|
1802
|
+
agentTools: () => gt,
|
|
1803
|
+
rpcMetrics: () => We,
|
|
1804
|
+
webhooksService: () => he,
|
|
1787
1805
|
runCanceller: () => s(),
|
|
1788
1806
|
flowControlHealth: () => d?.cancelHealth(),
|
|
1789
1807
|
inferenceHealth: () => c?.health(),
|
|
1790
|
-
workflowWriteActions: () => _ === void 0 || j === void 0 ? void 0 :
|
|
1808
|
+
workflowWriteActions: () => _ === void 0 || j === void 0 ? void 0 : ze({
|
|
1791
1809
|
store: e.store,
|
|
1792
1810
|
log: P,
|
|
1793
1811
|
workflows: e.discovered.workflows ?? [],
|
|
1794
1812
|
workflowsProxy: o,
|
|
1795
|
-
workflowRuntime:
|
|
1813
|
+
workflowRuntime: p,
|
|
1796
1814
|
workflowRunRecorder: j,
|
|
1797
|
-
closeChildrenForParent:
|
|
1815
|
+
closeChildrenForParent: jt
|
|
1798
1816
|
}),
|
|
1799
1817
|
redriveWorkflowRun: (e) => ee ? ee(e) : Promise.reject(/* @__PURE__ */ Error("redrive: this app registers no workflows")),
|
|
1800
1818
|
resumeWorkflowRunFromStep: (e) => te ? te(e) : Promise.reject(/* @__PURE__ */ Error("resume-from-step: this app registers no workflows")),
|
|
1801
1819
|
close: async () => {
|
|
1802
|
-
|
|
1803
|
-
for (let e of
|
|
1820
|
+
qt = !1, await Zt.drainRequests();
|
|
1821
|
+
for (let e of ye) try {
|
|
1804
1822
|
await e();
|
|
1805
1823
|
} catch (e) {
|
|
1806
1824
|
P.warn("serve: teardown step failed", {}, e);
|
|
1807
1825
|
}
|
|
1808
|
-
await
|
|
1826
|
+
await Pe?.detach(), await Me.detach(), an?.detach(), on?.detach(), n?.detach(), sn?.detach(), tn?.(), en?.(), await m?.shutdown(), r.close(), await ne?.detach(), await p?.dispose(), await Xt(), await Zt.finish();
|
|
1809
1827
|
}
|
|
1810
1828
|
};
|
|
1811
|
-
},
|
|
1812
|
-
|
|
1813
|
-
|
|
1829
|
+
}, Ko = (e) => {
|
|
1830
|
+
if (e == null || e === "") return;
|
|
1831
|
+
let t = Number(e);
|
|
1832
|
+
return Number.isFinite(t) && t > 0 ? t : void 0;
|
|
1833
|
+
}, qo = (e, t) => {
|
|
1834
|
+
let n = e === void 0 || e === !1 ? {
|
|
1835
|
+
on: !1,
|
|
1836
|
+
size: 500
|
|
1837
|
+
} : {
|
|
1838
|
+
on: !0,
|
|
1839
|
+
size: Ko(e === !0 ? void 0 : e.size) ?? 500
|
|
1840
|
+
};
|
|
1841
|
+
if (t === void 0 || t.trim() === "") return n;
|
|
1842
|
+
let r = t.trim().toLowerCase();
|
|
1843
|
+
if (r === "off" || r === "false" || r === "0") return {
|
|
1844
|
+
on: !1,
|
|
1845
|
+
size: n.size
|
|
1846
|
+
};
|
|
1847
|
+
if (r === "on" || r === "true") return {
|
|
1848
|
+
on: !0,
|
|
1849
|
+
size: n.size
|
|
1850
|
+
};
|
|
1851
|
+
let i = Ko(r);
|
|
1852
|
+
return i === void 0 ? n : {
|
|
1853
|
+
on: !0,
|
|
1854
|
+
size: i
|
|
1855
|
+
};
|
|
1856
|
+
}, Jo = (e, t = process.env) => ({
|
|
1857
|
+
logs: qo(e?.logs, t.VOLTRO_INSPECT_LOGS),
|
|
1858
|
+
traces: qo(e?.traces, t.VOLTRO_INSPECT_TRACES)
|
|
1859
|
+
}), $ = L({ scope: "voltro:serve" }), Yo = (e, t, n) => (e === "production" || e === "staging") && t !== "memory" && n !== "0", Xo = mn, Zo = async (e) => {
|
|
1860
|
+
let t = _n(process.cwd());
|
|
1861
|
+
if (er(t)) {
|
|
1814
1862
|
let n;
|
|
1815
1863
|
try {
|
|
1816
|
-
let e = await import(
|
|
1864
|
+
let e = await import(tr(t).href);
|
|
1817
1865
|
typeof e.runServe == "function" ? n = e.runServe : $.warn("serve bundle has no runServe export — using the standard serve path");
|
|
1818
1866
|
} catch (e) {
|
|
1819
1867
|
$.warn("serve bundle failed to load — using the standard serve path", {}, e);
|
|
1820
1868
|
}
|
|
1821
1869
|
if (n) return $.info("serve: booting from the precompiled serve bundle"), n(e);
|
|
1822
1870
|
}
|
|
1823
|
-
return
|
|
1824
|
-
},
|
|
1825
|
-
|
|
1826
|
-
let u =
|
|
1871
|
+
return Qo(e);
|
|
1872
|
+
}, Qo = async (l) => {
|
|
1873
|
+
Nr("serve");
|
|
1874
|
+
let u = qn();
|
|
1827
1875
|
e("serve");
|
|
1828
1876
|
try {
|
|
1829
|
-
|
|
1877
|
+
Hi();
|
|
1830
1878
|
} catch (e) {
|
|
1831
1879
|
throw i(e instanceof Error ? e.message : String(e));
|
|
1832
1880
|
}
|
|
1833
|
-
let
|
|
1881
|
+
let f = process.cwd(), h = await it(f), ie = hn({
|
|
1834
1882
|
kind: "api",
|
|
1835
|
-
configPort:
|
|
1883
|
+
configPort: h?.port,
|
|
1836
1884
|
env: process.env,
|
|
1837
|
-
flagPort:
|
|
1885
|
+
flagPort: Xo(l, "--port")
|
|
1838
1886
|
});
|
|
1839
|
-
for (let e of
|
|
1840
|
-
let
|
|
1841
|
-
|
|
1842
|
-
rawEnv:
|
|
1887
|
+
for (let e of ie.warnings) $.warn(e);
|
|
1888
|
+
let ce = ie.port;
|
|
1889
|
+
ji(ki(h?.secrets)), await rn({
|
|
1890
|
+
rawEnv: h?.env,
|
|
1843
1891
|
appType: "api",
|
|
1844
|
-
root:
|
|
1892
|
+
root: f,
|
|
1845
1893
|
log: $,
|
|
1846
|
-
generateTypes: !1
|
|
1894
|
+
generateTypes: !1,
|
|
1895
|
+
plugins: h?.plugins ?? []
|
|
1847
1896
|
}), u.mark("config");
|
|
1848
|
-
let
|
|
1849
|
-
if (!r() &&
|
|
1850
|
-
let e = await import(
|
|
1897
|
+
let v = (process.env.DB_DIALECT ?? h?.store ?? "memory").toLowerCase(), ge = (v === "mariadb" || v === "postgres" || v === "mssql") && (process.env.CDC ?? "1") !== "0", Se = v === "mariadb" ? "mariadb" : v === "mssql" ? "mssql" : void 0, Ce = gn(f);
|
|
1898
|
+
if (!r() && er(Ce)) try {
|
|
1899
|
+
let e = await import(tr(Ce).href);
|
|
1851
1900
|
if (e.modules) {
|
|
1852
1901
|
let t = {};
|
|
1853
|
-
for (let [n, r] of Object.entries(e.modules)) t[
|
|
1902
|
+
for (let [n, r] of Object.entries(e.modules)) t[Qn(f, n)] = r;
|
|
1854
1903
|
n(t), $.info("precompiled api bundle loaded", { modules: Object.keys(t).length });
|
|
1855
1904
|
}
|
|
1856
1905
|
} catch (e) {
|
|
1857
1906
|
$.warn("precompiled api bundle failed to load — falling back to source", {}, e);
|
|
1858
1907
|
}
|
|
1859
|
-
let
|
|
1908
|
+
let x = await jt(f), S = await Ut(x, {
|
|
1909
|
+
root: f,
|
|
1910
|
+
cdc: ge && Se !== void 0
|
|
1911
|
+
}), Ee = _e(S);
|
|
1860
1912
|
{
|
|
1861
|
-
|
|
1862
|
-
plugins:
|
|
1863
|
-
queries:
|
|
1864
|
-
mutations:
|
|
1865
|
-
actions:
|
|
1866
|
-
streams:
|
|
1913
|
+
ot({
|
|
1914
|
+
plugins: h?.plugins ?? [],
|
|
1915
|
+
queries: S.queries,
|
|
1916
|
+
mutations: S.mutations,
|
|
1917
|
+
actions: S.actions,
|
|
1918
|
+
streams: S.streams,
|
|
1867
1919
|
log: $
|
|
1868
1920
|
});
|
|
1869
|
-
let e =
|
|
1921
|
+
let e = Ae(S.serverOnlyLeaks, Xe(process.env, "strict"), Zr, "`voltro serve`");
|
|
1870
1922
|
if (e.action === "fail") throw i(e.message ?? "");
|
|
1871
1923
|
e.action === "warn" && $.warn(e.message ?? "");
|
|
1872
1924
|
}
|
|
1873
|
-
let
|
|
1925
|
+
let Oe = x.filter((e) => Kn.test(e)), ke = Oe.length > 0 ? await Gn(Oe, $.child("webhooks")) : {
|
|
1874
1926
|
outgoing: [],
|
|
1875
1927
|
incoming: [],
|
|
1876
1928
|
providers: []
|
|
1877
|
-
},
|
|
1878
|
-
...
|
|
1879
|
-
outgoing: [...
|
|
1880
|
-
},
|
|
1929
|
+
}, Ne = Un(S.events), ze = ke.outgoing.length + ke.incoming.length + ke.providers.length + Ne.length === 0 ? void 0 : {
|
|
1930
|
+
...ke,
|
|
1931
|
+
outgoing: [...ke.outgoing, ...Ne]
|
|
1932
|
+
}, Be = kn({
|
|
1881
1933
|
nodeEnv: process.env.NODE_ENV,
|
|
1882
|
-
cdcDialect:
|
|
1883
|
-
declared:
|
|
1884
|
-
}),
|
|
1885
|
-
gates:
|
|
1934
|
+
cdcDialect: Se,
|
|
1935
|
+
declared: h?.schema
|
|
1936
|
+
}), Ke = An({
|
|
1937
|
+
gates: Be,
|
|
1886
1938
|
runtime: {
|
|
1887
|
-
traces:
|
|
1888
|
-
undo:
|
|
1939
|
+
traces: me(),
|
|
1940
|
+
undo: Li()
|
|
1889
1941
|
}
|
|
1890
1942
|
});
|
|
1891
|
-
if (
|
|
1892
|
-
let
|
|
1893
|
-
mix:
|
|
1894
|
-
plugins:
|
|
1895
|
-
gates:
|
|
1896
|
-
...
|
|
1897
|
-
}),
|
|
1898
|
-
spec:
|
|
1899
|
-
sqlLayer:
|
|
1943
|
+
if (Ke !== void 0) throw i(`serve: ${Ke}`);
|
|
1944
|
+
let qe = On({
|
|
1945
|
+
mix: S.featureMix,
|
|
1946
|
+
plugins: h?.plugins ?? [],
|
|
1947
|
+
gates: Be,
|
|
1948
|
+
...Se ? { cdcDialect: Se } : {}
|
|
1949
|
+
}), Ye = h?.analytics !== void 0 && h.analytics.kind !== "noop" && v !== "memory" ? (await vn(v)).makeSqlLayer(j()) : void 0, $e = await st({
|
|
1950
|
+
spec: h?.analytics,
|
|
1951
|
+
sqlLayer: Ye,
|
|
1900
1952
|
log: $
|
|
1901
|
-
}),
|
|
1902
|
-
let e = new Set(
|
|
1903
|
-
for (let n of [...
|
|
1953
|
+
}), w = (() => {
|
|
1954
|
+
let e = new Set(S.tables.map((e) => e.tableName)), t = [...S.tables];
|
|
1955
|
+
for (let n of [...qe, ...$e.tables]) e.has(n.tableName) || (e.add(n.tableName), t.push(n));
|
|
1904
1956
|
return t;
|
|
1905
1957
|
})();
|
|
1906
|
-
for (let e of
|
|
1958
|
+
for (let e of w) Tr(e);
|
|
1907
1959
|
{
|
|
1908
|
-
let e =
|
|
1960
|
+
let e = Qr(Ri(De(S), le(w)));
|
|
1909
1961
|
e !== void 0 && $.warn(e);
|
|
1910
1962
|
}
|
|
1911
|
-
let
|
|
1912
|
-
if (
|
|
1913
|
-
let e = (await
|
|
1963
|
+
let et = (process.env.NODE_ENV ?? "").toLowerCase();
|
|
1964
|
+
if (Yo(et, v, process.env.VOLTRO_AUTO_MIGRATE)) {
|
|
1965
|
+
let e = (await vn(v)).makeSqlLayer(j()), t = await J.runPromise(Gi.SqlClient.pipe(J.flatMap((e) => Ji(e, f)), J.provide(e), J.catchAll(() => J.succeed([]))));
|
|
1914
1966
|
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));
|
|
1915
|
-
let n = await J.runPromise(
|
|
1916
|
-
appliedBy: `serve:${
|
|
1967
|
+
let n = await J.runPromise(Gi.SqlClient.pipe(J.flatMap((e) => Yi(e, w, {
|
|
1968
|
+
appliedBy: `serve:${et}`,
|
|
1917
1969
|
environment: "prod",
|
|
1918
|
-
dialectId:
|
|
1970
|
+
dialectId: v
|
|
1919
1971
|
})), J.provide(e)));
|
|
1920
|
-
n.kind === "prod-mismatch" && ($.error(
|
|
1921
|
-
gates:
|
|
1972
|
+
n.kind === "prod-mismatch" && ($.error(qi(n, v)), $.error(jn({
|
|
1973
|
+
gates: Be,
|
|
1922
1974
|
nodeEnv: process.env.NODE_ENV,
|
|
1923
|
-
cdcDialect:
|
|
1924
|
-
declared:
|
|
1925
|
-
})), $.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(
|
|
1975
|
+
cdcDialect: Se,
|
|
1976
|
+
declared: h?.schema
|
|
1977
|
+
})), $.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(qi(n, v));
|
|
1926
1978
|
}
|
|
1927
|
-
await
|
|
1928
|
-
dialectId:
|
|
1929
|
-
tables:
|
|
1930
|
-
mode:
|
|
1931
|
-
lockSchema:
|
|
1932
|
-
makeLayer: async () => (await
|
|
1979
|
+
await Cn({
|
|
1980
|
+
dialectId: v,
|
|
1981
|
+
tables: w,
|
|
1982
|
+
mode: xn(h?.reactiveTriggers),
|
|
1983
|
+
lockSchema: j().schema,
|
|
1984
|
+
makeLayer: async () => (await vn(v)).makeSqlLayer(j()),
|
|
1933
1985
|
log: {
|
|
1934
1986
|
info: (e, t) => $.info(e, t ?? {}),
|
|
1935
1987
|
warn: (e, t) => $.warn(e, t ?? {})
|
|
1936
1988
|
}
|
|
1937
1989
|
});
|
|
1938
|
-
let
|
|
1990
|
+
let nt = xi(w);
|
|
1939
1991
|
u.mark("discover");
|
|
1940
|
-
let
|
|
1992
|
+
let T = await gt(h, void 0);
|
|
1941
1993
|
{
|
|
1942
|
-
let e = await c(
|
|
1994
|
+
let e = await c(T);
|
|
1943
1995
|
if (e !== void 0) throw i(`serve: ${e}`);
|
|
1944
|
-
let t = await s(
|
|
1996
|
+
let t = await s(T, v, h);
|
|
1945
1997
|
t !== void 0 && $.warn(t);
|
|
1946
1998
|
}
|
|
1947
|
-
let
|
|
1948
|
-
for (let e of
|
|
1949
|
-
dialect: String(
|
|
1999
|
+
let at = Vi(T, v);
|
|
2000
|
+
for (let e of Te({
|
|
2001
|
+
dialect: String(h?.store ?? process.env.DB_DIALECT ?? "postgres"),
|
|
1950
2002
|
changeStrategy: (process.env.CDC ?? "1") === "0" ? "inline" : "cdc",
|
|
1951
2003
|
dbUrl: process.env.DB_URL,
|
|
1952
|
-
crossReplicaBus:
|
|
1953
|
-
tables:
|
|
2004
|
+
crossReplicaBus: la(h?.plugins ?? [])?.broadcast.crossReplica === !0,
|
|
2005
|
+
tables: S.tables.map((e) => ({
|
|
1954
2006
|
tableName: e.tableName,
|
|
1955
2007
|
isReactive: e.isReactive === !0
|
|
1956
2008
|
})),
|
|
1957
|
-
querySources:
|
|
2009
|
+
querySources: S.queries.flatMap((e) => {
|
|
1958
2010
|
let t = e.descriptor.source;
|
|
1959
2011
|
return t === void 0 ? [] : typeof t == "string" ? [t] : [...t];
|
|
1960
2012
|
})
|
|
1961
2013
|
})) e.level === "warn" ? $.warn(e.message) : $.info(e.message);
|
|
1962
2014
|
{
|
|
1963
|
-
let e =
|
|
1964
|
-
tables:
|
|
1965
|
-
queries:
|
|
2015
|
+
let e = oe({
|
|
2016
|
+
tables: br().map((e) => ({ tableName: e.tableName })),
|
|
2017
|
+
queries: S.queries.map((e) => ({
|
|
1966
2018
|
name: e.descriptor.name,
|
|
1967
2019
|
source: e.descriptor.source
|
|
1968
2020
|
}))
|
|
1969
|
-
}), t =
|
|
2021
|
+
}), t = g(e);
|
|
1970
2022
|
t !== void 0 && $.warn(t);
|
|
1971
2023
|
}
|
|
1972
|
-
|
|
1973
|
-
let { service:
|
|
2024
|
+
h?.cache && !process.env.CACHE_BACKEND && (process.env.CACHE_BACKEND = h.cache), h?.cacheRedisUrl && !process.env.CACHE_REDIS_URL && (process.env.CACHE_REDIS_URL = h.cacheRedisUrl), h?.cacheRedisDriver && !process.env.CACHE_REDIS_DRIVER && (process.env.CACHE_REDIS_DRIVER = h.cacheRedisDriver), h?.cacheKeyPrefix && !process.env.CACHE_KEY_PREFIX && (process.env.CACHE_KEY_PREFIX = h.cacheKeyPrefix);
|
|
2025
|
+
let { service: lt, invalidationBus: ft, snapshotCache: mt, cache: St, semantic: Ct, evictSource: Ot, backend: kt, stats: At, dispose: Mt } = await Le({
|
|
1974
2026
|
env: process.env,
|
|
1975
|
-
semantic:
|
|
2027
|
+
semantic: h?.cacheSemantic ?? !1
|
|
1976
2028
|
});
|
|
1977
|
-
|
|
1978
|
-
let
|
|
1979
|
-
J.runFork(
|
|
2029
|
+
Ct !== void 0 && $.info("semantic cache enabled — reactive eviction on live writes"), $.info(`cache backend resolved: ${kt}` + (kt === "redis" ? ` (driver ${process.env.CACHE_REDIS_DRIVER ?? "resp"})` : " — in-process, not cross-instance"));
|
|
2030
|
+
let Pt = (e) => {
|
|
2031
|
+
J.runFork(ft.publish(e));
|
|
1980
2032
|
};
|
|
1981
|
-
|
|
1982
|
-
if (J.runFork(
|
|
2033
|
+
T.onChange((e) => {
|
|
2034
|
+
if (J.runFork(ft.publish(e.table)), Ot !== void 0) {
|
|
1983
2035
|
let t = (e.new ?? e.old)?.id;
|
|
1984
|
-
|
|
2036
|
+
Ot({
|
|
1985
2037
|
table: e.table,
|
|
1986
2038
|
op: e.op,
|
|
1987
2039
|
...t === void 0 ? {} : { id: t }
|
|
1988
2040
|
});
|
|
1989
2041
|
}
|
|
1990
|
-
}),
|
|
1991
|
-
let { kv:
|
|
1992
|
-
|
|
2042
|
+
}), h?.kv && !process.env.KV_BACKEND && (process.env.KV_BACKEND = h.kv), h?.kvRedisUrl && !process.env.KV_REDIS_URL && (process.env.KV_REDIS_URL = h.kvRedisUrl), h?.kvKeyPrefix && !process.env.KV_KEY_PREFIX && (process.env.KV_KEY_PREFIX = h.kvKeyPrefix);
|
|
2043
|
+
let { kv: zt, service: Vt } = await ci({ store: T });
|
|
2044
|
+
Me({
|
|
1993
2045
|
log: $,
|
|
1994
|
-
max:
|
|
1995
|
-
outOfPool:
|
|
2046
|
+
max: bn(),
|
|
2047
|
+
outOfPool: ve(v, (process.env.CDC ?? "1") !== "0"),
|
|
1996
2048
|
readPools: t.replicationSnapshot()?.replicaCount ?? 0,
|
|
1997
2049
|
always: !0
|
|
1998
2050
|
}), u.mark("store");
|
|
1999
|
-
let
|
|
2000
|
-
store:
|
|
2001
|
-
sink:
|
|
2051
|
+
let Ht = Br({
|
|
2052
|
+
store: T,
|
|
2053
|
+
sink: $e.sink,
|
|
2002
2054
|
log: $
|
|
2003
|
-
}),
|
|
2004
|
-
store:
|
|
2005
|
-
dialect:
|
|
2055
|
+
}), N = Et(h?.idempotency, T), Kt = Jt({
|
|
2056
|
+
store: T,
|
|
2057
|
+
dialect: v,
|
|
2006
2058
|
log: { info: (e) => $.info(e) },
|
|
2007
|
-
...
|
|
2008
|
-
}),
|
|
2009
|
-
|
|
2010
|
-
let
|
|
2059
|
+
...N === void 0 ? {} : { idempotencyTtlMs: N.ttlMs }
|
|
2060
|
+
}), F = h?.plugins ?? [], Qt = Ar(), $t, nn;
|
|
2061
|
+
v !== "memory" && ($t = Wi.make((await vn(v)).makeSqlLayer(j()).pipe(Y.provideMerge(nr({})))), nn = await $t.runPromise(Gi.SqlClient));
|
|
2062
|
+
let mn = [
|
|
2011
2063
|
"postgres",
|
|
2012
2064
|
"mariadb",
|
|
2013
2065
|
"mysql",
|
|
2014
2066
|
"mssql"
|
|
2015
|
-
].includes(
|
|
2016
|
-
maxIdleIntervalMs:
|
|
2017
|
-
coordinator:
|
|
2018
|
-
replicaId:
|
|
2067
|
+
].includes(v) ? ii(T, Qt, $) : Pi, _n = Re(h?.scheduling), Bn = di({
|
|
2068
|
+
maxIdleIntervalMs: _n.pollCeilingMs,
|
|
2069
|
+
coordinator: mn,
|
|
2070
|
+
replicaId: Qt,
|
|
2019
2071
|
log: $
|
|
2020
|
-
}),
|
|
2072
|
+
}), Wn = [], Jn = Ar(), Yn = la(h?.plugins ?? [])?.broadcast?.provider, Xn = Gt(h?.plugins, h?.name ?? Zn(f));
|
|
2021
2073
|
{
|
|
2022
|
-
let e =
|
|
2074
|
+
let e = Ze(h?.plugins, h?.name ?? Zn(f));
|
|
2023
2075
|
e !== void 0 && $.warn(e);
|
|
2024
2076
|
}
|
|
2025
|
-
let
|
|
2026
|
-
instanceId:
|
|
2027
|
-
namespace:
|
|
2077
|
+
let I = tt(h?.plugins, {
|
|
2078
|
+
instanceId: Jn,
|
|
2079
|
+
namespace: Xn,
|
|
2028
2080
|
meta: { mode: "serve" },
|
|
2029
2081
|
logger: $
|
|
2030
|
-
}),
|
|
2031
|
-
|
|
2032
|
-
let
|
|
2033
|
-
store:
|
|
2034
|
-
members: () =>
|
|
2035
|
-
}),
|
|
2036
|
-
let e =
|
|
2082
|
+
}), $n = jr();
|
|
2083
|
+
Mr(`${$n.host}:${ce}`, $n.declared);
|
|
2084
|
+
let rr = on(), R = Jo(h?.inspect), z = fe({
|
|
2085
|
+
store: T,
|
|
2086
|
+
members: () => I.membership?.list() ?? []
|
|
2087
|
+
}), ir = () => {
|
|
2088
|
+
let e = I.membership?.list().length;
|
|
2037
2089
|
return typeof e == "number" && e > 0 ? { fleetSize: e } : {};
|
|
2038
|
-
},
|
|
2090
|
+
}, ar = zn({
|
|
2039
2091
|
mode: "serve",
|
|
2040
|
-
dialect:
|
|
2041
|
-
...
|
|
2092
|
+
dialect: v,
|
|
2093
|
+
...Yn === void 0 ? {} : { provider: Yn },
|
|
2042
2094
|
logger: $
|
|
2043
2095
|
});
|
|
2044
|
-
|
|
2045
|
-
await
|
|
2046
|
-
}),
|
|
2047
|
-
let
|
|
2048
|
-
claimedBy:
|
|
2096
|
+
G(async () => {
|
|
2097
|
+
await ar.stop();
|
|
2098
|
+
}), m(h?.reactive), Pe(h);
|
|
2099
|
+
let or = M(T, {
|
|
2100
|
+
claimedBy: kr(),
|
|
2049
2101
|
onError: (e) => $.warn("change claim failed — the claimed effect is being SKIPPED, not duplicated", { cause: String(e) })
|
|
2050
|
-
}),
|
|
2051
|
-
...
|
|
2052
|
-
instanceId:
|
|
2053
|
-
membership:
|
|
2054
|
-
...
|
|
2055
|
-
broadcastChannels: { presence:
|
|
2102
|
+
}), B = {
|
|
2103
|
+
...nn ? { sql: nn } : {},
|
|
2104
|
+
instanceId: Jn,
|
|
2105
|
+
membership: I.membership,
|
|
2106
|
+
...Yn === void 0 ? {} : { broadcast: Yn },
|
|
2107
|
+
broadcastChannels: { presence: ca(Xn, "presence") },
|
|
2056
2108
|
scheduleCoordinated: (e, t, n) => {
|
|
2057
|
-
let r =
|
|
2058
|
-
return
|
|
2109
|
+
let r = Bn(e, t, n);
|
|
2110
|
+
return Wn.push(r), r;
|
|
2059
2111
|
},
|
|
2060
|
-
claimChange:
|
|
2112
|
+
claimChange: or.claim
|
|
2061
2113
|
};
|
|
2062
|
-
for (let e of
|
|
2063
|
-
|
|
2064
|
-
store:
|
|
2065
|
-
...
|
|
2114
|
+
for (let e of F) e.bindDataStore?.(at, B);
|
|
2115
|
+
be({
|
|
2116
|
+
store: T,
|
|
2117
|
+
...vt(),
|
|
2066
2118
|
log: $
|
|
2067
2119
|
});
|
|
2068
|
-
let
|
|
2069
|
-
if (
|
|
2070
|
-
let e =
|
|
2071
|
-
|
|
2072
|
-
let n =
|
|
2073
|
-
for (let e of
|
|
2120
|
+
let sr = F.filter((e) => typeof e.onChangeEvent == "function");
|
|
2121
|
+
if (sr.length > 0) {
|
|
2122
|
+
let e = T.changeScope ?? "local";
|
|
2123
|
+
T.onChange((t) => {
|
|
2124
|
+
let n = Ue(t, e);
|
|
2125
|
+
for (let e of sr) J.runFork(e.onChangeEvent(n).pipe(J.catchAllCause((t) => J.sync(() => $.warn(`plugin ${e.name} onChangeEvent failed`, { error: Ui.pretty(t) })))));
|
|
2074
2126
|
});
|
|
2075
2127
|
}
|
|
2076
|
-
let
|
|
2077
|
-
|
|
2078
|
-
let
|
|
2079
|
-
plugins:
|
|
2080
|
-
appName:
|
|
2128
|
+
let cr = x.filter((e) => Nn.test(e));
|
|
2129
|
+
cr.length > 0 && (await It(cr, $), $.info(`queue: ${cr.length} consumer file(s) loaded`));
|
|
2130
|
+
let lr = A({
|
|
2131
|
+
plugins: F,
|
|
2132
|
+
appName: h?.name ?? "voltro-api",
|
|
2081
2133
|
appType: "api",
|
|
2082
|
-
voltroVersion:
|
|
2134
|
+
voltroVersion: Or() ?? "unknown",
|
|
2083
2135
|
log: $
|
|
2084
2136
|
});
|
|
2085
|
-
|
|
2086
|
-
let
|
|
2137
|
+
F.length && await lr.activate(), u.mark("plugins");
|
|
2138
|
+
let ur = await lr.gatherObservability(), dr = L({ scope: "voltro:broadcast" }), fr = {
|
|
2087
2139
|
info: (e, t) => {
|
|
2088
|
-
|
|
2140
|
+
dr.info(e, t);
|
|
2089
2141
|
},
|
|
2090
2142
|
warn: (e, t) => {
|
|
2091
|
-
|
|
2143
|
+
dr.warn(e, t);
|
|
2092
2144
|
},
|
|
2093
2145
|
debug: () => {}
|
|
2094
|
-
}
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2146
|
+
};
|
|
2147
|
+
R.logs.on && (cn(new dn(R.logs.size)), G(ln(rr)), fr.info("inspect: serving /_voltro/inspect/logs", { ring: R.logs.size }));
|
|
2148
|
+
let pr;
|
|
2149
|
+
R.traces.on && (en(new y(R.traces.size)), pr = ui(pt({ buffer: je() })), fr.info("inspect: serving /_voltro/inspect/traces", { ring: R.traces.size }));
|
|
2150
|
+
let mr, hr = Lt({
|
|
2151
|
+
store: T,
|
|
2152
|
+
dispatcher: () => mr,
|
|
2153
|
+
invalidateTable: () => Pt,
|
|
2154
|
+
log: fr
|
|
2155
|
+
}), gr = await Tt(T, h, v, Xn, fr, hr.onBroadcastGap), _r = h?.apiKeys, vr = (typeof _r == "object" ? _r.prefix : void 0) ?? "voltro_", V = _r ? Xr(T) : void 0, yr = V ? oi({ flush: si(V) }) : void 0;
|
|
2156
|
+
yr && G(() => yr.shutdown());
|
|
2157
|
+
let xr = V ? ai(V, {
|
|
2158
|
+
prefix: vr,
|
|
2159
|
+
...yr ? { usage: yr } : {}
|
|
2160
|
+
}) : void 0, Cr = xr ? [$r(xr, { prefix: vr })] : [], wr = Ft([...h?.auth?.strategies ?? [], ...Cr], ga(h?.plugins ?? []), h?.auth?.anonymousTenantRequired ?? !1, h?.auth, () => at), H = [...h?.restRoutes ?? [], ...xr ? zr(xr, (typeof _r == "object" ? _r.managementPath : void 0) ?? "/v1/api-keys") : []], Er = F.map((e) => e.services).filter((e) => e !== void 0), Pr = Y.mergeAll(Qe({
|
|
2161
|
+
analyticsLayer: $e.layer,
|
|
2162
|
+
cacheService: lt,
|
|
2163
|
+
kvService: Vt,
|
|
2164
|
+
...Ct === void 0 ? {} : { semanticCache: Ct },
|
|
2165
|
+
pluginServices: Er,
|
|
2166
|
+
userLayers: h?.layers ?? []
|
|
2167
|
+
}), O(h?.http ?? {})), U = await Nt({
|
|
2168
|
+
files: x,
|
|
2169
|
+
store: T,
|
|
2114
2170
|
log: $,
|
|
2115
2171
|
seedPolicy: "report",
|
|
2116
|
-
seedPattern:
|
|
2117
|
-
loadSeedFiles:
|
|
2118
|
-
startupPattern:
|
|
2172
|
+
seedPattern: Mn,
|
|
2173
|
+
loadSeedFiles: Sn,
|
|
2174
|
+
startupPattern: Rn,
|
|
2119
2175
|
loadStartupFiles: a,
|
|
2120
2176
|
runStartups: o,
|
|
2121
|
-
emailPattern:
|
|
2122
|
-
loadEmailFiles:
|
|
2123
|
-
registerEmailTemplates:
|
|
2177
|
+
emailPattern: Dt,
|
|
2178
|
+
loadEmailFiles: ht,
|
|
2179
|
+
registerEmailTemplates: _a
|
|
2124
2180
|
});
|
|
2125
|
-
(
|
|
2126
|
-
startups:
|
|
2127
|
-
emailTemplates:
|
|
2128
|
-
}),
|
|
2129
|
-
await
|
|
2130
|
-
}),
|
|
2131
|
-
demands:
|
|
2132
|
-
isRegistered: (e) =>
|
|
2181
|
+
(U.startupCount > 0 || U.emailCount > 0) && $.info("boot lifecycle", {
|
|
2182
|
+
startups: U.startupCount,
|
|
2183
|
+
emailTemplates: U.emailCount
|
|
2184
|
+
}), U.startups !== void 0 && G(async () => {
|
|
2185
|
+
await U.startups.stop();
|
|
2186
|
+
}), Ge({
|
|
2187
|
+
demands: de(Ee),
|
|
2188
|
+
isRegistered: (e) => ei(e) !== void 0
|
|
2133
2189
|
});
|
|
2134
|
-
let
|
|
2135
|
-
schedules:
|
|
2136
|
-
schedules:
|
|
2137
|
-
seeds:
|
|
2138
|
-
store:
|
|
2190
|
+
let Fr = ct({
|
|
2191
|
+
schedules: dt({
|
|
2192
|
+
schedules: S.schedules,
|
|
2193
|
+
seeds: U.seeds,
|
|
2194
|
+
store: T,
|
|
2139
2195
|
log: $.child("seeds")
|
|
2140
2196
|
}),
|
|
2141
|
-
workflows:
|
|
2197
|
+
workflows: S.workflows ?? [],
|
|
2142
2198
|
log: $.child("workflow-schedules")
|
|
2143
|
-
}),
|
|
2199
|
+
}), Ir = h?.scheduling ?? {}, Lr = Ir.trigger ?? "self", Rr = /* @__PURE__ */ new Set([
|
|
2144
2200
|
"postgres",
|
|
2145
2201
|
"mysql",
|
|
2146
2202
|
"mariadb",
|
|
2147
2203
|
"mssql"
|
|
2148
|
-
]),
|
|
2149
|
-
|
|
2150
|
-
let
|
|
2151
|
-
if (
|
|
2152
|
-
if (
|
|
2153
|
-
let e = await
|
|
2204
|
+
]), Vr = Ir.coordination ?? (Rr.has(v) ? "advisoryLock" : "single"), Hr = Vr === "cluster" && Rr.has(v), Ur = Hr ? "cluster" : Vr === "advisoryLock" && Rr.has(v) ? "advisoryLock" : "single";
|
|
2205
|
+
Vr === "cluster" && !Hr && $.warn("scheduling.coordination=cluster needs a sql-backed store except sqlite — falling back to single"), Vr === "advisoryLock" && !Rr.has(v) && $.warn("scheduling.coordination=advisoryLock needs a SQL store (the claim-row gate) — falling back to single");
|
|
2206
|
+
let Wr, Gr = S.workflows.length > 0 || S.workflowWorkers.length > 0 || S.eventTriggers.length > 0 || (ze?.outgoing.length ?? 0) > 0 || Hr, Kr;
|
|
2207
|
+
if (Gr) {
|
|
2208
|
+
if (v === "mssql") {
|
|
2209
|
+
let e = await Hn(process.cwd());
|
|
2154
2210
|
e && $.warn(e);
|
|
2155
2211
|
}
|
|
2156
|
-
let [{ WorkflowEngine: e }, { makeClusterCronLayer: t, workflowEngineLayer: n, resolveRunnerStorage: r, resolveFailoverTuning: i }] = await Promise.all([import("@effect/workflow"), import("@voltro/workflow/cluster")]), a =
|
|
2212
|
+
let [{ WorkflowEngine: e }, { makeClusterCronLayer: t, workflowEngineLayer: n, resolveRunnerStorage: r, resolveFailoverTuning: i }] = await Promise.all([import("@effect/workflow"), import("@voltro/workflow/cluster")]), a = Hr ? Fr.filter((e) => (e.trigger ?? Lr) === "self").map((e) => t({
|
|
2157
2213
|
name: e.name,
|
|
2158
|
-
cron:
|
|
2214
|
+
cron: Yr(e),
|
|
2159
2215
|
execute: async () => {
|
|
2160
|
-
await
|
|
2216
|
+
await Wr?.fireFromCluster(e.name);
|
|
2161
2217
|
}
|
|
2162
2218
|
})) : [];
|
|
2163
|
-
|
|
2164
|
-
let e = await
|
|
2219
|
+
Kr = v === "memory" ? e.layerMemory : await (async () => {
|
|
2220
|
+
let e = await vn(v), t = r({ sqliteFamily: e.id === "sqlite" || e.id === "turso" });
|
|
2165
2221
|
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({
|
|
2166
|
-
sqlClientLayer: e.makeSqlLayer(
|
|
2222
|
+
sqlClientLayer: e.makeSqlLayer(j()),
|
|
2167
2223
|
runnerStorage: t,
|
|
2168
2224
|
dialectId: e.id,
|
|
2169
2225
|
...process.env.VOLTRO_WORKFLOW_RUNNER_PORT ? { runnerListenPort: Number(process.env.VOLTRO_WORKFLOW_RUNNER_PORT) } : {},
|
|
@@ -2172,24 +2228,24 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
2172
2228
|
});
|
|
2173
2229
|
})();
|
|
2174
2230
|
}
|
|
2175
|
-
let
|
|
2231
|
+
let W = E(F, Vn()), qr = x.filter((e) => /\.subscribe\.tsx?$/.test(e)), Jr = qr.length > 0 ? await Rt(qr, $) : [], ti = x.filter((e) => /\.reaction\.tsx?$/.test(e)), ni = ti.length > 0 ? await te(ti, $) : [], ri = x.filter((e) => Pn.test(e)), li = ri.length > 0 ? await _t(ri, $) : [], fi = x.filter((e) => /\.aggregate\.tsx?$/.test(e)), pi = fi.length > 0 ? await _(fi, $) : [];
|
|
2176
2232
|
{
|
|
2177
|
-
let e =
|
|
2233
|
+
let e = Qr(Ri(De({ aggregates: pi.map((e) => e.definition) }), le(w)));
|
|
2178
2234
|
e !== void 0 && $.warn(e);
|
|
2179
2235
|
}
|
|
2180
|
-
let
|
|
2181
|
-
if (
|
|
2182
|
-
let e = (await
|
|
2183
|
-
|
|
2236
|
+
let mi = he();
|
|
2237
|
+
if (pi.length > 0 && v !== "memory") try {
|
|
2238
|
+
let e = (await vn(v)).makeSqlLayer(j());
|
|
2239
|
+
mi = ye(e);
|
|
2184
2240
|
} catch (e) {
|
|
2185
2241
|
$.warn("aggregate: SQL storage init failed — falling back to in-process", { err: String(e) });
|
|
2186
2242
|
}
|
|
2187
|
-
let
|
|
2188
|
-
if (
|
|
2189
|
-
let e = $.child("agent"), t =
|
|
2190
|
-
t.length > 0 && await
|
|
2191
|
-
let n = await
|
|
2192
|
-
for (let e of n.agents) for (let t of
|
|
2243
|
+
let hi = v === "memory" ? Pi : ii(T, `aggregate@${process.pid}`, $), gi = x.filter((e) => Fn.test(e)), _i = gi.length > 0 ? await bt(gi, $) : [], vi = x.filter((e) => In.test(e)), yi = vi.length > 0 ? await p(vi, $) : [], bi = x.filter((e) => Ln.test(e)), Si = bi.length > 0 ? await b(bi, $) : [], Ci = [], wi = [], Ti = x.filter((e) => wn.test(e));
|
|
2244
|
+
if (Ti.length > 0) {
|
|
2245
|
+
let e = $.child("agent"), t = x.filter((e) => Dn.test(e));
|
|
2246
|
+
t.length > 0 && await Tn(t, e);
|
|
2247
|
+
let n = await En(Ti, e);
|
|
2248
|
+
for (let e of n.agents) for (let t of wt(e)) (t.kind === "action" ? Ci : wi).push({
|
|
2193
2249
|
file: t.file,
|
|
2194
2250
|
descriptor: t.descriptor,
|
|
2195
2251
|
executor: t.executor
|
|
@@ -2201,89 +2257,89 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
2201
2257
|
let e = q.workflowWriteActions();
|
|
2202
2258
|
if (e === void 0) throw Error("workflow actions: this app registers no workflows");
|
|
2203
2259
|
return e;
|
|
2204
|
-
},
|
|
2205
|
-
dialect:
|
|
2206
|
-
...
|
|
2207
|
-
}),
|
|
2208
|
-
sqlLayer:
|
|
2209
|
-
declared:
|
|
2260
|
+
}, Ei = Sr({
|
|
2261
|
+
dialect: v,
|
|
2262
|
+
...j()
|
|
2263
|
+
}), Di = v === "memory" ? void 0 : (await vn(v)).makeSqlLayer(j()), Oi = async () => Wt({
|
|
2264
|
+
sqlLayer: Di,
|
|
2265
|
+
declared: w,
|
|
2210
2266
|
log: $
|
|
2211
|
-
}),
|
|
2267
|
+
}), Ai = {
|
|
2212
2268
|
kind: "api",
|
|
2213
2269
|
meta: {
|
|
2214
|
-
name:
|
|
2215
|
-
voltroVersion:
|
|
2216
|
-
port:
|
|
2217
|
-
mode:
|
|
2218
|
-
store:
|
|
2219
|
-
cdc:
|
|
2220
|
-
...
|
|
2270
|
+
name: h?.name ?? "voltro-api",
|
|
2271
|
+
voltroVersion: Bt,
|
|
2272
|
+
port: ce,
|
|
2273
|
+
mode: Dr(),
|
|
2274
|
+
store: v,
|
|
2275
|
+
cdc: ge ? "on" : "off",
|
|
2276
|
+
...Ei === void 0 ? {} : { databaseId: Ei }
|
|
2221
2277
|
},
|
|
2222
|
-
rpc:
|
|
2223
|
-
workflows:
|
|
2224
|
-
migrations:
|
|
2278
|
+
rpc: yt(S, f),
|
|
2279
|
+
workflows: xe(S, f),
|
|
2280
|
+
migrations: Oi,
|
|
2225
2281
|
events: () => q.eventsSnapshot(),
|
|
2226
2282
|
agentTools: () => q.agentTools(),
|
|
2227
2283
|
invariantChecks: () => ({
|
|
2228
2284
|
mode: "serve",
|
|
2229
|
-
accessGate:
|
|
2230
|
-
config:
|
|
2231
|
-
serverOnlyLeaks:
|
|
2232
|
-
migrations:
|
|
2285
|
+
accessGate: Ee,
|
|
2286
|
+
config: h,
|
|
2287
|
+
serverOnlyLeaks: S.serverOnlyLeaks,
|
|
2288
|
+
migrations: Oi
|
|
2233
2289
|
}),
|
|
2234
2290
|
members: () => q.membersSnapshot(),
|
|
2235
2291
|
inspectFireSchedule: async ({ name: e, trigger: t }) => {
|
|
2236
|
-
if (!
|
|
2237
|
-
return { runId: await
|
|
2292
|
+
if (!Wr) throw Error("scheduler not started — this app registers no self-triggered schedules (all schedules are trigger:'external', or there are none).");
|
|
2293
|
+
return { runId: await Wr.fireNow(e, t) ?? null };
|
|
2238
2294
|
},
|
|
2239
|
-
inspectBackfillSchedule:
|
|
2240
|
-
getHandle: () =>
|
|
2241
|
-
getSchedules: () =>
|
|
2295
|
+
inspectBackfillSchedule: we({
|
|
2296
|
+
getHandle: () => Wr,
|
|
2297
|
+
getSchedules: () => Fr
|
|
2242
2298
|
}),
|
|
2243
|
-
...
|
|
2244
|
-
store:
|
|
2245
|
-
discoveredWebhooks:
|
|
2299
|
+
...ze === void 0 ? {} : { webhooks: () => d({
|
|
2300
|
+
store: T,
|
|
2301
|
+
discoveredWebhooks: ze
|
|
2246
2302
|
}) },
|
|
2247
2303
|
plugins: () => ({
|
|
2248
|
-
plugins:
|
|
2304
|
+
plugins: lr.snapshot(),
|
|
2249
2305
|
capturedAt: Date.now()
|
|
2250
2306
|
}),
|
|
2251
|
-
env: () =>
|
|
2252
|
-
...
|
|
2253
|
-
plugins:
|
|
2307
|
+
env: () => an(h?.name ?? Zn(f), {
|
|
2308
|
+
...h?.env !== void 0 && aa(h.env) ? { contract: h.env } : {},
|
|
2309
|
+
plugins: h?.plugins ?? []
|
|
2254
2310
|
}),
|
|
2255
|
-
dataCache: () =>
|
|
2256
|
-
stats:
|
|
2257
|
-
backendKind:
|
|
2311
|
+
dataCache: () => C({
|
|
2312
|
+
stats: At,
|
|
2313
|
+
backendKind: kt
|
|
2258
2314
|
}),
|
|
2259
|
-
subscriptions: () =>
|
|
2260
|
-
fleetObservations: (e) =>
|
|
2261
|
-
peerAddress: (e) =>
|
|
2262
|
-
inspectTables: () =>
|
|
2263
|
-
inspectRows:
|
|
2264
|
-
store:
|
|
2265
|
-
tables:
|
|
2315
|
+
subscriptions: () => ne(() => mr),
|
|
2316
|
+
fleetObservations: (e) => z.fleet(e),
|
|
2317
|
+
peerAddress: (e) => z.addressOf(e),
|
|
2318
|
+
inspectTables: () => We(w),
|
|
2319
|
+
inspectRows: ue({
|
|
2320
|
+
store: T,
|
|
2321
|
+
tables: w,
|
|
2266
2322
|
mask: !0
|
|
2267
2323
|
}),
|
|
2268
2324
|
metrics: (e) => q.rpcMetrics().snapshot(e),
|
|
2269
|
-
cluster: () =>
|
|
2270
|
-
store:
|
|
2271
|
-
dialect:
|
|
2272
|
-
useClusterCron:
|
|
2273
|
-
scheduleCoordChoice:
|
|
2325
|
+
cluster: () => Xt({
|
|
2326
|
+
store: T,
|
|
2327
|
+
dialect: v,
|
|
2328
|
+
useClusterCron: Hr,
|
|
2329
|
+
scheduleCoordChoice: Vr
|
|
2274
2330
|
}),
|
|
2275
|
-
inspectSchedules: () =>
|
|
2276
|
-
schedules:
|
|
2277
|
-
defaultTrigger:
|
|
2278
|
-
coordination:
|
|
2331
|
+
inspectSchedules: () => re({
|
|
2332
|
+
schedules: Fr,
|
|
2333
|
+
defaultTrigger: Lr,
|
|
2334
|
+
coordination: Ur
|
|
2279
2335
|
}),
|
|
2280
|
-
inspectScheduleRuns: (e) =>
|
|
2281
|
-
...
|
|
2282
|
-
controls:
|
|
2283
|
-
active: (
|
|
2336
|
+
inspectScheduleRuns: (e) => ae(T, e),
|
|
2337
|
+
...Ie(T, {
|
|
2338
|
+
controls: Fe(S.workflows ?? []),
|
|
2339
|
+
active: (S.workflows?.length ?? 0) > 0,
|
|
2284
2340
|
cancellation: () => q.flowControlHealth()
|
|
2285
2341
|
}),
|
|
2286
|
-
webhookActions:
|
|
2342
|
+
webhookActions: qt(() => q.webhooksService()),
|
|
2287
2343
|
inspectStartWorkflow: (e) => K().inspectStartWorkflow(e),
|
|
2288
2344
|
inspectCancelWorkflowRun: (e) => K().inspectCancelWorkflowRun(e),
|
|
2289
2345
|
inspectSuspendWorkflowRun: (e) => K().inspectSuspendWorkflowRun(e),
|
|
@@ -2292,13 +2348,13 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
2292
2348
|
inspectRetryWorkflowRun: (e) => K().inspectRetryWorkflowRun(e),
|
|
2293
2349
|
inspectSignalWorkflowRun: (e) => K().inspectSignalWorkflowRun(e),
|
|
2294
2350
|
inspectUpdateWorkflowRun: (e) => K().inspectUpdateWorkflowRun(e),
|
|
2295
|
-
inspectInferences: (e) =>
|
|
2296
|
-
store:
|
|
2297
|
-
active: (
|
|
2351
|
+
inspectInferences: (e) => rt({
|
|
2352
|
+
store: T,
|
|
2353
|
+
active: (S.workflows?.length ?? 0) > 0,
|
|
2298
2354
|
dispatcher: () => q.inferenceHealth()
|
|
2299
2355
|
}, e.limit === void 0 ? {} : { limit: e.limit }),
|
|
2300
|
-
...
|
|
2301
|
-
store:
|
|
2356
|
+
...P({
|
|
2357
|
+
store: T,
|
|
2302
2358
|
cancelRun: async (e) => await q.runCanceller()?.(e) ?? !1,
|
|
2303
2359
|
retryRun: async (e) => K().inspectRetryWorkflowRun({ runId: e }),
|
|
2304
2360
|
redriveRun: async (e) => q.redriveWorkflowRun({ runId: e }),
|
|
@@ -2306,180 +2362,183 @@ var va = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy <
|
|
|
2306
2362
|
}),
|
|
2307
2363
|
inspectRedriveWorkflowRun: (e) => q.redriveWorkflowRun(e),
|
|
2308
2364
|
inspectResumeWorkflowRunFromStep: (e) => q.resumeWorkflowRunFromStep(e)
|
|
2309
|
-
},
|
|
2310
|
-
let e = await
|
|
2311
|
-
return
|
|
2312
|
-
tables:
|
|
2313
|
-
sqlLayer: e.makeSqlLayer(
|
|
2314
|
-
dialect:
|
|
2365
|
+
}, Mi = (process.env.VOLTRO_TENANT_ISOLATION ?? h?.tenancy?.isolation) === "namespace", Ni = Mi && v !== "memory" ? await (async () => {
|
|
2366
|
+
let e = await vn(v);
|
|
2367
|
+
return Zt({
|
|
2368
|
+
tables: w,
|
|
2369
|
+
sqlLayer: e.makeSqlLayer(j()),
|
|
2370
|
+
dialect: v,
|
|
2315
2371
|
options: { retryFilter: e.retryFilter },
|
|
2316
2372
|
log: {
|
|
2317
2373
|
info: (e, t) => $.info(e, t),
|
|
2318
2374
|
error: (e, t, n) => $.error(e, t ?? {}, n)
|
|
2319
2375
|
}
|
|
2320
2376
|
});
|
|
2321
|
-
})() : void 0,
|
|
2322
|
-
input:
|
|
2323
|
-
namespaceIsolationOn:
|
|
2324
|
-
makeStoreForUrl: (e, t) =>
|
|
2377
|
+
})() : void 0, Fi = await D({
|
|
2378
|
+
input: h?.tenancy?.residency,
|
|
2379
|
+
namespaceIsolationOn: Mi,
|
|
2380
|
+
makeStoreForUrl: (e, t) => gt(h, void 0, yn(j(), t)),
|
|
2325
2381
|
log: {
|
|
2326
2382
|
info: (e, t) => $.info(e, t),
|
|
2327
2383
|
warn: (e, t) => $.warn(e, t)
|
|
2328
2384
|
}
|
|
2329
2385
|
});
|
|
2330
|
-
|
|
2331
|
-
await
|
|
2386
|
+
Fi !== void 0 && G(async () => {
|
|
2387
|
+
await Fi.close();
|
|
2332
2388
|
});
|
|
2333
|
-
let q = await
|
|
2389
|
+
let q = await Go({
|
|
2334
2390
|
bootTiming: u,
|
|
2335
|
-
claimChange:
|
|
2336
|
-
broadcastNamespace:
|
|
2391
|
+
claimChange: or.claim,
|
|
2392
|
+
broadcastNamespace: Xn,
|
|
2337
2393
|
scheduling: (() => {
|
|
2338
|
-
let e =
|
|
2394
|
+
let e = _n;
|
|
2339
2395
|
return {
|
|
2340
2396
|
admissionDrainMs: e.admissionDrainMs,
|
|
2341
2397
|
inferenceTickMs: e.inferenceTickMs,
|
|
2342
2398
|
cancelSweepMs: e.cancelSweepMs,
|
|
2343
2399
|
stalenessSweepMs: e.stalenessSweepMs,
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2400
|
+
scheduleHeartbeatMs: e.scheduleHeartbeatMs,
|
|
2401
|
+
disarmWhenIdle: Yt({
|
|
2402
|
+
changeScope: T.changeScope,
|
|
2403
|
+
broadcastAttached: gr !== void 0
|
|
2347
2404
|
})
|
|
2348
2405
|
};
|
|
2349
2406
|
})(),
|
|
2350
|
-
...
|
|
2351
|
-
...
|
|
2352
|
-
workflowRecording:
|
|
2407
|
+
...h?.workflows?.staleness === void 0 ? {} : { workflowStaleness: h.workflows.staleness },
|
|
2408
|
+
...h?.workflows?.suspendSignalHintMs === void 0 ? {} : { workflowSuspendSignalHintMs: h.workflows.suspendSignalHintMs },
|
|
2409
|
+
workflowRecording: se(h?.workflows?.recording),
|
|
2353
2410
|
membership: {
|
|
2354
|
-
...
|
|
2355
|
-
instanceId:
|
|
2411
|
+
...I,
|
|
2412
|
+
instanceId: Jn
|
|
2356
2413
|
},
|
|
2357
2414
|
security: {
|
|
2358
|
-
defaultDeny:
|
|
2359
|
-
...
|
|
2415
|
+
defaultDeny: Je(h),
|
|
2416
|
+
...pe(h)
|
|
2360
2417
|
},
|
|
2361
|
-
approvals: { defaultExpiryMs:
|
|
2362
|
-
...
|
|
2363
|
-
...
|
|
2364
|
-
restRoutes:
|
|
2365
|
-
...
|
|
2366
|
-
config:
|
|
2367
|
-
root:
|
|
2418
|
+
approvals: { defaultExpiryMs: k(h) },
|
|
2419
|
+
...h?.plugins === void 0 ? {} : { plugins: h.plugins },
|
|
2420
|
+
...N ? { idempotency: N } : {},
|
|
2421
|
+
restRoutes: H,
|
|
2422
|
+
...h?.grpc === void 0 ? {} : { grpc: {
|
|
2423
|
+
config: h.grpc,
|
|
2424
|
+
root: f
|
|
2368
2425
|
} },
|
|
2369
|
-
appProcedures:
|
|
2426
|
+
appProcedures: Ee,
|
|
2370
2427
|
discovered: {
|
|
2371
|
-
wsGateways:
|
|
2372
|
-
queries: [...
|
|
2373
|
-
mutations:
|
|
2374
|
-
actions: [...
|
|
2375
|
-
streams:
|
|
2376
|
-
events:
|
|
2377
|
-
workflows:
|
|
2378
|
-
workflowWorkers:
|
|
2379
|
-
eventTriggers:
|
|
2380
|
-
schedules:
|
|
2381
|
-
subscribers:
|
|
2382
|
-
outboxHandlers:
|
|
2383
|
-
connections:
|
|
2384
|
-
reactions:
|
|
2385
|
-
aggregates:
|
|
2386
|
-
expectations:
|
|
2387
|
-
budgets:
|
|
2388
|
-
experiments:
|
|
2389
|
-
...
|
|
2428
|
+
wsGateways: S.wsGateways,
|
|
2429
|
+
queries: [...S.queries, ...wi],
|
|
2430
|
+
mutations: S.mutations,
|
|
2431
|
+
actions: [...S.actions, ...Ci],
|
|
2432
|
+
streams: S.streams,
|
|
2433
|
+
events: S.events,
|
|
2434
|
+
workflows: S.workflows,
|
|
2435
|
+
workflowWorkers: S.workflowWorkers,
|
|
2436
|
+
eventTriggers: S.eventTriggers,
|
|
2437
|
+
schedules: Fr,
|
|
2438
|
+
subscribers: Jr,
|
|
2439
|
+
outboxHandlers: li,
|
|
2440
|
+
connections: S.connections,
|
|
2441
|
+
reactions: ni,
|
|
2442
|
+
aggregates: pi,
|
|
2443
|
+
expectations: _i,
|
|
2444
|
+
budgets: yi,
|
|
2445
|
+
experiments: Si,
|
|
2446
|
+
...ze === void 0 ? {} : { webhooks: ze }
|
|
2390
2447
|
},
|
|
2391
2448
|
log: $,
|
|
2392
|
-
analytics:
|
|
2393
|
-
aggregateStorage:
|
|
2394
|
-
aggregateCoordinator:
|
|
2395
|
-
store:
|
|
2396
|
-
kv:
|
|
2397
|
-
cache:
|
|
2398
|
-
snapshotCache:
|
|
2399
|
-
...
|
|
2400
|
-
schemaRegistry:
|
|
2401
|
-
tenantScopedTables:
|
|
2402
|
-
softDeleteScopedTables:
|
|
2403
|
-
dataTransferSnapshot:
|
|
2404
|
-
dataTransferDialect:
|
|
2405
|
-
...
|
|
2406
|
-
...
|
|
2407
|
-
tenantIsolation: (process.env.VOLTRO_TENANT_ISOLATION ??
|
|
2408
|
-
resolveSubject: (e, t) =>
|
|
2449
|
+
analytics: $e.sink,
|
|
2450
|
+
aggregateStorage: mi,
|
|
2451
|
+
aggregateCoordinator: hi,
|
|
2452
|
+
store: T,
|
|
2453
|
+
kv: zt,
|
|
2454
|
+
cache: St,
|
|
2455
|
+
snapshotCache: mt,
|
|
2456
|
+
...h?.reactive === void 0 ? {} : { reactive: h.reactive },
|
|
2457
|
+
schemaRegistry: nt,
|
|
2458
|
+
tenantScopedTables: S.tenantScopedTables,
|
|
2459
|
+
softDeleteScopedTables: S.softDeleteScopedTables,
|
|
2460
|
+
dataTransferSnapshot: Ki(w, v),
|
|
2461
|
+
dataTransferDialect: v,
|
|
2462
|
+
...Ni === void 0 ? {} : { ensureTenantProvisioned: Ni.ensure },
|
|
2463
|
+
...Fi === void 0 ? {} : { resolveResidentStore: Fi.resolveStore },
|
|
2464
|
+
tenantIsolation: (process.env.VOLTRO_TENANT_ISOLATION ?? h?.tenancy?.isolation) === "namespace" ? "namespace" : "shared-schema",
|
|
2465
|
+
resolveSubject: (e, t) => wr({
|
|
2409
2466
|
headers: e,
|
|
2410
2467
|
clientId: t
|
|
2411
2468
|
}),
|
|
2412
|
-
...
|
|
2413
|
-
...
|
|
2414
|
-
httpRoutes:
|
|
2415
|
-
getStore: () =>
|
|
2416
|
-
...
|
|
2417
|
-
...
|
|
2418
|
-
scheduleDefaultTrigger:
|
|
2419
|
-
scheduleCoordination:
|
|
2420
|
-
scheduleArmSelf: !
|
|
2421
|
-
dormancy: process.env.VOLTRO_DORMANCY === "sleep" || process.env.VOLTRO_DORMANCY === "always-on" ? process.env.VOLTRO_DORMANCY :
|
|
2422
|
-
scheduleReplicaId:
|
|
2423
|
-
...
|
|
2469
|
+
...h?.auth === void 0 ? {} : { authority: h.auth },
|
|
2470
|
+
...h?.agents === void 0 ? {} : { agents: h.agents },
|
|
2471
|
+
httpRoutes: F.flatMap((e) => e.httpRoutes ?? []),
|
|
2472
|
+
getStore: () => at,
|
|
2473
|
+
...Pr ? { baseLayer: Pr } : {},
|
|
2474
|
+
...Kr === void 0 ? {} : { workflowEngineLayer: Kr },
|
|
2475
|
+
scheduleDefaultTrigger: Lr,
|
|
2476
|
+
scheduleCoordination: Ur,
|
|
2477
|
+
scheduleArmSelf: !Hr,
|
|
2478
|
+
dormancy: process.env.VOLTRO_DORMANCY === "sleep" || process.env.VOLTRO_DORMANCY === "always-on" ? process.env.VOLTRO_DORMANCY : h?.dormancy ?? "always-on",
|
|
2479
|
+
scheduleReplicaId: Ar(),
|
|
2480
|
+
...W === void 0 ? {} : { scheduleFireInterceptor: W },
|
|
2424
2481
|
onSchedulerReady: (e) => {
|
|
2425
|
-
|
|
2482
|
+
Wr = e;
|
|
2426
2483
|
},
|
|
2427
|
-
inspectStream:
|
|
2428
|
-
inspectRoute: { handle: async (e, t, n, r) => await
|
|
2484
|
+
inspectStream: He(rr),
|
|
2485
|
+
inspectRoute: { handle: async (e, t, n, r) => R.logs.on && n === "GET" && (e === "/_voltro/inspect/logs" || e.startsWith("/_voltro/inspect/logs?")) ? un(e, sn(), t) : R.traces.on && n === "GET" && (e === "/_voltro/inspect/traces" || e.startsWith("/_voltro/inspect/traces?")) ? Ve(e, je()) : await xt(e, Ai, t, {
|
|
2429
2486
|
method: n,
|
|
2430
2487
|
...r === void 0 ? {} : { body: r },
|
|
2431
|
-
...
|
|
2432
|
-
}) || ((n === "GET" ? await
|
|
2488
|
+
...ir()
|
|
2489
|
+
}) || ((n === "GET" ? await pn(e, Ai, t, {
|
|
2433
2490
|
method: n,
|
|
2434
|
-
...
|
|
2435
|
-
}) : null) ??
|
|
2491
|
+
...ir()
|
|
2492
|
+
}) : null) ?? fn(e, Ai, t, {
|
|
2436
2493
|
method: n,
|
|
2437
2494
|
...r === void 0 ? {} : { body: r },
|
|
2438
|
-
...
|
|
2495
|
+
...ir()
|
|
2439
2496
|
}) ?? {
|
|
2440
2497
|
status: 404,
|
|
2441
2498
|
contentType: "application/json",
|
|
2442
2499
|
body: JSON.stringify({ error: "not an inspect route" })
|
|
2443
2500
|
}) },
|
|
2444
|
-
...
|
|
2445
|
-
observability:
|
|
2446
|
-
|
|
2447
|
-
...
|
|
2448
|
-
|
|
2501
|
+
...h?.name === void 0 ? {} : { appName: h.name },
|
|
2502
|
+
observability: ur,
|
|
2503
|
+
...h?.health === void 0 ? {} : { health: h.health },
|
|
2504
|
+
...pr === void 0 ? {} : { traceSink: pr },
|
|
2505
|
+
port: ce,
|
|
2506
|
+
...h?.transport?.wsPath ? { path: h.transport.wsPath } : {},
|
|
2507
|
+
...h?.http === void 0 ? {} : { http: h.http }
|
|
2449
2508
|
});
|
|
2450
|
-
|
|
2451
|
-
let
|
|
2452
|
-
|
|
2453
|
-
},
|
|
2454
|
-
return
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2509
|
+
mr = q.dispatcher;
|
|
2510
|
+
let Ii = () => {
|
|
2511
|
+
rr.emit("subscriptions", ne(() => mr));
|
|
2512
|
+
}, zi = q.dispatcher.onSubscriptionsChange(Ii);
|
|
2513
|
+
return Ii(), ee(tn([
|
|
2514
|
+
S.queries,
|
|
2515
|
+
S.mutations,
|
|
2516
|
+
S.actions,
|
|
2517
|
+
S.streams
|
|
2459
2518
|
]), (e) => {
|
|
2460
2519
|
$.warn(e);
|
|
2461
|
-
}), $.info(`API listening on :${
|
|
2462
|
-
dialect:
|
|
2463
|
-
queries:
|
|
2464
|
-
mutations:
|
|
2465
|
-
actions:
|
|
2466
|
-
streams:
|
|
2467
|
-
workflows:
|
|
2468
|
-
workflowWorkers:
|
|
2469
|
-
schedules:
|
|
2470
|
-
scheduleCoordination:
|
|
2471
|
-
}), u.finish($),
|
|
2472
|
-
for (let e of
|
|
2473
|
-
|
|
2520
|
+
}), $.info(`API listening on :${ce}`, {
|
|
2521
|
+
dialect: v,
|
|
2522
|
+
queries: S.queries.length,
|
|
2523
|
+
mutations: S.mutations.length,
|
|
2524
|
+
actions: S.actions.length,
|
|
2525
|
+
streams: S.streams.length,
|
|
2526
|
+
workflows: S.workflows.length,
|
|
2527
|
+
workflowWorkers: S.workflowWorkers.length,
|
|
2528
|
+
schedules: Fr.length,
|
|
2529
|
+
scheduleCoordination: Ur
|
|
2530
|
+
}), u.finish($), G(async () => {
|
|
2531
|
+
for (let e of Wn) e.stop();
|
|
2532
|
+
Kt.stop(), zi(), z.stop();
|
|
2474
2533
|
try {
|
|
2475
|
-
await q.close(),
|
|
2476
|
-
mirror:
|
|
2534
|
+
await q.close(), Mt(), $t?.dispose(), await lr.deactivate(), await gr?.close(), await ut({
|
|
2535
|
+
mirror: Ht,
|
|
2477
2536
|
log: $
|
|
2478
|
-
}), await
|
|
2537
|
+
}), await $e.dispose(), await T.close?.();
|
|
2479
2538
|
} catch (e) {
|
|
2480
2539
|
console.error("serve: shutdown step failed, exiting anyway:", e);
|
|
2481
2540
|
}
|
|
2482
2541
|
}), await new Promise(() => {}), 0;
|
|
2483
2542
|
};
|
|
2484
2543
|
//#endregion
|
|
2485
|
-
export {
|
|
2544
|
+
export { Zo as n, Yo as r, Qo as t };
|