@mengine/medeo-client 2.1.1-dsl.1 → 2.1.1-dsl.10
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 +26 -11
- package/dist/{dsl-EV6kCdr6.js → dsl-COyzz7Fp.js} +1074 -531
- package/dist/dsl.d.ts +3 -3
- package/dist/dsl.js +3 -3
- package/dist/{index-Cu7SdKN5.d.ts → index-C5wDKYqC.d.ts} +183 -170
- package/dist/{index-yifEtZSP.d.ts → index-CHiPztZr.d.ts} +53 -56
- package/dist/{index-B7fC7q7P.d.ts → index-DAfOkcnZ.d.ts} +23 -4
- package/dist/index.d.ts +5 -5
- package/dist/index.js +65 -9
- package/dist/legacy.d.ts +2 -2
- package/dist/legacy.js +1 -1
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +4 -7
- package/dist/{video-draft-types-TXRv3wS6.js → video-draft-types-BnbfWrBx.js} +178 -111
- package/dist/{video-draft-types-c_shaRyq.d.ts → video-draft-types-GqXnsOzA.d.ts} +114 -54
- package/package.json +4 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { G as ResourceSystem,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { G as ResourceSystem, R as MedeoDslSnapshot, rt as TrackRole } from "./video-draft-types-GqXnsOzA.js";
|
|
2
|
+
import { b as MedeoDsl, h as UploadText, i as AudioScriptView, m as DslEditor, o as VideoDraftProjection } from "./index-C5wDKYqC.js";
|
|
3
|
+
import { _ as ManualSyncTransport, a as MengineDocSessionOptions, g as ManualSyncDocOptions, n as DocumentSession, r as DocumentSessionUpdateEvent } from "./index-DAfOkcnZ.js";
|
|
4
4
|
|
|
5
5
|
//#region src/manual-sync/manual-sync-doc.d.ts
|
|
6
6
|
/** Explicit synchronization over the same DSL/editor used by the live Session. */
|
|
@@ -8,7 +8,10 @@ declare class ManualSyncDoc extends ManualSyncTransport {
|
|
|
8
8
|
readonly dsl: MedeoDsl;
|
|
9
9
|
readonly editor: DslEditor;
|
|
10
10
|
private constructor();
|
|
11
|
-
|
|
11
|
+
/** `uploadText` stores raw content the editor writes, such as a PhoneticScript's text, in Memota. */
|
|
12
|
+
static open(options: ManualSyncDocOptions & {
|
|
13
|
+
uploadText?: UploadText;
|
|
14
|
+
}): Promise<ManualSyncDoc>;
|
|
12
15
|
snapshot(): {
|
|
13
16
|
readonly "timeline-entities": {
|
|
14
17
|
readonly [x: string]: {
|
|
@@ -30,6 +33,12 @@ declare class ManualSyncDoc extends ManualSyncTransport {
|
|
|
30
33
|
readonly fillTimeline?: true | undefined;
|
|
31
34
|
};
|
|
32
35
|
readonly volume?: number | undefined;
|
|
36
|
+
readonly source: string;
|
|
37
|
+
readonly anchor?: {
|
|
38
|
+
readonly to: string;
|
|
39
|
+
readonly offsetMs: number;
|
|
40
|
+
readonly fallback_abs_ms: number;
|
|
41
|
+
} | undefined;
|
|
33
42
|
};
|
|
34
43
|
};
|
|
35
44
|
readonly "media-entities": {
|
|
@@ -57,12 +66,36 @@ declare class ManualSyncDoc extends ManualSyncTransport {
|
|
|
57
66
|
};
|
|
58
67
|
readonly "audio-script-entities": {
|
|
59
68
|
readonly [x: string]: {
|
|
60
|
-
readonly
|
|
69
|
+
readonly segments: readonly {
|
|
70
|
+
readonly id: string;
|
|
71
|
+
readonly text: string;
|
|
72
|
+
}[];
|
|
61
73
|
readonly defaultLanguage?: string | undefined;
|
|
62
74
|
};
|
|
63
75
|
};
|
|
76
|
+
readonly "phonetic-script-entities": {
|
|
77
|
+
readonly [x: string]: {
|
|
78
|
+
readonly phoneme: {
|
|
79
|
+
readonly phonemeScript?: string | undefined;
|
|
80
|
+
readonly audioScriptId: string;
|
|
81
|
+
readonly segmentId: string;
|
|
82
|
+
readonly start?: import("loro-crdt").Cursor | undefined;
|
|
83
|
+
readonly end?: import("loro-crdt").Cursor | undefined;
|
|
84
|
+
};
|
|
85
|
+
readonly system?: "memota" | undefined;
|
|
86
|
+
readonly key?: string | undefined;
|
|
87
|
+
readonly storageKey?: string | undefined;
|
|
88
|
+
readonly digest?: string | undefined;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
64
91
|
readonly "caption-entities": {
|
|
65
92
|
readonly [x: string]: {
|
|
93
|
+
readonly selection?: {
|
|
94
|
+
readonly audioScriptId: string;
|
|
95
|
+
readonly segmentId: string;
|
|
96
|
+
readonly start?: import("loro-crdt").Cursor | undefined;
|
|
97
|
+
readonly end?: import("loro-crdt").Cursor | undefined;
|
|
98
|
+
} | undefined;
|
|
66
99
|
readonly text?: string | undefined;
|
|
67
100
|
readonly style?: {
|
|
68
101
|
readonly font?: {
|
|
@@ -88,44 +121,6 @@ declare class ManualSyncDoc extends ManualSyncTransport {
|
|
|
88
121
|
readonly name?: string | undefined;
|
|
89
122
|
};
|
|
90
123
|
};
|
|
91
|
-
readonly "asset-entities": {
|
|
92
|
-
readonly [x: string]: {
|
|
93
|
-
readonly system: ResourceSystem;
|
|
94
|
-
readonly key: string;
|
|
95
|
-
readonly storageKey?: string | undefined;
|
|
96
|
-
readonly digest?: string | undefined;
|
|
97
|
-
};
|
|
98
|
-
};
|
|
99
|
-
readonly "clip-source-relations": {
|
|
100
|
-
readonly [x: string]: {
|
|
101
|
-
readonly clipId: string;
|
|
102
|
-
readonly sourceId: string;
|
|
103
|
-
};
|
|
104
|
-
};
|
|
105
|
-
readonly "time-anchor-relations": {
|
|
106
|
-
readonly [x: string]: {
|
|
107
|
-
readonly from: string;
|
|
108
|
-
readonly to: string;
|
|
109
|
-
readonly offsetMs: number;
|
|
110
|
-
readonly fallback_abs_ms: number;
|
|
111
|
-
};
|
|
112
|
-
};
|
|
113
|
-
readonly "caption-content-relations": {
|
|
114
|
-
readonly [x: string]: {
|
|
115
|
-
readonly captionId: string;
|
|
116
|
-
readonly audioScriptId: string;
|
|
117
|
-
readonly start: import("loro-crdt").Cursor;
|
|
118
|
-
readonly end: import("loro-crdt").Cursor;
|
|
119
|
-
};
|
|
120
|
-
};
|
|
121
|
-
readonly "caption-alignment-relations": {
|
|
122
|
-
readonly [x: string]: {
|
|
123
|
-
readonly captionId: string;
|
|
124
|
-
readonly mediaId: string;
|
|
125
|
-
readonly startMs: number;
|
|
126
|
-
readonly endMs: number;
|
|
127
|
-
};
|
|
128
|
-
};
|
|
129
124
|
readonly "voice-timbre-relations": {
|
|
130
125
|
readonly [x: string]: {
|
|
131
126
|
readonly recordingId: string;
|
|
@@ -136,18 +131,7 @@ declare class ManualSyncDoc extends ManualSyncTransport {
|
|
|
136
131
|
readonly [x: string]: {
|
|
137
132
|
readonly entityId: string;
|
|
138
133
|
readonly sourceId: string;
|
|
139
|
-
|
|
140
|
-
};
|
|
141
|
-
readonly "from-asset-relations": {
|
|
142
|
-
readonly [x: string]: {
|
|
143
|
-
readonly audioScriptId: string;
|
|
144
|
-
readonly assetId: string;
|
|
145
|
-
};
|
|
146
|
-
};
|
|
147
|
-
readonly "to-asset-relations": {
|
|
148
|
-
readonly [x: string]: {
|
|
149
|
-
readonly audioScriptId: string;
|
|
150
|
-
readonly assetId: string;
|
|
134
|
+
readonly sourceDigest?: string | undefined;
|
|
151
135
|
};
|
|
152
136
|
};
|
|
153
137
|
readonly 'contain-relations': readonly {
|
|
@@ -175,6 +159,14 @@ declare class ManualSyncDoc extends ManualSyncTransport {
|
|
|
175
159
|
readonly bodyId: string;
|
|
176
160
|
};
|
|
177
161
|
};
|
|
162
|
+
readonly phoneticText: {
|
|
163
|
+
readonly [x: string]: {
|
|
164
|
+
readonly text: string;
|
|
165
|
+
readonly start: number;
|
|
166
|
+
readonly end: number;
|
|
167
|
+
readonly bodyId: string;
|
|
168
|
+
};
|
|
169
|
+
};
|
|
178
170
|
readonly diagnostics: readonly {
|
|
179
171
|
readonly code: string;
|
|
180
172
|
readonly path: string;
|
|
@@ -189,9 +181,14 @@ declare class ManualSyncDoc extends ManualSyncTransport {
|
|
|
189
181
|
type MengineDocSessionUpdateEvent = DocumentSessionUpdateEvent<MedeoDslSnapshot>;
|
|
190
182
|
/** Default collaborative session: one DSL handle and one editor over the synchronized LoroDoc. */
|
|
191
183
|
declare class MengineDocSession extends DocumentSession<MedeoDslSnapshot, DslEditor, MedeoDsl> {
|
|
192
|
-
|
|
184
|
+
/** `uploadText` stores raw content the editor writes, such as a PhoneticScript's text, in Memota. */
|
|
185
|
+
constructor(options: MengineDocSessionOptions & {
|
|
186
|
+
uploadText?: UploadText;
|
|
187
|
+
});
|
|
193
188
|
get dsl(): MedeoDsl;
|
|
194
189
|
projectVideoDraft(): VideoDraftProjection;
|
|
190
|
+
/** The document's AudioScripts with what says and shows them; read from the same snapshot as the VideoDraft. */
|
|
191
|
+
projectAudioScripts(): AudioScriptView[];
|
|
195
192
|
}
|
|
196
193
|
//#endregion
|
|
197
194
|
export { MengineDocSessionUpdateEvent as n, ManualSyncDoc as r, MengineDocSession as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { j as DslDiagnostic, o as VideoDraftContent, p as CommitOptions } from "./video-draft-types-GqXnsOzA.js";
|
|
2
2
|
import { LoroDoc, PeerID, VersionVector } 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
|
|
@@ -532,13 +532,18 @@ declare class MengineAckFailedError extends Error {
|
|
|
532
532
|
readonly cause: Error | undefined;
|
|
533
533
|
constructor(reason: 'timeout' | 'rejected' | 'failed', code: string | undefined, cause: Error | undefined, message: string);
|
|
534
534
|
}
|
|
535
|
+
type MengineLocalSaveState = LocalSaveState;
|
|
536
|
+
interface WaitForLocalSaveOptions {
|
|
537
|
+
/** Only limits waiting, never cancels persistence. */
|
|
538
|
+
timeoutMs?: number;
|
|
539
|
+
}
|
|
535
540
|
interface WaitForServerAckOptions {
|
|
536
541
|
/** Deadline in ms. Rejects with reason `timeout` when it elapses. */
|
|
537
542
|
timeoutMs?: number;
|
|
538
543
|
}
|
|
539
544
|
/** Document-level confirmation is independent of local operation completion. */
|
|
540
545
|
interface MengineDocSyncState {
|
|
541
|
-
/**
|
|
546
|
+
/** Server-originated imports do not create a new local confirmation obligation. */
|
|
542
547
|
readonly confirmation: 'unknown' | 'pending' | 'confirmed';
|
|
543
548
|
/** Transport/activity phase. Idle does not imply confirmation; failure details
|
|
544
549
|
* remain available through push outcomes and confirmation wait errors. */
|
|
@@ -553,6 +558,9 @@ interface MengineDocSessionOptions {
|
|
|
553
558
|
* Browsers should pass an `IndexedDBDocStorage` for refresh/cross-tab support.
|
|
554
559
|
*/
|
|
555
560
|
localStorage?: DocStorageLike;
|
|
561
|
+
/** A freshly fetched remote snapshot to merge into storage before loading.
|
|
562
|
+
* Existing local changes are retained; the host owns any online startup gate. */
|
|
563
|
+
initialSnapshot?: Uint8Array;
|
|
556
564
|
sseReconnectDelayMs?: number;
|
|
557
565
|
/**
|
|
558
566
|
* Keep remote synchronization read-only: pull snapshot/diffs and subscribe to
|
|
@@ -587,6 +595,7 @@ declare class DocumentSession<Snapshot, Editor, Document> {
|
|
|
587
595
|
private started;
|
|
588
596
|
private startTask;
|
|
589
597
|
private destroyed;
|
|
598
|
+
private closeTask;
|
|
590
599
|
private lifetime;
|
|
591
600
|
private hasConnected;
|
|
592
601
|
private initialVersionValue;
|
|
@@ -687,7 +696,17 @@ declare class DocumentSession<Snapshot, Editor, Document> {
|
|
|
687
696
|
*/
|
|
688
697
|
start(): Promise<Snapshot>;
|
|
689
698
|
private open;
|
|
699
|
+
getLocalSaveState(): MengineLocalSaveState;
|
|
700
|
+
/** Immediately reports local transaction state; independent of server confirmation. */
|
|
701
|
+
subscribeLocalSaveState(cb: (state: MengineLocalSaveState) => void): () => void;
|
|
702
|
+
/** Waits until all local saves finish, including edits made while waiting. Does not wait for the network. */
|
|
703
|
+
waitForLocalSave(options?: WaitForLocalSaveOptions): Promise<void>;
|
|
704
|
+
/** Stop accepting edits and drain local persistence before releasing resources.
|
|
705
|
+
* A failed local write keeps retrying, even after the host has unmounted.
|
|
706
|
+
* Hosts should use this for normal teardown; destroy() is immediate cancellation. */
|
|
707
|
+
close(): Promise<void>;
|
|
690
708
|
getSyncState(): MengineDocSyncState;
|
|
709
|
+
private trackLocalVersion;
|
|
691
710
|
private confirmationTarget;
|
|
692
711
|
/** Immediately supplies current state; unsubscribe when the host changes docs. */
|
|
693
712
|
subscribeSyncState(cb: (state: MengineDocSyncState) => void): () => void;
|
|
@@ -725,4 +744,4 @@ declare class MemoryDocStorage extends BaseDocStorage {
|
|
|
725
744
|
private now;
|
|
726
745
|
}
|
|
727
746
|
//#endregion
|
|
728
|
-
export {
|
|
747
|
+
export { MenginePushRejectedError as A, MengineSyncResponse as B, PushResult as C, MengineHttpClient as D, readMengineEventStream as E, MenginePushResponse as F, base64ToBytes as H, MenginePushUpdateResponse as I, MengineRejectedResponse as L, MengineAuditResponse as M, MengineDocumentVersion as N, MengineHttpClientOptions as O, MengineDraftResponse as P, MengineSnapshotResponse as R, PullResult as S, MengineEventStreamOptions as T, bytesToBase64 as U, MengineUpdateMeta as V, ManualSyncTransport as _, MengineDocSessionOptions as a, DocVersionMark as b, WaitForLocalSaveOptions as c, MengineUndoState as d, MedeoHttpDocStorage as f, ManualSyncDocOptions as g, PushOutcomeKind as h, MengineAckFailedError as i, MengineAuditEntry as j, MengineHttpRequestError as k, WaitForServerAckOptions as l, PushOutcome as m, DocumentSession as n, MengineDocSyncState as o, MedeoHttpDocStorageOptions as p, DocumentSessionUpdateEvent as r, MengineLocalSaveState as s, MemoryDocStorage as t, DocStorageLike as u, decodeDocVersionMark as v, PushResultKind as w, PullFailureReason as x, encodeDocVersionMark as y, MengineSseUpdateEvent as z };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { A as
|
|
3
|
-
import { A as
|
|
4
|
-
import { n as MengineDocSessionUpdateEvent, r as ManualSyncDoc, t as MengineDocSession } from "./index-
|
|
5
|
-
export { type AddDslClip, type AddDslClipsInput, type ApplyVoiceoverInput, type
|
|
1
|
+
import { $ as TextMutation, A as DeepReadonly, C as CaptionContent, D as Clip, E as CaptionText, F as EntityTables, G as ResourceSystem, H as RelationTable, I as EntityValues, K as RichTextSnapshot, L as FieldPatch, M as DslMutation, N as EntityMutation, O as ContainMutation, P as EntityTable, Q as TextMark, R as MedeoDslSnapshot, S as Caption, T as CaptionStyle, U as RelationTables, V as RelationMutation, W as RelationValues, X as TextDelta, Y as StoredFile, Z as TextEdit, _ as defaultIdFactory, a as VideoDraftCaptionStyle, b as tupleHash, c as VideoDraftInput, d as VideoDraftTrack, et as TextRun, f as VideoDraftTrackItem, g as EntityIdKind, h as DslIdFactory, i as VideoDraft, it as Voice, j as DslDiagnostic, k as ContainNode, l as VideoDraftPartUnion, m as OpActor, n as DEFAULT_UNIT_TIME_MS, nt as Track, o as VideoDraftContent, p as CommitOptions, r as VideoCreationSettings, rt as TrackRole, s as VideoDraftContentPartUnion, t as CaptionDisplayCue, tt as TimeAnchor, u as VideoDraftTimeline, v as relationId, w as CaptionSelection, x as AudioScript, y as resourceId, z as Media } from "./video-draft-types-GqXnsOzA.js";
|
|
2
|
+
import { A as MedeoDslDraft, C as UnsupportedDocumentFormatError, D as captionContentCodec, E as InvalidAtomic, F as ClipSource, I as DslClipUpdate, L as MoveDslClipsInput, M as medeoDslLoroShape, N as AddDslClip, O as isInvalidAtomic, P as AddDslClipsInput, R as ReplaceDslClipsInput, S as DslTransaction, T as documentFormat, _ as VoiceoverCaptionInput, a as toAudioScriptViews, b as MedeoDsl, c as resolveDslLayout, d as DslProjectionError, f as DslTrackLayout, g as ApplyVoiceoverInput, h as UploadText, i as AudioScriptView, j as MedeoDslLoroState, k as timeAnchorCodec, l as DslClipLayout, m as DslEditor, n as ImportedVideoDraft, o as VideoDraftProjection, p as createInitialMedeoDsl, r as fromVideoDraft, s as toVideoDraft, t as FromVideoDraftOptions, u as DslLayout, v as VoiceoverResult, w as assertDslDocument, x as DslAudit, y as CreateMedeoDslOptions, z as ClipPlacement } from "./index-C5wDKYqC.js";
|
|
3
|
+
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, a as MengineDocSessionOptions, b as DocVersionMark, c as WaitForLocalSaveOptions, d as MengineUndoState, f as MedeoHttpDocStorage, g as ManualSyncDocOptions, h as PushOutcomeKind, i as MengineAckFailedError, j as MengineAuditEntry, k as MengineHttpRequestError, l as WaitForServerAckOptions, m as PushOutcome, o as MengineDocSyncState, p as MedeoHttpDocStorageOptions, 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-DAfOkcnZ.js";
|
|
4
|
+
import { n as MengineDocSessionUpdateEvent, r as ManualSyncDoc, t as MengineDocSession } from "./index-CHiPztZr.js";
|
|
5
|
+
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,8 +1,8 @@
|
|
|
1
1
|
import { n as bytesToBase64, t as base64ToBytes } from "./base64-D-jd-dr5.js";
|
|
2
2
|
import { a as covers, c as readMengineEventStream, d as MenginePushRejectedError, i as openManualDocument, l as MengineHttpClient, n as MedeoHttpDocStorage, o as decodeDocVersionMark, r as ManualSyncTransport, s as encodeDocVersionMark, t as MemoryDocStorage, u as MengineHttpRequestError } from "./storage-BW3tI_ER.js";
|
|
3
|
-
import { a as documentFormat, c as isInvalidAtomic,
|
|
4
|
-
import { a as
|
|
5
|
-
import { UndoManager, VersionVector } from "loro-crdt";
|
|
3
|
+
import { _t as tupleHash, a as documentFormat, c as isInvalidAtomic, gt as resourceId, ht as relationId, i as assertDslDocument, mt as defaultIdFactory, o as medeoDslLoroShape, r as UnsupportedDocumentFormatError, s as captionContentCodec, t as DEFAULT_UNIT_TIME_MS, u as timeAnchorCodec } from "./video-draft-types-BnbfWrBx.js";
|
|
4
|
+
import { a as DslEditor, c as DslProjectionError, i as createInitialMedeoDsl, n as toVideoDraft, o as MedeoDsl, r as toAudioScriptViews, s as resolveDslLayout, t as fromVideoDraft } from "./dsl-COyzz7Fp.js";
|
|
5
|
+
import { UndoManager, VersionVector, decodeImportBlobMeta } from "loro-crdt";
|
|
6
6
|
import { ClientServerSynchronizer, DocManager } from "@mengine/sync";
|
|
7
7
|
import { DisposableSet, EventBus } from "@mengine/utils";
|
|
8
8
|
//#region src/manual-sync/manual-sync-doc.ts
|
|
@@ -10,14 +10,15 @@ import { DisposableSet, EventBus } from "@mengine/utils";
|
|
|
10
10
|
var ManualSyncDoc = class ManualSyncDoc extends ManualSyncTransport {
|
|
11
11
|
dsl;
|
|
12
12
|
editor;
|
|
13
|
-
constructor(client, doc, watermark) {
|
|
13
|
+
constructor(client, doc, watermark, uploadText) {
|
|
14
14
|
super(client, doc, watermark);
|
|
15
15
|
assertDslDocument(doc);
|
|
16
16
|
this.dsl = new MedeoDsl(doc);
|
|
17
|
-
this.editor = new DslEditor(this.dsl);
|
|
17
|
+
this.editor = new DslEditor(this.dsl, void 0, uploadText);
|
|
18
18
|
}
|
|
19
|
+
/** `uploadText` stores raw content the editor writes, such as a PhoneticScript's text, in Memota. */
|
|
19
20
|
static open(options) {
|
|
20
|
-
return openManualDocument(options, (doc, watermark) => new ManualSyncDoc(options.client, doc, watermark));
|
|
21
|
+
return openManualDocument(options, (doc, watermark) => new ManualSyncDoc(options.client, doc, watermark, options.uploadText));
|
|
21
22
|
}
|
|
22
23
|
snapshot() {
|
|
23
24
|
this.assertActive();
|
|
@@ -222,6 +223,7 @@ var DocumentSession = class {
|
|
|
222
223
|
started = false;
|
|
223
224
|
startTask = null;
|
|
224
225
|
destroyed = false;
|
|
226
|
+
closeTask = null;
|
|
225
227
|
lifetime = null;
|
|
226
228
|
hasConnected = false;
|
|
227
229
|
initialVersionValue = null;
|
|
@@ -438,6 +440,13 @@ var DocumentSession = class {
|
|
|
438
440
|
this.local.connection.connect();
|
|
439
441
|
await this.local.connection.waitForConnected().abortOn(this.lifetime.signal);
|
|
440
442
|
if (this.destroyed) throw new Error("mengine doc session destroyed");
|
|
443
|
+
if (this.options.initialSnapshot) {
|
|
444
|
+
await this.local.pushDocUpdate({
|
|
445
|
+
docId: this.docId,
|
|
446
|
+
data: this.options.initialSnapshot
|
|
447
|
+
}, "initial-snapshot");
|
|
448
|
+
if (this.destroyed) throw new Error("mengine doc session destroyed");
|
|
449
|
+
}
|
|
441
450
|
this.server.connection.connect();
|
|
442
451
|
this.synchronizer.start();
|
|
443
452
|
this.manager.start();
|
|
@@ -446,6 +455,10 @@ var DocumentSession = class {
|
|
|
446
455
|
const doc = this.manager.connectDoc(this.docId);
|
|
447
456
|
this.disposables.add(() => this.manager.disconnectDoc(this.docId));
|
|
448
457
|
if (this.options.peerId != null) doc.setPeerId(this.options.peerId);
|
|
458
|
+
this.disposables.add(this.manager.onLocalUpdateReceived(this.docId, (update) => {
|
|
459
|
+
this.trackLocalVersion(decodeImportBlobMeta(update, true).partialEndVersionVector);
|
|
460
|
+
this.emitSyncState();
|
|
461
|
+
}));
|
|
449
462
|
this.disposables.add(this.manager.onDocStateChange(this.docId, (state) => {
|
|
450
463
|
this.events.emit("state", state);
|
|
451
464
|
this.emitSyncState();
|
|
@@ -455,7 +468,7 @@ var DocumentSession = class {
|
|
|
455
468
|
this.adapterValue = this.model(doc, this.mutationGuard);
|
|
456
469
|
this.disposables.add(this.adapterValue.subscribe((source) => {
|
|
457
470
|
if (!this.adapterValue) return;
|
|
458
|
-
if (source === "local") this.
|
|
471
|
+
if (source === "local") this.trackLocalVersion(doc.version());
|
|
459
472
|
this.emitSyncState();
|
|
460
473
|
this.events.emit("update", {
|
|
461
474
|
source,
|
|
@@ -470,9 +483,39 @@ var DocumentSession = class {
|
|
|
470
483
|
this.undoManagerValue = new DocumentUndoManager(doc, this.mutationGuard, () => this.events.emit("undoState"));
|
|
471
484
|
this.editorValue = this.adapterValue.editor;
|
|
472
485
|
this.initialVersionValue = doc.version();
|
|
486
|
+
if (this.localVersionValue) this.trackLocalVersion(this.initialVersionValue);
|
|
473
487
|
this.emitSyncState();
|
|
474
488
|
return this.snapshot();
|
|
475
489
|
}
|
|
490
|
+
getLocalSaveState() {
|
|
491
|
+
return this.getState().localSave;
|
|
492
|
+
}
|
|
493
|
+
/** Immediately reports local transaction state; independent of server confirmation. */
|
|
494
|
+
subscribeLocalSaveState(cb) {
|
|
495
|
+
const off = this.events.on("state", () => cb(this.getLocalSaveState()));
|
|
496
|
+
cb(this.getLocalSaveState());
|
|
497
|
+
return off;
|
|
498
|
+
}
|
|
499
|
+
/** Waits until all local saves finish, including edits made while waiting. Does not wait for the network. */
|
|
500
|
+
async waitForLocalSave(options = {}) {
|
|
501
|
+
if (!this.editorValue || this.destroyed) throw new Error("mengine doc session is not started");
|
|
502
|
+
await this.manager.waitForLocalSave(this.docId).timeout(options.timeoutMs ?? 15e3);
|
|
503
|
+
}
|
|
504
|
+
/** Stop accepting edits and drain local persistence before releasing resources.
|
|
505
|
+
* A failed local write keeps retrying, even after the host has unmounted.
|
|
506
|
+
* Hosts should use this for normal teardown; destroy() is immediate cancellation. */
|
|
507
|
+
close() {
|
|
508
|
+
if (this.closeTask) return this.closeTask;
|
|
509
|
+
if (this.destroyed || !this.editorValue) {
|
|
510
|
+
this.destroy();
|
|
511
|
+
return Promise.resolve();
|
|
512
|
+
}
|
|
513
|
+
this.mutationGuard.close();
|
|
514
|
+
this.synchronizer.stop();
|
|
515
|
+
this.server.connection.disconnect();
|
|
516
|
+
this.closeTask = this.manager.waitForLocalSave(this.docId).then(() => this.destroy());
|
|
517
|
+
return this.closeTask;
|
|
518
|
+
}
|
|
476
519
|
getSyncState() {
|
|
477
520
|
const state = this.getState();
|
|
478
521
|
const target = this.confirmationTarget();
|
|
@@ -483,6 +526,14 @@ var DocumentSession = class {
|
|
|
483
526
|
phase: connection === "disconnected" ? "offline" : this.pushErrorValue != null || state.error != null ? "failed" : connection === "connecting" ? "connecting" : state.syncing ? "syncing" : "idle"
|
|
484
527
|
};
|
|
485
528
|
}
|
|
529
|
+
trackLocalVersion(version) {
|
|
530
|
+
const target = VersionVector.parseJSON(this.confirmationTarget()?.toJSON() ?? /* @__PURE__ */ new Map());
|
|
531
|
+
for (const [peer, counter] of version.toJSON()) if ((target.get(peer) ?? 0) < counter) target.setEnd({
|
|
532
|
+
peer,
|
|
533
|
+
counter
|
|
534
|
+
});
|
|
535
|
+
this.localVersionValue = target;
|
|
536
|
+
}
|
|
486
537
|
confirmationTarget() {
|
|
487
538
|
return this.localVersionValue ?? this.initialVersionValue;
|
|
488
539
|
}
|
|
@@ -573,6 +624,7 @@ function serverCovers(serverVV, target) {
|
|
|
573
624
|
//#region src/session/mengine-doc-session.ts
|
|
574
625
|
/** Default collaborative session: one DSL handle and one editor over the synchronized LoroDoc. */
|
|
575
626
|
var MengineDocSession = class extends DocumentSession {
|
|
627
|
+
/** `uploadText` stores raw content the editor writes, such as a PhoneticScript's text, in Memota. */
|
|
576
628
|
constructor(options) {
|
|
577
629
|
super(options, (doc, guard) => {
|
|
578
630
|
assertDslDocument(doc);
|
|
@@ -580,7 +632,7 @@ var MengineDocSession = class extends DocumentSession {
|
|
|
580
632
|
return {
|
|
581
633
|
doc,
|
|
582
634
|
document: dsl,
|
|
583
|
-
editor: new DslEditor(dsl),
|
|
635
|
+
editor: new DslEditor(dsl, void 0, options.uploadText),
|
|
584
636
|
snapshot: () => dsl.getSnapshot(),
|
|
585
637
|
subscribe: (listener) => dsl.subscribe(listener),
|
|
586
638
|
dispose: () => dsl.dispose()
|
|
@@ -593,6 +645,10 @@ var MengineDocSession = class extends DocumentSession {
|
|
|
593
645
|
projectVideoDraft() {
|
|
594
646
|
return toVideoDraft(this.snapshot());
|
|
595
647
|
}
|
|
648
|
+
/** The document's AudioScripts with what says and shows them; read from the same snapshot as the VideoDraft. */
|
|
649
|
+
projectAudioScripts() {
|
|
650
|
+
return toAudioScriptViews(this.snapshot());
|
|
651
|
+
}
|
|
596
652
|
};
|
|
597
653
|
//#endregion
|
|
598
|
-
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, toVideoDraft, tupleHash };
|
|
654
|
+
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 };
|
package/dist/legacy.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as VideoDraft, l as VideoDraftPartUnion, o as VideoDraftContent, p as CommitOptions, t as CaptionDisplayCue } from "./video-draft-types-
|
|
2
|
-
import { A as
|
|
1
|
+
import { i as VideoDraft, l as VideoDraftPartUnion, o as VideoDraftContent, p as CommitOptions, t as CaptionDisplayCue } from "./video-draft-types-GqXnsOzA.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 ManualSyncTransport, a as MengineDocSessionOptions, b as DocVersionMark, d as MengineUndoState, f as MedeoHttpDocStorage, g as ManualSyncDocOptions, h as PushOutcomeKind, j as MengineAuditEntry, k as MengineHttpRequestError, l as WaitForServerAckOptions, m as PushOutcome, o as MengineDocSyncState, p as MedeoHttpDocStorageOptions, t as MemoryDocStorage, u as DocStorageLike, v as decodeDocVersionMark, w as PushResultKind, x as PullFailureReason, y as encodeDocVersionMark, z as MengineSseUpdateEvent } from "./index-DAfOkcnZ.js";
|
|
3
3
|
import { LoroDoc, PeerID } from "loro-crdt";
|
|
4
4
|
|
|
5
5
|
//#region ../medeo-dsl/depreacted/sandbox.d.ts
|
package/dist/legacy.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as bytesToBase64, t as base64ToBytes } from "./base64-D-jd-dr5.js";
|
|
2
2
|
import { c as readMengineEventStream, d as MenginePushRejectedError, i as openManualDocument, l as MengineHttpClient, n as MedeoHttpDocStorage, o as decodeDocVersionMark, r as ManualSyncTransport, s as encodeDocVersionMark, t as MemoryDocStorage, u as MengineHttpRequestError } from "./storage-BW3tI_ER.js";
|
|
3
|
-
import { a as documentFormat, r as UnsupportedDocumentFormatError, t as DEFAULT_UNIT_TIME_MS } from "./video-draft-types-
|
|
3
|
+
import { a as documentFormat, r as UnsupportedDocumentFormatError, t as DEFAULT_UNIT_TIME_MS } from "./video-draft-types-BnbfWrBx.js";
|
|
4
4
|
import { u as volumeSchema } from "./shared-iWnU2osE.js";
|
|
5
5
|
import { sha256 } from "@noble/hashes/sha2.js";
|
|
6
6
|
import { LoroDoc, LoroMap, LoroMovableList, LoroText, UndoManager } from "loro-crdt";
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as VideoDraft } from "./video-draft-types-
|
|
2
|
-
import {
|
|
1
|
+
import { i as VideoDraft } from "./video-draft-types-GqXnsOzA.js";
|
|
2
|
+
import { b as MedeoDsl } from "./index-C5wDKYqC.js";
|
|
3
3
|
import { LoroDoc } from "loro-crdt";
|
|
4
4
|
|
|
5
5
|
//#region src/testing/in-memory-mengine-server.d.ts
|
package/dist/testing.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as bytesToBase64, t as base64ToBytes } from "./base64-D-jd-dr5.js";
|
|
2
|
-
import { a as documentFormat, i as assertDslDocument } from "./video-draft-types-
|
|
3
|
-
import { a as
|
|
2
|
+
import { a as documentFormat, i as assertDslDocument } from "./video-draft-types-BnbfWrBx.js";
|
|
3
|
+
import { a as DslEditor, i as createInitialMedeoDsl, n as toVideoDraft, o as MedeoDsl } from "./dsl-COyzz7Fp.js";
|
|
4
4
|
import { t as classifyUpdate } from "./loro-relay-doc-Bi6JKqtQ.js";
|
|
5
5
|
import { LoroDoc, VersionVector, encodeFrontiers } from "loro-crdt";
|
|
6
6
|
//#region src/testing/in-memory-mengine-server.ts
|
|
@@ -450,7 +450,7 @@ function createTestDsl(options = {}) {
|
|
|
450
450
|
durationMs: 1e3,
|
|
451
451
|
storageKey: "speech.mp3"
|
|
452
452
|
},
|
|
453
|
-
script: {
|
|
453
|
+
script: { segments: ["hello"] },
|
|
454
454
|
volume: 1,
|
|
455
455
|
voice: {
|
|
456
456
|
system: "voice-library",
|
|
@@ -466,10 +466,7 @@ function createTestDsl(options = {}) {
|
|
|
466
466
|
clipId: "caption",
|
|
467
467
|
startMs: 0,
|
|
468
468
|
durationMs: 1e3,
|
|
469
|
-
|
|
470
|
-
start: 0,
|
|
471
|
-
end: 5
|
|
472
|
-
},
|
|
469
|
+
segment: 0,
|
|
473
470
|
style: {}
|
|
474
471
|
}]
|
|
475
472
|
});
|