@spooky-sync/core 1.0.0-beta.1 → 1.0.0-beta.11

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.
Files changed (55) hide show
  1. package/AGENTS.md +4 -3
  2. package/dist/index.d.ts +170 -9
  3. package/dist/index.js +5398 -2968
  4. package/dist/rows-worker.d.ts +1 -0
  5. package/dist/rows-worker.js +2731 -0
  6. package/dist/sqlite-open.js +1 -1
  7. package/dist/sqlite-worker.js +1 -1
  8. package/dist/types.d.ts +131 -13
  9. package/package.json +9 -4
  10. package/scripts/check-worker-entries.mjs +15 -2
  11. package/skills/sp00ky-core/SKILL.md +2 -0
  12. package/src/client/bucket-handle.ts +21 -1
  13. package/src/client/eager-paint.test.ts +82 -0
  14. package/src/client/services.ts +4 -1
  15. package/src/client/sp00ky-client.test.ts +143 -1
  16. package/src/client/sp00ky-client.ts +158 -19
  17. package/src/index.ts +9 -0
  18. package/src/kernel/effects.ts +12 -2
  19. package/src/kernel/interpreter.test.ts +17 -0
  20. package/src/kernel/interpreter.ts +5 -2
  21. package/src/modules/channel/hub.test.ts +223 -0
  22. package/src/modules/channel/hub.ts +355 -0
  23. package/src/modules/channel/index.ts +358 -14
  24. package/src/modules/channel/room.test.ts +340 -0
  25. package/src/modules/channel/room.ts +367 -0
  26. package/src/modules/channel/rooms.fixture.ts +383 -0
  27. package/src/modules/channel/share.test.ts +535 -0
  28. package/src/modules/channel/webrtc.ts +2 -2
  29. package/src/modules/devtools/storage-info.ts +4 -3
  30. package/src/query/materialize.saga.test.ts +16 -0
  31. package/src/query/materialize.saga.ts +7 -26
  32. package/src/query/materialize.ts +79 -3
  33. package/src/query/register.saga.test.ts +61 -0
  34. package/src/query/register.saga.ts +39 -2
  35. package/src/services/database/cache-engine.ts +17 -3
  36. package/src/services/database/engine-factory.ts +7 -0
  37. package/src/services/database/index.ts +1 -0
  38. package/src/services/database/rows-cache-engine.test.ts +1584 -0
  39. package/src/services/database/rows-cache-engine.ts +1203 -0
  40. package/src/services/database/rows-exec.integration.test.ts +589 -0
  41. package/src/services/database/rows-exec.ts +1027 -0
  42. package/src/services/database/rows-prewarm.ts +251 -0
  43. package/src/services/database/rows-store.test.ts +635 -0
  44. package/src/services/database/rows-store.ts +1208 -0
  45. package/src/services/database/rows-transport.fixture.ts +151 -0
  46. package/src/services/database/rows-worker.ts +607 -0
  47. package/src/services/database/rows-yield.test.ts +141 -0
  48. package/src/services/database/rows-yield.ts +92 -0
  49. package/src/services/database/sqlite-cache-engine.test.ts +22 -1
  50. package/src/services/database/sqlite-cache-engine.ts +55 -34
  51. package/src/services/database/sqlite-transport.ts +7 -5
  52. package/src/services/tabs/support.ts +6 -4
  53. package/src/types.ts +41 -6
  54. package/tsdown.config.ts +42 -1
  55. package/vitest.config.ts +4 -0
package/AGENTS.md CHANGED
@@ -45,7 +45,7 @@ re-materialized from state, never patched in place.
45
45
  - `services/blobs/` — durable cache for bucket bytes: OPFS holds the files, `_00_blob` holds a manifest that reconcile rebuilds from disk (so a wiped local store costs metadata, not the offline cache). Nothing expires on a timer; eviction is LRU under a byte budget only, skipping pinned and on-screen entries. Config: `blobCache` in `types.ts`.
46
46
  - `AuthService` — token management, sign-in/sign-out events. `subscribe(cb, { immediate? })` calls `cb` at once with the current user unless `immediate: false`, then on every change.
47
47
  - `CrdtManager`, `CrdtField`, `cursorColorFromName`, `CURSOR_COLORS`: collaborative `@crdt` fields on Loro. Client methods: `openCrdtField(table, recordId, field, draft?)` -> `Promise<CrdtField>` (every open of one field in a tab shares one `LoroDoc`; pair each with a close), `closeCrdtField(table, recordId, field)` -> `Promise<void>` (resolves once unsent edits are in the outbox; offline, once they are saved on the device, never waiting on the network), `createCrdtDraft(table, field)` -> a detached `CrdtField` for a record not created yet (`db.create` first, then pass it to `openCrdtField` as `draft`). `CrdtField`: `getDoc()`, `hasContent()`, `pushCursorState(bytes)`, `onCursorUpdate = cb` (a setter). Config: `crdt: true` preloads Loro, `crdtDebounceMs` (the first edit after a quiet spell waits this long, default 50), `crdtSendIntervalMs` (shortest gap between two sends of one field while typing, default 200). Design: `docs/crdt-v2.md` at the repo root.
