@happyvertical/smrt-web 0.51.28 → 0.51.30
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/AGENTS.md +2 -2
- package/README.md +48 -3
- package/agents/offline-outbox.md +75 -4
- package/agents/version-persistence.md +19 -0
- package/dist/chunks/{src-0IQGhPIM.js → src-B2uQWayW.js} +476 -81
- package/dist/chunks/src-B2uQWayW.js.map +1 -0
- package/dist/index.d.ts +291 -11
- package/dist/index.js +2 -2
- package/dist/webmcp.js +1 -1
- package/package.json +3 -3
- package/dist/chunks/src-0IQGhPIM.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,15 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export declare function buildListQuery(params?: Record<string, unknown>): string;
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Default outcome mapping for a data-surface action result. `ok` → applied; a
|
|
13
|
+
* transient server reason → retryable `write_failed`; an authentication reason
|
|
14
|
+
* → pause for re-auth; a stale revision/preview → `conflict` (a RESOLVED
|
|
15
|
+
* outcome the app rebases from); anything else — including `denied` — is a
|
|
16
|
+
* terminal rejection surfaced as `failed`.
|
|
17
|
+
*/
|
|
18
|
+
export declare function classifySmrtWebDataSurfaceActionResult(result: SmrtWebDataSurfaceActionResult): OutboxCommandResult;
|
|
19
|
+
|
|
11
20
|
/**
|
|
12
21
|
* Compile a declared intent plus a mounted binding into a bespoke tool spec.
|
|
13
22
|
*
|
|
@@ -160,6 +169,17 @@ export declare function createSmrtWebQuery<TData extends object>(_collection: Sm
|
|
|
160
169
|
*/
|
|
161
170
|
export declare function createUpdateState(config: UpdateStateConfig): UpdateState;
|
|
162
171
|
|
|
172
|
+
/**
|
|
173
|
+
* An {@link OutboxCommandTransport} that replays a queued write as a
|
|
174
|
+
* data-surface action `apply` (optionally preceded by `preview`) through the
|
|
175
|
+
* surface's own server adapter — its authority, allowlist, and principal
|
|
176
|
+
* scoping stay on the server path (#3021). The outbox's durable idempotency
|
|
177
|
+
* key becomes the action's `idempotencyKey`, so a resend after a lost response
|
|
178
|
+
* replays the server's recorded result instead of applying twice. Malformed or
|
|
179
|
+
* mismatched replies throw, which the outbox treats as retryable.
|
|
180
|
+
*/
|
|
181
|
+
export declare function dataSurfaceActionCommandTransport(options: SmrtWebDataSurfaceActionCommandTransportOptions): OutboxCommandTransport;
|
|
182
|
+
|
|
163
183
|
/** Default trailing-debounce window (ms) for the write-back. */
|
|
164
184
|
export declare const DEFAULT_PERSIST_DEBOUNCE_MS = 250;
|
|
165
185
|
|
|
@@ -354,15 +374,85 @@ export declare function normalizeSmrtWebDataQueryResult(value: unknown): SmrtWeb
|
|
|
354
374
|
/** Fail closed before an action result reaches browser state. */
|
|
355
375
|
export declare function normalizeSmrtWebDataSurfaceActionResult(value: unknown): SmrtWebDataSurfaceActionResult;
|
|
356
376
|
|
|
377
|
+
/** One write for {@link OfflineCommandQueue.enqueue}. */
|
|
378
|
+
export declare interface OfflineCommandInput {
|
|
379
|
+
/** Command arguments — structured-clone-safe; persisted verbatim. */
|
|
380
|
+
payload?: Record<string, unknown>;
|
|
381
|
+
/** The row the write targets, when there is one. Defaults to the item id. */
|
|
382
|
+
rowId?: string;
|
|
383
|
+
/** Mutation kind, passed through to the transport. Defaults to `create`. */
|
|
384
|
+
op?: SyncApplyOp;
|
|
385
|
+
/** The server `updated_at` last seen, passed through to the transport. */
|
|
386
|
+
baseUpdatedAt?: string;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
/** A durable queue of consumer-declared server operations (#3021). */
|
|
390
|
+
export declare interface OfflineCommandQueue {
|
|
391
|
+
/**
|
|
392
|
+
* Durably queue one write and kick replay. Resolves to its idempotency key
|
|
393
|
+
* once the write is committed to IndexedDB, or `undefined` when the durable
|
|
394
|
+
* queue is unavailable (no IndexedDB) or the queue was disposed — the write
|
|
395
|
+
* was NOT captured, so the caller must perform it online itself or surface
|
|
396
|
+
* the failure; it is never acknowledged non-durably.
|
|
397
|
+
*/
|
|
398
|
+
enqueue(input: OfflineCommandInput): Promise<string | undefined>;
|
|
399
|
+
/** The namespace's durable queue (every route), like {@link OutboxHandle}. */
|
|
400
|
+
snapshot(): Promise<OutboxSnapshotItem[]>;
|
|
401
|
+
/** Force a retry of a queued item now (clears backoff and an auth pause). */
|
|
402
|
+
retry(itemId: string): Promise<void>;
|
|
403
|
+
/** Detach. Queued writes stay on disk and replay on the next attach. */
|
|
404
|
+
dispose(): Promise<void>;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* A durable offline queue for writes that go through a consumer-declared
|
|
409
|
+
* server operation — a data-surface action, a named remote command, a
|
|
410
|
+
* permission-gated service — rather than a generated collection (#3021).
|
|
411
|
+
*
|
|
412
|
+
* Shares the namespace's outbox engine with every {@link offlineOutbox}: one
|
|
413
|
+
* IndexedDB queue, a cross-tab leader per route, FIFO within the route, the
|
|
414
|
+
* `pending → uploading → synced | failed` state machine, backoff, auth pause,
|
|
415
|
+
* and the `wipeDurableStore` registration. Each replay carries the write's
|
|
416
|
+
* durable `idempotencyKey`, which the server operation must dedupe on — that
|
|
417
|
+
* is what makes a blind resend after a lost response safe.
|
|
418
|
+
*
|
|
419
|
+
* Attaches immediately; call `dispose()` when the owning view unmounts.
|
|
420
|
+
*/
|
|
421
|
+
export declare function offlineCommandQueue(config: OfflineCommandQueueConfig): OfflineCommandQueue;
|
|
422
|
+
|
|
423
|
+
/** Configuration for {@link offlineCommandQueue}. */
|
|
424
|
+
export declare interface OfflineCommandQueueConfig {
|
|
425
|
+
/**
|
|
426
|
+
* The queue's name — the key queued writes are stored and routed under. It
|
|
427
|
+
* shares the namespace's durable queue and per-object event routing with
|
|
428
|
+
* every collection outbox, so it MUST NOT equal a sibling collection's
|
|
429
|
+
* `definition.name` (their events would cross). Durable: a write queued under a name replays only once a queue
|
|
430
|
+
* with that name (and a transport) is attached again, e.g. after a reload.
|
|
431
|
+
*/
|
|
432
|
+
name: string;
|
|
433
|
+
/** The durable-store identity — the SAME key the app's other outboxes use. */
|
|
434
|
+
namespace: DurableStoreKey;
|
|
435
|
+
/** Replays each queued write through the consumer's own server operation. */
|
|
436
|
+
transport: OutboxCommandTransport;
|
|
437
|
+
/** Exponential-backoff tuning for retryable replay failures. */
|
|
438
|
+
backoff?: OutboxBackoff;
|
|
439
|
+
/** Push callback for every sync-state transition (see {@link offlineOutbox}). */
|
|
440
|
+
onSyncStateChange?: (event: SyncStateEvent) => void;
|
|
441
|
+
/** Push callback for a `conflict` outcome (a RESOLVED outcome). */
|
|
442
|
+
onConflict?: (conflict: OutboxConflict) => void;
|
|
443
|
+
/** Test-only: inject a deterministic RNG for backoff jitter. */
|
|
444
|
+
random?: () => number;
|
|
445
|
+
}
|
|
446
|
+
|
|
357
447
|
/**
|
|
358
448
|
* Build a durable offline-outbox capability for a collection. Add the returned
|
|
359
449
|
* capability to the collection's `capabilities` array; a collection without it
|
|
360
450
|
* is unaffected (the seam's no-op guarantee — the "opt-in per model" AC).
|
|
361
451
|
*
|
|
362
452
|
* The same `namespace` across multiple collections shares ONE engine (one IDB
|
|
363
|
-
* db, one
|
|
364
|
-
*
|
|
365
|
-
*
|
|
453
|
+
* db, one queue) — so cross-collection ordering and the multi-tab
|
|
454
|
+
* single-replayer guarantee hold across every sync-apply collection of a given
|
|
455
|
+
* identity (one route). A collection with a `transport` is its own route.
|
|
366
456
|
*/
|
|
367
457
|
export declare function offlineOutbox<TData extends object = object>(config: OfflineOutboxConfig<TData>): SmrtWebCapability<TData>;
|
|
368
458
|
|
|
@@ -394,9 +484,21 @@ export declare interface OfflineOutboxConfig<TData extends object = object> {
|
|
|
394
484
|
* API base path the sync-apply endpoint lives under (`POST
|
|
395
485
|
* {syncApplyBasePath}/sync/apply`). Defaults to `/api/v1`, matching the REST
|
|
396
486
|
* generator's default. Set to the SvelteKit route base (`/api`) when replaying
|
|
397
|
-
* against the generated SvelteKit `sync/apply/+server.ts`.
|
|
487
|
+
* against the generated SvelteKit `sync/apply/+server.ts`. Ignored when
|
|
488
|
+
* {@link transport} is set.
|
|
398
489
|
*/
|
|
399
490
|
syncApplyBasePath?: string;
|
|
491
|
+
/**
|
|
492
|
+
* Replay this collection's queued writes through a consumer-declared server
|
|
493
|
+
* operation instead of the generated `sync/apply` (#3021) — for a model whose
|
|
494
|
+
* generated write verbs are closed because a hand-written, permission-gated
|
|
495
|
+
* service owns its write rules. Rows are queued under `object.name` and replay
|
|
496
|
+
* ONLY through this transport (never `sync/apply`), each carrying its durable
|
|
497
|
+
* `idempotencyKey`, with the same four-state machine, per-route FIFO, and
|
|
498
|
+
* backoff.
|
|
499
|
+
* See {@link offlineCommandQueue} for writes with no collection at all.
|
|
500
|
+
*/
|
|
501
|
+
transport?: OutboxCommandTransport;
|
|
400
502
|
/** Fetch implementation override (tests, SSR). Defaults to global fetch. */
|
|
401
503
|
fetchFn?: typeof fetch;
|
|
402
504
|
/** Exponential-backoff tuning for retryable replay failures. */
|
|
@@ -429,6 +531,75 @@ export declare interface OutboxBackoff {
|
|
|
429
531
|
maxDelayMs?: number;
|
|
430
532
|
}
|
|
431
533
|
|
|
534
|
+
/**
|
|
535
|
+
* One queued write handed to a consumer-declared {@link OutboxCommandTransport}
|
|
536
|
+
* at replay time (#3021). The transport replays it through a server operation
|
|
537
|
+
* the consumer owns — a data-surface action, a named remote command, a
|
|
538
|
+
* hand-written permission-gated service — instead of the generated
|
|
539
|
+
* `sync/apply`, which calls `collection.create()` directly.
|
|
540
|
+
*/
|
|
541
|
+
export declare interface OutboxCommand {
|
|
542
|
+
/**
|
|
543
|
+
* The durable, client-minted idempotency key (the queue row's `itemId`). It
|
|
544
|
+
* is IDENTICAL on every attempt of this write — including a blind resend
|
|
545
|
+
* after a lost response — so the server operation MUST dedupe on it; that is
|
|
546
|
+
* what makes the outbox's ambiguous-failure retries safe on this path.
|
|
547
|
+
*/
|
|
548
|
+
idempotencyKey: string;
|
|
549
|
+
/** The transport name the write was queued under. */
|
|
550
|
+
name: string;
|
|
551
|
+
/** The mutation kind in sync-apply terms. */
|
|
552
|
+
op: SyncApplyOp;
|
|
553
|
+
/** The client-generated row id the write targets. */
|
|
554
|
+
rowId: string;
|
|
555
|
+
/** Row / changed fields (create, update); absent for delete. */
|
|
556
|
+
payload?: Record<string, unknown>;
|
|
557
|
+
/** The server `updated_at` the client last saw, when the caller supplied one. */
|
|
558
|
+
baseUpdatedAt?: string;
|
|
559
|
+
/** 1-based number of this attempt (`1` on the first send). */
|
|
560
|
+
attempt: number;
|
|
561
|
+
/** The value this write's transport pinned on an earlier attempt, if any. */
|
|
562
|
+
pinned?: unknown;
|
|
563
|
+
/**
|
|
564
|
+
* Durably pin a structured-clone-safe value to this write before sending,
|
|
565
|
+
* so a later attempt (including after a reload) sees it as `pinned`. A
|
|
566
|
+
* transport whose server fingerprints the request per idempotency key pins
|
|
567
|
+
* the request it built, so a resend after a lost response is identical.
|
|
568
|
+
*/
|
|
569
|
+
pin(value: unknown): Promise<void>;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
/**
|
|
573
|
+
* The server's outcome for one {@link OutboxCommand}, in the SAME vocabulary
|
|
574
|
+
* the sync-apply replay maps — so the four-state machine and backoff are
|
|
575
|
+
* shared, not re-derived:
|
|
576
|
+
*
|
|
577
|
+
* - `applied` → removed, `synced`.
|
|
578
|
+
* - `conflict` → removed, `onConflict` fired, `synced` (a RESOLVED outcome).
|
|
579
|
+
* - `rejected` with `write_failed` → kept, backoff, `pending` (retryable).
|
|
580
|
+
* - `rejected` with `auth_required` / `forbidden` → the whole loop pauses until
|
|
581
|
+
* re-auth (a later enqueue or `retry()`), kept `pending`.
|
|
582
|
+
* - `rejected` with any other reason → removed, `failed` (terminal).
|
|
583
|
+
*
|
|
584
|
+
* A transport that THROWS (network error, lost response, 5xx) is the ambiguous
|
|
585
|
+
* path: the write stays `pending` with backoff and is blindly resent later
|
|
586
|
+
* under the same {@link OutboxCommand.idempotencyKey}.
|
|
587
|
+
*/
|
|
588
|
+
export declare type OutboxCommandResult = {
|
|
589
|
+
status: 'applied';
|
|
590
|
+
updatedAt?: string;
|
|
591
|
+
} | {
|
|
592
|
+
status: 'conflict';
|
|
593
|
+
reason?: 'stale_write' | 'create_conflict';
|
|
594
|
+
updatedAt?: string;
|
|
595
|
+
} | {
|
|
596
|
+
status: 'rejected';
|
|
597
|
+
reason: SyncApplyReason | (string & {});
|
|
598
|
+
};
|
|
599
|
+
|
|
600
|
+
/** Replays one queued write through a consumer-declared server operation. */
|
|
601
|
+
export declare type OutboxCommandTransport = (command: OutboxCommand) => Promise<OutboxCommandResult>;
|
|
602
|
+
|
|
432
603
|
/**
|
|
433
604
|
* A conflict surfaced to {@link OfflineOutboxConfig.onConflict} when a replayed
|
|
434
605
|
* item comes back `conflict`. Per the contract this is a RESOLVED outcome — the
|
|
@@ -478,6 +649,8 @@ export declare interface OutboxHandle {
|
|
|
478
649
|
|
|
479
650
|
/** One item in an {@link OutboxHandle.snapshot} result. */
|
|
480
651
|
export declare interface OutboxSnapshotItem {
|
|
652
|
+
/** The transport name, when the item replays through one (#3021). */
|
|
653
|
+
transport?: string;
|
|
481
654
|
/** The queue row's idempotency handle. */
|
|
482
655
|
itemId: string;
|
|
483
656
|
/** The collection route segment. */
|
|
@@ -557,6 +730,59 @@ export declare interface PersistCollectionConfig<TData extends object = object>
|
|
|
557
730
|
debounceMs?: number;
|
|
558
731
|
}
|
|
559
732
|
|
|
733
|
+
/**
|
|
734
|
+
* Persist and rehydrate a mounted data surface's rows (#3021) — the
|
|
735
|
+
* `persistCollection` twin for a surface (e.g. one registered with
|
|
736
|
+
* `mountListDataSurface`) whose rows come from a server-scoped data-surface
|
|
737
|
+
* query rather than a generated `list` route. The page owns its rows, so it
|
|
738
|
+
* owns the calls: `load()` before the first fetch to paint stale rows, then
|
|
739
|
+
* `save(rows)` whenever it refreshes them.
|
|
740
|
+
*
|
|
741
|
+
* Shares the namespace's snapshot database, durable-resource registration,
|
|
742
|
+
* and IndexedDB-unavailable degrade with {@link persistCollection}: a
|
|
743
|
+
* manifest-hash, tenant, or identity change lands on a different database, and
|
|
744
|
+
* `wipeDurableStore(namespace)` clears the surface's rows with the rest.
|
|
745
|
+
*/
|
|
746
|
+
export declare function persistDataSurface<TRow extends object = object>(config: PersistDataSurfaceConfig): PersistedDataSurface<TRow>;
|
|
747
|
+
|
|
748
|
+
/** Configuration for {@link persistDataSurface}. */
|
|
749
|
+
export declare interface PersistDataSurfaceConfig {
|
|
750
|
+
/**
|
|
751
|
+
* The durable-store identity — the SAME key the app's collections and
|
|
752
|
+
* outbox use. It folds the principal (`identityId`) and tenant, so a surface
|
|
753
|
+
* whose rows the server scopes per principal lands on a per-principal
|
|
754
|
+
* database: another user on the device never reads them, and one
|
|
755
|
+
* `wipeDurableStore(namespace)` on logout clears them with everything else.
|
|
756
|
+
*/
|
|
757
|
+
namespace: DurableStoreKey;
|
|
758
|
+
/** The mounted surface's identity (`descriptor.identity`) — the store key. */
|
|
759
|
+
identity: SmrtWebDataSurfaceIdentity;
|
|
760
|
+
/** Trailing-debounce window for `save` (ms). Default {@link DEFAULT_PERSIST_DEBOUNCE_MS}. */
|
|
761
|
+
debounceMs?: number;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
/** A durable row snapshot for one mounted data surface (#3021). */
|
|
765
|
+
export declare interface PersistedDataSurface<TRow extends object = object> {
|
|
766
|
+
/**
|
|
767
|
+
* The rows last saved for this surface under this namespace, or `undefined`
|
|
768
|
+
* when none exist (first load, a different principal/tenant/manifest, a
|
|
769
|
+
* wipe, or no IndexedDB). Render them as stale, then revalidate. After a
|
|
770
|
+
* `wipeDurableStore` of its namespace a handle is inert (`load` finds
|
|
771
|
+
* nothing, `save` is ignored); create a new one for the next scope.
|
|
772
|
+
*/
|
|
773
|
+
load(): Promise<TRow[] | undefined>;
|
|
774
|
+
/**
|
|
775
|
+
* Replace the persisted rows (debounced, trailing; last call wins). Pass the
|
|
776
|
+
* surface's CURRENT rows whenever the page refreshes them. Rows must be
|
|
777
|
+
* structured-clone-safe plain objects.
|
|
778
|
+
*/
|
|
779
|
+
save(rows: readonly TRow[]): void;
|
|
780
|
+
/** Write any pending `save` now. */
|
|
781
|
+
flush(): Promise<void>;
|
|
782
|
+
/** Flush a pending `save`, then release the shared store. */
|
|
783
|
+
dispose(): Promise<void>;
|
|
784
|
+
}
|
|
785
|
+
|
|
560
786
|
/**
|
|
561
787
|
* Register a durable artifact under a namespace so {@link wipeDurableStore} can
|
|
562
788
|
* later clear it. Returns an unregister function that removes just this
|
|
@@ -1056,6 +1282,37 @@ export declare interface SmrtWebDataQueryTransport {
|
|
|
1056
1282
|
}): Promise<unknown>;
|
|
1057
1283
|
}
|
|
1058
1284
|
|
|
1285
|
+
/**
|
|
1286
|
+
* The replay-time request for {@link dataSurfaceActionCommandTransport}: every
|
|
1287
|
+
* action-request field except those the adapter owns — `version`, `phase`,
|
|
1288
|
+
* `requestId`, `idempotencyKey`, and `confirmationToken`.
|
|
1289
|
+
*/
|
|
1290
|
+
export declare type SmrtWebDataSurfaceActionCommandRequest = Omit<SmrtWebDataSurfaceActionRequest, 'version' | 'phase' | 'requestId' | 'idempotencyKey' | 'confirmationToken'>;
|
|
1291
|
+
|
|
1292
|
+
export declare interface SmrtWebDataSurfaceActionCommandTransportOptions {
|
|
1293
|
+
/** The same action transport the mounted surface uses online. */
|
|
1294
|
+
transport: SmrtWebDataSurfaceActionTransport;
|
|
1295
|
+
/**
|
|
1296
|
+
* Build the action request for a queued write at its FIRST replay attempt,
|
|
1297
|
+
* so it carries the surface's `expectedRevision` as of replay rather than
|
|
1298
|
+
* capture. The built request is pinned durably to the write and reused on
|
|
1299
|
+
* every later attempt (including after a reload): the server fingerprints
|
|
1300
|
+
* the request per idempotency key, so a resend after a lost response must be
|
|
1301
|
+
* identical to replay the recorded result instead of `idempotency_conflict`.
|
|
1302
|
+
*/
|
|
1303
|
+
request: (command: OutboxCommand) => SmrtWebDataSurfaceActionCommandRequest | Promise<SmrtWebDataSurfaceActionCommandRequest>;
|
|
1304
|
+
/**
|
|
1305
|
+
* Run `preview` first and apply with its `confirmationToken` — for actions
|
|
1306
|
+
* whose server adapter requires confirmation. Default false (apply only).
|
|
1307
|
+
* The token is pinned before apply; a retry applies with it directly (the
|
|
1308
|
+
* server replays a completed result) and previews again only when the token
|
|
1309
|
+
* turns out unusable.
|
|
1310
|
+
*/
|
|
1311
|
+
preview?: boolean;
|
|
1312
|
+
/** Map a non-throwing result onto an outbox outcome. Default below. */
|
|
1313
|
+
classify?: (result: SmrtWebDataSurfaceActionResult) => OutboxCommandResult;
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1059
1316
|
export declare interface SmrtWebDataSurfaceActionRequest {
|
|
1060
1317
|
version: 1;
|
|
1061
1318
|
requestId: string;
|
|
@@ -1100,13 +1357,6 @@ export declare interface SmrtWebDataSurfaceIdentity {
|
|
|
1100
1357
|
};
|
|
1101
1358
|
}
|
|
1102
1359
|
|
|
1103
|
-
/**
|
|
1104
|
-
* Browser transport for bounded data-surface action envelopes.
|
|
1105
|
-
*
|
|
1106
|
-
* This structurally mirrors smrt-types without importing another SMRT package.
|
|
1107
|
-
* The server remains responsible for authority, descriptor allowlists, and
|
|
1108
|
-
* confirmation-token validation; this boundary only rejects malformed replies.
|
|
1109
|
-
*/
|
|
1110
1360
|
export declare type SmrtWebDataSurfaceJsonPrimitive = string | number | boolean | null;
|
|
1111
1361
|
|
|
1112
1362
|
export declare type SmrtWebDataSurfaceJsonValue = SmrtWebDataSurfaceJsonPrimitive | SmrtWebDataSurfaceJsonValue[] | {
|
|
@@ -1406,6 +1656,36 @@ export declare interface SmrtWebTransaction {
|
|
|
1406
1656
|
};
|
|
1407
1657
|
}
|
|
1408
1658
|
|
|
1659
|
+
/**
|
|
1660
|
+
* @happyvertical/smrt-web — offline outbox shared types (#1762).
|
|
1661
|
+
*
|
|
1662
|
+
* The SMRT-owned vocabulary the outbox modules (`durable-queue`, `leader`,
|
|
1663
|
+
* `engine`) and the public surface (`offline.ts`) share. Kept in its own leaf
|
|
1664
|
+
* module — imported by everything, importing nothing from the package — so there
|
|
1665
|
+
* is no cycle back through `index.ts` and the whole outbox stays inside the
|
|
1666
|
+
* engine-absorption boundary (#1761): NOT ONE `@tanstack/*` type appears here.
|
|
1667
|
+
*
|
|
1668
|
+
* The sync-apply op/status/reason names mirror
|
|
1669
|
+
* `packages/core/src/sync/apply.ts` (the replay target) verbatim, so a queue row
|
|
1670
|
+
* maps to a batch item and a batch result maps to a state transition with no
|
|
1671
|
+
* translation layer. smrt-web has no inter-smrt dependency (dependency-DAG
|
|
1672
|
+
* guardrails), so these are re-declared here rather than imported from core.
|
|
1673
|
+
*/
|
|
1674
|
+
/**
|
|
1675
|
+
* Mutation kinds the sync-apply batch endpoint accepts. Mirrors core's
|
|
1676
|
+
* `SyncApplyOp`. The outbox maps the capability seam's insert/update/delete
|
|
1677
|
+
* envelope kinds onto these (`insert → create`).
|
|
1678
|
+
*/
|
|
1679
|
+
declare type SyncApplyOp = 'create' | 'update' | 'delete';
|
|
1680
|
+
|
|
1681
|
+
/**
|
|
1682
|
+
* Machine-readable reasons a sync-apply item was `conflict` or `rejected`.
|
|
1683
|
+
* Mirrors core's `SyncApplyReason` union. Drives the engine's result mapping:
|
|
1684
|
+
* `auth_required`/`forbidden` pause the loop; `write_failed` retries; the rest
|
|
1685
|
+
* are terminal.
|
|
1686
|
+
*/
|
|
1687
|
+
declare type SyncApplyReason = 'invalid_item' | 'invalid_id' | 'invalid_payload' | 'unknown_object' | 'op_not_allowed' | 'auth_required' | 'forbidden' | 'not_found' | 'id_conflict' | 'write_failed' | 'stale_write' | 'create_conflict';
|
|
1688
|
+
|
|
1409
1689
|
/**
|
|
1410
1690
|
* A sync-state transition delivered to {@link OfflineOutboxConfig.onSyncStateChange}.
|
|
1411
1691
|
* A PUSH callback (not a subscribable store): smrt-svelte wraps it into a
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as MAX_SMRT_WEB_DATA_SURFACE_ACTION_IDENTIFIER_LENGTH, B as MAX_SMRT_WEB_DATA_QUERY_OFFSET, C as getOutboxHandle, D as registerDurableResource, E as durableStoreNamespace, F as executeSmrtWebDataSurfaceAction, G as MAX_SMRT_WEB_DATA_QUERY_WARNINGS, H as MAX_SMRT_WEB_DATA_QUERY_RESULT_BYTES, I as normalizeSmrtWebDataSurfaceActionResult, J as runWrapMutation, K as executeSmrtWebDataQuery, L as MAX_SMRT_WEB_DATA_QUERY_CONTAINER_ITEMS, M as MAX_SMRT_WEB_DATA_SURFACE_ACTION_RESULT_BYTES, N as classifySmrtWebDataSurfaceActionResult, O as wipeDurableStore, P as dataSurfaceActionCommandTransport, R as MAX_SMRT_WEB_DATA_QUERY_FACETS, S as persistDataSurface, T as offlineOutbox, U as MAX_SMRT_WEB_DATA_QUERY_ROWS, V as MAX_SMRT_WEB_DATA_QUERY_PAGE_LIMIT, W as MAX_SMRT_WEB_DATA_QUERY_STRING_LENGTH, _ as createSmrtWebEventSubscriber, a as createSmrtWebClient, b as DEFAULT_PERSIST_DEBOUNCE_MS, c as newLocalId, d as unwrapListResult, f as validateSmrtWebClient, g as createUpdateState, h as registerWebMcpTools, i as createSmrtCollection, j as MAX_SMRT_WEB_DATA_SURFACE_ACTION_JSON_DEPTH, k as MAX_SMRT_WEB_DATA_SURFACE_ACTION_CONTAINER_ITEMS, l as throwIfSmrtWebError, m as registerWebMcpBespokeTool, n as buildListQuery, o as getEngineCollection, p as registerViewIntent, q as normalizeSmrtWebDataQueryResult, r as createDefinitionFetchers, s as invalidateSmrtWebCollections, t as SmrtWebRequestError, u as unwrapItemResult, v as liveInvalidation, w as offlineCommandQueue, x as persistCollection, y as createSmrtWebQuery, z as MAX_SMRT_WEB_DATA_QUERY_FACET_VALUES } from "./chunks/src-B2uQWayW.js";
|
|
2
2
|
import { n as compileViewIntentToolSpec, o as viewIntentToolName } from "./chunks/intents-BUTyN7YQ.js";
|
|
3
3
|
import { WebMcpToolNameCollisionError, reserveWebMcpToolNames, webMcpToolNameOwner } from "./webmcp-tool-names.js";
|
|
4
|
-
export { DEFAULT_PERSIST_DEBOUNCE_MS, MAX_SMRT_WEB_DATA_QUERY_CONTAINER_ITEMS, MAX_SMRT_WEB_DATA_QUERY_FACETS, MAX_SMRT_WEB_DATA_QUERY_FACET_VALUES, MAX_SMRT_WEB_DATA_QUERY_OFFSET, MAX_SMRT_WEB_DATA_QUERY_PAGE_LIMIT, MAX_SMRT_WEB_DATA_QUERY_RESULT_BYTES, MAX_SMRT_WEB_DATA_QUERY_ROWS, MAX_SMRT_WEB_DATA_QUERY_STRING_LENGTH, MAX_SMRT_WEB_DATA_QUERY_WARNINGS, MAX_SMRT_WEB_DATA_SURFACE_ACTION_CONTAINER_ITEMS, MAX_SMRT_WEB_DATA_SURFACE_ACTION_IDENTIFIER_LENGTH, MAX_SMRT_WEB_DATA_SURFACE_ACTION_JSON_DEPTH, MAX_SMRT_WEB_DATA_SURFACE_ACTION_RESULT_BYTES, SmrtWebRequestError, WebMcpToolNameCollisionError, buildListQuery, compileViewIntentToolSpec, createDefinitionFetchers, createSmrtCollection, createSmrtWebClient, createSmrtWebEventSubscriber, createSmrtWebQuery, createUpdateState, durableStoreNamespace, executeSmrtWebDataQuery, executeSmrtWebDataSurfaceAction, getEngineCollection, getOutboxHandle, invalidateSmrtWebCollections, liveInvalidation, newLocalId, normalizeSmrtWebDataQueryResult, normalizeSmrtWebDataSurfaceActionResult, offlineOutbox, persistCollection, registerDurableResource, registerViewIntent, registerWebMcpBespokeTool, registerWebMcpTools, reserveWebMcpToolNames, runWrapMutation, throwIfSmrtWebError, unwrapItemResult, unwrapListResult, validateSmrtWebClient, viewIntentToolName, webMcpToolNameOwner, wipeDurableStore };
|
|
4
|
+
export { DEFAULT_PERSIST_DEBOUNCE_MS, MAX_SMRT_WEB_DATA_QUERY_CONTAINER_ITEMS, MAX_SMRT_WEB_DATA_QUERY_FACETS, MAX_SMRT_WEB_DATA_QUERY_FACET_VALUES, MAX_SMRT_WEB_DATA_QUERY_OFFSET, MAX_SMRT_WEB_DATA_QUERY_PAGE_LIMIT, MAX_SMRT_WEB_DATA_QUERY_RESULT_BYTES, MAX_SMRT_WEB_DATA_QUERY_ROWS, MAX_SMRT_WEB_DATA_QUERY_STRING_LENGTH, MAX_SMRT_WEB_DATA_QUERY_WARNINGS, MAX_SMRT_WEB_DATA_SURFACE_ACTION_CONTAINER_ITEMS, MAX_SMRT_WEB_DATA_SURFACE_ACTION_IDENTIFIER_LENGTH, MAX_SMRT_WEB_DATA_SURFACE_ACTION_JSON_DEPTH, MAX_SMRT_WEB_DATA_SURFACE_ACTION_RESULT_BYTES, SmrtWebRequestError, WebMcpToolNameCollisionError, buildListQuery, classifySmrtWebDataSurfaceActionResult, compileViewIntentToolSpec, createDefinitionFetchers, createSmrtCollection, createSmrtWebClient, createSmrtWebEventSubscriber, createSmrtWebQuery, createUpdateState, dataSurfaceActionCommandTransport, durableStoreNamespace, executeSmrtWebDataQuery, executeSmrtWebDataSurfaceAction, getEngineCollection, getOutboxHandle, invalidateSmrtWebCollections, liveInvalidation, newLocalId, normalizeSmrtWebDataQueryResult, normalizeSmrtWebDataSurfaceActionResult, offlineCommandQueue, offlineOutbox, persistCollection, persistDataSurface, registerDurableResource, registerViewIntent, registerWebMcpBespokeTool, registerWebMcpTools, reserveWebMcpToolNames, runWrapMutation, throwIfSmrtWebError, unwrapItemResult, unwrapListResult, validateSmrtWebClient, viewIntentToolName, webMcpToolNameOwner, wipeDurableStore };
|
package/dist/webmcp.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { h as registerWebMcpTools, m as registerWebMcpBespokeTool, p as registerViewIntent } from "./chunks/src-
|
|
1
|
+
import { h as registerWebMcpTools, m as registerWebMcpBespokeTool, p as registerViewIntent } from "./chunks/src-B2uQWayW.js";
|
|
2
2
|
import { WebMcpToolNameCollisionError, reserveWebMcpToolNames, webMcpToolNameOwner } from "./webmcp-tool-names.js";
|
|
3
3
|
export { WebMcpToolNameCollisionError, registerViewIntent, registerWebMcpBespokeTool, registerWebMcpTools, reserveWebMcpToolNames, webMcpToolNameOwner };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@happyvertical/smrt-web",
|
|
3
|
-
"version": "0.51.
|
|
3
|
+
"version": "0.51.30",
|
|
4
4
|
"description": "SMRT browser client data runtime: typed collection factory wrapping the client-data engine over generated REST clients",
|
|
5
5
|
"author": "HappyVertical",
|
|
6
6
|
"type": "module",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"@tanstack/query-db-collection": "^1.0.46"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@happyvertical/smrt-core": "0.51.
|
|
44
|
-
"@happyvertical/smrt-scanner": "0.51.
|
|
43
|
+
"@happyvertical/smrt-core": "0.51.30",
|
|
44
|
+
"@happyvertical/smrt-scanner": "0.51.30",
|
|
45
45
|
"@types/node": "24.13.6",
|
|
46
46
|
"fake-indexeddb": "^6.2.5",
|
|
47
47
|
"typescript": "5.9.3",
|