@loro-dev/streams-crdt 0.16.1 → 0.16.2
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 +24 -4
- package/dist/flock.d.ts +2 -2
- package/dist/flock.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/loro.d.ts +2 -2
- package/dist/loro.js +1 -1
- package/dist/{stream-id-DEOH5LmQ.d.ts → shared-C5Dyx541.d.ts} +26 -10
- package/dist/{stream-id-BERJQKYV.js → stream-id-Dlnc1PNH.js} +294 -74
- package/dist/stream-id-Dlnc1PNH.js.map +1 -0
- package/package.json +2 -2
- package/dist/stream-id-BERJQKYV.js.map +0 -1
package/README.md
CHANGED
|
@@ -81,15 +81,35 @@ if (!result.ok && result.error.retryable) {
|
|
|
81
81
|
|
|
82
82
|
#### Surfacing errors to end users
|
|
83
83
|
|
|
84
|
+
For wrappers such as Loro Repo and diagnostic sinks, forward `error.context`,
|
|
85
|
+
`error.code` and the explicit `error.retryable`. `TransportErrorContext` is an
|
|
86
|
+
additive optional safe projection: source, CRDT operation, failing stage,
|
|
87
|
+
original client discriminator, request operation and available timeout budget,
|
|
88
|
+
elapsed duration, HTTP status, bounded request ID and allowlisted network code.
|
|
89
|
+
Do not forward the whole error as a diagnostic object: legacy message, body,
|
|
90
|
+
cause, headers and URL metadata may contain application secrets.
|
|
91
|
+
|
|
92
|
+
Source/stage are recorded at the actual fetch, cursor load/save, durability
|
|
93
|
+
hook, CRDT apply/export and payload encode/decode boundaries. Local TypeError is
|
|
94
|
+
`internal_error` with `retryable: false`; fetch-thrown ordinary Error is
|
|
95
|
+
`network_error`. This identifies the observed boundary, not the root cause of
|
|
96
|
+
a bug inside custom fetch. Unobserved provenance is explicitly `unknown`.
|
|
97
|
+
Initial-sync hard deadlines retain `initial_sync_timeout`, their own budget and
|
|
98
|
+
`source: "deadline"`. See the implemented
|
|
99
|
+
[safe error contract](../../specs/streams-error-context.md) for exact semantics,
|
|
100
|
+
security bounds and the Loro Repo integration still required downstream.
|
|
101
|
+
|
|
84
102
|
HTTP-derived variants (`server_error`, `auth_failed`, `protocol_error`,
|
|
85
|
-
`stream_not_found`, `gone`)
|
|
86
|
-
|
|
103
|
+
`stream_not_found`, `gone`) retain legacy response details. Prefer numeric status
|
|
104
|
+
and the safe correlation ID for UI/diagnostics; response bodies and arbitrary
|
|
105
|
+
messages need application-specific handling:
|
|
87
106
|
|
|
88
107
|
```ts
|
|
89
108
|
const err = result.error;
|
|
90
109
|
if (err.code === "server_error") {
|
|
91
|
-
|
|
92
|
-
|
|
110
|
+
const requestId = err.context?.requestId;
|
|
111
|
+
toast.error(`Server error ${err.status}${requestId ? ` (req: ${requestId})` : ""}`);
|
|
112
|
+
console.error("Streams failure:", err.context);
|
|
93
113
|
// err.retryAfterMs may suggest a backoff if the server set Retry-After.
|
|
94
114
|
}
|
|
95
115
|
```
|
package/dist/flock.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as TransportStage, A as PayloadProtectionProviderConfig, B as StreamsAuthProvider, C as LocalSyncStats, D as PayloadProtectionOpenInput, E as PayloadProtectionKind, F as Result, G as TransportCreateStreamSuccess, H as StreamsCrdtShardUrlsOptions, I as SnapshotCodec, J as TransportErrorContext, K as TransportDeleteStreamSuccess, L as SnapshotTransformHook, M as PayloadProtectionSealInput, N as PayloadProtectionSealResult, O as PayloadProtectionOptions, P as PayloadProtectionWritePolicy, Q as TransportSnapshotUploadSuccess, R as SnapshotUploadOptions, S as JsonValue, T as PayloadProtectionFailureReason, U as TransportCatchupParams, V as StreamsCrdtOptions, W as TransportCatchupSuccess, X as TransportOperation, Y as TransportJoinParams, Z as TransportRoomStatus, _ as EphemeralStreamCrdtOptions, a as StreamsCrdt, at as InMemoryRemoteCursorStore, b as IsolatedCrdtAdapter, c as CrdtApplyReturn, ct as RemoteCursor, d as E2eeOptions, dt as createInitialRemoteCursor, et as TransportSubscription, f as E2eeProvider, g as EphemeralStreamAdaptor, h as E2eeWritePolicy, i as EphemeralStreamCrdt, it as BeforeRemoteCursorSaveHook, j as PayloadProtectionReadPolicy, k as PayloadProtectionProvider, l as CrdtUnresolvedSpan, lt as RemoteCursorSaveSource, m as E2eeReadPolicy, n as PayloadProtectionError, nt as WriteOnlyAppendResult, o as CrdtAdapter, ot as IndexedDbRemoteCursorStore, p as E2eeProviderConfig, q as TransportError, r as LocalAppendFailedError, rt as BeforeRemoteCursorSaveContext, s as CrdtApplyOutcome, st as IndexedDbRemoteCursorStoreOptions, t as isValidRillId, tt as TransportSyncSuccess, u as CrdtUpdateBatch, ut as RemoteCursorStore, v as EphemeralStreamJoinParams, w as PayloadProtectionContext, x as JsonObject, y as EphemeralStreamSubscription, z as StreamsAuthContext } from "./shared-C5Dyx541.js";
|
|
2
2
|
import { ExportBundle, Flock, VersionVector, VersionVector as VersionVector$1 } from "@loro-dev/flock-wasm";
|
|
3
3
|
|
|
4
4
|
//#region src/flock.d.ts
|
|
@@ -7,5 +7,5 @@ import { ExportBundle, Flock, VersionVector, VersionVector as VersionVector$1 }
|
|
|
7
7
|
*/
|
|
8
8
|
declare function createFlockAdapter(flock: Flock): CrdtAdapter<VersionVector$1>;
|
|
9
9
|
//#endregion
|
|
10
|
-
export { BeforeRemoteCursorSaveContext, BeforeRemoteCursorSaveHook, CrdtAdapter, CrdtApplyOutcome, CrdtApplyReturn, CrdtUnresolvedSpan, CrdtUpdateBatch, PayloadProtectionError as E2eeError, PayloadProtectionError, E2eeOptions, E2eeProvider, E2eeProviderConfig, E2eeReadPolicy, E2eeWritePolicy, EphemeralStreamAdaptor, EphemeralStreamCrdt, EphemeralStreamCrdtOptions, EphemeralStreamJoinParams, EphemeralStreamSubscription, type ExportBundle, InMemoryRemoteCursorStore, IndexedDbRemoteCursorStore, IndexedDbRemoteCursorStoreOptions, IsolatedCrdtAdapter, JsonObject, JsonValue, LocalAppendFailedError, LocalSyncStats, PayloadProtectionContext, PayloadProtectionFailureReason, PayloadProtectionKind, PayloadProtectionOpenInput, PayloadProtectionOptions, PayloadProtectionProvider, PayloadProtectionProviderConfig, PayloadProtectionReadPolicy, PayloadProtectionSealInput, PayloadProtectionSealResult, PayloadProtectionWritePolicy, RemoteCursor, RemoteCursorSaveSource, RemoteCursorStore, Result, SnapshotCodec, SnapshotTransformHook, SnapshotUploadOptions, StreamsAuthContext, StreamsAuthProvider, StreamsCrdt, StreamsCrdtOptions, StreamsCrdtShardUrlsOptions, TransportCatchupParams, TransportCatchupSuccess, TransportCreateStreamSuccess, TransportDeleteStreamSuccess, TransportError, TransportJoinParams, TransportRoomStatus, TransportSnapshotUploadSuccess, TransportSubscription, TransportSyncSuccess, type VersionVector, WriteOnlyAppendResult, createFlockAdapter, createInitialRemoteCursor, isValidRillId };
|
|
10
|
+
export { BeforeRemoteCursorSaveContext, BeforeRemoteCursorSaveHook, CrdtAdapter, CrdtApplyOutcome, CrdtApplyReturn, CrdtUnresolvedSpan, CrdtUpdateBatch, PayloadProtectionError as E2eeError, PayloadProtectionError, E2eeOptions, E2eeProvider, E2eeProviderConfig, E2eeReadPolicy, E2eeWritePolicy, EphemeralStreamAdaptor, EphemeralStreamCrdt, EphemeralStreamCrdtOptions, EphemeralStreamJoinParams, EphemeralStreamSubscription, type ExportBundle, InMemoryRemoteCursorStore, IndexedDbRemoteCursorStore, IndexedDbRemoteCursorStoreOptions, IsolatedCrdtAdapter, JsonObject, JsonValue, LocalAppendFailedError, LocalSyncStats, PayloadProtectionContext, PayloadProtectionFailureReason, PayloadProtectionKind, PayloadProtectionOpenInput, PayloadProtectionOptions, PayloadProtectionProvider, PayloadProtectionProviderConfig, PayloadProtectionReadPolicy, PayloadProtectionSealInput, PayloadProtectionSealResult, PayloadProtectionWritePolicy, RemoteCursor, RemoteCursorSaveSource, RemoteCursorStore, Result, SnapshotCodec, SnapshotTransformHook, SnapshotUploadOptions, StreamsAuthContext, StreamsAuthProvider, StreamsCrdt, StreamsCrdtOptions, StreamsCrdtShardUrlsOptions, TransportCatchupParams, TransportCatchupSuccess, TransportCreateStreamSuccess, TransportDeleteStreamSuccess, TransportError, TransportErrorContext, TransportJoinParams, TransportOperation, TransportRoomStatus, TransportSnapshotUploadSuccess, TransportStage, TransportSubscription, TransportSyncSuccess, type VersionVector, WriteOnlyAppendResult, createFlockAdapter, createInitialRemoteCursor, isValidRillId };
|
|
11
11
|
//# sourceMappingURL=flock.d.ts.map
|
package/dist/flock.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as createInitialRemoteCursor, c as PayloadProtectionError, i as IndexedDbRemoteCursorStore, n as StreamsCrdt, o as EphemeralStreamCrdt, r as InMemoryRemoteCursorStore, s as LocalAppendFailedError, t as isValidRillId } from "./stream-id-
|
|
1
|
+
import { a as createInitialRemoteCursor, c as PayloadProtectionError, i as IndexedDbRemoteCursorStore, n as StreamsCrdt, o as EphemeralStreamCrdt, r as InMemoryRemoteCursorStore, s as LocalAppendFailedError, t as isValidRillId } from "./stream-id-Dlnc1PNH.js";
|
|
2
2
|
import { Flock } from "@loro-dev/flock-wasm";
|
|
3
3
|
//#region src/flock.ts
|
|
4
4
|
function isAfter(entry, current) {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
export { BeforeRemoteCursorSaveContext, BeforeRemoteCursorSaveHook, CrdtAdapter, CrdtApplyOutcome, CrdtApplyReturn, CrdtUnresolvedSpan, CrdtUpdateBatch, PayloadProtectionError as E2eeError, PayloadProtectionError, E2eeOptions, E2eeProvider, E2eeProviderConfig, E2eeReadPolicy, E2eeWritePolicy, EphemeralStreamAdaptor, EphemeralStreamCrdt, EphemeralStreamCrdtOptions, EphemeralStreamJoinParams, EphemeralStreamSubscription, InMemoryRemoteCursorStore, IndexedDbRemoteCursorStore, IndexedDbRemoteCursorStoreOptions, IsolatedCrdtAdapter, JsonObject, JsonValue, LocalAppendFailedError, LocalSyncStats, PayloadProtectionContext, PayloadProtectionFailureReason, PayloadProtectionKind, PayloadProtectionOpenInput, PayloadProtectionOptions, PayloadProtectionProvider, PayloadProtectionProviderConfig, PayloadProtectionReadPolicy, PayloadProtectionSealInput, PayloadProtectionSealResult, PayloadProtectionWritePolicy, RemoteCursor, RemoteCursorSaveSource, RemoteCursorStore, Result, SnapshotCodec, SnapshotTransformHook, SnapshotUploadOptions, StreamsAuthContext, StreamsAuthProvider, StreamsCrdt, StreamsCrdtOptions, StreamsCrdtShardUrlsOptions, TransportCatchupParams, TransportCatchupSuccess, TransportCreateStreamSuccess, TransportDeleteStreamSuccess, TransportError, TransportJoinParams, TransportRoomStatus, TransportSnapshotUploadSuccess, TransportSubscription, TransportSyncSuccess, WriteOnlyAppendResult, createInitialRemoteCursor, isValidRillId };
|
|
1
|
+
import { $ as TransportStage, A as PayloadProtectionProviderConfig, B as StreamsAuthProvider, C as LocalSyncStats, D as PayloadProtectionOpenInput, E as PayloadProtectionKind, F as Result, G as TransportCreateStreamSuccess, H as StreamsCrdtShardUrlsOptions, I as SnapshotCodec, J as TransportErrorContext, K as TransportDeleteStreamSuccess, L as SnapshotTransformHook, M as PayloadProtectionSealInput, N as PayloadProtectionSealResult, O as PayloadProtectionOptions, P as PayloadProtectionWritePolicy, Q as TransportSnapshotUploadSuccess, R as SnapshotUploadOptions, S as JsonValue, T as PayloadProtectionFailureReason, U as TransportCatchupParams, V as StreamsCrdtOptions, W as TransportCatchupSuccess, X as TransportOperation, Y as TransportJoinParams, Z as TransportRoomStatus, _ as EphemeralStreamCrdtOptions, a as StreamsCrdt, at as InMemoryRemoteCursorStore, b as IsolatedCrdtAdapter, c as CrdtApplyReturn, ct as RemoteCursor, d as E2eeOptions, dt as createInitialRemoteCursor, et as TransportSubscription, f as E2eeProvider, g as EphemeralStreamAdaptor, h as E2eeWritePolicy, i as EphemeralStreamCrdt, it as BeforeRemoteCursorSaveHook, j as PayloadProtectionReadPolicy, k as PayloadProtectionProvider, l as CrdtUnresolvedSpan, lt as RemoteCursorSaveSource, m as E2eeReadPolicy, n as PayloadProtectionError, nt as WriteOnlyAppendResult, o as CrdtAdapter, ot as IndexedDbRemoteCursorStore, p as E2eeProviderConfig, q as TransportError, r as LocalAppendFailedError, rt as BeforeRemoteCursorSaveContext, s as CrdtApplyOutcome, st as IndexedDbRemoteCursorStoreOptions, t as isValidRillId, tt as TransportSyncSuccess, u as CrdtUpdateBatch, ut as RemoteCursorStore, v as EphemeralStreamJoinParams, w as PayloadProtectionContext, x as JsonObject, y as EphemeralStreamSubscription, z as StreamsAuthContext } from "./shared-C5Dyx541.js";
|
|
2
|
+
export { BeforeRemoteCursorSaveContext, BeforeRemoteCursorSaveHook, CrdtAdapter, CrdtApplyOutcome, CrdtApplyReturn, CrdtUnresolvedSpan, CrdtUpdateBatch, PayloadProtectionError as E2eeError, PayloadProtectionError, E2eeOptions, E2eeProvider, E2eeProviderConfig, E2eeReadPolicy, E2eeWritePolicy, EphemeralStreamAdaptor, EphemeralStreamCrdt, EphemeralStreamCrdtOptions, EphemeralStreamJoinParams, EphemeralStreamSubscription, InMemoryRemoteCursorStore, IndexedDbRemoteCursorStore, IndexedDbRemoteCursorStoreOptions, IsolatedCrdtAdapter, JsonObject, JsonValue, LocalAppendFailedError, LocalSyncStats, PayloadProtectionContext, PayloadProtectionFailureReason, PayloadProtectionKind, PayloadProtectionOpenInput, PayloadProtectionOptions, PayloadProtectionProvider, PayloadProtectionProviderConfig, PayloadProtectionReadPolicy, PayloadProtectionSealInput, PayloadProtectionSealResult, PayloadProtectionWritePolicy, RemoteCursor, RemoteCursorSaveSource, RemoteCursorStore, Result, SnapshotCodec, SnapshotTransformHook, SnapshotUploadOptions, StreamsAuthContext, StreamsAuthProvider, StreamsCrdt, StreamsCrdtOptions, StreamsCrdtShardUrlsOptions, TransportCatchupParams, TransportCatchupSuccess, TransportCreateStreamSuccess, TransportDeleteStreamSuccess, TransportError, TransportErrorContext, TransportJoinParams, TransportOperation, TransportRoomStatus, TransportSnapshotUploadSuccess, TransportStage, TransportSubscription, TransportSyncSuccess, WriteOnlyAppendResult, createInitialRemoteCursor, isValidRillId };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as createInitialRemoteCursor, c as PayloadProtectionError, i as IndexedDbRemoteCursorStore, n as StreamsCrdt, o as EphemeralStreamCrdt, r as InMemoryRemoteCursorStore, s as LocalAppendFailedError, t as isValidRillId } from "./stream-id-
|
|
1
|
+
import { a as createInitialRemoteCursor, c as PayloadProtectionError, i as IndexedDbRemoteCursorStore, n as StreamsCrdt, o as EphemeralStreamCrdt, r as InMemoryRemoteCursorStore, s as LocalAppendFailedError, t as isValidRillId } from "./stream-id-Dlnc1PNH.js";
|
|
2
2
|
export { PayloadProtectionError as E2eeError, PayloadProtectionError, EphemeralStreamCrdt, InMemoryRemoteCursorStore, IndexedDbRemoteCursorStore, LocalAppendFailedError, StreamsCrdt, createInitialRemoteCursor, isValidRillId };
|
package/dist/loro.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as TransportStage, A as PayloadProtectionProviderConfig, B as StreamsAuthProvider, C as LocalSyncStats, D as PayloadProtectionOpenInput, E as PayloadProtectionKind, F as Result, G as TransportCreateStreamSuccess, H as StreamsCrdtShardUrlsOptions, I as SnapshotCodec, J as TransportErrorContext, K as TransportDeleteStreamSuccess, L as SnapshotTransformHook, M as PayloadProtectionSealInput, N as PayloadProtectionSealResult, O as PayloadProtectionOptions, P as PayloadProtectionWritePolicy, Q as TransportSnapshotUploadSuccess, R as SnapshotUploadOptions, S as JsonValue, T as PayloadProtectionFailureReason, U as TransportCatchupParams, V as StreamsCrdtOptions, W as TransportCatchupSuccess, X as TransportOperation, Y as TransportJoinParams, Z as TransportRoomStatus, _ as EphemeralStreamCrdtOptions, a as StreamsCrdt, at as InMemoryRemoteCursorStore, b as IsolatedCrdtAdapter, c as CrdtApplyReturn, ct as RemoteCursor, d as E2eeOptions, dt as createInitialRemoteCursor, et as TransportSubscription, f as E2eeProvider, g as EphemeralStreamAdaptor, h as E2eeWritePolicy, i as EphemeralStreamCrdt, it as BeforeRemoteCursorSaveHook, j as PayloadProtectionReadPolicy, k as PayloadProtectionProvider, l as CrdtUnresolvedSpan, lt as RemoteCursorSaveSource, m as E2eeReadPolicy, n as PayloadProtectionError, nt as WriteOnlyAppendResult, o as CrdtAdapter, ot as IndexedDbRemoteCursorStore, p as E2eeProviderConfig, q as TransportError, r as LocalAppendFailedError, rt as BeforeRemoteCursorSaveContext, s as CrdtApplyOutcome, st as IndexedDbRemoteCursorStoreOptions, t as isValidRillId, tt as TransportSyncSuccess, u as CrdtUpdateBatch, ut as RemoteCursorStore, v as EphemeralStreamJoinParams, w as PayloadProtectionContext, x as JsonObject, y as EphemeralStreamSubscription, z as StreamsAuthContext } from "./shared-C5Dyx541.js";
|
|
2
2
|
import { LoroDoc } from "loro-crdt";
|
|
3
3
|
|
|
4
4
|
//#region src/loro.d.ts
|
|
@@ -39,5 +39,5 @@ declare function loroEphemeralUpdateKey(update: Uint8Array): string | undefined;
|
|
|
39
39
|
declare function EphemeralStoreAdaptor(store: LoroEphemeralStoreLike): EphemeralStreamAdaptor;
|
|
40
40
|
declare const createLoroEphemeralStoreAdaptor: typeof EphemeralStoreAdaptor;
|
|
41
41
|
//#endregion
|
|
42
|
-
export { BeforeRemoteCursorSaveContext, BeforeRemoteCursorSaveHook, CrdtAdapter, CrdtApplyOutcome, CrdtApplyReturn, CrdtUnresolvedSpan, CrdtUpdateBatch, PayloadProtectionError as E2eeError, PayloadProtectionError, E2eeOptions, E2eeProvider, E2eeProviderConfig, E2eeReadPolicy, E2eeWritePolicy, EphemeralStoreAdaptor, EphemeralStreamAdaptor, EphemeralStreamCrdt, EphemeralStreamCrdtOptions, EphemeralStreamJoinParams, EphemeralStreamSubscription, InMemoryRemoteCursorStore, IndexedDbRemoteCursorStore, IndexedDbRemoteCursorStoreOptions, IsolatedCrdtAdapter, JsonObject, JsonValue, LocalAppendFailedError, LocalSyncStats, LoroEphemeralStoreLike, PayloadProtectionContext, PayloadProtectionFailureReason, PayloadProtectionKind, PayloadProtectionOpenInput, PayloadProtectionOptions, PayloadProtectionProvider, PayloadProtectionProviderConfig, PayloadProtectionReadPolicy, PayloadProtectionSealInput, PayloadProtectionSealResult, PayloadProtectionWritePolicy, RemoteCursor, RemoteCursorSaveSource, RemoteCursorStore, Result, SnapshotCodec, SnapshotTransformHook, SnapshotUploadOptions, StreamsAuthContext, StreamsAuthProvider, StreamsCrdt, StreamsCrdtOptions, StreamsCrdtShardUrlsOptions, TransportCatchupParams, TransportCatchupSuccess, TransportCreateStreamSuccess, TransportDeleteStreamSuccess, TransportError, TransportJoinParams, TransportRoomStatus, TransportSnapshotUploadSuccess, TransportSubscription, TransportSyncSuccess, WriteOnlyAppendResult, createInitialRemoteCursor, createLoroDocAdapter, createLoroEphemeralStoreAdaptor, isValidRillId, loroEphemeralUpdateKey };
|
|
42
|
+
export { BeforeRemoteCursorSaveContext, BeforeRemoteCursorSaveHook, CrdtAdapter, CrdtApplyOutcome, CrdtApplyReturn, CrdtUnresolvedSpan, CrdtUpdateBatch, PayloadProtectionError as E2eeError, PayloadProtectionError, E2eeOptions, E2eeProvider, E2eeProviderConfig, E2eeReadPolicy, E2eeWritePolicy, EphemeralStoreAdaptor, EphemeralStreamAdaptor, EphemeralStreamCrdt, EphemeralStreamCrdtOptions, EphemeralStreamJoinParams, EphemeralStreamSubscription, InMemoryRemoteCursorStore, IndexedDbRemoteCursorStore, IndexedDbRemoteCursorStoreOptions, IsolatedCrdtAdapter, JsonObject, JsonValue, LocalAppendFailedError, LocalSyncStats, LoroEphemeralStoreLike, PayloadProtectionContext, PayloadProtectionFailureReason, PayloadProtectionKind, PayloadProtectionOpenInput, PayloadProtectionOptions, PayloadProtectionProvider, PayloadProtectionProviderConfig, PayloadProtectionReadPolicy, PayloadProtectionSealInput, PayloadProtectionSealResult, PayloadProtectionWritePolicy, RemoteCursor, RemoteCursorSaveSource, RemoteCursorStore, Result, SnapshotCodec, SnapshotTransformHook, SnapshotUploadOptions, StreamsAuthContext, StreamsAuthProvider, StreamsCrdt, StreamsCrdtOptions, StreamsCrdtShardUrlsOptions, TransportCatchupParams, TransportCatchupSuccess, TransportCreateStreamSuccess, TransportDeleteStreamSuccess, TransportError, TransportErrorContext, TransportJoinParams, TransportOperation, TransportRoomStatus, TransportSnapshotUploadSuccess, TransportStage, TransportSubscription, TransportSyncSuccess, WriteOnlyAppendResult, createInitialRemoteCursor, createLoroDocAdapter, createLoroEphemeralStoreAdaptor, isValidRillId, loroEphemeralUpdateKey };
|
|
43
43
|
//# sourceMappingURL=loro.d.ts.map
|
package/dist/loro.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as createInitialRemoteCursor, c as PayloadProtectionError, i as IndexedDbRemoteCursorStore, n as StreamsCrdt, o as EphemeralStreamCrdt, r as InMemoryRemoteCursorStore, s as LocalAppendFailedError, t as isValidRillId } from "./stream-id-
|
|
1
|
+
import { a as createInitialRemoteCursor, c as PayloadProtectionError, i as IndexedDbRemoteCursorStore, n as StreamsCrdt, o as EphemeralStreamCrdt, r as InMemoryRemoteCursorStore, s as LocalAppendFailedError, t as isValidRillId } from "./stream-id-Dlnc1PNH.js";
|
|
2
2
|
import { LoroDoc, VersionVector, decodeImportBlobMeta } from "loro-crdt";
|
|
3
3
|
//#region src/loro.ts
|
|
4
4
|
function batchImportUpdates(doc, updates) {
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { StreamErrorContext, StreamRequestOperation } from "@loro-dev/streams-client";
|
|
2
|
+
|
|
1
3
|
//#region src/checkpoint.d.ts
|
|
2
4
|
/**
|
|
3
5
|
* Persisted replay progress for one stream.
|
|
@@ -186,14 +188,24 @@ type Result<T, E> = {
|
|
|
186
188
|
* Live subscription state exposed by `join()`.
|
|
187
189
|
*/
|
|
188
190
|
type TransportRoomStatus = "joined" | "reconnecting" | "disconnected" | "error";
|
|
191
|
+
type TransportOperation = "sync" | "join" | "catchup" | "create" | "delete" | "upload" | "snapshot" | "live" | "unknown";
|
|
192
|
+
type TransportStage = "bootstrap" | "catch_up" | "upload" | "cursor_load" | "cursor_save" | "cursor_delete" | "durability_hook" | "crdt_apply" | "crdt_export" | "payload_encode" | "payload_decode" | "initial_sync" | "unknown";
|
|
193
|
+
/** Safe diagnostics only. Source/stage describe observed boundaries, not root cause. */
|
|
194
|
+
type TransportErrorContext = Omit<StreamErrorContext, "source" | "operation" | "originalCode"> & {
|
|
195
|
+
readonly source: StreamErrorContext["source"] | "cursor_store" | "crdt" | "durability_hook" | "payload_protection" | "deadline";
|
|
196
|
+
readonly operation: TransportOperation;
|
|
197
|
+
readonly stage: TransportStage;
|
|
198
|
+
readonly requestOperation?: StreamRequestOperation;
|
|
199
|
+
readonly originalCode: StreamErrorContext["originalCode"] | TransportError["code"];
|
|
200
|
+
};
|
|
189
201
|
/**
|
|
190
202
|
* Discriminated error union for `createStream()`, `deleteStream()`, `sync()`,
|
|
191
203
|
* `join()`, and `appendWriteOnly()`.
|
|
192
204
|
*
|
|
193
205
|
* Every variant has a `code` discriminator and a `retryable: boolean`. Variants
|
|
194
206
|
* that originate from an HTTP response also carry `status`, `message`, and
|
|
195
|
-
* (when the server sent one) the raw response `body
|
|
196
|
-
*
|
|
207
|
+
* (when the server sent one) the legacy raw response `body`. Use `context` for
|
|
208
|
+
* safe diagnostics rather than forwarding arbitrary messages/bodies/causes.
|
|
197
209
|
*
|
|
198
210
|
* Codes:
|
|
199
211
|
* - `stream_not_found` — 404; the target stream does not exist. Create it first.
|
|
@@ -210,7 +222,7 @@ type TransportRoomStatus = "joined" | "reconnecting" | "disconnected" | "error";
|
|
|
210
222
|
* - `gone` — 410; persisted cursor is no longer valid. Bootstrap from scratch.
|
|
211
223
|
* - `apply_incomplete` — a CRDT adapter could not fully apply remote data.
|
|
212
224
|
* - `server_error` — 5xx or 429; transient backend failure, retry with backoff.
|
|
213
|
-
* - `internal_error` — local
|
|
225
|
+
* - `internal_error` — local/unmarked exception; consult context for provenance.
|
|
214
226
|
* - `unknown` — uncategorized error.
|
|
215
227
|
* - `payload_protection_error` — payload encryption/decryption failed.
|
|
216
228
|
*
|
|
@@ -224,7 +236,10 @@ type TransportRoomStatus = "joined" | "reconnecting" | "disconnected" | "error";
|
|
|
224
236
|
* return after a single attempt — applications decide whether to retry based
|
|
225
237
|
* on the `retryable` flag.
|
|
226
238
|
*/
|
|
227
|
-
type TransportError =
|
|
239
|
+
type TransportError = {
|
|
240
|
+
readonly context?: TransportErrorContext;
|
|
241
|
+
} & TransportErrorDetails;
|
|
242
|
+
type TransportErrorDetails =
|
|
228
243
|
/**
|
|
229
244
|
* The target stream does not exist on the server. Use
|
|
230
245
|
* `transport.createStream()` to create it (or pass `createIfMissing: true`
|
|
@@ -253,8 +268,8 @@ type TransportError =
|
|
|
253
268
|
* The user-supplied auth callback threw. Treated as transient because the
|
|
254
269
|
* callback typically fetches a token from a backend that may flake. The
|
|
255
270
|
* live read/write loops retry these automatically. `cause` is the original
|
|
256
|
-
* thrown value
|
|
257
|
-
*
|
|
271
|
+
* thrown value retained for compatibility; it may contain secrets. Use
|
|
272
|
+
* `context` for safe diagnostics and treat the failure as retryable.
|
|
258
273
|
*
|
|
259
274
|
* For "user is permanently logged out" cases, return `undefined` from the
|
|
260
275
|
* auth callback instead of throwing — that lets the request go out with
|
|
@@ -365,8 +380,9 @@ type TransportError =
|
|
|
365
380
|
readonly retryAfterMs?: number;
|
|
366
381
|
}
|
|
367
382
|
/**
|
|
368
|
-
*
|
|
369
|
-
*
|
|
383
|
+
* A local or unmarked exception was classified as internal. This alone
|
|
384
|
+
* does not establish its root cause; consult `context` for provenance.
|
|
385
|
+
* Operation-level results report retryable: false.
|
|
370
386
|
*/
|
|
371
387
|
| {
|
|
372
388
|
readonly code: "internal_error";
|
|
@@ -1403,5 +1419,5 @@ declare class PayloadProtectionError extends Error {
|
|
|
1403
1419
|
*/
|
|
1404
1420
|
declare function isValidRillId(id: string): boolean;
|
|
1405
1421
|
//#endregion
|
|
1406
|
-
export {
|
|
1407
|
-
//# sourceMappingURL=
|
|
1422
|
+
export { TransportStage 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, TransportErrorContext as J, TransportDeleteStreamSuccess as K, SnapshotTransformHook as L, PayloadProtectionSealInput as M, PayloadProtectionSealResult as N, PayloadProtectionOptions as O, PayloadProtectionWritePolicy as P, TransportSnapshotUploadSuccess as Q, SnapshotUploadOptions as R, JsonValue as S, PayloadProtectionFailureReason as T, TransportCatchupParams as U, StreamsCrdtOptions as V, TransportCatchupSuccess as W, TransportOperation as X, TransportJoinParams as Y, TransportRoomStatus as Z, EphemeralStreamCrdtOptions as _, StreamsCrdt as a, InMemoryRemoteCursorStore as at, IsolatedCrdtAdapter as b, CrdtApplyReturn as c, RemoteCursor as ct, E2eeOptions as d, createInitialRemoteCursor as dt, TransportSubscription as et, E2eeProvider as f, EphemeralStreamAdaptor as g, E2eeWritePolicy as h, EphemeralStreamCrdt as i, BeforeRemoteCursorSaveHook as it, PayloadProtectionReadPolicy as j, PayloadProtectionProvider as k, CrdtUnresolvedSpan as l, RemoteCursorSaveSource as lt, E2eeReadPolicy as m, PayloadProtectionError as n, WriteOnlyAppendResult as nt, CrdtAdapter as o, IndexedDbRemoteCursorStore as ot, E2eeProviderConfig as p, TransportError as q, LocalAppendFailedError as r, BeforeRemoteCursorSaveContext as rt, CrdtApplyOutcome as s, IndexedDbRemoteCursorStoreOptions as st, isValidRillId as t, TransportSyncSuccess as tt, CrdtUpdateBatch as u, RemoteCursorStore as ut, EphemeralStreamJoinParams as v, PayloadProtectionContext as w, JsonObject as x, EphemeralStreamSubscription as y, StreamsAuthContext as z };
|
|
1423
|
+
//# sourceMappingURL=shared-C5Dyx541.d.ts.map
|