48
- - **Peer to peer channels** (`-- @channel` tables, experimental): `client.channel(query, peers)` (a query builder, a built query, or a list, on `@channel` tables; typed from the query; own id skipped; both sides must list each other) opens WebRTC data channels to the peers' tabs and returns `Sp00kyChannel` (`state()`, `subscribe(cb)`, `setPeers`, `setQueries`, `close`, `tables()`, plus scoped `update` / `create` / `delete`). Only the query's `where` counts (`matchesWhere`, pure JS over the plan; `compileScope` throws for `.related()`, link-following paths, `$params`, unknown ops); it is never registered. `orderBy` / `limit` / `offset` / `select` / `.one()` warn once per shape (`unusedArgs`) unless the builder has `.ignoreUnusedArgs()`. Writes go to the peers of every open channel whose filter the row matches: a create checks the new row, an update or delete the stored row (`readRow` saga) before and after the patch. A peer's write is taken only if the sender is listed by a channel whose filter the row matches (an update/delete of a row not held is ignored). Peers fold updates into every subscription showing the row (output only, never the store): normal fields retire once the synced row holds them (or after `channels.confirmTimeoutMs`, default 5000); `-- @ephemeral` fields (optional, never filtered on) never reach the database, last writer wins, vanish when their author disconnects. A peer's create goes into the store and circuit like an own optimistic create minus the outbox (`peerCreate` saga, `state.peerWrites` folded into `overlay()`) and is undone at `confirmTimeoutMs` unless the server body landed (`versions`); a peer's delete hides the row through the overlay until it expires (`peerDelete`, `PeerWriteExpired`). Signaling is raw CREATE/LIVE on the generated server-only `_00_channel_signal` (sender stamped by the DB). Everything beyond identity, filter and field types is `channels.accept: { [table]: ({ kind, from, table, id, row, patch }) => boolean }`. Config also `iceServers`, `transport`. Dart has the same feature on the same wire protocol (`spooky_core` `modules/channel/`, `client.channel(...)`, WebRTC via `spooky_flutter`'s `flutterWebRtc`), so web and Flutter peers interoperate: keep the message shape, signaling rows and offer/answer ordering in step across both. Code: `modules/channel/`. Docs: `/docs/client/channels`.
48
+ - **Peer to peer channels** (`-- @channel` tables, experimental): `client.channel(query, peers)` (a query builder, a built query, or a list, on `@channel` tables; typed from the query; own id skipped; both sides must list each other) opens WebRTC data channels to the peers' tabs and returns `Sp00kyChannel` (`state()`, `subscribe(cb)`, `setPeers`, `setQueries`, `close`, `tables()`, plus scoped `update` / `create` / `delete`). Only the query's `where` counts (`matchesWhere`, pure JS over the plan; `compileScope` throws for `.related()`, link-following paths, `$params`, unknown ops); it is never registered. `orderBy` / `limit` / `offset` / `select` / `.one()` warn once per shape (`unusedArgs`) unless the builder has `.ignoreUnusedArgs()`. Writes go to the peers of every open channel whose filter the row matches: a create checks the new row, an update or delete the stored row (`readRow` saga) before and after the patch. A peer's write is taken only if the sender is listed by a channel whose filter the row matches (an update/delete of a row not held is ignored). Peers fold updates into every subscription showing the row (output only, never the store): normal fields retire once the synced row holds them (or after `channels.confirmTimeoutMs`, default 5000); `-- @ephemeral` fields (optional, never filtered on) never reach the database, last writer wins, vanish when their author disconnects. A peer's create goes into the store and circuit like an own optimistic create minus the outbox (`peerCreate` saga, `state.peerWrites` folded into `overlay()`) and is undone at `confirmTimeoutMs` unless the server body landed (`versions`); a peer's delete hides the row through the overlay until it expires (`peerDelete`, `PeerWriteExpired`). Signaling is raw CREATE/LIVE on the generated server-only `_00_channel_signal` (sender stamped by the DB). Everything beyond identity, filter and field types is `channels.accept: { [table]: ({ kind, from, table, id, row, patch }) => boolean }`. Config also `iceServers`, `transport`. **Sharing with the user's own devices** (`channels.share`, needs `channels.relay`; Dart and Rust have the same on the same wire): `share: { tables: { game: true, note: (row) => !row.draft } }` sends the user's own optimistic writes on those tables (no `-- @channel` needed) to their other devices, which treat them like any peer's write. `ChannelManager` keeps one internal channel whose only user is the signed-in one (`sharing`, `ownState()`, `subscribeOwn`; facade: `client.shareState()`, `client.subscribeShareState(cb)`). Transport: `splitTransport(room, mesh)` routes the own user to the room and everybody else to the WebRTC mesh. The room is `hubTransport` (`modules/channel/hub.ts`: one link per browser, a Web Lock picks the tab that holds it, the others reach it over a `BroadcastChannel`; hubs tell each other which tabs they speak for, so a peer is still one tab; tabs of one browser are not peers) over `roomLink` (`modules/channel/room.ts`: a WebSocket to `sp00ky-relay`, protocol in `apps/relay/README.md`, hello with the session token, reconnect with backoff, plus a direct WebRTC link signaled through the relay while exactly two browsers are in the room). Interest: each tab tells the user's other tabs what its subscriptions can show (`client.subscribe` passes `channels.interestOf(def.plan, def.params)` to `tap`; `queryInterest` / `mergeInterest` / `showsRow`, wire message `{ t: 'interest' }`, only ever between tabs of one user), and `send` skips a tab that shows nothing of the row; a filter the row alone cannot decide, or a table read through `.related()`, counts as the whole table. A native client (Dart `spooky_core` `modules/channel/room.dart`, Rust `core-rs` `modules/channel/room.rs`) is a hub with one tab and no direct link; a change to the relay frames, the hub envelope (`{ h: 'tabs' }`, `{ h: 'm' }`) or the interest message needs all three clients. Dart has the same feature on the same wire protocol (`spooky_core` `modules/channel/`, `client.channel(...)`, WebRTC via `spooky_flutter`'s `flutterWebRtc`), so web and Flutter peers interoperate: keep the message shape, signaling rows and offer/answer ordering in step across both. Code: `modules/channel/`. Docs: `/docs/client/channels`.
49
49
  - Types: `Sp00kyConfig` (client-solid wraps it as `SyncedDbConfig`), `QueryTimeToLive`, `PersistenceClient`, `StoreType`, `UpdateOptions`, `RunOptions`, `PreloadOptions`.
50
50
  - Subpath: `@spooky-sync/core/otel` — `createOtelTransmit(endpoint)` for piping pino logs to OpenTelemetry.
51
51
  - `client.webPush` (`WebPushModule`, `db.webPush` in the Solid bindings) - Web Push on the page: `support()`, `info()`, `subscribe(opts)` (call from a click), `unsubscribe(opts)`, `sync()`, `isSubscribed()`, `update(opts)`, `devices()`, `notify(msg)`, `cancel(id)`, `test()`, `bridge()`, `onMessage(cb)`. Server calls are `fn::push::*`; typed `WebPushError`; config `webPush` in `types.ts`. Sign-out runs through `AuthService.onBeforeSignOut`.
@@ -64,8 +64,9 @@ re-materialized from state, never patched in place.
64
64
  - **`@parent` columns are auto-populated.** Defined in the `.surql` schema as `record<user>` with the `-- @parent` annotation; never write them yourself — they're set from the auth context server-side.
65
65
  - **`db.preload` is a registered query.** Resolved before on this device (a `_00_view` row exists) it returns at once; never resolved it waits until the server's membership and every body are local. A signed-out session without `enableAnonymousLiveQueries` is never sent membership, so its preload returns at once instead of blocking. It holds no subscriber, so it is evicted a ttl after registration unless a view mounts the same query. `refresh`/`staleTime` are ignored; pass `signal` to abort a cold wait.
66
66
  - **A never-resolved query paints only vouched rows.** Before the server answers (`cold`), the local predicate scan shows a cached body only if some `_00_view` row names it (as a member or subquery child) or a write for it is in flight. A body no view names is an orphan (deleted upstream while nothing watched it): it stays hidden, and the GC deletes it 30 s after boot and then hourly. A `_00_view` row no query has resolved for 14 days is retired by the same sweep, so that query paints cold again.
