@voltro/cli 0.10.0 → 0.11.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.
Files changed (50) hide show
  1. package/CHANGELOG.md +84 -0
  2. package/dist/apiBuild-BCv3bekE.js +2 -0
  3. package/dist/{apiBuild-DTLPSlt9.js → apiBuild-BUbgGz73.js} +1 -1
  4. package/dist/bin.js +1 -1
  5. package/dist/{commands-B0QT8dUY.js → commands-C1qBfIBI.js} +34 -5
  6. package/dist/dev-DKASElZP.js +2 -0
  7. package/dist/{dev-CK9fbuAM.js → dev-ITlO-epO.js} +1248 -1226
  8. package/dist/index.js +1 -1
  9. package/dist/{serveCommand-YR3mKjvf.js → serveCommand-mpsE3vLY.js} +175 -171
  10. package/dist/serveEntry.js +2 -2
  11. package/package.json +17 -17
  12. package/templates/agent-docs/data.md +36 -0
  13. package/templates/agent-docs/database/seedsdialects.md +21 -1
  14. package/templates/apps/api-ai/package.json +7 -7
  15. package/templates/apps/api-auth/package.json +8 -8
  16. package/templates/apps/api-backend/package.json +7 -7
  17. package/templates/apps/api-backend-deactivation/package.json +7 -7
  18. package/templates/apps/api-backend-mail/package.json +8 -8
  19. package/templates/apps/api-backend-mariadb/package.json +9 -9
  20. package/templates/apps/api-backend-storage/package.json +8 -8
  21. package/templates/apps/api-data-advanced/package.json +8 -8
  22. package/templates/apps/api-durable/package.json +8 -8
  23. package/templates/apps/api-feature-flags/package.json +9 -9
  24. package/templates/apps/api-governance/package.json +8 -8
  25. package/templates/apps/api-kv/package.json +8 -8
  26. package/templates/apps/api-moderation/package.json +8 -8
  27. package/templates/apps/api-observability/package.json +8 -8
  28. package/templates/apps/api-ratelimit/package.json +8 -8
  29. package/templates/apps/api-rbac/package.json +8 -8
  30. package/templates/apps/api-rest/package.json +7 -7
  31. package/templates/apps/api-saas/package.json +11 -11
  32. package/templates/apps/api-search/package.json +8 -8
  33. package/templates/apps/api-versioning/package.json +8 -8
  34. package/templates/apps/api-webhooks/package.json +8 -8
  35. package/templates/apps/changelog/package.json +6 -6
  36. package/templates/apps/edge-functions/package.json +2 -2
  37. package/templates/apps/frontend-admin/package.json +8 -8
  38. package/templates/apps/frontend-app/package.json +8 -8
  39. package/templates/apps/frontend-blank/package.json +7 -7
  40. package/templates/apps/frontend-contact/package.json +7 -7
  41. package/templates/apps/frontend-dashboard/package.json +7 -7
  42. package/templates/apps/frontend-docs/package.json +7 -7
  43. package/templates/apps/frontend-i18n/package.json +6 -6
  44. package/templates/apps/frontend-landing/package.json +7 -7
  45. package/templates/apps/frontend-spa/package.json +7 -7
  46. package/templates/apps/frontend-ssr/package.json +7 -7
  47. package/templates/apps/frontend-ssr-api/package.json +8 -8
  48. package/templates/apps/frontend-static-blog/package.json +6 -6
  49. package/dist/apiBuild-BbR1nYcE.js +0 -2
  50. package/dist/dev-BJvbwjSz.js +0 -2
@@ -1,30 +1,30 @@
1
1
  import { t as e, yt as t } from "./inspectMetrics-BeMjgt8x.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, K as f, M as p, N as ee, O as m, P as h, Q as g, S as te, T as ne, U as re, W as ie, X as ae, Y as _, Z as oe, _ as se, at as v, b as ce, d as le, f as y, g as b, h as x, i as S, it as ue, j as C, k as de, lt as w, m as fe, n as pe, o as me, ot as T, q as E, rt as he, s as ge, t as _e, tt as ve, v as ye, w as be, x as xe, y as D } from "./dev-CK9fbuAM.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, K as f, M as p, N as ee, O as m, P as h, Q as g, S as te, T as ne, U as re, W as ie, X as ae, Y as _, Z as oe, _ as se, at as v, b as ce, d as le, f as y, g as b, h as x, i as S, it as ue, j as C, k as de, lt as w, m as fe, n as pe, o as me, ot as T, q as E, rt as he, s as ge, t as _e, tt as ve, v as ye, w as be, x as xe, y as D } from "./dev-ITlO-epO.js";
3
3
  import { a as Se, r as Ce } from "./startupRunner-DhlX9nqd.js";
4
- import { a as O, t as we } from "./apiBuild-DTLPSlt9.js";
4
+ import { a as O, t as we } from "./apiBuild-BUbgGz73.js";
5
5
  import { join as Te } from "node:path";
6
6
  import { pathToFileURL as Ee } from "node:url";
7
7
  import { Cause as De, Effect as k, Layer as A, ManagedRuntime as Oe } from "effect";
8
8
  import { createLogger as j } from "@voltro/logger";
9
9
  import { existsSync as M } from "node:fs";
