@voltro/cli 0.10.0 → 0.11.1
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 +134 -0
- package/THIRD-PARTY-NOTICES.md +1047 -22
- package/bin/voltro.mjs +16 -7
- package/dist/apiBuild-BGd-BnHq.js +2 -0
- package/dist/{apiBuild-DTLPSlt9.js → apiBuild-D_kEJTxc.js} +10 -10
- package/dist/bin.js +2 -2
- package/dist/bootTiming-BdyP9nYw.js +38 -0
- package/dist/{commands-B0QT8dUY.js → commands-BiQsbV50.js} +2191 -2039
- package/dist/dev-DH13Ysgs.js +2 -0
- package/dist/{dev-CK9fbuAM.js → dev-zJGsTTNb.js} +2317 -2282
- package/dist/index.js +1 -1
- package/dist/{inspectMetrics-BeMjgt8x.js → inspectMetrics-BuBwg1yW.js} +1169 -1137
- package/dist/{serveCommand-YR3mKjvf.js → serveCommand-BU454-ay.js} +272 -296
- package/dist/serveEntry.js +3 -3
- package/dist/{start-C_M4fGS2.js → start-ChN6PO-c.js} +338 -323
- package/dist/startEntry.js +2 -2
- package/package.json +23 -17
- package/templates/agent-docs/data.md +107 -0
- package/templates/agent-docs/database/seedsdialects.md +21 -1
- package/templates/agent-docs/deployment.md +49 -0
- package/templates/agent-docs/internationalization.md +36 -0
- package/templates/agent-docs/multi-tenancy.md +33 -0
- package/templates/apps/api-ai/package.json +7 -7
- 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-storage/package.json +8 -8
- package/templates/apps/api-data-advanced/package.json +8 -8
- package/templates/apps/api-durable/package.json +8 -8
- package/templates/apps/api-feature-flags/package.json +9 -9
- package/templates/apps/api-governance/package.json +8 -8
- package/templates/apps/api-kv/package.json +8 -8
- package/templates/apps/api-moderation/package.json +8 -8
- package/templates/apps/api-observability/package.json +8 -8
- package/templates/apps/api-ratelimit/package.json +8 -8
- package/templates/apps/api-rbac/package.json +8 -8
- package/templates/apps/api-rest/package.json +7 -7
- package/templates/apps/api-saas/package.json +11 -11
- package/templates/apps/api-search/package.json +8 -8
- package/templates/apps/api-versioning/package.json +8 -8
- package/templates/apps/api-webhooks/package.json +8 -8
- package/templates/apps/changelog/package.json +6 -6
- package/templates/apps/edge-functions/package.json +2 -2
- package/templates/apps/frontend-admin/package.json +8 -8
- package/templates/apps/frontend-app/package.json +8 -8
- package/templates/apps/frontend-blank/package.json +7 -7
- package/templates/apps/frontend-contact/package.json +7 -7
- package/templates/apps/frontend-dashboard/package.json +7 -7
- package/templates/apps/frontend-docs/package.json +7 -7
- package/templates/apps/frontend-i18n/package.json +6 -6
- package/templates/apps/frontend-landing/package.json +7 -7
- package/templates/apps/frontend-spa/package.json +7 -7
- package/templates/apps/frontend-ssr/package.json +7 -7
- package/templates/apps/frontend-ssr-api/package.json +8 -8
- package/templates/apps/frontend-static-blog/package.json +6 -6
- package/dist/apiBuild-BbR1nYcE.js +0 -2
- package/dist/dev-BJvbwjSz.js +0 -2
|
@@ -1,68 +1,40 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { $ as n, A as r, C as i, D as a, E as o, F as s, G as c, H as l, I as u, J as d,
|
|
1
|
+
import { kt as e, t } from "./inspectMetrics-BuBwg1yW.js";
|
|
2
|
+
import { $ as n, A as r, C as i, D as a, E as o, F as s, G as c, H as l, I as u, J as d, M as f, N as p, O as ee, P as m, Q as h, S as g, T as te, U as ne, W as re, X as _, Y as ie, Z as ae, _ as oe, at as v, b as se, d as ce, et as y, f as b, g as le, h as ue, i as x, it as de, j as S, k as C, m as fe, n as pe, nt as me, o as w, ot as T, q as he, s as ge, st as _e, t as ve, ut as E, v as ye, w as be, x as xe, y as D } from "./dev-zJGsTTNb.js";
|
|
3
3
|
import { a as Se, r as Ce } from "./startupRunner-DhlX9nqd.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { assertProductionSessionSecret as dt } from "@voltro/protocol/session";
|
|
4
|
+
import { n as we, s as O } from "./apiBuild-D_kEJTxc.js";
|
|
5
|
+
import { t as Te } from "./bootTiming-BdyP9nYw.js";
|
|
6
|
+
import { join as Ee } from "node:path";
|
|
7
|
+
import { pathToFileURL as De } from "node:url";
|
|
8
|
+
import { Cause as k, Effect as A, Layer as j, ManagedRuntime as Oe } from "effect";
|
|
9
|
+
import { createLogger as M } from "@voltro/logger";
|
|
10
|
+
import { existsSync as N } from "node:fs";
|
|
11
|
+
import { AggregateRegistry as ke, Dispatcher as P, apiKeyManagementRoutes as Ae, applySoftDeleteScope as je, applyTenantScope as Me, attachAnalyticsMirror as Ne, awaitServerListening as Pe, bindMutation as F, bindStream as Fe, bindSubscription as I, buildTracingLayer as Ie, cancelWakeup as Le, compileCron as Re, dataStoreApiKeyStore as ze, dataStoreIdempotencyStore as Be, frameworkApiKeyStrategy as Ve, installPolicyGuardResolver as He, loadResourceTuples as Ue, makeActionRunner as L, makeAdvisoryLockCoordinator as We, makeApiKeyService as Ge, makeAsyncKv as R, makeCoordinatedScheduler as Ke, makeEffectStoreLayer as qe, makeLazyWorkflowFacade as Je, makeMutationRunner as Ye, makeQueryDescriptorProducer as Xe, makeQueryReauthorizer as Ze, makeSchemaRegistry as Qe, makeWorkflowFacade as $e, makeWorkflowFacadeWithCallerContext as et, makeWorkflowLayers as tt, noopKv as nt, recordSubscriptionDelivery as rt, registerWakeup as z, resolveSecretsBackend as it, runProvidedEffect as at, setSecretsBackend as ot, setSystemStoreHandle as st, setTupleSource as ct, singleCoordinator as lt, startRpcServer as ut, startScheduler as dt, workflowToRpc as B } from "@voltro/runtime";
|
|
13
12
|
import { RpcGroup as ft } from "@effect/rpc";
|
|
14
13
|
import { SqlClient as pt } from "@effect/sql";
|
|
15
|
-
import { and as mt, ensureTableRegistered as ht, eq as
|
|
16
|
-
import { fromNodeReadable as _t, getObjectStream as vt, putObjectStream as yt, resolveStorageProvider as
|
|
17
|
-
import { AuthMiddleware as
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}, Yt = () => {
|
|
28
|
-
let e = [{
|
|
29
|
-
name: "modules",
|
|
30
|
-
at: performance.now()
|
|
31
|
-
}];
|
|
32
|
-
return {
|
|
33
|
-
mark: (t) => {
|
|
34
|
-
e.push({
|
|
35
|
-
name: t,
|
|
36
|
-
at: performance.now()
|
|
37
|
-
});
|
|
38
|
-
},
|
|
39
|
-
finish: (t) => {
|
|
40
|
-
let n = Math.round(e[e.length - 1].at);
|
|
41
|
-
if (!Jt()) {
|
|
42
|
-
t.info(`serve: ready in ${n}ms`);
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
let r = {}, i = 0;
|
|
46
|
-
for (let t of e) r[t.name] = Math.round(t.at - i), i = t.at;
|
|
47
|
-
t.info(`serve: ready in ${n}ms`, {
|
|
48
|
-
bootMs: n,
|
|
49
|
-
phases: r
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
}, Xt = "/_voltro/admin/import", Zt = "/_voltro/admin/export", Q = (e, t) => ({
|
|
14
|
+
import { and as mt, ensureTableRegistered as ht, eq as V, or as gt } from "@voltro/database";
|
|
15
|
+
import { fromNodeReadable as _t, getObjectStream as vt, putObjectStream as yt, resolveStorageProvider as H, toNodeReadable as U } from "@voltro/plugin-storage";
|
|
16
|
+
import { AuthMiddleware as bt, ConnectionInfoMiddleware as xt, actionToRpc as W, anonymousSubject as St, mutationToRpc as Ct, queryToRpc as G, streamToRpc as wt, workflowCancelDescriptor as Tt, workflowDomainEventsQueryDescriptor as Et, workflowEventDeliveriesQueryDescriptor as K, workflowResumeDescriptor as Dt, workflowRunEventsQueryDescriptor as q, workflowRunQueryDescriptor as J, workflowRunStepsQueryDescriptor as Y, workflowRunsQueryDescriptor as Ot, workflowSignalDescriptor as X, workflowUpdateDescriptor as kt } from "@voltro/protocol";
|
|
17
|
+
import { createHash as Z, timingSafeEqual as At } from "node:crypto";
|
|
18
|
+
import { declaredSnapshot as jt, describeOutcome as Mt, runPlannedMigrations as Nt } from "@voltro/database/sql";
|
|
19
|
+
import { assertProductionSessionSecret as Pt } from "@voltro/protocol/session";
|
|
20
|
+
import { getAuthSessionStrategy as Ft } from "@voltro/plugin-auth";
|
|
21
|
+
import { collectPublicApiRoutes as It, restRoutesToHttpRoutes as Lt } from "@voltro/protocol/rest";
|
|
22
|
+
import { buildDeliverWebhookExecute as Rt, buildWebhooksService as zt, defaultIncomingPath as Bt, deliverWebhookWorkflow as Vt, mountIncomingWebhook as Ht } from "@voltro/plugin-webhooks";
|
|
23
|
+
import { packBundle as Ut, runExport as Wt, runImport as Gt, storageBlobSink as Kt, storageRefsBlobSource as qt, unpackBundle as Jt, unpackBundleToDir as Yt } from "@voltro/data-transfer";
|
|
24
|
+
//#region src/adminAuth.ts
|
|
25
|
+
var Xt = "/_voltro/admin/import", Zt = "/_voltro/admin/export", Q = (e, t) => ({
|
|
54
26
|
status: e,
|
|
55
27
|
contentType: "application/json; charset=utf-8",
|
|
56
28
|
body: JSON.stringify(t)
|
|
57
29
|
}), Qt = (e) => {
|
|
58
30
|
let t = e.authorization ?? e.Authorization, n = t ? /^Bearer\s+(.+)$/i.exec(t) : null;
|
|
59
31
|
return n ? n[1] : null;
|
|
60
|
-
}, $t = (e, t) =>
|
|
32
|
+
}, $t = (e, t) => At(Z("sha256").update(e).digest(), Z("sha256").update(t).digest()), en = (e, t) => {
|
|
61
33
|
if (e.method.toUpperCase() !== "POST") return Q(405, { error: "method not allowed" });
|
|
62
34
|
if (!t || t.length < 16) return Q(503, { error: "data transfer misconfigured (no/weak secret)" });
|
|
63
35
|
let n = Qt(e.headers);
|
|
64
36
|
return !n || !$t(n, t) ? Q(401, { error: "unauthorized" }) : null;
|
|
65
|
-
}, tn =
|
|
37
|
+
}, tn = M({ scope: "voltro:admin-import" }), nn = "VBUNDLE2", rn = async function* (e) {
|
|
66
38
|
yield e;
|
|
67
39
|
}, an = (e) => async (t) => {
|
|
68
40
|
let n = en(t, e.secret);
|
|
@@ -82,11 +54,11 @@ var Jt = () => {
|
|
|
82
54
|
}
|
|
83
55
|
let u = await import("node:os"), d = await import("node:fs/promises"), f = await import("node:path"), p = await d.mkdtemp(f.join(u.tmpdir(), "voltro-admin-import-"));
|
|
84
56
|
try {
|
|
85
|
-
e.assetSink ? await
|
|
57
|
+
e.assetSink ? await Jt(c, {
|
|
86
58
|
dir: p,
|
|
87
59
|
blobs: e.assetSink
|
|
88
|
-
}) : await
|
|
89
|
-
let t = await
|
|
60
|
+
}) : await Yt(c, p);
|
|
61
|
+
let t = await A.runPromiseExit(Gt({
|
|
90
62
|
store: e.store,
|
|
91
63
|
bundleDir: p,
|
|
92
64
|
...r ? { mode: r } : {},
|
|
@@ -141,7 +113,7 @@ var Jt = () => {
|
|
|
141
113
|
force: !0
|
|
142
114
|
});
|
|
143
115
|
}
|
|
144
|
-
}, on =
|
|
116
|
+
}, on = M({ scope: "voltro:admin-export" }), sn = async (e) => {
|
|
145
117
|
let t = [];
|
|
146
118
|
for await (let n of e) t.push(Buffer.from(n));
|
|
147
119
|
return new Uint8Array(Buffer.concat(t));
|
|
@@ -174,7 +146,7 @@ var Jt = () => {
|
|
|
174
146
|
}
|
|
175
147
|
let a = r.consistency === "snapshot" ? "snapshot" : i.consistency ?? "live", o = (typeof r.compression == "string" ? r.compression : void 0) ?? i.compression, s = i.scope ?? cn(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"), f = await import("node:path"), p = await d.mkdtemp(f.join(u.tmpdir(), "voltro-admin-export-"));
|
|
176
148
|
try {
|
|
177
|
-
let t = await
|
|
149
|
+
let t = await A.runPromise(Wt({
|
|
178
150
|
store: e.store,
|
|
179
151
|
snapshot: e.snapshot,
|
|
180
152
|
dialect: e.dialect,
|
|
@@ -190,7 +162,7 @@ var Jt = () => {
|
|
|
190
162
|
if (c) {
|
|
191
163
|
if (!e.putArchive) return Q(501, { error: "storage transport not configured on this instance" });
|
|
192
164
|
let i = r.bundleKey;
|
|
193
|
-
return await e.putArchive(i, () =>
|
|
165
|
+
return await e.putArchive(i, () => Ut({
|
|
194
166
|
dir: p,
|
|
195
167
|
...l
|
|
196
168
|
})), on.info("admin.export", {
|
|
@@ -207,7 +179,7 @@ var Jt = () => {
|
|
|
207
179
|
transport: "storage"
|
|
208
180
|
});
|
|
209
181
|
}
|
|
210
|
-
let d = await sn(
|
|
182
|
+
let d = await sn(Ut({
|
|
211
183
|
dir: p,
|
|
212
184
|
...l
|
|
213
185
|
}));
|
|
@@ -259,16 +231,20 @@ var Jt = () => {
|
|
|
259
231
|
invalidateTag: async () => 0,
|
|
260
232
|
wrap: async (e, t, n) => n()
|
|
261
233
|
}, fn = async (e) => {
|
|
262
|
-
|
|
234
|
+
st({
|
|
235
|
+
dataStore: e.store,
|
|
236
|
+
schemaRegistry: e.schemaRegistry
|
|
237
|
+
});
|
|
238
|
+
let t = new P({
|
|
263
239
|
store: e.store,
|
|
264
240
|
...e.snapshotCache ? { cache: e.snapshotCache } : {},
|
|
265
|
-
recordDelivery: (e) =>
|
|
241
|
+
recordDelivery: (e) => rt({
|
|
266
242
|
label: e.label,
|
|
267
243
|
kind: e.kind,
|
|
268
244
|
durationMs: e.durationMs,
|
|
269
245
|
rowCount: e.rowCount
|
|
270
246
|
})
|
|
271
|
-
}), n = e.cache ?? dn, r = e.kv ??
|
|
247
|
+
}), n = e.cache ?? dn, r = e.kv ?? nt, a, o, c, l = /* @__PURE__ */ new Map(), u = () => `wfctx_${globalThis.crypto?.randomUUID?.() ?? `${Date.now().toString(36)}${Math.random().toString(36).slice(2)}`}`, d = async (t, n, r) => {
|
|
272
248
|
let i = {
|
|
273
249
|
...r,
|
|
274
250
|
source: r.source ?? `workflow:${t}`
|
|
@@ -278,7 +254,7 @@ var Jt = () => {
|
|
|
278
254
|
let r = await e.store.query({
|
|
279
255
|
table: "_voltro_workflow_start_contexts",
|
|
280
256
|
order: [],
|
|
281
|
-
predicate:
|
|
257
|
+
predicate: V("executionId", n),
|
|
282
258
|
projection: ["id"],
|
|
283
259
|
skip: void 0,
|
|
284
260
|
take: 1
|
|
@@ -299,14 +275,14 @@ var Jt = () => {
|
|
|
299
275
|
} catch (e) {
|
|
300
276
|
process.stderr.write(`[workflow] failed to persist start context for ${t}/${n}: ${e?.message ?? String(e)}\n`);
|
|
301
277
|
}
|
|
302
|
-
},
|
|
278
|
+
}, p = async (t, n) => {
|
|
303
279
|
let r = l.get(n);
|
|
304
280
|
if (r !== void 0) return r;
|
|
305
281
|
try {
|
|
306
282
|
let t = (await e.store.query({
|
|
307
283
|
table: "_voltro_workflow_start_contexts",
|
|
308
284
|
order: [],
|
|
309
|
-
predicate:
|
|
285
|
+
predicate: V("executionId", n),
|
|
310
286
|
projection: void 0,
|
|
311
287
|
skip: void 0,
|
|
312
288
|
take: 1
|
|
@@ -324,17 +300,17 @@ var Jt = () => {
|
|
|
324
300
|
process.stderr.write(`[workflow] failed to load start context for ${n}: ${e?.message ?? String(e)}\n`);
|
|
325
301
|
return;
|
|
326
302
|
}
|
|
327
|
-
}, g = (e.discovered.workflows?.length ?? 0) > 0 ?
|
|
303
|
+
}, g = (e.discovered.workflows?.length ?? 0) > 0 ? Je(() => a) : void 0, te = (e.discovered.workflows?.length ?? 0) > 0 || (e.discovered.eventTriggers?.length ?? 0) > 0, ne = te || (e.discovered.workflowWorkers?.length ?? 0) > 0 || e.scheduleCoordination === "cluster", re = e.tenantIsolation === "namespace", ie = (e.log ?? M({ scope: "voltro:serve" })).child("webhooks"), oe, v = e.discovered.webhooks;
|
|
328
304
|
if (v && v.outgoing.length > 0 && e.workflowEngineLayer !== void 0) {
|
|
329
|
-
let t = e.workflowEngineLayer, i =
|
|
305
|
+
let t = e.workflowEngineLayer, i = h({
|
|
330
306
|
store: e.store,
|
|
331
307
|
schemaRegistry: e.schemaRegistry,
|
|
332
308
|
cache: n,
|
|
333
309
|
kv: r
|
|
334
310
|
}), a = v.outgoing.map((e) => e.descriptor);
|
|
335
|
-
|
|
336
|
-
let n =
|
|
337
|
-
|
|
311
|
+
oe = zt(i, async (e) => {
|
|
312
|
+
let n = Vt.execute(e).pipe(A.provide(Vt.toLayer(Rt(i, { events: a })).pipe(j.provideMerge(t))));
|
|
313
|
+
A.runPromise(n).catch((t) => {
|
|
338
314
|
ie.error("deliverWebhook workflow crashed", {
|
|
339
315
|
deliveryId: e.deliveryId,
|
|
340
316
|
targetId: e.targetId
|
|
@@ -342,11 +318,11 @@ var Jt = () => {
|
|
|
342
318
|
});
|
|
343
319
|
}, { events: a });
|
|
344
320
|
}
|
|
345
|
-
let
|
|
321
|
+
let se = /* @__PURE__ */ new Map();
|
|
346
322
|
if (v) for (let e of v.incoming) {
|
|
347
|
-
let t = e.descriptor.path ??
|
|
323
|
+
let t = e.descriptor.path ?? Bt(e.descriptor.id), n = `VOLTRO_WEBHOOK_SECRET_${e.descriptor.id.toUpperCase().replace(/[^A-Z0-9]/g, "_")}`, r = Ht(e.descriptor, {
|
|
348
324
|
resolveSecret: async () => process.env[n] ?? null,
|
|
349
|
-
resolveWorkflows: () => g === void 0 ? void 0 :
|
|
325
|
+
resolveWorkflows: () => g === void 0 ? void 0 : et(g, {
|
|
350
326
|
traceId: `incoming:${e.descriptor.id}`,
|
|
351
327
|
source: `incoming:${e.descriptor.id}`
|
|
352
328
|
}),
|
|
@@ -361,81 +337,81 @@ var Jt = () => {
|
|
|
361
337
|
e.status >= 500 ? ie.error("incoming delivery failed", t) : e.status >= 400 ? ie.warn("incoming delivery rejected", t) : ie.info("incoming delivery handled", t);
|
|
362
338
|
}
|
|
363
339
|
});
|
|
364
|
-
|
|
340
|
+
se.set(t, { handle: r });
|
|
365
341
|
}
|
|
366
|
-
|
|
367
|
-
let
|
|
342
|
+
He(), ct((t) => Ue(e.store, t.subjectId, t.resourceType, t.resourceId));
|
|
343
|
+
let ce = (e.discovered.outboxHandlers?.length ?? 0) > 0 ? m({
|
|
368
344
|
handlers: e.discovered.outboxHandlers ?? [],
|
|
369
345
|
store: e.store,
|
|
370
|
-
log: (e.log ??
|
|
371
|
-
}) : void 0, y =
|
|
346
|
+
log: (e.log ?? M({ scope: "voltro:serve" })).child("outbox")
|
|
347
|
+
}) : void 0, y = f({
|
|
372
348
|
definitions: (e.discovered.connections ?? []).map((e) => e.definition),
|
|
373
349
|
store: e.store,
|
|
374
|
-
publicUrl:
|
|
375
|
-
log: (e.log ??
|
|
350
|
+
publicUrl: S(e.port ?? 4e3),
|
|
351
|
+
log: (e.log ?? M({ scope: "voltro:serve" })).child("connections")
|
|
376
352
|
}), b = ae({
|
|
377
353
|
store: e.store,
|
|
378
354
|
schemaRegistry: e.schemaRegistry,
|
|
379
355
|
cache: n,
|
|
380
356
|
kv: r,
|
|
381
|
-
...
|
|
357
|
+
...oe === void 0 ? {} : { webhooksService: oe },
|
|
382
358
|
...g === void 0 ? {} : { workflowsProxy: g },
|
|
383
359
|
eventTriggers: e.discovered.eventTriggers ?? [],
|
|
384
360
|
namespaceIsolationOn: re,
|
|
385
|
-
...
|
|
361
|
+
...ce === void 0 ? {} : { outbox: { nudge: ce.nudge } },
|
|
386
362
|
...y.active ? { connections: { registry: y.registry } } : {}
|
|
387
|
-
}),
|
|
388
|
-
let r = t.pipe(
|
|
389
|
-
return
|
|
390
|
-
},
|
|
363
|
+
}), le = j.succeed(ke, be), x = (t, n) => {
|
|
364
|
+
let r = t.pipe(A.provide(qe(n)));
|
|
365
|
+
return at((e.baseLayer ? r.pipe(A.provide(e.baseLayer)) : r).pipe(A.provide(le)));
|
|
366
|
+
}, de = Ye({
|
|
391
367
|
store: e.store,
|
|
392
368
|
buildContext: (e, t, n) => b(e, t, n),
|
|
393
|
-
runEffect:
|
|
369
|
+
runEffect: x,
|
|
394
370
|
undoCapture: D()
|
|
395
371
|
}), pe = ye(), me = L({
|
|
396
372
|
buildContext: (e) => b(e),
|
|
397
|
-
runEffect:
|
|
398
|
-
}),
|
|
373
|
+
runEffect: x
|
|
374
|
+
}), w = Xe({
|
|
399
375
|
buildContext: (e) => b(e),
|
|
400
|
-
finalize: (t, n) =>
|
|
401
|
-
provideEffect: (e, t) => e.pipe(
|
|
402
|
-
}),
|
|
376
|
+
finalize: (t, n) => je(Me(t, e.tenantScopedTables, n.subject.tenantId), e.softDeleteScopedTables),
|
|
377
|
+
provideEffect: (e, t) => e.pipe(A.provide(qe(t)))
|
|
378
|
+
}), T = {};
|
|
403
379
|
for (let n of [
|
|
404
380
|
...e.discovered.queries,
|
|
405
381
|
...pe.queries,
|
|
406
382
|
...y.queries
|
|
407
|
-
])
|
|
383
|
+
]) T[n.descriptor.name] = (e) => I(w(n, e), t, `subscription.${n.descriptor.name}`, void 0, void 0, Ze(n, e));
|
|
408
384
|
for (let t of [
|
|
409
385
|
...e.discovered.mutations,
|
|
410
386
|
...pe.mutations,
|
|
411
387
|
...y.mutations
|
|
412
|
-
])
|
|
413
|
-
for (let t of [...e.discovered.actions, ...y.actions])
|
|
414
|
-
let
|
|
388
|
+
]) T[t.descriptor.name] = (e) => F(async (e, n) => de(t, e, n), e, `mutation.${t.descriptor.name}`);
|
|
389
|
+
for (let t of [...e.discovered.actions, ...y.actions]) T[t.descriptor.name] = (e) => F(async (e, n) => me(t, e, n), e, `action.${t.descriptor.name}`);
|
|
390
|
+
let ge = () => `public-${Math.random().toString(36).slice(2, 10)}`, _e = [...e.discovered.mutations.filter((e) => e.descriptor.publicApi !== void 0).map((e) => ({
|
|
415
391
|
descriptor: e.descriptor,
|
|
416
|
-
invoke: (t, n) =>
|
|
392
|
+
invoke: (t, n) => de(e, t, {
|
|
417
393
|
subject: n.subject,
|
|
418
|
-
traceId:
|
|
394
|
+
traceId: ge()
|
|
419
395
|
})
|
|
420
396
|
})), ...e.discovered.actions.filter((e) => e.descriptor.publicApi !== void 0).map((e) => ({
|
|
421
397
|
descriptor: e.descriptor,
|
|
422
398
|
invoke: (t, n) => me(e, t, {
|
|
423
399
|
subject: n.subject,
|
|
424
|
-
traceId:
|
|
400
|
+
traceId: ge()
|
|
425
401
|
})
|
|
426
|
-
}))],
|
|
402
|
+
}))], ve = _e.length > 0 ? Lt(It(_e), {
|
|
427
403
|
store: e.store,
|
|
428
404
|
resolveSubject: (t) => e.resolveSubject(t, -1)
|
|
429
|
-
}) : [],
|
|
405
|
+
}) : [], E = e.dataTransferSecret ?? process.env.VOLTRO_DATA_TRANSFER_SECRET, xe = E && E.length >= 16 ? [{
|
|
430
406
|
method: "POST",
|
|
431
407
|
path: Xt,
|
|
432
408
|
handle: an({
|
|
433
|
-
secret:
|
|
409
|
+
secret: E,
|
|
434
410
|
store: e.store,
|
|
435
411
|
...e.dataTransferSnapshot ? { snapshot: e.dataTransferSnapshot } : {},
|
|
436
|
-
assetSink:
|
|
412
|
+
assetSink: Kt(H({})),
|
|
437
413
|
openArchive: (e) => (async function* () {
|
|
438
|
-
let t =
|
|
414
|
+
let t = H({}), n = await U((await A.runPromise(vt(t, e))).stream);
|
|
439
415
|
for await (let e of n) yield e instanceof Uint8Array ? e : new Uint8Array(e);
|
|
440
416
|
})()
|
|
441
417
|
})
|
|
@@ -443,41 +419,41 @@ var Jt = () => {
|
|
|
443
419
|
method: "POST",
|
|
444
420
|
path: Zt,
|
|
445
421
|
handle: ln({
|
|
446
|
-
secret:
|
|
422
|
+
secret: E,
|
|
447
423
|
store: e.store,
|
|
448
424
|
snapshot: e.dataTransferSnapshot ?? { tables: [] },
|
|
449
425
|
dialect: e.dataTransferDialect ?? "memory",
|
|
450
426
|
tenantTables: [...e.tenantScopedTables],
|
|
451
427
|
loadProfile: un,
|
|
452
|
-
assetSource:
|
|
428
|
+
assetSource: qt(H({}), e.store),
|
|
453
429
|
putArchive: async (e, t) => {
|
|
454
|
-
let { Readable: n } = await import("node:stream"), r =
|
|
455
|
-
await
|
|
430
|
+
let { Readable: n } = await import("node:stream"), r = H({}), i = _t("storage", () => n.from(t()));
|
|
431
|
+
await A.runPromise(yt(r, e, i, { contentType: "application/octet-stream" }));
|
|
456
432
|
}
|
|
457
433
|
})
|
|
458
434
|
}] : [], Se = [
|
|
459
435
|
...e.httpRoutes ?? [],
|
|
460
|
-
...
|
|
436
|
+
...ve,
|
|
461
437
|
...xe,
|
|
462
438
|
...y.httpRoutes
|
|
463
439
|
];
|
|
464
|
-
for (let t of e.discovered.streams ?? [])
|
|
440
|
+
for (let t of e.discovered.streams ?? []) T[t.descriptor.name] = (n) => Fe((r) => {
|
|
465
441
|
let i = b(r), a = t.executor(n, i);
|
|
466
|
-
if (
|
|
467
|
-
let t = a.pipe(
|
|
468
|
-
return (e.baseLayer ? t.pipe(
|
|
442
|
+
if (A.isEffect(a)) {
|
|
443
|
+
let t = a.pipe(A.provide(qe(i.store)));
|
|
444
|
+
return (e.baseLayer ? t.pipe(A.provide(e.baseLayer)) : t).pipe(A.provide(le));
|
|
469
445
|
}
|
|
470
|
-
return typeof a == "object" && a && typeof a.then == "function" ?
|
|
446
|
+
return typeof a == "object" && a && typeof a.then == "function" ? A.promise(() => a) : a;
|
|
471
447
|
}, `stream.${t.descriptor.name}`);
|
|
472
|
-
for (let t of e.discovered.workflows ?? [])
|
|
448
|
+
for (let t of e.discovered.workflows ?? []) T[t.definition.name] = (e) => F(async (e, n) => {
|
|
473
449
|
let r = n;
|
|
474
|
-
return
|
|
450
|
+
return et(g, {
|
|
475
451
|
subject: r.subject,
|
|
476
452
|
traceId: r.traceId,
|
|
477
453
|
source: "workflow-rpc"
|
|
478
454
|
}).start(t.definition.name, e);
|
|
479
455
|
}, e, `workflow.${t.definition.name}`);
|
|
480
|
-
te && (
|
|
456
|
+
te && (T[J.name] = (e) => I(w({
|
|
481
457
|
descriptor: J,
|
|
482
458
|
executor: (e) => {
|
|
483
459
|
let t = e.id;
|
|
@@ -487,16 +463,16 @@ var Jt = () => {
|
|
|
487
463
|
column: "startedAt",
|
|
488
464
|
direction: "desc"
|
|
489
465
|
}],
|
|
490
|
-
predicate: gt(
|
|
466
|
+
predicate: gt(V("id", t), V("executionId", t)),
|
|
491
467
|
take: 1,
|
|
492
468
|
skip: void 0,
|
|
493
469
|
projection: void 0
|
|
494
470
|
};
|
|
495
471
|
}
|
|
496
|
-
}, e), t, `subscription.${J.name}`),
|
|
497
|
-
descriptor:
|
|
472
|
+
}, e), t, `subscription.${J.name}`), T[Ot.name] = (e) => I(w({
|
|
473
|
+
descriptor: Ot,
|
|
498
474
|
executor: (e) => {
|
|
499
|
-
let t = e, n = [...t.tag === void 0 ? [] : [
|
|
475
|
+
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;
|
|
500
476
|
return {
|
|
501
477
|
table: "_voltro_workflow_runs",
|
|
502
478
|
order: [{
|
|
@@ -509,8 +485,8 @@ var Jt = () => {
|
|
|
509
485
|
projection: void 0
|
|
510
486
|
};
|
|
511
487
|
}
|
|
512
|
-
}, e), t, `subscription.${
|
|
513
|
-
descriptor:
|
|
488
|
+
}, e), t, `subscription.${Ot.name}`), T[Y.name] = (e) => I(w({
|
|
489
|
+
descriptor: Y,
|
|
514
490
|
executor: (e) => {
|
|
515
491
|
let t = e.runId;
|
|
516
492
|
return {
|
|
@@ -519,13 +495,13 @@ var Jt = () => {
|
|
|
519
495
|
column: "startedAt",
|
|
520
496
|
direction: "asc"
|
|
521
497
|
}],
|
|
522
|
-
predicate:
|
|
498
|
+
predicate: V("runId", t),
|
|
523
499
|
take: 1e3,
|
|
524
500
|
skip: void 0,
|
|
525
501
|
projection: void 0
|
|
526
502
|
};
|
|
527
503
|
}
|
|
528
|
-
}, e), t, `subscription.${
|
|
504
|
+
}, e), t, `subscription.${Y.name}`), T[q.name] = (e) => I(w({
|
|
529
505
|
descriptor: q,
|
|
530
506
|
executor: (e) => {
|
|
531
507
|
let t = e.runId;
|
|
@@ -535,14 +511,14 @@ var Jt = () => {
|
|
|
535
511
|
column: "occurredAt",
|
|
536
512
|
direction: "asc"
|
|
537
513
|
}],
|
|
538
|
-
predicate:
|
|
514
|
+
predicate: V("runId", t),
|
|
539
515
|
take: 1e3,
|
|
540
516
|
skip: void 0,
|
|
541
517
|
projection: void 0
|
|
542
518
|
};
|
|
543
519
|
}
|
|
544
|
-
}, e), t, `subscription.${q.name}`),
|
|
545
|
-
descriptor:
|
|
520
|
+
}, e), t, `subscription.${q.name}`), T[Et.name] = (e) => I(w({
|
|
521
|
+
descriptor: Et,
|
|
546
522
|
executor: (e) => {
|
|
547
523
|
let t = e;
|
|
548
524
|
return {
|
|
@@ -551,14 +527,14 @@ var Jt = () => {
|
|
|
551
527
|
column: "occurredAt",
|
|
552
528
|
direction: "desc"
|
|
553
529
|
}],
|
|
554
|
-
predicate: t.name === void 0 ? void 0 :
|
|
530
|
+
predicate: t.name === void 0 ? void 0 : V("name", t.name),
|
|
555
531
|
take: Math.max(1, Math.min(500, t.limit ?? 100)),
|
|
556
532
|
skip: void 0,
|
|
557
533
|
projection: void 0
|
|
558
534
|
};
|
|
559
535
|
}
|
|
560
|
-
}, e), t, `subscription.${
|
|
561
|
-
descriptor:
|
|
536
|
+
}, e), t, `subscription.${Et.name}`), T[K.name] = (e) => I(w({
|
|
537
|
+
descriptor: K,
|
|
562
538
|
executor: (e) => {
|
|
563
539
|
let t = e.eventId;
|
|
564
540
|
return {
|
|
@@ -567,69 +543,69 @@ var Jt = () => {
|
|
|
567
543
|
column: "createdAt",
|
|
568
544
|
direction: "asc"
|
|
569
545
|
}],
|
|
570
|
-
predicate:
|
|
546
|
+
predicate: V("eventId", t),
|
|
571
547
|
take: 500,
|
|
572
548
|
skip: void 0,
|
|
573
549
|
projection: void 0
|
|
574
550
|
};
|
|
575
551
|
}
|
|
576
|
-
}, e), t, `subscription.${
|
|
552
|
+
}, e), t, `subscription.${K.name}`), T[Tt.name] = (t) => F(async (t, n) => {
|
|
577
553
|
let r = t;
|
|
578
|
-
return await _(e.store, n.subject, { executionId: r.executionId }), await g.cancel(r.workflowName, r.executionId), await
|
|
579
|
-
}, t, `action.${
|
|
554
|
+
return await _(e.store, n.subject, { executionId: r.executionId }), await g.cancel(r.workflowName, r.executionId), await Ne(r.workflowName, r.executionId, "workflow.cancel"), { ok: !0 };
|
|
555
|
+
}, t, `action.${Tt.name}`), T[Dt.name] = (t) => F(async (t, n) => {
|
|
580
556
|
let r = t;
|
|
581
557
|
return await _(e.store, n.subject, { executionId: r.executionId }), await g.resume(r.workflowName, r.executionId), { ok: !0 };
|
|
582
|
-
}, t, `action.${
|
|
558
|
+
}, t, `action.${Dt.name}`), T[X.name] = (t) => F(async (t, n) => {
|
|
583
559
|
let r = t;
|
|
584
560
|
return await _(e.store, n.subject, { id: r.id }), g.signal({ id: r.id }, r.signalName, r.payload);
|
|
585
|
-
}, t, `action.${X.name}`),
|
|
561
|
+
}, t, `action.${X.name}`), T[kt.name] = (t) => F(async (t, n) => {
|
|
586
562
|
let r = t;
|
|
587
563
|
return await _(e.store, n.subject, { id: r.id }), g.update({ id: r.id }, r.updateName, r.payload, r.timeoutMs === void 0 ? void 0 : { timeoutMs: r.timeoutMs });
|
|
588
|
-
}, t, `action.${
|
|
564
|
+
}, t, `action.${kt.name}`));
|
|
589
565
|
let Ce = [
|
|
590
566
|
...e.discovered.queries.map((e) => G(e.descriptor)),
|
|
591
|
-
...e.discovered.mutations.map((e) =>
|
|
567
|
+
...e.discovered.mutations.map((e) => Ct(e.descriptor)),
|
|
592
568
|
...e.discovered.actions.map((e) => W(e.descriptor)),
|
|
593
569
|
...pe.queries.map((e) => G(e.descriptor)),
|
|
594
|
-
...pe.mutations.map((e) =>
|
|
570
|
+
...pe.mutations.map((e) => Ct(e.descriptor)),
|
|
595
571
|
...y.queries.map((e) => G(e.descriptor)),
|
|
596
|
-
...y.mutations.map((e) =>
|
|
572
|
+
...y.mutations.map((e) => Ct(e.descriptor)),
|
|
597
573
|
...y.actions.map((e) => W(e.descriptor)),
|
|
598
|
-
...(e.discovered.streams ?? []).map((e) =>
|
|
599
|
-
...(e.discovered.workflows ?? []).map((e) =>
|
|
574
|
+
...(e.discovered.streams ?? []).map((e) => wt(e.descriptor)),
|
|
575
|
+
...(e.discovered.workflows ?? []).map((e) => B(e.definition)),
|
|
600
576
|
...te ? [
|
|
601
577
|
G(J),
|
|
578
|
+
G(Ot),
|
|
602
579
|
G(Y),
|
|
603
|
-
G(kt),
|
|
604
580
|
G(q),
|
|
581
|
+
G(Et),
|
|
605
582
|
G(K),
|
|
606
|
-
|
|
607
|
-
W(
|
|
608
|
-
W(Ot),
|
|
583
|
+
W(Tt),
|
|
584
|
+
W(Dt),
|
|
609
585
|
W(X),
|
|
610
|
-
W(
|
|
586
|
+
W(kt)
|
|
611
587
|
] : []
|
|
612
|
-
],
|
|
588
|
+
], we = ft.make(...Ce).middleware(bt).middleware(xt), O = j.succeed(bt, bt.of(({ headers: t, clientId: n }) => A.promise(() => e.resolveSubject(t, n)))), Te = j.succeed(xt, xt.of(({ clientId: e }) => A.succeed({ clientId: e }))), Ee = e.dormancyTenantId ?? "default", De = e.dormancy === "sleep" ? {
|
|
613
589
|
register: (t, n, r) => z(e.store, {
|
|
614
590
|
tenantId: r ?? Ee,
|
|
615
591
|
kind: "workflow",
|
|
616
592
|
refId: t,
|
|
617
593
|
wakeAt: n
|
|
618
594
|
}),
|
|
619
|
-
cancel: (t, n) =>
|
|
595
|
+
cancel: (t, n) => Le(e.store, {
|
|
620
596
|
tenantId: n ?? Ee,
|
|
621
597
|
kind: "workflow",
|
|
622
598
|
refId: t
|
|
623
599
|
}).then(() => {})
|
|
624
|
-
} : void 0,
|
|
600
|
+
} : void 0, k = ne ? await import("@voltro/workflow") : void 0, N = k?.makeWorkflowRunRecorder({
|
|
625
601
|
store: e.store,
|
|
626
602
|
...De === void 0 ? {} : { wakeups: De }
|
|
627
|
-
}),
|
|
628
|
-
await
|
|
603
|
+
}), Ae = async (t, n) => {
|
|
604
|
+
await k.closeWorkflowChildrenForParent({
|
|
629
605
|
store: e.store,
|
|
630
606
|
parentExecutionId: t,
|
|
631
607
|
parentStatus: n,
|
|
632
|
-
recorder:
|
|
608
|
+
recorder: N,
|
|
633
609
|
log: { warn: (e, t) => {
|
|
634
610
|
process.stderr.write(`[workflow] ${e} ${t ? JSON.stringify(t) : ""}\n`);
|
|
635
611
|
} },
|
|
@@ -640,11 +616,11 @@ var Jt = () => {
|
|
|
640
616
|
await o.runPromise(r.definition.interrupt(n));
|
|
641
617
|
}
|
|
642
618
|
});
|
|
643
|
-
},
|
|
619
|
+
}, Ne = async (t, n, r) => {
|
|
644
620
|
let i = (await e.store.query({
|
|
645
621
|
table: "_voltro_workflow_runs",
|
|
646
622
|
order: [],
|
|
647
|
-
predicate:
|
|
623
|
+
predicate: V("executionId", n),
|
|
648
624
|
projection: void 0,
|
|
649
625
|
skip: void 0,
|
|
650
626
|
take: 1
|
|
@@ -655,7 +631,7 @@ var Jt = () => {
|
|
|
655
631
|
cancelled: !0,
|
|
656
632
|
completedAt: /* @__PURE__ */ new Date()
|
|
657
633
|
}), o = i.subject?.tenantId ?? void 0;
|
|
658
|
-
a && await
|
|
634
|
+
a && await N.recordEvent({
|
|
659
635
|
runId: i.id,
|
|
660
636
|
eventType: "run-cancelled",
|
|
661
637
|
payload: {
|
|
@@ -664,16 +640,16 @@ var Jt = () => {
|
|
|
664
640
|
executionId: n,
|
|
665
641
|
...o == null ? {} : { tenantId: o }
|
|
666
642
|
}
|
|
667
|
-
}), a && await
|
|
668
|
-
}, Re = [...
|
|
643
|
+
}), a && await Ae(n, "cancelled");
|
|
644
|
+
}, Re = [...tt(e.discovered.workflows ?? [], {
|
|
669
645
|
buildContext: (t, n) => e.buildContextForWorkflow?.(t, n) ?? b({
|
|
670
646
|
subject: t.subject,
|
|
671
647
|
traceId: t.traceId
|
|
672
648
|
}, e.store, void 0, `workflow:${n.workflowName}`, { parentExecutionId: n.executionId }),
|
|
673
|
-
resolveStartContext:
|
|
649
|
+
resolveStartContext: p
|
|
674
650
|
}, (t, n, r) => {
|
|
675
|
-
let i =
|
|
676
|
-
return
|
|
651
|
+
let i = k.getWorkflowVersionMetadata(t.definition);
|
|
652
|
+
return k.wrapWorkflowExecuteWithRunRecording({
|
|
677
653
|
name: t.definition.name,
|
|
678
654
|
store: e.store,
|
|
679
655
|
subject: r.subject,
|
|
@@ -684,66 +660,66 @@ var Jt = () => {
|
|
|
684
660
|
workflowPatches: i.patches,
|
|
685
661
|
parentExecutionId: r?.parentExecutionId ?? null,
|
|
686
662
|
parentClosePolicy: r?.parentClosePolicy ?? null,
|
|
687
|
-
onParentClose: ({ executionId: e, status: t }) =>
|
|
688
|
-
recorder:
|
|
663
|
+
onParentClose: ({ executionId: e, status: t }) => Ae(e, t),
|
|
664
|
+
recorder: N
|
|
689
665
|
}, n);
|
|
690
|
-
}), ...e.discovered.workflowWorkers ?? []], ze = Re.length > 0 ?
|
|
691
|
-
((e.discovered.workflows?.length ?? 0) > 0 || (e.discovered.workflowWorkers?.length ?? 0) > 0 || e.scheduleCoordination === "cluster") && e.workflowEngineLayer !== void 0 && (o = Oe.make(ze.pipe(
|
|
666
|
+
}), ...e.discovered.workflowWorkers ?? []], ze = Re.length > 0 ? j.mergeAll(...Re) : j.empty;
|
|
667
|
+
((e.discovered.workflows?.length ?? 0) > 0 || (e.discovered.workflowWorkers?.length ?? 0) > 0 || e.scheduleCoordination === "cluster") && e.workflowEngineLayer !== void 0 && (o = Oe.make(ze.pipe(j.provideMerge(e.workflowEngineLayer))), await o.runPromise(A.void), a = (e.discovered.workflows?.length ?? 0) > 0 ? $e({
|
|
692
668
|
workflows: e.discovered.workflows ?? [],
|
|
693
669
|
runEffect: (e) => o.runPromise(e),
|
|
694
670
|
rememberStartContext: d,
|
|
695
671
|
signal: async (t, n, r) => {
|
|
696
|
-
let i = await
|
|
672
|
+
let i = await k.sendWorkflowSignal({
|
|
697
673
|
store: e.store,
|
|
698
|
-
recorder:
|
|
674
|
+
recorder: N,
|
|
699
675
|
target: t,
|
|
700
676
|
signalName: n,
|
|
701
677
|
payload: r
|
|
702
678
|
});
|
|
703
|
-
return await o.runPromise(
|
|
679
|
+
return await o.runPromise(k.completeSuspendingSignal({
|
|
704
680
|
store: e.store,
|
|
705
681
|
target: t,
|
|
706
682
|
signalName: n,
|
|
707
683
|
payload: r
|
|
708
684
|
})).catch(() => {}), i;
|
|
709
685
|
},
|
|
710
|
-
update: (t, n, r, i) =>
|
|
686
|
+
update: (t, n, r, i) => k.sendWorkflowUpdate({
|
|
711
687
|
store: e.store,
|
|
712
|
-
recorder:
|
|
688
|
+
recorder: N,
|
|
713
689
|
target: t,
|
|
714
690
|
updateName: n,
|
|
715
691
|
payload: r,
|
|
716
692
|
...i === void 0 ? {} : { options: i }
|
|
717
693
|
}),
|
|
718
694
|
listRuns: (t) => fe(e.store, t),
|
|
719
|
-
retry: (t, n) =>
|
|
695
|
+
retry: (t, n) => ue({
|
|
720
696
|
store: e.store,
|
|
721
697
|
workflows: e.discovered.workflows ?? [],
|
|
722
698
|
runPromise: (e) => o.runPromise(e)
|
|
723
699
|
}, t, n)
|
|
724
700
|
}) : void 0);
|
|
725
|
-
let Be =
|
|
701
|
+
let Be = j.mergeAll(we.toLayer(T), O, Te), Ve = he(T, e.discovered.queries.map((e) => e.descriptor.name), te), Ge = j.mergeAll(we.toLayer(Ve), O, Te), R = e.observability, Ke = await Ie({
|
|
726
702
|
...R && R.spanProcessors.length > 0 ? { extraSpanProcessors: R.spanProcessors } : {},
|
|
727
703
|
...R && R.metricReaders.length > 0 ? { extraMetricReaders: R.metricReaders } : {},
|
|
728
704
|
...R && Object.keys(R.resourceAttributes).length > 0 ? { resourceAttributes: R.resourceAttributes } : {},
|
|
729
705
|
...R && R.sampler !== void 0 ? { sampler: R.sampler } : {}
|
|
730
|
-
}),
|
|
731
|
-
group:
|
|
706
|
+
}), Qe = !1, it = e.store.ping ? () => e.store.ping().then(() => !0).catch(() => !1) : void 0, ot = ut({
|
|
707
|
+
group: we,
|
|
732
708
|
handlersLayer: Be,
|
|
733
709
|
httpHandlersLayer: Ge,
|
|
734
710
|
port: e.port ?? 4e3,
|
|
735
711
|
path: e.path ?? "/ws",
|
|
736
|
-
tracerLayer:
|
|
712
|
+
tracerLayer: Ke.layer,
|
|
737
713
|
healthCheck: {
|
|
738
|
-
isReady: () =>
|
|
739
|
-
...
|
|
714
|
+
isReady: () => Qe,
|
|
715
|
+
...it ? { ping: it } : {}
|
|
740
716
|
},
|
|
741
717
|
...Se.length > 0 ? { httpRoutes: Se } : {},
|
|
742
|
-
...
|
|
718
|
+
...se.size > 0 ? { webhookRoutes: se } : {}
|
|
743
719
|
});
|
|
744
|
-
if (await
|
|
745
|
-
let t = (e.scheduleCoordination ?? "single") === "advisoryLock" ?
|
|
746
|
-
c = await
|
|
720
|
+
if (await Pe(ot), (e.discovered.schedules?.length ?? 0) > 0) {
|
|
721
|
+
let t = (e.scheduleCoordination ?? "single") === "advisoryLock" ? We(e.store, e.scheduleReplicaId ?? `pid-${process.pid}`) : lt;
|
|
722
|
+
c = await dt(e.discovered.schedules ?? [], {
|
|
747
723
|
store: e.store,
|
|
748
724
|
coordinator: t,
|
|
749
725
|
defaultTrigger: e.scheduleDefaultTrigger ?? "self",
|
|
@@ -768,10 +744,10 @@ var Jt = () => {
|
|
|
768
744
|
...e.onScheduleRunEvent === void 0 ? {} : { onRunEvent: e.onScheduleRunEvent }
|
|
769
745
|
}), e.onSchedulerReady?.(c);
|
|
770
746
|
}
|
|
771
|
-
let
|
|
772
|
-
if ((e.discovered.subscribers?.length ?? 0) > 0 && (
|
|
773
|
-
let t =
|
|
774
|
-
|
|
747
|
+
let pt = e.log ?? M({ scope: "voltro:serve" }), ht, Z;
|
|
748
|
+
if ((e.discovered.subscribers?.length ?? 0) > 0 && (ht = s(e.discovered.subscribers ?? [], e.store, pt.child("subscribe"), e.schemaRegistry)), (e.discovered.reactions?.length ?? 0) > 0) {
|
|
749
|
+
let t = pt.child("reaction");
|
|
750
|
+
Z = ee(e.discovered.reactions ?? [], e.store, {
|
|
775
751
|
runAct: async (n, r) => {
|
|
776
752
|
if (n.kind === "workflow") {
|
|
777
753
|
if (g === void 0) {
|
|
@@ -779,16 +755,16 @@ var Jt = () => {
|
|
|
779
755
|
return;
|
|
780
756
|
}
|
|
781
757
|
let e = r.new ?? r.old ?? {};
|
|
782
|
-
await
|
|
758
|
+
await et(g, {
|
|
783
759
|
traceId: `reaction:${n.workflow}`,
|
|
784
760
|
source: `reaction:${n.workflow}`
|
|
785
761
|
}).start(n.workflow, e);
|
|
786
762
|
return;
|
|
787
763
|
}
|
|
788
|
-
await
|
|
764
|
+
await C(n.agent, r, {
|
|
789
765
|
findAgentSend: (t) => e.discovered.actions.find((e) => e.descriptor.name === `${t}.send`),
|
|
790
766
|
runAction: (e, t, n) => Promise.resolve(me(e, t, n)),
|
|
791
|
-
makeSubject: (e) =>
|
|
767
|
+
makeSubject: (e) => St(e),
|
|
792
768
|
now: () => Date.now(),
|
|
793
769
|
log: t
|
|
794
770
|
});
|
|
@@ -796,7 +772,7 @@ var Jt = () => {
|
|
|
796
772
|
checkBudget: async (n, r) => {
|
|
797
773
|
try {
|
|
798
774
|
let { requireAiBudget: t } = await import("@voltro/ai");
|
|
799
|
-
return (await
|
|
775
|
+
return (await A.runPromise(A.either(t(e.store, {
|
|
800
776
|
tenantId: n,
|
|
801
777
|
limitUsd: r
|
|
802
778
|
}))))._tag === "Right";
|
|
@@ -806,31 +782,31 @@ var Jt = () => {
|
|
|
806
782
|
}
|
|
807
783
|
}, t);
|
|
808
784
|
}
|
|
809
|
-
let
|
|
810
|
-
return (e.discovered.aggregates?.length ?? 0) > 0 && (
|
|
785
|
+
let At;
|
|
786
|
+
return (e.discovered.aggregates?.length ?? 0) > 0 && (At = await i({
|
|
811
787
|
discovered: e.discovered.aggregates ?? [],
|
|
812
788
|
store: e.store,
|
|
813
|
-
log:
|
|
789
|
+
log: pt.child("aggregate"),
|
|
814
790
|
...e.analytics === void 0 ? {} : { analytics: e.analytics },
|
|
815
791
|
...e.aggregateStorage === void 0 ? {} : { storage: e.aggregateStorage },
|
|
816
792
|
...e.aggregateCoordinator === void 0 ? {} : { coordinator: e.aggregateCoordinator }
|
|
817
|
-
}),
|
|
793
|
+
}), le = j.succeed(ke, At.registry)), Qe = !0, e.bootTiming?.mark("ready"), {
|
|
818
794
|
dispatcher: t,
|
|
819
|
-
server:
|
|
795
|
+
server: ot,
|
|
820
796
|
scheduler: c,
|
|
821
797
|
close: async () => {
|
|
822
|
-
|
|
798
|
+
Qe = !1, At?.detach(), Z?.(), ht?.(), await c?.shutdown(), t.close(), await o?.dispose(), await new Promise((e) => ot.close(() => e()));
|
|
823
799
|
}
|
|
824
800
|
};
|
|
825
|
-
}, $ =
|
|
801
|
+
}, $ = M({ scope: "voltro:serve" }), pn = (e, t, n) => (e === "production" || e === "staging") && t !== "memory" && n !== "0", mn = (e, t) => {
|
|
826
802
|
let n = e.indexOf(t);
|
|
827
803
|
return n >= 0 ? e[n + 1] : void 0;
|
|
828
804
|
}, hn = async (e) => {
|
|
829
805
|
let t = O(process.cwd());
|
|
830
|
-
if (
|
|
806
|
+
if (N(t)) {
|
|
831
807
|
let n;
|
|
832
808
|
try {
|
|
833
|
-
let e = await import(
|
|
809
|
+
let e = await import(De(t).href);
|
|
834
810
|
typeof e.runServe == "function" ? n = e.runServe : $.warn("serve bundle has no runServe export — using the standard serve path");
|
|
835
811
|
} catch (e) {
|
|
836
812
|
$.warn("serve bundle failed to load — using the standard serve path", {}, e);
|
|
@@ -839,33 +815,33 @@ var Jt = () => {
|
|
|
839
815
|
}
|
|
840
816
|
return gn(e);
|
|
841
817
|
}, gn = async (i) => {
|
|
842
|
-
let s =
|
|
843
|
-
process.env.NODE_ENV || (process.env.NODE_ENV = "production"),
|
|
844
|
-
let f = process.cwd(),
|
|
845
|
-
|
|
818
|
+
let s = Te();
|
|
819
|
+
process.env.NODE_ENV || (process.env.NODE_ENV = "production"), Pt();
|
|
820
|
+
let f = process.cwd(), ee = Number(process.env.PORT ?? mn(i, "--port") ?? 4e3), m = await w(f);
|
|
821
|
+
ot(it(m?.secrets)), await e({
|
|
846
822
|
rawEnv: m?.env,
|
|
847
823
|
appType: "api",
|
|
848
824
|
root: f,
|
|
849
825
|
log: $,
|
|
850
826
|
generateTypes: !1
|
|
851
827
|
}), s.mark("config");
|
|
852
|
-
let h = (process.env.DB_DIALECT ?? m?.store ?? "memory").toLowerCase(),
|
|
853
|
-
if (!Ce() &&
|
|
854
|
-
let e = await import(
|
|
828
|
+
let h = (process.env.DB_DIALECT ?? m?.store ?? "memory").toLowerCase(), _ = (h === "mariadb" || h === "postgres" || h === "mssql") && (process.env.CDC ?? "1") !== "0", ae = h === "mariadb" ? "mariadb" : h === "mssql" ? "mssql" : void 0, ue = we(f);
|
|
829
|
+
if (!Ce() && N(ue)) try {
|
|
830
|
+
let e = await import(De(ue).href);
|
|
855
831
|
if (e.modules) {
|
|
856
832
|
let t = {};
|
|
857
|
-
for (let [n, r] of Object.entries(e.modules)) t[
|
|
833
|
+
for (let [n, r] of Object.entries(e.modules)) t[Ee(f, n)] = r;
|
|
858
834
|
Se(t), $.info("precompiled api bundle loaded", { modules: Object.keys(t).length });
|
|
859
835
|
}
|
|
860
836
|
} catch (e) {
|
|
861
837
|
$.warn("precompiled api bundle failed to load — falling back to source", {}, e);
|
|
862
838
|
}
|
|
863
|
-
let
|
|
839
|
+
let S = await ce(f), C = await ge(S, { cdc: _ && ae !== void 0 }), fe = S.filter((e) => xe.test(e)), he = fe.length > 0 ? await g(fe, $.child("webhooks")) : void 0, ye = me({
|
|
864
840
|
mix: C.featureMix,
|
|
865
841
|
plugins: m?.plugins ?? [],
|
|
866
|
-
cdc:
|
|
867
|
-
...
|
|
868
|
-
}), be = m?.analytics !== void 0 && m.analytics.kind !== "noop" && h !== "memory" ? (await
|
|
842
|
+
cdc: _ && ae !== void 0,
|
|
843
|
+
...ae ? { cdcDialect: ae } : {}
|
|
844
|
+
}), be = m?.analytics !== void 0 && m.analytics.kind !== "noop" && h !== "memory" ? (await E(h)).makeSqlLayer(x()) : void 0, D = await ne({
|
|
869
845
|
spec: m?.analytics,
|
|
870
846
|
sqlLayer: be,
|
|
871
847
|
log: $
|
|
@@ -875,55 +851,55 @@ var Jt = () => {
|
|
|
875
851
|
return t;
|
|
876
852
|
})();
|
|
877
853
|
for (let e of O) ht(e);
|
|
878
|
-
let
|
|
879
|
-
if (pn(
|
|
880
|
-
let e = (await
|
|
881
|
-
appliedBy: `serve:${
|
|
854
|
+
let M = (process.env.NODE_ENV ?? "").toLowerCase();
|
|
855
|
+
if (pn(M, h, process.env.VOLTRO_AUTO_MIGRATE)) {
|
|
856
|
+
let e = (await E(h)).makeSqlLayer(x()), t = await A.runPromise(pt.SqlClient.pipe(A.flatMap((e) => Nt(e, O, {
|
|
857
|
+
appliedBy: `serve:${M}`,
|
|
882
858
|
environment: "prod",
|
|
883
859
|
dialectId: h
|
|
884
|
-
})),
|
|
885
|
-
t.kind === "prod-mismatch" && ($.error(
|
|
860
|
+
})), A.provide(e)));
|
|
861
|
+
t.kind === "prod-mismatch" && ($.error(Mt(t, h)), $.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(Mt(t, h));
|
|
886
862
|
}
|
|
887
|
-
let ke =
|
|
863
|
+
let ke = Qe(O);
|
|
888
864
|
s.mark("discover");
|
|
889
|
-
let
|
|
865
|
+
let P = await pe(m, void 0);
|
|
890
866
|
m?.cache && !process.env.CACHE_BACKEND && (process.env.CACHE_BACKEND = m.cache), m?.cacheRedisUrl && !process.env.CACHE_REDIS_URL && (process.env.CACHE_REDIS_URL = m.cacheRedisUrl), m?.cacheRedisDriver && !process.env.CACHE_REDIS_DRIVER && (process.env.CACHE_REDIS_DRIVER = m.cacheRedisDriver), m?.cacheKeyPrefix && !process.env.CACHE_KEY_PREFIX && (process.env.CACHE_KEY_PREFIX = m.cacheKeyPrefix);
|
|
891
|
-
let { service:
|
|
892
|
-
$.info(`cache backend resolved: ${
|
|
893
|
-
|
|
867
|
+
let { service: je, invalidationBus: Me, snapshotCache: Pe, cache: F, backend: Fe, dispose: I } = await y({ env: process.env });
|
|
868
|
+
$.info(`cache backend resolved: ${Fe}` + (Fe === "redis" ? ` (driver ${process.env.CACHE_REDIS_DRIVER ?? "resp"})` : " — in-process, not cross-instance")), P.onChange((e) => {
|
|
869
|
+
A.runFork(Me.publish(e.table));
|
|
894
870
|
}), m?.kv && !process.env.KV_BACKEND && (process.env.KV_BACKEND = m.kv), m?.kvRedisUrl && !process.env.KV_REDIS_URL && (process.env.KV_REDIS_URL = m.kvRedisUrl), m?.kvKeyPrefix && !process.env.KV_KEY_PREFIX && (process.env.KV_KEY_PREFIX = m.kvKeyPrefix);
|
|
895
|
-
let { kv:
|
|
871
|
+
let { kv: Ie, service: Le } = await R({ store: P });
|
|
896
872
|
s.mark("store");
|
|
897
|
-
let
|
|
898
|
-
store:
|
|
873
|
+
let He = Ne({
|
|
874
|
+
store: P,
|
|
899
875
|
sink: D.sink,
|
|
900
876
|
log: $
|
|
901
|
-
}),
|
|
902
|
-
store:
|
|
877
|
+
}), Ue = n({
|
|
878
|
+
store: P,
|
|
903
879
|
dialect: h
|
|
904
|
-
}), L = m?.plugins ?? [],
|
|
905
|
-
h !== "memory" && (
|
|
906
|
-
let
|
|
880
|
+
}), L = m?.plugins ?? [], qe = process.env.POD_NAME ?? process.env.HOSTNAME ?? `serve-${process.pid}`, Je, Ye;
|
|
881
|
+
h !== "memory" && (Je = Oe.make((await E(h)).makeSqlLayer(x())), Ye = await Je.runPromise(pt.SqlClient));
|
|
882
|
+
let Xe = Ke({
|
|
907
883
|
coordinator: [
|
|
908
884
|
"postgres",
|
|
909
885
|
"mariadb",
|
|
910
886
|
"mysql",
|
|
911
887
|
"mssql"
|
|
912
|
-
].includes(h) ?
|
|
913
|
-
replicaId:
|
|
888
|
+
].includes(h) ? We(P, qe, $) : lt,
|
|
889
|
+
replicaId: qe,
|
|
914
890
|
log: $
|
|
915
|
-
}),
|
|
916
|
-
...
|
|
891
|
+
}), Ze = [], $e = {
|
|
892
|
+
...Ye ? { sql: Ye } : {},
|
|
917
893
|
scheduleCoordinated: (e, t, n) => {
|
|
918
|
-
let r =
|
|
919
|
-
return
|
|
894
|
+
let r = Xe(e, t, n);
|
|
895
|
+
return Ze.push(r), r;
|
|
920
896
|
}
|
|
921
897
|
};
|
|
922
|
-
for (let e of L) e.bindDataStore?.(
|
|
923
|
-
let
|
|
924
|
-
if (
|
|
925
|
-
let e =
|
|
926
|
-
|
|
898
|
+
for (let e of L) e.bindDataStore?.(P, $e);
|
|
899
|
+
let et = L.filter((e) => typeof e.onChangeEvent == "function");
|
|
900
|
+
if (et.length > 0) {
|
|
901
|
+
let e = P.changeScope ?? "local";
|
|
902
|
+
P.onChange((t) => {
|
|
927
903
|
let n = {
|
|
928
904
|
table: t.table,
|
|
929
905
|
op: t.op,
|
|
@@ -932,62 +908,62 @@ var Jt = () => {
|
|
|
932
908
|
...t.origin === void 0 ? {} : { origin: t.origin },
|
|
933
909
|
changeScope: e
|
|
934
910
|
};
|
|
935
|
-
for (let e of
|
|
911
|
+
for (let e of et) A.runFork(e.onChangeEvent(n).pipe(A.catchAllCause((t) => A.sync(() => $.warn(`plugin ${e.name} onChangeEvent failed`, { error: k.pretty(t) })))));
|
|
936
912
|
});
|
|
937
913
|
}
|
|
938
|
-
let
|
|
914
|
+
let tt = oe({
|
|
939
915
|
plugins: L,
|
|
940
916
|
appName: m?.name ?? "voltro-api",
|
|
941
917
|
appType: "api",
|
|
942
918
|
voltroVersion: process.env.npm_package_version ?? "0.0.0",
|
|
943
919
|
log: $
|
|
944
920
|
});
|
|
945
|
-
L.length && await
|
|
946
|
-
let
|
|
921
|
+
L.length && await tt.activate(), s.mark("plugins");
|
|
922
|
+
let nt = await tt.gatherObservability(), rt = await b(P, m, h, {
|
|
947
923
|
info: (e, t) => process.stdout.write(`[broadcast] ${e} ${t ? JSON.stringify(t) : ""}\n`),
|
|
948
924
|
warn: (e, t) => process.stderr.write(`[broadcast] ${e} ${t ? JSON.stringify(t) : ""}\n`),
|
|
949
925
|
debug: () => {}
|
|
950
|
-
}), z = m?.apiKeys,
|
|
951
|
-
store:
|
|
926
|
+
}), z = m?.apiKeys, at = (typeof z == "object" ? z.prefix : void 0) ?? "voltro_", st = z ? Ge(ze(P), { prefix: at }) : void 0, ct = st ? [Ve(st, { prefix: at })] : [], ut = ve([...m?.auth?.strategies ?? [], ...ct], Ft(m?.plugins ?? []), m?.auth?.anonymousTenantRequired ?? !1), dt = [...m?.restRoutes ?? [], ...st ? Ae(st, (typeof z == "object" ? z.managementPath : void 0) ?? "/v1/api-keys") : []], B = m?.idempotency, ft = B ? {
|
|
927
|
+
store: Be(P),
|
|
952
928
|
header: (typeof B == "object" ? B.header : void 0) ?? "Idempotency-Key",
|
|
953
929
|
ttlMs: (typeof B == "object" ? B.ttlMs : void 0) ?? 864e5
|
|
954
|
-
} : void 0,
|
|
955
|
-
store:
|
|
956
|
-
resolveSubject: (e) =>
|
|
930
|
+
} : void 0, mt = dt.length > 0 ? Lt(dt, {
|
|
931
|
+
store: P,
|
|
932
|
+
resolveSubject: (e) => ut({
|
|
957
933
|
headers: e,
|
|
958
934
|
clientId: -1
|
|
959
935
|
}),
|
|
960
|
-
...
|
|
961
|
-
}) : [],
|
|
936
|
+
...ft ? { idempotency: ft } : {}
|
|
937
|
+
}) : [], V = L.map((e) => e.services).filter((e) => e !== void 0), gt = j.mergeAll(ie({
|
|
962
938
|
analyticsLayer: D.layer,
|
|
963
|
-
cacheService:
|
|
964
|
-
kvService:
|
|
965
|
-
pluginServices:
|
|
939
|
+
cacheService: je,
|
|
940
|
+
kvService: Le,
|
|
941
|
+
pluginServices: V,
|
|
966
942
|
userLayers: m?.layers ?? []
|
|
967
|
-
}),
|
|
943
|
+
}), d), _t = m?.scheduling ?? {}, vt = _t.trigger ?? "self", yt = /* @__PURE__ */ new Set([
|
|
968
944
|
"postgres",
|
|
969
945
|
"mysql",
|
|
970
946
|
"mariadb",
|
|
971
947
|
"mssql"
|
|
972
|
-
]),
|
|
973
|
-
|
|
974
|
-
let xt,
|
|
975
|
-
if (
|
|
948
|
+
]), H = _t.coordination ?? (yt.has(h) ? "advisoryLock" : "single"), U = H === "cluster" && yt.has(h), bt = U ? "cluster" : H === "advisoryLock" && yt.has(h) ? "advisoryLock" : "single";
|
|
949
|
+
H === "cluster" && !U && $.warn("scheduling.coordination=cluster needs a sql-backed store except sqlite — falling back to single"), H === "advisoryLock" && !yt.has(h) && $.warn("scheduling.coordination=advisoryLock needs a SQL store (the claim-row gate) — falling back to single");
|
|
950
|
+
let xt, W = C.workflows.length > 0 || C.workflowWorkers.length > 0 || C.eventTriggers.length > 0 || (he?.outgoing.length ?? 0) > 0 || U, St;
|
|
951
|
+
if (W) {
|
|
976
952
|
if (h === "mssql") {
|
|
977
953
|
let e = await l(process.cwd());
|
|
978
954
|
e && $.warn(e);
|
|
979
955
|
}
|
|
980
|
-
let [{ WorkflowEngine: e }, { makeClusterCronLayer: t, workflowEngineLayer: n, resolveRunnerStorage: r }] = await Promise.all([import("@effect/workflow"), import("@voltro/workflow/cluster")]), i = U ? C.schedules.filter((e) => (e.trigger ??
|
|
956
|
+
let [{ WorkflowEngine: e }, { makeClusterCronLayer: t, workflowEngineLayer: n, resolveRunnerStorage: r }] = await Promise.all([import("@effect/workflow"), import("@voltro/workflow/cluster")]), i = U ? C.schedules.filter((e) => (e.trigger ?? vt) === "self").map((e) => t({
|
|
981
957
|
name: e.name,
|
|
982
|
-
cron:
|
|
958
|
+
cron: Re(e),
|
|
983
959
|
execute: async () => {
|
|
984
960
|
await xt?.fireFromCluster(e.name);
|
|
985
961
|
}
|
|
986
962
|
})) : [];
|
|
987
|
-
|
|
988
|
-
let e = await
|
|
963
|
+
St = h === "memory" ? e.layerMemory : await (async () => {
|
|
964
|
+
let e = await E(h), t = r({ sqliteFamily: e.id === "sqlite" || e.id === "turso" });
|
|
989
965
|
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({
|
|
990
|
-
sqlClientLayer: e.makeSqlLayer(
|
|
966
|
+
sqlClientLayer: e.makeSqlLayer(x()),
|
|
991
967
|
runnerStorage: t,
|
|
992
968
|
dialectId: e.id,
|
|
993
969
|
...process.env.VOLTRO_WORKFLOW_RUNNER_PORT ? { runnerListenPort: Number(process.env.VOLTRO_WORKFLOW_RUNNER_PORT) } : {},
|
|
@@ -995,18 +971,18 @@ var Jt = () => {
|
|
|
995
971
|
});
|
|
996
972
|
})();
|
|
997
973
|
}
|
|
998
|
-
let Ct =
|
|
999
|
-
if (
|
|
1000
|
-
|
|
974
|
+
let Ct = le(L, t()), G = S.filter((e) => /\.subscribe\.tsx?$/.test(e)), wt = G.length > 0 ? await u(G, $) : [], Tt = S.filter((e) => /\.reaction\.tsx?$/.test(e)), Et = Tt.length > 0 ? await r(Tt, $) : [], K = S.filter((e) => /\.outbox\.tsx?$/.test(e)), Dt = K.length > 0 ? await p(K, $) : [], q = S.filter((e) => /\.aggregate\.tsx?$/.test(e)), J = q.length > 0 ? await te(q, $) : [], Y = o();
|
|
975
|
+
if (J.length > 0 && h !== "memory") try {
|
|
976
|
+
Y = a((await E(h)).makeSqlLayer(x()));
|
|
1001
977
|
} catch (e) {
|
|
1002
978
|
$.warn("aggregate: SQL storage init failed — falling back to in-process", { err: String(e) });
|
|
1003
979
|
}
|
|
1004
|
-
let
|
|
980
|
+
let Ot = h === "memory" ? lt : We(P, `aggregate@${process.pid}`, $), X = [], kt = [], Z = S.filter((e) => de.test(e));
|
|
1005
981
|
if (Z.length > 0) {
|
|
1006
|
-
let e = $.child("agent"), t =
|
|
1007
|
-
t.length > 0 && await
|
|
1008
|
-
let n = await
|
|
1009
|
-
for (let e of n.agents) for (let t of
|
|
982
|
+
let e = $.child("agent"), t = S.filter((e) => v.test(e));
|
|
983
|
+
t.length > 0 && await _e(t, e);
|
|
984
|
+
let n = await T(Z, e);
|
|
985
|
+
for (let e of n.agents) for (let t of se(e)) (t.kind === "action" ? X : kt).push({
|
|
1010
986
|
file: t.file,
|
|
1011
987
|
descriptor: t.descriptor,
|
|
1012
988
|
executor: t.executor
|
|
@@ -1014,46 +990,46 @@ var Jt = () => {
|
|
|
1014
990
|
n.agents.length > 0 && e.info("synthesized agent routes", { agents: n.agents.map((e) => e.descriptor.name) });
|
|
1015
991
|
}
|
|
1016
992
|
s.mark("workflow");
|
|
1017
|
-
let
|
|
993
|
+
let At = await fn({
|
|
1018
994
|
bootTiming: s,
|
|
1019
995
|
discovered: {
|
|
1020
|
-
queries: [...C.queries, ...
|
|
996
|
+
queries: [...C.queries, ...kt],
|
|
1021
997
|
mutations: C.mutations,
|
|
1022
|
-
actions: [...C.actions, ...
|
|
998
|
+
actions: [...C.actions, ...X],
|
|
1023
999
|
streams: C.streams,
|
|
1024
1000
|
workflows: C.workflows,
|
|
1025
1001
|
workflowWorkers: C.workflowWorkers,
|
|
1026
1002
|
eventTriggers: C.eventTriggers,
|
|
1027
1003
|
schedules: C.schedules,
|
|
1028
|
-
subscribers:
|
|
1004
|
+
subscribers: wt,
|
|
1029
1005
|
outboxHandlers: Dt,
|
|
1030
1006
|
connections: C.connections,
|
|
1031
1007
|
reactions: Et,
|
|
1032
|
-
aggregates:
|
|
1033
|
-
...
|
|
1008
|
+
aggregates: J,
|
|
1009
|
+
...he === void 0 ? {} : { webhooks: he }
|
|
1034
1010
|
},
|
|
1035
1011
|
log: $,
|
|
1036
1012
|
analytics: D.sink,
|
|
1037
|
-
aggregateStorage:
|
|
1038
|
-
aggregateCoordinator:
|
|
1039
|
-
store:
|
|
1040
|
-
kv:
|
|
1013
|
+
aggregateStorage: Y,
|
|
1014
|
+
aggregateCoordinator: Ot,
|
|
1015
|
+
store: P,
|
|
1016
|
+
kv: Ie,
|
|
1041
1017
|
cache: F,
|
|
1042
|
-
snapshotCache:
|
|
1018
|
+
snapshotCache: Pe,
|
|
1043
1019
|
schemaRegistry: ke,
|
|
1044
1020
|
tenantScopedTables: C.tenantScopedTables,
|
|
1045
1021
|
softDeleteScopedTables: C.softDeleteScopedTables,
|
|
1046
|
-
dataTransferSnapshot:
|
|
1022
|
+
dataTransferSnapshot: jt(O),
|
|
1047
1023
|
dataTransferDialect: h,
|
|
1048
1024
|
tenantIsolation: (process.env.VOLTRO_TENANT_ISOLATION ?? m?.tenancy?.isolation) === "namespace" ? "namespace" : "shared-schema",
|
|
1049
|
-
resolveSubject: (e, t) =>
|
|
1025
|
+
resolveSubject: (e, t) => ut({
|
|
1050
1026
|
headers: e,
|
|
1051
1027
|
clientId: t
|
|
1052
1028
|
}),
|
|
1053
|
-
httpRoutes: [...L.flatMap((e) => e.httpRoutes ?? []), ...
|
|
1054
|
-
...
|
|
1055
|
-
...
|
|
1056
|
-
scheduleDefaultTrigger:
|
|
1029
|
+
httpRoutes: [...L.flatMap((e) => e.httpRoutes ?? []), ...mt],
|
|
1030
|
+
...gt ? { baseLayer: gt } : {},
|
|
1031
|
+
...St === void 0 ? {} : { workflowEngineLayer: St },
|
|
1032
|
+
scheduleDefaultTrigger: vt,
|
|
1057
1033
|
scheduleCoordination: bt,
|
|
1058
1034
|
scheduleArmSelf: !U,
|
|
1059
1035
|
dormancy: process.env.VOLTRO_DORMANCY === "sleep" || process.env.VOLTRO_DORMANCY === "always-on" ? process.env.VOLTRO_DORMANCY : m?.dormancy ?? "always-on",
|
|
@@ -1062,18 +1038,18 @@ var Jt = () => {
|
|
|
1062
1038
|
onSchedulerReady: (e) => {
|
|
1063
1039
|
xt = e;
|
|
1064
1040
|
},
|
|
1065
|
-
observability:
|
|
1066
|
-
port:
|
|
1041
|
+
observability: nt,
|
|
1042
|
+
port: ee,
|
|
1067
1043
|
...m?.transport?.wsPath ? { path: m.transport.wsPath } : {}
|
|
1068
1044
|
});
|
|
1069
|
-
c(
|
|
1045
|
+
c(re([
|
|
1070
1046
|
C.queries,
|
|
1071
1047
|
C.mutations,
|
|
1072
1048
|
C.actions,
|
|
1073
1049
|
C.streams
|
|
1074
1050
|
]), (e) => {
|
|
1075
1051
|
$.warn(e);
|
|
1076
|
-
}), $.info(`API listening on :${
|
|
1052
|
+
}), $.info(`API listening on :${ee}`, {
|
|
1077
1053
|
dialect: h,
|
|
1078
1054
|
queries: C.queries.length,
|
|
1079
1055
|
mutations: C.mutations.length,
|
|
@@ -1085,8 +1061,8 @@ var Jt = () => {
|
|
|
1085
1061
|
scheduleCoordination: bt
|
|
1086
1062
|
}), s.finish($);
|
|
1087
1063
|
let It = () => {
|
|
1088
|
-
for (let e of
|
|
1089
|
-
|
|
1064
|
+
for (let e of Ze) e.stop();
|
|
1065
|
+
He.detach(), Ue.stop(), I(), Je?.dispose(), Promise.resolve(tt.deactivate()).then(() => rt?.close()).then(() => D.dispose()).then(() => At.close()).then(() => P.close?.()).then(() => process.exit(0));
|
|
1090
1066
|
};
|
|
1091
1067
|
return process.on("SIGINT", It), process.on("SIGTERM", It), await new Promise(() => {}), 0;
|
|
1092
1068
|
};
|