@mengine/medeo-client 2.1.1-dsl.4 → 2.1.1-dsl.5
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/{dsl-BCcld0Ca.js → dsl-DQ63zFgu.js} +257 -26
- package/dist/dsl.d.ts +3 -3
- package/dist/dsl.js +3 -3
- package/dist/{index-W1eHhVus.d.ts → index-Cx5DojM1.d.ts} +18 -5
- package/dist/{index-DP9FG0z_.d.ts → index-DHcMMn2M.d.ts} +103 -19
- package/dist/{index-CwG4lYKp.d.ts → index-Dpl4bT94.d.ts} +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +13 -7
- package/dist/legacy.d.ts +2 -2
- package/dist/legacy.js +1 -1
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +2 -2
- package/dist/{video-draft-types-BfkIuW5f.d.ts → video-draft-types-Bq15tPBP.d.ts} +19 -3
- package/dist/{video-draft-types-DvPeam87.js → video-draft-types-Ce8NDenQ.js} +42 -4
- package/package.json +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as assertId, A as hardenCidDescriptors, B as safeStringify, C as applySchemaToInferOptions, D as deepEqual, E as decodeNestedJsonValues, F as isObject, G as valuesEqual, H as stripUndefined, I as isObjectLike, J as getChildSchema, K as CID_KEY, L as isStateAndSchemaOfType, M as inferContainerTypeFromValue, N as insertChildToMap, O as defineCidProperty, P as isArrayLike, Q as assertEntityPatch, R as isTreeID, S as applyEncode, T as containerIdToContainerType, U as tryInferContainerType, V as schemaToContainerType, W as tryUpdateToContainer, X as assertCaptionContent, Y as getMapFieldSchema, Z as assertEntity, _ as isLoroTreeSchema, at as isRecord, b as validateSchema, c as isInvalidAtomic, ct as relationTables, d as getDefaultValue, dt as assertResourceIdentity, et as assertPhoneme, f as isContainerSchema, ft as defaultIdFactory, g as isLoroMovableListSchema, h as isLoroMapSchema, it as entityTables, j as hasTransform, k as getRootContainerByType, lt as validLanguage, m as isLoroListSchema, mt as resourceId, n as textStyles, nt as assertTimeAnchor, o as medeoDslLoroShape, ot as mergeFields, p as isListLikeSchema, pt as relationId, q as getChildContainerSchema, rt as atomicFields, s as captionContentCodec, st as patchRow, t as DEFAULT_UNIT_TIME_MS, tt as assertRelation, u as schema, ut as assertRelationIdentity, v as isRootSchemaType, w as cidsEqual, x as applyDecode, y as schemaContainsIgnoreField, z as isValueOfContainerType } from "./video-draft-types-
|
|
1
|
+
import { $ as assertId, A as hardenCidDescriptors, B as safeStringify, C as applySchemaToInferOptions, D as deepEqual, E as decodeNestedJsonValues, F as isObject, G as valuesEqual, H as stripUndefined, I as isObjectLike, J as getChildSchema, K as CID_KEY, L as isStateAndSchemaOfType, M as inferContainerTypeFromValue, N as insertChildToMap, O as defineCidProperty, P as isArrayLike, Q as assertEntityPatch, R as isTreeID, S as applyEncode, T as containerIdToContainerType, U as tryInferContainerType, V as schemaToContainerType, W as tryUpdateToContainer, X as assertCaptionContent, Y as getMapFieldSchema, Z as assertEntity, _ as isLoroTreeSchema, at as isRecord, b as validateSchema, c as isInvalidAtomic, ct as relationTables, d as getDefaultValue, dt as assertResourceIdentity, et as assertPhoneme, f as isContainerSchema, ft as defaultIdFactory, g as isLoroMovableListSchema, h as isLoroMapSchema, it as entityTables, j as hasTransform, k as getRootContainerByType, lt as validLanguage, m as isLoroListSchema, mt as resourceId, n as textStyles, nt as assertTimeAnchor, o as medeoDslLoroShape, ot as mergeFields, p as isListLikeSchema, pt as relationId, q as getChildContainerSchema, rt as atomicFields, s as captionContentCodec, st as patchRow, t as DEFAULT_UNIT_TIME_MS, tt as assertRelation, u as schema, ut as assertRelationIdentity, v as isRootSchemaType, w as cidsEqual, x as applyDecode, y as schemaContainsIgnoreField, z as isValueOfContainerType } from "./video-draft-types-Ce8NDenQ.js";
|
|
2
2
|
import { Cursor, LoroDoc, LoroList, LoroMap, LoroMovableList, LoroText, LoroTree, isContainer, isContainerId } from "loro-crdt";
|
|
3
3
|
import { Immer, setAutoFreeze } from "immer";
|
|
4
4
|
//#region ../medeo-dsl/src/text.ts
|
|
@@ -107,6 +107,42 @@ function prepareTextEdits(text, edits) {
|
|
|
107
107
|
body: text
|
|
108
108
|
};
|
|
109
109
|
}
|
|
110
|
+
/** An empty body has no segments; otherwise each line, including a trailing empty one, is a segment. */
|
|
111
|
+
function lines(body) {
|
|
112
|
+
if (body === "") return [];
|
|
113
|
+
const result = [];
|
|
114
|
+
let start = 0;
|
|
115
|
+
for (const text of body.split("\n")) {
|
|
116
|
+
result.push({
|
|
117
|
+
text,
|
|
118
|
+
start,
|
|
119
|
+
end: start + text.length
|
|
120
|
+
});
|
|
121
|
+
start += text.length + 1;
|
|
122
|
+
}
|
|
123
|
+
return result;
|
|
124
|
+
}
|
|
125
|
+
/** The language a whole line carries: one shared mark on every unit, else none. */
|
|
126
|
+
function lineLanguage(text, line) {
|
|
127
|
+
if (line.start === line.end) return void 0;
|
|
128
|
+
const first = text.langs[line.start];
|
|
129
|
+
for (let i = line.start + 1; i < line.end; i++) if (text.langs[i] !== first) return void 0;
|
|
130
|
+
return first;
|
|
131
|
+
}
|
|
132
|
+
/** Read language marks off a rich-text delta. */
|
|
133
|
+
function langsFromDelta(delta) {
|
|
134
|
+
let body = "";
|
|
135
|
+
const langs = [];
|
|
136
|
+
for (const run of delta) {
|
|
137
|
+
body += run.insert;
|
|
138
|
+
const language = typeof run.attributes?.language === "string" ? run.attributes.language : void 0;
|
|
139
|
+
for (let i = 0; i < run.insert.length; i++) langs.push(language);
|
|
140
|
+
}
|
|
141
|
+
return {
|
|
142
|
+
body,
|
|
143
|
+
langs
|
|
144
|
+
};
|
|
145
|
+
}
|
|
110
146
|
//#endregion
|
|
111
147
|
//#region ../medeo-dsl/src/relations.ts
|
|
112
148
|
/** The row an endpoint names; refused when it is missing. */
|
|
@@ -4261,7 +4297,7 @@ function applyMutations(tx, mutations) {
|
|
|
4261
4297
|
assertRelation(m.table, m.value);
|
|
4262
4298
|
const id = relationId(m.table, m.value);
|
|
4263
4299
|
rows[m.table][id] ??= {};
|
|
4264
|
-
applyPatch(rows[m.table][id], m.value);
|
|
4300
|
+
applyPatch(rows[m.table][id], withSourceDigest(rows, m.table, m.value));
|
|
4265
4301
|
break;
|
|
4266
4302
|
}
|
|
4267
4303
|
case "delete-relation":
|
|
@@ -4280,6 +4316,25 @@ function applyMutations(tx, mutations) {
|
|
|
4280
4316
|
}
|
|
4281
4317
|
}
|
|
4282
4318
|
}
|
|
4319
|
+
/**
|
|
4320
|
+
* A derived-from records its source's digest (D177): the one the writer names, otherwise the
|
|
4321
|
+
* source's digest as this transaction leaves it. A source with no digest records none.
|
|
4322
|
+
*/
|
|
4323
|
+
function withSourceDigest(rows, table, value) {
|
|
4324
|
+
if (table !== "derived-from-relations") return value;
|
|
4325
|
+
const relation = value;
|
|
4326
|
+
if (relation.sourceDigest !== void 0) return value;
|
|
4327
|
+
const sourceDigest = digestOf(rows, relation.sourceId);
|
|
4328
|
+
return sourceDigest === void 0 ? value : {
|
|
4329
|
+
...relation,
|
|
4330
|
+
sourceDigest
|
|
4331
|
+
};
|
|
4332
|
+
}
|
|
4333
|
+
/** A source's digest is its file's: a PhoneticScript's or a medium's Media File `digest`. */
|
|
4334
|
+
function digestOf(rows, entityId) {
|
|
4335
|
+
const digest = (rows["phonetic-script-entities"][entityId] ?? rows["media-entities"][entityId])?.digest;
|
|
4336
|
+
return typeof digest === "string" ? digest : void 0;
|
|
4337
|
+
}
|
|
4283
4338
|
//#endregion
|
|
4284
4339
|
//#region src/dsl/document/native-text.ts
|
|
4285
4340
|
function applyTextEdits(text, edits) {
|
|
@@ -4764,6 +4819,8 @@ function voiceoverPlan(s, input, result) {
|
|
|
4764
4819
|
}
|
|
4765
4820
|
});
|
|
4766
4821
|
else if (!s["audio-script-entities"][result.audioScriptId]) throw new Error("Missing AudioScript");
|
|
4822
|
+
const phoneticScriptId = input.script.phoneticScriptId;
|
|
4823
|
+
if (phoneticScriptId !== void 0 && s["phonetic-script-entities"][phoneticScriptId]?.phoneme.audioScriptId !== result.audioScriptId) throw new Error("The PhoneticScript must name this AudioScript as its base");
|
|
4767
4824
|
validateWindow({
|
|
4768
4825
|
inMs: 0,
|
|
4769
4826
|
outMs: input.media.durationMs
|
|
@@ -4773,7 +4830,8 @@ function voiceoverPlan(s, input, result) {
|
|
|
4773
4830
|
table: "derived-from-relations",
|
|
4774
4831
|
value: {
|
|
4775
4832
|
entityId: result.mediaId,
|
|
4776
|
-
sourceId: result.audioScriptId
|
|
4833
|
+
sourceId: phoneticScriptId ?? result.audioScriptId,
|
|
4834
|
+
...input.sourceDigest === void 0 ? {} : { sourceDigest: input.sourceDigest }
|
|
4777
4835
|
}
|
|
4778
4836
|
});
|
|
4779
4837
|
if (input.voice) {
|
|
@@ -4899,9 +4957,11 @@ function voiceoverPlan(s, input, result) {
|
|
|
4899
4957
|
var DslEditor = class {
|
|
4900
4958
|
dsl;
|
|
4901
4959
|
idFactory;
|
|
4902
|
-
|
|
4960
|
+
uploadText;
|
|
4961
|
+
constructor(dsl, idFactory = defaultIdFactory, uploadText) {
|
|
4903
4962
|
this.dsl = dsl;
|
|
4904
4963
|
this.idFactory = idFactory;
|
|
4964
|
+
this.uploadText = uploadText;
|
|
4905
4965
|
}
|
|
4906
4966
|
createTrack(role, options) {
|
|
4907
4967
|
const id = this.idFactory("track");
|
|
@@ -5191,7 +5251,7 @@ var DslEditor = class {
|
|
|
5191
5251
|
const result = {
|
|
5192
5252
|
clipId: input.clipId ?? this.idFactory("clip"),
|
|
5193
5253
|
mediaId: resourceId("media", input.media.system, input.media.key),
|
|
5194
|
-
audioScriptId:
|
|
5254
|
+
audioScriptId: this.voiceoverScriptId(input.script),
|
|
5195
5255
|
captionClipIds: input.captions.map((c) => c.clipId ?? this.idFactory("clip")),
|
|
5196
5256
|
captionIds: input.captions.map(() => this.idFactory("caption"))
|
|
5197
5257
|
};
|
|
@@ -5201,6 +5261,71 @@ var DslEditor = class {
|
|
|
5201
5261
|
}, voiceoverPlan(this.dsl.getSnapshot(), input, result), options);
|
|
5202
5262
|
return result;
|
|
5203
5263
|
}
|
|
5264
|
+
voiceoverScriptId(script) {
|
|
5265
|
+
if (script.audioScriptId !== void 0) return script.audioScriptId;
|
|
5266
|
+
if (script.phoneticScriptId === void 0) return this.idFactory("audio-script");
|
|
5267
|
+
const phonetic = this.dsl.getSnapshot()["phonetic-script-entities"][script.phoneticScriptId];
|
|
5268
|
+
if (!phonetic) throw new Error("Missing PhoneticScript");
|
|
5269
|
+
return phonetic.phoneme.audioScriptId;
|
|
5270
|
+
}
|
|
5271
|
+
/**
|
|
5272
|
+
* Write a PhoneticScript: create one for `audioScriptId`, or, given `phoneticScriptId`, replace its
|
|
5273
|
+
* base and pronunciation together. A `phonemeScript` is stored as a Memota text file first, and
|
|
5274
|
+
* the file's facts are written with it; an unchanged one keeps its file. Recordings already spoken
|
|
5275
|
+
* from it keep their derived-from.
|
|
5276
|
+
*/
|
|
5277
|
+
async setPhoneticScript(input, options) {
|
|
5278
|
+
const id = input.phoneticScriptId ?? this.idFactory("phonetic-script");
|
|
5279
|
+
const phoneme = {
|
|
5280
|
+
audioScriptId: input.audioScriptId,
|
|
5281
|
+
...input.phonemeScript === void 0 ? {} : { phonemeScript: input.phonemeScript }
|
|
5282
|
+
};
|
|
5283
|
+
const file = input.phonemeScript === void 0 ? {} : await this.fileFor(id, input.phonemeScript);
|
|
5284
|
+
const exists = Object.hasOwn(this.dsl.getSnapshot()["phonetic-script-entities"], id);
|
|
5285
|
+
const cleared = {
|
|
5286
|
+
system: void 0,
|
|
5287
|
+
key: void 0,
|
|
5288
|
+
storageKey: void 0,
|
|
5289
|
+
digest: void 0
|
|
5290
|
+
};
|
|
5291
|
+
this.write("setPhoneticScript", {
|
|
5292
|
+
id,
|
|
5293
|
+
phoneme,
|
|
5294
|
+
...cleared,
|
|
5295
|
+
...file
|
|
5296
|
+
}, [exists ? {
|
|
5297
|
+
type: "patch-entity",
|
|
5298
|
+
table: "phonetic-script-entities",
|
|
5299
|
+
id,
|
|
5300
|
+
patch: {
|
|
5301
|
+
phoneme: {
|
|
5302
|
+
...phoneme,
|
|
5303
|
+
phonemeScript: input.phonemeScript
|
|
5304
|
+
},
|
|
5305
|
+
...cleared,
|
|
5306
|
+
...file
|
|
5307
|
+
}
|
|
5308
|
+
} : {
|
|
5309
|
+
type: "create-entity",
|
|
5310
|
+
table: "phonetic-script-entities",
|
|
5311
|
+
id,
|
|
5312
|
+
value: {
|
|
5313
|
+
phoneme,
|
|
5314
|
+
...file
|
|
5315
|
+
}
|
|
5316
|
+
}], options);
|
|
5317
|
+
return id;
|
|
5318
|
+
}
|
|
5319
|
+
/** The file holding `text`: the one the PhoneticScript keeps while its text is unchanged, else a new upload. */
|
|
5320
|
+
async fileFor(id, text) {
|
|
5321
|
+
const current = this.dsl.getSnapshot()["phonetic-script-entities"][id];
|
|
5322
|
+
if (current?.phoneme.phonemeScript === text) {
|
|
5323
|
+
const { phoneme: _, ...file } = current;
|
|
5324
|
+
return file;
|
|
5325
|
+
}
|
|
5326
|
+
if (!this.uploadText) throw new Error("This editor stores no files");
|
|
5327
|
+
return this.uploadText(text);
|
|
5328
|
+
}
|
|
5204
5329
|
setBgm(input, options) {
|
|
5205
5330
|
const s = this.dsl.getSnapshot();
|
|
5206
5331
|
if (requireTrack(s, input.trackId).role !== "bgm") throw new Error("Expected a BGM Track");
|
|
@@ -5295,6 +5420,131 @@ function createInitialMedeoDsl(options = {}) {
|
|
|
5295
5420
|
}
|
|
5296
5421
|
}
|
|
5297
5422
|
//#endregion
|
|
5423
|
+
//#region src/dsl/projection/audio-scripts.ts
|
|
5424
|
+
/**
|
|
5425
|
+
* The scripts a recording says. It follows derived-from from the recording; a PhoneticScript is a
|
|
5426
|
+
* variant, so its words are the base its phoneme names, and derived-from is not followed past it.
|
|
5427
|
+
* When nothing is found that way, a script read off the recording itself is what it says.
|
|
5428
|
+
*/
|
|
5429
|
+
function spokenScripts(snapshot, recordingId) {
|
|
5430
|
+
const relations = Object.values(snapshot["derived-from-relations"]);
|
|
5431
|
+
const found = /* @__PURE__ */ new Map();
|
|
5432
|
+
const seen = /* @__PURE__ */ new Set();
|
|
5433
|
+
const visit = (id, phoneticScriptId) => {
|
|
5434
|
+
if (seen.has(id)) return;
|
|
5435
|
+
seen.add(id);
|
|
5436
|
+
if (snapshot["audio-script-entities"][id]) {
|
|
5437
|
+
if (!found.has(id)) found.set(id, phoneticScriptId);
|
|
5438
|
+
return;
|
|
5439
|
+
}
|
|
5440
|
+
const phonetic = snapshot["phonetic-script-entities"][id];
|
|
5441
|
+
if (phonetic) {
|
|
5442
|
+
visit(phonetic.phoneme.audioScriptId, id);
|
|
5443
|
+
return;
|
|
5444
|
+
}
|
|
5445
|
+
for (const r of relations) if (r.entityId === id) visit(r.sourceId, phoneticScriptId);
|
|
5446
|
+
};
|
|
5447
|
+
visit(recordingId);
|
|
5448
|
+
if (!found.size) {
|
|
5449
|
+
for (const r of relations) if (r.sourceId === recordingId && snapshot["audio-script-entities"][r.entityId]) found.set(r.entityId, void 0);
|
|
5450
|
+
}
|
|
5451
|
+
return [...found].map(([audioScriptId, phoneticScriptId]) => phoneticScriptId === void 0 ? { audioScriptId } : {
|
|
5452
|
+
audioScriptId,
|
|
5453
|
+
phoneticScriptId
|
|
5454
|
+
});
|
|
5455
|
+
}
|
|
5456
|
+
/** Every AudioScript in the document with its PhoneticScripts, the Speech Clips saying it and the Caption Clips showing it. */
|
|
5457
|
+
function toAudioScriptViews(snapshot) {
|
|
5458
|
+
const views = /* @__PURE__ */ new Map();
|
|
5459
|
+
const bodies = /* @__PURE__ */ new Map();
|
|
5460
|
+
for (const [id, script] of Object.entries(snapshot["audio-script-entities"])) {
|
|
5461
|
+
const rich = snapshot.richText[id];
|
|
5462
|
+
const text = rich ? langsFromDelta(rich.delta) : {
|
|
5463
|
+
body: script.body,
|
|
5464
|
+
langs: []
|
|
5465
|
+
};
|
|
5466
|
+
bodies.set(id, text.body);
|
|
5467
|
+
views.set(id, {
|
|
5468
|
+
id,
|
|
5469
|
+
segments: lines(text.body).map((line) => {
|
|
5470
|
+
const language = lineLanguage(text, line);
|
|
5471
|
+
return language === void 0 ? { text: line.text } : {
|
|
5472
|
+
text: line.text,
|
|
5473
|
+
language
|
|
5474
|
+
};
|
|
5475
|
+
}),
|
|
5476
|
+
sourceMediaIds: [],
|
|
5477
|
+
phoneticScripts: [],
|
|
5478
|
+
speeches: [],
|
|
5479
|
+
captions: []
|
|
5480
|
+
});
|
|
5481
|
+
}
|
|
5482
|
+
for (const r of Object.values(snapshot["derived-from-relations"])) if (snapshot["media-entities"][r.sourceId]) views.get(r.entityId)?.sourceMediaIds.push(r.sourceId);
|
|
5483
|
+
for (const [id, phonetic] of Object.entries(snapshot["phonetic-script-entities"])) {
|
|
5484
|
+
const { phonemeScript } = phonetic.phoneme;
|
|
5485
|
+
const { digest } = phonetic;
|
|
5486
|
+
views.get(phonetic.phoneme.audioScriptId)?.phoneticScripts.push({
|
|
5487
|
+
id,
|
|
5488
|
+
...phonemeScript === void 0 ? {} : { phonemeScript },
|
|
5489
|
+
...digest === void 0 ? {} : { digest }
|
|
5490
|
+
});
|
|
5491
|
+
}
|
|
5492
|
+
const timbres = Object.values(snapshot["voice-timbre-relations"]);
|
|
5493
|
+
for (const track of resolveDslLayout(snapshot).tracks) for (const { clipId } of track.clips) {
|
|
5494
|
+
const source = snapshot["clip-entities"][clipId]?.source;
|
|
5495
|
+
if (!source) continue;
|
|
5496
|
+
if (snapshot["media-entities"][source]?.kind === "voiceover-recording") {
|
|
5497
|
+
const voices = timbres.filter((r) => r.recordingId === source).flatMap((r) => {
|
|
5498
|
+
const voice = snapshot["voice-entities"][r.voiceId];
|
|
5499
|
+
if (!voice) return [];
|
|
5500
|
+
return [voice.name === void 0 ? {
|
|
5501
|
+
voiceId: r.voiceId,
|
|
5502
|
+
key: voice.key
|
|
5503
|
+
} : {
|
|
5504
|
+
voiceId: r.voiceId,
|
|
5505
|
+
key: voice.key,
|
|
5506
|
+
name: voice.name
|
|
5507
|
+
}];
|
|
5508
|
+
});
|
|
5509
|
+
for (const spoken of spokenScripts(snapshot, source)) {
|
|
5510
|
+
const applied = appliedSpeech(snapshot, source, spoken);
|
|
5511
|
+
views.get(spoken.audioScriptId)?.speeches.push({
|
|
5512
|
+
clipId,
|
|
5513
|
+
recordingId: source,
|
|
5514
|
+
...spoken.phoneticScriptId === void 0 ? {} : { phoneticScriptId: spoken.phoneticScriptId },
|
|
5515
|
+
voices,
|
|
5516
|
+
...applied === void 0 ? {} : { applied }
|
|
5517
|
+
});
|
|
5518
|
+
}
|
|
5519
|
+
continue;
|
|
5520
|
+
}
|
|
5521
|
+
const caption = snapshot["caption-entities"][source];
|
|
5522
|
+
const shown = snapshot.captionText[source];
|
|
5523
|
+
if (!caption?.selection || caption.text !== void 0 || !shown) continue;
|
|
5524
|
+
const scriptId = caption.selection.audioScriptId;
|
|
5525
|
+
const body = bodies.get(scriptId);
|
|
5526
|
+
if (body === void 0) continue;
|
|
5527
|
+
const segment = lines(body).findIndex((line) => shown.start >= line.start && shown.end <= line.end);
|
|
5528
|
+
if (segment >= 0) views.get(scriptId)?.captions.push({
|
|
5529
|
+
clipId,
|
|
5530
|
+
captionId: source,
|
|
5531
|
+
segment
|
|
5532
|
+
});
|
|
5533
|
+
}
|
|
5534
|
+
return [...views.values()];
|
|
5535
|
+
}
|
|
5536
|
+
/**
|
|
5537
|
+
* Whether a recording still matches what it was synthesized from: the digest its derived-from
|
|
5538
|
+
* records against the source's file digest now. An AudioScript has no file, so a recording
|
|
5539
|
+
* derived from a script directly is not judged.
|
|
5540
|
+
*/
|
|
5541
|
+
function appliedSpeech(snapshot, recordingId, spoken) {
|
|
5542
|
+
const sourceId = spoken.phoneticScriptId ?? spoken.audioScriptId;
|
|
5543
|
+
const recorded = Object.values(snapshot["derived-from-relations"]).find((r) => r.entityId === recordingId && r.sourceId === sourceId)?.sourceDigest;
|
|
5544
|
+
const current = spoken.phoneticScriptId === void 0 ? void 0 : snapshot["phonetic-script-entities"][sourceId]?.digest;
|
|
5545
|
+
return recorded === void 0 || current === void 0 ? void 0 : recorded === current;
|
|
5546
|
+
}
|
|
5547
|
+
//#endregion
|
|
5298
5548
|
//#region src/dsl/projection/caption-style.ts
|
|
5299
5549
|
const fields = {
|
|
5300
5550
|
fontSize: "font_size",
|
|
@@ -5469,26 +5719,7 @@ function requireWholeAudio(media, clip, fail) {
|
|
|
5469
5719
|
if (media.kind === "image" || clip.inMs !== 0 || clip.outMs !== media.durationMs || clip.rate !== 1) fail("VideoDraft audio has no trim or speed fields");
|
|
5470
5720
|
}
|
|
5471
5721
|
function spokenText(snapshot, recordingId) {
|
|
5472
|
-
const
|
|
5473
|
-
const scripts = /* @__PURE__ */ new Set(), seen = /* @__PURE__ */ new Set();
|
|
5474
|
-
const visit = (id) => {
|
|
5475
|
-
if (seen.has(id)) return;
|
|
5476
|
-
seen.add(id);
|
|
5477
|
-
if (snapshot["audio-script-entities"][id]) {
|
|
5478
|
-
scripts.add(id);
|
|
5479
|
-
return;
|
|
5480
|
-
}
|
|
5481
|
-
const phonetic = snapshot["phonetic-script-entities"][id];
|
|
5482
|
-
if (phonetic) {
|
|
5483
|
-
visit(phonetic.phoneme.audioScriptId);
|
|
5484
|
-
return;
|
|
5485
|
-
}
|
|
5486
|
-
for (const r of relations) if (r.entityId === id) visit(r.sourceId);
|
|
5487
|
-
};
|
|
5488
|
-
visit(recordingId);
|
|
5489
|
-
if (!scripts.size) {
|
|
5490
|
-
for (const r of relations) if (r.sourceId === recordingId && snapshot["audio-script-entities"][r.entityId]) scripts.add(r.entityId);
|
|
5491
|
-
}
|
|
5722
|
+
const scripts = new Set(spokenScripts(snapshot, recordingId).map((spoken) => spoken.audioScriptId));
|
|
5492
5723
|
if (scripts.size > 1) projectionError("ambiguous-script", `media-entities/${recordingId}`, "Multiple scripts cannot be silently concatenated into audio_script");
|
|
5493
5724
|
const id = [...scripts][0];
|
|
5494
5725
|
return id ? snapshot.richText[id]?.plainText ?? "" : "";
|
|
@@ -5807,4 +6038,4 @@ function milliseconds(value, path, positive = false, signed = false) {
|
|
|
5807
6038
|
return value;
|
|
5808
6039
|
}
|
|
5809
6040
|
//#endregion
|
|
5810
|
-
export {
|
|
6041
|
+
export { DslEditor as a, DslProjectionError as c, createInitialMedeoDsl as i, toVideoDraft as n, MedeoDsl as o, toAudioScriptViews as r, resolveDslLayout as s, fromVideoDraft as t };
|
package/dist/dsl.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { A as
|
|
3
|
-
export { type AddDslClip, type AddDslClipsInput, type ApplyVoiceoverInput, type AudioScript, type Caption, type CaptionContent, type CaptionDisplayCue, type CaptionSelection, type CaptionStyle, type CaptionText, type Clip, type ClipPlacement, type ClipSource, type CommitOptions, type ContainMutation, type ContainNode, type CreateMedeoDslOptions, DEFAULT_UNIT_TIME_MS, type DeepReadonly, type DslAudit, type DslClipLayout, type DslClipUpdate, type DslDiagnostic, DslEditor, type DslIdFactory, type DslLayout, type DslMutation, DslProjectionError, type DslTrackLayout, type DslTransaction, type EntityIdKind, type EntityMutation, type EntityTable, type EntityTables, type EntityValues, type FieldPatch, type FromVideoDraftOptions, type ImportedVideoDraft, type InvalidAtomic, MedeoDsl, type MedeoDslDraft, type MedeoDslLoroState, type MedeoDslSnapshot, type Media, type MoveDslClipsInput, type OpActor, type RelationMutation, type RelationTable, type RelationTables, type RelationValues, type ReplaceDslClipsInput, type ResourceSystem, type RichTextSnapshot, type TextDelta, type TextEdit, type TextMark, type TextMutation, type TextRun, type TimeAnchor, type Track, type TrackRole, UnsupportedDocumentFormatError, type VideoCreationSettings, type VideoDraft, type VideoDraftCaptionStyle, type VideoDraftContent, type VideoDraftContentPartUnion, type VideoDraftInput, type VideoDraftPartUnion, type VideoDraftProjection, type VideoDraftTimeline, type VideoDraftTrack, type VideoDraftTrackItem, type Voice, type VoiceoverCaptionInput, type VoiceoverResult, assertDslDocument, captionContentCodec, createInitialMedeoDsl, defaultIdFactory, documentFormat, fromVideoDraft, isInvalidAtomic, medeoDslLoroShape, relationId, resolveDslLayout, resourceId, timeAnchorCodec, toVideoDraft, tupleHash };
|
|
1
|
+
import { $ as Track, A as DeepReadonly, B as RelationMutation, C as CaptionContent, D as Clip, E as CaptionText, F as EntityTables, G as RichTextSnapshot, H as RelationTables, I as EntityValues, J as TextEdit, K as StoredFile, L as FieldPatch, M as DslMutation, N as EntityMutation, O as ContainMutation, P as EntityTable, Q as TimeAnchor, R as MedeoDslSnapshot, S as Caption, T as CaptionStyle, U as RelationValues, V as RelationTable, W as ResourceSystem, X as TextMutation, Y as TextMark, Z as TextRun, _ as defaultIdFactory, a as VideoDraftCaptionStyle, b as tupleHash, c as VideoDraftInput, d as VideoDraftTrack, et as TrackRole, f as VideoDraftTrackItem, g as EntityIdKind, h as DslIdFactory, i as VideoDraft, j as DslDiagnostic, k as ContainNode, l as VideoDraftPartUnion, m as OpActor, n as DEFAULT_UNIT_TIME_MS, o as VideoDraftContent, p as CommitOptions, q as TextDelta, r as VideoCreationSettings, s as VideoDraftContentPartUnion, t as CaptionDisplayCue, tt as Voice, u as VideoDraftTimeline, v as relationId, w as CaptionSelection, x as AudioScript, y as resourceId, z as Media } from "./video-draft-types-Bq15tPBP.js";
|
|
2
|
+
import { A as MedeoDslDraft, C as UnsupportedDocumentFormatError, D as captionContentCodec, E as InvalidAtomic, F as ClipSource, I as DslClipUpdate, L as MoveDslClipsInput, M as medeoDslLoroShape, N as AddDslClip, O as isInvalidAtomic, P as AddDslClipsInput, R as ReplaceDslClipsInput, S as DslTransaction, T as documentFormat, _ as VoiceoverCaptionInput, a as toAudioScriptViews, b as MedeoDsl, c as resolveDslLayout, d as DslProjectionError, f as DslTrackLayout, g as ApplyVoiceoverInput, h as UploadText, i as AudioScriptView, j as MedeoDslLoroState, k as timeAnchorCodec, l as DslClipLayout, m as DslEditor, n as ImportedVideoDraft, o as VideoDraftProjection, p as createInitialMedeoDsl, r as fromVideoDraft, s as toVideoDraft, t as FromVideoDraftOptions, u as DslLayout, v as VoiceoverResult, w as assertDslDocument, x as DslAudit, y as CreateMedeoDslOptions, z as ClipPlacement } from "./index-DHcMMn2M.js";
|
|
3
|
+
export { type AddDslClip, type AddDslClipsInput, type ApplyVoiceoverInput, type AudioScript, type AudioScriptView, type Caption, type CaptionContent, type CaptionDisplayCue, type CaptionSelection, type CaptionStyle, type CaptionText, type Clip, type ClipPlacement, type ClipSource, type CommitOptions, type ContainMutation, type ContainNode, type CreateMedeoDslOptions, DEFAULT_UNIT_TIME_MS, type DeepReadonly, type DslAudit, type DslClipLayout, type DslClipUpdate, type DslDiagnostic, DslEditor, type DslIdFactory, type DslLayout, type DslMutation, DslProjectionError, type DslTrackLayout, type DslTransaction, type EntityIdKind, type EntityMutation, type EntityTable, type EntityTables, type EntityValues, type FieldPatch, type FromVideoDraftOptions, type ImportedVideoDraft, type InvalidAtomic, MedeoDsl, type MedeoDslDraft, type MedeoDslLoroState, type MedeoDslSnapshot, type Media, type MoveDslClipsInput, type OpActor, type RelationMutation, type RelationTable, type RelationTables, type RelationValues, type ReplaceDslClipsInput, type ResourceSystem, type RichTextSnapshot, type StoredFile, type TextDelta, type TextEdit, type TextMark, type TextMutation, type TextRun, type TimeAnchor, type Track, type TrackRole, UnsupportedDocumentFormatError, type UploadText, type VideoCreationSettings, type VideoDraft, type VideoDraftCaptionStyle, type VideoDraftContent, type VideoDraftContentPartUnion, type VideoDraftInput, type VideoDraftPartUnion, type VideoDraftProjection, type VideoDraftTimeline, type VideoDraftTrack, type VideoDraftTrackItem, type Voice, type VoiceoverCaptionInput, type VoiceoverResult, assertDslDocument, captionContentCodec, createInitialMedeoDsl, defaultIdFactory, documentFormat, fromVideoDraft, isInvalidAtomic, medeoDslLoroShape, relationId, resolveDslLayout, resourceId, timeAnchorCodec, toAudioScriptViews, toVideoDraft, tupleHash };
|
package/dist/dsl.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as documentFormat, c as isInvalidAtomic, ft as defaultIdFactory, ht as tupleHash, i as assertDslDocument, l as timeAnchorCodec, mt as resourceId, o as medeoDslLoroShape, pt as relationId, r as UnsupportedDocumentFormatError, s as captionContentCodec, t as DEFAULT_UNIT_TIME_MS } from "./video-draft-types-
|
|
2
|
-
import { a as
|
|
3
|
-
export { DEFAULT_UNIT_TIME_MS, DslEditor, DslProjectionError, MedeoDsl, UnsupportedDocumentFormatError, assertDslDocument, captionContentCodec, createInitialMedeoDsl, defaultIdFactory, documentFormat, fromVideoDraft, isInvalidAtomic, medeoDslLoroShape, relationId, resolveDslLayout, resourceId, timeAnchorCodec, toVideoDraft, tupleHash };
|
|
1
|
+
import { a as documentFormat, c as isInvalidAtomic, ft as defaultIdFactory, ht as tupleHash, i as assertDslDocument, l as timeAnchorCodec, mt as resourceId, o as medeoDslLoroShape, pt as relationId, r as UnsupportedDocumentFormatError, s as captionContentCodec, t as DEFAULT_UNIT_TIME_MS } from "./video-draft-types-Ce8NDenQ.js";
|
|
2
|
+
import { a as DslEditor, c as DslProjectionError, i as createInitialMedeoDsl, n as toVideoDraft, o as MedeoDsl, r as toAudioScriptViews, s as resolveDslLayout, t as fromVideoDraft } from "./dsl-DQ63zFgu.js";
|
|
3
|
+
export { DEFAULT_UNIT_TIME_MS, DslEditor, DslProjectionError, MedeoDsl, UnsupportedDocumentFormatError, assertDslDocument, captionContentCodec, createInitialMedeoDsl, defaultIdFactory, documentFormat, fromVideoDraft, isInvalidAtomic, medeoDslLoroShape, relationId, resolveDslLayout, resourceId, timeAnchorCodec, toAudioScriptViews, toVideoDraft, tupleHash };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { _ as ManualSyncTransport, a as MengineDocSessionOptions, g as ManualSyncDocOptions, n as DocumentSession, r as DocumentSessionUpdateEvent } from "./index-
|
|
1
|
+
import { R as MedeoDslSnapshot, W as ResourceSystem, et as TrackRole } from "./video-draft-types-Bq15tPBP.js";
|
|
2
|
+
import { b as MedeoDsl, h as UploadText, i as AudioScriptView, m as DslEditor, o as VideoDraftProjection } from "./index-DHcMMn2M.js";
|
|
3
|
+
import { _ as ManualSyncTransport, a as MengineDocSessionOptions, g as ManualSyncDocOptions, n as DocumentSession, r as DocumentSessionUpdateEvent } from "./index-Dpl4bT94.js";
|
|
4
4
|
|
|
5
5
|
//#region src/manual-sync/manual-sync-doc.d.ts
|
|
6
6
|
/** Explicit synchronization over the same DSL/editor used by the live Session. */
|
|
@@ -8,7 +8,10 @@ declare class ManualSyncDoc extends ManualSyncTransport {
|
|
|
8
8
|
readonly dsl: MedeoDsl;
|
|
9
9
|
readonly editor: DslEditor;
|
|
10
10
|
private constructor();
|
|
11
|
-
|
|
11
|
+
/** `uploadText` stores raw content the editor writes, such as a PhoneticScript's text, in Memota. */
|
|
12
|
+
static open(options: ManualSyncDocOptions & {
|
|
13
|
+
uploadText?: UploadText;
|
|
14
|
+
}): Promise<ManualSyncDoc>;
|
|
12
15
|
snapshot(): {
|
|
13
16
|
readonly "timeline-entities": {
|
|
14
17
|
readonly [x: string]: {
|
|
@@ -73,6 +76,10 @@ declare class ManualSyncDoc extends ManualSyncTransport {
|
|
|
73
76
|
readonly audioScriptId: string;
|
|
74
77
|
readonly phonemeScript?: string | undefined;
|
|
75
78
|
};
|
|
79
|
+
readonly system?: "memota" | undefined;
|
|
80
|
+
readonly key?: string | undefined;
|
|
81
|
+
readonly storageKey?: string | undefined;
|
|
82
|
+
readonly digest?: string | undefined;
|
|
76
83
|
};
|
|
77
84
|
};
|
|
78
85
|
readonly "caption-entities": {
|
|
@@ -117,6 +124,7 @@ declare class ManualSyncDoc extends ManualSyncTransport {
|
|
|
117
124
|
readonly [x: string]: {
|
|
118
125
|
readonly entityId: string;
|
|
119
126
|
readonly sourceId: string;
|
|
127
|
+
readonly sourceDigest?: string | undefined;
|
|
120
128
|
};
|
|
121
129
|
};
|
|
122
130
|
readonly 'contain-relations': readonly {
|
|
@@ -158,9 +166,14 @@ declare class ManualSyncDoc extends ManualSyncTransport {
|
|
|
158
166
|
type MengineDocSessionUpdateEvent = DocumentSessionUpdateEvent<MedeoDslSnapshot>;
|
|
159
167
|
/** Default collaborative session: one DSL handle and one editor over the synchronized LoroDoc. */
|
|
160
168
|
declare class MengineDocSession extends DocumentSession<MedeoDslSnapshot, DslEditor, MedeoDsl> {
|
|
161
|
-
|
|
169
|
+
/** `uploadText` stores raw content the editor writes, such as a PhoneticScript's text, in Memota. */
|
|
170
|
+
constructor(options: MengineDocSessionOptions & {
|
|
171
|
+
uploadText?: UploadText;
|
|
172
|
+
});
|
|
162
173
|
get dsl(): MedeoDsl;
|
|
163
174
|
projectVideoDraft(): VideoDraftProjection;
|
|
175
|
+
/** The document's AudioScripts with what says and shows them; read from the same snapshot as the VideoDraft. */
|
|
176
|
+
projectAudioScripts(): AudioScriptView[];
|
|
164
177
|
}
|
|
165
178
|
//#endregion
|
|
166
179
|
export { MengineDocSessionUpdateEvent as n, ManualSyncDoc as r, MengineDocSession as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as CaptionContent, J as TextEdit, K as StoredFile, L as FieldPatch, M as DslMutation, Q as TimeAnchor, R as MedeoDslSnapshot, T as CaptionStyle, c as VideoDraftInput, et as TrackRole, h as DslIdFactory, j as DslDiagnostic, o as VideoDraftContent, p as CommitOptions, tt as Voice, w as CaptionSelection, z as Media } from "./video-draft-types-Bq15tPBP.js";
|
|
2
2
|
import { ContainerType, Cursor, LoroDoc, PeerID, TreeID } from "loro-crdt";
|
|
3
3
|
|
|
4
4
|
//#region src/dsl/action-context.d.ts
|
|
@@ -476,11 +476,19 @@ declare const medeoDslLoroShape: RootSchemaType<{
|
|
|
476
476
|
};
|
|
477
477
|
'phonetic-script-entities': LoroMapSchemaWithCatchall<{}, LoroMapSchema<{
|
|
478
478
|
phoneme: /*elided*/any;
|
|
479
|
+
system: /*elided*/any;
|
|
480
|
+
key: /*elided*/any;
|
|
481
|
+
storageKey: /*elided*/any;
|
|
482
|
+
digest: /*elided*/any;
|
|
479
483
|
}> & {
|
|
480
484
|
options: {};
|
|
481
485
|
} & {
|
|
482
486
|
catchall: <C extends SchemaType>(catchallSchema: C) => LoroMapSchemaWithCatchall<{
|
|
483
487
|
phoneme: /*elided*/any;
|
|
488
|
+
system: /*elided*/any;
|
|
489
|
+
key: /*elided*/any;
|
|
490
|
+
storageKey: /*elided*/any;
|
|
491
|
+
digest: /*elided*/any;
|
|
484
492
|
}, C>;
|
|
485
493
|
}> & {
|
|
486
494
|
options: {};
|
|
@@ -545,24 +553,18 @@ declare const medeoDslLoroShape: RootSchemaType<{
|
|
|
545
553
|
readonly mergeableMapChildContainers: true;
|
|
546
554
|
};
|
|
547
555
|
};
|
|
548
|
-
'derived-from-relations': LoroMapSchemaWithCatchall<{}, LoroMapSchema<
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
transform: TransformDefinition<string, D>;
|
|
554
|
-
};
|
|
555
|
-
}>> & {
|
|
556
|
+
'derived-from-relations': LoroMapSchemaWithCatchall<{}, LoroMapSchema<{
|
|
557
|
+
entityId: /*elided*/any;
|
|
558
|
+
sourceId: /*elided*/any;
|
|
559
|
+
sourceDigest: /*elided*/any;
|
|
560
|
+
}> & {
|
|
556
561
|
options: {};
|
|
557
562
|
} & {
|
|
558
|
-
catchall: <C extends SchemaType>(catchallSchema: C) => LoroMapSchemaWithCatchall<
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
transform: TransformDefinition<string, D>;
|
|
564
|
-
};
|
|
565
|
-
}>, C>;
|
|
563
|
+
catchall: <C extends SchemaType>(catchallSchema: C) => LoroMapSchemaWithCatchall<{
|
|
564
|
+
entityId: /*elided*/any;
|
|
565
|
+
sourceId: /*elided*/any;
|
|
566
|
+
sourceDigest: /*elided*/any;
|
|
567
|
+
}, C>;
|
|
566
568
|
}> & {
|
|
567
569
|
options: {
|
|
568
570
|
readonly mergeableMapChildContainers: true;
|
|
@@ -697,15 +699,31 @@ interface ApplyVoiceoverInput {
|
|
|
697
699
|
}> & {
|
|
698
700
|
kind: 'voiceover-recording';
|
|
699
701
|
};
|
|
702
|
+
/**
|
|
703
|
+
* What the recording says: an existing AudioScript, a new one from `body`, or a PhoneticScript it
|
|
704
|
+
* was spoken from. A recording spoken from a PhoneticScript is derived-from it, and its captions
|
|
705
|
+
* select that variant's base script.
|
|
706
|
+
*/
|
|
700
707
|
script: {
|
|
701
708
|
audioScriptId: string;
|
|
702
709
|
body?: never;
|
|
710
|
+
phoneticScriptId?: never;
|
|
703
711
|
} | {
|
|
704
712
|
body: string;
|
|
705
713
|
audioScriptId?: never;
|
|
714
|
+
phoneticScriptId?: never;
|
|
706
715
|
defaultLanguage?: string;
|
|
716
|
+
} | {
|
|
717
|
+
phoneticScriptId: string;
|
|
718
|
+
audioScriptId?: never;
|
|
719
|
+
body?: never;
|
|
707
720
|
};
|
|
708
721
|
placement: ClipPlacement;
|
|
722
|
+
/**
|
|
723
|
+
* The digest of what the recording was synthesized from (D177): the PhoneticScript as it was
|
|
724
|
+
* read for synthesis. Absent, the source's digest as this voiceover leaves it is recorded.
|
|
725
|
+
*/
|
|
726
|
+
sourceDigest?: string;
|
|
709
727
|
volume?: number;
|
|
710
728
|
voice?: Voice;
|
|
711
729
|
/** Complete generated caption set for this use. Other uses of the recording are untouched. */
|
|
@@ -720,11 +738,17 @@ interface VoiceoverResult {
|
|
|
720
738
|
}
|
|
721
739
|
//#endregion
|
|
722
740
|
//#region src/dsl/dsl-editor.d.ts
|
|
741
|
+
/**
|
|
742
|
+
* Stores raw content in Memota as a text file and returns the file's facts. The host owns the
|
|
743
|
+
* store; an entity with the Media File trait keeps the facts beside the content (D178).
|
|
744
|
+
*/
|
|
745
|
+
type UploadText = (text: string) => Promise<StoredFile>;
|
|
723
746
|
/** Business edits write DSL facts in one audited transaction; layout is derived on read. */
|
|
724
747
|
declare class DslEditor {
|
|
725
748
|
readonly dsl: MedeoDsl;
|
|
726
749
|
private readonly idFactory;
|
|
727
|
-
|
|
750
|
+
private readonly uploadText?;
|
|
751
|
+
constructor(dsl: MedeoDsl, idFactory?: DslIdFactory, uploadText?: UploadText | undefined);
|
|
728
752
|
createTrack(role: TrackRole, options?: CommitOptions): string;
|
|
729
753
|
registerMedia(media: Media, options?: CommitOptions): string;
|
|
730
754
|
addClips(input: AddDslClipsInput, options?: CommitOptions): string[];
|
|
@@ -770,6 +794,20 @@ declare class DslEditor {
|
|
|
770
794
|
updateClips(updates: readonly DslClipUpdate[], options?: CommitOptions): void;
|
|
771
795
|
patchCaptionStyle(captionIds: readonly string[], patch: FieldPatch<CaptionStyle>, options?: CommitOptions): void;
|
|
772
796
|
applyVoiceover(input: ApplyVoiceoverInput, options?: CommitOptions): VoiceoverResult;
|
|
797
|
+
private voiceoverScriptId;
|
|
798
|
+
/**
|
|
799
|
+
* Write a PhoneticScript: create one for `audioScriptId`, or, given `phoneticScriptId`, replace its
|
|
800
|
+
* base and pronunciation together. A `phonemeScript` is stored as a Memota text file first, and
|
|
801
|
+
* the file's facts are written with it; an unchanged one keeps its file. Recordings already spoken
|
|
802
|
+
* from it keep their derived-from.
|
|
803
|
+
*/
|
|
804
|
+
setPhoneticScript(input: {
|
|
805
|
+
phoneticScriptId?: string;
|
|
806
|
+
audioScriptId: string;
|
|
807
|
+
phonemeScript?: string;
|
|
808
|
+
}, options?: CommitOptions): Promise<string>;
|
|
809
|
+
/** The file holding `text`: the one the PhoneticScript keeps while its text is unchanged, else a new upload. */
|
|
810
|
+
private fileFor;
|
|
773
811
|
setBgm(input: ClipSource & {
|
|
774
812
|
trackId: string;
|
|
775
813
|
clipId?: string;
|
|
@@ -828,6 +866,52 @@ interface VideoDraftProjection {
|
|
|
828
866
|
/** A content read view, not an archive of authoring identities, rich-text marks or provenance. */
|
|
829
867
|
declare function toVideoDraft(snapshot: MedeoDslSnapshot): VideoDraftProjection;
|
|
830
868
|
//#endregion
|
|
869
|
+
//#region src/dsl/projection/audio-scripts.d.ts
|
|
870
|
+
/**
|
|
871
|
+
* An AudioScript with everything that says or shows it, read from the same snapshot as the
|
|
872
|
+
* VideoDraft. Speeches and captions come in playback order.
|
|
873
|
+
*/
|
|
874
|
+
interface AudioScriptView {
|
|
875
|
+
id: string;
|
|
876
|
+
/** Its text, one segment per line. */
|
|
877
|
+
segments: {
|
|
878
|
+
text: string;
|
|
879
|
+
language?: string;
|
|
880
|
+
}[];
|
|
881
|
+
/** Media the script was read off (a transcript), through derived-from. */
|
|
882
|
+
sourceMediaIds: string[];
|
|
883
|
+
/** Its variants written for synthesis: the pronunciation the plain text cannot state, and its file's digest. */
|
|
884
|
+
phoneticScripts: {
|
|
885
|
+
id: string;
|
|
886
|
+
phonemeScript?: string;
|
|
887
|
+
digest?: string;
|
|
888
|
+
}[];
|
|
889
|
+
/** Speech Clips playing a recording of these words. */
|
|
890
|
+
speeches: {
|
|
891
|
+
clipId: string;
|
|
892
|
+
recordingId: string; /** The PhoneticScript the recording was spoken from; absent when it derives from the script directly. */
|
|
893
|
+
phoneticScriptId?: string;
|
|
894
|
+
voices: {
|
|
895
|
+
voiceId: string;
|
|
896
|
+
key: string;
|
|
897
|
+
name?: string;
|
|
898
|
+
}[];
|
|
899
|
+
/**
|
|
900
|
+
* Whether the recording was synthesized from its source as it is now: the digest its
|
|
901
|
+
* derived-from records equals the source's digest (D177). Absent when either has none.
|
|
902
|
+
*/
|
|
903
|
+
applied?: boolean;
|
|
904
|
+
}[];
|
|
905
|
+
/** Caption Clips showing one of its segments. A Caption with its own text shows none. */
|
|
906
|
+
captions: {
|
|
907
|
+
clipId: string;
|
|
908
|
+
captionId: string;
|
|
909
|
+
segment: number;
|
|
910
|
+
}[];
|
|
911
|
+
}
|
|
912
|
+
/** Every AudioScript in the document with its PhoneticScripts, the Speech Clips saying it and the Caption Clips showing it. */
|
|
913
|
+
declare function toAudioScriptViews(snapshot: MedeoDslSnapshot): AudioScriptView[];
|
|
914
|
+
//#endregion
|
|
831
915
|
//#region src/dsl/projection/from-video-draft.d.ts
|
|
832
916
|
interface FromVideoDraftOptions extends CreateMedeoDslOptions {
|
|
833
917
|
/** Complete physical media facts, keyed by their external system/key; no IO runs in the converter. */
|
|
@@ -841,4 +925,4 @@ interface ImportedVideoDraft {
|
|
|
841
925
|
/** One-time import into a newly owned document; never reverse-diff a live collaborative document. */
|
|
842
926
|
declare function fromVideoDraft(input: VideoDraftInput, options: FromVideoDraftOptions): ImportedVideoDraft;
|
|
843
927
|
//#endregion
|
|
844
|
-
export {
|
|
928
|
+
export { MedeoDslDraft as A, UnsupportedDocumentFormatError as C, captionContentCodec as D, InvalidAtomic as E, ClipSource as F, DslClipUpdate as I, MoveDslClipsInput as L, medeoDslLoroShape as M, AddDslClip as N, isInvalidAtomic as O, AddDslClipsInput as P, ReplaceDslClipsInput as R, DslTransaction as S, documentFormat as T, VoiceoverCaptionInput as _, toAudioScriptViews as a, MedeoDsl as b, resolveDslLayout as c, DslProjectionError as d, DslTrackLayout as f, ApplyVoiceoverInput as g, UploadText as h, AudioScriptView as i, MedeoDslLoroState as j, timeAnchorCodec as k, DslClipLayout as l, DslEditor as m, ImportedVideoDraft as n, VideoDraftProjection as o, createInitialMedeoDsl as p, fromVideoDraft as r, toVideoDraft as s, FromVideoDraftOptions as t, DslLayout as u, VoiceoverResult as v, assertDslDocument as w, DslAudit as x, CreateMedeoDslOptions as y, ClipPlacement as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { j as DslDiagnostic, o as VideoDraftContent, p as CommitOptions } from "./video-draft-types-
|
|
1
|
+
import { j as DslDiagnostic, o as VideoDraftContent, p as CommitOptions } from "./video-draft-types-Bq15tPBP.js";
|
|
2
2
|
import { LoroDoc, PeerID, VersionVector } from "loro-crdt";
|
|
3
3
|
import { DocState, LocalSaveState } from "@mengine/sync";
|
|
4
4
|
import { BaseDocStorage, Connection, DocDiff, DocPushReceipt, DocSnapshotRecord, DocStorage, DocStorageOptions, DocUpdate, DocUpdateRecord } from "@mengine/storage";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { A as
|
|
3
|
-
import { A as MenginePushRejectedError, B as MengineSyncResponse, C as PushResult, D as MengineHttpClient, E as readMengineEventStream, F as MenginePushResponse, H as base64ToBytes, I as MenginePushUpdateResponse, L as MengineRejectedResponse, M as MengineAuditResponse, N as MengineDocumentVersion, O as MengineHttpClientOptions, P as MengineDraftResponse, R as MengineSnapshotResponse, S as PullResult, T as MengineEventStreamOptions, U as bytesToBase64, V as MengineUpdateMeta, a as MengineDocSessionOptions, b as DocVersionMark, c as WaitForLocalSaveOptions, d as MengineUndoState, f as MedeoHttpDocStorage, g as ManualSyncDocOptions, h as PushOutcomeKind, i as MengineAckFailedError, j as MengineAuditEntry, k as MengineHttpRequestError, l as WaitForServerAckOptions, m as PushOutcome, o as MengineDocSyncState, p as MedeoHttpDocStorageOptions, s as MengineLocalSaveState, t as MemoryDocStorage, u as DocStorageLike, v as decodeDocVersionMark, w as PushResultKind, x as PullFailureReason, y as encodeDocVersionMark, z as MengineSseUpdateEvent } from "./index-
|
|
4
|
-
import { n as MengineDocSessionUpdateEvent, r as ManualSyncDoc, t as MengineDocSession } from "./index-
|
|
5
|
-
export { type AddDslClip, type AddDslClipsInput, type ApplyVoiceoverInput, type AudioScript, type Caption, type CaptionContent, type CaptionDisplayCue, type CaptionSelection, type CaptionStyle, type CaptionText, type Clip, type ClipPlacement, type ClipSource, type CommitOptions, type ContainMutation, type ContainNode, type CreateMedeoDslOptions, DEFAULT_UNIT_TIME_MS, type DeepReadonly, type DocStorageLike, type DocVersionMark, type DslAudit, type DslClipLayout, type DslClipUpdate, type DslDiagnostic, DslEditor, type DslIdFactory, type DslLayout, type DslMutation, DslProjectionError, type DslTrackLayout, type DslTransaction, type EntityIdKind, type EntityMutation, type EntityTable, type EntityTables, type EntityValues, type FieldPatch, type FromVideoDraftOptions, type ImportedVideoDraft, type InvalidAtomic, ManualSyncDoc, type ManualSyncDocOptions, MedeoDsl, type MedeoDslDraft, type MedeoDslLoroState, type MedeoDslSnapshot, MedeoHttpDocStorage, type MedeoHttpDocStorageOptions, type Media, MemoryDocStorage, MengineAckFailedError, type MengineAuditEntry, type MengineAuditResponse, MengineDocSession, type MengineDocSessionOptions, type MengineDocSessionUpdateEvent, type MengineDocSyncState, type MengineDocumentVersion, type MengineDraftResponse, type MengineEventStreamOptions, MengineHttpClient, type MengineHttpClientOptions, MengineHttpRequestError, type MengineLocalSaveState, MenginePushRejectedError, type MenginePushResponse, type MenginePushUpdateResponse, type MengineRejectedResponse, type MengineSnapshotResponse, type MengineSseUpdateEvent, type MengineSyncResponse, type MengineUndoState, type MengineUpdateMeta, type MoveDslClipsInput, type OpActor, type PullFailureReason, type PullResult, type PushOutcome, type PushOutcomeKind, type PushResult, type PushResultKind, type RelationMutation, type RelationTable, type RelationTables, type RelationValues, type ReplaceDslClipsInput, type ResourceSystem, type RichTextSnapshot, type TextDelta, type TextEdit, type TextMark, type TextMutation, type TextRun, type TimeAnchor, type Track, type TrackRole, UnsupportedDocumentFormatError, type VideoCreationSettings, type VideoDraft, type VideoDraftCaptionStyle, type VideoDraftContent, type VideoDraftContentPartUnion, type VideoDraftInput, type VideoDraftPartUnion, type VideoDraftProjection, type VideoDraftTimeline, type VideoDraftTrack, type VideoDraftTrackItem, type Voice, type VoiceoverCaptionInput, type VoiceoverResult, type WaitForLocalSaveOptions, type WaitForServerAckOptions, assertDslDocument, base64ToBytes, bytesToBase64, captionContentCodec, createInitialMedeoDsl, decodeDocVersionMark, defaultIdFactory, documentFormat, encodeDocVersionMark, fromVideoDraft, isInvalidAtomic, medeoDslLoroShape, readMengineEventStream, relationId, resolveDslLayout, resourceId, timeAnchorCodec, toVideoDraft, tupleHash };
|
|
1
|
+
import { $ as Track, A as DeepReadonly, B as RelationMutation, C as CaptionContent, D as Clip, E as CaptionText, F as EntityTables, G as RichTextSnapshot, H as RelationTables, I as EntityValues, J as TextEdit, K as StoredFile, L as FieldPatch, M as DslMutation, N as EntityMutation, O as ContainMutation, P as EntityTable, Q as TimeAnchor, R as MedeoDslSnapshot, S as Caption, T as CaptionStyle, U as RelationValues, V as RelationTable, W as ResourceSystem, X as TextMutation, Y as TextMark, Z as TextRun, _ as defaultIdFactory, a as VideoDraftCaptionStyle, b as tupleHash, c as VideoDraftInput, d as VideoDraftTrack, et as TrackRole, f as VideoDraftTrackItem, g as EntityIdKind, h as DslIdFactory, i as VideoDraft, j as DslDiagnostic, k as ContainNode, l as VideoDraftPartUnion, m as OpActor, n as DEFAULT_UNIT_TIME_MS, o as VideoDraftContent, p as CommitOptions, q as TextDelta, r as VideoCreationSettings, s as VideoDraftContentPartUnion, t as CaptionDisplayCue, tt as Voice, u as VideoDraftTimeline, v as relationId, w as CaptionSelection, x as AudioScript, y as resourceId, z as Media } from "./video-draft-types-Bq15tPBP.js";
|
|
2
|
+
import { A as MedeoDslDraft, C as UnsupportedDocumentFormatError, D as captionContentCodec, E as InvalidAtomic, F as ClipSource, I as DslClipUpdate, L as MoveDslClipsInput, M as medeoDslLoroShape, N as AddDslClip, O as isInvalidAtomic, P as AddDslClipsInput, R as ReplaceDslClipsInput, S as DslTransaction, T as documentFormat, _ as VoiceoverCaptionInput, a as toAudioScriptViews, b as MedeoDsl, c as resolveDslLayout, d as DslProjectionError, f as DslTrackLayout, g as ApplyVoiceoverInput, h as UploadText, i as AudioScriptView, j as MedeoDslLoroState, k as timeAnchorCodec, l as DslClipLayout, m as DslEditor, n as ImportedVideoDraft, o as VideoDraftProjection, p as createInitialMedeoDsl, r as fromVideoDraft, s as toVideoDraft, t as FromVideoDraftOptions, u as DslLayout, v as VoiceoverResult, w as assertDslDocument, x as DslAudit, y as CreateMedeoDslOptions, z as ClipPlacement } from "./index-DHcMMn2M.js";
|
|
3
|
+
import { A as MenginePushRejectedError, B as MengineSyncResponse, C as PushResult, D as MengineHttpClient, E as readMengineEventStream, F as MenginePushResponse, H as base64ToBytes, I as MenginePushUpdateResponse, L as MengineRejectedResponse, M as MengineAuditResponse, N as MengineDocumentVersion, O as MengineHttpClientOptions, P as MengineDraftResponse, R as MengineSnapshotResponse, S as PullResult, T as MengineEventStreamOptions, U as bytesToBase64, V as MengineUpdateMeta, a as MengineDocSessionOptions, b as DocVersionMark, c as WaitForLocalSaveOptions, d as MengineUndoState, f as MedeoHttpDocStorage, g as ManualSyncDocOptions, h as PushOutcomeKind, i as MengineAckFailedError, j as MengineAuditEntry, k as MengineHttpRequestError, l as WaitForServerAckOptions, m as PushOutcome, o as MengineDocSyncState, p as MedeoHttpDocStorageOptions, s as MengineLocalSaveState, t as MemoryDocStorage, u as DocStorageLike, v as decodeDocVersionMark, w as PushResultKind, x as PullFailureReason, y as encodeDocVersionMark, z as MengineSseUpdateEvent } from "./index-Dpl4bT94.js";
|
|
4
|
+
import { n as MengineDocSessionUpdateEvent, r as ManualSyncDoc, t as MengineDocSession } from "./index-Cx5DojM1.js";
|
|
5
|
+
export { type AddDslClip, type AddDslClipsInput, type ApplyVoiceoverInput, type AudioScript, type AudioScriptView, type Caption, type CaptionContent, type CaptionDisplayCue, type CaptionSelection, type CaptionStyle, type CaptionText, type Clip, type ClipPlacement, type ClipSource, type CommitOptions, type ContainMutation, type ContainNode, type CreateMedeoDslOptions, DEFAULT_UNIT_TIME_MS, type DeepReadonly, type DocStorageLike, type DocVersionMark, type DslAudit, type DslClipLayout, type DslClipUpdate, type DslDiagnostic, DslEditor, type DslIdFactory, type DslLayout, type DslMutation, DslProjectionError, type DslTrackLayout, type DslTransaction, type EntityIdKind, type EntityMutation, type EntityTable, type EntityTables, type EntityValues, type FieldPatch, type FromVideoDraftOptions, type ImportedVideoDraft, type InvalidAtomic, ManualSyncDoc, type ManualSyncDocOptions, MedeoDsl, type MedeoDslDraft, type MedeoDslLoroState, type MedeoDslSnapshot, MedeoHttpDocStorage, type MedeoHttpDocStorageOptions, type Media, MemoryDocStorage, MengineAckFailedError, type MengineAuditEntry, type MengineAuditResponse, MengineDocSession, type MengineDocSessionOptions, type MengineDocSessionUpdateEvent, type MengineDocSyncState, type MengineDocumentVersion, type MengineDraftResponse, type MengineEventStreamOptions, MengineHttpClient, type MengineHttpClientOptions, MengineHttpRequestError, type MengineLocalSaveState, MenginePushRejectedError, type MenginePushResponse, type MenginePushUpdateResponse, type MengineRejectedResponse, type MengineSnapshotResponse, type MengineSseUpdateEvent, type MengineSyncResponse, type MengineUndoState, type MengineUpdateMeta, type MoveDslClipsInput, type OpActor, type PullFailureReason, type PullResult, type PushOutcome, type PushOutcomeKind, type PushResult, type PushResultKind, type RelationMutation, type RelationTable, type RelationTables, type RelationValues, type ReplaceDslClipsInput, type ResourceSystem, type RichTextSnapshot, type StoredFile, type TextDelta, type TextEdit, type TextMark, type TextMutation, type TextRun, type TimeAnchor, type Track, type TrackRole, UnsupportedDocumentFormatError, type UploadText, type VideoCreationSettings, type VideoDraft, type VideoDraftCaptionStyle, type VideoDraftContent, type VideoDraftContentPartUnion, type VideoDraftInput, type VideoDraftPartUnion, type VideoDraftProjection, type VideoDraftTimeline, type VideoDraftTrack, type VideoDraftTrackItem, type Voice, type VoiceoverCaptionInput, type VoiceoverResult, type WaitForLocalSaveOptions, type WaitForServerAckOptions, assertDslDocument, base64ToBytes, bytesToBase64, captionContentCodec, createInitialMedeoDsl, decodeDocVersionMark, defaultIdFactory, documentFormat, encodeDocVersionMark, fromVideoDraft, isInvalidAtomic, medeoDslLoroShape, readMengineEventStream, relationId, resolveDslLayout, resourceId, timeAnchorCodec, toAudioScriptViews, toVideoDraft, tupleHash };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as bytesToBase64, t as base64ToBytes } from "./base64-D-jd-dr5.js";
|
|
2
2
|
import { a as covers, c as readMengineEventStream, d as MenginePushRejectedError, i as openManualDocument, l as MengineHttpClient, n as MedeoHttpDocStorage, o as decodeDocVersionMark, r as ManualSyncTransport, s as encodeDocVersionMark, t as MemoryDocStorage, u as MengineHttpRequestError } from "./storage-BW3tI_ER.js";
|
|
3
|
-
import { a as documentFormat, c as isInvalidAtomic, ft as defaultIdFactory, ht as tupleHash, i as assertDslDocument, l as timeAnchorCodec, mt as resourceId, o as medeoDslLoroShape, pt as relationId, r as UnsupportedDocumentFormatError, s as captionContentCodec, t as DEFAULT_UNIT_TIME_MS } from "./video-draft-types-
|
|
4
|
-
import { a as
|
|
3
|
+
import { a as documentFormat, c as isInvalidAtomic, ft as defaultIdFactory, ht as tupleHash, i as assertDslDocument, l as timeAnchorCodec, mt as resourceId, o as medeoDslLoroShape, pt as relationId, r as UnsupportedDocumentFormatError, s as captionContentCodec, t as DEFAULT_UNIT_TIME_MS } from "./video-draft-types-Ce8NDenQ.js";
|
|
4
|
+
import { a as DslEditor, c as DslProjectionError, i as createInitialMedeoDsl, n as toVideoDraft, o as MedeoDsl, r as toAudioScriptViews, s as resolveDslLayout, t as fromVideoDraft } from "./dsl-DQ63zFgu.js";
|
|
5
5
|
import { UndoManager, VersionVector, decodeImportBlobMeta } from "loro-crdt";
|
|
6
6
|
import { ClientServerSynchronizer, DocManager } from "@mengine/sync";
|
|
7
7
|
import { DisposableSet, EventBus } from "@mengine/utils";
|
|
@@ -10,14 +10,15 @@ import { DisposableSet, EventBus } from "@mengine/utils";
|
|
|
10
10
|
var ManualSyncDoc = class ManualSyncDoc extends ManualSyncTransport {
|
|
11
11
|
dsl;
|
|
12
12
|
editor;
|
|
13
|
-
constructor(client, doc, watermark) {
|
|
13
|
+
constructor(client, doc, watermark, uploadText) {
|
|
14
14
|
super(client, doc, watermark);
|
|
15
15
|
assertDslDocument(doc);
|
|
16
16
|
this.dsl = new MedeoDsl(doc);
|
|
17
|
-
this.editor = new DslEditor(this.dsl);
|
|
17
|
+
this.editor = new DslEditor(this.dsl, void 0, uploadText);
|
|
18
18
|
}
|
|
19
|
+
/** `uploadText` stores raw content the editor writes, such as a PhoneticScript's text, in Memota. */
|
|
19
20
|
static open(options) {
|
|
20
|
-
return openManualDocument(options, (doc, watermark) => new ManualSyncDoc(options.client, doc, watermark));
|
|
21
|
+
return openManualDocument(options, (doc, watermark) => new ManualSyncDoc(options.client, doc, watermark, options.uploadText));
|
|
21
22
|
}
|
|
22
23
|
snapshot() {
|
|
23
24
|
this.assertActive();
|
|
@@ -623,6 +624,7 @@ function serverCovers(serverVV, target) {
|
|
|
623
624
|
//#region src/session/mengine-doc-session.ts
|
|
624
625
|
/** Default collaborative session: one DSL handle and one editor over the synchronized LoroDoc. */
|
|
625
626
|
var MengineDocSession = class extends DocumentSession {
|
|
627
|
+
/** `uploadText` stores raw content the editor writes, such as a PhoneticScript's text, in Memota. */
|
|
626
628
|
constructor(options) {
|
|
627
629
|
super(options, (doc, guard) => {
|
|
628
630
|
assertDslDocument(doc);
|
|
@@ -630,7 +632,7 @@ var MengineDocSession = class extends DocumentSession {
|
|
|
630
632
|
return {
|
|
631
633
|
doc,
|
|
632
634
|
document: dsl,
|
|
633
|
-
editor: new DslEditor(dsl),
|
|
635
|
+
editor: new DslEditor(dsl, void 0, options.uploadText),
|
|
634
636
|
snapshot: () => dsl.getSnapshot(),
|
|
635
637
|
subscribe: (listener) => dsl.subscribe(listener),
|
|
636
638
|
dispose: () => dsl.dispose()
|
|
@@ -643,6 +645,10 @@ var MengineDocSession = class extends DocumentSession {
|
|
|
643
645
|
projectVideoDraft() {
|
|
644
646
|
return toVideoDraft(this.snapshot());
|
|
645
647
|
}
|
|
648
|
+
/** The document's AudioScripts with what says and shows them; read from the same snapshot as the VideoDraft. */
|
|
649
|
+
projectAudioScripts() {
|
|
650
|
+
return toAudioScriptViews(this.snapshot());
|
|
651
|
+
}
|
|
646
652
|
};
|
|
647
653
|
//#endregion
|
|
648
|
-
export { DEFAULT_UNIT_TIME_MS, DslEditor, DslProjectionError, ManualSyncDoc, MedeoDsl, MedeoHttpDocStorage, MemoryDocStorage, MengineAckFailedError, MengineDocSession, MengineHttpClient, MengineHttpRequestError, MenginePushRejectedError, UnsupportedDocumentFormatError, assertDslDocument, base64ToBytes, bytesToBase64, captionContentCodec, createInitialMedeoDsl, decodeDocVersionMark, defaultIdFactory, documentFormat, encodeDocVersionMark, fromVideoDraft, isInvalidAtomic, medeoDslLoroShape, readMengineEventStream, relationId, resolveDslLayout, resourceId, timeAnchorCodec, toVideoDraft, tupleHash };
|
|
654
|
+
export { DEFAULT_UNIT_TIME_MS, DslEditor, DslProjectionError, ManualSyncDoc, MedeoDsl, MedeoHttpDocStorage, MemoryDocStorage, MengineAckFailedError, MengineDocSession, MengineHttpClient, MengineHttpRequestError, MenginePushRejectedError, UnsupportedDocumentFormatError, assertDslDocument, base64ToBytes, bytesToBase64, captionContentCodec, createInitialMedeoDsl, decodeDocVersionMark, defaultIdFactory, documentFormat, encodeDocVersionMark, fromVideoDraft, isInvalidAtomic, medeoDslLoroShape, readMengineEventStream, relationId, resolveDslLayout, resourceId, timeAnchorCodec, toAudioScriptViews, toVideoDraft, tupleHash };
|
package/dist/legacy.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as VideoDraft, l as VideoDraftPartUnion, o as VideoDraftContent, p as CommitOptions, t as CaptionDisplayCue } from "./video-draft-types-
|
|
2
|
-
import { A as MenginePushRejectedError, B as MengineSyncResponse, C as PushResult, D as MengineHttpClient, E as readMengineEventStream, F as MenginePushResponse, H as base64ToBytes, I as MenginePushUpdateResponse, L as MengineRejectedResponse, M as MengineAuditResponse, N as MengineDocumentVersion, O as MengineHttpClientOptions, P as MengineDraftResponse, R as MengineSnapshotResponse, S as PullResult, T as MengineEventStreamOptions, U as bytesToBase64, V as MengineUpdateMeta, _ as ManualSyncTransport, a as MengineDocSessionOptions, b as DocVersionMark, d as MengineUndoState, f as MedeoHttpDocStorage, g as ManualSyncDocOptions, h as PushOutcomeKind, j as MengineAuditEntry, k as MengineHttpRequestError, l as WaitForServerAckOptions, m as PushOutcome, o as MengineDocSyncState, p as MedeoHttpDocStorageOptions, t as MemoryDocStorage, u as DocStorageLike, v as decodeDocVersionMark, w as PushResultKind, x as PullFailureReason, y as encodeDocVersionMark, z as MengineSseUpdateEvent } from "./index-
|
|
1
|
+
import { i as VideoDraft, l as VideoDraftPartUnion, o as VideoDraftContent, p as CommitOptions, t as CaptionDisplayCue } from "./video-draft-types-Bq15tPBP.js";
|
|
2
|
+
import { A as MenginePushRejectedError, B as MengineSyncResponse, C as PushResult, D as MengineHttpClient, E as readMengineEventStream, F as MenginePushResponse, H as base64ToBytes, I as MenginePushUpdateResponse, L as MengineRejectedResponse, M as MengineAuditResponse, N as MengineDocumentVersion, O as MengineHttpClientOptions, P as MengineDraftResponse, R as MengineSnapshotResponse, S as PullResult, T as MengineEventStreamOptions, U as bytesToBase64, V as MengineUpdateMeta, _ as ManualSyncTransport, a as MengineDocSessionOptions, b as DocVersionMark, d as MengineUndoState, f as MedeoHttpDocStorage, g as ManualSyncDocOptions, h as PushOutcomeKind, j as MengineAuditEntry, k as MengineHttpRequestError, l as WaitForServerAckOptions, m as PushOutcome, o as MengineDocSyncState, p as MedeoHttpDocStorageOptions, t as MemoryDocStorage, u as DocStorageLike, v as decodeDocVersionMark, w as PushResultKind, x as PullFailureReason, y as encodeDocVersionMark, z as MengineSseUpdateEvent } from "./index-Dpl4bT94.js";
|
|
3
3
|
import { LoroDoc, PeerID } from "loro-crdt";
|
|
4
4
|
|
|
5
5
|
//#region ../medeo-dsl/depreacted/sandbox.d.ts
|
package/dist/legacy.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as bytesToBase64, t as base64ToBytes } from "./base64-D-jd-dr5.js";
|
|
2
2
|
import { c as readMengineEventStream, d as MenginePushRejectedError, i as openManualDocument, l as MengineHttpClient, n as MedeoHttpDocStorage, o as decodeDocVersionMark, r as ManualSyncTransport, s as encodeDocVersionMark, t as MemoryDocStorage, u as MengineHttpRequestError } from "./storage-BW3tI_ER.js";
|
|
3
|
-
import { a as documentFormat, r as UnsupportedDocumentFormatError, t as DEFAULT_UNIT_TIME_MS } from "./video-draft-types-
|
|
3
|
+
import { a as documentFormat, r as UnsupportedDocumentFormatError, t as DEFAULT_UNIT_TIME_MS } from "./video-draft-types-Ce8NDenQ.js";
|
|
4
4
|
import { u as volumeSchema } from "./shared-iWnU2osE.js";
|
|
5
5
|
import { sha256 } from "@noble/hashes/sha2.js";
|
|
6
6
|
import { LoroDoc, LoroMap, LoroMovableList, LoroText, UndoManager } from "loro-crdt";
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as VideoDraft } from "./video-draft-types-
|
|
2
|
-
import {
|
|
1
|
+
import { i as VideoDraft } from "./video-draft-types-Bq15tPBP.js";
|
|
2
|
+
import { b as MedeoDsl } from "./index-DHcMMn2M.js";
|
|
3
3
|
import { LoroDoc } from "loro-crdt";
|
|
4
4
|
|
|
5
5
|
//#region src/testing/in-memory-mengine-server.d.ts
|
package/dist/testing.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as bytesToBase64, t as base64ToBytes } from "./base64-D-jd-dr5.js";
|
|
2
|
-
import { a as documentFormat, i as assertDslDocument } from "./video-draft-types-
|
|
3
|
-
import { a as
|
|
2
|
+
import { a as documentFormat, i as assertDslDocument } from "./video-draft-types-Ce8NDenQ.js";
|
|
3
|
+
import { a as DslEditor, i as createInitialMedeoDsl, n as toVideoDraft, o as MedeoDsl } from "./dsl-DQ63zFgu.js";
|
|
4
4
|
import { t as classifyUpdate } from "./loro-relay-doc-Bi6JKqtQ.js";
|
|
5
5
|
import { LoroDoc, VersionVector, encodeFrontiers } from "loro-crdt";
|
|
6
6
|
//#region src/testing/in-memory-mengine-server.ts
|
|
@@ -90,8 +90,19 @@ interface Phoneme {
|
|
|
90
90
|
/** One whole script in the target TTS vocabulary, such as a `<speak>` document. */
|
|
91
91
|
phonemeScript?: string;
|
|
92
92
|
}
|
|
93
|
-
/** A
|
|
94
|
-
interface
|
|
93
|
+
/** A file Memota stored from raw content: how a Media File entity names it, and its digest. */
|
|
94
|
+
interface StoredFile {
|
|
95
|
+
system: 'memota';
|
|
96
|
+
key: string;
|
|
97
|
+
storageKey?: string;
|
|
98
|
+
digest: string;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* A variant of an AudioScript: the script it reads, plus how to pronounce it. It has the Media File
|
|
102
|
+
* trait (D178): its `phonemeScript` is raw content, stored in Memota as a text file whenever it is
|
|
103
|
+
* written, and the file's facts are kept beside it. Without a `phonemeScript` it has no file.
|
|
104
|
+
*/
|
|
105
|
+
interface PhoneticScript extends Partial<StoredFile> {
|
|
95
106
|
phoneme: Phoneme;
|
|
96
107
|
}
|
|
97
108
|
interface Voice {
|
|
@@ -116,9 +127,14 @@ interface RelationValues {
|
|
|
116
127
|
recordingId: string;
|
|
117
128
|
voiceId: string;
|
|
118
129
|
};
|
|
130
|
+
/**
|
|
131
|
+
* `sourceDigest`: the source's digest when the product was made from it (D177). A product whose
|
|
132
|
+
* source's digest differs now was made from content the source no longer has.
|
|
133
|
+
*/
|
|
119
134
|
'derived-from-relations': {
|
|
120
135
|
entityId: string;
|
|
121
136
|
sourceId: string;
|
|
137
|
+
sourceDigest?: string;
|
|
122
138
|
};
|
|
123
139
|
}
|
|
124
140
|
type EntityTable = keyof EntityValues;
|
|
@@ -802,4 +818,4 @@ type VideoDraftContent = Pick<VideoDraft, 'timeline' | 'main_track' | 'above_mai
|
|
|
802
818
|
type VideoDraftInput = Pick<VideoDraft, keyof VideoDraftContent>;
|
|
803
819
|
declare const DEFAULT_UNIT_TIME_MS = 33.333;
|
|
804
820
|
//#endregion
|
|
805
|
-
export {
|
|
821
|
+
export { Track$1 as $, DeepReadonly as A, RelationMutation as B, CaptionContent as C, Clip as D, CaptionText as E, EntityTables as F, RichTextSnapshot as G, RelationTables as H, EntityValues as I, TextEdit as J, StoredFile as K, FieldPatch as L, DslMutation as M, EntityMutation as N, ContainMutation as O, EntityTable as P, TimeAnchor as Q, MedeoDslSnapshot as R, Caption as S, CaptionStyle$1 as T, RelationValues as U, RelationTable as V, ResourceSystem as W, TextMutation as X, TextMark as Y, TextRun as Z, defaultIdFactory as _, VideoDraftCaptionStyle as a, tupleHash as b, VideoDraftInput as c, VideoDraftTrack as d, TrackRole as et, VideoDraftTrackItem as f, EntityIdKind as g, DslIdFactory as h, VideoDraft as i, DslDiagnostic as j, ContainNode as k, VideoDraftPartUnion as l, OpActor as m, DEFAULT_UNIT_TIME_MS as n, VideoDraftContent as o, CommitOptions as p, TextDelta as q, VideoCreationSettings as r, VideoDraftContentPartUnion as s, CaptionDisplayCue as t, Voice as tt, VideoDraftTimeline as u, relationId as v, CaptionSelection as w, AudioScript as x, resourceId as y, Media as z };
|
|
@@ -173,7 +173,13 @@ const entityFields = {
|
|
|
173
173
|
body: required(string),
|
|
174
174
|
defaultLanguage: optional$1(validLanguage)
|
|
175
175
|
},
|
|
176
|
-
"phonetic-script-entities": {
|
|
176
|
+
"phonetic-script-entities": {
|
|
177
|
+
phoneme: required(object(phonemeFields)),
|
|
178
|
+
system: optional$1(oneOf("memota")),
|
|
179
|
+
key: optional$1(nonempty),
|
|
180
|
+
storageKey: optional$1(nonempty),
|
|
181
|
+
digest: optional$1(nonempty)
|
|
182
|
+
},
|
|
177
183
|
"caption-entities": {
|
|
178
184
|
selection: optional$1(object(captionContentFields)),
|
|
179
185
|
text: optional$1(string),
|
|
@@ -202,12 +208,30 @@ const relationFields = {
|
|
|
202
208
|
},
|
|
203
209
|
"derived-from-relations": {
|
|
204
210
|
entityId: required(id),
|
|
205
|
-
sourceId: required(id)
|
|
211
|
+
sourceId: required(id),
|
|
212
|
+
sourceDigest: optional$1(nonempty)
|
|
206
213
|
}
|
|
207
214
|
};
|
|
208
215
|
const relationTables = Object.keys(relationFields);
|
|
216
|
+
const fileFields = [
|
|
217
|
+
"system",
|
|
218
|
+
"key",
|
|
219
|
+
"storageKey",
|
|
220
|
+
"digest"
|
|
221
|
+
];
|
|
222
|
+
const phonemeScriptOf = (row) => isRecord(row.phoneme) ? row.phoneme.phonemeScript : void 0;
|
|
223
|
+
/**
|
|
224
|
+
* A PhoneticScript's phonemeScript is raw content stored as its file when written (D178): with one,
|
|
225
|
+
* the row names that file by system and key and states its digest; without one it has no file.
|
|
226
|
+
*/
|
|
227
|
+
function assertPhoneticFile(row) {
|
|
228
|
+
if (phonemeScriptOf(row) === void 0) {
|
|
229
|
+
if (fileFields.some((field) => row[field] !== void 0)) throw new Error("A PhoneticScript without text has no file");
|
|
230
|
+
} else if (row.system === void 0 || row.key === void 0 || row.digest === void 0) throw new Error("A PhoneticScript stores its phonemeScript as a file: name it by system and key with its digest");
|
|
231
|
+
}
|
|
209
232
|
function assertEntity(table, value) {
|
|
210
233
|
checkFields(value, entityFields[table]);
|
|
234
|
+
if (table === "phonetic-script-entities") assertPhoneticFile(value);
|
|
211
235
|
if (table === "media-entities") {
|
|
212
236
|
if (value.kind === "image" && value.durationMs !== void 0) throw new Error("Image has no intrinsic duration");
|
|
213
237
|
if (value.kind !== "image" && !positive(value.durationMs)) throw new Error("Finite media requires durationMs");
|
|
@@ -225,6 +249,10 @@ function assertEntityPatch(table, patch, current) {
|
|
|
225
249
|
const field = entityFields[table][key];
|
|
226
250
|
if (!field || !field.optional && next[key] === void 0 || next[key] !== void 0 && !field.check(next[key])) throw new Error(`Invalid patch field: ${key}`);
|
|
227
251
|
}
|
|
252
|
+
if (table === "phonetic-script-entities" && ["phoneme", ...fileFields].some((field) => Object.hasOwn(patch, field))) {
|
|
253
|
+
assertPhoneticFile(next);
|
|
254
|
+
if (phonemeScriptOf(next) !== phonemeScriptOf(current) && next.digest !== void 0 && next.digest === current.digest) throw new Error("A rewritten phonemeScript is stored again: write its new file");
|
|
255
|
+
}
|
|
228
256
|
if (table === "media-entities" || table === "voice-entities") {
|
|
229
257
|
for (const key of [
|
|
230
258
|
"system",
|
|
@@ -1358,7 +1386,13 @@ const medeoDslLoroShape = schema({
|
|
|
1358
1386
|
body: schema.LoroText(),
|
|
1359
1387
|
defaultLanguage: schema.String(optional)
|
|
1360
1388
|
})),
|
|
1361
|
-
"phonetic-script-entities": schema.LoroMapRecord(schema.LoroMap({
|
|
1389
|
+
"phonetic-script-entities": schema.LoroMapRecord(schema.LoroMap({
|
|
1390
|
+
phoneme: atomicValue(phonemeCodec),
|
|
1391
|
+
system: schema.String(optional),
|
|
1392
|
+
key: schema.String(optional),
|
|
1393
|
+
storageKey: schema.String(optional),
|
|
1394
|
+
digest: schema.String(optional)
|
|
1395
|
+
})),
|
|
1362
1396
|
"caption-entities": schema.LoroMapRecord(schema.LoroMap({
|
|
1363
1397
|
selection: optionalAtomicValue(captionContentCodec),
|
|
1364
1398
|
text: schema.LoroText(optional),
|
|
@@ -1388,7 +1422,11 @@ const medeoDslLoroShape = schema({
|
|
|
1388
1422
|
}), mergeable),
|
|
1389
1423
|
"contain-relations": schema.LoroTree(schema.LoroMap({ entityId: schema.String() })),
|
|
1390
1424
|
"voice-timbre-relations": relation(["recordingId", "voiceId"]),
|
|
1391
|
-
"derived-from-relations":
|
|
1425
|
+
"derived-from-relations": schema.LoroMapRecord(schema.LoroMap({
|
|
1426
|
+
entityId: schema.String(),
|
|
1427
|
+
sourceId: schema.String(),
|
|
1428
|
+
sourceDigest: schema.String(optional)
|
|
1429
|
+
}), mergeable)
|
|
1392
1430
|
});
|
|
1393
1431
|
//#endregion
|
|
1394
1432
|
//#region ../medeo-dsl/src/schema/document-format.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mengine/medeo-client",
|
|
3
|
-
"version": "2.1.1-dsl.
|
|
3
|
+
"version": "2.1.1-dsl.5",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"@noble/hashes": "^2.4.0",
|
|
30
30
|
"immer": "^10.2.0",
|
|
31
31
|
"zod": "^4.4.3",
|
|
32
|
-
"@mengine/storage": "2.1.1-dsl.
|
|
33
|
-
"@mengine/
|
|
34
|
-
"@mengine/
|
|
32
|
+
"@mengine/storage": "2.1.1-dsl.5",
|
|
33
|
+
"@mengine/utils": "2.1.1-dsl.5",
|
|
34
|
+
"@mengine/sync": "2.1.1-dsl.5"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/node": "^25.9.1",
|