10
- import { AggregateRegistry as ke, Dispatcher as N, apiKeyManagementRoutes as P, applySoftDeleteScope as Ae, applyTenantScope as je, attachAnalyticsMirror as Me, awaitServerListening as Ne, bindMutation as F, bindStream as Pe, bindSubscription as I, buildTracingLayer as Fe, cancelWakeup as Ie, compileCron as Le, dataStoreApiKeyStore as Re, dataStoreIdempotencyStore as ze, frameworkApiKeyStrategy as Be, installPolicyGuardResolver as Ve, loadResourceTuples as He, makeActionRunner as L, makeAdvisoryLockCoordinator as Ue, makeApiKeyService as We, makeAsyncKv as Ge, makeCoordinatedScheduler as R, makeEffectStoreLayer as Ke, makeLazyWorkflowFacade as qe, makeMutationRunner as Je, makeQueryDescriptorProducer as Ye, makeQueryReauthorizer as Xe, makeSchemaRegistry as Ze, makeWorkflowFacade as Qe, makeWorkflowFacadeWithCallerContext as $e, makeWorkflowLayers as et, noopKv as tt, recordSubscriptionDelivery as nt, registerWakeup as z, resolveSecretsBackend as rt, runProvidedEffect as it, setSecretsBackend as at, setTupleSource as ot, singleCoordinator as st, startRpcServer as ct, startScheduler as lt, workflowToRpc as ut } from "@voltro/runtime";
11
- import { createHash as B, timingSafeEqual as V } from "node:crypto";
12
- import { assertProductionSessionSecret as dt } from "@voltro/protocol/session";
13
- import { RpcGroup as ft } from "@effect/rpc";
14
- import { SqlClient as pt } from "@effect/sql";
15
- import { and as mt, ensureTableRegistered as ht, eq as H, or as gt } from "@voltro/database";
16
- import { fromNodeReadable as _t, getObjectStream as vt, putObjectStream as yt, resolveStorageProvider as U, toNodeReadable as bt } from "@voltro/plugin-storage";
17
- import { AuthMiddleware as xt, ConnectionInfoMiddleware as St, actionToRpc as W, anonymousSubject as Ct, mutationToRpc as wt, queryToRpc as G, streamToRpc as Tt, workflowCancelDescriptor as Et, workflowDomainEventsQueryDescriptor as K, workflowEventDeliveriesQueryDescriptor as Dt, workflowResumeDescriptor as Ot, workflowRunEventsQueryDescriptor as q, workflowRunQueryDescriptor as J, workflowRunStepsQueryDescriptor as kt, workflowRunsQueryDescriptor as Y, workflowSignalDescriptor as X, workflowUpdateDescriptor as Z } from "@voltro/protocol";
18
- import { declaredSnapshot as At, describeOutcome as jt, runPlannedMigrations as Mt } from "@voltro/database/sql";
19
- import { getAuthSessionStrategy as Nt } from "@voltro/plugin-auth";
20
- import { collectPublicApiRoutes as Pt, restRoutesToHttpRoutes as Ft } from "@voltro/protocol/rest";
21
- import { buildDeliverWebhookExecute as It, buildWebhooksService as Lt, defaultIncomingPath as Rt, deliverWebhookWorkflow as zt, mountIncomingWebhook as Bt } from "@voltro/plugin-webhooks";
22
- import { packBundle as Vt, runExport as Ht, runImport as Ut, storageBlobSink as Wt, storageRefsBlobSource as Gt, unpackBundle as Kt, unpackBundleToDir as qt } from "@voltro/data-transfer";
10
+ import { AggregateRegistry as ke, Dispatcher as N, apiKeyManagementRoutes as P, applySoftDeleteScope as Ae, applyTenantScope as je, attachAnalyticsMirror as Me, awaitServerListening as Ne, bindMutation as F, bindStream as Pe, bindSubscription as I, buildTracingLayer as Fe, cancelWakeup as Ie, compileCron as Le, dataStoreApiKeyStore as Re, dataStoreIdempotencyStore as ze, frameworkApiKeyStrategy as Be, installPolicyGuardResolver as Ve, loadResourceTuples as He, makeActionRunner as L, makeAdvisoryLockCoordinator as Ue, makeApiKeyService as We, makeAsyncKv as Ge, makeCoordinatedScheduler as R, makeEffectStoreLayer as Ke, makeLazyWorkflowFacade as qe, makeMutationRunner as Je, makeQueryDescriptorProducer as Ye, makeQueryReauthorizer as Xe, makeSchemaRegistry as Ze, makeWorkflowFacade as Qe, makeWorkflowFacadeWithCallerContext as $e, makeWorkflowLayers as et, noopKv as tt, recordSubscriptionDelivery as nt, registerWakeup as z, resolveSecretsBackend as rt, runProvidedEffect as it, setSecretsBackend as at, setSystemStoreHandle as ot, setTupleSource as st, singleCoordinator as ct, startRpcServer as lt, startScheduler as ut, workflowToRpc as B } from "@voltro/runtime";
11
+ import { createHash as V, timingSafeEqual as dt } from "node:crypto";
12
+ import { assertProductionSessionSecret as ft } from "@voltro/protocol/session";
13
+ import { RpcGroup as pt } from "@effect/rpc";
14
+ import { SqlClient as mt } from "@effect/sql";
15
+ import { and as ht, ensureTableRegistered as gt, eq as H, or as _t } from "@voltro/database";
16
+ import { fromNodeReadable as vt, getObjectStream as yt, putObjectStream as U, resolveStorageProvider as W, toNodeReadable as bt } from "@voltro/plugin-storage";
17
+ import { AuthMiddleware as xt, ConnectionInfoMiddleware as G, actionToRpc as K, anonymousSubject as St, mutationToRpc as Ct, queryToRpc as q, streamToRpc as wt, workflowCancelDescriptor as Tt, workflowDomainEventsQueryDescriptor as Et, workflowEventDeliveriesQueryDescriptor as J, workflowResumeDescriptor as Dt, workflowRunEventsQueryDescriptor as Y, workflowRunQueryDescriptor as Ot, workflowRunStepsQueryDescriptor as X, workflowRunsQueryDescriptor as Z, workflowSignalDescriptor as kt, workflowUpdateDescriptor as At } from "@voltro/protocol";
18
+ import { declaredSnapshot as jt, describeOutcome as Mt, runPlannedMigrations as Nt } from "@voltro/database/sql";
19
+ import { getAuthSessionStrategy as Pt } from "@voltro/plugin-auth";
20
+ import { collectPublicApiRoutes as Ft, restRoutesToHttpRoutes as It } from "@voltro/protocol/rest";
21
+ import { buildDeliverWebhookExecute as Lt, buildWebhooksService as Rt, defaultIncomingPath as zt, deliverWebhookWorkflow as Bt, mountIncomingWebhook as Vt } from "@voltro/plugin-webhooks";
22
+ import { packBundle as Ht, runExport as Ut, runImport as Wt, storageBlobSink as Gt, storageRefsBlobSource as Kt, unpackBundle as qt, unpackBundleToDir as Jt } from "@voltro/data-transfer";
23
23
  //#region src/bootTiming.ts
