@voltro/cli 0.22.0 → 0.22.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.
Files changed (53) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/dist/apiBuild-COyPDf3R.js +2 -0
  3. package/dist/{apiBuild-2zRxj2hJ.js → apiBuild-DiWxVz-M.js} +2 -2
  4. package/dist/bin.js +2 -2
  5. package/dist/{commands-DGaeTn2f.js → commands-BxRaIOBG.js} +1147 -1141
  6. package/dist/{dev-DeHVUxQx.js → dev-BRiPgbKw.js} +2 -2
  7. package/dist/{dev-BEYBSGJ7.js → dev-Dd3EZzj5.js} +1 -1
  8. package/dist/index.js +1 -1
  9. package/dist/{inspectMetrics-4AVPn6IS.js → inspectMetrics-9ZSuDeqD.js} +140 -111
  10. package/dist/{serveCommand-DEVTtnLy.js → serveCommand-DXJOARkO.js} +184 -184
  11. package/dist/serveEntry.js +2 -2
  12. package/dist/{start-BjGUIIvj.js → start-CsIjcOi-.js} +1 -1
  13. package/dist/startEntry.js +2 -2
  14. package/package.json +17 -17
  15. package/templates/AGENTS.md +1 -1
  16. package/templates/agent-docs/_index.md +1 -1
  17. package/templates/agent-docs/whats-new.md +32 -214
  18. package/templates/apps/api-ai/package.json +7 -7
  19. package/templates/apps/api-auth/package.json +8 -8
  20. package/templates/apps/api-backend/package.json +7 -7
  21. package/templates/apps/api-backend-deactivation/package.json +7 -7
  22. package/templates/apps/api-backend-mail/package.json +8 -8
  23. package/templates/apps/api-backend-mariadb/package.json +9 -9
  24. package/templates/apps/api-backend-storage/package.json +8 -8
  25. package/templates/apps/api-data-advanced/package.json +8 -8
  26. package/templates/apps/api-durable/package.json +8 -8
  27. package/templates/apps/api-feature-flags/package.json +9 -9
  28. package/templates/apps/api-governance/package.json +8 -8
  29. package/templates/apps/api-kv/package.json +8 -8
  30. package/templates/apps/api-moderation/package.json +8 -8
  31. package/templates/apps/api-observability/package.json +8 -8
  32. package/templates/apps/api-ratelimit/package.json +8 -8
  33. package/templates/apps/api-rbac/package.json +8 -8
  34. package/templates/apps/api-rest/package.json +7 -7
  35. package/templates/apps/api-saas/package.json +11 -11
  36. package/templates/apps/api-search/package.json +8 -8
  37. package/templates/apps/api-versioning/package.json +8 -8
  38. package/templates/apps/api-webhooks/package.json +9 -9
  39. package/templates/apps/changelog/package.json +6 -6
  40. package/templates/apps/edge-functions/package.json +2 -2
  41. package/templates/apps/frontend-admin/package.json +8 -8
  42. package/templates/apps/frontend-app/package.json +8 -8
  43. package/templates/apps/frontend-blank/package.json +7 -7
  44. package/templates/apps/frontend-contact/package.json +7 -7
  45. package/templates/apps/frontend-dashboard/package.json +7 -7
  46. package/templates/apps/frontend-docs/package.json +7 -7
  47. package/templates/apps/frontend-i18n/package.json +6 -6
  48. package/templates/apps/frontend-landing/package.json +7 -7
  49. package/templates/apps/frontend-spa/package.json +7 -7
  50. package/templates/apps/frontend-ssr/package.json +7 -7
  51. package/templates/apps/frontend-ssr-api/package.json +8 -8
  52. package/templates/apps/frontend-static-blog/package.json +6 -6
  53. package/dist/apiBuild-sqNmWmY5.js +0 -2
@@ -1,24 +1,24 @@
1
- import { at as e, t } from "./inspectMetrics-4AVPn6IS.js";
1
+ import { at as e, t } from "./inspectMetrics-9ZSuDeqD.js";
2
2
  import { s as n } from "./seedRunner-D6eu-u5U.js";
3
3
  import { r, t as i } from "./appModuleLoader-C9r9mxZt.js";
4
4
  import { f as a, m as o, n as s, p as c, u as l } from "./frameworkTableAssembly-sg41s14F.js";
5
5
  import { l as u } from "./fileConventions-CBNPZVOV.js";
6
6
  import { p as d } from "./inspect-_ldwsAwH.js";
7
- import { $ as ee, A as f, B as p, C as te, D as m, E as ne, F as re, G as ie, H as ae, I as h, K as oe, L as g, M as _, N as se, O as v, P as y, R as ce, S as le, T as ue, V as de, W as fe, _ as b, at as pe, b as me, c as he, et as ge, h as x, i as _e, it as S, j as ve, k as ye, lt as C, m as be, nt as w, o as T, ot as xe, q as E, r as Se, rt as Ce, st as we, t as Te, tt as Ee, u as De, ut as Oe, v as ke, w as Ae, x as D, y as je, z as Me } from "./dev-DeHVUxQx.js";
8
- import { l as O, r as k } from "./apiBuild-2zRxj2hJ.js";
9
- import { t as Ne } from "./bootTiming-BdyP9nYw.js";
7
+ import { $ as ee, A as f, B as p, C as te, D as m, E as ne, F as re, G as ie, H as ae, I as h, K as oe, L as g, M as _, N as se, O as v, P as y, R as ce, S as le, T as ue, V as de, W as fe, _ as b, at as pe, b as me, c as he, et as ge, h as _e, i as x, it as S, j as ve, k as ye, lt as be, m as C, nt as w, o as T, ot as xe, q as Se, r as Ce, rt as we, st as Te, t as Ee, tt as De, u as Oe, ut as ke, v as Ae, w as je, x as E, y as Me, z as Ne } from "./dev-BRiPgbKw.js";
8
+ import { l as D, r as O } from "./apiBuild-DiWxVz-M.js";
9
+ import { t as k } from "./bootTiming-BdyP9nYw.js";
10
10
  import { n as Pe } from "./cliArgs-qdZSElM3.js";
11
11
  import { join as Fe } from "node:path";
12
12
  import { pathToFileURL as Ie } from "node:url";
13
13
  import { Cause as Le, Effect as A, Layer as j, ManagedRuntime as Re } from "effect";
14
14
  import { createLogger as M } from "@voltro/logger";
15
15
  import { existsSync as ze } from "node:fs";
