@mengine/medeo-client 2.0.1-alpha.14 → 2.0.1-alpha.16
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.
|
@@ -1462,8 +1462,9 @@ function emptyLaneTracks() {
|
|
|
1462
1462
|
* `Voice` declares no `Sequence` — it is a timbre identity, not playable
|
|
1463
1463
|
* content; a rendered voiceover is an `audio` entity.
|
|
1464
1464
|
*
|
|
1465
|
-
*
|
|
1466
|
-
*
|
|
1465
|
+
* `Asset` says only that an entity of that kind may be bound to stored bytes,
|
|
1466
|
+
* and asks nothing of its payload. Which bytes, and which way the content
|
|
1467
|
+
* flowed, is the `from-asset` / `to-asset` Relation's answer alone.
|
|
1467
1468
|
*/
|
|
1468
1469
|
const ENTITY_KINDS = Object.freeze({
|
|
1469
1470
|
axvideo: Object.freeze([
|
|
@@ -1480,27 +1481,27 @@ const ENTITY_KINDS = Object.freeze({
|
|
|
1480
1481
|
"Sequence",
|
|
1481
1482
|
"Visual",
|
|
1482
1483
|
"Audible",
|
|
1483
|
-
"
|
|
1484
|
+
"Asset"
|
|
1484
1485
|
]),
|
|
1485
1486
|
audio: Object.freeze([
|
|
1486
1487
|
"Sequence",
|
|
1487
1488
|
"Audible",
|
|
1488
|
-
"
|
|
1489
|
+
"Asset"
|
|
1489
1490
|
]),
|
|
1490
1491
|
image: Object.freeze([
|
|
1491
1492
|
"Sequence",
|
|
1492
1493
|
"Visual",
|
|
1493
|
-
"
|
|
1494
|
+
"Asset"
|
|
1494
1495
|
]),
|
|
1495
1496
|
voice: Object.freeze(["Container", "IPBound"]),
|
|
1496
1497
|
"sequence-marker": Object.freeze([]),
|
|
1497
1498
|
viewport: Object.freeze([]),
|
|
1498
|
-
"audio-script": Object.freeze(["SegmentText", "
|
|
1499
|
-
"phonetic-script": Object.freeze(["SegmentText"]),
|
|
1499
|
+
"audio-script": Object.freeze(["SegmentText", "Asset"]),
|
|
1500
|
+
"phonetic-script": Object.freeze(["SegmentText", "Asset"]),
|
|
1500
1501
|
caption: Object.freeze([
|
|
1501
1502
|
"SegmentText",
|
|
1502
1503
|
"Sequence",
|
|
1503
|
-
"
|
|
1504
|
+
"Asset"
|
|
1504
1505
|
])
|
|
1505
1506
|
});
|
|
1506
1507
|
/** What a known kind declares; extension kinds declare nothing through this table. */
|
|
@@ -1798,15 +1799,6 @@ function entityToRow(entity) {
|
|
|
1798
1799
|
//#endregion
|
|
1799
1800
|
//#region ../medeo-dsl/src/invariants.ts
|
|
1800
1801
|
/** An entity is made from at most one Asset; two would leave its bytes ambiguous. */
|
|
1801
|
-
function validateAssetSource(entity, index) {
|
|
1802
|
-
if (entity.current().entityKind === "asset") return [];
|
|
1803
|
-
if ([...index.relationsOf(entity)].filter((relation) => relation.kind === "from-asset").length <= 1) return [];
|
|
1804
|
-
return [{
|
|
1805
|
-
code: "asset_source_cardinality",
|
|
1806
|
-
entityId: entity.entityId,
|
|
1807
|
-
message: `Entity "${entity.entityId}" is made from more than one Asset`
|
|
1808
|
-
}];
|
|
1809
|
-
}
|
|
1810
1802
|
/** Validates one complete set of entities and its authoritative Relation rows. */
|
|
1811
1803
|
function validateEntityRelationSet(entityRefs, index, options) {
|
|
1812
1804
|
const { entities, issues } = collectRelatedEntities(entityRefs, index);
|
|
@@ -1828,7 +1820,6 @@ function validateEntityRelationSet(entityRefs, index, options) {
|
|
|
1828
1820
|
const current = entity.current();
|
|
1829
1821
|
const entityIssues = validateEntity(entity, entityIds);
|
|
1830
1822
|
issues.push(...entityIssues);
|
|
1831
|
-
issues.push(...validateAssetSource(entity, index));
|
|
1832
1823
|
if (entityIssues.some((issue) => issue.code === "invalid_entity_payload")) continue;
|
|
1833
1824
|
if (current.entityKind === "sequence-marker") {
|
|
1834
1825
|
const marker = entity;
|
|
@@ -2472,10 +2463,10 @@ const markerContentRelationSpec = Object.freeze({
|
|
|
2472
2463
|
/**
|
|
2473
2464
|
* `from-asset(entity, asset)` — the entity was made from that stored resource.
|
|
2474
2465
|
*
|
|
2475
|
-
* Eligibility is declared: the non-Asset endpoint must carry the `
|
|
2476
|
-
*
|
|
2477
|
-
*
|
|
2478
|
-
*
|
|
2466
|
+
* Eligibility is declared: the non-Asset endpoint must carry the `Asset` kind,
|
|
2467
|
+
* which says an entity of that kind can be bound to stored bytes and asks
|
|
2468
|
+
* nothing of its payload. The bytes stay named in exactly one place, so no
|
|
2469
|
+
* entity copies the locator into its own row and one Asset can back several
|
|
2479
2470
|
* entities.
|
|
2480
2471
|
*/
|
|
2481
2472
|
const fromAssetRelationSpec = Object.freeze({
|
|
@@ -2483,6 +2474,26 @@ const fromAssetRelationSpec = Object.freeze({
|
|
|
2483
2474
|
validateEndpoints: (endpoints) => hasExactlyOneAsset(endpoints),
|
|
2484
2475
|
validateMetadata: isAssetBinding
|
|
2485
2476
|
});
|
|
2477
|
+
/**
|
|
2478
|
+
* `to-asset(entity, asset)` — the entity's content was written out to that
|
|
2479
|
+
* stored resource.
|
|
2480
|
+
*
|
|
2481
|
+
* The mirror of `from-asset`, and deliberately a separate relation kind rather
|
|
2482
|
+
* than a second declared kind: eligibility is the same either way, but which
|
|
2483
|
+
* way the content flowed is what says whether an entity may still be edited.
|
|
2484
|
+
* An entity reached by `from-asset` was produced from bytes it does not own,
|
|
2485
|
+
* so changing it would contradict them. An entity with a `to-asset` owns its
|
|
2486
|
+
* content and the resource is a snapshot of it, which is what goes stale and
|
|
2487
|
+
* gets written again. A transcript that is later edited carries both at once,
|
|
2488
|
+
* and only the distinct relation kinds keep them apart.
|
|
2489
|
+
*
|
|
2490
|
+
* Writing a snapshot is host assembly; nothing a script authors creates one.
|
|
2491
|
+
*/
|
|
2492
|
+
const toAssetRelationSpec = Object.freeze({
|
|
2493
|
+
kind: "to-asset",
|
|
2494
|
+
validateEndpoints: (endpoints) => hasExactlyOneAsset(endpoints),
|
|
2495
|
+
validateMetadata: isAssetBinding
|
|
2496
|
+
});
|
|
2486
2497
|
/** `generated(output, input)` means endpoint 0 was generated from endpoint 1. */
|
|
2487
2498
|
const generatedRelationSpec = Object.freeze({
|
|
2488
2499
|
kind: "generated",
|
|
@@ -2545,6 +2556,7 @@ const builtInRelationSpecs = Object.freeze([
|
|
|
2545
2556
|
axVideoMarkerRelationSpec,
|
|
2546
2557
|
markerTimelineRelationSpec,
|
|
2547
2558
|
fromAssetRelationSpec,
|
|
2559
|
+
toAssetRelationSpec,
|
|
2548
2560
|
generatedRelationSpec,
|
|
2549
2561
|
captionAlignmentRelationSpec,
|
|
2550
2562
|
clipAnchorRelationSpec,
|
|
@@ -2573,12 +2585,12 @@ function hasMarkerAndSequence(endpoints) {
|
|
|
2573
2585
|
const second = endpoints[1].current();
|
|
2574
2586
|
return first.entityKind === "sequence-marker" && hasSequence(second) || second.entityKind === "sequence-marker" && hasSequence(first);
|
|
2575
2587
|
}
|
|
2576
|
-
/** Exactly one end is the Asset, so the other end is unambiguously the
|
|
2588
|
+
/** Exactly one end is the Asset, so the other end is unambiguously the bound entity. */
|
|
2577
2589
|
function hasExactlyOneAsset(endpoints) {
|
|
2578
2590
|
const kinds = endpoints.map((endpoint) => endpoint.current().entityKind);
|
|
2579
2591
|
const assets = kinds.map((kind) => kind === "asset");
|
|
2580
2592
|
if (assets[0] === assets[1]) return false;
|
|
2581
|
-
return declaresKind(assets[0] ? kinds[1] : kinds[0], "
|
|
2593
|
+
return declaresKind(assets[0] ? kinds[1] : kinds[0], "Asset");
|
|
2582
2594
|
}
|
|
2583
2595
|
function isGeneratedMedia(entity) {
|
|
2584
2596
|
return entity.entityKind === "video" || entity.entityKind === "image" || entity.entityKind === "audio";
|
|
@@ -3608,12 +3620,23 @@ function audioScriptAssetHash(payload) {
|
|
|
3608
3620
|
return bytesToHex(sha256(new TextEncoder().encode(canonicalJson(audioScriptAssetContent(payload)))));
|
|
3609
3621
|
}
|
|
3610
3622
|
/**
|
|
3611
|
-
* The Asset a script was written out to
|
|
3612
|
-
*
|
|
3613
|
-
*
|
|
3623
|
+
* The Asset a script was written out to. It is a snapshot the script owns, so
|
|
3624
|
+
* it is reached by `to-asset` — not `from-asset`, which would say the script
|
|
3625
|
+
* was produced from bytes it cannot change.
|
|
3614
3626
|
*/
|
|
3615
3627
|
function audioScriptAssetOf(rows, entityId) {
|
|
3616
|
-
|
|
3628
|
+
return boundAsset(rows, entityId, "to-asset");
|
|
3629
|
+
}
|
|
3630
|
+
/**
|
|
3631
|
+
* The Asset a script was made from — a transcript it does not own. A script
|
|
3632
|
+
* that has one never writes a snapshot of its own: the bytes it would describe
|
|
3633
|
+
* are already named, and rewriting them would contradict their source.
|
|
3634
|
+
*/
|
|
3635
|
+
function scriptSourceAssetOf(rows, entityId) {
|
|
3636
|
+
return boundAsset(rows, entityId, "from-asset");
|
|
3637
|
+
}
|
|
3638
|
+
function boundAsset(rows, entityId, relationKind) {
|
|
3639
|
+
const link = rows.relations.find((relation) => relation.relationKind === relationKind && (String(relation.endpoint0EntityId) === entityId || String(relation.endpoint1EntityId) === entityId));
|
|
3617
3640
|
if (link === void 0) return void 0;
|
|
3618
3641
|
const otherId = String(link.endpoint0EntityId) === entityId ? link.endpoint1EntityId : link.endpoint0EntityId;
|
|
3619
3642
|
return rows.entities.find((row) => String(row.entityId) === String(otherId) && row.entityKind === "asset");
|
|
@@ -3622,6 +3645,33 @@ function audioScriptAssetOf(rows, entityId) {
|
|
|
3622
3645
|
function audioScriptAssetFields(payload) {
|
|
3623
3646
|
return { assetContentHash: audioScriptAssetHash(payload) };
|
|
3624
3647
|
}
|
|
3648
|
+
/**
|
|
3649
|
+
* What a PhoneticScript hands to synthesis: the base AudioScript's text as the
|
|
3650
|
+
* variant pronounces it, plus the variant's own phoneme and prosody control.
|
|
3651
|
+
*
|
|
3652
|
+
* The variant's content is written by a model — deciding how words are said is
|
|
3653
|
+
* text work, not a mechanical copy — but the bytes a synthesizer reads have to
|
|
3654
|
+
* leave the entity graph to reach it, because synthesis does not handle
|
|
3655
|
+
* entities. Writing this resource down is that crossing, and it is why speech
|
|
3656
|
+
* can only come from a PhoneticScript.
|
|
3657
|
+
*/
|
|
3658
|
+
function phoneticScriptAssetContent(rows, entityId) {
|
|
3659
|
+
const assembled = assemblePhoneticScriptContent(rows, createEntityId(entityId));
|
|
3660
|
+
const own = assembled.phoneticScript.payload;
|
|
3661
|
+
return {
|
|
3662
|
+
text: assembled.text,
|
|
3663
|
+
segments: structuredClone(assembled.segments),
|
|
3664
|
+
...typeof own.phonemeScript === "string" ? { phonemeScript: own.phonemeScript } : {},
|
|
3665
|
+
...isJsonObject(own.prosody) ? { prosody: structuredClone(own.prosody) } : {}
|
|
3666
|
+
};
|
|
3667
|
+
}
|
|
3668
|
+
function phoneticScriptAssetHash(rows, entityId) {
|
|
3669
|
+
return bytesToHex(sha256(new TextEncoder().encode(canonicalJson(phoneticScriptAssetContent(rows, entityId)))));
|
|
3670
|
+
}
|
|
3671
|
+
/** The Asset a PhoneticScript was written out to, read from the graph. */
|
|
3672
|
+
function phoneticScriptAssetOf(rows, entityId) {
|
|
3673
|
+
return audioScriptAssetOf(rows, entityId);
|
|
3674
|
+
}
|
|
3625
3675
|
//#endregion
|
|
3626
3676
|
//#region src/entity-crdt/ordering.ts
|
|
3627
3677
|
/** Domain order is scoped by membership; relation storage has no global order. */
|
|
@@ -3925,8 +3975,10 @@ var LoroEntityDocument = class LoroEntityDocument {
|
|
|
3925
3975
|
/**
|
|
3926
3976
|
* Bind a saved snapshot without rewriting text operations or resolving
|
|
3927
3977
|
* selection conflicts. The script names the bytes the same way everything
|
|
3928
|
-
* else does — an Asset entity plus a
|
|
3929
|
-
*
|
|
3978
|
+
* else does — an Asset entity plus a Relation — and keeps only the
|
|
3979
|
+
* fingerprint that tells a stale snapshot from a current one. The Relation is
|
|
3980
|
+
* `to-asset`: these bytes are the script's own content written out, not a
|
|
3981
|
+
* source it was made from.
|
|
3930
3982
|
*/
|
|
3931
3983
|
bindAudioScriptAsset(entityId, assetId, expectedContentHash) {
|
|
3932
3984
|
const key = family(this.doc, entityId);
|
|
@@ -3949,10 +4001,10 @@ var LoroEntityDocument = class LoroEntityDocument {
|
|
|
3949
4001
|
this.transact((draft) => {
|
|
3950
4002
|
const current = readEntityDocument(this.doc, true).rows;
|
|
3951
4003
|
if (audioScriptAssetOf(current, entityId)?.entityId !== assetEntityId) {
|
|
3952
|
-
for (const relation of current.relations) if (relation.relationKind === "
|
|
4004
|
+
for (const relation of current.relations) if (relation.relationKind === "to-asset" && (String(relation.endpoint0EntityId) === String(entityId) || String(relation.endpoint1EntityId) === String(entityId))) draft.unlink(String(relation.relationId));
|
|
3953
4005
|
draft.link({
|
|
3954
|
-
relationId: createRelationId(`
|
|
3955
|
-
relationKind: "
|
|
4006
|
+
relationId: createRelationId(`relation_to-asset_${entityId}_${assetId}`),
|
|
4007
|
+
relationKind: "to-asset",
|
|
3956
4008
|
endpoint0EntityId: createEntityId(entityId),
|
|
3957
4009
|
endpoint1EntityId: assetEntityId,
|
|
3958
4010
|
metadata: {},
|
|
@@ -4663,4 +4715,4 @@ function createPlainMemoryAdapter(document, options) {
|
|
|
4663
4715
|
return new PlainMemoryAdapter(document, options);
|
|
4664
4716
|
}
|
|
4665
4717
|
//#endregion
|
|
4666
|
-
export {
|
|
4718
|
+
export { validateVideoDocument as $, EntityTimelineProjectionError as A, variantBaseEntityIds as B, equalJson as C, partUnionToDraft as Ct, projectEntityTimeline as D, bytesToBase64 as Dt, resolveFieldPath as E, base64ToBytes as Et, assemblePhoneticScriptContent as F, isMediaAssetVariantKind as G, createEntityId as H, assembleScriptText as I, derivePositionFromAbs as J, buildInitialVideoDocument as K, findComposedAudioScript as L, ScriptCompositionError as M, assembleCaptionContent as N, EntityProjectionGraph as O, assembleEntityContent as P, assertValidVideoDocument as Q, selectAudioScriptSegment as R, canonicalJson as S, speedOf as St, assertFieldChanges as T, videoDocumentMirrorSchema as Tt, createRelationId as U, isJsonObject as V, hasSequence as W, toVideoDocument as X, fromVideoDocument as Y, VideoDocumentValidationError as Z, audioScriptAssetOf as _, isEmptyVideoClip as _t, createMirrorVideoDocument as a, hasResolvedPlacement as at, phoneticScriptAssetOf as b, DEFAULT_UNIT_TIME_MS as bt, DocumentMutationGuard as c, cascadeAfterVideoClipChanges as ct, LoroEntityDraft as d, reassignSpeechesToVideoClipsByTime as dt, partUnionSchema as et, readEntityDocument as f, recalculateTimelineDuration as ft, audioScriptAssetHash as g, TIMELINE_SKELETON_DURATION_MS as gt, audioScriptAssetFields as h, syncAggregatedClipsTimePosition as ht, MirrorVideoDocumentAdapter as i, findLaneTrack as it, decodeEntityRelationRows as j, resolveEntityTimelineLayout as k, LORO_ENTITY_SCHEMA as l, arrangeMainTrackSeamlessly as lt, audioScriptAssetContent as m, resolveSpeechOverlapByShiftingVideos as mt, createPlainMemoryAdapter as n, LANE_KINDS_IN_STACK_ORDER as nt, createMirrorVideoDocumentAdapter as o, laneTrackId as ot, entityOrderGroups as p, resolveAllSpeechOverlaps as pt, buildSpeechHostMap as q, generatePartId as r, ensureLaneTrack as rt, readVideoDocumentFromDraft as s, solveVideoDocument as st, PlainMemoryAdapter as t, videoDocumentSchema as tt, LoroEntityDocument as u, fillMainTrackTimeGaps as ut, phoneticScriptAssetContent as v, partDurationMs as vt, applyFieldChanges as w, recordEntries as wt, scriptSourceAssetOf as x, effectiveVideoClipDurationMs as xt, phoneticScriptAssetHash as y, safeDurationMs as yt, updateEntityFields as z };
|
|
@@ -1104,7 +1104,7 @@ type CaptionSegmentSelection = JsonObject & {
|
|
|
1104
1104
|
};
|
|
1105
1105
|
//#endregion
|
|
1106
1106
|
//#region ../medeo-dsl/src/relations.d.ts
|
|
1107
|
-
type KnownRelationKind = 'timeline-track' | 'track-clip' | 'clip-marker' | 'marker-content' | 'axvideo-marker' | 'marker-timeline' | 'from-asset' | 'generated' | 'caption-alignment' | 'clip-anchor' | 'phonetic-script-render' | 'audio-script-source' | 'audio-script-marker';
|
|
1107
|
+
type KnownRelationKind = 'timeline-track' | 'track-clip' | 'clip-marker' | 'marker-content' | 'axvideo-marker' | 'marker-timeline' | 'from-asset' | 'to-asset' | 'generated' | 'caption-alignment' | 'clip-anchor' | 'phonetic-script-render' | 'audio-script-source' | 'audio-script-marker';
|
|
1108
1108
|
type RelationKind = KnownRelationKind | (string & {});
|
|
1109
1109
|
type RelationTrace = JsonObject;
|
|
1110
1110
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as index_d_exports } from "./index-CMa6ZCtX.js";
|
|
2
|
-
import { $ as SpeechHostMap, A as assertValidVideoDocument, At as VideoDocumentValidationIssueCode, B as EntityRow, Bt as SpeedShift, C as isImplementedSemanticOpKind, Ct as Timeline, D as PartIdFactory, Dt as VideoClipPart, E as ValidationError, Et as TrackItemTimePosition, F as ResolvedEntityTrack, Ft as speedOf, G as SequenceDuration, H as CaptionSegmentSelection, Ht as Track$1, I as resolveEntityTimelineLayout, It as Attachment, J as JsonObject, K as SequenceRange, L as projectEntityTimeline, Lt as CaptionPart$1, M as EntityTimelineTrackRole, Mt as VideoDraftContent, N as ResolvedEntityClipPlacement, Nt as VideoDraftPartUnion, O as generatePartId, Ot as VideoDocument, P as ResolvedEntityTimelineLayout, Pt as effectiveVideoClipDurationMs, Q as DerivedItemPosition, R as EntityTimelineProjectionError, Rt as CaptionStyle, S as SemanticOpKind, St as SpeechPart, T as SnapshotReadable, Tt as TrackItem, U as CaptionStyleFields, Ut as TrackItem$1, V as RelationRow, Vt as Timeline$1, W as ScriptTextSegment, X as EntityId, Y as JsonValue, Z as buildInitialVideoDocument, _ as SemanticOpName, _t as CaptionDisplayCue, a as PlainMemoryAdapter, at as LaneKind, b as ImplementedSemanticOpKind, bt as PartKind, c as MirrorVideoDocumentAdapter, ct as findLaneTrack, d as createMirrorVideoDocumentAdapter, dt as TrackDraft, et as buildSpeechHostMap, f as CommitOptions, ft as TrackItemDraft, g as SemanticOpInput, gt as BgmPart, h as SemanticEditor, ht as videoDocumentMirrorSchema, i as JournalEntry, it as LANE_KINDS_IN_STACK_ORDER, j as validateVideoDocument, jt as VideoDraft, k as VideoDocumentValidationError, kt as VideoDocumentValidationIssue, l as MirrorVideoDocumentOptions, lt as laneTrackId, m as SemanticDocumentAdapter, mt as VideoDocumentMirrorSchema, n as videoDocumentSchema, nt as fromVideoDocument, o as PlainMemoryAdapterOptions, ot as SolvedVideoDocument, p as OpActor, pt as VideoDocumentDraft, q as VoiceDescriptor, r as readVideoDocumentFromDraft, rt as toVideoDocument, s as createPlainMemoryAdapter, st as ensureLaneTrack, t as partUnionSchema, tt as derivePositionFromAbs, u as createMirrorVideoDocument, ut as solveVideoDocument, v as TransactAudit, vt as CaptionPart, w as SchemaValidator, wt as Track, x as PlannedSemanticOpKind, xt as PartUnion, y as IMPLEMENTED_SEMANTIC_OP_KINDS, yt as DEFAULT_UNIT_TIME_MS, z as EntityRelationRows, zt as PartAggregation } from "./index-
|
|
2
|
+
import { $ as SpeechHostMap, A as assertValidVideoDocument, At as VideoDocumentValidationIssueCode, B as EntityRow, Bt as SpeedShift, C as isImplementedSemanticOpKind, Ct as Timeline, D as PartIdFactory, Dt as VideoClipPart, E as ValidationError, Et as TrackItemTimePosition, F as ResolvedEntityTrack, Ft as speedOf, G as SequenceDuration, H as CaptionSegmentSelection, Ht as Track$1, I as resolveEntityTimelineLayout, It as Attachment, J as JsonObject, K as SequenceRange, L as projectEntityTimeline, Lt as CaptionPart$1, M as EntityTimelineTrackRole, Mt as VideoDraftContent, N as ResolvedEntityClipPlacement, Nt as VideoDraftPartUnion, O as generatePartId, Ot as VideoDocument, P as ResolvedEntityTimelineLayout, Pt as effectiveVideoClipDurationMs, Q as DerivedItemPosition, R as EntityTimelineProjectionError, Rt as CaptionStyle, S as SemanticOpKind, St as SpeechPart, T as SnapshotReadable, Tt as TrackItem, U as CaptionStyleFields, Ut as TrackItem$1, V as RelationRow, Vt as Timeline$1, W as ScriptTextSegment, X as EntityId, Y as JsonValue, Z as buildInitialVideoDocument, _ as SemanticOpName, _t as CaptionDisplayCue, a as PlainMemoryAdapter, at as LaneKind, b as ImplementedSemanticOpKind, bt as PartKind, c as MirrorVideoDocumentAdapter, ct as findLaneTrack, d as createMirrorVideoDocumentAdapter, dt as TrackDraft, et as buildSpeechHostMap, f as CommitOptions, ft as TrackItemDraft, g as SemanticOpInput, gt as BgmPart, h as SemanticEditor, ht as videoDocumentMirrorSchema, i as JournalEntry, it as LANE_KINDS_IN_STACK_ORDER, j as validateVideoDocument, jt as VideoDraft, k as VideoDocumentValidationError, kt as VideoDocumentValidationIssue, l as MirrorVideoDocumentOptions, lt as laneTrackId, m as SemanticDocumentAdapter, mt as VideoDocumentMirrorSchema, n as videoDocumentSchema, nt as fromVideoDocument, o as PlainMemoryAdapterOptions, ot as SolvedVideoDocument, p as OpActor, pt as VideoDocumentDraft, q as VoiceDescriptor, r as readVideoDocumentFromDraft, rt as toVideoDocument, s as createPlainMemoryAdapter, st as ensureLaneTrack, t as partUnionSchema, tt as derivePositionFromAbs, u as createMirrorVideoDocument, ut as solveVideoDocument, v as TransactAudit, vt as CaptionPart, w as SchemaValidator, wt as Track, x as PlannedSemanticOpKind, xt as PartUnion, y as IMPLEMENTED_SEMANTIC_OP_KINDS, yt as DEFAULT_UNIT_TIME_MS, z as EntityRelationRows, zt as PartAggregation } from "./index-BZtSciyB.js";
|
|
3
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";
|
|
@@ -232,8 +232,8 @@ declare function selectAudioScriptSegment(script: EntityRow<'audio-script'>, sel
|
|
|
232
232
|
//#region src/entity-editor/entity-graph-http-client.d.ts
|
|
233
233
|
/** One authenticated revision of the authoritative Medeo Entity graph. */
|
|
234
234
|
interface EntityGraphState {
|
|
235
|
-
/** Current AudioScript
|
|
236
|
-
readonly audioScriptEntityId: string;
|
|
235
|
+
/** Current AudioScript attached to the project, or null until one is written. */
|
|
236
|
+
readonly audioScriptEntityId: string | null;
|
|
237
237
|
readonly revision: number;
|
|
238
238
|
readonly loroSnapshot: string;
|
|
239
239
|
readonly rows: EntityRelationRows;
|
|
@@ -385,8 +385,10 @@ declare class LoroEntityDocument {
|
|
|
385
385
|
/**
|
|
386
386
|
* Bind a saved snapshot without rewriting text operations or resolving
|
|
387
387
|
* selection conflicts. The script names the bytes the same way everything
|
|
388
|
-
* else does — an Asset entity plus a
|
|
389
|
-
*
|
|
388
|
+
* else does — an Asset entity plus a Relation — and keeps only the
|
|
389
|
+
* fingerprint that tells a stale snapshot from a current one. The Relation is
|
|
390
|
+
* `to-asset`: these bytes are the script's own content written out, not a
|
|
391
|
+
* source it was made from.
|
|
390
392
|
*/
|
|
391
393
|
bindAudioScriptAsset(entityId: string, assetId: string, expectedContentHash: string): Uint8Array;
|
|
392
394
|
canUndo(): boolean;
|
|
@@ -995,7 +997,7 @@ interface EditorFoundation {
|
|
|
995
997
|
readonly timelineEntityId: string;
|
|
996
998
|
readonly trackEntityIds: Readonly<Record<EditorTrackRole, string>>;
|
|
997
999
|
/** Initial or current AudioScript content ID selected by the foundation. */
|
|
998
|
-
readonly audioScriptEntityId: string;
|
|
1000
|
+
readonly audioScriptEntityId: string | null;
|
|
999
1001
|
}
|
|
1000
1002
|
/**
|
|
1001
1003
|
* MEngine editor policy, not a cardinality restriction on the general-purpose DSL.
|
|
@@ -1075,7 +1077,7 @@ interface DocumentAudioScript {
|
|
|
1075
1077
|
/** State exposing the current AudioScript content version attached to the project. */
|
|
1076
1078
|
interface DocumentAudioScriptState {
|
|
1077
1079
|
readonly rows: EntityRelationRows;
|
|
1078
|
-
/** Current attachment
|
|
1080
|
+
/** Current attachment, or null until a script is transcribed or written. */
|
|
1079
1081
|
readonly audioScriptEntityId: string | null;
|
|
1080
1082
|
}
|
|
1081
1083
|
/** Read only the attached version and preserve every segment; never aggregate other scripts. */
|
|
@@ -1961,12 +1963,32 @@ declare function relativePositionForAbs(ranges: MainClipRange[], absMs: number):
|
|
|
1961
1963
|
declare function audioScriptAssetContent(payload: JsonObject): JsonObject;
|
|
1962
1964
|
declare function audioScriptAssetHash(payload: JsonObject): string;
|
|
1963
1965
|
/**
|
|
1964
|
-
* The Asset a script was written out to
|
|
1965
|
-
*
|
|
1966
|
-
*
|
|
1966
|
+
* The Asset a script was written out to. It is a snapshot the script owns, so
|
|
1967
|
+
* it is reached by `to-asset` — not `from-asset`, which would say the script
|
|
1968
|
+
* was produced from bytes it cannot change.
|
|
1967
1969
|
*/
|
|
1968
1970
|
declare function audioScriptAssetOf(rows: EntityRelationRows, entityId: string): EntityRow | undefined;
|
|
1971
|
+
/**
|
|
1972
|
+
* The Asset a script was made from — a transcript it does not own. A script
|
|
1973
|
+
* that has one never writes a snapshot of its own: the bytes it would describe
|
|
1974
|
+
* are already named, and rewriting them would contradict their source.
|
|
1975
|
+
*/
|
|
1976
|
+
declare function scriptSourceAssetOf(rows: EntityRelationRows, entityId: string): EntityRow | undefined;
|
|
1969
1977
|
/** Internal fingerprint prevents a resource from silently describing an older text revision. */
|
|
1970
1978
|
declare function audioScriptAssetFields(payload: JsonObject): JsonObject;
|
|
1979
|
+
/**
|
|
1980
|
+
* What a PhoneticScript hands to synthesis: the base AudioScript's text as the
|
|
1981
|
+
* variant pronounces it, plus the variant's own phoneme and prosody control.
|
|
1982
|
+
*
|
|
1983
|
+
* The variant's content is written by a model — deciding how words are said is
|
|
1984
|
+
* text work, not a mechanical copy — but the bytes a synthesizer reads have to
|
|
1985
|
+
* leave the entity graph to reach it, because synthesis does not handle
|
|
1986
|
+
* entities. Writing this resource down is that crossing, and it is why speech
|
|
1987
|
+
* can only come from a PhoneticScript.
|
|
1988
|
+
*/
|
|
1989
|
+
declare function phoneticScriptAssetContent(rows: EntityRelationRows, entityId: string): JsonObject;
|
|
1990
|
+
declare function phoneticScriptAssetHash(rows: EntityRelationRows, entityId: string): string;
|
|
1991
|
+
/** The Asset a PhoneticScript was written out to, read from the graph. */
|
|
1992
|
+
declare function phoneticScriptAssetOf(rows: EntityRelationRows, entityId: string): EntityRow | undefined;
|
|
1971
1993
|
//#endregion
|
|
1972
|
-
export { type AddGeneratedVisualsInput, type AddSpeechAssetsInput, type Aggregation, type ApplyCaptionAssetsInput, type ApplyCaptionAssetsResult, type AsrCaptionSegment, type AssembledCaptionContent, type AssembledPhoneticScriptContent, type Attachment, type AudioMediaAssetFact, type BgmPart, type CaptionAssetFact, type CaptionAssetsEffectEnvelope, type CaptionContentInput, type CaptionDisplayCue, type CaptionPart, type CaptionSegmentSelection, type CaptionStyle, type ClipEntityId, type ClipPlacement, type CommitOptions, type CompiledCaptionAssetsEffect, type CompiledGeneratedVisualEffect, type CompiledSpeechAssetsEffect, type ContinueVideoInput, DEFAULT_UNIT_TIME_MS, type DeleteBgmInput, type DeleteClipInput, type DeleteClipTreeInput, type DeleteVoiceoverInput, type DerivedItemPosition, type DocStorageLike, type DocVersionMark, type DocumentAudioScript, type DocumentAudioScriptState, type EditorFoundation, EntityDocumentState, type EntityGraphCommitOptions, EntityGraphHttpClient, type EntityGraphState, EntityTimelineEditor, type EntityTimelineIdFactory, EntityTimelineProjectionError, type EntityTimelineTrackRole, type FieldChange, type FieldPath, type GeneratedSpeechCaptionFact, type GeneratedSpeechFact, type GeneratedSpeechSourceFact, type GeneratedVisualClipFact, type GeneratedVisualEffectEnvelope, type GeneratedVisualEffectResult, IMPLEMENTED_SEMANTIC_OP_KINDS, type ImageMediaAssetFact, type ImplementedSemanticOpKind, type ImportedCaptionAsset, type ImportedMediaAsset, 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 MengineDocSyncState, type MengineDocumentVersion, type MengineEventStreamOptions, MengineHttpClient, type MengineHttpClientOptions, MengineHttpRequestError, MenginePushRejectedError, type MenginePushResponse, type MenginePushUpdateResponse, type MengineRejectedResponse, type MengineSnapshotResponse, type MengineSseUpdateEvent, type MengineSyncResponse, type MengineUndoState, 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 ReplaceVoiceSpeechAssetsInput, type ReplacementMediaClipInput, type ResolvedAsrSpeechSegment, type ResolvedEntityClipPlacement, type ResolvedEntityTimelineLayout, type ResolvedEntityTrack, type ResolvedSpeechScriptSegment, SchemaValidator, ScriptCompositionError, type SemanticDocumentAdapter, SemanticEditor, type SemanticOpInput, type SemanticOpKind, type SemanticOpName, type SequentialClipAnchor, type SetBgmInput, type SetCaptionVisibilityInput, type SetClipPlacementInput, type SetClipSpeedInput, type SetClipVolumeInput, type SetVideoClipSpeedEffectInput, type SnapshotReadable, type SolvedVideoDocument, type SpeechAssetsEffectEnvelope, type SpeechAssetsEffectInput, type SpeechAssetsEffectResult, 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, ValidationError, type VideoClipPart, type VideoClipSpeedMode, type VideoDocument, type VideoDocumentDraft, type VideoDocumentMirrorSchema, VideoDocumentValidationError, type VideoDocumentValidationIssue, type VideoDocumentValidationIssueCode, type VideoDraft, type CaptionPart$1 as VideoDraftCaptionPart, type VideoDraftContent, type VideoDraftPartUnion, type Timeline$1 as VideoDraftTimeline, type Track$1 as VideoDraftTrack, type TrackItem$1 as VideoDraftTrackItem, type VideoMediaAssetFact, type VisualMediaAssetFact, type VoiceoverCaptionFact, type VoiceoverMediaAssetFact, type VoiceoverTakeInput, type VoiceoverTakeResult, type WaitForServerAckOptions, applyEntityRows, applyFieldChanges, arrangeMainTrackSeamlessly, assembleCaptionContent, assembleEntityContent, assemblePhoneticScriptContent, assembleScriptText, assertCanonicalEditorResources, assertEntityProjectionPreservesLegacy, assertFieldChanges, assertMediaAssetWritePolicy, assertValidVideoDocument, audioScriptAssetContent, audioScriptAssetFields, audioScriptAssetHash, audioScriptAssetOf, base64ToBytes, buildInitialVideoDocument, buildSpeechHostMap, bytesToBase64, cascadeAfterVideoClipChanges, compileCaptionAssetsEffect, compileEntityRows, compileGeneratedVisualEffect, compileSpeechAssetsEffect, createEditSandbox, createMirrorVideoDocument, createMirrorVideoDocumentAdapter, createPlainMemoryAdapter, decodeDocVersionMark, derivePositionFromAbs, effectiveVideoClipDurationMs, encodeDocVersionMark, ensureEditorFoundation, ensureLaneTrack, fillMainTrackTimeGaps, findComposedAudioScript, findLaneTrack, fromVideoDocument, generatePartId, getAt, hostForAbsMs, importCaptionAsset, importMediaAsset, isEmptyVideoClip, isImplementedSemanticOpKind, isMap, laneTrackId, mainTrackRanges, migrateLegacyTimelineToEntities, partDurationMs, partUnionSchema, prepareCaptionAssetsEffect, prepareCaptionContent, prepareContinueVideoEffect, prepareGeneratedVisualEffect, prepareSpeechAssetsEffect, projectEntityTimeline, readDocumentAudioScript, readEntityDocument, readMainTrackItems, readMengineEventStream, readPart, readPartDurationMs, readVideoDocumentFromDraft, reassignSpeechesToVideoClipsByTime, recalculateTimelineDuration, relativePositionForAbs, replayJournal, resolveAllSpeechOverlaps, resolveEntityTimelineLayout, resolveFieldPath, resolveSpeechOverlapByShiftingVideos, safeDurationMs, index_d_exports as schemas, selectAudioScriptSegment, snapshotToPlain, solveVideoDocument, speedOf, syncAggregatedClipsTimePosition, toVideoDocument, validateVideoDocument, videoDocumentMirrorSchema, videoDocumentSchema };
|
|
1994
|
+
export { type AddGeneratedVisualsInput, type AddSpeechAssetsInput, type Aggregation, type ApplyCaptionAssetsInput, type ApplyCaptionAssetsResult, type AsrCaptionSegment, type AssembledCaptionContent, type AssembledPhoneticScriptContent, type Attachment, type AudioMediaAssetFact, type BgmPart, type CaptionAssetFact, type CaptionAssetsEffectEnvelope, type CaptionContentInput, type CaptionDisplayCue, type CaptionPart, type CaptionSegmentSelection, type CaptionStyle, type ClipEntityId, type ClipPlacement, type CommitOptions, type CompiledCaptionAssetsEffect, type CompiledGeneratedVisualEffect, type CompiledSpeechAssetsEffect, type ContinueVideoInput, DEFAULT_UNIT_TIME_MS, type DeleteBgmInput, type DeleteClipInput, type DeleteClipTreeInput, type DeleteVoiceoverInput, type DerivedItemPosition, type DocStorageLike, type DocVersionMark, type DocumentAudioScript, type DocumentAudioScriptState, type EditorFoundation, EntityDocumentState, type EntityGraphCommitOptions, EntityGraphHttpClient, type EntityGraphState, EntityTimelineEditor, type EntityTimelineIdFactory, EntityTimelineProjectionError, type EntityTimelineTrackRole, type FieldChange, type FieldPath, type GeneratedSpeechCaptionFact, type GeneratedSpeechFact, type GeneratedSpeechSourceFact, type GeneratedVisualClipFact, type GeneratedVisualEffectEnvelope, type GeneratedVisualEffectResult, IMPLEMENTED_SEMANTIC_OP_KINDS, type ImageMediaAssetFact, type ImplementedSemanticOpKind, type ImportedCaptionAsset, type ImportedMediaAsset, 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 MengineDocSyncState, type MengineDocumentVersion, type MengineEventStreamOptions, MengineHttpClient, type MengineHttpClientOptions, MengineHttpRequestError, MenginePushRejectedError, type MenginePushResponse, type MenginePushUpdateResponse, type MengineRejectedResponse, type MengineSnapshotResponse, type MengineSseUpdateEvent, type MengineSyncResponse, type MengineUndoState, 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 ReplaceVoiceSpeechAssetsInput, type ReplacementMediaClipInput, type ResolvedAsrSpeechSegment, type ResolvedEntityClipPlacement, type ResolvedEntityTimelineLayout, type ResolvedEntityTrack, type ResolvedSpeechScriptSegment, SchemaValidator, ScriptCompositionError, type SemanticDocumentAdapter, SemanticEditor, type SemanticOpInput, type SemanticOpKind, type SemanticOpName, type SequentialClipAnchor, type SetBgmInput, type SetCaptionVisibilityInput, type SetClipPlacementInput, type SetClipSpeedInput, type SetClipVolumeInput, type SetVideoClipSpeedEffectInput, type SnapshotReadable, type SolvedVideoDocument, type SpeechAssetsEffectEnvelope, type SpeechAssetsEffectInput, type SpeechAssetsEffectResult, 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, ValidationError, type VideoClipPart, type VideoClipSpeedMode, type VideoDocument, type VideoDocumentDraft, type VideoDocumentMirrorSchema, VideoDocumentValidationError, type VideoDocumentValidationIssue, type VideoDocumentValidationIssueCode, type VideoDraft, type CaptionPart$1 as VideoDraftCaptionPart, type VideoDraftContent, type VideoDraftPartUnion, type Timeline$1 as VideoDraftTimeline, type Track$1 as VideoDraftTrack, type TrackItem$1 as VideoDraftTrackItem, type VideoMediaAssetFact, type VisualMediaAssetFact, type VoiceoverCaptionFact, type VoiceoverMediaAssetFact, type VoiceoverTakeInput, type VoiceoverTakeResult, type WaitForServerAckOptions, applyEntityRows, applyFieldChanges, arrangeMainTrackSeamlessly, assembleCaptionContent, assembleEntityContent, assemblePhoneticScriptContent, assembleScriptText, assertCanonicalEditorResources, assertEntityProjectionPreservesLegacy, assertFieldChanges, assertMediaAssetWritePolicy, assertValidVideoDocument, audioScriptAssetContent, audioScriptAssetFields, audioScriptAssetHash, audioScriptAssetOf, base64ToBytes, buildInitialVideoDocument, buildSpeechHostMap, bytesToBase64, cascadeAfterVideoClipChanges, compileCaptionAssetsEffect, compileEntityRows, compileGeneratedVisualEffect, compileSpeechAssetsEffect, createEditSandbox, createMirrorVideoDocument, createMirrorVideoDocumentAdapter, createPlainMemoryAdapter, decodeDocVersionMark, derivePositionFromAbs, effectiveVideoClipDurationMs, encodeDocVersionMark, ensureEditorFoundation, ensureLaneTrack, fillMainTrackTimeGaps, findComposedAudioScript, findLaneTrack, fromVideoDocument, generatePartId, getAt, hostForAbsMs, importCaptionAsset, importMediaAsset, isEmptyVideoClip, isImplementedSemanticOpKind, isMap, laneTrackId, mainTrackRanges, migrateLegacyTimelineToEntities, partDurationMs, partUnionSchema, phoneticScriptAssetContent, phoneticScriptAssetHash, phoneticScriptAssetOf, prepareCaptionAssetsEffect, prepareCaptionContent, prepareContinueVideoEffect, prepareGeneratedVisualEffect, prepareSpeechAssetsEffect, projectEntityTimeline, readDocumentAudioScript, readEntityDocument, readMainTrackItems, readMengineEventStream, readPart, readPartDurationMs, readVideoDocumentFromDraft, reassignSpeechesToVideoClipsByTime, recalculateTimelineDuration, relativePositionForAbs, replayJournal, resolveAllSpeechOverlaps, resolveEntityTimelineLayout, resolveFieldPath, resolveSpeechOverlapByShiftingVideos, safeDurationMs, index_d_exports as schemas, scriptSourceAssetOf, selectAudioScriptSegment, snapshotToPlain, solveVideoDocument, speedOf, syncAggregatedClipsTimePosition, toVideoDocument, validateVideoDocument, videoDocumentMirrorSchema, videoDocumentSchema };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as validateVideoDocument, A as EntityTimelineProjectionError, B as variantBaseEntityIds, C as equalJson, Ct as partUnionToDraft, D as projectEntityTimeline, Dt as bytesToBase64, E as resolveFieldPath, Et as base64ToBytes, F as assemblePhoneticScriptContent, G as isMediaAssetVariantKind, H as createEntityId, I as assembleScriptText, J as derivePositionFromAbs, K as buildInitialVideoDocument, L as findComposedAudioScript, M as ScriptCompositionError, N as assembleCaptionContent, O as EntityProjectionGraph, P as assembleEntityContent, Q as assertValidVideoDocument, R as selectAudioScriptSegment, S as canonicalJson, St as speedOf, T as assertFieldChanges, Tt as videoDocumentMirrorSchema, U as createRelationId, V as isJsonObject, W as hasSequence, X as toVideoDocument, Y as fromVideoDocument, Z as VideoDocumentValidationError, _ as audioScriptAssetOf, _t as isEmptyVideoClip, a as createMirrorVideoDocument, at as hasResolvedPlacement, b as phoneticScriptAssetOf, bt as DEFAULT_UNIT_TIME_MS, c as DocumentMutationGuard, ct as cascadeAfterVideoClipChanges, d as LoroEntityDraft, dt as reassignSpeechesToVideoClipsByTime, et as partUnionSchema, f as readEntityDocument, ft as recalculateTimelineDuration, g as audioScriptAssetHash, gt as TIMELINE_SKELETON_DURATION_MS, h as audioScriptAssetFields, ht as syncAggregatedClipsTimePosition, i as MirrorVideoDocumentAdapter, it as findLaneTrack, j as decodeEntityRelationRows, k as resolveEntityTimelineLayout, l as LORO_ENTITY_SCHEMA, lt as arrangeMainTrackSeamlessly, m as audioScriptAssetContent, mt as resolveSpeechOverlapByShiftingVideos, n as createPlainMemoryAdapter, nt as LANE_KINDS_IN_STACK_ORDER, o as createMirrorVideoDocumentAdapter, ot as laneTrackId, p as entityOrderGroups, pt as resolveAllSpeechOverlaps, q as buildSpeechHostMap, r as generatePartId, rt as ensureLaneTrack, s as readVideoDocumentFromDraft, st as solveVideoDocument, t as PlainMemoryAdapter, tt as videoDocumentSchema, u as LoroEntityDocument, ut as fillMainTrackTimeGaps, v as phoneticScriptAssetContent, vt as partDurationMs, w as applyFieldChanges, wt as recordEntries, x as scriptSourceAssetOf, xt as effectiveVideoClipDurationMs, y as phoneticScriptAssetHash, yt as safeDurationMs, z as updateEntityFields } from "./document-ecRldQY4.js";
|
|
2
2
|
import { addSpeechesInputSchema, addVideoClipsInputSchema, adjustBgmVolumeInputSchema, adjustSpeechVolumeInputSchema, adjustVideoClipDurationInputSchema, adjustVideoClipVolumeInputSchema, changeSpeechScriptInputSchema, changeSpeechVoiceInputSchema, deleteBgmInputSchema, deleteSpeechesInputSchema, deleteVideoClipsInputSchema, moveSpeechesInputSchema, moveVideoClipsByAnchorInputSchema, moveVideoClipsInputSchema, replaceVideoClipContentInputSchema, replaceVideoClipSequenceInputSchema, setBgmInputSchema, setCaptionStyleInputSchema, setCaptionVisibilityInputSchema, setVideoClipSpeedShiftInputSchema, t as schemas_exports } from "./schemas.js";
|
|
3
3
|
import { LoroDoc, UndoManager, VersionVector } from "loro-crdt";
|
|
4
4
|
import { sha256 } from "@noble/hashes/sha2.js";
|
|
@@ -223,7 +223,8 @@ function compileEntityRows(snapshot, rows, validate) {
|
|
|
223
223
|
}
|
|
224
224
|
/** Compile an edit on an existing peer, retaining its native local undo history. */
|
|
225
225
|
function applyEntityRows(editor, rows) {
|
|
226
|
-
const
|
|
226
|
+
const baseline = editor.snapshot();
|
|
227
|
+
const before = baseline.rows;
|
|
227
228
|
const oldEntities = new Map(before.entities.map((row) => [row.entityId, row]));
|
|
228
229
|
const newEntities = new Map(rows.entities.map((row) => [row.entityId, row]));
|
|
229
230
|
const oldRelations = new Map(before.relations.map((row) => [row.relationId, row]));
|
|
@@ -239,10 +240,16 @@ function applyEntityRows(editor, rows) {
|
|
|
239
240
|
if (!equalJson(row.metadata, next.metadata) || !equalJson(row.trace, next.trace)) draft.patchRelation(row.relationId, next.metadata, next.trace);
|
|
240
241
|
}
|
|
241
242
|
}
|
|
243
|
+
let attached = baseline.project.audioScriptEntityId !== void 0;
|
|
242
244
|
for (const row of rows.entities) {
|
|
243
245
|
const previous = oldEntities.get(row.entityId);
|
|
244
|
-
if (!previous)
|
|
245
|
-
|
|
246
|
+
if (!previous) {
|
|
247
|
+
draft.create(row);
|
|
248
|
+
if (!attached && row.entityKind === "audio-script") {
|
|
249
|
+
draft.attach("audioScriptEntityId", String(row.entityId));
|
|
250
|
+
attached = true;
|
|
251
|
+
}
|
|
252
|
+
} else {
|
|
246
253
|
if (previous.entityKind !== row.entityKind) throw new Error("Entity kind cannot change");
|
|
247
254
|
if (!equalJson(previous.payload, row.payload)) draft.replaceOwned(row.entityId, row.payload);
|
|
248
255
|
}
|
|
@@ -352,23 +359,14 @@ function memotaLocator(value) {
|
|
|
352
359
|
* explicit project attachment, multiple candidates are ambiguous. Existing
|
|
353
360
|
* content IDs are reused here; Loro editing advances their immutable versions.
|
|
354
361
|
*/
|
|
355
|
-
function ensureDocumentAudioScript(entities,
|
|
362
|
+
function ensureDocumentAudioScript(entities, selectedEntityId) {
|
|
356
363
|
if (selectedEntityId != null) {
|
|
357
364
|
if (!entities.some((row) => row.entityKind === "audio-script" && row.entityId === selectedEntityId)) throw new EntityTimelineProjectionError(`Selected AudioScript ${selectedEntityId} does not exist`);
|
|
358
365
|
return selectedEntityId;
|
|
359
366
|
}
|
|
360
367
|
const scripts = entities.filter((row) => row.entityKind === "audio-script");
|
|
361
368
|
if (scripts.length > 1) throw new EntityTimelineProjectionError("Select an AudioScript for the editor panel when multiple scripts exist");
|
|
362
|
-
|
|
363
|
-
if (existing !== void 0) return existing.entityId;
|
|
364
|
-
const id = createEntityId(idFactory("entity"));
|
|
365
|
-
if (entities.some((row) => row.entityId === id)) throw new Error(`Duplicate entity id ${id}`);
|
|
366
|
-
entities.push({
|
|
367
|
-
entityId: id,
|
|
368
|
-
entityKind: "audio-script",
|
|
369
|
-
payload: { segments: [] }
|
|
370
|
-
});
|
|
371
|
-
return id;
|
|
369
|
+
return scripts[0]?.entityId ?? null;
|
|
372
370
|
}
|
|
373
371
|
/** Add only missing editor structure; existing identities and owned settings are never replaced. */
|
|
374
372
|
function ensureEditorFoundation(initial, idFactory = (prefix) => `${prefix}_${globalThis.crypto.randomUUID()}`, timelinePayload = {}, selectedAudioScriptEntityId) {
|
|
@@ -422,7 +420,7 @@ function ensureEditorFoundation(initial, idFactory = (prefix) => `${prefix}_${gl
|
|
|
422
420
|
}
|
|
423
421
|
trackEntityIds[role] = track.entityId;
|
|
424
422
|
}
|
|
425
|
-
const audioScriptEntityId = ensureDocumentAudioScript(entities,
|
|
423
|
+
const audioScriptEntityId = ensureDocumentAudioScript(entities, selectedAudioScriptEntityId);
|
|
426
424
|
return {
|
|
427
425
|
rows: {
|
|
428
426
|
entities,
|
|
@@ -490,15 +488,16 @@ function parseWireState(value, expectedDocId) {
|
|
|
490
488
|
if (value.doc_id !== expectedDocId) throw new Error(`Entity-state response doc_id mismatch: expected "${expectedDocId}"`);
|
|
491
489
|
const rows = parseWireRows(value.rows);
|
|
492
490
|
decodeEntityRelationRows(rows, numericMarkerValidation$1);
|
|
493
|
-
|
|
491
|
+
const attached = value.audio_script_entity_id;
|
|
492
|
+
if (attached !== null && typeof attached !== "string") throw new Error("Invalid document AudioScript identity");
|
|
494
493
|
if (typeof value.loro_snapshot !== "string") throw new Error("Missing causal Loro snapshot");
|
|
495
494
|
const state = {
|
|
496
495
|
revision: value.revision,
|
|
497
496
|
loroSnapshot: value.loro_snapshot,
|
|
498
497
|
rows,
|
|
499
|
-
audioScriptEntityId:
|
|
498
|
+
audioScriptEntityId: attached
|
|
500
499
|
};
|
|
501
|
-
readDocumentAudioScript(state);
|
|
500
|
+
if (attached !== null) readDocumentAudioScript(state);
|
|
502
501
|
return state;
|
|
503
502
|
}
|
|
504
503
|
function parseWireRows(value) {
|
|
@@ -2722,13 +2721,13 @@ function requireAssetlessAsrSourceScript(rows, source) {
|
|
|
2722
2721
|
return audioScript;
|
|
2723
2722
|
}
|
|
2724
2723
|
function requireNoAudioScriptAsset(rows, audioScriptEntityId, label) {
|
|
2725
|
-
if (incidentRelations(rows, audioScriptEntityId).filter((relation) => relation.relationKind === "
|
|
2724
|
+
if (incidentRelations(rows, audioScriptEntityId).filter((relation) => relation.relationKind === "to-asset").length > 0) throw new Error(`${label} AudioScript "${audioScriptEntityId}" must not have an authored Asset snapshot`);
|
|
2726
2725
|
}
|
|
2727
2726
|
function requireCanonicalAudioScriptAsset(rows, audioScriptEntityId) {
|
|
2728
|
-
const bindings = incidentRelations(rows, audioScriptEntityId).filter((relation) => relation.relationKind === "
|
|
2727
|
+
const bindings = incidentRelations(rows, audioScriptEntityId).filter((relation) => relation.relationKind === "to-asset");
|
|
2729
2728
|
if (bindings.length !== 1) throw new Error(`AudioScript "${audioScriptEntityId}" requires exactly one Asset binding`);
|
|
2730
2729
|
const binding = bindings[0];
|
|
2731
|
-
if (binding.endpoint0EntityId !== audioScriptEntityId) throw new Error("
|
|
2730
|
+
if (binding.endpoint0EntityId !== audioScriptEntityId) throw new Error("to-asset must use ordered endpoints [AudioScript, Asset]");
|
|
2732
2731
|
const asset = requireEntityKind(rows, binding.endpoint1EntityId, "asset");
|
|
2733
2732
|
if (asset.payload.system !== "memota" || typeof asset.payload.key !== "string" || asset.payload.key.length === 0 || asset.payload.key.trim() !== asset.payload.key) throw new Error(`AudioScript Asset "${asset.entityId}" must state a canonical memota locator`);
|
|
2734
2733
|
return asset;
|
|
@@ -3400,7 +3399,15 @@ function migrateLegacyTimelineToEntities(legacy, assetFacts, initial = {
|
|
|
3400
3399
|
const normalizedMainRanges = overlapNormalizedMainRanges(legacy);
|
|
3401
3400
|
let entities = structuredClone([...initial.entities]);
|
|
3402
3401
|
let relations = structuredClone([...initial.relations]);
|
|
3403
|
-
const documentAudioScriptEntityId = ensureDocumentAudioScript(entities
|
|
3402
|
+
const documentAudioScriptEntityId = ensureDocumentAudioScript(entities) ?? (() => {
|
|
3403
|
+
const id = createEntityId(idFactory("entity"));
|
|
3404
|
+
entities.push({
|
|
3405
|
+
entityId: id,
|
|
3406
|
+
entityKind: "audio-script",
|
|
3407
|
+
payload: { segments: [] }
|
|
3408
|
+
});
|
|
3409
|
+
return String(id);
|
|
3410
|
+
})();
|
|
3404
3411
|
const addEntity = (kind, payload, existingId) => {
|
|
3405
3412
|
const entityId = createEntityId(existingId ?? idFactory("entity"));
|
|
3406
3413
|
if (entities.some((row) => row.entityId === entityId)) fail(`Migration entity identity collision: ${entityId}`);
|
|
@@ -6503,4 +6510,4 @@ function serverCovers(serverVV, target) {
|
|
|
6503
6510
|
return covers(server, target);
|
|
6504
6511
|
}
|
|
6505
6512
|
//#endregion
|
|
6506
|
-
export { DEFAULT_UNIT_TIME_MS, EntityGraphHttpClient, EntityTimelineEditor, EntityTimelineProjectionError, IMPLEMENTED_SEMANTIC_OP_KINDS, LANE_KINDS_IN_STACK_ORDER, LORO_ENTITY_SCHEMA, LoroEntityDocument, LoroEntityDraft, ManualSyncDoc, MedeoHttpDocStorage, MemoryDocStorage, MengineAckFailedError, MengineDocSession, MengineHttpClient, MengineHttpRequestError, MenginePushRejectedError, MirrorVideoDocumentAdapter, PlainMemoryAdapter, SchemaValidator, ScriptCompositionError, SemanticEditor, TIMELINE_SKELETON_DURATION_MS, ValidationError, VideoDocumentValidationError, applyEntityRows, applyFieldChanges, arrangeMainTrackSeamlessly, assembleCaptionContent, assembleEntityContent, assemblePhoneticScriptContent, assembleScriptText, assertCanonicalEditorResources, assertEntityProjectionPreservesLegacy, assertFieldChanges, assertMediaAssetWritePolicy, assertValidVideoDocument, audioScriptAssetContent, audioScriptAssetFields, audioScriptAssetHash, audioScriptAssetOf, base64ToBytes, buildInitialVideoDocument, buildSpeechHostMap, bytesToBase64, cascadeAfterVideoClipChanges, compileCaptionAssetsEffect, compileEntityRows, compileGeneratedVisualEffect, compileSpeechAssetsEffect, createEditSandbox, createMirrorVideoDocument, createMirrorVideoDocumentAdapter, createPlainMemoryAdapter, decodeDocVersionMark, derivePositionFromAbs, effectiveVideoClipDurationMs, encodeDocVersionMark, ensureEditorFoundation, ensureLaneTrack, fillMainTrackTimeGaps, findComposedAudioScript, findLaneTrack, fromVideoDocument, generatePartId, getAt, hostForAbsMs, importCaptionAsset, importMediaAsset, isEmptyVideoClip, isImplementedSemanticOpKind, isMap, laneTrackId, mainTrackRanges, migrateLegacyTimelineToEntities, partDurationMs, partUnionSchema, prepareCaptionAssetsEffect, prepareCaptionContent, prepareContinueVideoEffect, prepareGeneratedVisualEffect, prepareSpeechAssetsEffect, projectEntityTimeline, readDocumentAudioScript, readEntityDocument, readMainTrackItems, readMengineEventStream, readPart, readPartDurationMs, readVideoDocumentFromDraft, reassignSpeechesToVideoClipsByTime, recalculateTimelineDuration, relativePositionForAbs, replayJournal, resolveAllSpeechOverlaps, resolveEntityTimelineLayout, resolveFieldPath, resolveSpeechOverlapByShiftingVideos, safeDurationMs, schemas_exports as schemas, selectAudioScriptSegment, snapshotToPlain, solveVideoDocument, speedOf, syncAggregatedClipsTimePosition, toVideoDocument, validateVideoDocument, videoDocumentMirrorSchema, videoDocumentSchema };
|
|
6513
|
+
export { DEFAULT_UNIT_TIME_MS, EntityGraphHttpClient, EntityTimelineEditor, EntityTimelineProjectionError, IMPLEMENTED_SEMANTIC_OP_KINDS, LANE_KINDS_IN_STACK_ORDER, LORO_ENTITY_SCHEMA, LoroEntityDocument, LoroEntityDraft, ManualSyncDoc, MedeoHttpDocStorage, MemoryDocStorage, MengineAckFailedError, MengineDocSession, MengineHttpClient, MengineHttpRequestError, MenginePushRejectedError, MirrorVideoDocumentAdapter, PlainMemoryAdapter, SchemaValidator, ScriptCompositionError, SemanticEditor, TIMELINE_SKELETON_DURATION_MS, ValidationError, VideoDocumentValidationError, applyEntityRows, applyFieldChanges, arrangeMainTrackSeamlessly, assembleCaptionContent, assembleEntityContent, assemblePhoneticScriptContent, assembleScriptText, assertCanonicalEditorResources, assertEntityProjectionPreservesLegacy, assertFieldChanges, assertMediaAssetWritePolicy, assertValidVideoDocument, audioScriptAssetContent, audioScriptAssetFields, audioScriptAssetHash, audioScriptAssetOf, base64ToBytes, buildInitialVideoDocument, buildSpeechHostMap, bytesToBase64, cascadeAfterVideoClipChanges, compileCaptionAssetsEffect, compileEntityRows, compileGeneratedVisualEffect, compileSpeechAssetsEffect, createEditSandbox, createMirrorVideoDocument, createMirrorVideoDocumentAdapter, createPlainMemoryAdapter, decodeDocVersionMark, derivePositionFromAbs, effectiveVideoClipDurationMs, encodeDocVersionMark, ensureEditorFoundation, ensureLaneTrack, fillMainTrackTimeGaps, findComposedAudioScript, findLaneTrack, fromVideoDocument, generatePartId, getAt, hostForAbsMs, importCaptionAsset, importMediaAsset, isEmptyVideoClip, isImplementedSemanticOpKind, isMap, laneTrackId, mainTrackRanges, migrateLegacyTimelineToEntities, partDurationMs, partUnionSchema, phoneticScriptAssetContent, phoneticScriptAssetHash, phoneticScriptAssetOf, prepareCaptionAssetsEffect, prepareCaptionContent, prepareContinueVideoEffect, prepareGeneratedVisualEffect, prepareSpeechAssetsEffect, projectEntityTimeline, readDocumentAudioScript, readEntityDocument, readMainTrackItems, readMengineEventStream, readPart, readPartDurationMs, readVideoDocumentFromDraft, reassignSpeechesToVideoClipsByTime, recalculateTimelineDuration, relativePositionForAbs, replayJournal, resolveAllSpeechOverlaps, resolveEntityTimelineLayout, resolveFieldPath, resolveSpeechOverlapByShiftingVideos, safeDurationMs, schemas_exports as schemas, scriptSourceAssetOf, selectAudioScriptSegment, snapshotToPlain, solveVideoDocument, speedOf, syncAggregatedClipsTimePosition, toVideoDocument, validateVideoDocument, videoDocumentMirrorSchema, videoDocumentSchema };
|
package/dist/testing.d.ts
CHANGED
package/dist/testing.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Dt as bytesToBase64, Et as base64ToBytes, o as createMirrorVideoDocumentAdapter } from "./document-ecRldQY4.js";
|
|
2
2
|
import { t as classifyUpdate } from "./loro-relay-doc-cJSY-uau.js";
|
|
3
3
|
import { LoroDoc, VersionVector, encodeFrontiers } from "loro-crdt";
|
|
4
4
|
//#region src/testing/in-memory-mengine-server.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mengine/medeo-client",
|
|
3
|
-
"version": "2.0.1-alpha.
|
|
3
|
+
"version": "2.0.1-alpha.16",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"immer": "^10.2.0",
|
|
29
29
|
"loro-mirror": "^2.3.3",
|
|
30
30
|
"zod": "^4.4.3",
|
|
31
|
-
"@mengine/sync": "2.0.1-alpha.
|
|
32
|
-
"@mengine/utils": "2.0.1-alpha.
|
|
33
|
-
"@mengine/storage": "2.0.1-alpha.
|
|
31
|
+
"@mengine/sync": "2.0.1-alpha.16",
|
|
32
|
+
"@mengine/utils": "2.0.1-alpha.16",
|
|
33
|
+
"@mengine/storage": "2.0.1-alpha.16"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/node": "^25.9.1",
|