@voltro/cli 0.13.0 → 0.15.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 +412 -0
- package/dist/{apiBuild-B6_ehbem.js → apiBuild-CHItlwPO.js} +2 -2
- package/dist/apiBuild-D8juhYsS.js +2 -0
- package/dist/bin.js +3 -3
- package/dist/{commands-DYOuGlEC.js → commands-CPQuQRXh.js} +3967 -2831
- package/dist/{dbCommand-DIOJQwsq.js → dbCommand-B8F29zV0.js} +2 -1
- package/dist/dbCommand-Dt7BtdMd.js +2 -0
- package/dist/{dev-xdijqojc.js → dev-BHLM3RPX.js} +1 -1
- package/dist/{dev-Fb9BmavX.js → dev-C2lCUhYI.js} +1478 -1347
- package/dist/fileConventions-Cu0tM-Bl.js +29 -0
- package/dist/{frameworkTableAssembly-CYlrafoK.js → frameworkTableAssembly-BA2bAmYN.js} +164 -163
- package/dist/frameworkTableAssembly-D1zJSgOU.js +2 -0
- package/dist/index.js +1 -1
- package/dist/{inspectMetrics-DOiiII34.js → inspectMetrics-CYDSO3za.js} +955 -945
- package/dist/{serveCommand-CqYxzBZR.js → serveCommand-DBzQcCuv.js} +410 -396
- package/dist/serveEntry.js +2 -2
- package/dist/{start-CjG_0xhR.js → start-BtgatJN3.js} +246 -246
- package/dist/startEntry.js +2 -2
- package/package.json +17 -17
- package/templates/AGENTS.core.md +77 -3
- package/templates/AGENTS.md +78 -4
- package/templates/agent-docs/_index.md +1 -1
- package/templates/agent-docs/_manifest.json +2 -2
- package/templates/agent-docs/authentication.md +34 -2
- package/templates/agent-docs/cli.md +116 -2
- package/templates/agent-docs/data.md +195 -3
- package/templates/agent-docs/database/hosting.md +2 -2
- package/templates/agent-docs/database/migrations.md +77 -3
- package/templates/agent-docs/database/overview.md +11 -0
- package/templates/agent-docs/database/seedsdialects.md +53 -1
- package/templates/agent-docs/internationalization.md +3 -3
- package/templates/agent-docs/introduction.md +133 -2
- package/templates/agent-docs/plugins.md +2 -1
- package/templates/agent-docs/reference.md +4 -4
- package/templates/agent-docs/routing.md +48 -43
- package/templates/agent-docs/schema-driven-ui.md +14 -3
- package/templates/agent-docs/templates/apibackends.md +1 -8
- package/templates/agent-docs/templates/appshells.md +24 -24
- package/templates/agent-docs/testing.md +16 -1
- package/templates/agent-docs/whats-new.md +247 -39
- package/templates/apps/api-ai/database/schema.ts +0 -2
- package/templates/apps/api-ai/package.json +7 -7
- package/templates/apps/api-auth/package.json +8 -8
- package/templates/apps/api-backend/database/schema.ts +0 -3
- package/templates/apps/api-backend/package.json +7 -7
- package/templates/apps/api-backend-deactivation/database/schema.ts +0 -1
- package/templates/apps/api-backend-deactivation/package.json +7 -7
- package/templates/apps/api-backend-mail/database/schema.ts +0 -3
- package/templates/apps/api-backend-mail/package.json +8 -8
- package/templates/apps/api-backend-mariadb/database/schema.ts +0 -3
- package/templates/apps/api-backend-mariadb/package.json +9 -9
- package/templates/apps/api-backend-storage/database/schema.ts +0 -3
- package/templates/apps/api-backend-storage/package.json +8 -8
- package/templates/apps/api-data-advanced/database/authors.entity.ts +0 -2
- package/templates/apps/api-data-advanced/database/books.entity.ts +0 -1
- package/templates/apps/api-data-advanced/package.json +8 -8
- package/templates/apps/api-durable/database/schema.ts +0 -3
- package/templates/apps/api-durable/package.json +8 -8
- package/templates/apps/api-feature-flags/database/schema.ts +0 -1
- package/templates/apps/api-feature-flags/package.json +9 -9
- package/templates/apps/api-governance/database/schema.ts +0 -1
- package/templates/apps/api-governance/package.json +8 -8
- package/templates/apps/api-kv/database/schema.ts +0 -3
- package/templates/apps/api-kv/package.json +8 -8
- package/templates/apps/api-moderation/database/schema.ts +0 -2
- package/templates/apps/api-moderation/package.json +8 -8
- package/templates/apps/api-observability/database/schema.ts +0 -1
- package/templates/apps/api-observability/package.json +8 -8
- package/templates/apps/api-ratelimit/database/schema.ts +0 -1
- package/templates/apps/api-ratelimit/package.json +8 -8
- package/templates/apps/api-rbac/database/schema.ts +0 -2
- package/templates/apps/api-rbac/package.json +8 -8
- package/templates/apps/api-rest/database/schema.ts +0 -3
- package/templates/apps/api-rest/package.json +7 -7
- package/templates/apps/api-saas/database/schema.ts +0 -1
- package/templates/apps/api-saas/package.json +11 -11
- package/templates/apps/api-search/database/schema.ts +0 -1
- package/templates/apps/api-search/package.json +8 -8
- package/templates/apps/api-versioning/database/schema.ts +0 -1
- package/templates/apps/api-versioning/package.json +8 -8
- package/templates/apps/api-webhooks/database/schema.ts +0 -1
- package/templates/apps/api-webhooks/package.json +9 -9
- package/templates/apps/changelog/package.json +6 -6
- package/templates/apps/changelog/src/pages/[locale]/{[slug].tsx → [slug].page.tsx} +2 -2
- package/templates/apps/changelog/src/pages/[locale]/{index.tsx → index.page.tsx} +2 -2
- package/templates/apps/changelog/src/pages/[locale]/mirrors.test.tsx +2 -2
- package/templates/apps/changelog/src/pages/{[slug].test.tsx → [slug].page.test.tsx} +1 -1
- package/templates/apps/changelog/src/pages/{index.test.tsx → index.page.test.tsx} +1 -1
- package/templates/apps/edge-functions/package.json +2 -2
- package/templates/apps/frontend-admin/package.json +8 -8
- package/templates/apps/frontend-admin/src/pages/(marketing)/{index.test.tsx → index.page.test.tsx} +1 -1
- package/templates/apps/frontend-admin/src/pages/(marketing)/{login.test.tsx → login.page.test.tsx} +1 -1
- package/templates/apps/frontend-admin/src/pages/admin/entity.test.tsx +1 -1
- package/templates/apps/frontend-admin/src/pages/admin/{index.test.tsx → index.page.test.tsx} +1 -1
- package/templates/apps/frontend-app/package.json +8 -8
- package/templates/apps/frontend-app/src/pages/{index.test.tsx → index.page.test.tsx} +1 -1
- package/templates/apps/frontend-app/src/pages/{schema-ui.test.tsx → schema-ui.page.test.tsx} +1 -1
- package/templates/apps/frontend-blank/package.json +7 -7
- package/templates/apps/frontend-blank/src/pages/{index.test.tsx → index.page.test.tsx} +1 -1
- package/templates/apps/frontend-contact/package.json +7 -7
- package/templates/apps/frontend-contact/src/pages/[locale]/{index.tsx → index.page.tsx} +2 -2
- package/templates/apps/frontend-contact/src/pages/{index.test.tsx → index.page.test.tsx} +1 -1
- package/templates/apps/frontend-dashboard/package.json +7 -7
- package/templates/apps/frontend-dashboard/src/pages/(marketing)/{index.test.tsx → index.page.test.tsx} +1 -1
- package/templates/apps/frontend-dashboard/src/pages/(marketing)/{login.test.tsx → login.page.test.tsx} +1 -1
- package/templates/apps/frontend-dashboard/src/pages/dashboard/{index.test.tsx → index.page.test.tsx} +1 -1
- package/templates/apps/frontend-dashboard/src/pages/dashboard/{settings.test.tsx → settings.page.test.tsx} +1 -1
- package/templates/apps/frontend-docs/package.json +7 -7
- package/templates/apps/frontend-docs/src/pages/[locale]/docs/{[...slug].tsx → [...slug].page.tsx} +3 -3
- package/templates/apps/frontend-docs/src/pages/[locale]/{index.tsx → index.page.tsx} +2 -2
- package/templates/apps/frontend-docs/src/pages/[locale]/mirrors.test.tsx +2 -2
- package/templates/apps/frontend-docs/src/pages/docs/{[...slug].test.tsx → [...slug].page.test.tsx} +1 -1
- package/templates/apps/frontend-docs/src/pages/{index.test.tsx → index.page.test.tsx} +1 -1
- package/templates/apps/frontend-i18n/package.json +6 -6
- package/templates/apps/frontend-i18n/src/pages/[locale]/{about.tsx → about.page.tsx} +2 -2
- package/templates/apps/frontend-i18n/src/pages/[locale]/{index.tsx → index.page.tsx} +2 -2
- package/templates/apps/frontend-i18n/src/pages/[locale]/mirrors.test.tsx +2 -2
- package/templates/apps/frontend-i18n/src/pages/{about.test.tsx → about.page.test.tsx} +1 -1
- package/templates/apps/frontend-i18n/src/pages/{index.test.tsx → index.page.test.tsx} +1 -1
- package/templates/apps/frontend-landing/package.json +7 -7
- package/templates/apps/frontend-landing/src/pages/[locale]/{index.tsx → index.page.tsx} +2 -2
- package/templates/apps/frontend-landing/src/pages/[locale]/mirrors.test.tsx +1 -1
- package/templates/apps/frontend-landing/src/pages/{index.test.tsx → index.page.test.tsx} +1 -1
- package/templates/apps/frontend-spa/package.json +7 -7
- package/templates/apps/frontend-spa/src/pages/{index.test.tsx → index.page.test.tsx} +1 -1
- package/templates/apps/frontend-ssr/package.json +7 -7
- package/templates/apps/frontend-ssr/src/pages/{feed-swr.test.tsx → feed-swr.page.test.tsx} +1 -1
- package/templates/apps/frontend-ssr/src/pages/{feed.test.tsx → feed.page.test.tsx} +1 -1
- package/templates/apps/frontend-ssr/src/pages/{index.test.tsx → index.page.test.tsx} +1 -1
- package/templates/apps/frontend-ssr-api/package.json +8 -8
- package/templates/apps/frontend-ssr-api/src/pages/{index.test.tsx → index.page.test.tsx} +1 -1
- package/templates/apps/frontend-static-blog/package.json +6 -6
- package/templates/apps/frontend-static-blog/src/pages/[locale]/blog/{[slug].tsx → [slug].page.tsx} +2 -2
- package/templates/apps/frontend-static-blog/src/pages/[locale]/{index.tsx → index.page.tsx} +2 -2
- package/templates/apps/frontend-static-blog/src/pages/[locale]/mirrors.test.tsx +2 -2
- package/templates/apps/frontend-static-blog/src/pages/blog/{[slug].test.tsx → [slug].page.test.tsx} +1 -1
- package/templates/apps/frontend-static-blog/src/pages/{index.test.tsx → index.page.test.tsx} +1 -1
- package/dist/apiBuild-Bzpb383i.js +0 -2
- package/dist/dbCommand-ADD4mrTI.js +0 -2
- package/dist/frameworkTableAssembly-XvKO7wQt.js +0 -2
- /package/templates/apps/changelog/src/pages/{[slug].tsx → [slug].page.tsx} +0 -0
- /package/templates/apps/changelog/src/pages/{index.tsx → index.page.tsx} +0 -0
- /package/templates/apps/frontend-admin/src/pages/(marketing)/{index.tsx → index.page.tsx} +0 -0
- /package/templates/apps/frontend-admin/src/pages/(marketing)/{login.tsx → login.page.tsx} +0 -0
- /package/templates/apps/frontend-admin/src/pages/admin/{[entity].tsx → [entity].page.tsx} +0 -0
- /package/templates/apps/frontend-admin/src/pages/admin/{index.tsx → index.page.tsx} +0 -0
- /package/templates/apps/frontend-app/src/pages/{index.tsx → index.page.tsx} +0 -0
- /package/templates/apps/frontend-app/src/pages/{schema-ui.tsx → schema-ui.page.tsx} +0 -0
- /package/templates/apps/frontend-blank/src/pages/{index.tsx → index.page.tsx} +0 -0
- /package/templates/apps/frontend-contact/src/pages/{index.tsx → index.page.tsx} +0 -0
- /package/templates/apps/frontend-dashboard/src/pages/(marketing)/{index.tsx → index.page.tsx} +0 -0
- /package/templates/apps/frontend-dashboard/src/pages/(marketing)/{login.tsx → login.page.tsx} +0 -0
- /package/templates/apps/frontend-dashboard/src/pages/dashboard/{index.tsx → index.page.tsx} +0 -0
- /package/templates/apps/frontend-dashboard/src/pages/dashboard/{settings.tsx → settings.page.tsx} +0 -0
- /package/templates/apps/frontend-docs/src/pages/docs/{[...slug].tsx → [...slug].page.tsx} +0 -0
- /package/templates/apps/frontend-docs/src/pages/{index.tsx → index.page.tsx} +0 -0
- /package/templates/apps/frontend-i18n/src/pages/{about.tsx → about.page.tsx} +0 -0
- /package/templates/apps/frontend-i18n/src/pages/{index.tsx → index.page.tsx} +0 -0
- /package/templates/apps/frontend-landing/src/pages/{index.tsx → index.page.tsx} +0 -0
- /package/templates/apps/frontend-spa/src/pages/{index.tsx → index.page.tsx} +0 -0
- /package/templates/apps/frontend-ssr/src/pages/{feed-swr.tsx → feed-swr.page.tsx} +0 -0
- /package/templates/apps/frontend-ssr/src/pages/{feed.tsx → feed.page.tsx} +0 -0
- /package/templates/apps/frontend-ssr/src/pages/{index.tsx → index.page.tsx} +0 -0
- /package/templates/apps/frontend-ssr-api/src/pages/{index.tsx → index.page.tsx} +0 -0
- /package/templates/apps/frontend-static-blog/src/pages/blog/{[slug].tsx → [slug].page.tsx} +0 -0
- /package/templates/apps/frontend-static-blog/src/pages/{index.tsx → index.page.tsx} +0 -0
|
@@ -1,49 +1,50 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ct as e, t } from "./inspectMetrics-CYDSO3za.js";
|
|
2
2
|
import { s as n } from "./seedRunner-D6eu-u5U.js";
|
|
3
3
|
import { r, t as i } from "./appModuleLoader-C9r9mxZt.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
4
|
+
import { f as a, m as o, n as s, p as c, u as l } from "./frameworkTableAssembly-BA2bAmYN.js";
|
|
5
|
+
import { l as u } from "./fileConventions-Cu0tM-Bl.js";
|
|
6
|
+
import { $ as d, A as ee, B as f, C as te, D as ne, E as re, F as p, H as ie, I as m, J as h, K as ae, L as oe, M as g, N as _, O as se, P as v, Q as y, S as ce, T as le, V as ue, X as de, Y as b, Z as x, _ as fe, a as S, b as C, c as pe, et as me, f as w, g as he, h as ge, j as _e, k as ve, n as ye, p as T, q as be, r as xe, s as Se, v as Ce, w as we, x as Te, y as E, z as Ee } from "./dev-C2lCUhYI.js";
|
|
7
|
+
import { c as D, r as De } from "./apiBuild-CHItlwPO.js";
|
|
8
|
+
import { t as Oe } from "./bootTiming-BdyP9nYw.js";
|
|
9
|
+
import { n as ke } from "./cliArgs-qdZSElM3.js";
|
|
10
|
+
import { join as Ae } from "node:path";
|
|
11
|
+
import { pathToFileURL as je } from "node:url";
|
|
12
|
+
import { Cause as O, Effect as k, Layer as A, ManagedRuntime as Me } from "effect";
|
|
13
|
+
import { createLogger as j } from "@voltro/logger";
|
|
14
|
+
import { existsSync as M } from "node:fs";
|
|
15
|
+
import { AggregateRegistry as N, Dispatcher as Ne, apiKeyManagementRoutes as Pe, applySoftDeleteScope as Fe, applyTenantScope as Ie, attachAnalyticsMirror as Le, awaitServerListening as Re, bindMutation as P, bindStream as ze, bindSubscription as F, buildTracingLayer as Be, cancelWakeup as Ve, compileCron as He, dataStoreApiKeyStore as Ue, dataStoreIdempotencyStore as We, frameworkApiKeyStrategy as Ge, installPolicyGuardResolver as Ke, loadResourceTuples as I, makeActionRunner as qe, makeAdvisoryLockCoordinator as Je, makeApiKeyService as Ye, makeApiKeyUsageBuffer as L, makeApiKeyUsageFlusher as Xe, makeAsyncKv as Ze, makeCoordinatedScheduler as Qe, makeEffectStoreLayer as R, makeLazyWorkflowFacade as $e, makeMutationRunner as et, makeOneShotQueryRunner as tt, makeQueryDescriptorProducer as nt, makeQueryReauthorizer as rt, makeQuerySubscriber as it, makeSchemaRegistry as at, makeWorkflowFacade as ot, makeWorkflowFacadeWithCallerContext as st, makeWorkflowLayers as z, noopKv as ct, recordSubscriptionDelivery as lt, registerWakeup as ut, resolveSecretsBackend as dt, runProvidedEffect as ft, setSecretsBackend as pt, setSystemStoreHandle as mt, setTupleSource as ht, singleCoordinator as gt, startRpcServer as _t, startScheduler as B, workflowToRpc as vt } from "@voltro/runtime";
|
|
16
|
+
import { RpcGroup as yt } from "@effect/rpc";
|
|
17
|
+
import { SqlClient as bt } from "@effect/sql";
|
|
18
|
+
import { and as xt, ensureTableRegistered as St, eq as V, or as Ct } from "@voltro/database";
|
|
19
|
+
import { appStorageProvider as H, fromNodeReadable as wt, getObjectStream as U, putObjectStream as W, toNodeReadable as Tt } from "@voltro/plugin-storage";
|
|
20
|
+
import { AuthMiddleware as Et, ConnectionInfoMiddleware as Dt, actionToRpc as G, anonymousSubject as Ot, mutationToRpc as kt, queryToRpc as K, streamToRpc as At, workflowCancelDescriptor as jt, workflowDomainEventsQueryDescriptor as q, workflowEventDeliveriesQueryDescriptor as Mt, workflowResumeDescriptor as Nt, workflowRunEventsQueryDescriptor as J, workflowRunQueryDescriptor as Y, workflowRunStepsQueryDescriptor as X, workflowRunsQueryDescriptor as Z, workflowSignalDescriptor as Pt, workflowUpdateDescriptor as Ft } from "@voltro/protocol";
|
|
21
|
+
import { assertProductionSessionSecret as It } from "@voltro/protocol/session";
|
|
22
|
+
import { createHash as Lt, timingSafeEqual as Rt } from "node:crypto";
|
|
23
|
+
import { declaredSnapshot as zt, describeOutcome as Bt, runPlannedMigrations as Vt } from "@voltro/database/sql";
|
|
24
|
+
import { getAuthSessionStrategy as Ht } from "@voltro/plugin-auth";
|
|
25
|
+
import { collectPublicApiRoutes as Ut, restRoutesToHttpRoutes as Wt } from "@voltro/protocol/rest";
|
|
26
|
+
import { buildDeliverWebhookExecute as Gt, buildWebhooksService as Kt, defaultIncomingPath as qt, deliverWebhookWorkflow as Jt, mountIncomingWebhook as Yt } from "@voltro/plugin-webhooks";
|
|
27
|
+
import { packBundle as Xt, runExport as Zt, runImport as Qt, storageBlobSink as $t, storageRefsBlobSource as en, unpackBundle as tn, unpackBundleToDir as nn } from "@voltro/data-transfer";
|
|
27
28
|
//#region src/adminAuth.ts
|
|
28
|
-
var
|
|
29
|
+
var rn = "/_voltro/admin/import", an = "/_voltro/admin/export", Q = (e, t) => ({
|
|
29
30
|
status: e,
|
|
30
31
|
contentType: "application/json; charset=utf-8",
|
|
31
32
|
body: JSON.stringify(t)
|
|
32
|
-
}),
|
|
33
|
+
}), on = (e) => {
|
|
33
34
|
let t = e.authorization ?? e.Authorization, n = t ? /^Bearer\s+(.+)$/i.exec(t) : null;
|
|
34
35
|
return n ? n[1] : null;
|
|
35
|
-
},
|
|
36
|
+
}, sn = (e, t) => Rt(Lt("sha256").update(e).digest(), Lt("sha256").update(t).digest()), cn = (e, t) => {
|
|
36
37
|
if (e.method.toUpperCase() !== "POST") return Q(405, { error: "method not allowed" });
|
|
37
38
|
if (!t || t.length < 16) return Q(503, { error: "data transfer misconfigured (no/weak secret)" });
|
|
38
|
-
let n =
|
|
39
|
-
return !n || !
|
|
40
|
-
},
|
|
39
|
+
let n = on(e.headers);
|
|
40
|
+
return !n || !sn(n, t) ? Q(401, { error: "unauthorized" }) : null;
|
|
41
|
+
}, ln = j({ scope: "voltro:admin-import" }), un = "VBUNDLE2", dn = async function* (e) {
|
|
41
42
|
yield e;
|
|
42
|
-
},
|
|
43
|
-
let n =
|
|
43
|
+
}, fn = (e) => async (t) => {
|
|
44
|
+
let n = cn(t, e.secret);
|
|
44
45
|
if (n) return n;
|
|
45
|
-
let r = t.headers["x-import-mode"], i = t.headers["x-import-on-conflict"], a = t.headers["x-import-atomic"] === "1" || t.headers["x-import-atomic"] === "true", o = t.headers["x-import-force"] === "1" || t.headers["x-import-force"] === "true", s = t.rawBody.byteLength >= 8 && Buffer.from(t.rawBody.subarray(0, 8)).toString("latin1") ===
|
|
46
|
-
if (s) c =
|
|
46
|
+
let r = t.headers["x-import-mode"], i = t.headers["x-import-on-conflict"], a = t.headers["x-import-atomic"] === "1" || t.headers["x-import-atomic"] === "true", o = t.headers["x-import-force"] === "1" || t.headers["x-import-force"] === "true", s = t.rawBody.byteLength >= 8 && Buffer.from(t.rawBody.subarray(0, 8)).toString("latin1") === un, c, l;
|
|
47
|
+
if (s) c = dn(t.rawBody), l = "upload";
|
|
47
48
|
else {
|
|
48
49
|
let n;
|
|
49
50
|
try {
|
|
@@ -55,28 +56,28 @@ var nn = "/_voltro/admin/import", rn = "/_voltro/admin/export", Q = (e, t) => ({
|
|
|
55
56
|
if (!e.openArchive) return Q(501, { error: "storage transport not configured on this instance" });
|
|
56
57
|
c = e.openArchive(n.bundleKey), l = "storage";
|
|
57
58
|
}
|
|
58
|
-
let u = await import("node:os"), d = await import("node:fs/promises"),
|
|
59
|
+
let u = await import("node:os"), d = await import("node:fs/promises"), ee = await import("node:path"), f = await d.mkdtemp(ee.join(u.tmpdir(), "voltro-admin-import-"));
|
|
59
60
|
try {
|
|
60
|
-
e.assetSink ? await
|
|
61
|
-
dir:
|
|
61
|
+
e.assetSink ? await tn(c, {
|
|
62
|
+
dir: f,
|
|
62
63
|
blobs: e.assetSink
|
|
63
|
-
}) : await
|
|
64
|
-
let t = await
|
|
64
|
+
}) : await nn(c, f);
|
|
65
|
+
let t = await k.runPromiseExit(Qt({
|
|
65
66
|
store: e.store,
|
|
66
|
-
bundleDir:
|
|
67
|
+
bundleDir: f,
|
|
67
68
|
...r ? { mode: r } : {},
|
|
68
69
|
...i ? { onConflict: i } : {},
|
|
69
70
|
...a ? { atomic: a } : {},
|
|
70
71
|
...e.snapshot ? { targetSnapshot: e.snapshot } : {},
|
|
71
72
|
force: o,
|
|
72
|
-
onWarn: (e) =>
|
|
73
|
+
onWarn: (e) => ln.warn("admin.import", { message: e }),
|
|
73
74
|
...e.assetSink ? { assetsAlreadyRestored: !0 } : {}
|
|
74
75
|
}));
|
|
75
76
|
if (t._tag === "Failure") {
|
|
76
77
|
let e = t.cause._tag === "Fail" ? t.cause.error : void 0;
|
|
77
78
|
if (e && e._tag === "SchemaDriftError") {
|
|
78
79
|
let t = e;
|
|
79
|
-
return
|
|
80
|
+
return ln.warn("admin.import refused (schema drift)", {
|
|
80
81
|
transport: l,
|
|
81
82
|
bundle: t.bundleFingerprint.slice(0, 16),
|
|
82
83
|
target: t.targetFingerprint.slice(0, 16)
|
|
@@ -91,7 +92,7 @@ var nn = "/_voltro/admin/import", rn = "/_voltro/admin/export", Q = (e, t) => ({
|
|
|
91
92
|
throw Error(String(e?.message ?? e ?? "import failed"));
|
|
92
93
|
}
|
|
93
94
|
let n = t.value, s = n.tables.reduce((e, t) => e + t.rowCount, 0);
|
|
94
|
-
return
|
|
95
|
+
return ln.info("admin.import", {
|
|
95
96
|
transport: l,
|
|
96
97
|
tables: n.tables.length,
|
|
97
98
|
rows: s,
|
|
@@ -103,7 +104,7 @@ var nn = "/_voltro/admin/import", rn = "/_voltro/admin/export", Q = (e, t) => ({
|
|
|
103
104
|
transport: l
|
|
104
105
|
});
|
|
105
106
|
} catch (e) {
|
|
106
|
-
return
|
|
107
|
+
return ln.warn("admin.import failed", {
|
|
107
108
|
transport: l,
|
|
108
109
|
error: e?.message ?? String(e)
|
|
109
110
|
}), Q(500, {
|
|
@@ -111,23 +112,23 @@ var nn = "/_voltro/admin/import", rn = "/_voltro/admin/export", Q = (e, t) => ({
|
|
|
111
112
|
message: e?.message ?? String(e)
|
|
112
113
|
});
|
|
113
114
|
} finally {
|
|
114
|
-
await d.rm(
|
|
115
|
+
await d.rm(f, {
|
|
115
116
|
recursive: !0,
|
|
116
117
|
force: !0
|
|
117
118
|
});
|
|
118
119
|
}
|
|
119
|
-
},
|
|
120
|
+
}, pn = j({ scope: "voltro:admin-export" }), mn = async (e) => {
|
|
120
121
|
let t = [];
|
|
121
122
|
for await (let n of e) t.push(Buffer.from(n));
|
|
122
123
|
return new Uint8Array(Buffer.concat(t));
|
|
123
|
-
},
|
|
124
|
+
}, hn = (e) => typeof e.tenant == "string" && e.tenant ? {
|
|
124
125
|
kind: "tenant",
|
|
125
126
|
tenantId: e.tenant
|
|
126
127
|
} : Array.isArray(e.tables) && e.tables.length ? {
|
|
127
128
|
kind: "tables",
|
|
128
129
|
tables: e.tables.filter((e) => typeof e == "string")
|
|
129
|
-
} : { kind: "all" },
|
|
130
|
-
let n =
|
|
130
|
+
} : { kind: "all" }, gn = (e) => async (t) => {
|
|
131
|
+
let n = cn(t, e.secret);
|
|
131
132
|
if (n) return n;
|
|
132
133
|
let r;
|
|
133
134
|
try {
|
|
@@ -147,13 +148,13 @@ var nn = "/_voltro/admin/import", rn = "/_voltro/admin/export", Q = (e, t) => ({
|
|
|
147
148
|
});
|
|
148
149
|
}
|
|
149
150
|
}
|
|
150
|
-
let a = r.consistency === "snapshot" ? "snapshot" : i.consistency ?? "live", o = (typeof r.compression == "string" ? r.compression : void 0) ?? i.compression, s = i.scope ??
|
|
151
|
+
let a = r.consistency === "snapshot" ? "snapshot" : i.consistency ?? "live", o = (typeof r.compression == "string" ? r.compression : void 0) ?? i.compression, s = i.scope ?? hn(r), c = typeof r.bundleKey == "string" && r.bundleKey.length > 0, l = r.assets === !0 && e.assetSource ? { blobs: e.assetSource } : {}, u = await import("node:os"), d = await import("node:fs/promises"), ee = await import("node:path"), f = await d.mkdtemp(ee.join(u.tmpdir(), "voltro-admin-export-"));
|
|
151
152
|
try {
|
|
152
|
-
let t = await
|
|
153
|
+
let t = await k.runPromise(Zt({
|
|
153
154
|
store: e.store,
|
|
154
155
|
snapshot: e.snapshot,
|
|
155
156
|
dialect: e.dialect,
|
|
156
|
-
outDir:
|
|
157
|
+
outDir: f,
|
|
157
158
|
...i.subset ? { subset: i.subset } : {
|
|
158
159
|
scope: s,
|
|
159
160
|
...e.tenantTables && e.tenantTables.length > 0 ? { tenantTables: e.tenantTables } : {}
|
|
@@ -165,10 +166,10 @@ var nn = "/_voltro/admin/import", rn = "/_voltro/admin/export", Q = (e, t) => ({
|
|
|
165
166
|
if (c) {
|
|
166
167
|
if (!e.putArchive) return Q(501, { error: "storage transport not configured on this instance" });
|
|
167
168
|
let i = r.bundleKey;
|
|
168
|
-
return await e.putArchive(i, () =>
|
|
169
|
-
dir:
|
|
169
|
+
return await e.putArchive(i, () => Xt({
|
|
170
|
+
dir: f,
|
|
170
171
|
...l
|
|
171
|
-
})),
|
|
172
|
+
})), pn.info("admin.export", {
|
|
172
173
|
transport: "storage",
|
|
173
174
|
tables: t.tables.length,
|
|
174
175
|
rows: n,
|
|
@@ -182,11 +183,11 @@ var nn = "/_voltro/admin/import", rn = "/_voltro/admin/export", Q = (e, t) => ({
|
|
|
182
183
|
transport: "storage"
|
|
183
184
|
});
|
|
184
185
|
}
|
|
185
|
-
let d = await
|
|
186
|
-
dir:
|
|
186
|
+
let d = await mn(Xt({
|
|
187
|
+
dir: f,
|
|
187
188
|
...l
|
|
188
189
|
}));
|
|
189
|
-
return
|
|
190
|
+
return pn.info("admin.export", {
|
|
190
191
|
transport: "download",
|
|
191
192
|
tables: t.tables.length,
|
|
192
193
|
rows: n,
|
|
@@ -203,17 +204,17 @@ var nn = "/_voltro/admin/import", rn = "/_voltro/admin/export", Q = (e, t) => ({
|
|
|
203
204
|
}
|
|
204
205
|
};
|
|
205
206
|
} catch (e) {
|
|
206
|
-
return
|
|
207
|
+
return pn.warn("admin.export failed", { error: e?.message ?? String(e) }), Q(500, {
|
|
207
208
|
error: "export failed",
|
|
208
209
|
message: e?.message ?? String(e)
|
|
209
210
|
});
|
|
210
211
|
} finally {
|
|
211
|
-
await d.rm(
|
|
212
|
+
await d.rm(f, {
|
|
212
213
|
recursive: !0,
|
|
213
214
|
force: !0
|
|
214
215
|
});
|
|
215
216
|
}
|
|
216
|
-
},
|
|
217
|
+
}, _n = async (e) => {
|
|
217
218
|
let { resolve: t } = await import("node:path"), { existsSync: n } = await import("node:fs"), r = [
|
|
218
219
|
e,
|
|
219
220
|
`${e}.profile.ts`,
|
|
@@ -224,8 +225,8 @@ var nn = "/_voltro/admin/import", rn = "/_voltro/admin/export", Q = (e, t) => ({
|
|
|
224
225
|
let a = await import(i), o = a.default ?? a.profile;
|
|
225
226
|
if (!o) throw Error(`data profile '${i}' has no default export`);
|
|
226
227
|
return o;
|
|
227
|
-
},
|
|
228
|
-
let r = await
|
|
228
|
+
}, vn = (e, t, n = {}) => (async function* () {
|
|
229
|
+
let r = await Tt((await k.runPromise(U(e, t).pipe(k.timeout(n.openTimeout ?? "30 seconds")))).stream), i = n.stallMs ?? 12e4, a, o = () => {
|
|
229
230
|
a && clearTimeout(a), a = setTimeout(() => r.destroy(/* @__PURE__ */ Error(`storage read stalled for ${i}ms reading '${t}'`)), i);
|
|
230
231
|
};
|
|
231
232
|
try {
|
|
@@ -234,7 +235,7 @@ var nn = "/_voltro/admin/import", rn = "/_voltro/admin/export", Q = (e, t) => ({
|
|
|
234
235
|
} finally {
|
|
235
236
|
a && clearTimeout(a), r.destroy();
|
|
236
237
|
}
|
|
237
|
-
})(),
|
|
238
|
+
})(), yn = {
|
|
238
239
|
get: async () => void 0,
|
|
239
240
|
set: async () => {},
|
|
240
241
|
setWithTags: async () => {},
|
|
@@ -243,21 +244,21 @@ var nn = "/_voltro/admin/import", rn = "/_voltro/admin/export", Q = (e, t) => ({
|
|
|
243
244
|
clear: async () => {},
|
|
244
245
|
invalidateTag: async () => 0,
|
|
245
246
|
wrap: async (e, t, n) => n()
|
|
246
|
-
},
|
|
247
|
-
|
|
247
|
+
}, bn = async (e) => {
|
|
248
|
+
mt({
|
|
248
249
|
dataStore: e.store,
|
|
249
250
|
schemaRegistry: e.schemaRegistry
|
|
250
251
|
});
|
|
251
252
|
let t = new Ne({
|
|
252
253
|
store: e.store,
|
|
253
254
|
...e.snapshotCache ? { cache: e.snapshotCache } : {},
|
|
254
|
-
recordDelivery: (e) =>
|
|
255
|
+
recordDelivery: (e) => lt({
|
|
255
256
|
label: e.label,
|
|
256
257
|
kind: e.kind,
|
|
257
258
|
durationMs: e.durationMs,
|
|
258
259
|
rowCount: e.rowCount
|
|
259
260
|
})
|
|
260
|
-
}), n = e.cache ??
|
|
261
|
+
}), n = e.cache ?? yn, r = e.kv ?? ct, i, a, o, s = /* @__PURE__ */ new Map(), c = () => `wfctx_${globalThis.crypto?.randomUUID?.() ?? `${Date.now().toString(36)}${Math.random().toString(36).slice(2)}`}`, l = async (t, n, r) => {
|
|
261
262
|
let i = {
|
|
262
263
|
...r,
|
|
263
264
|
source: r.source ?? `workflow:${t}`
|
|
@@ -313,29 +314,29 @@ var nn = "/_voltro/admin/import", rn = "/_voltro/admin/export", Q = (e, t) => ({
|
|
|
313
314
|
process.stderr.write(`[workflow] failed to load start context for ${n}: ${e?.message ?? String(e)}\n`);
|
|
314
315
|
return;
|
|
315
316
|
}
|
|
316
|
-
},
|
|
317
|
-
if (
|
|
318
|
-
let t = e.workflowEngineLayer, i =
|
|
317
|
+
}, d = (e.discovered.workflows?.length ?? 0) > 0 ? $e(() => i) : void 0, f = (e.discovered.workflows?.length ?? 0) > 0 || (e.discovered.eventTriggers?.length ?? 0) > 0, te = f || (e.discovered.workflowWorkers?.length ?? 0) > 0 || e.scheduleCoordination === "cluster", ne = e.tenantIsolation === "namespace", re = (e.log ?? j({ scope: "voltro:serve" })).child("webhooks"), ie, h = e.discovered.webhooks;
|
|
318
|
+
if (h && h.outgoing.length > 0 && e.workflowEngineLayer !== void 0) {
|
|
319
|
+
let t = e.workflowEngineLayer, i = x({
|
|
319
320
|
store: e.store,
|
|
320
321
|
schemaRegistry: e.schemaRegistry,
|
|
321
322
|
cache: n,
|
|
322
323
|
kv: r
|
|
323
|
-
}), a =
|
|
324
|
-
|
|
325
|
-
let n =
|
|
326
|
-
|
|
327
|
-
|
|
324
|
+
}), a = h.outgoing.map((e) => e.descriptor);
|
|
325
|
+
ie = Kt(i, async (e) => {
|
|
326
|
+
let n = Jt.execute(e).pipe(k.provide(Jt.toLayer(Gt(i, { events: a })).pipe(A.provideMerge(t))));
|
|
327
|
+
k.runPromise(n).catch((t) => {
|
|
328
|
+
re.error("deliverWebhook workflow crashed", {
|
|
328
329
|
deliveryId: e.deliveryId,
|
|
329
330
|
targetId: e.targetId
|
|
330
331
|
}, t);
|
|
331
332
|
});
|
|
332
333
|
}, { events: a });
|
|
333
334
|
}
|
|
334
|
-
let
|
|
335
|
-
if (
|
|
336
|
-
let t = e.descriptor.path ??
|
|
335
|
+
let oe = /* @__PURE__ */ new Map();
|
|
336
|
+
if (h) for (let e of h.incoming) {
|
|
337
|
+
let t = e.descriptor.path ?? qt(e.descriptor.id), n = `VOLTRO_WEBHOOK_SECRET_${e.descriptor.id.toUpperCase().replace(/[^A-Z0-9]/g, "_")}`, r = Yt(e.descriptor, {
|
|
337
338
|
resolveSecret: async () => process.env[n] ?? null,
|
|
338
|
-
resolveWorkflows: () =>
|
|
339
|
+
resolveWorkflows: () => d === void 0 ? void 0 : st(d, {
|
|
339
340
|
traceId: `incoming:${e.descriptor.id}`,
|
|
340
341
|
source: `incoming:${e.descriptor.id}`
|
|
341
342
|
}),
|
|
@@ -347,74 +348,74 @@ var nn = "/_voltro/admin/import", rn = "/_voltro/admin/export", Q = (e, t) => ({
|
|
|
347
348
|
idempotency: e.idempotency,
|
|
348
349
|
durationMs: e.durationMs
|
|
349
350
|
};
|
|
350
|
-
e.status >= 500 ?
|
|
351
|
+
e.status >= 500 ? re.error("incoming delivery failed", t) : e.status >= 400 ? re.warn("incoming delivery rejected", t) : re.info("incoming delivery handled", t);
|
|
351
352
|
}
|
|
352
353
|
});
|
|
353
|
-
|
|
354
|
+
oe.set(t, { handle: r });
|
|
354
355
|
}
|
|
355
|
-
|
|
356
|
-
let
|
|
356
|
+
Ke(), ht((t) => I(e.store, t.subjectId, t.resourceType, t.resourceId));
|
|
357
|
+
let se = (e.discovered.outboxHandlers?.length ?? 0) > 0 ? p({
|
|
357
358
|
handlers: e.discovered.outboxHandlers ?? [],
|
|
358
359
|
store: e.store,
|
|
359
|
-
log: (e.log ??
|
|
360
|
-
}) : void 0,
|
|
360
|
+
log: (e.log ?? j({ scope: "voltro:serve" })).child("outbox")
|
|
361
|
+
}) : void 0, v = _({
|
|
361
362
|
definitions: (e.discovered.connections ?? []).map((e) => e.definition),
|
|
362
363
|
store: e.store,
|
|
363
|
-
publicUrl:
|
|
364
|
-
log: (e.log ??
|
|
365
|
-
}),
|
|
364
|
+
publicUrl: g(e.port ?? 4e3),
|
|
365
|
+
log: (e.log ?? j({ scope: "voltro:serve" })).child("connections")
|
|
366
|
+
}), y = de({
|
|
366
367
|
store: e.store,
|
|
367
368
|
schemaRegistry: e.schemaRegistry,
|
|
368
369
|
cache: n,
|
|
369
370
|
kv: r,
|
|
370
|
-
...
|
|
371
|
-
...
|
|
371
|
+
...ie === void 0 ? {} : { webhooksService: ie },
|
|
372
|
+
...d === void 0 ? {} : { workflowsProxy: d },
|
|
372
373
|
eventTriggers: e.discovered.eventTriggers ?? [],
|
|
373
|
-
namespaceIsolationOn:
|
|
374
|
-
...
|
|
375
|
-
...
|
|
376
|
-
}), ce =
|
|
377
|
-
let r = t.pipe(
|
|
378
|
-
return
|
|
379
|
-
}, fe =
|
|
374
|
+
namespaceIsolationOn: ne,
|
|
375
|
+
...se === void 0 ? {} : { outbox: { nudge: se.nudge } },
|
|
376
|
+
...v.active ? { connections: { registry: v.registry } } : {}
|
|
377
|
+
}), ce = A.succeed(N, le), ue = (t, n) => {
|
|
378
|
+
let r = t.pipe(k.provide(R(n)));
|
|
379
|
+
return ft((e.baseLayer ? r.pipe(k.provide(e.baseLayer)) : r).pipe(k.provide(ce)));
|
|
380
|
+
}, fe = et({
|
|
380
381
|
store: e.store,
|
|
381
|
-
buildContext: (e, t, n) =>
|
|
382
|
+
buildContext: (e, t, n) => y(e, t, n),
|
|
382
383
|
runEffect: ue,
|
|
383
|
-
undoCapture:
|
|
384
|
-
}),
|
|
385
|
-
buildContext: (e) =>
|
|
384
|
+
undoCapture: C()
|
|
385
|
+
}), S = E(), pe = qe({
|
|
386
|
+
buildContext: (e) => y(e),
|
|
386
387
|
runEffect: ue
|
|
387
388
|
}), me = {
|
|
388
|
-
buildContext: (e) =>
|
|
389
|
-
finalize: (t, n) =>
|
|
390
|
-
provideEffect: (e, t) => e.pipe(
|
|
391
|
-
},
|
|
389
|
+
buildContext: (e) => y(e),
|
|
390
|
+
finalize: (t, n) => Fe(Ie(t, e.tenantScopedTables, n.subject.tenantId), e.softDeleteScopedTables),
|
|
391
|
+
provideEffect: (e, t) => e.pipe(k.provide(R(t)))
|
|
392
|
+
}, w = nt(me), _e = tt({
|
|
392
393
|
...me,
|
|
393
394
|
queryRows: (t) => e.store.query(t)
|
|
394
|
-
}),
|
|
395
|
+
}), ye = it({
|
|
395
396
|
...me,
|
|
396
397
|
subscribeDescriptor: (e, n, r) => t.subscribe(e, n, r),
|
|
397
398
|
subscribeComputed: (e, n, r) => t.subscribeComputed(e, n, r)
|
|
398
399
|
}), T = {};
|
|
399
400
|
for (let n of [
|
|
400
401
|
...e.discovered.queries,
|
|
401
|
-
...
|
|
402
|
-
...
|
|
403
|
-
]) T[n.descriptor.name] = (e) => F(
|
|
402
|
+
...S.queries,
|
|
403
|
+
...v.queries
|
|
404
|
+
]) T[n.descriptor.name] = (e) => F(w(n, e), t, `subscription.${n.descriptor.name}`, void 0, void 0, rt(n, e));
|
|
404
405
|
for (let t of [
|
|
405
406
|
...e.discovered.mutations,
|
|
406
|
-
...
|
|
407
|
-
...
|
|
407
|
+
...S.mutations,
|
|
408
|
+
...v.mutations
|
|
408
409
|
]) T[t.descriptor.name] = (e) => P(async (e, n) => fe(t, e, n), e, `mutation.${t.descriptor.name}`);
|
|
409
|
-
for (let t of [...e.discovered.actions, ...
|
|
410
|
+
for (let t of [...e.discovered.actions, ...v.actions]) T[t.descriptor.name] = (e) => P(async (e, n) => pe(t, e, n), e, `action.${t.descriptor.name}`);
|
|
410
411
|
let be = () => `public-${Math.random().toString(36).slice(2, 10)}`, xe = [
|
|
411
412
|
...e.discovered.queries.filter((e) => e.descriptor.publicApi !== void 0).map((e) => ({
|
|
412
413
|
descriptor: e.descriptor,
|
|
413
|
-
invoke: (t, n) =>
|
|
414
|
+
invoke: (t, n) => _e(e, t, {
|
|
414
415
|
subject: n.subject,
|
|
415
416
|
traceId: be()
|
|
416
417
|
}),
|
|
417
|
-
subscribe: (t, n, r) =>
|
|
418
|
+
subscribe: (t, n, r) => ye(e, t, {
|
|
418
419
|
subject: n.subject,
|
|
419
420
|
traceId: be()
|
|
420
421
|
}, r)
|
|
@@ -428,64 +429,64 @@ var nn = "/_voltro/admin/import", rn = "/_voltro/admin/export", Q = (e, t) => ({
|
|
|
428
429
|
})),
|
|
429
430
|
...e.discovered.actions.filter((e) => e.descriptor.publicApi !== void 0).map((e) => ({
|
|
430
431
|
descriptor: e.descriptor,
|
|
431
|
-
invoke: (t, n) =>
|
|
432
|
+
invoke: (t, n) => pe(e, t, {
|
|
432
433
|
subject: n.subject,
|
|
433
434
|
traceId: be()
|
|
434
435
|
})
|
|
435
436
|
}))
|
|
436
|
-
], Se = xe.length > 0 ? Ut(
|
|
437
|
+
], Se = xe.length > 0 ? Wt(Ut(xe), {
|
|
437
438
|
store: e.store,
|
|
438
439
|
resolveSubject: (t) => e.resolveSubject(t, -1)
|
|
439
|
-
}) : [],
|
|
440
|
+
}) : [], Ce = e.dataTransferSecret ?? process.env.VOLTRO_DATA_TRANSFER_SECRET, Te = Ce && Ce.length >= 16 ? [{
|
|
440
441
|
method: "POST",
|
|
441
|
-
path:
|
|
442
|
-
handle:
|
|
443
|
-
secret:
|
|
442
|
+
path: rn,
|
|
443
|
+
handle: fn({
|
|
444
|
+
secret: Ce,
|
|
444
445
|
store: e.store,
|
|
445
446
|
...e.dataTransferSnapshot ? { snapshot: e.dataTransferSnapshot } : {},
|
|
446
|
-
assetSink:
|
|
447
|
-
openArchive: (e) =>
|
|
447
|
+
assetSink: $t(H()),
|
|
448
|
+
openArchive: (e) => vn(H(), e)
|
|
448
449
|
})
|
|
449
450
|
}, {
|
|
450
451
|
method: "POST",
|
|
451
|
-
path:
|
|
452
|
-
handle:
|
|
453
|
-
secret:
|
|
452
|
+
path: an,
|
|
453
|
+
handle: gn({
|
|
454
|
+
secret: Ce,
|
|
454
455
|
store: e.store,
|
|
455
456
|
snapshot: e.dataTransferSnapshot ?? { tables: [] },
|
|
456
457
|
dialect: e.dataTransferDialect ?? "memory",
|
|
457
458
|
tenantTables: [...e.tenantScopedTables],
|
|
458
|
-
loadProfile:
|
|
459
|
-
assetSource:
|
|
459
|
+
loadProfile: _n,
|
|
460
|
+
assetSource: en(H(), e.store),
|
|
460
461
|
putArchive: async (e, t) => {
|
|
461
|
-
let { Readable: n } = await import("node:stream"), r = H(), i =
|
|
462
|
-
await
|
|
462
|
+
let { Readable: n } = await import("node:stream"), r = H(), i = wt("storage", () => n.from(t()));
|
|
463
|
+
await k.runPromise(W(r, e, i, { contentType: "application/octet-stream" }));
|
|
463
464
|
}
|
|
464
465
|
})
|
|
465
|
-
}] : [],
|
|
466
|
+
}] : [], Ee = [
|
|
466
467
|
...e.httpRoutes ?? [],
|
|
467
468
|
...Se,
|
|
468
469
|
...Te,
|
|
469
|
-
...
|
|
470
|
+
...v.httpRoutes
|
|
470
471
|
];
|
|
471
|
-
for (let t of e.discovered.streams ?? []) T[t.descriptor.name] = (n) =>
|
|
472
|
-
let i =
|
|
473
|
-
if (
|
|
474
|
-
let t = a.pipe(
|
|
475
|
-
return (e.baseLayer ? t.pipe(
|
|
472
|
+
for (let t of e.discovered.streams ?? []) T[t.descriptor.name] = (n) => ze((r) => {
|
|
473
|
+
let i = y(r), a = t.executor(n, i);
|
|
474
|
+
if (k.isEffect(a)) {
|
|
475
|
+
let t = a.pipe(k.provide(R(i.store)));
|
|
476
|
+
return (e.baseLayer ? t.pipe(k.provide(e.baseLayer)) : t).pipe(k.provide(ce));
|
|
476
477
|
}
|
|
477
|
-
return typeof a == "object" && a && typeof a.then == "function" ?
|
|
478
|
+
return typeof a == "object" && a && typeof a.then == "function" ? k.promise(() => a) : a;
|
|
478
479
|
}, `stream.${t.descriptor.name}`);
|
|
479
480
|
for (let t of e.discovered.workflows ?? []) T[t.definition.name] = (e) => P(async (e, n) => {
|
|
480
481
|
let r = n;
|
|
481
|
-
return
|
|
482
|
+
return st(d, {
|
|
482
483
|
subject: r.subject,
|
|
483
484
|
traceId: r.traceId,
|
|
484
485
|
source: "workflow-rpc"
|
|
485
486
|
}).start(t.definition.name, e);
|
|
486
487
|
}, e, `workflow.${t.definition.name}`);
|
|
487
|
-
|
|
488
|
-
descriptor:
|
|
488
|
+
f && (T[Y.name] = (e) => F(w({
|
|
489
|
+
descriptor: Y,
|
|
489
490
|
executor: (e) => {
|
|
490
491
|
let t = e.id;
|
|
491
492
|
return {
|
|
@@ -494,13 +495,13 @@ var nn = "/_voltro/admin/import", rn = "/_voltro/admin/export", Q = (e, t) => ({
|
|
|
494
495
|
column: "startedAt",
|
|
495
496
|
direction: "desc"
|
|
496
497
|
}],
|
|
497
|
-
predicate:
|
|
498
|
+
predicate: Ct(V("id", t), V("executionId", t)),
|
|
498
499
|
take: 1,
|
|
499
500
|
skip: void 0,
|
|
500
501
|
projection: void 0
|
|
501
502
|
};
|
|
502
503
|
}
|
|
503
|
-
}, e), t, `subscription.${
|
|
504
|
+
}, e), t, `subscription.${Y.name}`), T[Z.name] = (e) => F(w({
|
|
504
505
|
descriptor: Z,
|
|
505
506
|
executor: (e) => {
|
|
506
507
|
let t = e, n = [...t.tag === void 0 ? [] : [V("tag", t.tag)], ...t.status === void 0 ? [] : [V("status", t.status)]], r = Number.isFinite(t.limit) && t.limit !== void 0 ? Math.min(Math.max(Math.floor(t.limit), 1), 500) : 100;
|
|
@@ -510,14 +511,14 @@ var nn = "/_voltro/admin/import", rn = "/_voltro/admin/export", Q = (e, t) => ({
|
|
|
510
511
|
column: "startedAt",
|
|
511
512
|
direction: "desc"
|
|
512
513
|
}],
|
|
513
|
-
predicate: n.length === 0 ? void 0 : n.length === 1 ? n[0] :
|
|
514
|
+
predicate: n.length === 0 ? void 0 : n.length === 1 ? n[0] : xt(...n),
|
|
514
515
|
take: r,
|
|
515
516
|
skip: void 0,
|
|
516
517
|
projection: void 0
|
|
517
518
|
};
|
|
518
519
|
}
|
|
519
|
-
}, e), t, `subscription.${Z.name}`), T[
|
|
520
|
-
descriptor:
|
|
520
|
+
}, e), t, `subscription.${Z.name}`), T[X.name] = (e) => F(w({
|
|
521
|
+
descriptor: X,
|
|
521
522
|
executor: (e) => {
|
|
522
523
|
let t = e.runId;
|
|
523
524
|
return {
|
|
@@ -532,8 +533,8 @@ var nn = "/_voltro/admin/import", rn = "/_voltro/admin/export", Q = (e, t) => ({
|
|
|
532
533
|
projection: void 0
|
|
533
534
|
};
|
|
534
535
|
}
|
|
535
|
-
}, e), t, `subscription.${
|
|
536
|
-
descriptor:
|
|
536
|
+
}, e), t, `subscription.${X.name}`), T[J.name] = (e) => F(w({
|
|
537
|
+
descriptor: J,
|
|
537
538
|
executor: (e) => {
|
|
538
539
|
let t = e.runId;
|
|
539
540
|
return {
|
|
@@ -548,8 +549,8 @@ var nn = "/_voltro/admin/import", rn = "/_voltro/admin/export", Q = (e, t) => ({
|
|
|
548
549
|
projection: void 0
|
|
549
550
|
};
|
|
550
551
|
}
|
|
551
|
-
}, e), t, `subscription.${
|
|
552
|
-
descriptor:
|
|
552
|
+
}, e), t, `subscription.${J.name}`), T[q.name] = (e) => F(w({
|
|
553
|
+
descriptor: q,
|
|
553
554
|
executor: (e) => {
|
|
554
555
|
let t = e;
|
|
555
556
|
return {
|
|
@@ -564,8 +565,8 @@ var nn = "/_voltro/admin/import", rn = "/_voltro/admin/export", Q = (e, t) => ({
|
|
|
564
565
|
projection: void 0
|
|
565
566
|
};
|
|
566
567
|
}
|
|
567
|
-
}, e), t, `subscription.${
|
|
568
|
-
descriptor:
|
|
568
|
+
}, e), t, `subscription.${q.name}`), T[Mt.name] = (e) => F(w({
|
|
569
|
+
descriptor: Mt,
|
|
569
570
|
executor: (e) => {
|
|
570
571
|
let t = e.eventId;
|
|
571
572
|
return {
|
|
@@ -580,63 +581,63 @@ var nn = "/_voltro/admin/import", rn = "/_voltro/admin/export", Q = (e, t) => ({
|
|
|
580
581
|
projection: void 0
|
|
581
582
|
};
|
|
582
583
|
}
|
|
583
|
-
}, e), t, `subscription.${
|
|
584
|
-
let r = t;
|
|
585
|
-
return await ye(e.store, n.subject, { executionId: r.executionId }), await f.cancel(r.workflowName, r.executionId), await Ve(r.workflowName, r.executionId, "workflow.cancel"), { ok: !0 };
|
|
586
|
-
}, t, `action.${kt.name}`), T[jt.name] = (t) => P(async (t, n) => {
|
|
584
|
+
}, e), t, `subscription.${Mt.name}`), T[jt.name] = (t) => P(async (t, n) => {
|
|
587
585
|
let r = t;
|
|
588
|
-
return await
|
|
586
|
+
return await b(e.store, n.subject, { executionId: r.executionId }), await d.cancel(r.workflowName, r.executionId), await Le(r.workflowName, r.executionId, "workflow.cancel"), { ok: !0 };
|
|
589
587
|
}, t, `action.${jt.name}`), T[Nt.name] = (t) => P(async (t, n) => {
|
|
590
588
|
let r = t;
|
|
591
|
-
return await
|
|
589
|
+
return await b(e.store, n.subject, { executionId: r.executionId }), await d.resume(r.workflowName, r.executionId), { ok: !0 };
|
|
592
590
|
}, t, `action.${Nt.name}`), T[Pt.name] = (t) => P(async (t, n) => {
|
|
593
591
|
let r = t;
|
|
594
|
-
return await
|
|
595
|
-
}, t, `action.${Pt.name}`))
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
...
|
|
601
|
-
...
|
|
602
|
-
...
|
|
603
|
-
...
|
|
604
|
-
...
|
|
605
|
-
...
|
|
606
|
-
...
|
|
607
|
-
...
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
K(
|
|
615
|
-
K(
|
|
616
|
-
K(
|
|
617
|
-
|
|
592
|
+
return await b(e.store, n.subject, { id: r.id }), d.signal({ id: r.id }, r.signalName, r.payload);
|
|
593
|
+
}, t, `action.${Pt.name}`), T[Ft.name] = (t) => P(async (t, n) => {
|
|
594
|
+
let r = t;
|
|
595
|
+
return await b(e.store, n.subject, { id: r.id }), d.update({ id: r.id }, r.updateName, r.payload, r.timeoutMs === void 0 ? void 0 : { timeoutMs: r.timeoutMs });
|
|
596
|
+
}, t, `action.${Ft.name}`));
|
|
597
|
+
let D = [
|
|
598
|
+
...e.discovered.queries.map((e) => K(e.descriptor)),
|
|
599
|
+
...e.discovered.mutations.map((e) => kt(e.descriptor)),
|
|
600
|
+
...e.discovered.actions.map((e) => G(e.descriptor)),
|
|
601
|
+
...S.queries.map((e) => K(e.descriptor)),
|
|
602
|
+
...S.mutations.map((e) => kt(e.descriptor)),
|
|
603
|
+
...v.queries.map((e) => K(e.descriptor)),
|
|
604
|
+
...v.mutations.map((e) => kt(e.descriptor)),
|
|
605
|
+
...v.actions.map((e) => G(e.descriptor)),
|
|
606
|
+
...(e.discovered.streams ?? []).map((e) => At(e.descriptor)),
|
|
607
|
+
...(e.discovered.workflows ?? []).map((e) => vt(e.definition)),
|
|
608
|
+
...f ? [
|
|
609
|
+
K(Y),
|
|
610
|
+
K(Z),
|
|
611
|
+
K(X),
|
|
612
|
+
K(J),
|
|
613
|
+
K(q),
|
|
614
|
+
K(Mt),
|
|
615
|
+
G(jt),
|
|
616
|
+
G(Nt),
|
|
617
|
+
G(Pt),
|
|
618
|
+
G(Ft)
|
|
618
619
|
] : []
|
|
619
|
-
], De =
|
|
620
|
-
register: (t, n, r) =>
|
|
620
|
+
], De = yt.make(...D).middleware(Et).middleware(Dt), Oe = A.succeed(Et, Et.of(({ headers: t, clientId: n }) => k.promise(() => e.resolveSubject(t, n)))), ke = A.succeed(Dt, Dt.of(({ clientId: e }) => k.succeed({ clientId: e }))), Ae = e.dormancyTenantId ?? "default", je = e.dormancy === "sleep" ? {
|
|
621
|
+
register: (t, n, r) => ut(e.store, {
|
|
621
622
|
tenantId: r ?? Ae,
|
|
622
623
|
kind: "workflow",
|
|
623
624
|
refId: t,
|
|
624
625
|
wakeAt: n
|
|
625
626
|
}),
|
|
626
|
-
cancel: (t, n) =>
|
|
627
|
+
cancel: (t, n) => Ve(e.store, {
|
|
627
628
|
tenantId: n ?? Ae,
|
|
628
629
|
kind: "workflow",
|
|
629
630
|
refId: t
|
|
630
631
|
}).then(() => {})
|
|
631
|
-
} : void 0,
|
|
632
|
+
} : void 0, O = te ? await import("@voltro/workflow") : void 0, M = O?.makeWorkflowRunRecorder({
|
|
632
633
|
store: e.store,
|
|
633
634
|
...je === void 0 ? {} : { wakeups: je }
|
|
634
|
-
}),
|
|
635
|
-
await
|
|
635
|
+
}), Pe = async (t, n) => {
|
|
636
|
+
await O.closeWorkflowChildrenForParent({
|
|
636
637
|
store: e.store,
|
|
637
638
|
parentExecutionId: t,
|
|
638
639
|
parentStatus: n,
|
|
639
|
-
recorder:
|
|
640
|
+
recorder: M,
|
|
640
641
|
log: { warn: (e, t) => {
|
|
641
642
|
process.stderr.write(`[workflow] ${e} ${t ? JSON.stringify(t) : ""}\n`);
|
|
642
643
|
} },
|
|
@@ -647,7 +648,7 @@ var nn = "/_voltro/admin/import", rn = "/_voltro/admin/export", Q = (e, t) => ({
|
|
|
647
648
|
await a.runPromise(r.definition.interrupt(n));
|
|
648
649
|
}
|
|
649
650
|
});
|
|
650
|
-
},
|
|
651
|
+
}, Le = async (t, n, r) => {
|
|
651
652
|
let i = (await e.store.query({
|
|
652
653
|
table: "_voltro_workflow_runs",
|
|
653
654
|
order: [],
|
|
@@ -662,7 +663,7 @@ var nn = "/_voltro/admin/import", rn = "/_voltro/admin/export", Q = (e, t) => ({
|
|
|
662
663
|
cancelled: !0,
|
|
663
664
|
completedAt: /* @__PURE__ */ new Date()
|
|
664
665
|
}), o = i.subject?.tenantId ?? void 0;
|
|
665
|
-
a && await
|
|
666
|
+
a && await M.recordEvent({
|
|
666
667
|
runId: i.id,
|
|
667
668
|
eventType: "run-cancelled",
|
|
668
669
|
payload: {
|
|
@@ -671,16 +672,16 @@ var nn = "/_voltro/admin/import", rn = "/_voltro/admin/export", Q = (e, t) => ({
|
|
|
671
672
|
executionId: n,
|
|
672
673
|
...o == null ? {} : { tenantId: o }
|
|
673
674
|
}
|
|
674
|
-
}), a && await
|
|
675
|
+
}), a && await Pe(n, "cancelled");
|
|
675
676
|
}, He = [...z(e.discovered.workflows ?? [], {
|
|
676
|
-
buildContext: (t, n) => e.buildContextForWorkflow?.(t, n) ??
|
|
677
|
+
buildContext: (t, n) => e.buildContextForWorkflow?.(t, n) ?? y({
|
|
677
678
|
subject: t.subject,
|
|
678
679
|
traceId: t.traceId
|
|
679
680
|
}, e.store, void 0, `workflow:${n.workflowName}`, { parentExecutionId: n.executionId }),
|
|
680
681
|
resolveStartContext: u
|
|
681
682
|
}, (t, n, r) => {
|
|
682
|
-
let i =
|
|
683
|
-
return
|
|
683
|
+
let i = O.getWorkflowVersionMetadata(t.definition);
|
|
684
|
+
return O.wrapWorkflowExecuteWithRunRecording({
|
|
684
685
|
name: t.definition.name,
|
|
685
686
|
store: e.store,
|
|
686
687
|
subject: r.subject,
|
|
@@ -691,53 +692,53 @@ var nn = "/_voltro/admin/import", rn = "/_voltro/admin/export", Q = (e, t) => ({
|
|
|
691
692
|
workflowPatches: i.patches,
|
|
692
693
|
parentExecutionId: r?.parentExecutionId ?? null,
|
|
693
694
|
parentClosePolicy: r?.parentClosePolicy ?? null,
|
|
694
|
-
onParentClose: ({ executionId: e, status: t }) =>
|
|
695
|
-
recorder:
|
|
695
|
+
onParentClose: ({ executionId: e, status: t }) => Pe(e, t),
|
|
696
|
+
recorder: M
|
|
696
697
|
}, n);
|
|
697
|
-
}), ...e.discovered.workflowWorkers ?? []], Ue = He.length > 0 ?
|
|
698
|
+
}), ...e.discovered.workflowWorkers ?? []], Ue = He.length > 0 ? A.mergeAll(...He) : A.empty;
|
|
698
699
|
if (((e.discovered.workflows?.length ?? 0) > 0 || (e.discovered.workflowWorkers?.length ?? 0) > 0 || e.scheduleCoordination === "cluster") && e.workflowEngineLayer !== void 0) {
|
|
699
|
-
let t = Ue.pipe(
|
|
700
|
-
a = Me.make(e.baseLayer === void 0 ? t : t.pipe(
|
|
700
|
+
let t = Ue.pipe(A.provideMerge(e.workflowEngineLayer));
|
|
701
|
+
a = Me.make(e.baseLayer === void 0 ? t : t.pipe(A.provideMerge(e.baseLayer))), await a.runPromise(k.void), i = (e.discovered.workflows?.length ?? 0) > 0 ? ot({
|
|
701
702
|
workflows: e.discovered.workflows ?? [],
|
|
702
703
|
runEffect: (e) => a.runPromise(e),
|
|
703
704
|
rememberStartContext: l,
|
|
704
705
|
signal: async (t, n, r) => {
|
|
705
|
-
let i = await
|
|
706
|
+
let i = await O.sendWorkflowSignal({
|
|
706
707
|
store: e.store,
|
|
707
|
-
recorder:
|
|
708
|
+
recorder: M,
|
|
708
709
|
target: t,
|
|
709
710
|
signalName: n,
|
|
710
711
|
payload: r
|
|
711
712
|
});
|
|
712
|
-
return await a.runPromise(
|
|
713
|
+
return await a.runPromise(O.completeSuspendingSignal({
|
|
713
714
|
store: e.store,
|
|
714
715
|
target: t,
|
|
715
716
|
signalName: n,
|
|
716
717
|
payload: r
|
|
717
718
|
})).catch(() => {}), i;
|
|
718
719
|
},
|
|
719
|
-
update: (t, n, r, i) =>
|
|
720
|
+
update: (t, n, r, i) => O.sendWorkflowUpdate({
|
|
720
721
|
store: e.store,
|
|
721
|
-
recorder:
|
|
722
|
+
recorder: M,
|
|
722
723
|
target: t,
|
|
723
724
|
updateName: n,
|
|
724
725
|
payload: r,
|
|
725
726
|
...i === void 0 ? {} : { options: i }
|
|
726
727
|
}),
|
|
727
|
-
listRuns: (t) =>
|
|
728
|
-
retry: (t, n) =>
|
|
728
|
+
listRuns: (t) => ge(e.store, t),
|
|
729
|
+
retry: (t, n) => he({
|
|
729
730
|
store: e.store,
|
|
730
731
|
workflows: e.discovered.workflows ?? [],
|
|
731
732
|
runPromise: (e) => a.runPromise(e)
|
|
732
733
|
}, t, n)
|
|
733
734
|
}) : void 0;
|
|
734
735
|
}
|
|
735
|
-
let We =
|
|
736
|
+
let We = A.mergeAll(De.toLayer(T), Oe, ke), Ge = ae(T, e.discovered.queries.map((e) => e.descriptor.name), f), Ye = A.mergeAll(De.toLayer(Ge), Oe, ke), L = e.observability, Xe = await Be({
|
|
736
737
|
...L && L.spanProcessors.length > 0 ? { extraSpanProcessors: L.spanProcessors } : {},
|
|
737
738
|
...L && L.metricReaders.length > 0 ? { extraMetricReaders: L.metricReaders } : {},
|
|
738
739
|
...L && Object.keys(L.resourceAttributes).length > 0 ? { resourceAttributes: L.resourceAttributes } : {},
|
|
739
740
|
...L && L.sampler !== void 0 ? { sampler: L.sampler } : {}
|
|
740
|
-
}), Ze = !1,
|
|
741
|
+
}), Ze = !1, Qe = e.store.ping ? () => e.store.ping().then(() => !0).catch(() => !1) : void 0, { server: at, shutdown: dt } = _t({
|
|
741
742
|
group: De,
|
|
742
743
|
handlersLayer: We,
|
|
743
744
|
httpHandlersLayer: Ye,
|
|
@@ -746,13 +747,13 @@ var nn = "/_voltro/admin/import", rn = "/_voltro/admin/export", Q = (e, t) => ({
|
|
|
746
747
|
tracerLayer: Xe.layer,
|
|
747
748
|
healthCheck: {
|
|
748
749
|
isReady: () => Ze,
|
|
749
|
-
...
|
|
750
|
+
...Qe ? { ping: Qe } : {}
|
|
750
751
|
},
|
|
751
|
-
...
|
|
752
|
-
...
|
|
752
|
+
...Ee.length > 0 ? { httpRoutes: Ee } : {},
|
|
753
|
+
...oe.size > 0 ? { webhookRoutes: oe } : {}
|
|
753
754
|
});
|
|
754
|
-
if (await
|
|
755
|
-
let t = (e.scheduleCoordination ?? "single") === "advisoryLock" ?
|
|
755
|
+
if (await Re(at), (e.discovered.schedules?.length ?? 0) > 0) {
|
|
756
|
+
let t = (e.scheduleCoordination ?? "single") === "advisoryLock" ? Je(e.store, e.scheduleReplicaId ?? `pid-${process.pid}`) : gt;
|
|
756
757
|
o = await B(e.discovered.schedules ?? [], {
|
|
757
758
|
store: e.store,
|
|
758
759
|
coordinator: t,
|
|
@@ -761,7 +762,7 @@ var nn = "/_voltro/admin/import", rn = "/_voltro/admin/export", Q = (e, t) => ({
|
|
|
761
762
|
armSelf: e.scheduleArmSelf ?? !0,
|
|
762
763
|
dormancy: e.dormancy ?? "always-on",
|
|
763
764
|
...e.dormancyTenantId === void 0 ? {} : { dormancyTenantId: e.dormancyTenantId },
|
|
764
|
-
buildContext: ({ traceId: t, scheduleName: n, subject: r }) =>
|
|
765
|
+
buildContext: ({ traceId: t, scheduleName: n, subject: r }) => y({
|
|
765
766
|
subject: r,
|
|
766
767
|
traceId: t
|
|
767
768
|
}, e.store, void 0, `schedule:${n}`),
|
|
@@ -781,27 +782,27 @@ var nn = "/_voltro/admin/import", rn = "/_voltro/admin/export", Q = (e, t) => ({
|
|
|
781
782
|
...e.onScheduleRunEvent === void 0 ? {} : { onRunEvent: e.onScheduleRunEvent }
|
|
782
783
|
}), e.onSchedulerReady?.(o);
|
|
783
784
|
}
|
|
784
|
-
let
|
|
785
|
-
if ((e.discovered.subscribers?.length ?? 0) > 0 && (
|
|
786
|
-
let t =
|
|
787
|
-
|
|
785
|
+
let pt = e.log ?? j({ scope: "voltro:serve" }), bt, St;
|
|
786
|
+
if ((e.discovered.subscribers?.length ?? 0) > 0 && (bt = m(e.discovered.subscribers ?? [], e.store, pt.child("subscribe"), e.schemaRegistry)), (e.discovered.reactions?.length ?? 0) > 0) {
|
|
787
|
+
let t = pt.child("reaction");
|
|
788
|
+
St = ve(e.discovered.reactions ?? [], e.store, {
|
|
788
789
|
runAct: async (n, r) => {
|
|
789
790
|
if (n.kind === "workflow") {
|
|
790
|
-
if (
|
|
791
|
+
if (d === void 0) {
|
|
791
792
|
t.warn("reaction workflow act skipped — no workflow engine in this app", { workflow: n.workflow });
|
|
792
793
|
return;
|
|
793
794
|
}
|
|
794
795
|
let e = r.new ?? r.old ?? {};
|
|
795
|
-
await
|
|
796
|
+
await st(d, {
|
|
796
797
|
traceId: `reaction:${n.workflow}`,
|
|
797
798
|
source: `reaction:${n.workflow}`
|
|
798
799
|
}).start(n.workflow, e);
|
|
799
800
|
return;
|
|
800
801
|
}
|
|
801
|
-
await
|
|
802
|
+
await ee(n.agent, r, {
|
|
802
803
|
findAgentSend: (t) => e.discovered.actions.find((e) => e.descriptor.name === `${t}.send`),
|
|
803
|
-
runAction: (e, t, n) => Promise.resolve(
|
|
804
|
-
makeSubject: (e) =>
|
|
804
|
+
runAction: (e, t, n) => Promise.resolve(pe(e, t, n)),
|
|
805
|
+
makeSubject: (e) => Ot(e),
|
|
805
806
|
now: () => Date.now(),
|
|
806
807
|
log: t
|
|
807
808
|
});
|
|
@@ -809,7 +810,7 @@ var nn = "/_voltro/admin/import", rn = "/_voltro/admin/export", Q = (e, t) => ({
|
|
|
809
810
|
checkBudget: async (n, r) => {
|
|
810
811
|
try {
|
|
811
812
|
let { requireAiBudget: t } = await import("@voltro/ai");
|
|
812
|
-
return (await
|
|
813
|
+
return (await k.runPromise(k.either(t(e.store, {
|
|
813
814
|
tenantId: n,
|
|
814
815
|
limitUsd: r
|
|
815
816
|
}))))._tag === "Right";
|
|
@@ -819,121 +820,134 @@ var nn = "/_voltro/admin/import", rn = "/_voltro/admin/export", Q = (e, t) => ({
|
|
|
819
820
|
}
|
|
820
821
|
}, t);
|
|
821
822
|
}
|
|
822
|
-
let
|
|
823
|
-
return (e.discovered.aggregates?.length ?? 0) > 0 && (
|
|
823
|
+
let U;
|
|
824
|
+
return (e.discovered.aggregates?.length ?? 0) > 0 && (U = await we({
|
|
824
825
|
discovered: e.discovered.aggregates ?? [],
|
|
825
826
|
store: e.store,
|
|
826
|
-
log:
|
|
827
|
+
log: pt.child("aggregate"),
|
|
827
828
|
...e.analytics === void 0 ? {} : { analytics: e.analytics },
|
|
828
829
|
...e.aggregateStorage === void 0 ? {} : { storage: e.aggregateStorage },
|
|
829
830
|
...e.aggregateCoordinator === void 0 ? {} : { coordinator: e.aggregateCoordinator }
|
|
830
|
-
}), ce =
|
|
831
|
+
}), ce = A.succeed(N, U.registry)), Ze = !0, e.bootTiming?.mark("ready"), {
|
|
831
832
|
dispatcher: t,
|
|
832
|
-
server:
|
|
833
|
+
server: at,
|
|
833
834
|
scheduler: o,
|
|
834
835
|
close: async () => {
|
|
835
|
-
Ze = !1,
|
|
836
|
+
Ze = !1, U?.detach(), St?.(), bt?.(), await o?.shutdown(), t.close(), await a?.dispose(), await new Promise((e) => at.close(() => e())), await dt();
|
|
836
837
|
}
|
|
837
838
|
};
|
|
838
|
-
}, $ =
|
|
839
|
+
}, $ = j({ scope: "voltro:serve" }), xn = (e, t, n) => (e === "production" || e === "staging") && t !== "memory" && n !== "0", Sn = ke, Cn = async (e) => {
|
|
839
840
|
let t = D(process.cwd());
|
|
840
|
-
if (
|
|
841
|
+
if (M(t)) {
|
|
841
842
|
let n;
|
|
842
843
|
try {
|
|
843
|
-
let e = await import(
|
|
844
|
+
let e = await import(je(t).href);
|
|
844
845
|
typeof e.runServe == "function" ? n = e.runServe : $.warn("serve bundle has no runServe export — using the standard serve path");
|
|
845
846
|
} catch (e) {
|
|
846
847
|
$.warn("serve bundle failed to load — using the standard serve path", {}, e);
|
|
847
848
|
}
|
|
848
849
|
if (n) return $.info("serve: booting from the precompiled serve bundle"), n(e);
|
|
849
850
|
}
|
|
850
|
-
return
|
|
851
|
-
},
|
|
852
|
-
let
|
|
853
|
-
process.env.NODE_ENV || (process.env.NODE_ENV = "production"),
|
|
854
|
-
let
|
|
855
|
-
|
|
856
|
-
rawEnv:
|
|
851
|
+
return wn(e);
|
|
852
|
+
}, wn = async (ee) => {
|
|
853
|
+
let p = Oe();
|
|
854
|
+
process.env.NODE_ENV || (process.env.NODE_ENV = "production"), It();
|
|
855
|
+
let m = process.cwd(), ae = Number(process.env.PORT ?? Sn(ee, "--port") ?? 4e3), g = await Se(m);
|
|
856
|
+
pt(dt(g?.secrets)), await e({
|
|
857
|
+
rawEnv: g?.env,
|
|
857
858
|
appType: "api",
|
|
858
|
-
root:
|
|
859
|
+
root: m,
|
|
859
860
|
log: $,
|
|
860
861
|
generateTypes: !1
|
|
861
|
-
}),
|
|
862
|
-
let
|
|
863
|
-
if (!i() &&
|
|
864
|
-
let e = await import(
|
|
862
|
+
}), p.mark("config");
|
|
863
|
+
let _ = (process.env.DB_DIALECT ?? g?.store ?? "memory").toLowerCase(), le = (_ === "mariadb" || _ === "postgres" || _ === "mssql") && (process.env.CDC ?? "1") !== "0", de = _ === "mariadb" ? "mariadb" : _ === "mssql" ? "mssql" : void 0, b = De(m);
|
|
864
|
+
if (!i() && M(b)) try {
|
|
865
|
+
let e = await import(je(b).href);
|
|
865
866
|
if (e.modules) {
|
|
866
867
|
let t = {};
|
|
867
|
-
for (let [n, r] of Object.entries(e.modules)) t[
|
|
868
|
+
for (let [n, r] of Object.entries(e.modules)) t[Ae(m, n)] = r;
|
|
868
869
|
r(t), $.info("precompiled api bundle loaded", { modules: Object.keys(t).length });
|
|
869
870
|
}
|
|
870
871
|
} catch (e) {
|
|
871
872
|
$.warn("precompiled api bundle failed to load — falling back to source", {}, e);
|
|
872
873
|
}
|
|
873
|
-
let
|
|
874
|
-
mix:
|
|
875
|
-
plugins:
|
|
876
|
-
cdc:
|
|
877
|
-
...
|
|
878
|
-
}),
|
|
879
|
-
spec:
|
|
880
|
-
sqlLayer:
|
|
874
|
+
let x = await w(m), C = await pe(x, { cdc: le && de !== void 0 }), he = x.filter((e) => ce.test(e)), ge = he.length > 0 ? await te(he, $.child("webhooks")) : void 0, ve = s({
|
|
875
|
+
mix: C.featureMix,
|
|
876
|
+
plugins: g?.plugins ?? [],
|
|
877
|
+
cdc: le && de !== void 0,
|
|
878
|
+
...de ? { cdcDialect: de } : {}
|
|
879
|
+
}), we = g?.analytics !== void 0 && g.analytics.kind !== "noop" && _ !== "memory" ? (await n(_)).makeSqlLayer(S()) : void 0, E = await f({
|
|
880
|
+
spec: g?.analytics,
|
|
881
|
+
sqlLayer: we,
|
|
881
882
|
log: $
|
|
882
883
|
}), D = (() => {
|
|
883
|
-
let e = new Set(
|
|
884
|
-
for (let n of [...
|
|
884
|
+
let e = new Set(C.tables.map((e) => e.tableName)), t = [...C.tables];
|
|
885
|
+
for (let n of [...ve, ...E.tables]) e.has(n.tableName) || (e.add(n.tableName), t.push(n));
|
|
885
886
|
return t;
|
|
886
887
|
})();
|
|
887
|
-
for (let e of D)
|
|
888
|
-
let
|
|
889
|
-
if (
|
|
890
|
-
let e = (await n(
|
|
891
|
-
appliedBy: `serve:${
|
|
888
|
+
for (let e of D) St(e);
|
|
889
|
+
let ke = (process.env.NODE_ENV ?? "").toLowerCase();
|
|
890
|
+
if (xn(ke, _, process.env.VOLTRO_AUTO_MIGRATE)) {
|
|
891
|
+
let e = (await n(_)).makeSqlLayer(S()), t = await k.runPromise(bt.SqlClient.pipe(k.flatMap((e) => Vt(e, D, {
|
|
892
|
+
appliedBy: `serve:${ke}`,
|
|
892
893
|
environment: "prod",
|
|
893
|
-
dialectId:
|
|
894
|
-
})),
|
|
895
|
-
t.kind === "prod-mismatch" && ($.error(
|
|
894
|
+
dialectId: _
|
|
895
|
+
})), k.provide(e)));
|
|
896
|
+
t.kind === "prod-mismatch" && ($.error(Bt(t, _)), $.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(Bt(t, _));
|
|
896
897
|
}
|
|
897
|
-
let
|
|
898
|
-
|
|
899
|
-
let
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
898
|
+
let j = at(D);
|
|
899
|
+
p.mark("discover");
|
|
900
|
+
let N = await xe(g, void 0);
|
|
901
|
+
for (let e of me({
|
|
902
|
+
dialect: String(g?.store ?? process.env.DB_DIALECT ?? "postgres"),
|
|
903
|
+
changeStrategy: (process.env.CDC ?? "1") === "0" ? "inline" : "cdc",
|
|
904
|
+
dbUrl: process.env.DB_URL,
|
|
905
|
+
tables: C.tables.map((e) => ({
|
|
906
|
+
tableName: e.tableName,
|
|
907
|
+
isReactive: e.isReactive === !0
|
|
908
|
+
})),
|
|
909
|
+
querySources: C.queries.flatMap((e) => {
|
|
910
|
+
let t = e.descriptor.source;
|
|
911
|
+
return t === void 0 ? [] : typeof t == "string" ? [t] : [...t];
|
|
912
|
+
})
|
|
913
|
+
})) e.level === "warn" ? $.warn(e.message) : $.info(e.message);
|
|
914
|
+
g?.cache && !process.env.CACHE_BACKEND && (process.env.CACHE_BACKEND = g.cache), g?.cacheRedisUrl && !process.env.CACHE_REDIS_URL && (process.env.CACHE_REDIS_URL = g.cacheRedisUrl), g?.cacheRedisDriver && !process.env.CACHE_REDIS_DRIVER && (process.env.CACHE_REDIS_DRIVER = g.cacheRedisDriver), g?.cacheKeyPrefix && !process.env.CACHE_KEY_PREFIX && (process.env.CACHE_KEY_PREFIX = g.cacheKeyPrefix);
|
|
915
|
+
let { service: Ne, invalidationBus: Fe, snapshotCache: Ie, cache: Re, backend: P, dispose: ze } = await d({ env: process.env });
|
|
916
|
+
$.info(`cache backend resolved: ${P}` + (P === "redis" ? ` (driver ${process.env.CACHE_REDIS_DRIVER ?? "resp"})` : " — in-process, not cross-instance")), N.onChange((e) => {
|
|
917
|
+
k.runFork(Fe.publish(e.table));
|
|
918
|
+
}), g?.kv && !process.env.KV_BACKEND && (process.env.KV_BACKEND = g.kv), g?.kvRedisUrl && !process.env.KV_REDIS_URL && (process.env.KV_REDIS_URL = g.kvRedisUrl), g?.kvKeyPrefix && !process.env.KV_KEY_PREFIX && (process.env.KV_KEY_PREFIX = g.kvKeyPrefix);
|
|
919
|
+
let { kv: F, service: Be } = await Ze({ store: N });
|
|
920
|
+
p.mark("store");
|
|
921
|
+
let Ve = Le({
|
|
922
|
+
store: N,
|
|
909
923
|
sink: E.sink,
|
|
910
924
|
log: $
|
|
911
|
-
}),
|
|
912
|
-
store:
|
|
913
|
-
dialect:
|
|
914
|
-
}), I =
|
|
915
|
-
|
|
916
|
-
let
|
|
925
|
+
}), Ke = y({
|
|
926
|
+
store: N,
|
|
927
|
+
dialect: _
|
|
928
|
+
}), I = g?.plugins ?? [], qe = process.env.POD_NAME ?? process.env.HOSTNAME ?? `serve-${process.pid}`, R, $e;
|
|
929
|
+
_ !== "memory" && (R = Me.make((await n(_)).makeSqlLayer(S())), $e = await R.runPromise(bt.SqlClient));
|
|
930
|
+
let et = Qe({
|
|
917
931
|
coordinator: [
|
|
918
932
|
"postgres",
|
|
919
933
|
"mariadb",
|
|
920
934
|
"mysql",
|
|
921
935
|
"mssql"
|
|
922
|
-
].includes(
|
|
923
|
-
replicaId:
|
|
936
|
+
].includes(_) ? Je(N, qe, $) : gt,
|
|
937
|
+
replicaId: qe,
|
|
924
938
|
log: $
|
|
925
|
-
}),
|
|
926
|
-
|
|
939
|
+
}), tt = [], nt = {
|
|
940
|
+
...$e ? { sql: $e } : {},
|
|
927
941
|
scheduleCoordinated: (e, t, n) => {
|
|
928
|
-
let r =
|
|
929
|
-
return
|
|
942
|
+
let r = et(e, t, n);
|
|
943
|
+
return tt.push(r), r;
|
|
930
944
|
}
|
|
931
945
|
};
|
|
932
|
-
for (let e of I) e.bindDataStore?.(
|
|
933
|
-
let
|
|
934
|
-
if (
|
|
935
|
-
let e =
|
|
936
|
-
|
|
946
|
+
for (let e of I) e.bindDataStore?.(N, nt);
|
|
947
|
+
let rt = I.filter((e) => typeof e.onChangeEvent == "function");
|
|
948
|
+
if (rt.length > 0) {
|
|
949
|
+
let e = N.changeScope ?? "local";
|
|
950
|
+
N.onChange((t) => {
|
|
937
951
|
let n = {
|
|
938
952
|
table: t.table,
|
|
939
953
|
op: t.op,
|
|
@@ -942,69 +956,69 @@ var nn = "/_voltro/admin/import", rn = "/_voltro/admin/export", Q = (e, t) => ({
|
|
|
942
956
|
...t.origin === void 0 ? {} : { origin: t.origin },
|
|
943
957
|
changeScope: e
|
|
944
958
|
};
|
|
945
|
-
for (let e of
|
|
959
|
+
for (let e of rt) k.runFork(e.onChangeEvent(n).pipe(k.catchAllCause((t) => k.sync(() => $.warn(`plugin ${e.name} onChangeEvent failed`, { error: O.pretty(t) })))));
|
|
946
960
|
});
|
|
947
961
|
}
|
|
948
|
-
let
|
|
962
|
+
let it = Ce({
|
|
949
963
|
plugins: I,
|
|
950
|
-
appName:
|
|
964
|
+
appName: g?.name ?? "voltro-api",
|
|
951
965
|
appType: "api",
|
|
952
966
|
voltroVersion: process.env.npm_package_version ?? "0.0.0",
|
|
953
967
|
log: $
|
|
954
968
|
});
|
|
955
|
-
I.length && await
|
|
956
|
-
let
|
|
969
|
+
I.length && await it.activate(), p.mark("plugins");
|
|
970
|
+
let ot = await it.gatherObservability(), st = await T(N, g, _, {
|
|
957
971
|
info: (e, t) => process.stdout.write(`[broadcast] ${e} ${t ? JSON.stringify(t) : ""}\n`),
|
|
958
972
|
warn: (e, t) => process.stderr.write(`[broadcast] ${e} ${t ? JSON.stringify(t) : ""}\n`),
|
|
959
973
|
debug: () => {}
|
|
960
|
-
}), z =
|
|
961
|
-
|
|
962
|
-
|
|
974
|
+
}), z = g?.apiKeys, ct = (typeof z == "object" ? z.prefix : void 0) ?? "voltro_", lt = z ? Ue(N) : void 0, ut = lt ? L({ flush: Xe(lt) }) : void 0;
|
|
975
|
+
ut && process.once("exit", () => {
|
|
976
|
+
ut.shutdown();
|
|
963
977
|
});
|
|
964
|
-
let
|
|
965
|
-
prefix:
|
|
966
|
-
...
|
|
967
|
-
}) : void 0,
|
|
968
|
-
store:
|
|
978
|
+
let ft = lt ? Ye(lt, {
|
|
979
|
+
prefix: ct,
|
|
980
|
+
...ut ? { usage: ut } : {}
|
|
981
|
+
}) : void 0, mt = ft ? [Ge(ft, { prefix: ct })] : [], ht = ye([...g?.auth?.strategies ?? [], ...mt], Ht(g?.plugins ?? []), g?.auth?.anonymousTenantRequired ?? !1, g?.auth?.resolveScopes, () => N), _t = [...g?.restRoutes ?? [], ...ft ? Pe(ft, (typeof z == "object" ? z.managementPath : void 0) ?? "/v1/api-keys") : []], B = g?.idempotency, vt = B ? {
|
|
982
|
+
store: We(N),
|
|
969
983
|
header: (typeof B == "object" ? B.header : void 0) ?? "Idempotency-Key",
|
|
970
984
|
ttlMs: (typeof B == "object" ? B.ttlMs : void 0) ?? 864e5
|
|
971
|
-
} : void 0,
|
|
972
|
-
store:
|
|
973
|
-
resolveSubject: (e) =>
|
|
985
|
+
} : void 0, yt = _t.length > 0 ? Wt(_t, {
|
|
986
|
+
store: N,
|
|
987
|
+
resolveSubject: (e) => ht({
|
|
974
988
|
headers: e,
|
|
975
989
|
clientId: -1
|
|
976
990
|
}),
|
|
977
|
-
...
|
|
978
|
-
}) : [],
|
|
991
|
+
...vt ? { idempotency: vt } : {}
|
|
992
|
+
}) : [], xt = I.map((e) => e.services).filter((e) => e !== void 0), V = A.mergeAll(h({
|
|
979
993
|
analyticsLayer: E.layer,
|
|
980
994
|
cacheService: Ne,
|
|
981
|
-
kvService:
|
|
982
|
-
pluginServices:
|
|
983
|
-
userLayers:
|
|
984
|
-
}),
|
|
995
|
+
kvService: Be,
|
|
996
|
+
pluginServices: xt,
|
|
997
|
+
userLayers: g?.layers ?? []
|
|
998
|
+
}), be(g?.http ?? {})), Ct = g?.scheduling ?? {}, H = Ct.trigger ?? "self", wt = /* @__PURE__ */ new Set([
|
|
985
999
|
"postgres",
|
|
986
1000
|
"mysql",
|
|
987
1001
|
"mariadb",
|
|
988
1002
|
"mssql"
|
|
989
|
-
]), U =
|
|
990
|
-
U === "cluster" && !W && $.warn("scheduling.coordination=cluster needs a sql-backed store except sqlite — falling back to single"), U === "advisoryLock" && !
|
|
991
|
-
let
|
|
992
|
-
if (
|
|
993
|
-
if (
|
|
994
|
-
let e = await
|
|
1003
|
+
]), U = Ct.coordination ?? (wt.has(_) ? "advisoryLock" : "single"), W = U === "cluster" && wt.has(_), Tt = W ? "cluster" : U === "advisoryLock" && wt.has(_) ? "advisoryLock" : "single";
|
|
1004
|
+
U === "cluster" && !W && $.warn("scheduling.coordination=cluster needs a sql-backed store except sqlite — falling back to single"), U === "advisoryLock" && !wt.has(_) && $.warn("scheduling.coordination=advisoryLock needs a SQL store (the claim-row gate) — falling back to single");
|
|
1005
|
+
let Et, Dt = C.workflows.length > 0 || C.workflowWorkers.length > 0 || C.eventTriggers.length > 0 || (ge?.outgoing.length ?? 0) > 0 || W, G;
|
|
1006
|
+
if (Dt) {
|
|
1007
|
+
if (_ === "mssql") {
|
|
1008
|
+
let e = await Ee(process.cwd());
|
|
995
1009
|
e && $.warn(e);
|
|
996
1010
|
}
|
|
997
|
-
let [{ WorkflowEngine: e }, { makeClusterCronLayer: t, workflowEngineLayer: r, resolveRunnerStorage: i }] = await Promise.all([import("@effect/workflow"), import("@voltro/workflow/cluster")]), a = W ?
|
|
1011
|
+
let [{ WorkflowEngine: e }, { makeClusterCronLayer: t, workflowEngineLayer: r, resolveRunnerStorage: i }] = await Promise.all([import("@effect/workflow"), import("@voltro/workflow/cluster")]), a = W ? C.schedules.filter((e) => (e.trigger ?? H) === "self").map((e) => t({
|
|
998
1012
|
name: e.name,
|
|
999
|
-
cron:
|
|
1013
|
+
cron: He(e),
|
|
1000
1014
|
execute: async () => {
|
|
1001
|
-
await
|
|
1015
|
+
await Et?.fireFromCluster(e.name);
|
|
1002
1016
|
}
|
|
1003
1017
|
})) : [];
|
|
1004
|
-
|
|
1005
|
-
let e = await n(
|
|
1018
|
+
G = _ === "memory" ? e.layerMemory : await (async () => {
|
|
1019
|
+
let e = await n(_), t = i({ sqliteFamily: e.id === "sqlite" || e.id === "turso" });
|
|
1006
1020
|
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)" : "") : "")), r({
|
|
1007
|
-
sqlClientLayer: e.makeSqlLayer(
|
|
1021
|
+
sqlClientLayer: e.makeSqlLayer(S()),
|
|
1008
1022
|
runnerStorage: t,
|
|
1009
1023
|
dialectId: e.id,
|
|
1010
1024
|
...process.env.VOLTRO_WORKFLOW_RUNNER_PORT ? { runnerListenPort: Number(process.env.VOLTRO_WORKFLOW_RUNNER_PORT) } : {},
|
|
@@ -1012,102 +1026,102 @@ var nn = "/_voltro/admin/import", rn = "/_voltro/admin/export", Q = (e, t) => ({
|
|
|
1012
1026
|
});
|
|
1013
1027
|
})();
|
|
1014
1028
|
}
|
|
1015
|
-
let
|
|
1016
|
-
if (
|
|
1017
|
-
|
|
1029
|
+
let Ot = fe(I, t()), kt = x.filter((e) => /\.subscribe\.tsx?$/.test(e)), K = kt.length > 0 ? await oe(kt, $) : [], At = x.filter((e) => /\.reaction\.tsx?$/.test(e)), jt = At.length > 0 ? await _e(At, $) : [], q = x.filter((e) => u.test(e)), Mt = q.length > 0 ? await v(q, $) : [], Nt = x.filter((e) => /\.aggregate\.tsx?$/.test(e)), J = Nt.length > 0 ? await re(Nt, $) : [], Y = ne();
|
|
1030
|
+
if (J.length > 0 && _ !== "memory") try {
|
|
1031
|
+
Y = se((await n(_)).makeSqlLayer(S()));
|
|
1018
1032
|
} catch (e) {
|
|
1019
1033
|
$.warn("aggregate: SQL storage init failed — falling back to in-process", { err: String(e) });
|
|
1020
1034
|
}
|
|
1021
|
-
let
|
|
1022
|
-
if (
|
|
1023
|
-
let e = $.child("agent"), t =
|
|
1024
|
-
t.length > 0 && await
|
|
1025
|
-
let n = await
|
|
1026
|
-
for (let e of n.agents) for (let t of
|
|
1035
|
+
let X = _ === "memory" ? gt : Je(N, `aggregate@${process.pid}`, $), Z = [], Pt = [], Ft = x.filter((e) => l.test(e));
|
|
1036
|
+
if (Ft.length > 0) {
|
|
1037
|
+
let e = $.child("agent"), t = x.filter((e) => a.test(e));
|
|
1038
|
+
t.length > 0 && await o(t, e);
|
|
1039
|
+
let n = await c(Ft, e);
|
|
1040
|
+
for (let e of n.agents) for (let t of Te(e)) (t.kind === "action" ? Z : Pt).push({
|
|
1027
1041
|
file: t.file,
|
|
1028
1042
|
descriptor: t.descriptor,
|
|
1029
1043
|
executor: t.executor
|
|
1030
1044
|
});
|
|
1031
1045
|
n.agents.length > 0 && e.info("synthesized agent routes", { agents: n.agents.map((e) => e.descriptor.name) });
|
|
1032
1046
|
}
|
|
1033
|
-
|
|
1034
|
-
let
|
|
1035
|
-
bootTiming:
|
|
1047
|
+
p.mark("workflow");
|
|
1048
|
+
let Lt = await bn({
|
|
1049
|
+
bootTiming: p,
|
|
1036
1050
|
discovered: {
|
|
1037
|
-
queries: [...
|
|
1038
|
-
mutations:
|
|
1039
|
-
actions: [...
|
|
1040
|
-
streams:
|
|
1041
|
-
workflows:
|
|
1042
|
-
workflowWorkers:
|
|
1043
|
-
eventTriggers:
|
|
1044
|
-
schedules:
|
|
1045
|
-
subscribers:
|
|
1046
|
-
outboxHandlers:
|
|
1047
|
-
connections:
|
|
1048
|
-
reactions:
|
|
1049
|
-
aggregates:
|
|
1050
|
-
...
|
|
1051
|
+
queries: [...C.queries, ...Pt],
|
|
1052
|
+
mutations: C.mutations,
|
|
1053
|
+
actions: [...C.actions, ...Z],
|
|
1054
|
+
streams: C.streams,
|
|
1055
|
+
workflows: C.workflows,
|
|
1056
|
+
workflowWorkers: C.workflowWorkers,
|
|
1057
|
+
eventTriggers: C.eventTriggers,
|
|
1058
|
+
schedules: C.schedules,
|
|
1059
|
+
subscribers: K,
|
|
1060
|
+
outboxHandlers: Mt,
|
|
1061
|
+
connections: C.connections,
|
|
1062
|
+
reactions: jt,
|
|
1063
|
+
aggregates: J,
|
|
1064
|
+
...ge === void 0 ? {} : { webhooks: ge }
|
|
1051
1065
|
},
|
|
1052
1066
|
log: $,
|
|
1053
1067
|
analytics: E.sink,
|
|
1054
|
-
aggregateStorage:
|
|
1055
|
-
aggregateCoordinator:
|
|
1056
|
-
store:
|
|
1068
|
+
aggregateStorage: Y,
|
|
1069
|
+
aggregateCoordinator: X,
|
|
1070
|
+
store: N,
|
|
1057
1071
|
kv: F,
|
|
1058
|
-
cache:
|
|
1059
|
-
snapshotCache:
|
|
1060
|
-
schemaRegistry:
|
|
1061
|
-
tenantScopedTables:
|
|
1062
|
-
softDeleteScopedTables:
|
|
1063
|
-
dataTransferSnapshot:
|
|
1064
|
-
dataTransferDialect:
|
|
1065
|
-
tenantIsolation: (process.env.VOLTRO_TENANT_ISOLATION ??
|
|
1066
|
-
resolveSubject: (e, t) =>
|
|
1072
|
+
cache: Re,
|
|
1073
|
+
snapshotCache: Ie,
|
|
1074
|
+
schemaRegistry: j,
|
|
1075
|
+
tenantScopedTables: C.tenantScopedTables,
|
|
1076
|
+
softDeleteScopedTables: C.softDeleteScopedTables,
|
|
1077
|
+
dataTransferSnapshot: zt(D),
|
|
1078
|
+
dataTransferDialect: _,
|
|
1079
|
+
tenantIsolation: (process.env.VOLTRO_TENANT_ISOLATION ?? g?.tenancy?.isolation) === "namespace" ? "namespace" : "shared-schema",
|
|
1080
|
+
resolveSubject: (e, t) => ht({
|
|
1067
1081
|
headers: e,
|
|
1068
1082
|
clientId: t
|
|
1069
1083
|
}),
|
|
1070
|
-
httpRoutes: [...I.flatMap((e) => e.httpRoutes ?? []), ...
|
|
1084
|
+
httpRoutes: [...I.flatMap((e) => e.httpRoutes ?? []), ...yt],
|
|
1071
1085
|
...V ? { baseLayer: V } : {},
|
|
1072
|
-
...
|
|
1086
|
+
...G === void 0 ? {} : { workflowEngineLayer: G },
|
|
1073
1087
|
scheduleDefaultTrigger: H,
|
|
1074
|
-
scheduleCoordination:
|
|
1088
|
+
scheduleCoordination: Tt,
|
|
1075
1089
|
scheduleArmSelf: !W,
|
|
1076
|
-
dormancy: process.env.VOLTRO_DORMANCY === "sleep" || process.env.VOLTRO_DORMANCY === "always-on" ? process.env.VOLTRO_DORMANCY :
|
|
1090
|
+
dormancy: process.env.VOLTRO_DORMANCY === "sleep" || process.env.VOLTRO_DORMANCY === "always-on" ? process.env.VOLTRO_DORMANCY : g?.dormancy ?? "always-on",
|
|
1077
1091
|
scheduleReplicaId: process.env.HOSTNAME ?? `pid-${process.pid}`,
|
|
1078
|
-
...
|
|
1092
|
+
...Ot === void 0 ? {} : { scheduleFireInterceptor: Ot },
|
|
1079
1093
|
onSchedulerReady: (e) => {
|
|
1080
|
-
|
|
1094
|
+
Et = e;
|
|
1081
1095
|
},
|
|
1082
|
-
observability:
|
|
1083
|
-
port:
|
|
1084
|
-
...
|
|
1096
|
+
observability: ot,
|
|
1097
|
+
port: ae,
|
|
1098
|
+
...g?.transport?.wsPath ? { path: g.transport.wsPath } : {}
|
|
1085
1099
|
});
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1100
|
+
ie(ue([
|
|
1101
|
+
C.queries,
|
|
1102
|
+
C.mutations,
|
|
1103
|
+
C.actions,
|
|
1104
|
+
C.streams
|
|
1091
1105
|
]), (e) => {
|
|
1092
1106
|
$.warn(e);
|
|
1093
|
-
}), $.info(`API listening on :${
|
|
1094
|
-
dialect:
|
|
1095
|
-
queries:
|
|
1096
|
-
mutations:
|
|
1097
|
-
actions:
|
|
1098
|
-
streams:
|
|
1099
|
-
workflows:
|
|
1100
|
-
workflowWorkers:
|
|
1101
|
-
schedules:
|
|
1102
|
-
scheduleCoordination:
|
|
1103
|
-
}),
|
|
1104
|
-
let
|
|
1105
|
-
for (let e of
|
|
1106
|
-
|
|
1107
|
+
}), $.info(`API listening on :${ae}`, {
|
|
1108
|
+
dialect: _,
|
|
1109
|
+
queries: C.queries.length,
|
|
1110
|
+
mutations: C.mutations.length,
|
|
1111
|
+
actions: C.actions.length,
|
|
1112
|
+
streams: C.streams.length,
|
|
1113
|
+
workflows: C.workflows.length,
|
|
1114
|
+
workflowWorkers: C.workflowWorkers.length,
|
|
1115
|
+
schedules: C.schedules.length,
|
|
1116
|
+
scheduleCoordination: Tt
|
|
1117
|
+
}), p.finish($);
|
|
1118
|
+
let Rt = () => {
|
|
1119
|
+
for (let e of tt) e.stop();
|
|
1120
|
+
Ve.detach(), Ke.stop(), ze(), R?.dispose(), setTimeout(() => process.exit(0), 1e4).unref?.(), Promise.resolve(it.deactivate()).then(() => st?.close()).then(() => E.dispose()).then(() => Lt.close()).then(() => N.close?.()).then(() => process.exit(0)).catch((e) => {
|
|
1107
1121
|
console.error("serve: shutdown step failed, exiting anyway:", e), process.exit(0);
|
|
1108
1122
|
});
|
|
1109
1123
|
};
|
|
1110
|
-
return process.on("SIGINT",
|
|
1124
|
+
return process.on("SIGINT", Rt), process.on("SIGTERM", Rt), await new Promise(() => {}), 0;
|
|
1111
1125
|
};
|
|
1112
1126
|
//#endregion
|
|
1113
|
-
export {
|
|
1127
|
+
export { Cn as n, _n as r, wn as t };
|