@voltro/client 0.89.2 → 0.90.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 +1822 -0
- package/README.md +22 -0
- package/dist/analytics.d.ts +68 -0
- package/dist/analytics.js +1 -0
- package/dist/awaitResolvedApi.js +45 -19
- package/dist/bootstrap.d.ts +0 -115
- package/dist/connectionSetupController.js +93 -61
- package/dist/index.d.ts +148 -162
- package/dist/index.js +87 -85
- package/dist/invocationWait.js +14 -0
- package/dist/mutationsBus.js +92 -35
- package/dist/outbox.js +147 -118
- package/dist/outboxState.js +7 -0
- package/dist/query.js +3 -10
- package/dist/rpcCallOnce.js +30 -0
- package/dist/rpcDeclared.js +7 -0
- package/dist/runRpc.js +9 -6
- package/dist/runtime.d.ts +16 -116
- package/dist/runtime.js +16 -16
- package/dist/traceBus.js +7 -1
- package/dist/unknownRpcTag.js +7 -0
- package/dist/uploadBytes.js +83 -0
- package/dist/uploadClient.js +153 -0
- package/dist/useAction.js +146 -72
- package/dist/useMutation.js +220 -133
- package/dist/useRpcCaller.js +74 -12
- package/dist/useRpcInvocationOwner.js +29 -0
- package/dist/useSubscription.js +52 -49
- package/dist/useTranscription.js +114 -42
- package/dist/useUpload.js +160 -242
- package/dist/useWorkflow.js +111 -246
- package/dist/workflowClient.js +126 -0
- package/package.json +7 -2
package/dist/outbox.js
CHANGED
|
@@ -2,211 +2,240 @@ import { recoveryCoordinatorFor as e } from "./recoveryCoordinator.js";
|
|
|
2
2
|
import { FrameworkRuntimesContext as t, isUnresolvedApi as n } from "./frameworkRuntimesContext.js";
|
|
3
3
|
import { resolveByTag as r } from "./tagWalk.js";
|
|
4
4
|
import { runRpcPromise as i } from "./runRpc.js";
|
|
5
|
-
import { awaitResolvedApi as
|
|
6
|
-
import { withIdempotencyKey as
|
|
7
|
-
import { useApiOnline as
|
|
8
|
-
import { OutboxState as
|
|
9
|
-
import { useCallback as
|
|
5
|
+
import { awaitResolvedApi as ee } from "./awaitResolvedApi.js";
|
|
6
|
+
import { withIdempotencyKey as te } from "./mutationIdentity.js";
|
|
7
|
+
import { useApiOnline as a } from "./useApiOnline.js";
|
|
8
|
+
import { OutboxState as o } from "./outboxState.js";
|
|
9
|
+
import { useCallback as s, useContext as c, useEffect as l, useMemo as ne, useRef as u, useState as d } from "react";
|
|
10
10
|
// src/outbox.ts
|
|
11
|
-
var
|
|
11
|
+
var f = (e, t, n, r, i) => [...e, {
|
|
12
12
|
id: t,
|
|
13
13
|
tag: n,
|
|
14
14
|
input: r,
|
|
15
15
|
status: "pending",
|
|
16
16
|
attempts: 0,
|
|
17
17
|
...i === void 0 ? {} : { stamp: i }
|
|
18
|
-
}],
|
|
18
|
+
}], p = (e, t, n) => e.map((e) => e.id === t ? {
|
|
19
19
|
...e,
|
|
20
20
|
...n
|
|
21
|
-
} : e),
|
|
21
|
+
} : e), m = (e, t) => p(e, t, { status: "sent" }), h = (e, t, n) => e.map((e) => e.id === t ? {
|
|
22
22
|
...e,
|
|
23
23
|
status: "failed",
|
|
24
24
|
error: n,
|
|
25
25
|
attempts: e.attempts + 1
|
|
26
|
-
} : e),
|
|
26
|
+
} : e), g = (e, t, n) => p(e, t, {
|
|
27
27
|
status: "conflict",
|
|
28
28
|
error: n
|
|
29
|
-
}),
|
|
29
|
+
}), _ = (e, t, n) => e.map((e) => e.id === t && e.status === "conflict" ? {
|
|
30
30
|
...e,
|
|
31
31
|
input: n,
|
|
32
32
|
status: "pending",
|
|
33
33
|
error: void 0
|
|
34
|
-
} : e),
|
|
34
|
+
} : e), v = (e) => e.filter((e) => e.status !== "sent"), y = (e) => {
|
|
35
35
|
let t = [];
|
|
36
36
|
for (let n of e) {
|
|
37
37
|
if (n.status === "conflict") break;
|
|
38
38
|
(n.status === "pending" || n.status === "failed") && t.push(n);
|
|
39
39
|
}
|
|
40
40
|
return t;
|
|
41
|
-
},
|
|
41
|
+
}, b = (e) => {
|
|
42
42
|
let t = e;
|
|
43
43
|
return t?.conflict === !0 || t?._tag === "UndoBoundaryError" && t?.boundary === "conflict";
|
|
44
|
-
},
|
|
44
|
+
}, x = (e) => {
|
|
45
45
|
let t = Math.min(3e4, 1e3 * 2 ** Math.max(0, e - 1));
|
|
46
46
|
return t / 2 + t / 2 * Math.random();
|
|
47
|
-
},
|
|
48
|
-
let { persistence:
|
|
49
|
-
if (
|
|
50
|
-
let
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}, [
|
|
54
|
-
let
|
|
55
|
-
|
|
56
|
-
let [
|
|
57
|
-
|
|
58
|
-
let
|
|
59
|
-
e(
|
|
60
|
-
}, []),
|
|
61
|
-
|
|
62
|
-
let
|
|
63
|
-
|
|
64
|
-
let
|
|
65
|
-
|
|
66
|
-
if (
|
|
67
|
-
let
|
|
68
|
-
|
|
47
|
+
}, S = (f) => {
|
|
48
|
+
let { persistence: p, isConflict: m = b, idFor: h, api: g } = f;
|
|
49
|
+
if (f.send === void 0 && g === void 0) throw Error("useOutbox: pass `send`, or `api` to send through that api's own mutations.");
|
|
50
|
+
let _ = c(t), y = _?.demand;
|
|
51
|
+
l(() => {
|
|
52
|
+
g !== void 0 && y?.(g);
|
|
53
|
+
}, [y, g]);
|
|
54
|
+
let S = g === void 0 || _ === null ? void 0 : _.get(g), C = u(S);
|
|
55
|
+
C.current = S;
|
|
56
|
+
let [re, w] = d(0), [T, E] = d(0), D = a(g), O = f.online ?? D, k = u(void 0), A = u(0);
|
|
57
|
+
k.current === void 0 && (k.current = new o());
|
|
58
|
+
let j = ne(() => k.current.snapshot(), [re]), M = s((e) => {
|
|
59
|
+
e(k.current), w((e) => e + 1);
|
|
60
|
+
}, []), N = u(f.retryDelay ?? x);
|
|
61
|
+
N.current = f.retryDelay ?? x;
|
|
62
|
+
let P = u(f.stamp);
|
|
63
|
+
P.current = f.stamp;
|
|
64
|
+
let F = u(async () => void 0);
|
|
65
|
+
F.current = f.send ?? (async (t) => {
|
|
66
|
+
if (C.current === void 0) throw Error(`useOutbox: no mounted api '${g}' — render it inside the framework's runtime provider.`);
|
|
67
|
+
let n = C.current, a = n.subjectSignal ?? (n.recovery ?? e(n.errorBus, g)).subjectSignal, o = await ee(C, g, t.tag, a);
|
|
68
|
+
if (a?.throwIfAborted(), n.recovery !== void 0 && n.recovery !== o.recovery) throw Error("Outbox API ownership changed before the queued write started");
|
|
69
|
+
let s = r(o.client, t.tag);
|
|
70
|
+
await i(o.runtime, te(s(t.input), t.id), { signal: a });
|
|
69
71
|
});
|
|
70
|
-
let
|
|
71
|
-
|
|
72
|
-
let
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
let I = u(m);
|
|
73
|
+
I.current = m;
|
|
74
|
+
let L = u(void 0), R = u(!1), z = u(!0);
|
|
75
|
+
l(() => (z.current = !0, () => {
|
|
76
|
+
z.current = !1;
|
|
75
77
|
}), []);
|
|
76
|
-
let
|
|
77
|
-
|
|
78
|
-
if (
|
|
79
|
-
let e =
|
|
78
|
+
let B = u(0), V = u(Math.random().toString(36).slice(2, 8)), H = u(p === void 0), [U, W] = d(0), G = S === void 0 ? void 0 : S.recovery ?? e(S.errorBus, g), K = G?.subjectSignal;
|
|
79
|
+
l(() => {
|
|
80
|
+
if (G === void 0) return;
|
|
81
|
+
let e = G.subjectSignal;
|
|
80
82
|
if (e.aborted) return;
|
|
81
83
|
let t = () => {
|
|
82
|
-
|
|
84
|
+
A.current++, L.current = void 0, Z(), k.current.reset(), w((e) => e + 1), H.current = p === void 0, R.current = !1, W((e) => e + 1);
|
|
83
85
|
};
|
|
84
86
|
return e.addEventListener("abort", t, { once: !0 }), () => {
|
|
85
87
|
e.removeEventListener("abort", t);
|
|
86
88
|
};
|
|
87
89
|
}, [
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
]),
|
|
92
|
-
if (
|
|
90
|
+
G,
|
|
91
|
+
p,
|
|
92
|
+
U
|
|
93
|
+
]), l(() => {
|
|
94
|
+
if (p === void 0) return;
|
|
93
95
|
let e = !1;
|
|
94
|
-
return
|
|
95
|
-
e || (
|
|
96
|
+
return H.current = !1, p.load().then((t) => {
|
|
97
|
+
e || (H.current = !0, t.length > 0 && M((e) => e.prepend(t.map((e) => {
|
|
98
|
+
if (e.status !== "conflict" || !(e.error instanceof Error)) return e;
|
|
99
|
+
let t = !1;
|
|
100
|
+
try {
|
|
101
|
+
t = I.current(e.error);
|
|
102
|
+
} catch {}
|
|
103
|
+
return t ? e : {
|
|
104
|
+
...e,
|
|
105
|
+
status: "failed"
|
|
106
|
+
};
|
|
107
|
+
}))), E((e) => e + 1));
|
|
96
108
|
}, () => {
|
|
97
|
-
e || (
|
|
109
|
+
e || (H.current = !0, E((e) => e + 1));
|
|
98
110
|
}), () => {
|
|
99
111
|
e = !0;
|
|
100
112
|
};
|
|
101
113
|
}, [
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
]),
|
|
106
|
-
|
|
114
|
+
p,
|
|
115
|
+
M,
|
|
116
|
+
U
|
|
117
|
+
]), l(() => {
|
|
118
|
+
p !== void 0 && H.current && p.save(v(j)).catch(() => {});
|
|
107
119
|
}, [
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
120
|
+
p,
|
|
121
|
+
j,
|
|
122
|
+
T
|
|
111
123
|
]);
|
|
112
|
-
let
|
|
113
|
-
|
|
114
|
-
if (
|
|
115
|
-
let t =
|
|
124
|
+
let q = u(/* @__PURE__ */ new Set()), J = S === void 0 || n(S) ? void 0 : S.cache;
|
|
125
|
+
l(() => {
|
|
126
|
+
if (J !== void 0 && S !== void 0) for (let e of j) {
|
|
127
|
+
let t = S.descriptors[e.tag]?.targets;
|
|
116
128
|
if (e.status === "pending" || e.status === "failed") {
|
|
117
|
-
if (
|
|
118
|
-
|
|
119
|
-
} else
|
|
129
|
+
if (q.current.delete(e.id), t === void 0 || t.length === 0 || J.hasIntent(e.id) || typeof e.input != "object" || e.input === null) continue;
|
|
130
|
+
J.autoApply(t, e.input, e.id, { standing: !0 });
|
|
131
|
+
} else q.current.has(e.id) || (q.current.add(e.id), e.status === "sent" ? J.confirmByMutation(e.id) : J.revertByMutation(e.id));
|
|
120
132
|
}
|
|
121
133
|
}, [
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
134
|
+
J,
|
|
135
|
+
S,
|
|
136
|
+
j
|
|
125
137
|
]);
|
|
126
|
-
let
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
138
|
+
let Y = s((e, t, n) => {
|
|
139
|
+
if (!z.current || K?.aborted || S !== C.current) throw Error("Outbox ownership changed before enqueue");
|
|
140
|
+
let r = n?.stamp ?? P.current?.();
|
|
141
|
+
if (r !== void 0 && typeof r != "string") throw TypeError("Outbox stamp must be a string");
|
|
142
|
+
let i = h?.() ?? `obx_${V.current}_${B.current++}_${e}`;
|
|
143
|
+
M((n) => n.append({
|
|
144
|
+
id: i,
|
|
130
145
|
tag: e,
|
|
131
146
|
input: t,
|
|
132
147
|
status: "pending",
|
|
133
148
|
attempts: 0,
|
|
134
|
-
...
|
|
135
|
-
})),
|
|
136
|
-
}, [
|
|
149
|
+
...r === void 0 ? {} : { stamp: r }
|
|
150
|
+
})), E((e) => e + 1);
|
|
151
|
+
}, [
|
|
152
|
+
h,
|
|
153
|
+
M,
|
|
154
|
+
K,
|
|
155
|
+
S
|
|
156
|
+
]), X = u(void 0), Z = s(() => {
|
|
137
157
|
X.current !== void 0 && clearTimeout(X.current), X.current = void 0;
|
|
138
158
|
}, []);
|
|
139
|
-
|
|
140
|
-
let Q =
|
|
141
|
-
if (!
|
|
142
|
-
if (
|
|
143
|
-
|
|
144
|
-
let e = Promise.resolve().then(async () => {
|
|
145
|
-
for (;
|
|
146
|
-
let
|
|
147
|
-
if (
|
|
159
|
+
l(() => Z, [Z]);
|
|
160
|
+
let Q = s(() => {
|
|
161
|
+
if (!H.current || !z.current) return Promise.resolve();
|
|
162
|
+
if (L.current !== void 0) return L.current;
|
|
163
|
+
R.current = !1, Z();
|
|
164
|
+
let e = A.current, t = Promise.resolve().then(async () => {
|
|
165
|
+
for (; z.current && A.current === e;) {
|
|
166
|
+
let t = k.current.next();
|
|
167
|
+
if (t === void 0) break;
|
|
148
168
|
try {
|
|
149
|
-
if (await
|
|
150
|
-
|
|
169
|
+
if (await F.current(t), !z.current || A.current !== e) break;
|
|
170
|
+
M((e) => e.update(t.id, (e) => ({
|
|
151
171
|
...e,
|
|
152
172
|
status: "sent"
|
|
153
173
|
})));
|
|
154
|
-
} catch (
|
|
155
|
-
if (!
|
|
156
|
-
let
|
|
157
|
-
|
|
174
|
+
} catch (n) {
|
|
175
|
+
if (!z.current || A.current !== e) break;
|
|
176
|
+
let r = I.current(n);
|
|
177
|
+
M((e) => e.update(t.id, (e) => r ? {
|
|
158
178
|
...e,
|
|
159
179
|
status: "conflict",
|
|
160
|
-
error:
|
|
180
|
+
error: n
|
|
161
181
|
} : {
|
|
162
182
|
...e,
|
|
163
183
|
status: "failed",
|
|
164
|
-
error:
|
|
184
|
+
error: n,
|
|
165
185
|
attempts: e.attempts + 1
|
|
166
|
-
})),
|
|
186
|
+
})), R.current = !0, r || (X.current = setTimeout(() => {
|
|
167
187
|
X.current = void 0, $.current();
|
|
168
|
-
},
|
|
188
|
+
}, N.current(t.attempts + 1)));
|
|
169
189
|
break;
|
|
170
190
|
}
|
|
171
191
|
}
|
|
172
192
|
}).finally(() => {
|
|
173
|
-
|
|
193
|
+
L.current === t && (L.current = void 0);
|
|
174
194
|
});
|
|
175
|
-
return
|
|
176
|
-
}, [
|
|
177
|
-
$.current = Q,
|
|
178
|
-
|
|
195
|
+
return L.current = t, t;
|
|
196
|
+
}, [M, Z]), $ = u(Q);
|
|
197
|
+
$.current = Q, l(() => {
|
|
198
|
+
O ? Q() : Z();
|
|
179
199
|
}, [
|
|
180
|
-
|
|
200
|
+
O,
|
|
181
201
|
Q,
|
|
182
202
|
Z
|
|
183
|
-
]),
|
|
184
|
-
|
|
203
|
+
]), l(() => {
|
|
204
|
+
O && !R.current && Q();
|
|
185
205
|
}, [
|
|
206
|
+
T,
|
|
186
207
|
O,
|
|
187
|
-
j,
|
|
188
208
|
Q
|
|
189
209
|
]);
|
|
190
|
-
let
|
|
191
|
-
|
|
210
|
+
let ie = s((e, t) => {
|
|
211
|
+
z.current && !K?.aborted && S === C.current && (M((n) => n.update(e, (e) => e.status === "conflict" ? {
|
|
192
212
|
...e,
|
|
193
213
|
input: t,
|
|
194
214
|
status: "pending",
|
|
195
215
|
error: void 0
|
|
196
|
-
} : e)),
|
|
216
|
+
} : e)), O && Q());
|
|
197
217
|
}, [
|
|
198
|
-
|
|
218
|
+
O,
|
|
219
|
+
Q,
|
|
220
|
+
M,
|
|
221
|
+
K,
|
|
222
|
+
S
|
|
223
|
+
]), ae = s((e) => !z.current || K?.aborted || S !== C.current || !k.current.snapshot().some((t) => t.id === e && t.status === "conflict") || (J?.revertByMutation(e), !z.current || K?.aborted || S !== C.current) || !k.current.discardConflict(e) ? !1 : (q.current.delete(e), R.current = !1, w((e) => e + 1), E((e) => e + 1), O && Q(), !0), [
|
|
224
|
+
O,
|
|
199
225
|
Q,
|
|
200
|
-
|
|
226
|
+
J,
|
|
227
|
+
K,
|
|
228
|
+
S
|
|
201
229
|
]);
|
|
202
230
|
return {
|
|
203
|
-
queue:
|
|
204
|
-
enqueue:
|
|
231
|
+
queue: j,
|
|
232
|
+
enqueue: Y,
|
|
205
233
|
replay: Q,
|
|
206
|
-
online:
|
|
207
|
-
pending:
|
|
208
|
-
conflicts:
|
|
209
|
-
resolveConflict:
|
|
234
|
+
online: O,
|
|
235
|
+
pending: j.reduce((e, t) => e + +(t.status === "pending" || t.status === "failed"), 0),
|
|
236
|
+
conflicts: j.filter((e) => e.status === "conflict"),
|
|
237
|
+
resolveConflict: ie,
|
|
238
|
+
discardConflict: ae
|
|
210
239
|
};
|
|
211
240
|
};
|
|
212
|
-
export {
|
|
241
|
+
export { v as clearSent, x as defaultOutboxRetryDelay, f as enqueueEntry, g as markConflict, h as markFailed, m as markSent, y as replayable, _ as resolveConflictEntry, S as useOutbox };
|
package/dist/outboxState.js
CHANGED
|
@@ -30,6 +30,13 @@ var e = class {
|
|
|
30
30
|
e !== r && (this.entries[n] = r, r.status !== "sent" && n < this.cursor && (this.cursor = n), this.cached = void 0);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
+
discardConflict(e) {
|
|
34
|
+
if (!(this.positions.get(e) ?? []).some((e) => this.entries[e].status === "conflict")) return !1;
|
|
35
|
+
let t = this.entries.filter((t) => t.id !== e || t.status !== "conflict");
|
|
36
|
+
this.reset();
|
|
37
|
+
for (let e of t) this.append(e);
|
|
38
|
+
return !0;
|
|
39
|
+
}
|
|
33
40
|
next() {
|
|
34
41
|
for (; this.cursor < this.entries.length;) {
|
|
35
42
|
let e = this.entries[this.cursor];
|
package/dist/query.js
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { runRpcPromise as t } from "./runRpc.js";
|
|
3
|
-
import { awaitResolvedApi as n } from "./awaitResolvedApi.js";
|
|
4
|
-
import { Effect as r, Option as i, Stream as a } from "effect";
|
|
5
|
-
import { firstEventValue as o } from "@voltro/protocol";
|
|
1
|
+
import { rpcCallOnce as e } from "./rpcCallOnce.js";
|
|
6
2
|
// src/queryOnce.ts
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
return o(l, g, "[loader.query]");
|
|
10
|
-
};
|
|
11
|
-
export { s as queryOnce };
|
|
3
|
+
var t = async (t, n, r, i, a) => e(t, n, r, i ?? {}, a, "[loader.query]");
|
|
4
|
+
export { t as queryOnce };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { resolveByTag as e } from "./tagWalk.js";
|
|
2
|
+
import { runRpcPromise as t } from "./runRpc.js";
|
|
3
|
+
import { ConnectionPrerequisiteInvalidated as n } from "./connectionPrerequisite.js";
|
|
4
|
+
import { awaitResolvedApi as r, bindResolvedRpcInvocationOwner as i, rpcInvocationOwnerCurrent as a } from "./awaitResolvedApi.js";
|
|
5
|
+
import { Effect as o, Option as s, Stream as c } from "effect";
|
|
6
|
+
import { firstEventValue as l } from "@voltro/protocol";
|
|
7
|
+
// src/rpcCallOnce.ts
|
|
8
|
+
var u = async (u, d, f, p, m, h, g) => {
|
|
9
|
+
let _ = () => {
|
|
10
|
+
if (g && !a(g, u.current)) throw new n("inactive");
|
|
11
|
+
};
|
|
12
|
+
_();
|
|
13
|
+
let v = g?.subject, y = await r(u, d, f, m);
|
|
14
|
+
if (v?.aborted) throw new n("inactive");
|
|
15
|
+
g && i(g, y), _();
|
|
16
|
+
let { runtime: b, client: x } = y;
|
|
17
|
+
m?.throwIfAborted();
|
|
18
|
+
let S = g ? new AbortController() : void 0, C = g ? [.../* @__PURE__ */ new Set([g.subject, ...m ? [m] : []])] : [], w = () => S?.abort();
|
|
19
|
+
for (let e of C) e.aborted ? w() : e.addEventListener("abort", w, { once: !0 });
|
|
20
|
+
try {
|
|
21
|
+
_();
|
|
22
|
+
let n = e(x, f)(p), r = o.isEffect(n), i = r ? n : c.runHead(n).pipe(o.flatMap((e) => s.isNone(e) ? o.fail(/* @__PURE__ */ Error(`${h} ${f}: the query ended before its first snapshot`)) : o.succeed(e.value))), a = await t(b, o.suspend(() => (_(), i)), { signal: S?.signal ?? m });
|
|
23
|
+
return _(), r ? a : l(f, a, h);
|
|
24
|
+
} catch (e) {
|
|
25
|
+
throw _(), e;
|
|
26
|
+
} finally {
|
|
27
|
+
for (let e of C) e.removeEventListener("abort", w);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
export { u as rpcCallOnce };
|
package/dist/runRpc.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { squashRpcCause as e } from "./squashRpcCause.js";
|
|
2
2
|
import { rememberRpcErrorKind as t, rpcErrorKind as n } from "./rpcErrorKind.js";
|
|
3
|
-
import { Cause as r,
|
|
3
|
+
import { Cause as r, Effect as i, Exit as a, Option as o } from "effect";
|
|
4
4
|
// src/runRpc.ts
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
var s = (e) => i.try({
|
|
6
|
+
try: e,
|
|
7
|
+
catch: (e) => t(e, n(e, "client"))
|
|
8
|
+
}).pipe(i.flatten), c = async (i, s, c) => {
|
|
9
|
+
let l = await i.runPromiseExit(s, c?.signal === void 0 ? void 0 : { signal: c.signal });
|
|
10
|
+
if (a.isSuccess(l)) return l.value;
|
|
11
|
+
let u = e(l.cause), d = r.findErrorOption(l.cause), f = o.isSome(d) ? n(d.value, "handler") : "unknown";
|
|
9
12
|
throw t(u, f);
|
|
10
13
|
};
|
|
11
|
-
export {
|
|
14
|
+
export { s as deferRpcMethod, c as runRpcPromise };
|