24
- var Jt = () => {
24
+ var Yt = () => {
25
25
  let e = process.env.VOLTRO_BOOT_TIMING;
26
26
  return e === "1" || e === "true";
27
- }, Yt = () => {
27
+ }, Xt = () => {
28
28
  let e = [{
29
29
  name: "modules",
30
30
  at: performance.now()
@@ -38,7 +38,7 @@ var Jt = () => {
38
38
  },
39
39
  finish: (t) => {
40
40
  let n = Math.round(e[e.length - 1].at);
41
- if (!Jt()) {
41
+ if (!Yt()) {
42
42
  t.info(`serve: ready in ${n}ms`);
43
43
  return;
44
44
  }
@@ -50,25 +50,25 @@ var Jt = () => {
50
50
  });
51
51
  }
52
52
  };
53
- }, Xt = "/_voltro/admin/import", Zt = "/_voltro/admin/export", Q = (e, t) => ({
53
+ }, Zt = "/_voltro/admin/import", Qt = "/_voltro/admin/export", Q = (e, t) => ({
54
54
  status: e,
55
55
  contentType: "application/json; charset=utf-8",
56
56
  body: JSON.stringify(t)
57
- }), Qt = (e) => {
57
+ }), $t = (e) => {
58
58
  let t = e.authorization ?? e.Authorization, n = t ? /^Bearer\s+(.+)$/i.exec(t) : null;
59
59
  return n ? n[1] : null;
60
- }, $t = (e, t) => V(B("sha256").update(e).digest(), B("sha256").update(t).digest()), en = (e, t) => {
60
+ }, en = (e, t) => dt(V("sha256").update(e).digest(), V("sha256").update(t).digest()), tn = (e, t) => {
61
61
  if (e.method.toUpperCase() !== "POST") return Q(405, { error: "method not allowed" });
62
62
  if (!t || t.length < 16) return Q(503, { error: "data transfer misconfigured (no/weak secret)" });
63
- let n = Qt(e.headers);
64
- return !n || !$t(n, t) ? Q(401, { error: "unauthorized" }) : null;
65
- }, tn = j({ scope: "voltro:admin-import" }), nn = "VBUNDLE2", rn = async function* (e) {
63
+ let n = $t(e.headers);
64
+ return !n || !en(n, t) ? Q(401, { error: "unauthorized" }) : null;
65
+ }, nn = j({ scope: "voltro:admin-import" }), rn = "VBUNDLE2", an = async function* (e) {
66
66
  yield e;
67
- }, an = (e) => async (t) => {
68
- let n = en(t, e.secret);
67
+ }, on = (e) => async (t) => {
68
+ let n = tn(t, e.secret);
69
69
  if (n) return n;
70
- 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") === nn, c, l;
71
- if (s) c = rn(t.rawBody), l = "upload";
70
+ 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") === rn, c, l;
71
+ if (s) c = an(t.rawBody), l = "upload";
72
72
  else {
73
73
  let n;
74
74
  try {
@@ -82,11 +82,11 @@ var Jt = () => {
82
82
  }
83
83
  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
84
  try {
85
- e.assetSink ? await Kt(c, {
85
+ e.assetSink ? await qt(c, {
86
86
  dir: p,
87
87
  blobs: e.assetSink
88
- }) : await qt(c, p);
89
- let t = await k.runPromiseExit(Ut({
88
+ }) : await Jt(c, p);
89
+ let t = await k.runPromiseExit(Wt({
90
90
  store: e.store,
91
91
  bundleDir: p,
92
92
  ...r ? { mode: r } : {},
@@ -94,14 +94,14 @@ var Jt = () => {
94
94
  ...a ? { atomic: a } : {},
95
95
  ...e.snapshot ? { targetSnapshot: e.snapshot } : {},
96
96
  force: o,
97
- onWarn: (e) => tn.warn("admin.import", { message: e }),
97
+ onWarn: (e) => nn.warn("admin.import", { message: e }),
98
98
  ...e.assetSink ? { assetsAlreadyRestored: !0 } : {}
99
99
  }));
100
100
  if (t._tag === "Failure") {
101
101
  let e = t.cause._tag === "Fail" ? t.cause.error : void 0;
102
102
  if (e && e._tag === "SchemaDriftError") {
103
103
  let t = e;
104
- return tn.warn("admin.import refused (schema drift)", {
104
+ return nn.warn("admin.import refused (schema drift)", {
105
105
  transport: l,
106
106
  bundle: t.bundleFingerprint.slice(0, 16),
107
107
  target: t.targetFingerprint.slice(0, 16)
@@ -116,7 +116,7 @@ var Jt = () => {
116
116
  throw Error(String(e?.message ?? e ?? "import failed"));
117
117
  }
118
118
  let n = t.value, s = n.tables.reduce((e, t) => e + t.rowCount, 0);
119
- return tn.info("admin.import", {
119
+ return nn.info("admin.import", {
120
120
  transport: l,
121
121
  tables: n.tables.length,
122
122
  rows: s,
@@ -128,7 +128,7 @@ var Jt = () => {
128
128
  transport: l
129
129
  });
130
130
  } catch (e) {
131
- return tn.warn("admin.import failed", {
131
+ return nn.warn("admin.import failed", {
132
132
  transport: l,
133
133
  error: e?.message ?? String(e)
134
134
  }), Q(500, {
@@ -141,18 +141,18 @@ var Jt = () => {
141
141
  force: !0
142
142
  });
143
143
  }
144
- }, on = j({ scope: "voltro:admin-export" }), sn = async (e) => {
144
+ }, sn = j({ scope: "voltro:admin-export" }), cn = async (e) => {
145
145
  let t = [];
146
146
  for await (let n of e) t.push(Buffer.from(n));
147
147
  return new Uint8Array(Buffer.concat(t));
148
- }, cn = (e) => typeof e.tenant == "string" && e.tenant ? {
148
+ }, ln = (e) => typeof e.tenant == "string" && e.tenant ? {
149
149
  kind: "tenant",
150
150
  tenantId: e.tenant
151
151
  } : Array.isArray(e.tables) && e.tables.length ? {
152
152
  kind: "tables",
153
153
  tables: e.tables.filter((e) => typeof e == "string")
154
- } : { kind: "all" }, ln = (e) => async (t) => {
155
- let n = en(t, e.secret);
154
+ } : { kind: "all" }, un = (e) => async (t) => {
155
+ let n = tn(t, e.secret);
156
156
  if (n) return n;
157
157
  let r;
158
158
  try {
@@ -172,9 +172,9 @@ var Jt = () => {
172
172
  });
173
173
  }
174
174
  }
175
- 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-"));
175
+ let a = r.consistency === "snapshot" ? "snapshot" : i.consistency ?? "live", o = (typeof r.compression == "string" ? r.compression : void 0) ?? i.compression, s = i.scope ?? ln(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
176
  try {
177
- let t = await k.runPromise(Ht({
177
+ let t = await k.runPromise(Ut({
178
178
  store: e.store,
179
179
  snapshot: e.snapshot,
180
180
  dialect: e.dialect,
@@ -190,10 +190,10 @@ var Jt = () => {
190
190
  if (c) {
191
191
  if (!e.putArchive) return Q(501, { error: "storage transport not configured on this instance" });
192
192
  let i = r.bundleKey;
193
- return await e.putArchive(i, () => Vt({
193
+ return await e.putArchive(i, () => Ht({
194
194
  dir: p,
195
195
  ...l
196
- })), on.info("admin.export", {
196
+ })), sn.info("admin.export", {
197
197
  transport: "storage",
198
198
  tables: t.tables.length,
199
199
  rows: n,
@@ -207,11 +207,11 @@ var Jt = () => {
207
207
  transport: "storage"
208
208
  });
209
209
  }
210
- let d = await sn(Vt({
210
+ let d = await cn(Ht({
211
211
  dir: p,
212
212
  ...l
213
213
  }));
214
- return on.info("admin.export", {
214
+ return sn.info("admin.export", {
215
215
  transport: "download",
216
216
  tables: t.tables.length,
217
217
  rows: n,
@@ -228,7 +228,7 @@ var Jt = () => {
228
228
  }
229
229
  };
230
230
  } catch (e) {
231
- return on.warn("admin.export failed", { error: e?.message ?? String(e) }), Q(500, {
231
+ return sn.warn("admin.export failed", { error: e?.message ?? String(e) }), Q(500, {
232
232
  error: "export failed",
233
233
  message: e?.message ?? String(e)
234
234
  });
@@ -238,7 +238,7 @@ var Jt = () => {
238
238
  force: !0
239
239
  });
240
240
  }
241
- }, un = async (e) => {
241
+ }, dn = async (e) => {
242
242
  let { resolve: t } = await import("node:path"), { existsSync: n } = await import("node:fs"), r = [
243
243
  e,
244
244
  `${e}.profile.ts`,
@@ -249,7 +249,7 @@ var Jt = () => {
249
249
  let a = await import(i), o = a.default ?? a.profile;
250
250
  if (!o) throw Error(`data profile '${i}' has no default export`);
251
251
  return o;
252
- }, dn = {
252
+ }, fn = {
253
253
  get: async () => void 0,
254
254
  set: async () => {},
255
255
  setWithTags: async () => {},
@@ -258,7 +258,11 @@ var Jt = () => {
258
258
  clear: async () => {},
259
259
  invalidateTag: async () => 0,
260
260
  wrap: async (e, t, n) => n()
261
- }, fn = async (e) => {
261
+ }, pn = async (e) => {
262
+ ot({
263
+ dataStore: e.store,
264
+ schemaRegistry: e.schemaRegistry
265
+ });
262
266
  let t = new N({
263
267
  store: e.store,
264
268
  ...e.snapshotCache ? { cache: e.snapshotCache } : {},
@@ -268,7 +272,7 @@ var Jt = () => {
268
272
  durationMs: e.durationMs,
269
273
  rowCount: e.rowCount
270
274
  })
271
- }), n = e.cache ?? dn, r = e.kv ?? tt, 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) => {
275
+ }), n = e.cache ?? fn, r = e.kv ?? tt, 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
276
  let i = {
273
277
  ...r,
274
278
  source: r.source ?? `workflow:${t}`
@@ -332,8 +336,8 @@ var Jt = () => {
332
336
  cache: n,
333
337
  kv: r
334
338
  }), a = v.outgoing.map((e) => e.descriptor);
335
- se = Lt(i, async (e) => {
336
- let n = zt.execute(e).pipe(k.provide(zt.toLayer(It(i, { events: a })).pipe(A.provideMerge(t))));
339
+ se = Rt(i, async (e) => {
340
+ let n = Bt.execute(e).pipe(k.provide(Bt.toLayer(Lt(i, { events: a })).pipe(A.provideMerge(t))));
337
341
  k.runPromise(n).catch((t) => {
338
342
  ie.error("deliverWebhook workflow crashed", {
339
343
  deliveryId: e.deliveryId,
@@ -344,7 +348,7 @@ var Jt = () => {
344
348
  }
345
349
  let ce = /* @__PURE__ */ new Map();
346
350
  if (v) for (let e of v.incoming) {
347
- let t = e.descriptor.path ?? Rt(e.descriptor.id), n = `VOLTRO_WEBHOOK_SECRET_${e.descriptor.id.toUpperCase().replace(/[^A-Z0-9]/g, "_")}`, r = Bt(e.descriptor, {
351
+ let t = e.descriptor.path ?? zt(e.descriptor.id), n = `VOLTRO_WEBHOOK_SECRET_${e.descriptor.id.toUpperCase().replace(/[^A-Z0-9]/g, "_")}`, r = Vt(e.descriptor, {
348
352
  resolveSecret: async () => process.env[n] ?? null,
349
353
  resolveWorkflows: () => g === void 0 ? void 0 : $e(g, {
350
354
  traceId: `incoming:${e.descriptor.id}`,
@@ -363,7 +367,7 @@ var Jt = () => {
363
367
  });
364
368
  ce.set(t, { handle: r });
365
369
  }
366
- Ve(), ot((t) => He(e.store, t.subjectId, t.resourceType, t.resourceId));
370
+ Ve(), st((t) => He(e.store, t.subjectId, t.resourceType, t.resourceId));
367
371
  let le = (e.discovered.outboxHandlers?.length ?? 0) > 0 ? h({
368
372
  handlers: e.discovered.outboxHandlers ?? [],
369
373
  store: e.store,
@@ -423,36 +427,36 @@ var Jt = () => {
423
427
  subject: n.subject,
424
428
  traceId: he()
425
429
  })
426
- }))], _e = ge.length > 0 ? Ft(Pt(ge), {
430
+ }))], _e = ge.length > 0 ? It(Ft(ge), {
427
431
  store: e.store,
428
432
  resolveSubject: (t) => e.resolveSubject(t, -1)
429
433
  }) : [], ve = e.dataTransferSecret ?? process.env.VOLTRO_DATA_TRANSFER_SECRET, xe = ve && ve.length >= 16 ? [{
430
434
  method: "POST",
431
- path: Xt,
432
- handle: an({
435
+ path: Zt,
436
+ handle: on({
433
437
  secret: ve,
434
438
  store: e.store,
435
439
  ...e.dataTransferSnapshot ? { snapshot: e.dataTransferSnapshot } : {},
436
- assetSink: Wt(U({})),
440
+ assetSink: Gt(W({})),
437
441
  openArchive: (e) => (async function* () {
438
- let t = U({}), n = await bt((await k.runPromise(vt(t, e))).stream);
442
+ let t = W({}), n = await bt((await k.runPromise(yt(t, e))).stream);
439
443
  for await (let e of n) yield e instanceof Uint8Array ? e : new Uint8Array(e);
440
444
  })()
441
445
  })
442
446
  }, {
443
447
  method: "POST",
444
- path: Zt,
445
- handle: ln({
448
+ path: Qt,
449
+ handle: un({
446
450
  secret: ve,
447
451
  store: e.store,
448
452
  snapshot: e.dataTransferSnapshot ?? { tables: [] },
449
453
  dialect: e.dataTransferDialect ?? "memory",
450
454
  tenantTables: [...e.tenantScopedTables],
451
- loadProfile: un,
452
- assetSource: Gt(U({}), e.store),
455
+ loadProfile: dn,
456
+ assetSource: Kt(W({}), e.store),
453
457
  putArchive: async (e, t) => {
454
- let { Readable: n } = await import("node:stream"), r = U({}), i = _t("storage", () => n.from(t()));
455
- await k.runPromise(yt(r, e, i, { contentType: "application/octet-stream" }));
458
+ let { Readable: n } = await import("node:stream"), r = W({}), i = vt("storage", () => n.from(t()));
459
+ await k.runPromise(U(r, e, i, { contentType: "application/octet-stream" }));
456
460
  }
457
461
  })
458
462
  }] : [], Se = [
@@ -477,8 +481,8 @@ var Jt = () => {
477
481
  source: "workflow-rpc"
478
482
  }).start(t.definition.name, e);
479
483
  }, e, `workflow.${t.definition.name}`);
480
- te && (E[J.name] = (e) => I(T({
481
- descriptor: J,
484
+ te && (E[Ot.name] = (e) => I(T({
485
+ descriptor: Ot,
482
486
  executor: (e) => {
483
487
  let t = e.id;
484
488
  return {
@@ -487,14 +491,14 @@ var Jt = () => {
487
491
  column: "startedAt",
488
492
  direction: "desc"
489
493
  }],
490
- predicate: gt(H("id", t), H("executionId", t)),
494
+ predicate: _t(H("id", t), H("executionId", t)),
491
495
  take: 1,
492
496
  skip: void 0,
493
497
  projection: void 0
494
498
  };
495
499
  }
496
- }, e), t, `subscription.${J.name}`), E[Y.name] = (e) => I(T({
497
- descriptor: Y,
500
+ }, e), t, `subscription.${Ot.name}`), E[Z.name] = (e) => I(T({
501
+ descriptor: Z,
498
502
  executor: (e) => {
499
503
  let t = e, n = [...t.tag === void 0 ? [] : [H("tag", t.tag)], ...t.status === void 0 ? [] : [H("status", t.status)]], r = Number.isFinite(t.limit) && t.limit !== void 0 ? Math.min(Math.max(Math.floor(t.limit), 1), 500) : 100;
500
504
  return {
@@ -503,14 +507,14 @@ var Jt = () => {
503
507
  column: "startedAt",
504
508
  direction: "desc"
505
509
  }],
506
- predicate: n.length === 0 ? void 0 : n.length === 1 ? n[0] : mt(...n),
510
+ predicate: n.length === 0 ? void 0 : n.length === 1 ? n[0] : ht(...n),
507
511
  take: r,
508
512
  skip: void 0,
509
513
  projection: void 0
510
514
  };
511
515
  }
512
- }, e), t, `subscription.${Y.name}`), E[kt.name] = (e) => I(T({
513
- descriptor: kt,
516
+ }, e), t, `subscription.${Z.name}`), E[X.name] = (e) => I(T({
517
+ descriptor: X,
514
518
  executor: (e) => {
515
519
  let t = e.runId;
516
520
  return {
@@ -525,8 +529,8 @@ var Jt = () => {
525
529
  projection: void 0
526
530
  };
527
531
  }
528
- }, e), t, `subscription.${kt.name}`), E[q.name] = (e) => I(T({
529
- descriptor: q,
532
+ }, e), t, `subscription.${X.name}`), E[Y.name] = (e) => I(T({
533
+ descriptor: Y,
530
534
  executor: (e) => {
531
535
  let t = e.runId;
532
536
  return {
@@ -541,8 +545,8 @@ var Jt = () => {
541
545
  projection: void 0
542
546
  };
543
547
  }
544
- }, e), t, `subscription.${q.name}`), E[K.name] = (e) => I(T({
545
- descriptor: K,
548
+ }, e), t, `subscription.${Y.name}`), E[Et.name] = (e) => I(T({
549
+ descriptor: Et,
546
550
  executor: (e) => {
547
551
  let t = e;
548
552
  return {
@@ -557,8 +561,8 @@ var Jt = () => {
557
561
  projection: void 0
558
562
  };
559
563
  }
560
- }, e), t, `subscription.${K.name}`), E[Dt.name] = (e) => I(T({
561
- descriptor: Dt,
564
+ }, e), t, `subscription.${Et.name}`), E[J.name] = (e) => I(T({
565
+ descriptor: J,
562
566
  executor: (e) => {
563
567
  let t = e.eventId;
564
568
  return {
@@ -573,43 +577,43 @@ var Jt = () => {
573
577
  projection: void 0
574
578
  };
575
579
  }
576
- }, e), t, `subscription.${Dt.name}`), E[Et.name] = (t) => F(async (t, n) => {
580
+ }, e), t, `subscription.${J.name}`), E[Tt.name] = (t) => F(async (t, n) => {
577
581
  let r = t;
578
582
  return await _(e.store, n.subject, { executionId: r.executionId }), await g.cancel(r.workflowName, r.executionId), await Le(r.workflowName, r.executionId, "workflow.cancel"), { ok: !0 };
579
- }, t, `action.${Et.name}`), E[Ot.name] = (t) => F(async (t, n) => {
583
+ }, t, `action.${Tt.name}`), E[Dt.name] = (t) => F(async (t, n) => {
580
584
  let r = t;
581
585
  return await _(e.store, n.subject, { executionId: r.executionId }), await g.resume(r.workflowName, r.executionId), { ok: !0 };
582
- }, t, `action.${Ot.name}`), E[X.name] = (t) => F(async (t, n) => {
586
+ }, t, `action.${Dt.name}`), E[kt.name] = (t) => F(async (t, n) => {
583
587
  let r = t;
584
588
  return await _(e.store, n.subject, { id: r.id }), g.signal({ id: r.id }, r.signalName, r.payload);
585
- }, t, `action.${X.name}`), E[Z.name] = (t) => F(async (t, n) => {
589
+ }, t, `action.${kt.name}`), E[At.name] = (t) => F(async (t, n) => {
586
590
  let r = t;
587
591
  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.${Z.name}`));
592
+ }, t, `action.${At.name}`));
589
593
  let Ce = [
590
- ...e.discovered.queries.map((e) => G(e.descriptor)),
591
- ...e.discovered.mutations.map((e) => wt(e.descriptor)),
592
- ...e.discovered.actions.map((e) => W(e.descriptor)),
593
- ...pe.queries.map((e) => G(e.descriptor)),
594
- ...pe.mutations.map((e) => wt(e.descriptor)),
595
- ...y.queries.map((e) => G(e.descriptor)),
596
- ...y.mutations.map((e) => wt(e.descriptor)),
597
- ...y.actions.map((e) => W(e.descriptor)),
598
- ...(e.discovered.streams ?? []).map((e) => Tt(e.descriptor)),
599
- ...(e.discovered.workflows ?? []).map((e) => ut(e.definition)),
594
+ ...e.discovered.queries.map((e) => q(e.descriptor)),
595
+ ...e.discovered.mutations.map((e) => Ct(e.descriptor)),
596
+ ...e.discovered.actions.map((e) => K(e.descriptor)),
597
+ ...pe.queries.map((e) => q(e.descriptor)),
598
+ ...pe.mutations.map((e) => Ct(e.descriptor)),
599
+ ...y.queries.map((e) => q(e.descriptor)),
600
+ ...y.mutations.map((e) => Ct(e.descriptor)),
601
+ ...y.actions.map((e) => K(e.descriptor)),
602
+ ...(e.discovered.streams ?? []).map((e) => wt(e.descriptor)),
603
+ ...(e.discovered.workflows ?? []).map((e) => B(e.definition)),
600
604
  ...te ? [
601
- G(J),
602
- G(Y),
603
- G(kt),
604
- G(q),
605
- G(K),
606
- G(Dt),
607
- W(Et),
608
- W(Ot),
609
- W(X),
610
- W(Z)
605
+ q(Ot),
606
+ q(Z),
607
+ q(X),
608
+ q(Y),
609
+ q(Et),
610
+ q(J),
611
+ K(Tt),
612
+ K(Dt),
613
+ K(kt),
614
+ K(At)
611
615
  ] : []
612
- ], O = ft.make(...Ce).middleware(xt).middleware(St), we = A.succeed(xt, xt.of(({ headers: t, clientId: n }) => k.promise(() => e.resolveSubject(t, n)))), Te = A.succeed(St, St.of(({ clientId: e }) => k.succeed({ clientId: e }))), Ee = e.dormancyTenantId ?? "default", De = e.dormancy === "sleep" ? {
616
+ ], O = pt.make(...Ce).middleware(xt).middleware(G), we = A.succeed(xt, xt.of(({ headers: t, clientId: n }) => k.promise(() => e.resolveSubject(t, n)))), Te = A.succeed(G, G.of(({ clientId: e }) => k.succeed({ clientId: e }))), Ee = e.dormancyTenantId ?? "default", De = e.dormancy === "sleep" ? {
613
617
  register: (t, n, r) => z(e.store, {
614
618
  tenantId: r ?? Ee,
615
619
  kind: "workflow",
@@ -727,7 +731,7 @@ var Jt = () => {
727
731
  ...R && R.metricReaders.length > 0 ? { extraMetricReaders: R.metricReaders } : {},
728
732
  ...R && Object.keys(R.resourceAttributes).length > 0 ? { resourceAttributes: R.resourceAttributes } : {},
729
733
  ...R && R.sampler !== void 0 ? { sampler: R.sampler } : {}
730
- }), rt = !1, at = e.store.ping ? () => e.store.ping().then(() => !0).catch(() => !1) : void 0, B = ct({
734
+ }), rt = !1, at = e.store.ping ? () => e.store.ping().then(() => !0).catch(() => !1) : void 0, V = lt({
731
735
  group: O,
732
736
  handlersLayer: Be,
733
737
  httpHandlersLayer: Ge,
@@ -741,9 +745,9 @@ var Jt = () => {
741
745
  ...Se.length > 0 ? { httpRoutes: Se } : {},
742
746
  ...ce.size > 0 ? { webhookRoutes: ce } : {}
743
747
  });
744
- if (await Ne(B), (e.discovered.schedules?.length ?? 0) > 0) {
745
- let t = (e.scheduleCoordination ?? "single") === "advisoryLock" ? Ue(e.store, e.scheduleReplicaId ?? `pid-${process.pid}`) : st;
746
- c = await lt(e.discovered.schedules ?? [], {
748
+ if (await Ne(V), (e.discovered.schedules?.length ?? 0) > 0) {
749
+ let t = (e.scheduleCoordination ?? "single") === "advisoryLock" ? Ue(e.store, e.scheduleReplicaId ?? `pid-${process.pid}`) : ct;
750
+ c = await ut(e.discovered.schedules ?? [], {
747
751
  store: e.store,
748
752
  coordinator: t,
749
753
  defaultTrigger: e.scheduleDefaultTrigger ?? "self",
@@ -768,10 +772,10 @@ var Jt = () => {
768
772
  ...e.onScheduleRunEvent === void 0 ? {} : { onRunEvent: e.onScheduleRunEvent }
769
773
  }), e.onSchedulerReady?.(c);
770
774
  }
771
- let V = e.log ?? j({ scope: "voltro:serve" }), dt, pt;
772
- if ((e.discovered.subscribers?.length ?? 0) > 0 && (dt = s(e.discovered.subscribers ?? [], e.store, V.child("subscribe"), e.schemaRegistry)), (e.discovered.reactions?.length ?? 0) > 0) {
773
- let t = V.child("reaction");
774
- pt = m(e.discovered.reactions ?? [], e.store, {
775
+ let dt = e.log ?? j({ scope: "voltro:serve" }), ft, mt;
776
+ if ((e.discovered.subscribers?.length ?? 0) > 0 && (ft = s(e.discovered.subscribers ?? [], e.store, dt.child("subscribe"), e.schemaRegistry)), (e.discovered.reactions?.length ?? 0) > 0) {
777
+ let t = dt.child("reaction");
778
+ mt = m(e.discovered.reactions ?? [], e.store, {
775
779
  runAct: async (n, r) => {
776
780
  if (n.kind === "workflow") {
777
781
  if (g === void 0) {
@@ -788,7 +792,7 @@ var Jt = () => {
788
792
  await de(n.agent, r, {
789
793
  findAgentSend: (t) => e.discovered.actions.find((e) => e.descriptor.name === `${t}.send`),
790
794
  runAction: (e, t, n) => Promise.resolve(me(e, t, n)),
791
- makeSubject: (e) => Ct(e),
795
+ makeSubject: (e) => St(e),
792
796
  now: () => Date.now(),
793
797
  log: t
794
798
  });
@@ -806,26 +810,26 @@ var Jt = () => {
806
810
  }
807
811
  }, t);
808
812
  }
809
- let ht;
810
- return (e.discovered.aggregates?.length ?? 0) > 0 && (ht = await i({
813
+ let gt;
814
+ return (e.discovered.aggregates?.length ?? 0) > 0 && (gt = await i({
811
815
  discovered: e.discovered.aggregates ?? [],
812
816
  store: e.store,
813
- log: V.child("aggregate"),
817
+ log: dt.child("aggregate"),
814
818
  ...e.analytics === void 0 ? {} : { analytics: e.analytics },
815
819
  ...e.aggregateStorage === void 0 ? {} : { storage: e.aggregateStorage },
816
820
  ...e.aggregateCoordinator === void 0 ? {} : { coordinator: e.aggregateCoordinator }
817
- }), S = A.succeed(ke, ht.registry)), rt = !0, e.bootTiming?.mark("ready"), {
821
+ }), S = A.succeed(ke, gt.registry)), rt = !0, e.bootTiming?.mark("ready"), {
818
822
  dispatcher: t,
819
- server: B,
823
+ server: V,
820
824
  scheduler: c,
821
825
  close: async () => {
822
- rt = !1, ht?.detach(), pt?.(), dt?.(), await c?.shutdown(), t.close(), await o?.dispose(), await new Promise((e) => B.close(() => e()));
826
+ rt = !1, gt?.detach(), mt?.(), ft?.(), await c?.shutdown(), t.close(), await o?.dispose(), await new Promise((e) => V.close(() => e()));
823
827
  }
824
828
  };
825
- }, $ = j({ scope: "voltro:serve" }), pn = (e, t, n) => (e === "production" || e === "staging") && t !== "memory" && n !== "0", mn = (e, t) => {
829
+ }, $ = j({ scope: "voltro:serve" }), mn = (e, t, n) => (e === "production" || e === "staging") && t !== "memory" && n !== "0", hn = (e, t) => {
826
830
  let n = e.indexOf(t);
827
831
  return n >= 0 ? e[n + 1] : void 0;
828
- }, hn = async (e) => {
832
+ }, gn = async (e) => {
829
833
  let t = O(process.cwd());
830
834
  if (M(t)) {
831
835
  let n;
@@ -837,11 +841,11 @@ var Jt = () => {
837
841
  }
838
842
  if (n) return $.info("serve: booting from the precompiled serve bundle"), n(e);
839
843
  }
840
- return gn(e);
841
- }, gn = async (i) => {
842
- let s = Yt();
843
- process.env.NODE_ENV || (process.env.NODE_ENV = "production"), dt();
844
- let f = process.cwd(), p = Number(process.env.PORT ?? mn(i, "--port") ?? 4e3), m = await me(f);
844
+ return _n(e);
845
+ }, _n = async (i) => {
846
+ let s = Xt();
847
+ process.env.NODE_ENV || (process.env.NODE_ENV = "production"), ft();
848
+ let f = process.cwd(), p = Number(process.env.PORT ?? hn(i, "--port") ?? 4e3), m = await me(f);
845
849
  at(rt(m?.secrets)), await t({
846
850
  rawEnv: m?.env,
847
851
  appType: "api",
@@ -874,15 +878,15 @@ var Jt = () => {
874
878
  for (let n of [...ye, ...D.tables]) e.has(n.tableName) || (e.add(n.tableName), t.push(n));
875
879
  return t;
876
880
  })();
877
- for (let e of O) ht(e);
881
+ for (let e of O) gt(e);
878
882
  let j = (process.env.NODE_ENV ?? "").toLowerCase();
879
- if (pn(j, h, process.env.VOLTRO_AUTO_MIGRATE)) {
880
- let e = (await w(h)).makeSqlLayer(S()), t = await k.runPromise(pt.SqlClient.pipe(k.flatMap((e) => Mt(e, O, {
883
+ if (mn(j, h, process.env.VOLTRO_AUTO_MIGRATE)) {
884
+ let e = (await w(h)).makeSqlLayer(S()), t = await k.runPromise(mt.SqlClient.pipe(k.flatMap((e) => Nt(e, O, {
881
885
  appliedBy: `serve:${j}`,
882
886
  environment: "prod",
883
887
  dialectId: h
884
888
  })), k.provide(e)));
885
- t.kind === "prod-mismatch" && ($.error(jt(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(jt(t, h));
889
+ 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
890
  }
887
891
  let ke = Ze(O);
888
892
  s.mark("discover");
@@ -902,14 +906,14 @@ var Jt = () => {
902
906
  store: N,
903
907
  dialect: h
904
908
  }), L = m?.plugins ?? [], Ke = process.env.POD_NAME ?? process.env.HOSTNAME ?? `serve-${process.pid}`, qe, Je;
905
- h !== "memory" && (qe = Oe.make((await w(h)).makeSqlLayer(S())), Je = await qe.runPromise(pt.SqlClient));
909
+ h !== "memory" && (qe = Oe.make((await w(h)).makeSqlLayer(S())), Je = await qe.runPromise(mt.SqlClient));
906
910
  let Ye = R({
907
911
  coordinator: [
908
912
  "postgres",
909
913
  "mariadb",
910
914
  "mysql",
911
915
  "mssql"
912
- ].includes(h) ? Ue(N, Ke, $) : st,
916
+ ].includes(h) ? Ue(N, Ke, $) : ct,
913
917
  replicaId: Ke,
914
918
  log: $
915
919
  }), Xe = [], Qe = {
@@ -947,32 +951,32 @@ var Jt = () => {
947
951
  info: (e, t) => process.stdout.write(`[broadcast] ${e} ${t ? JSON.stringify(t) : ""}\n`),
948
952
  warn: (e, t) => process.stderr.write(`[broadcast] ${e} ${t ? JSON.stringify(t) : ""}\n`),
949
953
  debug: () => {}
950
- }), z = m?.apiKeys, it = (typeof z == "object" ? z.prefix : void 0) ?? "voltro_", ot = z ? We(Re(N), { prefix: it }) : void 0, ct = ot ? [Be(ot, { prefix: it })] : [], lt = _e([...m?.auth?.strategies ?? [], ...ct], Nt(m?.plugins ?? []), m?.auth?.anonymousTenantRequired ?? !1), ut = [...m?.restRoutes ?? [], ...ot ? P(ot, (typeof z == "object" ? z.managementPath : void 0) ?? "/v1/api-keys") : []], B = m?.idempotency, V = B ? {
954
+ }), z = m?.apiKeys, it = (typeof z == "object" ? z.prefix : void 0) ?? "voltro_", ot = z ? We(Re(N), { prefix: it }) : void 0, st = ot ? [Be(ot, { prefix: it })] : [], lt = _e([...m?.auth?.strategies ?? [], ...st], Pt(m?.plugins ?? []), m?.auth?.anonymousTenantRequired ?? !1), ut = [...m?.restRoutes ?? [], ...ot ? P(ot, (typeof z == "object" ? z.managementPath : void 0) ?? "/v1/api-keys") : []], B = m?.idempotency, V = B ? {
951
955
  store: ze(N),
952
956
  header: (typeof B == "object" ? B.header : void 0) ?? "Idempotency-Key",
953
957
  ttlMs: (typeof B == "object" ? B.ttlMs : void 0) ?? 864e5
954
- } : void 0, ft = ut.length > 0 ? Ft(ut, {
958
+ } : void 0, dt = ut.length > 0 ? It(ut, {
955
959
  store: N,
956
960
  resolveSubject: (e) => lt({
957
961
  headers: e,
958
962
  clientId: -1
959
963
  }),
960
964
  ...V ? { idempotency: V } : {}
961
- }) : [], mt = L.map((e) => e.services).filter((e) => e !== void 0), H = A.mergeAll(d({
965
+ }) : [], pt = L.map((e) => e.services).filter((e) => e !== void 0), ht = A.mergeAll(d({
962
966
  analyticsLayer: D.layer,
963
967
  cacheService: Ae,
964
968
  kvService: Ie,
965
- pluginServices: mt,
969
+ pluginServices: pt,
966
970
  userLayers: m?.layers ?? []
967
- }), E), gt = m?.scheduling ?? {}, _t = gt.trigger ?? "self", vt = /* @__PURE__ */ new Set([
971
+ }), E), H = m?.scheduling ?? {}, _t = H.trigger ?? "self", vt = /* @__PURE__ */ new Set([
968
972
  "postgres",
969
973
  "mysql",
970
974
  "mariadb",
971
975
  "mssql"
972
- ]), yt = gt.coordination ?? (vt.has(h) ? "advisoryLock" : "single"), U = yt === "cluster" && vt.has(h), bt = U ? "cluster" : yt === "advisoryLock" && vt.has(h) ? "advisoryLock" : "single";
976
+ ]), yt = H.coordination ?? (vt.has(h) ? "advisoryLock" : "single"), U = yt === "cluster" && vt.has(h), W = U ? "cluster" : yt === "advisoryLock" && vt.has(h) ? "advisoryLock" : "single";
973
977
  yt === "cluster" && !U && $.warn("scheduling.coordination=cluster needs a sql-backed store except sqlite — falling back to single"), yt === "advisoryLock" && !vt.has(h) && $.warn("scheduling.coordination=advisoryLock needs a SQL store (the claim-row gate) — falling back to single");
974
- let xt, St = C.workflows.length > 0 || C.workflowWorkers.length > 0 || C.eventTriggers.length > 0 || (fe?.outgoing.length ?? 0) > 0 || U, W;
975
- if (St) {
978
+ let bt, xt = C.workflows.length > 0 || C.workflowWorkers.length > 0 || C.eventTriggers.length > 0 || (fe?.outgoing.length ?? 0) > 0 || U, G;
979
+ if (xt) {
976
980
  if (h === "mssql") {
977
981
  let e = await l(process.cwd());
978
982
  e && $.warn(e);
@@ -981,10 +985,10 @@ var Jt = () => {
981
985
  name: e.name,
982
986
  cron: Le(e),
983
987
  execute: async () => {
984
- await xt?.fireFromCluster(e.name);
988
+ await bt?.fireFromCluster(e.name);
985
989
  }
986
990
  })) : [];
987
- W = h === "memory" ? e.layerMemory : await (async () => {
991
+ G = h === "memory" ? e.layerMemory : await (async () => {
988
992
  let e = await w(h), t = r({ sqliteFamily: e.id === "sqlite" || e.id === "turso" });
989
993
  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
994
  sqlClientLayer: e.makeSqlLayer(S()),
@@ -995,18 +999,18 @@ var Jt = () => {
995
999
  });
996
1000
  })();
997
1001
  }
998
- let Ct = b(L, e()), wt = x.filter((e) => /\.subscribe\.tsx?$/.test(e)), G = wt.length > 0 ? await u(wt, $) : [], Tt = x.filter((e) => /\.reaction\.tsx?$/.test(e)), Et = Tt.length > 0 ? await r(Tt, $) : [], K = x.filter((e) => /\.outbox\.tsx?$/.test(e)), Dt = K.length > 0 ? await ee(K, $) : [], Ot = x.filter((e) => /\.aggregate\.tsx?$/.test(e)), q = Ot.length > 0 ? await ne(Ot, $) : [], J = o();
999
- if (q.length > 0 && h !== "memory") try {
1000
- J = a((await w(h)).makeSqlLayer(S()));
1002
+ let K = b(L, e()), St = x.filter((e) => /\.subscribe\.tsx?$/.test(e)), Ct = St.length > 0 ? await u(St, $) : [], q = x.filter((e) => /\.reaction\.tsx?$/.test(e)), wt = q.length > 0 ? await r(q, $) : [], Tt = x.filter((e) => /\.outbox\.tsx?$/.test(e)), Et = Tt.length > 0 ? await ee(Tt, $) : [], J = x.filter((e) => /\.aggregate\.tsx?$/.test(e)), Dt = J.length > 0 ? await ne(J, $) : [], Y = o();
1003
+ if (Dt.length > 0 && h !== "memory") try {
1004
+ Y = a((await w(h)).makeSqlLayer(S()));
1001
1005
  } catch (e) {
1002
1006
  $.warn("aggregate: SQL storage init failed — falling back to in-process", { err: String(e) });
1003
1007
  }
1004
- let kt = h === "memory" ? st : Ue(N, `aggregate@${process.pid}`, $), Y = [], X = [], Z = x.filter((e) => he.test(e));
1005
- if (Z.length > 0) {
1008
+ let Ot = h === "memory" ? ct : Ue(N, `aggregate@${process.pid}`, $), X = [], Z = [], kt = x.filter((e) => he.test(e));
1009
+ if (kt.length > 0) {
1006
1010
  let e = $.child("agent"), t = x.filter((e) => ue.test(e));
1007
1011
  t.length > 0 && await T(t, e);
1008
- let n = await v(Z, e);
1009
- for (let e of n.agents) for (let t of ce(e)) (t.kind === "action" ? Y : X).push({
1012
+ let n = await v(kt, e);
1013
+ for (let e of n.agents) for (let t of ce(e)) (t.kind === "action" ? X : Z).push({
1010
1014
  file: t.file,
1011
1015
  descriptor: t.descriptor,
1012
1016
  executor: t.executor
@@ -1014,28 +1018,28 @@ var Jt = () => {
1014
1018
  n.agents.length > 0 && e.info("synthesized agent routes", { agents: n.agents.map((e) => e.descriptor.name) });
1015
1019
  }
1016
1020
  s.mark("workflow");
1017
- let Pt = await fn({
1021
+ let At = await pn({
1018
1022
  bootTiming: s,
1019
1023
  discovered: {
1020
- queries: [...C.queries, ...X],
1024
+ queries: [...C.queries, ...Z],
1021
1025
  mutations: C.mutations,
1022
- actions: [...C.actions, ...Y],
1026
+ actions: [...C.actions, ...X],
1023
1027
  streams: C.streams,
1024
1028
  workflows: C.workflows,
1025
1029
  workflowWorkers: C.workflowWorkers,
1026
1030
  eventTriggers: C.eventTriggers,
1027
1031
  schedules: C.schedules,
1028
- subscribers: G,
1029
- outboxHandlers: Dt,
1032
+ subscribers: Ct,
1033
+ outboxHandlers: Et,
1030
1034
  connections: C.connections,
1031
- reactions: Et,
1032
- aggregates: q,
1035
+ reactions: wt,
1036
+ aggregates: Dt,
1033
1037
  ...fe === void 0 ? {} : { webhooks: fe }
1034
1038
  },
1035
1039
  log: $,
1036
1040
  analytics: D.sink,
1037
- aggregateStorage: J,
1038
- aggregateCoordinator: kt,
1041
+ aggregateStorage: Y,
1042
+ aggregateCoordinator: Ot,
1039
1043
  store: N,
1040
1044
  kv: Fe,
1041
1045
  cache: F,
@@ -1043,24 +1047,24 @@ var Jt = () => {
1043
1047
  schemaRegistry: ke,
1044
1048
  tenantScopedTables: C.tenantScopedTables,
1045
1049
  softDeleteScopedTables: C.softDeleteScopedTables,
1046
- dataTransferSnapshot: At(O),
1050
+ dataTransferSnapshot: jt(O),
1047
1051
  dataTransferDialect: h,
1048
1052
  tenantIsolation: (process.env.VOLTRO_TENANT_ISOLATION ?? m?.tenancy?.isolation) === "namespace" ? "namespace" : "shared-schema",
1049
1053
  resolveSubject: (e, t) => lt({
1050
1054
  headers: e,
1051
1055
  clientId: t
1052
1056
  }),
1053
- httpRoutes: [...L.flatMap((e) => e.httpRoutes ?? []), ...ft],
1054
- ...H ? { baseLayer: H } : {},
1055
- ...W === void 0 ? {} : { workflowEngineLayer: W },
1057
+ httpRoutes: [...L.flatMap((e) => e.httpRoutes ?? []), ...dt],
1058
+ ...ht ? { baseLayer: ht } : {},
1059
+ ...G === void 0 ? {} : { workflowEngineLayer: G },
1056
1060
  scheduleDefaultTrigger: _t,
1057
- scheduleCoordination: bt,
1061
+ scheduleCoordination: W,
1058
1062
  scheduleArmSelf: !U,
1059
1063
  dormancy: process.env.VOLTRO_DORMANCY === "sleep" || process.env.VOLTRO_DORMANCY === "always-on" ? process.env.VOLTRO_DORMANCY : m?.dormancy ?? "always-on",
1060
1064
  scheduleReplicaId: process.env.HOSTNAME ?? `pid-${process.pid}`,
1061
- ...Ct === void 0 ? {} : { scheduleFireInterceptor: Ct },
1065
+ ...K === void 0 ? {} : { scheduleFireInterceptor: K },
1062
1066
  onSchedulerReady: (e) => {
1063
- xt = e;
1067
+ bt = e;
1064
1068
  },
1065
1069
  observability: tt,
1066
1070
  port: p,
@@ -1082,13 +1086,13 @@ var Jt = () => {
1082
1086
  workflows: C.workflows.length,
1083
1087
  workflowWorkers: C.workflowWorkers.length,
1084
1088
  schedules: C.schedules.length,
1085
- scheduleCoordination: bt
1089
+ scheduleCoordination: W
1086
1090
  }), s.finish($);
1087
- let It = () => {
1091
+ let Ft = () => {
1088
1092
  for (let e of Xe) e.stop();
1089
- Ve.detach(), He.stop(), I(), qe?.dispose(), Promise.resolve(et.deactivate()).then(() => nt?.close()).then(() => D.dispose()).then(() => Pt.close()).then(() => N.close?.()).then(() => process.exit(0));
1093
+ Ve.detach(), He.stop(), I(), qe?.dispose(), Promise.resolve(et.deactivate()).then(() => nt?.close()).then(() => D.dispose()).then(() => At.close()).then(() => N.close?.()).then(() => process.exit(0));
1090
1094
  };
1091
- return process.on("SIGINT", It), process.on("SIGTERM", It), await new Promise(() => {}), 0;
1095
+ return process.on("SIGINT", Ft), process.on("SIGTERM", Ft), await new Promise(() => {}), 0;
1092
1096
  };
1093
1097
  //#endregion
1094
- export { hn as n, un as r, gn as t };
1098
+ export { gn as n, dn as r, _n as t };