67
- - **`database.store` defaults to `'memory'`.** `'indexeddb'` keeps one IndexedDB database per user bucket (`sp00ky-<bucket>`) and needs `@surrealdb/wasm` >= 3.1.0: the 3.0.x engine opened the store but failed every write (`An IndexedDB error occured: idb error`), so each session fell back to memory. 3.1.0 ships the engine as `@surrealdb/wasm-native`; a Vite app lists it in `optimizeDeps.exclude` next to `@surrealdb/wasm`. A store that still cannot open after a drop runs the session in memory (error log `falling back to in-memory`). Under `localEngine: 'sqlite'`, `'indexeddb'` means OPFS.
68
- - **`database.workers` lets the app start the local store's worker.** Only for a bundler that does not bundle a `new Worker(new URL(...))` inside a dependency, i.e. the Angular CLI: `workers.surreal` returns a module worker whose entry is `import '@surrealdb/wasm/worker'`, `workers.sqlite` (with `localEngine: 'sqlite'`) one whose entry is `import '@spooky-sync/core/sqlite-worker'` (an export kept in `sideEffects` so the bare import survives tree shaking). Unset, the built-in worker expressions run as before; Vite / Rollup / webpack apps leave it unset.
67
+ - **`database.store` defaults to `'memory'`.** `'indexeddb'` keeps one IndexedDB database per user bucket (`sp00ky-<bucket>`) and needs `@surrealdb/wasm` >= 3.1.0: the 3.0.x engine opened the store but failed every write (`An IndexedDB error occured: idb error`), so each session fell back to memory. 3.1.0 ships the engine as `@surrealdb/wasm-native`; a Vite app lists it in `optimizeDeps.exclude` next to `@surrealdb/wasm`. A store that still cannot open after a drop runs the session in memory (error log `falling back to in-memory`). Under `localEngine: 'sqlite'` or `'rows'`, `'indexeddb'` means OPFS.
68
+ - **`localEngine: 'rows'` is the client's own row store (experimental).** `services/database/rows-store.ts` (one append-only file per bucket on OPFS sync access handles: hashed batches, a flat typed-array index per table, checkpoints, compaction; opening replays only the writes since the last checkpoint), `rows-exec.ts` (the verbs; bodies are the JSON text the SQLite engine stores and cross the worker as transferred bytes, parsed once on the page), `rows-worker.ts`, `rows-cache-engine.ts` (extends `SqliteCacheEngine` for the op queue, epoch fencing and shared-tabs roles, replaces everything that renders SQL). Same answers as `'sqlite'`, checked against real SQLite in `rows-exec.integration.test.ts`; where SQL leaves an order open (ties on `orderBy`, children of an unordered `.related()`) it returns id order. Writes to `ROWS_DURABLE_TABLES` (outbox, pending writes, failed mutations, local CRDT edits) are flushed before they resolve, everything else within ~100 ms. Works with `sharedTabs`. A change to how the SQLite engine filters, orders or merges needs the same change in `rows-exec.ts`. Secondary indexes are hidden tables in the same store (ids `value\0rowId`, empty bodies, written in the row's own batch): one per field that holds record links (found as rows are written), one per field a query filters on with `=` (built on first use; a field with fewer than 8 distinct values is left to scans); the registry is a row of the hidden meta table. `prewarmRows()` / `ROWS_PREWARM_SNIPPET` start the worker and open the last bucket from the page head, before the bundle; the engine adopts that worker (`createTransport`), takes the answer the worker already gave to that `open` when there is one (so its first read is one trip, not two) and replaces the worker when the answer names another `ROWS_PROTOCOL`. The worker's `warm` reads one table's index per turn and only after 15 ms without an op (`warmStep`): read all at once, it made the page's first read wait 10 ms. Bump `ROWS_PROTOCOL` when the worker's messages change. Read ahead (`rows-prewarm.ts`, a file without imports so a build script can load the snippet from it): the engine saves a session's first reads (`select` / `by-ids` / `relation` within 3 s of connecting, JSON-safe payloads only, at most 24) in the prewarm record; the next load's prewarm sends them under ids `<= ROWS_AHEAD_ID` (the worker refuses anything but those reads there), and `createTransport` answers a matching read from the reply already in the page (`ReadAhead`), so the client's first reads cost no trip. Answers are dropped on the first op that is not a read, on an open of another bucket, and 3 s after adoption. With `sharedTabs`: a tab's startup reads are recorded once per session whatever its role; the tab that becomes leader on the worker its head script started keeps the answers through the open under the role lock (the worker keeps the store it has open; the answer to the prewarm's own `open` is never reused there, the open is what takes the lock), and drops them when a follower's port is handed to the worker (`exposeClientPort`). A prewarm cannot know whether its tab will lead, so a store opened ahead and not yet claimed by its page (`AheadStore` in `rows-yield.ts`, kept out of `rows-worker.ts` so it has tests; any message with a positive id claims) is given up when a leading worker asks on the `ROWS_YIELD_CHANNEL` BroadcastChannel, which a worker opening under a role lock does after each failed attempt; the worker then says so under the prewarm open's id and the page forgets that open's answer and everything read ahead (the handler in `prewarmRows` and the snippet before adoption, `ReadAhead.arrived` after): the tab that got the store writes to it. Without this the elected tab's ten attempts all failed against the handles of a worker nobody used. `PaintCache` (`database.paintCache`) keeps the reads of a session's first 3 s in localStorage; `engine.peekSelect` / `peekByIds` (optional on `LocalStore`) return that copy synchronously before the store is open, a write to any table it read drops it, the next read of the same request takes it again. A peek is for painting, the read that follows is the answer. The cache is one for all tabs of a bucket: every table has a mark in localStorage (`sp00ky.paint.<bucket>.t.<table>`) that a writing tab replaces before its write is sent and again once the store answered (`touch(tables)`, `touch(tables, true)`; only an engine built with `shared`, a tab alone in the store leaves no marks and does no storage I/O per write, dropping its own copies is enough there); a copy stores the marks it was read under and `get` hands it out only while they stand; `stamp` counts a tab's own writes plus every foreign mark change it sees, so a read overtaken by another tab's write is not kept, while the tab's own second mark does not fail its reads queued behind the write. `flush` skips copies whose marks moved, merges the other tabs' index, removes what no longer stands (copies in another release's layout, and copies the index lost track of, found by a scan of the bucket's keys) and keeps one budget for the bucket; a mark that does not fit (quota) makes room by dropping the bucket's copies. Roles start it through `paint.adopt` (first hand-over of a bucket only), and a store that fell back to memory keeps nothing (`paint.stop`). The client uses it for a query's first render: `materialize` names its read by the query's view key (`fx.local.select(plan, params, paintKey)`, so the copy kept is the query's latest render whatever its id set was), and `registerLocal` seeds a new entry's `records` from `fx.local.peekSelect` with the same render set and the same cold filter (`renderRead` in `query/materialize.ts`), leaving it unnotified and unanswered; `materialize` then confirms or replaces the rows. Before `init()`: `Sp00kyClient.peekQuery(finalQuery)` hands those rows back synchronously on a client that is not open (the bindings' `eager` providers render with them). For that the paint key is `paintKeyOf(def, ids)` in `query/materialize.ts`, the query's text and parameters (no digest: a component asks while it renders), with a `\ncold` suffix for a cold scan so a closed client, which cannot apply the cold filter, only ever gets a membership render's rows; and the constructor tells the engine which bucket boot will open (`expectBucket(readBootBucketHint() ?? 'anon')`). Calls made before `init()` finished wait for it instead of failing (`opened()`: `query().run()`, `queryRaw`, `preload`, `create` / `update` / `delete`, channel writes, `openCrdtField`, every `BucketHandle` method; the feature flag and app release registrations wait while there is no session yet), and reject with its error if it fails; `whenReady()` is the same promise for apps. `followerReads: 'direct'` (with `sharedTabs`): the leader's worker opens the files with `readwrite-unsafe` handles (`share` in the `open` payload), and a follower starts a worker of its own on a `RowStore` in reader mode (`RowStore.open(io, { reader: true })`: never writes, `refresh()` replays what was appended, `current()` after a read says whether a compaction moved the file under it; `handleReaderOp` retries then) and routes `ROWS_READER_OPS` to it (`rawCall` override), everything else to the leader's port; any failure of the reader falls back to the port. A reader builds no index (`RowsExec` `readOnly`) and re-reads the registry when the leader rewrites it. `dist/rows-worker.js` is built on its own (third tsdown config) so it is one self-contained file starting with the V8 compile hint `//# allFunctionsCalledOnLoad`. Benchmark: `apps/storage-bench`.
69
+ - **`database.workers` lets the app start the local store's worker.** Only for a bundler that does not bundle a `new Worker(new URL(...))` inside a dependency, i.e. the Angular CLI: `workers.surreal` returns a module worker whose entry is `import '@surrealdb/wasm/worker'`, `workers.sqlite` (with `localEngine: 'sqlite'`) one whose entry is `import '@spooky-sync/core/sqlite-worker'`, `workers.rows` (with `localEngine: 'rows'`) one whose entry is `import '@spooky-sync/core/rows-worker'` (exports kept in `sideEffects` so the bare import survives tree shaking). Unset, the built-in worker expressions run as before; Vite / Rollup / webpack apps leave it unset.
69
70
  - **Boot owns the first identity.** The facade subscribes to auth with `immediate: false`: boot opens the bucket the hint names and `auth.restoreSession` announces the user. `LocalDatabaseService.switchStore` also waits for an in-flight `connect`, and lets statements already past the gate finish before it closes a client: the 3.1 engine streams results from its worker, and a statement whose client closed under it stayed pending until its 30 s deadline with every later local statement queued behind it.
