@mengine/medeo-client 2.0.1-alpha.24 → 2.0.1-alpha.25
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/dist/{document-Ct11SMBS.js → document-Bx9xf40e.js} +172 -27
- package/dist/{index-CcIoMxs1.d.ts → index-BYv9FPSS.d.ts} +339 -74
- package/dist/index.d.ts +82 -16
- package/dist/index.js +280 -31
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +1 -1
- package/package.json +4 -4
|
@@ -2495,7 +2495,7 @@ const toAssetRelationSpec = Object.freeze({
|
|
|
2495
2495
|
validateEndpoints: (endpoints) => hasExactlyOneAsset(endpoints),
|
|
2496
2496
|
validateMetadata: isAssetBinding
|
|
2497
2497
|
});
|
|
2498
|
-
/** Media
|
|
2498
|
+
/** Media lineage, speech inputs, transcription sources, and immutable script revisions. */
|
|
2499
2499
|
const MEDIA_VARIANT_KINDS = [
|
|
2500
2500
|
"video",
|
|
2501
2501
|
"image",
|
|
@@ -2517,7 +2517,7 @@ const derivedFromRelationSpec = Object.freeze({
|
|
|
2517
2517
|
kind: "derived-from",
|
|
2518
2518
|
ordered: true,
|
|
2519
2519
|
sequenced: false,
|
|
2520
|
-
validateEndpoints: (endpoints) => hasKinds(endpoints, new Set(MEDIA_VARIANT_KINDS), new Set(MEDIA_VARIANT_KINDS)) || hasKinds(endpoints, new Set(["voiceover-recording"]), new Set(["phonetic-script"])) || hasKinds(endpoints, new Set(["audio-script"]), new Set(MEDIA_AUDIBLE_KINDS)),
|
|
2520
|
+
validateEndpoints: (endpoints) => hasKinds(endpoints, new Set(MEDIA_VARIANT_KINDS), new Set(MEDIA_VARIANT_KINDS)) || hasKinds(endpoints, new Set(["voiceover-recording"]), new Set(["phonetic-script"])) || hasKinds(endpoints, new Set(["audio-script"]), new Set(MEDIA_AUDIBLE_KINDS)) || hasKinds(endpoints, new Set(["audio-script"]), new Set(["audio-script"])),
|
|
2521
2521
|
validateMetadata: isEmptyMetadata
|
|
2522
2522
|
});
|
|
2523
2523
|
const captionAlignmentRelationSpec = Object.freeze({
|
|
@@ -2887,6 +2887,42 @@ function errorMessage(error) {
|
|
|
2887
2887
|
return error instanceof Error ? error.message : String(error);
|
|
2888
2888
|
}
|
|
2889
2889
|
//#endregion
|
|
2890
|
+
//#region ../medeo-dsl/src/relation-transition.ts
|
|
2891
|
+
var InvalidEntityRelationTransitionError = class extends Error {
|
|
2892
|
+
issues;
|
|
2893
|
+
constructor(issues) {
|
|
2894
|
+
super(`Invalid Medeo relation transition:\n- ${issues.join("\n- ")}`);
|
|
2895
|
+
this.issues = issues;
|
|
2896
|
+
this.name = "InvalidEntityRelationTransitionError";
|
|
2897
|
+
}
|
|
2898
|
+
};
|
|
2899
|
+
/** Enforce relation fact identity while admitting a complete candidate view. */
|
|
2900
|
+
function validateEntityRelationTransition(before, candidate) {
|
|
2901
|
+
const issues = [];
|
|
2902
|
+
const previous = new Map(before.relations.map((row) => [row.relationId, row]));
|
|
2903
|
+
for (const relation of candidate.relations) {
|
|
2904
|
+
const original = previous.get(relation.relationId);
|
|
2905
|
+
if (original == null) {
|
|
2906
|
+
if (relation.relationKind === "caption-alignment") issues.push(`new caption-alignment relation "${relation.relationId}" is forbidden`);
|
|
2907
|
+
continue;
|
|
2908
|
+
}
|
|
2909
|
+
if (original.relationKind !== relation.relationKind || original.endpoint0EntityId !== relation.endpoint0EntityId || original.endpoint1EntityId !== relation.endpoint1EntityId) {
|
|
2910
|
+
issues.push(`relation "${relation.relationId}" changed its kind or ordered endpoints`);
|
|
2911
|
+
continue;
|
|
2912
|
+
}
|
|
2913
|
+
if (!sameJson(original.metadata, relation.metadata)) issues.push(`relation "${relation.relationId}" changed semantic metadata without a new identity`);
|
|
2914
|
+
if (relation.relationKind === "caption-alignment" && !sameJson(original.trace, relation.trace)) issues.push(`legacy caption-alignment relation "${relation.relationId}" may only be carried unchanged or deleted`);
|
|
2915
|
+
}
|
|
2916
|
+
if (issues.length > 0) throw new InvalidEntityRelationTransitionError(issues);
|
|
2917
|
+
}
|
|
2918
|
+
function sameJson(left, right) {
|
|
2919
|
+
if (left === right) return true;
|
|
2920
|
+
if (Array.isArray(left) && Array.isArray(right)) return left.length === right.length && left.every((value, index) => sameJson(value, right[index]));
|
|
2921
|
+
if (!isJsonObject(left) || !isJsonObject(right)) return false;
|
|
2922
|
+
const leftKeys = Object.keys(left);
|
|
2923
|
+
return leftKeys.length === Object.keys(right).length && leftKeys.every((key) => Object.hasOwn(right, key) && sameJson(left[key], right[key]));
|
|
2924
|
+
}
|
|
2925
|
+
//#endregion
|
|
2890
2926
|
//#region src/document/entity-projection-values.ts
|
|
2891
2927
|
/** A graph cannot be represented faithfully by the compatibility reader. */
|
|
2892
2928
|
var EntityTimelineProjectionError = class extends Error {
|
|
@@ -2992,7 +3028,7 @@ function resolveGraphLayout(graph) {
|
|
|
2992
3028
|
const held = graph.holds(clip.entityId);
|
|
2993
3029
|
if (held.length !== 1) fail(`Clip ${clip.entityId} must contain exactly one content entity`);
|
|
2994
3030
|
const content = held[0];
|
|
2995
|
-
const expected = typedRole === "video_clip" ? ["image", "video"] : typedRole === "speech" ? ["voiceover-recording"] : typedRole === "caption" ? ["caption"] : ["audio"];
|
|
3031
|
+
const expected = typedRole === "video_clip" ? ["image", "video"] : typedRole === "speech" ? ["voiceover-recording", "audio"] : typedRole === "caption" ? ["caption"] : ["audio"];
|
|
2996
3032
|
if (!expected.includes(content.entityKind)) fail(`${typedRole} Track accepts ${expected.join(" or ")}, got ${content.entityKind}`);
|
|
2997
3033
|
const inMs = milliseconds(marker.payload.inMs, "inMs");
|
|
2998
3034
|
const outMs = milliseconds(marker.payload.outMs, "outMs");
|
|
@@ -3142,10 +3178,11 @@ function projectEntityTimeline(rows) {
|
|
|
3142
3178
|
} else if (track.role === "speech") {
|
|
3143
3179
|
const asset = mediaAssetFacts(graph, content);
|
|
3144
3180
|
requireUntrimmedAudio(content, marker, placement);
|
|
3145
|
-
const
|
|
3146
|
-
const
|
|
3181
|
+
const synthesized = content.entityKind === "voiceover-recording";
|
|
3182
|
+
const external = externalLocator(asset, synthesized ? "memota-speech" : "memota");
|
|
3147
3183
|
const timbreEdges = graph.adjacent(content.entityId, "voice-timbre");
|
|
3148
|
-
const assembled =
|
|
3184
|
+
const assembled = synthesized ? assemblePhoneticScriptContent(rows, synthesizedPhoneticScript(graph, content).entityId) : void 0;
|
|
3185
|
+
const transcript = synthesized ? void 0 : transcribedAudioScript(graph, content);
|
|
3149
3186
|
if (timbreEdges.length > 1) fail("A voiceover resolves at most one Voice identity");
|
|
3150
3187
|
const voice = timbreEdges.length === 0 ? void 0 : graph.one(content.entityId, "voice-timbre", "voice").payload.voice;
|
|
3151
3188
|
if (voice !== void 0 && (!object(voice) || voice.system !== "voice-library" || typeof voice.key !== "string")) fail("Voice must use an explicit voice-library locator");
|
|
@@ -3156,7 +3193,7 @@ function projectEntityTimeline(rows) {
|
|
|
3156
3193
|
media_duration_ms: placement.duration,
|
|
3157
3194
|
audio_storage_key: storageKey(asset),
|
|
3158
3195
|
origin_speech_id: external.key,
|
|
3159
|
-
audio_script: assembled?.text ?? (
|
|
3196
|
+
audio_script: assembled?.text ?? (transcript === void 0 ? "" : assembleScriptText(transcript)),
|
|
3160
3197
|
volume: volume.data,
|
|
3161
3198
|
voice: object(voice) ? {
|
|
3162
3199
|
id: typeof voice.key === "string" ? voice.key : void 0,
|
|
@@ -3275,7 +3312,17 @@ function captionStyle(value) {
|
|
|
3275
3312
|
}
|
|
3276
3313
|
function requireUntrimmedAudio(content, marker, placement) {
|
|
3277
3314
|
const source = markerWindow(marker);
|
|
3278
|
-
if (source.start !== 0 || content.payload.durationMs !== source.end || placement.duration !== source.end || marker.payload.rate !== void 0) fail("
|
|
3315
|
+
if (source.start !== 0 || content.payload.durationMs !== source.end || placement.duration !== source.end || marker.payload.rate !== void 0) fail("Speech compatibility requires the complete, unremapped take");
|
|
3316
|
+
}
|
|
3317
|
+
function synthesizedPhoneticScript(graph, content) {
|
|
3318
|
+
const scripts = graph.rows.relations.filter((row) => row.relationKind === "derived-from" && row.endpoint0EntityId === content.entityId).map((row) => graph.entity(row.endpoint1EntityId)).filter((row) => row.entityKind === "phonetic-script");
|
|
3319
|
+
if (scripts.length !== 1) fail("Synthesized Speech requires exactly one ordered PhoneticScript input");
|
|
3320
|
+
return scripts[0];
|
|
3321
|
+
}
|
|
3322
|
+
function transcribedAudioScript(graph, content) {
|
|
3323
|
+
const scripts = graph.rows.relations.filter((row) => row.relationKind === "derived-from" && row.endpoint1EntityId === content.entityId).map((row) => graph.entity(row.endpoint0EntityId)).filter((row) => row.entityKind === "audio-script");
|
|
3324
|
+
if (scripts.length > 1) fail("Recorded Speech has ambiguous AudioScript transcripts");
|
|
3325
|
+
return scripts[0];
|
|
3279
3326
|
}
|
|
3280
3327
|
/** The Marker's window, in the {start,end} shape this compatibility reader speaks. */
|
|
3281
3328
|
function markerWindow(marker) {
|
|
@@ -3684,6 +3731,19 @@ function writeEntityOrder(doc, group, roots, token) {
|
|
|
3684
3731
|
//#region src/entity-crdt/entity-document.ts
|
|
3685
3732
|
const LORO_ENTITY_SCHEMA = "medeo.entities.loro.v1";
|
|
3686
3733
|
const MATERIALIZE_ORIGIN = "medeo.materialize";
|
|
3734
|
+
/** Read persisted relation roots before current entity versions are projected. */
|
|
3735
|
+
function readEntityRelationRecords(doc) {
|
|
3736
|
+
if (root(doc).get("schema") !== "medeo.entities.loro.v1") throw new Error("Document has no Loro entity state");
|
|
3737
|
+
return relationRecords(doc).map(({ rootId, identity, map, deleted }) => ({
|
|
3738
|
+
relationId: createRelationId(rootId),
|
|
3739
|
+
relationKind: identity.kind,
|
|
3740
|
+
endpoint0EntityId: createEntityId(identity.endpoints[0]),
|
|
3741
|
+
endpoint1EntityId: createEntityId(identity.endpoints[1]),
|
|
3742
|
+
metadata: requireMap(map, "metadata").toJSON(),
|
|
3743
|
+
trace: requireMap(map, "trace").toJSON(),
|
|
3744
|
+
deleted
|
|
3745
|
+
}));
|
|
3746
|
+
}
|
|
3687
3747
|
function hash(value) {
|
|
3688
3748
|
return bytesToHex(sha256(new TextEncoder().encode(canonicalJson(value))));
|
|
3689
3749
|
}
|
|
@@ -3770,35 +3830,31 @@ function readEntityDocument(doc, allowSelectionConflicts = false) {
|
|
|
3770
3830
|
}
|
|
3771
3831
|
};
|
|
3772
3832
|
});
|
|
3773
|
-
const relations =
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
if (original.endpoints.some((id) => !ids.has(family(doc, id)))) continue;
|
|
3779
|
-
const endpoints = original.endpoints.map((id) => currentId(doc, id, ids));
|
|
3780
|
-
const relationId = equalJson(endpoints, original.endpoints) ? key : `relation_${hash([key, endpoints])}`;
|
|
3781
|
-
relations.push({
|
|
3782
|
-
relationId: createRelationId(relationId),
|
|
3783
|
-
relationKind: original.kind,
|
|
3833
|
+
const relations = activeRelationRecords(doc, ids).map(({ rootId, identity, map }) => {
|
|
3834
|
+
const endpoints = identity.endpoints.map((id) => currentId(doc, id, ids));
|
|
3835
|
+
return {
|
|
3836
|
+
relationId: createRelationId(equalJson(endpoints, identity.endpoints) ? rootId : `relation_${hash([rootId, endpoints])}`),
|
|
3837
|
+
relationKind: identity.kind,
|
|
3784
3838
|
endpoint0EntityId: createEntityId(endpoints[0]),
|
|
3785
3839
|
endpoint1EntityId: createEntityId(endpoints[1]),
|
|
3786
3840
|
metadata: requireMap(map, "metadata").toJSON(),
|
|
3787
3841
|
trace: requireMap(map, "trace").toJSON()
|
|
3788
|
-
}
|
|
3789
|
-
}
|
|
3842
|
+
};
|
|
3843
|
+
});
|
|
3790
3844
|
sortSequencedRelations(doc, relations);
|
|
3791
3845
|
const project = {};
|
|
3792
3846
|
for (const [key, value] of Object.entries(section(doc, "attachments").toJSON())) {
|
|
3793
3847
|
if (typeof value !== "string") throw new Error(`Invalid project attachment ${key}`);
|
|
3794
3848
|
project[key] = currentId(doc, value, ids);
|
|
3795
3849
|
}
|
|
3850
|
+
const phoneticScriptSelections = readPhoneticScriptSelections(doc, ids);
|
|
3796
3851
|
const state = {
|
|
3797
3852
|
rows: {
|
|
3798
3853
|
entities,
|
|
3799
3854
|
relations
|
|
3800
3855
|
},
|
|
3801
|
-
project
|
|
3856
|
+
project,
|
|
3857
|
+
...phoneticScriptSelections === void 0 ? {} : { phoneticScriptSelections }
|
|
3802
3858
|
};
|
|
3803
3859
|
if (!allowSelectionConflicts) for (const [key, id] of ids) {
|
|
3804
3860
|
const fingerprint = selectionFingerprint(state.rows, id);
|
|
@@ -3806,6 +3862,54 @@ function readEntityDocument(doc, allowSelectionConflicts = false) {
|
|
|
3806
3862
|
}
|
|
3807
3863
|
return state;
|
|
3808
3864
|
}
|
|
3865
|
+
function readPhoneticScriptSelections(doc, ids) {
|
|
3866
|
+
const native = root(doc).get("phoneticScriptSelections");
|
|
3867
|
+
if (native === void 0) return void 0;
|
|
3868
|
+
if (!(native instanceof LoroMap)) throw new Error("Invalid phonetic-script selector");
|
|
3869
|
+
const selections = {};
|
|
3870
|
+
for (const clipRoot of native.keys().sort((a, b) => a < b ? -1 : a > b ? 1 : 0)) {
|
|
3871
|
+
const phoneticScriptRoot = native.get(clipRoot);
|
|
3872
|
+
if (typeof phoneticScriptRoot !== "string") throw new Error("Invalid phonetic-script selection");
|
|
3873
|
+
const clipId = ids.get(clipRoot);
|
|
3874
|
+
const phoneticScriptId = ids.get(phoneticScriptRoot);
|
|
3875
|
+
if (clipId === void 0 || phoneticScriptId === void 0) continue;
|
|
3876
|
+
if (workspace(doc, clipRoot).get("kind") !== "clip") throw new Error("Phonetic-script selection target must be a Clip");
|
|
3877
|
+
if (workspace(doc, phoneticScriptRoot).get("kind") !== "phonetic-script") throw new Error("Phonetic-script selection value must be a PhoneticScript");
|
|
3878
|
+
selections[clipRoot] = phoneticScriptId;
|
|
3879
|
+
}
|
|
3880
|
+
return Object.keys(selections).length === 0 ? void 0 : selections;
|
|
3881
|
+
}
|
|
3882
|
+
function relationRecords(doc) {
|
|
3883
|
+
const records = [];
|
|
3884
|
+
for (const rootId of section(doc, "relations").keys().sort((a, b) => a < b ? -1 : a > b ? 1 : 0)) {
|
|
3885
|
+
const map = section(doc, "relations").get(rootId);
|
|
3886
|
+
if (!(map instanceof LoroMap)) throw new Error(`Invalid relation record ${rootId}`);
|
|
3887
|
+
const value = map.get("identity");
|
|
3888
|
+
if (!isJsonObject(value) || typeof value.kind !== "string" || !Array.isArray(value.endpoints) || value.endpoints.length !== 2 || !value.endpoints.every((endpoint) => typeof endpoint === "string")) throw new Error(`Invalid relation identity ${rootId}`);
|
|
3889
|
+
records.push({
|
|
3890
|
+
rootId,
|
|
3891
|
+
identity: {
|
|
3892
|
+
kind: value.kind,
|
|
3893
|
+
endpoints: [value.endpoints[0], value.endpoints[1]]
|
|
3894
|
+
},
|
|
3895
|
+
map,
|
|
3896
|
+
deleted: map.get("deleted") === true
|
|
3897
|
+
});
|
|
3898
|
+
}
|
|
3899
|
+
return records;
|
|
3900
|
+
}
|
|
3901
|
+
function activeRelationRecords(doc, ids) {
|
|
3902
|
+
const selector = root(doc).get("clipContentSelections");
|
|
3903
|
+
if (selector !== void 0 && !(selector instanceof LoroMap)) throw new Error("Invalid clip-content selector");
|
|
3904
|
+
return relationRecords(doc).filter(({ rootId, identity, deleted }) => {
|
|
3905
|
+
if (deleted) return false;
|
|
3906
|
+
if (!identity.endpoints.every((id) => ids.has(family(doc, id)))) return false;
|
|
3907
|
+
if (identity.kind !== "contain" || selector === void 0 || workspace(doc, family(doc, identity.endpoints[0])).get("kind") !== "clip") return true;
|
|
3908
|
+
const selected = selector.get(family(doc, identity.endpoints[0]));
|
|
3909
|
+
if (selected !== void 0 && typeof selected !== "string") throw new Error("Invalid clip-content selection");
|
|
3910
|
+
return selected === void 0 || selected === rootId;
|
|
3911
|
+
});
|
|
3912
|
+
}
|
|
3809
3913
|
/** Native editing containers survive domain version changes and merge independently. */
|
|
3810
3914
|
var LoroEntityDocument = class LoroEntityDocument {
|
|
3811
3915
|
doc;
|
|
@@ -3837,7 +3941,9 @@ var LoroEntityDocument = class LoroEntityDocument {
|
|
|
3837
3941
|
"relations",
|
|
3838
3942
|
"project",
|
|
3839
3943
|
"attachments",
|
|
3840
|
-
"ordering"
|
|
3944
|
+
"ordering",
|
|
3945
|
+
"clipContentSelections",
|
|
3946
|
+
"phoneticScriptSelections"
|
|
3841
3947
|
]) root(doc).ensureMergeableMap(name);
|
|
3842
3948
|
for (const row of rows.entities) apply(doc, {
|
|
3843
3949
|
type: "create",
|
|
@@ -4041,11 +4147,14 @@ var LoroEntityDraft = class {
|
|
|
4041
4147
|
row: clone(row)
|
|
4042
4148
|
});
|
|
4043
4149
|
}
|
|
4044
|
-
|
|
4150
|
+
patchRelationTrace(relationId, trace) {
|
|
4151
|
+
const relation = this.snapshot().rows.relations.find((row) => row.relationId === relationId);
|
|
4152
|
+
if (relation == null) throw new Error(`Unknown relation ${relationId}`);
|
|
4153
|
+
if (relation.relationKind === "caption-alignment") throw new Error("caption-alignment Relations are read-only legacy facts");
|
|
4045
4154
|
this.record({
|
|
4046
4155
|
type: "relation-fields",
|
|
4047
4156
|
root: this.relationRoot(relationId),
|
|
4048
|
-
metadata: clone(metadata),
|
|
4157
|
+
metadata: clone(relation.metadata),
|
|
4049
4158
|
trace: clone(trace)
|
|
4050
4159
|
});
|
|
4051
4160
|
}
|
|
@@ -4055,6 +4164,35 @@ var LoroEntityDraft = class {
|
|
|
4055
4164
|
root: this.relationRoot(relationId)
|
|
4056
4165
|
});
|
|
4057
4166
|
}
|
|
4167
|
+
/** Select the one content membership projected for this stable Clip identity. */
|
|
4168
|
+
selectClipContent(relationId) {
|
|
4169
|
+
const relationRoot = this.relationRoot(relationId);
|
|
4170
|
+
const map = section(this.doc, "relations").get(relationRoot);
|
|
4171
|
+
if (!(map instanceof LoroMap)) throw new Error(`Unknown relation ${relationId}`);
|
|
4172
|
+
const identity = map.get("identity");
|
|
4173
|
+
if (!isJsonObject(identity) || identity.kind !== "contain" || !Array.isArray(identity.endpoints) || typeof identity.endpoints[0] !== "string") throw new Error("Clip-content selection requires a contain relation");
|
|
4174
|
+
const clipRoot = family(this.doc, identity.endpoints[0]);
|
|
4175
|
+
if (workspace(this.doc, clipRoot).get("kind") !== "clip") throw new Error("Clip-content selection requires a Clip container");
|
|
4176
|
+
this.record({
|
|
4177
|
+
type: "select-clip-content",
|
|
4178
|
+
clipRoot,
|
|
4179
|
+
relationRoot
|
|
4180
|
+
});
|
|
4181
|
+
}
|
|
4182
|
+
/** Select the pending immutable pronunciation variant for one stable Speech Clip. */
|
|
4183
|
+
selectPhoneticScript(clipEntityId, phoneticScriptEntityId) {
|
|
4184
|
+
const clipRoot = family(this.doc, clipEntityId);
|
|
4185
|
+
const phoneticScriptRoot = family(this.doc, phoneticScriptEntityId);
|
|
4186
|
+
const clip = workspace(this.doc, clipRoot);
|
|
4187
|
+
const phoneticScript = workspace(this.doc, phoneticScriptRoot);
|
|
4188
|
+
if (clip.get("deleted") === true || clip.get("kind") !== "clip") throw new Error("Phonetic-script selection target must be an active Clip");
|
|
4189
|
+
if (phoneticScript.get("deleted") === true || phoneticScript.get("kind") !== "phonetic-script") throw new Error("Phonetic-script selection value must be an active PhoneticScript");
|
|
4190
|
+
this.record({
|
|
4191
|
+
type: "select-phonetic-script",
|
|
4192
|
+
clipRoot,
|
|
4193
|
+
phoneticScriptRoot
|
|
4194
|
+
});
|
|
4195
|
+
}
|
|
4058
4196
|
relationRoot(relationId) {
|
|
4059
4197
|
const alias = this.relationAliases.get(relationId);
|
|
4060
4198
|
if (alias !== void 0) return alias;
|
|
@@ -4141,8 +4279,9 @@ var LoroEntityDraft = class {
|
|
|
4141
4279
|
const key = this.relationRoot(relationId);
|
|
4142
4280
|
const map = section(this.doc, "relations").get(key);
|
|
4143
4281
|
if (!(map instanceof LoroMap) || map.get("deleted") === true) throw new Error("Unknown relation");
|
|
4282
|
+
if (map.get("identity").kind === "caption-alignment") throw new Error("caption-alignment Relations are read-only legacy facts");
|
|
4144
4283
|
for (const change of changes) {
|
|
4145
|
-
if (
|
|
4284
|
+
if (change.path[0] !== "trace" || change.path.length < 2) throw new Error("Relation changes may only edit trace fields");
|
|
4146
4285
|
const payload = {
|
|
4147
4286
|
metadata: requireMap(map, "metadata").toJSON(),
|
|
4148
4287
|
trace: requireMap(map, "trace").toJSON()
|
|
@@ -4261,6 +4400,12 @@ function apply(doc, command) {
|
|
|
4261
4400
|
map.set("deleted", true);
|
|
4262
4401
|
break;
|
|
4263
4402
|
}
|
|
4403
|
+
case "select-clip-content":
|
|
4404
|
+
root(doc).ensureMergeableMap("clipContentSelections").set(command.clipRoot, command.relationRoot);
|
|
4405
|
+
break;
|
|
4406
|
+
case "select-phonetic-script":
|
|
4407
|
+
root(doc).ensureMergeableMap("phoneticScriptSelections").set(command.clipRoot, command.phoneticScriptRoot);
|
|
4408
|
+
break;
|
|
4264
4409
|
case "relation-fields": {
|
|
4265
4410
|
const map = section(doc, "relations").get(command.root);
|
|
4266
4411
|
if (!(map instanceof LoroMap)) throw new Error("Unknown relation");
|
|
@@ -4682,4 +4827,4 @@ function createPlainMemoryAdapter(document, options) {
|
|
|
4682
4827
|
return new PlainMemoryAdapter(document, options);
|
|
4683
4828
|
}
|
|
4684
4829
|
//#endregion
|
|
4685
|
-
export {
|
|
4830
|
+
export { fromVideoDocument as $, resolveEntityTimelineLayout as A, base64ToBytes as At, assembleScriptText as B, canonicalJson as C, safeDurationMs as Ct, resolveFieldPath as D, partUnionToDraft as Dt, assertFieldChanges as E, speedOf as Et, relationsTo as F, isJsonObject as G, selectAudioScriptSegment as H, ScriptCompositionError as I, hasSequence as J, createEntityId as K, assembleCaptionContent as L, validateEntityRelationTransition as M, decodeEntityRelationRows as N, projectEntityTimeline as O, recordEntries as Ot, relationsFrom as P, derivePositionFromAbs as Q, assembleEntityContent as R, scriptSourceAssetOf as S, partDurationMs as St, applyFieldChanges as T, effectiveVideoClipDurationMs as Tt, updateEntityFields as U, findComposedAudioScript as V, variantBaseEntityIds as W, buildInitialVideoDocument as X, isMediaAssetVariantKind as Y, buildSpeechHostMap as Z, audioScriptAssetHash as _, resolveAllSpeechOverlaps as _t, createMirrorVideoDocument as a, videoDocumentSchema as at, phoneticScriptAssetHash as b, TIMELINE_SKELETON_DURATION_MS as bt, DocumentMutationGuard as c, findLaneTrack as ct, LoroEntityDraft as d, solveVideoDocument as dt, toVideoDocument as et, readEntityDocument as f, cascadeAfterVideoClipChanges as ft, audioScriptAssetFields as g, recalculateTimelineDuration as gt, audioScriptAssetContent as h, reassignSpeechesToVideoClipsByTime as ht, MirrorVideoDocumentAdapter as i, partUnionSchema as it, EntityTimelineProjectionError as j, bytesToBase64 as jt, EntityProjectionGraph as k, videoDocumentMirrorSchema as kt, LORO_ENTITY_SCHEMA as l, hasResolvedPlacement as lt, entityOrderGroups as m, fillMainTrackTimeGaps as mt, createPlainMemoryAdapter as n, assertValidVideoDocument as nt, createMirrorVideoDocumentAdapter as o, LANE_KINDS_IN_STACK_ORDER as ot, readEntityRelationRecords as p, arrangeMainTrackSeamlessly as pt, createRelationId as q, generatePartId as r, validateVideoDocument as rt, readVideoDocumentFromDraft as s, ensureLaneTrack as st, PlainMemoryAdapter as t, VideoDocumentValidationError as tt, LoroEntityDocument as u, laneTrackId as ut, audioScriptAssetOf as v, resolveSpeechOverlapByShiftingVideos as vt, equalJson as w, DEFAULT_UNIT_TIME_MS as wt, phoneticScriptAssetOf as x, isEmptyVideoClip as xt, phoneticScriptAssetContent as y, syncAggregatedClipsTimePosition as yt, assemblePhoneticScriptContent as z };
|