@mengine/medeo-client 2.1.1-dsl.2 → 2.1.1-dsl.20

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/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-c_shaRyq.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-D-3rdfUP.js";
1
+ import { i as VideoDraft, l as VideoDraftPartUnion, o as VideoDraftContent, p as CommitOptions, t as CaptionDisplayCue } from "./video-draft-types-BOdawmig.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-CwZ0zt-E.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-TXRv3wS6.js";
3
+ import { a as documentFormat, r as UnsupportedDocumentFormatError, t as DEFAULT_UNIT_TIME_MS } from "./video-draft-types-DKo53mZ8.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-c_shaRyq.js";
2
- import { _ as MedeoDsl } from "./index-Cu7SdKN5.js";
1
+ import { i as VideoDraft } from "./video-draft-types-BOdawmig.js";
2
+ import { b as MedeoDsl } from "./index-CTai9I2R.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-TXRv3wS6.js";
3
- import { a as MedeoDsl, i as DslEditor, n as toVideoDraft, r as createInitialMedeoDsl } from "./dsl-EV6kCdr6.js";
2
+ import { a as documentFormat, i as assertDslDocument } from "./video-draft-types-DKo53mZ8.js";
3
+ import { i as DslEditor, n as toVideoDraft, o as MedeoDsl, r as createInitialMedeoDsl } from "./dsl-wdel0lX7.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
@@ -450,7 +450,7 @@ function createTestDsl(options = {}) {
450
450
  durationMs: 1e3,
451
451
  storageKey: "speech.mp3"
452
452
  },
453
- script: { body: "hello" },
453
+ script: { segments: ["hello"] },
454
454
  volume: 1,
455
455
  voice: {
456
456
  system: "voice-library",
@@ -466,10 +466,7 @@ function createTestDsl(options = {}) {
466
466
  clipId: "caption",
467
467
  startMs: 0,
468
468
  durationMs: 1e3,
469
- range: {
470
- start: 0,
471
- end: 5
472
- },
469
+ segment: 0,
473
470
  style: {}
474
471
  }]
475
472
  });
@@ -17,9 +17,24 @@ interface SeqMarker {
17
17
  rate?: number;
18
18
  fillTimeline?: true;
19
19
  }
20
+ /**
21
+ * Where a Clip starts: at an absolute time on the Timeline, or following another Clip. No anchor
22
+ * means it plays in Tree order. One value, so concurrent placements keep one whole placement.
23
+ */
24
+ interface TimeAnchor {
25
+ /** The Timeline (absolute) or another Clip (following). */
26
+ to: string;
27
+ offsetMs: number;
28
+ /** The absolute start recorded by the placement edit; used when the anchor cannot be solved. */
29
+ fallback_abs_ms: number;
30
+ }
31
+ /** A Clip's single-valued relations are fields of its own row: its content and its time anchor. */
20
32
  interface Clip {
21
33
  seqMarker: SeqMarker;
22
34
  volume?: number;
35
+ /** The media or Caption this use plays. */
36
+ source: string;
37
+ anchor?: TimeAnchor;
23
38
  }
