@mengine/medeo-client 2.1.1-dsl.2 → 2.1.1-dsl.21
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/README.md +13 -12
- package/dist/{dsl-EV6kCdr6.js → dsl-B7-4dMjr.js} +1125 -531
- package/dist/dsl.d.ts +3 -3
- package/dist/dsl.js +3 -3
- package/dist/{index-D-6uebu4.d.ts → index-CcNkkQll.d.ts} +59 -56
- package/dist/{index-D-3rdfUP.d.ts → index-D4Bgukns.d.ts} +1 -1
- package/dist/{index-Cu7SdKN5.d.ts → index-DVmvFhEn.d.ts} +208 -171
- 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 +4 -7
- package/dist/{video-draft-types-c_shaRyq.d.ts → video-draft-types-0J2vfXBu.d.ts} +128 -55
- package/dist/{video-draft-types-TXRv3wS6.js → video-draft-types-BfIXM8q3.js} +215 -115
- package/package.json +4 -4
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-BfIXM8q3.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-0J2vfXBu.js";
|
|
2
|
+
import { b as MedeoDsl } from "./index-DVmvFhEn.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 {
|
|
2
|
+
import { a as documentFormat, i as assertDslDocument } from "./video-draft-types-BfIXM8q3.js";
|
|
3
|
+
import { i as DslEditor, n as toVideoDraft, o as MedeoDsl, r as createInitialMedeoDsl } from "./dsl-B7-4dMjr.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: {
|
|
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
|
-
|
|
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
|
-
|
|
42
|
-
|
|
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 {
|
|
@@ -54,24 +84,54 @@ interface CaptionStyle$1 {
|
|
|
54
84
|
entranceAnimationDurationMs?: number;
|
|
55
85
|
strokeColor?: string;
|
|
56
86
|
strokeWidth?: number;
|
|
87
|
+
/** The caption's center across the frame, from 0 at the left edge to 1 at the right. */
|
|
57
88
|
positionX?: number;
|
|
89
|
+
/** The caption's center down the frame, from 0 at the top edge to 1 at the bottom. */
|
|
58
90
|
positionY?: number;
|
|
59
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* What a Caption shows or a PhoneticScript is written for: one segment of a script, or a run inside
|
|
94
|
+
* it (D181). The run's ends are Cursors on that segment's Text, so they follow its edits; without
|
|
95
|
+
* them the whole segment is meant, whatever it comes to say. One value: taken or replaced whole.
|
|
96
|
+
*/
|
|
97
|
+
interface SegmentSelection {
|
|
98
|
+
audioScriptId: string;
|
|
99
|
+
segmentId: string;
|
|
100
|
+
start?: Cursor;
|
|
101
|
+
end?: Cursor;
|
|
102
|
+
}
|
|
103
|
+
type CaptionContent = SegmentSelection;
|
|
104
|
+
/** Words come from a selected run of a script or from the Caption's own text, never both. */
|
|
60
105
|
interface Caption {
|
|
106
|
+
selection?: CaptionContent;
|
|
61
107
|
text?: string;
|
|
62
108
|
style?: CaptionStyle$1;
|
|
63
109
|
}
|
|
110
|
+
/** The segment a PhoneticScript is written for, selected as a Caption selects one, and its pronunciation. */
|
|
111
|
+
interface Phoneme extends SegmentSelection {
|
|
112
|
+
/** What the voice synthesizes for that selection, written in what the voice accepts. */
|
|
113
|
+
phonemeScript?: string;
|
|
114
|
+
}
|
|
115
|
+
/** A file Memota stored from raw content: how a Media File entity names it, and its digest. */
|
|
116
|
+
interface StoredFile {
|
|
117
|
+
system: 'memota';
|
|
118
|
+
key: string;
|
|
119
|
+
storageKey?: string;
|
|
120
|
+
digest: string;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* A variant of an AudioScript: the segment it is written for, plus what to synthesize. It has the Media File
|
|
124
|
+
* trait (D178): its `phonemeScript` is raw content, stored in Memota as a text file whenever it is
|
|
125
|
+
* written, and the file's facts are kept beside it. Without a `phonemeScript` it has no file.
|
|
126
|
+
*/
|
|
127
|
+
interface PhoneticScript extends Partial<StoredFile> {
|
|
128
|
+
phoneme: Phoneme;
|
|
129
|
+
}
|
|
64
130
|
interface Voice {
|
|
65
131
|
system: 'voice-library';
|
|
66
132
|
key: string;
|
|
67
133
|
name?: string;
|
|
68
134
|
}
|
|
69
|
-
interface Asset {
|
|
70
|
-
system: ResourceSystem;
|
|
71
|
-
key: string;
|
|
72
|
-
storageKey?: string;
|
|
73
|
-
digest?: string;
|
|
74
|
-
}
|
|
75
135
|
/** Table keys carry entity identity; values never duplicate an id or a single-table kind. */
|
|
76
136
|
interface EntityValues {
|
|
77
137
|
'timeline-entities': Record<string, never>;
|
|
@@ -79,52 +139,32 @@ interface EntityValues {
|
|
|
79
139
|
'clip-entities': Clip;
|
|
80
140
|
'media-entities': Media;
|
|
81
141
|
'audio-script-entities': AudioScript;
|
|
142
|
+
'phonetic-script-entities': PhoneticScript;
|
|
82
143
|
'caption-entities': Caption;
|
|
83
144
|
'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
145
|
}
|
|
146
|
+
/** Only relations an entity may hold many of have tables; single-valued ones are fields of their owner. */
|
|
98
147
|
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
148
|
'voice-timbre-relations': {
|
|
112
149
|
recordingId: string;
|
|
113
150
|
voiceId: string;
|
|
114
151
|
};
|
|
152
|
+
/**
|
|
153
|
+
* `sourceDigest`: the source's digest when the product was made from it (D177). A product whose
|
|
154
|
+
* source's digest differs now was made from content the source no longer has.
|
|
155
|
+
*/
|
|
115
156
|
'derived-from-relations': {
|
|
116
157
|
entityId: string;
|
|
117
158
|
sourceId: string;
|
|
118
|
-
|
|
119
|
-
'from-asset-relations': {
|
|
120
|
-
audioScriptId: string;
|
|
121
|
-
assetId: string;
|
|
122
|
-
};
|
|
123
|
-
'to-asset-relations': {
|
|
124
|
-
audioScriptId: string;
|
|
125
|
-
assetId: string;
|
|
159
|
+
sourceDigest?: string;
|
|
126
160
|
};
|
|
127
161
|
}
|
|
162
|
+
/** What a create states: a PhoneticScript's phoneme may follow by set-phoneme in the same write. */
|
|
163
|
+
type EntityInput = Omit<EntityValues, 'phonetic-script-entities'> & {
|
|
164
|
+
'phonetic-script-entities': Omit<PhoneticScript, 'phoneme'> & {
|
|
165
|
+
phoneme?: Phoneme;
|
|
166
|
+
};
|
|
167
|
+
};
|
|
128
168
|
type EntityTable = keyof EntityValues;
|
|
129
169
|
type RelationTable = keyof RelationValues;
|
|
130
170
|
type EntityTables = { [K in EntityTable]: Record<string, EntityValues[K]> };
|
|
@@ -134,7 +174,7 @@ type EntityMutation = { [K in EntityTable]: {
|
|
|
134
174
|
type: 'create-entity';
|
|
135
175
|
table: K;
|
|
136
176
|
id: string;
|
|
137
|
-
value:
|
|
177
|
+
value: EntityInput[K];
|
|
138
178
|
} | {
|
|
139
179
|
type: 'patch-entity';
|
|
140
180
|
table: K;
|
|
@@ -168,12 +208,39 @@ type ContainMutation = {
|
|
|
168
208
|
type: 'delete-node';
|
|
169
209
|
entityId: string;
|
|
170
210
|
};
|
|
171
|
-
|
|
172
|
-
|
|
211
|
+
/** A segment, or a run of it in UTF-16 offsets of its current text, as a write states it. */
|
|
212
|
+
interface SegmentRange {
|
|
173
213
|
audioScriptId: string;
|
|
174
|
-
|
|
175
|
-
|
|
214
|
+
segmentId: string;
|
|
215
|
+
start?: number;
|
|
216
|
+
end?: number;
|
|
217
|
+
}
|
|
218
|
+
interface CaptionSelection extends SegmentRange {
|
|
219
|
+
captionId: string;
|
|
220
|
+
}
|
|
221
|
+
interface PhonemeSelection extends SegmentRange {
|
|
222
|
+
phoneticScriptId: string;
|
|
223
|
+
phonemeScript?: string;
|
|
176
224
|
}
|
|
225
|
+
/** A script's segments are added, moved and removed by id; their text is edited in place. */
|
|
226
|
+
type SegmentMutation = {
|
|
227
|
+
type: 'insert-segment';
|
|
228
|
+
audioScriptId: string;
|
|
229
|
+
segmentId: string;
|
|
230
|
+
index?: number;
|
|
231
|
+
text: string;
|
|
232
|
+
startMs?: number;
|
|
233
|
+
endMs?: number;
|
|
234
|
+
} | {
|
|
235
|
+
type: 'move-segment';
|
|
236
|
+
audioScriptId: string;
|
|
237
|
+
segmentId: string;
|
|
238
|
+
index: number;
|
|
239
|
+
} | {
|
|
240
|
+
type: 'delete-segment';
|
|
241
|
+
audioScriptId: string;
|
|
242
|
+
segmentId: string;
|
|
243
|
+
};
|
|
177
244
|
type TextMutation = {
|
|
178
245
|
type: 'edit-caption-text';
|
|
179
246
|
captionId: string;
|
|
@@ -182,12 +249,15 @@ type TextMutation = {
|
|
|
182
249
|
} | {
|
|
183
250
|
type: 'edit-text';
|
|
184
251
|
audioScriptId: string;
|
|
252
|
+
segmentId: string;
|
|
185
253
|
expectedBodyId?: string;
|
|
186
254
|
edits: readonly TextEdit[];
|
|
187
255
|
} | ({
|
|
188
256
|
type: 'set-caption-content';
|
|
189
|
-
} & CaptionSelection)
|
|
190
|
-
type
|
|
257
|
+
} & CaptionSelection) | ({
|
|
258
|
+
type: 'set-phoneme';
|
|
259
|
+
} & PhonemeSelection);
|
|
260
|
+
type DslMutation = EntityMutation | RelationMutation | ContainMutation | SegmentMutation | TextMutation;
|
|
191
261
|
interface ContainNode {
|
|
192
262
|
treeId: TreeID;
|
|
193
263
|
entityId: string;
|
|
@@ -207,6 +277,7 @@ interface RichTextSnapshot {
|
|
|
207
277
|
plainText: string;
|
|
208
278
|
delta: TextRun[];
|
|
209
279
|
}
|
|
280
|
+
/** Selected text, with its UTF-16 range in the Text it lies in: the segment's, or a Caption's own. */
|
|
210
281
|
interface CaptionText {
|
|
211
282
|
text: string;
|
|
212
283
|
start: number;
|
|
@@ -215,12 +286,13 @@ interface CaptionText {
|
|
|
215
286
|
}
|
|
216
287
|
type DeepReadonly<T> = T extends Cursor ? T : T extends object ? { readonly [K in keyof T]: DeepReadonly<T[K]> } : T;
|
|
217
288
|
type MedeoDslSnapshot = DeepReadonly<EntityTables & RelationTables & {
|
|
218
|
-
'contain-relations': ContainNode[];
|
|
289
|
+
'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
290
|
richText: Record<string, RichTextSnapshot>;
|
|
220
|
-
captionText: Record<string, CaptionText>;
|
|
291
|
+
captionText: Record<string, CaptionText>; /** What each PhoneticScript's selection holds now, resolved as a Caption's is. */
|
|
292
|
+
phoneticText: Record<string, CaptionText>;
|
|
221
293
|
diagnostics: DslDiagnostic[];
|
|
222
294
|
}>;
|
|
223
|
-
type TextMark = 'language'
|
|
295
|
+
type TextMark = 'language';
|
|
224
296
|
type TextEdit = {
|
|
225
297
|
type: 'insert';
|
|
226
298
|
at: number;
|
|
@@ -234,7 +306,7 @@ type TextEdit = {
|
|
|
234
306
|
start: number;
|
|
235
307
|
end: number;
|
|
236
308
|
key: TextMark;
|
|
237
|
-
value: string
|
|
309
|
+
value: string;
|
|
238
310
|
} | {
|
|
239
311
|
type: 'unmark';
|
|
240
312
|
start: number;
|
|
@@ -256,9 +328,10 @@ type TextDelta = {
|
|
|
256
328
|
//#endregion
|
|
257
329
|
//#region ../medeo-dsl/src/ids.d.ts
|
|
258
330
|
declare function tupleHash(tuple: readonly string[]): string;
|
|
259
|
-
declare function resourceId(kind: 'media' | 'voice'
|
|
331
|
+
declare function resourceId(kind: 'media' | 'voice', system: string, key: string): string;
|
|
260
332
|
declare function relationId<K extends RelationTable>(table: K, value: RelationValues[K]): string;
|
|
261
|
-
|
|
333
|
+
/** Kinds of id a document mints: its entities', and a script segment's. */
|
|
334
|
+
type EntityIdKind = 'timeline' | 'track' | 'clip' | 'audio-script' | 'segment' | 'phonetic-script' | 'caption';
|
|
262
335
|
type DslIdFactory = (kind: EntityIdKind) => string;
|
|
263
336
|
declare const defaultIdFactory: DslIdFactory;
|
|
264
337
|
//#endregion
|
|
@@ -806,4 +879,4 @@ type VideoDraftContent = Pick<VideoDraft, 'timeline' | 'main_track' | 'above_mai
|
|
|
806
879
|
type VideoDraftInput = Pick<VideoDraft, keyof VideoDraftContent>;
|
|
807
880
|
declare const DEFAULT_UNIT_TIME_MS = 33.333;
|
|
808
881
|
//#endregion
|
|
809
|
-
export {
|
|
882
|
+
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 };
|