@mengine/medeo-client 1.3.1-alpha.0 → 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.
- package/README.md +26 -11
- package/dist/{document-Caidonf8.js → document-BxWxPFTj.js} +1056 -122
- package/dist/{index-WxMNUbOa.d.ts → index-Bs60N9Hl.d.ts} +36 -9
- package/dist/index.d.ts +215 -20
- package/dist/index.js +313 -168
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +1 -1
- package/package.json +5 -4
|
@@ -849,6 +849,13 @@ type RelationId = string & {
|
|
|
849
849
|
readonly [relationIdBrand]: 'RelationId';
|
|
850
850
|
};
|
|
851
851
|
//#endregion
|
|
852
|
+
//#region ../medeo-dsl/src/json-values.d.ts
|
|
853
|
+
type JsonPrimitive = string | number | boolean | null;
|
|
854
|
+
type JsonValue = JsonPrimitive | JsonObject | readonly JsonValue[];
|
|
855
|
+
type JsonObject = {
|
|
856
|
+
readonly [key: string]: JsonValue;
|
|
857
|
+
};
|
|
858
|
+
//#endregion
|
|
852
859
|
//#region ../medeo-dsl/src/entities.d.ts
|
|
853
860
|
type KnownEntityKind = 'axvideo' | 'timeline' | 'track' | 'clip' | 'asset' | 'video' | 'audio' | 'voice' | 'image' | 'sequence-marker' | 'viewport' | 'audio-script' | 'phonetic-script' | 'caption';
|
|
854
861
|
declare const extensionEntityKindBrand: unique symbol;
|
|
@@ -867,6 +874,11 @@ type SequenceDuration<Span = unknown> = {
|
|
|
867
874
|
readonly mode: 'fixed';
|
|
868
875
|
readonly value: Span;
|
|
869
876
|
};
|
|
877
|
+
interface ScriptTextSegment {
|
|
878
|
+
readonly segmentId: string;
|
|
879
|
+
readonly text: string;
|
|
880
|
+
readonly language?: string;
|
|
881
|
+
}
|
|
870
882
|
interface VoiceDescriptor {
|
|
871
883
|
readonly system: 'voice-library';
|
|
872
884
|
readonly key: string;
|
|
@@ -888,16 +900,31 @@ interface CaptionStyleFields {
|
|
|
888
900
|
readonly positionX?: number;
|
|
889
901
|
readonly positionY?: number;
|
|
890
902
|
}
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
903
|
+
/**
|
|
904
|
+
* Half-open `[start, end)` position window inside one Segment's text, counted
|
|
905
|
+
* in Unicode code points (not UTF-16 code units), so a boundary never splits a
|
|
906
|
+
* surrogate pair. Positions are non-negative safe integers with `start < end`;
|
|
907
|
+
* `end` must not exceed the Segment's code-point length.
|
|
908
|
+
*/
|
|
909
|
+
interface CaptionTextRange extends JsonObject {
|
|
910
|
+
readonly start: number;
|
|
911
|
+
readonly end: number;
|
|
912
|
+
}
|
|
913
|
+
/**
|
|
914
|
+
* One ordered entry of the Caption's segment selection. `segmentId` quotes the
|
|
915
|
+
* composed AudioScript's own stable segment identity — a local id quoted by the
|
|
916
|
+
* variant, never a peer Entity reference. Text itself is never copied here;
|
|
917
|
+
* complete Caption content is assembled through its direct baseEntityIds.
|
|
918
|
+
* The optional `textRange` narrows one Segment to an intra-Segment sub-span
|
|
919
|
+
* (intra-segment re-segmentation); without it the whole Segment text is selected.
|
|
920
|
+
*/
|
|
921
|
+
type CaptionSegmentSelection = JsonObject & {
|
|
922
|
+
readonly segmentId: string;
|
|
923
|
+
readonly textRange?: CaptionTextRange;
|
|
897
924
|
};
|
|
898
925
|
//#endregion
|
|
899
926
|
//#region ../medeo-dsl/src/relations.d.ts
|
|
900
|
-
type KnownRelationKind = 'timeline-track' | 'track-clip' | 'clip-marker' | 'marker-content' | 'axvideo-marker' | 'marker-timeline' | 'physical-asset' | 'generated' | '
|
|
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';
|
|
901
928
|
type RelationKind = KnownRelationKind | (string & {});
|
|
902
929
|
type RelationTrace = JsonObject;
|
|
903
930
|
/**
|
|
@@ -1655,10 +1682,10 @@ declare const videoDocumentSchema: z.ZodObject<{
|
|
|
1655
1682
|
tracks: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1656
1683
|
id: z.ZodOptional<z.ZodString>;
|
|
1657
1684
|
parts_kind: z.ZodOptional<z.ZodEnum<{
|
|
1685
|
+
video_clip: "video_clip";
|
|
1658
1686
|
speech: "speech";
|
|
1659
1687
|
caption: "caption";
|
|
1660
1688
|
bgm: "bgm";
|
|
1661
|
-
video_clip: "video_clip";
|
|
1662
1689
|
}>>;
|
|
1663
1690
|
is_hidden: z.ZodOptional<z.ZodBoolean>;
|
|
1664
1691
|
items: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -1740,4 +1767,4 @@ declare const videoDocumentSchema: z.ZodObject<{
|
|
|
1740
1767
|
}, z.core.$loose>]>>>;
|
|
1741
1768
|
}, z.core.$loose>;
|
|
1742
1769
|
//#endregion
|
|
1743
|
-
export {
|
|
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
|
|
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
|
|
|
@@ -178,17 +178,60 @@ interface MengineEventStreamOptions {
|
|
|
178
178
|
}
|
|
179
179
|
declare function readMengineEventStream(options: MengineEventStreamOptions): Promise<void>;
|
|
180
180
|
//#endregion
|
|
181
|
+
//#region ../medeo-dsl/src/composition.d.ts
|
|
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. */
|
|
184
|
+
declare class ScriptCompositionError extends Error {
|
|
185
|
+
readonly code: ScriptCompositionIssueCode;
|
|
186
|
+
readonly entityId: EntityId;
|
|
187
|
+
constructor(code: ScriptCompositionIssueCode, entityId: EntityId, message: string);
|
|
188
|
+
}
|
|
189
|
+
interface AssembledCaptionContent {
|
|
190
|
+
readonly caption: EntityRow<'caption'>;
|
|
191
|
+
readonly audioScript: EntityRow<'audio-script'>;
|
|
192
|
+
/** Selected AudioScript segments in Caption selection order. */
|
|
193
|
+
readonly segments: readonly ScriptTextSegment[];
|
|
194
|
+
/** Complete display text: the selected segments' text joined in order. */
|
|
195
|
+
readonly text: string;
|
|
196
|
+
}
|
|
197
|
+
interface AssembledPhoneticScriptContent {
|
|
198
|
+
readonly phoneticScript: EntityRow<'phonetic-script'>;
|
|
199
|
+
readonly audioScript: EntityRow<'audio-script'>;
|
|
200
|
+
/** All AudioScript segments in script order; the pronunciation variant never reorders text. */
|
|
201
|
+
readonly segments: readonly ScriptTextSegment[];
|
|
202
|
+
/** Complete base text owned by the AudioScript. */
|
|
203
|
+
readonly text: string;
|
|
204
|
+
}
|
|
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. */
|
|
208
|
+
declare function findComposedAudioScript(rows: EntityRelationRows, variantEntityId: EntityId, variantKind: 'caption' | 'phonetic-script'): EntityRow<'audio-script'>;
|
|
209
|
+
/** Join the whole AudioScript text in segment order. */
|
|
210
|
+
declare function assembleScriptText(script: EntityRow<'audio-script'>): string;
|
|
211
|
+
/** Assemble selected text after base-field validation and explicit variant overrides. */
|
|
212
|
+
declare function assembleCaptionContent(rows: EntityRelationRows, captionEntityId: EntityId): AssembledCaptionContent;
|
|
213
|
+
/**
|
|
214
|
+
* Assemble the complete Phonetic Script content for TTS: the composed
|
|
215
|
+
* AudioScript's base text plus the variant's own phoneme and prosody fields.
|
|
216
|
+
*/
|
|
217
|
+
declare function assemblePhoneticScriptContent(rows: EntityRelationRows, phoneticScriptEntityId: EntityId): AssembledPhoneticScriptContent;
|
|
218
|
+
/** Select source text without creating another authoritative text field. */
|
|
219
|
+
declare function selectAudioScriptSegments(script: EntityRow<'audio-script'>, selections: readonly CaptionSegmentSelection[]): readonly ScriptTextSegment[];
|
|
220
|
+
//#endregion
|
|
181
221
|
//#region src/entity-editor/entity-graph-http-client.d.ts
|
|
182
222
|
/** One authenticated revision of the authoritative Medeo Entity graph. */
|
|
183
223
|
interface EntityGraphState {
|
|
224
|
+
/** Current AudioScript content version attached to the project. */
|
|
225
|
+
readonly audioScriptEntityId: string;
|
|
184
226
|
readonly revision: number;
|
|
227
|
+
readonly loroSnapshot: string;
|
|
185
228
|
readonly rows: EntityRelationRows;
|
|
186
229
|
}
|
|
187
230
|
interface EntityGraphCommitOptions {
|
|
188
231
|
/** Server version vector proving the explicit legacy-to-Entity migration baseline. */
|
|
189
232
|
readonly migrationBaseVv?: string;
|
|
190
233
|
}
|
|
191
|
-
/** Browser-safe authenticated
|
|
234
|
+
/** Browser-safe authenticated Loro client for a document's Entity graph. */
|
|
192
235
|
declare class EntityGraphHttpClient {
|
|
193
236
|
private readonly options;
|
|
194
237
|
private readonly transport;
|
|
@@ -196,13 +239,15 @@ declare class EntityGraphHttpClient {
|
|
|
196
239
|
constructor(options: MengineHttpClientOptions);
|
|
197
240
|
fetchState(): Promise<EntityGraphState>;
|
|
198
241
|
/**
|
|
199
|
-
*
|
|
242
|
+
* Compile edits against the original causal snapshot and publish native Loro operations.
|
|
200
243
|
*
|
|
201
244
|
* Deletion intent is derived from baseline IDs omitted from `nextRows`, so a
|
|
202
245
|
* transient create-then-remove never becomes a request to delete unknown
|
|
203
246
|
* persisted data.
|
|
204
247
|
*/
|
|
205
|
-
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>;
|
|
206
251
|
private request;
|
|
207
252
|
}
|
|
208
253
|
//#endregion
|
|
@@ -288,7 +333,10 @@ interface DeleteClipTreeInput {
|
|
|
288
333
|
interface VoiceoverCaptionFact {
|
|
289
334
|
/** Stable placed caption identity supplied by the materialized side effect. */
|
|
290
335
|
readonly captionClipEntityId: string;
|
|
291
|
-
|
|
336
|
+
/** Directly held bases; includes the AudioScript used by the Voice. */
|
|
337
|
+
readonly baseEntityIds: readonly string[];
|
|
338
|
+
/** Ordered selection of AudioScript segments; caption text is never passed inline. */
|
|
339
|
+
readonly selections: readonly CaptionSegmentSelection[];
|
|
292
340
|
readonly startMs: number;
|
|
293
341
|
readonly durationMs: number;
|
|
294
342
|
readonly style?: CaptionStyleFields;
|
|
@@ -296,8 +344,8 @@ interface VoiceoverCaptionFact {
|
|
|
296
344
|
type VoiceoverTakeInput = {
|
|
297
345
|
readonly timelineEntityId: string; /** Stable placed speech identity, distinct from media.assetId. */
|
|
298
346
|
readonly voiceoverClipEntityId: string;
|
|
299
|
-
readonly media: VoiceMediaAssetFact; /**
|
|
300
|
-
readonly
|
|
347
|
+
readonly media: VoiceMediaAssetFact; /** Existing pronunciation variant; its composed AudioScript stays the text owner. */
|
|
348
|
+
readonly phoneticScriptEntityId: string;
|
|
301
349
|
readonly volume: number;
|
|
302
350
|
readonly captions: readonly VoiceoverCaptionFact[];
|
|
303
351
|
} & ({
|
|
@@ -373,6 +421,9 @@ interface TrimClipInput {
|
|
|
373
421
|
interface VoiceoverTakeResult {
|
|
374
422
|
readonly voiceoverClipEntityId: string;
|
|
375
423
|
readonly voiceEntityId: string;
|
|
424
|
+
/** The pronunciation variant the Voice was rendered from. */
|
|
425
|
+
readonly phoneticScriptEntityId: string;
|
|
426
|
+
/** The base-text owner resolved from the PhoneticScript baseEntityIds. */
|
|
376
427
|
readonly audioScriptEntityId: string;
|
|
377
428
|
readonly captionClipEntityIds: readonly string[];
|
|
378
429
|
}
|
|
@@ -405,7 +456,10 @@ interface InsertCaptionClipInput {
|
|
|
405
456
|
readonly timelineEntityId: string;
|
|
406
457
|
/** Stable placed caption identity, distinct from the Caption content identity. */
|
|
407
458
|
readonly captionClipEntityId?: string;
|
|
408
|
-
|
|
459
|
+
/** Existing bases composed by this variant; includes an AudioScript text owner. */
|
|
460
|
+
readonly baseEntityIds: readonly string[];
|
|
461
|
+
/** Ordered selection of the AudioScript segments this Caption displays. */
|
|
462
|
+
readonly selections: readonly CaptionSegmentSelection[];
|
|
409
463
|
/** Intrinsic cue length of the Caption entity itself; display comes from the placement. */
|
|
410
464
|
readonly durationMs: number;
|
|
411
465
|
readonly style?: CaptionStyleFields;
|
|
@@ -490,18 +544,26 @@ declare class EntityTimelineEditor {
|
|
|
490
544
|
setCaptionVisibility(input: SetCaptionVisibilityInput): void;
|
|
491
545
|
patchCaptionStyle(input: PatchCaptionStyleInput): void;
|
|
492
546
|
/**
|
|
493
|
-
* Place
|
|
494
|
-
*
|
|
495
|
-
*
|
|
496
|
-
* the returned Clip later changes the Clip/Marker,
|
|
547
|
+
* Place a Caption as a composed variant of an existing AudioScript: the
|
|
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;
|
|
550
|
+
* moving or stretching the returned Clip later changes the Clip/Marker,
|
|
551
|
+
* never the Caption entity or the AudioScript.
|
|
497
552
|
*/
|
|
498
553
|
insertCaptionClip(input: InsertCaptionClipInput): ClipEntityId;
|
|
499
554
|
private insertPlacedClipIntoDraft;
|
|
500
555
|
private ensureRoleTrack;
|
|
501
|
-
|
|
556
|
+
/** The existing pronunciation variant a Voice consumes; composition is required. */
|
|
557
|
+
private requireComposedPhoneticScript;
|
|
558
|
+
/** Preserve the factual synthesis input, regardless of persisted endpoint positions. */
|
|
559
|
+
private ensurePhoneticRender;
|
|
502
560
|
private reconcileVoiceoverCaptions;
|
|
503
561
|
private ensureRoleTrackForClip;
|
|
504
|
-
private
|
|
562
|
+
private replaceCaptionAlignment;
|
|
563
|
+
/**
|
|
564
|
+
* Remove one placed Caption use. The composed AudioScript outlives the
|
|
565
|
+
* caption: it may anchor further captions and remains the text owner.
|
|
566
|
+
*/
|
|
505
567
|
private removeCaptionClipGraph;
|
|
506
568
|
private replaceAnchorHost;
|
|
507
569
|
/** Rebuild the legacy edit baseline from current visual order before a high-level cascade. */
|
|
@@ -530,6 +592,8 @@ interface EditorFoundation {
|
|
|
530
592
|
readonly rows: EntityRelationRows;
|
|
531
593
|
readonly timelineEntityId: string;
|
|
532
594
|
readonly trackEntityIds: Readonly<Record<EditorTrackRole, string>>;
|
|
595
|
+
/** Fixed identity of the project's one AudioScript, minted here when missing. */
|
|
596
|
+
readonly audioScriptEntityId: string;
|
|
533
597
|
}
|
|
534
598
|
/**
|
|
535
599
|
* MEngine editor policy, not a cardinality restriction on the general-purpose DSL.
|
|
@@ -538,8 +602,7 @@ interface EditorFoundation {
|
|
|
538
602
|
* Image/Video/Audio/Voice Entity must carry its own external locator, every
|
|
539
603
|
* external asset id has exactly one claimant, and no media variant may be
|
|
540
604
|
* bound through a legacy `physical-asset` Relation. Dual-entity media graphs
|
|
541
|
-
* are rejected, not migrated. Caption
|
|
542
|
-
* `physical-asset` binding.
|
|
605
|
+
* are rejected, not migrated. Caption composes AudioScript text and has no physical text Asset.
|
|
543
606
|
*/
|
|
544
607
|
declare function assertCanonicalEditorResources(rows: EntityRelationRows): void;
|
|
545
608
|
/**
|
|
@@ -550,8 +613,7 @@ declare function assertCanonicalEditorResources(rows: EntityRelationRows): void;
|
|
|
550
613
|
*
|
|
551
614
|
* 1. every Image/Video/Audio/Voice Entity carries its own Asset `external`
|
|
552
615
|
* identity;
|
|
553
|
-
* 2. no `physical-asset` Relation may bind a media variant
|
|
554
|
-
* text keeps its inline Asset and binding);
|
|
616
|
+
* 2. no `physical-asset` Relation may bind a media variant or Caption;
|
|
555
617
|
* 3. a self-carried media identity is immutable — it cannot be rewritten to
|
|
556
618
|
* another asset id.
|
|
557
619
|
*
|
|
@@ -587,6 +649,139 @@ declare function migrateLegacyTimelineToEntities(legacy: VideoDocument, assetFac
|
|
|
587
649
|
/** Server gate: a cutover may change representation, never the existing render facts. */
|
|
588
650
|
declare function assertEntityProjectionPreservesLegacy(legacy: VideoDocument, projection: VideoDocument, rows: EntityRelationRows): void;
|
|
589
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
|
|
590
785
|
//#region src/editor/journal.d.ts
|
|
591
786
|
/**
|
|
592
787
|
* Wire a plain-memory adapter + editor that share a recording id factory, so
|
|
@@ -1491,4 +1686,4 @@ declare function hostForAbsMs(ranges: MainClipRange[], absMs: number): MainClipR
|
|
|
1491
1686
|
*/
|
|
1492
1687
|
declare function relativePositionForAbs(ranges: MainClipRange[], absMs: number): TrackItemTimePosition;
|
|
1493
1688
|
//#endregion
|
|
1494
|
-
export { type Aggregation, type Attachment, type AudioMediaAssetFact, type BgmPart, type CaptionPart, 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, 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, assertCanonicalEditorResources, assertEntityProjectionPreservesLegacy, assertMediaAssetWritePolicy, assertValidVideoDocument, base64ToBytes, buildInitialVideoDocument, buildSpeechHostMap, bytesToBase64, cascadeAfterVideoClipChanges, createEditSandbox, createMirrorVideoDocument, createMirrorVideoDocumentAdapter, createPlainMemoryAdapter, decodeDocVersionMark, derivePositionFromAbs, effectiveVideoClipDurationMs, encodeDocVersionMark, ensureEditorFoundation, ensureLaneTrack, fillMainTrackTimeGaps, 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, 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 };
|