@voltro/client 0.85.0 → 0.87.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 +5987 -0
- package/THIRD-PARTY-NOTICES.md +1125 -34
- package/dist/analyticsCatalog.js +47 -0
- package/dist/apiConnectivity.js +33 -0
- package/dist/apiRoleTransports.js +48 -0
- package/dist/apiRuntime.js +145 -0
- package/dist/apiSocketTracker.js +21 -0
- package/dist/apiSupervisor.js +136 -0
- package/dist/authRefresh.js +20 -0
- package/dist/awaitResolvedApi.js +23 -0
- package/dist/bootstrap.d.ts +1153 -0
- package/dist/bootstrap.js +8 -0
- package/dist/cellMerger.js +6 -0
- package/dist/clientDiagnostics.js +94 -0
- package/dist/clientErrorBus.js +16 -0
- package/dist/clientScheduler.js +31 -0
- package/dist/connectionPrerequisite.js +70 -0
- package/dist/connectionScope.js +47 -0
- package/dist/connectionSetupController.js +206 -0
- package/dist/createHooks.js +15 -0
- package/dist/deepLink.js +69 -0
- package/dist/filters.js +58 -0
- package/dist/form.d.ts +37 -4
- package/dist/form.js +7 -2
- package/dist/formBinding.js +325 -0
- package/dist/formData.js +127 -0
- package/dist/formFlashId.js +4 -0
- package/dist/formRejection.js +23 -0
- package/dist/formSource.js +13 -0
- package/dist/frameworkRuntimesContext.js +8 -0
- package/dist/globalContext.js +10 -0
- package/dist/index.d.ts +152 -27
- package/dist/index.js +87 -4121
- package/dist/liveRowSort.js +66 -0
- package/dist/mutationConnectionSetup.js +16 -0
- package/dist/mutationIdentity.js +10 -0
- package/dist/mutationSerialExecution.js +53 -0
- package/dist/mutationsBus.js +40 -0
- package/dist/onlineSource.js +13 -0
- package/dist/outbox.js +213 -0
- package/dist/outboxHttp.js +104 -0
- package/dist/outboxState.js +43 -0
- package/dist/permissions.js +20 -0
- package/dist/platform.js +121 -0
- package/dist/preloadSeed.js +47 -0
- package/dist/provider.js +22 -0
- package/dist/query.js +12 -2
- package/dist/recoveryCoordinator.js +195 -0
- package/dist/recoveryRetry.js +24 -0
- package/dist/richText.js +176 -0
- package/dist/rpcErrorBus.js +39 -0
- package/dist/rpcErrorKind.js +13 -0
- package/dist/runRpc.js +12 -0
- package/dist/runtime.d.ts +49 -3
- package/dist/runtime.js +16 -126
- package/dist/runtimeCapabilities.js +44 -0
- package/dist/runtimeContext.js +49 -0
- package/dist/schemaFields.js +219 -0
- package/dist/scopeMembership.js +12 -0
- package/dist/seedResolvers.js +7 -0
- package/dist/sequence.js +65 -0
- package/dist/serverRequest.js +28 -0
- package/dist/serviceClient.js +129 -0
- package/dist/squashRpcCause.js +8 -0
- package/dist/stableKey.js +21 -0
- package/dist/store.js +288 -0
- package/dist/storeStorage.js +28 -0
- package/dist/subscriptionCache.js +724 -0
- package/dist/tagWalk.js +23 -0
- package/dist/traceBus.js +10 -0
- package/dist/tracking.js +40 -0
- package/dist/uploadProgress.js +21 -0
- package/dist/useAction.js +101 -0
- package/dist/useAgent.js +53 -0
- package/dist/useAgentChat.js +43 -0
- package/dist/useAgentStream.js +64 -0
- package/dist/useApiOnline.js +14 -0
- package/dist/useCapabilityManifest.js +105 -0
- package/dist/useConnectionSetup.js +28 -0
- package/dist/useConnectionStatus.js +38 -0
- package/dist/useConnections.js +107 -0
- package/dist/useDataCopilot.js +24 -0
- package/dist/useDataTable.js +34 -0
- package/dist/useDerived.js +22 -0
- package/dist/useEvent.js +98 -0
- package/dist/useFormBinding.js +478 -0
- package/dist/useLocalQuery.js +59 -0
- package/dist/useMutation.js +214 -0
- package/dist/useOnRpcError.js +13 -0
- package/dist/usePreloadedSubscription.js +18 -0
- package/dist/usePreview.js +14 -0
- package/dist/useProvenance.js +51 -0
- package/dist/useQueryField.js +34 -0
- package/dist/useRecord.js +12 -0
- package/dist/useRefreshSubscriptions.js +22 -0
- package/dist/useResourceCan.js +18 -0
- package/dist/useResumableAgentStream.js +75 -0
- package/dist/useRpcCaller.js +17 -0
- package/dist/useSequence.js +25 -0
- package/dist/useSkeleton.js +13 -0
- package/dist/useSubscription.js +98 -0
- package/dist/useSubscriptionHealth.js +32 -0
- package/dist/useTranscription.js +51 -0
- package/dist/useUndo.js +33 -0
- package/dist/useUndoLog.js +44 -0
- package/dist/useUpload.js +296 -0
- package/dist/useWindowedSubscription.js +65 -0
- package/dist/useWorkflow.js +284 -0
- package/dist/useWorkflowRunState.js +93 -0
- package/dist/validation.js +39 -0
- package/dist/validationMessages.js +5 -0
- package/package.json +7 -2
- package/dist/authRefresh-DmfSoCca.js +0 -360
- package/dist/formData-BfpBt7BQ.js +0 -769
- package/dist/queryOnce-D5Y4V1SB.js +0 -55
- package/dist/runRpc-Zfz3w709.js +0 -1172
|
@@ -1,360 +0,0 @@
|
|
|
1
|
-
import { S as e, a as t, c as n, h as r, i, n as a, s as o, u as s } from "./runRpc-Zfz3w709.js";
|
|
2
|
-
import { Context as c, Effect as l, Layer as u, ManagedRuntime as d, MutableList as f, Result as p, Scheduler as m, Schema as h, Stream as g } from "effect";
|
|
3
|
-
import * as _ from "effect/http/Headers";
|
|
4
|
-
import { RpcClient as v, RpcSerialization as y } from "effect/rpc";
|
|
5
|
-
import { compareSurfaces as b, groupShapeDigests as x } from "@voltro/protocol";
|
|
6
|
-
import * as S from "effect/socket/Socket";
|
|
7
|
-
//#region src/clientScheduler.ts
|
|
8
|
-
var C = {
|
|
9
|
-
channel: "timer",
|
|
10
|
-
yield: (e) => {
|
|
11
|
-
setTimeout(e, 0);
|
|
12
|
-
}
|
|
13
|
-
}, w = (e) => {
|
|
14
|
-
let t = f.make();
|
|
15
|
-
return e.port1.onmessage = () => {
|
|
16
|
-
let e = f.take(t);
|
|
17
|
-
e !== f.Empty && e();
|
|
18
|
-
}, e.port1.unref?.(), {
|
|
19
|
-
channel: "message-channel",
|
|
20
|
-
yield: (n) => {
|
|
21
|
-
f.append(t, n), e.port2.postMessage(null);
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
}, T = () => globalThis.window !== void 0 && typeof MessageChannel == "function" ? w(new MessageChannel()) : C, E = (e = T()) => {
|
|
25
|
-
let t = new m.MixedScheduler("async", (t) => {
|
|
26
|
-
let n = !0;
|
|
27
|
-
return e.yield(() => {
|
|
28
|
-
n && t();
|
|
29
|
-
}), () => {
|
|
30
|
-
n = !1;
|
|
31
|
-
};
|
|
32
|
-
});
|
|
33
|
-
return Object.assign(t, { yieldChannel: e.channel });
|
|
34
|
-
}, D = (e, t, n) => {
|
|
35
|
-
try {
|
|
36
|
-
let r = globalThis.location, i = typeof r == "object" && r ? r.href : void 0, a = new URL(e, i);
|
|
37
|
-
if (a.protocol === "wss:" ? a.protocol = "https:" : a.protocol === "ws:" && (a.protocol = "http:"), n !== void 0) return new URL(n, a).toString();
|
|
38
|
-
let o = `/ws/${t}`;
|
|
39
|
-
if (a.pathname === o) a.pathname = `/_voltro/api/${encodeURIComponent(t)}/_voltro/runtime-capabilities`;
|
|
40
|
-
else {
|
|
41
|
-
let e = a.pathname.lastIndexOf("/");
|
|
42
|
-
a.pathname = `${e <= 0 ? "" : a.pathname.slice(0, e)}/_voltro/runtime-capabilities`;
|
|
43
|
-
}
|
|
44
|
-
return a.search = "", a.hash = "", a.toString();
|
|
45
|
-
} catch {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
}, O = async (e, t, n = fetch, r = 1500, i) => {
|
|
49
|
-
let a = D(e, t, i);
|
|
50
|
-
if (a === void 0) return;
|
|
51
|
-
let o = new AbortController(), s = setTimeout(() => o.abort(), r);
|
|
52
|
-
try {
|
|
53
|
-
let e = await n(a, {
|
|
54
|
-
method: "GET",
|
|
55
|
-
headers: { accept: "application/json" },
|
|
56
|
-
cache: "no-store",
|
|
57
|
-
signal: o.signal
|
|
58
|
-
});
|
|
59
|
-
if (!e.ok) return;
|
|
60
|
-
let t = await e.json();
|
|
61
|
-
if (t.protocol !== 1 || typeof t.mutationReplay != "boolean") return;
|
|
62
|
-
let r = (e) => typeof e == "object" && e && !Array.isArray(e) && Object.values(e).every((e) => typeof e == "string") ? e : void 0, i = r(t.surface), s = r(t.serviceSurface);
|
|
63
|
-
return {
|
|
64
|
-
protocol: 1,
|
|
65
|
-
mutationReplay: t.mutationReplay,
|
|
66
|
-
...i === void 0 ? {} : { surface: i },
|
|
67
|
-
...s === void 0 ? {} : { serviceSurface: s }
|
|
68
|
-
};
|
|
69
|
-
} catch {
|
|
70
|
-
return;
|
|
71
|
-
} finally {
|
|
72
|
-
clearTimeout(s), o.abort();
|
|
73
|
-
}
|
|
74
|
-
}, k = class {
|
|
75
|
-
#e;
|
|
76
|
-
#t;
|
|
77
|
-
#n;
|
|
78
|
-
#r = /* @__PURE__ */ new Set();
|
|
79
|
-
getSnapshot = () => this.#n;
|
|
80
|
-
subscribe = (e) => (this.#r.add(e), () => {
|
|
81
|
-
this.#r.delete(e);
|
|
82
|
-
});
|
|
83
|
-
begin() {
|
|
84
|
-
let e = {};
|
|
85
|
-
return this.#e = e, this.#i(), {
|
|
86
|
-
open: () => {
|
|
87
|
-
if (this.#e === e) return this.#n === void 0 && (this.#t = new AbortController(), this.#n = Object.freeze({ signal: this.#t.signal }), this.#a()), this.#e === e ? this.#n : void 0;
|
|
88
|
-
},
|
|
89
|
-
close: () => {
|
|
90
|
-
this.#e === e && (this.#e = void 0, this.#i());
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
#i() {
|
|
95
|
-
let e = this.#t, t = this.#n !== void 0;
|
|
96
|
-
this.#t = void 0, this.#n = void 0, e?.abort(), t && this.#a();
|
|
97
|
-
}
|
|
98
|
-
#a() {
|
|
99
|
-
for (let e of this.#r) try {
|
|
100
|
-
e();
|
|
101
|
-
} catch {}
|
|
102
|
-
}
|
|
103
|
-
}, A = /* @__PURE__ */ new WeakMap(), j = (e, t) => {
|
|
104
|
-
A.set(e, t);
|
|
105
|
-
}, M = (e) => A.get(e), N = async (t, n, r, i) => {
|
|
106
|
-
if (r !== void 0) try {
|
|
107
|
-
let a = await r({
|
|
108
|
-
apiName: t,
|
|
109
|
-
descriptors: i
|
|
110
|
-
});
|
|
111
|
-
return e(t, "runtime.mirror", {
|
|
112
|
-
generation: n,
|
|
113
|
-
mirrored: a !== void 0
|
|
114
|
-
}), a;
|
|
115
|
-
} catch (r) {
|
|
116
|
-
e(t, "runtime.mirror", {
|
|
117
|
-
generation: n,
|
|
118
|
-
mirrored: !1,
|
|
119
|
-
errorName: r instanceof Error ? r.name : typeof r
|
|
120
|
-
});
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
}, P = (e, t = new k()) => {
|
|
124
|
-
let n;
|
|
125
|
-
return {
|
|
126
|
-
wrap: (e) => S.Socket.of({
|
|
127
|
-
...e,
|
|
128
|
-
reader: l.gen(function* () {
|
|
129
|
-
let r = t.begin();
|
|
130
|
-
yield* l.addFinalizer(() => l.sync(() => {
|
|
131
|
-
n === r && (n = void 0), r.close();
|
|
132
|
-
}));
|
|
133
|
-
let i = yield* e.reader;
|
|
134
|
-
return n = r, i;
|
|
135
|
-
})
|
|
136
|
-
}),
|
|
137
|
-
hooks: {
|
|
138
|
-
onConnect: l.sync(() => {
|
|
139
|
-
let t = n;
|
|
140
|
-
n = void 0, t?.open() !== void 0 && e();
|
|
141
|
-
}),
|
|
142
|
-
onDisconnect: l.void
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
}, F = 3, I = (t, n, r) => {
|
|
146
|
-
let i;
|
|
147
|
-
try {
|
|
148
|
-
i = b(x(n), r);
|
|
149
|
-
} catch {
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
let { differing: a, missingHere: o } = i;
|
|
153
|
-
if (a.length === 0 && o.length === 0) return;
|
|
154
|
-
e(t, "runtime.surface-mismatch", {
|
|
155
|
-
differing: a.length,
|
|
156
|
-
missingHere: o.length,
|
|
157
|
-
first: a[0] ?? o[0] ?? null
|
|
158
|
-
});
|
|
159
|
-
let s = [...a, ...o].slice(0, F), c = a.length + o.length - s.length;
|
|
160
|
-
console.warn(`[voltro] the api client this page loaded does not match what the '${t}' server binds: ${s.join(", ")}${c > 0 ? ` and ${c} more` : ""}. Responses for those procedures may decode against the wrong schema — a field the server sends and this client does not know is dropped silently. Reload; if it persists, stop the dev server, delete \`.framework/.vite\`, and start it again.`);
|
|
161
|
-
}, L = async (n) => {
|
|
162
|
-
let { name: i, wsUrl: f, group: b, headers: x, webSocketConstructor: C } = n, w = n.generation ?? 0;
|
|
163
|
-
e(i, "runtime.build-started", { generation: w });
|
|
164
|
-
let T = n.errorBus ?? new s(), D = n.recovery ?? t(T, i), A = o(D.options.retry, (t, n) => {
|
|
165
|
-
e(i, "socket.retry-scheduled", {
|
|
166
|
-
generation: w,
|
|
167
|
-
attempt: t,
|
|
168
|
-
delayMs: n,
|
|
169
|
-
owner: "socket"
|
|
170
|
-
});
|
|
171
|
-
});
|
|
172
|
-
O(f, i, fetch, 1500, D.options.capabilitiesUrl).then((t) => {
|
|
173
|
-
D.setMutationReplaySupported(t?.mutationReplay === !0, w), e(i, "runtime.capabilities", {
|
|
174
|
-
mutationReplay: t?.mutationReplay === !0,
|
|
175
|
-
discovered: t !== void 0
|
|
176
|
-
});
|
|
177
|
-
let r = n.surfaceAudience === "service" ? t?.serviceSurface : t?.surface;
|
|
178
|
-
r !== void 0 && I(i, b, r);
|
|
179
|
-
});
|
|
180
|
-
let M = n.descriptors ?? {}, F = await N(i, w, n.mirror, M), L = new r({
|
|
181
|
-
errorBus: T,
|
|
182
|
-
apiName: i,
|
|
183
|
-
...F === void 0 ? {} : { mirror: F }
|
|
184
|
-
}), R = new k(), z;
|
|
185
|
-
class B extends c.Service()(`@voltro/client/AppClient/${i}`) {}
|
|
186
|
-
let V = u.succeed(S.WebSocketConstructor, C), H = S.layerWebSocket(f).pipe(u.provide(V)), U = P(() => {
|
|
187
|
-
A.reset();
|
|
188
|
-
let t = 0;
|
|
189
|
-
z !== void 0 && (t = L.resumeTransportFailures(z)), e(i, "protocol.ready", {
|
|
190
|
-
generation: w,
|
|
191
|
-
resumed: t
|
|
192
|
-
}), D.protocolReady();
|
|
193
|
-
}, R), W = u.effect(S.Socket, l.map(S.Socket, U.wrap)).pipe(u.provide(H)), G = u.effect(v.Protocol, v.makeProtocolSocket({ retryPolicy: A.schedule })).pipe(u.provide(y.layerJson), u.provide(W), u.provide(u.succeed(v.ConnectionHooks, U.hooks))), K = typeof x == "function" ? await x() : x, q = u.effect(B, v.make(b)).pipe(u.provide(G)), J = K ? u.succeed(v.CurrentHeaders, _.fromInput(K)) : u.empty, Y = E(), X = d.make(u.merge(q, J).pipe(u.provideMerge(u.succeed(m.Scheduler, Y))));
|
|
194
|
-
z = X, j(z, R);
|
|
195
|
-
try {
|
|
196
|
-
let t = await X.runPromise(B);
|
|
197
|
-
e(i, "runtime.resolved", {
|
|
198
|
-
generation: w,
|
|
199
|
-
scheduler: Y.yieldChannel
|
|
200
|
-
});
|
|
201
|
-
let n = (F?.warmTags ?? []).filter((e) => {
|
|
202
|
-
let t = M[e]?.input;
|
|
203
|
-
return t !== void 0 && p.isSuccess(h.decodeUnknownResult(t)({}));
|
|
204
|
-
}).map((e) => [e, {}]);
|
|
205
|
-
for (let [e, r] of [...F?.warm ?? [], ...n]) {
|
|
206
|
-
let n = M[e]?.source;
|
|
207
|
-
L.subscribe([e, r], () => g.suspend(() => a(t, e)(r)), X, () => {}, n === void 0 ? {} : { source: n });
|
|
208
|
-
}
|
|
209
|
-
return {
|
|
210
|
-
runtime: X,
|
|
211
|
-
client: t,
|
|
212
|
-
cache: L,
|
|
213
|
-
errorBus: T,
|
|
214
|
-
recovery: D
|
|
215
|
-
};
|
|
216
|
-
} catch (t) {
|
|
217
|
-
throw e(i, "runtime.failed", {
|
|
218
|
-
generation: w,
|
|
219
|
-
errorName: t instanceof Error ? t.name : typeof t
|
|
220
|
-
}), X.dispose(), t;
|
|
221
|
-
}
|
|
222
|
-
}, R = (e, t, n) => ({
|
|
223
|
-
resolved: null,
|
|
224
|
-
retryToken: 0,
|
|
225
|
-
failureCount: 0,
|
|
226
|
-
generation: 0,
|
|
227
|
-
reconnectStatusDispose: null,
|
|
228
|
-
everOpened: !1,
|
|
229
|
-
wedgeStop: null,
|
|
230
|
-
subjectMayHaveChanged: !1,
|
|
231
|
-
errorBus: e,
|
|
232
|
-
recovery: t,
|
|
233
|
-
stopRecoveryError: e.on((e) => t.observeError(e)),
|
|
234
|
-
stopRecoverySuccess: e.onSuccess((e) => t.observeSuccess(e)),
|
|
235
|
-
ownsRecovery: n
|
|
236
|
-
}), z = (e) => {
|
|
237
|
-
e.wedgeStop !== null && (e.wedgeStop(), e.wedgeStop = null);
|
|
238
|
-
}, B = (e) => {
|
|
239
|
-
e.cache.destroy(e.runtime), e.runtime.dispose();
|
|
240
|
-
}, V = (t) => {
|
|
241
|
-
let r = t.apis, a = t.buildClient, o = t.onChange, c = t.stableWindowMs ?? 5e3, l = t.scheduler?.setTimeout ?? ((e, t) => setTimeout(e, t)), u = t.scheduler?.clearTimeout ?? ((e) => {
|
|
242
|
-
clearTimeout(e);
|
|
243
|
-
}), d = t.scheduler?.queueMicrotask ?? queueMicrotask, f = t.onReconnecting, p = t.wedgeBackstop, m = /* @__PURE__ */ new Map();
|
|
244
|
-
for (let e of r) {
|
|
245
|
-
let n = t.errorBusFor?.(e.name) ?? new s(), r = t.recoveryFor?.(e.name, e.recovery), a = r ?? new i(e.name, e.recovery);
|
|
246
|
-
m.set(e.name, R(n, a, r === void 0));
|
|
247
|
-
}
|
|
248
|
-
let h = !1, g = /* @__PURE__ */ new Set(), _ = (e, t) => {
|
|
249
|
-
let n = l(() => {
|
|
250
|
-
g.delete(n), e();
|
|
251
|
-
}, t);
|
|
252
|
-
return g.add(n), n;
|
|
253
|
-
}, v = () => {
|
|
254
|
-
if (h) return;
|
|
255
|
-
let e = /* @__PURE__ */ new Map();
|
|
256
|
-
for (let [t, n] of m) n.resolved && e.set(t, n.resolved);
|
|
257
|
-
o(e, r.every((t) => e.has(t.name)));
|
|
258
|
-
}, y = (e, t) => {
|
|
259
|
-
t.failureCount += 1, !t.reconnectStatusDispose && f && (t.reconnectStatusDispose = f(e.name)), p && t.everOpened && t.failureCount >= p.afterFailures && t.wedgeStop === null && (t.wedgeStop = p.arm(e.name));
|
|
260
|
-
}, b = (r) => {
|
|
261
|
-
if (h) return;
|
|
262
|
-
let i = m.get(r.name);
|
|
263
|
-
if (!i) return;
|
|
264
|
-
y(r, i);
|
|
265
|
-
let a = t.retryDelayMs?.(i.failureCount) ?? n(i.recovery.options.retry, i.failureCount);
|
|
266
|
-
e(r.name, "socket.retry-scheduled", {
|
|
267
|
-
generation: i.generation,
|
|
268
|
-
attempt: i.failureCount,
|
|
269
|
-
delayMs: a,
|
|
270
|
-
owner: "runtime-build"
|
|
271
|
-
});
|
|
272
|
-
let o = ++i.retryToken;
|
|
273
|
-
_(() => {
|
|
274
|
-
h || i.retryToken === o && (i.generation += 1, x(r));
|
|
275
|
-
}, a);
|
|
276
|
-
}, x = async (t) => {
|
|
277
|
-
if (h) return;
|
|
278
|
-
let n = m.get(t.name);
|
|
279
|
-
if (!n) return;
|
|
280
|
-
let r = n.generation, i = () => {
|
|
281
|
-
if (h || n.generation !== r) return;
|
|
282
|
-
n.everOpened = !0, z(n), n.reconnectStatusDispose &&= (n.reconnectStatusDispose(), null), n.retryToken++;
|
|
283
|
-
let e = n.failureCount;
|
|
284
|
-
_(() => {
|
|
285
|
-
h || n.failureCount === e && (n.failureCount = 0);
|
|
286
|
-
}, c);
|
|
287
|
-
}, o = (e) => {
|
|
288
|
-
h || n.generation !== r || (n.recovery.transportIssue(), y(t, n));
|
|
289
|
-
};
|
|
290
|
-
try {
|
|
291
|
-
let s = await a(t, r, i, o, n.errorBus, n.recovery);
|
|
292
|
-
if (h || n.generation !== r) {
|
|
293
|
-
B(s);
|
|
294
|
-
return;
|
|
295
|
-
}
|
|
296
|
-
let c = n.resolved, l = n.subjectMayHaveChanged, u = c && !l ? s.cache.seedStaleFrom(c.cache) : 0;
|
|
297
|
-
n.subjectMayHaveChanged = !1, n.resolved = s, e(t.name, "runtime.swapped", {
|
|
298
|
-
generation: r,
|
|
299
|
-
replaced: c !== null,
|
|
300
|
-
seeded: u,
|
|
301
|
-
subjectMayHaveChanged: l
|
|
302
|
-
}), v(), c && B(c);
|
|
303
|
-
} catch {
|
|
304
|
-
if (h || n.generation !== r) return;
|
|
305
|
-
b(t);
|
|
306
|
-
}
|
|
307
|
-
}, S = (e) => {
|
|
308
|
-
if (!h) for (let t of r) {
|
|
309
|
-
let n = m.get(t.name);
|
|
310
|
-
n && (e && (n.subjectMayHaveChanged = !0), n.retryToken += 1, n.generation += 1, e && n.recovery.resetForSubjectChange(n.generation), n.failureCount = 0, z(n), x(t));
|
|
311
|
-
}
|
|
312
|
-
};
|
|
313
|
-
return r.length === 0 ? (o(/* @__PURE__ */ new Map(), !0), {
|
|
314
|
-
dispose: () => {
|
|
315
|
-
h = !0;
|
|
316
|
-
},
|
|
317
|
-
reconnect: () => {},
|
|
318
|
-
refreshAuth: () => {}
|
|
319
|
-
}) : (d(() => {
|
|
320
|
-
if (!h) for (let e of r) x(e);
|
|
321
|
-
}), {
|
|
322
|
-
dispose: () => {
|
|
323
|
-
if (!h) {
|
|
324
|
-
h = !0;
|
|
325
|
-
for (let e of g) u(e);
|
|
326
|
-
g.clear();
|
|
327
|
-
for (let [, e] of m) e.resolved && B(e.resolved), e.reconnectStatusDispose && e.reconnectStatusDispose(), z(e), e.stopRecoveryError(), e.stopRecoverySuccess(), e.ownsRecovery && e.recovery.dispose();
|
|
328
|
-
for (let t of r) e(t.name, "runtime.disposed");
|
|
329
|
-
m.clear();
|
|
330
|
-
}
|
|
331
|
-
},
|
|
332
|
-
reconnect: () => {
|
|
333
|
-
S(!0);
|
|
334
|
-
},
|
|
335
|
-
refreshAuth: () => {
|
|
336
|
-
S(!1);
|
|
337
|
-
}
|
|
338
|
-
});
|
|
339
|
-
}, H = 0, U = () => {
|
|
340
|
-
let e = typeof crypto < "u" ? crypto : void 0;
|
|
341
|
-
return e && typeof e.randomUUID == "function" ? e.randomUUID() : `idem_${Date.now().toString(36)}_${H += 1}`;
|
|
342
|
-
}, W = (e, t) => e.pipe(l.updateService(v.CurrentHeaders, (e) => _.set(e, "idempotency-key", t))), G = (e) => e?._tag === "Unauthenticated", K = (e, t, n = {}) => {
|
|
343
|
-
let r = n.cooldownMs ?? 15e3, i = n.maxConsecutive ?? 3, a = n.now ?? (() => Date.now()), o = -Infinity, s = 0, c = e.on((e) => {
|
|
344
|
-
if (!G(e.error) || s >= i) return;
|
|
345
|
-
let n = a();
|
|
346
|
-
n - o < r || (o = n, s += 1, t());
|
|
347
|
-
}), l = e.onSuccess(() => {
|
|
348
|
-
s = 0;
|
|
349
|
-
});
|
|
350
|
-
return {
|
|
351
|
-
dispose: () => {
|
|
352
|
-
c(), l();
|
|
353
|
-
},
|
|
354
|
-
noteSuccess: () => {
|
|
355
|
-
s = 0;
|
|
356
|
-
}
|
|
357
|
-
};
|
|
358
|
-
};
|
|
359
|
-
//#endregion
|
|
360
|
-
export { V as a, M as c, W as i, K as n, L as o, U as r, P as s, G as t };
|