@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/platform.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { browserStoreStorage as e, setStoreStorage as t } from "./storeStorage.js";
|
|
2
2
|
import { browserOnlineSource as n } from "./onlineSource.js";
|
|
3
3
|
import { useSyncExternalStore as r } from "react";
|
|
4
|
-
|
|
4
|
+
// src/platform.ts
|
|
5
5
|
var i = (e, t = {}) => {
|
|
6
6
|
let n = e.platform.shell !== "browser" && e.platform.shell !== "node" && e.platform.shell !== "test";
|
|
7
7
|
return {
|
|
@@ -117,5 +117,4 @@ var i = (e, t = {}) => {
|
|
|
117
117
|
t.listeners.delete(e);
|
|
118
118
|
};
|
|
119
119
|
}, x = () => r(b, _, _), S = (e) => x().extensions?.[e] ?? null;
|
|
120
|
-
//#endregion
|
|
121
120
|
export { p as browserPlatform, i as capabilitiesOf, _ as currentPlatform, a as definePlatform, g as installPlatform, v as isPlatformInstalled, d as isStandaloneDisplay, s as memoryTokenStore, o as refusingTokenStore, y as resetPlatformForTest, x as usePlatform, S as useShellExtension };
|
package/dist/preloadSeed.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { stableKey as e } from "./stableKey.js";
|
|
2
2
|
import { seedResolvers as t } from "./seedResolvers.js";
|
|
3
|
-
|
|
3
|
+
// src/preloadSeed.ts
|
|
4
4
|
var n = () => ({ seeds: [] }), r = (e) => {
|
|
5
5
|
t.preload = e;
|
|
6
6
|
}, i = /* @__PURE__ */ new Map(), a = (e, t) => `${e}\u0000${t}`, o = (n, r, i, a) => {
|
|
@@ -43,5 +43,4 @@ var n = () => ({ seeds: [] }), r = (e) => {
|
|
|
43
43
|
}, d = () => {
|
|
44
44
|
i.clear();
|
|
45
45
|
};
|
|
46
|
-
//#endregion
|
|
47
46
|
export { c as applyPreloadSeeds, n as makePreloadSeedBag, u as readPreloadedSeedOutcome, l as readPreloadedSnapshot, d as resetPreloadSeeds, o as seedPreloadedSubscription, s as seedPreloadedSubscriptionFailure, r as setPreloadSeedResolver };
|
package/dist/provider.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FrameworkRuntimesContext as e, unknownApiError as t } from "./frameworkRuntimesContext.js";
|
|
2
2
|
import { useMemo as n } from "react";
|
|
3
3
|
import { jsx as r } from "react/jsx-runtime";
|
|
4
|
-
|
|
4
|
+
// src/provider.tsx
|
|
5
5
|
var i = ({ apis: i, children: a, demand: o, queryOnce: s }) => {
|
|
6
6
|
let c = n(() => ({
|
|
7
7
|
get: (e) => {
|
|
@@ -18,5 +18,4 @@ var i = ({ apis: i, children: a, demand: o, queryOnce: s }) => {
|
|
|
18
18
|
children: a
|
|
19
19
|
});
|
|
20
20
|
};
|
|
21
|
-
//#endregion
|
|
22
21
|
export { i as FrameworkRuntimesProvider };
|
package/dist/query.js
CHANGED
|
@@ -3,10 +3,9 @@ import { runRpcPromise as t } from "./runRpc.js";
|
|
|
3
3
|
import { awaitResolvedApi as n } from "./awaitResolvedApi.js";
|
|
4
4
|
import { Effect as r, Option as i, Stream as a } from "effect";
|
|
5
5
|
import { firstEventValue as o } from "@voltro/protocol";
|
|
6
|
-
|
|
6
|
+
// src/queryOnce.ts
|
|
7
7
|
var s = async (s, c, l, u, d) => {
|
|
8
8
|
let { runtime: f, client: p } = await n(s, c, l), m = e(p, l)(u ?? {}), h = r.isEffect(m) ? m : a.runHead(m).pipe(r.map(i.getOrUndefined)), g = await t(f, h, { signal: d });
|
|
9
9
|
return o(l, g, "[loader.query]");
|
|
10
10
|
};
|
|
11
|
-
//#endregion
|
|
12
11
|
export { s as queryOnce };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { recordClientDiagnostic as e } from "./clientDiagnostics.js";
|
|
2
2
|
import { notifyApiTransportChanged as t, registerApiTransport as n } from "./apiConnectivity.js";
|
|
3
3
|
import { resolveRecoveryRetry as r } from "./recoveryRetry.js";
|
|
4
|
-
|
|
4
|
+
// src/recoveryCoordinator.ts
|
|
5
5
|
var i = (e, t, n, r) => e === void 0 || !Number.isFinite(e) ? t : Math.min(r, Math.max(n, Math.trunc(e))), a = (e) => ({
|
|
6
6
|
graceMs: i(e?.graceMs, 1500, 0, 3e4),
|
|
7
7
|
retry: r(e?.retry),
|
|
@@ -191,5 +191,4 @@ var i = (e, t, n, r) => e === void 0 || !Number.isFinite(e) ? t : Math.min(r, Ma
|
|
|
191
191
|
let i = new s(t, n);
|
|
192
192
|
return e.on((e) => i.observeError(e)), typeof e.onSuccess == "function" && e.onSuccess((e) => i.observeSuccess(e)), c.set(e, i), i;
|
|
193
193
|
};
|
|
194
|
-
//#endregion
|
|
195
194
|
export { o as INITIAL_RECOVERY_SNAPSHOT, s as RecoveryCoordinator, l as recoveryCoordinatorFor, a as resolveRecoveryOptions };
|
package/dist/recoveryRetry.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Effect as e, Schedule as t } from "effect";
|
|
2
|
-
|
|
2
|
+
// src/recoveryRetry.ts
|
|
3
3
|
var n = (e, t, n, r) => Math.min(r, Math.max(n, e === void 0 || !Number.isFinite(e) ? t : e)), r = (e) => {
|
|
4
4
|
let t = Math.trunc(n(e?.maxMs, 5e3, 50, 6e4));
|
|
5
5
|
return {
|
|
@@ -20,5 +20,4 @@ var n = (e, t, n, r) => Math.min(r, Math.max(n, e === void 0 || !Number.isFinite
|
|
|
20
20
|
})))
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
|
-
//#endregion
|
|
24
23
|
export { a as makeRecoveryRetry, i as recoveryRetryDelay, r as resolveRecoveryRetry };
|
package/dist/richText.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { formField as e } from "./schemaFields.js";
|
|
2
2
|
import { Schema as t } from "effect";
|
|
3
|
-
|
|
3
|
+
// src/richText.ts
|
|
4
4
|
var n = [
|
|
5
5
|
"bold",
|
|
6
6
|
"italic",
|
|
@@ -172,5 +172,4 @@ var n = [
|
|
|
172
172
|
}
|
|
173
173
|
}).join("\n\n");
|
|
174
174
|
};
|
|
175
|
-
//#endregion
|
|
176
175
|
export { n as RICH_TEXT_MARKS, r as RICH_TEXT_MAX_NODES, p as RichTextDocument, m as emptyRichTextDocument, h as isRichTextDocument, a as isSafeHref, x as parseRichText, w as richTextToPlainText, C as serializeRichText };
|
package/dist/rpcErrorBus.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { publishClientError as e } from "./clientErrorBus.js";
|
|
2
|
-
|
|
2
|
+
// src/rpcErrorBus.ts
|
|
3
3
|
var t = class {
|
|
4
4
|
#e = /* @__PURE__ */ new Set();
|
|
5
5
|
#t = /* @__PURE__ */ new Set();
|
|
@@ -35,5 +35,4 @@ var t = class {
|
|
|
35
35
|
} catch {}
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
-
//#endregion
|
|
39
38
|
export { t as RpcErrorBus };
|
package/dist/rpcErrorKind.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/rpcErrorKind.ts
|
|
2
2
|
var e = /* @__PURE__ */ new WeakMap(), t = (t, n) => ((typeof t == "object" && t || typeof t == "function") && e.set(t, n), t), n = (t, n) => {
|
|
3
3
|
if ((typeof t != "object" || !t) && typeof t != "function") return n;
|
|
4
4
|
let r = e.get(t);
|
|
@@ -9,5 +9,4 @@ var e = /* @__PURE__ */ new WeakMap(), t = (t, n) => ((typeof t == "object" && t
|
|
|
9
9
|
return n;
|
|
10
10
|
}
|
|
11
11
|
};
|
|
12
|
-
//#endregion
|
|
13
12
|
export { t as rememberRpcErrorKind, n as rpcErrorKind };
|
package/dist/runRpc.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { squashRpcCause as e } from "./squashRpcCause.js";
|
|
2
2
|
import { rememberRpcErrorKind as t, rpcErrorKind as n } from "./rpcErrorKind.js";
|
|
3
3
|
import { Cause as r, Exit as i, Option as a } from "effect";
|
|
4
|
-
|
|
4
|
+
// src/runRpc.ts
|
|
5
5
|
var o = async (o, s, c) => {
|
|
6
6
|
let l = await o.runPromiseExit(s, c?.signal === void 0 ? void 0 : { signal: c.signal });
|
|
7
7
|
if (i.isSuccess(l)) return l.value;
|
|
8
8
|
let u = e(l.cause), d = r.findErrorOption(l.cause), f = a.isSome(d) ? n(d.value, "handler") : "unknown";
|
|
9
9
|
throw t(u, f);
|
|
10
10
|
};
|
|
11
|
-
//#endregion
|
|
12
11
|
export { o as runRpcPromise };
|
package/dist/runtime.d.ts
CHANGED
|
@@ -60,6 +60,8 @@ export declare interface ApiHandle {
|
|
|
60
60
|
readonly errorBus: RpcErrorBus;
|
|
61
61
|
/** Stable UI/raw transport recovery state for this logical api. */
|
|
62
62
|
readonly recovery?: RecoveryCoordinator;
|
|
63
|
+
/** Identity lifetime captured when this transport was built. */
|
|
64
|
+
readonly subjectSignal?: AbortSignal;
|
|
63
65
|
}
|
|
64
66
|
|
|
65
67
|
export declare interface AuthRefreshHandle {
|
|
@@ -150,6 +152,8 @@ export declare interface BuildApiRuntimeOptions {
|
|
|
150
152
|
readonly generation?: number;
|
|
151
153
|
/** WebSocket URL of the api (`ws(s)://host:port/ws`). */
|
|
152
154
|
readonly wsUrl: string;
|
|
155
|
+
/** Captured deployment role endpoint manifest; partition this group's transports by tag/workload. */
|
|
156
|
+
readonly roleEndpoints?: unknown;
|
|
153
157
|
/**
|
|
154
158
|
* The api's rpc group, as the ERASED `RpcGroup.Any`.
|
|
155
159
|
*
|
|
@@ -208,6 +212,8 @@ export declare interface BuiltApiRuntime {
|
|
|
208
212
|
readonly client: RpcClient.RpcClient<Rpc.Any, RpcClientError.RpcClientError>;
|
|
209
213
|
readonly errorBus: RpcErrorBus;
|
|
210
214
|
readonly recovery: RecoveryCoordinator;
|
|
215
|
+
/** Identity lifetime captured when this transport was built. */
|
|
216
|
+
readonly subjectSignal?: AbortSignal;
|
|
211
217
|
}
|
|
212
218
|
|
|
213
219
|
declare interface CacheEntry {
|
|
@@ -567,6 +573,7 @@ export declare interface MountedApi {
|
|
|
567
573
|
readonly group: RpcGroup.Any;
|
|
568
574
|
readonly descriptors: ClientDescriptorMap;
|
|
569
575
|
readonly wsUrl: string;
|
|
576
|
+
readonly roleEndpoints?: unknown;
|
|
570
577
|
readonly headers?: ResolvableHeaders | undefined;
|
|
571
578
|
readonly recovery?: RecoveryOptions | undefined;
|
|
572
579
|
/** Durable local mirror, resolved per transport generation — see
|
|
@@ -742,6 +749,8 @@ export declare interface ResolvedClient {
|
|
|
742
749
|
readonly client: RpcClient.RpcClient<Rpc.Any, RpcClientError.RpcClientError>;
|
|
743
750
|
readonly errorBus?: RpcErrorBus;
|
|
744
751
|
readonly recovery?: RecoveryCoordinator;
|
|
752
|
+
/** Identity lifetime captured when this transport was built. */
|
|
753
|
+
readonly subjectSignal?: AbortSignal;
|
|
745
754
|
}
|
|
746
755
|
|
|
747
756
|
export declare interface ResolvedRecoveryOptions {
|
|
@@ -905,6 +914,8 @@ export declare interface ServiceClientOptions {
|
|
|
905
914
|
/** The callee's WebSocket endpoint. A function so a late-resolved URL (dev
|
|
906
915
|
* port discovery) is read at connect time, not at construction. */
|
|
907
916
|
readonly wsUrl: string | (() => string);
|
|
917
|
+
/** Parsed deployment role endpoint manifest; captured before the lazy connect. */
|
|
918
|
+
readonly roleEndpoints?: unknown;
|
|
908
919
|
/** The service credential, read at each (re)connect. */
|
|
909
920
|
readonly token: () => string;
|
|
910
921
|
/** The callee's `serviceGroup` (erased — see `BuildApiRuntimeOptions.group`). */
|
|
@@ -1355,8 +1366,12 @@ export declare interface SupervisorHandle {
|
|
|
1355
1366
|
readonly dispose: () => void;
|
|
1356
1367
|
/** Force a fresh ws connect for every api (carrying the browser's current
|
|
1357
1368
|
* cookies) so a cookie-based login re-resolves the authenticated Subject
|
|
1358
|
-
* in place, without a page reload.
|
|
1359
|
-
|
|
1369
|
+
* in place, without a page reload. Resolves once every api runs on a
|
|
1370
|
+
* runtime built after this call (or the supervisor is gone): a call made
|
|
1371
|
+
* after that goes out as the next Subject. Never rejects; a failing build
|
|
1372
|
+
* keeps retrying and the promise waits for the one that lands. Resolves
|
|
1373
|
+
* at once for UI-only (no-api) apps. */
|
|
1374
|
+
readonly reconnect: () => Promise<void>;
|
|
1360
1375
|
/** Re-resolve `authHeaders` and rebuild the transport, SAME subject — for a
|
|
1361
1376
|
* rotated token on a long-lived tab. Unlike `reconnect()` this seeds the new
|
|
1362
1377
|
* cache from the old one, because nobody's entitlement changed. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/runtimeCapabilities.ts
|
|
2
2
|
var e = (e, t, n) => {
|
|
3
3
|
try {
|
|
4
4
|
let r = globalThis.location, i = typeof r == "object" && r ? r.href : void 0, a = new URL(e, i);
|
|
@@ -40,5 +40,4 @@ var e = (e, t, n) => {
|
|
|
40
40
|
clearTimeout(c), s.abort();
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
|
-
//#endregion
|
|
44
43
|
export { t as readRuntimeCapabilities, e as runtimeCapabilitiesUrl };
|
package/dist/runtimeContext.js
CHANGED
|
@@ -4,7 +4,7 @@ import { RecoveryCoordinator as n } from "./recoveryCoordinator.js";
|
|
|
4
4
|
import { FrameworkRuntimesContext as r, isUnresolvedApi as i, unknownApiError as a } from "./frameworkRuntimesContext.js";
|
|
5
5
|
import { useContext as o, useEffect as s } from "react";
|
|
6
6
|
import { Exit as c } from "effect";
|
|
7
|
-
|
|
7
|
+
// src/runtimeContext.ts
|
|
8
8
|
var l = () => {
|
|
9
9
|
throw Error("Voltro: rpc / cache calls are not invokable on a not-yet-resolved api — either during SSR, or in the client boot window before the api client resolves");
|
|
10
10
|
}, u = /* @__PURE__ */ new Proxy(() => l(), {
|
|
@@ -45,5 +45,4 @@ var l = () => {
|
|
|
45
45
|
n?.(e);
|
|
46
46
|
}, [n, e]), t.get(e);
|
|
47
47
|
};
|
|
48
|
-
//#endregion
|
|
49
48
|
export { r as FrameworkRuntimesContext, S as _resetFrameworkRuntimesWarning, g as _resetSsrDescriptors, i as isUnresolvedApi, m as registerSsrDescriptors, u as ssrClientProxy, h as ssrDescriptorsFor, _ as ssrStubHandle, a as unknownApiError, w as useFrameworkApi, C as useFrameworkRuntimes };
|
package/dist/schemaFields.js
CHANGED
|
@@ -2,7 +2,7 @@ import { Schema as e } from "effect";
|
|
|
2
2
|
import { finiteNumberView as t } from "@voltro/protocol";
|
|
3
3
|
import * as n from "effect/SchemaAST";
|
|
4
4
|
import * as r from "effect/SchemaRepresentation";
|
|
5
|
-
|
|
5
|
+
// src/schemaFields.ts
|
|
6
6
|
var i = (e) => ({ voltroField: e }), a = "x-voltro", o = (t) => e.makeFilter(() => !0, { toJsonSchema: () => ({ [a]: t }) }), s = {
|
|
7
7
|
"effect/schema/Date": "date",
|
|
8
8
|
"effect/schema/DateTimeUtc": "date-time"
|
|
@@ -215,5 +215,4 @@ var i = (e) => ({ voltroField: e }), a = "x-voltro", o = (t) => e.makeFilter(()
|
|
|
215
215
|
}
|
|
216
216
|
return t;
|
|
217
217
|
};
|
|
218
|
-
//#endregion
|
|
219
218
|
export { i as formField, O as formSections, D as schemaToColumns, E as schemaToFields };
|
package/dist/scopeMembership.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/scopeMembership.ts
|
|
2
2
|
var e = (e) => {
|
|
3
3
|
if (!(e.length < 32 || Object.getPrototypeOf(e) !== Array.prototype || e.includes !== Array.prototype.includes || e[Symbol.iterator] !== Array.prototype[Symbol.iterator])) {
|
|
4
4
|
for (let t = 0; t < e.length; t++) {
|
|
@@ -8,5 +8,4 @@ var e = (e) => {
|
|
|
8
8
|
return new Set(e);
|
|
9
9
|
}
|
|
10
10
|
};
|
|
11
|
-
//#endregion
|
|
12
11
|
export { e as scopeMembership };
|
package/dist/seedResolvers.js
CHANGED
package/dist/sequence.js
CHANGED
package/dist/serverRequest.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { globalContext as e } from "./globalContext.js";
|
|
2
2
|
import { FORM_FLASH_SCRIPT_ID as t } from "./formFlashId.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import { formCaptureSource as n, readFormCaptureSource as r } from "./formSource.js";
|
|
4
|
+
import { useContext as i, useMemo as a } from "react";
|
|
5
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
6
|
+
// src/serverRequest.tsx
|
|
7
|
+
var s = e("serverRequest", null), c = () => i(s), l = ({ value: e, children: t }) => /* @__PURE__ */ o(s.Provider, {
|
|
7
8
|
value: e,
|
|
8
9
|
children: t
|
|
9
|
-
}),
|
|
10
|
-
let n =
|
|
11
|
-
return
|
|
10
|
+
}), u = (e) => {
|
|
11
|
+
let n = c();
|
|
12
|
+
return a(() => {
|
|
12
13
|
if (n !== null) return n.formFlash?.formKey === e ? n.formFlash : void 0;
|
|
13
14
|
if (typeof document > "u") return;
|
|
14
15
|
let r = document.getElementById(t);
|
|
@@ -19,6 +20,8 @@ var a = e("serverRequest", null), o = () => n(a), s = ({ value: e, children: t }
|
|
|
19
20
|
return;
|
|
20
21
|
}
|
|
21
22
|
}, [n, e]);
|
|
23
|
+
}, d = () => {
|
|
24
|
+
let e = c();
|
|
25
|
+
return e === null ? r() : n(e.formSource);
|
|
22
26
|
};
|
|
23
|
-
|
|
24
|
-
export { a as ServerRequestContext, s as ServerRequestProvider, c as useFormFlash, o as useServerRequest };
|
|
27
|
+
export { s as ServerRequestContext, l as ServerRequestProvider, d as useFormCapture, u as useFormFlash, c as useServerRequest };
|
package/dist/serviceClient.js
CHANGED
|
@@ -5,91 +5,92 @@ import { freshIdempotencyKey as r, withIdempotencyKey as i } from "./mutationIde
|
|
|
5
5
|
import { Duration as a, Effect as o, Exit as s, Option as c, Schedule as l, Stream as u } from "effect";
|
|
6
6
|
import * as d from "effect/http/Headers";
|
|
7
7
|
import { RpcClient as f } from "effect/rpc";
|
|
8
|
-
import { ApiUnavailable as p, MUTATION_IN_FLIGHT_RETRY_AFTER_MS as m } from "@voltro/protocol";
|
|
9
|
-
|
|
10
|
-
var
|
|
8
|
+
import { ApiUnavailable as p, MUTATION_IN_FLIGHT_RETRY_AFTER_MS as m, captureApiRoleEndpoints as h } from "@voltro/protocol";
|
|
9
|
+
// src/serviceClient.ts
|
|
10
|
+
var g = (e) => e?._tag === "MutationInFlight", _ = 1e4, v = (e, t) => {
|
|
11
11
|
let n = e.descriptors[t]?.kind;
|
|
12
12
|
return n === "query" || n === "mutation" || n === "action" ? n : void 0;
|
|
13
|
-
},
|
|
14
|
-
let
|
|
15
|
-
if (
|
|
16
|
-
api:
|
|
13
|
+
}, y = (_) => {
|
|
14
|
+
let y = _.roleEndpoints === void 0 ? void 0 : h(_.roleEndpoints), b = _.defaultTimeoutMs ?? 1e4, x, S, C = !1, w = () => {
|
|
15
|
+
if (C) return Promise.reject(new p({
|
|
16
|
+
api: _.name,
|
|
17
17
|
tag: "",
|
|
18
18
|
reason: "closed",
|
|
19
19
|
message: "client closed"
|
|
20
20
|
}));
|
|
21
|
-
if (
|
|
22
|
-
let e = typeof
|
|
23
|
-
return
|
|
24
|
-
name: `service:${
|
|
21
|
+
if (x !== void 0) return x;
|
|
22
|
+
let e = typeof _.wsUrl == "function" ? _.wsUrl() : _.wsUrl, t = _.webSocketConstructor ?? ((e, t) => new globalThis.WebSocket(e, typeof t == "object" && !Array.isArray(t) ? void 0 : t));
|
|
23
|
+
return x = n({
|
|
24
|
+
name: `service:${_.name}`,
|
|
25
25
|
wsUrl: e,
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
roleEndpoints: y,
|
|
27
|
+
group: _.group,
|
|
28
|
+
headers: async () => ({ authorization: `Bearer ${_.token()}` }),
|
|
28
29
|
webSocketConstructor: t,
|
|
29
30
|
surfaceAudience: "service"
|
|
30
|
-
}).then((e) => (
|
|
31
|
-
throw
|
|
32
|
-
}),
|
|
33
|
-
},
|
|
34
|
-
api:
|
|
31
|
+
}).then((e) => (S = e, e), (e) => {
|
|
32
|
+
throw x = void 0, e;
|
|
33
|
+
}), x;
|
|
34
|
+
}, T = (e, t, n) => new p({
|
|
35
|
+
api: _.name,
|
|
35
36
|
tag: e,
|
|
36
37
|
reason: t,
|
|
37
38
|
message: n
|
|
38
|
-
}),
|
|
39
|
-
let t =
|
|
39
|
+
}), E = (e) => {
|
|
40
|
+
let t = _.callHeaders?.() ?? {};
|
|
40
41
|
return e.pipe(o.updateService(f.CurrentHeaders, (e) => {
|
|
41
|
-
let n = d.set(e, "authorization", `Bearer ${
|
|
42
|
+
let n = d.set(e, "authorization", `Bearer ${_.token()}`);
|
|
42
43
|
for (let [e, r] of Object.entries(t)) n = d.set(n, e, r);
|
|
43
44
|
return n;
|
|
44
45
|
}));
|
|
45
|
-
},
|
|
46
|
+
}, D = (e) => e.pipe(u.filter((e) => e._tag === "snapshot" || e._tag === "error"), u.runHead, o.flatMap((e) => {
|
|
46
47
|
if (c.isNone(e)) return o.fail(/* @__PURE__ */ Error("the query stream ended before its first snapshot"));
|
|
47
48
|
let t = e.value;
|
|
48
49
|
return t._tag === "error" ? o.fail(t.error) : o.succeed(t.data);
|
|
49
|
-
})),
|
|
50
|
-
let c = _
|
|
51
|
-
|
|
52
|
-
api:
|
|
50
|
+
})), O = (e, n, s) => {
|
|
51
|
+
let c = v(_, e), u = s?.timeoutMs ?? b, d = Date.now(), f = (t) => {
|
|
52
|
+
_.onCall?.({
|
|
53
|
+
api: _.name,
|
|
53
54
|
tag: e,
|
|
54
55
|
durationMs: Date.now() - d,
|
|
55
56
|
outcome: t
|
|
56
57
|
});
|
|
57
58
|
};
|
|
58
|
-
if (c === void 0) return o.die(/* @__PURE__ */ Error(`apis.${
|
|
59
|
+
if (c === void 0) return o.die(/* @__PURE__ */ Error(`apis.${_.name}: '${e}' is not a service procedure of this api — is the caller built against an older contract?`));
|
|
59
60
|
let p = o.gen(function* () {
|
|
60
61
|
let u = yield* o.tryPromise({
|
|
61
|
-
try: () =>
|
|
62
|
-
catch: (t) =>
|
|
62
|
+
try: () => w(),
|
|
63
|
+
catch: (t) => T(e, C ? "closed" : "transport", `could not build the connection: ${String(t)}`)
|
|
63
64
|
}), d = t(u.client, e);
|
|
64
65
|
if (c === "query") {
|
|
65
66
|
let e = d(n);
|
|
66
|
-
return yield*
|
|
67
|
+
return yield* E(D(e));
|
|
67
68
|
}
|
|
68
|
-
let f = s?.idempotencyKey === void 0 &&
|
|
69
|
-
return yield*
|
|
70
|
-
|
|
69
|
+
let f = s?.idempotencyKey === void 0 && _.ambientIdempotencyKey !== void 0 ? yield* _.ambientIdempotencyKey(e, n) : void 0, p = s?.idempotencyKey ?? f ?? r();
|
|
70
|
+
return yield* E(i(d(n), p)).pipe(o.tapError((e) => o.sync(() => {
|
|
71
|
+
g(e) && (h = !0);
|
|
71
72
|
})), o.retry({
|
|
72
|
-
while:
|
|
73
|
+
while: g,
|
|
73
74
|
schedule: l.spaced(a.millis(m))
|
|
74
75
|
}));
|
|
75
|
-
}),
|
|
76
|
+
}), h = !1;
|
|
76
77
|
return p.pipe(o.timeoutOrElse({
|
|
77
78
|
duration: a.millis(u),
|
|
78
|
-
orElse: () => o.fail(
|
|
79
|
-
}), o.mapError((t) => t?._tag === "RpcClientError" ?
|
|
79
|
+
orElse: () => o.fail(T(e, "timeout", h ? `no answer within ${u} ms — an earlier send with this idempotency key is still in flight on the callee` : `no answer within ${u} ms`))
|
|
80
|
+
}), o.mapError((t) => t?._tag === "RpcClientError" ? T(e, "transport", String(t.message ?? t)) : t), o.tapError((e) => o.sync(() => f(e?._tag === "ApiUnavailable" ? "unavailable" : "error"))), o.tap(() => o.sync(() => f("ok"))));
|
|
80
81
|
};
|
|
81
82
|
return {
|
|
82
|
-
name:
|
|
83
|
+
name: _.name,
|
|
83
84
|
call: async (t, n, r) => {
|
|
84
|
-
let i = await o.runPromiseExit(
|
|
85
|
+
let i = await o.runPromiseExit(O(t, n, r), r?.signal === void 0 ? void 0 : { signal: r.signal });
|
|
85
86
|
if (s.isSuccess(i)) return i.value;
|
|
86
87
|
throw e(i.cause);
|
|
87
88
|
},
|
|
88
|
-
callEffect:
|
|
89
|
+
callEffect: O,
|
|
89
90
|
subscribe: (e, n, r) => {
|
|
90
|
-
if (_
|
|
91
|
+
if (v(_, e) !== "query") throw Error(`apis.${_.name}: '${e}' is not a query — only a query can be subscribed to`);
|
|
91
92
|
let i, a = !1, o = -2, s;
|
|
92
|
-
return
|
|
93
|
+
return w().then((c) => {
|
|
93
94
|
if (a) return;
|
|
94
95
|
let l = [e, n], u = c.cache.subscribe(l, () => t(c.client, e)(n), c.runtime, () => {
|
|
95
96
|
let e = u.getSnapshot();
|
|
@@ -97,19 +98,19 @@ var h = (e) => e?._tag === "MutationInFlight", g = 1e4, _ = (e, t) => {
|
|
|
97
98
|
});
|
|
98
99
|
i = u.unsubscribe;
|
|
99
100
|
}, (t) => {
|
|
100
|
-
r.onError?.(
|
|
101
|
+
r.onError?.(T(e, "transport", `could not build the connection: ${String(t)}`));
|
|
101
102
|
}), { unsubscribe: () => {
|
|
102
103
|
a = !0, i?.();
|
|
103
104
|
} };
|
|
104
105
|
},
|
|
105
|
-
connected: () =>
|
|
106
|
+
connected: () => S !== void 0,
|
|
106
107
|
close: async () => {
|
|
107
|
-
|
|
108
|
-
let e =
|
|
109
|
-
|
|
108
|
+
C = !0;
|
|
109
|
+
let e = S;
|
|
110
|
+
S = void 0, x = void 0, e !== void 0 && (e.cache.destroy(e.runtime), await e.runtime.dispose());
|
|
110
111
|
}
|
|
111
112
|
};
|
|
112
|
-
},
|
|
113
|
+
}, b = (e) => {
|
|
113
114
|
let t = (n) => {
|
|
114
115
|
let r = n.join("."), i = Object.assign((t, n) => e.call(r, t, n), {
|
|
115
116
|
effect: (t, n) => e.callEffect(r, t, n),
|
|
@@ -124,5 +125,4 @@ var h = (e) => e?._tag === "MutationInFlight", g = 1e4, _ = (e, t) => {
|
|
|
124
125
|
};
|
|
125
126
|
return new Proxy({}, { get: (e, n) => typeof n == "string" && n !== "then" ? t([n]) : void 0 });
|
|
126
127
|
};
|
|
127
|
-
|
|
128
|
-
export { g as DEFAULT_SERVICE_CALL_TIMEOUT_MS, v as makeServiceClient, y as serviceApi };
|
|
128
|
+
export { _ as DEFAULT_SERVICE_CALL_TIMEOUT_MS, y as makeServiceClient, b as serviceApi };
|
package/dist/squashRpcCause.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Cause as e, Option as t, Schema as n } from "effect";
|
|
2
|
-
|
|
2
|
+
// src/squashRpcCause.ts
|
|
3
3
|
var r = (r) => {
|
|
4
4
|
let i = e.squash(r);
|
|
5
5
|
return t.isNone(e.findErrorOption(r)) && n.isSchemaError(i) && console.error("[voltro] a value failed its schema in the client — if it is the request payload, the request never reached the server, so no server log has it:\n" + i.message), i;
|
|
6
6
|
};
|
|
7
|
-
//#endregion
|
|
8
7
|
export { r as squashRpcCause };
|
package/dist/stableKey.js
CHANGED
package/dist/store.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { seedResolvers as e } from "./seedResolvers.js";
|
|
2
2
|
import { resolveStoreStorage as t } from "./storeStorage.js";
|
|
3
3
|
import { useCallback as n, useDebugValue as r, useRef as i, useSyncExternalStore as a } from "react";
|
|
4
|
-
|
|
4
|
+
// src/store.ts
|
|
5
5
|
var o = (e, t) => {
|
|
6
6
|
if (Object.is(e, t)) return !0;
|
|
7
7
|
if (typeof e != "object" || typeof t != "object" || e === null || t === null || Array.isArray(e) !== Array.isArray(t)) return !1;
|
|
@@ -284,5 +284,4 @@ var M = () => {
|
|
|
284
284
|
e !== void 0 && e.set(t.value, t.key);
|
|
285
285
|
}
|
|
286
286
|
};
|
|
287
|
-
//#endregion
|
|
288
287
|
export { z as applyStoreSeeds, y as clearStoreHistory, P as defineStore, N as definedStores, I as makeStoreSeedBag, F as resetStoreRegistryForTests, R as seedStore, L as setStoreSeedResolver, o as shallow, _ as storeHistory, v as subscribeStoreHistory, b as travelToStoreState };
|
package/dist/storeStorage.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/storeStorage.ts
|
|
2
2
|
var e = Symbol.for("@voltro/client/storeStorageProvider"), t = () => {
|
|
3
3
|
let t = globalThis, n = t[e];
|
|
4
4
|
if (n !== void 0) return n;
|
|
@@ -24,5 +24,4 @@ var e = Symbol.for("@voltro/client/storeStorageProvider"), t = () => {
|
|
|
24
24
|
let e = t();
|
|
25
25
|
e.provider = void 0, e.used = !1;
|
|
26
26
|
};
|
|
27
|
-
//#endregion
|
|
28
27
|
export { n as browserStoreStorage, a as resetStoreStorageForTest, i as resolveStoreStorage, r as setStoreStorage };
|
|
@@ -8,7 +8,7 @@ import { Cause as o, Effect as s, Exit as c, Fiber as l, Option as u, Stream as
|
|
|
8
8
|
import * as f from "effect/http/Headers";
|
|
9
9
|
import { RpcClient as p } from "effect/rpc";
|
|
10
10
|
import { createRowPatchApplier as m } from "@voltro/protocol";
|
|
11
|
-
|
|
11
|
+
// src/subscriptionCache.ts
|
|
12
12
|
var h = (e) => e === void 0 ? /* @__PURE__ */ Error("[voltro] the subscription failed without an error value") : e, g = Object.freeze({
|
|
13
13
|
data: void 0,
|
|
14
14
|
revision: -1,
|
|
@@ -380,10 +380,10 @@ var h = (e) => e === void 0 ? /* @__PURE__ */ Error("[voltro] the subscription f
|
|
|
380
380
|
let t = this.entries.get(a(e));
|
|
381
381
|
return !t?.fetch || !t.runtime || t.subscribers.size === 0 || this.refreshing.has(t) || t.state.base === void 0 && t.state.baseError === void 0 ? !1 : (this.refreshing.add(t), this.reissue(t, t.runtime, !1), !0);
|
|
382
382
|
}
|
|
383
|
-
resumeTransportFailures(e) {
|
|
384
|
-
let
|
|
385
|
-
for (let
|
|
386
|
-
return
|
|
383
|
+
resumeTransportFailures(e, t) {
|
|
384
|
+
let n = 0;
|
|
385
|
+
for (let r of this.entries.values()) !r.resumeAfterTransportOpen || t && !t(r.tag) || (r.fiber !== null || r.fetch === null || r.subscribers.size === 0 ? this.diagnose("subscription.reissue-skipped", r, { reason: r.fiber === null ? r.fetch === null ? "missing-fetch" : "no-subscribers" : "fiber-running" }) : (r.recoveryAttempt += 1, r.recoveryPhase = "awaiting-delivery", r.lastReissueAt = Date.now(), r.recoveryBasePreserved = r.state.base !== void 0, this.diagnose("subscription.reissue-started", r, { basePreserved: r.recoveryBasePreserved }), this.reissue(r, e, !1), this.armRecoveryWatchdog(r), n += 1));
|
|
386
|
+
return n;
|
|
387
387
|
}
|
|
388
388
|
armRecoveryWatchdog(e) {
|
|
389
389
|
let t = e.recoveryAttempt;
|
|
@@ -720,5 +720,4 @@ var h = (e) => e === void 0 ? /* @__PURE__ */ Error("[voltro] the subscription f
|
|
|
720
720
|
};
|
|
721
721
|
}
|
|
722
722
|
};
|
|
723
|
-
//#endregion
|
|
724
723
|
export { L as LoadingSubscriptionCache, I as SubscriptionCache, a as stableKey, v as supersedesConfirmedPatches };
|
package/dist/tagWalk.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/tagWalk.ts
|
|
2
2
|
var e = (e, t) => {
|
|
3
3
|
let n = t.split("."), r = e, i = 0;
|
|
4
4
|
for (let e = 0; e < n.length; e++) {
|
|
@@ -19,5 +19,4 @@ var e = (e, t) => {
|
|
|
19
19
|
if (typeof r != "function") throw Error(`@voltro/client: rpc tag ${JSON.stringify(t)} did not resolve to a callable method.`);
|
|
20
20
|
return r;
|
|
21
21
|
};
|
|
22
|
-
//#endregion
|
|
23
22
|
export { e as resolveByTag };
|
package/dist/traceBus.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/traceBus.ts
|
|
2
2
|
var e = /* @__PURE__ */ new Set(), t = (t) => {
|
|
3
3
|
for (let n of e) try {
|
|
4
4
|
n(t);
|
|
@@ -6,5 +6,4 @@ var e = /* @__PURE__ */ new Set(), t = (t) => {
|
|
|
6
6
|
}, n = (t) => (e.add(t), () => {
|
|
7
7
|
e.delete(t);
|
|
8
8
|
});
|
|
9
|
-
//#endregion
|
|
10
9
|
export { t as publishClientTrace, n as subscribeClientTraces };
|
package/dist/tracking.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect as e, useMemo as t, useRef as n } from "react";
|
|
2
|
-
|
|
2
|
+
// src/tracking.ts
|
|
3
3
|
var r = (e, t) => ({
|
|
4
4
|
name: e,
|
|
5
5
|
map: t
|
|
@@ -36,5 +36,4 @@ var r = (e, t) => ({
|
|
|
36
36
|
s
|
|
37
37
|
]);
|
|
38
38
|
};
|
|
39
|
-
//#endregion
|
|
40
39
|
export { r as defineTracking, i as resolveTrackingEvent, s as useTracking, o as wrapTrackedCallbacks };
|
package/dist/uploadProgress.js
CHANGED