@voltro/runtime 0.27.0 → 0.28.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.
- package/CHANGELOG.md +235 -0
- package/dist/index.d.ts +44 -15
- package/dist/index.js +277 -270
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -5687,37 +5687,40 @@ update again, which is indistinguishable from "nothing has changed" — so the
|
|
|
5687
5687
|
symptom is silence, and silence is what this surface exists to eliminate.
|
|
5688
5688
|
A \`source:\` is a STRING, so \`tsc\` cannot see a stale one and a rename leaves it
|
|
5689
5689
|
behind quietly.`;
|
|
5690
|
-
}, iu = (e) => e.
|
|
5691
|
-
let
|
|
5690
|
+
}, iu = (e) => e.old ?? e.new ?? {}, au = (e) => String(iu(e).id ?? ""), ou = (e) => {
|
|
5691
|
+
let t = iu(e).tenantId;
|
|
5692
|
+
return typeof t == "string" ? t : null;
|
|
5693
|
+
}, su = (e) => e.op === "update" && (e.old?.deletedAt ?? null) === null && (e.new?.deletedAt ?? null) !== null, cu = (e, t) => {
|
|
5694
|
+
let n = su(t);
|
|
5692
5695
|
return t.op !== "delete" && !n ? [] : e.filter((e) => e.targetTable === t.table && e.policy !== "keep" && (!n || e.onSoftDelete));
|
|
5693
|
-
},
|
|
5694
|
-
let r =
|
|
5696
|
+
}, lu = async (e, t, n) => {
|
|
5697
|
+
let r = cu(t, n);
|
|
5695
5698
|
if (r.length === 0) return [];
|
|
5696
|
-
let i = [];
|
|
5699
|
+
let i = au(n), a = ou(n), o = [];
|
|
5697
5700
|
for (let t of r) {
|
|
5698
|
-
let
|
|
5701
|
+
let n = await e.query({
|
|
5699
5702
|
table: t.table,
|
|
5700
5703
|
predicate: {
|
|
5701
5704
|
kind: "eq",
|
|
5702
5705
|
column: t.column,
|
|
5703
|
-
value:
|
|
5706
|
+
value: i
|
|
5704
5707
|
},
|
|
5705
5708
|
order: void 0,
|
|
5706
5709
|
take: void 0,
|
|
5707
5710
|
skip: void 0,
|
|
5708
5711
|
projection: void 0
|
|
5709
|
-
}),
|
|
5710
|
-
for (let n of
|
|
5712
|
+
}), r = a === null ? n : n.filter((e) => e.tenantId === a);
|
|
5713
|
+
for (let n of r) {
|
|
5711
5714
|
let r = String(n.id);
|
|
5712
5715
|
t.policy === "delete" ? await e.delete(t.table, r) : await e.update(t.table, r, { [t.column]: null });
|
|
5713
5716
|
}
|
|
5714
|
-
|
|
5717
|
+
o.push({
|
|
5715
5718
|
rule: t,
|
|
5716
|
-
affected:
|
|
5719
|
+
affected: r.length
|
|
5717
5720
|
});
|
|
5718
5721
|
}
|
|
5719
|
-
return
|
|
5720
|
-
},
|
|
5722
|
+
return o;
|
|
5723
|
+
}, uu = (e, t) => {
|
|
5721
5724
|
let n = [];
|
|
5722
5725
|
for (let r of e) for (let e of r.appliedPluginRefs ?? []) {
|
|
5723
5726
|
let i = e.column, a;
|
|
@@ -5736,26 +5739,26 @@ behind quietly.`;
|
|
|
5736
5739
|
});
|
|
5737
5740
|
}
|
|
5738
5741
|
return n.filter((e) => e.policy !== "keep");
|
|
5739
|
-
},
|
|
5742
|
+
}, du = class extends y.TaggedError()("CircuitOpen", {
|
|
5740
5743
|
name: y.String,
|
|
5741
5744
|
retryAfterMs: y.Number
|
|
5742
|
-
}) {},
|
|
5745
|
+
}) {}, fu = {
|
|
5743
5746
|
tag: "closed",
|
|
5744
5747
|
failureCount: 0,
|
|
5745
5748
|
halfOpenSuccesses: 0,
|
|
5746
5749
|
openedAt: 0
|
|
5747
|
-
},
|
|
5748
|
-
let r = n.name ?? "circuit", i = a.toMillis(a.decode(n.resetTimeout)), s = n.halfOpenSuccessThreshold ?? 1, c = n.isFailure ?? (() => !0), l = yield* _.make(
|
|
5750
|
+
}, pu = { make: (n) => o.gen(function* () {
|
|
5751
|
+
let r = n.name ?? "circuit", i = a.toMillis(a.decode(n.resetTimeout)), s = n.halfOpenSuccessThreshold ?? 1, c = n.isFailure ?? (() => !0), l = yield* _.make(fu), u = o.gen(function* () {
|
|
5749
5752
|
let e = yield* _.get(l);
|
|
5750
5753
|
if (e.tag === "half-open") {
|
|
5751
5754
|
let t = e.halfOpenSuccesses + 1;
|
|
5752
|
-
yield* _.set(l, t >= s ?
|
|
5755
|
+
yield* _.set(l, t >= s ? fu : {
|
|
5753
5756
|
...e,
|
|
5754
5757
|
halfOpenSuccesses: t
|
|
5755
5758
|
});
|
|
5756
5759
|
return;
|
|
5757
5760
|
}
|
|
5758
|
-
e.failureCount !== 0 && (yield* _.set(l,
|
|
5761
|
+
e.failureCount !== 0 && (yield* _.set(l, fu));
|
|
5759
5762
|
}), d = o.gen(function* () {
|
|
5760
5763
|
let e = yield* t.currentTimeMillis, r = yield* _.get(l);
|
|
5761
5764
|
if (r.tag === "half-open" || r.tag === "open") {
|
|
@@ -5793,7 +5796,7 @@ behind quietly.`;
|
|
|
5793
5796
|
if (e.isInterruptedOnly(t)) return o.void;
|
|
5794
5797
|
let n = e.failureOption(t), r = n._tag === "Some" ? n.value : void 0;
|
|
5795
5798
|
return c(r) ? d : o.void;
|
|
5796
|
-
})) : yield* o.fail(new
|
|
5799
|
+
})) : yield* o.fail(new du({
|
|
5797
5800
|
name: r,
|
|
5798
5801
|
retryAfterMs: n
|
|
5799
5802
|
}));
|
|
@@ -5802,15 +5805,15 @@ behind quietly.`;
|
|
|
5802
5805
|
value: _.get(l).pipe(o.map((e) => e.tag)),
|
|
5803
5806
|
enumerable: !0
|
|
5804
5807
|
}), Object.defineProperty(m, "reset", {
|
|
5805
|
-
value: _.set(l,
|
|
5808
|
+
value: _.set(l, fu),
|
|
5806
5809
|
enumerable: !0
|
|
5807
5810
|
}), m;
|
|
5808
|
-
}) },
|
|
5809
|
-
|
|
5810
|
-
},
|
|
5811
|
-
|
|
5812
|
-
},
|
|
5813
|
-
let n = t.scopes === void 0 ? vt(t.id ?? "system") : vt(t.id ?? "system", t.scopes), r = t.store ??
|
|
5811
|
+
}) }, mu, hu = (e) => {
|
|
5812
|
+
mu = e;
|
|
5813
|
+
}, gu = () => {
|
|
5814
|
+
mu = void 0;
|
|
5815
|
+
}, _u = () => mu, vu = async (e, t = {}) => {
|
|
5816
|
+
let n = t.scopes === void 0 ? vt(t.id ?? "system") : vt(t.id ?? "system", t.scopes), r = t.store ?? mu?.dataStore, i = t.schemaRegistry ?? mu?.schemaRegistry, a = t.dialect ?? mu?.dialect;
|
|
5814
5817
|
if (r === void 0 || i === void 0) throw Error("runAsSystem: no data store available — register one at boot via setSystemStoreHandle({ dataStore, schemaRegistry }) or pass { store, schemaRegistry } in the options.");
|
|
5815
5818
|
return e({
|
|
5816
5819
|
subject: n,
|
|
@@ -5820,7 +5823,7 @@ behind quietly.`;
|
|
|
5820
5823
|
...a === void 0 ? {} : { dialect: a }
|
|
5821
5824
|
})
|
|
5822
5825
|
});
|
|
5823
|
-
},
|
|
5826
|
+
}, yu = (e) => {
|
|
5824
5827
|
let { currentRegion: t, replicaRegions: n, inner: r } = e, i = (e) => {
|
|
5825
5828
|
if (t === void 0) return {
|
|
5826
5829
|
sameRegion: [],
|
|
@@ -5848,7 +5851,7 @@ behind quietly.`;
|
|
|
5848
5851
|
return r.loadSnapshot();
|
|
5849
5852
|
}
|
|
5850
5853
|
};
|
|
5851
|
-
},
|
|
5854
|
+
}, bu = (e = process.env) => {
|
|
5852
5855
|
for (let t of [
|
|
5853
5856
|
"VOLTRO_REGION",
|
|
5854
5857
|
"AWS_REGION",
|
|
@@ -5860,7 +5863,7 @@ behind quietly.`;
|
|
|
5860
5863
|
let n = e[t];
|
|
5861
5864
|
if (typeof n == "string" && n.length > 0) return n;
|
|
5862
5865
|
}
|
|
5863
|
-
},
|
|
5866
|
+
}, xu = () => {
|
|
5864
5867
|
let e = {
|
|
5865
5868
|
primary: 0,
|
|
5866
5869
|
lagByReplica: /* @__PURE__ */ new Map()
|
|
@@ -5885,7 +5888,7 @@ behind quietly.`;
|
|
|
5885
5888
|
e.lagByReplica.set(t, n);
|
|
5886
5889
|
}
|
|
5887
5890
|
};
|
|
5888
|
-
},
|
|
5891
|
+
}, Su = Symbol.for("@voltro/ScheduleDefinition"), Cu = (e) => typeof e == "object" && !!e && Su in e, wu = 30 * 6e4, Tu = (e) => {
|
|
5889
5892
|
let t = r.parse(e.cron, e.timezone);
|
|
5890
5893
|
if (s.isLeft(t)) throw Error(`defineSchedule("${e.name}"): invalid cron expression "${e.cron}" (tz="${e.timezone}") — ${String(t.left)}`);
|
|
5891
5894
|
if (!e.timezone || e.timezone.trim() === "") throw Error(`defineSchedule("${e.name}"): timezone is required (e.g. "UTC", "Europe/Berlin").\nThe field is non-optional in \`ScheduleDefinition\`, so an ABSENT one is a tsc error and never reaches here. Arriving at this message means the value was present and EMPTY — almost always \`process.env.TZ ?? ''\` or a config lookup that missed. A reporter lost a crashloop to it, so the distinction is worth stating: this is not a check the type could have made for you.`);
|
|
@@ -5894,18 +5897,18 @@ behind quietly.`;
|
|
|
5894
5897
|
...e,
|
|
5895
5898
|
onOverlap: e.onOverlap ?? "skip",
|
|
5896
5899
|
backfill: e.backfill ?? "skip",
|
|
5897
|
-
maxRuntimeMs: e.maxRuntimeMs ??
|
|
5898
|
-
[
|
|
5900
|
+
maxRuntimeMs: e.maxRuntimeMs ?? wu,
|
|
5901
|
+
[Su]: !0
|
|
5899
5902
|
};
|
|
5900
|
-
},
|
|
5903
|
+
}, Eu = (e) => r.unsafeParse(e.cron, e.timezone), Du = (e, t = /* @__PURE__ */ new Date()) => r.next(Eu(e), t), Z = "_voltro_wakeups", Ou = (e) => `${e.tenantId}:${e.kind}:${e.refId}`, ku = (e) => ({
|
|
5901
5904
|
tenantId: String(e.tenantId),
|
|
5902
5905
|
kind: String(e.kind),
|
|
5903
5906
|
refId: String(e.refId),
|
|
5904
5907
|
wakeAt: e.wakeAt instanceof Date ? e.wakeAt : new Date(String(e.wakeAt)),
|
|
5905
5908
|
status: e.status === "fired" ? "fired" : "pending"
|
|
5906
|
-
}),
|
|
5909
|
+
}), Au = async (e, t) => {
|
|
5907
5910
|
await e.upsert(Z, {
|
|
5908
|
-
id:
|
|
5911
|
+
id: Ou(t),
|
|
5909
5912
|
tenantId: t.tenantId,
|
|
5910
5913
|
kind: t.kind,
|
|
5911
5914
|
refId: t.refId,
|
|
@@ -5915,7 +5918,7 @@ behind quietly.`;
|
|
|
5915
5918
|
conflictColumns: ["id"],
|
|
5916
5919
|
update: ["wakeAt", "status"]
|
|
5917
5920
|
});
|
|
5918
|
-
},
|
|
5921
|
+
}, ju = async (e, t) => e.delete(Z, Ou(t)), Mu = async (e, t) => await e.update(Z, Ou(t), { status: "fired" }) !== null, Nu = (e, t) => ({ and: [{
|
|
5919
5922
|
column: "id",
|
|
5920
5923
|
op: "eq",
|
|
5921
5924
|
value: e
|
|
@@ -5923,16 +5926,16 @@ behind quietly.`;
|
|
|
5923
5926
|
column: "status",
|
|
5924
5927
|
op: "eq",
|
|
5925
5928
|
value: t
|
|
5926
|
-
}] }),
|
|
5927
|
-
await e.updateMany(Z, { status: "pending" }, { where:
|
|
5928
|
-
},
|
|
5929
|
+
}] }), Pu = async (e, t) => await e.updateMany(Z, { status: "fired" }, { where: Nu(Ou(t), "pending") }) > 0, Fu = async (e, t) => {
|
|
5930
|
+
await e.updateMany(Z, { status: "pending" }, { where: Nu(Ou(t), "fired") });
|
|
5931
|
+
}, Iu = {
|
|
5929
5932
|
column: "status",
|
|
5930
5933
|
op: "eq",
|
|
5931
5934
|
value: "pending"
|
|
5932
|
-
},
|
|
5935
|
+
}, Lu = async (e, t) => {
|
|
5933
5936
|
let n = {
|
|
5934
5937
|
table: Z,
|
|
5935
|
-
predicate:
|
|
5938
|
+
predicate: Iu,
|
|
5936
5939
|
order: [{
|
|
5937
5940
|
column: "wakeAt",
|
|
5938
5941
|
direction: "asc"
|
|
@@ -5941,18 +5944,18 @@ behind quietly.`;
|
|
|
5941
5944
|
skip: void 0,
|
|
5942
5945
|
projection: void 0
|
|
5943
5946
|
};
|
|
5944
|
-
return (await e.query(n)).map(
|
|
5945
|
-
},
|
|
5946
|
-
let r = await
|
|
5947
|
+
return (await e.query(n)).map(ku);
|
|
5948
|
+
}, Ru = async (e, t, n = 500) => {
|
|
5949
|
+
let r = await Lu(e, n), i = t.getTime();
|
|
5947
5950
|
return r.filter((e) => e.wakeAt.getTime() <= i);
|
|
5948
|
-
},
|
|
5951
|
+
}, zu = async (e) => (await Lu(e, 1))[0] ?? null, Bu = {
|
|
5949
5952
|
column: "status",
|
|
5950
5953
|
op: "eq",
|
|
5951
5954
|
value: "fired"
|
|
5952
|
-
},
|
|
5955
|
+
}, Vu = async (e, t = {}) => {
|
|
5953
5956
|
let n = {
|
|
5954
5957
|
table: Z,
|
|
5955
|
-
predicate:
|
|
5958
|
+
predicate: Bu,
|
|
5956
5959
|
order: [{
|
|
5957
5960
|
column: "wakeAt",
|
|
5958
5961
|
direction: "asc"
|
|
@@ -5963,12 +5966,12 @@ behind quietly.`;
|
|
|
5963
5966
|
}, r = await e.query(n), i = t.firedOlderThan?.getTime(), a = 0;
|
|
5964
5967
|
for (let t of r) i !== void 0 && (t.wakeAt instanceof Date ? t.wakeAt : new Date(String(t.wakeAt))).getTime() >= i || await e.delete(Z, String(t.id)) && a++;
|
|
5965
5968
|
return a;
|
|
5966
|
-
},
|
|
5969
|
+
}, Hu = Ho, Uu = "default", Wu = {
|
|
5967
5970
|
kind: "single",
|
|
5968
5971
|
tryClaim: async () => !0
|
|
5969
|
-
},
|
|
5972
|
+
}, Gu = "_voltro_schedule_claims", Ku = (e, t, n) => {
|
|
5970
5973
|
let r = async (t) => (await e.query({
|
|
5971
|
-
table:
|
|
5974
|
+
table: Gu,
|
|
5972
5975
|
order: [],
|
|
5973
5976
|
predicate: void 0,
|
|
5974
5977
|
projection: ["id"],
|
|
@@ -5983,7 +5986,7 @@ behind quietly.`;
|
|
|
5983
5986
|
if (await r(s)) return !1;
|
|
5984
5987
|
} catch {}
|
|
5985
5988
|
try {
|
|
5986
|
-
return await e.insert(
|
|
5989
|
+
return await e.insert(Gu, {
|
|
5987
5990
|
id: s,
|
|
5988
5991
|
scheduleName: i,
|
|
5989
5992
|
bucket: o,
|
|
@@ -6001,12 +6004,12 @@ behind quietly.`;
|
|
|
6001
6004
|
}
|
|
6002
6005
|
}
|
|
6003
6006
|
};
|
|
6004
|
-
},
|
|
6007
|
+
}, qu = "_voltro_schedule_runs", Ju = async (e, t) => {
|
|
6005
6008
|
let { store: n, coordinator: i, buildContext: a, replicaId: o, log: s, onRunEvent: c, interceptFire: l } = t, u = t.dormancy === "sleep", d = t.dormancyTenantId ?? "default", f = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Set(), m = /* @__PURE__ */ new Map(), h = !1, g = new Map(e.map((e) => [e.name, e])), _ = (e, t) => {
|
|
6006
|
-
c?.(e,
|
|
6009
|
+
c?.(e, Xu(t));
|
|
6007
6010
|
}, v = async (e, t, r, i, a, c) => {
|
|
6008
6011
|
try {
|
|
6009
|
-
let s = `sr_${Re()}`, l = await n.insert(
|
|
6012
|
+
let s = `sr_${Re()}`, l = await n.insert(qu, {
|
|
6010
6013
|
id: s,
|
|
6011
6014
|
name: e.name,
|
|
6012
6015
|
status: i,
|
|
@@ -6031,7 +6034,7 @@ behind quietly.`;
|
|
|
6031
6034
|
}
|
|
6032
6035
|
}, y = async (e, t) => {
|
|
6033
6036
|
try {
|
|
6034
|
-
let r = await n.update(
|
|
6037
|
+
let r = await n.update(qu, e, t);
|
|
6035
6038
|
r && _("update", r);
|
|
6036
6039
|
} catch (t) {
|
|
6037
6040
|
s.warn("schedule: failed to record run finish", {
|
|
@@ -6042,7 +6045,7 @@ behind quietly.`;
|
|
|
6042
6045
|
}, b = async (e) => {
|
|
6043
6046
|
try {
|
|
6044
6047
|
let t = await n.query({
|
|
6045
|
-
table:
|
|
6048
|
+
table: qu,
|
|
6046
6049
|
predicate: {
|
|
6047
6050
|
_tag: "leaf",
|
|
6048
6051
|
column: "status",
|
|
@@ -6077,7 +6080,7 @@ behind quietly.`;
|
|
|
6077
6080
|
scheduleName: e.name,
|
|
6078
6081
|
trigger: n,
|
|
6079
6082
|
runId: o,
|
|
6080
|
-
subject:
|
|
6083
|
+
subject: Hu
|
|
6081
6084
|
})
|
|
6082
6085
|
};
|
|
6083
6086
|
try {
|
|
@@ -6113,7 +6116,7 @@ behind quietly.`;
|
|
|
6113
6116
|
let n = Q(t).includes("exceeded maxRuntimeMs"), r = xn(t).dbMessage, i = typeof r == "string" && r !== "" ? `${Q(t)} — ${r}` : Q(t);
|
|
6114
6117
|
o && await y(o, {
|
|
6115
6118
|
status: "failed",
|
|
6116
|
-
errorTag: n ? "timeout" :
|
|
6119
|
+
errorTag: n ? "timeout" : Yu(t),
|
|
6117
6120
|
errorMessage: i,
|
|
6118
6121
|
completedAt: /* @__PURE__ */ new Date(),
|
|
6119
6122
|
durationMs: Date.now() - c
|
|
@@ -6177,8 +6180,8 @@ behind quietly.`;
|
|
|
6177
6180
|
}
|
|
6178
6181
|
}, w = async (e) => {
|
|
6179
6182
|
try {
|
|
6180
|
-
let t = r.next(
|
|
6181
|
-
await
|
|
6183
|
+
let t = r.next(Eu(e), /* @__PURE__ */ new Date());
|
|
6184
|
+
await Au(n, {
|
|
6182
6185
|
tenantId: d,
|
|
6183
6186
|
kind: "schedule",
|
|
6184
6187
|
refId: e.name,
|
|
@@ -6192,7 +6195,7 @@ behind quietly.`;
|
|
|
6192
6195
|
}
|
|
6193
6196
|
}, T = 2147483647, E = (e) => {
|
|
6194
6197
|
if (h) return;
|
|
6195
|
-
let n =
|
|
6198
|
+
let n = Eu(e), i = r.next(n, /* @__PURE__ */ new Date()), a = () => {
|
|
6196
6199
|
if (h) return;
|
|
6197
6200
|
let n = i.getTime() - Date.now();
|
|
6198
6201
|
if (n > T) {
|
|
@@ -6214,7 +6217,7 @@ behind quietly.`;
|
|
|
6214
6217
|
let i;
|
|
6215
6218
|
try {
|
|
6216
6219
|
let t = (await n.query({
|
|
6217
|
-
table:
|
|
6220
|
+
table: qu,
|
|
6218
6221
|
order: [{
|
|
6219
6222
|
column: "scheduledAt",
|
|
6220
6223
|
direction: "desc"
|
|
@@ -6233,7 +6236,7 @@ behind quietly.`;
|
|
|
6233
6236
|
return;
|
|
6234
6237
|
}
|
|
6235
6238
|
if (!i) return;
|
|
6236
|
-
let a =
|
|
6239
|
+
let a = Eu(e), o = [], c = r.next(a, i), l = Date.now();
|
|
6237
6240
|
for (; c.getTime() < l && o.length < 1e3;) o.push(c), c = r.next(a, c);
|
|
6238
6241
|
if (o.length !== 0) if (s.info("schedule: backfill", {
|
|
6239
6242
|
name: e.name,
|
|
@@ -6278,11 +6281,11 @@ behind quietly.`;
|
|
|
6278
6281
|
f.clear(), s.info("scheduler: stopped");
|
|
6279
6282
|
}
|
|
6280
6283
|
};
|
|
6281
|
-
}, Q = (e) => e?.message ?? String(e),
|
|
6284
|
+
}, Q = (e) => e?.message ?? String(e), Yu = (e) => e && typeof e == "object" && "_tag" in e ? String(e._tag) : null, Xu = (e) => {
|
|
6282
6285
|
let t = {};
|
|
6283
6286
|
for (let [n, r] of Object.entries(e)) t[n] = r instanceof Date ? r.toISOString() : r;
|
|
6284
6287
|
return t;
|
|
6285
|
-
},
|
|
6288
|
+
}, Zu = (e, t, n, r) => {
|
|
6286
6289
|
let i = !1, a, o = async () => {
|
|
6287
6290
|
if (i) return;
|
|
6288
6291
|
let a = new Date(Math.floor(Date.now() / t) * t), o = !1;
|
|
@@ -6312,7 +6315,7 @@ behind quietly.`;
|
|
|
6312
6315
|
i || (i = !0, a && clearInterval(a), a = void 0);
|
|
6313
6316
|
}
|
|
6314
6317
|
};
|
|
6315
|
-
},
|
|
6318
|
+
}, Qu = (e) => (t, n, r) => Zu(t, n, r, e), $u = F("_voltro_schedule_runs", {
|
|
6316
6319
|
id: M({ prefix: "schrun" }),
|
|
6317
6320
|
name: I(),
|
|
6318
6321
|
status: I().oneOf([
|
|
@@ -6342,13 +6345,13 @@ behind quietly.`;
|
|
|
6342
6345
|
]).nullable(),
|
|
6343
6346
|
replicaId: I().nullable(),
|
|
6344
6347
|
result: P().nullable()
|
|
6345
|
-
}).index(["name", "scheduledAt"]).index(["status"]),
|
|
6348
|
+
}).index(["name", "scheduledAt"]).index(["status"]), ed = F("_voltro_schedule_claims", {
|
|
6346
6349
|
id: M({ prefix: "schclaim" }),
|
|
6347
6350
|
scheduleName: I(),
|
|
6348
6351
|
bucket: I(),
|
|
6349
6352
|
claimedBy: I(),
|
|
6350
6353
|
claimedAt: L()
|
|
6351
|
-
}).index(["scheduleName", "bucket"]).index(["claimedAt"]),
|
|
6354
|
+
}).index(["scheduleName", "bucket"]).index(["claimedAt"]), td = F("_voltro_traces", {
|
|
6352
6355
|
id: M({ prefix: "span" }),
|
|
6353
6356
|
traceId: I(),
|
|
6354
6357
|
spanId: I(),
|
|
@@ -6372,7 +6375,7 @@ behind quietly.`;
|
|
|
6372
6375
|
durationMs: N(),
|
|
6373
6376
|
attributes: P().nullable(),
|
|
6374
6377
|
events: P().nullable()
|
|
6375
|
-
}).index(["traceId", "startedAt"]).index(["startedAt"]).index(["status"]),
|
|
6378
|
+
}).index(["traceId", "startedAt"]).index(["startedAt"]).index(["status"]), nd = F("_voltro_undo_log", {
|
|
6376
6379
|
id: M({ prefix: "undo" }),
|
|
6377
6380
|
tag: I(),
|
|
6378
6381
|
label: I().nullable(),
|
|
@@ -6383,25 +6386,25 @@ behind quietly.`;
|
|
|
6383
6386
|
crossesAction: E().default(!1),
|
|
6384
6387
|
undone: E().default(!1),
|
|
6385
6388
|
createdAt: L().default("now")
|
|
6386
|
-
}).index(["subjectId", "createdAt"]),
|
|
6389
|
+
}).index(["subjectId", "createdAt"]), rd = (e = process.env) => {
|
|
6387
6390
|
let t = (e.VOLTRO_UNDO ?? "").toLowerCase();
|
|
6388
6391
|
return t === "on" || t === "1" || t === "true" ? !0 : t === "off" || t === "0" || t === "false" ? !1 : e.NODE_ENV !== "production";
|
|
6389
|
-
},
|
|
6392
|
+
}, id = (e) => e.startsWith("_voltro"), ad = async (e, t, n) => (await e.query({
|
|
6390
6393
|
table: t,
|
|
6391
6394
|
predicate: O("id", n),
|
|
6392
6395
|
order: []
|
|
6393
|
-
}))[0] ?? null,
|
|
6396
|
+
}))[0] ?? null, od = (e, t) => new Proxy(e, { get(e, n, r) {
|
|
6394
6397
|
if (n === "insert") return async (n, r) => {
|
|
6395
6398
|
let i = await e.insert(n, r);
|
|
6396
|
-
return
|
|
6399
|
+
return id(n) || t({
|
|
6397
6400
|
table: n,
|
|
6398
6401
|
op: "insert",
|
|
6399
6402
|
next: i
|
|
6400
6403
|
}), i;
|
|
6401
6404
|
};
|
|
6402
6405
|
if (n === "update") return async (n, r, i) => {
|
|
6403
|
-
let a =
|
|
6404
|
-
return
|
|
6406
|
+
let a = id(n) ? null : await ad(e, n, r), o = await e.update(n, r, i);
|
|
6407
|
+
return id(n) || t({
|
|
6405
6408
|
table: n,
|
|
6406
6409
|
op: "update",
|
|
6407
6410
|
id: r,
|
|
@@ -6410,8 +6413,8 @@ behind quietly.`;
|
|
|
6410
6413
|
}), o;
|
|
6411
6414
|
};
|
|
6412
6415
|
if (n === "delete") return async (n, r) => {
|
|
6413
|
-
let i =
|
|
6414
|
-
return !
|
|
6416
|
+
let i = id(n) ? null : await ad(e, n, r), a = await e.delete(n, r);
|
|
6417
|
+
return !id(n) && a && t({
|
|
6415
6418
|
table: n,
|
|
6416
6419
|
op: "delete",
|
|
6417
6420
|
id: r,
|
|
@@ -6420,10 +6423,10 @@ behind quietly.`;
|
|
|
6420
6423
|
};
|
|
6421
6424
|
let i = Reflect.get(e, n, r);
|
|
6422
6425
|
return typeof i == "function" ? i.bind(e) : i;
|
|
6423
|
-
} }),
|
|
6426
|
+
} }), sd = (e) => {
|
|
6424
6427
|
let t = [];
|
|
6425
6428
|
return {
|
|
6426
|
-
tx:
|
|
6429
|
+
tx: od(e, (e) => t.push(e)),
|
|
6427
6430
|
persist: async (e, n) => {
|
|
6428
6431
|
if (t.length === 0 || n.tag.startsWith("__voltro")) return;
|
|
6429
6432
|
let r = n.subject;
|
|
@@ -6439,14 +6442,14 @@ behind quietly.`;
|
|
|
6439
6442
|
});
|
|
6440
6443
|
}
|
|
6441
6444
|
};
|
|
6442
|
-
},
|
|
6445
|
+
}, cd = (e) => {
|
|
6443
6446
|
if (e.id !== void 0) return e.id;
|
|
6444
6447
|
let t = e.next?.id;
|
|
6445
6448
|
if (typeof t == "string") return t;
|
|
6446
6449
|
let n = e.prev?.id;
|
|
6447
6450
|
return typeof n == "string" ? n : void 0;
|
|
6448
|
-
},
|
|
6449
|
-
let t =
|
|
6451
|
+
}, ld = (e) => {
|
|
6452
|
+
let t = cd(e);
|
|
6450
6453
|
switch (e.op) {
|
|
6451
6454
|
case "insert": return t === void 0 ? null : {
|
|
6452
6455
|
table: e.table,
|
|
@@ -6470,28 +6473,28 @@ behind quietly.`;
|
|
|
6470
6473
|
row: e.prev
|
|
6471
6474
|
};
|
|
6472
6475
|
}
|
|
6473
|
-
},
|
|
6474
|
-
if (e.crossesAction) throw new
|
|
6476
|
+
}, ud = (e) => {
|
|
6477
|
+
if (e.crossesAction) throw new dd(e.invocationId, "action");
|
|
6475
6478
|
let t = [];
|
|
6476
6479
|
for (let n = e.changes.length - 1; n >= 0; --n) {
|
|
6477
|
-
let r =
|
|
6480
|
+
let r = ld(e.changes[n]);
|
|
6478
6481
|
r !== null && t.push(r);
|
|
6479
6482
|
}
|
|
6480
6483
|
return t;
|
|
6481
|
-
},
|
|
6484
|
+
}, dd = class extends Error {
|
|
6482
6485
|
invocationId;
|
|
6483
6486
|
boundary;
|
|
6484
6487
|
_tag = "UndoBoundaryError";
|
|
6485
6488
|
constructor(e, t) {
|
|
6486
6489
|
super(t === "action" ? `cannot undo invocation ${e}: it crossed an action (external side effect)` : `cannot undo invocation ${e}: the row changed since (conflict)`), this.invocationId = e, this.boundary = t, this.name = "UndoBoundaryError";
|
|
6487
6490
|
}
|
|
6488
|
-
},
|
|
6491
|
+
}, fd = (e, t, n = ["updatedAt", "updatedBy"]) => {
|
|
6489
6492
|
if (t == null) return e == null;
|
|
6490
6493
|
if (e == null) return !1;
|
|
6491
6494
|
let r = new Set(n);
|
|
6492
6495
|
for (let [n, i] of Object.entries(t)) if (!r.has(n) && !Object.is(e[n], i) && JSON.stringify(e[n]) !== JSON.stringify(i)) return !1;
|
|
6493
6496
|
return !0;
|
|
6494
|
-
},
|
|
6497
|
+
}, pd = class {
|
|
6495
6498
|
capacity;
|
|
6496
6499
|
done = [];
|
|
6497
6500
|
undone = [];
|
|
@@ -6527,7 +6530,7 @@ behind quietly.`;
|
|
|
6527
6530
|
redo: [...this.undone]
|
|
6528
6531
|
};
|
|
6529
6532
|
}
|
|
6530
|
-
},
|
|
6533
|
+
}, md = (e, t = /* @__PURE__ */ new Set()) => e.op === "insert" ? {
|
|
6531
6534
|
table: e.table,
|
|
6532
6535
|
op: "insert",
|
|
6533
6536
|
next: e.new ?? null
|
|
@@ -6544,7 +6547,7 @@ behind quietly.`;
|
|
|
6544
6547
|
table: e.table,
|
|
6545
6548
|
op: "delete",
|
|
6546
6549
|
prev: e.old ?? null
|
|
6547
|
-
},
|
|
6550
|
+
}, hd = async (e, t) => {
|
|
6548
6551
|
switch (t.op) {
|
|
6549
6552
|
case "delete":
|
|
6550
6553
|
await e.delete(t.table, t.id);
|
|
@@ -6562,21 +6565,21 @@ behind quietly.`;
|
|
|
6562
6565
|
await e.insert(t.table, t.row);
|
|
6563
6566
|
return;
|
|
6564
6567
|
}
|
|
6565
|
-
},
|
|
6566
|
-
for (let n of t) await
|
|
6567
|
-
},
|
|
6568
|
+
}, gd = async (e, t) => {
|
|
6569
|
+
for (let n of t) await hd(e, n);
|
|
6570
|
+
}, _d = (e) => e.request?.subject?.id ?? null, vd = (e) => e === !0 || e === 1, yd = async (e, t, n) => (await e.query({
|
|
6568
6571
|
table: t,
|
|
6569
6572
|
predicate: O("id", n),
|
|
6570
6573
|
order: []
|
|
6571
|
-
}))[0] ?? null,
|
|
6574
|
+
}))[0] ?? null, bd = (e) => {
|
|
6572
6575
|
try {
|
|
6573
6576
|
let t = JSON.parse(String(e ?? "[]"));
|
|
6574
6577
|
return Array.isArray(t) ? t : [];
|
|
6575
6578
|
} catch {
|
|
6576
6579
|
return [];
|
|
6577
6580
|
}
|
|
6578
|
-
},
|
|
6579
|
-
let n =
|
|
6581
|
+
}, xd = (e) => e.id ?? e.next?.id ?? e.prev?.id, Sd = async (e, t) => {
|
|
6582
|
+
let n = _d(t);
|
|
6580
6583
|
return [...await t.store.query({
|
|
6581
6584
|
table: "_voltro_undo_log",
|
|
6582
6585
|
predicate: O("subjectId", n),
|
|
@@ -6585,68 +6588,68 @@ behind quietly.`;
|
|
|
6585
6588
|
id: String(e.id),
|
|
6586
6589
|
tag: String(e.tag ?? ""),
|
|
6587
6590
|
label: e.label ?? null,
|
|
6588
|
-
undone:
|
|
6589
|
-
crossesAction:
|
|
6591
|
+
undone: vd(e.undone),
|
|
6592
|
+
crossesAction: vd(e.crossesAction),
|
|
6590
6593
|
createdAt: String(e.createdAt ?? "")
|
|
6591
6594
|
}));
|
|
6592
|
-
},
|
|
6593
|
-
let n = await
|
|
6595
|
+
}, Cd = async (e, t) => {
|
|
6596
|
+
let n = await yd(t.store, "_voltro_undo_log", e.invocationId);
|
|
6594
6597
|
if (!n) throw new rt({ invocationId: e.invocationId });
|
|
6595
|
-
if ((n.subjectId ?? null) !==
|
|
6598
|
+
if ((n.subjectId ?? null) !== _d(t)) throw new nt({ invocationId: e.invocationId });
|
|
6596
6599
|
return n;
|
|
6597
|
-
},
|
|
6598
|
-
let n = await
|
|
6599
|
-
if (
|
|
6600
|
-
if (
|
|
6600
|
+
}, wd = async (e, t) => {
|
|
6601
|
+
let n = await Cd(e, t);
|
|
6602
|
+
if (vd(n.undone)) return { ok: !0 };
|
|
6603
|
+
if (vd(n.crossesAction)) throw new tt({
|
|
6601
6604
|
invocationId: e.invocationId,
|
|
6602
6605
|
reason: "action"
|
|
6603
6606
|
});
|
|
6604
|
-
let r =
|
|
6607
|
+
let r = bd(n.changes);
|
|
6605
6608
|
for (let n of r) {
|
|
6606
|
-
let r =
|
|
6607
|
-
if (r !== void 0 && !
|
|
6609
|
+
let r = xd(n);
|
|
6610
|
+
if (r !== void 0 && !fd(await yd(t.store, n.table, r), n.next ?? null)) throw new tt({
|
|
6608
6611
|
invocationId: e.invocationId,
|
|
6609
6612
|
reason: "conflict"
|
|
6610
6613
|
});
|
|
6611
6614
|
}
|
|
6612
6615
|
let i = {
|
|
6613
6616
|
invocationId: e.invocationId,
|
|
6614
|
-
subject:
|
|
6617
|
+
subject: _d(t),
|
|
6615
6618
|
changes: r,
|
|
6616
6619
|
crossesAction: !1
|
|
6617
6620
|
};
|
|
6618
|
-
return await
|
|
6619
|
-
},
|
|
6620
|
-
let n = await
|
|
6621
|
-
if (!
|
|
6622
|
-
for (let e of
|
|
6623
|
-
let n =
|
|
6621
|
+
return await gd(t.store, ud(i)), await t.store.update("_voltro_undo_log", e.invocationId, { undone: !0 }), { ok: !0 };
|
|
6622
|
+
}, Td = async (e, t) => {
|
|
6623
|
+
let n = await Cd(e, t);
|
|
6624
|
+
if (!vd(n.undone)) return { ok: !0 };
|
|
6625
|
+
for (let e of bd(n.changes)) {
|
|
6626
|
+
let n = xd(e);
|
|
6624
6627
|
e.op === "insert" && e.next ? await t.store.insert(e.table, e.next) : e.op === "update" && n !== void 0 && e.next ? await t.store.update(e.table, n, e.next) : e.op === "delete" && n !== void 0 && await t.store.delete(e.table, n);
|
|
6625
6628
|
}
|
|
6626
6629
|
return await t.store.update("_voltro_undo_log", e.invocationId, { undone: !1 }), { ok: !0 };
|
|
6627
|
-
},
|
|
6630
|
+
}, Ed = (e = process.env) => {
|
|
6628
6631
|
let t = (e.VOLTRO_TIMELINE ?? "").toLowerCase();
|
|
6629
6632
|
return t === "off" || t === "0" || t === "false" ? "off" : t === "all" ? "all" : t === "interesting" || t === "on" || t === "1" || t === "true" ? "interesting" : e.NODE_ENV === "production" ? "off" : "interesting";
|
|
6630
|
-
},
|
|
6633
|
+
}, Dd = /pass(word)?|secret|token|api[_-]?key|authorization|cookie|ssn|credit[_-]?card|card[_-]?number|cvv|encrypted/i, Od = "«redacted»", kd = (e) => {
|
|
6631
6634
|
if (e == null) return null;
|
|
6632
6635
|
let t = {};
|
|
6633
|
-
for (let [n, r] of Object.entries(e)) t[n] =
|
|
6636
|
+
for (let [n, r] of Object.entries(e)) t[n] = Dd.test(n) ? Od : r;
|
|
6634
6637
|
return t;
|
|
6635
|
-
},
|
|
6638
|
+
}, Ad = (e) => {
|
|
6636
6639
|
let t = e?.id;
|
|
6637
6640
|
return typeof t == "string" ? t : void 0;
|
|
6638
|
-
},
|
|
6641
|
+
}, jd = (e, t) => {
|
|
6639
6642
|
if (t.op === "insert") {
|
|
6640
|
-
let n =
|
|
6643
|
+
let n = Ad(t.new);
|
|
6641
6644
|
return n === void 0 ? e : e.filter((e) => e.id !== n);
|
|
6642
6645
|
}
|
|
6643
6646
|
if (t.op === "update") {
|
|
6644
6647
|
if (t.old == null) return e;
|
|
6645
|
-
let n =
|
|
6648
|
+
let n = Ad(t.new) ?? Ad(t.old);
|
|
6646
6649
|
return e.map((e) => e.id === n ? t.old : e);
|
|
6647
6650
|
}
|
|
6648
6651
|
return t.old == null ? e : [...e, t.old];
|
|
6649
|
-
},
|
|
6652
|
+
}, Md = class {
|
|
6650
6653
|
mode;
|
|
6651
6654
|
capacity;
|
|
6652
6655
|
now;
|
|
@@ -6666,8 +6669,8 @@ behind quietly.`;
|
|
|
6666
6669
|
ts: this.now(),
|
|
6667
6670
|
table: e.table,
|
|
6668
6671
|
op: e.op,
|
|
6669
|
-
old:
|
|
6670
|
-
new:
|
|
6672
|
+
old: kd(e.old),
|
|
6673
|
+
new: kd(e.new),
|
|
6671
6674
|
tenantId: n
|
|
6672
6675
|
}), this.ring.length > this.capacity && this.ring.shift(), t;
|
|
6673
6676
|
}
|
|
@@ -6680,23 +6683,23 @@ behind quietly.`;
|
|
|
6680
6683
|
}
|
|
6681
6684
|
replay(e, t, n) {
|
|
6682
6685
|
let r = this.ring.filter((n) => n.table === e && n.seq > t).sort((e, t) => t.seq - e.seq), i = n;
|
|
6683
|
-
for (let e of r) i =
|
|
6686
|
+
for (let e of r) i = jd(i, e);
|
|
6684
6687
|
return i;
|
|
6685
6688
|
}
|
|
6686
|
-
},
|
|
6687
|
-
|
|
6688
|
-
},
|
|
6689
|
-
let t =
|
|
6689
|
+
}, Nd, Pd = () => (Nd === void 0 && (Nd = new Md(Ed())), Nd), Fd = (e) => {
|
|
6690
|
+
Nd = e;
|
|
6691
|
+
}, Id = (e) => {
|
|
6692
|
+
let t = Pd();
|
|
6690
6693
|
if (t.enabled) try {
|
|
6691
6694
|
t.record(e);
|
|
6692
6695
|
} catch {}
|
|
6693
|
-
},
|
|
6696
|
+
}, Ld = /* @__PURE__ */ new Set([
|
|
6694
6697
|
"count",
|
|
6695
6698
|
"sum",
|
|
6696
6699
|
"avg",
|
|
6697
6700
|
"min",
|
|
6698
6701
|
"max"
|
|
6699
|
-
]),
|
|
6702
|
+
]), Rd = (e) => {
|
|
6700
6703
|
if (e.joins !== void 0 && e.joins.length > 0) return {
|
|
6701
6704
|
maintainable: !1,
|
|
6702
6705
|
reason: "joins are not maintainable in v1"
|
|
@@ -6718,7 +6721,7 @@ behind quietly.`;
|
|
|
6718
6721
|
reason: "v1 maintains exactly one aggregation"
|
|
6719
6722
|
};
|
|
6720
6723
|
let t = e.aggregations[0];
|
|
6721
|
-
return
|
|
6724
|
+
return Ld.has(t.op) ? t.op !== "count" && (t.column === void 0 || t.column.length === 0) ? {
|
|
6722
6725
|
maintainable: !1,
|
|
6723
6726
|
reason: `op '${t.op}' requires a column`
|
|
6724
6727
|
} : {
|
|
@@ -6732,7 +6735,7 @@ behind quietly.`;
|
|
|
6732
6735
|
maintainable: !1,
|
|
6733
6736
|
reason: `op '${t.op}' is not maintainable`
|
|
6734
6737
|
};
|
|
6735
|
-
},
|
|
6738
|
+
}, zd = "\0", $ = (e, t) => t === void 0 || t.length === 0 ? "" : t.map((t) => JSON.stringify(e[t] ?? null)).join(zd), Bd = (e, t) => t === void 0 ? 0 : Number(e[t] ?? 0), Vd = (e, t) => {
|
|
6736
6739
|
switch (e.op) {
|
|
6737
6740
|
case "count": return t.count;
|
|
6738
6741
|
case "sum": return t.sum ?? 0;
|
|
@@ -6740,10 +6743,10 @@ behind quietly.`;
|
|
|
6740
6743
|
case "min":
|
|
6741
6744
|
case "max": return t.count > 0 ? t.extreme ?? null : null;
|
|
6742
6745
|
}
|
|
6743
|
-
},
|
|
6746
|
+
}, Hd = (e, t) => {
|
|
6744
6747
|
let n = /* @__PURE__ */ new Map();
|
|
6745
6748
|
for (let r of t) {
|
|
6746
|
-
let t = $(r, e.groupBy), i = n.get(t), a =
|
|
6749
|
+
let t = $(r, e.groupBy), i = n.get(t), a = Bd(r, e.column);
|
|
6747
6750
|
if (i === void 0) n.set(t, {
|
|
6748
6751
|
count: 1,
|
|
6749
6752
|
...e.op === "sum" || e.op === "avg" ? { sum: a } : {},
|
|
@@ -6759,10 +6762,10 @@ behind quietly.`;
|
|
|
6759
6762
|
}
|
|
6760
6763
|
}
|
|
6761
6764
|
return n;
|
|
6762
|
-
},
|
|
6765
|
+
}, Ud = (e, t) => [...t.entries()].map(([t, n]) => ({
|
|
6763
6766
|
groupKey: t,
|
|
6764
|
-
value:
|
|
6765
|
-
})),
|
|
6767
|
+
value: Vd(e, n)
|
|
6768
|
+
})), Wd = (e, t, n) => {
|
|
6766
6769
|
let r = new Map(t), i = /* @__PURE__ */ new Set(), a = (t) => {
|
|
6767
6770
|
let n = $(t, e.groupBy), a = r.get(n);
|
|
6768
6771
|
if (a === void 0) return;
|
|
@@ -6771,7 +6774,7 @@ behind quietly.`;
|
|
|
6771
6774
|
r.delete(n);
|
|
6772
6775
|
return;
|
|
6773
6776
|
}
|
|
6774
|
-
let s =
|
|
6777
|
+
let s = Bd(t, e.column);
|
|
6775
6778
|
e.op === "min" || e.op === "max" ? (a.extreme !== void 0 && s === a.extreme && i.add(n), r.set(n, {
|
|
6776
6779
|
count: o,
|
|
6777
6780
|
...a.extreme === void 0 ? {} : { extreme: a.extreme }
|
|
@@ -6780,7 +6783,7 @@ behind quietly.`;
|
|
|
6780
6783
|
...e.op === "sum" || e.op === "avg" ? { sum: (a.sum ?? 0) - s } : {}
|
|
6781
6784
|
});
|
|
6782
6785
|
}, o = (t) => {
|
|
6783
|
-
let n = $(t, e.groupBy), i = r.get(n), a =
|
|
6786
|
+
let n = $(t, e.groupBy), i = r.get(n), a = Bd(t, e.column);
|
|
6784
6787
|
if (i === void 0) {
|
|
6785
6788
|
r.set(n, {
|
|
6786
6789
|
count: 1,
|
|
@@ -6800,15 +6803,15 @@ behind quietly.`;
|
|
|
6800
6803
|
state: r,
|
|
6801
6804
|
rescanGroups: [...i]
|
|
6802
6805
|
};
|
|
6803
|
-
},
|
|
6806
|
+
}, Gd = (e, t, n, r) => {
|
|
6804
6807
|
if (n.length === 0) return t;
|
|
6805
|
-
let i = new Set(n), a =
|
|
6808
|
+
let i = new Set(n), a = Hd(e, r.filter((t) => i.has($(t, e.groupBy)))), o = new Map(t);
|
|
6806
6809
|
for (let e of i) {
|
|
6807
6810
|
let t = a.get(e);
|
|
6808
6811
|
t === void 0 ? o.delete(e) : o.set(e, t);
|
|
6809
6812
|
}
|
|
6810
6813
|
return o;
|
|
6811
|
-
},
|
|
6814
|
+
}, Kd = class {
|
|
6812
6815
|
shape;
|
|
6813
6816
|
state = /* @__PURE__ */ new Map();
|
|
6814
6817
|
groups = /* @__PURE__ */ new Map();
|
|
@@ -6816,7 +6819,7 @@ behind quietly.`;
|
|
|
6816
6819
|
this.shape = e;
|
|
6817
6820
|
}
|
|
6818
6821
|
seed(e) {
|
|
6819
|
-
this.state =
|
|
6822
|
+
this.state = Hd(this.shape, e), this.groups.clear();
|
|
6820
6823
|
for (let t of e) {
|
|
6821
6824
|
let e = $(t, this.shape.groupBy);
|
|
6822
6825
|
this.groups.has(e) || this.groups.set(e, this.groupValues(t));
|
|
@@ -6828,14 +6831,14 @@ behind quietly.`;
|
|
|
6828
6831
|
let e = $(t, this.shape.groupBy);
|
|
6829
6832
|
this.groups.has(e) || this.groups.set(e, this.groupValues(t));
|
|
6830
6833
|
}
|
|
6831
|
-
let n =
|
|
6834
|
+
let n = Wd(this.shape, this.state, e);
|
|
6832
6835
|
this.state = n.state;
|
|
6833
6836
|
for (let e of this.groups.keys()) this.state.has(e) || this.groups.delete(e);
|
|
6834
6837
|
return n.rescanGroups;
|
|
6835
6838
|
}
|
|
6836
6839
|
resolveRescan(e, t) {
|
|
6837
6840
|
if (e.length === 0) return;
|
|
6838
|
-
this.state =
|
|
6841
|
+
this.state = Gd(this.shape, this.state, e, t);
|
|
6839
6842
|
let n = new Set(e);
|
|
6840
6843
|
for (let e of t) {
|
|
6841
6844
|
let t = $(e, this.shape.groupBy);
|
|
@@ -6844,7 +6847,7 @@ behind quietly.`;
|
|
|
6844
6847
|
for (let e of n) this.state.has(e) || this.groups.delete(e);
|
|
6845
6848
|
}
|
|
6846
6849
|
materialize() {
|
|
6847
|
-
return
|
|
6850
|
+
return Ud(this.shape, this.state).map((e) => ({
|
|
6848
6851
|
groupKey: e.groupKey,
|
|
6849
6852
|
group: this.groups.get(e.groupKey) ?? {},
|
|
6850
6853
|
value: e.value
|
|
@@ -6857,7 +6860,7 @@ behind quietly.`;
|
|
|
6857
6860
|
for (let r of t) n[r] = e[r];
|
|
6858
6861
|
return n;
|
|
6859
6862
|
}
|
|
6860
|
-
},
|
|
6863
|
+
}, qd = F("_voltro_rebac_tuples", {
|
|
6861
6864
|
id: M({ prefix: "rbct" }),
|
|
6862
6865
|
subjectId: I(),
|
|
6863
6866
|
relation: I(),
|
|
@@ -6869,7 +6872,7 @@ behind quietly.`;
|
|
|
6869
6872
|
"subjectId",
|
|
6870
6873
|
"resourceType",
|
|
6871
6874
|
"resourceId"
|
|
6872
|
-
]),
|
|
6875
|
+
]), Jd = async (e, t, n, r) => t === null ? [] : (await e.query({
|
|
6873
6876
|
table: "_voltro_rebac_tuples",
|
|
6874
6877
|
predicate: C(O("subjectId", t), O("resourceType", n), O("resourceId", r)),
|
|
6875
6878
|
order: [],
|
|
@@ -6881,11 +6884,11 @@ behind quietly.`;
|
|
|
6881
6884
|
relation: e.relation,
|
|
6882
6885
|
resourceType: e.resourceType,
|
|
6883
6886
|
resourceId: e.resourceId
|
|
6884
|
-
})),
|
|
6887
|
+
})), Yd = (e) => ({
|
|
6885
6888
|
id: e.id,
|
|
6886
6889
|
tenantId: e.tenantId,
|
|
6887
6890
|
...e.scopes === void 0 ? {} : { scopes: e.scopes }
|
|
6888
|
-
}),
|
|
6891
|
+
}), Xd = (e, t) => {
|
|
6889
6892
|
let n = t.getPolicy ?? nl;
|
|
6890
6893
|
return (r, i) => {
|
|
6891
6894
|
let a = e[i.tag];
|
|
@@ -6898,7 +6901,7 @@ behind quietly.`;
|
|
|
6898
6901
|
if (s === void 0) return c("");
|
|
6899
6902
|
let l = a.resourceId(i.input);
|
|
6900
6903
|
if (l === null || l === "") return c("");
|
|
6901
|
-
let u =
|
|
6904
|
+
let u = Yd(i.subject), d = {
|
|
6902
6905
|
type: a.resourceType,
|
|
6903
6906
|
id: l,
|
|
6904
6907
|
tenantId: i.subject.tenantId
|
|
@@ -6908,7 +6911,7 @@ behind quietly.`;
|
|
|
6908
6911
|
tuples: e
|
|
6909
6912
|
}) ? r : c(l));
|
|
6910
6913
|
};
|
|
6911
|
-
},
|
|
6914
|
+
}, Zd = async (e, t, n) => t === null ? [] : (await e.query({
|
|
6912
6915
|
table: "_voltro_rebac_tuples",
|
|
6913
6916
|
predicate: C(O("subjectId", t), O("resourceType", n)),
|
|
6914
6917
|
order: [],
|
|
@@ -6920,18 +6923,18 @@ behind quietly.`;
|
|
|
6920
6923
|
relation: e.relation,
|
|
6921
6924
|
resourceType: e.resourceType,
|
|
6922
6925
|
resourceId: e.resourceId
|
|
6923
|
-
})),
|
|
6926
|
+
})), Qd = (e) => {
|
|
6924
6927
|
let t = e.getPolicy ?? nl;
|
|
6925
6928
|
return async (n, r, i, a) => {
|
|
6926
6929
|
let o = t(r);
|
|
6927
6930
|
if (o === void 0) return [];
|
|
6928
|
-
let s =
|
|
6931
|
+
let s = Yd(n);
|
|
6929
6932
|
return ul(s, i, r, a, {
|
|
6930
6933
|
policy: o,
|
|
6931
6934
|
tuples: await e.loadSubjectTuples(s.id, r)
|
|
6932
6935
|
});
|
|
6933
6936
|
};
|
|
6934
|
-
},
|
|
6937
|
+
}, $d = (e) => {
|
|
6935
6938
|
if (typeof e.name != "string" || e.name.length === 0) throw Error("defineReaction: a non-empty `name` is required");
|
|
6936
6939
|
if (e.watch === void 0 || typeof e.watch.table != "string" || e.watch.table.length === 0) throw Error(`reaction '${e.name}': watch.table is required`);
|
|
6937
6940
|
if (e.act === void 0 || e.act.kind !== "agent" && e.act.kind !== "workflow") throw Error(`reaction '${e.name}': act must be { kind: 'agent' | 'workflow', … }`);
|
|
@@ -6939,14 +6942,14 @@ behind quietly.`;
|
|
|
6939
6942
|
if (e.guards.rateLimit !== void 0 && (e.guards.rateLimit.limit <= 0 || e.guards.rateLimit.windowMs <= 0)) throw Error(`reaction '${e.name}': guards.rateLimit needs positive limit + windowMs`);
|
|
6940
6943
|
if (e.guards.costBudgetUsd !== void 0 && e.guards.costBudgetUsd < 0) throw Error(`reaction '${e.name}': guards.costBudgetUsd must be >= 0`);
|
|
6941
6944
|
return e;
|
|
6942
|
-
},
|
|
6945
|
+
}, ef = (e, t) => e === void 0 ? !0 : Array.isArray(e) ? e.includes(t) : e === t, tf = (e) => e.new?.tenantId ?? e.old?.tenantId ?? null, nf = class {
|
|
6943
6946
|
hits = /* @__PURE__ */ new Map();
|
|
6944
6947
|
allow(e, t, n, r) {
|
|
6945
6948
|
let i = r - n, a = (this.hits.get(e) ?? []).filter((e) => e > i);
|
|
6946
6949
|
return a.length >= t ? (this.hits.set(e, a), !1) : (a.push(r), this.hits.set(e, a), !0);
|
|
6947
6950
|
}
|
|
6948
|
-
},
|
|
6949
|
-
if (t.table !== e.watch.table || !
|
|
6951
|
+
}, rf = async (e, t, n) => {
|
|
6952
|
+
if (t.table !== e.watch.table || !ef(e.watch.on, t.op)) return "skipped-op";
|
|
6950
6953
|
if (e.when !== void 0 && !e.when(t)) return "skipped-when";
|
|
6951
6954
|
let r = `${e.name}:${e.guards.dedupeKey(t)}`;
|
|
6952
6955
|
if (await n.dedupe.has(r)) return "skipped-dedupe";
|
|
@@ -6955,26 +6958,26 @@ behind quietly.`;
|
|
|
6955
6958
|
let t = n.now?.() ?? Date.now();
|
|
6956
6959
|
if (!n.rateLimiter.allow(e.name, i.limit, i.windowMs, t)) return "skipped-ratelimit";
|
|
6957
6960
|
}
|
|
6958
|
-
let a =
|
|
6961
|
+
let a = tf(t);
|
|
6959
6962
|
return e.guards.costBudgetUsd !== void 0 && n.checkBudget !== void 0 && !await n.checkBudget(a, e.guards.costBudgetUsd) ? "skipped-budget" : (await n.runAct(e.act, t, {
|
|
6960
6963
|
id: a,
|
|
6961
6964
|
via: "agent"
|
|
6962
6965
|
}), await n.dedupe.add(r), "acted");
|
|
6963
|
-
},
|
|
6966
|
+
}, af = F("_voltro_wakeups", {
|
|
6964
6967
|
id: M({ prefix: "wakeup" }),
|
|
6965
6968
|
tenantId: I(),
|
|
6966
6969
|
kind: I(),
|
|
6967
6970
|
refId: I(),
|
|
6968
6971
|
wakeAt: L(),
|
|
6969
6972
|
status: I()
|
|
6970
|
-
}).index(["status", "wakeAt"]).index(["tenantId"]),
|
|
6971
|
-
let t = e.now?.() ?? /* @__PURE__ */ new Date(), n = await
|
|
6973
|
+
}).index(["status", "wakeAt"]).index(["tenantId"]), of = async (e) => {
|
|
6974
|
+
let t = e.now?.() ?? /* @__PURE__ */ new Date(), n = await Ru(e.store, t, e.batchLimit ?? 100);
|
|
6972
6975
|
if (n.length === 0) return 0;
|
|
6973
6976
|
let r = 0;
|
|
6974
|
-
for (let t of n) if (await
|
|
6977
|
+
for (let t of n) if (await Pu(e.store, t)) try {
|
|
6975
6978
|
await e.adapter.wake(t), r++;
|
|
6976
6979
|
} catch (n) {
|
|
6977
|
-
await
|
|
6980
|
+
await Fu(e.store, t), e.log?.warn("wake: adapter failed — released for retry", {
|
|
6978
6981
|
tenantId: t.tenantId,
|
|
6979
6982
|
kind: t.kind,
|
|
6980
6983
|
refId: t.refId,
|
|
@@ -6982,11 +6985,11 @@ behind quietly.`;
|
|
|
6982
6985
|
});
|
|
6983
6986
|
}
|
|
6984
6987
|
return r > 0 && e.log?.info("wake: woke due deployments", { count: r }), r;
|
|
6985
|
-
},
|
|
6988
|
+
}, sf = (e, t = 1e3) => {
|
|
6986
6989
|
let n = !1, r, i = async () => {
|
|
6987
6990
|
if (!n) {
|
|
6988
6991
|
try {
|
|
6989
|
-
await
|
|
6992
|
+
await of(e);
|
|
6990
6993
|
} catch (t) {
|
|
6991
6994
|
e.log?.warn("wake: tick failed", { reason: t instanceof Error ? t.message : String(t) });
|
|
6992
6995
|
}
|
|
@@ -6996,10 +6999,10 @@ behind quietly.`;
|
|
|
6996
6999
|
return i(), { stop: () => {
|
|
6997
7000
|
n = !0, r !== void 0 && clearTimeout(r);
|
|
6998
7001
|
} };
|
|
6999
|
-
},
|
|
7002
|
+
}, cf = (e) => ({ wake: async () => {
|
|
7000
7003
|
await e.start();
|
|
7001
|
-
} }),
|
|
7002
|
-
let t = e.fetchImpl ?? fetch, n = e.now ?? Date.now, r = e.sleep ??
|
|
7004
|
+
} }), lf = (e) => new Promise((t) => setTimeout(t, e)), uf = (e) => {
|
|
7005
|
+
let t = e.fetchImpl ?? fetch, n = e.now ?? Date.now, r = e.sleep ?? lf, i = e.spawnImpl ?? Zt, a = e.startTimeoutMs ?? 3e4, o = e.healthPollMs ?? 200, s = e.stopSignal ?? "SIGTERM", c = e.stopGraceMs ?? 1e4, l, u, d = e.healthCheck ?? ((e) => e.ok), f = async () => {
|
|
7003
7006
|
try {
|
|
7004
7007
|
let n = await t(e.healthUrl);
|
|
7005
7008
|
return d(n);
|
|
@@ -7053,11 +7056,11 @@ behind quietly.`;
|
|
|
7053
7056
|
},
|
|
7054
7057
|
stop: m
|
|
7055
7058
|
};
|
|
7056
|
-
},
|
|
7059
|
+
}, df = async (e) => {
|
|
7057
7060
|
if (e.signals.connectedClients() > 0 || e.signals.inFlightRequests() > 0 || e.signals.activeWorkflowExecutions() > 0) return !1;
|
|
7058
|
-
let t = (e.now?.() ?? /* @__PURE__ */ new Date()).getTime() + (e.wakeLookaheadMs ?? 3e4), n = await
|
|
7061
|
+
let t = (e.now?.() ?? /* @__PURE__ */ new Date()).getTime() + (e.wakeLookaheadMs ?? 3e4), n = await zu(e.store);
|
|
7059
7062
|
return !(n !== null && n.wakeAt.getTime() <= t);
|
|
7060
|
-
},
|
|
7063
|
+
}, ff = (e, t = Date.now) => {
|
|
7061
7064
|
let n;
|
|
7062
7065
|
return {
|
|
7063
7066
|
update: (r) => {
|
|
@@ -7069,7 +7072,7 @@ behind quietly.`;
|
|
|
7069
7072
|
n = void 0;
|
|
7070
7073
|
}
|
|
7071
7074
|
};
|
|
7072
|
-
},
|
|
7075
|
+
}, pf = () => {
|
|
7073
7076
|
let e = 0, t = 0;
|
|
7074
7077
|
return {
|
|
7075
7078
|
onRequestStart: () => {
|
|
@@ -7087,7 +7090,7 @@ behind quietly.`;
|
|
|
7087
7090
|
inFlightRequests: () => e,
|
|
7088
7091
|
openConnections: () => t
|
|
7089
7092
|
};
|
|
7090
|
-
},
|
|
7093
|
+
}, mf = (e) => ({ run: async (t) => (e.onActivity?.(), await e.ensureAwake(), t()) }), hf = (e, t, n, r) => new Promise((i, a) => {
|
|
7091
7094
|
let o = xt.request({
|
|
7092
7095
|
host: n,
|
|
7093
7096
|
port: r,
|
|
@@ -7098,7 +7101,7 @@ behind quietly.`;
|
|
|
7098
7101
|
t.writeHead(e.statusCode ?? 502, e.headers), e.pipe(t), e.on("end", i), e.on("error", a);
|
|
7099
7102
|
});
|
|
7100
7103
|
o.on("error", a), e.pipe(o);
|
|
7101
|
-
}),
|
|
7104
|
+
}), gf = (e, t, n, r, i) => new Promise((a, o) => {
|
|
7102
7105
|
let s = xt.request({
|
|
7103
7106
|
host: r,
|
|
7104
7107
|
port: i,
|
|
@@ -7113,21 +7116,21 @@ behind quietly.`;
|
|
|
7113
7116
|
};
|
|
7114
7117
|
t.on("close", s), r.on("close", s), r.on("error", o);
|
|
7115
7118
|
}), s.on("error", o), s.end();
|
|
7116
|
-
}),
|
|
7117
|
-
let t =
|
|
7119
|
+
}), _f = (e) => {
|
|
7120
|
+
let t = mf({
|
|
7118
7121
|
ensureAwake: () => e.supervisor.start(),
|
|
7119
7122
|
...e.onActivity === void 0 ? {} : { onActivity: e.onActivity }
|
|
7120
7123
|
}), n = e.activity, r = xt.createServer((r, i) => {
|
|
7121
|
-
n?.onRequestStart(), i.on("close", () => n?.onRequestEnd()), t.run(() =>
|
|
7124
|
+
n?.onRequestStart(), i.on("close", () => n?.onRequestEnd()), t.run(() => hf(r, i, e.targetHost, e.targetPort)).catch((t) => {
|
|
7122
7125
|
e.log?.warn("wake-router: proxy failed", { reason: t instanceof Error ? t.message : String(t) }), i.headersSent || i.writeHead(502), i.end("wake/proxy failed");
|
|
7123
7126
|
});
|
|
7124
7127
|
});
|
|
7125
7128
|
return r.on("upgrade", (r, i, a) => {
|
|
7126
|
-
n?.onConnect(), i.on("close", () => n?.onDisconnect()), t.run(() =>
|
|
7129
|
+
n?.onConnect(), i.on("close", () => n?.onDisconnect()), t.run(() => gf(r, i, a, e.targetHost, e.targetPort)).catch((t) => {
|
|
7127
7130
|
e.log?.warn("wake-router: upgrade proxy failed", { reason: t instanceof Error ? t.message : String(t) }), i.destroy();
|
|
7128
7131
|
});
|
|
7129
7132
|
}), r;
|
|
7130
|
-
},
|
|
7133
|
+
}, vf = async (e) => {
|
|
7131
7134
|
try {
|
|
7132
7135
|
return (await e.query({
|
|
7133
7136
|
table: "_voltro_workflow_runs",
|
|
@@ -7144,15 +7147,15 @@ behind quietly.`;
|
|
|
7144
7147
|
} catch {
|
|
7145
7148
|
return 0;
|
|
7146
7149
|
}
|
|
7147
|
-
},
|
|
7148
|
-
let t =
|
|
7150
|
+
}, yf = async (e) => {
|
|
7151
|
+
let t = cf(e.supervisor), n = await of({
|
|
7149
7152
|
store: e.store,
|
|
7150
7153
|
adapter: t,
|
|
7151
7154
|
...e.now === void 0 ? {} : { now: e.now },
|
|
7152
7155
|
...e.log === void 0 ? {} : { log: e.log }
|
|
7153
7156
|
});
|
|
7154
7157
|
n > 0 && e.idleGate.reset();
|
|
7155
|
-
let r = await
|
|
7158
|
+
let r = await df({
|
|
7156
7159
|
store: e.store,
|
|
7157
7160
|
signals: e.signals,
|
|
7158
7161
|
...e.wakeLookaheadMs === void 0 ? {} : { wakeLookaheadMs: e.wakeLookaheadMs },
|
|
@@ -7162,12 +7165,12 @@ behind quietly.`;
|
|
|
7162
7165
|
woke: n,
|
|
7163
7166
|
stopped: i
|
|
7164
7167
|
};
|
|
7165
|
-
},
|
|
7166
|
-
let t =
|
|
7168
|
+
}, bf = async (e) => {
|
|
7169
|
+
let t = ff(e.idleGraceMs ?? 6e4), n = e.tickMs ?? 1e3, r = pf(), i = 0, a = e.signals === void 0, o = e.signals ?? {
|
|
7167
7170
|
connectedClients: () => r.openConnections(),
|
|
7168
7171
|
inFlightRequests: () => r.inFlightRequests(),
|
|
7169
7172
|
activeWorkflowExecutions: () => i
|
|
7170
|
-
}, s =
|
|
7173
|
+
}, s = _f({
|
|
7171
7174
|
supervisor: e.supervisor,
|
|
7172
7175
|
targetHost: e.targetHost,
|
|
7173
7176
|
targetPort: e.targetPort,
|
|
@@ -7186,7 +7189,7 @@ behind quietly.`;
|
|
|
7186
7189
|
let l = !1, u, d = e.firedRetentionMs ?? 10 * 6e4, f = 0, p = async () => {
|
|
7187
7190
|
if (!l) {
|
|
7188
7191
|
try {
|
|
7189
|
-
if (a && (i = await
|
|
7192
|
+
if (a && (i = await vf(e.store)), await yf({
|
|
7190
7193
|
store: e.store,
|
|
7191
7194
|
supervisor: e.supervisor,
|
|
7192
7195
|
signals: o,
|
|
@@ -7194,7 +7197,7 @@ behind quietly.`;
|
|
|
7194
7197
|
...e.wakeLookaheadMs === void 0 ? {} : { wakeLookaheadMs: e.wakeLookaheadMs },
|
|
7195
7198
|
...e.log === void 0 ? {} : { log: e.log }
|
|
7196
7199
|
}), f++ % 60 == 0) {
|
|
7197
|
-
let t = await
|
|
7200
|
+
let t = await Vu(e.store, { firedOlderThan: new Date(Date.now() - d) });
|
|
7198
7201
|
t > 0 && e.log?.info("orchestrator: pruned fired wakeups", { count: t });
|
|
7199
7202
|
}
|
|
7200
7203
|
} catch (t) {
|
|
@@ -7209,14 +7212,14 @@ behind quietly.`;
|
|
|
7209
7212
|
l = !0, u !== void 0 && clearTimeout(u), await new Promise((e) => s.close(() => e()));
|
|
7210
7213
|
}
|
|
7211
7214
|
};
|
|
7212
|
-
},
|
|
7215
|
+
}, xf = (e) => e, Sf = class extends y.TaggedError()("AnalyticsError", {
|
|
7213
7216
|
provider: y.String,
|
|
7214
7217
|
operation: y.String,
|
|
7215
7218
|
cause: y.String
|
|
7216
|
-
}) {},
|
|
7219
|
+
}) {}, Cf = class extends y.TaggedError()("AnalyticsCapabilityNotSupported", {
|
|
7217
7220
|
provider: y.String,
|
|
7218
7221
|
capability: y.String
|
|
7219
|
-
}) {},
|
|
7222
|
+
}) {}, wf = class extends n.Tag("@voltro/AnalyticsSink")() {}, Tf = (e, t) => ({
|
|
7220
7223
|
info: e.info,
|
|
7221
7224
|
track: (n) => e.track(n.tenantId === void 0 ? {
|
|
7222
7225
|
...n,
|
|
@@ -7235,20 +7238,20 @@ behind quietly.`;
|
|
|
7235
7238
|
tenantId: t
|
|
7236
7239
|
} : n),
|
|
7237
7240
|
...e.mirror === void 0 ? {} : { mirror: e.mirror }
|
|
7238
|
-
}),
|
|
7239
|
-
let e = yield*
|
|
7241
|
+
}), Ef = () => o.gen(function* () {
|
|
7242
|
+
let e = yield* wf, t = yield* o.serviceOption(et), n = h.match(t, {
|
|
7240
7243
|
onNone: () => null,
|
|
7241
7244
|
onSome: (e) => e.tenantId ?? null
|
|
7242
7245
|
});
|
|
7243
|
-
return n === null ? e :
|
|
7244
|
-
}),
|
|
7245
|
-
let e = (e) => o.fail(new
|
|
7246
|
-
provider:
|
|
7246
|
+
return n === null ? e : Tf(e, n);
|
|
7247
|
+
}), Df = "noop", Of = () => {
|
|
7248
|
+
let e = (e) => o.fail(new Cf({
|
|
7249
|
+
provider: Df,
|
|
7247
7250
|
capability: e
|
|
7248
7251
|
}));
|
|
7249
7252
|
return {
|
|
7250
7253
|
info: {
|
|
7251
|
-
provider:
|
|
7254
|
+
provider: Df,
|
|
7252
7255
|
capabilities: {
|
|
7253
7256
|
track: !0,
|
|
7254
7257
|
aggregate: !1,
|
|
@@ -7262,8 +7265,8 @@ behind quietly.`;
|
|
|
7262
7265
|
timeseries: () => e("timeseries"),
|
|
7263
7266
|
topN: () => e("topN")
|
|
7264
7267
|
};
|
|
7265
|
-
},
|
|
7266
|
-
if (e.length === 0) return
|
|
7268
|
+
}, kf = (e) => {
|
|
7269
|
+
if (e.length === 0) return Of();
|
|
7267
7270
|
if (e.length === 1) return e[0];
|
|
7268
7271
|
let t = {
|
|
7269
7272
|
provider: "compose",
|
|
@@ -7280,7 +7283,7 @@ behind quietly.`;
|
|
|
7280
7283
|
discard: !0
|
|
7281
7284
|
}), r = (t, n) => {
|
|
7282
7285
|
let r = e.find((e) => e.info.capabilities[t]);
|
|
7283
|
-
return r === void 0 ? o.fail(new
|
|
7286
|
+
return r === void 0 ? o.fail(new Cf({
|
|
7284
7287
|
provider: "compose",
|
|
7285
7288
|
capability: t
|
|
7286
7289
|
})) : n(r);
|
|
@@ -7303,11 +7306,11 @@ behind quietly.`;
|
|
|
7303
7306
|
topN: (e) => r("topN", (t) => t.topN(e)),
|
|
7304
7307
|
...a === void 0 ? {} : { mirror: a }
|
|
7305
7308
|
};
|
|
7306
|
-
},
|
|
7309
|
+
}, Af = (e) => {
|
|
7307
7310
|
let t = e.filter((e) => e.dispose !== void 0);
|
|
7308
7311
|
return {
|
|
7309
7312
|
kind: "compose",
|
|
7310
|
-
build: (t) =>
|
|
7313
|
+
build: (t) => kf(e.map((e) => e.build(t))),
|
|
7311
7314
|
tables: e.flatMap((e) => e.tables ?? []),
|
|
7312
7315
|
initialize: (t) => o.forEach(e, (e) => e.initialize ? e.initialize(t) : o.void, {
|
|
7313
7316
|
concurrency: 1,
|
|
@@ -7318,15 +7321,15 @@ behind quietly.`;
|
|
|
7318
7321
|
discard: !0
|
|
7319
7322
|
}) } : {}
|
|
7320
7323
|
};
|
|
7321
|
-
},
|
|
7324
|
+
}, jf = {
|
|
7322
7325
|
kind: "noop",
|
|
7323
|
-
build: () =>
|
|
7324
|
-
},
|
|
7326
|
+
build: () => Of()
|
|
7327
|
+
}, Mf = {
|
|
7325
7328
|
tables: [],
|
|
7326
7329
|
detach: () => {}
|
|
7327
|
-
},
|
|
7330
|
+
}, Nf = (e) => {
|
|
7328
7331
|
let { store: t, sink: n, log: r } = e, i = n.mirror;
|
|
7329
|
-
if (i === void 0 || i.tables.length === 0) return
|
|
7332
|
+
if (i === void 0 || i.tables.length === 0) return Mf;
|
|
7330
7333
|
let a = e.run ?? ((e) => o.runPromise(e)), s = i.primaryKey ?? "id", c = new Set(i.tables), l = (e) => {
|
|
7331
7334
|
if (e.op === "delete") {
|
|
7332
7335
|
let t = e.old;
|
|
@@ -7350,11 +7353,11 @@ behind quietly.`;
|
|
|
7350
7353
|
tables: i.tables,
|
|
7351
7354
|
detach: u
|
|
7352
7355
|
};
|
|
7353
|
-
},
|
|
7356
|
+
}, Pf = (e) => {
|
|
7354
7357
|
let t = typeof e.refresh == "string" ? { interval: e.refresh } : e.refresh, n = e.strategy ?? "replace";
|
|
7355
7358
|
if (n === "merge" && (e.mergeKey === void 0 || e.mergeKey.length === 0)) throw Error(`defineAggregate("${e.name}"): strategy: 'merge' requires mergeKey — the property on each row to upsert by`);
|
|
7356
7359
|
if (e.incremental !== void 0) {
|
|
7357
|
-
let t =
|
|
7360
|
+
let t = Rd({
|
|
7358
7361
|
aggregations: [{
|
|
7359
7362
|
op: e.incremental.op,
|
|
7360
7363
|
...e.incremental.column === void 0 ? {} : { column: e.incremental.column }
|
|
@@ -7376,47 +7379,51 @@ behind quietly.`;
|
|
|
7376
7379
|
build: e.build,
|
|
7377
7380
|
...e.incremental === void 0 ? {} : { incremental: e.incremental }
|
|
7378
7381
|
};
|
|
7379
|
-
},
|
|
7382
|
+
}, Ff = (e) => typeof e == "object" && !!e && e._voltroAggregate === !0, If = class extends y.TaggedError()("AggregateStale", {
|
|
7380
7383
|
name: y.String,
|
|
7381
7384
|
ageMs: y.Number,
|
|
7382
7385
|
maxAgeMs: y.Number
|
|
7383
|
-
}) {},
|
|
7386
|
+
}) {}, Lf = class extends y.TaggedError()("AggregateNotFound", { name: y.String }) {}, Rf = class extends y.TaggedError()("AggregateError", {
|
|
7384
7387
|
name: y.String,
|
|
7385
7388
|
operation: y.String,
|
|
7386
7389
|
cause: y.String
|
|
7387
|
-
}) {},
|
|
7388
|
-
return (yield*
|
|
7389
|
-
}),
|
|
7390
|
+
}) {}, zf = class extends n.Tag("@voltro/AggregateRegistry")() {}, Bf = (e) => o.gen(function* () {
|
|
7391
|
+
return (yield* zf).getHandle(e);
|
|
7392
|
+
}), Vf = (e, t, n) => {
|
|
7390
7393
|
if (e.crossTenant || !t.has(e.table) || n == null) return e;
|
|
7391
7394
|
let r = O("tenantId", n);
|
|
7392
7395
|
return {
|
|
7393
7396
|
...e,
|
|
7394
7397
|
predicate: e.predicate ? C(e.predicate, r) : r
|
|
7395
7398
|
};
|
|
7396
|
-
},
|
|
7399
|
+
}, Hf = (e, t, n) => n === "" && !e.crossTenant && t.has(e.table), Uf = (e) => e?.type === "user" && e.tenantId === "", Wf = (e, t) => {
|
|
7397
7400
|
if (e.includeDeleted || !t.has(e.table)) return e;
|
|
7398
7401
|
let n = de("deletedAt");
|
|
7399
7402
|
return {
|
|
7400
7403
|
...e,
|
|
7401
7404
|
predicate: e.predicate ? C(e.predicate, n) : n
|
|
7402
7405
|
};
|
|
7403
|
-
},
|
|
7406
|
+
}, Gf = (e) => (t, n) => {
|
|
7407
|
+
e.observe?.beforeScope?.({ ...t }, n);
|
|
7408
|
+
let r = Wf(Vf(t, e.tenantScopedTables, n.tenantId), e.softDeleteScopedTables);
|
|
7409
|
+
return e.observe?.afterScope?.({ ...r }), r;
|
|
7410
|
+
}, Kf = (e, t) => t, qf = (t) => o.runPromiseExit(t).then((t) => {
|
|
7404
7411
|
if (c.isSuccess(t)) return t.value;
|
|
7405
7412
|
let n = e.failureOption(t.cause);
|
|
7406
7413
|
throw h.isSome(n) ? n.value : e.squash(t.cause);
|
|
7407
|
-
}),
|
|
7414
|
+
}), Jf = (e, t) => e.pipe(o.provideService(et, t)), Yf = async (e, t, n) => {
|
|
7408
7415
|
let r = await o.runPromise(ot(t, e.guards, n));
|
|
7409
7416
|
if (r) throw r;
|
|
7410
|
-
},
|
|
7417
|
+
}, Xf = async (e) => {
|
|
7411
7418
|
if (Dr() === void 0) return e;
|
|
7412
|
-
let t = await
|
|
7419
|
+
let t = await qf(kr(e.subject, (e) => {
|
|
7413
7420
|
console.error("[voltro] row filter failed to load", e);
|
|
7414
7421
|
}));
|
|
7415
7422
|
return {
|
|
7416
7423
|
...e,
|
|
7417
7424
|
rowFilter: t
|
|
7418
7425
|
};
|
|
7419
|
-
},
|
|
7426
|
+
}, Zf = async (t) => {
|
|
7420
7427
|
let n = `${t.kind}.${t.name}`, r = Date.now(), i = "ok";
|
|
7421
7428
|
try {
|
|
7422
7429
|
if (t.interceptor) {
|
|
@@ -7445,28 +7452,28 @@ behind quietly.`;
|
|
|
7445
7452
|
status: i
|
|
7446
7453
|
});
|
|
7447
7454
|
}
|
|
7448
|
-
},
|
|
7455
|
+
}, Qf = /* @__PURE__ */ new Set([1213, 1205]), $f = /* @__PURE__ */ new Set([
|
|
7449
7456
|
"ER_LOCK_DEADLOCK",
|
|
7450
7457
|
"ER_LOCK_WAIT_TIMEOUT",
|
|
7451
7458
|
"40001",
|
|
7452
7459
|
"40P01"
|
|
7453
|
-
]),
|
|
7460
|
+
]), ep = (e) => {
|
|
7454
7461
|
let t = e;
|
|
7455
7462
|
for (let e = 0; e < 6 && typeof t == "object" && t; e++) {
|
|
7456
7463
|
let e = t;
|
|
7457
|
-
if (typeof e.errno == "number" &&
|
|
7464
|
+
if (typeof e.errno == "number" && Qf.has(e.errno) || typeof e.code == "string" && $f.has(e.code) || typeof e.sqlState == "string" && $f.has(e.sqlState)) return !0;
|
|
7458
7465
|
t = e.cause;
|
|
7459
7466
|
}
|
|
7460
7467
|
return !1;
|
|
7461
|
-
},
|
|
7462
|
-
let n = t?.delay ?? ((e) =>
|
|
7468
|
+
}, tp = 3, np = (e) => new Promise((t) => setTimeout(t, e)), rp = async (e, t) => {
|
|
7469
|
+
let n = t?.delay ?? ((e) => np(e * 20 + Math.floor(Math.random() * 30)));
|
|
7463
7470
|
for (let t = 1;; t++) try {
|
|
7464
7471
|
return await e();
|
|
7465
7472
|
} catch (e) {
|
|
7466
|
-
if (t >=
|
|
7473
|
+
if (t >= tp || !ep(e)) throw e;
|
|
7467
7474
|
await n(t);
|
|
7468
7475
|
}
|
|
7469
|
-
},
|
|
7476
|
+
}, ip = (e) => (t, n, r) => Zf({
|
|
7470
7477
|
name: t.descriptor.name,
|
|
7471
7478
|
kind: "mutation",
|
|
7472
7479
|
input: n,
|
|
@@ -7474,11 +7481,11 @@ behind quietly.`;
|
|
|
7474
7481
|
...e.interceptor ? { interceptor: e.interceptor } : {},
|
|
7475
7482
|
...e.recordMetric ? { recordMetric: e.recordMetric } : {},
|
|
7476
7483
|
runExecutor: async () => {
|
|
7477
|
-
await
|
|
7478
|
-
let i = await
|
|
7484
|
+
await Yf(t.descriptor, r.subject, n);
|
|
7485
|
+
let i = await Xf(r), a = [], s = await rp(async () => (a.length = 0, e.store.transactional(async (s) => {
|
|
7479
7486
|
let c = e.undoCapture?.(s), l = c ? c.tx : s, u = e.buildContext(i, l, { afterCommit: (e) => {
|
|
7480
7487
|
a.push(e);
|
|
7481
|
-
} }), d = t.executor(n, u), f = o.isEffect(d) ? await e.runEffect(
|
|
7488
|
+
} }), d = t.executor(n, u), f = o.isEffect(d) ? await e.runEffect(Jf(d, r.subject), u.store) : await d;
|
|
7482
7489
|
return c && await c.persist(u.store, {
|
|
7483
7490
|
tag: t.descriptor.name,
|
|
7484
7491
|
subject: r.subject,
|
|
@@ -7488,30 +7495,30 @@ behind quietly.`;
|
|
|
7488
7495
|
for (let e of a) await e();
|
|
7489
7496
|
return s;
|
|
7490
7497
|
}
|
|
7491
|
-
}),
|
|
7498
|
+
}), ap = (e) => e && typeof e == "object" && "descriptor" in e ? e.descriptor : e, op = (e) => typeof e == "object" && !!e && !Array.isArray(e) && "table" in e && "order" in e, sp = (e) => {
|
|
7492
7499
|
let t = e.descriptor.source;
|
|
7493
7500
|
return t == null ? [] : typeof t == "string" ? [t] : [...t];
|
|
7494
|
-
},
|
|
7501
|
+
}, cp = (e, t) => (n) => () => {
|
|
7495
7502
|
let r = e.descriptor.guards;
|
|
7496
7503
|
return !r || r.length === 0 ? Promise.resolve(null) : o.runPromise(ot(n, r, t));
|
|
7497
|
-
},
|
|
7498
|
-
let i = e.buildContext(r), a =
|
|
7504
|
+
}, lp = (e) => (t, n) => (r) => {
|
|
7505
|
+
let i = e.buildContext(r), a = cp(t, n)(r.subject), s = async () => {
|
|
7499
7506
|
let i = await a();
|
|
7500
7507
|
if (i) throw i;
|
|
7501
|
-
let s = e.buildContext(await
|
|
7502
|
-
return o.isEffect(c) ? o.runPromise(e.provideEffect(
|
|
7508
|
+
let s = e.buildContext(await Xf(r)), c = t.executor(n, s);
|
|
7509
|
+
return o.isEffect(c) ? o.runPromise(e.provideEffect(Jf(c, r.subject), s.store)) : ap(await Promise.resolve(c));
|
|
7503
7510
|
}, c = (n) => {
|
|
7504
|
-
let i =
|
|
7505
|
-
return
|
|
7511
|
+
let i = ap(n);
|
|
7512
|
+
return op(i) ? e.finalize(i, r) : {
|
|
7506
7513
|
__voltroComputed: !0,
|
|
7507
7514
|
value: i,
|
|
7508
|
-
dependentTables:
|
|
7515
|
+
dependentTables: sp(t),
|
|
7509
7516
|
tenantId: r.subject?.tenantId ?? null,
|
|
7510
7517
|
recompute: s
|
|
7511
7518
|
};
|
|
7512
7519
|
}, l = () => {
|
|
7513
7520
|
let a = t.executor(n, i);
|
|
7514
|
-
return o.isEffect(a) ? e.provideEffect(
|
|
7521
|
+
return o.isEffect(a) ? e.provideEffect(Jf(a, r.subject), i.store).pipe(o.map(c)) : a instanceof Promise ? o.promise(() => a).pipe(o.map(c)) : c(a);
|
|
7515
7522
|
}, u = () => {
|
|
7516
7523
|
let e = t.descriptor.guards;
|
|
7517
7524
|
return !e || e.length === 0 ? l() : ot(r.subject, e, n).pipe(o.flatMap((e) => {
|
|
@@ -7533,14 +7540,14 @@ behind quietly.`;
|
|
|
7533
7540
|
traceId: r.traceId,
|
|
7534
7541
|
...r.spanId === void 0 ? {} : { spanId: r.spanId }
|
|
7535
7542
|
});
|
|
7536
|
-
},
|
|
7537
|
-
let i = await
|
|
7543
|
+
}, up = (e) => async (t, n, r) => {
|
|
7544
|
+
let i = await Xf(r), a = lp(e)(t, n)(i), s = o.isEffect(a) ? await qf(a) : a;
|
|
7538
7545
|
return zr(s) ? s.value : e.queryRows(s);
|
|
7539
|
-
},
|
|
7546
|
+
}, dp = (e) => (t, n, r, i) => {
|
|
7540
7547
|
let a = !1, s;
|
|
7541
7548
|
return (async () => {
|
|
7542
7549
|
try {
|
|
7543
|
-
let c = await
|
|
7550
|
+
let c = await Xf(r), l = lp(e)(t, n)(c), u = o.isEffect(l) ? await qf(l) : l, d = (e) => i(e), f = zr(u) ? await e.subscribeComputed(u, d, c) : await e.subscribeDescriptor(u, d, c);
|
|
7544
7551
|
a ? f() : s = f;
|
|
7545
7552
|
} catch (e) {
|
|
7546
7553
|
i({
|
|
@@ -7551,7 +7558,7 @@ behind quietly.`;
|
|
|
7551
7558
|
})(), () => {
|
|
7552
7559
|
a = !0, s?.();
|
|
7553
7560
|
};
|
|
7554
|
-
},
|
|
7561
|
+
}, fp = (e) => (t, n, r) => Zf({
|
|
7555
7562
|
name: t.descriptor.name,
|
|
7556
7563
|
kind: "action",
|
|
7557
7564
|
input: n,
|
|
@@ -7559,16 +7566,16 @@ behind quietly.`;
|
|
|
7559
7566
|
...e.interceptor ? { interceptor: e.interceptor } : {},
|
|
7560
7567
|
...e.recordMetric ? { recordMetric: e.recordMetric } : {},
|
|
7561
7568
|
runExecutor: async () => {
|
|
7562
|
-
await
|
|
7563
|
-
let i = e.buildContext(await
|
|
7564
|
-
return o.isEffect(a) ? e.runEffect(
|
|
7569
|
+
await Yf(t.descriptor, r.subject, n);
|
|
7570
|
+
let i = e.buildContext(await Xf(r)), a = t.executor(n, i);
|
|
7571
|
+
return o.isEffect(a) ? e.runEffect(Jf(a, r.subject), i.store) : a;
|
|
7565
7572
|
}
|
|
7566
|
-
}),
|
|
7573
|
+
}), pp = (e) => e instanceof Date ? e.toISOString() : typeof e == "string" && e.length > 0 ? e : null, mp = (e) => typeof e == "string" && e.length > 0 ? e : null, hp = [
|
|
7567
7574
|
"updatedAt",
|
|
7568
7575
|
"createdAt",
|
|
7569
7576
|
"updatedBy",
|
|
7570
7577
|
"createdBy"
|
|
7571
|
-
],
|
|
7578
|
+
], gp = (e) => hp.some((t) => t in e), _p = (e, t, n) => {
|
|
7572
7579
|
let r = {
|
|
7573
7580
|
table: t.table,
|
|
7574
7581
|
id: t.id,
|
|
@@ -7583,14 +7590,14 @@ behind quietly.`;
|
|
|
7583
7590
|
found: !1
|
|
7584
7591
|
};
|
|
7585
7592
|
let i = t.column === void 0 ? void 0 : e[t.column];
|
|
7586
|
-
if (!
|
|
7593
|
+
if (!gp(e)) return {
|
|
7587
7594
|
...r,
|
|
7588
7595
|
value: i,
|
|
7589
7596
|
lastWrite: null,
|
|
7590
7597
|
attribution: "none",
|
|
7591
7598
|
found: !0
|
|
7592
7599
|
};
|
|
7593
|
-
let a =
|
|
7600
|
+
let a = mp(e.updatedBy) ?? mp(e.createdBy), o = pp(e.updatedAt) ?? pp(e.createdAt);
|
|
7594
7601
|
return {
|
|
7595
7602
|
...r,
|
|
7596
7603
|
value: i,
|
|
@@ -7602,12 +7609,12 @@ behind quietly.`;
|
|
|
7602
7609
|
attribution: "audit",
|
|
7603
7610
|
found: !0
|
|
7604
7611
|
};
|
|
7605
|
-
},
|
|
7612
|
+
}, vp = (e, t) => {
|
|
7606
7613
|
let n = e.map((e) => {
|
|
7607
7614
|
let n = e.newValue ?? e.value, r = t.column !== void 0 && n && typeof n == "object" ? n[t.column] : e.newValue ?? e.value;
|
|
7608
7615
|
return {
|
|
7609
|
-
actor: { id:
|
|
7610
|
-
at:
|
|
7616
|
+
actor: { id: mp(e.actor) ?? mp(e.changedBy) },
|
|
7617
|
+
at: pp(e.at) ?? pp(e.changedAt),
|
|
7611
7618
|
...e.traceId === void 0 ? {} : { traceId: e.traceId },
|
|
7612
7619
|
value: r
|
|
7613
7620
|
};
|
|
@@ -7622,12 +7629,12 @@ behind quietly.`;
|
|
|
7622
7629
|
history: n,
|
|
7623
7630
|
found: n.length > 0
|
|
7624
7631
|
};
|
|
7625
|
-
},
|
|
7632
|
+
}, yp = (e) => {
|
|
7626
7633
|
let t = e.new?.id;
|
|
7627
7634
|
if (typeof t == "string") return t;
|
|
7628
7635
|
let n = e.old?.id;
|
|
7629
7636
|
return typeof n == "string" ? n : void 0;
|
|
7630
|
-
},
|
|
7637
|
+
}, bp = (e) => {
|
|
7631
7638
|
let t = {};
|
|
7632
7639
|
if (e.op === "insert") for (let [n, r] of Object.entries(e.new ?? {})) t[n] = {
|
|
7633
7640
|
from: void 0,
|
|
@@ -7647,11 +7654,11 @@ behind quietly.`;
|
|
|
7647
7654
|
return {
|
|
7648
7655
|
table: e.table,
|
|
7649
7656
|
op: e.op,
|
|
7650
|
-
id:
|
|
7657
|
+
id: yp(e),
|
|
7651
7658
|
fields: t
|
|
7652
7659
|
};
|
|
7653
|
-
},
|
|
7654
|
-
let t = e.map(
|
|
7660
|
+
}, xp = (e) => {
|
|
7661
|
+
let t = e.map(bp);
|
|
7655
7662
|
return {
|
|
7656
7663
|
rows: t,
|
|
7657
7664
|
summary: {
|
|
@@ -7660,21 +7667,21 @@ behind quietly.`;
|
|
|
7660
7667
|
deletes: t.filter((e) => e.op === "delete").length
|
|
7661
7668
|
}
|
|
7662
7669
|
};
|
|
7663
|
-
},
|
|
7670
|
+
}, Sp = class extends Error {
|
|
7664
7671
|
constructor() {
|
|
7665
7672
|
super("voltro:preview-rollback"), this.name = "PreviewRollback";
|
|
7666
7673
|
}
|
|
7667
|
-
},
|
|
7674
|
+
}, Cp = async (e, t) => {
|
|
7668
7675
|
let n, r = !1;
|
|
7669
7676
|
try {
|
|
7670
7677
|
await e.transactional(async (e) => {
|
|
7671
|
-
throw n = await t(e), r = !0, new
|
|
7678
|
+
throw n = await t(e), r = !0, new Sp();
|
|
7672
7679
|
});
|
|
7673
7680
|
} catch (e) {
|
|
7674
|
-
if (!(e instanceof
|
|
7681
|
+
if (!(e instanceof Sp)) throw e;
|
|
7675
7682
|
}
|
|
7676
7683
|
if (!r) throw Error("preview: handler did not complete");
|
|
7677
7684
|
return n;
|
|
7678
|
-
},
|
|
7685
|
+
}, wp = "framework-runtime";
|
|
7679
7686
|
//#endregion
|
|
7680
|
-
export { Oo as API_KEYS_TABLE, $c as AccessDenied,
|
|
7687
|
+
export { Oo as API_KEYS_TABLE, $c as AccessDenied, Rf as AggregateError, Kd as AggregateMaintainer, Lf as AggregateNotFound, zf as AggregateRegistry, If as AggregateStale, Cf as AnalyticsCapabilityNotSupported, Sf as AnalyticsError, wf as AnalyticsSink, X as CONNECTIONS_TABLE, Qs as CONNECTION_GRANTS_TABLE, pu as CircuitBreaker, du as CircuitOpen, xc as ConnectionNotConnected, Pa as DEFAULT_MAX_RPC_BODY_BYTES, yc as DEFAULT_REFRESH_SKEW_MS, wr as DEFAULT_ROW_FILTER_RETRY, Uu as DORMANCY_WAKEUP_TENANT, Li as DeleteBuilder, Ir as Dispatcher, Es as EVENT_CLIENT_QUEUE_SIZE, Ds as EVENT_LATEST_QUEUE_SIZE, Uo as EffectStore, xs as EventBus, Nc as GRANT_TTL_MS, yn as InMemoryDataStore, sn as IndexedMatcher, Ns as InstanceMembership, $t as LinearScanMatcher, p as MetricBoundaries, Df as NOOP_ANALYTICS_PROVIDER, Or as NO_ROW_FILTER, Ai as NoRowFound, Ls as OUTBOX_ATTEMPTS_TABLE, Ws as OUTBOX_ATTEMPT_LOG_CAP, Y as OUTBOX_TABLE, ji as OptimisticLockError, Qc as REBAC_ADMIN_SCOPE, bc as REFRESH_LEASE_MS, wp as RUNTIME_NAME, nf as ReactionRateLimiter, ia as ReplicatedDataStore, Cr as RowFilterUnavailable, Hu as SCHEDULE_SUBJECT, Ho as SYSTEM_SUBJECT, Fi as SelectBuilder, wl as SsrfBlockedError, Bi as StoreOperationFailed, un as SubscriptionRegistry, Vi as TableValidationFailed, zi as TenantScopeViolation, Md as TimelineRecorder, dd as UndoBoundaryError, pd as UndoStack, Ii as UpdateBuilder, jl as VOLTRO_AUDIT_MIXIN_ID, Nl as VOLTRO_EXPIRES_MIXIN_ID, Ml as VOLTRO_SOFT_DELETE_MIXIN_ID, Pl as VOLTRO_TENANT_MIXIN_ID, $o as WorkflowPayloadError, ei as _connectionStreamCount, ti as _resetConnectionSubjectsForTest, ec as _voltroConnectionGrantsTable, Zs as _voltroConnectionsTable, qd as _voltroRebacTuplesTable, ed as _voltroScheduleClaimsTable, $u as _voltroScheduleRunsTable, td as _voltroTracesTable, nd as _voltroUndoLogTable, af as _voltroWakeupsTable, hs as _voltroWorkflowEventDeliveriesTable, ms as _voltroWorkflowEventsTable, qi as actingUserId, Vo as apiKeyManagementRoutes, Wi as applyDefined, Wd as applyDelta, hd as applyInverse, gd as applyInverses, lu as applyPluginRefRules, Mr as applyRowFilter, Nr as applyRowFilterToDescriptor, Wf as applySoftDeleteScope, Vf as applyTenantScope, wd as applyUndoInvocation, ll as assertCan, ic as assertConnectionCipherConfigured, Nf as attachAnalyticsMirror, Ka as awaitServerListening, Us as backoffMs, Lc as beginOAuthConnect, qr as bindConnectionSubject, As as bindEvent, Na as bindMutation, Sa as bindStream, xa as bindSubscription, ga as bindSubscriptionUntyped, Hd as buildIvmState, xp as buildPreview, Xd as buildRebacInterceptor, Qd as buildRebacReadFilter, Qi as buildSubjectKey, Za as buildTracingLayer, $l as cacheScopeLeaks, po as cachedBackend, cl as can, ju as cancelWakeup, cn as canonicalize, Rd as classifyShape, Tc as clearConnectionRefreshFlights, il as clearResourcePolicies, ee as clearRetentions, gu as clearSystemStoreHandle, uu as collectPluginRefRules, Eu as compileCron, Rc as completeOAuthConnect, Af as composeAnalytics, kf as composeAnalyticsSinks, Pc as connectionCallbackPath, rc as connectionLabel, ni as connectionSubjectsSnapshot, vf as countRunningWorkflows, _r as counter, Jl as crud, ml as currentRequestLoader, ra as currentRoutingContext, li as currentTraceContext, Ro as dataStoreApiKeyStore, bo as dataStoreIdempotencyStore, To as dataStoreKvStore, _i as decryptField, Pf as defineAggregate, nc as defineConnection, ls as defineEventTrigger, Kf as defineExecutor, Bs as defineOutboxHandler, $d as defineReaction, tl as defineResourcePolicy, Tu as defineSchedule, xf as defineSubscriber, Pr as deliveredRowCount, ui as deriveKey, bp as diffChange, Wa as drainForShutdown, Js as drainOutbox, Ru as dueWakeups, sl as effectiveRelations, zl as emptySchemaRegistry, Ci as enableGraphObservation, gi as encryptField, pl as enterRequestLoader, oo as envSecretsBackend, ar as eventMetricTagCacheSizeForTests, _c as exchangeAuthorizationCode, oi as externalSpanFromTraceparent, xn as extractDbCause, ln as fingerprintFor, pc as forgetCredential, eu as formatCacheScopeLeaks, Ql as formatServerOnlyLeaks, ii as formatTraceparent, ru as formatUnresolvedSources, md as forwardChangeFromCdc, zo as frameworkApiKeyStrategy, vr as gauge, Ao as generateApiKeyToken, Hc as getConnectionResolver, Jr as getConnectionSubject, Kr as getCredentialExpiry, q as getFieldCipher, nl as getResourcePolicy, Dr as getRowFilter, _u as getSystemStoreHandle, Pd as getTimelineRecorder, yl as getTupleSource, $ as groupKeyOf, yr as histogramMetric, vp as historyProvenance, mo as httpSecretsBackend, Xt as inspectWorkflow, bl as installPolicyGuardResolver, $r as interruptConnectionStreams, ld as invertChange, Ff as isAggregateDefinition, Hf as isEmptyTenantScopedRead, Sn as isForeignKeyViolation, df as isIdleNow, Oa as isInfraError, wi as isObservingGraph, Uf as isOrglessUserSubject, Cn as isQueryTimeout, fd as isSafeToApply, Cu as isScheduleDefinition, su as isSoftDelete, us as isWorkflowEventTriggerDefinition, Vd as ivmValue, _p as lastWriteProvenance, mc as listConnectionStates, rl as listResourcePolicies, pe as listRetentions, Jd as loadResourceTuples, Zd as loadSubjectTuples, yu as localityAwareSelector, fp as makeActionRunner, Ku as makeAdvisoryLockCoordinator, di as makeAesCipher, No as makeApiKeyService, Al as makeApiKeyUsageBuffer, Lo as makeApiKeyUsageFlusher, wn as makeAppAccess, Eo as makeAsyncKv, ks as makeBufferGapDetector, ao as makeBufferingSpanProcessor, ac as makeConnectionRegistry, Wc as makeConnectionResolver, Gc as makeConnectionsFacade, Qu as makeCoordinatedScheduler, Sl as makeDataLoader, Zc as makeDisconnectConnectionExecutor, Ko as makeEffectStoreLayer, Ts as makeEventPublisher, gs as makeEventsFacade, fi as makeFieldCipher, Ri as makeFluentStore, ff as makeIdleGate, as as makeLazyWorkflowFacade, Jc as makeListConnectionsExecutor, ja as makeMutationOutputCodec, ip as makeMutationRunner, up as makeOneShotQueryRunner, Hs as makeOutboxFacade, rs as makePostCommitWorkflowFacade, cf as makeProcessAdapter, lp as makeQueryDescriptorProducer, Gf as makeQueryFinalizer, cp as makeQueryReauthorizer, dp as makeQuerySubscriber, pf as makeRouterActivity, Fl as makeSchemaRegistry, Yc as makeStartConnectionExecutor, Xc as makeSubmitTokenExecutor, sd as makeUndoCapture, mf as makeWakeGate, _f as makeWakeProxyServer, ns as makeWorkflowFacade, is as makeWorkflowFacadeWithCallerContext, os as makeWorkflowHandlers, ss as makeWorkflowLayers, Yo as makeWorkflowRunHandle, Mu as markWakeupFired, Ud as materializeIvm, Po as memoryApiKeyStore, xu as memoryReplicationAdapter, Zi as memoryRywPositionStore, Du as nextFiring, zu as nextWakeup, uf as nodeProcessSupervisor, Of as noopAnalytics, jf as noopAnalyticsSpec, Do as noopKv, ki as observeStore, Di as observedGraph, Xr as onBindConnectionSubject, za as onProcessShutdown, zs as outboxAttemptsTable, Is as outboxTable, ai as parseTraceparent, es as payloadPropertyNames, Yi as powerOfTwoSelector, Cp as previewInRollback, lc as projectConnectionState, Vu as pruneWakeups, Cs as publishEvent, al as rebacPolicyGraph, Gr as recordCredentialExpiry, sr as recordEventDelivered, cr as recordEventDropped, or as recordEventPublished, lr as recordEventSubscribers, ur as recordSample, hr as recordScheduleRun, mr as recordSubscriptionActive, fr as recordSubscriptionDelivery, Ei as recordTableAccess, Id as recordTimelineEvent, gr as recordWorkflowRun, Wl as redactColumns, kd as redactRow, $i as redisRywPositionStore, Td as redoUndoInvocation, vc as refreshAccessToken, Qr as registerConnectionStream, Ce as registerRetention, Au as registerWakeup, Fu as releaseWakeup, Xi as replicaHealth, va as resetComputedQueryCacheWarnings, ir as resetEventMetricTagCacheForTests, Oi as resetObservedGraph, lo as resetSecretsBackend, Oc as resolveConnection, Uc as resolveConnectionForSubject, bu as resolveCurrentRegion, Tn as resolveDependentTables, Ic as resolveRedirectUri, Gd as resolveRescan, kr as resolveRowFilterScope, Ar as resolveRowFilterScopeFor, uo as resolveSecret, fo as resolveSecretSync, ho as resolveSecretsBackend, Ed as resolveTimelineMode, Te as retentionTtlMsFromEnv, jd as reverseEventOverRows, dl as revokedIds, cu as rulesFor, vu as runAsSystem, yf as runOrchestratorTick, qf as runProvidedEffect, rf as runReaction, bf as runSingleNodeOrchestrator, sf as runWakeLoop, rp as runWithDeadlockRetry, Ti as runWithObservedProcedure, hl as runWithRequestLoader, na as runWithRoutingContext, ci as runWithTraceContext, Fc as sanitizeRedirectTo, Zu as scheduleCoordinated, Yl as schemaPropertyNames, Zl as serverOnlyLeaks, Vc as setConnectionResolver, mi as setFieldCipher, Er as setRowFilter, co as setSecretsBackend, hu as setSystemStoreHandle, Fd as setTimelineRecorderForTest, vl as setTupleSource, Qt as settleHandlerBody, ko as sha256Hex, Ua as shutdownGraceMsFromEnv, Wu as singleCoordinator, xr as snapshotMetrics, Sr as snapshotMetricsSync, kl as ssrfGuardHttpClientLayer, Ol as ssrfReason, Fa as startRpcServer, Ju as startScheduler, dc as storeCredential, zc as sweepExpiredGrants, Me as sweepRetention, ud as synthesizeInverse, Cl as tracingHttpClientLayer, cs as triggerWorkflow, Pu as tryClaimWakeup, Yr as unbindConnectionSubject, rd as undoCaptureEnabled, Sd as undoLogExecutor, nu as unresolvedSources, Bf as useAggregate, Ef as useAnalytics, ul as visibleRows, of as wakeDueOnce, Xf as withRowFilter, qo as workflowToRpc, od as wrapCaptureStore, Vl as wrapStoreWithBootCodec, Ji as wrapStoreWithMixinBehaviour };
|