@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,4 +1,4 @@
1
- //#region src/replicaHealth.ts
1
+ // src/replicaHealth.ts
2
2
  var e = (e = {}) => {
3
3
  let t = e.thresholdFailures ?? 3, n = e.windowMs ?? 1e4, r = e.blackoutMs ?? 6e4, i = e.now ?? Date.now, a = /* @__PURE__ */ new Map(), o = (e) => {
4
4
  let t = a.get(e);
@@ -38,5 +38,4 @@ var e = (e = {}) => {
38
38
  }
39
39
  };
40
40
  };
41
- //#endregion
42
41
  export { e as replicaHealth };
@@ -1,4 +1,4 @@
1
- //#region src/replicaLocality.ts
1
+ // src/replicaLocality.ts
2
2
  var e = (e) => {
3
3
  let { currentRegion: t, replicaRegions: n, inner: r } = e, i = (e) => {
4
4
  if (t === void 0) return {
@@ -40,5 +40,4 @@ var e = (e) => {
40
40
  if (typeof n == "string" && n.length > 0) return n;
41
41
  }
42
42
  };
43
- //#endregion
44
43
  export { e as localityAwareSelector, t as resolveCurrentRegion };
@@ -1,6 +1,6 @@
1
1
  import { createLogger as e } from "@voltro/logger";
2
2
  import { processIdentity as t } from "@voltro/protocol/identity";
3
- //#region src/replicaObservations.ts
3
+ // src/replicaObservations.ts
4
4
  var n = e({ scope: "voltro:replica-observations" }), r = "_voltro_replica_observations", i = (e) => e instanceof Date ? e.getTime() : typeof e == "number" ? e : NaN, a = /* @__PURE__ */ new Set(), o = () => {
5
5
  a.clear();
6
6
  }, s = async (e, i, o) => {
@@ -117,5 +117,4 @@ var n = e({ scope: "voltro:replica-observations" }), r = "_voltro_replica_observ
117
117
  ...h === void 0 ? { versions: void 0 } : { versions: h }
118
118
  };
119
119
  };
120
- //#endregion
121
120
  export { f as DEFAULT_STALE_AFTER_MS, l as ObservationsUnavailable, r as REPLICA_OBSERVATIONS_TABLE, d as forgetReplicaObservations, p as mergeFleetObservations, c as readReplicaObservations, o as resetReplicaObservationWarnings, s as writeReplicaObservation };
@@ -1,4 +1,4 @@
1
- //#region src/replicaSelection.ts
1
+ // src/replicaSelection.ts
2
2
  var e = (e = {}) => {
3
3
  let t = e.random ?? Math.random, n = /* @__PURE__ */ new Map(), r = (e) => n.get(e) ?? 0;
4
4
  return {
@@ -28,5 +28,4 @@ var e = (e = {}) => {
28
28
  }
29
29
  };
30
30
  };
31
- //#endregion
32
31
  export { e as powerOfTwoSelector };
@@ -4,13 +4,14 @@ import { memoryRywPositionStore as n } from "./rywPositionStore.js";
4
4
  import { Effect as r, Fiber as i } from "effect";
5
5
  import { createLogger as a } from "@voltro/logger";
6
6
  import { AsyncLocalStorage as o } from "node:async_hooks";
7
- //#region src/replicatedDataStore.ts
7
+ // src/replicatedDataStore.ts
8
8
  var s = a({ scope: "voltro:replication" }), c = new o(), l = (e, t) => c.run(e, t), u = (e, t) => r.flatMap(r.context(), (n) => r.callback((a) => {
9
9
  let o = l(e, () => r.runForkWith(n)(t));
10
10
  return o.addObserver((e) => {
11
11
  a(e);
12
12
  }), r.asVoid(i.interrupt(o));
13
13
  })), d = () => c.getStore(), f = class {
14
+ integrityQuery;
14
15
  primary;
15
16
  replicas;
16
17
  adapter;
@@ -22,8 +23,9 @@ var s = a({ scope: "voltro:replication" }), c = new o(), l = (e, t) => c.run(e,
22
23
  health;
23
24
  recordRouting;
24
25
  now;
26
+ closing;
25
27
  constructor(r) {
26
- this.primary = r.primary, this.replicas = r.replicas, this.adapter = r.replicationAdapter, this.policy = r.rywPolicy ?? "fallback", this.rywTtlMs = r.rywTtlMs ?? 3e4, this.rywMaxWaitMs = r.rywMaxWaitMs ?? 500, this.now = r.now ?? Date.now, this.rywStore = r.rywStore ?? n({ now: this.now }), this.selector = r.replicaSelector ?? e(), this.health = r.replicaHealth ?? t({ now: this.now }), r.recordRouting !== void 0 && (this.recordRouting = r.recordRouting);
28
+ this.primary = r.primary, r.primary.integrityQuery !== void 0 && (this.integrityQuery = r.primary.integrityQuery.bind(r.primary)), this.replicas = r.replicas, this.adapter = r.replicationAdapter, this.policy = r.rywPolicy ?? "fallback", this.rywTtlMs = r.rywTtlMs ?? 3e4, this.rywMaxWaitMs = r.rywMaxWaitMs ?? 500, this.now = r.now ?? Date.now, this.rywStore = r.rywStore ?? n({ now: this.now }), this.selector = r.replicaSelector ?? e(), this.health = r.replicaHealth ?? t({ now: this.now }), r.recordRouting !== void 0 && (this.recordRouting = r.recordRouting);
27
29
  }
28
30
  async query(e) {
29
31
  let t = c.getStore(), n = t?.subjectKey ?? "anon:bg";
@@ -166,9 +168,9 @@ var s = a({ scope: "voltro:replication" }), c = new o(), l = (e, t) => c.run(e,
166
168
  let n = await this.primary.insert(e, t);
167
169
  return await this.stampPostWrite(), n;
168
170
  }
169
- async insertMany(e, t) {
170
- let n = await this.primary.insertMany(e, t);
171
- return await this.stampPostWrite(), n;
171
+ async insertMany(e, t, n) {
172
+ let r = await this.primary.insertMany(e, t, n);
173
+ return await this.stampPostWrite(), r;
172
174
  }
173
175
  async patchJson(e, t, n, r, i) {
174
176
  let a = await this.primary.patchJson(e, t, n, r, i);
@@ -218,6 +220,22 @@ var s = a({ scope: "voltro:replication" }), c = new o(), l = (e, t) => c.run(e,
218
220
  get changeScope() {
219
221
  return this.primary.changeScope ?? "local";
220
222
  }
223
+ close(e) {
224
+ return this.closing ??= (async () => {
225
+ let t = [];
226
+ try {
227
+ await this.rywStore.close?.();
228
+ } catch (e) {
229
+ t.push(e);
230
+ }
231
+ for (let n of /* @__PURE__ */ new Set([this.primary, ...this.replicas])) try {
232
+ await n.close?.(e);
233
+ } catch (e) {
234
+ t.push(e);
235
+ }
236
+ if (t.length > 0) throw AggregateError(t, "Read replica shutdown failed");
237
+ })();
238
+ }
221
239
  async stampPostWrite() {
222
240
  if (this.replicas.length === 0) return;
223
241
  let e = c.getStore()?.subjectKey ?? "anon:bg";
@@ -235,5 +253,4 @@ var s = a({ scope: "voltro:replication" }), c = new o(), l = (e, t) => c.run(e,
235
253
  this.recordRouting?.(e);
236
254
  }
237
255
  }, p = (e) => new Promise((t) => setTimeout(t, e));
238
- //#endregion
239
256
  export { f as ReplicatedDataStore, d as currentRoutingContext, l as runWithRoutingContext, u as runWithRoutingContextEffect };
@@ -1,7 +1,6 @@
1
1
  import { AsyncLocalStorage as e } from "node:async_hooks";
2
- //#region src/requestLoader.ts
2
+ // src/requestLoader.ts
3
3
  var t = new e(), n = (e) => {
4
4
  t.enterWith(e);
5
5
  }, r = () => t.getStore(), i = (e, n) => t.run(e, n);
6
- //#endregion
7
6
  export { r as currentRequestLoader, n as enterRequestLoader, i as runWithRequestLoader };
@@ -1,5 +1,5 @@
1
1
  import { createLogger as e } from "@voltro/logger";
2
- //#region src/resumeCensus.ts
2
+ // src/resumeCensus.ts
3
3
  var t = Symbol.for("@voltro/runtime/resumeCensus"), n = globalThis, r = n[t] ?? (n[t] = { byLabel: /* @__PURE__ */ new Map() }), i = e({ scope: "voltro:resume" }), a = (e, t) => {
4
4
  let n = e.startsWith("subscription.") ? e.slice(13) : e, a = r.byLabel.get(n) ?? {
5
5
  resumable: 0,
@@ -24,5 +24,4 @@ var t = Symbol.for("@voltro/runtime/resumeCensus"), n = globalThis, r = n[t] ??
24
24
  }, s = () => {
25
25
  r.byLabel.clear();
26
26
  };
27
- //#endregion
28
27
  export { a as noteResumeVerdict, s as resetResumeCensus, o as resumeCensus };
@@ -1,4 +1,4 @@
1
- //#region src/revalidation.ts
1
+ // src/revalidation.ts
2
2
  var e = Symbol.for("@voltro/runtime/revalidation:publisher"), t = () => {
3
3
  let t = globalThis;
4
4
  return t[e] ??= { publisher: null };
@@ -18,5 +18,4 @@ var e = Symbol.for("@voltro/runtime/revalidation:publisher"), t = () => {
18
18
  kind: "tag",
19
19
  value: e
20
20
  });
21
- //#endregion
22
21
  export { i as revalidatePath, a as revalidateTable, o as revalidateTag, n as setRevalidationPublisher };
package/dist/rowFilter.js CHANGED
@@ -1,65 +1,81 @@
1
1
  import { restrictingReadsEffect as e } from "./readRecorder.js";
2
- import { Effect as t, Schedule as n, Schema as r } from "effect";
3
- import { and as i } from "@voltro/database";
4
- import { currentSubjectAuthority as a, isMachineSubject as o } from "@voltro/protocol";
5
- import { createLogger as s } from "@voltro/logger";
6
- //#region src/rowFilter.ts
7
- var c = class extends r.TaggedError()("RowFilterUnavailable", { cause: r.String }) {}, l = class extends r.TaggedError()("RowFilterDeclarationViolated", {
8
- table: r.String,
9
- declared: r.Array(r.String)
2
+ import { mapSetReadScopes as t } from "./setReadScopes.js";
3
+ import { Effect as n, Schedule as r, Schema as i } from "effect";
4
+ import { and as a } from "@voltro/database";
5
+ import { currentSubjectAuthority as o, isMachineSubject as s } from "@voltro/protocol";
6
+ import { createLogger as c } from "@voltro/logger";
7
+ // src/rowFilter.ts
8
+ var l = class extends i.TaggedError()("RowFilterUnavailable", { cause: i.String }) {}, u = class extends i.TaggedError()("RowFilterDeclarationViolated", {
9
+ table: i.String,
10
+ declared: i.Array(i.String)
10
11
  }) {
11
12
  get message() {
12
13
  return `row filter narrowed '${this.table}', which its declaration does not name (declared: ${this.declared.join(", ") || "none"})`;
13
14
  }
14
- }, u = n.max([n.exponential("20 millis"), n.recurs(2)]), d = Symbol.for("@voltro/runtime/rowFilter"), f = globalThis, p = f[d] ?? (f[d] = {}), m = (e) => {
15
- p.filter = e;
16
- }, h = () => p.filter, g = () => p.filter !== void 0, _ = () => void 0, v = s({ scope: "voltro:row-filter" }), y = /* @__PURE__ */ new Set(), b = (e, t) => {
17
- y.has(e) || (y.add(e), v.info("row filter: RESOLVED on a live read path", {
15
+ }, d = r.max([r.exponential("20 millis"), r.recurs(2)]), f = Symbol.for("@voltro/runtime/rowFilter"), p = globalThis, m = p[f] ?? (p[f] = {}), h = (e) => {
16
+ m.filter = e;
17
+ }, g = () => m.filter, _ = () => m.filter !== void 0, v = () => void 0, y = c({ scope: "voltro:row-filter" }), b = /* @__PURE__ */ new Set(), x = (e, t) => {
18
+ b.has(e) || (b.add(e), y.info("row filter: RESOLVED on a live read path", {
18
19
  arm: e,
19
20
  ...t === void 0 ? {} : { constrains: t },
20
- armsSeen: [...y].sort().join(",")
21
+ armsSeen: [...b].sort().join(",")
21
22
  }));
22
- }, x = () => [...y].sort(), S = () => {
23
- y.clear();
24
- }, C = (e, n) => t.tap(w(h(), e, n), () => t.sync(() => {
25
- let e = h();
26
- e !== void 0 && b("request", e.tables?.length);
27
- })), w = (n, r, i) => {
28
- if (n === void 0 || o(r)) return t.succeed(_);
29
- let a = n.retry ?? u, s = e(n.load(r)), d = a === !1 ? s : t.retry(s, a), f = n.tables, p = f === void 0 ? void 0 : new Set(f);
30
- return d.pipe(t.map((e) => p === void 0 ? (t) => n.predicate(e, t) : (t) => {
31
- let r = n.predicate(e, t);
32
- if (r !== void 0 && !p.has(t)) throw new l({
33
- table: t,
23
+ }, S = () => [...b].sort(), C = () => {
24
+ b.clear();
25
+ }, w = (e, t) => n.tap(T(g(), e, t), () => n.sync(() => {
26
+ let e = g();
27
+ e !== void 0 && x("request", e.tables?.length);
28
+ })), T = (t, r, i) => {
29
+ if (t === void 0 || s(r)) return n.succeed(v);
30
+ let a = t.retry ?? d, o = e(t.load(r)), c = a === !1 ? o : n.retry(o, a), f = t.tables, p = f === void 0 ? void 0 : new Set(f);
31
+ return c.pipe(n.map((e) => p === void 0 ? (n) => t.predicate(e, n) : (n) => {
32
+ let r = t.predicate(e, n);
33
+ if (r !== void 0 && !p.has(n)) throw new u({
34
+ table: n,
34
35
  declared: f ?? []
35
36
  });
36
37
  return r;
37
- }), t.catch((e) => t.suspend(() => (i?.(e), n.onLoadError === "deny" ? t.succeed(T) : t.fail(new c({ cause: String(e) }))))));
38
- }, T = () => ({
38
+ }), n.catch((e) => n.suspend(() => (i?.(e), t.onLoadError === "deny" ? n.succeed(E) : n.fail(new l({ cause: String(e) }))))));
39
+ }, E = () => ({
39
40
  column: "id",
40
41
  op: "isNull"
41
- }), E = (e) => {
42
- let t = h();
42
+ }), D = (e) => {
43
+ let t = g();
43
44
  if (t === void 0) return !1;
44
45
  let n = t.tables;
45
46
  if (n === void 0) return !0;
46
47
  let r = new Set(n);
47
48
  return e.some((e) => r.has(e));
48
- }, D = (e, t, n) => {
49
+ }, O = (e, t, n) => {
49
50
  let r = e(t);
50
- return r === void 0 ? n : n ? i(n, r) : r;
51
- }, O = (e, t) => {
52
- let n = D(e, t.table, t.predicate);
53
- return n === t.predicate ? t : {
54
- ...t,
55
- predicate: n
56
- };
51
+ return r === void 0 ? n : n ? a(n, r) : r;
57
52
  }, k = (e, n) => {
58
- if (h() !== void 0) return async () => {
59
- let r = await t.runPromise(t.result(C(a(e), n)));
53
+ let r = n;
54
+ if (r.setOp !== void 0) {
55
+ let i = {
56
+ ...r,
57
+ table: n.table,
58
+ predicate: n.predicate,
59
+ order: r.order ?? [],
60
+ projection: r.projection,
61
+ take: r.take,
62
+ skip: r.skip
63
+ }, a = t(i, (t) => k(e, t));
64
+ return {
65
+ ...n,
66
+ setOp: a.setOp
67
+ };
68
+ }
69
+ let i = O(e, n.table, n.predicate);
70
+ return i === n.predicate ? n : {
71
+ ...n,
72
+ predicate: i
73
+ };
74
+ }, A = (e, t) => {
75
+ if (g() !== void 0) return async () => {
76
+ let r = await n.runPromise(n.result(w(o(e), t)));
60
77
  if (r._tag === "Failure") throw r.failure;
61
78
  return r.success;
62
79
  };
63
80
  };
64
- //#endregion
65
- export { u as DEFAULT_ROW_FILTER_RETRY, _ as NO_ROW_FILTER, l as RowFilterDeclarationViolated, c as RowFilterUnavailable, D as applyRowFilter, O as applyRowFilterToDescriptor, h as getRowFilter, k as makeDefaultRefilter, b as noteRowFilterResolved, S as resetRowFilterResolvedArms, C as resolveRowFilterScope, w as resolveRowFilterScopeFor, E as rowFilterMayNarrow, g as rowFilterRegistered, x as rowFilterResolvedArms, m as setRowFilter };
81
+ export { d as DEFAULT_ROW_FILTER_RETRY, v as NO_ROW_FILTER, u as RowFilterDeclarationViolated, l as RowFilterUnavailable, O as applyRowFilter, k as applyRowFilterToDescriptor, g as getRowFilter, A as makeDefaultRefilter, x as noteRowFilterResolved, C as resetRowFilterResolvedArms, w as resolveRowFilterScope, T as resolveRowFilterScopeFor, D as rowFilterMayNarrow, _ as rowFilterRegistered, S as rowFilterResolvedArms, h as setRowFilter };
@@ -1,4 +1,4 @@
1
- //#region src/rowStateBytes.ts
1
+ // src/rowStateBytes.ts
2
2
  var e = (t, n) => {
3
3
  if (typeof t != "object" || !t) return typeof t != "bigint";
4
4
  if (n.has(t)) return !1;
@@ -41,5 +41,4 @@ var e = (t, n) => {
41
41
  }
42
42
  };
43
43
  };
44
- //#endregion
45
44
  export { t as createRowStateByteEstimator };
@@ -1,6 +1,6 @@
1
1
  import { Effect as e, Stream as t } from "effect";
2
2
  import { HttpServerError as n, UrlParams as r } from "effect/http";
3
- //#region src/rpcBodyCap.ts
3
+ // src/rpcBodyCap.ts
4
4
  var i = (t, n) => e.callback((r) => {
5
5
  let i = [], a = 0, o = !1, s = () => {
6
6
  t.off("data", l), t.off("end", u), t.off("error", d), t.off("aborted", d);
@@ -59,5 +59,4 @@ var i = (t, n) => e.callback((r) => {
59
59
  }
60
60
  }), o;
61
61
  };
62
- //#endregion
63
62
  export { i as readCappedBody, a as withBufferedBody };
@@ -1,15 +1,15 @@
1
1
  import { interruptConnectionStreams as e, unbindConnection as t } from "./connectionCredentials.js";
2
2
  import { Effect as n, Layer as r, Queue as i } from "effect";
3
3
  import { randomUUID as a } from "node:crypto";
4
- import { Headers as o } from "effect/http";
5
- import { RpcServer as s } from "effect/rpc";
6
- //#region src/rpcConnections.ts
4
+ import { RpcServer as o } from "effect/rpc";
5
+ import { Headers as s } from "effect/http";
6
+ // src/rpcConnections.ts
7
7
  var c = Symbol.for("@voltro/runtime/rpcConnections"), l = globalThis, u = l[c] ??= {
8
8
  nextId: 1,
9
9
  entries: /* @__PURE__ */ new Map(),
10
10
  addressMark: a()
11
11
  }, d = "x-voltro-client-address", f = (e) => `${u.addressMark} ${e}`, p = (e, t) => {
12
- let n = o.remove(e.headers, d), r = t === void 0 ? n : o.set(n, d, f(t)), i = Object.create(e);
12
+ let n = s.remove(e.headers, d), r = t === void 0 ? n : s.set(n, d, f(t)), i = Object.create(e);
13
13
  return Object.defineProperty(i, "headers", {
14
14
  value: r,
15
15
  configurable: !0
@@ -21,8 +21,8 @@ var c = Symbol.for("@voltro/runtime/rpcConnections"), l = globalThis, u = l[c] ?
21
21
  remoteAddr: n,
22
22
  headers: r.length === e.length ? e : r
23
23
  };
24
- }, h = (e) => u.entries.get(e)?.connection, g = (o, c) => r.effect(s.Protocol, n.gen(function* () {
25
- let r = yield* s.Protocol, o = yield* i.make(), l = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), f = (e, t) => {
24
+ }, h = (e) => u.entries.get(e)?.connection, g = (s, c) => r.effect(o.Protocol, n.gen(function* () {
25
+ let r = yield* o.Protocol, s = yield* i.make(), l = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), f = (e, t) => {
26
26
  let n = l.get(e);
27
27
  if (n !== void 0) return t !== void 0 && n.connection.remoteAddr === void 0 && (n.connection = Object.freeze({
28
28
  ...n.connection,
@@ -48,10 +48,10 @@ var c = Symbol.for("@voltro/runtime/rpcConnections"), l = globalThis, u = l[c] ?
48
48
  for (let e of l.keys()) p(e);
49
49
  })), yield* n.forkScoped(n.gen(function* () {
50
50
  let e = yield* i.take(r.disconnects), t = p(e);
51
- t !== void 0 && (yield* i.offer(o, t));
51
+ t !== void 0 && (yield* i.offer(s, t));
52
52
  }).pipe(n.forever)), {
53
53
  ...r,
54
- disconnects: o,
54
+ disconnects: s,
55
55
  run: (e) => r.run((t, i) => n.gen(function* () {
56
56
  if (!(yield* r.clientIds).has(t)) return;
57
57
  if (i._tag !== "Request") {
@@ -78,6 +78,5 @@ var c = Symbol.for("@voltro/runtime/rpcConnections"), l = globalThis, u = l[c] ?
78
78
  return n;
79
79
  })
80
80
  };
81
- })).pipe(r.provide(o));
82
- //#endregion
81
+ })).pipe(r.provide(s));
83
82
  export { d as RPC_CLIENT_ADDRESS_HEADER, h as getRpcConnection, f as stampRpcClientAddress, m as takeRpcClientAddress, p as withRpcClientAddress, g as withRpcConnectionIdentity };
@@ -1,4 +1,4 @@
1
- //#region src/rpcDefectDiagnostics.ts
1
+ // src/rpcDefectDiagnostics.ts
2
2
  var e = (e) => {
3
3
  if (typeof e != "object" || !e) return [];
4
4
  let t = e;
@@ -11,5 +11,4 @@ var e = (e) => {
11
11
  return t._tag === "Die" ? [t.defect] : [];
12
12
  });
13
13
  };
14
- //#endregion
15
14
  export { e as rpcFrameDefects };