@mengine/medeo-client 2.1.1-dsl.0 → 2.1.1-dsl.10
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 +27 -12
- package/dist/dsl-COyzz7Fp.js +6395 -0
- package/dist/dsl.d.ts +3 -3
- package/dist/dsl.js +3 -3
- package/dist/index-C5wDKYqC.d.ts +953 -0
- package/dist/{index-DQZUkrpg.d.ts → index-CHiPztZr.d.ts} +53 -56
- package/dist/{index-B7fC7q7P.d.ts → index-DAfOkcnZ.d.ts} +23 -4
- package/dist/index.d.ts +5 -5
- package/dist/index.js +65 -9
- 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-BnbfWrBx.js +1486 -0
- package/dist/{video-draft-types-c_shaRyq.d.ts → video-draft-types-GqXnsOzA.d.ts} +114 -54
- package/package.json +8 -5
- package/dist/dsl-Dkecq_2c.js +0 -2814
- package/dist/index-DKDMTXUe.d.ts +0 -605
- package/dist/video-draft-types-DTXxvPt-.js +0 -449
|
@@ -0,0 +1,953 @@
|
|
|
1
|
+
import { B as PhonemeSelection, J as SegmentSelection, L as FieldPatch, M as DslMutation, R as MedeoDslSnapshot, T as CaptionStyle, Y as StoredFile, Z as TextEdit, c as VideoDraftInput, h as DslIdFactory, it as Voice, j as DslDiagnostic, o as VideoDraftContent, p as CommitOptions, q as SegmentRange, rt as TrackRole, tt as TimeAnchor, w as CaptionSelection, z as Media } from "./video-draft-types-GqXnsOzA.js";
|
|
2
|
+
import { ContainerType, Cursor, LoroDoc, PeerID, TreeID } from "loro-crdt";
|
|
3
|
+
|
|
4
|
+
//#region src/dsl/action-context.d.ts
|
|
5
|
+
type ClipPlacement = {
|
|
6
|
+
kind: 'sequential';
|
|
7
|
+
} | {
|
|
8
|
+
kind: 'absolute';
|
|
9
|
+
startMs: number;
|
|
10
|
+
} | {
|
|
11
|
+
kind: 'anchored';
|
|
12
|
+
clipId: string;
|
|
13
|
+
offsetMs: number;
|
|
14
|
+
};
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/dsl/clip-actions.d.ts
|
|
17
|
+
type ClipSource = {
|
|
18
|
+
sourceId: string;
|
|
19
|
+
media?: never;
|
|
20
|
+
} | {
|
|
21
|
+
media: Media;
|
|
22
|
+
sourceId?: never;
|
|
23
|
+
};
|
|
24
|
+
type AddDslClip = ClipSource & {
|
|
25
|
+
inMs?: number;
|
|
26
|
+
outMs?: number;
|
|
27
|
+
speed?: {
|
|
28
|
+
rate: number;
|
|
29
|
+
};
|
|
30
|
+
volume?: number;
|
|
31
|
+
fillTimeline?: true;
|
|
32
|
+
placement?: ClipPlacement;
|
|
33
|
+
};
|
|
34
|
+
interface AddDslClipsInput {
|
|
35
|
+
trackId: string;
|
|
36
|
+
clips: readonly AddDslClip[];
|
|
37
|
+
index?: number;
|
|
38
|
+
}
|
|
39
|
+
interface MoveDslClipsInput {
|
|
40
|
+
clipIds: readonly string[];
|
|
41
|
+
trackId: string;
|
|
42
|
+
index: number;
|
|
43
|
+
onAnchored: 'follow' | 'keepAbsolute';
|
|
44
|
+
}
|
|
45
|
+
interface ReplaceDslClipsInput {
|
|
46
|
+
clipIds: readonly string[];
|
|
47
|
+
clips: readonly AddDslClip[];
|
|
48
|
+
onAnchored: 'remap' | 'cascade';
|
|
49
|
+
}
|
|
50
|
+
interface DslClipUpdate {
|
|
51
|
+
clipId: string;
|
|
52
|
+
inMs?: number;
|
|
53
|
+
outMs?: number;
|
|
54
|
+
speed?: {
|
|
55
|
+
rate: number;
|
|
56
|
+
};
|
|
57
|
+
volume?: number;
|
|
58
|
+
placement?: ClipPlacement;
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
//#region ../../node_modules/.pnpm/loro-mirror@2.3.3_patch_hash=a551a0e4aa4f61ec88b0d9e970a183b5ee2955107a2e0bb03b378bc510c2f395_loro-crdt@1.16.1/node_modules/loro-mirror/dist/schema/types.d.ts
|
|
62
|
+
/**
|
|
63
|
+
* Options for schema definitions
|
|
64
|
+
*/
|
|
65
|
+
interface SchemaOptions {
|
|
66
|
+
/** Whether the field is required */
|
|
67
|
+
required?: boolean;
|
|
68
|
+
/** Default value for the field */
|
|
69
|
+
defaultValue?: unknown;
|
|
70
|
+
/** Description of the field */
|
|
71
|
+
description?: string;
|
|
72
|
+
/**
|
|
73
|
+
* Additional validation function.
|
|
74
|
+
* Receives the domain value to validate - this will be the transformed value if a transform is defined, otherwise the raw value (string | number | boolean).
|
|
75
|
+
* Return true if valid, or a string error message if invalid.
|
|
76
|
+
*/
|
|
77
|
+
validate?: (value: unknown) => boolean | string;
|
|
78
|
+
/**
|
|
79
|
+
* When set on a `schema.LoroMap` or `schema.LoroMapRecord`, new direct child
|
|
80
|
+
* containers under that map's keys are created with Loro's `ensureMergeable*`
|
|
81
|
+
* APIs instead of `setContainer`.
|
|
82
|
+
*
|
|
83
|
+
* By default, two peers that concurrently create a child container under the
|
|
84
|
+
* same Map key produce distinct container IDs; the Map slot is
|
|
85
|
+
* last-writer-wins, so one peer's child (and its contents) is silently
|
|
86
|
+
* dropped after sync. With this enabled, the child's identity derives from
|
|
87
|
+
* its logical position (parent container id + key + type), so every peer
|
|
88
|
+
* resolves to the same CRDT object and their content merges.
|
|
89
|
+
*
|
|
90
|
+
* Opt-in (default `false`) to keep the document format compatible with older
|
|
91
|
+
* `setContainer` child-container semantics. All collaborating clients must
|
|
92
|
+
* use `loro-crdt >= 1.13.3`.
|
|
93
|
+
*
|
|
94
|
+
* @see https://loro.dev/blog/mergeable-containers
|
|
95
|
+
*/
|
|
96
|
+
mergeableMapChildContainers?: boolean;
|
|
97
|
+
[key: string]: unknown;
|
|
98
|
+
}
|
|
99
|
+
type HasExplicitDefaultValue<S extends SchemaType> = S extends {
|
|
100
|
+
options: {
|
|
101
|
+
defaultValue: unknown;
|
|
102
|
+
};
|
|
103
|
+
} ? true : false;
|
|
104
|
+
type AnySchemaOptions = SchemaOptions & {
|
|
105
|
+
/**
|
|
106
|
+
* Per-Any inference overrides.
|
|
107
|
+
*
|
|
108
|
+
* Notes:
|
|
109
|
+
* - `defaultLoroText` defaults to `false` for Any when omitted (primitive string),
|
|
110
|
+
* overriding the global `inferOptions.defaultLoroText`.
|
|
111
|
+
* - `defaultMovableList` inherits from the global inference options unless specified.
|
|
112
|
+
*/
|
|
113
|
+
defaultLoroText?: boolean;
|
|
114
|
+
defaultMovableList?: boolean;
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* Base interface for all schema types
|
|
118
|
+
*/
|
|
119
|
+
interface BaseSchemaType {
|
|
120
|
+
type: string;
|
|
121
|
+
options: SchemaOptions;
|
|
122
|
+
getContainerType(): ContainerType | null;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Any schema type
|
|
126
|
+
*
|
|
127
|
+
* This schema defers container inference decisions to the runtime (Mirror).
|
|
128
|
+
*/
|
|
129
|
+
interface AnySchemaType extends BaseSchemaType {
|
|
130
|
+
type: "any";
|
|
131
|
+
options: AnySchemaOptions;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* String schema type
|
|
135
|
+
*/
|
|
136
|
+
interface StringSchemaType<T extends string = string> extends BaseSchemaType {
|
|
137
|
+
type: "string";
|
|
138
|
+
_t: T;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Number schema type
|
|
142
|
+
*/
|
|
143
|
+
interface NumberSchemaType extends BaseSchemaType {
|
|
144
|
+
type: "number";
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Boolean schema type
|
|
148
|
+
*/
|
|
149
|
+
interface BooleanSchemaType extends BaseSchemaType {
|
|
150
|
+
type: "boolean";
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Ignored field schema type
|
|
154
|
+
*/
|
|
155
|
+
interface IgnoreSchemaType extends BaseSchemaType {
|
|
156
|
+
type: "ignore";
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Loro Map schema type
|
|
160
|
+
*/
|
|
161
|
+
interface LoroMapSchema<T extends Record<string, SchemaType>> extends BaseSchemaType {
|
|
162
|
+
type: "loro-map";
|
|
163
|
+
definition: SchemaDefinition<T>;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Enhanced LoroMapSchema with catchall support
|
|
167
|
+
*/
|
|
168
|
+
interface LoroMapSchemaWithCatchall<T extends Record<string, SchemaType>, C extends SchemaType> extends BaseSchemaType {
|
|
169
|
+
type: "loro-map";
|
|
170
|
+
definition: SchemaDefinition<T>;
|
|
171
|
+
catchallType: C;
|
|
172
|
+
catchall<NewC extends SchemaType>(catchallSchema: NewC): LoroMapSchemaWithCatchall<T, NewC>;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Loro List schema type
|
|
176
|
+
*/
|
|
177
|
+
interface LoroListSchema<T extends SchemaType> extends BaseSchemaType {
|
|
178
|
+
type: "loro-list";
|
|
179
|
+
itemSchema: T;
|
|
180
|
+
idSelector?: (item: unknown) => string;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Loro Movable List schema type
|
|
184
|
+
*/
|
|
185
|
+
interface LoroMovableListSchema<T extends SchemaType> extends BaseSchemaType {
|
|
186
|
+
type: "loro-movable-list";
|
|
187
|
+
itemSchema: T;
|
|
188
|
+
idSelector?: (item: unknown) => string;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Loro Text schema type
|
|
192
|
+
*/
|
|
193
|
+
interface LoroTextSchemaType extends BaseSchemaType {
|
|
194
|
+
type: "loro-text";
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Loro Tree schema type
|
|
198
|
+
*
|
|
199
|
+
* Represents a tree where each node has a `data` map described by `nodeSchema`.
|
|
200
|
+
*/
|
|
201
|
+
interface LoroTreeSchema<T extends Record<string, SchemaType>> extends BaseSchemaType {
|
|
202
|
+
type: "loro-tree";
|
|
203
|
+
nodeSchema: LoroMapSchema<T>;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Field types allowed at the document root: containers, plus `Ignore`
|
|
207
|
+
* (a memory-only field that never touches the LoroDoc).
|
|
208
|
+
*/
|
|
209
|
+
type RootFieldSchemaType = ContainerSchemaType | IgnoreSchemaType;
|
|
210
|
+
/**
|
|
211
|
+
* Root schema type
|
|
212
|
+
*/
|
|
213
|
+
interface RootSchemaType<T extends Record<string, RootFieldSchemaType>> extends BaseSchemaType {
|
|
214
|
+
type: "schema";
|
|
215
|
+
definition: RootSchemaDefinition<T>;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Union of all schema types
|
|
219
|
+
*/
|
|
220
|
+
type SchemaType = AnySchemaType | StringSchemaType | NumberSchemaType | BooleanSchemaType | IgnoreSchemaType | LoroMapSchema<Record<string, SchemaType>> | LoroMapSchemaWithCatchall<Record<string, SchemaType>, SchemaType> | LoroListSchema<SchemaType> | LoroMovableListSchema<SchemaType> | LoroTextSchemaType | LoroTreeSchema<Record<string, SchemaType>> | RootSchemaType<Record<string, RootFieldSchemaType>>;
|
|
221
|
+
type ContainerSchemaType = LoroMapSchema<Record<string, SchemaType>> | LoroMapSchemaWithCatchall<Record<string, SchemaType>, SchemaType> | LoroListSchema<SchemaType> | LoroMovableListSchema<SchemaType> | LoroTextSchemaType | LoroTreeSchema<Record<string, SchemaType>>;
|
|
222
|
+
/**
|
|
223
|
+
* Schema definition type
|
|
224
|
+
*/
|
|
225
|
+
type RootSchemaDefinition<T extends Record<string, RootFieldSchemaType>> = { [K in keyof T]: T[K] };
|
|
226
|
+
/**
|
|
227
|
+
* Schema definition type
|
|
228
|
+
*/
|
|
229
|
+
type SchemaDefinition<T extends Record<string, SchemaType>> = { [K in keyof T]: T[K] };
|
|
230
|
+
/**
|
|
231
|
+
* Check if a schema type is required
|
|
232
|
+
*
|
|
233
|
+
* true is default
|
|
234
|
+
*/
|
|
235
|
+
type IsSchemaRequired<S extends SchemaType> = S extends {
|
|
236
|
+
options: {
|
|
237
|
+
required: true;
|
|
238
|
+
};
|
|
239
|
+
} ? true : S extends {
|
|
240
|
+
options: {
|
|
241
|
+
required: false;
|
|
242
|
+
};
|
|
243
|
+
} ? false : S extends {
|
|
244
|
+
options: {
|
|
245
|
+
required?: undefined;
|
|
246
|
+
};
|
|
247
|
+
} ? true : S extends {
|
|
248
|
+
options: {};
|
|
249
|
+
} ? true : true;
|
|
250
|
+
/**
|
|
251
|
+
* Infer the JavaScript type from a schema type.
|
|
252
|
+
*/
|
|
253
|
+
type InferType<S extends SchemaType> = S extends {
|
|
254
|
+
transform: TransformDefinition<infer _C, infer D>;
|
|
255
|
+
} ? WithTransformStartupOptionality<D, S & SchemaType> : S extends StringSchemaType ? InferStringType<S> : S extends NumberSchemaType ? InferNumberType<S> : S extends BooleanSchemaType ? InferBooleanType<S> : IsSchemaRequired<S> extends false ? S extends AnySchemaType ? unknown : S extends IgnoreSchemaType ? unknown : S extends LoroTextSchemaType ? string | undefined : S extends LoroMapSchemaWithCatchall<infer M, infer C> ? keyof M extends never ? ({
|
|
256
|
+
[key: string]: InferType<C>;
|
|
257
|
+
} & {
|
|
258
|
+
$cid: string;
|
|
259
|
+
}) | undefined : (({ [K in keyof M]: InferType<M[K]> } & { [K in Exclude<string, keyof M>]: InferType<C> }) & {
|
|
260
|
+
$cid: string;
|
|
261
|
+
}) | undefined : S extends LoroMapSchema<infer M> ? ({ [K in keyof M]: InferType<M[K]> } & {
|
|
262
|
+
$cid: string;
|
|
263
|
+
}) | undefined : S extends LoroListSchema<infer I> ? Array<InferType<I>> | undefined : S extends LoroMovableListSchema<infer I> ? Array<InferType<I>> | undefined : S extends LoroTreeSchema<infer M> ? Array<InferTreeNodeTypeWithCid<M>> | undefined : S extends RootSchemaType<infer R> ? { [K in keyof R]: InferType<R[K]> } | undefined : never : S extends IgnoreSchemaType ? unknown : S extends LoroTextSchemaType ? string : S extends AnySchemaType ? unknown : S extends LoroMapSchemaWithCatchall<infer M, infer C> ? keyof M extends never ? {
|
|
264
|
+
[key: string]: InferType<C>;
|
|
265
|
+
} & {
|
|
266
|
+
$cid: string;
|
|
267
|
+
} : ({ [K in keyof M]: InferType<M[K]> } & { [K in Exclude<string, keyof M>]: InferType<C> }) & {
|
|
268
|
+
$cid: string;
|
|
269
|
+
} : S extends LoroMapSchema<infer M> ? { [K in keyof M]: InferType<M[K]> } & {
|
|
270
|
+
$cid: string;
|
|
271
|
+
} : S extends LoroListSchema<infer I> ? Array<InferType<I>> : S extends LoroMovableListSchema<infer I> ? Array<InferType<I>> : S extends LoroTreeSchema<infer M> ? Array<InferTreeNodeTypeWithCid<M>> : S extends RootSchemaType<infer R> ? { [K in keyof R]: InferType<R[K]> } : never;
|
|
272
|
+
/**
|
|
273
|
+
* Infer the input (write) type for setState updates.
|
|
274
|
+
* Identical to InferType<S> except that for any LoroMap shape, the `$cid` field is optional.
|
|
275
|
+
*/
|
|
276
|
+
type InferInputType<S extends SchemaType> = S extends {
|
|
277
|
+
transform: TransformDefinition<infer _C, infer D>;
|
|
278
|
+
} ? WithTransformStartupOptionality<D, S & SchemaType> : S extends StringSchemaType ? InferStringType<S> : S extends NumberSchemaType ? InferNumberType<S> : S extends BooleanSchemaType ? InferBooleanType<S> : IsSchemaRequired<S> extends false ? S extends AnySchemaType ? unknown : S extends IgnoreSchemaType ? unknown : S extends LoroTextSchemaType ? string | undefined : S extends LoroMapSchemaWithCatchall<infer M, infer C> ? keyof M extends never ? ({
|
|
279
|
+
[key: string]: InferInputType<C>;
|
|
280
|
+
} & {
|
|
281
|
+
$cid?: string;
|
|
282
|
+
}) | undefined : (({ [K in keyof M]: InferInputType<M[K]> } & { [K in Exclude<string, keyof M>]: InferInputType<C> }) & {
|
|
283
|
+
$cid?: string;
|
|
284
|
+
}) | undefined : S extends LoroMapSchema<infer M> ? ({ [K in keyof M]: InferInputType<M[K]> } & {
|
|
285
|
+
$cid?: string;
|
|
286
|
+
}) | undefined : S extends LoroListSchema<infer I> ? Array<InferInputType<I>> | undefined : S extends LoroMovableListSchema<infer I> ? Array<InferInputType<I>> | undefined : S extends LoroTreeSchema<infer M> ? Array<InferInputTreeNodeType<M>> | undefined : S extends RootSchemaType<infer R> ? { [K in keyof R]: InferInputType<R[K]> } | undefined : never : S extends IgnoreSchemaType ? unknown : S extends LoroTextSchemaType ? string : S extends AnySchemaType ? unknown : S extends LoroMapSchemaWithCatchall<infer M, infer C> ? keyof M extends never ? {
|
|
287
|
+
[key: string]: InferInputType<C>;
|
|
288
|
+
} & {
|
|
289
|
+
$cid?: string;
|
|
290
|
+
} : ({ [K in keyof M]: InferInputType<M[K]> } & { [K in Exclude<string, keyof M>]: InferInputType<C> }) & {
|
|
291
|
+
$cid?: string;
|
|
292
|
+
} : S extends LoroMapSchema<infer M> ? { [K in keyof M]: InferInputType<M[K]> } & {
|
|
293
|
+
$cid?: string;
|
|
294
|
+
} : S extends LoroListSchema<infer I> ? Array<InferInputType<I>> : S extends LoroMovableListSchema<infer I> ? Array<InferInputType<I>> : S extends LoroTreeSchema<infer M> ? Array<InferInputTreeNodeType<M>> : S extends RootSchemaType<infer R> ? { [K in keyof R]: InferInputType<R[K]> } : never;
|
|
295
|
+
/**
|
|
296
|
+
* Helper: Infer the node type for a tree schema whose node.data map includes $cid
|
|
297
|
+
*/
|
|
298
|
+
type InferTreeNodeTypeWithCid<M extends Record<string, SchemaType>> = {
|
|
299
|
+
id: string;
|
|
300
|
+
data: { [K in keyof M]: InferType<M[K]> } & {
|
|
301
|
+
$cid: string;
|
|
302
|
+
};
|
|
303
|
+
children: Array<InferTreeNodeTypeWithCid<M>>;
|
|
304
|
+
};
|
|
305
|
+
/**
|
|
306
|
+
* Helper: Input node type for a tree schema (node.data has optional $cid)
|
|
307
|
+
*/
|
|
308
|
+
type InferInputTreeNodeType<M extends Record<string, SchemaType>> = {
|
|
309
|
+
id: string;
|
|
310
|
+
data: { [K in keyof M]: InferInputType<M[K]> } & {
|
|
311
|
+
$cid?: string;
|
|
312
|
+
};
|
|
313
|
+
children: Array<InferInputTreeNodeType<M>>;
|
|
314
|
+
};
|
|
315
|
+
/**
|
|
316
|
+
* Equality comparison strategy for transformed values.
|
|
317
|
+
*
|
|
318
|
+
* Reference equality is ALWAYS checked first.
|
|
319
|
+
* This setting controls what happens when references differ.
|
|
320
|
+
*
|
|
321
|
+
* - "reference-equality" (default): If refs differ, treat as not equal (no encoding).
|
|
322
|
+
* Correct for Immer-draftable types, immutable types, and copy-on-change patterns.
|
|
323
|
+
* Fast because no encoding is needed.
|
|
324
|
+
*
|
|
325
|
+
* - "encoded-value-equality": If refs differ, encode both and compare.
|
|
326
|
+
* Use when you may have different objects with the same encoded value
|
|
327
|
+
* and want to avoid redundant updates.
|
|
328
|
+
*
|
|
329
|
+
* - "deep-equality": If refs differ, perform a deep equality check on the domain values.
|
|
330
|
+
* This is rarely needed as Immer-draftable objects typically maintain reference equality when unchanged,
|
|
331
|
+
* but can be useful for non-Immer-managed objects that are slow to encode and have no simple equality check.
|
|
332
|
+
*
|
|
333
|
+
* - Custom function: Your own comparison logic. Receives the domain values.
|
|
334
|
+
*/
|
|
335
|
+
type EqualityStrategy<DomainType> = "reference-equality" | "encoded-value-equality" | "deep-equality" | ((a: DomainType, b: DomainType) => boolean);
|
|
336
|
+
/**
|
|
337
|
+
* Transform definition for bidirectional conversion between CRDT primitives and domain types.
|
|
338
|
+
* It is strongly recommend that DomainType is immutable or
|
|
339
|
+
* [supported by Immer](https://immerjs.github.io/immer/complex-objects/) otherwise changes to transformed
|
|
340
|
+
* values may not be detected and converted to CRDT operations. Never mutate DomainType instances
|
|
341
|
+
* outside of Loro Mirror's setState function. CRDTType and DomainType can be null or undefined, but decode/encode functions
|
|
342
|
+
* will never receive null/undefined - they pass through as-is. Validation is performed on the domain type after transformation
|
|
343
|
+
* (or more precisely, validation on domain types happens before encoding).
|
|
344
|
+
*/
|
|
345
|
+
interface TransformDefinition<CRDTType, DomainType> {
|
|
346
|
+
/**
|
|
347
|
+
* Convert CRDT primitive to domain type.
|
|
348
|
+
* Never called with null/undefined - they pass through as-is.
|
|
349
|
+
*/
|
|
350
|
+
decode: (value: CRDTType & {}) => DomainType & {};
|
|
351
|
+
/**
|
|
352
|
+
* Convert domain type to CRDT primitive.
|
|
353
|
+
* Never called with null/undefined - they pass through as-is.
|
|
354
|
+
*/
|
|
355
|
+
encode: (value: DomainType & {}) => CRDTType & {};
|
|
356
|
+
/**
|
|
357
|
+
* Validate the domain value.
|
|
358
|
+
* Called during schema validation after null/undefined checks pass.
|
|
359
|
+
* Return true if valid, or a string error message if invalid.
|
|
360
|
+
* The validate function passed to schema.String | Number | Boolean will also be called.
|
|
361
|
+
*/
|
|
362
|
+
validate?: (value: DomainType & {}) => boolean | string;
|
|
363
|
+
/**
|
|
364
|
+
* How to compare domain values for equality.
|
|
365
|
+
*
|
|
366
|
+
* Reference equality (===) is always checked first.
|
|
367
|
+
* This setting controls behavior when references differ.
|
|
368
|
+
*
|
|
369
|
+
* @default "reference-equality"
|
|
370
|
+
*/
|
|
371
|
+
isEqual?: EqualityStrategy<DomainType>;
|
|
372
|
+
/**
|
|
373
|
+
* Whether to validate that encode() returns the correct CRDT type during schema validation.
|
|
374
|
+
* When true, encode() is called on every validation to check the return type.
|
|
375
|
+
* When false, encode type checking is skipped for better performance.
|
|
376
|
+
*
|
|
377
|
+
* @default false
|
|
378
|
+
*/
|
|
379
|
+
validateEncodedType?: boolean;
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Add | undefined to T if schema is optional (required: false).
|
|
383
|
+
* Used by InferType to add optionality to both transformed and non-transformed fields.
|
|
384
|
+
*/
|
|
385
|
+
type WithOptionality<T, S extends SchemaType> = IsSchemaRequired<S> extends false ? T | undefined : T;
|
|
386
|
+
type WithTransformStartupOptionality<T, S extends SchemaType> = IsSchemaRequired<S> extends false ? T | undefined : HasExplicitDefaultValue<S> extends true ? T : T | undefined;
|
|
387
|
+
type InferStringType<S extends SchemaType> = S extends {
|
|
388
|
+
transform: TransformDefinition<infer _C, infer D>;
|
|
389
|
+
} ? WithOptionality<D, S> : S extends StringSchemaType<infer T> ? WithOptionality<T, S> : WithOptionality<string, S>;
|
|
390
|
+
type InferNumberType<S extends SchemaType> = S extends {
|
|
391
|
+
transform: TransformDefinition<infer _C, infer D>;
|
|
392
|
+
} ? WithOptionality<D, S> : WithOptionality<number, S>;
|
|
393
|
+
type InferBooleanType<S extends SchemaType> = S extends {
|
|
394
|
+
transform: TransformDefinition<infer _C, infer D>;
|
|
395
|
+
} ? WithOptionality<D, S> : WithOptionality<boolean, S>;
|
|
396
|
+
//#endregion
|
|
397
|
+
//#region ../medeo-dsl/src/schema/loro-shape.d.ts
|
|
398
|
+
/**
|
|
399
|
+
* Only direct children inherit mergeable identity. Text and ordinary entity rows keep normal
|
|
400
|
+
* identities, so deleting a row also drops what a peer wrote into it concurrently: a relation an
|
|
401
|
+
* entity holds at most one of is a field of that row and never outlives it.
|
|
402
|
+
*/
|
|
403
|
+
declare const medeoDslLoroShape: RootSchemaType<{
|
|
404
|
+
'timeline-entities': LoroMapSchemaWithCatchall<{}, LoroMapSchema<{}> & {
|
|
405
|
+
options: {};
|
|
406
|
+
} & {
|
|
407
|
+
catchall: <C extends SchemaType>(catchallSchema: C) => LoroMapSchemaWithCatchall<{}, C>;
|
|
408
|
+
}> & {
|
|
409
|
+
options: {};
|
|
410
|
+
};
|
|
411
|
+
'track-entities': LoroMapSchemaWithCatchall<{}, LoroMapSchema<{
|
|
412
|
+
role: /*elided*/any;
|
|
413
|
+
hidden: /*elided*/any;
|
|
414
|
+
}> & {
|
|
415
|
+
options: {};
|
|
416
|
+
} & {
|
|
417
|
+
catchall: <C extends SchemaType>(catchallSchema: C) => LoroMapSchemaWithCatchall<{
|
|
418
|
+
role: /*elided*/any;
|
|
419
|
+
hidden: /*elided*/any;
|
|
420
|
+
}, C>;
|
|
421
|
+
}> & {
|
|
422
|
+
options: {};
|
|
423
|
+
};
|
|
424
|
+
'clip-entities': LoroMapSchemaWithCatchall<{}, LoroMapSchema<{
|
|
425
|
+
seqMarker: /*elided*/any;
|
|
426
|
+
volume: /*elided*/any;
|
|
427
|
+
source: /*elided*/any;
|
|
428
|
+
anchor: /*elided*/any;
|
|
429
|
+
}> & {
|
|
430
|
+
options: {};
|
|
431
|
+
} & {
|
|
432
|
+
catchall: <C extends SchemaType>(catchallSchema: C) => LoroMapSchemaWithCatchall<{
|
|
433
|
+
seqMarker: /*elided*/any;
|
|
434
|
+
volume: /*elided*/any;
|
|
435
|
+
source: /*elided*/any;
|
|
436
|
+
anchor: /*elided*/any;
|
|
437
|
+
}, C>;
|
|
438
|
+
}> & {
|
|
439
|
+
options: {};
|
|
440
|
+
};
|
|
441
|
+
'media-entities': LoroMapSchemaWithCatchall<{}, LoroMapSchema<{
|
|
442
|
+
kind: /*elided*/any;
|
|
443
|
+
system: /*elided*/any;
|
|
444
|
+
key: /*elided*/any;
|
|
445
|
+
storageKey: /*elided*/any;
|
|
446
|
+
durationMs: /*elided*/any;
|
|
447
|
+
digest: /*elided*/any;
|
|
448
|
+
}> & {
|
|
449
|
+
options: {};
|
|
450
|
+
} & {
|
|
451
|
+
catchall: <C extends SchemaType>(catchallSchema: C) => LoroMapSchemaWithCatchall<{
|
|
452
|
+
kind: /*elided*/any;
|
|
453
|
+
system: /*elided*/any;
|
|
454
|
+
key: /*elided*/any;
|
|
455
|
+
storageKey: /*elided*/any;
|
|
456
|
+
durationMs: /*elided*/any;
|
|
457
|
+
digest: /*elided*/any;
|
|
458
|
+
}, C>;
|
|
459
|
+
}> & {
|
|
460
|
+
options: {
|
|
461
|
+
readonly mergeableMapChildContainers: true;
|
|
462
|
+
};
|
|
463
|
+
};
|
|
464
|
+
'audio-script-entities': LoroMapSchemaWithCatchall<{}, LoroMapSchema<{
|
|
465
|
+
segments: /*elided*/any;
|
|
466
|
+
defaultLanguage: /*elided*/any;
|
|
467
|
+
}> & {
|
|
468
|
+
options: {};
|
|
469
|
+
} & {
|
|
470
|
+
catchall: <C extends SchemaType>(catchallSchema: C) => LoroMapSchemaWithCatchall<{
|
|
471
|
+
segments: /*elided*/any;
|
|
472
|
+
defaultLanguage: /*elided*/any;
|
|
473
|
+
}, C>;
|
|
474
|
+
}> & {
|
|
475
|
+
options: {};
|
|
476
|
+
};
|
|
477
|
+
'phonetic-script-entities': LoroMapSchemaWithCatchall<{}, LoroMapSchema<{
|
|
478
|
+
phoneme: /*elided*/any;
|
|
479
|
+
system: /*elided*/any;
|
|
480
|
+
key: /*elided*/any;
|
|
481
|
+
storageKey: /*elided*/any;
|
|
482
|
+
digest: /*elided*/any;
|
|
483
|
+
}> & {
|
|
484
|
+
options: {};
|
|
485
|
+
} & {
|
|
486
|
+
catchall: <C extends SchemaType>(catchallSchema: C) => LoroMapSchemaWithCatchall<{
|
|
487
|
+
phoneme: /*elided*/any;
|
|
488
|
+
system: /*elided*/any;
|
|
489
|
+
key: /*elided*/any;
|
|
490
|
+
storageKey: /*elided*/any;
|
|
491
|
+
digest: /*elided*/any;
|
|
492
|
+
}, C>;
|
|
493
|
+
}> & {
|
|
494
|
+
options: {};
|
|
495
|
+
};
|
|
496
|
+
'caption-entities': LoroMapSchemaWithCatchall<{}, LoroMapSchema<{
|
|
497
|
+
selection: /*elided*/any;
|
|
498
|
+
text: /*elided*/any;
|
|
499
|
+
style: /*elided*/any;
|
|
500
|
+
}> & {
|
|
501
|
+
options: {
|
|
502
|
+
readonly mergeableMapChildContainers: true;
|
|
503
|
+
};
|
|
504
|
+
} & {
|
|
505
|
+
catchall: <C extends SchemaType>(catchallSchema: C) => LoroMapSchemaWithCatchall<{
|
|
506
|
+
selection: /*elided*/any;
|
|
507
|
+
text: /*elided*/any;
|
|
508
|
+
style: /*elided*/any;
|
|
509
|
+
}, C>;
|
|
510
|
+
}> & {
|
|
511
|
+
options: {};
|
|
512
|
+
};
|
|
513
|
+
'voice-entities': LoroMapSchemaWithCatchall<{}, LoroMapSchema<{
|
|
514
|
+
system: /*elided*/any;
|
|
515
|
+
key: /*elided*/any;
|
|
516
|
+
name: /*elided*/any;
|
|
517
|
+
}> & {
|
|
518
|
+
options: {};
|
|
519
|
+
} & {
|
|
520
|
+
catchall: <C extends SchemaType>(catchallSchema: C) => LoroMapSchemaWithCatchall<{
|
|
521
|
+
system: /*elided*/any;
|
|
522
|
+
key: /*elided*/any;
|
|
523
|
+
name: /*elided*/any;
|
|
524
|
+
}, C>;
|
|
525
|
+
}> & {
|
|
526
|
+
options: {
|
|
527
|
+
readonly mergeableMapChildContainers: true;
|
|
528
|
+
};
|
|
529
|
+
};
|
|
530
|
+
'contain-relations': LoroTreeSchema<{
|
|
531
|
+
entityId: /*elided*/any;
|
|
532
|
+
}>;
|
|
533
|
+
'voice-timbre-relations': LoroMapSchemaWithCatchall<{}, LoroMapSchema<Record<string, StringSchemaType<string> & {
|
|
534
|
+
options: {};
|
|
535
|
+
} & {
|
|
536
|
+
transform: <D>(def: TransformDefinition<string, D>) => StringSchemaType<string> & {
|
|
537
|
+
options: {};
|
|
538
|
+
transform: TransformDefinition<string, D>;
|
|
539
|
+
};
|
|
540
|
+
}>> & {
|
|
541
|
+
options: {};
|
|
542
|
+
} & {
|
|
543
|
+
catchall: <C extends SchemaType>(catchallSchema: C) => LoroMapSchemaWithCatchall<Record<string, StringSchemaType<string> & {
|
|
544
|
+
options: {};
|
|
545
|
+
} & {
|
|
546
|
+
transform: <D>(def: TransformDefinition<string, D>) => StringSchemaType<string> & {
|
|
547
|
+
options: {};
|
|
548
|
+
transform: TransformDefinition<string, D>;
|
|
549
|
+
};
|
|
550
|
+
}>, C>;
|
|
551
|
+
}> & {
|
|
552
|
+
options: {
|
|
553
|
+
readonly mergeableMapChildContainers: true;
|
|
554
|
+
};
|
|
555
|
+
};
|
|
556
|
+
'derived-from-relations': LoroMapSchemaWithCatchall<{}, LoroMapSchema<{
|
|
557
|
+
entityId: /*elided*/any;
|
|
558
|
+
sourceId: /*elided*/any;
|
|
559
|
+
sourceDigest: /*elided*/any;
|
|
560
|
+
}> & {
|
|
561
|
+
options: {};
|
|
562
|
+
} & {
|
|
563
|
+
catchall: <C extends SchemaType>(catchallSchema: C) => LoroMapSchemaWithCatchall<{
|
|
564
|
+
entityId: /*elided*/any;
|
|
565
|
+
sourceId: /*elided*/any;
|
|
566
|
+
sourceDigest: /*elided*/any;
|
|
567
|
+
}, C>;
|
|
568
|
+
}> & {
|
|
569
|
+
options: {
|
|
570
|
+
readonly mergeableMapChildContainers: true;
|
|
571
|
+
};
|
|
572
|
+
};
|
|
573
|
+
}> & {
|
|
574
|
+
options: {};
|
|
575
|
+
};
|
|
576
|
+
type MedeoDslLoroState = InferType<typeof medeoDslLoroShape>;
|
|
577
|
+
/** Writable view: new containers do not yet have a $cid or TreeID. */
|
|
578
|
+
type Input = InferInputType<typeof medeoDslLoroShape>;
|
|
579
|
+
type ContainDraftNode = Omit<Input['contain-relations'][number], 'id' | 'children'> & {
|
|
580
|
+
readonly id?: string;
|
|
581
|
+
children: ContainDraftNode[];
|
|
582
|
+
};
|
|
583
|
+
type DraftFields<T> = T extends Cursor ? T : T extends (infer Item)[] ? DraftFields<Item>[] : T extends object ? { [K in keyof T as undefined extends T[K] ? never : K]: DraftFields<T[K]> } & { [K in keyof T as undefined extends T[K] ? K : never]?: DraftFields<T[K]> } : T;
|
|
584
|
+
type MedeoDslDraft = DraftFields<Omit<Input, 'contain-relations'>> & {
|
|
585
|
+
'contain-relations': ContainDraftNode[];
|
|
586
|
+
};
|
|
587
|
+
//#endregion
|
|
588
|
+
//#region ../medeo-dsl/src/schema/codec.d.ts
|
|
589
|
+
interface InvalidAtomic {
|
|
590
|
+
invalid: true;
|
|
591
|
+
raw: string;
|
|
592
|
+
reason: string;
|
|
593
|
+
}
|
|
594
|
+
declare function isInvalidAtomic(value: unknown): value is InvalidAtomic;
|
|
595
|
+
interface AtomicCodec<T> {
|
|
596
|
+
encode(value: T | InvalidAtomic): string;
|
|
597
|
+
decode(raw: string): T | InvalidAtomic;
|
|
598
|
+
}
|
|
599
|
+
/** A Clip's time anchor; the Clip holding it is the anchored end. */
|
|
600
|
+
declare const timeAnchorCodec: AtomicCodec<TimeAnchor>;
|
|
601
|
+
/** A Caption's selection. */
|
|
602
|
+
declare const captionContentCodec: AtomicCodec<SegmentSelection>;
|
|
603
|
+
//#endregion
|
|
604
|
+
//#region ../medeo-dsl/src/schema/document-format.d.ts
|
|
605
|
+
/** Format discrimination does not register containers or alter the document. */
|
|
606
|
+
declare function documentFormat(doc: LoroDoc): 'dsl' | 'legacy' | 'mixed' | 'unknown';
|
|
607
|
+
declare class UnsupportedDocumentFormatError extends Error {
|
|
608
|
+
readonly code = "unsupported_document_format";
|
|
609
|
+
constructor();
|
|
610
|
+
}
|
|
611
|
+
/** Run after initial import, before opening an editable handle. Empty new documents still have one Timeline. */
|
|
612
|
+
declare function assertDslDocument(doc: LoroDoc): void;
|
|
613
|
+
//#endregion
|
|
614
|
+
//#region src/dsl/document/types.d.ts
|
|
615
|
+
/** Serialized once at the transaction exit, using the existing server audit envelope. */
|
|
616
|
+
interface DslAudit {
|
|
617
|
+
semantic_op: string;
|
|
618
|
+
payload: unknown;
|
|
619
|
+
intent?: unknown;
|
|
620
|
+
actor?: {
|
|
621
|
+
user_id: string;
|
|
622
|
+
role: 'user' | 'agent';
|
|
623
|
+
} | null;
|
|
624
|
+
}
|
|
625
|
+
/** Synchronous, scoped draft. Never retain this context or any draft object after the callback. */
|
|
626
|
+
interface DslTransaction {
|
|
627
|
+
readonly draft: MedeoDslDraft;
|
|
628
|
+
applyMutations(mutations: readonly DslMutation[]): void;
|
|
629
|
+
/** Offsets use the preview after preceding edits. Existing Text identities are checked when supplied. */
|
|
630
|
+
editText(audioScriptId: string, segmentId: string, edits: readonly TextEdit[], expectedBodyId?: string): void;
|
|
631
|
+
editCaptionText(captionId: string, edits: readonly TextEdit[], expectedBodyId?: string): void;
|
|
632
|
+
/** Adds a segment at `index` (the end by default); its id must be new to the script. */
|
|
633
|
+
insertSegment(audioScriptId: string, segmentId: string, text: string, index?: number): void;
|
|
634
|
+
/** `index` is measured after removing the segment. */
|
|
635
|
+
moveSegment(audioScriptId: string, segmentId: string, index: number): void;
|
|
636
|
+
deleteSegment(audioScriptId: string, segmentId: string): void;
|
|
637
|
+
/** Creates real Cursors during application; pending ranges are not exposed as draft Cursor objects. */
|
|
638
|
+
setCaptionContent(selection: CaptionSelection): void;
|
|
639
|
+
/** Writes a PhoneticScript's phoneme, its run turned into Cursors like a Caption's. */
|
|
640
|
+
setPhoneme(selection: PhonemeSelection): void;
|
|
641
|
+
}
|
|
642
|
+
//#endregion
|
|
643
|
+
//#region src/dsl/document/medeo-dsl.d.ts
|
|
644
|
+
interface CreateMedeoDslOptions {
|
|
645
|
+
timelineId?: string;
|
|
646
|
+
peerId?: PeerID;
|
|
647
|
+
idFactory?: DslIdFactory;
|
|
648
|
+
}
|
|
649
|
+
/** One live DSL document. Business Actions belong to medeo-client, not this storage interface. */
|
|
650
|
+
declare class MedeoDsl {
|
|
651
|
+
readonly doc: LoroDoc;
|
|
652
|
+
private readonly options;
|
|
653
|
+
private disposed;
|
|
654
|
+
private writing;
|
|
655
|
+
private rejectTransaction?;
|
|
656
|
+
private listeners;
|
|
657
|
+
private changeSource;
|
|
658
|
+
private snapshot?;
|
|
659
|
+
private dirty;
|
|
660
|
+
private notifying;
|
|
661
|
+
private readonly mirror;
|
|
662
|
+
private readonly unsubscribe;
|
|
663
|
+
private ownsDoc;
|
|
664
|
+
/** Opens a borrowed LoroDoc; dispose releases subscriptions but does not free the caller's doc. */
|
|
665
|
+
constructor(doc: LoroDoc, options?: {
|
|
666
|
+
mutationGuard?: {
|
|
667
|
+
run<T>(mutation: () => T): T;
|
|
668
|
+
};
|
|
669
|
+
});
|
|
670
|
+
/** Creates and owns a fresh document; this handle frees it on dispose. */
|
|
671
|
+
static create(options?: CreateMedeoDslOptions): MedeoDsl;
|
|
672
|
+
getSnapshot(): MedeoDslSnapshot;
|
|
673
|
+
subscribe(listener: (source: 'local' | 'remote') => void): () => void;
|
|
674
|
+
/** One synchronous, audited edit. Preparation errors discard the whole draft before native writes. */
|
|
675
|
+
transact(edit: (tx: DslTransaction) => void, audit: DslAudit): void;
|
|
676
|
+
/** Preferred vocabulary for ordinary entity/relation/Tree edits and serializable native commands. */
|
|
677
|
+
applyMutations(mutations: readonly DslMutation[], audit: DslAudit): void;
|
|
678
|
+
editText(scriptId: string, segmentId: string, expectedBodyId: string, edits: readonly TextEdit[], audit: DslAudit): void;
|
|
679
|
+
editCaptionText(captionId: string, expectedBodyId: string, edits: readonly TextEdit[], audit: DslAudit): void;
|
|
680
|
+
/**
|
|
681
|
+
* A run inside one segment as native Cursors. Local ranges exclude insertions at their start and
|
|
682
|
+
* include insertions at their end. K01 remains deferred.
|
|
683
|
+
*/
|
|
684
|
+
textRange(scriptId: string, segmentId: string, start: number, end: number): SegmentSelection;
|
|
685
|
+
dispose(): void;
|
|
686
|
+
private mutate;
|
|
687
|
+
private notify;
|
|
688
|
+
private assertActive;
|
|
689
|
+
}
|
|
690
|
+
//#endregion
|
|
691
|
+
//#region src/dsl/voiceover-actions.d.ts
|
|
692
|
+
interface VoiceoverCaptionInput {
|
|
693
|
+
clipId?: string;
|
|
694
|
+
startMs: number;
|
|
695
|
+
durationMs: number;
|
|
696
|
+
/** The segment of the voiceover's script it shows, by index; timing remains a separate fact. */
|
|
697
|
+
segment: number;
|
|
698
|
+
/** A UTF-16 run inside that segment; without one the whole segment shows. */
|
|
699
|
+
range?: {
|
|
700
|
+
start: number;
|
|
701
|
+
end: number;
|
|
702
|
+
};
|
|
703
|
+
style?: CaptionStyle;
|
|
704
|
+
}
|
|
705
|
+
interface ApplyVoiceoverInput {
|
|
706
|
+
clipId?: string;
|
|
707
|
+
trackId: string;
|
|
708
|
+
captionTrackId?: string;
|
|
709
|
+
media: Extract<Media, {
|
|
710
|
+
kind: 'audio' | 'voiceover-recording';
|
|
711
|
+
}> & {
|
|
712
|
+
kind: 'voiceover-recording';
|
|
713
|
+
};
|
|
714
|
+
/**
|
|
715
|
+
* What the recording says: an existing AudioScript, a new one of these `segments`, or a
|
|
716
|
+
* PhoneticScript it was spoken from. A recording spoken from a PhoneticScript is derived-from it,
|
|
717
|
+
* and its captions select segments of that variant's base script.
|
|
718
|
+
*/
|
|
719
|
+
script: {
|
|
720
|
+
audioScriptId: string;
|
|
721
|
+
segments?: never;
|
|
722
|
+
phoneticScriptId?: never;
|
|
723
|
+
} | {
|
|
724
|
+
segments: string[];
|
|
725
|
+
audioScriptId?: never;
|
|
726
|
+
phoneticScriptId?: never;
|
|
727
|
+
defaultLanguage?: string;
|
|
728
|
+
} | {
|
|
729
|
+
phoneticScriptId: string;
|
|
730
|
+
audioScriptId?: never;
|
|
731
|
+
segments?: never;
|
|
732
|
+
};
|
|
733
|
+
placement: ClipPlacement;
|
|
734
|
+
/**
|
|
735
|
+
* The digest of what the recording was synthesized from (D177): the PhoneticScript as it was
|
|
736
|
+
* read for synthesis. Absent, the source's digest as this voiceover leaves it is recorded.
|
|
737
|
+
*/
|
|
738
|
+
sourceDigest?: string;
|
|
739
|
+
volume?: number;
|
|
740
|
+
voice?: Voice;
|
|
741
|
+
/** Complete generated caption set for this use. Other uses of the recording are untouched. */
|
|
742
|
+
captions: readonly VoiceoverCaptionInput[];
|
|
743
|
+
}
|
|
744
|
+
interface VoiceoverResult {
|
|
745
|
+
clipId: string;
|
|
746
|
+
mediaId: string;
|
|
747
|
+
audioScriptId: string;
|
|
748
|
+
/** Ids of a new script's segments, in order; empty when the script already exists. */
|
|
749
|
+
segmentIds: string[];
|
|
750
|
+
captionClipIds: string[];
|
|
751
|
+
captionIds: string[];
|
|
752
|
+
}
|
|
753
|
+
//#endregion
|
|
754
|
+
//#region src/dsl/dsl-editor.d.ts
|
|
755
|
+
/**
|
|
756
|
+
* Stores raw content in Memota as a text file and returns the file's facts. The host owns the
|
|
757
|
+
* store; an entity with the Media File trait keeps the facts beside the content (D178).
|
|
758
|
+
*/
|
|
759
|
+
type UploadText = (text: string) => Promise<StoredFile>;
|
|
760
|
+
/** Business edits write DSL facts in one audited transaction; layout is derived on read. */
|
|
761
|
+
declare class DslEditor {
|
|
762
|
+
readonly dsl: MedeoDsl;
|
|
763
|
+
private readonly idFactory;
|
|
764
|
+
private readonly uploadText?;
|
|
765
|
+
constructor(dsl: MedeoDsl, idFactory?: DslIdFactory, uploadText?: UploadText | undefined);
|
|
766
|
+
createTrack(role: TrackRole, options?: CommitOptions): string;
|
|
767
|
+
registerMedia(media: Media, options?: CommitOptions): string;
|
|
768
|
+
addClips(input: AddDslClipsInput, options?: CommitOptions): string[];
|
|
769
|
+
/** index is measured in the target's children after removing the moved Clip. */
|
|
770
|
+
moveClip(clipId: string, trackId: string, index?: number, options?: CommitOptions): void;
|
|
771
|
+
trimClip(clipId: string, window: {
|
|
772
|
+
inMs?: number;
|
|
773
|
+
outMs?: number;
|
|
774
|
+
}, options?: CommitOptions): void;
|
|
775
|
+
setClipSpeed(clipId: string, speed: {
|
|
776
|
+
rate: number;
|
|
777
|
+
} | undefined, options?: CommitOptions): void;
|
|
778
|
+
setClipVolume(clipId: string, volume: number | undefined, options?: CommitOptions): void;
|
|
779
|
+
/** A script of these segments, in order; each segment gets its own id. */
|
|
780
|
+
createAudioScript(segments: readonly string[], defaultLanguage?: string, options?: CommitOptions): string;
|
|
781
|
+
editAudioScript(scriptId: string, segmentId: string, expectedBodyId: string, edits: readonly TextEdit[], options?: CommitOptions): void;
|
|
782
|
+
/** Adds a segment at `index`, the end by default, and returns its id. */
|
|
783
|
+
insertScriptSegment(scriptId: string, text: string, index?: number, options?: CommitOptions): string;
|
|
784
|
+
/** `index` is measured after removing the segment. */
|
|
785
|
+
moveScriptSegment(scriptId: string, segmentId: string, index: number, options?: CommitOptions): void;
|
|
786
|
+
/** Captions and PhoneticScripts selecting the segment keep their selection, which then shows nothing (D72). */
|
|
787
|
+
deleteScriptSegment(scriptId: string, segmentId: string, options?: CommitOptions): void;
|
|
788
|
+
createCaption(input: ((SegmentRange & {
|
|
789
|
+
text?: never;
|
|
790
|
+
}) | {
|
|
791
|
+
text: string;
|
|
792
|
+
audioScriptId?: never;
|
|
793
|
+
segmentId?: never;
|
|
794
|
+
start?: never;
|
|
795
|
+
end?: never;
|
|
796
|
+
}) & {
|
|
797
|
+
style?: CaptionStyle;
|
|
798
|
+
}, options?: CommitOptions): string;
|
|
799
|
+
/** Show a segment of a script, or a run of it, in place of the Caption's own text. */
|
|
800
|
+
setCaptionContent(captionId: string, selection: SegmentRange, options?: CommitOptions): void;
|
|
801
|
+
setCaptionText(captionId: string, text: string, options?: CommitOptions): void;
|
|
802
|
+
editCaptionText(captionId: string, expectedBodyId: string, edits: readonly TextEdit[], options?: CommitOptions): void;
|
|
803
|
+
moveTrack(trackId: string, index: number, options?: CommitOptions): void;
|
|
804
|
+
setTrackHidden(trackId: string, hidden: boolean | undefined, options?: CommitOptions): void;
|
|
805
|
+
deleteTrack(trackId: string, onAnchored: 'cascade' | 'detach', options?: CommitOptions): void;
|
|
806
|
+
setClipPlacement(clipId: string, placement: ClipPlacement, options?: CommitOptions): void;
|
|
807
|
+
moveClips(input: MoveDslClipsInput, options?: CommitOptions): void;
|
|
808
|
+
deleteClips(clipIds: readonly string[], onAnchored: 'cascade' | 'detach', options?: CommitOptions): void;
|
|
809
|
+
replaceClipSource(clipId: string, input: ClipSource & {
|
|
810
|
+
inMs: number;
|
|
811
|
+
outMs: number;
|
|
812
|
+
}, options?: CommitOptions): void;
|
|
813
|
+
replaceClips(input: ReplaceDslClipsInput, options?: CommitOptions): string[];
|
|
814
|
+
updateClips(updates: readonly DslClipUpdate[], options?: CommitOptions): void;
|
|
815
|
+
patchCaptionStyle(captionIds: readonly string[], patch: FieldPatch<CaptionStyle>, options?: CommitOptions): void;
|
|
816
|
+
applyVoiceover(input: ApplyVoiceoverInput, options?: CommitOptions): VoiceoverResult;
|
|
817
|
+
private voiceoverScriptId;
|
|
818
|
+
/**
|
|
819
|
+
* Write a PhoneticScript: create one for a segment of a script, or a run of it, or, given
|
|
820
|
+
* `phoneticScriptId`, replace its selection and what to synthesize together (D181). A
|
|
821
|
+
* `phonemeScript` is stored as a Memota text file first, and the file's facts are written with
|
|
822
|
+
* it; an unchanged one keeps its file. Recordings already spoken from it keep their derived-from.
|
|
823
|
+
*/
|
|
824
|
+
setPhoneticScript(input: SegmentRange & {
|
|
825
|
+
phoneticScriptId?: string;
|
|
826
|
+
phonemeScript?: string;
|
|
827
|
+
}, options?: CommitOptions): Promise<string>;
|
|
828
|
+
/** The file holding `text`: the one the PhoneticScript keeps while its text is unchanged, else a new upload. */
|
|
829
|
+
private fileFor;
|
|
830
|
+
setBgm(input: ClipSource & {
|
|
831
|
+
trackId: string;
|
|
832
|
+
clipId?: string;
|
|
833
|
+
volume?: number;
|
|
834
|
+
}, options?: CommitOptions): string;
|
|
835
|
+
private write;
|
|
836
|
+
}
|
|
837
|
+
//#endregion
|
|
838
|
+
//#region src/dsl/initial-document.d.ts
|
|
839
|
+
/** One server/host creates the foundation; peers import its binary identity instead of initializing independently. */
|
|
840
|
+
declare function createInitialMedeoDsl(options?: CreateMedeoDslOptions): MedeoDsl;
|
|
841
|
+
//#endregion
|
|
842
|
+
//#region src/dsl/projection/types.d.ts
|
|
843
|
+
interface DslClipLayout {
|
|
844
|
+
clipId: string;
|
|
845
|
+
trackId: string;
|
|
846
|
+
sourceId?: string;
|
|
847
|
+
inMs: number;
|
|
848
|
+
outMs: number;
|
|
849
|
+
rate: number;
|
|
850
|
+
volume: number;
|
|
851
|
+
startMs: number;
|
|
852
|
+
durationMs: number;
|
|
853
|
+
mode: 'sequential' | 'absolute' | 'anchored' | 'fallback';
|
|
854
|
+
anchorClipId?: string;
|
|
855
|
+
fillTimeline: boolean;
|
|
856
|
+
}
|
|
857
|
+
interface DslTrackLayout {
|
|
858
|
+
trackId: string;
|
|
859
|
+
role: TrackRole;
|
|
860
|
+
hidden: boolean;
|
|
861
|
+
clips: DslClipLayout[];
|
|
862
|
+
}
|
|
863
|
+
interface DslLayout {
|
|
864
|
+
timelineId: string;
|
|
865
|
+
tracks: DslTrackLayout[];
|
|
866
|
+
clips: Record<string, DslClipLayout>;
|
|
867
|
+
durationMs: number;
|
|
868
|
+
diagnostics: DslDiagnostic[];
|
|
869
|
+
}
|
|
870
|
+
/** Unsupported legacy representations fail explicitly; recoverable CRDT state is returned as diagnostics. */
|
|
871
|
+
declare class DslProjectionError extends Error {
|
|
872
|
+
readonly issues: readonly DslDiagnostic[];
|
|
873
|
+
constructor(issues: readonly DslDiagnostic[]);
|
|
874
|
+
}
|
|
875
|
+
//#endregion
|
|
876
|
+
//#region src/dsl/projection/layout.d.ts
|
|
877
|
+
/** Pure deterministic solve. Constraints only move sequential roots; anchors retain their exact offsets. */
|
|
878
|
+
declare function resolveDslLayout(snapshot: MedeoDslSnapshot): DslLayout;
|
|
879
|
+
//#endregion
|
|
880
|
+
//#region src/dsl/projection/to-video-draft.d.ts
|
|
881
|
+
interface VideoDraftProjection {
|
|
882
|
+
content: VideoDraftContent;
|
|
883
|
+
diagnostics: DslDiagnostic[];
|
|
884
|
+
}
|
|
885
|
+
/** A content read view, not an archive of authoring identities, rich-text marks or provenance. */
|
|
886
|
+
declare function toVideoDraft(snapshot: MedeoDslSnapshot): VideoDraftProjection;
|
|
887
|
+
//#endregion
|
|
888
|
+
//#region src/dsl/projection/audio-scripts.d.ts
|
|
889
|
+
/**
|
|
890
|
+
* An AudioScript with everything that says or shows it, read from the same snapshot as the
|
|
891
|
+
* VideoDraft. Speeches and captions come in playback order.
|
|
892
|
+
*/
|
|
893
|
+
interface AudioScriptView {
|
|
894
|
+
id: string;
|
|
895
|
+
/** Its segments, in order. */
|
|
896
|
+
segments: {
|
|
897
|
+
id: string;
|
|
898
|
+
text: string;
|
|
899
|
+
language?: string;
|
|
900
|
+
}[];
|
|
901
|
+
/** Media the script was read off (a transcript), through derived-from. */
|
|
902
|
+
sourceMediaIds: string[];
|
|
903
|
+
/**
|
|
904
|
+
* Its variants written for synthesis: the segment each is for (by index, absent once that
|
|
905
|
+
* segment is gone), what its selection holds, what to synthesize, and its file's digest.
|
|
906
|
+
*/
|
|
907
|
+
phoneticScripts: {
|
|
908
|
+
id: string;
|
|
909
|
+
segment?: number;
|
|
910
|
+
text?: string;
|
|
911
|
+
phonemeScript?: string;
|
|
912
|
+
digest?: string;
|
|
913
|
+
}[];
|
|
914
|
+
/** Speech Clips playing a recording of these words. */
|
|
915
|
+
speeches: {
|
|
916
|
+
clipId: string;
|
|
917
|
+
recordingId: string; /** The PhoneticScript the recording was spoken from; absent when it derives from the script directly. */
|
|
918
|
+
phoneticScriptId?: string;
|
|
919
|
+
voices: {
|
|
920
|
+
voiceId: string;
|
|
921
|
+
key: string;
|
|
922
|
+
name?: string;
|
|
923
|
+
}[];
|
|
924
|
+
/**
|
|
925
|
+
* Whether the recording was synthesized from its source as it is now: the digest its
|
|
926
|
+
* derived-from records equals the source's digest (D177). Absent when either has none.
|
|
927
|
+
*/
|
|
928
|
+
applied?: boolean;
|
|
929
|
+
}[];
|
|
930
|
+
/** Caption Clips showing one of its segments. A Caption with its own text shows none. */
|
|
931
|
+
captions: {
|
|
932
|
+
clipId: string;
|
|
933
|
+
captionId: string;
|
|
934
|
+
segment: number;
|
|
935
|
+
}[];
|
|
936
|
+
}
|
|
937
|
+
/** Every AudioScript in the document with its PhoneticScripts, the Speech Clips saying it and the Caption Clips showing it. */
|
|
938
|
+
declare function toAudioScriptViews(snapshot: MedeoDslSnapshot): AudioScriptView[];
|
|
939
|
+
//#endregion
|
|
940
|
+
//#region src/dsl/projection/from-video-draft.d.ts
|
|
941
|
+
interface FromVideoDraftOptions extends CreateMedeoDslOptions {
|
|
942
|
+
/** Complete physical media facts, keyed by their external system/key; no IO runs in the converter. */
|
|
943
|
+
mediaFacts?: readonly Media[];
|
|
944
|
+
audit: DslAudit;
|
|
945
|
+
}
|
|
946
|
+
interface ImportedVideoDraft {
|
|
947
|
+
dsl: MedeoDsl;
|
|
948
|
+
diagnostics: DslDiagnostic[];
|
|
949
|
+
}
|
|
950
|
+
/** One-time import into a newly owned document; never reverse-diff a live collaborative document. */
|
|
951
|
+
declare function fromVideoDraft(input: VideoDraftInput, options: FromVideoDraftOptions): ImportedVideoDraft;
|
|
952
|
+
//#endregion
|
|
953
|
+
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 };
|