@loro-dev/streams-crdt 0.15.1 → 0.16.1
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 +11 -8
- package/dist/flock.d.ts +1 -1
- package/dist/flock.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/loro.d.ts +9 -11
- package/dist/loro.js +43 -3
- package/dist/loro.js.map +1 -1
- package/dist/{stream-id-BygPTNvQ.js → stream-id-BERJQKYV.js} +278 -94
- package/dist/stream-id-BERJQKYV.js.map +1 -0
- package/dist/{stream-id-CVCOLgSp.d.ts → stream-id-DEOH5LmQ.d.ts} +42 -3
- package/package.json +2 -2
- package/dist/stream-id-BygPTNvQ.js.map +0 -1
|
@@ -470,7 +470,7 @@ interface StreamsCrdtShardUrlsOptions {
|
|
|
470
470
|
* Origin URLs used for `GET <stream>/bootstrap`.
|
|
471
471
|
*
|
|
472
472
|
* Each entry should be an origin URL such as
|
|
473
|
-
* `https://control-a.
|
|
473
|
+
* `https://control-a.streams.example.com`. The transport keeps the
|
|
474
474
|
* stream path and query from `streamUrl` and only replaces the request origin.
|
|
475
475
|
* If omitted, `other` is used as the fallback pool for bootstrap requests.
|
|
476
476
|
*/
|
|
@@ -532,6 +532,13 @@ interface PayloadProtectionContext {
|
|
|
532
532
|
readonly protocol: "loro-streams-crdt-payload-protection";
|
|
533
533
|
readonly version: 2;
|
|
534
534
|
readonly kind: PayloadProtectionKind;
|
|
535
|
+
/**
|
|
536
|
+
* Opaque Durable Streams continuation offset for `kind: "snapshot"`.
|
|
537
|
+
* Absent for `update_batch`. streams-crdt does not parse the token, bind
|
|
538
|
+
* bucket/Org/role, or treat it as a timestamp. Providers that authenticate
|
|
539
|
+
* snapshot position MUST bind this exact string.
|
|
540
|
+
*/
|
|
541
|
+
readonly continuationOffset?: string;
|
|
535
542
|
}
|
|
536
543
|
interface PayloadProtectionSealInput {
|
|
537
544
|
readonly plaintext: Uint8Array;
|
|
@@ -719,6 +726,15 @@ interface EphemeralStreamAdaptor {
|
|
|
719
726
|
applyRemoteUpdates(updates: readonly Uint8Array[]): MaybePromise<void>;
|
|
720
727
|
/** Subscribes to local ephemeral updates. Returns an unsubscribe function. */
|
|
721
728
|
subscribeLocalUpdates(listener: (update: Uint8Array) => void): () => void;
|
|
729
|
+
/**
|
|
730
|
+
* Optional. Returns the single key a local update writes (set or delete),
|
|
731
|
+
* or `undefined` when it writes several keys or the key is unknown. The
|
|
732
|
+
* write queue then drops a queued, not yet sent update once a newer update
|
|
733
|
+
* for the same key is queued, so a burst on one key cannot delay others.
|
|
734
|
+
* Only return a key when a newer update for it fully replaces the older
|
|
735
|
+
* one for every receiver. Bodies are still sent exactly as emitted.
|
|
736
|
+
*/
|
|
737
|
+
localUpdateKey?(update: Uint8Array): string | undefined;
|
|
722
738
|
}
|
|
723
739
|
interface EphemeralStreamJoinParams {
|
|
724
740
|
/** Called when the live ephemeral subscription status changes. */
|
|
@@ -1129,7 +1145,10 @@ declare class StreamsCrdt<TVersion extends JsonObject> implements StreamsCrdtLik
|
|
|
1129
1145
|
*/
|
|
1130
1146
|
private salvageLocalBacklogOnIncompleteInitialSync;
|
|
1131
1147
|
private syncOnce;
|
|
1148
|
+
/** Caller owns opQueue; never wait for the background flush from here. */
|
|
1149
|
+
private syncOnceExclusive;
|
|
1132
1150
|
private performInitialJoinSync;
|
|
1151
|
+
private performInitialJoinSyncExclusive;
|
|
1133
1152
|
private createInitialCursor;
|
|
1134
1153
|
private resolveInitialRemoteState;
|
|
1135
1154
|
private resolvePullOnlyRemoteState;
|
|
@@ -1229,6 +1248,12 @@ declare class StreamsCrdt<TVersion extends JsonObject> implements StreamsCrdtLik
|
|
|
1229
1248
|
private drainQueuedBatch;
|
|
1230
1249
|
private drainPendingBatch;
|
|
1231
1250
|
private drainPendingWriteOnlyBatch;
|
|
1251
|
+
/**
|
|
1252
|
+
* One FIFO transaction, called only while holding opQueue. Selecting the
|
|
1253
|
+
* head and committing its ACK/count must share the lock: sync may drain
|
|
1254
|
+
* the queue while a background writer is queued or sleeping between retries.
|
|
1255
|
+
*/
|
|
1256
|
+
private flushPendingLocalBatchExclusive;
|
|
1232
1257
|
/**
|
|
1233
1258
|
* Drains `pendingLocal` to the server in strict FIFO order.
|
|
1234
1259
|
*
|
|
@@ -1331,7 +1356,21 @@ declare class EphemeralStreamCrdt {
|
|
|
1331
1356
|
private runReadLoop;
|
|
1332
1357
|
private enqueueLocal;
|
|
1333
1358
|
private flushPendingLocal;
|
|
1334
|
-
private
|
|
1359
|
+
private localUpdateKey;
|
|
1360
|
+
/**
|
|
1361
|
+
* Pops superseded entries off the head and returns the next entry to send,
|
|
1362
|
+
* marking it in-flight so later same-key updates queue behind it.
|
|
1363
|
+
*/
|
|
1364
|
+
private nextPendingLocal;
|
|
1365
|
+
/** Drops superseded markers once they dominate the queue (amortized O(1)). */
|
|
1366
|
+
private maybeRebuildPendingLocal;
|
|
1367
|
+
/**
|
|
1368
|
+
* Completes waiters that tracked `chainId`. Each chain is acknowledged
|
|
1369
|
+
* exactly once (its entry is never superseded after it goes in flight), so
|
|
1370
|
+
* a waiter resolves only after every chain live at call time has had its
|
|
1371
|
+
* latest value acknowledged.
|
|
1372
|
+
*/
|
|
1373
|
+
private notifyChainAcknowledged;
|
|
1335
1374
|
private rejectSyncWaiters;
|
|
1336
1375
|
private setReadStatus;
|
|
1337
1376
|
private setWriteStatus;
|
|
@@ -1365,4 +1404,4 @@ declare class PayloadProtectionError extends Error {
|
|
|
1365
1404
|
declare function isValidRillId(id: string): boolean;
|
|
1366
1405
|
//#endregion
|
|
1367
1406
|
export { WriteOnlyAppendResult as $, PayloadProtectionProviderConfig as A, StreamsAuthProvider as B, LocalSyncStats as C, PayloadProtectionOpenInput as D, PayloadProtectionKind as E, Result as F, TransportCreateStreamSuccess as G, StreamsCrdtShardUrlsOptions as H, SnapshotCodec as I, TransportJoinParams as J, TransportDeleteStreamSuccess as K, SnapshotTransformHook as L, PayloadProtectionSealInput as M, PayloadProtectionSealResult as N, PayloadProtectionOptions as O, PayloadProtectionWritePolicy as P, TransportSyncSuccess as Q, SnapshotUploadOptions as R, JsonValue as S, PayloadProtectionFailureReason as T, TransportCatchupParams as U, StreamsCrdtOptions as V, TransportCatchupSuccess as W, TransportSnapshotUploadSuccess as X, TransportRoomStatus as Y, TransportSubscription as Z, EphemeralStreamCrdtOptions as _, StreamsCrdt as a, RemoteCursor as at, IsolatedCrdtAdapter as b, CrdtApplyReturn as c, createInitialRemoteCursor as ct, E2eeOptions as d, BeforeRemoteCursorSaveContext as et, E2eeProvider as f, EphemeralStreamAdaptor as g, E2eeWritePolicy as h, EphemeralStreamCrdt as i, IndexedDbRemoteCursorStoreOptions as it, PayloadProtectionReadPolicy as j, PayloadProtectionProvider as k, CrdtUnresolvedSpan as l, E2eeReadPolicy as m, PayloadProtectionError as n, InMemoryRemoteCursorStore as nt, CrdtAdapter as o, RemoteCursorSaveSource as ot, E2eeProviderConfig as p, TransportError as q, LocalAppendFailedError as r, IndexedDbRemoteCursorStore as rt, CrdtApplyOutcome as s, RemoteCursorStore as st, isValidRillId as t, BeforeRemoteCursorSaveHook as tt, CrdtUpdateBatch as u, EphemeralStreamJoinParams as v, PayloadProtectionContext as w, JsonObject as x, EphemeralStreamSubscription as y, StreamsAuthContext as z };
|
|
1368
|
-
//# sourceMappingURL=stream-id-
|
|
1407
|
+
//# sourceMappingURL=stream-id-DEOH5LmQ.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loro-dev/streams-crdt",
|
|
3
3
|
"description": "Transport/runtime layer for synchronizing CRDT state over Durable Streams.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.16.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Loro Team",
|
|
7
7
|
"homepage": "https://streams.loro.dev",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@loro-dev/streams-client": "0.
|
|
53
|
+
"@loro-dev/streams-client": "0.8.0"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"@loro-dev/flock-wasm": "^0.4.0",
|