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