@mengine/medeo-tool 1.3.1-alpha.8 → 1.3.1-alpha.9
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/{entity-contract-Dm3AMEC9.d.mts → entity-contract-SQdOaLm-.d.mts} +2 -4
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +19 -15
- package/dist/index.mjs.map +1 -1
- package/dist/sandbox-api.d.mts +4 -3
- package/dist/{script-session-C2uQHYt4.mjs → script-session-B2UQ1W_y.mjs} +16 -23
- package/dist/{script-session-C2uQHYt4.mjs.map → script-session-B2UQ1W_y.mjs.map} +1 -1
- package/dist/worker-entry.d.mts +1 -1
- package/dist/worker-entry.mjs +4 -3
- package/dist/worker-entry.mjs.map +1 -1
- package/package.json +2 -2
package/dist/sandbox-api.d.mts
CHANGED
|
@@ -192,6 +192,7 @@ interface EntityPayloadByKind {
|
|
|
192
192
|
}
|
|
193
193
|
interface EntityStoreSnapshot {
|
|
194
194
|
revision: number;
|
|
195
|
+
/** Fixed identity outlet of the project's one AudioScript; null only before initialization (revision 0). */
|
|
195
196
|
audioScriptEntityId: string | null;
|
|
196
197
|
entities: SandboxEntity[];
|
|
197
198
|
relations: SandboxRelation[];
|
|
@@ -549,8 +550,6 @@ interface VoiceoverTakeResult {
|
|
|
549
550
|
}
|
|
550
551
|
/** Timeline writes accept existing media Entity ids, never Memota asset ids or URLs. */
|
|
551
552
|
interface EditApi {
|
|
552
|
-
/** Select the document AudioScript, or clear the optional association with null. */
|
|
553
|
-
setDocumentAudioScript(entityId: string | null): void;
|
|
554
553
|
insertClip(input: InsertClipInput): ClipEntityId;
|
|
555
554
|
insertPlacedClip(input: InsertPlacedClipInput): ClipEntityId;
|
|
556
555
|
updateClipMarker(input: UpdateClipMarkerInput): void;
|
|
@@ -579,7 +578,9 @@ interface EditApi {
|
|
|
579
578
|
insertCaptionClip(input: InsertCaptionClipInput): ClipEntityId;
|
|
580
579
|
}
|
|
581
580
|
interface TimelineApi {
|
|
582
|
-
snapshot(): EntityStoreSnapshot
|
|
581
|
+
snapshot(): EntityStoreSnapshot & {
|
|
582
|
+
audioScriptEntityId: string;
|
|
583
|
+
};
|
|
583
584
|
}
|
|
584
585
|
interface SandboxCheckpoint {
|
|
585
586
|
readonly index: number;
|
|
@@ -1560,16 +1560,11 @@ var EntitySandbox = class {
|
|
|
1560
1560
|
ensureFoundation(timelinePayload = {}) {
|
|
1561
1561
|
const foundation = ensureEditorFoundation(toDslRows(this.state), this.idFactory, timelinePayload);
|
|
1562
1562
|
this.appendResourceRows(foundation.rows);
|
|
1563
|
+
if (this.state.audioScriptEntityId === null) this.state.audioScriptEntityId = foundation.audioScriptEntityId;
|
|
1563
1564
|
}
|
|
1564
1565
|
get audioScriptEntityId() {
|
|
1565
1566
|
return this.state.audioScriptEntityId;
|
|
1566
1567
|
}
|
|
1567
|
-
setDocumentAudioScript(audioScriptEntityId) {
|
|
1568
|
-
this.record({
|
|
1569
|
-
kind: "set-document-audio-script",
|
|
1570
|
-
audioScriptEntityId
|
|
1571
|
-
});
|
|
1572
|
-
}
|
|
1573
1568
|
rollbackTo(index) {
|
|
1574
1569
|
if (!Number.isInteger(index) || index < 0 || index > this.commands.length) throw new Error(`rollbackTo: entity checkpoint index ${index} is past journal length ${this.commands.length}`);
|
|
1575
1570
|
const prefix = this.commands.slice(0, index);
|
|
@@ -1582,11 +1577,13 @@ var EntitySandbox = class {
|
|
|
1582
1577
|
buildPlan() {
|
|
1583
1578
|
const rows = toDslRows(this.state);
|
|
1584
1579
|
decodeEntityRelationRows(rows, numericMarkerComparators);
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1580
|
+
if (this.state.revision !== 0 || rows.entities.length !== 0 || this.commands.length !== 0) {
|
|
1581
|
+
assertCanonicalEditorResources(rows);
|
|
1582
|
+
readDocumentAudioScript({
|
|
1583
|
+
rows,
|
|
1584
|
+
audioScriptEntityId: this.state.audioScriptEntityId
|
|
1585
|
+
});
|
|
1586
|
+
}
|
|
1590
1587
|
const currentEntityIds = new Set(this.state.entities.map((entity) => entity.entity_id));
|
|
1591
1588
|
const currentRelationIds = new Set(this.state.relations.map((relation) => relation.relation_id));
|
|
1592
1589
|
return {
|
|
@@ -1600,9 +1597,6 @@ var EntitySandbox = class {
|
|
|
1600
1597
|
renderPreview() {
|
|
1601
1598
|
const lines = [`Entity plan: base_revision=${this.original.revision} commands=${this.commands.length} entities=${this.state.entities.length} relations=${this.state.relations.length}`];
|
|
1602
1599
|
for (const command of this.commands) switch (command.kind) {
|
|
1603
|
-
case "set-document-audio-script":
|
|
1604
|
-
lines.push(`~ document audioScriptEntityId=${command.audioScriptEntityId}`);
|
|
1605
|
-
break;
|
|
1606
1600
|
case "create-entity":
|
|
1607
1601
|
lines.push(`+ entity ${command.entity.entity_id} kind=${command.entity.entity_kind}`);
|
|
1608
1602
|
break;
|
|
@@ -1722,6 +1716,10 @@ var EntitySandbox = class {
|
|
|
1722
1716
|
}
|
|
1723
1717
|
const entityId = input.entity_id ?? this.idFactory("entity");
|
|
1724
1718
|
assertTrimmed(entityId, "entity_id");
|
|
1719
|
+
if (input.entity_kind === "audio-script") {
|
|
1720
|
+
const existing = this.state.entities.find((entity) => entity.entity_kind === "audio-script");
|
|
1721
|
+
if (existing !== void 0 && existing.entity_id !== entityId) throw new Error(`Editor requires exactly one AudioScript; edit ${existing.entity_id} instead of creating ${entityId}`);
|
|
1722
|
+
}
|
|
1725
1723
|
const entity = {
|
|
1726
1724
|
entity_id: entityId,
|
|
1727
1725
|
entity_kind: input.entity_kind,
|
|
@@ -1949,18 +1947,13 @@ var EntitySandbox = class {
|
|
|
1949
1947
|
}
|
|
1950
1948
|
apply(command, enforceIdentity) {
|
|
1951
1949
|
switch (command.kind) {
|
|
1952
|
-
case "set-document-audio-script":
|
|
1953
|
-
readDocumentAudioScript({
|
|
1954
|
-
rows: toDslRows(this.state),
|
|
1955
|
-
audioScriptEntityId: command.audioScriptEntityId
|
|
1956
|
-
});
|
|
1957
|
-
this.state.audioScriptEntityId = command.audioScriptEntityId;
|
|
1958
|
-
return;
|
|
1959
1950
|
case "create-entity": {
|
|
1951
|
+
if (command.entity.entity_kind === "audio-script" && this.state.entities.some((entity) => entity.entity_kind === "audio-script")) throw new Error("The project AudioScript already exists; edit its segments instead");
|
|
1960
1952
|
if (enforceIdentity && this.state.entities.some((entity) => entity.entity_id === command.entity.entity_id)) throw new Error(`Entity id "${command.entity.entity_id}" already exists`);
|
|
1961
1953
|
const original = this.original.entities.find((entity) => entity.entity_id === command.entity.entity_id);
|
|
1962
1954
|
if (enforceIdentity && original != null && original.entity_kind !== command.entity.entity_kind) throw new Error(`Entity id "${command.entity.entity_id}" was originally kind "${original.entity_kind}" and cannot be recreated as "${command.entity.entity_kind}"`);
|
|
1963
1955
|
this.state.entities.push(clone(command.entity));
|
|
1956
|
+
if (command.entity.entity_kind === "audio-script" && this.state.audioScriptEntityId === null) this.state.audioScriptEntityId = command.entity.entity_id;
|
|
1964
1957
|
return;
|
|
1965
1958
|
}
|
|
1966
1959
|
case "update-entity": {
|
|
@@ -1975,7 +1968,7 @@ var EntitySandbox = class {
|
|
|
1975
1968
|
return;
|
|
1976
1969
|
}
|
|
1977
1970
|
case "delete-entity": {
|
|
1978
|
-
if (this.state.
|
|
1971
|
+
if (this.state.entities.find((entity) => entity.entity_id === command.entity_id)?.entity_kind === "audio-script") throw new Error("The document AudioScript is a fixed project identity and cannot be deleted");
|
|
1979
1972
|
const index = this.state.entities.findIndex((entity) => entity.entity_id === command.entity_id);
|
|
1980
1973
|
if (index < 0) throw new Error(`Entity id "${command.entity_id}" does not exist`);
|
|
1981
1974
|
const incidentRelationIds = this.state.relations.filter((relation) => relation.endpoint_0_entity_id === command.entity_id || relation.endpoint_1_entity_id === command.entity_id).map((relation) => relation.relation_id).sort();
|
|
@@ -2395,4 +2388,4 @@ function replayJournalSync(adapter, journal) {
|
|
|
2395
2388
|
//#endregion
|
|
2396
2389
|
export { createRelationId as a, renderPreview as c, createEntityId as i, renderCompactProjection as l, EntitySandbox as n, isMediaAssetVariantKind as o, toDslRows as r, collectAffectedPartIds as s, EditSandboxSession as t };
|
|
2397
2390
|
|
|
2398
|
-
//# sourceMappingURL=script-session-
|
|
2391
|
+
//# sourceMappingURL=script-session-B2UQ1W_y.mjs.map
|