@mengine/medeo-client 3.0.0 → 3.0.1-caption-source.0
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-96AZnd7O.js} +326 -89
- package/dist/dsl.d.ts +2 -2
- package/dist/dsl.js +2 -2
- package/dist/{index-DuM7I4Ku.d.ts → index-C1iiDt_Q.d.ts} +28 -18
- package/dist/{index-Dldi944U.d.ts → index-CSjqNIoR.d.ts} +7 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +16 -3
- 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 +8 -6
package/dist/dsl.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
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 };
|
|
1
|
+
import { $ as MoveDslClipsInput, A as ApplyVoiceoverInput, At as RelationValues, B as InvalidAtomic, Bt as Track, C as DslClipLayout, Ct as EntityValues, D as createInitialMedeoDsl, Dt as RelationMutation, E as DslTrackLayout, Et as Media, F as DslAudit, Ft as TextEdit, G as MedeoDslLoroState, H as isInvalidAtomic, Ht as Voice, I as DslTransaction, It as TextMark, J as OpActor, K as medeoDslLoroShape, L as UnsupportedDocumentFormatError, Lt as TextMutation, M as VoiceoverResult, Mt as RichTextSnapshot, N as CreateMedeoDslOptions, Nt as StoredFile, O as DslEditor, Ot as RelationTable, P as MedeoDsl, Pt as TextDelta, Q as DslClipUpdate, R as assertDslDocument, Rt as TextRun, S as resolveDslLayout, St as EntityTables, T as DslProjectionError, Tt as MedeoDslSnapshot, U as timeAnchorCodec, V as captionContentCodec, Vt as TrackRole, W as MedeoDslDraft, X as AddDslClipsInput, Y as AddDslClip, Z as ClipSource, _ as VideoDraftInput, _t as DeepReadonly, a as SpokenScript, at as relationId, b as VideoDraftTrack, bt as EntityMutation, c as VideoDraftProjection, ct as AudioScript, d as DEFAULT_UNIT_TIME_MS, dt as CaptionSelection, et as ReplaceDslClipsInput, f as VideoCreationSettings, ft as CaptionStyle, g as VideoDraftContentPartUnion, gt as ContainNode, h as VideoDraftContent, ht as ContainMutation, i as AudioScriptView, it as defaultIdFactory, j as VoiceoverCaptionInput, jt as ResourceSystem, k as UploadText, kt as RelationTables, l as toVideoDraft, lt as Caption, m as VideoDraftCaptionStyle, mt as Clip, n as ImportedVideoDraft, nt as DslIdFactory, o as spokenScripts, ot as resourceId, p as VideoDraft, pt as CaptionText, q as CommitOptions, r as fromVideoDraft, rt as EntityIdKind, s as toAudioScriptViews, st as tupleHash, t as FromVideoDraftOptions, tt as ClipPlacement, u as CaptionDisplayCue, ut as CaptionContent, v as VideoDraftPartUnion, vt as DslDiagnostic, w as DslLayout, wt as FieldPatch, x as VideoDraftTrackItem, xt as EntityTable, y as VideoDraftTimeline, yt as DslMutation, z as documentFormat, zt as TimeAnchor } from "./index-C1iiDt_Q.js";
|
|
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 SpokenScript, 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, spokenScripts, timeAnchorCodec, toAudioScriptViews, toVideoDraft, tupleHash };
|
package/dist/dsl.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as
|
|
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
|
+
import { S as tupleHash, _ as resolveDslLayout, a as DslEditor, b as relationId, c as MedeoDsl, f as documentFormat, g as timeAnchorCodec, h as isInvalidAtomic, i as createInitialMedeoDsl, l as UnsupportedDocumentFormatError, m as captionContentCodec, n as toVideoDraft, o as spokenScripts, p as medeoDslLoroShape, r as DEFAULT_UNIT_TIME_MS, s as toAudioScriptViews, t as fromVideoDraft, u as assertDslDocument, v as DslProjectionError, x as resourceId, y as defaultIdFactory } from "./dsl-96AZnd7O.js";
|
|
2
|
+
export { DEFAULT_UNIT_TIME_MS, DslEditor, DslProjectionError, MedeoDsl, UnsupportedDocumentFormatError, assertDslDocument, captionContentCodec, createInitialMedeoDsl, defaultIdFactory, documentFormat, fromVideoDraft, isInvalidAtomic, medeoDslLoroShape, relationId, resolveDslLayout, resourceId, spokenScripts, timeAnchorCodec, toAudioScriptViews, toVideoDraft, tupleHash };
|
|
@@ -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;
|
|
@@ -1781,6 +1777,13 @@ interface VideoDraftProjection {
|
|
|
1781
1777
|
declare function toVideoDraft(snapshot: MedeoDslSnapshot): VideoDraftProjection;
|
|
1782
1778
|
//#endregion
|
|
1783
1779
|
//#region src/dsl/projection/audio-scripts.d.ts
|
|
1780
|
+
/** The script a recording says and its phonetic origins; old direct script origins remain readable. */
|
|
1781
|
+
interface SpokenScript {
|
|
1782
|
+
audioScriptId: string;
|
|
1783
|
+
phoneticScriptId?: string;
|
|
1784
|
+
/** Several plain selections of the same script; the singular summary is omitted. */
|
|
1785
|
+
phoneticScriptIds?: string[];
|
|
1786
|
+
}
|
|
1784
1787
|
/**
|
|
1785
1788
|
* An AudioScript with everything that says or shows it, read from the same snapshot as the
|
|
1786
1789
|
* VideoDraft. Speeches and captions come in playback order.
|
|
@@ -1816,8 +1819,9 @@ interface AudioScriptView {
|
|
|
1816
1819
|
/** Speech Clips playing a recording of these words. */
|
|
1817
1820
|
speeches: {
|
|
1818
1821
|
clipId: string;
|
|
1819
|
-
recordingId: string; /**
|
|
1820
|
-
phoneticScriptId?: string;
|
|
1822
|
+
recordingId: string; /** Its single phonetic origin; omitted for multiple origins or an old direct script origin. */
|
|
1823
|
+
phoneticScriptId?: string; /** Multiple segment selections used by one recording, without duplicating its Clip. */
|
|
1824
|
+
phoneticScriptIds?: string[];
|
|
1821
1825
|
voices: {
|
|
1822
1826
|
voiceId: string;
|
|
1823
1827
|
key: string;
|
|
@@ -1836,6 +1840,12 @@ interface AudioScriptView {
|
|
|
1836
1840
|
segment: number;
|
|
1837
1841
|
}[];
|
|
1838
1842
|
}
|
|
1843
|
+
/**
|
|
1844
|
+
* The scripts a recording says. It follows derived-from from the recording; a PhoneticScript is a
|
|
1845
|
+
* variant, so its words are the base its phoneme names, and derived-from is not followed past it.
|
|
1846
|
+
* When nothing is found that way, a script read off the recording itself is what it says.
|
|
1847
|
+
*/
|
|
1848
|
+
declare function spokenScripts(snapshot: MedeoDslSnapshot, recordingId: string): SpokenScript[];
|
|
1839
1849
|
/** Every AudioScript in the document with its PhoneticScripts, the Speech Clips saying it and the Caption Clips showing it. */
|
|
1840
1850
|
declare function toAudioScriptViews(snapshot: MedeoDslSnapshot): AudioScriptView[];
|
|
1841
1851
|
//#endregion
|
|
@@ -1852,4 +1862,4 @@ interface ImportedVideoDraft {
|
|
|
1852
1862
|
/** One-time import into a newly owned document; never reverse-diff a live collaborative document. */
|
|
1853
1863
|
declare function fromVideoDraft(input: VideoDraftInput, options: FromVideoDraftOptions): ImportedVideoDraft;
|
|
1854
1864
|
//#endregion
|
|
1855
|
-
export {
|
|
1865
|
+
export { MoveDslClipsInput as $, ApplyVoiceoverInput as A, RelationValues as At, InvalidAtomic as B, Track$1 as Bt, DslClipLayout as C, EntityValues as Ct, createInitialMedeoDsl as D, RelationMutation as Dt, DslTrackLayout as E, Media as Et, DslAudit as F, TextEdit as Ft, MedeoDslLoroState as G, isInvalidAtomic as H, Voice as Ht, DslTransaction as I, TextMark as It, OpActor as J, medeoDslLoroShape as K, UnsupportedDocumentFormatError as L, TextMutation as Lt, VoiceoverResult as M, RichTextSnapshot as Mt, CreateMedeoDslOptions as N, StoredFile as Nt, DslEditor as O, RelationTable as Ot, MedeoDsl as P, TextDelta as Pt, DslClipUpdate as Q, assertDslDocument as R, TextRun as Rt, resolveDslLayout as S, EntityTables as St, DslProjectionError as T, MedeoDslSnapshot as Tt, timeAnchorCodec as U, captionContentCodec as V, TrackRole as Vt, MedeoDslDraft as W, AddDslClipsInput as X, AddDslClip as Y, ClipSource as Z, VideoDraftInput as _, DeepReadonly as _t, SpokenScript as a, relationId as at, VideoDraftTrack as b, EntityMutation as bt, VideoDraftProjection as c, AudioScript as ct, DEFAULT_UNIT_TIME_MS as d, CaptionSelection as dt, ReplaceDslClipsInput as et, VideoCreationSettings as f, CaptionStyle$1 as ft, VideoDraftContentPartUnion as g, ContainNode as gt, VideoDraftContent as h, ContainMutation as ht, AudioScriptView as i, defaultIdFactory as it, VoiceoverCaptionInput as j, ResourceSystem as jt, UploadText as k, RelationTables as kt, toVideoDraft as l, Caption as lt, VideoDraftCaptionStyle as m, Clip as mt, ImportedVideoDraft as n, DslIdFactory as nt, spokenScripts as o, resourceId as ot, VideoDraft as p, CaptionText as pt, CommitOptions as q, fromVideoDraft as r, EntityIdKind as rt, toAudioScriptViews as s, tupleHash as st, FromVideoDraftOptions as t, ClipPlacement as tt, CaptionDisplayCue as u, CaptionContent as ut, VideoDraftPartUnion as v, DslDiagnostic as vt, DslLayout as w, FieldPatch as wt, VideoDraftTrackItem as x, EntityTable as xt, VideoDraftTimeline as y, DslMutation as yt, documentFormat as z, TimeAnchor as zt };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { O as DslEditor, P as MedeoDsl, Tt as MedeoDslSnapshot, Vt as TrackRole, c as VideoDraftProjection, h as VideoDraftContent, i as AudioScriptView, jt as ResourceSystem, k as UploadText, q as CommitOptions, vt as DslDiagnostic } from "./index-C1iiDt_Q.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
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as
|
|
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-
|
|
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 };
|
|
1
|
+
import { $ as MoveDslClipsInput, A as ApplyVoiceoverInput, At as RelationValues, B as InvalidAtomic, Bt as Track, C as DslClipLayout, Ct as EntityValues, D as createInitialMedeoDsl, Dt as RelationMutation, E as DslTrackLayout, Et as Media, F as DslAudit, Ft as TextEdit, G as MedeoDslLoroState, H as isInvalidAtomic, Ht as Voice, I as DslTransaction, It as TextMark, J as OpActor, K as medeoDslLoroShape, L as UnsupportedDocumentFormatError, Lt as TextMutation, M as VoiceoverResult, Mt as RichTextSnapshot, N as CreateMedeoDslOptions, Nt as StoredFile, O as DslEditor, Ot as RelationTable, P as MedeoDsl, Pt as TextDelta, Q as DslClipUpdate, R as assertDslDocument, Rt as TextRun, S as resolveDslLayout, St as EntityTables, T as DslProjectionError, Tt as MedeoDslSnapshot, U as timeAnchorCodec, V as captionContentCodec, Vt as TrackRole, W as MedeoDslDraft, X as AddDslClipsInput, Y as AddDslClip, Z as ClipSource, _ as VideoDraftInput, _t as DeepReadonly, a as SpokenScript, at as relationId, b as VideoDraftTrack, bt as EntityMutation, c as VideoDraftProjection, ct as AudioScript, d as DEFAULT_UNIT_TIME_MS, dt as CaptionSelection, et as ReplaceDslClipsInput, f as VideoCreationSettings, ft as CaptionStyle, g as VideoDraftContentPartUnion, gt as ContainNode, h as VideoDraftContent, ht as ContainMutation, i as AudioScriptView, it as defaultIdFactory, j as VoiceoverCaptionInput, jt as ResourceSystem, k as UploadText, kt as RelationTables, l as toVideoDraft, lt as Caption, m as VideoDraftCaptionStyle, mt as Clip, n as ImportedVideoDraft, nt as DslIdFactory, o as spokenScripts, ot as resourceId, p as VideoDraft, pt as CaptionText, q as CommitOptions, r as fromVideoDraft, rt as EntityIdKind, s as toAudioScriptViews, st as tupleHash, t as FromVideoDraftOptions, tt as ClipPlacement, u as CaptionDisplayCue, ut as CaptionContent, v as VideoDraftPartUnion, vt as DslDiagnostic, w as DslLayout, wt as FieldPatch, x as VideoDraftTrackItem, xt as EntityTable, y as VideoDraftTimeline, yt as DslMutation, z as documentFormat, zt as TimeAnchor } from "./index-C1iiDt_Q.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-CSjqNIoR.js";
|
|
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 SpokenScript, 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, spokenScripts, 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 { S as tupleHash, _ as resolveDslLayout, a as DslEditor, b as relationId, c as MedeoDsl, f as documentFormat, g as timeAnchorCodec, h as isInvalidAtomic, i as createInitialMedeoDsl, l as UnsupportedDocumentFormatError, m as captionContentCodec, n as toVideoDraft, o as spokenScripts, p as medeoDslLoroShape, r as DEFAULT_UNIT_TIME_MS, s as toAudioScriptViews, t as fromVideoDraft, u as assertDslDocument, v as DslProjectionError, x as resourceId, y as defaultIdFactory } from "./dsl-96AZnd7O.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();
|
|
@@ -1459,4 +1472,4 @@ var MengineDocSession = class extends DocumentSession {
|
|
|
1459
1472
|
}
|
|
1460
1473
|
};
|
|
1461
1474
|
//#endregion
|
|
1462
|
-
export { DEFAULT_UNIT_TIME_MS, DslEditor, DslProjectionError, ManualSyncDoc, MedeoDsl, MedeoHttpDocStorage, MemoryDocStorage, MengineAckFailedError, MengineDocSession, MengineHttpClient, MengineHttpRequestError, MenginePushRejectedError, UnsupportedDocumentFormatError, assertDslDocument, base64ToBytes, bytesToBase64, captionContentCodec, createInitialMedeoDsl, decodeDocVersionMark, defaultIdFactory, documentFormat, encodeDocVersionMark, fromVideoDraft, isInvalidAtomic, medeoDslLoroShape, readMengineEventStream, relationId, resolveDslLayout, resourceId, timeAnchorCodec, toAudioScriptViews, toVideoDraft, tupleHash };
|
|
1475
|
+
export { DEFAULT_UNIT_TIME_MS, DslEditor, DslProjectionError, ManualSyncDoc, MedeoDsl, MedeoHttpDocStorage, MemoryDocStorage, MengineAckFailedError, MengineDocSession, MengineHttpClient, MengineHttpRequestError, MenginePushRejectedError, UnsupportedDocumentFormatError, assertDslDocument, base64ToBytes, bytesToBase64, captionContentCodec, createInitialMedeoDsl, decodeDocVersionMark, defaultIdFactory, documentFormat, encodeDocVersionMark, fromVideoDraft, isInvalidAtomic, medeoDslLoroShape, readMengineEventStream, relationId, resolveDslLayout, resourceId, spokenScripts, timeAnchorCodec, toAudioScriptViews, toVideoDraft, tupleHash };
|