24
39
  interface MediaLocator {
25
40
  system: ResourceSystem;
@@ -38,8 +53,23 @@ type Media = MediaLocator & ({
38
53
  kind: 'image';
39
54
  storageKey?: string;
40
55
  });
41
- interface AudioScript {
42
- body: string;
56
+ /** One segment of a script: its own text, and the id a Caption or PhoneticScript names it by. */
57
+ interface AudioScriptSegment {
58
+ id: string;
59
+ text: string;
60
+ /**
61
+ * Where these words were spoken in the medium the script was read off, as the transcription
62
+ * file it names gave them (D186). Only a transcript's segments state it, both ends together.
63
+ */
64
+ startMs?: number;
65
+ endMs?: number;
66
+ }
67
+ /**
68
+ * A script is segmented text: its segments in order (D181). A transcript names the transcription
69
+ * file its words and times were read from (D186); a written script names none.
70
+ */
71
+ interface AudioScript extends Partial<StoredFile> {
72
+ segments: AudioScriptSegment[];
43
73
  defaultLanguage?: string;
44
74
  }
45
75
  interface CaptionStyle$1 {
@@ -57,21 +87,49 @@ interface CaptionStyle$1 {
57
87
  positionX?: number;
58
88
  positionY?: number;
59
89
  }
90
+ /**
91
+ * What a Caption shows or a PhoneticScript is written for: one segment of a script, or a run inside
92
+ * it (D181). The run's ends are Cursors on that segment's Text, so they follow its edits; without
93
+ * them the whole segment is meant, whatever it comes to say. One value: taken or replaced whole.
94
+ */
95
+ interface SegmentSelection {
96
+ audioScriptId: string;
97
+ segmentId: string;
98
+ start?: Cursor;
99
+ end?: Cursor;
100
+ }
101
+ type CaptionContent = SegmentSelection;
102
+ /** Words come from a selected run of a script or from the Caption's own text, never both. */
60
103
  interface Caption {
104
+ selection?: CaptionContent;
61
105
  text?: string;
62
106
  style?: CaptionStyle$1;
63
107
  }
108
+ /** The segment a PhoneticScript is written for, selected as a Caption selects one, and its pronunciation. */
109
+ interface Phoneme extends SegmentSelection {
110
+ /** What the voice synthesizes for that selection, written in what the voice accepts. */
111
+ phonemeScript?: string;
112
+ }
113
+ /** A file Memota stored from raw content: how a Media File entity names it, and its digest. */
114
+ interface StoredFile {
115
+ system: 'memota';
116
+ key: string;
117
+ storageKey?: string;
118
+ digest: string;
119
+ }
120
+ /**
121
+ * A variant of an AudioScript: the segment it is written for, plus what to synthesize. It has the Media File
122
+ * trait (D178): its `phonemeScript` is raw content, stored in Memota as a text file whenever it is
123
+ * written, and the file's facts are kept beside it. Without a `phonemeScript` it has no file.
124
+ */
125
+ interface PhoneticScript extends Partial<StoredFile> {
126
+ phoneme: Phoneme;
127
+ }
64
128
  interface Voice {
65
129
  system: 'voice-library';
66
130
  key: string;
67
131
  name?: string;
68
132
  }
69
- interface Asset {
70
- system: ResourceSystem;
71
- key: string;
72
- storageKey?: string;
73
- digest?: string;
74
- }
75
133
  /** Table keys carry entity identity; values never duplicate an id or a single-table kind. */
76
134
  interface EntityValues {
77
135
  'timeline-entities': Record<string, never>;
@@ -79,52 +137,32 @@ interface EntityValues {
79
137
  'clip-entities': Clip;
80
138
  'media-entities': Media;
81
139
  'audio-script-entities': AudioScript;
140
+ 'phonetic-script-entities': PhoneticScript;
82
141
  'caption-entities': Caption;
83
142
  'voice-entities': Voice;
84
- 'asset-entities': Asset;
85
- }
86
- interface TimeAnchor {
87
- from: string;
88
- to: string;
89
- offsetMs: number;
90
- fallback_abs_ms: number;
91
- }
92
- interface CaptionContent {
93
- captionId: string;
94
- audioScriptId: string;
95
- start: Cursor;
96
- end: Cursor;
97
143
  }
144
+ /** Only relations an entity may hold many of have tables; single-valued ones are fields of their owner. */
98
145
  interface RelationValues {
99
- 'clip-source-relations': {
100
- clipId: string;
101
- sourceId: string;
102
- };
103
- 'time-anchor-relations': TimeAnchor;
104
- 'caption-content-relations': CaptionContent;
105
- 'caption-alignment-relations': {
106
- captionId: string;
107
- mediaId: string;
108
- startMs: number;
109
- endMs: number;
110
- };
111
146
  'voice-timbre-relations': {
112
147
  recordingId: string;
113
148
  voiceId: string;
114
149
  };
150
+ /**
151
+ * `sourceDigest`: the source's digest when the product was made from it (D177). A product whose
152
+ * source's digest differs now was made from content the source no longer has.
153
+ */
115
154
  'derived-from-relations': {
116
155
  entityId: string;
117
156
  sourceId: string;
118
- };
119
- 'from-asset-relations': {
120
- audioScriptId: string;
121
- assetId: string;
122
- };
123
- 'to-asset-relations': {
124
- audioScriptId: string;
125
- assetId: string;
157
+ sourceDigest?: string;
126
158
  };
127
159
  }
160
+ /** What a create states: a PhoneticScript's phoneme may follow by set-phoneme in the same write. */
161
+ type EntityInput = Omit<EntityValues, 'phonetic-script-entities'> & {
162
+ 'phonetic-script-entities': Omit<PhoneticScript, 'phoneme'> & {
163
+ phoneme?: Phoneme;
164
+ };
165
+ };
128
166
  type EntityTable = keyof EntityValues;
129
167
  type RelationTable = keyof RelationValues;
130
168
  type EntityTables = { [K in EntityTable]: Record<string, EntityValues[K]> };
@@ -134,7 +172,7 @@ type EntityMutation = { [K in EntityTable]: {
134
172
  type: 'create-entity';
135
173
  table: K;
136
174
  id: string;
137
- value: EntityValues[K];
175
+ value: EntityInput[K];
138
176
  } | {
139
177
  type: 'patch-entity';
140
178
  table: K;
@@ -168,12 +206,39 @@ type ContainMutation = {
168
206
  type: 'delete-node';
169
207
  entityId: string;
170
208
  };
171
- interface CaptionSelection {
172
- captionId: string;
209
+ /** A segment, or a run of it in UTF-16 offsets of its current text, as a write states it. */
210
+ interface SegmentRange {
173
211
  audioScriptId: string;
174
- start: number;
175
- end: number;
212
+ segmentId: string;
213
+ start?: number;
214
+ end?: number;
215
+ }
216
+ interface CaptionSelection extends SegmentRange {
217
+ captionId: string;
218
+ }
219
+ interface PhonemeSelection extends SegmentRange {
220
+ phoneticScriptId: string;
221
+ phonemeScript?: string;
176
222
  }
223
+ /** A script's segments are added, moved and removed by id; their text is edited in place. */
224
+ type SegmentMutation = {
225
+ type: 'insert-segment';
226
+ audioScriptId: string;
227
+ segmentId: string;
228
+ index?: number;
229
+ text: string;
230
+ startMs?: number;
231
+ endMs?: number;
232
+ } | {
233
+ type: 'move-segment';
234
+ audioScriptId: string;
235
+ segmentId: string;
236
+ index: number;
237
+ } | {
238
+ type: 'delete-segment';
239
+ audioScriptId: string;
240
+ segmentId: string;
241
+ };
177
242
  type TextMutation = {
178
243
  type: 'edit-caption-text';
179
244
  captionId: string;
@@ -182,12 +247,15 @@ type TextMutation = {
182
247
  } | {
183
248
  type: 'edit-text';
184
249
  audioScriptId: string;
250
+ segmentId: string;
185
251
  expectedBodyId?: string;
186
252
  edits: readonly TextEdit[];
187
253
  } | ({
188
254
  type: 'set-caption-content';
189
- } & CaptionSelection);
190
- type DslMutation = EntityMutation | RelationMutation | ContainMutation | TextMutation;
255
+ } & CaptionSelection) | ({
256
+ type: 'set-phoneme';
257
+ } & PhonemeSelection);
258
+ type DslMutation = EntityMutation | RelationMutation | ContainMutation | SegmentMutation | TextMutation;
191
259
  interface ContainNode {
192
260
  treeId: TreeID;
193
261
  entityId: string;
@@ -207,6 +275,7 @@ interface RichTextSnapshot {
207
275
  plainText: string;
208
276
  delta: TextRun[];
209
277
  }
278
+ /** Selected text, with its UTF-16 range in the Text it lies in: the segment's, or a Caption's own. */
210
279
  interface CaptionText {
211
280
  text: string;
212
281
  start: number;
@@ -215,12 +284,13 @@ interface CaptionText {
215
284
  }
216
285
  type DeepReadonly<T> = T extends Cursor ? T : T extends object ? { readonly [K in keyof T]: DeepReadonly<T[K]> } : T;
217
286
  type MedeoDslSnapshot = DeepReadonly<EntityTables & RelationTables & {
218
- 'contain-relations': ContainNode[];
287
+ 'contain-relations': ContainNode[]; /** A Caption's own text by the Caption's id, and each script segment's text by the segment's id. */
219
288
  richText: Record<string, RichTextSnapshot>;
220
- captionText: Record<string, CaptionText>;
289
+ captionText: Record<string, CaptionText>; /** What each PhoneticScript's selection holds now, resolved as a Caption's is. */
290
+ phoneticText: Record<string, CaptionText>;
221
291
  diagnostics: DslDiagnostic[];
222
292
  }>;
223
- type TextMark = 'language' | 'pauseMs';
293
+ type TextMark = 'language';
224
294
  type TextEdit = {
225
295
  type: 'insert';
226
296
  at: number;
@@ -234,7 +304,7 @@ type TextEdit = {
234
304
  start: number;
235
305
  end: number;
236
306
  key: TextMark;
237
- value: string | number;
307
+ value: string;
238
308
  } | {
239
309
  type: 'unmark';
240
310
  start: number;
@@ -256,9 +326,10 @@ type TextDelta = {
256
326
  //#endregion
257
327
  //#region ../medeo-dsl/src/ids.d.ts
258
328
  declare function tupleHash(tuple: readonly string[]): string;
259
- declare function resourceId(kind: 'media' | 'voice' | 'asset', system: string, key: string): string;
329
+ declare function resourceId(kind: 'media' | 'voice', system: string, key: string): string;
260
330
  declare function relationId<K extends RelationTable>(table: K, value: RelationValues[K]): string;
261
- type EntityIdKind = 'timeline' | 'track' | 'clip' | 'audio-script' | 'caption';
331
+ /** Kinds of id a document mints: its entities', and a script segment's. */
332
+ type EntityIdKind = 'timeline' | 'track' | 'clip' | 'audio-script' | 'segment' | 'phonetic-script' | 'caption';
262
333
  type DslIdFactory = (kind: EntityIdKind) => string;
263
334
  declare const defaultIdFactory: DslIdFactory;
264
335
  //#endregion
@@ -806,4 +877,4 @@ type VideoDraftContent = Pick<VideoDraft, 'timeline' | 'main_track' | 'above_mai
806
877
  type VideoDraftInput = Pick<VideoDraft, keyof VideoDraftContent>;
807
878
  declare const DEFAULT_UNIT_TIME_MS = 33.333;
808
879
  //#endregion
809
- export { Track$1 as $, ContainNode as A, Media as B, Caption as C, CaptionText as D, CaptionStyle$1 as E, EntityTable as F, ResourceSystem as G, RelationTable as H, EntityTables as I, TextEdit as J, RichTextSnapshot as K, EntityValues as L, DslDiagnostic as M, DslMutation as N, Clip as O, EntityMutation as P, TimeAnchor as Q, FieldPatch as R, AudioScript as S, CaptionSelection as T, RelationTables as U, RelationMutation as V, RelationValues 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, DeepReadonly as j, ContainMutation 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, CaptionContent as w, Asset as x, resourceId as y, MedeoDslSnapshot as z };
880
+ export { TextMutation as $, DeepReadonly as A, PhonemeSelection as B, CaptionContent as C, Clip as D, CaptionText as E, EntityTables as F, ResourceSystem as G, RelationTable as H, EntityValues as I, SegmentSelection as J, RichTextSnapshot as K, FieldPatch as L, DslMutation as M, EntityMutation as N, ContainMutation as O, EntityTable as P, TextMark as Q, MedeoDslSnapshot as R, Caption as S, CaptionStyle$1 as T, RelationTables as U, RelationMutation as V, RelationValues as W, TextDelta as X, StoredFile as Y, TextEdit as Z, defaultIdFactory as _, VideoDraftCaptionStyle as a, tupleHash as b, VideoDraftInput as c, VideoDraftTrack as d, TextRun as et, VideoDraftTrackItem as f, EntityIdKind as g, DslIdFactory as h, VideoDraft as i, Voice as it, DslDiagnostic as j, ContainNode as k, VideoDraftPartUnion as l, OpActor as m, DEFAULT_UNIT_TIME_MS as n, Track$1 as nt, VideoDraftContent as o, CommitOptions as p, SegmentRange as q, VideoCreationSettings as r, TrackRole as rt, VideoDraftContentPartUnion as s, CaptionDisplayCue as t, TimeAnchor as tt, VideoDraftTimeline as u, relationId as v, CaptionSelection as w, AudioScript as x, resourceId as y, Media as z };