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