@voltro/client 0.83.1 → 0.85.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/dist/index.d.ts CHANGED
@@ -3,12 +3,17 @@ import { clearPairing } from '@voltro/protocol';
3
3
  import { ClientDescriptor } from '@voltro/protocol';
4
4
  import { ClipboardEvent as ClipboardEvent_2 } from 'react';
5
5
  import { Context } from 'react';
6
+ import { createRowPatchApplier } from '@voltro/protocol';
6
7
  import { DragEvent as DragEvent_2 } from 'react';
7
8
  import { Effect } from 'effect';
8
9
  import { errorMessage } from '@voltro/protocol';
9
10
  import { errorTag } from '@voltro/protocol';
10
11
  import { EventDescriptor as EventDescriptor_2 } from '@voltro/protocol';
11
12
  import { Fiber } from 'effect';
13
+ import { JsonSchemaDocument } from '@voltro/protocol';
14
+ import { jsonSchemaDocumentOf } from '@voltro/protocol';
15
+ import { jsonSchemaOf } from '@voltro/protocol';
16
+ import { JsonSchemaOptions } from '@voltro/protocol';
12
17
  import { ManagedRuntime } from 'effect';
13
18
  import { Pairing } from '@voltro/protocol';
14
19
  import { PAIRING_HOST } from '@voltro/protocol';
@@ -17,20 +22,21 @@ import { PAIRING_STORAGE_KEY } from '@voltro/protocol';
17
22
  import { pairingLink } from '@voltro/protocol';
18
23
  import { PairingStorage } from '@voltro/protocol';
19
24
  import { parsePairingLink } from '@voltro/protocol';
20
- import { ParseResult } from 'effect';
21
25
  import { ReactElement } from 'react';
22
26
  import { ReactNode } from 'react';
23
27
  import { readPairing } from '@voltro/protocol';
24
- import { Rpc } from '@effect/rpc';
25
- import { RpcClient } from '@effect/rpc';
26
- import { RpcClientError } from '@effect/rpc';
27
- import { RpcGroup } from '@effect/rpc';
28
+ import { Rpc } from 'effect/rpc';
29
+ import { RpcClient } from 'effect/rpc';
30
+ import { RpcClientError } from 'effect/rpc';
31
+ import { RpcGroup } from 'effect/rpc';
28
32
  import { Schema } from 'effect';
29
- import * as Socket from '@effect/platform/Socket';
33
+ import * as Socket from 'effect/socket/Socket';
34
+ import { StorageAccessPolicy } from '@voltro/protocol';
30
35
  import { Stream } from 'effect';
31
36
  import { SubscriptionEvent } from '@voltro/protocol';
32
37
  import { TargetRelations } from '@voltro/protocol';
33
38
  import { UIEvent as UIEvent_2 } from 'react';
39
+ import { WebSocketConstructorOptions } from 'effect/socket/Socket';
34
40
  import { WorkflowControlIntent } from '@voltro/protocol';
35
41
  import { WorkflowControlReadInput } from '@voltro/protocol';
36
42
  import { WorkflowControlResult } from '@voltro/protocol';
@@ -185,6 +191,22 @@ export declare interface Analytics<E extends ReadonlyArray<EventDescriptor<strin
185
191
  * React context (and its browser globals) merely to name this Effect type. */
186
192
  export declare type AnyRuntime = ManagedRuntime.ManagedRuntime<never, never>;
187
193
 
