@mengine/medeo-client 2.0.1-alpha.21 → 2.0.1-alpha.22
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-BXQcpnOg.js → document-BB8U25jt.js} +10 -60
- package/dist/{index-CzDNr1Tb.d.ts → index-C0uUWqkz.d.ts} +3 -21
- package/dist/index.d.ts +165 -411
- package/dist/index.js +55 -1598
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +1 -1
- package/package.json +4 -4
|
@@ -1177,8 +1177,7 @@ function toAuthoritativePartLibrary(partLibrary) {
|
|
|
1177
1177
|
if (typeof part !== "object" || part == null) continue;
|
|
1178
1178
|
if (part.video_clip != null) out[partId] = { video_clip: withTrimWindowFromDuration(part.video_clip) };
|
|
1179
1179
|
else if (part.speech != null) {
|
|
1180
|
-
const {
|
|
1181
|
-
const { duration_ms, rest } = splitDurationMs(readSpeech);
|
|
1180
|
+
const { duration_ms, rest } = splitDurationMs(part.speech);
|
|
1182
1181
|
out[partId] = { speech: {
|
|
1183
1182
|
...rest,
|
|
1184
1183
|
media_duration_ms: rest.media_duration_ms ?? duration_ms
|
|
@@ -3036,7 +3035,8 @@ function resolveGraphLayout(graph) {
|
|
|
3036
3035
|
if (clip.entityKind !== "clip" || graph.adjacent(clip.entityId, "track-clip").length !== 1) fail(`Clip ${clip.entityId} must belong to exactly one Track`);
|
|
3037
3036
|
const marker = graph.one(clip.entityId, "clip-marker", "sequence-marker");
|
|
3038
3037
|
const content = graph.one(marker.entityId, "marker-content");
|
|
3039
|
-
|
|
3038
|
+
const expected = typedRole === "video_clip" ? ["image", "video"] : typedRole === "speech" ? ["voiceover"] : typedRole === "caption" ? ["caption"] : ["audio"];
|
|
3039
|
+
if (!expected.includes(content.entityKind)) fail(`${typedRole} Track accepts ${expected.join(" or ")}, got ${content.entityKind}`);
|
|
3040
3040
|
const source = range(marker.payload.sourceRange, "sourceRange");
|
|
3041
3041
|
const durationFact = marker.payload.duration;
|
|
3042
3042
|
if (!object(durationFact)) fail(`Marker ${marker.entityId} requires duration`);
|
|
@@ -3155,32 +3155,6 @@ function resolveGraphLayout(graph) {
|
|
|
3155
3155
|
}))
|
|
3156
3156
|
};
|
|
3157
3157
|
}
|
|
3158
|
-
function assertTrackContent(graph, role, content) {
|
|
3159
|
-
if (role === "speech") {
|
|
3160
|
-
assertSpeechContent(graph, content);
|
|
3161
|
-
return;
|
|
3162
|
-
}
|
|
3163
|
-
if (!(role === "video_clip" ? ["image", "video"] : role === "caption" ? ["caption"] : ["audio"]).includes(content.entityKind)) fail(`unsupported compatibility content kind ${content.entityKind} on ${role} Track`);
|
|
3164
|
-
}
|
|
3165
|
-
function assertSpeechContent(graph, content) {
|
|
3166
|
-
const assetLinks = graph.rows.relations.filter((relation) => relation.relationKind === "from-asset" && (relation.endpoint0EntityId === content.entityId || relation.endpoint1EntityId === content.entityId));
|
|
3167
|
-
if (assetLinks.length !== 1 || assetLinks[0].endpoint0EntityId !== content.entityId) fail("Speech content requires one ordered from-asset binding");
|
|
3168
|
-
const asset = graph.entity(assetLinks[0].endpoint1EntityId, "asset");
|
|
3169
|
-
if (content.entityKind === "voiceover") {
|
|
3170
|
-
const renders = graph.rows.relations.filter((relation) => relation.relationKind === "phonetic-script-render" && (relation.endpoint0EntityId === content.entityId || relation.endpoint1EntityId === content.entityId));
|
|
3171
|
-
if (renders.length !== 1 || renders[0].endpoint0EntityId !== content.entityId || graph.entity(renders[0].endpoint1EntityId).entityKind !== "phonetic-script") fail("Synthesized Speech Voiceover requires one ordered PhoneticScript render");
|
|
3172
|
-
if (asset.payload.system !== "memota-speech") fail("Synthesized Speech Voiceover requires an explicit memota-speech key");
|
|
3173
|
-
return;
|
|
3174
|
-
}
|
|
3175
|
-
if (content.entityKind === "audio") {
|
|
3176
|
-
const sources = graph.rows.relations.filter((relation) => relation.relationKind === "audio-script-source" && (relation.endpoint0EntityId === content.entityId || relation.endpoint1EntityId === content.entityId));
|
|
3177
|
-
if (sources.length > 1) fail("Recorded speech has an ambiguous AudioScript source receipt");
|
|
3178
|
-
if (sources.length === 1 && (sources[0].endpoint1EntityId !== content.entityId || graph.entity(sources[0].endpoint0EntityId).entityKind !== "audio-script")) fail("Recorded Speech AudioScript source must use ordered endpoints");
|
|
3179
|
-
if (asset.payload.system !== "memota") fail("Recorded Speech Audio requires an explicit memota key");
|
|
3180
|
-
return;
|
|
3181
|
-
}
|
|
3182
|
-
fail(`unsupported compatibility content kind ${content.entityKind} on speech Track`);
|
|
3183
|
-
}
|
|
3184
3158
|
//#endregion
|
|
3185
3159
|
//#region src/document/entity-projection.ts
|
|
3186
3160
|
/**
|
|
@@ -3222,21 +3196,20 @@ function projectEntityTimeline(rows) {
|
|
|
3222
3196
|
} else if (track.role === "speech") {
|
|
3223
3197
|
const asset = mediaAssetFacts(graph, content);
|
|
3224
3198
|
requireUntrimmedAudio(content, marker, placement);
|
|
3199
|
+
const external = externalLocator(asset, "memota-speech");
|
|
3200
|
+
const renderEdges = graph.adjacent(content.entityId, "phonetic-script-render");
|
|
3225
3201
|
const timbreEdges = graph.adjacent(content.entityId, "voice-timbre");
|
|
3226
|
-
const
|
|
3227
|
-
const external = externalLocator(asset, isSynthesized ? "memota-speech" : "memota");
|
|
3228
|
-
const assembled = isSynthesized ? assemblePhoneticScriptContent(rows, graph.one(content.entityId, "phonetic-script-render", "phonetic-script").entityId) : void 0;
|
|
3202
|
+
const assembled = renderEdges.length > 0 || timbreEdges.length > 0 ? assemblePhoneticScriptContent(rows, graph.one(content.entityId, "phonetic-script-render", "phonetic-script").entityId) : void 0;
|
|
3229
3203
|
if (timbreEdges.length > 1) fail("A voiceover resolves at most one Voice identity");
|
|
3230
3204
|
const voice = timbreEdges.length === 0 ? void 0 : graph.one(content.entityId, "voice-timbre", "voice").payload.voice;
|
|
3231
3205
|
if (voice !== void 0 && (!object(voice) || voice.system !== "voice-library" || typeof voice.key !== "string")) fail("Voice must use an explicit voice-library locator");
|
|
3232
3206
|
const captionIds = layout.tracks.flatMap((candidate) => candidate.role === "caption" ? candidate.clips.filter((caption) => caption.anchorClipEntityId === clip.entityId).map((caption) => caption.clipEntityId) : []);
|
|
3233
|
-
|
|
3207
|
+
parts[clip.entityId] = { speech: {
|
|
3234
3208
|
id: clip.entityId,
|
|
3235
3209
|
kind: "speech",
|
|
3236
3210
|
media_duration_ms: placement.duration,
|
|
3237
3211
|
audio_storage_key: storageKey(asset),
|
|
3238
3212
|
origin_speech_id: external.key,
|
|
3239
|
-
origin_asset_system: external.system,
|
|
3240
3213
|
audio_script: assembled?.text ?? (graph.adjacent(content.entityId, "audio-script-source").length > 0 ? assembleScriptText(graph.one(content.entityId, "audio-script-source", "audio-script")) : ""),
|
|
3241
3214
|
volume: volume.data,
|
|
3242
3215
|
voice: object(voice) ? {
|
|
@@ -3244,8 +3217,7 @@ function projectEntityTimeline(rows) {
|
|
|
3244
3217
|
name: typeof voice.name === "string" ? voice.name : void 0
|
|
3245
3218
|
} : void 0,
|
|
3246
3219
|
caption_ids: captionIds
|
|
3247
|
-
};
|
|
3248
|
-
parts[clip.entityId] = { speech };
|
|
3220
|
+
} };
|
|
3249
3221
|
} else if (track.role === "caption") {
|
|
3250
3222
|
const assembled = assembleCaptionContent(rows, content.entityId);
|
|
3251
3223
|
const text = assembled.text;
|
|
@@ -3325,10 +3297,7 @@ function storageKey(asset) {
|
|
|
3325
3297
|
function externalLocator(asset, system) {
|
|
3326
3298
|
const { system: found, key } = asset.payload;
|
|
3327
3299
|
if (found !== system || typeof key !== "string" || key.trim() === "") fail("Asset " + asset.entityId + " requires an explicit " + system + " key");
|
|
3328
|
-
return {
|
|
3329
|
-
key,
|
|
3330
|
-
system
|
|
3331
|
-
};
|
|
3300
|
+
return { key };
|
|
3332
3301
|
}
|
|
3333
3302
|
function captionStyle(value) {
|
|
3334
3303
|
if (value === void 0) return void 0;
|
|
@@ -3972,25 +3941,6 @@ var LoroEntityDocument = class LoroEntityDocument {
|
|
|
3972
3941
|
if (id === void 0) return [];
|
|
3973
3942
|
return this.snapshot().rows.relations.filter((row) => row.endpoint0EntityId === id || row.endpoint1EntityId === id);
|
|
3974
3943
|
}
|
|
3975
|
-
/** Read unlinked Relation records for durable effect receipts; never part of the current semantic graph. */
|
|
3976
|
-
tombstonedRelations() {
|
|
3977
|
-
const result = [];
|
|
3978
|
-
for (const key of section(this.doc, "relations").keys().sort((a, b) => a < b ? -1 : a > b ? 1 : 0)) {
|
|
3979
|
-
const map = section(this.doc, "relations").get(key);
|
|
3980
|
-
if (!(map instanceof LoroMap) || map.get("deleted") !== true) continue;
|
|
3981
|
-
const identity = map.get("identity");
|
|
3982
|
-
if (!identity || identity.endpoints.length !== 2) throw new Error(`Invalid tombstoned Relation ${key}`);
|
|
3983
|
-
result.push({
|
|
3984
|
-
relationId: createRelationId(key),
|
|
3985
|
-
relationKind: identity.kind,
|
|
3986
|
-
endpoint0EntityId: createEntityId(identity.endpoints[0]),
|
|
3987
|
-
endpoint1EntityId: createEntityId(identity.endpoints[1]),
|
|
3988
|
-
metadata: requireMap(map, "metadata").toJSON(),
|
|
3989
|
-
trace: requireMap(map, "trace").toJSON()
|
|
3990
|
-
});
|
|
3991
|
-
}
|
|
3992
|
-
return result;
|
|
3993
|
-
}
|
|
3994
3944
|
/** Resolve a queued edit target through its native identity without changing history. */
|
|
3995
3945
|
resolveCurrentEntityId(id) {
|
|
3996
3946
|
return currentId(this.doc, id);
|
|
@@ -4778,4 +4728,4 @@ function createPlainMemoryAdapter(document, options) {
|
|
|
4778
4728
|
return new PlainMemoryAdapter(document, options);
|
|
4779
4729
|
}
|
|
4780
4730
|
//#endregion
|
|
4781
|
-
export {
|
|
4731
|
+
export { partUnionSchema as $, decodeEntityRelationRows as A, isJsonObject as B, applyFieldChanges as C, recordEntries as Ct, EntityProjectionGraph as D, projectEntityTimeline as E, bytesToBase64 as Et, assembleScriptText as F, buildInitialVideoDocument as G, createRelationId as H, findComposedAudioScript as I, fromVideoDocument as J, buildSpeechHostMap as K, selectAudioScriptSegment as L, assembleCaptionContent as M, assembleEntityContent as N, resolveEntityTimelineLayout as O, assemblePhoneticScriptContent as P, validateVideoDocument as Q, updateEntityFields as R, equalJson as S, partUnionToDraft as St, resolveFieldPath as T, base64ToBytes as Tt, hasSequence as U, createEntityId as V, isMediaAssetVariantKind as W, VideoDocumentValidationError as X, toVideoDocument as Y, assertValidVideoDocument as Z, audioScriptAssetOf as _, partDurationMs as _t, createMirrorVideoDocument as a, laneTrackId as at, phoneticScriptAssetOf as b, effectiveVideoClipDurationMs as bt, DocumentMutationGuard as c, arrangeMainTrackSeamlessly as ct, LoroEntityDraft as d, recalculateTimelineDuration as dt, videoDocumentSchema as et, readEntityDocument as f, resolveAllSpeechOverlaps as ft, audioScriptAssetHash as g, isEmptyVideoClip as gt, audioScriptAssetFields as h, TIMELINE_SKELETON_DURATION_MS as ht, MirrorVideoDocumentAdapter as i, hasResolvedPlacement as it, ScriptCompositionError as j, EntityTimelineProjectionError as k, LORO_ENTITY_SCHEMA as l, fillMainTrackTimeGaps as lt, audioScriptAssetContent as m, syncAggregatedClipsTimePosition as mt, createPlainMemoryAdapter as n, ensureLaneTrack as nt, createMirrorVideoDocumentAdapter as o, solveVideoDocument as ot, entityOrderGroups as p, resolveSpeechOverlapByShiftingVideos as pt, derivePositionFromAbs as q, generatePartId as r, findLaneTrack as rt, readVideoDocumentFromDraft as s, cascadeAfterVideoClipChanges as st, PlainMemoryAdapter as t, LANE_KINDS_IN_STACK_ORDER as tt, LoroEntityDocument as u, reassignSpeechesToVideoClipsByTime as ut, phoneticScriptAssetContent as v, safeDurationMs as vt, assertFieldChanges as w, videoDocumentMirrorSchema as wt, scriptSourceAssetOf as x, speedOf as xt, phoneticScriptAssetHash as y, DEFAULT_UNIT_TIME_MS as yt, variantBaseEntityIds as z };
|
|
@@ -473,8 +473,6 @@ type VideoClipPart = Omit<VideoClipPart$1, 'duration_ms'>;
|
|
|
473
473
|
type SpeechPart = Omit<SpeechPart$1, 'duration_ms'> & {
|
|
474
474
|
media_duration_ms?: number | undefined;
|
|
475
475
|
};
|
|
476
|
-
/** Asset namespace exposed only by the legacy read view; never an authoritative Speech fact. */
|
|
477
|
-
type SpeechOriginAssetSystem = 'memota' | 'memota-speech';
|
|
478
476
|
/**
|
|
479
477
|
* Authoritative caption part. The IDL `CaptionPart` carries `duration_ms` (the
|
|
480
478
|
* effective display length, a derived read-view value); the authoritative store
|
|
@@ -623,8 +621,7 @@ type VideoDraftPartUnion = {
|
|
|
623
621
|
} | {
|
|
624
622
|
video_clip?: never;
|
|
625
623
|
speech: SpeechPart & {
|
|
626
|
-
duration_ms?: number;
|
|
627
|
-
origin_asset_system?: SpeechOriginAssetSystem;
|
|
624
|
+
duration_ms?: number;
|
|
628
625
|
};
|
|
629
626
|
caption?: never;
|
|
630
627
|
bgm?: never;
|
|
@@ -672,7 +669,6 @@ type VideoDraftContentPartUnion = {
|
|
|
672
669
|
video_clip?: never;
|
|
673
670
|
speech: SpeechPart & {
|
|
674
671
|
duration_ms: number | undefined;
|
|
675
|
-
origin_asset_system?: SpeechOriginAssetSystem;
|
|
676
672
|
};
|
|
677
673
|
caption?: never;
|
|
678
674
|
bgm?: never;
|
|
@@ -1147,26 +1143,12 @@ declare class EntityTimelineProjectionError extends Error {
|
|
|
1147
1143
|
}
|
|
1148
1144
|
//#endregion
|
|
1149
1145
|
//#region src/document/entity-projection.d.ts
|
|
1150
|
-
type EntityTimelineProjectionPart = Exclude<PartUnion, {
|
|
1151
|
-
speech: SpeechPart;
|
|
1152
|
-
}> | {
|
|
1153
|
-
video_clip?: never;
|
|
1154
|
-
speech: SpeechPart & {
|
|
1155
|
-
origin_asset_system: SpeechOriginAssetSystem;
|
|
1156
|
-
};
|
|
1157
|
-
caption?: never;
|
|
1158
|
-
bgm?: never;
|
|
1159
|
-
};
|
|
1160
|
-
/** Ephemeral compatibility document; the origin discriminator is never stored in Loro. */
|
|
1161
|
-
type EntityTimelineProjectionDocument = Omit<VideoDocument, 'part_library'> & {
|
|
1162
|
-
part_library: Record<string, EntityTimelineProjectionPart>;
|
|
1163
|
-
};
|
|
1164
1146
|
/**
|
|
1165
1147
|
* One-way compatibility view over the Entity graph. A legacy part is never
|
|
1166
1148
|
* consulted as an editing fact. Peer IDs appear only in this derived read
|
|
1167
1149
|
* contract, reconstructed from relations; they are not stored in payloads.
|
|
1168
1150
|
*/
|
|
1169
|
-
declare function projectEntityTimeline(rows: EntityRelationRows):
|
|
1151
|
+
declare function projectEntityTimeline(rows: EntityRelationRows): VideoDocument;
|
|
1170
1152
|
//#endregion
|
|
1171
1153
|
//#region src/document/entity-timeline-layout.d.ts
|
|
1172
1154
|
type EntityTimelineTrackRole = 'video_clip' | 'speech' | 'caption' | 'bgm';
|
|
@@ -1888,4 +1870,4 @@ declare const videoDocumentSchema: z.ZodObject<{
|
|
|
1888
1870
|
}, z.core.$loose>]>>>;
|
|
1889
1871
|
}, z.core.$loose>;
|
|
1890
1872
|
//#endregion
|
|
1891
|
-
export {
|
|
1873
|
+
export { SpeechHostMap as $, assertValidVideoDocument as A, VideoDocumentValidationIssueCode as At, EntityRow as B, SpeedShift as Bt, isImplementedSemanticOpKind as C, Timeline as Ct, PartIdFactory as D, VideoClipPart as Dt, ValidationError as E, TrackItemTimePosition as Et, ResolvedEntityTrack as F, speedOf as Ft, SequenceDuration as G, CaptionSegmentSelection as H, Track$1 as Ht, resolveEntityTimelineLayout as I, Attachment as It, JsonObject as J, SequenceRange as K, projectEntityTimeline as L, CaptionPart$1 as Lt, EntityTimelineTrackRole as M, VideoDraftContent as Mt, ResolvedEntityClipPlacement as N, VideoDraftPartUnion as Nt, generatePartId as O, VideoDocument as Ot, ResolvedEntityTimelineLayout as P, effectiveVideoClipDurationMs as Pt, DerivedItemPosition as Q, EntityTimelineProjectionError as R, CaptionStyle as Rt, SemanticOpKind as S, SpeechPart as St, SnapshotReadable as T, TrackItem as Tt, CaptionStyleFields as U, TrackItem$1 as Ut, RelationRow as V, Timeline$1 as Vt, ScriptTextSegment as W, EntityId as X, JsonValue as Y, buildInitialVideoDocument as Z, SemanticOpName as _, CaptionDisplayCue as _t, PlainMemoryAdapter as a, LaneKind as at, ImplementedSemanticOpKind as b, PartKind as bt, MirrorVideoDocumentAdapter as c, findLaneTrack as ct, createMirrorVideoDocumentAdapter as d, TrackDraft as dt, buildSpeechHostMap as et, CommitOptions as f, TrackItemDraft as ft, SemanticOpInput as g, BgmPart as gt, SemanticEditor as h, videoDocumentMirrorSchema as ht, JournalEntry as i, LANE_KINDS_IN_STACK_ORDER as it, validateVideoDocument as j, VideoDraft as jt, VideoDocumentValidationError as k, VideoDocumentValidationIssue as kt, MirrorVideoDocumentOptions as l, laneTrackId as lt, SemanticDocumentAdapter as m, VideoDocumentMirrorSchema as mt, videoDocumentSchema as n, fromVideoDocument as nt, PlainMemoryAdapterOptions as o, SolvedVideoDocument as ot, OpActor as p, VideoDocumentDraft as pt, VoiceDescriptor as q, readVideoDocumentFromDraft as r, toVideoDocument as rt, createPlainMemoryAdapter as s, ensureLaneTrack as st, partUnionSchema as t, derivePositionFromAbs as tt, createMirrorVideoDocument as u, solveVideoDocument as ut, TransactAudit as v, CaptionPart as vt, SchemaValidator as w, Track as wt, PlannedSemanticOpKind as x, PartUnion as xt, IMPLEMENTED_SEMANTIC_OP_KINDS as y, DEFAULT_UNIT_TIME_MS as yt, EntityRelationRows as z, PartAggregation as zt };
|