@voltro/runtime 0.86.0 → 0.88.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 (184) hide show
  1. package/CHANGELOG.md +5484 -0
  2. package/README.md +43 -0
  3. package/THIRD-PARTY-NOTICES.md +1511 -276
  4. package/dist/aggregate.js +1 -2
  5. package/dist/aggregateExtrema.js +1 -2
  6. package/dist/aggregateIvm.js +1 -2
  7. package/dist/analyticsMirror.js +1 -2
  8. package/dist/analyticsSink.js +9 -16
  9. package/dist/apiKeyUsage.js +1 -2
  10. package/dist/apiKeys.js +83 -80
  11. package/dist/apiKeysWiring.js +1 -2
  12. package/dist/apiRoleBucketSampler.js +63 -0
  13. package/dist/apiRoleWorkloadHistory.js +55 -0
  14. package/dist/apiRoleWorkloadMetrics.js +77 -0
  15. package/dist/apiRoleWorkloadStorage.js +94 -0
  16. package/dist/approvalBuiltins.js +1 -2
  17. package/dist/approvals.js +68 -76
  18. package/dist/authMiddlewareLayer.js +8 -8
  19. package/dist/bindEvent.js +49 -30
  20. package/dist/boot-refusal.d.ts +10 -0
  21. package/dist/{bootRefusal.js → boot-refusal.js} +1 -2
  22. package/dist/bootListener.js +203 -47
  23. package/dist/bootStoreCodec.js +39 -39
  24. package/dist/businessRules.js +1 -2
  25. package/dist/changeClaimsTable.js +1 -2
  26. package/dist/circuitBreaker.js +1 -72
  27. package/dist/columnOnUpdate.js +1 -2
  28. package/dist/composeAnalytics.js +32 -12
  29. package/dist/computedQuery.js +1 -2
  30. package/dist/computedQueryCache.js +289 -0
  31. package/dist/connectionBuiltins.js +1 -2
  32. package/dist/connectionCredentials.js +1 -2
  33. package/dist/connectionState.js +1 -2
  34. package/dist/connectionVault.js +1 -2
  35. package/dist/connectionsFacade.js +33 -32
  36. package/dist/coordinatedSchedule.js +85 -80
  37. package/dist/crdtHistory.js +1 -2
  38. package/dist/crdtMerge.js +1 -2
  39. package/dist/crdtVersionsTable.js +1 -2
  40. package/dist/credentialBound.js +1 -2
  41. package/dist/crud.js +1 -2
  42. package/dist/dataStore.js +155 -123
  43. package/dist/dataloader.js +1 -2
  44. package/dist/declaredTablesGuard.js +3 -3
  45. package/dist/defineExecutor.js +1 -2
  46. package/dist/dependencyGraph.js +1 -2
  47. package/dist/devices.js +1 -2
  48. package/dist/devicesWiring.js +1 -2
  49. package/dist/dialectReplicationAdapter.js +1 -2
  50. package/dist/dispatcher.js +404 -330
  51. package/dist/effectStore.js +3 -4
  52. package/dist/engineClients.js +23 -0
  53. package/dist/eventBus.js +1 -2
  54. package/dist/eventPublish.js +1 -2
  55. package/dist/events.js +1 -2
  56. package/dist/expectation.js +1 -2
  57. package/dist/expectationEvaluator.js +2 -3
  58. package/dist/experiment.js +1 -2
  59. package/dist/experimentEvaluator.js +1 -2
  60. package/dist/externalizedTasks.js +20 -8
  61. package/dist/fieldCipher.js +110 -42
  62. package/dist/fieldKeyRegistry.js +294 -0
  63. package/dist/fieldKeyRekey.js +285 -0
  64. package/dist/fieldKeyScan.js +135 -0
  65. package/dist/fieldKeyring.js +76 -0
  66. package/dist/fingerprint.js +1 -2
  67. package/dist/finops.js +1 -2
  68. package/dist/finopsAccountant.js +1 -2
  69. package/dist/handlerBody.js +1 -2
  70. package/dist/healthProbes.js +1 -2
  71. package/dist/hot.d.ts +56 -0
  72. package/dist/hot.js +3 -0
  73. package/dist/hotDataStore.js +147 -0
  74. package/dist/hotDataStoreSnapshot.js +97 -0
  75. package/dist/hotDataStoreTables.js +17 -0
  76. package/dist/http-range.d.ts +53 -0
  77. package/dist/http-range.js +51 -0
  78. package/dist/httpClientSsrf.js +13 -39
  79. package/dist/httpClientTracing.js +13 -11
  80. package/dist/httpCompression.js +18 -19
  81. package/dist/httpInputStream.js +81 -0
  82. package/dist/httpKeepAlive.js +1 -2
  83. package/dist/httpRouteMounts.js +2 -2
  84. package/dist/idempotencyStore.js +93 -54
  85. package/dist/idleDetector.js +1 -2
  86. package/dist/index.d.ts +1185 -452
  87. package/dist/index.js +144 -134
  88. package/dist/insertRequiredColumns.js +1 -2
  89. package/dist/instanceMembership.js +1 -2
  90. package/dist/ivm.js +1 -2
  91. package/dist/kvDataStore.js +1 -2
  92. package/dist/kvFacade.js +24 -19
  93. package/dist/matcher.js +1 -2
  94. package/dist/memoryColumnDefaults.js +1 -2
  95. package/dist/memoryQueryJoins.js +17 -18
  96. package/dist/memorySetOperations.js +42 -0
  97. package/dist/metrics.js +39 -26
  98. package/dist/observability.js +2 -3
  99. package/dist/observedGraph.js +1 -2
  100. package/dist/originGuard.js +1 -2
  101. package/dist/outbox.js +2 -3
  102. package/dist/pluginRefRules.js +1 -2
  103. package/dist/policyGuardResolver.js +1 -2
  104. package/dist/preview.js +1 -2
  105. package/dist/projectedRows.js +1 -2
  106. package/dist/provenance.js +1 -2
  107. package/dist/rangeIndex.js +1 -2
  108. package/dist/rawReadScope.js +2 -3
  109. package/dist/reaction.js +1 -2
  110. package/dist/reactiveConfig.js +1 -2
  111. package/dist/readClassification.js +1 -2
  112. package/dist/readRecorder.js +36 -36
  113. package/dist/readScopePredicate.js +11 -0
  114. package/dist/rebac.js +1 -2
  115. package/dist/rebacInterceptor.js +1 -2
  116. package/dist/registry.js +1 -2
  117. package/dist/relevantFields.js +1 -2
  118. package/dist/replicaHealth.js +1 -2
  119. package/dist/replicaLocality.js +1 -2
  120. package/dist/replicaObservations.js +1 -2
  121. package/dist/replicaSelection.js +1 -2
  122. package/dist/replicatedDataStore.js +23 -6
  123. package/dist/requestLoader.js +1 -2
  124. package/dist/resumeCensus.js +1 -2
  125. package/dist/revalidation.js +1 -2
  126. package/dist/rowFilter.js +57 -41
  127. package/dist/rowStateBytes.js +1 -2
  128. package/dist/rpcBodyCap.js +1 -2
  129. package/dist/rpcConnections.js +9 -10
  130. package/dist/rpcDefectDiagnostics.js +1 -2
  131. package/dist/rpcServer.js +523 -451
  132. package/dist/rpcWorkloadAdmission.js +49 -0
  133. package/dist/runAsSystem.js +1 -2
  134. package/dist/rywPositionStore.js +83 -49
  135. package/dist/schedule.js +1 -2
  136. package/dist/scheduleBackfillRequests.js +1 -2
  137. package/dist/scheduleClaimsTable.js +1 -2
  138. package/dist/scheduleRunsTable.js +1 -2
  139. package/dist/scheduler.js +7 -3
  140. package/dist/schemaRegistry.js +1 -2
  141. package/dist/secretsResolver.js +1 -2
  142. package/dist/securityHeaders.js +1 -2
  143. package/dist/servePipeline.js +238 -154
  144. package/dist/serverOnlyAudit.js +1 -2
  145. package/dist/serverTracer.js +1 -2
  146. package/dist/serviceCredentials.js +1 -2
  147. package/dist/setReadScopes.js +27 -0
  148. package/dist/singleNodeOrchestrator.js +1 -2
  149. package/dist/snapshotValueCodec.js +45 -0
  150. package/dist/sourceResolution.js +35 -26
  151. package/dist/storeMiddleware.js +213 -212
  152. package/dist/storeQuery.js +1 -2
  153. package/dist/storeRead.js +1 -2
  154. package/dist/subscriber.js +2 -2
  155. package/dist/subscriptionOutbox.js +1 -2
  156. package/dist/subscriptionRegistry.js +1 -2
  157. package/dist/subscriptionResume.js +1 -2
  158. package/dist/subscriptionSocketMetrics.js +1 -2
  159. package/dist/systemSubject.js +1 -2
  160. package/dist/tenantScope.js +9 -22
  161. package/dist/tenantSelection.js +1 -2
  162. package/dist/timeline.js +1 -2
  163. package/dist/traceContext.js +1 -2
  164. package/dist/traceSink.js +1 -2
  165. package/dist/traceSpansTable.js +1 -2
  166. package/dist/traceparent.js +9 -21
  167. package/dist/transactionSubject.js +1 -2
  168. package/dist/trustedProxy.js +2 -3
  169. package/dist/undo.js +1 -2
  170. package/dist/undoBuiltins.js +1 -2
  171. package/dist/undoCapture.js +1 -2
  172. package/dist/undoLogTable.js +1 -2
  173. package/dist/upsertBinding.js +1 -2
  174. package/dist/wakeOrchestrator.js +1 -2
  175. package/dist/wakeRegistry.js +1 -2
  176. package/dist/wakeRouter.js +1 -2
  177. package/dist/wakeSupervisor.js +1 -2
  178. package/dist/wakeupsTable.js +1 -2
  179. package/dist/webSocketGatewayRuntime.js +112 -73
  180. package/dist/webhookVerification.js +1 -2
  181. package/dist/wireColumnStrip.js +1 -2
  182. package/dist/workflowReadBuiltins.js +1 -2
  183. package/dist/workflowRuntime.js +10 -11
  184. package/package.json +36 -17
