foldkit-sync 0.6.0 → 0.7.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/README.md +121 -10
- package/dist/index.d.mts +148 -20
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +458 -160
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -269,6 +269,15 @@ replica. If an application genuinely needs different replay semantics, `make`
|
|
|
269
269
|
accepts a custom `replay`, but that custom replay does not get the derived
|
|
270
270
|
guardrails.
|
|
271
271
|
|
|
272
|
+
When the work between intent and fact needs nothing but the Model — an id minted
|
|
273
|
+
from a local counter, say — return the fact as `Sync.fact(message)` instead of an
|
|
274
|
+
ordinary Command. `Sync.mount` applies it straight after the intent's `update`,
|
|
275
|
+
in the same transition, and persists it if it is durable. An ordinary Command's
|
|
276
|
+
Message arrives later, so a second intent dispatched in the meantime would read
|
|
277
|
+
the Model from before the fact and could mint the same id. Outside `mount`, or
|
|
278
|
+
once a parent has mapped it, `Sync.fact` is an ordinary Command that yields the
|
|
279
|
+
Message.
|
|
280
|
+
|
|
272
281
|
## Running a replica
|
|
273
282
|
|
|
274
283
|
The low-level runtime is a `Replica`. It owns the local outbox, committed shared
|
|
@@ -340,18 +349,21 @@ operation may run many times as the authoritative base changes beneath it.
|
|
|
340
349
|
|
|
341
350
|
## Synchronization
|
|
342
351
|
|
|
343
|
-
A replica exchanges
|
|
352
|
+
A replica exchanges these with the server:
|
|
344
353
|
|
|
345
354
|
```text
|
|
346
355
|
request
|
|
347
356
|
current cursor
|
|
348
357
|
pending operations
|
|
358
|
+
the server's epoch, once the replica has heard one
|
|
349
359
|
|
|
350
360
|
response
|
|
351
361
|
newly committed operations
|
|
352
362
|
acknowledgements
|
|
353
363
|
rejections
|
|
354
364
|
optional checkpoint
|
|
365
|
+
optional more (the replica asks again at once)
|
|
366
|
+
optional epoch
|
|
355
367
|
```
|
|
356
368
|
|
|
357
369
|
`replica.synchronize` performs one exchange through the `Transport` Effect
|
|
@@ -364,8 +376,12 @@ const once = replica.synchronize.pipe(
|
|
|
364
376
|
```
|
|
365
377
|
|
|
366
378
|
`replica.start` is the long-running convenience loop. It exchanges once, then
|
|
367
|
-
wakes after every submit
|
|
368
|
-
`
|
|
379
|
+
wakes after every submit and every notice the transport hears from the server
|
|
380
|
+
(`Transport.changes`). A failed exchange, whether the wire failed or the
|
|
381
|
+
response was refused, is recorded in `status.lastError` and announced on
|
|
382
|
+
`statusChanges`; the loop survives and retries on a backoff from 0.5 s up to
|
|
383
|
+
30 s, or at once on the next submit, so an outbox is delivered even if nobody
|
|
384
|
+
types again.
|
|
369
385
|
|
|
370
386
|
```ts
|
|
371
387
|
Effect.runFork(
|
|
@@ -383,7 +399,9 @@ the replica validates the response and applies the protocol rules.
|
|
|
383
399
|
|
|
384
400
|
An acknowledgement says an operation the replica sent is durably accepted, so
|
|
385
401
|
it may leave the outbox even if its committed payload is not repeated in this
|
|
386
|
-
response.
|
|
402
|
+
response. While a paged response says there is `more`, an acknowledged operation
|
|
403
|
+
stays pending, because its committed copy may be on a later page; it leaves once
|
|
404
|
+
that copy arrives or the last page has been read.
|
|
387
405
|
|
|
388
406
|
### Rejections
|
|
389
407
|
|
|
@@ -421,6 +439,31 @@ pending operations on top. A checkpoint behind the replica's current cursor is
|
|
|
421
439
|
rejected with `CheckpointRegressionError` rather than silently moving history
|
|
422
440
|
backwards.
|
|
423
441
|
|
|
442
|
+
### Paged answers
|
|
443
|
+
|
|
444
|
+
A server may answer with only part of what follows the cursor and set `more:
|
|
445
|
+
true`. `synchronize` then exchanges again at once, until an answer has no
|
|
446
|
+
`more` or a round moves the cursor nowhere. A replica that was offline for a
|
|
447
|
+
long time therefore catches up in bounded steps within one `synchronize`. The
|
|
448
|
+
example servers page with Durable's `read(key, cursor, { limit })`.
|
|
449
|
+
|
|
450
|
+
### Coalescing a burst
|
|
451
|
+
|
|
452
|
+
Typing makes one durable Message per keystroke. A contract can merge them while
|
|
453
|
+
the server has not seen them. `make({ ..., coalesce: (last, next) => merged })`
|
|
454
|
+
is offered each submitted Message together with the last one in the outbox. If
|
|
455
|
+
it returns a Message, that Message replaces the last operation under the last
|
|
456
|
+
operation's id; if it returns `undefined`, the new Message gets an operation of
|
|
457
|
+
its own. Replaying the merged Message must give the same result as replaying
|
|
458
|
+
`last` then `next`.
|
|
459
|
+
|
|
460
|
+
An operation is merged into only while no exchange has carried it. Once one has,
|
|
461
|
+
even an exchange that failed, the server may already have committed it as it
|
|
462
|
+
was. An operation loaded from storage is never merged into either. So there is
|
|
463
|
+
no timer to tune: a burst typed while an exchange is out becomes one operation,
|
|
464
|
+
and a single keystroke goes out as quickly as it did before. The local sequence
|
|
465
|
+
still advances on every submit.
|
|
466
|
+
|
|
424
467
|
## Replica status and UI state
|
|
425
468
|
|
|
426
469
|
The public replica surface deliberately exposes enough state for UI and recovery
|
|
@@ -580,6 +623,18 @@ await mounted.dispose()
|
|
|
580
623
|
`dispose()` waits for in-flight persists started by the mount; the Replica itself
|
|
581
624
|
remains separately owned and must be closed with its scope/lifecycle.
|
|
582
625
|
|
|
626
|
+
The mount replaces the shared slice outside `update` in two cases: when an
|
|
627
|
+
exchange changes what the replica holds (it commits, acknowledges or rejects
|
|
628
|
+
something), and when a failed persist reverts its edit. A replica status that
|
|
629
|
+
changes nothing the Model shows, such as the one a mount starts with, replaces
|
|
630
|
+
nothing. `onReinstall(next, previous)` sees both cases and returns the
|
|
631
|
+
transition, so local state that points into the shared slice (a selection) can
|
|
632
|
+
be carried across the change, and a Command can take it where it has to go (a
|
|
633
|
+
DOM that is patched rather than re-rendered). Omitted, the Model is simply
|
|
634
|
+
`next`. A durable `Sync.fact` it returns is a new edit, so return one only for
|
|
635
|
+
what changed: returned every time, it adds an edit per exchange, and while
|
|
636
|
+
storage keeps failing, one per failure.
|
|
637
|
+
|
|
583
638
|
### URL, Mirror, and agents
|
|
584
639
|
|
|
585
640
|
The optional `url` option routes navigation through the application:
|
|
@@ -690,10 +745,20 @@ const storage = yield* Sync.indexedDb('todos/tab-1')
|
|
|
690
745
|
```
|
|
691
746
|
|
|
692
747
|
Stored replica state includes protocol/schema versions, document/replica
|
|
693
|
-
identity, cursor, committed snapshot, local sequence, and
|
|
748
|
+
identity, cursor, the server's epoch, committed snapshot, local sequence, and
|
|
749
|
+
pending operations.
|
|
694
750
|
Persisted and remote operations are decoded strictly against the application
|
|
695
751
|
Message Schema.
|
|
696
752
|
|
|
753
|
+
A submit writes only its operation. A `Storage` may implement the optional
|
|
754
|
+
`append(entry, expectedRevision)`, which records one operation with the
|
|
755
|
+
replica's next revision and local sequence. `load` then returns the saved state
|
|
756
|
+
with those operations added to its outbox. The IndexedDB adapter keeps them in an
|
|
757
|
+
`outbox` store beside the state, so a keystroke costs the size of the operation,
|
|
758
|
+
not of the document. An exchange changes the committed snapshot, so it still
|
|
759
|
+
saves the whole state, which clears the appended rows. A storage without
|
|
760
|
+
`append` saves the whole state on every submit, as before.
|
|
761
|
+
|
|
697
762
|
Important recovery cases:
|
|
698
763
|
|
|
699
764
|
- **Storage absent or evicted.** The replica starts at cursor 0 and can catch up
|
|
@@ -706,8 +771,26 @@ Important recovery cases:
|
|
|
706
771
|
the application can offer an explicit reset/recovery path.
|
|
707
772
|
- **Unsupported storage version.** `UnsupportedReplicaVersionError` names the
|
|
708
773
|
persisted and supported versions so migration/reset can be explicit.
|
|
774
|
+
- **Rolling back past the outbox store.** The IndexedDB adapter upgrades its
|
|
775
|
+
database to version 2, adding the `outbox` store. A release from before that
|
|
776
|
+
opens it as version 1, which the browser refuses with a `VersionError`, so a
|
|
777
|
+
rollback that far needs a new database name or a reset.
|
|
778
|
+
- **Another tab blocks the upgrade.** Opening fails with a `StorageError`
|
|
779
|
+
rather than waiting; a connection the upgrade opens later is closed.
|
|
709
780
|
- **Server compaction.** A checkpoint replaces history the replica can no longer
|
|
710
781
|
replay and pending local work is rebased on it.
|
|
782
|
+
- **Server reset.** A server that answers with an `epoch` (Durable's
|
|
783
|
+
`journal.epoch(key)`) names its history, and the replica stores it and sends
|
|
784
|
+
it back as `exchange`'s third argument. A server that finds another epoch
|
|
785
|
+
answers from sequence 0 of its own history, and should skip its
|
|
786
|
+
cursor-ahead check for that request. The replica then rebuilds its committed
|
|
787
|
+
state from that answer and keeps its outbox, which the same exchange delivers.
|
|
788
|
+
Everything the old server committed is gone, on every replica; only what was
|
|
789
|
+
still pending survives. The replica trusts a server that names a new epoch to
|
|
790
|
+
have answered from its start; it does not check. A replica that has never
|
|
791
|
+
heard an epoch takes the first one as its own, so a reset before that is not
|
|
792
|
+
recognized: such a replica fails every exchange (its cursor is ahead of the
|
|
793
|
+
server's) until its storage is cleared.
|
|
711
794
|
|
|
712
795
|
Application Message/shared-state migrations remain application policy; Sync
|
|
713
796
|
versioning protects its own persisted envelope.
|
|
@@ -726,11 +809,27 @@ Sync.transport.serve(...)
|
|
|
726
809
|
Sync.transport.nativeSocket(...)
|
|
727
810
|
```
|
|
728
811
|
|
|
729
|
-
The
|
|
730
|
-
jittered backoff
|
|
731
|
-
|
|
812
|
+
The socket transport reconnects for as long as its layer lives, on an
|
|
813
|
+
exponential, jittered backoff capped at `maxRetryDelay` (5 s by default), and
|
|
814
|
+
keeps request identities stable when resending queued or in-flight exchanges.
|
|
815
|
+
After `maxRetries` consecutive failed connections (5 by default) queued work
|
|
816
|
+
fails and new exchanges fail fast while no socket is open. The count resets
|
|
817
|
+
only when a connection proves healthy, by answering a frame or by staying open
|
|
818
|
+
for `maxRetryDelay`, so a server that accepts each socket and drops it is backed
|
|
819
|
+
off like one that refuses it. The queue is bounded by `maxQueue`. A server rejection is protocol data; only a wire failure is
|
|
732
820
|
a `TransportError`.
|
|
733
821
|
|
|
822
|
+
The server can also tell a client that something changed. Pass `serve` a
|
|
823
|
+
`changes` subscription, a function that takes a listener and returns its
|
|
824
|
+
unsubscribe, and it sends the socket a `{ notify: true }` frame after each
|
|
825
|
+
commit. The client's socket transport exposes these notices, and every
|
|
826
|
+
(re)connection, as the `Transport`'s optional `changes` stream, which
|
|
827
|
+
`replica.start` wakes on as it does on a submit. A notice carries no data: the
|
|
828
|
+
exchange that follows reads from the replica's own cursor, so a lost or repeated
|
|
829
|
+
notice is harmless, and a replica that is only reading still sees others' edits
|
|
830
|
+
without polling. With Durable, the subscription is `journal.subscribe` filtered
|
|
831
|
+
to the document's key; `examples/sync/src/server.ts` wires it.
|
|
832
|
+
|
|
734
833
|
Transport is deliberately below reconciliation. A custom transport can carry
|
|
735
834
|
the same exchange without changing replica semantics.
|
|
736
835
|
|
|
@@ -742,7 +841,18 @@ next week.
|
|
|
742
841
|
|
|
743
842
|
`Sync.presence.make` creates a TTL'd peer registry. Values are decoded before
|
|
744
843
|
they enter the registry; a peer that stops refreshing is removed. Changes are
|
|
745
|
-
available both as a callback subscription and as a Stream.
|
|
844
|
+
available both as a callback subscription and as a Stream. A caret sets a new
|
|
845
|
+
value on nearly every keystroke; with `throttle: '50 millis'` a value set after
|
|
846
|
+
a quiet interval is sent at once, and those set within the interval wait, only
|
|
847
|
+
the latest of them sent when it ends. The peer's own entry changes at once. A departure (`leave`) is sent immediately
|
|
848
|
+
and cancels a value still waiting.
|
|
849
|
+
|
|
850
|
+
Presence can share the socket transport's connection. `transport.socket` is a
|
|
851
|
+
stable handle to it: a send goes to the socket that is open now and is dropped
|
|
852
|
+
while none is, and messages from every socket the transport opens arrive
|
|
853
|
+
through it. So `Sync.presence.socketChannel(transport.socket)` survives
|
|
854
|
+
reconnects without being bound again. After a reconnect the server has
|
|
855
|
+
forgotten the peer's value, so announce it again within the time to live.
|
|
746
856
|
|
|
747
857
|
Presence can travel through:
|
|
748
858
|
|
|
@@ -973,7 +1083,8 @@ declared projection; treat any other write as a bug.
|
|
|
973
1083
|
- There is no operational transform / collaborative text algorithm.
|
|
974
1084
|
- Binding the socket transport and presence server to a platform WebSocket
|
|
975
1085
|
server remains application/platform glue. The sync example demonstrates a
|
|
976
|
-
`ws` transport binding
|
|
1086
|
+
`ws` transport binding. `examples/pages` serves presence over the same socket,
|
|
1087
|
+
and shows remote carets.
|
|
977
1088
|
- Application schema migration remains application policy. Sync versions and
|
|
978
1089
|
validates its own persisted/wire envelope.
|
|
979
1090
|
|
package/dist/index.d.mts
CHANGED
|
@@ -4,6 +4,7 @@ import { UrlRequest } from "foldkit/navigation";
|
|
|
4
4
|
import { Subscriptions } from "foldkit/subscription";
|
|
5
5
|
import * as Url from "foldkit/url";
|
|
6
6
|
import { Document, HtmlBuilder } from "foldkit/html";
|
|
7
|
+
import * as Update from "foldkit/update";
|
|
7
8
|
//#region src/ids.d.ts
|
|
8
9
|
/** Identifies the replicated document a replica or operation belongs to. */
|
|
9
10
|
export declare const DocumentId: Schema$1.brand<Schema$1.NonEmptyString, "@foldkit-sync/DocumentId">;
|
|
@@ -125,15 +126,39 @@ export declare class ReplayError extends ReplayError_base {}
|
|
|
125
126
|
type ReplicaError = StorageError | ReplayError | WrongReplicaStorageError | InvalidReplicaHistoryError | InvalidExchangeError | UnsupportedReplicaVersionError | InvalidOutboxError | CheckpointRegressionError | CommittedOrderError | ForeignRejectionError | ForeignAcknowledgementError | ReplicaClosedError;
|
|
126
127
|
//#endregion
|
|
127
128
|
//#region src/indexedDb.d.ts
|
|
129
|
+
/** One submitted operation, as `Storage.append` records it. */
|
|
130
|
+
interface OutboxEntry {
|
|
131
|
+
/** The replica's revision once this operation is in its outbox. */
|
|
132
|
+
readonly revision: number;
|
|
133
|
+
readonly nextLocalSequence: number;
|
|
134
|
+
/**
|
|
135
|
+
* The operation's local sequence. An entry with the sequence of one already in the
|
|
136
|
+
* outbox replaces it: a coalesced submit rewrites the last operation.
|
|
137
|
+
*/
|
|
138
|
+
readonly localSequence: number;
|
|
139
|
+
/** The operation, encoded. */
|
|
140
|
+
readonly operation: unknown;
|
|
141
|
+
}
|
|
128
142
|
/** Persists a replica's state with compare-and-swap on its revision. */
|
|
129
143
|
interface Storage {
|
|
144
|
+
/**
|
|
145
|
+
* The saved state, with every operation appended since in its `pending` (replacing the
|
|
146
|
+
* one of the same local sequence), and the last one's `revision` and `nextLocalSequence`.
|
|
147
|
+
*/
|
|
130
148
|
load: () => Effect.Effect<unknown, StorageError>;
|
|
149
|
+
/** Replaces the whole state, and with it every appended operation. */
|
|
131
150
|
save: (state: unknown, expectedRevision: number | null) => Effect.Effect<void, StorageError>;
|
|
151
|
+
/**
|
|
152
|
+
* Optional. Records one submitted operation without rewriting the rest of the state, so
|
|
153
|
+
* a submit costs the operation's size rather than the document's. Without it, a submit
|
|
154
|
+
* saves the whole state.
|
|
155
|
+
*/
|
|
156
|
+
append?: (entry: OutboxEntry, expectedRevision: number) => Effect.Effect<void, StorageError>;
|
|
132
157
|
/** Idempotent; the caller closes the connection explicitly. */
|
|
133
158
|
close: Effect.Effect<void>;
|
|
134
159
|
}
|
|
135
160
|
/** One database per document/replica; CAS prevents two tabs from sharing a writer identity. */
|
|
136
|
-
export declare const indexedDb: (name: string | Config.Config<string>, factory?: IDBFactory | undefined) => Effect.Effect<Storage
|
|
161
|
+
export declare const indexedDb: (name: string | Config.Config<string>, factory?: IDBFactory | undefined) => Effect.Effect<Required<Storage>, StorageError, import("effect/Scope").Scope>;
|
|
137
162
|
//#endregion
|
|
138
163
|
//#region src/transport.d.ts
|
|
139
164
|
declare const TransportError_base: Schema$1.Class<TransportError, Schema$1.TaggedStruct<"SyncTransportError", {
|
|
@@ -146,14 +171,35 @@ interface ExchangeFrame {
|
|
|
146
171
|
readonly id: string;
|
|
147
172
|
readonly cursor: number;
|
|
148
173
|
readonly pending: ReadonlyArray<Operation>;
|
|
174
|
+
readonly epoch?: string | undefined;
|
|
149
175
|
}
|
|
150
176
|
interface ExchangeReply {
|
|
151
177
|
readonly id: string;
|
|
152
178
|
readonly result?: unknown;
|
|
153
179
|
readonly error?: string;
|
|
154
180
|
}
|
|
181
|
+
/**
|
|
182
|
+
* Sent by a server, unasked, when the document may have changed. It carries no
|
|
183
|
+
* data: the replica exchanges from its own cursor, so a notice that is lost,
|
|
184
|
+
* late, or one of many is harmless.
|
|
185
|
+
*/
|
|
186
|
+
interface NotifyFrame {
|
|
187
|
+
readonly notify: true;
|
|
188
|
+
}
|
|
155
189
|
interface TransportShape {
|
|
156
|
-
|
|
190
|
+
/** `epoch` is the server history the replica's cursor points into, when it knows one. */
|
|
191
|
+
readonly exchange: (cursor: number, pending: ReadonlyArray<Operation>, epoch?: string | undefined) => Effect.Effect<unknown, TransportError>;
|
|
192
|
+
/**
|
|
193
|
+
* Emits when the server may have something new, for a transport that can hear
|
|
194
|
+
* it: `Replica.start` exchanges on each. A wake-up, not data.
|
|
195
|
+
*/
|
|
196
|
+
readonly changes?: Stream.Stream<void> | undefined;
|
|
197
|
+
/**
|
|
198
|
+
* The connection itself, for another protocol to share, such as presence: a send goes to
|
|
199
|
+
* the socket open now and is dropped while none is, and messages from every socket the
|
|
200
|
+
* transport opens arrive here. It is the transport's to close.
|
|
201
|
+
*/
|
|
202
|
+
readonly socket?: SocketLike | undefined;
|
|
157
203
|
}
|
|
158
204
|
declare const Transport_base: Context.ServiceClass<Transport, "foldkit-sync/Transport", TransportShape>;
|
|
159
205
|
/**
|
|
@@ -165,7 +211,7 @@ declare const Transport_base: Context.ServiceClass<Transport, "foldkit-sync/Tran
|
|
|
165
211
|
*/
|
|
166
212
|
export declare class Transport extends Transport_base {}
|
|
167
213
|
/** A transport backed by an in-process handler, for tests and single-process demos. */
|
|
168
|
-
export declare const layerLoopback: (handler: (cursor: number, pending: ReadonlyArray<Operation
|
|
214
|
+
export declare const layerLoopback: (handler: (cursor: number, pending: ReadonlyArray<Operation>, epoch?: string | undefined) => unknown | Promise<unknown>) => Layer.Layer<Transport>;
|
|
169
215
|
/** Wraps the promise-based client the replica already speaks. */
|
|
170
216
|
export declare const layerFromPromise: (transport: TransportClient) => Layer.Layer<Transport>;
|
|
171
217
|
/** Bridges the service back to the promise client the replica consumes. */
|
|
@@ -174,11 +220,15 @@ export declare const toPromise: (transport: TransportShape) => TransportClient;
|
|
|
174
220
|
* Serves one accepted socket, answering each exchange frame.
|
|
175
221
|
*
|
|
176
222
|
* The counterpart to `layerSocket`: the handler returns the exchange result, or
|
|
177
|
-
* throws and the failure is written back as an error frame.
|
|
178
|
-
*
|
|
223
|
+
* throws and the failure is written back as an error frame. With `changes`, a
|
|
224
|
+
* subscription to the document's commits, the socket is also sent a
|
|
225
|
+
* `NotifyFrame` after each, so a client hears of others' edits without polling.
|
|
226
|
+
* Returns a function that stops serving.
|
|
179
227
|
*/
|
|
180
228
|
export declare const serveSocket: (socket: SocketLike, options: {
|
|
181
|
-
readonly exchange: (cursor: number, pending: ReadonlyArray<Operation
|
|
229
|
+
readonly exchange: (cursor: number, pending: ReadonlyArray<Operation>, epoch?: string | undefined) => unknown | Promise<unknown>;
|
|
230
|
+
/** Subscribes to the document's commits; returns the unsubscribe. */
|
|
231
|
+
readonly changes?: ((listener: () => void) => () => void) | undefined;
|
|
182
232
|
}) => (() => void);
|
|
183
233
|
/** The minimal socket the layer needs; the global `WebSocket` satisfies it. */
|
|
184
234
|
interface SocketLike {
|
|
@@ -196,10 +246,16 @@ interface SocketOptions {
|
|
|
196
246
|
readonly url: string;
|
|
197
247
|
/** Injectable for tests; defaults to the platform `WebSocket`. */
|
|
198
248
|
readonly makeSocket?: ((url: string) => SocketLike) | undefined;
|
|
199
|
-
/**
|
|
249
|
+
/**
|
|
250
|
+
* Consecutive failed connections after which queued work fails and new
|
|
251
|
+
* exchanges fail fast until a connection is healthy again. Reconnecting goes
|
|
252
|
+
* on regardless. Default 5.
|
|
253
|
+
*/
|
|
200
254
|
readonly maxRetries?: number | undefined;
|
|
201
255
|
/** Base delay of the exponential reconnect backoff. Default `50 millis`. */
|
|
202
256
|
readonly retryBase?: Duration.Input | undefined;
|
|
257
|
+
/** Longest wait between reconnect attempts. Default `5 seconds`. */
|
|
258
|
+
readonly maxRetryDelay?: Duration.Input | undefined;
|
|
203
259
|
/** Exchanges queued or in flight before new ones fail. Default 64. */
|
|
204
260
|
readonly maxQueue?: number | undefined;
|
|
205
261
|
}
|
|
@@ -212,9 +268,14 @@ export declare const nativeSocket: (url: string) => SocketLike;
|
|
|
212
268
|
* it closes, the transport reconnects on an exponential, jittered backoff and
|
|
213
269
|
* re-sends every queued and in-flight frame with its original id, so a lost
|
|
214
270
|
* reply is answered rather than dropped and a late reply cannot resolve a newer
|
|
215
|
-
* frame.
|
|
216
|
-
* with a `TransportError
|
|
217
|
-
*
|
|
271
|
+
* frame. It never stops reconnecting: after `maxRetries` consecutive failures
|
|
272
|
+
* queued work fails with a `TransportError`, and exchanges fail fast while no
|
|
273
|
+
* socket is up, until a socket opens. The count resets only when a connection
|
|
274
|
+
* proves healthy, by answering a frame or by staying open for `maxRetryDelay`:
|
|
275
|
+
* a server that accepts a socket and drops it at once is backed off like one
|
|
276
|
+
* that refuses it. A queue over `maxQueue` fails new
|
|
277
|
+
* exchanges with backpressure. The socket is released when the layer's scope
|
|
278
|
+
* ends.
|
|
218
279
|
*/
|
|
219
280
|
export declare const layerSocket: (options: SocketOptions) => Layer.Layer<Transport, TransportError>;
|
|
220
281
|
//#endregion
|
|
@@ -268,6 +329,14 @@ interface Exchange<Shared> {
|
|
|
268
329
|
readonly acknowledged?: ReadonlyArray<OpId> | undefined;
|
|
269
330
|
/** The snapshot a replica predating compaction adopts in place of the log. */
|
|
270
331
|
readonly checkpoint?: Checkpoint<Shared> | undefined;
|
|
332
|
+
/** The server sent only part of what is after the cursor; the replica asks again. */
|
|
333
|
+
readonly more?: boolean | undefined;
|
|
334
|
+
/**
|
|
335
|
+
* The identity of the server's history. The replica sends back the one it last saw; a
|
|
336
|
+
* server that finds another answers from the start of its own history, and the replica,
|
|
337
|
+
* seeing a new epoch, rebuilds its committed state from that answer and keeps its outbox.
|
|
338
|
+
*/
|
|
339
|
+
readonly epoch?: string | undefined;
|
|
271
340
|
}
|
|
272
341
|
interface ReplicaState<Shared> {
|
|
273
342
|
readonly protocolVersion: typeof PROTOCOL_VERSION;
|
|
@@ -280,13 +349,16 @@ interface ReplicaState<Shared> {
|
|
|
280
349
|
readonly committed: Shared;
|
|
281
350
|
readonly committedIds: ReadonlyArray<string>;
|
|
282
351
|
readonly pending: ReadonlyArray<Operation>;
|
|
352
|
+
/** The server history `cursor` points into, once an exchange has named one. */
|
|
353
|
+
readonly epoch?: string;
|
|
283
354
|
}
|
|
284
355
|
/**
|
|
285
356
|
* What the promise-based edge adapter consumes; the Effect `Transport` service
|
|
286
357
|
* is the primary seam.
|
|
287
358
|
*/
|
|
288
359
|
interface TransportClient {
|
|
289
|
-
|
|
360
|
+
/** `epoch` is the server history the replica's cursor points into, when it knows one. */
|
|
361
|
+
exchange(cursor: Sequence, pending: ReadonlyArray<Operation>, epoch?: string | undefined): Promise<unknown>;
|
|
290
362
|
}
|
|
291
363
|
/** A redacted view of a replica's state, for a UI to explain and recover. */
|
|
292
364
|
interface ReplicaStatus {
|
|
@@ -342,10 +414,12 @@ interface Replica<Message, Shared> {
|
|
|
342
414
|
/** Reconciles against the server. The `Transport` service must be provided. */
|
|
343
415
|
readonly synchronize: Effect.Effect<void, ReplicaError | TransportError, Transport>;
|
|
344
416
|
/**
|
|
345
|
-
* The exchange loop: exchanges once, then after every `submit
|
|
346
|
-
*
|
|
347
|
-
*
|
|
348
|
-
*
|
|
417
|
+
* The exchange loop: exchanges once, then after every `submit` and every
|
|
418
|
+
* notice on the transport's `changes`, until the replica closes or the fiber
|
|
419
|
+
* is interrupted. A failed exchange is recorded
|
|
420
|
+
* in `status.lastError` and retried on a backoff (from 0.5 s, doubling up to
|
|
421
|
+
* 30 s), or at once on the next `submit`, so the fiber never fails. Fork it
|
|
422
|
+
* with `Effect.forkScoped` and provide `Transport`.
|
|
349
423
|
*/
|
|
350
424
|
readonly start: Effect.Effect<void, never, Transport>;
|
|
351
425
|
readonly close: Effect.Effect<void>;
|
|
@@ -357,9 +431,17 @@ interface SyncDefinition<Message, Shared, MessageEncoded, SharedEncoded> {
|
|
|
357
431
|
readonly empty: Shared;
|
|
358
432
|
readonly durable: (message: Message) => boolean;
|
|
359
433
|
readonly replay: (shared: Shared, message: Message) => Shared;
|
|
434
|
+
/**
|
|
435
|
+
* Optional. Merges a durable Message into the one submitted before it, while that one
|
|
436
|
+
* has not been sent: one operation instead of two, for a burst of typing. Replaying the
|
|
437
|
+
* result must equal replaying `last` then `next`. Undefined keeps them apart.
|
|
438
|
+
*/
|
|
439
|
+
readonly coalesce?: ((last: Message, next: Message) => Message | undefined) | undefined;
|
|
360
440
|
}
|
|
361
441
|
interface Sync$1<Message, Shared> {
|
|
362
442
|
readonly documentId: DocumentId;
|
|
443
|
+
/** Whether a Message is one the replica records and replays. */
|
|
444
|
+
readonly durable: (message: Message) => boolean;
|
|
363
445
|
/**
|
|
364
446
|
* Low-level wire codecs for adapters and the transport. Most applications use
|
|
365
447
|
* `journalContract` and `openReplica`; these are exposed for a custom
|
|
@@ -377,6 +459,10 @@ interface Sync$1<Message, Shared> {
|
|
|
377
459
|
}
|
|
378
460
|
/** Structural match for `foldkit-durable`'s journal options; Sync stays independent. */
|
|
379
461
|
interface JournalContract<Operation, Shared> {
|
|
462
|
+
/** The replica each operation came from, which Durable binds to its first committer. */
|
|
463
|
+
readonly replicaId: (operation: Operation) => string;
|
|
464
|
+
/** Sync's operation id includes the replica, even after Durable compacts its payload. */
|
|
465
|
+
readonly legacyReplicaId: (opId: string) => string;
|
|
380
466
|
readonly operation: {
|
|
381
467
|
/** Operations are stored in their encoded form, so this is the identity. */
|
|
382
468
|
readonly encode: (operation: Operation) => Operation;
|
|
@@ -445,6 +531,12 @@ interface BaseOptions<Principal, Fields extends Schema$1.Struct.Fields, Ms exten
|
|
|
445
531
|
readonly replay?: (shared: Schema$1.Struct.Type<NoInfer<Fields>>, message: MsgOf<NoInfer<Ms>>) => Schema$1.Struct.Type<NoInfer<Fields>>;
|
|
446
532
|
/** Authorization the server journal applies before committing; see `AuthorizePolicy`. */
|
|
447
533
|
readonly authorize?: AuthorizePolicy<Principal, NoInfer<Fields>, NoInfer<Ms>>;
|
|
534
|
+
/**
|
|
535
|
+
* Merges a durable Message into the one submitted before it while that one is unsent,
|
|
536
|
+
* so a burst of edits is one operation. Replaying the result must equal replaying
|
|
537
|
+
* `last` then `next`; undefined keeps them apart.
|
|
538
|
+
*/
|
|
539
|
+
readonly coalesce?: (last: MsgOf<NoInfer<Ms>>, next: MsgOf<NoInfer<Ms>>) => MsgOf<NoInfer<Ms>> | undefined;
|
|
448
540
|
}
|
|
449
541
|
interface MakeOptions<AppModel, Fields extends Schema$1.Struct.Fields, Subset, Ms extends readonly MessageConstructor<any>[], Principal = unknown> extends BaseOptions<Principal, Fields, Ms> {
|
|
450
542
|
/** The writable projection of the shared fields. */
|
|
@@ -531,6 +623,21 @@ interface ApplicationSync<AppModel, F extends Schema$1.Struct.Fields, Cases exte
|
|
|
531
623
|
export declare const forApplication: <AppModel, F extends Schema$1.Struct.Fields, Cases extends Record<string, Schema$1.Struct.Fields>>(app: RunnableApplication<AppModel, F, Cases, any>) => ApplicationSync<AppModel, F, Cases>;
|
|
532
624
|
//#endregion
|
|
533
625
|
//#region src/mount.d.ts
|
|
626
|
+
/**
|
|
627
|
+
* A Command that dispatches `message` as the next transition, which under `Sync.mount`
|
|
628
|
+
* means within this one: the mount applies it straight after the `update` that returned
|
|
629
|
+
* it, and persists it if it is durable, before any other Message is processed. This is
|
|
630
|
+
* how a local intent turns into a durable fact that needs something only the intent's
|
|
631
|
+
* transition knows, such as an id minted from local state, without a later Message
|
|
632
|
+
* seeing the Model before the fact. Elsewhere, or once a parent has mapped the Command,
|
|
633
|
+
* it is an ordinary Command that yields `message`, and so is one a durable Message's
|
|
634
|
+
* update returns: replay would not apply it, and with derived replay the durable Message's
|
|
635
|
+
* persist fails with `ReplayError` as for any Command.
|
|
636
|
+
*/
|
|
637
|
+
export declare const fact: <Message>(message: Message) => {
|
|
638
|
+
readonly name: string;
|
|
639
|
+
readonly effect: Effect.Effect<Message>;
|
|
640
|
+
};
|
|
534
641
|
/**
|
|
535
642
|
* The URL as part of the application: `onUrlChange` names the Message the
|
|
536
643
|
* runtime sends for the current URL at start and on every navigation (so a
|
|
@@ -559,6 +666,15 @@ interface MountOptions<Model, Message, Shared, Resources> {
|
|
|
559
666
|
* has been reverted. Omitted, the edit is reverted silently.
|
|
560
667
|
*/
|
|
561
668
|
readonly onPersistenceFailure?: ((model: Model, error: ReplicaError) => Model) | undefined;
|
|
669
|
+
/**
|
|
670
|
+
* Runs when the mount replaces the shared slice outside `update`: an exchange committed,
|
|
671
|
+
* acknowledged or rejected something, or a persist failed and its edit was reverted.
|
|
672
|
+
* `previous` is the Model before; what it returns is the transition, so an application
|
|
673
|
+
* can carry local state across the change (a selection held by what it points at) or
|
|
674
|
+
* return Commands (a DOM the change has to reach). Omitted, the Model is `next`. It is
|
|
675
|
+
* not called for a status that changes nothing the Model shows, such as the first.
|
|
676
|
+
*/
|
|
677
|
+
readonly onReinstall?: ((next: Model, previous: Model) => Update.Return<Model, Message, Resources>) | undefined;
|
|
562
678
|
}
|
|
563
679
|
/**
|
|
564
680
|
* The shared slice as the server has confirmed it, outside the Model. It is a
|
|
@@ -625,6 +741,12 @@ interface PresenceOptions<Update> {
|
|
|
625
741
|
*/
|
|
626
742
|
readonly decodeValue: (value: unknown) => Update;
|
|
627
743
|
readonly channel?: PresenceChannel<Update> | undefined;
|
|
744
|
+
/**
|
|
745
|
+
* The least time between two values sent on the channel. `set` still takes effect here at
|
|
746
|
+
* once; a value set sooner waits, and only the latest one waiting is sent when the time is
|
|
747
|
+
* up. A departure is never held back. Absent, every `set` is sent at once.
|
|
748
|
+
*/
|
|
749
|
+
readonly throttle?: Duration.Input | undefined;
|
|
628
750
|
}
|
|
629
751
|
interface PresencePeer<Update> {
|
|
630
752
|
readonly id: string;
|
|
@@ -632,7 +754,7 @@ interface PresencePeer<Update> {
|
|
|
632
754
|
readonly updatedAt: number;
|
|
633
755
|
}
|
|
634
756
|
interface Presence<Update> {
|
|
635
|
-
/** Sets this peer's value and broadcasts it. */
|
|
757
|
+
/** Sets this peer's value and broadcasts it, no sooner than `throttle` allows. */
|
|
636
758
|
readonly set: (value: Update) => Effect.Effect<void>;
|
|
637
759
|
/** Removes this peer and broadcasts the departure. */
|
|
638
760
|
readonly leave: Effect.Effect<void>;
|
|
@@ -786,6 +908,11 @@ export declare const Sync: {
|
|
|
786
908
|
define: <Message, Shared, MessageEncoded, SharedEncoded>(definition: SyncDefinition<Message, Shared, MessageEncoded, SharedEncoded>) => Sync$1<Message, Shared>;
|
|
787
909
|
/** Runs a Foldkit application over an open replica with one reducer. */
|
|
788
910
|
mount: <Model, F extends import("effect/Schema").Struct.Fields, Cases extends Record<string, import("effect/Schema").Struct.Fields>, Fields extends import("effect/Schema").Struct.Fields, Ms extends readonly unknown[], Resources = never, Principal = unknown>(app: import("foldkit-surface").RunnableApplication<Model, F, Cases, Resources>, sync: DefinedSync<Model, Fields, import("effect/Schema").Schema.Type<import("foldkit/message").MessageUnion<Cases>>, Ms, Principal>, options: MountOptions<Model, import("effect/Schema").Schema.Type<import("foldkit/message").MessageUnion<Cases>>, import("effect/Schema").Struct.Type<Fields>, Resources>) => Mounted<Model, import("effect/Schema").Schema.Type<import("foldkit/message").MessageUnion<Cases>>, import("effect/Schema").Struct.Type<Fields>>;
|
|
911
|
+
/** A Command whose Message the mount applies within the transition that returned it. */
|
|
912
|
+
fact: <Message>(message: Message) => {
|
|
913
|
+
readonly name: string;
|
|
914
|
+
readonly effect: import("effect/Effect").Effect<Message>;
|
|
915
|
+
};
|
|
789
916
|
/** Counters and a histogram an application can scrape. */
|
|
790
917
|
metrics: {
|
|
791
918
|
exchanges: import("effect/Metric").Counter<number>;
|
|
@@ -794,20 +921,21 @@ export declare const Sync: {
|
|
|
794
921
|
exchangePending: import("effect/Metric").Histogram<number>;
|
|
795
922
|
};
|
|
796
923
|
/** The only storage adapter: one IndexedDB database per document/replica. */
|
|
797
|
-
indexedDb: (name: string | import("effect/Config").Config<string>, factory?: IDBFactory | undefined) => import("effect/Effect").Effect<Storage
|
|
924
|
+
indexedDb: (name: string | import("effect/Config").Config<string>, factory?: IDBFactory | undefined) => import("effect/Effect").Effect<Required<Storage>, StorageError, import("effect/Scope").Scope>;
|
|
798
925
|
/** The `Transport` service's layers, and the bridges to and from a promise client. */
|
|
799
926
|
transport: {
|
|
800
927
|
/** A reconnecting WebSocket client layer. */
|
|
801
928
|
socket: (options: SocketOptions) => import("effect/Layer").Layer<Transport, TransportError>;
|
|
802
929
|
/** An in-process layer, for tests and single-process demos. */
|
|
803
|
-
loopback: (handler: (cursor: number, pending: ReadonlyArray<Operation
|
|
930
|
+
loopback: (handler: (cursor: number, pending: ReadonlyArray<Operation>, epoch?: string | undefined) => unknown | Promise<unknown>) => import("effect/Layer").Layer<Transport>;
|
|
804
931
|
/** Wraps the promise-based client the replica already speaks. */
|
|
805
932
|
fromPromise: (transport: TransportClient) => import("effect/Layer").Layer<Transport>;
|
|
806
933
|
/** Bridges the service back to that promise client. */
|
|
807
934
|
toPromise: (transport: TransportShape) => TransportClient;
|
|
808
935
|
/** The server side of one accepted socket connection. */
|
|
809
936
|
serve: (socket: SocketLike, options: {
|
|
810
|
-
readonly exchange: (cursor: number, pending: ReadonlyArray<Operation
|
|
937
|
+
readonly exchange: (cursor: number, pending: ReadonlyArray<Operation>, epoch?: string | undefined) => unknown | Promise<unknown>;
|
|
938
|
+
readonly changes?: ((listener: () => void) => () => void) | undefined;
|
|
811
939
|
}) => (() => void);
|
|
812
940
|
/** The default socket factory: the platform `WebSocket`. */
|
|
813
941
|
nativeSocket: (url: string) => SocketLike;
|
|
@@ -888,5 +1016,5 @@ export declare const Sync: {
|
|
|
888
1016
|
};
|
|
889
1017
|
};
|
|
890
1018
|
//#endregion
|
|
891
|
-
export type { ApplicationSync, AuthorizePolicy, AuthorizeRequest, Checkpoint, CommittedOperation, CommittedView, DefinedSync, Exchange, ExchangeFrame, ExchangeReply, FragmentMessages, JournalContract, LwwClock, LwwClockState, MakeOptions, MountOptions, MountUrl, Mounted, MsgOf, Operation, PolicyJournalContract, Presence, PresenceChannel, PresenceHub, PresenceOptions, PresencePeer, PresenceUpdate, Replica, ReplicaError, ReplicaSnapshot, ReplicaState, ReplicaStatus, SocketLike, SocketOptions, Storage, SyncDefinition, SyncFragment, TransportClient, TransportShape };
|
|
1019
|
+
export type { ApplicationSync, AuthorizePolicy, AuthorizeRequest, Checkpoint, CommittedOperation, CommittedView, DefinedSync, Exchange, ExchangeFrame, ExchangeReply, FragmentMessages, JournalContract, LwwClock, LwwClockState, MakeOptions, MountOptions, MountUrl, Mounted, MsgOf, NotifyFrame, Operation, OutboxEntry, PolicyJournalContract, Presence, PresenceChannel, PresenceHub, PresenceOptions, PresencePeer, PresenceUpdate, Replica, ReplicaError, ReplicaSnapshot, ReplicaState, ReplicaStatus, SocketLike, SocketOptions, Storage, SyncDefinition, SyncFragment, TransportClient, TransportShape };
|
|
892
1020
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/ids.ts","../src/errors.ts","../src/indexedDb.ts","../src/transport.ts","../src/sync.ts","../src/make.ts","../src/mount.ts","../src/presence.ts","../src/lww.ts","../src/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/ids.ts","../src/errors.ts","../src/indexedDb.ts","../src/transport.ts","../src/sync.ts","../src/make.ts","../src/mount.ts","../src/presence.ts","../src/lww.ts","../src/index.ts"],"mappings":";;;;;;;;;qBAGa,YAAU,SAAA,MAAA,SAAA;YACX,oBAAoB,WAAW;;qBAG9B,WAAS,SAAA,MAAA,SAAA;YACV,mBAAmB,UAAU;;qBAG5B,MAAI,SAAA,MAAA,SAAA;YACL,cAAc,KAAK;;;;;qBAMlB,UAAQ,SAAA,MAAA,SAAA;YAKT,kBAAkB,SAAS;;qBAG1B,eAAa,SAAA,MAAA,SAAA;YAKd,uBAAuB,cAAc;;;;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