70
71
  - **A rejected write is not lost.** Application errors roll the local row back (create/update/delete) and move the mutation to `_00_failed_mutations`; the tray API above lists, retries (as a fresh write) or discards it. Network errors keep the row queued, and so does a write SurrealDB refused only because sp00ky's own `_00_` ingest event could not post to the scheduler/SSP (refused, past its TIMEOUT, DNS, 5xx/408/429; `SP00KY_EVENT_POST_FAILED` in `utils/error-classification.ts`).
71
72
 
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as WebPushInfo, $t as ChannelScope, A as RecordVersionArray, At as AuthEventTypeMap, B as StorageHealthStatus, Bt as ImpersonationTimerHost, C as QueryState, Ct as AuthService, D as QueryTimings, Dt as SignOutContext, E as QueryTimeToLive, Et as SIGN_OUT_HOOK_TIMEOUT_MS, F as Sp00kyChannel, Ft as SealedQuery, G as TimingPhase, Gt as decodeTokenClaims, H as SyncHealth, Ht as ORIGIN_TOKEN_KEY, I as Sp00kyConfig, It as EventDefinition, J as PushDeviceKind, Jt as sameImpersonation, K as UpdateOptions, Kt as impersonationFromToken, L as Sp00kyQueryResult, Lt as EventSystem, M as RegistrationTimings, Mt as createAuthEventSystem, N as RunOptions, Nt as RemoteDatabaseService, O as QueryUpdateCallback, Ot as SignOutHook, P as ServerViewMeta, Pt as LocalStore, Q as WebPushErrorCode, Qt as ChannelOp, R as Sp00kyQueryResultPromise, Rt as IMPERSONATION_ACCESS, S as QueryHash, St as ActiveImpersonation, T as QueryStatusCallback, Tt as REFUSAL_RECHECK_MIN_MS, U as SyncHealthConfig, Ut as SESSION_POLL_MS, V as StoreType, Vt as ImpersonationTimers, W as SyncHealthStatus, Wt as TokenClaims, X as WebPushDevice, Xt as ChannelHandle, Y as WebPushConfig, Yt as ChannelAcceptRule, Z as WebPushError, Zt as ChannelMessage, _ as PreloadOptions, _t as PushPayload, a as EventSubscriptionOptions, an as PeerRef, at as WebPushSyncOptions, b as QueryConfig, bt as WebPushClientMessage, c as LocalWorkers, cn as unusedArgs, ct as WebPushUnsupportedReason, d as MutationCallback, dt as BridgeSignOutMessage, en as ChannelState, et as WebPushMessage, f as MutationEvent, ft as BridgeTokenMessage, g as PinoTransmit, gt as PushOp, h as PhaseStat, ht as PushNotificationAction, i as EdgeDelta, in as ChannelsConfig, it as WebPushSupport, j as RecordVersionDiff, jt as AuthEventTypes, k as ReconnectConfig, kt as AuthEventSystem, l as MATERIALIZATION_SAMPLE_WINDOW, ln as LogTap, lt as WebPushUpdateOptions, m as PersistenceClient, mt as PushNotification, n as ConnectionState, nn as ChannelTransport, nt as WebPushModule, o as InlineRow, on as TransportHooks, ot as WebPushSyncStatus, p as MutationEventType, pt as PUSH_PAYLOAD_VERSION, q as PUSH_ENDPOINT_KEY, qt as renewDelayMs, r as DebounceOptions, rn as ChannelTransportFactory, rt as WebPushSubscribeOptions, s as Level, sn as matchesWhere, st as WebPushUnsubscribeOptions, t as ChannelQuery, tn as ChannelStatus, tt as WebPushMessageInput, u as MembershipOutcome, un as Logger$1, ut as detectWebPushSupport, v as PreloadRefresh, vt as PushPayloadKind, w as QueryStatus, wt as ImpersonationCandidate, x as QueryConfigRecord, xt as isPushPayload, y as QueryAuthorityCallback, yt as PushUrgency, z as StorageHealth, zt as ImpersonationInfo } from "./types.js";
1
+ import { $ as WebPushInfo, $t as ChannelRelayConfig, A as RecordVersionArray, At as AuthEventTypeMap, B as StorageHealthStatus, Bt as ImpersonationTimerHost, C as QueryState, Ct as AuthService, D as QueryTimings, Dt as SignOutContext, E as QueryTimeToLive, Et as SIGN_OUT_HOOK_TIMEOUT_MS, F as Sp00kyChannel, Ft as SealedQuery, G as TimingPhase, Gt as decodeTokenClaims, H as SyncHealth, Ht as ORIGIN_TOKEN_KEY, I as Sp00kyConfig, It as EventDefinition, J as PushDeviceKind, Jt as sameImpersonation, K as UpdateOptions, Kt as impersonationFromToken, L as Sp00kyQueryResult, Lt as EventSystem, M as RegistrationTimings, Mt as createAuthEventSystem, N as RunOptions, Nt as RemoteDatabaseService, O as QueryUpdateCallback, Ot as SignOutHook, P as ServerViewMeta, Pt as LocalStore, Q as WebPushErrorCode, Qt as ChannelOp, R as Sp00kyQueryResultPromise, Rt as IMPERSONATION_ACCESS, S as QueryHash, St as ActiveImpersonation, T as QueryStatusCallback, Tt as REFUSAL_RECHECK_MIN_MS, U as SyncHealthConfig, Ut as SESSION_POLL_MS, V as StoreType, Vt as ImpersonationTimers, W as SyncHealthStatus, Wt as TokenClaims, X as WebPushDevice, Xt as ChannelHandle, Y as WebPushConfig, Yt as ChannelAcceptRule, Z as WebPushError, Zt as ChannelMessage, _ as PreloadOptions, _t as PushPayload, a as EventSubscriptionOptions, an as ChannelTransport, at as WebPushSyncOptions, b as QueryConfig, bt as WebPushClientMessage, c as LocalWorkers, cn as ChannelsConfig, ct as WebPushUnsupportedReason, d as MutationCallback, dn as TransportHooks, dt as BridgeSignOutMessage, en as ChannelScope, et as WebPushMessage, f as MutationEvent, fn as matchesWhere, ft as BridgeTokenMessage, g as PinoTransmit, gt as PushOp, h as PhaseStat, hn as Logger$1, ht as PushNotificationAction, i as EdgeDelta, in as ChannelStatus, it as WebPushSupport, j as RecordVersionDiff, jt as AuthEventTypes, k as ReconnectConfig, kt as AuthEventSystem, l as MATERIALIZATION_SAMPLE_WINDOW, ln as InterestMessage, lt as WebPushUpdateOptions, m as PersistenceClient, mn as LogTap, mt as PushNotification, n as ConnectionState, nn as ChannelShareRule, nt as WebPushModule, o as InlineRow, on as ChannelTransportFactory, ot as WebPushSyncStatus, p as MutationEventType, pn as unusedArgs, pt as PUSH_PAYLOAD_VERSION, q as PUSH_ENDPOINT_KEY, qt as renewDelayMs, r as DebounceOptions, rn as ChannelState, rt as WebPushSubscribeOptions, s as Level, sn as ChannelWire, st as WebPushUnsubscribeOptions, t as ChannelQuery, tn as ChannelShareConfig, tt as WebPushMessageInput, u as MembershipOutcome, un as PeerRef, ut as detectWebPushSupport, v as PreloadRefresh, vt as PushPayloadKind, w as QueryStatus, wt as ImpersonationCandidate, x as QueryConfigRecord, xt as isPushPayload, y as QueryAuthorityCallback, yt as PushUrgency, z as StorageHealth, zt as ImpersonationInfo } from "./types.js";
2
2
  import { BackendNames, BackendRoutes, BucketNames, ChannelPeer, ChannelTableNames, FinalQuery, GetTable, QueryBuilder, QueryOptions, QueryPlan, RecordId, RoutePayload, SchemaStructure, TableModel, TableNames } from "@spooky-sync/query-builder";
