@mengine/medeo-client 2.1.1-dsl.1 → 2.1.1-dsl.3
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 +17 -3
- package/dist/{dsl-EV6kCdr6.js → dsl-Dm3Sq1fa.js} +307 -354
- package/dist/dsl.d.ts +3 -3
- package/dist/dsl.js +2 -2
- package/dist/{index-B7fC7q7P.d.ts → index-CwG4lYKp.d.ts} +23 -4
- package/dist/{index-Cu7SdKN5.d.ts → index-DP9FG0z_.d.ts} +41 -137
- package/dist/{index-yifEtZSP.d.ts → index-W1eHhVus.d.ts} +22 -53
- package/dist/index.d.ts +5 -5
- package/dist/index.js +54 -4
- package/dist/legacy.d.ts +2 -2
- package/dist/legacy.js +1 -1
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +2 -2
- package/dist/{video-draft-types-c_shaRyq.d.ts → video-draft-types-BfkIuW5f.d.ts} +40 -44
- package/dist/{video-draft-types-TXRv3wS6.js → video-draft-types-DvPeam87.js} +105 -98
- package/package.json +6 -6
package/dist/dsl.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { A as AddDslClip, C as
|
|
3
|
-
export { type AddDslClip, type AddDslClipsInput, type ApplyVoiceoverInput, type
|
|
1
|
+
import { $ as TrackRole, A as DeepReadonly, B as RelationMutation, C as CaptionContent, D as Clip, E as CaptionText, F as EntityTables, G as RichTextSnapshot, H as RelationTables, I as EntityValues, J as TextMark, K as TextDelta, L as FieldPatch, M as DslMutation, N as EntityMutation, O as ContainMutation, P as EntityTable, Q as Track, R as MedeoDslSnapshot, S as Caption, T as CaptionStyle, U as RelationValues, V as RelationTable, W as ResourceSystem, X as TextRun, Y as TextMutation, Z as TimeAnchor, _ as defaultIdFactory, a as VideoDraftCaptionStyle, b as tupleHash, c as VideoDraftInput, d as VideoDraftTrack, et as Voice, f as VideoDraftTrackItem, g as EntityIdKind, h as DslIdFactory, i as VideoDraft, j as DslDiagnostic, k as ContainNode, l as VideoDraftPartUnion, m as OpActor, n as DEFAULT_UNIT_TIME_MS, o as VideoDraftContent, p as CommitOptions, q as TextEdit, r as VideoCreationSettings, s as VideoDraftContentPartUnion, t as CaptionDisplayCue, u as VideoDraftTimeline, v as relationId, w as CaptionSelection, x as AudioScript, y as resourceId, z as Media } from "./video-draft-types-BfkIuW5f.js";
|
|
2
|
+
import { A as AddDslClip, C as InvalidAtomic, D as MedeoDslDraft, E as timeAnchorCodec, F as ReplaceDslClipsInput, I as ClipPlacement, M as ClipSource, N as DslClipUpdate, O as MedeoDslLoroState, P as MoveDslClipsInput, S as documentFormat, T as isInvalidAtomic, _ as MedeoDsl, a as toVideoDraft, b as UnsupportedDocumentFormatError, c as DslLayout, d as createInitialMedeoDsl, f as DslEditor, g as CreateMedeoDslOptions, h as VoiceoverResult, i as VideoDraftProjection, j as AddDslClipsInput, k as medeoDslLoroShape, l as DslProjectionError, m as VoiceoverCaptionInput, n as ImportedVideoDraft, o as resolveDslLayout, p as ApplyVoiceoverInput, r as fromVideoDraft, s as DslClipLayout, t as FromVideoDraftOptions, u as DslTrackLayout, v as DslAudit, w as captionContentCodec, x as assertDslDocument, y as DslTransaction } from "./index-DP9FG0z_.js";
|
|
3
|
+
export { type AddDslClip, type AddDslClipsInput, type ApplyVoiceoverInput, type AudioScript, 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 TextDelta, type TextEdit, type TextMark, type TextMutation, type TextRun, type TimeAnchor, type Track, type TrackRole, UnsupportedDocumentFormatError, 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, toVideoDraft, tupleHash };
|
package/dist/dsl.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as documentFormat, c as isInvalidAtomic,
|
|
2
|
-
import { a as MedeoDsl, i as DslEditor, n as toVideoDraft, o as resolveDslLayout, r as createInitialMedeoDsl, s as DslProjectionError, t as fromVideoDraft } from "./dsl-
|
|
1
|
+
import { a as documentFormat, c as isInvalidAtomic, ft as defaultIdFactory, ht as tupleHash, i as assertDslDocument, l as timeAnchorCodec, mt as resourceId, o as medeoDslLoroShape, pt as relationId, r as UnsupportedDocumentFormatError, s as captionContentCodec, t as DEFAULT_UNIT_TIME_MS } from "./video-draft-types-DvPeam87.js";
|
|
2
|
+
import { a as MedeoDsl, i as DslEditor, n as toVideoDraft, o as resolveDslLayout, r as createInitialMedeoDsl, s as DslProjectionError, t as fromVideoDraft } from "./dsl-Dm3Sq1fa.js";
|
|
3
3
|
export { DEFAULT_UNIT_TIME_MS, DslEditor, DslProjectionError, MedeoDsl, UnsupportedDocumentFormatError, assertDslDocument, captionContentCodec, createInitialMedeoDsl, defaultIdFactory, documentFormat, fromVideoDraft, isInvalidAtomic, medeoDslLoroShape, relationId, resolveDslLayout, resourceId, timeAnchorCodec, toVideoDraft, tupleHash };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { j as DslDiagnostic, o as VideoDraftContent, p as CommitOptions } from "./video-draft-types-BfkIuW5f.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 };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $ as TrackRole, C as CaptionContent, L as FieldPatch, M as DslMutation, R as MedeoDslSnapshot, T as CaptionStyle, Z as TimeAnchor, c as VideoDraftInput, et as Voice, h as DslIdFactory, j as DslDiagnostic, o as VideoDraftContent, p as CommitOptions, q as TextEdit, w as CaptionSelection, z as Media } from "./video-draft-types-BfkIuW5f.js";
|
|
2
2
|
import { ContainerType, Cursor, LoroDoc, PeerID, TreeID } from "loro-crdt";
|
|
3
3
|
|
|
4
4
|
//#region src/dsl/action-context.d.ts
|
|
@@ -394,22 +394,12 @@ type InferBooleanType<S extends SchemaType> = S extends {
|
|
|
394
394
|
transform: TransformDefinition<infer _C, infer D>;
|
|
395
395
|
} ? WithOptionality<D, S> : WithOptionality<boolean, S>;
|
|
396
396
|
//#endregion
|
|
397
|
-
//#region ../medeo-dsl/src/schema/codec.d.ts
|
|
398
|
-
interface InvalidAtomic {
|
|
399
|
-
invalid: true;
|
|
400
|
-
raw: string;
|
|
401
|
-
reason: string;
|
|
402
|
-
}
|
|
403
|
-
declare function isInvalidAtomic(value: unknown): value is InvalidAtomic;
|
|
404
|
-
interface AtomicCodec<T> {
|
|
405
|
-
encode(value: T | InvalidAtomic): string;
|
|
406
|
-
decode(raw: string): T | InvalidAtomic;
|
|
407
|
-
}
|
|
408
|
-
declare const timeAnchorCodec: AtomicCodec<TimeAnchor>;
|
|
409
|
-
declare const captionContentCodec: AtomicCodec<CaptionContent>;
|
|
410
|
-
//#endregion
|
|
411
397
|
//#region ../medeo-dsl/src/schema/loro-shape.d.ts
|
|
412
|
-
/**
|
|
398
|
+
/**
|
|
399
|
+
* Only direct children inherit mergeable identity. Body and ordinary entity rows keep normal
|
|
400
|
+
* identities, so deleting a row also drops what a peer wrote into it concurrently: a relation an
|
|
401
|
+
* entity holds at most one of is a field of that row and never outlives it.
|
|
402
|
+
*/
|
|
413
403
|
declare const medeoDslLoroShape: RootSchemaType<{
|
|
414
404
|
'timeline-entities': LoroMapSchemaWithCatchall<{}, LoroMapSchema<{}> & {
|
|
415
405
|
options: {};
|
|
@@ -434,12 +424,16 @@ declare const medeoDslLoroShape: RootSchemaType<{
|
|
|
434
424
|
'clip-entities': LoroMapSchemaWithCatchall<{}, LoroMapSchema<{
|
|
435
425
|
seqMarker: /*elided*/any;
|
|
436
426
|
volume: /*elided*/any;
|
|
427
|
+
source: /*elided*/any;
|
|
428
|
+
anchor: /*elided*/any;
|
|
437
429
|
}> & {
|
|
438
430
|
options: {};
|
|
439
431
|
} & {
|
|
440
432
|
catchall: <C extends SchemaType>(catchallSchema: C) => LoroMapSchemaWithCatchall<{
|
|
441
433
|
seqMarker: /*elided*/any;
|
|
442
434
|
volume: /*elided*/any;
|
|
435
|
+
source: /*elided*/any;
|
|
436
|
+
anchor: /*elided*/any;
|
|
443
437
|
}, C>;
|
|
444
438
|
}> & {
|
|
445
439
|
options: {};
|
|
@@ -480,7 +474,19 @@ declare const medeoDslLoroShape: RootSchemaType<{
|
|
|
480
474
|
}> & {
|
|
481
475
|
options: {};
|
|
482
476
|
};
|
|
477
|
+
'phonetic-script-entities': LoroMapSchemaWithCatchall<{}, LoroMapSchema<{
|
|
478
|
+
phoneme: /*elided*/any;
|
|
479
|
+
}> & {
|
|
480
|
+
options: {};
|
|
481
|
+
} & {
|
|
482
|
+
catchall: <C extends SchemaType>(catchallSchema: C) => LoroMapSchemaWithCatchall<{
|
|
483
|
+
phoneme: /*elided*/any;
|
|
484
|
+
}, C>;
|
|
485
|
+
}> & {
|
|
486
|
+
options: {};
|
|
487
|
+
};
|
|
483
488
|
'caption-entities': LoroMapSchemaWithCatchall<{}, LoroMapSchema<{
|
|
489
|
+
selection: /*elided*/any;
|
|
484
490
|
text: /*elided*/any;
|
|
485
491
|
style: /*elided*/any;
|
|
486
492
|
}> & {
|
|
@@ -489,6 +495,7 @@ declare const medeoDslLoroShape: RootSchemaType<{
|
|
|
489
495
|
};
|
|
490
496
|
} & {
|
|
491
497
|
catchall: <C extends SchemaType>(catchallSchema: C) => LoroMapSchemaWithCatchall<{
|
|
498
|
+
selection: /*elided*/any;
|
|
492
499
|
text: /*elided*/any;
|
|
493
500
|
style: /*elided*/any;
|
|
494
501
|
}, C>;
|
|
@@ -512,82 +519,9 @@ declare const medeoDslLoroShape: RootSchemaType<{
|
|
|
512
519
|
readonly mergeableMapChildContainers: true;
|
|
513
520
|
};
|
|
514
521
|
};
|
|
515
|
-
'asset-entities': LoroMapSchemaWithCatchall<{}, LoroMapSchema<{
|
|
516
|
-
system: /*elided*/any;
|
|
517
|
-
key: /*elided*/any;
|
|
518
|
-
storageKey: /*elided*/any;
|
|
519
|
-
digest: /*elided*/any;
|
|
520
|
-
}> & {
|
|
521
|
-
options: {};
|
|
522
|
-
} & {
|
|
523
|
-
catchall: <C extends SchemaType>(catchallSchema: C) => LoroMapSchemaWithCatchall<{
|
|
524
|
-
system: /*elided*/any;
|
|
525
|
-
key: /*elided*/any;
|
|
526
|
-
storageKey: /*elided*/any;
|
|
527
|
-
digest: /*elided*/any;
|
|
528
|
-
}, C>;
|
|
529
|
-
}> & {
|
|
530
|
-
options: {
|
|
531
|
-
readonly mergeableMapChildContainers: true;
|
|
532
|
-
};
|
|
533
|
-
};
|
|
534
522
|
'contain-relations': LoroTreeSchema<{
|
|
535
523
|
entityId: /*elided*/any;
|
|
536
524
|
}>;
|
|
537
|
-
'clip-source-relations': LoroMapSchemaWithCatchall<{}, LoroMapSchema<Record<string, StringSchemaType<string> & {
|
|
538
|
-
options: {};
|
|
539
|
-
} & {
|
|
540
|
-
transform: <D>(def: TransformDefinition<string, D>) => StringSchemaType<string> & {
|
|
541
|
-
options: {};
|
|
542
|
-
transform: TransformDefinition<string, D>;
|
|
543
|
-
};
|
|
544
|
-
}>> & {
|
|
545
|
-
options: {};
|
|
546
|
-
} & {
|
|
547
|
-
catchall: <C extends SchemaType>(catchallSchema: C) => LoroMapSchemaWithCatchall<Record<string, StringSchemaType<string> & {
|
|
548
|
-
options: {};
|
|
549
|
-
} & {
|
|
550
|
-
transform: <D>(def: TransformDefinition<string, D>) => StringSchemaType<string> & {
|
|
551
|
-
options: {};
|
|
552
|
-
transform: TransformDefinition<string, D>;
|
|
553
|
-
};
|
|
554
|
-
}>, C>;
|
|
555
|
-
}> & {
|
|
556
|
-
options: {
|
|
557
|
-
readonly mergeableMapChildContainers: true;
|
|
558
|
-
};
|
|
559
|
-
};
|
|
560
|
-
'time-anchor-relations': LoroMapSchemaWithCatchall<{}, StringSchemaType<string> & {
|
|
561
|
-
options: {};
|
|
562
|
-
transform: TransformDefinition<string, TimeAnchor | InvalidAtomic>;
|
|
563
|
-
}> & {
|
|
564
|
-
options: {};
|
|
565
|
-
};
|
|
566
|
-
'caption-content-relations': LoroMapSchemaWithCatchall<{}, StringSchemaType<string> & {
|
|
567
|
-
options: {};
|
|
568
|
-
transform: TransformDefinition<string, CaptionContent | InvalidAtomic>;
|
|
569
|
-
}> & {
|
|
570
|
-
options: {};
|
|
571
|
-
};
|
|
572
|
-
'caption-alignment-relations': LoroMapSchemaWithCatchall<{}, LoroMapSchema<{
|
|
573
|
-
captionId: /*elided*/any;
|
|
574
|
-
mediaId: /*elided*/any;
|
|
575
|
-
startMs: /*elided*/any;
|
|
576
|
-
endMs: /*elided*/any;
|
|
577
|
-
}> & {
|
|
578
|
-
options: {};
|
|
579
|
-
} & {
|
|
580
|
-
catchall: <C extends SchemaType>(catchallSchema: C) => LoroMapSchemaWithCatchall<{
|
|
581
|
-
captionId: /*elided*/any;
|
|
582
|
-
mediaId: /*elided*/any;
|
|
583
|
-
startMs: /*elided*/any;
|
|
584
|
-
endMs: /*elided*/any;
|
|
585
|
-
}, C>;
|
|
586
|
-
}> & {
|
|
587
|
-
options: {
|
|
588
|
-
readonly mergeableMapChildContainers: true;
|
|
589
|
-
};
|
|
590
|
-
};
|
|
591
525
|
'voice-timbre-relations': LoroMapSchemaWithCatchall<{}, LoroMapSchema<Record<string, StringSchemaType<string> & {
|
|
592
526
|
options: {};
|
|
593
527
|
} & {
|
|
@@ -634,52 +568,6 @@ declare const medeoDslLoroShape: RootSchemaType<{
|
|
|
634
568
|
readonly mergeableMapChildContainers: true;
|
|
635
569
|
};
|
|
636
570
|
};
|
|
637
|
-
'from-asset-relations': LoroMapSchemaWithCatchall<{}, LoroMapSchema<Record<string, StringSchemaType<string> & {
|
|
638
|
-
options: {};
|
|
639
|
-
} & {
|
|
640
|
-
transform: <D>(def: TransformDefinition<string, D>) => StringSchemaType<string> & {
|
|
641
|
-
options: {};
|
|
642
|
-
transform: TransformDefinition<string, D>;
|
|
643
|
-
};
|
|
644
|
-
}>> & {
|
|
645
|
-
options: {};
|
|
646
|
-
} & {
|
|
647
|
-
catchall: <C extends SchemaType>(catchallSchema: C) => LoroMapSchemaWithCatchall<Record<string, StringSchemaType<string> & {
|
|
648
|
-
options: {};
|
|
649
|
-
} & {
|
|
650
|
-
transform: <D>(def: TransformDefinition<string, D>) => StringSchemaType<string> & {
|
|
651
|
-
options: {};
|
|
652
|
-
transform: TransformDefinition<string, D>;
|
|
653
|
-
};
|
|
654
|
-
}>, C>;
|
|
655
|
-
}> & {
|
|
656
|
-
options: {
|
|
657
|
-
readonly mergeableMapChildContainers: true;
|
|
658
|
-
};
|
|
659
|
-
};
|
|
660
|
-
'to-asset-relations': LoroMapSchemaWithCatchall<{}, LoroMapSchema<Record<string, StringSchemaType<string> & {
|
|
661
|
-
options: {};
|
|
662
|
-
} & {
|
|
663
|
-
transform: <D>(def: TransformDefinition<string, D>) => StringSchemaType<string> & {
|
|
664
|
-
options: {};
|
|
665
|
-
transform: TransformDefinition<string, D>;
|
|
666
|
-
};
|
|
667
|
-
}>> & {
|
|
668
|
-
options: {};
|
|
669
|
-
} & {
|
|
670
|
-
catchall: <C extends SchemaType>(catchallSchema: C) => LoroMapSchemaWithCatchall<Record<string, StringSchemaType<string> & {
|
|
671
|
-
options: {};
|
|
672
|
-
} & {
|
|
673
|
-
transform: <D>(def: TransformDefinition<string, D>) => StringSchemaType<string> & {
|
|
674
|
-
options: {};
|
|
675
|
-
transform: TransformDefinition<string, D>;
|
|
676
|
-
};
|
|
677
|
-
}>, C>;
|
|
678
|
-
}> & {
|
|
679
|
-
options: {
|
|
680
|
-
readonly mergeableMapChildContainers: true;
|
|
681
|
-
};
|
|
682
|
-
};
|
|
683
571
|
}> & {
|
|
684
572
|
options: {};
|
|
685
573
|
};
|
|
@@ -695,6 +583,22 @@ type MedeoDslDraft = DraftFields<Omit<Input, 'contain-relations'>> & {
|
|
|
695
583
|
'contain-relations': ContainDraftNode[];
|
|
696
584
|
};
|
|
697
585
|
//#endregion
|
|
586
|
+
//#region ../medeo-dsl/src/schema/codec.d.ts
|
|
587
|
+
interface InvalidAtomic {
|
|
588
|
+
invalid: true;
|
|
589
|
+
raw: string;
|
|
590
|
+
reason: string;
|
|
591
|
+
}
|
|
592
|
+
declare function isInvalidAtomic(value: unknown): value is InvalidAtomic;
|
|
593
|
+
interface AtomicCodec<T> {
|
|
594
|
+
encode(value: T | InvalidAtomic): string;
|
|
595
|
+
decode(raw: string): T | InvalidAtomic;
|
|
596
|
+
}
|
|
597
|
+
/** A Clip's time anchor; the Clip holding it is the anchored end. */
|
|
598
|
+
declare const timeAnchorCodec: AtomicCodec<TimeAnchor>;
|
|
599
|
+
/** A Caption's selection; Cursors are stored as their native bytes in unpadded base64url. */
|
|
600
|
+
declare const captionContentCodec: AtomicCodec<CaptionContent>;
|
|
601
|
+
//#endregion
|
|
698
602
|
//#region ../medeo-dsl/src/schema/document-format.d.ts
|
|
699
603
|
/** Format discrimination does not register containers or alter the document. */
|
|
700
604
|
declare function documentFormat(doc: LoroDoc): 'dsl' | 'legacy' | 'mixed' | 'unknown';
|
|
@@ -765,7 +669,7 @@ declare class MedeoDsl {
|
|
|
765
669
|
editText(scriptId: string, expectedBodyId: string, edits: readonly TextEdit[], audit: DslAudit): void;
|
|
766
670
|
editCaptionText(captionId: string, expectedBodyId: string, edits: readonly TextEdit[], audit: DslAudit): void;
|
|
767
671
|
/** Local ranges exclude insertions at their start and include insertions at their end. K01 remains deferred. */
|
|
768
|
-
textRange(scriptId: string, start: number, end: number):
|
|
672
|
+
textRange(scriptId: string, start: number, end: number): CaptionContent;
|
|
769
673
|
dispose(): void;
|
|
770
674
|
private mutate;
|
|
771
675
|
private notify;
|
|
@@ -937,4 +841,4 @@ interface ImportedVideoDraft {
|
|
|
937
841
|
/** One-time import into a newly owned document; never reverse-diff a live collaborative document. */
|
|
938
842
|
declare function fromVideoDraft(input: VideoDraftInput, options: FromVideoDraftOptions): ImportedVideoDraft;
|
|
939
843
|
//#endregion
|
|
940
|
-
export { AddDslClip as A,
|
|
844
|
+
export { AddDslClip as A, InvalidAtomic as C, MedeoDslDraft as D, timeAnchorCodec as E, ReplaceDslClipsInput as F, ClipPlacement as I, ClipSource as M, DslClipUpdate as N, MedeoDslLoroState as O, MoveDslClipsInput as P, documentFormat as S, isInvalidAtomic as T, MedeoDsl as _, toVideoDraft as a, UnsupportedDocumentFormatError as b, DslLayout as c, createInitialMedeoDsl as d, DslEditor as f, CreateMedeoDslOptions as g, VoiceoverResult as h, VideoDraftProjection as i, AddDslClipsInput as j, medeoDslLoroShape as k, DslProjectionError as l, VoiceoverCaptionInput as m, ImportedVideoDraft as n, resolveDslLayout as o, ApplyVoiceoverInput as p, fromVideoDraft as r, DslClipLayout as s, FromVideoDraftOptions as t, DslTrackLayout as u, DslAudit as v, captionContentCodec as w, assertDslDocument as x, DslTransaction as y };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { _ as MedeoDsl, f as DslEditor, i as VideoDraftProjection } from "./index-
|
|
3
|
-
import {
|
|
1
|
+
import { $ as TrackRole, R as MedeoDslSnapshot, W as ResourceSystem } from "./video-draft-types-BfkIuW5f.js";
|
|
2
|
+
import { _ as MedeoDsl, f as DslEditor, i as VideoDraftProjection } from "./index-DP9FG0z_.js";
|
|
3
|
+
import { _ as ManualSyncTransport, a as MengineDocSessionOptions, g as ManualSyncDocOptions, n as DocumentSession, r as DocumentSessionUpdateEvent } from "./index-CwG4lYKp.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. */
|
|
@@ -30,6 +30,12 @@ declare class ManualSyncDoc extends ManualSyncTransport {
|
|
|
30
30
|
readonly fillTimeline?: true | undefined;
|
|
31
31
|
};
|
|
32
32
|
readonly volume?: number | undefined;
|
|
33
|
+
readonly source: string;
|
|
34
|
+
readonly anchor?: {
|
|
35
|
+
readonly to: string;
|
|
36
|
+
readonly offsetMs: number;
|
|
37
|
+
readonly fallback_abs_ms: number;
|
|
38
|
+
} | undefined;
|
|
33
39
|
};
|
|
34
40
|
};
|
|
35
41
|
readonly "media-entities": {
|
|
@@ -61,8 +67,21 @@ declare class ManualSyncDoc extends ManualSyncTransport {
|
|
|
61
67
|
readonly defaultLanguage?: string | undefined;
|
|
62
68
|
};
|
|
63
69
|
};
|
|
70
|
+
readonly "phonetic-script-entities": {
|
|
71
|
+
readonly [x: string]: {
|
|
72
|
+
readonly phoneme: {
|
|
73
|
+
readonly audioScriptId: string;
|
|
74
|
+
readonly phonemeScript?: string | undefined;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
};
|
|
64
78
|
readonly "caption-entities": {
|
|
65
79
|
readonly [x: string]: {
|
|
80
|
+
readonly selection?: {
|
|
81
|
+
readonly audioScriptId: string;
|
|
82
|
+
readonly start: import("loro-crdt").Cursor;
|
|
83
|
+
readonly end: import("loro-crdt").Cursor;
|
|
84
|
+
} | undefined;
|
|
66
85
|
readonly text?: string | undefined;
|
|
67
86
|
readonly style?: {
|
|
68
87
|
readonly font?: {
|
|
@@ -88,44 +107,6 @@ declare class ManualSyncDoc extends ManualSyncTransport {
|
|
|
88
107
|
readonly name?: string | undefined;
|
|
89
108
|
};
|
|
90
109
|
};
|
|
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
110
|
readonly "voice-timbre-relations": {
|
|
130
111
|
readonly [x: string]: {
|
|
131
112
|
readonly recordingId: string;
|
|
@@ -138,18 +119,6 @@ declare class ManualSyncDoc extends ManualSyncTransport {
|
|
|
138
119
|
readonly sourceId: string;
|
|
139
120
|
};
|
|
140
121
|
};
|
|
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;
|
|
151
|
-
};
|
|
152
|
-
};
|
|
153
122
|
readonly 'contain-relations': readonly {
|
|
154
123
|
readonly treeId: import("loro-crdt").TreeID;
|
|
155
124
|
readonly entityId: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { A as AddDslClip, C 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 TrackRole, A as DeepReadonly, B as RelationMutation, C as CaptionContent, D as Clip, E as CaptionText, F as EntityTables, G as RichTextSnapshot, H as RelationTables, I as EntityValues, J as TextMark, K as TextDelta, L as FieldPatch, M as DslMutation, N as EntityMutation, O as ContainMutation, P as EntityTable, Q as Track, R as MedeoDslSnapshot, S as Caption, T as CaptionStyle, U as RelationValues, V as RelationTable, W as ResourceSystem, X as TextRun, Y as TextMutation, Z as TimeAnchor, _ as defaultIdFactory, a as VideoDraftCaptionStyle, b as tupleHash, c as VideoDraftInput, d as VideoDraftTrack, et as Voice, f as VideoDraftTrackItem, g as EntityIdKind, h as DslIdFactory, i as VideoDraft, j as DslDiagnostic, k as ContainNode, l as VideoDraftPartUnion, m as OpActor, n as DEFAULT_UNIT_TIME_MS, o as VideoDraftContent, p as CommitOptions, q as TextEdit, r as VideoCreationSettings, s as VideoDraftContentPartUnion, t as CaptionDisplayCue, u as VideoDraftTimeline, v as relationId, w as CaptionSelection, x as AudioScript, y as resourceId, z as Media } from "./video-draft-types-BfkIuW5f.js";
|
|
2
|
+
import { A as AddDslClip, C as InvalidAtomic, D as MedeoDslDraft, E as timeAnchorCodec, F as ReplaceDslClipsInput, I as ClipPlacement, M as ClipSource, N as DslClipUpdate, O as MedeoDslLoroState, P as MoveDslClipsInput, S as documentFormat, T as isInvalidAtomic, _ as MedeoDsl, a as toVideoDraft, b as UnsupportedDocumentFormatError, c as DslLayout, d as createInitialMedeoDsl, f as DslEditor, g as CreateMedeoDslOptions, h as VoiceoverResult, i as VideoDraftProjection, j as AddDslClipsInput, k as medeoDslLoroShape, l as DslProjectionError, m as VoiceoverCaptionInput, n as ImportedVideoDraft, o as resolveDslLayout, p as ApplyVoiceoverInput, r as fromVideoDraft, s as DslClipLayout, t as FromVideoDraftOptions, u as DslTrackLayout, v as DslAudit, w as captionContentCodec, x as assertDslDocument, y as DslTransaction } from "./index-DP9FG0z_.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-CwG4lYKp.js";
|
|
4
|
+
import { n as MengineDocSessionUpdateEvent, r as ManualSyncDoc, t as MengineDocSession } from "./index-W1eHhVus.js";
|
|
5
|
+
export { type AddDslClip, type AddDslClipsInput, type ApplyVoiceoverInput, type AudioScript, 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 TextDelta, type TextEdit, type TextMark, type TextMutation, type TextRun, type TimeAnchor, type Track, type TrackRole, UnsupportedDocumentFormatError, 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, 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 MedeoDsl, i as DslEditor, n as toVideoDraft, o as resolveDslLayout, r as createInitialMedeoDsl, s as DslProjectionError, t as fromVideoDraft } from "./dsl-
|
|
5
|
-
import { UndoManager, VersionVector } from "loro-crdt";
|
|
3
|
+
import { a as documentFormat, c as isInvalidAtomic, ft as defaultIdFactory, ht as tupleHash, i as assertDslDocument, l as timeAnchorCodec, mt as resourceId, o as medeoDslLoroShape, pt as relationId, r as UnsupportedDocumentFormatError, s as captionContentCodec, t as DEFAULT_UNIT_TIME_MS } from "./video-draft-types-DvPeam87.js";
|
|
4
|
+
import { a as MedeoDsl, i as DslEditor, n as toVideoDraft, o as resolveDslLayout, r as createInitialMedeoDsl, s as DslProjectionError, t as fromVideoDraft } from "./dsl-Dm3Sq1fa.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
|
|
@@ -222,6 +222,7 @@ var DocumentSession = class {
|
|
|
222
222
|
started = false;
|
|
223
223
|
startTask = null;
|
|
224
224
|
destroyed = false;
|
|
225
|
+
closeTask = null;
|
|
225
226
|
lifetime = null;
|
|
226
227
|
hasConnected = false;
|
|
227
228
|
initialVersionValue = null;
|
|
@@ -438,6 +439,13 @@ var DocumentSession = class {
|
|
|
438
439
|
this.local.connection.connect();
|
|
439
440
|
await this.local.connection.waitForConnected().abortOn(this.lifetime.signal);
|
|
440
441
|
if (this.destroyed) throw new Error("mengine doc session destroyed");
|
|
442
|
+
if (this.options.initialSnapshot) {
|
|
443
|
+
await this.local.pushDocUpdate({
|
|
444
|
+
docId: this.docId,
|
|
445
|
+
data: this.options.initialSnapshot
|
|
446
|
+
}, "initial-snapshot");
|
|
447
|
+
if (this.destroyed) throw new Error("mengine doc session destroyed");
|
|
448
|
+
}
|
|
441
449
|
this.server.connection.connect();
|
|
442
450
|
this.synchronizer.start();
|
|
443
451
|
this.manager.start();
|
|
@@ -446,6 +454,10 @@ var DocumentSession = class {
|
|
|
446
454
|
const doc = this.manager.connectDoc(this.docId);
|
|
447
455
|
this.disposables.add(() => this.manager.disconnectDoc(this.docId));
|
|
448
456
|
if (this.options.peerId != null) doc.setPeerId(this.options.peerId);
|
|
457
|
+
this.disposables.add(this.manager.onLocalUpdateReceived(this.docId, (update) => {
|
|
458
|
+
this.trackLocalVersion(decodeImportBlobMeta(update, true).partialEndVersionVector);
|
|
459
|
+
this.emitSyncState();
|
|
460
|
+
}));
|
|
449
461
|
this.disposables.add(this.manager.onDocStateChange(this.docId, (state) => {
|
|
450
462
|
this.events.emit("state", state);
|
|
451
463
|
this.emitSyncState();
|
|
@@ -455,7 +467,7 @@ var DocumentSession = class {
|
|
|
455
467
|
this.adapterValue = this.model(doc, this.mutationGuard);
|
|
456
468
|
this.disposables.add(this.adapterValue.subscribe((source) => {
|
|
457
469
|
if (!this.adapterValue) return;
|
|
458
|
-
if (source === "local") this.
|
|
470
|
+
if (source === "local") this.trackLocalVersion(doc.version());
|
|
459
471
|
this.emitSyncState();
|
|
460
472
|
this.events.emit("update", {
|
|
461
473
|
source,
|
|
@@ -470,9 +482,39 @@ var DocumentSession = class {
|
|
|
470
482
|
this.undoManagerValue = new DocumentUndoManager(doc, this.mutationGuard, () => this.events.emit("undoState"));
|
|
471
483
|
this.editorValue = this.adapterValue.editor;
|
|
472
484
|
this.initialVersionValue = doc.version();
|
|
485
|
+
if (this.localVersionValue) this.trackLocalVersion(this.initialVersionValue);
|
|
473
486
|
this.emitSyncState();
|
|
474
487
|
return this.snapshot();
|
|
475
488
|
}
|
|
489
|
+
getLocalSaveState() {
|
|
490
|
+
return this.getState().localSave;
|
|
491
|
+
}
|
|
492
|
+
/** Immediately reports local transaction state; independent of server confirmation. */
|
|
493
|
+
subscribeLocalSaveState(cb) {
|
|
494
|
+
const off = this.events.on("state", () => cb(this.getLocalSaveState()));
|
|
495
|
+
cb(this.getLocalSaveState());
|
|
496
|
+
return off;
|
|
497
|
+
}
|
|
498
|
+
/** Waits until all local saves finish, including edits made while waiting. Does not wait for the network. */
|
|
499
|
+
async waitForLocalSave(options = {}) {
|
|
500
|
+
if (!this.editorValue || this.destroyed) throw new Error("mengine doc session is not started");
|
|
501
|
+
await this.manager.waitForLocalSave(this.docId).timeout(options.timeoutMs ?? 15e3);
|
|
502
|
+
}
|
|
503
|
+
/** Stop accepting edits and drain local persistence before releasing resources.
|
|
504
|
+
* A failed local write keeps retrying, even after the host has unmounted.
|
|
505
|
+
* Hosts should use this for normal teardown; destroy() is immediate cancellation. */
|
|
506
|
+
close() {
|
|
507
|
+
if (this.closeTask) return this.closeTask;
|
|
508
|
+
if (this.destroyed || !this.editorValue) {
|
|
509
|
+
this.destroy();
|
|
510
|
+
return Promise.resolve();
|
|
511
|
+
}
|
|
512
|
+
this.mutationGuard.close();
|
|
513
|
+
this.synchronizer.stop();
|
|
514
|
+
this.server.connection.disconnect();
|
|
515
|
+
this.closeTask = this.manager.waitForLocalSave(this.docId).then(() => this.destroy());
|
|
516
|
+
return this.closeTask;
|
|
517
|
+
}
|
|
476
518
|
getSyncState() {
|
|
477
519
|
const state = this.getState();
|
|
478
520
|
const target = this.confirmationTarget();
|
|
@@ -483,6 +525,14 @@ var DocumentSession = class {
|
|
|
483
525
|
phase: connection === "disconnected" ? "offline" : this.pushErrorValue != null || state.error != null ? "failed" : connection === "connecting" ? "connecting" : state.syncing ? "syncing" : "idle"
|
|
484
526
|
};
|
|
485
527
|
}
|
|
528
|
+
trackLocalVersion(version) {
|
|
529
|
+
const target = VersionVector.parseJSON(this.confirmationTarget()?.toJSON() ?? /* @__PURE__ */ new Map());
|
|
530
|
+
for (const [peer, counter] of version.toJSON()) if ((target.get(peer) ?? 0) < counter) target.setEnd({
|
|
531
|
+
peer,
|
|
532
|
+
counter
|
|
533
|
+
});
|
|
534
|
+
this.localVersionValue = target;
|
|
535
|
+
}
|
|
486
536
|
confirmationTarget() {
|
|
487
537
|
return this.localVersionValue ?? this.initialVersionValue;
|
|
488
538
|
}
|
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-BfkIuW5f.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-CwG4lYKp.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-DvPeam87.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 { _ as MedeoDsl } from "./index-
|
|
1
|
+
import { i as VideoDraft } from "./video-draft-types-BfkIuW5f.js";
|
|
2
|
+
import { _ as MedeoDsl } from "./index-DP9FG0z_.js";
|
|
3
3
|
import { LoroDoc } from "loro-crdt";
|
|
4
4
|
|
|
5
5
|
//#region src/testing/in-memory-mengine-server.d.ts
|