@mengine/medeo-tool 1.3.1-alpha.6 → 1.3.1-alpha.8

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.
@@ -139,6 +139,7 @@ interface SandboxRelation {
139
139
  }
140
140
  interface EntityStoreSnapshot {
141
141
  revision: number;
142
+ audioScriptEntityId: string | null;
142
143
  entities: SandboxEntity[];
143
144
  relations: SandboxRelation[];
144
145
  }
@@ -205,6 +206,9 @@ interface UnlinkRelationInput {
205
206
  relation_id: string;
206
207
  }
207
208
  type EntityCommand = {
209
+ kind: 'set-document-audio-script';
210
+ audioScriptEntityId: string | null;
211
+ } | {
208
212
  kind: 'create-entity';
209
213
  entity: SandboxEntity;
210
214
  } | {
@@ -269,4 +273,4 @@ interface RelationFacade {
269
273
  }
270
274
  //#endregion
271
275
  export { SandboxEntity as _, EntityFacade as a, UpdateEntityInput as b, JsonObject as c, KnownEntityKind as d, KnownRelationKind as f, ResourceEntityKind as g, RelationFacade as h, EntityCommand as i, JsonPrimitive as l, LinkRelationInput as m, CreateEntityInput as n, EntityPlanState as o, LinkGeneratedRelationInput as p, DeleteEntityInput as r, EntityStoreSnapshot as s, AuthorableRelationKind as t, JsonValue as u, SandboxRelation as v, UnlinkRelationInput as y };
272
- //# sourceMappingURL=entity-contract-hKZbJSRP.d.mts.map
276
+ //# sourceMappingURL=entity-contract-Dm3AMEC9.d.mts.map
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { _ as SandboxEntity, a as EntityFacade, b as UpdateEntityInput, c as JsonObject, d as KnownEntityKind, f as KnownRelationKind, g as ResourceEntityKind, h as RelationFacade, i as EntityCommand, l as JsonPrimitive, m as LinkRelationInput, n as CreateEntityInput, o as EntityPlanState, p as LinkGeneratedRelationInput, r as DeleteEntityInput, s as EntityStoreSnapshot, t as AuthorableRelationKind, u as JsonValue, v as SandboxRelation, y as UnlinkRelationInput } from "./entity-contract-hKZbJSRP.mjs";
1
+ import { _ as SandboxEntity, a as EntityFacade, b as UpdateEntityInput, c as JsonObject, d as KnownEntityKind, f as KnownRelationKind, g as ResourceEntityKind, h as RelationFacade, i as EntityCommand, l as JsonPrimitive, m as LinkRelationInput, n as CreateEntityInput, o as EntityPlanState, p as LinkGeneratedRelationInput, r as DeleteEntityInput, s as EntityStoreSnapshot, t as AuthorableRelationKind, u as JsonValue, v as SandboxRelation, y as UnlinkRelationInput } from "./entity-contract-Dm3AMEC9.mjs";
2
2
  import { JournalEntry, ManualSyncDoc, MediaAssetFact, PartIdFactory, SemanticOpName, VideoDocument, VideoDraft, fromVideoDocument } from "@mengine/medeo-client";
3
3
  import { AddSpeechesInput, AddVideoClipsInput, AdjustBgmVolumeInput, AdjustSpeechVolumeInput, AdjustVideoClipDurationInput, AdjustVideoClipVolumeInput, ChangeSpeechScriptInput, ChangeSpeechVoiceInput, DeleteBgmInput, DeleteSpeechesInput, DeleteVideoClipsInput, MoveSpeechesInput, MoveVideoClipsByAnchorInput, MoveVideoClipsInput, ReplaceVideoClipContentInput, ReplaceVideoClipSequenceInput, SetBgmInput, SetCaptionStyleInput, SetCaptionVisibilityInput, SetVideoClipSpeedShiftInput } from "@mengine/medeo-client/schemas";
4
4
 
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { c as renderPreview, l as renderCompactProjection, n as EntitySandbox, o as isMediaAssetVariantKind, r as toDslRows, s as collectAffectedPartIds, t as EditSandboxSession } from "./script-session-1eqBGegp.mjs";
1
+ import { c as renderPreview, l as renderCompactProjection, n as EntitySandbox, o as isMediaAssetVariantKind, r as toDslRows, s as collectAffectedPartIds, t as EditSandboxSession } from "./script-session-C2uQHYt4.mjs";
2
2
  import { EntityGraphHttpClient, ManualSyncDoc, MengineHttpClient, MengineHttpRequestError, ValidationError, createMirrorVideoDocument, createPlainMemoryAdapter, decodeDocVersionMark, encodeDocVersionMark, migrateLegacyTimelineToEntities, replayJournal, toVideoDocument } from "@mengine/medeo-client";
3
3
  import { Worker } from "node:worker_threads";
4
4
  import { randomUUID } from "node:crypto";
@@ -242,6 +242,7 @@ var EntityHttpClient = class {
242
242
  method: "POST",
243
243
  body: JSON.stringify({
244
244
  expected_revision: expectedRevision,
245
+ audio_script_entity_id: state.audioScriptEntityId,
245
246
  rows: {
246
247
  entities: state.entities,
247
248
  relations: state.relations
@@ -279,9 +280,12 @@ function toSnapshot(value, expectedDocId) {
279
280
  if (!isRecord$2(value) || typeof value.doc_id !== "string" || !isNonNegativeInteger(value.revision)) throw new Error("invalid entity-state response envelope");
280
281
  if (value.doc_id !== expectedDocId) throw new Error(`entity-state response doc_id mismatch: expected "${expectedDocId}"`);
281
282
  if (!isRecord$2(value.rows) || !Array.isArray(value.rows.entities) || !Array.isArray(value.rows.relations)) throw new Error("invalid entity-state response rows");
283
+ if (value.audio_script_entity_id !== null && !isTrimmed(value.audio_script_entity_id)) throw new Error("invalid document AudioScript association");
282
284
  const response = value;
285
+ if (response.audio_script_entity_id !== null && !response.rows.entities.some((entity) => entity.entity_id === response.audio_script_entity_id && entity.entity_kind === "audio-script")) throw new Error("Document AudioScript must name an AudioScript in this document");
283
286
  return {
284
287
  revision: response.revision,
288
+ audioScriptEntityId: response.audio_script_entity_id,
285
289
  entities: response.rows.entities.map(parseEntity),
286
290
  relations: response.rows.relations.map(parseRelation)
287
291
  };
@@ -790,6 +794,7 @@ const ENTITY_EDIT_SANDBOX_API_DTS = [
790
794
  "}",
791
795
  "export interface EntityStoreSnapshot {",
792
796
  " revision: number;",
797
+ " audioScriptEntityId: string | null;",
793
798
  " entities: SandboxEntity[];",
794
799
  " relations: SandboxRelation[];",
795
800
  "}",
@@ -1191,6 +1196,8 @@ const ENTITY_EDIT_SANDBOX_API_DTS = [
1191
1196
  "}",
1192
1197
  "/** Timeline writes accept existing media Entity ids, never Memota asset ids or URLs. */",
1193
1198
  "export interface EditApi {",
1199
+ " /** Select the document AudioScript, or clear the optional association with null. */",
1200
+ " setDocumentAudioScript(entityId: string | null): void;",
1194
1201
  " insertClip(input: InsertClipInput): ClipEntityId;",
1195
1202
  " insertPlacedClip(input: InsertPlacedClipInput): ClipEntityId;",
1196
1203
  " updateClipMarker(input: UpdateClipMarkerInput): void;",
@@ -1614,7 +1621,7 @@ function renderEntitySnapshot(state) {
1614
1621
  const rows = [...state.entities.map((entity) => JSON.stringify(entity)), ...state.relations.map((relation) => JSON.stringify(relation))];
1615
1622
  const shown = rows.slice(0, 200);
1616
1623
  return [
1617
- `Entity revision=${state.revision} entities=${state.entities.length} relations=${state.relations.length}`,
1624
+ `Entity revision=${state.revision} audioScriptEntityId=${JSON.stringify(state.audioScriptEntityId)} entities=${state.entities.length} relations=${state.relations.length}`,
1618
1625
  ...shown,
1619
1626
  ...shown.length < rows.length ? ["[truncated; inspect entities/relations in the sandbox]"] : []
1620
1627
  ].join("\n");
@@ -1706,6 +1713,7 @@ function commitWarnings(result) {
1706
1713
  }
1707
1714
  function entityRowsEquivalent(left, right) {
1708
1715
  const normalize = (state) => ({
1716
+ audioScriptEntityId: state.audioScriptEntityId,
1709
1717
  entities: [...state.entities].sort((a, b) => a.entity_id.localeCompare(b.entity_id)).map((entity) => canonicalJson(entity)),
1710
1718
  relations: [...state.relations].sort((a, b) => a.relation_id.localeCompare(b.relation_id)).map((relation) => canonicalJson(relation))
1711
1719
  });
@@ -1915,6 +1923,7 @@ function createMedeoTool(options) {
1915
1923
  try {
1916
1924
  await getGraphClient(docId).commit({
1917
1925
  revision: state.revision,
1926
+ audioScriptEntityId: state.audioScriptEntityId,
1918
1927
  rows: baseRows
1919
1928
  }, migrated, { migrationBaseVv: encodeDocVersionMark(doc.versionMark()) });
1920
1929
  } catch (error) {