@@ -1,114 +1,153 @@
1
- import { Effect as e } from "effect";
2
- import { GATEWAY_CREDENTIAL_EXPIRED_CLOSE_CODE as t } from "@voltro/protocol";
3
- import { Socket as n } from "effect/socket";
4
- //#region src/webSocketGatewayRuntime.ts
5
- var r = (r, i, a, o, s, c, l) => e.scoped(e.gen(function* () {
6
- let u = yield* r.writer, d = yield* e.context(), f = new AbortController(), p = a.limits?.maxMessageBytes ?? 1048576, m = a.limits?.maxPendingBytes ?? 4194304, h = a.limits?.maxPendingMessages ?? 64, g = [], _ = [], v = 0, y, b = 0, x, S, C, w = !1, T = !1, E = () => {
7
- let e = x;
8
- x = void 0;
1
+ import { Effect as e, Schema as t } from "effect";
2
+ import { GATEWAY_CREDENTIAL_EXPIRED_CLOSE_CODE as n, Subject as r } from "@voltro/protocol";
3
+ import { Socket as i } from "effect/socket";
4
+ // src/webSocketGatewayRuntime.ts
5
+ var a = (a, o, s, c, l, u, d) => e.scoped(e.gen(function* () {
6
+ let f = yield* a.writer, p = yield* e.context(), m = new AbortController(), h = s.limits?.maxMessageBytes ?? 1048576, g = s.limits?.maxPendingBytes ?? 4194304, _ = s.limits?.maxPendingMessages ?? 64, v = [], y = s.limits?.maxInboundMessagesPerSecond, b = s.limits?.burst ?? y ?? 0, x = b, S = performance.now(), C = [], w = 0, T, E = 0, D, O, k, A = 0, j, M = s.auth === "token" ? "waiting" : "admitted", N = c, P = !1, F = !1, I = () => {
7
+ let e = D;
8
+ D = void 0;
9
9
  try {
10
10
  e?.();
11
11
  } catch (e) {
12
- l(e);
12
+ d(e);
13
13
  }
14
- }, D = (e) => {
15
- if (!f.signal.aborted) {
16
- f.abort(e), S !== void 0 && clearTimeout(S), g.length = 0, y?.reject(e);
17
- for (let t = v; t < _.length; t += 1) _[t]?.reject(e);
18
- _.length = 0, v = 0, b = 0, E();
14
+ }, L = (e) => {
15
+ if (!m.signal.aborted) {
16
+ m.abort(e), O !== void 0 && clearTimeout(O), k !== void 0 && clearTimeout(k), v.length = 0, T?.reject(e);
17
+ for (let t = w; t < C.length; t += 1) C[t]?.reject(e);
18
+ C.length = 0, w = 0, E = 0, I();
19
19
  }
20
- }, O = (t = 1e3, r) => {
21
- f.signal.aborted || (D(Error(r ?? "gateway closed")), !(T || i.destroyed) && (T = !0, C = setTimeout(() => i.destroy(), 1e3), C.unref(), w ? e.runPromiseWith(d)(u.write(new n.CloseEvent(t, r))).catch(() => i.destroy()) : i.destroy()));
22
- }, k = () => new Promise((e, t) => {
23
- if (f.signal.aborted || i.destroyed) {
20
+ }, R = (t = 1e3, n) => {
21
+ m.signal.aborted || (L(Error(n ?? "gateway closed")), !(F || o.destroyed) && (F = !0, j = setTimeout(() => o.destroy(), 1e3), j.unref(), P ? e.runPromiseWith(p)(f.write(new i.CloseEvent(t, n))).catch(() => o.destroy()) : o.destroy()));
22
+ }, z = () => new Promise((e, t) => {
23
+ if (m.signal.aborted || o.destroyed) {
24
24
  t(/* @__PURE__ */ Error("gateway closed"));
25
25
  return;
26
26
  }
27
27
  let n = () => {
28
28
  t(/* @__PURE__ */ Error("gateway closed"));
29
29
  };
30
- f.signal.addEventListener("abort", n, { once: !0 }), i.write(/* @__PURE__ */ new Uint8Array(), (r) => {
31
- f.signal.removeEventListener("abort", n), r ? t(r) : e();
30
+ m.signal.addEventListener("abort", n, { once: !0 }), o.write(/* @__PURE__ */ new Uint8Array(), (r) => {
31
+ m.signal.removeEventListener("abort", n), r ? t(r) : e();
32
32
  });
33
- }), A = async () => {
34
- if (y !== void 0 || f.signal.aborted) return;
35
- let t = _[v];
33
+ }), B = async () => {
34
+ if (T !== void 0 || m.signal.aborted) return;
35
+ let t = C[w];
36
36
  if (t) {
37
- _[v] = void 0, v += 1, v === _.length ? (_.length = 0, v = 0) : v >= 1024 && v * 2 >= _.length && (_.splice(0, v), v = 0), y = t;
37
+ C[w] = void 0, w += 1, w === C.length ? (C.length = 0, w = 0) : w >= 1024 && w * 2 >= C.length && (C.splice(0, w), w = 0), T = t;
38
38
  try {
39
- if (await e.runPromiseWith(d)(u.write(t.data), { signal: f.signal }), await k(), f.signal.aborted) throw Error("gateway closed");
40
- t.resolve();
39
+ if (await e.runPromiseWith(p)(f.write(t.data), { signal: m.signal }), await z(), m.signal.aborted) throw Error("gateway closed");
40
+ t.resolve({ queuedBytes: E - t.size });
41
41
  } catch (e) {
42
- t.reject(e instanceof Error ? e : /* @__PURE__ */ Error("gateway write failed")), O(1011, "gateway write failed");
42
+ t.reject(e instanceof Error ? e : /* @__PURE__ */ Error("gateway write failed")), R(1011, "gateway write failed");
43
43
  } finally {
44
- f.signal.aborted || (b -= t.size), y = void 0, f.signal.aborted || A();
44
+ m.signal.aborted || (E -= t.size), T = void 0, m.signal.aborted || B();
45
45
  }
46
46
  }
47
- }, j = (e) => {
48
- if (f.signal.aborted) return Promise.reject(/* @__PURE__ */ Error("gateway closed"));
47
+ }, V = (e) => {
48
+ if (m.signal.aborted) return Promise.reject(/* @__PURE__ */ Error("gateway closed"));
49
49
  let t = typeof e == "string" ? Buffer.byteLength(e) : e.byteLength;
50
- if (t > p) return O(1009, "gateway message too large"), Promise.reject(/* @__PURE__ */ Error("gateway message too large"));
51
- if (t > m - b || _.length - v + +!!y >= h) return O(1013, "gateway outbound queue exceeded"), Promise.reject(/* @__PURE__ */ Error("gateway outbound queue exceeded"));
52
- b += t;
50
+ if (t > h) return R(1009, "gateway message too large"), Promise.reject(/* @__PURE__ */ Error("gateway message too large"));
51
+ if (t > g - E || C.length - w + +!!T >= _) return R(1013, "gateway outbound queue exceeded"), Promise.reject(/* @__PURE__ */ Error("gateway outbound queue exceeded"));
52
+ E += t;
53
53
  let n = new Promise((n, r) => {
54
- _.push({
54
+ C.push({
55
55
  data: typeof e == "string" ? e : e.slice(),
56
56
  size: t,
57
57
  resolve: n,
58
58
  reject: r
59
59
  });
60
60
  });
61
- return A(), n;
62
- }, M = {
61
+ return B(), n;
62
+ }, H = {
63
63
  send: (e) => {
64
- j(e).catch(() => {});
64
+ V(e).catch(() => {});
65
65
  },
66
- sendAsync: j,
67
- signal: f.signal,
68
- close: O,
66
+ sendAsync: V,
67
+ get queuedBytes() {
68
+ return E;
69
+ },
70
+ signal: m.signal,
71
+ close: R,
69
72
  onMessage: (e) => {
70
- f.signal.aborted || g.push(e);
73
+ m.signal.aborted || v.push(e);
74
+ },
75
+ get subject() {
76
+ return N;
71
77
  },
72
- subject: o,
73
- headers: s,
74
- path: a.path
75
- }, N = () => D(/* @__PURE__ */ Error("gateway disconnected")), P = () => O(1011, "gateway transport failed");
76
- i.once("close", N), i.once("error", P), yield* e.addFinalizer(() => e.sync(() => {
77
- D(/* @__PURE__ */ Error("gateway stopped")), C !== void 0 && clearTimeout(C), i.off("close", N), i.off("error", P), i.destroy();
78
+ headers: l,
79
+ path: s.path
80
+ }, U = () => {
81
+ Promise.resolve().then(() => {
82
+ if (!m.signal.aborted) return s.onConnection(H);
83
+ }).then((e) => {
84
+ typeof e == "function" && (D = e), m.signal.aborted && I();
85
+ }, (e) => {
86
+ d(e), R(1011, "gateway setup failed");
87
+ });
88
+ }, W = (e) => {
89
+ if (m.signal.aborted) return !1;
90
+ let t = e - Date.now();
91
+ return t <= 0 ? (R(n, "credential expired"), !1) : (O = setTimeout(() => {
92
+ W(e);
93
+ }, Math.min(t, 2147483647)), O.unref(), !0);
94
+ }, G = (e, n) => {
95
+ M = "verifying";
96
+ let i = Uint8Array.from(e);
97
+ Promise.resolve().then(() => m.signal.aborted ? null : s.verify(i, {
98
+ signal: m.signal,
99
+ headers: l,
100
+ path: s.path,
101
+ receivedAt: n
102
+ })).then((e) => {
103
+ if (!m.signal.aborted) {
104
+ if (performance.now() >= A) R(1008, "gateway token verification timed out");
105
+ else if (e === null) R(1008, "gateway token rejected");
106
+ else {
107
+ if (!e || !t.is(r)(e.subject) || e.credentialExpiresAt !== void 0 && (!Number.isFinite(e.credentialExpiresAt) || !Number.isSafeInteger(Math.ceil(e.credentialExpiresAt * 1e3)))) throw Error("gateway token verifier returned an invalid SubjectResolution");
108
+ N = e.subject, k !== void 0 && clearTimeout(k), (e.credentialExpiresAt === void 0 || W(e.credentialExpiresAt * 1e3)) && (M = "admitted", U());
109
+ }
110
+ }
111
+ }).catch((e) => {
112
+ m.signal.aborted || (d(e), R(1011, "gateway token verification failed"));
113
+ });
114
+ }, K = () => L(/* @__PURE__ */ Error("gateway disconnected")), q = () => R(1011, "gateway transport failed");
115
+ o.once("close", K), o.once("error", q), yield* e.addFinalizer(() => e.sync(() => {
116
+ L(/* @__PURE__ */ Error("gateway stopped")), j !== void 0 && clearTimeout(j), o.off("close", K), o.off("error", q), o.destroy();
78
117
  }));
79
- let F = (e) => {
80
- if (!f.signal.aborted) {
81
- if (e.byteLength > p) O(1009, "gateway message too large");
118
+ let J = (e) => {
119
+ if (m.signal.aborted) return;
120
+ let t = performance.now();
121
+ if (e.byteLength > h) R(1009, "gateway message too large");
122
+ else {
123
+ if (y !== void 0) {
124
+ if (x = Math.min(b, x + Math.max(0, t - S) * y / 1e3), S = t, x < 1) {
125
+ R(1008, "gateway inbound rate exceeded");
126
+ return;
127
+ }
128
+ x--;
129
+ }
130
+ if (M !== "admitted" && t >= A) R(1008, "gateway token verification timed out");
131
+ else if (M === "waiting") G(e, t);
132
+ else if (M === "verifying") R(1008, "gateway token verification pending");
82
133
  else try {
83
- for (let t of g) t(e);
134
+ for (let n of v) n(e, t);
84
135
  } catch (e) {
85
- l(e), O(1011, "gateway message handler failed");
86
- }
87
- }
88
- }, I = e.sync(() => {
89
- if (w = !0, c !== void 0) {
90
- let e = c - Date.now();
91
- if (e <= 0) {
92
- O(t, "credential expired");
93
- return;
136
+ d(e), R(1011, "gateway message handler failed");
94
137
  }
95
- S = setTimeout(() => O(t, "credential expired"), e), S.unref();
96
138
  }
97
- Promise.resolve().then(() => {
98
- if (!f.signal.aborted) return a.onConnection(M);
99
- }).then((e) => {
100
- typeof e == "function" && (x = e), f.signal.aborted && E();
101
- }, (e) => {
102
- l(e), O(1011, "gateway setup failed");
103
- });
139
+ }, Y = e.sync(() => {
140
+ if (P = !0, s.auth === "token") {
141
+ let e = s.verificationTimeoutMs ?? 5e3;
142
+ A = performance.now() + e, k = setTimeout(() => R(1008, "gateway token verification timed out"), e), k.unref();
143
+ } else (u === void 0 || W(u)) && U();
104
144
  });
105
145
  yield* e.gen(function* () {
106
- let e = yield* r.reader;
107
- for (yield* I;;) {
146
+ let e = yield* a.reader;
147
+ for (yield* Y;;) {
108
148
  let t = yield* e.pull;
109
- for (let e of t) F(typeof e == "string" ? new TextEncoder().encode(e) : e);
149
+ for (let e of t) J(typeof e == "string" ? new TextEncoder().encode(e) : e);
110
150
  }
111
151
  }).pipe(e.ignore);
112
152
  }));
113
- //#endregion
114
- export { r as runWebSocketGateway };
153
+ export { a as runWebSocketGateway };
@@ -1,4 +1,4 @@
1
- //#region src/webhookVerification.ts
1
+ // src/webhookVerification.ts
2
2
  var e = "voltroWebhookVerification", t = (e) => e === "signature" || e === "provider" || e === "none", n = (n) => {
3
3
  if (typeof n != "function" && (typeof n != "object" || !n)) return;
4
4
  let r = n[e];
@@ -14,5 +14,4 @@ var e = "voltroWebhookVerification", t = (e) => e === "signature" || e === "prov
14
14
  for (let [t, i] of e) if (n(i.handle) === void 0) throw new r(t);
15
15
  }
16
16
  };
17
- //#endregion
18
17
  export { r as UnverifiedWebhookRoute, e as WEBHOOK_VERIFICATION_PROPERTY, i as assertWebhookRoutesDeclareVerification, n as webhookVerificationOf };
@@ -1,7 +1,7 @@
1
1
  import { getTable as e, readableByColumns as t, serverOnlyColumns as n } from "@voltro/database";
2
2
  import { ADMIN_SCOPE as r, effectiveScopes as i, hasEffectiveScope as a } from "@voltro/protocol";
3
3
  import { types as o } from "node:util";
4
- //#region src/wireColumnStrip.ts
4
+ // src/wireColumnStrip.ts
5
5
  var s = Array.prototype.includes, c = (e) => !o.isProxy(e) && Object.getPrototypeOf(e) === Array.prototype && Object.getOwnPropertyDescriptor(Array.prototype, "includes")?.value === s && Reflect.ownKeys(e).every((t) => {
6
6
  if (typeof t != "string" || t !== "length" && !/^(0|[1-9][0-9]*)$/.test(t)) return !1;
7
7
  let n = Object.getOwnPropertyDescriptor(e, t);
@@ -80,5 +80,4 @@ var s = Array.prototype.includes, c = (e) => !o.isProxy(e) && Object.getPrototyp
80
80
  };
81
81
  };
82
82
  };
83
- //#endregion
84
83
  export { g as createDispatchWireStrip, p as forbiddenColumnsForSubject, u as serverOnlyColumnNames, d as stripColumnsFromRows, m as stripForbiddenForWire, f as stripServerOnlyForWire };
@@ -1,7 +1,7 @@
1
1
  import { and as e, eq as t } from "@voltro/database";
2
2
  import { ADMIN_SCOPE as n, hasEffectiveScope as r } from "@voltro/protocol";
3
3
  import { openWorkflowRow as i } from "@voltro/workflow";
4
- //#region src/workflowReadBuiltins.ts
4
+ // src/workflowReadBuiltins.ts
5
5
  var a = (e) => e.request?.subject ?? null, o = (e, t) => {
6
6
  if (typeof e != "object" || !e) return null;
7
7
  let n = e[t];
@@ -83,5 +83,4 @@ var a = (e) => e.request?.subject ?? null, o = (e, t) => {
83
83
  projection: void 0
84
84
  });
85
85
  };
86
- //#endregion
87
86
  export { _ as workflowDomainEventsExecutor, v as workflowEventDeliveriesExecutor, s as workflowRowVisibleTo, h as workflowRunEventsExecutor, f as workflowRunExecutor, m as workflowRunStepsExecutor, p as workflowRunsExecutor };
@@ -4,9 +4,9 @@ import { makeEffectStoreLayer as r } from "./effectStore.js";
4
4
  import { Cause as i, Effect as a, Exit as o, Layer as s, Option as c, Schema as l, SchemaIssue as u } from "effect";
5
5
  import { SubjectService as d, WorkflowControlResultSchema as f, WorkflowQueuedCancellationResultSchema as p, WorkflowRestartCommandSchema as m, WorkflowRestartObservationSchema as h, WorkflowRestartResultSchema as g, WorkflowRestartTargetSchema as _, WorkflowRetryCommandSchema as v, WorkflowRetryObservationSchema as y, WorkflowRetryTargetSchema as b } from "@voltro/protocol";
6
6
  import { createLogger as x } from "@voltro/logger";
7
- import * as S from "effect/SchemaAST";
8
- import { executePreparedWorkflow as C, getCurrentWorkflowExecutionId as w, hasPreparedWorkflowExecution as T } from "@voltro/workflow";
9
- //#region src/workflowRuntime.ts
7
+ import { executePreparedWorkflow as S, getCurrentWorkflowExecutionId as C, hasPreparedWorkflowExecution as w } from "@voltro/workflow";
8
+ import * as T from "effect/SchemaAST";
9
+ // src/workflowRuntime.ts
10
10
  var E = class extends l.TaggedError()("WorkflowStartNotExecuted", {
11
11
  workflowName: l.String,
12
12
  handleId: l.String,
@@ -135,9 +135,9 @@ var E = class extends l.TaggedError()("WorkflowStartNotExecuted", {
135
135
  }
136
136
  }, H = (e, t) => {
137
137
  let n = e.ast, r = [], i = [];
138
- return S.isObjects(n) && n.propertySignatures.forEach((e) => {
138
+ return T.isObjects(n) && n.propertySignatures.forEach((e) => {
139
139
  let n = e.name;
140
- typeof n == "string" && (S.isOptional(e.type) ? t && i.push(n) : r.push(n));
140
+ typeof n == "string" && (T.isOptional(e.type) ? t && i.push(n) : r.push(n));
141
141
  }), {
142
142
  required: r,
143
143
  optional: i
@@ -151,7 +151,7 @@ var E = class extends l.TaggedError()("WorkflowStartNotExecuted", {
151
151
  }
152
152
  return n;
153
153
  }, i = (e, t, n = e.payloadSchema) => {
154
- let r = l.decodeUnknownResult(l.make(S.toType(n.ast)))(t);
154
+ let r = l.decodeUnknownResult(l.make(T.toType(n.ast)))(t);
155
155
  if (r._tag === "Success") return;
156
156
  let i = new Set(typeof t == "object" && t ? Object.keys(t) : []), a = W(n).filter((e) => !i.has(e));
157
157
  throw new V(e.name, a, u.makeFormatterDefault()(r.failure.issue));
@@ -161,7 +161,7 @@ var E = class extends l.TaggedError()("WorkflowStartNotExecuted", {
161
161
  }, d = async (t, n) => {
162
162
  let i = r(t);
163
163
  return z(t, n, c.getOrUndefined(await e.runEffect(i.poll(n))));
164
- }, x = async () => e.runEffect(w()), L = async (t, n, r) => {
164
+ }, x = async () => e.runEffect(C()), L = async (t, n, r) => {
165
165
  if (e.resolveQueuedStart === void 0) throw Error(`Workflow '${t}' remains queued under receipt '${n}'; no receipt resolver is configured`);
166
166
  let i = await e.resolveQueuedStart({
167
167
  workflowName: t,
@@ -353,9 +353,9 @@ var E = class extends l.TaggedError()("WorkflowStartNotExecuted", {
353
353
  }
354
354
  let m;
355
355
  (e.rememberStartContext !== void 0 || i?.callerContext !== void 0) && (m = c ?? await e.runEffect(u.executionId(p)), await e.rememberStartContext?.(t, m, i?.callerContext ?? { subject: n }));
356
- let h = c ?? (m !== void 0 && T(u) ? m : void 0);
357
- if (d) return h === void 0 ? await e.runEffect(u.execute(p)) : await e.runEffect(C(u, p, h, { discard: !1 })), e.onEnqueue?.(), M(t, h ?? await e.runEffect(u.executionId(p)), "succeeded");
358
- let g = await e.runEffect(h === void 0 ? u.execute(p, { discard: !0 }) : C(u, p, h));
356
+ let h = c ?? (m !== void 0 && w(u) ? m : void 0);
357
+ if (d) return h === void 0 ? await e.runEffect(u.execute(p)) : await e.runEffect(S(u, p, h, { discard: !1 })), e.onEnqueue?.(), M(t, h ?? await e.runEffect(u.executionId(p)), "succeeded");
358
+ let g = await e.runEffect(h === void 0 ? u.execute(p, { discard: !0 }) : S(u, p, h));
359
359
  return e.onEnqueue?.(), M(t, g, "running");
360
360
  };
361
361
  return {
@@ -704,5 +704,4 @@ var E = class extends l.TaggedError()("WorkflowStartNotExecuted", {
704
704
  return a.provide(m, h);
705
705
  }));
706
706
  })));
707
- //#endregion
708
707
  export { V as WorkflowPayloadError, P as WorkflowRateLimitedError, F as WorkflowSingletonHeldError, E as WorkflowStartNotExecuted, Y as makeLazyWorkflowFacade, q as makeTransactionalWorkflowFacade, G as makeWorkflowFacade, J as makeWorkflowFacadeWithCallerContext, X as makeWorkflowHandlers, Z as makeWorkflowLayers, L as makeWorkflowRunHandle, U as payloadPropertyNames };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voltro/runtime",
3
- "version": "0.86.0",
3
+ "version": "0.88.0",
4
4
  "description": "The Voltro server runtime — AppContext assembly, the dispatcher, handler layers, API keys, coordinated scheduling, and analytics composition.",
5
5
  "keywords": [
6
6
  "voltro",
@@ -18,11 +18,26 @@
18
18
  },
19
19
  "type": "module",
20
20
  "exports": {
21
+ "./hot": {
22
+ "types": "./dist/hot.d.ts",
23
+ "import": "./dist/hot.js",
24
+ "default": "./dist/hot.js"
25
+ },
21
26
  ".": {
22
27
  "types": "./dist/index.d.ts",
23
28
  "import": "./dist/index.js",
24
29
  "default": "./dist/index.js"
25
30
  },
31
+ "./http-range": {
32
+ "types": "./dist/http-range.d.ts",
33
+ "import": "./dist/http-range.js",
34
+ "default": "./dist/http-range.js"
35
+ },
36
+ "./boot-refusal": {
37
+ "types": "./dist/boot-refusal.d.ts",
38
+ "import": "./dist/boot-refusal.js",
39
+ "default": "./dist/boot-refusal.js"
40
+ },
26
41
  "./package.json": "./package.json"
27
42
  },
28
43
  "main": "./dist/index.js",
@@ -33,26 +48,30 @@
33
48
  "node": ">=24.0.0"
34
49
  },
35
50
  "dependencies": {
36
- "@effect/platform-node": "4.0.1",
37
- "@opentelemetry/api": "^1.9.1",
51
+ "@effect/platform-node": "4.1.0",
52
+ "@effect/platform-node-shared": "4.1.0",
53
+ "@nats-io/transport-node": "^3.4.0",
54
+ "@opentelemetry/api": "~1.9.1",
38
55
  "@opentelemetry/exporter-metrics-otlp-http": "^0.222.0",
39
56
  "@opentelemetry/exporter-trace-otlp-http": "^0.222.0",
40
- "@opentelemetry/resources": "^2.11.0",
41
- "@opentelemetry/sdk-metrics": "^2.11.0",
42
- "@opentelemetry/sdk-trace-base": "^2.11.0",
43
- "@opentelemetry/sdk-trace-node": "^2.11.0",
44
- "@opentelemetry/semantic-conventions": "^1.43.0",
45
- "@voltro/database": "0.86.0",
46
- "@voltro/kv": "0.86.0",
47
- "@voltro/local-first": "0.86.0",
48
- "@voltro/logger": "0.86.0",
49
- "@voltro/protocol": "0.86.0",
50
- "@voltro/workflow": "0.86.0",
51
- "ioredis": "^5.11.1"
57
+ "@opentelemetry/resources": "^2.12.0",
58
+ "@opentelemetry/sdk-metrics": "^2.12.0",
59
+ "@opentelemetry/sdk-trace-base": "^2.12.0",
60
+ "@opentelemetry/sdk-trace-node": "^2.12.0",
61
+ "@opentelemetry/semantic-conventions": "^1.44.0",
62
+ "@upstash/redis": "^1.40.0",
63
+ "@voltro/database": "0.88.0",
64
+ "@voltro/kv": "0.88.0",
65
+ "@voltro/local-first": "0.88.0",
66
+ "@voltro/logger": "0.88.0",
67
+ "@voltro/protocol": "0.88.0",
68
+ "@voltro/shared": "0.88.0",
69
+ "@voltro/workflow": "0.88.0",
70
+ "ioredis": "^6.0.0"
52
71
  },
53
72
  "peerDependencies": {
54
- "@effect/opentelemetry": "4.0.1",
55
- "effect": "4.0.1"
73
+ "@effect/opentelemetry": "4.1.0",
74
+ "effect": "4.1.0"
56
75
  },
57
76
  "peerDependenciesMeta": {
58
77
  "@effect/opentelemetry": {