@mengine/medeo-client 1.3.1-alpha.1 → 1.3.1-alpha.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.
@@ -914,7 +914,7 @@ interface CaptionTextRange extends JsonObject {
914
914
  * One ordered entry of the Caption's segment selection. `segmentId` quotes the
915
915
  * composed AudioScript's own stable segment identity — a local id quoted by the
916
916
  * variant, never a peer Entity reference. Text itself is never copied here;
917
- * complete Caption content is assembled along the caption-composition Relation.
917
+ * complete Caption content is assembled through its direct baseEntityIds.
918
918
  * The optional `textRange` narrows one Segment to an intra-Segment sub-span
919
919
  * (intra-segment re-segmentation); without it the whole Segment text is selected.
920
920
  */
@@ -924,7 +924,7 @@ type CaptionSegmentSelection = JsonObject & {
924
924
  };
925
925
  //#endregion
926
926
  //#region ../medeo-dsl/src/relations.d.ts
927
- type KnownRelationKind = 'timeline-track' | 'track-clip' | 'clip-marker' | 'marker-content' | 'axvideo-marker' | 'marker-timeline' | 'physical-asset' | 'generated' | 'phonetic-script-composition' | 'caption-composition' | 'caption-alignment' | 'clip-anchor' | 'phonetic-script-render' | 'audio-script-source' | 'audio-script-marker';
927
+ type KnownRelationKind = 'timeline-track' | 'track-clip' | 'clip-marker' | 'marker-content' | 'axvideo-marker' | 'marker-timeline' | 'physical-asset' | 'generated' | 'caption-alignment' | 'clip-anchor' | 'phonetic-script-render' | 'audio-script-source' | 'audio-script-marker';
928
928
  type RelationKind = KnownRelationKind | (string & {});
929
929
  type RelationTrace = JsonObject;
930
930
  /**
@@ -1767,4 +1767,4 @@ declare const videoDocumentSchema: z.ZodObject<{
1767
1767
  }, z.core.$loose>]>>>;
1768
1768
  }, z.core.$loose>;
1769
1769
  //#endregion
1770
- export { VoiceDescriptor as $, generatePartId as A, effectiveVideoClipDurationMs as At, ResolvedEntityClipPlacement as B, PlannedSemanticOpKind as C, VideoClipPart as Ct, SnapshotReadable as D, VideoDocumentValidationIssueCode as Dt, SchemaValidator as E, VideoDocumentValidationIssue as Et, videoDocumentMirrorSchema as F, PartAggregation as Ft, EntityTimelineProjectionError as G, ResolvedEntityTrack as H, VideoDocumentValidationError as I, SpeedShift as It, CaptionSegmentSelection as J, EntityRelationRows as K, assertValidVideoDocument as L, Timeline$1 as Lt, TrackItemDraft as M, Attachment as Mt, VideoDocumentDraft as N, CaptionPart$1 as Nt, ValidationError as O, VideoDraft as Ot, VideoDocumentMirrorSchema as P, CaptionStyle as Pt, SequenceRange as Q, validateVideoDocument as R, Track$1 as Rt, ImplementedSemanticOpKind as S, VIDEO_DOCUMENT_SCHEMA_VERSION as St, isImplementedSemanticOpKind as T, VideoDocumentSchemaVersion as Tt, resolveEntityTimelineLayout as U, ResolvedEntityTimelineLayout as V, projectEntityTimeline as W, ScriptTextSegment as X, CaptionStyleFields as Y, SequenceDuration as Z, SemanticEditor as _, SpeechPart as _t, PlainMemoryAdapter as a, DerivedItemPosition as at, TransactAudit as b, TrackItem as bt, MirrorVideoDocumentAdapter as c, derivePositionFromAbs as ct, createMirrorVideoDocument as d, BgmPart as dt, JsonObject as et, createMirrorVideoDocumentAdapter as f, CaptionPart as ft, SemanticDocumentAdapter as g, PartUnion as gt, OpActor as h, PartKind as ht, JournalEntry as i, buildInitialVideoDocument as it, TrackDraft as j, speedOf as jt, PartIdFactory as k, VideoDraftPartUnion as kt, MirrorVideoDocumentOptions as l, fromVideoDocument as lt, CommitOptions as m, ENTITY_TIMELINE_PROJECTION_SCHEMA_VERSION as mt, videoDocumentSchema as n, EntityId as nt, PlainMemoryAdapterOptions as o, SpeechHostMap as ot, writeVideoDocumentToDraft as p, DEFAULT_UNIT_TIME_MS as pt, EntityRow as q, readVideoDocumentFromDraft as r, InitialDocumentFacts as rt, createPlainMemoryAdapter as s, buildSpeechHostMap as st, partUnionSchema as t, JsonValue as tt, applyEntityTimelineProjection as u, toVideoDocument as ut, SemanticOpInput as v, Timeline as vt, SemanticOpKind as w, VideoDocument as wt, IMPLEMENTED_SEMANTIC_OP_KINDS as x, TrackItemTimePosition as xt, SemanticOpName as y, Track as yt, EntityTimelineTrackRole as z, TrackItem$1 as zt };
1770
+ export { SequenceRange as $, generatePartId as A, VideoDraftPartUnion as At, ResolvedEntityClipPlacement as B, TrackItem$1 as Bt, PlannedSemanticOpKind as C, VIDEO_DOCUMENT_SCHEMA_VERSION as Ct, SnapshotReadable as D, VideoDocumentValidationIssue as Dt, SchemaValidator as E, VideoDocumentSchemaVersion as Et, videoDocumentMirrorSchema as F, CaptionStyle as Ft, EntityTimelineProjectionError as G, ResolvedEntityTrack as H, VideoDocumentValidationError as I, PartAggregation as It, RelationRow as J, EntityRelationRows as K, assertValidVideoDocument as L, SpeedShift as Lt, TrackItemDraft as M, speedOf as Mt, VideoDocumentDraft as N, Attachment as Nt, ValidationError as O, VideoDocumentValidationIssueCode as Ot, VideoDocumentMirrorSchema as P, CaptionPart$1 as Pt, SequenceDuration as Q, validateVideoDocument as R, Timeline$1 as Rt, ImplementedSemanticOpKind as S, TrackItemTimePosition as St, isImplementedSemanticOpKind as T, VideoDocument as Tt, resolveEntityTimelineLayout as U, ResolvedEntityTimelineLayout as V, projectEntityTimeline as W, CaptionStyleFields as X, CaptionSegmentSelection as Y, ScriptTextSegment as Z, SemanticEditor as _, PartUnion as _t, PlainMemoryAdapter as a, buildInitialVideoDocument as at, TransactAudit as b, Track as bt, MirrorVideoDocumentAdapter as c, buildSpeechHostMap as ct, createMirrorVideoDocument as d, toVideoDocument as dt, VoiceDescriptor as et, createMirrorVideoDocumentAdapter as f, BgmPart as ft, SemanticDocumentAdapter as g, PartKind as gt, OpActor as h, ENTITY_TIMELINE_PROJECTION_SCHEMA_VERSION as ht, JournalEntry as i, InitialDocumentFacts as it, TrackDraft as j, effectiveVideoClipDurationMs as jt, PartIdFactory as k, VideoDraft as kt, MirrorVideoDocumentOptions as l, derivePositionFromAbs as lt, CommitOptions as m, DEFAULT_UNIT_TIME_MS as mt, videoDocumentSchema as n, JsonValue as nt, PlainMemoryAdapterOptions as o, DerivedItemPosition as ot, writeVideoDocumentToDraft as p, CaptionPart as pt, EntityRow as q, readVideoDocumentFromDraft as r, EntityId as rt, createPlainMemoryAdapter as s, SpeechHostMap as st, partUnionSchema as t, JsonObject as tt, applyEntityTimelineProjection as u, fromVideoDocument as ut, SemanticOpInput as v, SpeechPart as vt, SemanticOpKind as w, VideoClipPart as wt, IMPLEMENTED_SEMANTIC_OP_KINDS as x, TrackItem as xt, SemanticOpName as y, Timeline as yt, EntityTimelineTrackRole as z, Track$1 as zt };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { t as index_d_exports } from "./index-CMa6ZCtX.js";
2
- import { $ as VoiceDescriptor, A as generatePartId, At as effectiveVideoClipDurationMs, B as ResolvedEntityClipPlacement, C as PlannedSemanticOpKind, Ct as VideoClipPart, D as SnapshotReadable, Dt as VideoDocumentValidationIssueCode, E as SchemaValidator, Et as VideoDocumentValidationIssue, F as videoDocumentMirrorSchema, Ft as PartAggregation, G as EntityTimelineProjectionError, H as ResolvedEntityTrack, I as VideoDocumentValidationError, It as SpeedShift, J as CaptionSegmentSelection, K as EntityRelationRows, L as assertValidVideoDocument, Lt as Timeline$1, M as TrackItemDraft, Mt as Attachment, N as VideoDocumentDraft, Nt as CaptionPart$1, O as ValidationError, Ot as VideoDraft, P as VideoDocumentMirrorSchema, Pt as CaptionStyle, Q as SequenceRange, R as validateVideoDocument, Rt as Track$1, S as ImplementedSemanticOpKind, St as VIDEO_DOCUMENT_SCHEMA_VERSION, T as isImplementedSemanticOpKind, Tt as VideoDocumentSchemaVersion, U as resolveEntityTimelineLayout, V as ResolvedEntityTimelineLayout, W as projectEntityTimeline, X as ScriptTextSegment, Y as CaptionStyleFields, Z as SequenceDuration, _ as SemanticEditor, _t as SpeechPart, a as PlainMemoryAdapter, at as DerivedItemPosition, b as TransactAudit, bt as TrackItem, c as MirrorVideoDocumentAdapter, ct as derivePositionFromAbs, d as createMirrorVideoDocument, dt as BgmPart, et as JsonObject, f as createMirrorVideoDocumentAdapter, ft as CaptionPart, g as SemanticDocumentAdapter, gt as PartUnion, h as OpActor, ht as PartKind, i as JournalEntry, it as buildInitialVideoDocument, j as TrackDraft, jt as speedOf, k as PartIdFactory, kt as VideoDraftPartUnion, l as MirrorVideoDocumentOptions, lt as fromVideoDocument, m as CommitOptions, mt as ENTITY_TIMELINE_PROJECTION_SCHEMA_VERSION, n as videoDocumentSchema, nt as EntityId, o as PlainMemoryAdapterOptions, ot as SpeechHostMap, p as writeVideoDocumentToDraft, pt as DEFAULT_UNIT_TIME_MS, q as EntityRow, r as readVideoDocumentFromDraft, rt as InitialDocumentFacts, s as createPlainMemoryAdapter, st as buildSpeechHostMap, t as partUnionSchema, tt as JsonValue, u as applyEntityTimelineProjection, ut as toVideoDocument, v as SemanticOpInput, vt as Timeline, w as SemanticOpKind, wt as VideoDocument, x as IMPLEMENTED_SEMANTIC_OP_KINDS, xt as TrackItemTimePosition, y as SemanticOpName, yt as Track, z as EntityTimelineTrackRole, zt as TrackItem$1 } from "./index-PYtGeXNk.js";
3
- import { PeerID } from "loro-crdt";
2
+ import { $ as SequenceRange, A as generatePartId, At as VideoDraftPartUnion, B as ResolvedEntityClipPlacement, Bt as TrackItem$1, C as PlannedSemanticOpKind, Ct as VIDEO_DOCUMENT_SCHEMA_VERSION, D as SnapshotReadable, Dt as VideoDocumentValidationIssue, E as SchemaValidator, Et as VideoDocumentSchemaVersion, F as videoDocumentMirrorSchema, Ft as CaptionStyle, G as EntityTimelineProjectionError, H as ResolvedEntityTrack, I as VideoDocumentValidationError, It as PartAggregation, J as RelationRow, K as EntityRelationRows, L as assertValidVideoDocument, Lt as SpeedShift, M as TrackItemDraft, Mt as speedOf, N as VideoDocumentDraft, Nt as Attachment, O as ValidationError, Ot as VideoDocumentValidationIssueCode, P as VideoDocumentMirrorSchema, Pt as CaptionPart$1, Q as SequenceDuration, R as validateVideoDocument, Rt as Timeline$1, S as ImplementedSemanticOpKind, St as TrackItemTimePosition, T as isImplementedSemanticOpKind, Tt as VideoDocument, U as resolveEntityTimelineLayout, V as ResolvedEntityTimelineLayout, W as projectEntityTimeline, X as CaptionStyleFields, Y as CaptionSegmentSelection, Z as ScriptTextSegment, _ as SemanticEditor, _t as PartUnion, a as PlainMemoryAdapter, at as buildInitialVideoDocument, b as TransactAudit, bt as Track, c as MirrorVideoDocumentAdapter, ct as buildSpeechHostMap, d as createMirrorVideoDocument, dt as toVideoDocument, et as VoiceDescriptor, f as createMirrorVideoDocumentAdapter, ft as BgmPart, g as SemanticDocumentAdapter, gt as PartKind, h as OpActor, ht as ENTITY_TIMELINE_PROJECTION_SCHEMA_VERSION, i as JournalEntry, it as InitialDocumentFacts, j as TrackDraft, jt as effectiveVideoClipDurationMs, k as PartIdFactory, kt as VideoDraft, l as MirrorVideoDocumentOptions, lt as derivePositionFromAbs, m as CommitOptions, mt as DEFAULT_UNIT_TIME_MS, n as videoDocumentSchema, nt as JsonValue, o as PlainMemoryAdapterOptions, ot as DerivedItemPosition, p as writeVideoDocumentToDraft, pt as CaptionPart, q as EntityRow, r as readVideoDocumentFromDraft, rt as EntityId, s as createPlainMemoryAdapter, st as SpeechHostMap, t as partUnionSchema, tt as JsonObject, u as applyEntityTimelineProjection, ut as fromVideoDocument, v as SemanticOpInput, vt as SpeechPart, w as SemanticOpKind, wt as VideoClipPart, x as IMPLEMENTED_SEMANTIC_OP_KINDS, xt as TrackItem, y as SemanticOpName, yt as Timeline, z as EntityTimelineTrackRole, zt as Track$1 } from "./index-Bs60N9Hl.js";
3
+ import { LoroDoc, PeerID } from "loro-crdt";
4
4
  import { DocState } from "@mengine/sync";
5
5
  import { BaseDocStorage, Connection, DocDiff, DocPushReceipt, DocSnapshotRecord, DocStorage, DocStorageOptions, DocUpdate, DocUpdateRecord } from "@mengine/storage";
6
6
 
@@ -179,13 +179,8 @@ interface MengineEventStreamOptions {
179
179
  declare function readMengineEventStream(options: MengineEventStreamOptions): Promise<void>;
180
180
  //#endregion
181
181
  //#region ../medeo-dsl/src/composition.d.ts
182
- type ScriptCompositionIssueCode = 'composition_missing' | 'composition_ambiguous' | 'composition_dangling' | 'unknown_segment' | 'empty_selection' | 'invalid_script' | 'invalid_selection';
183
- /**
184
- * Raised when a variant's complete content cannot be assembled from its
185
- * required composition Relation. Assembly never falls back to variant-local
186
- * text: a missing, ambiguous, or dangling source is an error, not an empty
187
- * read.
188
- */
182
+ type ScriptCompositionIssueCode = 'field_conflict' | 'composition_cycle' | 'invalid_bases' | 'composition_missing' | 'composition_ambiguous' | 'composition_dangling' | 'unknown_segment' | 'empty_selection' | 'invalid_script' | 'invalid_selection';
183
+ /** Assembly fails explicitly when declared bases cannot provide valid, unambiguous content. */
189
184
  declare class ScriptCompositionError extends Error {
190
185
  readonly code: ScriptCompositionIssueCode;
191
186
  readonly entityId: EntityId;
@@ -207,19 +202,13 @@ interface AssembledPhoneticScriptContent {
207
202
  /** Complete base text owned by the AudioScript. */
208
203
  readonly text: string;
209
204
  }
210
- /**
211
- * Resolve the one AudioScript a variant composes. Relations are queried from
212
- * both endpoints, so persisted endpoint positions do not matter.
213
- */
205
+ /** Validate all base providers before applying explicit own fields; ordering cannot resolve ambiguity. */
206
+ declare function assembleEntityContent(rows: EntityRelationRows, entityId: EntityId): EntityRow;
207
+ /** Find the actual AudioScript text owner through direct variant bases. */
214
208
  declare function findComposedAudioScript(rows: EntityRelationRows, variantEntityId: EntityId, variantKind: 'caption' | 'phonetic-script'): EntityRow<'audio-script'>;
215
209
  /** Join the whole AudioScript text in segment order. */
216
210
  declare function assembleScriptText(script: EntityRow<'audio-script'>): string;
217
- /**
218
- * Assemble the complete Caption content from its AudioScript: the selected
219
- * segments in selection order, joined as display text. The Caption payload
220
- * never carries text, so a broken composition fails here instead of silently
221
- * rendering an empty caption.
222
- */
211
+ /** Assemble selected text after base-field validation and explicit variant overrides. */
223
212
  declare function assembleCaptionContent(rows: EntityRelationRows, captionEntityId: EntityId): AssembledCaptionContent;
224
213
  /**
225
214
  * Assemble the complete Phonetic Script content for TTS: the composed
@@ -232,14 +221,17 @@ declare function selectAudioScriptSegments(script: EntityRow<'audio-script'>, se
232
221
  //#region src/entity-editor/entity-graph-http-client.d.ts
233
222
  /** One authenticated revision of the authoritative Medeo Entity graph. */
234
223
  interface EntityGraphState {
224
+ /** Current AudioScript content version attached to the project. */
225
+ readonly audioScriptEntityId: string;
235
226
  readonly revision: number;
227
+ readonly loroSnapshot: string;
236
228
  readonly rows: EntityRelationRows;
237
229
  }
238
230
  interface EntityGraphCommitOptions {
239
231
  /** Server version vector proving the explicit legacy-to-Entity migration baseline. */
240
232
  readonly migrationBaseVv?: string;
241
233
  }
242
- /** Browser-safe authenticated CAS client for a document's Entity graph. */
234
+ /** Browser-safe authenticated Loro client for a document's Entity graph. */
243
235
  declare class EntityGraphHttpClient {
244
236
  private readonly options;
245
237
  private readonly transport;
@@ -247,13 +239,15 @@ declare class EntityGraphHttpClient {
247
239
  constructor(options: MengineHttpClientOptions);
248
240
  fetchState(): Promise<EntityGraphState>;
249
241
  /**
250
- * Replace the complete Entity graph under the baseline revision.
242
+ * Compile edits against the original causal snapshot and publish native Loro operations.
251
243
  *
252
244
  * Deletion intent is derived from baseline IDs omitted from `nextRows`, so a
253
245
  * transient create-then-remove never becomes a request to delete unknown
254
246
  * persisted data.
255
247
  */
256
- commit(baseState: EntityGraphState, nextRows: EntityRelationRows, options?: EntityGraphCommitOptions): Promise<EntityGraphState>;
248
+ commit(baseState: Pick<EntityGraphState, 'revision' | 'rows' | 'loroSnapshot'>, nextRows: EntityRelationRows, options?: EntityGraphCommitOptions): Promise<EntityGraphState>;
249
+ /** Send the same prepared bytes on retry; never recompile an unconfirmed edit. */
250
+ commitUpdate(update: string): Promise<EntityGraphState>;
257
251
  private request;
258
252
  }
259
253
  //#endregion
@@ -339,6 +333,8 @@ interface DeleteClipTreeInput {
339
333
  interface VoiceoverCaptionFact {
340
334
  /** Stable placed caption identity supplied by the materialized side effect. */
341
335
  readonly captionClipEntityId: string;
336
+ /** Directly held bases; includes the AudioScript used by the Voice. */
337
+ readonly baseEntityIds: readonly string[];
342
338
  /** Ordered selection of AudioScript segments; caption text is never passed inline. */
343
339
  readonly selections: readonly CaptionSegmentSelection[];
344
340
  readonly startMs: number;
@@ -427,7 +423,7 @@ interface VoiceoverTakeResult {
427
423
  readonly voiceEntityId: string;
428
424
  /** The pronunciation variant the Voice was rendered from. */
429
425
  readonly phoneticScriptEntityId: string;
430
- /** The base-text owner resolved along the phonetic composition Relation. */
426
+ /** The base-text owner resolved from the PhoneticScript baseEntityIds. */
431
427
  readonly audioScriptEntityId: string;
432
428
  readonly captionClipEntityIds: readonly string[];
433
429
  }
@@ -460,8 +456,8 @@ interface InsertCaptionClipInput {
460
456
  readonly timelineEntityId: string;
461
457
  /** Stable placed caption identity, distinct from the Caption content identity. */
462
458
  readonly captionClipEntityId?: string;
463
- /** Existing base-text owner; the Caption composes it instead of storing text. */
464
- readonly audioScriptEntityId: string;
459
+ /** Existing bases composed by this variant; includes an AudioScript text owner. */
460
+ readonly baseEntityIds: readonly string[];
465
461
  /** Ordered selection of the AudioScript segments this Caption displays. */
466
462
  readonly selections: readonly CaptionSegmentSelection[];
467
463
  /** Intrinsic cue length of the Caption entity itself; display comes from the placement. */
@@ -549,8 +545,8 @@ declare class EntityTimelineEditor {
549
545
  patchCaptionStyle(input: PatchCaptionStyleInput): void;
550
546
  /**
551
547
  * Place a Caption as a composed variant of an existing AudioScript: the
552
- * entity stores only its selection, style, and inherent cue-bounded
553
- * Sequence — never text. The Clip and its display Marker describe this use;
548
+ * entity stores baseEntityIds, selection, optional style, and inherent cue-bounded
549
+ * Sequence. This helper does not copy base text. The Clip and its display Marker describe this use;
554
550
  * moving or stretching the returned Clip later changes the Clip/Marker,
555
551
  * never the Caption entity or the AudioScript.
556
552
  */
@@ -563,7 +559,7 @@ declare class EntityTimelineEditor {
563
559
  private ensurePhoneticRender;
564
560
  private reconcileVoiceoverCaptions;
565
561
  private ensureRoleTrackForClip;
566
- private replaceCaptionSemanticRelations;
562
+ private replaceCaptionAlignment;
567
563
  /**
568
564
  * Remove one placed Caption use. The composed AudioScript outlives the
569
565
  * caption: it may anchor further captions and remains the text owner.
@@ -596,6 +592,8 @@ interface EditorFoundation {
596
592
  readonly rows: EntityRelationRows;
597
593
  readonly timelineEntityId: string;
598
594
  readonly trackEntityIds: Readonly<Record<EditorTrackRole, string>>;
595
+ /** Fixed identity of the project's one AudioScript, minted here when missing. */
596
+ readonly audioScriptEntityId: string;
599
597
  }
600
598
  /**
601
599
  * MEngine editor policy, not a cardinality restriction on the general-purpose DSL.
@@ -651,6 +649,139 @@ declare function migrateLegacyTimelineToEntities(legacy: VideoDocument, assetFac
651
649
  /** Server gate: a cutover may change representation, never the existing render facts. */
652
650
  declare function assertEntityProjectionPreservesLegacy(legacy: VideoDocument, projection: VideoDocument, rows: EntityRelationRows): void;
653
651
  //#endregion
652
+ //#region src/entity-editor/caption-content.d.ts
653
+ interface CaptionContentInput {
654
+ readonly contentEntityId: string;
655
+ readonly audioScriptEntityId: string;
656
+ readonly text: string;
657
+ readonly selections?: readonly CaptionSegmentSelection[];
658
+ readonly durationMs: number;
659
+ }
660
+ /** Author Caption content from semantic intent; callers never reconcile variant bases or assembled fields. */
661
+ declare function prepareCaptionContent(rows: EntityRelationRows, input: CaptionContentInput): EntityRow<'caption'>;
662
+ //#endregion
663
+ //#region src/entity-editor/document-audio-script.d.ts
664
+ interface DocumentAudioScript {
665
+ readonly entityId: string;
666
+ readonly segments: readonly (ScriptTextSegment & Readonly<Record<string, unknown>>)[];
667
+ }
668
+ /** State exposing the current AudioScript content version attached to the project. */
669
+ interface DocumentAudioScriptState {
670
+ readonly rows: EntityRelationRows;
671
+ /** Current attachment; initialized projects point to a real script, including an empty one. */
672
+ readonly audioScriptEntityId: string | null;
673
+ }
674
+ /** Read only the attached version and preserve every segment; never aggregate other scripts. */
675
+ declare function readDocumentAudioScript(state: DocumentAudioScriptState): DocumentAudioScript;
676
+ //#endregion
677
+ //#region src/entity-crdt/entity-document.d.ts
678
+ declare const LORO_ENTITY_SCHEMA = "medeo.entities.loro.v1";
679
+ interface EntityDocumentState {
680
+ readonly rows: EntityRelationRows;
681
+ readonly project: Readonly<Record<string, string>>;
682
+ }
683
+ type Command = {
684
+ type: 'create';
685
+ row: EntityRow;
686
+ } | {
687
+ type: 'selection-baseline';
688
+ root: string;
689
+ fingerprint: string;
690
+ } | {
691
+ type: 'order';
692
+ group: string;
693
+ roots: string[];
694
+ token: string;
695
+ } | {
696
+ type: 'write';
697
+ root: string;
698
+ payload: JsonObject;
699
+ token: string;
700
+ } | {
701
+ type: 'text';
702
+ root: string;
703
+ path: readonly (string | number)[];
704
+ start: number;
705
+ deleteCount: number;
706
+ text: string;
707
+ token: string;
708
+ } | {
709
+ type: 'delete';
710
+ root: string;
711
+ } | {
712
+ type: 'relation';
713
+ row: RelationRow;
714
+ } | {
715
+ type: 'relation-fields';
716
+ root: string;
717
+ metadata: JsonObject;
718
+ trace: JsonObject;
719
+ } | {
720
+ type: 'unlink';
721
+ root: string;
722
+ } | {
723
+ type: 'attach';
724
+ slot: string;
725
+ entityId: string;
726
+ };
727
+ /** Plain domain objects assembled from native Loro state, never a second writable authority. */
728
+ declare function readEntityDocument(doc: LoroDoc, allowSelectionConflicts?: boolean): EntityDocumentState;
729
+ /** Native editing containers survive domain version changes and merge independently. */
730
+ declare class LoroEntityDocument {
731
+ readonly doc: LoroDoc;
732
+ private readonly validate?;
733
+ private readonly undoManager;
734
+ constructor(doc: LoroDoc, validate?: ((state: EntityDocumentState) => void) | undefined);
735
+ /** Open a causal snapshot using the same Loro runtime as the compiler. */
736
+ static fromSnapshot(snapshot: Uint8Array, validate?: (state: EntityDocumentState) => void): LoroEntityDocument;
737
+ static create(rows: EntityRelationRows, project?: Readonly<Record<string, string>>, peerId?: PeerID): LoroEntityDocument;
738
+ snapshot(): EntityDocumentState;
739
+ relationsOf(entityId: string): readonly RelationRow[];
740
+ getVersion(id: string): EntityRow | undefined;
741
+ /** The callback and every domain validation execute on a causally complete fork first. */
742
+ transact(edit: (draft: LoroEntityDraft) => void): Uint8Array;
743
+ /** Import preserves native operation identities; projection errors never discard remote operations. */
744
+ import(update: Uint8Array): void;
745
+ canUndo(): boolean;
746
+ canRedo(): boolean;
747
+ undo(): boolean;
748
+ redo(): boolean;
749
+ private historyEdit;
750
+ }
751
+ declare class LoroEntityDraft {
752
+ private readonly doc;
753
+ readonly commands: Command[];
754
+ private readonly selectedRoots;
755
+ constructor(doc: LoroDoc);
756
+ snapshot(): EntityDocumentState;
757
+ order(groupId: string, entityIds: readonly string[]): void;
758
+ create(row: EntityRow): void;
759
+ delete(entityId: string): void;
760
+ attach(slot: string, entityId: string): void;
761
+ link(row: RelationRow): void;
762
+ patchRelation(relationId: string, metadata: JsonObject, trace: JsonObject): void;
763
+ unlink(relationId: string): void;
764
+ private relationRoot;
765
+ update(entityId: string, fields: JsonObject): void;
766
+ declare(entityId: string, fields: JsonObject): void;
767
+ replaceOwned(entityId: string, payload: JsonObject): void;
768
+ editText(entityId: string, path: readonly (string | number)[], start: number, deleteCount: number, text: string): void;
769
+ captureSelectionBaselines(): void;
770
+ private record;
771
+ }
772
+ //#endregion
773
+ //#region src/entity-crdt/compile-rows.d.ts
774
+ /** Lower a detached ordinary-object edit against its actual causal Loro baseline. */
775
+ declare function compileEntityRows(snapshot: Uint8Array, rows: EntityRelationRows, validate?: (state: EntityDocumentState) => void): {
776
+ update: Uint8Array;
777
+ state: EntityDocumentState;
778
+ };
779
+ /** Compile an edit on an existing peer, retaining its native local undo history. */
780
+ declare function applyEntityRows(editor: LoroEntityDocument, rows: EntityRelationRows): {
781
+ update: Uint8Array;
782
+ state: EntityDocumentState;
783
+ };
784
+ //#endregion
654
785
  //#region src/editor/journal.d.ts
655
786
  /**
656
787
  * Wire a plain-memory adapter + editor that share a recording id factory, so
@@ -1555,4 +1686,4 @@ declare function hostForAbsMs(ranges: MainClipRange[], absMs: number): MainClipR
1555
1686
  */
1556
1687
  declare function relativePositionForAbs(ranges: MainClipRange[], absMs: number): TrackItemTimePosition;
1557
1688
  //#endregion
1558
- export { type Aggregation, type AssembledCaptionContent, type AssembledPhoneticScriptContent, type Attachment, type AudioMediaAssetFact, type BgmPart, type CaptionPart, type CaptionSegmentSelection, type CaptionStyle, type ClipEntityId, type ClipPlacement, type CommitOptions, DEFAULT_UNIT_TIME_MS, type DeleteBgmInput, type DeleteClipInput, type DeleteClipTreeInput, type DeleteVoiceoverInput, type DerivedItemPosition, type DocStorageLike, type DocVersionMark, ENTITY_TIMELINE_PROJECTION_SCHEMA_VERSION, type EditorFoundation, type EntityGraphCommitOptions, EntityGraphHttpClient, type EntityGraphState, EntityTimelineEditor, type EntityTimelineIdFactory, EntityTimelineProjectionError, type EntityTimelineTrackRole, IMPLEMENTED_SEMANTIC_OP_KINDS, type ImageMediaAssetFact, type ImplementedSemanticOpKind, type ImportedMediaAsset, type InitialDocumentFacts, type InsertCaptionClipInput, type InsertClipInput, type InsertMediaClipInput, type InsertMediaClipsInput, type InsertPlacedClipInput, type JournalEntry, LANE_KINDS_IN_STACK_ORDER, type LaneKind, type LinearClipSpeed, type MainClipRange, type MakeEmptyPart, ManualSyncDoc, type ManualSyncDocOptions, MedeoHttpDocStorage, type MedeoHttpDocStorageOptions, type MediaAssetFact, type MediaClipInsertion, MemoryDocStorage, MengineAckFailedError, type MengineAuditEntry, type MengineAuditResponse, MengineDocSession, type MengineDocSessionOptions, type MengineDocSessionUpdateEvent, type MengineDocumentVersion, type MengineEventStreamOptions, MengineHttpClient, type MengineHttpClientOptions, MengineHttpRequestError, MenginePushRejectedError, type MenginePushResponse, type MenginePushUpdateResponse, type MengineRejectedResponse, type MengineSnapshotResponse, type MengineSseUpdateEvent, type MengineSyncResponse, type MengineUpdateMeta, MirrorVideoDocumentAdapter, type MirrorVideoDocumentOptions, type MoveClipInput, type MoveClipsToStartsInput, type MoveSequentialClipsInput, type MoveVoiceoverInput, type OpActor, type PartAggregation, type PartIdFactory, type PartKind, type PartUnion, type PatchCaptionStyleInput, PlainMemoryAdapter, type PlainMemoryAdapterOptions, type PlannedSemanticOpKind, type PullFailureReason, type PullResult, type PushOutcome, type PushOutcomeKind, type PushResult, type PushResultKind, type ReplaceClipContentInput, type ReplaceMediaClipInput, type ReplaceSequentialClipsInput, type ReplacementMediaClipInput, type ResolvedEntityClipPlacement, type ResolvedEntityTimelineLayout, type ResolvedEntityTrack, SchemaValidator, ScriptCompositionError, type SemanticDocumentAdapter, SemanticEditor, type SemanticOpInput, type SemanticOpKind, type SemanticOpName, type SequentialClipAnchor, type SetBgmInput, type SetCaptionVisibilityInput, type SetClipPlacementInput, type SetClipSpeedInput, type SetClipVolumeInput, type SnapshotReadable, type SolvedVideoDocument, type SpeechHostMap, type SpeechPart, type SpeedShift, TIMELINE_SKELETON_DURATION_MS, type Timeline, type TimelineDoc, type TimelineItem, type Track, type TrackDraft, type TrackItem, type TrackItemDraft, type TrackItemTimePosition, type TransactAudit, type TrimClipInput, type UpdateClipInput, type UpdateClipMarkerInput, VIDEO_DOCUMENT_SCHEMA_VERSION, ValidationError, type VideoClipPart, type VideoDocument, type VideoDocumentDraft, type VideoDocumentMirrorSchema, type VideoDocumentSchemaVersion, VideoDocumentValidationError, type VideoDocumentValidationIssue, type VideoDocumentValidationIssueCode, type VideoDraft, type CaptionPart$1 as VideoDraftCaptionPart, type VideoDraftPartUnion, type Timeline$1 as VideoDraftTimeline, type Track$1 as VideoDraftTrack, type TrackItem$1 as VideoDraftTrackItem, type VideoMediaAssetFact, type VisualMediaAssetFact, type VoiceMediaAssetFact, type VoiceoverCaptionFact, type VoiceoverTakeInput, type VoiceoverTakeResult, type WaitForServerAckOptions, applyEntityTimelineProjection, arrangeMainTrackSeamlessly, assembleCaptionContent, assemblePhoneticScriptContent, assembleScriptText, assertCanonicalEditorResources, assertEntityProjectionPreservesLegacy, assertMediaAssetWritePolicy, assertValidVideoDocument, base64ToBytes, buildInitialVideoDocument, buildSpeechHostMap, bytesToBase64, cascadeAfterVideoClipChanges, createEditSandbox, createMirrorVideoDocument, createMirrorVideoDocumentAdapter, createPlainMemoryAdapter, decodeDocVersionMark, derivePositionFromAbs, effectiveVideoClipDurationMs, encodeDocVersionMark, ensureEditorFoundation, ensureLaneTrack, fillMainTrackTimeGaps, findComposedAudioScript, findLaneTrack, fromVideoDocument, generatePartId, getAt, hostForAbsMs, importMediaAsset, isEmptyVideoClip, isImplementedSemanticOpKind, isMap, laneTrackId, mainTrackRanges, migrateLegacyTimelineToEntities, partDurationMs, partUnionSchema, projectEntityTimeline, readMainTrackItems, readMengineEventStream, readPart, readPartDurationMs, readVideoDocumentFromDraft, reassignSpeechesToVideoClipsByTime, recalculateTimelineDuration, relativePositionForAbs, replayJournal, resolveAllSpeechOverlaps, resolveEntityTimelineLayout, resolveSpeechOverlapByShiftingVideos, safeDurationMs, index_d_exports as schemas, selectAudioScriptSegments, snapshotToPlain, solveVideoDocument, speedOf, syncAggregatedClipsTimePosition, toVideoDocument, validateVideoDocument, videoDocumentMirrorSchema, videoDocumentSchema, writeVideoDocumentToDraft };
1689
+ export { type Aggregation, type AssembledCaptionContent, type AssembledPhoneticScriptContent, type Attachment, type AudioMediaAssetFact, type BgmPart, type CaptionContentInput, type CaptionPart, type CaptionSegmentSelection, type CaptionStyle, type ClipEntityId, type ClipPlacement, type CommitOptions, DEFAULT_UNIT_TIME_MS, type DeleteBgmInput, type DeleteClipInput, type DeleteClipTreeInput, type DeleteVoiceoverInput, type DerivedItemPosition, type DocStorageLike, type DocVersionMark, type DocumentAudioScript, type DocumentAudioScriptState, ENTITY_TIMELINE_PROJECTION_SCHEMA_VERSION, type EditorFoundation, EntityDocumentState, type EntityGraphCommitOptions, EntityGraphHttpClient, type EntityGraphState, EntityTimelineEditor, type EntityTimelineIdFactory, EntityTimelineProjectionError, type EntityTimelineTrackRole, IMPLEMENTED_SEMANTIC_OP_KINDS, type ImageMediaAssetFact, type ImplementedSemanticOpKind, type ImportedMediaAsset, type InitialDocumentFacts, type InsertCaptionClipInput, type InsertClipInput, type InsertMediaClipInput, type InsertMediaClipsInput, type InsertPlacedClipInput, type JournalEntry, LANE_KINDS_IN_STACK_ORDER, LORO_ENTITY_SCHEMA, type LaneKind, type LinearClipSpeed, LoroEntityDocument, LoroEntityDraft, type MainClipRange, type MakeEmptyPart, ManualSyncDoc, type ManualSyncDocOptions, MedeoHttpDocStorage, type MedeoHttpDocStorageOptions, type MediaAssetFact, type MediaClipInsertion, MemoryDocStorage, MengineAckFailedError, type MengineAuditEntry, type MengineAuditResponse, MengineDocSession, type MengineDocSessionOptions, type MengineDocSessionUpdateEvent, type MengineDocumentVersion, type MengineEventStreamOptions, MengineHttpClient, type MengineHttpClientOptions, MengineHttpRequestError, MenginePushRejectedError, type MenginePushResponse, type MenginePushUpdateResponse, type MengineRejectedResponse, type MengineSnapshotResponse, type MengineSseUpdateEvent, type MengineSyncResponse, type MengineUpdateMeta, MirrorVideoDocumentAdapter, type MirrorVideoDocumentOptions, type MoveClipInput, type MoveClipsToStartsInput, type MoveSequentialClipsInput, type MoveVoiceoverInput, type OpActor, type PartAggregation, type PartIdFactory, type PartKind, type PartUnion, type PatchCaptionStyleInput, PlainMemoryAdapter, type PlainMemoryAdapterOptions, type PlannedSemanticOpKind, type PullFailureReason, type PullResult, type PushOutcome, type PushOutcomeKind, type PushResult, type PushResultKind, type ReplaceClipContentInput, type ReplaceMediaClipInput, type ReplaceSequentialClipsInput, type ReplacementMediaClipInput, type ResolvedEntityClipPlacement, type ResolvedEntityTimelineLayout, type ResolvedEntityTrack, SchemaValidator, ScriptCompositionError, type SemanticDocumentAdapter, SemanticEditor, type SemanticOpInput, type SemanticOpKind, type SemanticOpName, type SequentialClipAnchor, type SetBgmInput, type SetCaptionVisibilityInput, type SetClipPlacementInput, type SetClipSpeedInput, type SetClipVolumeInput, type SnapshotReadable, type SolvedVideoDocument, type SpeechHostMap, type SpeechPart, type SpeedShift, TIMELINE_SKELETON_DURATION_MS, type Timeline, type TimelineDoc, type TimelineItem, type Track, type TrackDraft, type TrackItem, type TrackItemDraft, type TrackItemTimePosition, type TransactAudit, type TrimClipInput, type UpdateClipInput, type UpdateClipMarkerInput, VIDEO_DOCUMENT_SCHEMA_VERSION, ValidationError, type VideoClipPart, type VideoDocument, type VideoDocumentDraft, type VideoDocumentMirrorSchema, type VideoDocumentSchemaVersion, VideoDocumentValidationError, type VideoDocumentValidationIssue, type VideoDocumentValidationIssueCode, type VideoDraft, type CaptionPart$1 as VideoDraftCaptionPart, type VideoDraftPartUnion, type Timeline$1 as VideoDraftTimeline, type Track$1 as VideoDraftTrack, type TrackItem$1 as VideoDraftTrackItem, type VideoMediaAssetFact, type VisualMediaAssetFact, type VoiceMediaAssetFact, type VoiceoverCaptionFact, type VoiceoverTakeInput, type VoiceoverTakeResult, type WaitForServerAckOptions, applyEntityRows, applyEntityTimelineProjection, arrangeMainTrackSeamlessly, assembleCaptionContent, assembleEntityContent, assemblePhoneticScriptContent, assembleScriptText, assertCanonicalEditorResources, assertEntityProjectionPreservesLegacy, assertMediaAssetWritePolicy, assertValidVideoDocument, base64ToBytes, buildInitialVideoDocument, buildSpeechHostMap, bytesToBase64, cascadeAfterVideoClipChanges, compileEntityRows, createEditSandbox, createMirrorVideoDocument, createMirrorVideoDocumentAdapter, createPlainMemoryAdapter, decodeDocVersionMark, derivePositionFromAbs, effectiveVideoClipDurationMs, encodeDocVersionMark, ensureEditorFoundation, ensureLaneTrack, fillMainTrackTimeGaps, findComposedAudioScript, findLaneTrack, fromVideoDocument, generatePartId, getAt, hostForAbsMs, importMediaAsset, isEmptyVideoClip, isImplementedSemanticOpKind, isMap, laneTrackId, mainTrackRanges, migrateLegacyTimelineToEntities, partDurationMs, partUnionSchema, prepareCaptionContent, projectEntityTimeline, readDocumentAudioScript, readEntityDocument, readMainTrackItems, readMengineEventStream, readPart, readPartDurationMs, readVideoDocumentFromDraft, reassignSpeechesToVideoClipsByTime, recalculateTimelineDuration, relativePositionForAbs, replayJournal, resolveAllSpeechOverlaps, resolveEntityTimelineLayout, resolveSpeechOverlapByShiftingVideos, safeDurationMs, index_d_exports as schemas, selectAudioScriptSegments, snapshotToPlain, solveVideoDocument, speedOf, syncAggregatedClipsTimePosition, toVideoDocument, validateVideoDocument, videoDocumentMirrorSchema, videoDocumentSchema, writeVideoDocumentToDraft };