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