@voltro/client 0.86.0 → 0.88.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5484 -0
- package/THIRD-PARTY-NOTICES.md +6 -230
- package/dist/analyticsCatalog.js +1 -2
- package/dist/apiConnectivity.js +1 -2
- package/dist/apiRoleTransports.js +47 -0
- package/dist/apiRuntime.js +76 -67
- package/dist/apiSocketTracker.js +20 -0
- package/dist/apiSupervisor.js +17 -7
- package/dist/authRefresh.js +1 -2
- package/dist/awaitResolvedApi.js +5 -6
- package/dist/bootstrap.d.ts +9 -0
- package/dist/bootstrap.js +3 -3
- package/dist/cellMerger.js +1 -2
- package/dist/clientDiagnostics.js +1 -2
- package/dist/clientErrorBus.js +1 -2
- package/dist/clientScheduler.js +1 -2
- package/dist/connectionPrerequisite.js +1 -2
- package/dist/connectionScope.js +15 -4
- package/dist/connectionSetupController.js +1 -2
- package/dist/createHooks.js +1 -2
- package/dist/deepLink.js +1 -2
- package/dist/filters.js +1 -2
- package/dist/form.d.ts +37 -4
- package/dist/form.js +4 -2
- package/dist/formBinding.js +1 -2
- package/dist/formData.js +73 -12
- package/dist/formFlashId.js +1 -2
- package/dist/formRejection.js +22 -0
- package/dist/formSource.js +12 -0
- package/dist/frameworkRuntimesContext.js +1 -2
- package/dist/globalContext.js +1 -2
- package/dist/index.d.ts +99 -20
- package/dist/index.js +57 -54
- package/dist/liveRowSort.js +1 -2
- package/dist/mutationConnectionSetup.js +1 -2
- package/dist/mutationIdentity.js +1 -2
- package/dist/mutationSerialExecution.js +1 -2
- package/dist/mutationsBus.js +1 -2
- package/dist/onlineSource.js +1 -2
- package/dist/outbox.js +1 -2
- package/dist/outboxHttp.js +1 -2
- package/dist/outboxState.js +1 -2
- package/dist/permissions.js +1 -2
- package/dist/platform.js +1 -2
- package/dist/preloadSeed.js +1 -2
- package/dist/provider.js +1 -2
- package/dist/query.js +1 -2
- package/dist/recoveryCoordinator.js +1 -2
- package/dist/recoveryRetry.js +1 -2
- package/dist/richText.js +1 -2
- package/dist/rpcErrorBus.js +1 -2
- package/dist/rpcErrorKind.js +1 -2
- package/dist/runRpc.js +1 -2
- package/dist/runtime.d.ts +17 -2
- package/dist/runtimeCapabilities.js +1 -2
- package/dist/runtimeContext.js +1 -2
- package/dist/schemaFields.js +1 -2
- package/dist/scopeMembership.js +1 -2
- package/dist/seedResolvers.js +1 -2
- package/dist/sequence.js +1 -2
- package/dist/serverRequest.js +12 -9
- package/dist/serviceClient.js +50 -50
- package/dist/squashRpcCause.js +1 -2
- package/dist/stableKey.js +1 -2
- package/dist/store.js +1 -2
- package/dist/storeStorage.js +1 -2
- package/dist/subscriptionCache.js +5 -6
- package/dist/tagWalk.js +1 -2
- package/dist/traceBus.js +1 -2
- package/dist/tracking.js +1 -2
- package/dist/uploadProgress.js +1 -2
- package/dist/useAction.js +1 -2
- package/dist/useAgent.js +1 -2
- package/dist/useAgentChat.js +1 -2
- package/dist/useAgentStream.js +1 -2
- package/dist/useApiOnline.js +1 -2
- package/dist/useCapabilityManifest.js +28 -25
- package/dist/useConnectionSetup.js +1 -2
- package/dist/useConnectionStatus.js +1 -2
- package/dist/useConnections.js +1 -2
- package/dist/useDataCopilot.js +1 -2
- package/dist/useDataTable.js +1 -2
- package/dist/useDerived.js +1 -2
- package/dist/useEvent.js +78 -69
- package/dist/useFormBinding.js +227 -226
- package/dist/useLocalQuery.js +1 -2
- package/dist/useMutation.js +1 -2
- package/dist/useOnRpcError.js +1 -2
- package/dist/usePreloadedSubscription.js +1 -2
- package/dist/usePreview.js +1 -2
- package/dist/useProvenance.js +1 -2
- package/dist/useQueryField.js +1 -2
- package/dist/useRecord.js +1 -2
- package/dist/useRefreshSubscriptions.js +1 -2
- package/dist/useResourceCan.js +1 -2
- package/dist/useResumableAgentStream.js +1 -2
- package/dist/useRpcCaller.js +16 -0
- package/dist/useSequence.js +1 -2
- package/dist/useSkeleton.js +1 -2
- package/dist/useSubscription.js +56 -48
- package/dist/useSubscriptionHealth.js +1 -2
- package/dist/useTranscription.js +1 -2
- package/dist/useUndo.js +1 -2
- package/dist/useUndoLog.js +1 -2
- package/dist/useUpload.js +1 -2
- package/dist/useWindowedSubscription.js +1 -2
- package/dist/useWorkflow.js +1 -2
- package/dist/useWorkflowRunState.js +1 -2
- package/dist/validation.js +1 -2
- package/dist/validationMessages.js +1 -2
- package/package.json +4 -4
package/dist/useAction.js
CHANGED
|
@@ -9,7 +9,7 @@ import { freshIdempotencyKey as c, withIdempotencyKey as l } from "./mutationIde
|
|
|
9
9
|
import { getMutationNotifier as u } from "./useMutation.js";
|
|
10
10
|
import { useCallback as d, useMemo as f, useRef as p, useState as m } from "react";
|
|
11
11
|
import { Effect as h } from "effect";
|
|
12
|
-
|
|
12
|
+
// src/useAction.ts
|
|
13
13
|
var g = (e, t) => {
|
|
14
14
|
if (t === void 0 || typeof e != "object" || !e) return e;
|
|
15
15
|
try {
|
|
@@ -97,5 +97,4 @@ var g = (e, t) => {
|
|
|
97
97
|
O
|
|
98
98
|
]);
|
|
99
99
|
};
|
|
100
|
-
//#endregion
|
|
101
100
|
export { b as useAction };
|
package/dist/useAgent.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useAgentStream as e } from "./useAgentStream.js";
|
|
2
2
|
import { useCallback as t, useEffect as n, useMemo as r, useRef as i, useState as a } from "react";
|
|
3
|
-
|
|
3
|
+
// src/useAgent.ts
|
|
4
4
|
var o = (o, s) => {
|
|
5
5
|
let { events: c, status: l, error: u, start: d, cancel: f } = e(o, s), [p, m] = a([]), h = i(null), g = i({
|
|
6
6
|
events: [],
|
|
@@ -49,5 +49,4 @@ var o = (o, s) => {
|
|
|
49
49
|
cancel: f
|
|
50
50
|
};
|
|
51
51
|
};
|
|
52
|
-
//#endregion
|
|
53
52
|
export { o as useAgent };
|
package/dist/useAgentChat.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useSubscription as e } from "./useSubscription.js";
|
|
2
2
|
import { useAction as t } from "./useAction.js";
|
|
3
3
|
import { useCallback as n, useMemo as r } from "react";
|
|
4
|
-
|
|
4
|
+
// src/useAgentChat.ts
|
|
5
5
|
var i = (e, t) => e.order - t.order || (e.stepOrder ?? 0) - (t.stepOrder ?? 0), a = (e) => {
|
|
6
6
|
for (let t = e.length - 1; t >= 0; --t) {
|
|
7
7
|
let n = e[t];
|
|
@@ -39,5 +39,4 @@ var i = (e, t) => e.order - t.order || (e.stepOrder ?? 0) - (t.stepOrder ?? 0),
|
|
|
39
39
|
h
|
|
40
40
|
]);
|
|
41
41
|
};
|
|
42
|
-
//#endregion
|
|
43
42
|
export { o as useAgentChat };
|
package/dist/useAgentStream.js
CHANGED
|
@@ -3,7 +3,7 @@ import { useFrameworkApi as t } from "./runtimeContext.js";
|
|
|
3
3
|
import { resolveByTag as n } from "./tagWalk.js";
|
|
4
4
|
import { useCallback as r, useEffect as i, useRef as a, useState as o } from "react";
|
|
5
5
|
import { Cause as s, Effect as c, Fiber as l, Stream as u } from "effect";
|
|
6
|
-
|
|
6
|
+
// src/useAgentStream.ts
|
|
7
7
|
var d = (d, f) => {
|
|
8
8
|
let { runtime: p, client: m } = t(d), [h, g] = o([]), [_, v] = o("idle"), [y, b] = o(void 0), x = a(null), S = a(null);
|
|
9
9
|
i(() => () => {
|
|
@@ -60,5 +60,4 @@ var d = (d, f) => {
|
|
|
60
60
|
cancel: C
|
|
61
61
|
};
|
|
62
62
|
};
|
|
63
|
-
//#endregion
|
|
64
63
|
export { d as useAgentStream };
|
package/dist/useApiOnline.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { apiConnectivity as e } from "./apiConnectivity.js";
|
|
2
2
|
import { useCallback as t, useSyncExternalStore as n } from "react";
|
|
3
|
-
|
|
3
|
+
// src/useApiOnline.ts
|
|
4
4
|
var r = () => globalThis.navigator?.onLine !== !1, i = (t) => r() && (e().online(t) ?? !0), a = (t) => {
|
|
5
5
|
let n = e().subscribe(t);
|
|
6
6
|
return typeof window > "u" ? n : (window.addEventListener("online", t), window.addEventListener("offline", t), () => {
|
|
@@ -10,5 +10,4 @@ var r = () => globalThis.navigator?.onLine !== !1, i = (t) => r() && (e().online
|
|
|
10
10
|
let r = t(() => i(e), [e]);
|
|
11
11
|
return n(a, r, () => !0);
|
|
12
12
|
};
|
|
13
|
-
//#endregion
|
|
14
13
|
export { i as readApiOnline, a as subscribeApiOnline, o as useApiOnline };
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { useFrameworkApi as e } from "./runtimeContext.js";
|
|
2
2
|
import { scopeMembership as t } from "./scopeMembership.js";
|
|
3
|
-
import {
|
|
4
|
-
import { useEffect as
|
|
5
|
-
|
|
6
|
-
var
|
|
7
|
-
let { inspectBaseUrl: n } = e(t), [
|
|
3
|
+
import { ADMIN_SCOPE as n, usePermissions as r } from "./permissions.js";
|
|
4
|
+
import { useEffect as i, useState as a } from "react";
|
|
5
|
+
// src/useCapabilityManifest.ts
|
|
6
|
+
var o = (e) => `${e.replace(/\/$/, "")}/_voltro/inspect/manifest`, s = (t) => {
|
|
7
|
+
let { inspectBaseUrl: n } = e(t), [r, s] = a({
|
|
8
8
|
manifest: void 0,
|
|
9
9
|
loading: !0,
|
|
10
10
|
error: void 0
|
|
11
11
|
});
|
|
12
|
-
return
|
|
12
|
+
return i(() => {
|
|
13
13
|
let e = !1;
|
|
14
14
|
return s({
|
|
15
15
|
manifest: void 0,
|
|
16
16
|
loading: !0,
|
|
17
17
|
error: void 0
|
|
18
|
-
}), fetch(
|
|
18
|
+
}), fetch(o(n ?? "")).then(async (e) => {
|
|
19
19
|
if (!e.ok) throw Error(`manifest fetch failed: HTTP ${e.status}`);
|
|
20
20
|
return await e.json();
|
|
21
21
|
}).then((t) => {
|
|
@@ -33,8 +33,8 @@ var a = (e) => `${e.replace(/\/$/, "")}/_voltro/inspect/manifest`, o = (t) => {
|
|
|
33
33
|
}), () => {
|
|
34
34
|
e = !0;
|
|
35
35
|
};
|
|
36
|
-
}, [t, n]),
|
|
37
|
-
},
|
|
36
|
+
}, [t, n]), r;
|
|
37
|
+
}, c = (e) => {
|
|
38
38
|
if (Object.getPrototypeOf(e) !== Array.prototype || Object.hasOwn(e, Symbol.iterator)) return !1;
|
|
39
39
|
for (let t = 0; t < e.length; t++) {
|
|
40
40
|
let n = Object.getOwnPropertyDescriptor(e, String(t));
|
|
@@ -54,24 +54,28 @@ var a = (e) => `${e.replace(/\/$/, "")}/_voltro/inspect/manifest`, o = (t) => {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
return !0;
|
|
57
|
-
},
|
|
57
|
+
}, l = (e, t, n) => t.scope.length === 0 || (t.mode === "any" ? t.scope.some((t) => n?.has(t) ?? e.includes(t)) : t.scope.every((t) => n?.has(t) ?? e.includes(t))), u = (e, r) => {
|
|
58
58
|
if (e === void 0) return "unknown";
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
let i = r.includes(n);
|
|
60
|
+
if (e.length === 0) return "allowed";
|
|
61
|
+
let a = e.length >= 32 && r.length >= 32 && !Object.hasOwn(r, "includes") && !Object.hasOwn(r, Symbol.iterator) && c(e) ? t(r) : void 0, o = !1;
|
|
61
62
|
for (let t of e) if (t.kind !== "open") {
|
|
62
|
-
if (t.kind === "
|
|
63
|
-
else if (
|
|
64
|
-
if (
|
|
63
|
+
if (t.kind === "upgraded") o = !0;
|
|
64
|
+
else if (t.kind === "policy") {
|
|
65
|
+
if (i) continue;
|
|
66
|
+
o = !0;
|
|
67
|
+
} else if (!(i || l(r, t, a))) {
|
|
68
|
+
if (t.resourceScoped) o = !0;
|
|
65
69
|
else return "denied";
|
|
66
70
|
}
|
|
67
71
|
}
|
|
68
|
-
return
|
|
69
|
-
},
|
|
72
|
+
return o ? "unknown" : "allowed";
|
|
73
|
+
}, d = (e) => (e ?? []).flatMap((e) => e.kind === "scope" ? [...e.scope] : []), f = (e) => {
|
|
70
74
|
for (let t of e ?? []) if (t.kind === "open") return t.reason;
|
|
71
|
-
},
|
|
75
|
+
}, p = (e) => u(e, r().scopes), m = (e) => e === void 0 ? {} : {
|
|
72
76
|
tag: e.tag,
|
|
73
77
|
...e.guards === void 0 ? {} : { guards: e.guards }
|
|
74
|
-
},
|
|
78
|
+
}, h = (e) => {
|
|
75
79
|
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
|
|
76
80
|
for (let r of e.procedures) if (r.kind === "query") {
|
|
77
81
|
let e = Array.isArray(r.source) ? r.source : [r.source];
|
|
@@ -90,12 +94,11 @@ var a = (e) => `${e.replace(/\/$/, "")}/_voltro/inspect/manifest`, o = (t) => {
|
|
|
90
94
|
reactive: e.reactive,
|
|
91
95
|
...c === void 0 ? {} : { pkColumn: c },
|
|
92
96
|
editable: (e.editable ?? !0) && c !== void 0,
|
|
93
|
-
list:
|
|
94
|
-
create:
|
|
95
|
-
update:
|
|
96
|
-
delete:
|
|
97
|
+
list: m(r),
|
|
98
|
+
create: m(a),
|
|
99
|
+
update: m(o),
|
|
100
|
+
delete: m(s)
|
|
97
101
|
};
|
|
98
102
|
});
|
|
99
103
|
};
|
|
100
|
-
|
|
101
|
-
export { l as decideAccess, m as deriveEntityAdmins, a as manifestUrl, d as openAccessReason, u as requiredScopes, f as useAccessDecision, o as useCapabilityManifest };
|
|
104
|
+
export { u as decideAccess, h as deriveEntityAdmins, o as manifestUrl, f as openAccessReason, d as requiredScopes, p as useAccessDecision, s as useCapabilityManifest };
|
|
@@ -2,7 +2,7 @@ import { useFrameworkApi as e } from "./runtimeContext.js";
|
|
|
2
2
|
import { awaitResolvedApi as t } from "./awaitResolvedApi.js";
|
|
3
3
|
import { ConnectionSetupController as n } from "./connectionSetupController.js";
|
|
4
4
|
import { useCallback as r, useEffect as i, useMemo as a, useRef as o, useSyncExternalStore as s } from "react";
|
|
5
|
-
|
|
5
|
+
// src/useConnectionSetup.ts
|
|
6
6
|
var c = (c, l) => {
|
|
7
7
|
let u = e(c), d = o(u);
|
|
8
8
|
d.current = u;
|
|
@@ -24,5 +24,4 @@ var c = (c, l) => {
|
|
|
24
24
|
ready: m.status === "ready"
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
|
-
//#endregion
|
|
28
27
|
export { c as useConnectionSetup };
|
|
@@ -2,7 +2,7 @@ import { recordClientDiagnostic as e } from "./clientDiagnostics.js";
|
|
|
2
2
|
import { INITIAL_RECOVERY_SNAPSHOT as t, recoveryCoordinatorFor as n } from "./recoveryCoordinator.js";
|
|
3
3
|
import { useFrameworkApi as r } from "./runtimeContext.js";
|
|
4
4
|
import { useCallback as i, useEffect as a, useSyncExternalStore as o } from "react";
|
|
5
|
-
|
|
5
|
+
// src/useConnectionStatus.ts
|
|
6
6
|
var s = () => typeof navigator > "u" || navigator.onLine, c = () => !0, l = (e) => typeof window > "u" ? () => {} : (window.addEventListener("online", e), window.addEventListener("offline", e), () => {
|
|
7
7
|
window.removeEventListener("online", e), window.removeEventListener("offline", e);
|
|
8
8
|
}), u = (u) => {
|
|
@@ -34,5 +34,4 @@ var s = () => typeof navigator > "u" || navigator.onLine, c = () => !0, l = (e)
|
|
|
34
34
|
reportSuccess: h
|
|
35
35
|
};
|
|
36
36
|
};
|
|
37
|
-
//#endregion
|
|
38
37
|
export { u as useConnectionStatus };
|
package/dist/useConnections.js
CHANGED
|
@@ -2,7 +2,7 @@ import { useSubscription as e } from "./useSubscription.js";
|
|
|
2
2
|
import { useMutation as t } from "./useMutation.js";
|
|
3
3
|
import { useAction as n } from "./useAction.js";
|
|
4
4
|
import { useCallback as r, useMemo as i } from "react";
|
|
5
|
-
|
|
5
|
+
// src/useConnections.ts
|
|
6
6
|
var a = "__voltro.connections.list", o = "__voltro.connections.start", s = "__voltro.connections.submitToken", c = "__voltro.connections.disconnect", l = {
|
|
7
7
|
connectionId: "",
|
|
8
8
|
kind: "oauth2",
|
|
@@ -103,5 +103,4 @@ var a = "__voltro.connections.list", o = "__voltro.connections.start", s = "__vo
|
|
|
103
103
|
n.pending
|
|
104
104
|
]);
|
|
105
105
|
};
|
|
106
|
-
//#endregion
|
|
107
106
|
export { a as CONNECTIONS_LIST_TAG, c as CONNECTION_DISCONNECT_TAG, o as CONNECTION_START_TAG, s as CONNECTION_SUBMIT_TOKEN_TAG, p as useConnection, f as useConnections };
|
package/dist/useDataCopilot.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useAction as e } from "./useAction.js";
|
|
2
2
|
import { useCallback as t, useMemo as n, useState as r } from "react";
|
|
3
|
-
|
|
3
|
+
// src/useDataCopilot.ts
|
|
4
4
|
var i = (i, a) => {
|
|
5
5
|
let o = e(i, a), [s, c] = r(void 0), l = t(async (e) => {
|
|
6
6
|
let t = await o.run({ question: e });
|
|
@@ -20,5 +20,4 @@ var i = (i, a) => {
|
|
|
20
20
|
u
|
|
21
21
|
]);
|
|
22
22
|
};
|
|
23
|
-
//#endregion
|
|
24
23
|
export { i as useDataCopilot };
|
package/dist/useDataTable.js
CHANGED
|
@@ -3,7 +3,7 @@ import { useSubscription as t } from "./useSubscription.js";
|
|
|
3
3
|
import { schemaToColumns as n } from "./schemaFields.js";
|
|
4
4
|
import { createLiveRowSorter as r } from "./liveRowSort.js";
|
|
5
5
|
import { useCallback as i, useMemo as a, useRef as o, useState as s } from "react";
|
|
6
|
-
|
|
6
|
+
// src/useDataTable.ts
|
|
7
7
|
var c = (c, l, u = {}) => {
|
|
8
8
|
let d = e(c), [f, p] = s(u.pageSize), m = a(() => f === void 0 ? u.input ?? {} : {
|
|
9
9
|
...u.input,
|
|
@@ -30,5 +30,4 @@ var c = (c, l, u = {}) => {
|
|
|
30
30
|
hasMore: f !== void 0 && (h.data?.length ?? 0) >= f
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
|
-
//#endregion
|
|
34
33
|
export { c as useDataTable };
|
package/dist/useDerived.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useRef as e } from "react";
|
|
2
|
-
|
|
2
|
+
// src/useDerived.ts
|
|
3
3
|
var t = (e, t) => {
|
|
4
4
|
if (e === t) return !0;
|
|
5
5
|
if (e.length !== t.length) return !1;
|
|
@@ -18,5 +18,4 @@ var t = (e, t) => {
|
|
|
18
18
|
names: s
|
|
19
19
|
}), i.current.value;
|
|
20
20
|
};
|
|
21
|
-
//#endregion
|
|
22
21
|
export { t as shallowArrayEqual, n as sourceValues, r as useDerived };
|
package/dist/useEvent.js
CHANGED
|
@@ -2,87 +2,96 @@ import { recordClientDiagnostic as e } from "./clientDiagnostics.js";
|
|
|
2
2
|
import { isUnresolvedApi as t } from "./frameworkRuntimesContext.js";
|
|
3
3
|
import { useFrameworkApi as n } from "./runtimeContext.js";
|
|
4
4
|
import { resolveByTag as r } from "./tagWalk.js";
|
|
5
|
-
import {
|
|
6
|
-
import { Effect as
|
|
7
|
-
|
|
8
|
-
var
|
|
5
|
+
import { useEffect as i, useLayoutEffect as a, useMemo as o, useRef as s, useState as c } from "react";
|
|
6
|
+
import { Effect as l, Fiber as u, Schedule as d, Stream as f } from "effect";
|
|
7
|
+
// src/useEvent.ts
|
|
8
|
+
var p = {
|
|
9
9
|
status: "idle",
|
|
10
10
|
missed: 0,
|
|
11
11
|
lastMiss: void 0
|
|
12
|
-
},
|
|
12
|
+
}, m = class {
|
|
13
13
|
_tag = "EventStreamClosed";
|
|
14
14
|
};
|
|
15
|
-
function
|
|
16
|
-
let { skip:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
15
|
+
function h(h, g, _, v = {}) {
|
|
16
|
+
let { skip: y = !1, apiName: b = "app", onMissed: x } = v, S = n(b), C = g === null ? null : JSON.stringify(Object.entries(g).sort(([e], [t]) => e < t ? -1 : 1)), w = !y && C !== null && !t(S), T = o(() => ({
|
|
17
|
+
resume: /* @__PURE__ */ new Map(),
|
|
18
|
+
runtime: S.runtime,
|
|
19
|
+
client: S.client,
|
|
20
|
+
subject: S.subjectSignal ?? S.recovery?.subjectSignal,
|
|
21
|
+
key: C === null ? null : Object.fromEntries(JSON.parse(C)),
|
|
22
|
+
tag: h.name,
|
|
23
|
+
apiName: b
|
|
24
|
+
}), [
|
|
25
|
+
S.cache,
|
|
26
|
+
b,
|
|
27
|
+
h.name,
|
|
28
|
+
C,
|
|
29
|
+
w
|
|
30
|
+
]), E = s(null), [D, O] = c(null);
|
|
31
|
+
return a(() => (E.current = {
|
|
32
|
+
scope: T,
|
|
33
|
+
handler: _,
|
|
34
|
+
onMissed: x
|
|
35
|
+
}, () => {
|
|
36
|
+
E.current = null;
|
|
37
|
+
})), i(() => {
|
|
38
|
+
if (!w || T.subject?.aborted) return;
|
|
39
|
+
let t = !1, n = () => !t && !T.subject?.aborted && E.current?.scope === T, i = (e) => {
|
|
40
|
+
n() && O((t) => ({
|
|
41
|
+
scope: T,
|
|
42
|
+
value: e(t?.scope === T ? t.value : p)
|
|
43
|
+
}));
|
|
44
|
+
}, a = (t, r) => {
|
|
45
|
+
!n() || t <= 0 || (e(T.apiName, "event.gap", {
|
|
46
|
+
tag: T.tag,
|
|
47
|
+
missed: t,
|
|
48
|
+
reason: r
|
|
49
|
+
}), i((e) => ({
|
|
50
|
+
...e,
|
|
51
|
+
missed: e.missed + t,
|
|
52
|
+
lastMiss: {
|
|
53
|
+
count: t,
|
|
54
|
+
reason: r
|
|
55
|
+
}
|
|
56
|
+
})), E.current?.onMissed?.({
|
|
37
57
|
count: t,
|
|
38
|
-
reason:
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
reason: n
|
|
43
|
-
}));
|
|
44
|
-
}, [y, m.name]), F = !v && j !== null && !t(x);
|
|
45
|
-
return a(() => {
|
|
46
|
-
if (!F) {
|
|
47
|
-
T(f);
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
T((e) => ({
|
|
58
|
+
reason: r
|
|
59
|
+
}));
|
|
60
|
+
};
|
|
61
|
+
i((e) => ({
|
|
51
62
|
...e,
|
|
52
63
|
status: "connecting"
|
|
53
64
|
}));
|
|
54
|
-
let
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
origin:
|
|
58
|
-
n
|
|
59
|
-
});
|
|
60
|
-
return
|
|
61
|
-
key:
|
|
65
|
+
let o = l.suspend(() => {
|
|
66
|
+
if (!n()) return l.interrupt;
|
|
67
|
+
let e = [...T.resume].map(([e, t]) => ({
|
|
68
|
+
origin: e,
|
|
69
|
+
n: t
|
|
70
|
+
})), t = r(T.client, T.tag);
|
|
71
|
+
return l.succeed(t({
|
|
72
|
+
key: T.key,
|
|
62
73
|
...e.length > 0 ? { resume: e } : {}
|
|
63
|
-
});
|
|
64
|
-
}), n = d.unwrap(t).pipe(d.tap(() => c.sync(() => {
|
|
65
|
-
e = 0;
|
|
66
|
-
})), d.concat(d.fail(new p())), d.retry(u.min([u.exponential("250 millis", 2), u.spaced("30 seconds")]).pipe(u.jittered, u.tap(() => c.sync(() => {
|
|
67
|
-
e += 1, T((e) => ({
|
|
68
|
-
...e,
|
|
69
|
-
status: "connecting"
|
|
70
74
|
}));
|
|
71
|
-
}))))),
|
|
72
|
-
e
|
|
75
|
+
}), s = f.unwrap(o).pipe(f.concat(f.fail(new m())), f.retry(d.min([d.exponential("250 millis", 2), d.spaced("30 seconds")]).pipe(d.jittered, d.tap(() => l.sync(() => i((e) => ({
|
|
76
|
+
...e,
|
|
77
|
+
status: "connecting"
|
|
78
|
+
}))))))), c = T.runtime.runFork(f.runForEach(s, (e) => l.sync(() => {
|
|
79
|
+
n() && (e._tag === "attached" ? i((e) => ({
|
|
73
80
|
...e,
|
|
74
81
|
status: "live"
|
|
75
|
-
})) : e._tag === "gap" ?
|
|
76
|
-
})))
|
|
77
|
-
|
|
78
|
-
|
|
82
|
+
})) : e._tag === "gap" ? a(e.missed, e.reason) : (T.resume.set(e.origin, Math.max(T.resume.get(e.origin) ?? 0, e.n)), E.current?.handler(e.payload)));
|
|
83
|
+
}))), h = () => {
|
|
84
|
+
t || (t = !0, T.resume.clear(), O((e) => e?.scope === T ? {
|
|
85
|
+
scope: T,
|
|
86
|
+
value: p
|
|
87
|
+
} : e), T.runtime.runFork(l.forkDetach(u.interrupt(c))));
|
|
88
|
+
};
|
|
89
|
+
return T.subject?.addEventListener("abort", h, { once: !0 }), T.subject?.aborted && h(), () => {
|
|
90
|
+
T.subject?.removeEventListener("abort", h), h();
|
|
79
91
|
};
|
|
80
|
-
}, [
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
P
|
|
85
|
-
]), F ? w : f;
|
|
92
|
+
}, [w, T]), !w || T.subject?.aborted ? p : D?.scope === T ? D.value : {
|
|
93
|
+
...p,
|
|
94
|
+
status: "connecting"
|
|
95
|
+
};
|
|
86
96
|
}
|
|
87
|
-
|
|
88
|
-
export { m as useEvent };
|
|
97
|
+
export { h as useEvent };
|