@mengine/medeo-client 3.0.0 → 3.0.1-dsl.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 +4 -0
- package/dist/{dsl-Cpk8WxcZ.js → dsl-BSX7hMcR.js} +320 -81
- package/dist/dsl.d.ts +1 -1
- package/dist/dsl.js +1 -1
- package/dist/{index-Dldi944U.d.ts → index-D1ZC5V8t.d.ts} +7 -3
- package/dist/{index-DuM7I4Ku.d.ts → index-rW40K2LR.d.ts} +15 -18
- package/dist/index.d.ts +2 -2
- package/dist/index.js +15 -2
- package/dist/schemas.d.ts +606 -0
- package/dist/schemas.js +478 -0
- package/dist/testing.d.ts +2 -1
- package/dist/testing.js +35 -14
- package/package.json +10 -8
package/dist/dsl.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as ClipPlacement, A as VoiceoverResult, At as RichTextSnapshot, B as isInvalidAtomic, Bt as Voice, C as DslProjectionError, Ct as MedeoDslSnapshot, D as UploadText, Dt as RelationTables, E as DslEditor, Et as RelationTable, F as UnsupportedDocumentFormatError, Ft as TextMutation, G as CommitOptions, H as MedeoDslDraft, I as assertDslDocument, It as TextRun, J as AddDslClipsInput, K as OpActor, L as documentFormat, Lt as TimeAnchor, M as MedeoDsl, Mt as TextDelta, N as DslAudit, Nt as TextEdit, O as ApplyVoiceoverInput, Ot as RelationValues, P as DslTransaction, Pt as TextMark, Q as ReplaceDslClipsInput, R as InvalidAtomic, Rt as Track, S as DslLayout, St as FieldPatch, T as createInitialMedeoDsl, Tt as RelationMutation, U as MedeoDslLoroState, V as timeAnchorCodec, W as medeoDslLoroShape, X as DslClipUpdate, Y as ClipSource, Z as MoveDslClipsInput, _ as VideoDraftTimeline, _t as DslMutation, a as toAudioScriptViews, at as tupleHash, b as resolveDslLayout, bt as EntityTables, c as CaptionDisplayCue, ct as CaptionContent, d as VideoDraft, dt as CaptionText, et as DslIdFactory, f as VideoDraftCaptionStyle, ft as Clip, g as VideoDraftPartUnion, gt as DslDiagnostic, h as VideoDraftInput, ht as DeepReadonly, i as AudioScriptView, it as resourceId, j as CreateMedeoDslOptions, jt as StoredFile, k as VoiceoverCaptionInput, kt as ResourceSystem, l as DEFAULT_UNIT_TIME_MS, lt as CaptionSelection, m as VideoDraftContentPartUnion, mt as ContainNode, n as ImportedVideoDraft, nt as defaultIdFactory, o as VideoDraftProjection, ot as AudioScript, p as VideoDraftContent, pt as ContainMutation, q as AddDslClip, r as fromVideoDraft, rt as relationId, s as toVideoDraft, st as Caption, t as FromVideoDraftOptions, tt as EntityIdKind, u as VideoCreationSettings, ut as CaptionStyle, v as VideoDraftTrack, vt as EntityMutation, w as DslTrackLayout, wt as Media, x as DslClipLayout, xt as EntityValues, y as VideoDraftTrackItem, yt as EntityTable, z as captionContentCodec, zt as TrackRole } from "./index-
|
|
1
|
+
import { $ as ClipPlacement, A as VoiceoverResult, At as RichTextSnapshot, B as isInvalidAtomic, Bt as Voice, C as DslProjectionError, Ct as MedeoDslSnapshot, D as UploadText, Dt as RelationTables, E as DslEditor, Et as RelationTable, F as UnsupportedDocumentFormatError, Ft as TextMutation, G as CommitOptions, H as MedeoDslDraft, I as assertDslDocument, It as TextRun, J as AddDslClipsInput, K as OpActor, L as documentFormat, Lt as TimeAnchor, M as MedeoDsl, Mt as TextDelta, N as DslAudit, Nt as TextEdit, O as ApplyVoiceoverInput, Ot as RelationValues, P as DslTransaction, Pt as TextMark, Q as ReplaceDslClipsInput, R as InvalidAtomic, Rt as Track, S as DslLayout, St as FieldPatch, T as createInitialMedeoDsl, Tt as RelationMutation, U as MedeoDslLoroState, V as timeAnchorCodec, W as medeoDslLoroShape, X as DslClipUpdate, Y as ClipSource, Z as MoveDslClipsInput, _ as VideoDraftTimeline, _t as DslMutation, a as toAudioScriptViews, at as tupleHash, b as resolveDslLayout, bt as EntityTables, c as CaptionDisplayCue, ct as CaptionContent, d as VideoDraft, dt as CaptionText, et as DslIdFactory, f as VideoDraftCaptionStyle, ft as Clip, g as VideoDraftPartUnion, gt as DslDiagnostic, h as VideoDraftInput, ht as DeepReadonly, i as AudioScriptView, it as resourceId, j as CreateMedeoDslOptions, jt as StoredFile, k as VoiceoverCaptionInput, kt as ResourceSystem, l as DEFAULT_UNIT_TIME_MS, lt as CaptionSelection, m as VideoDraftContentPartUnion, mt as ContainNode, n as ImportedVideoDraft, nt as defaultIdFactory, o as VideoDraftProjection, ot as AudioScript, p as VideoDraftContent, pt as ContainMutation, q as AddDslClip, r as fromVideoDraft, rt as relationId, s as toVideoDraft, st as Caption, t as FromVideoDraftOptions, tt as EntityIdKind, u as VideoCreationSettings, ut as CaptionStyle, v as VideoDraftTrack, vt as EntityMutation, w as DslTrackLayout, wt as Media, x as DslClipLayout, xt as EntityValues, y as VideoDraftTrackItem, yt as EntityTable, z as captionContentCodec, zt as TrackRole } from "./index-rW40K2LR.js";
|
|
2
2
|
export { type AddDslClip, type AddDslClipsInput, type ApplyVoiceoverInput, type AudioScript, type AudioScriptView, type Caption, type CaptionContent, type CaptionDisplayCue, type CaptionSelection, type CaptionStyle, type CaptionText, type Clip, type ClipPlacement, type ClipSource, type CommitOptions, type ContainMutation, type ContainNode, type CreateMedeoDslOptions, DEFAULT_UNIT_TIME_MS, type DeepReadonly, type DslAudit, type DslClipLayout, type DslClipUpdate, type DslDiagnostic, DslEditor, type DslIdFactory, type DslLayout, type DslMutation, DslProjectionError, type DslTrackLayout, type DslTransaction, type EntityIdKind, type EntityMutation, type EntityTable, type EntityTables, type EntityValues, type FieldPatch, type FromVideoDraftOptions, type ImportedVideoDraft, type InvalidAtomic, MedeoDsl, type MedeoDslDraft, type MedeoDslLoroState, type MedeoDslSnapshot, type Media, type MoveDslClipsInput, type OpActor, type RelationMutation, type RelationTable, type RelationTables, type RelationValues, type ReplaceDslClipsInput, type ResourceSystem, type RichTextSnapshot, type StoredFile, type TextDelta, type TextEdit, type TextMark, type TextMutation, type TextRun, type TimeAnchor, type Track, type TrackRole, UnsupportedDocumentFormatError, type UploadText, type VideoCreationSettings, type VideoDraft, type VideoDraftCaptionStyle, type VideoDraftContent, type VideoDraftContentPartUnion, type VideoDraftInput, type VideoDraftPartUnion, type VideoDraftProjection, type VideoDraftTimeline, type VideoDraftTrack, type VideoDraftTrackItem, type Voice, type VoiceoverCaptionInput, type VoiceoverResult, assertDslDocument, captionContentCodec, createInitialMedeoDsl, defaultIdFactory, documentFormat, fromVideoDraft, isInvalidAtomic, medeoDslLoroShape, relationId, resolveDslLayout, resourceId, timeAnchorCodec, toAudioScriptViews, toVideoDraft, tupleHash };
|
package/dist/dsl.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as
|
|
1
|
+
import { _ as DslProjectionError, a as DslEditor, b as resourceId, c as UnsupportedDocumentFormatError, d as documentFormat, f as medeoDslLoroShape, g as resolveDslLayout, h as timeAnchorCodec, i as createInitialMedeoDsl, l as assertDslDocument, m as isInvalidAtomic, n as toVideoDraft, o as toAudioScriptViews, p as captionContentCodec, r as DEFAULT_UNIT_TIME_MS, s as MedeoDsl, t as fromVideoDraft, v as defaultIdFactory, x as tupleHash, y as relationId } from "./dsl-BSX7hMcR.js";
|
|
2
2
|
export { DEFAULT_UNIT_TIME_MS, DslEditor, DslProjectionError, MedeoDsl, UnsupportedDocumentFormatError, assertDslDocument, captionContentCodec, createInitialMedeoDsl, defaultIdFactory, documentFormat, fromVideoDraft, isInvalidAtomic, medeoDslLoroShape, relationId, resolveDslLayout, resourceId, timeAnchorCodec, toAudioScriptViews, toVideoDraft, tupleHash };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Ct as MedeoDslSnapshot, D as UploadText, E as DslEditor, G as CommitOptions, M as MedeoDsl, gt as DslDiagnostic, i as AudioScriptView, kt as ResourceSystem, o as VideoDraftProjection, p as VideoDraftContent, zt as TrackRole } from "./index-
|
|
1
|
+
import { Ct as MedeoDslSnapshot, D as UploadText, E as DslEditor, G as CommitOptions, M as MedeoDsl, gt as DslDiagnostic, i as AudioScriptView, kt as ResourceSystem, o as VideoDraftProjection, p as VideoDraftContent, zt as TrackRole } from "./index-rW40K2LR.js";
|
|
2
2
|
import { LoroDoc, PeerID, VersionVector } from "loro-crdt";
|
|
3
3
|
import { DocState, LocalSaveState } from "@mengine/sync";
|
|
4
4
|
import { BaseDocStorage, Connection, DocDiff, DocPushReceipt, DocSnapshotRecord, DocStorage, DocStorageOptions, DocUpdate, DocUpdateRecord } from "@mengine/storage";
|
|
@@ -255,7 +255,7 @@ type PushResultKind = 'ack' | 'duplicate' | 'rejected' | 'failed' | 'nothing_to_
|
|
|
255
255
|
*/
|
|
256
256
|
interface PushResult {
|
|
257
257
|
kind: PushResultKind;
|
|
258
|
-
/** Server
|
|
258
|
+
/** Server sequence from an `ack`/`duplicate`, retained on an idle retry so its revision can be verified. */
|
|
259
259
|
mengineUpdateSeq?: number | undefined;
|
|
260
260
|
/** @deprecated Ack-only sequence retained until consumers adopt `mengineUpdateSeq`. */
|
|
261
261
|
updateSeq?: number | undefined;
|
|
@@ -301,10 +301,12 @@ interface ManualSyncDocOptions {
|
|
|
301
301
|
}
|
|
302
302
|
/** Shared explicit pull/push lifecycle; model-specific editors never implement transport. */
|
|
303
303
|
declare class ManualSyncTransport {
|
|
304
|
-
|
|
304
|
+
protected readonly client: MengineHttpClient;
|
|
305
305
|
protected readonly doc: LoroDoc;
|
|
306
306
|
private watermark;
|
|
307
307
|
private disposed;
|
|
308
|
+
/** A retry with no new bytes still verifies the revision from its last durable receipt. */
|
|
309
|
+
private confirmedSequence?;
|
|
308
310
|
protected constructor(client: MengineHttpClient, doc: LoroDoc, watermark: VersionVector);
|
|
309
311
|
editorPeerId(): PeerID;
|
|
310
312
|
protected assertActive(): void;
|
|
@@ -538,6 +540,8 @@ declare class ManualSyncDoc extends ManualSyncTransport {
|
|
|
538
540
|
}[];
|
|
539
541
|
};
|
|
540
542
|
projectVideoDraft(): VideoDraftProjection;
|
|
543
|
+
/** Read the acknowledged server revision; without a new push, confirm against the current server view. */
|
|
544
|
+
readPersistedDraft(updateSeq?: number): Promise<MengineDraftResponse>;
|
|
541
545
|
dispose(): void;
|
|
542
546
|
}
|
|
543
547
|
//#endregion
|
|
@@ -404,7 +404,7 @@ interface CommitOptions {
|
|
|
404
404
|
actor?: OpActor;
|
|
405
405
|
}
|
|
406
406
|
//#endregion
|
|
407
|
-
//#region ../../node_modules/.pnpm/loro-mirror@2.3.3_patch_hash=a551a0e4aa4f61ec88b0d9e970a183b5ee2955107a2e0bb03b378bc510c2f395_loro-crdt@1.16.
|
|
407
|
+
//#region ../../node_modules/.pnpm/loro-mirror@2.3.3_patch_hash=a551a0e4aa4f61ec88b0d9e970a183b5ee2955107a2e0bb03b378bc510c2f395_loro-crdt@1.16.1/node_modules/loro-mirror/dist/schema/types.d.ts
|
|
408
408
|
/**
|
|
409
409
|
* Options for schema definitions
|
|
410
410
|
*/
|
|
@@ -829,20 +829,12 @@ declare const medeoDslLoroShape: RootSchemaType<{
|
|
|
829
829
|
options: {};
|
|
830
830
|
};
|
|
831
831
|
'phonetic-script-entities': LoroMapSchemaWithCatchall<{}, LoroMapSchema<{
|
|
832
|
-
|
|
833
|
-
system: /*elided*/any;
|
|
834
|
-
key: /*elided*/any;
|
|
835
|
-
storageKey: /*elided*/any;
|
|
836
|
-
digest: /*elided*/any;
|
|
832
|
+
binding: /*elided*/any;
|
|
837
833
|
}> & {
|
|
838
834
|
options: {};
|
|
839
835
|
} & {
|
|
840
836
|
catchall: <C extends SchemaType>(catchallSchema: C) => LoroMapSchemaWithCatchall<{
|
|
841
|
-
|
|
842
|
-
system: /*elided*/any;
|
|
843
|
-
key: /*elided*/any;
|
|
844
|
-
storageKey: /*elided*/any;
|
|
845
|
-
digest: /*elided*/any;
|
|
837
|
+
binding: /*elided*/any;
|
|
846
838
|
}, C>;
|
|
847
839
|
}> & {
|
|
848
840
|
options: {};
|
|
@@ -935,8 +927,9 @@ type ContainDraftNode = Omit<Input['contain-relations'][number], 'id' | 'childre
|
|
|
935
927
|
children: ContainDraftNode[];
|
|
936
928
|
};
|
|
937
929
|
type DraftFields<T> = T extends Cursor ? T : T extends (infer Item)[] ? DraftFields<Item>[] : T extends object ? { [K in keyof T as undefined extends T[K] ? never : K]: DraftFields<T[K]> } & { [K in keyof T as undefined extends T[K] ? K : never]?: DraftFields<T[K]> } : T;
|
|
938
|
-
type MedeoDslDraft = DraftFields<Omit<Input, 'contain-relations'>> & {
|
|
930
|
+
type MedeoDslDraft = DraftFields<Omit<Input, 'contain-relations' | 'phonetic-script-entities'>> & {
|
|
939
931
|
'contain-relations': ContainDraftNode[];
|
|
932
|
+
'phonetic-script-entities': Record<string, PhoneticScript>;
|
|
940
933
|
};
|
|
941
934
|
//#endregion
|
|
942
935
|
//#region ../medeo-dsl/src/schema/codec.d.ts
|
|
@@ -960,7 +953,7 @@ declare const captionContentCodec: AtomicCodec<SegmentSelection>;
|
|
|
960
953
|
declare function documentFormat(doc: LoroDoc): 'dsl' | 'legacy' | 'mixed' | 'unknown';
|
|
961
954
|
declare class UnsupportedDocumentFormatError extends Error {
|
|
962
955
|
readonly code = "unsupported_document_format";
|
|
963
|
-
constructor();
|
|
956
|
+
constructor(message?: string);
|
|
964
957
|
}
|
|
965
958
|
/** Run after initial import, before opening an editable handle. Empty new documents still have one Timeline. */
|
|
966
959
|
declare function assertDslDocument(doc: LoroDoc): void;
|
|
@@ -1037,6 +1030,8 @@ declare class MedeoDsl {
|
|
|
1037
1030
|
applyMutations(mutations: readonly DslMutation[], audit: DslAudit): void;
|
|
1038
1031
|
editText(scriptId: string, segmentId: string, expectedBodyId: string, edits: readonly TextEdit[], audit: DslAudit): void;
|
|
1039
1032
|
editCaptionText(captionId: string, expectedBodyId: string, edits: readonly TextEdit[], audit: DslAudit): void;
|
|
1033
|
+
/** Check the session's write capability before an Action starts host-owned resource I/O. */
|
|
1034
|
+
assertWritable(): void;
|
|
1040
1035
|
/**
|
|
1041
1036
|
* A run inside one segment as native Cursors. Local ranges exclude insertions at their start and
|
|
1042
1037
|
* include insertions at their end. K01 remains deferred.
|
|
@@ -1044,6 +1039,7 @@ declare class MedeoDsl {
|
|
|
1044
1039
|
textRange(scriptId: string, segmentId: string, start: number, end: number): SegmentSelection;
|
|
1045
1040
|
dispose(): void;
|
|
1046
1041
|
private mutate;
|
|
1042
|
+
private assertReadyToWrite;
|
|
1047
1043
|
private notify;
|
|
1048
1044
|
private assertActive;
|
|
1049
1045
|
}
|
|
@@ -1072,9 +1068,9 @@ interface ApplyVoiceoverInput {
|
|
|
1072
1068
|
kind: 'voiceover-recording';
|
|
1073
1069
|
};
|
|
1074
1070
|
/**
|
|
1075
|
-
* What the recording says:
|
|
1076
|
-
*
|
|
1077
|
-
*
|
|
1071
|
+
* What the recording says: a PhoneticScript it was spoken from, or plain words from an existing
|
|
1072
|
+
* or new AudioScript. Plain words get selection-only PhoneticScripts (D190), one per segment;
|
|
1073
|
+
* no control content, file or digest is invented. Captions keep selecting the base script.
|
|
1078
1074
|
*/
|
|
1079
1075
|
script: {
|
|
1080
1076
|
audioScriptId: string;
|
|
@@ -1816,8 +1812,9 @@ interface AudioScriptView {
|
|
|
1816
1812
|
/** Speech Clips playing a recording of these words. */
|
|
1817
1813
|
speeches: {
|
|
1818
1814
|
clipId: string;
|
|
1819
|
-
recordingId: string; /**
|
|
1820
|
-
phoneticScriptId?: string;
|
|
1815
|
+
recordingId: string; /** Its single phonetic origin; omitted for multiple origins or an old direct script origin. */
|
|
1816
|
+
phoneticScriptId?: string; /** Multiple segment selections used by one recording, without duplicating its Clip. */
|
|
1817
|
+
phoneticScriptIds?: string[];
|
|
1821
1818
|
voices: {
|
|
1822
1819
|
voiceId: string;
|
|
1823
1820
|
key: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as ClipPlacement, A as VoiceoverResult, At as RichTextSnapshot, B as isInvalidAtomic, Bt as Voice, C as DslProjectionError, Ct as MedeoDslSnapshot, D as UploadText, Dt as RelationTables, E as DslEditor, Et as RelationTable, F as UnsupportedDocumentFormatError, Ft as TextMutation, G as CommitOptions, H as MedeoDslDraft, I as assertDslDocument, It as TextRun, J as AddDslClipsInput, K as OpActor, L as documentFormat, Lt as TimeAnchor, M as MedeoDsl, Mt as TextDelta, N as DslAudit, Nt as TextEdit, O as ApplyVoiceoverInput, Ot as RelationValues, P as DslTransaction, Pt as TextMark, Q as ReplaceDslClipsInput, R as InvalidAtomic, Rt as Track, S as DslLayout, St as FieldPatch, T as createInitialMedeoDsl, Tt as RelationMutation, U as MedeoDslLoroState, V as timeAnchorCodec, W as medeoDslLoroShape, X as DslClipUpdate, Y as ClipSource, Z as MoveDslClipsInput, _ as VideoDraftTimeline, _t as DslMutation, a as toAudioScriptViews, at as tupleHash, b as resolveDslLayout, bt as EntityTables, c as CaptionDisplayCue, ct as CaptionContent, d as VideoDraft, dt as CaptionText, et as DslIdFactory, f as VideoDraftCaptionStyle, ft as Clip, g as VideoDraftPartUnion, gt as DslDiagnostic, h as VideoDraftInput, ht as DeepReadonly, i as AudioScriptView, it as resourceId, j as CreateMedeoDslOptions, jt as StoredFile, k as VoiceoverCaptionInput, kt as ResourceSystem, l as DEFAULT_UNIT_TIME_MS, lt as CaptionSelection, m as VideoDraftContentPartUnion, mt as ContainNode, n as ImportedVideoDraft, nt as defaultIdFactory, o as VideoDraftProjection, ot as AudioScript, p as VideoDraftContent, pt as ContainMutation, q as AddDslClip, r as fromVideoDraft, rt as relationId, s as toVideoDraft, st as Caption, t as FromVideoDraftOptions, tt as EntityIdKind, u as VideoCreationSettings, ut as CaptionStyle, v as VideoDraftTrack, vt as EntityMutation, w as DslTrackLayout, wt as Media, x as DslClipLayout, xt as EntityValues, y as VideoDraftTrackItem, yt as EntityTable, z as captionContentCodec, zt as TrackRole } from "./index-
|
|
2
|
-
import { A as MenginePushRejectedError, B as MengineSyncResponse, C as PushResult, D as MengineHttpClient, E as readMengineEventStream, F as MenginePushResponse, H as base64ToBytes, I as MenginePushUpdateResponse, L as MengineRejectedResponse, M as MengineAuditResponse, N as MengineDocumentVersion, O as MengineHttpClientOptions, P as MengineDraftResponse, R as MengineSnapshotResponse, S as PullResult, T as MengineEventStreamOptions, U as bytesToBase64, V as MengineUpdateMeta, _ as ManualSyncDocOptions, a as MengineDocSessionOptions, b as DocVersionMark, c as WaitForLocalSaveOptions, d as MengineUndoState, f as MedeoHttpDocStorage, g as ManualSyncDoc, h as PushOutcomeKind, i as MengineAckFailedError, j as MengineAuditEntry, k as MengineHttpRequestError, l as WaitForServerAckOptions, m as PushOutcome, n as MengineDocSession, o as MengineDocSyncState, p as MedeoHttpDocStorageOptions, r as MengineDocSessionUpdateEvent, s as MengineLocalSaveState, t as MemoryDocStorage, u as DocStorageLike, v as decodeDocVersionMark, w as PushResultKind, x as PullFailureReason, y as encodeDocVersionMark, z as MengineSseUpdateEvent } from "./index-
|
|
1
|
+
import { $ as ClipPlacement, A as VoiceoverResult, At as RichTextSnapshot, B as isInvalidAtomic, Bt as Voice, C as DslProjectionError, Ct as MedeoDslSnapshot, D as UploadText, Dt as RelationTables, E as DslEditor, Et as RelationTable, F as UnsupportedDocumentFormatError, Ft as TextMutation, G as CommitOptions, H as MedeoDslDraft, I as assertDslDocument, It as TextRun, J as AddDslClipsInput, K as OpActor, L as documentFormat, Lt as TimeAnchor, M as MedeoDsl, Mt as TextDelta, N as DslAudit, Nt as TextEdit, O as ApplyVoiceoverInput, Ot as RelationValues, P as DslTransaction, Pt as TextMark, Q as ReplaceDslClipsInput, R as InvalidAtomic, Rt as Track, S as DslLayout, St as FieldPatch, T as createInitialMedeoDsl, Tt as RelationMutation, U as MedeoDslLoroState, V as timeAnchorCodec, W as medeoDslLoroShape, X as DslClipUpdate, Y as ClipSource, Z as MoveDslClipsInput, _ as VideoDraftTimeline, _t as DslMutation, a as toAudioScriptViews, at as tupleHash, b as resolveDslLayout, bt as EntityTables, c as CaptionDisplayCue, ct as CaptionContent, d as VideoDraft, dt as CaptionText, et as DslIdFactory, f as VideoDraftCaptionStyle, ft as Clip, g as VideoDraftPartUnion, gt as DslDiagnostic, h as VideoDraftInput, ht as DeepReadonly, i as AudioScriptView, it as resourceId, j as CreateMedeoDslOptions, jt as StoredFile, k as VoiceoverCaptionInput, kt as ResourceSystem, l as DEFAULT_UNIT_TIME_MS, lt as CaptionSelection, m as VideoDraftContentPartUnion, mt as ContainNode, n as ImportedVideoDraft, nt as defaultIdFactory, o as VideoDraftProjection, ot as AudioScript, p as VideoDraftContent, pt as ContainMutation, q as AddDslClip, r as fromVideoDraft, rt as relationId, s as toVideoDraft, st as Caption, t as FromVideoDraftOptions, tt as EntityIdKind, u as VideoCreationSettings, ut as CaptionStyle, v as VideoDraftTrack, vt as EntityMutation, w as DslTrackLayout, wt as Media, x as DslClipLayout, xt as EntityValues, y as VideoDraftTrackItem, yt as EntityTable, z as captionContentCodec, zt as TrackRole } from "./index-rW40K2LR.js";
|
|
2
|
+
import { A as MenginePushRejectedError, B as MengineSyncResponse, C as PushResult, D as MengineHttpClient, E as readMengineEventStream, F as MenginePushResponse, H as base64ToBytes, I as MenginePushUpdateResponse, L as MengineRejectedResponse, M as MengineAuditResponse, N as MengineDocumentVersion, O as MengineHttpClientOptions, P as MengineDraftResponse, R as MengineSnapshotResponse, S as PullResult, T as MengineEventStreamOptions, U as bytesToBase64, V as MengineUpdateMeta, _ as ManualSyncDocOptions, a as MengineDocSessionOptions, b as DocVersionMark, c as WaitForLocalSaveOptions, d as MengineUndoState, f as MedeoHttpDocStorage, g as ManualSyncDoc, h as PushOutcomeKind, i as MengineAckFailedError, j as MengineAuditEntry, k as MengineHttpRequestError, l as WaitForServerAckOptions, m as PushOutcome, n as MengineDocSession, o as MengineDocSyncState, p as MedeoHttpDocStorageOptions, r as MengineDocSessionUpdateEvent, s as MengineLocalSaveState, t as MemoryDocStorage, u as DocStorageLike, v as decodeDocVersionMark, w as PushResultKind, x as PullFailureReason, y as encodeDocVersionMark, z as MengineSseUpdateEvent } from "./index-D1ZC5V8t.js";
|
|
3
3
|
export { type AddDslClip, type AddDslClipsInput, type ApplyVoiceoverInput, type AudioScript, type AudioScriptView, type Caption, type CaptionContent, type CaptionDisplayCue, type CaptionSelection, type CaptionStyle, type CaptionText, type Clip, type ClipPlacement, type ClipSource, type CommitOptions, type ContainMutation, type ContainNode, type CreateMedeoDslOptions, DEFAULT_UNIT_TIME_MS, type DeepReadonly, type DocStorageLike, type DocVersionMark, type DslAudit, type DslClipLayout, type DslClipUpdate, type DslDiagnostic, DslEditor, type DslIdFactory, type DslLayout, type DslMutation, DslProjectionError, type DslTrackLayout, type DslTransaction, type EntityIdKind, type EntityMutation, type EntityTable, type EntityTables, type EntityValues, type FieldPatch, type FromVideoDraftOptions, type ImportedVideoDraft, type InvalidAtomic, ManualSyncDoc, type ManualSyncDocOptions, MedeoDsl, type MedeoDslDraft, type MedeoDslLoroState, type MedeoDslSnapshot, MedeoHttpDocStorage, type MedeoHttpDocStorageOptions, type Media, MemoryDocStorage, MengineAckFailedError, type MengineAuditEntry, type MengineAuditResponse, MengineDocSession, type MengineDocSessionOptions, type MengineDocSessionUpdateEvent, type MengineDocSyncState, type MengineDocumentVersion, type MengineDraftResponse, 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, type MoveDslClipsInput, type OpActor, type PullFailureReason, type PullResult, type PushOutcome, type PushOutcomeKind, type PushResult, type PushResultKind, type RelationMutation, type RelationTable, type RelationTables, type RelationValues, type ReplaceDslClipsInput, type ResourceSystem, type RichTextSnapshot, type StoredFile, type TextDelta, type TextEdit, type TextMark, type TextMutation, type TextRun, type TimeAnchor, type Track, type TrackRole, UnsupportedDocumentFormatError, type UploadText, type VideoCreationSettings, type VideoDraft, type VideoDraftCaptionStyle, type VideoDraftContent, type VideoDraftContentPartUnion, type VideoDraftInput, type VideoDraftPartUnion, type VideoDraftProjection, type VideoDraftTimeline, type VideoDraftTrack, type VideoDraftTrackItem, type Voice, type VoiceoverCaptionInput, type VoiceoverResult, type WaitForLocalSaveOptions, type WaitForServerAckOptions, assertDslDocument, base64ToBytes, bytesToBase64, captionContentCodec, createInitialMedeoDsl, decodeDocVersionMark, defaultIdFactory, documentFormat, encodeDocVersionMark, fromVideoDraft, isInvalidAtomic, medeoDslLoroShape, readMengineEventStream, relationId, resolveDslLayout, resourceId, timeAnchorCodec, toAudioScriptViews, toVideoDraft, tupleHash };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as bytesToBase64, t as base64ToBytes } from "./base64-D-jd-dr5.js";
|
|
2
|
-
import { _ as
|
|
2
|
+
import { _ as DslProjectionError, a as DslEditor, b as resourceId, c as UnsupportedDocumentFormatError, d as documentFormat, f as medeoDslLoroShape, g as resolveDslLayout, h as timeAnchorCodec, i as createInitialMedeoDsl, l as assertDslDocument, m as isInvalidAtomic, n as toVideoDraft, o as toAudioScriptViews, p as captionContentCodec, r as DEFAULT_UNIT_TIME_MS, s as MedeoDsl, t as fromVideoDraft, v as defaultIdFactory, x as tupleHash, y as relationId } from "./dsl-BSX7hMcR.js";
|
|
3
3
|
import { LoroDoc, UndoManager, VersionVector, decodeImportBlobMeta } from "loro-crdt";
|
|
4
4
|
import { ClientServerSynchronizer, DocManager } from "@mengine/sync";
|
|
5
5
|
import { DisposableSet, EventBus, Task } from "@mengine/utils";
|
|
@@ -295,6 +295,8 @@ var ManualSyncTransport = class {
|
|
|
295
295
|
doc;
|
|
296
296
|
watermark;
|
|
297
297
|
disposed = false;
|
|
298
|
+
/** A retry with no new bytes still verifies the revision from its last durable receipt. */
|
|
299
|
+
confirmedSequence;
|
|
298
300
|
constructor(client, doc, watermark) {
|
|
299
301
|
this.client = client;
|
|
300
302
|
this.doc = doc;
|
|
@@ -397,7 +399,8 @@ var ManualSyncTransport = class {
|
|
|
397
399
|
const localVersion = this.doc.oplogVersion();
|
|
398
400
|
if (covers(this.watermark, localVersion)) return {
|
|
399
401
|
kind: "nothing_to_push",
|
|
400
|
-
collaborated: false
|
|
402
|
+
collaborated: false,
|
|
403
|
+
...this.confirmedSequence === void 0 ? {} : { mengineUpdateSeq: this.confirmedSequence }
|
|
401
404
|
};
|
|
402
405
|
const update = this.doc.export({
|
|
403
406
|
mode: "update",
|
|
@@ -407,6 +410,7 @@ var ManualSyncTransport = class {
|
|
|
407
410
|
const response = await this.client.pushUpdate(update);
|
|
408
411
|
const serverVV = this.serverVVFrom(response.version?.server_vv);
|
|
409
412
|
if (serverVV != null) this.watermark = serverVV;
|
|
413
|
+
this.confirmedSequence = response.version?.update_seq ?? response.update_seq ?? void 0;
|
|
410
414
|
return {
|
|
411
415
|
kind: response.kind,
|
|
412
416
|
mengineUpdateSeq: response.version?.update_seq ?? response.update_seq ?? void 0,
|
|
@@ -473,6 +477,15 @@ var ManualSyncDoc = class ManualSyncDoc extends ManualSyncTransport {
|
|
|
473
477
|
projectVideoDraft() {
|
|
474
478
|
return toVideoDraft(this.snapshot());
|
|
475
479
|
}
|
|
480
|
+
/** Read the acknowledged server revision; without a new push, confirm against the current server view. */
|
|
481
|
+
async readPersistedDraft(updateSeq) {
|
|
482
|
+
this.assertActive();
|
|
483
|
+
const result = updateSeq === void 0 ? await this.client.fetchDraft() : await this.client.fetchDraftAt(updateSeq);
|
|
484
|
+
this.assertActive();
|
|
485
|
+
if (updateSeq !== void 0 && result.version.update_seq !== updateSeq) throw new Error("The projected revision does not match the push receipt");
|
|
486
|
+
if (!covers(VersionVector.decode(base64ToBytes(result.version.server_vv)), this.doc.oplogVersion())) throw new Error("The projected server revision does not hold the local update");
|
|
487
|
+
return result;
|
|
488
|
+
}
|
|
476
489
|
dispose() {
|
|
477
490
|
this.dsl.dispose();
|
|
478
491
|
super.dispose();
|