3
3
  import * as surrealdb0 from "surrealdb";
4
4
  import { Duration, RecordId as RecordId$1, Surreal } from "surrealdb";
@@ -215,6 +215,27 @@ declare class LocalMigrator {
215
215
  private createHashRecord;
216
216
  }
217
217
  //#endregion
218
+ //#region src/services/database/rows-prewarm.d.ts
219
+
220
+ /**
221
+ * Start the row store's worker and open the last bucket NOW, before the app
222
+ * has loaded. A worker takes about 10 ms to start and the store a few more to
223
+ * open; started from the first bytes of the page, that happens while the
224
+ * bundle downloads and parses, and by the time the client connects the store
225
+ * is open, its indexes are in memory and the answers to the app's first reads
226
+ * are already in the page. The engine finds the worker and adopts it; if
227
+ * anything about it is wrong (a new release, another bucket, a failed start)
228
+ * it starts its own, as it would have without this.
229
+ *
230
+ * Call it as early as the app can, or inline {@link ROWS_PREWARM_SNIPPET} in
231
+ * the page's `<head>`, which is this function without the bundle. A no-op on
232
+ * a first visit: the worker's URL is learned from the engine's first open.
233
+ */
234
+ declare function prewarmRows(): void;
235
+ /** {@link prewarmRows} as a script to inline in `<head>`, ahead of the app's bundle. */
236
+ declare const ROWS_PREWARM_SNIPPET: string;
237
+ /** The prewarmed worker, once: whoever takes it owns it. */
238
+ //#endregion
218
239
  //#region src/services/stream-processor/wasm-types.d.ts