194
+ /** The registry's read side, as other packages see it through the slot. */
195
+ export declare interface ApiConnectivity {
196
+ /**
197
+ * Is the transport up? With a name: that api's. Without: any mounted api's
198
+ * — the right default for a writer that does not say which api it talks to,
199
+ * because answering "down" while its own api is up would hold its queue
200
+ * shut. `undefined` when no api (of that name) is mounted: nothing is known.
201
+ */
202
+ readonly online: (apiName?: string) => boolean | undefined;
203
+ /** Called on every transport change of any api. Returns the unsubscribe. */
204
+ readonly subscribe: (listener: () => void) => () => void;
205
+ }
206
+
207
+ /** The read side — what `useApiOnline` and other packages consume. */
208
+ export declare const apiConnectivity: () => ApiConnectivity;
209
+
188
210
  export declare interface ApiHandle {
189
211
  readonly runtime: AnyRuntime;
190
212
  readonly cache: SubscriptionCache;
@@ -398,7 +420,7 @@ export declare interface BuildApiRuntimeOptions {
398
420
  /**
399
421
  * The api's rpc group, as the ERASED `RpcGroup.Any`.
400
422
  *
401
- * `RpcGroup` is declared `in out` in @effect/rpc — invariant on purpose — so a
423
+ * `RpcGroup` is declared `in out` in effect/rpc — invariant on purpose — so a
402
424
  * CONCRETE group (the `appGroup` codegen emits) is not assignable to
403
425
  * `RpcGroup<Rpc.Any>`, and a boundary typed that way rejects the only value
404
426
  * anyone ever passes it. This mirrors what `ApiHandle.client` already does:
@@ -412,7 +434,7 @@ export declare interface BuildApiRuntimeOptions {
412
434
  /** How to construct a WebSocket. Web wraps `globalThis.WebSocket` with
413
435
  * tracking + a connect-timeout; RN passes a plain `globalThis.WebSocket`.
414
436
  * Injected so this module touches no environment global directly. */
415
- readonly webSocketConstructor: (url: string, protocols?: string | ReadonlyArray<string>) => globalThis.WebSocket;
437
+ readonly webSocketConstructor: (url: string, options?: Socket.WebSocketConstructorOptions) => globalThis.WebSocket;
416
438
  /**
417
439
  * Error channel owned by the logical api mount. A reconnect supervisor passes
418
440
  * the SAME instance to every transport generation so a failure emitted by the
@@ -429,6 +451,16 @@ export declare interface BuildApiRuntimeOptions {
429
451
  * its concern.
430
452
  */
431
453
  readonly surfaceAudience?: 'client' | 'service';
454
+ /**
455
+ * Durable local mirror for this generation's subscription cache — the
456
+ * offline read half of local-first. Resolved once here, before the cache
457
+ * exists; see {@link SubscriptionMirrorSource} for why it is never swapped
458
+ * under a live cache.
459
+ */
460
+ readonly mirror?: SubscriptionMirrorSource | undefined;
461
+ /** The api's rpc descriptors. Handed to the mirror source, and each warm
462
+ * query's `source` routes queued writes' previews onto it. */
463
+ readonly descriptors?: Readonly<Record<string, ClientDescriptor>> | undefined;
432
464
  }
433
465
 
434
466
  export declare type BuildClient = (api: MountedApi, generation: number, onSocketOpen: () => void, onSocketIssue: (kind: SocketIssueKind) => void,
@@ -446,6 +478,7 @@ export declare interface BuiltApiRuntime {
446
478
  }
447
479
 
448
480
  declare interface CacheEntry {
481
+ rowPatchApplier?: ReturnType<typeof createRowPatchApplier>;
449
482
  readonly key: string;
450
483
  /** First element of the keyArr — the rpc tag (e.g. 'todos.list'). Used
451
484
  * by `forTag()` so callers can patch every sub-key for a tag without
@@ -463,7 +496,7 @@ declare interface CacheEntry {
463
496
  /** Subscriber re-render callbacks. */
464
497
  subscribers: Set<() => void>;
465
498
  /** Fiber running the underlying stream. */
466
- fiber: Fiber.RuntimeFiber<unknown, unknown> | null;
499
+ fiber: Fiber.Fiber<unknown, unknown> | null;
467
500
  /** The last fiber ended because the rpc transport failed. A later socket
468
501
  * `open` re-issues active entries with their last-known-good base intact. */
469
502
  resumeAfterTransportOpen: boolean;
@@ -689,7 +722,7 @@ export declare interface ClientDiagnosticEvent {
689
722
  readonly fields: Readonly<Record<string, ClientDiagnosticValue>>;
690
723
  }
691
724
 
692
- export declare type ClientDiagnosticKind = 'runtime.build-started' | 'runtime.resolved' | 'runtime.failed' | 'runtime.capabilities' | 'runtime.surface-mismatch' | 'runtime.swapped' | 'runtime.disposed' | 'socket.created' | 'socket.raw-open' | 'socket.close' | 'socket.error' | 'socket.connect-timeout' | 'socket.retry-scheduled' | 'socket.frames' | 'protocol.ready' | 'subscription.transport-failed' | 'subscription.reissue-started' | 'subscription.reissue-skipped' | 'subscription.first-delivery' | 'subscription.recovery-stuck' | 'subscription.recovery-timer-late' | 'subscription.health-cleared' | 'event.gap' | 'connection.status' | 'recovery.state' | 'fault.transport-cut';
725
+ export declare type ClientDiagnosticKind = 'runtime.build-started' | 'runtime.resolved' | 'runtime.failed' | 'runtime.capabilities' | 'runtime.surface-mismatch' | 'runtime.mirror' | 'runtime.swapped' | 'runtime.disposed' | 'socket.created' | 'socket.raw-open' | 'socket.close' | 'socket.error' | 'socket.connect-timeout' | 'socket.retry-scheduled' | 'socket.frames' | 'protocol.ready' | 'subscription.transport-failed' | 'subscription.reissue-started' | 'subscription.reissue-skipped' | 'subscription.first-delivery' | 'subscription.recovery-stuck' | 'subscription.recovery-timer-late' | 'subscription.health-cleared' | 'event.gap' | 'connection.status' | 'recovery.state' | 'fault.transport-cut';
693
726
 
694
727
  export declare interface ClientDiagnosticsSnapshot {
695
728
  readonly version: 1;
@@ -989,11 +1022,11 @@ export declare interface DataTableState<Row> {
989
1022
  export declare const decideAccess: (guards: ReadonlyArray<ManifestGuard> | undefined, subjectScopes: ReadonlyArray<string>) => AccessDecision;
990
1023
 
991
1024
  /**
992
- * Walk a ParseError's issue tree into structured, PATH-PRESERVING issues.
1025
+ * Walk a schema failure's issue tree into structured, PATH-PRESERVING issues.
993
1026
  * Every leaf keeps its full path (`address.city`, `entries.0.startsAt`) —
994
1027
  * nothing collapses to the top-level segment.
995
1028
  */
996
- export declare const decodeFieldIssues: (error: ParseResult.ParseError) => ReadonlyArray<FieldIssue>;
1029
+ export declare const decodeFieldIssues: (error: Schema.SchemaError) => ReadonlyArray<FieldIssue>;
997
1030
 
998
1031
  /**
999
1032
  * The descriptor a `*.deepLink.ts` file default-exports. `_tag` marks it for
@@ -1044,6 +1077,13 @@ export declare interface DeepLinkSource {
1044
1077
  readonly subscribe: (onUrl: (url: string) => void) => () => void;
1045
1078
  }
1046
1079
 
1080
+ /**
1081
+ * Exponential backoff from 1 s, capped at 30 s, jittered into the upper half of
1082
+ * each step — the same curve `@voltro/local-first`'s sync client uses for CRDT
1083
+ * writes, so the two queues of one device back off alike.
1084
+ */
1085
+ export declare const defaultOutboxRetryDelay: (attempts: number) => number;
1086
+
1047
1087
  /**
1048
1088
  * Declare a deep link.
1049
1089
  *
@@ -1065,7 +1105,7 @@ export declare interface DefineDeepLinkConfig<Pattern extends string> {
1065
1105
  export declare const definedStores: () => ReadonlyArray<StoreHandle<never>>;
1066
1106
 
1067
1107
  /** Declare a typed analytics event. */
1068
- export declare const defineEvent: <const Name extends string, A, I>(name: Name, payload: Schema.Schema<A, I>) => EventDescriptor<Name, A>;
1108
+ export declare const defineEvent: <const Name extends string, A, I>(name: Name, payload: Schema.Codec<A, I>) => EventDescriptor<Name, A>;
1069
1109
 
1070
1110
  /** Fill in the derived capabilities. Adapters are built through this. */
1071
1111
  export declare const definePlatform: (input: PlatformAdapterInput) => PlatformAdapter;
@@ -1174,7 +1214,7 @@ export declare const emptyRichTextDocument: RichTextDocument;
1174
1214
  */
1175
1215
  export declare const enableClientDiagnosticsPersistence: (storage: ClientDiagnosticsStorage) => void;
1176
1216
 
1177
- export declare const enqueueEntry: (queue: Outbox, id: string, tag: string, input: unknown) => Outbox;
1217
+ export declare const enqueueEntry: (queue: Outbox, id: string, tag: string, input: unknown, stamp?: string) => Outbox;
1178
1218
 
1179
1219
  /**
1180
1220
  * One operation of an entity's admin surface.
@@ -1241,6 +1281,15 @@ declare interface EntryState<T> {
1241
1281
  /** Cached optimistic snapshot — invalidated on every state change so
1242
1282
  * `getSnapshot` returns a stable reference between mutations. */
1243
1283
  cachedSnapshot: CacheSnapshot<T> | null;
1284
+ previewPrefix?: {
1285
+ readonly base: T;
1286
+ readonly count: number;
1287
+ readonly data: T;
1288
+ };
1289
+ previewBase?: {
1290
+ readonly base: T;
1291
+ readonly eligible: boolean;
1292
+ };
1244
1293
  }
1245
1294
 
1246
1295
  /** Compares two selector results. Return true to keep the previous value. */
@@ -1266,7 +1315,7 @@ export declare interface EventDescriptor<Name extends string, A> {
1266
1315
  * `A` and break a heterogeneous catalog. The decoded type is carried by the
1267
1316
  * covariant phantom `_type` below instead, so `EventDescriptor<string,
1268
1317
  * unknown>` accepts every typed descriptor AND `track` stays typed. */
1269
- readonly payload: Schema.Schema.Any;
1318
+ readonly payload: Schema.Top;
1270
1319
  /** Phantom — never present at runtime; carries the decoded payload type for
1271
1320
  * `track`'s compile-time signature. Covariant (optional), so erasure works. */
1272
1321
  readonly _type?: A;
@@ -1395,7 +1444,7 @@ export declare type FilterKind = 'text' | 'select' | 'multi-select' | 'number-ra
1395
1444
 
1396
1445
  /** Derive the filter controls from a query's input Schema. Each filterable
1397
1446
  * input field → one FilterDescriptor. Pure. */
1398
- export declare const filtersFromSchema: (schema: Schema.Schema.Any) => ReadonlyArray<FilterDescriptor>;
1447
+ export declare const filtersFromSchema: (schema: Schema.Top) => ReadonlyArray<FilterDescriptor>;
1399
1448
 
1400
1449
  /** DOM id of the JSON script the 422 re-render embeds (survives the
1401
1450
  * `interactive:'none'` strip — it is neither `type="module"` nor `src`). */
@@ -1485,8 +1534,8 @@ export declare interface FormBinding<Input, Output> {
1485
1534
  *
1486
1535
  * `<AutoForm>` mounts one for you.
1487
1536
  */
1488
- export declare const FormBindingProvider: (props: {
1489
- readonly binding: FormBinding<never, never> | FormBinding<Record<string, unknown>, unknown>;
1537
+ export declare const FormBindingProvider: <Input extends Record<string, unknown>, Output>(props: {
1538
+ readonly binding: FormBinding<Input, Output>;
1490
1539
  readonly children?: ReactNode;
1491
1540
  }) => ReactElement;
1492
1541
 
@@ -1509,7 +1558,7 @@ export declare const FormBindingProvider: (props: {
1509
1558
  * the server rejects undeclared fields, and a hidden bookkeeping field must
1510
1559
  * not turn every no-JS submit into a validation error.
1511
1560
  */
1512
- export declare const formDataToInput: (schema: Schema.Schema.Any, entries: Iterable<FormEntry>) => Record<string, unknown>;
1561
+ export declare const formDataToInput: (schema: Schema.Top, entries: Iterable<FormEntry>) => Record<string, unknown>;
1513
1562
 
1514
1563
  /** One posted entry. File entries must be filtered out by the caller —
1515
1564
  * uploads are a declared limit of the no-JS path. */
@@ -1531,9 +1580,7 @@ export declare const formField: (meta: {
1531
1580
  * list, for a multi-reference feeding a target's `relations:`). */
1532
1581
  readonly reference?: string;
1533
1582
  }) => {
1534
- readonly jsonSchema: {
1535
- readonly "x-voltro": typeof meta;
1536
- };
1583
+ readonly voltroField: typeof meta;
1537
1584
  };
1538
1585
 
1539
1586
  /** One field, bound: value + change/blur wiring + gated error + descriptor
@@ -1825,6 +1872,14 @@ export declare const isUnauthenticated: (error: unknown) => boolean;
1825
1872
  */
1826
1873
  export declare const isUnresolvedApi: (handle: ApiHandle) => boolean;
1827
1874
 
1875
+ export { JsonSchemaDocument }
1876
+
1877
+ export { jsonSchemaDocumentOf }
1878
+
1879
+ export { jsonSchemaOf }
1880
+
1881
+ export { JsonSchemaOptions }
1882
+
1828
1883
  /** Foreground/background transitions — `AppState` on React Native,
1829
1884
  * `visibilitychange` in a browser, window focus in a desktop shell. */
1830
1885
  export declare interface LifecycleSource {
@@ -1862,8 +1917,19 @@ export declare class LoadingSubscriptionCache extends SubscriptionCache {
1862
1917
  };
1863
1918
  }
1864
1919
 
1920
+ export declare interface LocalQueryOptions<Row> {
1921
+ /** Keep the rows this returns `true` for. Omitted: every row. */
1922
+ readonly where?: (row: Row) => boolean;
1923
+ /** Sort: a column name (ascending), `[column, 'asc' | 'desc']`, or a comparator. */
1924
+ readonly orderBy?: (keyof Row & string) | readonly [keyof Row & string, 'asc' | 'desc'] | ((a: Row, b: Row) => number);
1925
+ /** At most this many rows, after sorting. */
1926
+ readonly limit?: number;
1927
+ }
1928
+
1865
1929
  export declare const makePreloadSeedBag: () => PreloadSeedBag;
1866
1930
 
1931
+ /* Excluded from this release type: makeProtocolOpenRecovery */
1932
+
1867
1933
  export declare const makeStoreSeedBag: () => StoreSeedBag;
1868
1934
 
1869
1935
  /**
@@ -1951,6 +2017,9 @@ export declare interface MountedApi {
1951
2017
  readonly wsUrl: string;
1952
2018
  readonly headers?: ResolvableHeaders | undefined;
1953
2019
  readonly recovery?: RecoveryOptions | undefined;
2020
+ /** Durable local mirror, resolved per transport generation — see
2021
+ * `BuildApiRuntimeOptions.mirror`. */
2022
+ readonly mirror?: SubscriptionMirrorSource | undefined;
1954
2023
  }
1955
2024
 
1956
2025
  export declare interface MutateOptions<Input, Output> {
@@ -2109,6 +2178,8 @@ declare interface OptimisticPatch<T = unknown> {
2109
2178
  /** A successful write stays previewed until a matching post-ACK primary
2110
2179
  * snapshot supersedes it. A different write's delta proves nothing. */
2111
2180
  confirmed?: boolean;
2181
+ /** Only framework-owned reducers with an unchanged input can reuse a prefix. */
2182
+ readonly canReuse?: (() => boolean) | undefined;
2112
2183
  }
2113
2184
 
2114
2185
  /**
@@ -2146,18 +2217,23 @@ export declare interface OutboxEntry {
2146
2217
  readonly status: OutboxStatus;
2147
2218
  readonly attempts: number;
2148
2219
  readonly error?: unknown;
2220
+ /** When the write was made, as the `stamp` option's clock reported it — a
2221
+ * hybrid logical clock stamp feeds conflict resolution a causal order
2222
+ * where wall clocks disagree. Absent without a `stamp` option. */
2223
+ readonly stamp?: string;
2149
2224
  }
2150
2225
 
2151
2226
  /**
2152
- * Durability seam for the outbox queue. `load` runs once on mount and returns
2153
- * the surviving entries (oldest first); `save` is called after every queue
2227
+ * Durability seam for the outbox queue. `load` runs on mount — and again after
2228
+ * a sign-in or tenant switch on an `api`-bound outbox — and returns the
2229
+ * surviving entries (oldest first); `save` is called after every queue
2154
2230
  * transition with the entries worth keeping (`sent` entries are compacted away
2155
2231
  * before the call — a delivered write needs no durability).
2156
2232
  *
2157
2233
  * The one real implementation is `outboxPersistence()` in
2158
2234
  * `@voltro/local-first`, which stores the entries through the same
2159
2235
  * `PersistenceAdapter` the sync engine uses — ONE durable queue for a device,
2160
- * whichever surface enqueued the write.
2236
+ * whichever surface enqueued the write — partitioned per signed-in subject.
2161
2237
  */
2162
2238
  export declare interface OutboxPersistence {
2163
2239
  readonly load: () => Promise<Outbox>;
@@ -2231,7 +2307,7 @@ export declare interface PlatformAdapter {
2231
2307
  readonly platform: PlatformInfo;
2232
2308
  readonly capabilities: PlatformCapabilities;
2233
2309
  /** The WebSocket the api runtime opens — `buildApiRuntime`'s constructor. */
2234
- readonly webSocket: (url: string, protocols?: string | ReadonlyArray<string>) => WebSocket;
2310
+ readonly webSocket: (url: string, options?: Socket.WebSocketConstructorOptions) => WebSocket;
2235
2311
  /** Backing store for `defineStore({ persist })`; installed via `setStoreStorage`. */
2236
2312
  readonly storage: StoreStorageProvider;
2237
2313
  readonly secureStorage: TokenStore;
@@ -2377,7 +2453,7 @@ export declare interface PreviewState<Input> {
2377
2453
 
2378
2454
  /** The value a procedure's `input` schema decodes to on the client. */
2379
2455
  export declare type ProcedureInput<D> = D extends {
2380
- readonly input: infer I extends Schema.Schema.Any;
2456
+ readonly input: infer I extends Schema.Top;
2381
2457
  } ? Schema.Schema.Type<I> : never;
2382
2458
 
2383
2459
  /**
@@ -2387,9 +2463,9 @@ export declare type ProcedureInput<D> = D extends {
2387
2463
  * per-element schema is named differently in its descriptor.
2388
2464
  */
2389
2465
  export declare type ProcedureOutput<D> = D extends {
2390
- readonly output: infer O extends Schema.Schema.Any;
2466
+ readonly output: infer O extends Schema.Top;
2391
2467
  } ? Schema.Schema.Type<O> : D extends {
2392
- readonly element: infer E extends Schema.Schema.Any;
2468
+ readonly element: infer E extends Schema.Top;
2393
2469
  } ? Schema.Schema.Type<E> : never;
2394
2470
 
2395
2471
  /**
@@ -2475,12 +2551,31 @@ export declare interface QueryFiltersState<Row> {
2475
2551
  readonly error: unknown | undefined;
2476
2552
  }
2477
2553
 
2478
- /* Excluded from this release type: queryOnce */
2554
+ /**
2555
+ * Resolve `tag(input)` once on the api behind `handleRef`: a query to the data
2556
+ * of its first snapshot, a mutation or action to its result.
2557
+ *
2558
+ * Waits out the client boot window like every other imperative seam, and
2559
+ * rejects the way the server loader's `query` does: with the declared error
2560
+ * itself, whether it arrived as an in-band `error` event or as a failed call —
2561
+ * the same value every hook hands over. Aborting `signal` interrupts the call.
2562
+ *
2563
+ * @public
2564
+ * @remarks
2565
+ * The cross-package browser half of `LoaderContext.query`, wired by
2566
+ * `@voltro/web`'s router. Apps read through `ctx.query`.
2567
+ */
2568
+ export declare const queryOnce: (handleRef: {
2569
+ readonly current: ResolvableHandle;
2570
+ }, apiName: string, tag: string, input: Record<string, unknown> | undefined, signal?: AbortSignal) => Promise<unknown>;
2479
2571
 
2480
2572
  declare type QueryTag<P extends ProcedureTypeMap> = TagsOfKind<P, 'query'>;
2481
2573
 
2482
2574
  export declare type RawTransportStatus = 'connected' | 'disconnected';
2483
2575
 
2576
+ /** The current answer, outside React. */
2577
+ export declare const readApiOnline: (apiName?: string) => boolean;
2578
+
2484
2579
  export { readPairing }
2485
2580
 
2486
2581
  /**
@@ -2772,7 +2867,7 @@ export declare interface ResourceCansResult {
2772
2867
  * Non-struct schemas (a scalar input) are returned untouched — there is no
2773
2868
  * declared key set to restrict against.
2774
2869
  */
2775
- export declare const restrictToSchema: (schema: Schema.Schema.Any, input: unknown) => {
2870
+ export declare const restrictToSchema: (schema: Schema.Top, input: unknown) => {
2776
2871
  readonly input: unknown;
2777
2872
  readonly dropped: ReadonlyArray<string>;
2778
2873
  };
@@ -2862,91 +2957,91 @@ export declare const RICH_TEXT_MAX_NODES = 5000;
2862
2957
 
2863
2958
  export declare type RichTextBlock = typeof RichTextBlock_2.Type;
2864
2959
 
2865
- declare const RichTextBlock_2: Schema.Union<[Schema.Struct<{
2866
- type: Schema.Literal<["paragraph"]>;
2867
- content: Schema.Array$<Schema.Union<[Schema.Struct<{
2868
- type: Schema.Literal<["text"]>;
2869
- text: typeof Schema.String;
2870
- marks: Schema.optional<Schema.Array$<Schema.Literal<["bold", "italic", "code", "strike"]>>>;
2960
+ declare const RichTextBlock_2: Schema.Union<readonly [Schema.Struct<{
2961
+ readonly type: Schema.Literal<"paragraph">;
2962
+ readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
2963
+ readonly type: Schema.Literal<"text">;
2964
+ readonly text: Schema.String;
2965
+ readonly marks: Schema.optional<Schema.$Array<Schema.Literals<readonly ["bold", "italic", "code", "strike"]>>>;
2871
2966
  }>, Schema.Struct<{
2872
- type: Schema.Literal<["link"]>;
2873
- href: Schema.filter<typeof Schema.String>;
2874
- content: Schema.Array$<Schema.Struct<{
2875
- type: Schema.Literal<["text"]>;
2876
- text: typeof Schema.String;
2877
- marks: Schema.optional<Schema.Array$<Schema.Literal<["bold", "italic", "code", "strike"]>>>;
2967
+ readonly type: Schema.Literal<"link">;
2968
+ readonly href: Schema.String;
2969
+ readonly content: Schema.$Array<Schema.Struct<{
2970
+ readonly type: Schema.Literal<"text">;
2971
+ readonly text: Schema.String;
2972
+ readonly marks: Schema.optional<Schema.$Array<Schema.Literals<readonly ["bold", "italic", "code", "strike"]>>>;
2878
2973
  }>>;
2879
2974
  }>]>>;
2880
2975
  }>, Schema.Struct<{
2881
- type: Schema.Literal<["heading"]>;
2882
- level: Schema.Literal<[1, 2, 3]>;
2883
- content: Schema.Array$<Schema.Union<[Schema.Struct<{
2884
- type: Schema.Literal<["text"]>;
2885
- text: typeof Schema.String;
2886
- marks: Schema.optional<Schema.Array$<Schema.Literal<["bold", "italic", "code", "strike"]>>>;
2976
+ readonly type: Schema.Literal<"heading">;
2977
+ readonly level: Schema.Literals<readonly [1, 2, 3]>;
2978
+ readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
2979
+ readonly type: Schema.Literal<"text">;
2980
+ readonly text: Schema.String;
2981
+ readonly marks: Schema.optional<Schema.$Array<Schema.Literals<readonly ["bold", "italic", "code", "strike"]>>>;
2887
2982
  }>, Schema.Struct<{
2888
- type: Schema.Literal<["link"]>;
2889
- href: Schema.filter<typeof Schema.String>;
2890
- content: Schema.Array$<Schema.Struct<{
2891
- type: Schema.Literal<["text"]>;
2892
- text: typeof Schema.String;
2893
- marks: Schema.optional<Schema.Array$<Schema.Literal<["bold", "italic", "code", "strike"]>>>;
2983
+ readonly type: Schema.Literal<"link">;
2984
+ readonly href: Schema.String;
2985
+ readonly content: Schema.$Array<Schema.Struct<{
2986
+ readonly type: Schema.Literal<"text">;
2987
+ readonly text: Schema.String;
2988
+ readonly marks: Schema.optional<Schema.$Array<Schema.Literals<readonly ["bold", "italic", "code", "strike"]>>>;
2894
2989
  }>>;
2895
2990
  }>]>>;
2896
2991
  }>, Schema.Struct<{
2897
- type: Schema.Literal<["blockquote"]>;
2898
- content: Schema.Array$<Schema.Union<[Schema.Struct<{
2899
- type: Schema.Literal<["text"]>;
2900
- text: typeof Schema.String;
2901
- marks: Schema.optional<Schema.Array$<Schema.Literal<["bold", "italic", "code", "strike"]>>>;
2992
+ readonly type: Schema.Literal<"blockquote">;
2993
+ readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
2994
+ readonly type: Schema.Literal<"text">;
2995
+ readonly text: Schema.String;
2996
+ readonly marks: Schema.optional<Schema.$Array<Schema.Literals<readonly ["bold", "italic", "code", "strike"]>>>;
2902
2997
  }>, Schema.Struct<{
2903
- type: Schema.Literal<["link"]>;
2904
- href: Schema.filter<typeof Schema.String>;
2905
- content: Schema.Array$<Schema.Struct<{
2906
- type: Schema.Literal<["text"]>;
2907
- text: typeof Schema.String;
2908
- marks: Schema.optional<Schema.Array$<Schema.Literal<["bold", "italic", "code", "strike"]>>>;
2998
+ readonly type: Schema.Literal<"link">;
2999
+ readonly href: Schema.String;
3000
+ readonly content: Schema.$Array<Schema.Struct<{
3001
+ readonly type: Schema.Literal<"text">;
3002
+ readonly text: Schema.String;
3003
+ readonly marks: Schema.optional<Schema.$Array<Schema.Literals<readonly ["bold", "italic", "code", "strike"]>>>;
2909
3004
  }>>;
2910
3005
  }>]>>;
2911
3006
  }>, Schema.Struct<{
2912
- type: Schema.Literal<["bulletList"]>;
2913
- content: Schema.Array$<Schema.Struct<{
2914
- type: Schema.Literal<["listItem"]>;
2915
- content: Schema.Array$<Schema.Union<[Schema.Struct<{
2916
- type: Schema.Literal<["text"]>;
2917
- text: typeof Schema.String;
2918
- marks: Schema.optional<Schema.Array$<Schema.Literal<["bold", "italic", "code", "strike"]>>>;
3007
+ readonly type: Schema.Literal<"bulletList">;
3008
+ readonly content: Schema.$Array<Schema.Struct<{
3009
+ readonly type: Schema.Literal<"listItem">;
3010
+ readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
3011
+ readonly type: Schema.Literal<"text">;
3012
+ readonly text: Schema.String;
3013
+ readonly marks: Schema.optional<Schema.$Array<Schema.Literals<readonly ["bold", "italic", "code", "strike"]>>>;
2919
3014
  }>, Schema.Struct<{
2920
- type: Schema.Literal<["link"]>;
2921
- href: Schema.filter<typeof Schema.String>;
2922
- content: Schema.Array$<Schema.Struct<{
2923
- type: Schema.Literal<["text"]>;
2924
- text: typeof Schema.String;
2925
- marks: Schema.optional<Schema.Array$<Schema.Literal<["bold", "italic", "code", "strike"]>>>;
3015
+ readonly type: Schema.Literal<"link">;
3016
+ readonly href: Schema.String;
3017
+ readonly content: Schema.$Array<Schema.Struct<{
3018
+ readonly type: Schema.Literal<"text">;
3019
+ readonly text: Schema.String;
3020
+ readonly marks: Schema.optional<Schema.$Array<Schema.Literals<readonly ["bold", "italic", "code", "strike"]>>>;
2926
3021
  }>>;
2927
3022
  }>]>>;
2928
3023
  }>>;
2929
3024
  }>, Schema.Struct<{
2930
- type: Schema.Literal<["orderedList"]>;
2931
- content: Schema.Array$<Schema.Struct<{
2932
- type: Schema.Literal<["listItem"]>;
2933
- content: Schema.Array$<Schema.Union<[Schema.Struct<{
2934
- type: Schema.Literal<["text"]>;
2935
- text: typeof Schema.String;
2936
- marks: Schema.optional<Schema.Array$<Schema.Literal<["bold", "italic", "code", "strike"]>>>;
3025
+ readonly type: Schema.Literal<"orderedList">;
3026
+ readonly content: Schema.$Array<Schema.Struct<{
3027
+ readonly type: Schema.Literal<"listItem">;
3028
+ readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
3029
+ readonly type: Schema.Literal<"text">;
3030
+ readonly text: Schema.String;
3031
+ readonly marks: Schema.optional<Schema.$Array<Schema.Literals<readonly ["bold", "italic", "code", "strike"]>>>;
2937
3032
  }>, Schema.Struct<{
2938
- type: Schema.Literal<["link"]>;
2939
- href: Schema.filter<typeof Schema.String>;
2940
- content: Schema.Array$<Schema.Struct<{
2941
- type: Schema.Literal<["text"]>;
2942
- text: typeof Schema.String;
2943
- marks: Schema.optional<Schema.Array$<Schema.Literal<["bold", "italic", "code", "strike"]>>>;
3033
+ readonly type: Schema.Literal<"link">;
3034
+ readonly href: Schema.String;
3035
+ readonly content: Schema.$Array<Schema.Struct<{
3036
+ readonly type: Schema.Literal<"text">;
3037
+ readonly text: Schema.String;
3038
+ readonly marks: Schema.optional<Schema.$Array<Schema.Literals<readonly ["bold", "italic", "code", "strike"]>>>;
2944
3039
  }>>;
2945
3040
  }>]>>;
2946
3041
  }>>;
2947
3042
  }>, Schema.Struct<{
2948
- type: Schema.Literal<["codeBlock"]>;
2949
- text: typeof Schema.String;
3043
+ readonly type: Schema.Literal<"codeBlock">;
3044
+ readonly text: Schema.String;
2950
3045
  }>]>;
2951
3046
 
2952
3047
  declare type RichTextBlock = typeof RichTextBlock_2.Type;
@@ -2960,199 +3055,111 @@ declare type RichTextBlock = typeof RichTextBlock_2.Type;
2960
3055
  * editor with no extra `formField({ widget })` call — and the decode that
2961
3056
  * validates the mutation input IS the sanitizing boundary (see the header).
2962
3057
  */
2963
- export declare const RichTextDocument: Schema.refine<{
2964
- readonly type: "doc";
2965
- readonly content: readonly ({
2966
- readonly type: "paragraph";
2967
- readonly content: readonly ({
2968
- readonly type: "text";
2969
- readonly text: string;
2970
- readonly marks?: readonly ("code" | "bold" | "strike" | "italic")[] | undefined;
2971
- } | {
2972
- readonly type: "link";
2973
- readonly content: readonly {
2974
- readonly type: "text";
2975
- readonly text: string;
2976
- readonly marks?: readonly ("code" | "bold" | "strike" | "italic")[] | undefined;
2977
- }[];
2978
- readonly href: string;
2979
- })[];
2980
- } | {
2981
- readonly type: "heading";
2982
- readonly level: 2 | 1 | 3;
2983
- readonly content: readonly ({
2984
- readonly type: "text";
2985
- readonly text: string;
2986
- readonly marks?: readonly ("code" | "bold" | "strike" | "italic")[] | undefined;
2987
- } | {
2988
- readonly type: "link";
2989
- readonly content: readonly {
2990
- readonly type: "text";
2991
- readonly text: string;
2992
- readonly marks?: readonly ("code" | "bold" | "strike" | "italic")[] | undefined;
2993
- }[];
2994
- readonly href: string;
2995
- })[];
2996
- } | {
2997
- readonly type: "blockquote";
2998
- readonly content: readonly ({
2999
- readonly type: "text";
3000
- readonly text: string;
3001
- readonly marks?: readonly ("code" | "bold" | "strike" | "italic")[] | undefined;
3002
- } | {
3003
- readonly type: "link";
3004
- readonly content: readonly {
3005
- readonly type: "text";
3006
- readonly text: string;
3007
- readonly marks?: readonly ("code" | "bold" | "strike" | "italic")[] | undefined;
3008
- }[];
3009
- readonly href: string;
3010
- })[];
3011
- } | {
3012
- readonly type: "bulletList";
3013
- readonly content: readonly {
3014
- readonly type: "listItem";
3015
- readonly content: readonly ({
3016
- readonly type: "text";
3017
- readonly text: string;
3018
- readonly marks?: readonly ("code" | "bold" | "strike" | "italic")[] | undefined;
3019
- } | {
3020
- readonly type: "link";
3021
- readonly content: readonly {
3022
- readonly type: "text";
3023
- readonly text: string;
3024
- readonly marks?: readonly ("code" | "bold" | "strike" | "italic")[] | undefined;
3025
- }[];
3026
- readonly href: string;
3027
- })[];
3028
- }[];
3029
- } | {
3030
- readonly type: "orderedList";
3031
- readonly content: readonly {
3032
- readonly type: "listItem";
3033
- readonly content: readonly ({
3034
- readonly type: "text";
3035
- readonly text: string;
3036
- readonly marks?: readonly ("code" | "bold" | "strike" | "italic")[] | undefined;
3037
- } | {
3038
- readonly type: "link";
3039
- readonly content: readonly {
3040
- readonly type: "text";
3041
- readonly text: string;
3042
- readonly marks?: readonly ("code" | "bold" | "strike" | "italic")[] | undefined;
3043
- }[];
3044
- readonly href: string;
3045
- })[];
3046
- }[];
3047
- } | {
3048
- readonly type: "codeBlock";
3049
- readonly text: string;
3050
- })[];
3051
- }, Schema.Struct<{
3052
- type: Schema.Literal<["doc"]>;
3053
- content: Schema.Array$<Schema.Union<[Schema.Struct<{
3054
- type: Schema.Literal<["paragraph"]>;
3055
- content: Schema.Array$<Schema.Union<[Schema.Struct<{
3056
- type: Schema.Literal<["text"]>;
3057
- text: typeof Schema.String;
3058
- marks: Schema.optional<Schema.Array$<Schema.Literal<["bold", "italic", "code", "strike"]>>>;
3058
+ export declare const RichTextDocument: Schema.Struct<{
3059
+ readonly type: Schema.Literal<"doc">;
3060
+ readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
3061
+ readonly type: Schema.Literal<"paragraph">;
3062
+ readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
3063
+ readonly type: Schema.Literal<"text">;
3064
+ readonly text: Schema.String;
3065
+ readonly marks: Schema.optional<Schema.$Array<Schema.Literals<readonly ["bold", "italic", "code", "strike"]>>>;
3059
3066
  }>, Schema.Struct<{
3060
- type: Schema.Literal<["link"]>;
3061
- href: Schema.filter<typeof Schema.String>;
3062
- content: Schema.Array$<Schema.Struct<{
3063
- type: Schema.Literal<["text"]>;
3064
- text: typeof Schema.String;
3065
- marks: Schema.optional<Schema.Array$<Schema.Literal<["bold", "italic", "code", "strike"]>>>;
3067
+ readonly type: Schema.Literal<"link">;
3068
+ readonly href: Schema.String;
3069
+ readonly content: Schema.$Array<Schema.Struct<{
3070
+ readonly type: Schema.Literal<"text">;
3071
+ readonly text: Schema.String;
3072
+ readonly marks: Schema.optional<Schema.$Array<Schema.Literals<readonly ["bold", "italic", "code", "strike"]>>>;
3066
3073
  }>>;
3067
3074
  }>]>>;
3068
3075
  }>, Schema.Struct<{
3069
- type: Schema.Literal<["heading"]>;
3070
- level: Schema.Literal<[1, 2, 3]>;
3071
- content: Schema.Array$<Schema.Union<[Schema.Struct<{
3072
- type: Schema.Literal<["text"]>;
3073
- text: typeof Schema.String;
3074
- marks: Schema.optional<Schema.Array$<Schema.Literal<["bold", "italic", "code", "strike"]>>>;
3076
+ readonly type: Schema.Literal<"heading">;
3077
+ readonly level: Schema.Literals<readonly [1, 2, 3]>;
3078
+ readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
3079
+ readonly type: Schema.Literal<"text">;
3080
+ readonly text: Schema.String;
3081
+ readonly marks: Schema.optional<Schema.$Array<Schema.Literals<readonly ["bold", "italic", "code", "strike"]>>>;
3075
3082
  }>, Schema.Struct<{
3076
- type: Schema.Literal<["link"]>;
3077
- href: Schema.filter<typeof Schema.String>;
3078
- content: Schema.Array$<Schema.Struct<{
3079
- type: Schema.Literal<["text"]>;
3080
- text: typeof Schema.String;
3081
- marks: Schema.optional<Schema.Array$<Schema.Literal<["bold", "italic", "code", "strike"]>>>;
3083
+ readonly type: Schema.Literal<"link">;
3084
+ readonly href: Schema.String;
3085
+ readonly content: Schema.$Array<Schema.Struct<{
3086
+ readonly type: Schema.Literal<"text">;
3087
+ readonly text: Schema.String;
3088
+ readonly marks: Schema.optional<Schema.$Array<Schema.Literals<readonly ["bold", "italic", "code", "strike"]>>>;
3082
3089
  }>>;
3083
3090
  }>]>>;
3084
3091
  }>, Schema.Struct<{
3085
- type: Schema.Literal<["blockquote"]>;
3086
- content: Schema.Array$<Schema.Union<[Schema.Struct<{
3087
- type: Schema.Literal<["text"]>;
3088
- text: typeof Schema.String;
3089
- marks: Schema.optional<Schema.Array$<Schema.Literal<["bold", "italic", "code", "strike"]>>>;
3092
+ readonly type: Schema.Literal<"blockquote">;
3093
+ readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
3094
+ readonly type: Schema.Literal<"text">;
3095
+ readonly text: Schema.String;
3096
+ readonly marks: Schema.optional<Schema.$Array<Schema.Literals<readonly ["bold", "italic", "code", "strike"]>>>;
3090
3097
  }>, Schema.Struct<{
3091
- type: Schema.Literal<["link"]>;
3092
- href: Schema.filter<typeof Schema.String>;
3093
- content: Schema.Array$<Schema.Struct<{
3094
- type: Schema.Literal<["text"]>;
3095
- text: typeof Schema.String;
3096
- marks: Schema.optional<Schema.Array$<Schema.Literal<["bold", "italic", "code", "strike"]>>>;
3098
+ readonly type: Schema.Literal<"link">;
3099
+ readonly href: Schema.String;
3100
+ readonly content: Schema.$Array<Schema.Struct<{
3101
+ readonly type: Schema.Literal<"text">;
3102
+ readonly text: Schema.String;
3103
+ readonly marks: Schema.optional<Schema.$Array<Schema.Literals<readonly ["bold", "italic", "code", "strike"]>>>;
3097
3104
  }>>;
3098
3105
  }>]>>;
3099
3106
  }>, Schema.Struct<{
3100
- type: Schema.Literal<["bulletList"]>;
3101
- content: Schema.Array$<Schema.Struct<{
3102
- type: Schema.Literal<["listItem"]>;
3103
- content: Schema.Array$<Schema.Union<[Schema.Struct<{
3104
- type: Schema.Literal<["text"]>;
3105
- text: typeof Schema.String;
3106
- marks: Schema.optional<Schema.Array$<Schema.Literal<["bold", "italic", "code", "strike"]>>>;
3107
+ readonly type: Schema.Literal<"bulletList">;
3108
+ readonly content: Schema.$Array<Schema.Struct<{
3109
+ readonly type: Schema.Literal<"listItem">;
3110
+ readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
3111
+ readonly type: Schema.Literal<"text">;
3112
+ readonly text: Schema.String;
3113
+ readonly marks: Schema.optional<Schema.$Array<Schema.Literals<readonly ["bold", "italic", "code", "strike"]>>>;
3107
3114
  }>, Schema.Struct<{
3108
- type: Schema.Literal<["link"]>;
3109
- href: Schema.filter<typeof Schema.String>;
3110
- content: Schema.Array$<Schema.Struct<{
3111
- type: Schema.Literal<["text"]>;
3112
- text: typeof Schema.String;
3113
- marks: Schema.optional<Schema.Array$<Schema.Literal<["bold", "italic", "code", "strike"]>>>;
3115
+ readonly type: Schema.Literal<"link">;
3116
+ readonly href: Schema.String;
3117
+ readonly content: Schema.$Array<Schema.Struct<{
3118
+ readonly type: Schema.Literal<"text">;
3119
+ readonly text: Schema.String;
3120
+ readonly marks: Schema.optional<Schema.$Array<Schema.Literals<readonly ["bold", "italic", "code", "strike"]>>>;
3114
3121
  }>>;
3115
3122
  }>]>>;
3116
3123
  }>>;
3117
3124
  }>, Schema.Struct<{
3118
- type: Schema.Literal<["orderedList"]>;
3119
- content: Schema.Array$<Schema.Struct<{
3120
- type: Schema.Literal<["listItem"]>;
3121
- content: Schema.Array$<Schema.Union<[Schema.Struct<{
3122
- type: Schema.Literal<["text"]>;
3123
- text: typeof Schema.String;
3124
- marks: Schema.optional<Schema.Array$<Schema.Literal<["bold", "italic", "code", "strike"]>>>;
3125
+ readonly type: Schema.Literal<"orderedList">;
3126
+ readonly content: Schema.$Array<Schema.Struct<{
3127
+ readonly type: Schema.Literal<"listItem">;
3128
+ readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
3129
+ readonly type: Schema.Literal<"text">;
3130
+ readonly text: Schema.String;
3131
+ readonly marks: Schema.optional<Schema.$Array<Schema.Literals<readonly ["bold", "italic", "code", "strike"]>>>;
3125
3132
  }>, Schema.Struct<{
3126
- type: Schema.Literal<["link"]>;
3127
- href: Schema.filter<typeof Schema.String>;
3128
- content: Schema.Array$<Schema.Struct<{
3129
- type: Schema.Literal<["text"]>;
3130
- text: typeof Schema.String;
3131
- marks: Schema.optional<Schema.Array$<Schema.Literal<["bold", "italic", "code", "strike"]>>>;
3133
+ readonly type: Schema.Literal<"link">;
3134
+ readonly href: Schema.String;
3135
+ readonly content: Schema.$Array<Schema.Struct<{
3136
+ readonly type: Schema.Literal<"text">;
3137
+ readonly text: Schema.String;
3138
+ readonly marks: Schema.optional<Schema.$Array<Schema.Literals<readonly ["bold", "italic", "code", "strike"]>>>;
3132
3139
  }>>;
3133
3140
  }>]>>;
3134
3141
  }>>;
3135
3142
  }>, Schema.Struct<{
3136
- type: Schema.Literal<["codeBlock"]>;
3137
- text: typeof Schema.String;
3143
+ readonly type: Schema.Literal<"codeBlock">;
3144
+ readonly text: Schema.String;
3138
3145
  }>]>>;
3139
- }>>;
3146
+ }>;
3140
3147
 
3141
3148
  export declare type RichTextDocument = typeof RichTextDocument.Type;
3142
3149
 
3143
3150
  export declare type RichTextInline = typeof RichTextInline_2.Type;
3144
3151
 
3145
- declare const RichTextInline_2: Schema.Union<[Schema.Struct<{
3146
- type: Schema.Literal<["text"]>;
3147
- text: typeof Schema.String;
3148
- marks: Schema.optional<Schema.Array$<Schema.Literal<["bold", "italic", "code", "strike"]>>>;
3152
+ declare const RichTextInline_2: Schema.Union<readonly [Schema.Struct<{
3153
+ readonly type: Schema.Literal<"text">;
3154
+ readonly text: Schema.String;
3155
+ readonly marks: Schema.optional<Schema.$Array<Schema.Literals<readonly ["bold", "italic", "code", "strike"]>>>;
3149
3156
  }>, Schema.Struct<{
3150
- type: Schema.Literal<["link"]>;
3151
- href: Schema.filter<typeof Schema.String>;
3152
- content: Schema.Array$<Schema.Struct<{
3153
- type: Schema.Literal<["text"]>;
3154
- text: typeof Schema.String;
3155
- marks: Schema.optional<Schema.Array$<Schema.Literal<["bold", "italic", "code", "strike"]>>>;
3157
+ readonly type: Schema.Literal<"link">;
3158
+ readonly href: Schema.String;
3159
+ readonly content: Schema.$Array<Schema.Struct<{
3160
+ readonly type: Schema.Literal<"text">;
3161
+ readonly text: Schema.String;
3162
+ readonly marks: Schema.optional<Schema.$Array<Schema.Literals<readonly ["bold", "italic", "code", "strike"]>>>;
3156
3163
  }>>;
3157
3164
  }>]>;
3158
3165
 
@@ -3161,18 +3168,18 @@ declare type RichTextInline = typeof RichTextInline_2.Type;
3161
3168
  export declare type RichTextListItem = typeof RichTextListItem_2.Type;
3162
3169
 
3163
3170
  declare const RichTextListItem_2: Schema.Struct<{
3164
- type: Schema.Literal<["listItem"]>;
3165
- content: Schema.Array$<Schema.Union<[Schema.Struct<{
3166
- type: Schema.Literal<["text"]>;
3167
- text: typeof Schema.String;
3168
- marks: Schema.optional<Schema.Array$<Schema.Literal<["bold", "italic", "code", "strike"]>>>;
3171
+ readonly type: Schema.Literal<"listItem">;
3172
+ readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
3173
+ readonly type: Schema.Literal<"text">;
3174
+ readonly text: Schema.String;
3175
+ readonly marks: Schema.optional<Schema.$Array<Schema.Literals<readonly ["bold", "italic", "code", "strike"]>>>;
3169
3176
  }>, Schema.Struct<{
3170
- type: Schema.Literal<["link"]>;
3171
- href: Schema.filter<typeof Schema.String>;
3172
- content: Schema.Array$<Schema.Struct<{
3173
- type: Schema.Literal<["text"]>;
3174
- text: typeof Schema.String;
3175
- marks: Schema.optional<Schema.Array$<Schema.Literal<["bold", "italic", "code", "strike"]>>>;
3177
+ readonly type: Schema.Literal<"link">;
3178
+ readonly href: Schema.String;
3179
+ readonly content: Schema.$Array<Schema.Struct<{
3180
+ readonly type: Schema.Literal<"text">;
3181
+ readonly text: Schema.String;
3182
+ readonly marks: Schema.optional<Schema.$Array<Schema.Literals<readonly ["bold", "italic", "code", "strike"]>>>;
3176
3183
  }>>;
3177
3184
  }>]>>;
3178
3185
  }>;
@@ -3214,7 +3221,7 @@ export declare interface RpcError {
3214
3221
  * server may have committed before the response disappeared. */
3215
3222
  readonly outcome?: RpcCallOutcome;
3216
3223
  /** Trace id of the CLIENT call span. When the server accepted the request,
3217
- * @effect/rpc propagates this same id into its span. A transport failure may
3224
+ * effect/rpc propagates this same id into its span. A transport failure may
3218
3225
  * happen before that, so the id is not proof that server logs exist. Present
3219
3226
  * only when a client span was active. */
3220
3227
  readonly traceId?: string;
@@ -3290,6 +3297,9 @@ export declare type RpcSuccessListener = (event: RpcSuccess) => void;
3290
3297
  */
3291
3298
  export declare const runDeepLink: <Pattern extends string>(descriptor: DeepLinkDescriptor<Pattern>, path: string) => DeepLinkParams<Pattern> | null;
3292
3299
 
3300
+ /** The query itself, outside React — `rows` from `SubscriptionCache.rowsOf`. */
3301
+ export declare const runLocalQuery: <Row>(rows: ReadonlyArray<Row>, options?: LocalQueryOptions<Row>) => ReadonlyArray<Row>;
3302
+
3293
3303
  /**
3294
3304
  * Run a sequence. Resolves with a discriminated result rather than rejecting —
3295
3305
  * the same "handled" semantics `useMutation`/`useAction` use, so the call site
@@ -3321,14 +3331,14 @@ export declare interface RunSequenceOptions {
3321
3331
  * its properties (same descriptor shape as `schemaToFields`, reused for
3322
3332
  * `<DataTable>` cells). Returns `[]` if the output isn't an array of objects.
3323
3333
  */
3324
- export declare const schemaToColumns: (schema: Schema.Schema.Any) => ReadonlyArray<FieldDescriptor>;
3334
+ export declare const schemaToColumns: (schema: Schema.Top) => ReadonlyArray<FieldDescriptor>;
3325
3335
 
3326
3336
  /**
3327
3337
  * Derive the ordered field list for a `Schema.Struct` input. Returns `[]` for a
3328
3338
  * schema with no object properties (a scalar, `Schema.Void`, or anything
3329
3339
  * `JSONSchema.make` cannot represent).
3330
3340
  */
3331
- export declare const schemaToFields: (schema: Schema.Schema.Any) => ReadonlyArray<FieldDescriptor>;
3341
+ export declare const schemaToFields: (schema: Schema.Top) => ReadonlyArray<FieldDescriptor>;
3332
3342
 
3333
3343
  /**
3334
3344
  * Seed a subscription's first value for THIS request's hydration. Call it on the
@@ -3765,6 +3775,9 @@ export declare interface StoreUseOptions<T> {
3765
3775
  readonly retain?: boolean;
3766
3776
  }
3767
3777
 
3778
+ /** Call `listener` whenever the answer may have changed. Returns the unsubscribe. */
3779
+ export declare const subscribeApiOnline: (listener: () => void) => (() => void);
3780
+
3768
3781
  export declare const subscribeClientDiagnostics: (listener: () => void) => (() => void);
3769
3782
 
3770
3783
  /** Subscribe to client errors. Returns an unsubscribe fn. */
@@ -3780,6 +3793,18 @@ export declare const subscribeStoreHistory: (listener: Listener) => (() => void)
3780
3793
 
3781
3794
  export declare class SubscriptionCache {
3782
3795
  private readonly entries;
3796
+ private readonly entriesByTable;
3797
+ private readonly entriesByTag;
3798
+ private readonly entriesByMutation;
3799
+ private readonly patchMemberships;
3800
+ private readonly entryOrder;
3801
+ private orderedMemberships;
3802
+ private nextEntryOrder;
3803
+ /** Standing optimistic intents, by mutation id — see `autoApply`. */
3804
+ private readonly intents;
3805
+ private readonly tableRows;
3806
+ private readonly anyListeners;
3807
+ private readonly tableListeners;
3783
3808
  private readonly refreshing;
3784
3809
  /**
3785
3810
  * Same-subject runtime replacement. A mutation may settle against the cache
@@ -3901,7 +3926,15 @@ export declare class SubscriptionCache {
3901
3926
  * these defaults. All patches are tagged with `mutationId` for atomic
3902
3927
  * revert.
3903
3928
  */
3904
- autoApply(targets: ReadonlyArray<AutoApplyTarget>, input: Record<string, unknown>, mutationId: string): void;
3929
+ autoApply(targets: ReadonlyArray<AutoApplyTarget>, input: Record<string, unknown>, mutationId: string, options?: {
3930
+ readonly standing?: boolean;
3931
+ }): void;
3932
+ /** Whether a standing intent for `mutationId` is still held (see
3933
+ * {@link SubscriptionCache.autoApply}). Carried to a same-subject
3934
+ * replacement cache, so a stager can tell "already staged" from "new". */
3935
+ hasIntent(mutationId: string): boolean;
3936
+ private applyIntent;
3937
+ private applyStandingIntents;
3905
3938
  /** Drop a specific patch by id. */
3906
3939
  private revertPatch;
3907
3940
  /**
@@ -4027,7 +4060,30 @@ export declare class SubscriptionCache {
4027
4060
  private createStub;
4028
4061
  private freshState;
4029
4062
  private startFiber;
4063
+ private sourceTables;
4064
+ private addIndex;
4065
+ private removeIndex;
4066
+ private orderedEntries;
4067
+ private indexSource;
4068
+ private appendPatch;
4069
+ private replacePatches;
4070
+ private indexPatches;
4071
+ private registerEntry;
4072
+ private unindexEntry;
4030
4073
  private invalidate;
4074
+ /**
4075
+ * Every row of `table` this cache holds — the client's local replica of the
4076
+ * table: the union of the rows of every entry sourced on that table ALONE
4077
+ * (an entry over several tables holds joined shapes, not rows of one),
4078
+ * optimistic previews and mirror-seeded rows included, deduplicated by `id`.
4079
+ * Memoised per table until the next change, so the result is reference-stable
4080
+ * for `useSyncExternalStore`.
4081
+ */
4082
+ rowsOf(table: string): ReadonlyArray<Readonly<Record<string, unknown>>>;
4083
+ /** Subscribe to cache changes affecting this source table only. */
4084
+ subscribeTable(table: string, listener: () => void): () => void;
4085
+ /** Call `listener` after any entry changed. Returns the unsubscribe. */
4086
+ subscribeAny(listener: () => void): () => void;
4031
4087
  private getSnapshot;
4032
4088
  private unsubscribe;
4033
4089
  /** Start (or restart) the inactive-TTL countdown for `entry`: unless
@@ -4189,8 +4245,42 @@ export declare interface SubscriptionMirror {
4189
4245
  readonly data: unknown;
4190
4246
  readonly revision: number;
4191
4247
  }) => Promise<void>;
4248
+ /**
4249
+ * Queries to keep subscribed for the whole connection generation, as
4250
+ * `[tag, input]` — so they are mirrored, and readable offline, before any
4251
+ * screen ever opened them. Offline coverage is otherwise "what the user
4252
+ * happened to visit"; this makes it a declaration.
4253
+ */
4254
+ readonly warm?: ReadonlyArray<readonly [tag: string, input: Readonly<Record<string, unknown>>]>;
4255
+ /**
4256
+ * Tags to keep warm with an EMPTY input — each one whose declared input
4257
+ * schema accepts `{}` (a list, a feed, a settings read). The runtime makes
4258
+ * that check against the descriptors; a tag that needs parameters is left
4259
+ * out rather than subscribed into an error.
4260
+ */
4261
+ readonly warmTags?: ReadonlyArray<string>;
4262
+ }
4263
+
4264
+ /** What a {@link SubscriptionMirrorSource} is told about the api it mirrors. */
4265
+ export declare interface SubscriptionMirrorContext {
4266
+ /** The api's mount name (`'app'`). */
4267
+ readonly apiName: string;
4268
+ /** The api's rpc descriptors — each query's `source` table(s) is how a source
4269
+ * derives which queries read local-first tables without being told. */
4270
+ readonly descriptors: Readonly<Record<string, ClientDescriptor>>;
4192
4271
  }
4193
4272
 
4273
+ /**
4274
+ * Where a runtime gets its {@link SubscriptionMirror}: called ONCE per
4275
+ * connection generation, before that generation's cache exists. The cache
4276
+ * keeps what it returned for its whole life, so a mirror is never swapped
4277
+ * under a live cache — a sign-in or tenant switch (`reconnect()`) builds a new
4278
+ * generation, and THAT call resolves the next subject's partition. Resolving
4279
+ * to `undefined` (nobody signed in, no durable storage) mirrors nothing.
4280
+ * `@voltro/local-first`'s `createMirrorSource` is the implementation.
4281
+ */
4282
+ export declare type SubscriptionMirrorSource = (context: SubscriptionMirrorContext) => SubscriptionMirror | undefined | Promise<SubscriptionMirror | undefined>;
4283
+
4194
4284
  /**
4195
4285
  * Subscribe to a streaming rpc by tag.
4196
4286
  *
@@ -4604,6 +4694,8 @@ export declare interface UploadHandle {
4604
4694
  export declare interface UploadOptions {
4605
4695
  /** `'private'` (default) or `'public'`. Public objects get a cacheable URL. */
4606
4696
  readonly visibility?: 'public' | 'private';
4697
+ /** Requested private-file policy. The server must authorize it before issuing a ticket. */
4698
+ readonly access?: StorageAccessPolicy;
4607
4699
  /** Fixed logical key (e.g. `avatars/<userId>.png`); else content-addressed. */
4608
4700
  readonly key?: string;
4609
4701
  /** App metadata stored on the ref (so no parallel `assets` table is needed). */
@@ -4682,6 +4774,9 @@ export declare interface UseAgentChatOptions {
4682
4774
 
4683
4775
  export declare const useAgentStream: <E = unknown>(apiName: string, rpcTag: string) => AgentStreamControls<E>;
4684
4776
 
4777
+ /** Can a write reach `apiName` (or any mounted api) right now? */
4778
+ export declare const useApiOnline: (apiName?: string) => boolean;
4779
+
4685
4780
  export declare const useAsyncValidation: (apiName: string, queryTag: string, value: string, options: UseAsyncValidationOptions) => AsyncValidationResult;
4686
4781
 
4687
4782
  export declare interface UseAsyncValidationOptions {
@@ -4786,7 +4881,7 @@ export declare const useDerived: <S extends Record<string, unknown>, T>(sources:
4786
4881
  * at this call site, and the `key` must structurally match the descriptor's key
4787
4882
  * schema, so a typo cannot produce a subscription that silently never fires.
4788
4883
  */
4789
- export declare function useEvent<Name extends string, Key extends Schema.Schema.Any, Payload extends Schema.Schema.Any>(descriptor: EventDescriptor_2<Name, Key, Payload>, key: Schema.Schema.Type<Key> | null, handler: (payload: Schema.Schema.Type<Payload>) => void, options?: UseEventOptions): EventState;
4884
+ export declare function useEvent<Name extends string, Key extends Schema.Top, Payload extends Schema.Top>(descriptor: EventDescriptor_2<Name, Key, Payload>, key: Schema.Schema.Type<Key> | null, handler: (payload: Schema.Schema.Type<Payload>) => void, options?: UseEventOptions): EventState;
4790
4885
 
4791
4886
  export declare interface UseEventOptions {
4792
4887
  /**
@@ -4835,7 +4930,7 @@ export declare interface UseFormBindingOptions<Input> {
4835
4930
  * the mounted client descriptor (`descriptors[tag].input`, the capability
4836
4931
  * map — innovation/06). Pass it explicitly to override, or when the
4837
4932
  * descriptor isn't on the client. */
4838
- readonly schema?: Schema.Schema.Any;
4933
+ readonly schema?: Schema.Top;
4839
4934
  /** Initial field values. */
4840
4935
  readonly defaults?: Partial<Input>;
4841
4936
  /** The failed no-JS POST's payload for THIS form (`useFormFlash` from
@@ -4962,6 +5057,10 @@ export declare const useFrameworkApi: (apiName: string) => ApiHandle;
4962
5057
 
4963
5058
  export declare const useFrameworkRuntimes: () => FrameworkRuntimes;
4964
5059
 
5060
+ /** Query the local replica of `table` (see the module header). Re-renders when
5061
+ * any row of the api's cache changes. */
5062
+ export declare const useLocalQuery: <Row = Readonly<Record<string, unknown>>>(apiName: string, table: string, options?: LocalQueryOptions<Row>) => ReadonlyArray<Row>;
5063
+
4965
5064
  /**
4966
5065
  * Invoke a unary rpc by tag. The descriptor metadata (mounted via
4967
5066
  * `app.config.ts`'s `apis` → emitted by codegen as `appDescriptors`)
@@ -4978,17 +5077,42 @@ export declare const useOnRpcError: (apiName: string, listener: RpcErrorListener
4978
5077
  export declare const useOutbox: (options: UseOutboxOptions) => OutboxControls;
4979
5078
 
4980
5079
  export declare interface UseOutboxOptions {
4981
- /** Perform one queued write (the real mutation). Throw to fail. */
4982
- readonly send: (entry: OutboxEntry) => Promise<void>;
5080
+ /**
5081
+ * The api the queued writes go to, by its mount name (`'app'`). Bound, the
5082
+ * outbox is the framework's offline write lane:
5083
+ *
5084
+ * - `send` defaults to the api's own mutation for the entry's tag, with
5085
+ * the entry id as its idempotency key — a write the server committed
5086
+ * whose answer was lost is not applied twice when it is resent;
5087
+ * - every queued write PREVIEWS through the mutation's declared `targets`
5088
+ * on every query that reads its table — including queries opened later
5089
+ * and rows rendered from the durable mirror after a reload — until it is
5090
+ * sent (the server's echo then supersedes it) or conflicts (reverted);
5091
+ * - connectivity follows the api's transport, not just the browser;
5092
+ * - a sign-in or tenant switch drops the previous subject's queue from
5093
+ * memory and loads the next one's from `persistence`.
5094
+ */
5095
+ readonly api?: string;
5096
+ /** Perform one queued write (the real mutation). Throw to fail. Required
5097
+ * unless `api` is set, where it defaults to the api's mutation. */
5098
+ readonly send?: (entry: OutboxEntry) => Promise<void>;
4983
5099
  /** Durable backing (see {@link OutboxPersistence}). Omitted → in-memory only. */
4984
5100
  readonly persistence?: OutboxPersistence;
4985
- /** Online override (defaults to navigator.onLine + online/offline events). */
5101
+ /** Online override. Default: the browser's signal AND, with `api`, that
5102
+ * api's transport (`useApiOnline`). */
4986
5103
  readonly online?: boolean;
4987
5104
  /** Classify a send error as a conflict (blocks replay) vs a transient
4988
5105
  * failure (retried). Default: an error with `conflict === true` or the
4989
5106
  * undo concurrency tag. */
4990
5107
  readonly isConflict?: (error: unknown) => boolean;
4991
5108
  readonly idFor?: () => string;
5109
+ /** Milliseconds before a transiently failed write is retried, after
5110
+ * `attempts` failures. Default {@link defaultOutboxRetryDelay}. Going online
5111
+ * retries at once. */
5112
+ readonly retryDelay?: (attempts: number) => number;
5113
+ /** Stamp each enqueued write (`OutboxEntry.stamp`) — pass a hybrid logical
5114
+ * clock's `now` (`createHybridClock` in `@voltro/local-first`). */
5115
+ readonly stamp?: () => string;
4992
5116
  }
4993
5117
 
4994
5118
  /** The current subject's scopes (defaults to none if no provider). */
@@ -5080,7 +5204,7 @@ export declare const useResumableAgentStream: <E = unknown>(apiName: string, rpc
5080
5204
  /** A schema-owned form for actions, parent plans, and local saves. It uses the
5081
5205
  * same validation/field engine without connecting to an API or inventing a tag. */
5082
5206
  export declare const useSchemaFormBinding: <Input extends Record<string, unknown>, Encoded, Output>(options: Omit<UseFormBindingOptions<Input>, "schema" | "onSubmit"> & {
5083
- readonly schema: Schema.Schema<Input, Encoded>;
5207
+ readonly schema: Schema.Codec<Input, Encoded>;
5084
5208
  readonly onSubmit: (input: Input) => Output | Promise<Output>;
5085
5209
  }) => FormBinding<Input, Output>;
5086
5210
 
@@ -5258,7 +5382,7 @@ export declare const validateEventPayload: (descriptor: EventDescriptor<string,
5258
5382
  * pass. Client-side validation is non-authoritative UX — the server
5259
5383
  * re-validates the same schema on the mutation.
5260
5384
  */
5261
- export declare const validateFields: (schema: Schema.Schema.Any, values: unknown, options?: ValidateOptions) => ValidationResult;
5385
+ export declare const validateFields: (schema: Schema.Top, values: unknown, options?: ValidateOptions) => ValidationResult;
5262
5386
 
5263
5387
  export declare interface ValidateOptions {
5264
5388
  /** BCP-47-ish tag; only the primary subtag is read. Default: the document's
@@ -5305,6 +5429,8 @@ export declare const validationStatus: (args: {
5305
5429
  readonly skipEmpty?: boolean;
5306
5430
  }) => AsyncValidationResult;
5307
5431
 
5432
+ export { WebSocketConstructorOptions }
5433
+
5308
5434
  /** The default widget kinds the framework can render from a schema. `'custom'`
5309
5435
  * means "no default widget" — the field needs a render-prop (a nested object,
5310
5436
  * an array of objects, or a multi-branch union). Mirrors innovation/01's set. */
@@ -5369,8 +5495,6 @@ export declare type WithOptimistic<T> = T extends ReadonlyArray<infer Element> ?
5369
5495
  readonly optimistic?: boolean;
5370
5496
  } : Element> : T;
5371
5497
 
5372
- /* Excluded from this release type: withProtocolOpenRecovery */
5373
-
5374
5498
  export declare interface WorkflowClientMessages {
5375
5499
  readonly signals?: Readonly<Record<string, unknown>>;
5376
5500
  readonly updates?: Readonly<Record<string, {