16
- import { AggregateRegistry as N, Dispatcher as Be, apiKeyManagementRoutes as Ve, applySoftDeleteScope as He, applyTenantScope as Ue, attachAnalyticsMirror as P, awaitServerListening as We, bindMutation as F, bindStream as Ge, bindSubscription as I, buildTracingLayer as Ke, cancelWakeup as qe, compileCron as Je, dataStoreApiKeyStore as Ye, dataStoreIdempotencyStore as Xe, formatServerOnlyLeaks as Ze, frameworkApiKeyStrategy as Qe, installPolicyGuardResolver as $e, loadResourceTuples as et, makeActionRunner as L, makeAdvisoryLockCoordinator as tt, makeApiKeyService as nt, makeApiKeyUsageBuffer as rt, makeApiKeyUsageFlusher as it, makeAsyncKv as at, makeCoordinatedScheduler as ot, makeEffectStoreLayer as st, makeLazyWorkflowFacade as ct, makeMutationRunner as lt, makeOneShotQueryRunner as ut, makeQueryDescriptorProducer as dt, makeQueryReauthorizer as ft, makeQuerySubscriber as pt, makeSchemaRegistry as mt, makeWorkflowFacade as ht, makeWorkflowFacadeWithCallerContext as gt, makeWorkflowLayers as _t, noopKv as R, onProcessShutdown as vt, recordSubscriptionDelivery as yt, registerWakeup as bt, resolveSecretsBackend as xt, runProvidedEffect as St, setSecretsBackend as Ct, setSystemStoreHandle as z, setTupleSource as wt, singleCoordinator as Tt, startRpcServer as Et, startScheduler as Dt, workflowToRpc as B, wrapStoreWithBootCodec as Ot } from "@voltro/runtime";
17
- import { RpcGroup as kt } from "@effect/rpc";
18
- import { SqlClient as At } from "@effect/sql";
19
- import { and as jt, ensureTableRegistered as Mt, eq as V, or as Nt } from "@voltro/database";
20
- import { appStorageProvider as H, fromNodeReadable as Pt, getObjectStream as Ft, putObjectStream as It, toNodeReadable as U } from "@voltro/plugin-storage";
21
- import { AuthMiddleware as W, ConnectionInfoMiddleware as G, actionToRpc as K, anonymousSubject as Lt, isWireReachable as Rt, mutationToRpc as zt, queryToRpc as q, streamToRpc as Bt, workflowCancelDescriptor as Vt, workflowDomainEventsQueryDescriptor as J, workflowEventDeliveriesQueryDescriptor as Ht, workflowResumeDescriptor as Ut, workflowRunEventsQueryDescriptor as Y, workflowRunQueryDescriptor as X, workflowRunStepsQueryDescriptor as Wt, workflowRunsQueryDescriptor as Z, workflowSignalDescriptor as Gt, workflowUpdateDescriptor as Kt } from "@voltro/protocol";
16
+ import { AggregateRegistry as N, Dispatcher as Be, apiKeyManagementRoutes as Ve, applySoftDeleteScope as He, applyTenantScope as Ue, attachAnalyticsMirror as We, awaitServerListening as Ge, bindMutation as P, bindStream as Ke, bindSubscription as F, buildTracingLayer as qe, cancelWakeup as Je, compileCron as I, dataStoreApiKeyStore as Ye, dataStoreIdempotencyStore as Xe, formatServerOnlyLeaks as Ze, frameworkApiKeyStrategy as Qe, installPolicyGuardResolver as $e, loadResourceTuples as et, makeActionRunner as L, makeAdvisoryLockCoordinator as tt, makeApiKeyService as nt, makeApiKeyUsageBuffer as rt, makeApiKeyUsageFlusher as it, makeAsyncKv as at, makeCoordinatedScheduler as ot, makeEffectStoreLayer as st, makeLazyWorkflowFacade as ct, makeMutationRunner as lt, makeOneShotQueryRunner as ut, makeQueryDescriptorProducer as dt, makeQueryReauthorizer as ft, makeQuerySubscriber as pt, makeSchemaRegistry as mt, makeWorkflowFacade as ht, makeWorkflowFacadeWithCallerContext as gt, makeWorkflowLayers as _t, noopKv as R, onProcessShutdown as vt, recordSubscriptionDelivery as yt, registerWakeup as z, resolveSecretsBackend as bt, runProvidedEffect as B, setSecretsBackend as xt, setSystemStoreHandle as St, setTupleSource as Ct, singleCoordinator as wt, startRpcServer as Tt, startScheduler as Et, workflowToRpc as V, wrapStoreWithBootCodec as Dt } from "@voltro/runtime";
17
+ import { RpcGroup as Ot } from "@effect/rpc";
18
+ import { SqlClient as kt } from "@effect/sql";
19
+ import { and as At, ensureTableRegistered as jt, eq as H, or as Mt } from "@voltro/database";
20
+ import { appStorageProvider as U, fromNodeReadable as Nt, getObjectStream as Pt, putObjectStream as Ft, toNodeReadable as W } from "@voltro/plugin-storage";
21
+ import { AuthMiddleware as It, ConnectionInfoMiddleware as G, actionToRpc as K, anonymousSubject as Lt, isWireReachable as Rt, mutationToRpc as zt, queryToRpc as q, streamToRpc as Bt, workflowCancelDescriptor as Vt, workflowDomainEventsQueryDescriptor as J, workflowEventDeliveriesQueryDescriptor as Ht, workflowResumeDescriptor as Ut, workflowRunEventsQueryDescriptor as Y, workflowRunQueryDescriptor as X, workflowRunStepsQueryDescriptor as Wt, workflowRunsQueryDescriptor as Z, workflowSignalDescriptor as Gt, workflowUpdateDescriptor as Kt } from "@voltro/protocol";
22
22
  import { assertProductionSessionSecret as qt } from "@voltro/protocol/session";
23
23
  import { createHash as Jt, timingSafeEqual as Yt } from "node:crypto";
24
24
  import { declaredSnapshot as Xt, describeOutcome as Zt, runPlannedMigrations as Qt } from "@voltro/database/sql";
