@loro-dev/streams-crdt 0.15.0 → 0.15.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.
@@ -1099,6 +1099,35 @@ declare class StreamsCrdt<TVersion extends JsonObject> implements StreamsCrdtLik
1099
1099
  private disposeJoinState;
1100
1100
  private runInitialSyncWithDeadline;
1101
1101
  private startJoin;
1102
+ /**
1103
+ * Join-time salvage for a stream whose head cannot be fully applied
1104
+ * (apply_incomplete at `up_to_date`, even after bootstrap): before the
1105
+ * join surfaces the error, durably append everything this replica holds
1106
+ * that the server does not.
1107
+ *
1108
+ * Why this exists: the dual-author wedge is usually two-sided — the stream
1109
+ * is missing some author's ops, and a replica that HOLDS those ops (e.g.
1110
+ * received out-of-band over a local data plane) may itself be unable to
1111
+ * complete the join because of a second gap. The regular join-time export
1112
+ * runs only AFTER a successful initial sync, so without this salvage such
1113
+ * a replica can never publish the healing ops, and its own backlog from a
1114
+ * previous process run stays local for as long as the stream stays
1115
+ * poisoned.
1116
+ *
1117
+ * `error.appliedVersion` advances only from success spans, so
1118
+ * `exportUpdates(appliedVersion)` is exactly "ops this replica holds that
1119
+ * the server does not" — the failed initial sync already imported
1120
+ * everything the server DOES have, so the delta cannot re-append
1121
+ * server-known data. Cursor safety is untouched: the append is write-only
1122
+ * style (producer-acked, no read catch-up, no durable-cursor save), and
1123
+ * the retried initial sync re-derives its cursor from the server.
1124
+ *
1125
+ * Returns `true` when anything was durably appended; the caller then
1126
+ * retries the initial sync once. Best-effort: a salvage failure logs and
1127
+ * returns `false` so the original apply-incomplete error is what callers
1128
+ * observe.
1129
+ */
1130
+ private salvageLocalBacklogOnIncompleteInitialSync;
1102
1131
  private syncOnce;
1103
1132
  private performInitialJoinSync;
1104
1133
  private createInitialCursor;
@@ -1213,6 +1242,12 @@ declare class StreamsCrdt<TVersion extends JsonObject> implements StreamsCrdtLik
1213
1242
  * `"error"` write status (with `lastWriteError` set) and then retries via
1214
1243
  * this flush's own backoff timer (`maybeScheduleWriteRetry`) — it does not
1215
1244
  * depend on a future local op to re-trigger the flush.
1245
+ *
1246
+ * While the cursor is incomplete (unresolved remote spans), the flush
1247
+ * degrades to an append-only mode instead of pausing: batches still reach
1248
+ * the server, but read progress, durable-cursor saves, and snapshot
1249
+ * scheduling stay untouched. See the inline comment in the incomplete
1250
+ * branch and specs/loro-pending.md "Local Append Rules".
1216
1251
  */
1217
1252
  private flushPendingLocal;
1218
1253
  /**
@@ -1330,4 +1365,4 @@ declare class PayloadProtectionError extends Error {
1330
1365
  declare function isValidRillId(id: string): boolean;
1331
1366
  //#endregion
1332
1367
  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 };
1333
- //# sourceMappingURL=stream-id-CO65-58E.d.ts.map
1368
+ //# sourceMappingURL=stream-id-CVCOLgSp.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.15.0",
4
+ "version": "0.15.1",
5
5
  "license": "MIT",
6
6
  "author": "Loro Team",
7
7
  "homepage": "https://streams.loro.dev",