@mengine/medeo-client 2.0.0 → 2.0.1-alpha.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 +14 -0
- package/dist/index.d.ts +22 -3
- package/dist/index.js +52 -2
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -8,6 +8,20 @@ This package owns the shared `VideoDocument` contract, semantic editing layer, a
|
|
|
8
8
|
|
|
9
9
|
`getState().loaded` means the first local load completed. Once loaded, `loadedFromLocal` reports whether that load imported a snapshot, including a valid empty document. It stays unchanged by later edits and remote updates. Document readiness does not depend on metadata or nonempty tracks.
|
|
10
10
|
|
|
11
|
+
## Local persistence
|
|
12
|
+
|
|
13
|
+
Browser hosts can inject `IndexedDBDocStorage` through `localStorage`. An optional `initialSnapshot` merges a freshly fetched server snapshot into that storage before DocManager loads it; it never replaces locally saved, unconfirmed edits. The host can require a successful online fetch before constructing the session.
|
|
14
|
+
|
|
15
|
+
`getLocalSaveState()` / `subscribeLocalSaveState()` report `{ status: 'saving' | 'saved' | 'failed', error }` for this session's local commits. This is separate from `getSyncState()` and server confirmation. The storage adapter determines durability: IndexedDB resolves only after its transaction commits; MemoryDocStorage remains in memory. Failed saves retain their causal order and retry without blocking other documents.
|
|
16
|
+
|
|
17
|
+
`waitForLocalSave({ timeoutMs? })` waits for the commits present at invocation (default deadline: 15 seconds). Later edits do not extend that target. Timing out only stops the wait; persistence continues. This does not wait for server acknowledgement.
|
|
18
|
+
|
|
19
|
+
For normal teardown, use `await session.close()`. It immediately rejects new edits and stops synchronization, then keeps local persistence alive until pending commits are saved before releasing connections. Storage failures remain retryable while closing. `destroy()` is immediate cancellation for exceptional teardown, including failed startup; it can discard unpersisted in-memory work. Neither API can guarantee a save after the browser process is forcibly terminated. Only completed local saves survive reopening.
|
|
20
|
+
|
|
21
|
+
Edits received from another local-storage peer also remain unconfirmed until covered by an authoritative server version. Receiving a cross-tab notification is not a server acknowledgement.
|
|
22
|
+
|
|
23
|
+
Reopening uses the stored Loro history and the server's version vector to derive missing updates, without replaying semantic operations or their external side effects. Undo history remains limited to the current session.
|
|
24
|
+
|
|
11
25
|
## Session undo/redo
|
|
12
26
|
|
|
13
27
|
After `await session.start()`, `session.undo(options?)` and `session.redo(options?)` synchronously apply local history and return whether they produced a document update. `options` accepts the same actor/intent metadata as semantic edits. Read the resulting document through `session.snapshot()`; use `waitForServerAck()` only when durable confirmation is required.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { $ as VideoDraft, A as assertValidVideoDocument, B as CaptionPart, C as index_d_exports, D as VideoDocumentMirrorSchema, E as VideoDocumentDraft, F as buildSpeechHostMap, G as Timeline, H as PartKind, I as derivePositionFromAbs, J as TrackItemTimePosition, K as Track, L as fromVideoDocument, M as buildInitialVideoDocument, N as DerivedItemPosition, O as videoDocumentMirrorSchema, P as SpeechHostMap, Q as VideoDocumentValidationIssueCode, R as toVideoDocument, S as ValidationError, T as TrackItemDraft, U as PartUnion, V as DEFAULT_UNIT_TIME_MS, W as SpeechPart, X as VideoDocument, Y as VideoClipPart, Z as VideoDocumentValidationIssue, _ as PlannedSemanticOpKind, a as MirrorVideoDocumentOptions, at as PartAggregation, b as SchemaValidator, c as CommitOptions, ct as Track$1, d as SemanticEditor, et as VideoDraftContent, f as SemanticOpInput, g as ImplementedSemanticOpKind, h as IMPLEMENTED_SEMANTIC_OP_KINDS, i as MirrorVideoDocumentAdapter, it as CaptionStyle, j as validateVideoDocument, k as VideoDocumentValidationError, l as OpActor, lt as TrackItem$1, m as TransactAudit, n as videoDocumentSchema, nt as Attachment, o as createMirrorVideoDocument, ot as SpeedShift, p as SemanticOpName, q as TrackItem, r as readVideoDocumentFromDraft, rt as CaptionPart$1, s as createMirrorVideoDocumentAdapter, st as Timeline$1, t as partUnionSchema, tt as VideoDraftPartUnion, u as SemanticDocumentAdapter, v as SemanticOpKind, w as TrackDraft, x as SnapshotReadable, y as isImplementedSemanticOpKind, z as BgmPart } from "./index-CnZ9l3rb.js";
|
|
2
2
|
import { LoroDoc, PeerID } from "loro-crdt";
|
|
3
|
-
import { DocState } from "@mengine/sync";
|
|
3
|
+
import { DocState, LocalSaveState } from "@mengine/sync";
|
|
4
4
|
import { BaseDocStorage, Connection, DocDiff, DocPushReceipt, DocSnapshotRecord, DocStorage, DocStorageOptions, DocUpdate, DocUpdateRecord } from "@mengine/storage";
|
|
5
5
|
|
|
6
6
|
//#region src/client/base64.d.ts
|
|
@@ -628,13 +628,18 @@ declare class MengineAckFailedError extends Error {
|
|
|
628
628
|
readonly cause: Error | undefined;
|
|
629
629
|
constructor(reason: 'timeout' | 'rejected' | 'failed', code: string | undefined, cause: Error | undefined, message: string);
|
|
630
630
|
}
|
|
631
|
+
type MengineLocalSaveState = LocalSaveState;
|
|
632
|
+
interface WaitForLocalSaveOptions {
|
|
633
|
+
/** Only limits waiting, never cancels persistence. */
|
|
634
|
+
timeoutMs?: number;
|
|
635
|
+
}
|
|
631
636
|
interface WaitForServerAckOptions {
|
|
632
637
|
/** Deadline in ms. Rejects with reason `timeout` when it elapses. */
|
|
633
638
|
timeoutMs?: number;
|
|
634
639
|
}
|
|
635
640
|
/** Document-level confirmation is independent of local operation completion. */
|
|
636
641
|
interface MengineDocSyncState {
|
|
637
|
-
/**
|
|
642
|
+
/** Server-originated imports do not create a new local confirmation obligation. */
|
|
638
643
|
readonly confirmation: 'unknown' | 'pending' | 'confirmed';
|
|
639
644
|
/** Transport/activity phase. Idle does not imply confirmation; failure details
|
|
640
645
|
* remain available through push outcomes and confirmation wait errors. */
|
|
@@ -649,6 +654,9 @@ interface MengineDocSessionOptions {
|
|
|
649
654
|
* Browsers should pass an `IndexedDBDocStorage` for refresh/cross-tab support.
|
|
650
655
|
*/
|
|
651
656
|
localStorage?: DocStorageLike;
|
|
657
|
+
/** A freshly fetched remote snapshot to merge into storage before loading.
|
|
658
|
+
* Existing local changes are retained; the host owns any online startup gate. */
|
|
659
|
+
initialSnapshot?: Uint8Array;
|
|
652
660
|
sseReconnectDelayMs?: number;
|
|
653
661
|
}
|
|
654
662
|
/**
|
|
@@ -685,6 +693,7 @@ declare class MengineDocSession {
|
|
|
685
693
|
private started;
|
|
686
694
|
private startTask;
|
|
687
695
|
private destroyed;
|
|
696
|
+
private closeTask;
|
|
688
697
|
private lifetime;
|
|
689
698
|
private hasConnected;
|
|
690
699
|
private initialVersionValue;
|
|
@@ -778,7 +787,17 @@ declare class MengineDocSession {
|
|
|
778
787
|
*/
|
|
779
788
|
start(): Promise<VideoDocument>;
|
|
780
789
|
private open;
|
|
790
|
+
getLocalSaveState(): MengineLocalSaveState;
|
|
791
|
+
/** Immediately reports local transaction state; independent of server confirmation. */
|
|
792
|
+
subscribeLocalSaveState(cb: (state: MengineLocalSaveState) => void): () => void;
|
|
793
|
+
/** Waits for commits present now to reach local storage. Does not wait for the network. */
|
|
794
|
+
waitForLocalSave(options?: WaitForLocalSaveOptions): Promise<void>;
|
|
795
|
+
/** Stop accepting edits and drain local persistence before releasing resources.
|
|
796
|
+
* A failed local write keeps retrying, even after the host has unmounted.
|
|
797
|
+
* Hosts should use this for normal teardown; destroy() is immediate cancellation. */
|
|
798
|
+
close(): Promise<void>;
|
|
781
799
|
getSyncState(): MengineDocSyncState;
|
|
800
|
+
private trackLocalVersion;
|
|
782
801
|
private confirmationTarget;
|
|
783
802
|
/** Immediately supplies current state; unsubscribe when the host changes docs. */
|
|
784
803
|
subscribeSyncState(cb: (state: MengineDocSyncState) => void): () => void;
|
|
@@ -1115,4 +1134,4 @@ declare function hostForAbsMs(ranges: MainClipRange[], absMs: number): MainClipR
|
|
|
1115
1134
|
*/
|
|
1116
1135
|
declare function relativePositionForAbs(ranges: MainClipRange[], absMs: number): TrackItemTimePosition;
|
|
1117
1136
|
//#endregion
|
|
1118
|
-
export { type Aggregation, type Attachment, type BgmPart, type CaptionPart, type CaptionStyle, type CommitOptions, DEFAULT_UNIT_TIME_MS, type DerivedItemPosition, type DocStorageLike, type DocVersionMark, IMPLEMENTED_SEMANTIC_OP_KINDS, type ImplementedSemanticOpKind, LANE_KINDS_IN_STACK_ORDER, type LaneKind, type MainClipRange, type MakeEmptyPart, ManualSyncDoc, type ManualSyncDocOptions, MedeoHttpDocStorage, type MedeoHttpDocStorageOptions, MemoryDocStorage, MengineAckFailedError, type MengineAuditEntry, type MengineAuditResponse, MengineDocSession, type MengineDocSessionOptions, type MengineDocSessionUpdateEvent, type MengineDocSyncState, type MengineDocumentVersion, type MengineEventStreamOptions, MengineHttpClient, type MengineHttpClientOptions, MengineHttpRequestError, MenginePushRejectedError, type MenginePushResponse, type MenginePushUpdateResponse, type MengineRejectedResponse, type MengineSnapshotResponse, type MengineSseUpdateEvent, type MengineSyncResponse, type MengineUndoState, type MengineUpdateMeta, MirrorVideoDocumentAdapter, type MirrorVideoDocumentOptions, type OpActor, type PartAggregation, type PartKind, type PartUnion, type PlannedSemanticOpKind, type PullFailureReason, type PullResult, type PushOutcome, type PushOutcomeKind, type PushResult, type PushResultKind, SchemaValidator, type SemanticDocumentAdapter, SemanticEditor, type SemanticOpInput, type SemanticOpKind, type SemanticOpName, type SnapshotReadable, type SolvedVideoDocument, type SpeechHostMap, type SpeechPart, type SpeedShift, TIMELINE_SKELETON_DURATION_MS, type Timeline, type TimelineDoc, type TimelineItem, type Track, type TrackDraft, type TrackItem, type TrackItemDraft, type TrackItemTimePosition, type TransactAudit, ValidationError, type VideoClipPart, type VideoDocument, type VideoDocumentDraft, type VideoDocumentMirrorSchema, VideoDocumentValidationError, type VideoDocumentValidationIssue, type VideoDocumentValidationIssueCode, type VideoDraft, type CaptionPart$1 as VideoDraftCaptionPart, type VideoDraftContent, type VideoDraftPartUnion, type Timeline$1 as VideoDraftTimeline, type Track$1 as VideoDraftTrack, type TrackItem$1 as VideoDraftTrackItem, type WaitForServerAckOptions, arrangeMainTrackSeamlessly, assertValidVideoDocument, base64ToBytes, buildInitialVideoDocument, buildSpeechHostMap, bytesToBase64, cascadeAfterVideoClipChanges, createMirrorVideoDocument, createMirrorVideoDocumentAdapter, decodeDocVersionMark, derivePositionFromAbs, encodeDocVersionMark, ensureLaneTrack, fillMainTrackTimeGaps, findLaneTrack, fromVideoDocument, generatePartId, getAt, hostForAbsMs, isEmptyVideoClip, isImplementedSemanticOpKind, isMap, laneTrackId, mainTrackRanges, partDurationMs, partUnionSchema, readMainTrackItems, readMengineEventStream, readPart, readPartDurationMs, readVideoDocumentFromDraft, reassignSpeechesToVideoClipsByTime, recalculateTimelineDuration, relativePositionForAbs, resolveAllSpeechOverlaps, resolveSpeechOverlapByShiftingVideos, safeDurationMs, index_d_exports as schemas, snapshotToPlain, solveVideoDocument, syncAggregatedClipsTimePosition, toVideoDocument, validateVideoDocument, videoDocumentMirrorSchema, videoDocumentSchema };
|
|
1137
|
+
export { type Aggregation, type Attachment, type BgmPart, type CaptionPart, type CaptionStyle, type CommitOptions, DEFAULT_UNIT_TIME_MS, type DerivedItemPosition, type DocStorageLike, type DocVersionMark, IMPLEMENTED_SEMANTIC_OP_KINDS, type ImplementedSemanticOpKind, LANE_KINDS_IN_STACK_ORDER, type LaneKind, type MainClipRange, type MakeEmptyPart, ManualSyncDoc, type ManualSyncDocOptions, MedeoHttpDocStorage, type MedeoHttpDocStorageOptions, MemoryDocStorage, MengineAckFailedError, type MengineAuditEntry, type MengineAuditResponse, MengineDocSession, type MengineDocSessionOptions, type MengineDocSessionUpdateEvent, type MengineDocSyncState, type MengineDocumentVersion, type MengineEventStreamOptions, MengineHttpClient, type MengineHttpClientOptions, MengineHttpRequestError, type MengineLocalSaveState, MenginePushRejectedError, type MenginePushResponse, type MenginePushUpdateResponse, type MengineRejectedResponse, type MengineSnapshotResponse, type MengineSseUpdateEvent, type MengineSyncResponse, type MengineUndoState, type MengineUpdateMeta, MirrorVideoDocumentAdapter, type MirrorVideoDocumentOptions, type OpActor, type PartAggregation, type PartKind, type PartUnion, type PlannedSemanticOpKind, type PullFailureReason, type PullResult, type PushOutcome, type PushOutcomeKind, type PushResult, type PushResultKind, SchemaValidator, type SemanticDocumentAdapter, SemanticEditor, type SemanticOpInput, type SemanticOpKind, type SemanticOpName, type SnapshotReadable, type SolvedVideoDocument, type SpeechHostMap, type SpeechPart, type SpeedShift, TIMELINE_SKELETON_DURATION_MS, type Timeline, type TimelineDoc, type TimelineItem, type Track, type TrackDraft, type TrackItem, type TrackItemDraft, type TrackItemTimePosition, type TransactAudit, ValidationError, type VideoClipPart, type VideoDocument, type VideoDocumentDraft, type VideoDocumentMirrorSchema, VideoDocumentValidationError, type VideoDocumentValidationIssue, type VideoDocumentValidationIssueCode, type VideoDraft, type CaptionPart$1 as VideoDraftCaptionPart, type VideoDraftContent, type VideoDraftPartUnion, type Timeline$1 as VideoDraftTimeline, type Track$1 as VideoDraftTrack, type TrackItem$1 as VideoDraftTrackItem, type WaitForLocalSaveOptions, type WaitForServerAckOptions, arrangeMainTrackSeamlessly, assertValidVideoDocument, base64ToBytes, buildInitialVideoDocument, buildSpeechHostMap, bytesToBase64, cascadeAfterVideoClipChanges, createMirrorVideoDocument, createMirrorVideoDocumentAdapter, decodeDocVersionMark, derivePositionFromAbs, encodeDocVersionMark, ensureLaneTrack, fillMainTrackTimeGaps, findLaneTrack, fromVideoDocument, generatePartId, getAt, hostForAbsMs, isEmptyVideoClip, isImplementedSemanticOpKind, isMap, laneTrackId, mainTrackRanges, partDurationMs, partUnionSchema, readMainTrackItems, readMengineEventStream, readPart, readPartDurationMs, readVideoDocumentFromDraft, reassignSpeechesToVideoClipsByTime, recalculateTimelineDuration, relativePositionForAbs, resolveAllSpeechOverlaps, resolveSpeechOverlapByShiftingVideos, safeDurationMs, index_d_exports as schemas, snapshotToPlain, solveVideoDocument, syncAggregatedClipsTimePosition, toVideoDocument, validateVideoDocument, videoDocumentMirrorSchema, videoDocumentSchema };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "./chunk-D7D4PA-g.js";
|
|
2
2
|
import { A as isEmptyVideoClip, C as fillMainTrackTimeGaps, D as resolveSpeechOverlapByShiftingVideos, E as resolveAllSpeechOverlaps, F as partUnionToDraft, I as recordEntries, L as videoDocumentMirrorSchema, M as safeDurationMs, N as DEFAULT_UNIT_TIME_MS, O as syncAggregatedClipsTimePosition, P as effectiveVideoClipDurationMs, R as base64ToBytes, S as arrangeMainTrackSeamlessly, T as recalculateTimelineDuration, _ as ensureLaneTrack, a as DocumentMutationGuard, b as solveVideoDocument, c as derivePositionFromAbs, d as VideoDocumentValidationError, f as assertValidVideoDocument, g as LANE_KINDS_IN_STACK_ORDER, h as videoDocumentSchema, i as readVideoDocumentFromDraft, j as partDurationMs, k as TIMELINE_SKELETON_DURATION_MS, l as fromVideoDocument, m as partUnionSchema, n as createMirrorVideoDocument, o as buildInitialVideoDocument, p as validateVideoDocument, r as createMirrorVideoDocumentAdapter, s as buildSpeechHostMap, t as MirrorVideoDocumentAdapter, u as toVideoDocument, v as findLaneTrack, w as reassignSpeechesToVideoClipsByTime, x as cascadeAfterVideoClipChanges, y as laneTrackId, z as bytesToBase64 } from "./document-CmjJwOba.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
import { LoroDoc, UndoManager, VersionVector } from "loro-crdt";
|
|
4
|
+
import { LoroDoc, UndoManager, VersionVector, decodeImportBlobMeta } from "loro-crdt";
|
|
5
5
|
import { ClientServerSynchronizer, DocManager } from "@mengine/sync";
|
|
6
6
|
import { DisposableSet, EventBus, Task } from "@mengine/utils";
|
|
7
7
|
import { BaseDocStorage, DummyConnection } from "@mengine/storage";
|
|
@@ -2705,6 +2705,7 @@ var MengineDocSession = class {
|
|
|
2705
2705
|
started = false;
|
|
2706
2706
|
startTask = null;
|
|
2707
2707
|
destroyed = false;
|
|
2708
|
+
closeTask = null;
|
|
2708
2709
|
lifetime = null;
|
|
2709
2710
|
hasConnected = false;
|
|
2710
2711
|
initialVersionValue = null;
|
|
@@ -2904,6 +2905,13 @@ var MengineDocSession = class {
|
|
|
2904
2905
|
this.local.connection.connect();
|
|
2905
2906
|
await this.local.connection.waitForConnected().abortOn(this.lifetime.signal);
|
|
2906
2907
|
if (this.destroyed) throw new Error("mengine doc session destroyed");
|
|
2908
|
+
if (this.options.initialSnapshot) {
|
|
2909
|
+
await this.local.pushDocUpdate({
|
|
2910
|
+
docId: this.docId,
|
|
2911
|
+
data: this.options.initialSnapshot
|
|
2912
|
+
}, "initial-snapshot");
|
|
2913
|
+
if (this.destroyed) throw new Error("mengine doc session destroyed");
|
|
2914
|
+
}
|
|
2907
2915
|
this.server.connection.connect();
|
|
2908
2916
|
this.synchronizer.start();
|
|
2909
2917
|
this.manager.start();
|
|
@@ -2915,7 +2923,7 @@ var MengineDocSession = class {
|
|
|
2915
2923
|
this.adapterValue = new MirrorVideoDocumentAdapter(doc, this.mutationGuard);
|
|
2916
2924
|
const unsubscribe = doc.subscribe((event) => {
|
|
2917
2925
|
if (this.adapterValue == null) return;
|
|
2918
|
-
if (event.by === "local") this.
|
|
2926
|
+
if (event.by === "local") this.trackLocalVersion(doc.version());
|
|
2919
2927
|
this.emitSyncState();
|
|
2920
2928
|
this.events.emit("update", {
|
|
2921
2929
|
source: event.by === "local" ? "local" : "remote",
|
|
@@ -2923,6 +2931,10 @@ var MengineDocSession = class {
|
|
|
2923
2931
|
});
|
|
2924
2932
|
});
|
|
2925
2933
|
this.disposables.add(unsubscribe);
|
|
2934
|
+
this.disposables.add(this.manager.onLocalUpdateReceived(this.docId, (update) => {
|
|
2935
|
+
this.trackLocalVersion(decodeImportBlobMeta(update, true).partialEndVersionVector);
|
|
2936
|
+
this.emitSyncState();
|
|
2937
|
+
}));
|
|
2926
2938
|
this.disposables.add(this.manager.onDocStateChange(this.docId, (state) => {
|
|
2927
2939
|
this.events.emit("state", state);
|
|
2928
2940
|
this.emitSyncState();
|
|
@@ -2933,9 +2945,39 @@ var MengineDocSession = class {
|
|
|
2933
2945
|
this.undoManagerValue = new DocumentUndoManager(doc, this.mutationGuard, () => this.events.emit("undoState"));
|
|
2934
2946
|
this.editorValue = new SemanticEditor(this.adapterValue);
|
|
2935
2947
|
this.initialVersionValue = doc.version();
|
|
2948
|
+
if (this.localVersionValue) this.trackLocalVersion(this.initialVersionValue);
|
|
2936
2949
|
this.emitSyncState();
|
|
2937
2950
|
return this.snapshot();
|
|
2938
2951
|
}
|
|
2952
|
+
getLocalSaveState() {
|
|
2953
|
+
return this.getState().localSave;
|
|
2954
|
+
}
|
|
2955
|
+
/** Immediately reports local transaction state; independent of server confirmation. */
|
|
2956
|
+
subscribeLocalSaveState(cb) {
|
|
2957
|
+
const off = this.events.on("state", () => cb(this.getLocalSaveState()));
|
|
2958
|
+
cb(this.getLocalSaveState());
|
|
2959
|
+
return off;
|
|
2960
|
+
}
|
|
2961
|
+
/** Waits for commits present now to reach local storage. Does not wait for the network. */
|
|
2962
|
+
async waitForLocalSave(options = {}) {
|
|
2963
|
+
if (!this.editorValue || this.destroyed) throw new Error("mengine doc session is not started");
|
|
2964
|
+
await this.manager.waitForLocalSave(this.docId).timeout(options.timeoutMs ?? 15e3);
|
|
2965
|
+
}
|
|
2966
|
+
/** Stop accepting edits and drain local persistence before releasing resources.
|
|
2967
|
+
* A failed local write keeps retrying, even after the host has unmounted.
|
|
2968
|
+
* Hosts should use this for normal teardown; destroy() is immediate cancellation. */
|
|
2969
|
+
close() {
|
|
2970
|
+
if (this.closeTask) return this.closeTask;
|
|
2971
|
+
if (this.destroyed || !this.editorValue) {
|
|
2972
|
+
this.destroy();
|
|
2973
|
+
return Promise.resolve();
|
|
2974
|
+
}
|
|
2975
|
+
this.mutationGuard.close();
|
|
2976
|
+
this.synchronizer.stop();
|
|
2977
|
+
this.server.connection.disconnect();
|
|
2978
|
+
this.closeTask = this.manager.waitForLocalSave(this.docId).then(() => this.destroy());
|
|
2979
|
+
return this.closeTask;
|
|
2980
|
+
}
|
|
2939
2981
|
getSyncState() {
|
|
2940
2982
|
const state = this.getState();
|
|
2941
2983
|
const target = this.confirmationTarget();
|
|
@@ -2946,6 +2988,14 @@ var MengineDocSession = class {
|
|
|
2946
2988
|
phase: connection === "disconnected" ? "offline" : this.pushErrorValue != null || state.error != null ? "failed" : connection === "connecting" ? "connecting" : state.syncing ? "syncing" : "idle"
|
|
2947
2989
|
};
|
|
2948
2990
|
}
|
|
2991
|
+
trackLocalVersion(version) {
|
|
2992
|
+
const target = VersionVector.parseJSON(this.confirmationTarget()?.toJSON() ?? /* @__PURE__ */ new Map());
|
|
2993
|
+
for (const [peer, counter] of version.toJSON()) if ((target.get(peer) ?? 0) < counter) target.setEnd({
|
|
2994
|
+
peer,
|
|
2995
|
+
counter
|
|
2996
|
+
});
|
|
2997
|
+
this.localVersionValue = target;
|
|
2998
|
+
}
|
|
2949
2999
|
confirmationTarget() {
|
|
2950
3000
|
return this.localVersionValue ?? this.initialVersionValue;
|
|
2951
3001
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mengine/medeo-client",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1-alpha.1",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"loro-mirror": "^2.3.3",
|
|
27
27
|
"zod": "^4.4.3",
|
|
28
|
-
"@mengine/
|
|
29
|
-
"@mengine/
|
|
30
|
-
"@mengine/
|
|
28
|
+
"@mengine/storage": "2.0.1-alpha.1",
|
|
29
|
+
"@mengine/sync": "2.0.1-alpha.1",
|
|
30
|
+
"@mengine/utils": "2.0.1-alpha.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/node": "^25.9.1",
|