@@ -230,7 +230,7 @@ var hn = "VoltroBootRefusal", gn = (e) => {
230
230
  if (!o) throw Error(`data profile '${i}' has no default export`);
231
231
  return o;
232
232
  }, jn = (e, t, n = {}) => (async function* () {
233
- let r = await U((await A.runPromise(Ft(e, t).pipe(A.timeout(n.openTimeout ?? "30 seconds")))).stream), i = n.stallMs ?? 12e4, a, o = () => {
233
+ let r = await W((await A.runPromise(Pt(e, t).pipe(A.timeout(n.openTimeout ?? "30 seconds")))).stream), i = n.stallMs ?? 12e4, a, o = () => {
234
234
  a && clearTimeout(a), a = setTimeout(() => r.destroy(/* @__PURE__ */ Error(`storage read stalled for ${i}ms reading '${t}'`)), i);
235
235
  };
236
236
  try {
@@ -249,7 +249,7 @@ var hn = "VoltroBootRefusal", gn = (e) => {
249
249
  invalidateTag: async () => 0,
250
250
  wrap: async (e, t, n) => n()
251
251
  }, Nn = async (e) => {
252
- z({
252
+ St({
253
253
  dataStore: e.store,
254
254
  schemaRegistry: e.schemaRegistry
255
255
  });
@@ -272,7 +272,7 @@ var hn = "VoltroBootRefusal", gn = (e) => {
272
272
  let r = await e.store.query({
273
273
  table: "_voltro_workflow_start_contexts",
274
274
  order: [],
275
- predicate: V("executionId", n),
275
+ predicate: H("executionId", n),
276
276
  projection: ["id"],
277
277
  skip: void 0,
278
278
  take: 1
@@ -300,7 +300,7 @@ var hn = "VoltroBootRefusal", gn = (e) => {
300
300
  let t = (await e.store.query({
301
301
  table: "_voltro_workflow_start_contexts",
302
302
  order: [],
303
- predicate: V("executionId", n),
303
+ predicate: H("executionId", n),
304
304
  projection: void 0,
305
305
  skip: void 0,
306
306
  take: 1
@@ -357,7 +357,7 @@ var hn = "VoltroBootRefusal", gn = (e) => {
357
357
  });
358
358
  oe.set(t, { handle: r });
359
359
  }
360
- $e(), wt((t) => et(e.store, t.subjectId, t.resourceType, t.resourceId));
360
+ $e(), Ct((t) => et(e.store, t.subjectId, t.resourceType, t.resourceId));
361
361
  let se = (e.discovered.outboxHandlers?.length ?? 0) > 0 ? p({
362
362
  handlers: e.discovered.outboxHandlers ?? [],
363
363
  store: e.store,
@@ -367,7 +367,7 @@ var hn = "VoltroBootRefusal", gn = (e) => {
367
367
  store: e.store,
368
368
  publicUrl: g(e.port ?? 4e3),
369
369
  log: (e.log ?? M({ scope: "voltro:serve" })).child("connections")
370
- }), y = Ce({
370
+ }), y = we({
371
371
  store: e.store,
372
372
  schemaRegistry: e.schemaRegistry,
373
373
  cache: n,
@@ -380,100 +380,100 @@ var hn = "VoltroBootRefusal", gn = (e) => {
380
380
  ...v.active ? { connections: { registry: v.registry } } : {}
381
381
  }), ue = j.succeed(N, m), fe = (t, n) => {
382
382
  let r = t.pipe(A.provide(st(n)));
383
- return St((e.baseLayer ? r.pipe(A.provide(e.baseLayer)) : r).pipe(A.provide(ue)));
384
- }, pe = lt({
383
+ return (e.baseLayer ? r.pipe(A.provide(e.baseLayer)) : r).pipe(A.provide(ue));
384
+ }, pe = (e, t) => B(fe(e, t)), me = lt({
385
385
  store: e.store,
386
386
  buildContext: (e, t, n) => y(e, t, n),
387
- runEffect: fe,
387
+ runEffect: pe,
388
388
  undoCapture: le()
389
- }), me = D(), he = L({
389
+ }), he = E(), ge = L({
390
390
  buildContext: (e) => y(e),
391
- runEffect: fe
392
- }), ge = {
391
+ runEffect: pe
392
+ }), _e = {
393
393
  buildContext: (e) => y(e),
394
394
  finalize: (t, n) => He(Ue(t, e.tenantScopedTables, n.subject.tenantId), e.softDeleteScopedTables),
395
- provideEffect: (e, t) => e.pipe(A.provide(st(t)))
396
- }, x = dt(ge), _e = ut({
397
- ...ge,
395
+ provideEffect: fe
396
+ }, x = dt(_e), ye = ut({
397
+ ..._e,
398
398
  queryRows: (t) => e.store.query(t)
399
- }), ye = pt({
400
- ...ge,
399
+ }), be = pt({
400
+ ..._e,
401
401
  subscribeDescriptor: (e, n, r) => t.subscribe(e, n, r),
402
402
  subscribeComputed: (e, n, r) => t.subscribeComputed(e, n, r)
403
403
  }), C = {};
404
404
  for (let n of [
405
405
  ...e.discovered.queries,
406
- ...me.queries,
406
+ ...he.queries,
407
407
  ...v.queries
408
- ]) C[n.descriptor.name] = (e) => I(x(n, e), t, `subscription.${n.descriptor.name}`, void 0, void 0, ft(n, e));
408
+ ]) C[n.descriptor.name] = (e) => F(x(n, e), t, `subscription.${n.descriptor.name}`, void 0, void 0, ft(n, e));
409
409
  for (let t of [
410
410
  ...e.discovered.mutations,
411
- ...me.mutations,
411
+ ...he.mutations,
412
412
  ...v.mutations
413
- ]) C[t.descriptor.name] = (e) => F(async (e, n) => pe(t, e, n), e, `mutation.${t.descriptor.name}`);
414
- for (let t of [...e.discovered.actions, ...v.actions]) C[t.descriptor.name] = (e) => F(async (e, n) => he(t, e, n), e, `action.${t.descriptor.name}`);
415
- let be = () => `public-${Math.random().toString(36).slice(2, 10)}`, T = [
413
+ ]) C[t.descriptor.name] = (e) => P(async (e, n) => me(t, e, n), e, `mutation.${t.descriptor.name}`);
414
+ for (let t of [...e.discovered.actions, ...v.actions]) C[t.descriptor.name] = (e) => P(async (e, n) => ge(t, e, n), e, `action.${t.descriptor.name}`);
415
+ let T = () => `public-${Math.random().toString(36).slice(2, 10)}`, xe = [
416
416
  ...e.discovered.queries.filter((e) => e.descriptor.publicApi !== void 0).map((e) => ({
417
417
  descriptor: e.descriptor,
418
- invoke: (t, n) => _e(e, t, {
418
+ invoke: (t, n) => ye(e, t, {
419
419
  subject: n.subject,
420
- traceId: be()
420
+ traceId: T()
421
421
  }),
422
- subscribe: (t, n, r) => ye(e, t, {
422
+ subscribe: (t, n, r) => be(e, t, {
423
423
  subject: n.subject,
424
- traceId: be()
424
+ traceId: T()
425
425
  }, r)
426
426
  })),
427
427
  ...e.discovered.mutations.filter((e) => e.descriptor.publicApi !== void 0).map((e) => ({
428
428
  descriptor: e.descriptor,
429
- invoke: (t, n) => pe(e, t, {
429
+ invoke: (t, n) => me(e, t, {
430
430
  subject: n.subject,
431
- traceId: be()
431
+ traceId: T()
432
432
  })
433
433
  })),
434
434
  ...e.discovered.actions.filter((e) => e.descriptor.publicApi !== void 0).map((e) => ({
435
435
  descriptor: e.descriptor,
436
- invoke: (t, n) => he(e, t, {
436
+ invoke: (t, n) => ge(e, t, {
437
437
  subject: n.subject,
438
- traceId: be()
438
+ traceId: T()
439
439
  })
440
440
  }))
441
- ], xe = T.length > 0 ? tn(en(T), {
441
+ ], Se = xe.length > 0 ? tn(en(xe), {
442
442
  store: e.store,
443
443
  resolveSubject: (t) => e.resolveSubject(t, -1)
444
- }) : [], E = e.dataTransferSecret ?? process.env.VOLTRO_DATA_TRANSFER_SECRET, Se = E && E.length >= 16 ? [{
444
+ }) : [], Ce = e.dataTransferSecret ?? process.env.VOLTRO_DATA_TRANSFER_SECRET, Te = Ce && Ce.length >= 16 ? [{
445
445
  method: "POST",
446
446
  path: _n,
447
447
  handle: Tn({
448
- secret: E,
448
+ secret: Ce,
449
449
  store: e.store,
450
450
  ...e.dataTransferSnapshot ? { snapshot: e.dataTransferSnapshot } : {},
451
- assetSink: dn(H()),
452
- openArchive: (e) => jn(H(), e)
451
+ assetSink: dn(U()),
452
+ openArchive: (e) => jn(U(), e)
453
453
  })
454
454
  }, {
455
455
  method: "POST",
456
456
  path: vn,
457
457
  handle: kn({
458
- secret: E,
458
+ secret: Ce,
459
459
  store: e.store,
460
460
  snapshot: e.dataTransferSnapshot ?? { tables: [] },
461
461
  dialect: e.dataTransferDialect ?? "memory",
462
462
  tenantTables: [...e.tenantScopedTables],
463
463
  loadProfile: An,
464
- assetSource: fn(H(), e.store),
464
+ assetSource: fn(U(), e.store),
465
465
  putArchive: async (e, t) => {
466
- let { Readable: n } = await import("node:stream"), r = H(), i = Pt("storage", () => n.from(t()));
467
- await A.runPromise(It(r, e, i, { contentType: "application/octet-stream" }));
466
+ let { Readable: n } = await import("node:stream"), r = U(), i = Nt("storage", () => n.from(t()));
467
+ await A.runPromise(Ft(r, e, i, { contentType: "application/octet-stream" }));
468
468
  }
469
469
  })
470
- }] : [], we = [
470
+ }] : [], Ee = [
471
471
  ...e.httpRoutes ?? [],
472
- ...xe,
473
472
  ...Se,
473
+ ...Te,
474
474
  ...v.httpRoutes
475
475
  ];
476
- for (let t of e.discovered.streams ?? []) C[t.descriptor.name] = (n) => Ge((r) => {
476
+ for (let t of e.discovered.streams ?? []) C[t.descriptor.name] = (n) => Ke((r) => {
477
477
  let i = y(r), a = t.executor(n, i);
478
478
  if (A.isEffect(a)) {
479
479
  let t = a.pipe(A.provide(st(i.store)));
@@ -481,7 +481,7 @@ var hn = "VoltroBootRefusal", gn = (e) => {
481
481
  }
482
482
  return typeof a == "object" && a && typeof a.then == "function" ? A.promise(() => a) : a;
483
483
  }, `stream.${t.descriptor.name}`);
484
- for (let t of e.discovered.workflows ?? []) C[t.definition.name] = (e) => F(async (e, n) => {
484
+ for (let t of e.discovered.workflows ?? []) C[t.definition.name] = (e) => P(async (e, n) => {
485
485
  let r = n;
486
486
  return gt(d, {
487
487
  subject: r.subject,
@@ -489,7 +489,7 @@ var hn = "VoltroBootRefusal", gn = (e) => {
489
489
  source: "workflow-rpc"
490
490
  }).start(t.definition.name, e);
491
491
  }, e, `workflow.${t.definition.name}`);
492
- f && (C[X.name] = (e) => I(x({
492
+ f && (C[X.name] = (e) => F(x({
493
493
  descriptor: X,
494
494
  executor: (e) => {
495
495
  let t = e.id;
@@ -499,29 +499,29 @@ var hn = "VoltroBootRefusal", gn = (e) => {
499
499
  column: "startedAt",
500
500
  direction: "desc"
501
501
  }],
502
- predicate: Nt(V("id", t), V("executionId", t)),
502
+ predicate: Mt(H("id", t), H("executionId", t)),
503
503
  take: 1,
504
504
  skip: void 0,
505
505
  projection: void 0
506
506
  };
507
507
  }
508
- }, e), t, `subscription.${X.name}`), C[Z.name] = (e) => I(x({
508
+ }, e), t, `subscription.${X.name}`), C[Z.name] = (e) => F(x({
509
509
  descriptor: Z,
510
510
  executor: (e) => {
511
- 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;
511
+ 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;
512
512
  return {
513
513
  table: "_voltro_workflow_runs",
514
514
  order: [{
515
515
  column: "startedAt",
516
516
  direction: "desc"
517
517
  }],
518
- predicate: n.length === 0 ? void 0 : n.length === 1 ? n[0] : jt(...n),
518
+ predicate: n.length === 0 ? void 0 : n.length === 1 ? n[0] : At(...n),
519
519
  take: r,
520
520
  skip: void 0,
521
521
  projection: void 0
522
522
  };
523
523
  }
524
- }, e), t, `subscription.${Z.name}`), C[Wt.name] = (e) => I(x({
524
+ }, e), t, `subscription.${Z.name}`), C[Wt.name] = (e) => F(x({
525
525
  descriptor: Wt,
526
526
  executor: (e) => {
527
527
  let t = e.runId;
@@ -531,13 +531,13 @@ var hn = "VoltroBootRefusal", gn = (e) => {
531
531
  column: "startedAt",
532
532
  direction: "asc"
533
533
  }],
534
- predicate: V("runId", t),
534
+ predicate: H("runId", t),
535
535
  take: 1e3,
536
536
  skip: void 0,
537
537
  projection: void 0
538
538
  };
539
539
  }
540
- }, e), t, `subscription.${Wt.name}`), C[Y.name] = (e) => I(x({
540
+ }, e), t, `subscription.${Wt.name}`), C[Y.name] = (e) => F(x({
541
541
  descriptor: Y,
542
542
  executor: (e) => {
543
543
  let t = e.runId;
@@ -547,13 +547,13 @@ var hn = "VoltroBootRefusal", gn = (e) => {
547
547
  column: "occurredAt",
548
548
  direction: "asc"
549
549
  }],
550
- predicate: V("runId", t),
550
+ predicate: H("runId", t),
551
551
  take: 1e3,
552
552
  skip: void 0,
553
553
  projection: void 0
554
554
  };
555
555
  }
556
- }, e), t, `subscription.${Y.name}`), C[J.name] = (e) => I(x({
556
+ }, e), t, `subscription.${Y.name}`), C[J.name] = (e) => F(x({
557
557
  descriptor: J,
558
558
  executor: (e) => {
559
559
  let t = e;
@@ -563,13 +563,13 @@ var hn = "VoltroBootRefusal", gn = (e) => {
563
563
  column: "occurredAt",
564
564
  direction: "desc"
565
565
  }],
566
- predicate: t.name === void 0 ? void 0 : V("name", t.name),
566
+ predicate: t.name === void 0 ? void 0 : H("name", t.name),
567
567
  take: Math.max(1, Math.min(500, t.limit ?? 100)),
568
568
  skip: void 0,
569
569
  projection: void 0
570
570
  };
571
571
  }
572
- }, e), t, `subscription.${J.name}`), C[Ht.name] = (e) => I(x({
572
+ }, e), t, `subscription.${J.name}`), C[Ht.name] = (e) => F(x({
573
573
  descriptor: Ht,
574
574
  executor: (e) => {
575
575
  let t = e.eventId;
@@ -579,36 +579,36 @@ var hn = "VoltroBootRefusal", gn = (e) => {
579
579
  column: "createdAt",
580
580
  direction: "asc"
581
581
  }],
582
- predicate: V("eventId", t),
582
+ predicate: H("eventId", t),
583
583
  take: 500,
584
584
  skip: void 0,
585
585
  projection: void 0
586
586
  };
587
587
  }
588
- }, e), t, `subscription.${Ht.name}`), C[Vt.name] = (t) => F(async (t, n) => {
588
+ }, e), t, `subscription.${Ht.name}`), C[Vt.name] = (t) => P(async (t, n) => {
589
589
  let r = t;
590
- return await w(e.store, n.subject, { executionId: r.executionId }), await d.cancel(r.workflowName, r.executionId), await Pe(r.workflowName, r.executionId, "workflow.cancel"), { ok: !0 };
591
- }, t, `action.${Vt.name}`), C[Ut.name] = (t) => F(async (t, n) => {
590
+ return await w(e.store, n.subject, { executionId: r.executionId }), await d.cancel(r.workflowName, r.executionId), await Fe(r.workflowName, r.executionId, "workflow.cancel"), { ok: !0 };
591
+ }, t, `action.${Vt.name}`), C[Ut.name] = (t) => P(async (t, n) => {
592
592
  let r = t;
593
593
  return await w(e.store, n.subject, { executionId: r.executionId }), await d.resume(r.workflowName, r.executionId), { ok: !0 };
594
- }, t, `action.${Ut.name}`), C[Gt.name] = (t) => F(async (t, n) => {
594
+ }, t, `action.${Ut.name}`), C[Gt.name] = (t) => P(async (t, n) => {
595
595
  let r = t;
596
596
  return await w(e.store, n.subject, { id: r.id }), d.signal({ id: r.id }, r.signalName, r.payload);
597
- }, t, `action.${Gt.name}`), C[Kt.name] = (t) => F(async (t, n) => {
597
+ }, t, `action.${Gt.name}`), C[Kt.name] = (t) => P(async (t, n) => {
598
598
  let r = t;
599
599
  return await w(e.store, n.subject, { id: r.id }), d.update({ id: r.id }, r.updateName, r.payload, r.timeoutMs === void 0 ? void 0 : { timeoutMs: r.timeoutMs });
600
600
  }, t, `action.${Kt.name}`));
601
- let Te = (e) => e.filter((e) => Rt(e.descriptor)), Ee = [
602
- ...Te(e.discovered.queries).map((e) => q(e.descriptor)),
603
- ...Te(e.discovered.mutations).map((e) => zt(e.descriptor)),
604
- ...Te(e.discovered.actions).map((e) => K(e.descriptor)),
605
- ...me.queries.map((e) => q(e.descriptor)),
606
- ...me.mutations.map((e) => zt(e.descriptor)),
601
+ let De = (e) => e.filter((e) => Rt(e.descriptor)), Oe = [
602
+ ...De(e.discovered.queries).map((e) => q(e.descriptor)),
603
+ ...De(e.discovered.mutations).map((e) => zt(e.descriptor)),
604
+ ...De(e.discovered.actions).map((e) => K(e.descriptor)),
605
+ ...he.queries.map((e) => q(e.descriptor)),
606
+ ...he.mutations.map((e) => zt(e.descriptor)),
607
607
  ...v.queries.map((e) => q(e.descriptor)),
608
608
  ...v.mutations.map((e) => zt(e.descriptor)),
609
609
  ...v.actions.map((e) => K(e.descriptor)),
610
610
  ...(e.discovered.streams ?? []).map((e) => Bt(e.descriptor)),
611
- ...(e.discovered.workflows ?? []).map((e) => B(e.definition)),
611
+ ...(e.discovered.workflows ?? []).map((e) => V(e.definition)),
612
612
  ...f ? [
613
613
  q(X),
614
614
  q(Z),
@@ -621,22 +621,22 @@ var hn = "VoltroBootRefusal", gn = (e) => {
621
621
  K(Gt),
622
622
  K(Kt)
623
623
  ] : []
624
- ], De = kt.make(...Ee).middleware(W).middleware(G), Oe = j.succeed(W, W.of(({ headers: t, clientId: n }) => A.promise(() => e.resolveSubject(t, n)))), Ae = j.succeed(G, G.of(({ clientId: e }) => A.succeed({ clientId: e }))), je = e.dormancyTenantId ?? "default", Me = e.dormancy === "sleep" ? {
625
- register: (t, n, r) => bt(e.store, {
626
- tenantId: r ?? je,
624
+ ], ke = Ot.make(...Oe).middleware(It).middleware(G), je = j.succeed(It, It.of(({ headers: t, clientId: n }) => A.promise(() => e.resolveSubject(t, n)))), Me = j.succeed(G, G.of(({ clientId: e }) => A.succeed({ clientId: e }))), Ne = e.dormancyTenantId ?? "default", D = e.dormancy === "sleep" ? {
625
+ register: (t, n, r) => z(e.store, {
626
+ tenantId: r ?? Ne,
627
627
  kind: "workflow",
628
628
  refId: t,
629
629
  wakeAt: n
630
630
  }),
631
- cancel: (t, n) => qe(e.store, {
632
- tenantId: n ?? je,
631
+ cancel: (t, n) => Je(e.store, {
632
+ tenantId: n ?? Ne,
633
633
  kind: "workflow",
634
634
  refId: t
635
635
  }).then(() => {})
636
636
  } : void 0, O = te ? await import("@voltro/workflow") : void 0, k = O?.makeWorkflowRunRecorder({
637
637
  store: e.store,
638
- ...Me === void 0 ? {} : { wakeups: Me }
639
- }), Ne = async (t, n) => {
638
+ ...D === void 0 ? {} : { wakeups: D }
639
+ }), Pe = async (t, n) => {
640
640
  await O.closeWorkflowChildrenForParent({
641
641
  store: e.store,
642
642
  parentExecutionId: t,
@@ -652,11 +652,11 @@ var hn = "VoltroBootRefusal", gn = (e) => {
652
652
  await a.runPromise(r.definition.interrupt(n));
653
653
  }
654
654
  });
655
- }, Pe = async (t, n, r) => {
655
+ }, Fe = async (t, n, r) => {
656
656
  let i = (await e.store.query({
657
657
  table: "_voltro_workflow_runs",
658
658
  order: [],
659
- predicate: V("executionId", n),
659
+ predicate: H("executionId", n),
660
660
  projection: void 0,
661
661
  skip: void 0,
662
662
  take: 1
@@ -676,8 +676,8 @@ var hn = "VoltroBootRefusal", gn = (e) => {
676
676
  executionId: n,
677
677
  ...o == null ? {} : { tenantId: o }
678
678
  }
679
- }), a && await Ne(n, "cancelled");
680
- }, Fe = [..._t(e.discovered.workflows ?? [], {
679
+ }), a && await Pe(n, "cancelled");
680
+ }, Ie = [..._t(e.discovered.workflows ?? [], {
681
681
  buildContext: (t, n) => e.buildContextForWorkflow?.(t, n) ?? y({
682
682
  subject: t.subject,
683
683
  traceId: t.traceId
@@ -696,12 +696,12 @@ var hn = "VoltroBootRefusal", gn = (e) => {
696
696
  workflowPatches: i.patches,
697
697
  parentExecutionId: r?.parentExecutionId ?? null,
698
698
  parentClosePolicy: r?.parentClosePolicy ?? null,
699
- onParentClose: ({ executionId: e, status: t }) => Ne(e, t),
699
+ onParentClose: ({ executionId: e, status: t }) => Pe(e, t),
700
700
  recorder: k
701
701
  }, n);
702
- }), ...e.discovered.workflowWorkers ?? []], Ie = Fe.length > 0 ? j.mergeAll(...Fe) : j.empty;
702
+ }), ...e.discovered.workflowWorkers ?? []], Le = Ie.length > 0 ? j.mergeAll(...Ie) : j.empty;
703
703
  if (((e.discovered.workflows?.length ?? 0) > 0 || (e.discovered.workflowWorkers?.length ?? 0) > 0 || e.scheduleCoordination === "cluster") && e.workflowEngineLayer !== void 0) {
704
- let t = Ie.pipe(j.provideMerge(e.workflowEngineLayer));
704
+ let t = Le.pipe(j.provideMerge(e.workflowEngineLayer));
705
705
  a = Re.make(e.baseLayer === void 0 ? t : t.pipe(j.provideMerge(e.baseLayer))), await a.runPromise(A.void), i = (e.discovered.workflows?.length ?? 0) > 0 ? ht({
706
706
  workflows: e.discovered.workflows ?? [],
707
707
  runEffect: (e) => a.runPromise(e),
@@ -730,37 +730,37 @@ var hn = "VoltroBootRefusal", gn = (e) => {
730
730
  ...i === void 0 ? {} : { options: i }
731
731
  }),
732
732
  listRuns: (t) => b(e.store, t),
733
- retry: (t, n) => ke({
733
+ retry: (t, n) => Ae({
734
734
  store: e.store,
735
735
  workflows: e.discovered.workflows ?? [],
736
736
  runPromise: (e) => a.runPromise(e)
737
737
  }, t, n)
738
738
  }) : void 0;
739
739
  }
740
- let Le = j.mergeAll(De.toLayer(C), Oe, Ae), ze = ee(C, e.discovered.queries.map((e) => e.descriptor.name), f), Ve = j.mergeAll(De.toLayer(ze), Oe, Ae), P = e.observability, Je = await Ke({
741
- ...P && P.spanProcessors.length > 0 ? { extraSpanProcessors: P.spanProcessors } : {},
742
- ...P && P.metricReaders.length > 0 ? { extraMetricReaders: P.metricReaders } : {},
743
- ...P && Object.keys(P.resourceAttributes).length > 0 ? { resourceAttributes: P.resourceAttributes } : {},
744
- ...P && P.sampler !== void 0 ? { sampler: P.sampler } : {}
745
- }), Ye = !1, Xe = e.store.ping ? () => e.store.ping().then(() => !0).catch(() => !1) : void 0, { server: Ze, shutdown: Qe } = Et({
746
- group: De,
747
- handlersLayer: Le,
748
- httpHandlersLayer: Ve,
740
+ let ze = j.mergeAll(ke.toLayer(C), je, Me), Ve = ee(C, e.discovered.queries.map((e) => e.descriptor.name), f), We = j.mergeAll(ke.toLayer(Ve), je, Me), I = e.observability, Ye = await qe({
741
+ ...I && I.spanProcessors.length > 0 ? { extraSpanProcessors: I.spanProcessors } : {},
742
+ ...I && I.metricReaders.length > 0 ? { extraMetricReaders: I.metricReaders } : {},
743
+ ...I && Object.keys(I.resourceAttributes).length > 0 ? { resourceAttributes: I.resourceAttributes } : {},
744
+ ...I && I.sampler !== void 0 ? { sampler: I.sampler } : {}
745
+ }), Xe = !1, Ze = e.store.ping ? () => e.store.ping().then(() => !0).catch(() => !1) : void 0, { server: Qe, shutdown: nt } = Tt({
746
+ group: ke,
747
+ handlersLayer: ze,
748
+ httpHandlersLayer: We,
749
749
  port: e.port ?? 4e3,
750
750
  path: e.path ?? "/ws",
751
- tracerLayer: Je.layer,
751
+ tracerLayer: Ye.layer,
752
752
  healthCheck: {
753
- isReady: () => Ye,
754
- ...Xe ? { ping: Xe } : {}
753
+ isReady: () => Xe,
754
+ ...Ze ? { ping: Ze } : {}
755
755
  },
756
- ...we.length > 0 ? { httpRoutes: we } : {},
756
+ ...Ee.length > 0 ? { httpRoutes: Ee } : {},
757
757
  ...e.getStore === void 0 ? {} : { getStore: e.getStore },
758
758
  ...oe.size > 0 ? { webhookRoutes: oe } : {},
759
759
  ...e.inspectRoute === void 0 ? {} : { inspectRoute: e.inspectRoute }
760
760
  });
761
- if (await We(Ze), (e.discovered.schedules?.length ?? 0) > 0) {
762
- let t = (e.scheduleCoordination ?? "single") === "advisoryLock" ? tt(e.store, e.scheduleReplicaId ?? `pid-${process.pid}`) : Tt;
763
- o = await Dt(e.discovered.schedules ?? [], {
761
+ if (await Ge(Qe), (e.discovered.schedules?.length ?? 0) > 0) {
762
+ let t = (e.scheduleCoordination ?? "single") === "advisoryLock" ? tt(e.store, e.scheduleReplicaId ?? `pid-${process.pid}`) : wt;
763
+ o = await Et(e.discovered.schedules ?? [], {
764
764
  store: e.store,
765
765
  coordinator: t,
766
766
  defaultTrigger: e.scheduleDefaultTrigger ?? "self",
@@ -788,10 +788,10 @@ var hn = "VoltroBootRefusal", gn = (e) => {
788
788
  ...e.onScheduleRunEvent === void 0 ? {} : { onRunEvent: e.onScheduleRunEvent }
789
789
  }), e.onSchedulerReady?.(o);
790
790
  }
791
- let nt = e.log ?? M({ scope: "voltro:serve" }), rt, it;
792
- if ((e.discovered.subscribers?.length ?? 0) > 0 && (rt = de(e.discovered.subscribers ?? [], e.store, nt.child("subscribe"), e.schemaRegistry)), (e.discovered.reactions?.length ?? 0) > 0) {
793
- let t = nt.child("reaction");
794
- it = ve(e.discovered.reactions ?? [], e.store, {
791
+ let rt = e.log ?? M({ scope: "voltro:serve" }), it, at;
792
+ if ((e.discovered.subscribers?.length ?? 0) > 0 && (it = de(e.discovered.subscribers ?? [], e.store, rt.child("subscribe"), e.schemaRegistry)), (e.discovered.reactions?.length ?? 0) > 0) {
793
+ let t = rt.child("reaction");
794
+ at = ve(e.discovered.reactions ?? [], e.store, {
795
795
  runAct: async (n, r) => {
796
796
  if (n.kind === "workflow") {
797
797
  if (d === void 0) {
@@ -807,7 +807,7 @@ var hn = "VoltroBootRefusal", gn = (e) => {
807
807
  }
808
808
  await _(n.agent, r, {
809
809
  findAgentSend: (t) => e.discovered.actions.find((e) => e.descriptor.name === `${t}.send`),
810
- runAction: (e, t, n) => Promise.resolve(he(e, t, n)),
810
+ runAction: (e, t, n) => Promise.resolve(ge(e, t, n)),
811
811
  makeSubject: (e) => Lt(e),
812
812
  now: () => Date.now(),
813
813
  log: t
@@ -826,24 +826,24 @@ var hn = "VoltroBootRefusal", gn = (e) => {
826
826
  }
827
827
  }, t);
828
828
  }
829
- let at;
830
- return (e.discovered.aggregates?.length ?? 0) > 0 && (at = await ne({
829
+ let ot;
830
+ return (e.discovered.aggregates?.length ?? 0) > 0 && (ot = await ne({
831
831
  discovered: e.discovered.aggregates ?? [],
832
832
  store: e.store,
833
- log: nt.child("aggregate"),
833
+ log: rt.child("aggregate"),
834
834
  ...e.analytics === void 0 ? {} : { analytics: e.analytics },
835
835
  ...e.aggregateStorage === void 0 ? {} : { storage: e.aggregateStorage },
836
836
  ...e.aggregateCoordinator === void 0 ? {} : { coordinator: e.aggregateCoordinator }
837
- }), ue = j.succeed(N, at.registry)), Ye = !0, e.bootTiming?.mark("ready"), {
837
+ }), ue = j.succeed(N, ot.registry)), Xe = !0, e.bootTiming?.mark("ready"), {
838
838
  dispatcher: t,
839
- server: Ze,
839
+ server: Qe,
840
840
  scheduler: o,
841
841
  close: async () => {
842
- Ye = !1, at?.detach(), it?.(), rt?.(), await o?.shutdown(), t.close(), await a?.dispose(), await new Promise((e) => Ze.close(() => e())), await Qe();
842
+ Xe = !1, ot?.detach(), at?.(), it?.(), await o?.shutdown(), t.close(), await a?.dispose(), await new Promise((e) => Qe.close(() => e())), await nt();
843
843
  }
844
844
  };
845
845
  }, $ = M({ scope: "voltro:serve" }), Pn = (e, t, n) => (e === "production" || e === "staging") && t !== "memory" && n !== "0", Fn = Pe, In = async (e) => {
846
- let t = O(process.cwd());
846
+ let t = D(process.cwd());
847
847
  if (ze(t)) {
848
848
  let n;
849
849
  try {
@@ -856,7 +856,7 @@ var hn = "VoltroBootRefusal", gn = (e) => {
856
856
  }
857
857
  return Ln(e);
858
858
  }, Ln = async (ee) => {
859
- let p = Ne();
859
+ let p = k();
860
860
  process.env.NODE_ENV || (process.env.NODE_ENV = "production");
861
861
  try {
862
862
  qt();
@@ -864,14 +864,14 @@ var hn = "VoltroBootRefusal", gn = (e) => {
864
864
  throw gn(e instanceof Error ? e.message : String(e));
865
865
  }
866
866
  let m = process.cwd(), ne = Number(process.env.PORT ?? Fn(ee, "--port") ?? 4e3), g = await he(m);
867
- Ct(xt(g?.secrets)), await e({
867
+ xt(bt(g?.secrets)), await e({
868
868
  rawEnv: g?.env,
869
869
  appType: "api",
870
870
  root: m,
871
871
  log: $,
872
872
  generateTypes: !1
873
873
  }), p.mark("config");
874
- let _ = (process.env.DB_DIALECT ?? g?.store ?? "memory").toLowerCase(), ce = (_ === "mariadb" || _ === "postgres" || _ === "mssql") && (process.env.CDC ?? "1") !== "0", le = _ === "mariadb" ? "mariadb" : _ === "mssql" ? "mssql" : void 0, de = k(m);
874
+ let _ = (process.env.DB_DIALECT ?? g?.store ?? "memory").toLowerCase(), ce = (_ === "mariadb" || _ === "postgres" || _ === "mssql") && (process.env.CDC ?? "1") !== "0", le = _ === "mariadb" ? "mariadb" : _ === "mssql" ? "mssql" : void 0, de = O(m);
875
875
  if (!i() && ze(de)) try {
876
876
  let e = await import(Ie(de).href);
877
877
  if (e.modules) {
@@ -882,40 +882,40 @@ var hn = "VoltroBootRefusal", gn = (e) => {
882
882
  } catch (e) {
883
883
  $.warn("precompiled api bundle failed to load — falling back to source", {}, e);
884
884
  }
885
- let b = await be(m), S = await De(b, { cdc: ce && le !== void 0 });
885
+ let b = await C(m), S = await Oe(b, { cdc: ce && le !== void 0 });
886
886
  {
887
887
  let e = h(S.serverOnlyLeaks, re(process.env, "strict"), Ze, "`voltro serve`");
888
888
  if (e.action === "fail") throw gn(e.message ?? "");
889
889
  e.action === "warn" && $.warn(e.message ?? "");
890
890
  }
891
- let ve = b.filter((e) => Ae.test(e)), w = ve.length > 0 ? await ue(ve, $.child("webhooks")) : void 0, Ce = s({
891
+ let ve = b.filter((e) => je.test(e)), w = ve.length > 0 ? await ue(ve, $.child("webhooks")) : void 0, we = s({
892
892
  mix: S.featureMix,
893
893
  plugins: g?.plugins ?? [],
894
894
  cdc: ce && le !== void 0,
895
895
  ...le ? { cdcDialect: le } : {}
896
- }), ke = g?.analytics !== void 0 && g.analytics.kind !== "noop" && _ !== "memory" ? (await n(_)).makeSqlLayer(T()) : void 0, D = await ie({
896
+ }), Ae = g?.analytics !== void 0 && g.analytics.kind !== "noop" && _ !== "memory" ? (await n(_)).makeSqlLayer(T()) : void 0, E = await ie({
897
897
  spec: g?.analytics,
898
- sqlLayer: ke,
898
+ sqlLayer: Ae,
899
899
  log: $
900
- }), O = (() => {
900
+ }), D = (() => {
901
901
  let e = new Set(S.tables.map((e) => e.tableName)), t = [...S.tables];
902
- for (let n of [...Ce, ...D.tables]) e.has(n.tableName) || (e.add(n.tableName), t.push(n));
902
+ for (let n of [...we, ...E.tables]) e.has(n.tableName) || (e.add(n.tableName), t.push(n));
903
903
  return t;
904
904
  })();
905
- for (let e of O) Mt(e);
905
+ for (let e of D) jt(e);
906
906
  let Pe = (process.env.NODE_ENV ?? "").toLowerCase();
907
907
  if (Pn(Pe, _, process.env.VOLTRO_AUTO_MIGRATE)) {
908
- let e = (await n(_)).makeSqlLayer(T()), t = await A.runPromise(At.SqlClient.pipe(A.flatMap((e) => Qt(e, O, {
908
+ let e = (await n(_)).makeSqlLayer(T()), t = await A.runPromise(kt.SqlClient.pipe(A.flatMap((e) => Qt(e, D, {
909
909
  appliedBy: `serve:${Pe}`,
910
910
  environment: "prod",
911
911
  dialectId: _
912
912
  })), A.provide(e)));
913
913
  t.kind === "prod-mismatch" && ($.error(Zt(t, _)), $.error("serve: refusing to boot — apply the schema first (voltro db apply in a pre-deploy step), or set VOLTRO_AUTO_MIGRATE=0 to bypass this check."), process.exit(1)), $.info(Zt(t, _));
914
914
  }
915
- let M = mt(O);
915
+ let M = mt(D);
916
916
  p.mark("discover");
917
- let N = await _e(g, void 0), Be = Ot(N, _);
918
- for (let e of we({
917
+ let N = await x(g, void 0), Be = Dt(N, _);
918
+ for (let e of Te({
919
919
  dialect: String(g?.store ?? process.env.DB_DIALECT ?? "postgres"),
920
920
  changeStrategy: (process.env.CDC ?? "1") === "0" ? "inline" : "cdc",
921
921
  dbUrl: process.env.DB_URL,
@@ -929,28 +929,28 @@ var hn = "VoltroBootRefusal", gn = (e) => {
929
929
  })
930
930
  })) e.level === "warn" ? $.warn(e.message) : $.info(e.message);
931
931
  g?.cache && !process.env.CACHE_BACKEND && (process.env.CACHE_BACKEND = g.cache), g?.cacheRedisUrl && !process.env.CACHE_REDIS_URL && (process.env.CACHE_REDIS_URL = g.cacheRedisUrl), g?.cacheRedisDriver && !process.env.CACHE_REDIS_DRIVER && (process.env.CACHE_REDIS_DRIVER = g.cacheRedisDriver), g?.cacheKeyPrefix && !process.env.CACHE_KEY_PREFIX && (process.env.CACHE_KEY_PREFIX = g.cacheKeyPrefix);
932
- let { service: He, invalidationBus: Ue, snapshotCache: We, cache: F, backend: Ge, dispose: I } = await xe({ env: process.env });
933
- $.info(`cache backend resolved: ${Ge}` + (Ge === "redis" ? ` (driver ${process.env.CACHE_REDIS_DRIVER ?? "resp"})` : " — in-process, not cross-instance")), N.onChange((e) => {
932
+ let { service: He, invalidationBus: Ue, snapshotCache: Ge, cache: P, backend: Ke, dispose: F } = await xe({ env: process.env });
933
+ $.info(`cache backend resolved: ${Ke}` + (Ke === "redis" ? ` (driver ${process.env.CACHE_REDIS_DRIVER ?? "resp"})` : " — in-process, not cross-instance")), N.onChange((e) => {
934
934
  A.runFork(Ue.publish(e.table));
935
935
  }), g?.kv && !process.env.KV_BACKEND && (process.env.KV_BACKEND = g.kv), g?.kvRedisUrl && !process.env.KV_REDIS_URL && (process.env.KV_REDIS_URL = g.kvRedisUrl), g?.kvKeyPrefix && !process.env.KV_KEY_PREFIX && (process.env.KV_KEY_PREFIX = g.kvKeyPrefix);
936
- let { kv: Ke, service: qe } = await at({ store: N });
936
+ let { kv: qe, service: Je } = await at({ store: N });
937
937
  p.mark("store");
938
- let $e = P({
938
+ let $e = We({
939
939
  store: N,
940
- sink: D.sink,
940
+ sink: E.sink,
941
941
  log: $
942
942
  }), et = pe({
943
943
  store: N,
944
944
  dialect: _
945
945
  }), L = g?.plugins ?? [], st = process.env.POD_NAME ?? process.env.HOSTNAME ?? `serve-${process.pid}`, ct, lt;
946
- _ !== "memory" && (ct = Re.make((await n(_)).makeSqlLayer(T())), lt = await ct.runPromise(At.SqlClient));
946
+ _ !== "memory" && (ct = Re.make((await n(_)).makeSqlLayer(T())), lt = await ct.runPromise(kt.SqlClient));
947
947
  let ut = ot({
948
948
  coordinator: [
949
949
  "postgres",
950
950
  "mariadb",
951
951
  "mysql",
952
952
  "mssql"
953
- ].includes(_) ? tt(N, st, $) : Tt,
953
+ ].includes(_) ? tt(N, st, $) : wt,
954
954
  replicaId: st,
955
955
  log: $
956
956
  }), dt = [], ft = {
@@ -977,48 +977,48 @@ var hn = "VoltroBootRefusal", gn = (e) => {
977
977
  log: $
978
978
  });
979
979
  L.length && await ht.activate(), p.mark("plugins");
980
- let gt = await ht.gatherObservability(), _t = await x(N, g, _, {
980
+ let gt = await ht.gatherObservability(), _t = await _e(N, g, _, {
981
981
  info: (e, t) => process.stdout.write(`[broadcast] ${e} ${t ? JSON.stringify(t) : ""}\n`),
982
982
  warn: (e, t) => process.stderr.write(`[broadcast] ${e} ${t ? JSON.stringify(t) : ""}\n`),
983
983
  debug: () => {}
984
- }), R = g?.apiKeys, yt = (typeof R == "object" ? R.prefix : void 0) ?? "voltro_", bt = R ? Ye(N) : void 0, St = bt ? rt({ flush: it(bt) }) : void 0;
985
- St && vt(() => St.shutdown());
986
- let z = bt ? nt(bt, {
984
+ }), R = g?.apiKeys, yt = (typeof R == "object" ? R.prefix : void 0) ?? "voltro_", z = R ? Ye(N) : void 0, B = z ? rt({ flush: it(z) }) : void 0;
985
+ B && vt(() => B.shutdown());
986
+ let St = z ? nt(z, {
987
987
  prefix: yt,
988
- ...St ? { usage: St } : {}
989
- }) : void 0, wt = z ? [Qe(z, { prefix: yt })] : [], Et = Se([...g?.auth?.strategies ?? [], ...wt], $t(g?.plugins ?? []), g?.auth?.anonymousTenantRequired ?? !1, g?.auth?.resolveScopes, () => Be), Dt = [...g?.restRoutes ?? [], ...z ? Ve(z, (typeof R == "object" ? R.managementPath : void 0) ?? "/v1/api-keys") : []], B = g?.idempotency, kt = B ? {
988
+ ...B ? { usage: B } : {}
989
+ }) : void 0, Ct = St ? [Qe(St, { prefix: yt })] : [], Tt = Ce([...g?.auth?.strategies ?? [], ...Ct], $t(g?.plugins ?? []), g?.auth?.anonymousTenantRequired ?? !1, g?.auth?.resolveScopes, () => Be), Et = [...g?.restRoutes ?? [], ...St ? Ve(St, (typeof R == "object" ? R.managementPath : void 0) ?? "/v1/api-keys") : []], V = g?.idempotency, Ot = V ? {
990
990
  store: Xe(N),
991
- header: (typeof B == "object" ? B.header : void 0) ?? "Idempotency-Key",
992
- ttlMs: (typeof B == "object" ? B.ttlMs : void 0) ?? 864e5
993
- } : void 0, jt = Dt.length > 0 ? tn(Dt, {
991
+ header: (typeof V == "object" ? V.header : void 0) ?? "Idempotency-Key",
992
+ ttlMs: (typeof V == "object" ? V.ttlMs : void 0) ?? 864e5
993
+ } : void 0, At = Et.length > 0 ? tn(Et, {
994
994
  store: N,
995
- resolveSubject: (e) => Et({
995
+ resolveSubject: (e) => Tt({
996
996
  headers: e,
997
997
  clientId: -1
998
998
  }),
999
- ...kt ? { idempotency: kt } : {}
1000
- }) : [], V = L.map((e) => e.services).filter((e) => e !== void 0), Nt = j.mergeAll(Ee({
1001
- analyticsLayer: D.layer,
999
+ ...Ot ? { idempotency: Ot } : {}
1000
+ }) : [], H = L.map((e) => e.services).filter((e) => e !== void 0), Mt = j.mergeAll(De({
1001
+ analyticsLayer: E.layer,
1002
1002
  cacheService: He,
1003
- kvService: qe,
1004
- pluginServices: V,
1003
+ kvService: Je,
1004
+ pluginServices: H,
1005
1005
  userLayers: g?.layers ?? []
1006
- }), ge(g?.http ?? {})), H = g?.scheduling ?? {}, Pt = H.trigger ?? "self", Ft = /* @__PURE__ */ new Set([
1006
+ }), ge(g?.http ?? {})), U = g?.scheduling ?? {}, Nt = U.trigger ?? "self", Pt = /* @__PURE__ */ new Set([
1007
1007
  "postgres",
1008
1008
  "mysql",
1009
1009
  "mariadb",
1010
1010
  "mssql"
1011
- ]), It = H.coordination ?? (Ft.has(_) ? "advisoryLock" : "single"), U = It === "cluster" && Ft.has(_), W = U ? "cluster" : It === "advisoryLock" && Ft.has(_) ? "advisoryLock" : "single";
1012
- It === "cluster" && !U && $.warn("scheduling.coordination=cluster needs a sql-backed store except sqlite — falling back to single"), It === "advisoryLock" && !Ft.has(_) && $.warn("scheduling.coordination=advisoryLock needs a SQL store (the claim-row gate) — falling back to single");
1013
- let G, K = S.workflows.length > 0 || S.workflowWorkers.length > 0 || S.eventTriggers.length > 0 || (w?.outgoing.length ?? 0) > 0 || U, Lt;
1011
+ ]), Ft = U.coordination ?? (Pt.has(_) ? "advisoryLock" : "single"), W = Ft === "cluster" && Pt.has(_), It = W ? "cluster" : Ft === "advisoryLock" && Pt.has(_) ? "advisoryLock" : "single";
1012
+ Ft === "cluster" && !W && $.warn("scheduling.coordination=cluster needs a sql-backed store except sqlite — falling back to single"), Ft === "advisoryLock" && !Pt.has(_) && $.warn("scheduling.coordination=advisoryLock needs a SQL store (the claim-row gate) — falling back to single");
1013
+ let G, K = S.workflows.length > 0 || S.workflowWorkers.length > 0 || S.eventTriggers.length > 0 || (w?.outgoing.length ?? 0) > 0 || W, Lt;
1014
1014
  if (K) {
1015
1015
  if (_ === "mssql") {
1016
1016
  let e = await fe(process.cwd());
1017
1017
  e && $.warn(e);
1018
1018
  }
1019
- let [{ WorkflowEngine: e }, { makeClusterCronLayer: t, workflowEngineLayer: r, resolveRunnerStorage: i }] = await Promise.all([import("@effect/workflow"), import("@voltro/workflow/cluster")]), a = U ? S.schedules.filter((e) => (e.trigger ?? Pt) === "self").map((e) => t({
1019
+ let [{ WorkflowEngine: e }, { makeClusterCronLayer: t, workflowEngineLayer: r, resolveRunnerStorage: i }] = await Promise.all([import("@effect/workflow"), import("@voltro/workflow/cluster")]), a = W ? S.schedules.filter((e) => (e.trigger ?? Nt) === "self").map((e) => t({
1020
1020
  name: e.name,
1021
- cron: Je(e),
1021
+ cron: I(e),
1022
1022
  execute: async () => {
1023
1023
  await G?.fireFromCluster(e.name);
1024
1024
  }
@@ -1034,13 +1034,13 @@ var hn = "VoltroBootRefusal", gn = (e) => {
1034
1034
  });
1035
1035
  })();
1036
1036
  }
1037
- let Rt = je(L, t()), zt = b.filter((e) => /\.subscribe\.tsx?$/.test(e)), q = zt.length > 0 ? await ae(zt, $) : [], Bt = b.filter((e) => /\.reaction\.tsx?$/.test(e)), Vt = Bt.length > 0 ? await se(Bt, $) : [], J = b.filter((e) => u.test(e)), Ht = J.length > 0 ? await Me(J, $) : [], Ut = b.filter((e) => /\.aggregate\.tsx?$/.test(e)), Y = Ut.length > 0 ? await v(Ut, $) : [], X = ye();
1037
+ let Rt = Me(L, t()), zt = b.filter((e) => /\.subscribe\.tsx?$/.test(e)), q = zt.length > 0 ? await ae(zt, $) : [], Bt = b.filter((e) => /\.reaction\.tsx?$/.test(e)), Vt = Bt.length > 0 ? await se(Bt, $) : [], J = b.filter((e) => u.test(e)), Ht = J.length > 0 ? await Ne(J, $) : [], Ut = b.filter((e) => /\.aggregate\.tsx?$/.test(e)), Y = Ut.length > 0 ? await v(Ut, $) : [], X = ye();
1038
1038
  if (Y.length > 0 && _ !== "memory") try {
1039
1039
  X = f((await n(_)).makeSqlLayer(T()));
1040
1040
  } catch (e) {
1041
1041
  $.warn("aggregate: SQL storage init failed — falling back to in-process", { err: String(e) });
1042
1042
  }
1043
- let Wt = _ === "memory" ? Tt : tt(N, `aggregate@${process.pid}`, $), Z = [], Gt = [], Kt = b.filter((e) => l.test(e));
1043
+ let Wt = _ === "memory" ? wt : tt(N, `aggregate@${process.pid}`, $), Z = [], Gt = [], Kt = b.filter((e) => l.test(e));
1044
1044
  if (Kt.length > 0) {
1045
1045
  let e = $.child("agent"), t = b.filter((e) => a.test(e));
1046
1046
  t.length > 0 && await o(t, e);
@@ -1072,30 +1072,30 @@ var hn = "VoltroBootRefusal", gn = (e) => {
1072
1072
  ...w === void 0 ? {} : { webhooks: w }
1073
1073
  },
1074
1074
  log: $,
1075
- analytics: D.sink,
1075
+ analytics: E.sink,
1076
1076
  aggregateStorage: X,
1077
1077
  aggregateCoordinator: Wt,
1078
1078
  store: N,
1079
- kv: Ke,
1080
- cache: F,
1081
- snapshotCache: We,
1079
+ kv: qe,
1080
+ cache: P,
1081
+ snapshotCache: Ge,
1082
1082
  schemaRegistry: M,
1083
1083
  tenantScopedTables: S.tenantScopedTables,
1084
1084
  softDeleteScopedTables: S.softDeleteScopedTables,
1085
- dataTransferSnapshot: Xt(O),
1085
+ dataTransferSnapshot: Xt(D),
1086
1086
  dataTransferDialect: _,
1087
1087
  tenantIsolation: (process.env.VOLTRO_TENANT_ISOLATION ?? g?.tenancy?.isolation) === "namespace" ? "namespace" : "shared-schema",
1088
- resolveSubject: (e, t) => Et({
1088
+ resolveSubject: (e, t) => Tt({
1089
1089
  headers: e,
1090
1090
  clientId: t
1091
1091
  }),
1092
- httpRoutes: [...L.flatMap((e) => e.httpRoutes ?? []), ...jt],
1092
+ httpRoutes: [...L.flatMap((e) => e.httpRoutes ?? []), ...At],
1093
1093
  getStore: () => Be,
1094
- ...Nt ? { baseLayer: Nt } : {},
1094
+ ...Mt ? { baseLayer: Mt } : {},
1095
1095
  ...Lt === void 0 ? {} : { workflowEngineLayer: Lt },
1096
- scheduleDefaultTrigger: Pt,
1097
- scheduleCoordination: W,
1098
- scheduleArmSelf: !U,
1096
+ scheduleDefaultTrigger: Nt,
1097
+ scheduleCoordination: It,
1098
+ scheduleArmSelf: !W,
1099
1099
  dormancy: process.env.VOLTRO_DORMANCY === "sleep" || process.env.VOLTRO_DORMANCY === "always-on" ? process.env.VOLTRO_DORMANCY : g?.dormancy ?? "always-on",
1100
1100
  scheduleReplicaId: process.env.HOSTNAME ?? `pid-${process.pid}`,
1101
1101
  ...Rt === void 0 ? {} : { scheduleFireInterceptor: Rt },
@@ -1106,14 +1106,14 @@ var hn = "VoltroBootRefusal", gn = (e) => {
1106
1106
  kind: "api",
1107
1107
  meta: {
1108
1108
  name: g?.name ?? "voltro-api",
1109
- voltroVersion: Te,
1109
+ voltroVersion: Ee,
1110
1110
  port: ne,
1111
1111
  mode: "start",
1112
1112
  store: _,
1113
1113
  cdc: ce ? "on" : "off"
1114
1114
  },
1115
- rpc: C(S, m),
1116
- workflows: Oe(S, m),
1115
+ rpc: be(S, m),
1116
+ workflows: ke(S, m),
1117
1117
  inspectFireSchedule: async ({ name: e, trigger: t }) => {
1118
1118
  if (!G) throw Error("scheduler not started — this app registers no self-triggered schedules (all schedules are trigger:'external', or there are none).");
1119
1119
  return { runId: await G.fireNow(e, t) ?? null };
@@ -1130,7 +1130,7 @@ var hn = "VoltroBootRefusal", gn = (e) => {
1130
1130
  port: ne,
1131
1131
  ...g?.transport?.wsPath ? { path: g.transport.wsPath } : {}
1132
1132
  });
1133
- return E(oe([
1133
+ return Se(oe([
1134
1134
  S.queries,
1135
1135
  S.mutations,
1136
1136
  S.actions,
@@ -1146,12 +1146,12 @@ var hn = "VoltroBootRefusal", gn = (e) => {
1146
1146
  workflows: S.workflows.length,
1147
1147
  workflowWorkers: S.workflowWorkers.length,
1148
1148
  schedules: S.schedules.length,
1149
- scheduleCoordination: W
1149
+ scheduleCoordination: It
1150
1150
  }), p.finish($), vt(async () => {
1151
1151
  for (let e of dt) e.stop();
1152
- $e.detach(), et.stop(), I(), ct?.dispose();
1152
+ $e.detach(), et.stop(), F(), ct?.dispose();
1153
1153
  try {
1154
- await ht.deactivate(), await _t?.close(), await D.dispose(), await Jt.close(), await N.close?.();
1154
+ await ht.deactivate(), await _t?.close(), await E.dispose(), await Jt.close(), await N.close?.();
1155
1155
  } catch (e) {
1156
1156
  console.error("serve: shutdown step failed, exiting anyway:", e);
1157
1157
  }