219
240
  interface WasmStreamUpdate {
220
241
  query_id: string;
@@ -1135,6 +1156,12 @@ type Effect = {
1135
1156
  kind: 'local.select';
1136
1157
  plan: QueryPlan;
1137
1158
  params?: Vars;
1159
+ paintKey?: string;
1160
+ } | {
1161
+ kind: 'local.peekSelect';
1162
+ plan: QueryPlan;
1163
+ params?: Vars;
1164
+ paintKey?: string;
1138
1165
  } | {
1139
1166
  kind: 'local.execute';
1140
1167
  query: SealedQuery<unknown>;
@@ -1503,7 +1530,7 @@ interface FailedMutationRow {
1503
1530
  //#region src/kernel/interpreter.d.ts
1504
1531
  /** The five adapters plus the pure ports, as the interpreter sees them. */
1505
1532
  interface Adapters {
1506
- local: Pick<LocalStore, 'query' | 'execute' | 'select' | 'getById' | 'upsert' | 'delete'> & {
1533
+ local: Pick<LocalStore, 'query' | 'execute' | 'select' | 'peekSelect' | 'getById' | 'upsert' | 'delete'> & {
1507
1534
  readonly epoch: number;
1508
1535
  };
1509
1536
  remote: {
@@ -2072,9 +2099,23 @@ declare class BucketHandle {
2072
2099
  /** Absent on the raw handle the cache itself reads through. */
2073
2100
  private blobs?;
2074
2101
  private settings?;
2102
+ /**
2103
+ * Resolves once the client is open; nothing to wait for when it already
2104
+ * is. Every call below awaits it, so a file asked for by a component that
2105
+ * rendered before the client was ready (a provider's `eager` mode) is
2106
+ * fetched then, where it used to fail for want of a connection.
2107
+ */
2108
+ private opened?;
2075
2109
  private io;
2076
2110
  constructor(bucketName: string, remote: RemoteDatabaseService, /** Absent on the raw handle the cache itself reads through. */
2077
- blobs?: (BlobCache | null) | undefined, settings?: BucketHandleSettings | undefined);
2111
+ blobs?: (BlobCache | null) | undefined, settings?: BucketHandleSettings | undefined,
2112
+ /**
2113
+ * Resolves once the client is open; nothing to wait for when it already
2114
+ * is. Every call below awaits it, so a file asked for by a component that
2115
+ * rendered before the client was ready (a provider's `eager` mode) is
2116
+ * fetched then, where it used to fail for want of a connection.
2117
+ */
2118
+ opened?: (() => Promise<void> | undefined) | undefined);
2078
2119
  /** Effective blurhash setting: per-call option > client config > default ON. */
2079
2120
  private resolveBlurhash;
2080
2121
  put(path: string, content: string | Uint8Array | Blob, options?: BucketPutOptions): Promise<BucketPutResult>;
@@ -2120,11 +2161,6 @@ interface Sp00kyClientDeps<S extends SchemaStructure> {
2120
2161
  runtime?: Runtime;
2121
2162
  env?: Partial<SagaEnv>;
2122
2163
  }
2123
- /**
2124
- * The public client. Every method is a thin translation into a saga run, a
2125
- * state read, or a subscription on the runtime; the engine's behaviour lives
2126
- * in the sagas.
2127
- */
2128
2164
  declare class Sp00kyClient<S extends SchemaStructure> {
2129
2165
  private readonly config;
2130
2166
  readonly auth: AuthService<S>;
@@ -2152,12 +2188,40 @@ declare class Sp00kyClient<S extends SchemaStructure> {
2152
2188
  private wireAdapters;
2153
2189
  /** Runtime events the DevTools panel follows; query transitions also go to the log. */
2154
2190
  private forwardToDevTools;
2191
+ /** Settled by `init`: what a call made before the client is open waits on. */
2192
+ private ready;
2155
2193
  init(): Promise<void>;
2194
+ /**
2195
+ * Resolves once `init()` has finished, and rejects with its error if it
2196
+ * fails. A page that renders before the client is open (a provider's
2197
+ * `eager` mode) awaits this for whatever must not run earlier.
2198
+ */
2199
+ whenReady(): Promise<void>;
2200
+ /**
2201
+ * Queries and writes need the open client: its store, its session. Asked
2202
+ * for earlier, they wait for `init()` to finish, so a component may register
2203
+ * a query on its first render and need not know whether the client is open.
2204
+ */
2205
+ private opened;
2156
2206
  close(): Promise<void>;
2157
2207
  isLocalReady(): boolean;
2158
2208
  query<Table extends TableNames<S>>(table: Table, options: QueryOptions<TableModel<GetTable<S, Table>>, false>, ttl?: QueryTimeToLive): QueryBuilder<S, Table, Sp00kyQueryResultPromise>;
2159
2209
  private registerInput;
2160
2210
  private initQuery;
2211
+ /**
2212
+ * The rows this query rendered the last time this browser had the app open,
2213
+ * handed back at once and with no need for `init()` to have run: something
2214
+ * for a component to render on its first pass, where it would have rendered
2215
+ * an empty list. `null` when the local store keeps no such copy (only
2216
+ * `localEngine: 'rows'` with its paint cache does), or has none for this
2217
+ * query: it never rendered at startup, or a tab has written to one of its
2218
+ * tables since.
2219
+ *
2220
+ * They are rows to paint from, not a result. The query still has to be run
2221
+ * and subscribed to; what that delivers is the answer, and it replaces these
2222
+ * rows when it differs.
2223
+ */
2224
+ peekQuery(finalQuery: FinalQuery<S, any, any, any, any, any>): Record<string, any>[] | null;
2161
2225
  /**
2162
2226
  * The raw remote escape hatches bypass the query builder, so their shapes
2163
2227
  * can never be on the server's query allowlist. When the generated schema
@@ -2183,6 +2247,15 @@ declare class Sp00kyClient<S extends SchemaStructure> {
2183
2247
  * when done.
2184
2248
  */
2185
2249
  channel<T extends ChannelTableNames<S>>(queries: ChannelQuery<S, T> | ReadonlyArray<ChannelQuery<S, T>>, peers: Iterable<ChannelPeer>): Sp00kyChannel<S, T>;
2250
+ /**
2251
+ * The link to this user's other devices (`channels.share`): `connected`
2252
+ * with the user's id in `peers` while at least one other tab of theirs, in
2253
+ * another browser, is in the room. `idle` when nothing is shared or nobody
2254
+ * is signed in.
2255
+ */
2256
+ shareState(): ChannelState;
2257
+ /** Called at once with `shareState()`, then on every change. */
2258
+ subscribeShareState(callback: (state: ChannelState) => void): () => void;
2186
2259
  private channelScopes;
2187
2260
  deregisterQuery(queryHash: string): void;
2188
2261
  subscribeQueryStatus(queryHash: string, callback: QueryStatusCallback, options?: {
@@ -2251,6 +2324,94 @@ declare class Sp00kyClient<S extends SchemaStructure> {
2251
2324
  getBlobCacheStats(): BlobCacheStats;
2252
2325
  }
2253
2326
  //#endregion
2327
+ //#region src/modules/channel/room.d.ts
2328
+ /**
2329
+ * The link between the browsers of one user.
2330
+ *
2331
+ * Every browser keeps one socket to the room relay (`sp00ky-relay`, see
2332
+ * `apps/relay`). The relay proves the user from the session token, puts the
2333
+ * socket into that user's room and forwards what the members send each
2334
+ * other without reading it. So a message is there after one hop to the relay
2335
+ * and one back, whatever network each device sits in, and nothing waits for
2336
+ * a connection to be negotiated.
2337
+ *
2338
+ * Two browsers alone in a room also open a WebRTC data channel to each other
2339
+ * (its offer and answer travel through the relay) and use it while it is up:
2340
+ * on one network that is a millisecond instead of a trip to the relay. A
2341
+ * third browser joining ends that, and everybody talks through the room.
2342
+ *
2343
+ * Nothing here is kept or retried: a message lost on the way is one the
2344
+ * normal sync delivers a moment later.
2345
+ */
2346
+ /** A browser in the room, by the id it joined with. */
2347
+ type RoomPeer = string;
2348
+ interface RoomLinkHooks {
2349
+ /** Who this browser is, or null while signed out. */
2350
+ self(): {
2351
+ user: string;
2352
+ peer: RoomPeer;
2353
+ } | null;
2354
+ onPeer(peer: RoomPeer, up: boolean): void;
2355
+ onMessage(from: RoomPeer, data: unknown): void;
2356
+ onStatus(status: 'connecting' | 'connected' | 'failed'): void;
2357
+ }
2358
+ interface RoomLink {
2359
+ /** Send to these browsers of the room, or (`null`) to all of them. Fire and forget. */
2360
+ send(to: ReadonlyArray<RoomPeer> | null, data: unknown): void;
2361
+ close(): void;
2362
+ }
2363
+ type RoomLinkFactory = (hooks: RoomLinkHooks) => RoomLink;
2364
+ interface RoomLinkOptions {
2365
+ /** The relay's WebSocket address. */
2366
+ url: string;
2367
+ /** The session token the relay proves the user with; null while there is none. */
2368
+ token: () => string | null;
2369
+ /** `false`: never open the direct link. */
2370
+ direct?: boolean;
2371
+ iceServers?: RTCIceServer[];
2372
+ logger?: Pick<Logger$1, 'debug' | 'warn'>;
2373
+ /** Injectable for tests and non-browser runtimes. */
2374
+ WebSocket?: typeof WebSocket;
2375
+ RTCPeerConnection?: typeof RTCPeerConnection;
2376
+ }
2377
+ declare function roomLink(hooks: RoomLinkHooks, opts: RoomLinkOptions): RoomLink;
2378
+ /**
2379
+ * One transport out of two: the user's own devices are reached through
2380
+ * `own` (the room), everybody else through `others` (the mesh between
2381
+ * users). Without `own`, the user's own devices are simply never reached.
2382
+ */
2383
+ declare function splitTransport(own: ChannelTransportFactory | null, others: ChannelTransportFactory): ChannelTransportFactory;
2384
+ //#endregion
2385
+ //#region src/modules/channel/hub.d.ts
2386
+ /** The part of `navigator.locks` this needs. */
2387
+ interface HubLocks {
2388
+ request(name: string, callback: () => Promise<void>): Promise<unknown>;
2389
+ request(name: string, options: {
2390
+ mode: 'shared' | 'exclusive';
2391
+ }, callback: () => Promise<void> | void): Promise<unknown>;
2392
+ }
2393
+ /** The part of a `BroadcastChannel` this needs. */
2394
+ interface HubBus {
2395
+ postMessage(message: unknown): void;
2396
+ onmessage: ((event: {
2397
+ data: unknown;
2398
+ }) => void) | null;
2399
+ close(): void;
2400
+ }
2401
+ interface HubOptions {
2402
+ /** Names the room of one user in this browser; the lock and the bus carry it. */
2403
+ scope: (user: string) => string;
2404
+ /** Builds the browser's link. Called in the tab that holds it. */
2405
+ link: RoomLinkFactory;
2406
+ logger?: Pick<Logger$1, 'debug' | 'warn'>;
2407
+ /** `null` forces a link per tab. Default `navigator.locks`. */
2408
+ locks?: HubLocks | null;
2409
+ /** `null` forces a link per tab. Default `BroadcastChannel`. */
2410
+ bus?: ((name: string) => HubBus) | null;
2411
+ supported?: boolean;
2412
+ }
2413
+ declare function hubTransport(hooks: TransportHooks, opts: HubOptions): ChannelTransport;
2414
+ //#endregion
2254
2415
  //#region src/modules/channel/webrtc.d.ts
2255
2416
  /**
2256
2417
  * The default channel transport: one WebRTC data channel per pair of tabs,
@@ -2353,4 +2514,4 @@ declare class LocalOpTimeoutError extends Error {
2353
2514
  * select on a throttled tab is seconds, not tens of seconds. */
2354
2515
  declare const DEFAULT_LOCAL_OP_TIMEOUT_MS = 30000;
2355
2516
  //#endregion
2356
- export { ActiveImpersonation, AppReleaseHandle, AppReleaseModule, type AppReleaseOptions, type AppReleaseSnapshot, AuthEventSystem, AuthEventTypeMap, AuthEventTypes, AuthService, BLURHASH_IMAGE_EXTENSIONS, type BlobCacheStats, type BlobEntry, type BlobKey, type BlobReadOptions, type BlobUrlLease, type BlurhashEncodeOptions, type BlurhashSetting, type BridgeSignOutMessage, type BridgeTokenMessage, BucketHandle, BucketPutOptions, BucketPutResult, CURSOR_COLORS, type ChannelAcceptRule, type ChannelHandle, type ChannelMessage, type ChannelOp, ChannelQuery, type ChannelScope, type ChannelState, type ChannelStatus, type ChannelTransport, type ChannelTransportFactory, type ChannelsConfig, ConnectionState, CrdtField, CrdtManager, DEFAULT_LOCAL_OP_TIMEOUT_MS, DebounceOptions, EdgeDelta, EventSubscriptionOptions, type FailedMutationRow as FailedMutation, FeatureFlagHandle, FeatureFlagModule, type FeatureFlagOptions, type FeatureFlagOverride, type FeatureFlagSnapshot, IMPERSONATION_ACCESS, ImpersonationCandidate, ImpersonationInfo, ImpersonationTimerHost, ImpersonationTimers, InlineRow, Level, LocalOpTimeoutError, LocalWorkers, MATERIALIZATION_SAMPLE_WINDOW, MembershipOutcome, MutationCallback, MutationEvent, MutationEventType, ORIGIN_TOKEN_KEY, type OutgoingSignal, PUSH_ENDPOINT_KEY, PUSH_PAYLOAD_VERSION, type PeerRef, PersistenceClient, PhaseStat, PinoTransmit, PreloadOptions, PreloadRefresh, type PushDeviceKind, type PushNotification, type PushNotificationAction, type PushOp, type PushPayload, type PushPayloadKind, type PushUrgency, QueryAuthorityCallback, QueryConfig, QueryConfigRecord, QueryHash, QueryState, QueryStatus, QueryStatusCallback, QueryTimeToLive, QueryTimings, QueryUpdateCallback, REFUSAL_RECHECK_MIN_MS, ReconnectConfig, RecordVersionArray, RecordVersionDiff, RegistrationTimings, RunOptions, SESSION_POLL_MS, SIGN_OUT_HOOK_TIMEOUT_MS, ServerViewMeta, SignOutContext, SignOutHook, type Signal, type SignalPort, Sp00kyChannel, Sp00kyClient, Sp00kyClientDeps, Sp00kyConfig, Sp00kyQueryResult, Sp00kyQueryResultPromise, StorageHealth, StorageHealthStatus, StoreType, SyncHealth, SyncHealthConfig, SyncHealthStatus, TimingPhase, TokenClaims, type TransportHooks, UpdateOptions, type WebPushClientMessage, type WebPushConfig, type WebPushDevice, WebPushError, type WebPushErrorCode, type WebPushInfo, type WebPushMessage, type WebPushMessageInput, WebPushModule, type WebPushSubscribeOptions, type WebPushSupport, type WebPushSyncOptions, type WebPushSyncStatus, type WebPushUnsubscribeOptions, type WebPushUnsupportedReason, type WebPushUpdateOptions, blurhashSidecarPath, bucketContentToBlob, createAuthEventSystem, cursorColorFromName, decode as decodeBlurhash, decodeTokenClaims, detectWebPushSupport, encode as encodeBlurhash, encodeImageToBlurhash, fileToUint8Array, impersonationFromToken, isBlurhashValid, isImagePath, isPushPayload, matchesWhere, renewDelayMs, sameImpersonation, semverGt, surrealSignal, textToHtml, unusedArgs, webrtcTransport };
2517
+ export { ActiveImpersonation, AppReleaseHandle, AppReleaseModule, type AppReleaseOptions, type AppReleaseSnapshot, AuthEventSystem, AuthEventTypeMap, AuthEventTypes, AuthService, BLURHASH_IMAGE_EXTENSIONS, type BlobCacheStats, type BlobEntry, type BlobKey, type BlobReadOptions, type BlobUrlLease, type BlurhashEncodeOptions, type BlurhashSetting, type BridgeSignOutMessage, type BridgeTokenMessage, BucketHandle, BucketPutOptions, BucketPutResult, CURSOR_COLORS, type ChannelAcceptRule, type ChannelHandle, type ChannelMessage, type ChannelOp, ChannelQuery, type ChannelRelayConfig, type ChannelScope, type ChannelShareConfig, type ChannelShareRule, type ChannelState, type ChannelStatus, type ChannelTransport, type ChannelTransportFactory, type ChannelWire, type ChannelsConfig, ConnectionState, CrdtField, CrdtManager, DEFAULT_LOCAL_OP_TIMEOUT_MS, DebounceOptions, EdgeDelta, EventSubscriptionOptions, type FailedMutationRow as FailedMutation, FeatureFlagHandle, FeatureFlagModule, type FeatureFlagOptions, type FeatureFlagOverride, type FeatureFlagSnapshot, type HubOptions, IMPERSONATION_ACCESS, ImpersonationCandidate, ImpersonationInfo, ImpersonationTimerHost, ImpersonationTimers, InlineRow, type InterestMessage, Level, LocalOpTimeoutError, LocalWorkers, MATERIALIZATION_SAMPLE_WINDOW, MembershipOutcome, MutationCallback, MutationEvent, MutationEventType, ORIGIN_TOKEN_KEY, type OutgoingSignal, PUSH_ENDPOINT_KEY, PUSH_PAYLOAD_VERSION, type PeerRef, PersistenceClient, PhaseStat, PinoTransmit, PreloadOptions, PreloadRefresh, type PushDeviceKind, type PushNotification, type PushNotificationAction, type PushOp, type PushPayload, type PushPayloadKind, type PushUrgency, QueryAuthorityCallback, QueryConfig, QueryConfigRecord, QueryHash, QueryState, QueryStatus, QueryStatusCallback, QueryTimeToLive, QueryTimings, QueryUpdateCallback, REFUSAL_RECHECK_MIN_MS, ROWS_PREWARM_SNIPPET, ReconnectConfig, RecordVersionArray, RecordVersionDiff, RegistrationTimings, type RoomLink, type RoomLinkHooks, type RoomLinkOptions, RunOptions, SESSION_POLL_MS, SIGN_OUT_HOOK_TIMEOUT_MS, ServerViewMeta, SignOutContext, SignOutHook, type Signal, type SignalPort, Sp00kyChannel, Sp00kyClient, Sp00kyClientDeps, Sp00kyConfig, Sp00kyQueryResult, Sp00kyQueryResultPromise, StorageHealth, StorageHealthStatus, StoreType, SyncHealth, SyncHealthConfig, SyncHealthStatus, TimingPhase, TokenClaims, type TransportHooks, UpdateOptions, type WebPushClientMessage, type WebPushConfig, type WebPushDevice, WebPushError, type WebPushErrorCode, type WebPushInfo, type WebPushMessage, type WebPushMessageInput, WebPushModule, type WebPushSubscribeOptions, type WebPushSupport, type WebPushSyncOptions, type WebPushSyncStatus, type WebPushUnsubscribeOptions, type WebPushUnsupportedReason, type WebPushUpdateOptions, blurhashSidecarPath, bucketContentToBlob, createAuthEventSystem, cursorColorFromName, decode as decodeBlurhash, decodeTokenClaims, detectWebPushSupport, encode as encodeBlurhash, encodeImageToBlurhash, fileToUint8Array, hubTransport, impersonationFromToken, isBlurhashValid, isImagePath, isPushPayload, matchesWhere, prewarmRows, renewDelayMs, roomLink, sameImpersonation, semverGt, splitTransport, surrealSignal, textToHtml, unusedArgs, webrtcTransport };