@mengine/medeo-client 1.3.0 → 1.3.1-alpha.0
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 +95 -1
- package/dist/document-Caidonf8.js +3354 -0
- package/dist/index-CMa6ZCtX.d.ts +609 -0
- package/dist/{index-DWVYLTjv.d.ts → index-WxMNUbOa.d.ts} +272 -628
- package/dist/index.d.ts +456 -53
- package/dist/index.js +2520 -676
- package/dist/schemas.d.ts +2 -0
- package/dist/schemas.js +482 -0
- package/dist/shared-iWnU2osE.js +39 -0
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +40 -1
- package/package.json +9 -5
- package/dist/document-C0o_cjAH.js +0 -1654
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as index_d_exports } from "./index-CMa6ZCtX.js";
|
|
2
|
+
import { $ as VoiceDescriptor, A as generatePartId, At as Attachment, B as ResolvedEntityClipPlacement, C as PlannedSemanticOpKind, Ct as VideoDocumentSchemaVersion, D as SnapshotReadable, Dt as VideoDraftPartUnion, E as SchemaValidator, Et as VideoDraft, F as videoDocumentMirrorSchema, Ft as Timeline$1, G as EntityTimelineProjectionError, H as ResolvedEntityTrack, I as VideoDocumentValidationError, It as Track$1, J as JsonObject, K as EntityRelationRows, L as assertValidVideoDocument, Lt as TrackItem$1, M as TrackItemDraft, Mt as CaptionStyle, N as VideoDocumentDraft, Nt as PartAggregation, O as ValidationError, Ot as effectiveVideoClipDurationMs, P as VideoDocumentMirrorSchema, Pt as SpeedShift, Q as SequenceRange, R as validateVideoDocument, S as ImplementedSemanticOpKind, St as VideoDocument, T as isImplementedSemanticOpKind, Tt as VideoDocumentValidationIssueCode, U as resolveEntityTimelineLayout, V as ResolvedEntityTimelineLayout, W as projectEntityTimeline, X as CaptionStyleFields, Y as JsonValue, Z as SequenceDuration, _ as SemanticEditor, _t as Track, a as PlainMemoryAdapter, at as buildSpeechHostMap, b as TransactAudit, bt as VIDEO_DOCUMENT_SCHEMA_VERSION, c as MirrorVideoDocumentAdapter, ct as toVideoDocument, d as createMirrorVideoDocument, dt as DEFAULT_UNIT_TIME_MS, et as EntityId, f as createMirrorVideoDocumentAdapter, ft as ENTITY_TIMELINE_PROJECTION_SCHEMA_VERSION, g as SemanticDocumentAdapter, gt as Timeline, h as OpActor, ht as SpeechPart, i as JournalEntry, it as SpeechHostMap, j as TrackDraft, jt as CaptionPart$1, k as PartIdFactory, kt as speedOf, l as MirrorVideoDocumentOptions, lt as BgmPart, m as CommitOptions, mt as PartUnion, n as videoDocumentSchema, nt as buildInitialVideoDocument, o as PlainMemoryAdapterOptions, ot as derivePositionFromAbs, p as writeVideoDocumentToDraft, pt as PartKind, q as EntityRow, r as readVideoDocumentFromDraft, rt as DerivedItemPosition, s as createPlainMemoryAdapter, st as fromVideoDocument, t as partUnionSchema, tt as InitialDocumentFacts, u as applyEntityTimelineProjection, ut as CaptionPart, v as SemanticOpInput, vt as TrackItem, w as SemanticOpKind, wt as VideoDocumentValidationIssue, x as IMPLEMENTED_SEMANTIC_OP_KINDS, xt as VideoClipPart, y as SemanticOpName, yt as TrackItemTimePosition, z as EntityTimelineTrackRole } from "./index-WxMNUbOa.js";
|
|
2
3
|
import { PeerID } from "loro-crdt";
|
|
3
4
|
import { DocState } from "@mengine/sync";
|
|
4
5
|
import { BaseDocStorage, Connection, DocDiff, DocPushReceipt, DocSnapshotRecord, DocStorage, DocStorageOptions, DocUpdate, DocUpdateRecord } from "@mengine/storage";
|
|
@@ -177,33 +178,432 @@ interface MengineEventStreamOptions {
|
|
|
177
178
|
}
|
|
178
179
|
declare function readMengineEventStream(options: MengineEventStreamOptions): Promise<void>;
|
|
179
180
|
//#endregion
|
|
180
|
-
//#region src/editor/
|
|
181
|
+
//#region src/entity-editor/entity-graph-http-client.d.ts
|
|
182
|
+
/** One authenticated revision of the authoritative Medeo Entity graph. */
|
|
183
|
+
interface EntityGraphState {
|
|
184
|
+
readonly revision: number;
|
|
185
|
+
readonly rows: EntityRelationRows;
|
|
186
|
+
}
|
|
187
|
+
interface EntityGraphCommitOptions {
|
|
188
|
+
/** Server version vector proving the explicit legacy-to-Entity migration baseline. */
|
|
189
|
+
readonly migrationBaseVv?: string;
|
|
190
|
+
}
|
|
191
|
+
/** Browser-safe authenticated CAS client for a document's Entity graph. */
|
|
192
|
+
declare class EntityGraphHttpClient {
|
|
193
|
+
private readonly options;
|
|
194
|
+
private readonly transport;
|
|
195
|
+
private readonly endpoint;
|
|
196
|
+
constructor(options: MengineHttpClientOptions);
|
|
197
|
+
fetchState(): Promise<EntityGraphState>;
|
|
198
|
+
/**
|
|
199
|
+
* Replace the complete Entity graph under the baseline revision.
|
|
200
|
+
*
|
|
201
|
+
* Deletion intent is derived from baseline IDs omitted from `nextRows`, so a
|
|
202
|
+
* transient create-then-remove never becomes a request to delete unknown
|
|
203
|
+
* persisted data.
|
|
204
|
+
*/
|
|
205
|
+
commit(baseState: EntityGraphState, nextRows: EntityRelationRows, options?: EntityGraphCommitOptions): Promise<EntityGraphState>;
|
|
206
|
+
private request;
|
|
207
|
+
}
|
|
208
|
+
//#endregion
|
|
209
|
+
//#region src/entity-editor/types.d.ts
|
|
210
|
+
/** Injectable domain-id mint shared by Entity and Relation authoring surfaces. */
|
|
211
|
+
type EntityTimelineIdFactory = (prefix: 'entity' | 'relation') => string;
|
|
212
|
+
interface ImageMediaAssetFact {
|
|
213
|
+
readonly assetId: string;
|
|
214
|
+
readonly kind: 'image';
|
|
215
|
+
readonly storageKey?: string;
|
|
216
|
+
}
|
|
217
|
+
interface VideoMediaAssetFact {
|
|
218
|
+
readonly assetId: string;
|
|
219
|
+
readonly kind: 'video';
|
|
220
|
+
readonly durationMs: number;
|
|
221
|
+
readonly storageKey?: string;
|
|
222
|
+
}
|
|
223
|
+
interface AudioMediaAssetFact {
|
|
224
|
+
readonly assetId: string;
|
|
225
|
+
readonly kind: 'audio';
|
|
226
|
+
readonly durationMs: number;
|
|
227
|
+
readonly storageKey: string;
|
|
228
|
+
}
|
|
229
|
+
interface VoiceMediaAssetFact {
|
|
230
|
+
/** Stable external speech result id, independent of the placed Clip id. */
|
|
231
|
+
readonly assetId: string;
|
|
232
|
+
readonly kind: 'voice';
|
|
233
|
+
readonly durationMs: number;
|
|
234
|
+
readonly storageKey: string;
|
|
235
|
+
/** Present for synthesized voice, absent for original recorded audio. */
|
|
236
|
+
readonly voice?: VoiceDescriptor;
|
|
237
|
+
}
|
|
238
|
+
/** Facts resolved from media storage. A trim window never substitutes for intrinsic duration. */
|
|
239
|
+
type MediaAssetFact = ImageMediaAssetFact | VideoMediaAssetFact | AudioMediaAssetFact | VoiceMediaAssetFact;
|
|
240
|
+
type ClipPlacement = {
|
|
241
|
+
readonly kind: 'sequential';
|
|
242
|
+
readonly order: number;
|
|
243
|
+
} | {
|
|
244
|
+
readonly kind: 'absolute';
|
|
245
|
+
readonly targetRange: SequenceRange<number>;
|
|
246
|
+
} | {
|
|
247
|
+
readonly kind: 'anchored';
|
|
248
|
+
readonly hostClipEntityId: string;
|
|
249
|
+
readonly anchorOffset: number;
|
|
250
|
+
};
|
|
251
|
+
interface InsertPlacedClipInput {
|
|
252
|
+
readonly trackEntityId: string;
|
|
253
|
+
readonly contentEntityId: string;
|
|
254
|
+
readonly sourceRange: SequenceRange<number>;
|
|
255
|
+
readonly duration: SequenceDuration<number>;
|
|
256
|
+
readonly placement: ClipPlacement;
|
|
257
|
+
readonly clipPayload?: JsonObject;
|
|
258
|
+
/** Stable caller-owned placement identity, when one already exists outside the graph. */
|
|
259
|
+
readonly clipEntityId?: string;
|
|
260
|
+
}
|
|
261
|
+
interface SetClipPlacementInput {
|
|
262
|
+
readonly clipEntityId: string;
|
|
263
|
+
readonly placement: ClipPlacement;
|
|
264
|
+
}
|
|
265
|
+
type SequentialClipAnchor = {
|
|
266
|
+
readonly position: 'before' | 'after';
|
|
267
|
+
readonly clipEntityId: string;
|
|
268
|
+
} | {
|
|
269
|
+
readonly position: 'trackStart';
|
|
270
|
+
};
|
|
271
|
+
interface MoveSequentialClipsInput {
|
|
272
|
+
readonly clipEntityIds: readonly string[];
|
|
273
|
+
readonly anchor: SequentialClipAnchor;
|
|
274
|
+
readonly onAnchored: 'follow' | 'keepAbsolute';
|
|
275
|
+
}
|
|
276
|
+
interface MoveClipsToStartsInput {
|
|
277
|
+
readonly moves: readonly {
|
|
278
|
+
readonly clipEntityId: string;
|
|
279
|
+
readonly newStartMs: number;
|
|
280
|
+
}[];
|
|
281
|
+
/** Absolute-time drags preserve every voiceover's current visible landing. */
|
|
282
|
+
readonly onAnchored: 'keepAbsolute';
|
|
283
|
+
}
|
|
284
|
+
interface DeleteClipTreeInput {
|
|
285
|
+
readonly clipEntityIds: readonly string[];
|
|
286
|
+
readonly onAnchored: 'cascade' | 'detach';
|
|
287
|
+
}
|
|
288
|
+
interface VoiceoverCaptionFact {
|
|
289
|
+
/** Stable placed caption identity supplied by the materialized side effect. */
|
|
290
|
+
readonly captionClipEntityId: string;
|
|
291
|
+
readonly text: string;
|
|
292
|
+
readonly startMs: number;
|
|
293
|
+
readonly durationMs: number;
|
|
294
|
+
readonly style?: CaptionStyleFields;
|
|
295
|
+
}
|
|
296
|
+
type VoiceoverTakeInput = {
|
|
297
|
+
readonly timelineEntityId: string; /** Stable placed speech identity, distinct from media.assetId. */
|
|
298
|
+
readonly voiceoverClipEntityId: string;
|
|
299
|
+
readonly media: VoiceMediaAssetFact; /** Complete spoken text; the editor owns the deterministic local script segment identity. */
|
|
300
|
+
readonly scriptText: string;
|
|
301
|
+
readonly volume: number;
|
|
302
|
+
readonly captions: readonly VoiceoverCaptionFact[];
|
|
303
|
+
} & ({
|
|
304
|
+
readonly placement: ClipPlacement;
|
|
305
|
+
readonly hostClipEntityId?: never;
|
|
306
|
+
readonly anchorOffset?: never;
|
|
307
|
+
} | {
|
|
308
|
+
readonly placement?: never;
|
|
309
|
+
readonly hostClipEntityId: string;
|
|
310
|
+
readonly anchorOffset: number;
|
|
311
|
+
});
|
|
312
|
+
type VisualMediaAssetFact = ImageMediaAssetFact | VideoMediaAssetFact;
|
|
313
|
+
interface InsertMediaClipInput {
|
|
314
|
+
readonly timelineEntityId: string;
|
|
315
|
+
readonly clipEntityId?: string;
|
|
316
|
+
readonly media: VisualMediaAssetFact;
|
|
317
|
+
/** Source/display window in whole milliseconds. Images use this as their finite display span. */
|
|
318
|
+
readonly sourceRange: SequenceRange<number>;
|
|
319
|
+
readonly placement: ClipPlacement;
|
|
320
|
+
readonly volume?: number;
|
|
321
|
+
}
|
|
322
|
+
interface ReplaceMediaClipInput {
|
|
323
|
+
readonly clipEntityId: string;
|
|
324
|
+
readonly media: VisualMediaAssetFact;
|
|
325
|
+
readonly sourceRange: SequenceRange<number>;
|
|
326
|
+
}
|
|
327
|
+
interface ReplacementMediaClipInput {
|
|
328
|
+
readonly clipEntityId?: string;
|
|
329
|
+
readonly media: VisualMediaAssetFact;
|
|
330
|
+
readonly sourceRange: SequenceRange<number>;
|
|
331
|
+
readonly volume?: number;
|
|
332
|
+
}
|
|
333
|
+
type MediaClipInsertion = {
|
|
334
|
+
readonly kind: 'before';
|
|
335
|
+
readonly clipEntityId: string;
|
|
336
|
+
} | {
|
|
337
|
+
readonly kind: 'after';
|
|
338
|
+
readonly clipEntityId: string;
|
|
339
|
+
} | {
|
|
340
|
+
readonly kind: 'firstStart';
|
|
341
|
+
readonly startMs: number;
|
|
342
|
+
};
|
|
343
|
+
interface InsertMediaClipsInput {
|
|
344
|
+
readonly timelineEntityId: string;
|
|
345
|
+
readonly clips: readonly ReplacementMediaClipInput[];
|
|
346
|
+
/** One placement decision for the whole input-ordered block. */
|
|
347
|
+
readonly insertion: MediaClipInsertion;
|
|
348
|
+
}
|
|
349
|
+
interface ReplaceSequentialClipsInput {
|
|
350
|
+
readonly timelineEntityId: string;
|
|
351
|
+
readonly oldClipEntityIds: readonly string[];
|
|
352
|
+
readonly newClips: readonly ReplacementMediaClipInput[];
|
|
353
|
+
readonly onAnchored: 'remap' | 'cascade';
|
|
354
|
+
}
|
|
355
|
+
interface SetClipVolumeInput {
|
|
356
|
+
readonly clipEntityId: string;
|
|
357
|
+
/** Playback gain in decibels. */
|
|
358
|
+
readonly volume: number;
|
|
359
|
+
}
|
|
360
|
+
interface LinearClipSpeed {
|
|
361
|
+
readonly kind: 'linear';
|
|
362
|
+
readonly rate: number;
|
|
363
|
+
readonly mode?: string;
|
|
364
|
+
}
|
|
365
|
+
interface SetClipSpeedInput {
|
|
366
|
+
readonly clipEntityId: string;
|
|
367
|
+
readonly timeRemapping: LinearClipSpeed | null;
|
|
368
|
+
}
|
|
369
|
+
interface TrimClipInput {
|
|
370
|
+
readonly clipEntityId: string;
|
|
371
|
+
readonly sourceRange: SequenceRange<number>;
|
|
372
|
+
}
|
|
373
|
+
interface VoiceoverTakeResult {
|
|
374
|
+
readonly voiceoverClipEntityId: string;
|
|
375
|
+
readonly voiceEntityId: string;
|
|
376
|
+
readonly audioScriptEntityId: string;
|
|
377
|
+
readonly captionClipEntityIds: readonly string[];
|
|
378
|
+
}
|
|
379
|
+
interface MoveVoiceoverInput {
|
|
380
|
+
readonly voiceoverClipEntityId: string;
|
|
381
|
+
/** Absolute requested timeline start; MEngine resolves and persists the host relation. */
|
|
382
|
+
readonly newStartMs: number;
|
|
383
|
+
}
|
|
384
|
+
interface DeleteVoiceoverInput {
|
|
385
|
+
readonly voiceoverClipEntityIds: readonly string[];
|
|
386
|
+
}
|
|
387
|
+
interface SetBgmInput {
|
|
388
|
+
readonly timelineEntityId: string;
|
|
389
|
+
readonly bgmClipEntityId: string;
|
|
390
|
+
readonly media: AudioMediaAssetFact;
|
|
391
|
+
readonly volume: number;
|
|
392
|
+
}
|
|
393
|
+
interface DeleteBgmInput {
|
|
394
|
+
readonly timelineEntityId: string;
|
|
395
|
+
}
|
|
396
|
+
interface SetCaptionVisibilityInput {
|
|
397
|
+
readonly timelineEntityId: string;
|
|
398
|
+
readonly hidden: boolean;
|
|
399
|
+
}
|
|
400
|
+
interface PatchCaptionStyleInput {
|
|
401
|
+
readonly timelineEntityId: string;
|
|
402
|
+
readonly style: CaptionStyleFields;
|
|
403
|
+
}
|
|
404
|
+
interface InsertCaptionClipInput {
|
|
405
|
+
readonly timelineEntityId: string;
|
|
406
|
+
/** Stable placed caption identity, distinct from the Caption content identity. */
|
|
407
|
+
readonly captionClipEntityId?: string;
|
|
408
|
+
readonly text: string;
|
|
409
|
+
/** Intrinsic cue length of the Caption entity itself; display comes from the placement. */
|
|
410
|
+
readonly durationMs: number;
|
|
411
|
+
readonly style?: CaptionStyleFields;
|
|
412
|
+
readonly placement: ClipPlacement;
|
|
413
|
+
}
|
|
414
|
+
interface InsertClipInput {
|
|
415
|
+
readonly trackEntityId: string;
|
|
416
|
+
/** Existing Sequence media Entity id. Asset ids and URLs are not content ids. */
|
|
417
|
+
readonly contentEntityId: string;
|
|
418
|
+
readonly sourceRange: SequenceRange<number>;
|
|
419
|
+
readonly duration: SequenceDuration<number>;
|
|
420
|
+
readonly targetRange?: SequenceRange<number>;
|
|
421
|
+
readonly clipPayload?: JsonObject;
|
|
422
|
+
}
|
|
423
|
+
interface UpdateClipMarkerInput {
|
|
424
|
+
readonly clipEntityId: string;
|
|
425
|
+
readonly sourceRange?: SequenceRange<number>;
|
|
426
|
+
/** Passing `undefined` explicitly removes the optional target range. */
|
|
427
|
+
readonly targetRange?: SequenceRange<number> | undefined;
|
|
428
|
+
readonly duration?: SequenceDuration<number>;
|
|
429
|
+
/** Passing `undefined` explicitly removes the optional remapping value. */
|
|
430
|
+
readonly timeRemapping?: JsonValue | undefined;
|
|
431
|
+
}
|
|
432
|
+
interface MoveClipInput {
|
|
433
|
+
readonly clipEntityId: string;
|
|
434
|
+
readonly trackEntityId: string;
|
|
435
|
+
}
|
|
436
|
+
interface ReplaceClipContentInput {
|
|
437
|
+
readonly clipEntityId: string;
|
|
438
|
+
/** Existing Sequence media Entity id. Asset ids and URLs are not content ids. */
|
|
439
|
+
readonly contentEntityId: string;
|
|
440
|
+
readonly sourceRange: SequenceRange<number>;
|
|
441
|
+
readonly duration: SequenceDuration<number>;
|
|
442
|
+
readonly targetRange?: SequenceRange<number>;
|
|
443
|
+
readonly timeRemapping?: JsonValue;
|
|
444
|
+
}
|
|
445
|
+
interface DeleteClipInput {
|
|
446
|
+
readonly clipEntityId: string;
|
|
447
|
+
}
|
|
448
|
+
interface UpdateClipInput {
|
|
449
|
+
readonly clipEntityId: string;
|
|
450
|
+
/** Complete replacement for the Clip-owned payload. */
|
|
451
|
+
readonly payload: JsonObject;
|
|
452
|
+
}
|
|
453
|
+
type ClipEntityId = EntityId;
|
|
454
|
+
//#endregion
|
|
455
|
+
//#region src/entity-editor/entity-timeline-editor.d.ts
|
|
181
456
|
/**
|
|
182
|
-
*
|
|
457
|
+
* Graph-native timeline authoring over authoritative Medeo Entity and Relation rows.
|
|
183
458
|
*
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
459
|
+
* Each mutation is applied to a detached graph, validated as a complete DSL set,
|
|
460
|
+
* and committed only after validation succeeds.
|
|
461
|
+
*/
|
|
462
|
+
declare class EntityTimelineEditor {
|
|
463
|
+
private readonly idFactory;
|
|
464
|
+
private state;
|
|
465
|
+
constructor(initialRows: EntityRelationRows, idFactory?: EntityTimelineIdFactory);
|
|
466
|
+
rows(): EntityRelationRows;
|
|
467
|
+
insertClip(input: InsertClipInput): ClipEntityId;
|
|
468
|
+
insertPlacedClip(input: InsertPlacedClipInput): ClipEntityId;
|
|
469
|
+
updateClipMarker(input: UpdateClipMarkerInput): void;
|
|
470
|
+
setClipPlacement(input: SetClipPlacementInput): void;
|
|
471
|
+
moveSequentialClips(input: MoveSequentialClipsInput): void;
|
|
472
|
+
moveClipsToStarts(input: MoveClipsToStartsInput): void;
|
|
473
|
+
moveClip(input: MoveClipInput): void;
|
|
474
|
+
replaceClipContent(input: ReplaceClipContentInput): void;
|
|
475
|
+
insertMediaClip(input: InsertMediaClipInput): ClipEntityId;
|
|
476
|
+
insertMediaClips(input: InsertMediaClipsInput): readonly ClipEntityId[];
|
|
477
|
+
replaceMediaClip(input: ReplaceMediaClipInput): void;
|
|
478
|
+
setClipVolume(input: SetClipVolumeInput): void;
|
|
479
|
+
setClipSpeed(input: SetClipSpeedInput): void;
|
|
480
|
+
trimClip(input: TrimClipInput): void;
|
|
481
|
+
replaceSequentialClips(input: ReplaceSequentialClipsInput): readonly ClipEntityId[];
|
|
482
|
+
deleteClip(input: DeleteClipInput): void;
|
|
483
|
+
deleteClipTree(input: DeleteClipTreeInput): void;
|
|
484
|
+
updateClip(input: UpdateClipInput): void;
|
|
485
|
+
upsertVoiceoverTake(input: VoiceoverTakeInput): VoiceoverTakeResult;
|
|
486
|
+
moveVoiceover(input: MoveVoiceoverInput): void;
|
|
487
|
+
deleteVoiceover(input: DeleteVoiceoverInput): void;
|
|
488
|
+
setBgm(input: SetBgmInput): ClipEntityId;
|
|
489
|
+
deleteBgm(input: DeleteBgmInput): void;
|
|
490
|
+
setCaptionVisibility(input: SetCaptionVisibilityInput): void;
|
|
491
|
+
patchCaptionStyle(input: PatchCaptionStyleInput): void;
|
|
492
|
+
/**
|
|
493
|
+
* Place an independent Caption: its own content entity, inline text Asset,
|
|
494
|
+
* and Clip with a display Marker. No Voice, provenance, or alignment is
|
|
495
|
+
* required — the placement describes only this use. Moving or stretching
|
|
496
|
+
* the returned Clip later changes the Clip/Marker, never the Caption entity.
|
|
497
|
+
*/
|
|
498
|
+
insertCaptionClip(input: InsertCaptionClipInput): ClipEntityId;
|
|
499
|
+
private insertPlacedClipIntoDraft;
|
|
500
|
+
private ensureRoleTrack;
|
|
501
|
+
private ensureAudioScript;
|
|
502
|
+
private reconcileVoiceoverCaptions;
|
|
503
|
+
private ensureRoleTrackForClip;
|
|
504
|
+
private replaceCaptionSemanticRelations;
|
|
505
|
+
private removeCaptionClipGraph;
|
|
506
|
+
private replaceAnchorHost;
|
|
507
|
+
/** Rebuild the legacy edit baseline from current visual order before a high-level cascade. */
|
|
508
|
+
private normalizeMainSequential;
|
|
509
|
+
private resolveOneVoiceoverOverlap;
|
|
510
|
+
private applyClipPlacement;
|
|
511
|
+
private reanchorAtAbsolute;
|
|
512
|
+
private removeAnchoredDescendants;
|
|
513
|
+
private removeClipGraph;
|
|
514
|
+
private transact;
|
|
515
|
+
private mintEntityId;
|
|
516
|
+
private createRelation;
|
|
517
|
+
private relinkRelation;
|
|
518
|
+
private mintRelationId;
|
|
519
|
+
}
|
|
520
|
+
//#endregion
|
|
521
|
+
//#region src/entity-editor/editor-resources.d.ts
|
|
522
|
+
declare const roleOrder: {
|
|
523
|
+
readonly caption: 0;
|
|
524
|
+
readonly video_clip: 1;
|
|
525
|
+
readonly speech: 2;
|
|
526
|
+
readonly bgm: 3;
|
|
527
|
+
};
|
|
528
|
+
type EditorTrackRole = keyof typeof roleOrder;
|
|
529
|
+
interface EditorFoundation {
|
|
530
|
+
readonly rows: EntityRelationRows;
|
|
531
|
+
readonly timelineEntityId: string;
|
|
532
|
+
readonly trackEntityIds: Readonly<Record<EditorTrackRole, string>>;
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* MEngine editor policy, not a cardinality restriction on the general-purpose DSL.
|
|
191
536
|
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
537
|
+
* Media variants share one entity identity with their Asset: every
|
|
538
|
+
* Image/Video/Audio/Voice Entity must carry its own external locator, every
|
|
539
|
+
* external asset id has exactly one claimant, and no media variant may be
|
|
540
|
+
* bound through a legacy `physical-asset` Relation. Dual-entity media graphs
|
|
541
|
+
* are rejected, not migrated. Caption inline text keeps its inline Asset and
|
|
542
|
+
* `physical-asset` binding.
|
|
197
543
|
*/
|
|
544
|
+
declare function assertCanonicalEditorResources(rows: EntityRelationRows): void;
|
|
198
545
|
/**
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
546
|
+
* Commit-transition policy shared by the editor, the HTTP commit boundary, the
|
|
547
|
+
* host tool, and the entity stores. It compares the authoritative before and
|
|
548
|
+
* after rows of one CAS commit and enforces the single-identity write rules
|
|
549
|
+
* on the complete after state, with no exemption for historical graphs:
|
|
550
|
+
*
|
|
551
|
+
* 1. every Image/Video/Audio/Voice Entity carries its own Asset `external`
|
|
552
|
+
* identity;
|
|
553
|
+
* 2. no `physical-asset` Relation may bind a media variant (Caption inline
|
|
554
|
+
* text keeps its inline Asset and binding);
|
|
555
|
+
* 3. a self-carried media identity is immutable — it cannot be rewritten to
|
|
556
|
+
* another asset id.
|
|
557
|
+
*
|
|
558
|
+
* Dual-entity media graphs are rejected instead of being migrated or merged
|
|
559
|
+
* implicitly. Deleting media is explicit and allowed.
|
|
204
560
|
*/
|
|
205
|
-
|
|
206
|
-
|
|
561
|
+
declare function assertMediaAssetWritePolicy(before: EntityRelationRows, after: EntityRelationRows): void;
|
|
562
|
+
/** Add only missing editor structure; existing identities and owned settings are never replaced. */
|
|
563
|
+
declare function ensureEditorFoundation(initial: EntityRelationRows, idFactory?: EntityTimelineIdFactory, timelinePayload?: EntityRow['payload']): EditorFoundation;
|
|
564
|
+
//#endregion
|
|
565
|
+
//#region src/entity-editor/media-asset-import.d.ts
|
|
566
|
+
interface ImportedMediaAsset {
|
|
567
|
+
readonly rows: EntityRelationRows;
|
|
568
|
+
/** The single media variant identity for this asset id; it is its own Asset. */
|
|
569
|
+
readonly contentEntityId: string;
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* Import at the editor boundary, not at asset generation time. Existing
|
|
573
|
+
* provenance is retained.
|
|
574
|
+
*
|
|
575
|
+
* A media variant is a logical facet of its Asset and shares one entity
|
|
576
|
+
* identity: the import mints exactly one entity of the media kind that carries
|
|
577
|
+
* the external locator itself, and deduplicates only against existing variants
|
|
578
|
+
* that already carry the same `(system, key)`. Legacy dual-entity graphs
|
|
579
|
+
* (`asset` row plus a `physical-asset` binding) are not reused and are
|
|
580
|
+
* rejected by the canonical resource policy instead of being migrated.
|
|
581
|
+
*/
|
|
582
|
+
declare function importMediaAsset(initial: EntityRelationRows, fact: MediaAssetFact, idFactory?: EntityTimelineIdFactory): ImportedMediaAsset;
|
|
583
|
+
//#endregion
|
|
584
|
+
//#region src/entity-editor/legacy-entity-migration.d.ts
|
|
585
|
+
/** One-time import only. Ordinary editor operations must never reverse-diff a legacy document. */
|
|
586
|
+
declare function migrateLegacyTimelineToEntities(legacy: VideoDocument, assetFacts: readonly MediaAssetFact[], initial?: EntityRelationRows, idFactory?: EntityTimelineIdFactory): EntityRelationRows;
|
|
587
|
+
/** Server gate: a cutover may change representation, never the existing render facts. */
|
|
588
|
+
declare function assertEntityProjectionPreservesLegacy(legacy: VideoDocument, projection: VideoDocument, rows: EntityRelationRows): void;
|
|
589
|
+
//#endregion
|
|
590
|
+
//#region src/editor/journal.d.ts
|
|
591
|
+
/**
|
|
592
|
+
* Wire a plain-memory adapter + editor that share a recording id factory, so
|
|
593
|
+
* every mutating transact lands in `journal` with ordered `generated_ids`.
|
|
594
|
+
*/
|
|
595
|
+
declare function createEditSandbox(document: VideoDocument, options?: PlainMemoryAdapterOptions): {
|
|
596
|
+
adapter: PlainMemoryAdapter;
|
|
597
|
+
editor: SemanticEditor;
|
|
598
|
+
journal: readonly JournalEntry[];
|
|
599
|
+
};
|
|
600
|
+
/**
|
|
601
|
+
* Re-drive `doc` from a recorded journal, forcing each entry's `generated_ids`
|
|
602
|
+
* through a queue-backed id factory. Never mints fresh ids: an empty queue on
|
|
603
|
+
* demand throws `unrecorded id`; leftover ids after an entry throws
|
|
604
|
+
* `unconsumed ids`. Legacy entries without `generated_ids` are treated as `[]`.
|
|
605
|
+
*/
|
|
606
|
+
declare function replayJournal(doc: SemanticDocumentAdapter, journal: readonly JournalEntry[]): Promise<void>;
|
|
207
607
|
//#endregion
|
|
208
608
|
//#region src/editor/snapshot-utils.d.ts
|
|
209
609
|
/** Main-track item identity read from a raw snapshot (only `part_id` is needed). */
|
|
@@ -296,9 +696,7 @@ type PushResultKind = 'ack' | 'duplicate' | 'rejected' | 'failed' | 'nothing_to_
|
|
|
296
696
|
*/
|
|
297
697
|
interface PushResult {
|
|
298
698
|
kind: PushResultKind;
|
|
299
|
-
/** Server
|
|
300
|
-
mengineUpdateSeq?: number | undefined;
|
|
301
|
-
/** @deprecated Ack-only sequence retained until consumers adopt `mengineUpdateSeq`. */
|
|
699
|
+
/** Server-allocated sequence number; only present for `ack`. */
|
|
302
700
|
updateSeq?: number | undefined;
|
|
303
701
|
/** Whether the server held ops the local document lacked. See above. */
|
|
304
702
|
collaborated: boolean;
|
|
@@ -424,6 +822,16 @@ declare class ManualSyncDoc {
|
|
|
424
822
|
editorPeerId(): PeerID;
|
|
425
823
|
/** Current document projected to the legacy `VideoDraft` read shape. */
|
|
426
824
|
draft(): VideoDraft;
|
|
825
|
+
/**
|
|
826
|
+
* Replay a deterministic sandbox journal into this document.
|
|
827
|
+
*
|
|
828
|
+
* The adapter stays private so callers cannot bypass the manual-sync
|
|
829
|
+
* lifecycle; journal replay is the one host-side operation that needs the
|
|
830
|
+
* adapter's transaction boundary and recorded id queue. Durability is still
|
|
831
|
+
* explicit: call {@link push} after replay and report success only from its
|
|
832
|
+
* verdict.
|
|
833
|
+
*/
|
|
834
|
+
replayJournal(journal: readonly JournalEntry[]): Promise<void>;
|
|
427
835
|
/**
|
|
428
836
|
* Mark the document state the caller has just observed, for a later
|
|
429
837
|
* {@link hasChangedSince}.
|
|
@@ -577,9 +985,6 @@ declare class MedeoHttpDocStorage implements DocStorage {
|
|
|
577
985
|
* tool-level ack wait) subscribe here.
|
|
578
986
|
*/
|
|
579
987
|
subscribePushOutcome(callback: (outcome: PushOutcome) => void): () => void;
|
|
580
|
-
/** Authoritative HTTP reads and accepted pushes, never inferred from SSE bytes. */
|
|
581
|
-
subscribeServerVersion(callback: (version: Uint8Array) => void): () => void;
|
|
582
|
-
private reportServerVersion;
|
|
583
988
|
deleteDoc(_docId: string): Promise<void>;
|
|
584
989
|
subscribeDocUpdate(callback: (update: DocUpdate, origin: unknown) => void): () => void;
|
|
585
990
|
private assertDocId;
|
|
@@ -628,14 +1033,6 @@ interface WaitForServerAckOptions {
|
|
|
628
1033
|
/** Deadline in ms. Rejects with reason `timeout` when it elapses. */
|
|
629
1034
|
timeoutMs?: number;
|
|
630
1035
|
}
|
|
631
|
-
/** Document-level confirmation is independent of local operation completion. */
|
|
632
|
-
interface MengineDocSyncState {
|
|
633
|
-
/** Remote-only imports do not create a new local confirmation obligation. */
|
|
634
|
-
readonly confirmation: 'unknown' | 'pending' | 'confirmed';
|
|
635
|
-
/** Transport/activity phase. Idle does not imply confirmation; failure details
|
|
636
|
-
* remain available through push outcomes and confirmation wait errors. */
|
|
637
|
-
readonly phase: 'connecting' | 'idle' | 'syncing' | 'offline' | 'failed';
|
|
638
|
-
}
|
|
639
1036
|
interface MengineDocSessionOptions {
|
|
640
1037
|
docId: string;
|
|
641
1038
|
client: MengineHttpClient;
|
|
@@ -646,6 +1043,11 @@ interface MengineDocSessionOptions {
|
|
|
646
1043
|
*/
|
|
647
1044
|
localStorage?: DocStorageLike;
|
|
648
1045
|
sseReconnectDelayMs?: number;
|
|
1046
|
+
/**
|
|
1047
|
+
* Keep remote synchronization read-only: pull snapshot/diffs and subscribe to
|
|
1048
|
+
* SSE updates, but never POST local Loro updates to the server.
|
|
1049
|
+
*/
|
|
1050
|
+
readonlyMode?: boolean;
|
|
649
1051
|
}
|
|
650
1052
|
/**
|
|
651
1053
|
* A live editing session for one Medeo document — the single entry point clients
|
|
@@ -681,14 +1083,8 @@ declare class MengineDocSession {
|
|
|
681
1083
|
private adapterValue;
|
|
682
1084
|
private editorValue;
|
|
683
1085
|
private started;
|
|
684
|
-
private destroyed;
|
|
685
|
-
private lifetime;
|
|
686
|
-
private hasConnected;
|
|
687
|
-
private initialVersionValue;
|
|
688
|
-
private localVersionValue;
|
|
689
|
-
private pushErrorValue;
|
|
690
1086
|
/**
|
|
691
|
-
* Latest server oplog version seen on
|
|
1087
|
+
* Latest server oplog version seen on a push outcome. Lets `waitForServerAck`
|
|
692
1088
|
* return without waiting when the server is already known to cover the local
|
|
693
1089
|
* doc (e.g. nothing was edited since the last confirmed push).
|
|
694
1090
|
*/
|
|
@@ -703,14 +1099,14 @@ declare class MengineDocSession {
|
|
|
703
1099
|
*/
|
|
704
1100
|
subscribePushOutcome(callback: (outcome: PushOutcome) => void): () => void;
|
|
705
1101
|
/**
|
|
706
|
-
* Resolve once the server has durably accepted the local
|
|
1102
|
+
* Resolve once the server has durably accepted the local document state as of
|
|
707
1103
|
* *now* — the capability an Agent tool needs to answer "did my edit land?"
|
|
708
1104
|
* before reporting success.
|
|
709
1105
|
*
|
|
710
1106
|
* Call it right after the editor ops whose durability matters. It snapshots the
|
|
711
|
-
*
|
|
712
|
-
*
|
|
713
|
-
*
|
|
1107
|
+
* local doc's current version and resolves on the first push outcome whose
|
|
1108
|
+
* `serverVV` covers that version, i.e. the server log is at least as advanced as
|
|
1109
|
+
* the local doc was when this was called.
|
|
714
1110
|
*
|
|
715
1111
|
* Version coverage, not byte identity, is the acceptance test — for two reasons:
|
|
716
1112
|
* the ops may reach the server inside a merged blob rather than as the exact
|
|
@@ -732,6 +1128,18 @@ declare class MengineDocSession {
|
|
|
732
1128
|
* step. The committed change drives DocManager's local-update push.
|
|
733
1129
|
*/
|
|
734
1130
|
get editor(): SemanticEditor;
|
|
1131
|
+
/**
|
|
1132
|
+
* Opaque version token of the local oplog (base64 `VersionVector.encode`).
|
|
1133
|
+
* Equality-comparable only: equal means no observed change (local or
|
|
1134
|
+
* remote-arrived) since the token was taken. Throws when not started.
|
|
1135
|
+
*/
|
|
1136
|
+
version(): string;
|
|
1137
|
+
/**
|
|
1138
|
+
* The live document adapter, exposed for journal replay (commit channel).
|
|
1139
|
+
* Replaying through it still goes SemanticEditor → Loro → mengine-server —
|
|
1140
|
+
* no write bypass. Typed by the narrow interface on purpose.
|
|
1141
|
+
*/
|
|
1142
|
+
get documentAdapter(): SemanticDocumentAdapter;
|
|
735
1143
|
/** Current document snapshot (read model). */
|
|
736
1144
|
snapshot(): VideoDocument;
|
|
737
1145
|
/**
|
|
@@ -742,11 +1150,6 @@ declare class MengineDocSession {
|
|
|
742
1150
|
* surfaces through `subscribe`.
|
|
743
1151
|
*/
|
|
744
1152
|
start(): Promise<VideoDocument>;
|
|
745
|
-
getSyncState(): MengineDocSyncState;
|
|
746
|
-
private confirmationTarget;
|
|
747
|
-
/** Immediately supplies current state; unsubscribe when the host changes docs. */
|
|
748
|
-
subscribeSyncState(cb: (state: MengineDocSyncState) => void): () => void;
|
|
749
|
-
private emitSyncState;
|
|
750
1153
|
subscribe(cb: (event: MengineDocSessionUpdateEvent) => void): () => void;
|
|
751
1154
|
onStateChange(cb: (state: DocState) => void): () => void;
|
|
752
1155
|
getState(): DocState;
|
|
@@ -1088,4 +1491,4 @@ declare function hostForAbsMs(ranges: MainClipRange[], absMs: number): MainClipR
|
|
|
1088
1491
|
*/
|
|
1089
1492
|
declare function relativePositionForAbs(ranges: MainClipRange[], absMs: number): TrackItemTimePosition;
|
|
1090
1493
|
//#endregion
|
|
1091
|
-
export { type Aggregation, type Attachment, type BgmPart, type CaptionPart, type CaptionStyle, type CommitOptions, DEFAULT_UNIT_TIME_MS, type DerivedItemPosition, type DocStorageLike, type DocVersionMark, IMPLEMENTED_SEMANTIC_OP_KINDS, type ImplementedSemanticOpKind, type InitialDocumentFacts, LANE_KINDS_IN_STACK_ORDER, type LaneKind, type MainClipRange, type MakeEmptyPart, ManualSyncDoc, type ManualSyncDocOptions, MedeoHttpDocStorage, type MedeoHttpDocStorageOptions, MemoryDocStorage, MengineAckFailedError, type MengineAuditEntry, type MengineAuditResponse, MengineDocSession, type MengineDocSessionOptions, type MengineDocSessionUpdateEvent, type
|
|
1494
|
+
export { type Aggregation, type Attachment, type AudioMediaAssetFact, type BgmPart, type CaptionPart, type CaptionStyle, type ClipEntityId, type ClipPlacement, type CommitOptions, DEFAULT_UNIT_TIME_MS, type DeleteBgmInput, type DeleteClipInput, type DeleteClipTreeInput, type DeleteVoiceoverInput, type DerivedItemPosition, type DocStorageLike, type DocVersionMark, ENTITY_TIMELINE_PROJECTION_SCHEMA_VERSION, type EditorFoundation, type EntityGraphCommitOptions, EntityGraphHttpClient, type EntityGraphState, EntityTimelineEditor, type EntityTimelineIdFactory, EntityTimelineProjectionError, type EntityTimelineTrackRole, IMPLEMENTED_SEMANTIC_OP_KINDS, type ImageMediaAssetFact, type ImplementedSemanticOpKind, type ImportedMediaAsset, type InitialDocumentFacts, type InsertCaptionClipInput, type InsertClipInput, type InsertMediaClipInput, type InsertMediaClipsInput, type InsertPlacedClipInput, type JournalEntry, LANE_KINDS_IN_STACK_ORDER, type LaneKind, type LinearClipSpeed, type MainClipRange, type MakeEmptyPart, ManualSyncDoc, type ManualSyncDocOptions, MedeoHttpDocStorage, type MedeoHttpDocStorageOptions, type MediaAssetFact, type MediaClipInsertion, MemoryDocStorage, MengineAckFailedError, type MengineAuditEntry, type MengineAuditResponse, MengineDocSession, type MengineDocSessionOptions, type MengineDocSessionUpdateEvent, type MengineDocumentVersion, type MengineEventStreamOptions, MengineHttpClient, type MengineHttpClientOptions, MengineHttpRequestError, MenginePushRejectedError, type MenginePushResponse, type MenginePushUpdateResponse, type MengineRejectedResponse, type MengineSnapshotResponse, type MengineSseUpdateEvent, type MengineSyncResponse, type MengineUpdateMeta, MirrorVideoDocumentAdapter, type MirrorVideoDocumentOptions, type MoveClipInput, type MoveClipsToStartsInput, type MoveSequentialClipsInput, type MoveVoiceoverInput, type OpActor, type PartAggregation, type PartIdFactory, type PartKind, type PartUnion, type PatchCaptionStyleInput, PlainMemoryAdapter, type PlainMemoryAdapterOptions, type PlannedSemanticOpKind, type PullFailureReason, type PullResult, type PushOutcome, type PushOutcomeKind, type PushResult, type PushResultKind, type ReplaceClipContentInput, type ReplaceMediaClipInput, type ReplaceSequentialClipsInput, type ReplacementMediaClipInput, type ResolvedEntityClipPlacement, type ResolvedEntityTimelineLayout, type ResolvedEntityTrack, SchemaValidator, type SemanticDocumentAdapter, SemanticEditor, type SemanticOpInput, type SemanticOpKind, type SemanticOpName, type SequentialClipAnchor, type SetBgmInput, type SetCaptionVisibilityInput, type SetClipPlacementInput, type SetClipSpeedInput, type SetClipVolumeInput, type SnapshotReadable, type SolvedVideoDocument, type SpeechHostMap, type SpeechPart, type SpeedShift, TIMELINE_SKELETON_DURATION_MS, type Timeline, type TimelineDoc, type TimelineItem, type Track, type TrackDraft, type TrackItem, type TrackItemDraft, type TrackItemTimePosition, type TransactAudit, type TrimClipInput, type UpdateClipInput, type UpdateClipMarkerInput, VIDEO_DOCUMENT_SCHEMA_VERSION, ValidationError, type VideoClipPart, type VideoDocument, type VideoDocumentDraft, type VideoDocumentMirrorSchema, type VideoDocumentSchemaVersion, VideoDocumentValidationError, type VideoDocumentValidationIssue, type VideoDocumentValidationIssueCode, type VideoDraft, type CaptionPart$1 as VideoDraftCaptionPart, type VideoDraftPartUnion, type Timeline$1 as VideoDraftTimeline, type Track$1 as VideoDraftTrack, type TrackItem$1 as VideoDraftTrackItem, type VideoMediaAssetFact, type VisualMediaAssetFact, type VoiceMediaAssetFact, type VoiceoverCaptionFact, type VoiceoverTakeInput, type VoiceoverTakeResult, type WaitForServerAckOptions, applyEntityTimelineProjection, arrangeMainTrackSeamlessly, assertCanonicalEditorResources, assertEntityProjectionPreservesLegacy, assertMediaAssetWritePolicy, assertValidVideoDocument, base64ToBytes, buildInitialVideoDocument, buildSpeechHostMap, bytesToBase64, cascadeAfterVideoClipChanges, createEditSandbox, createMirrorVideoDocument, createMirrorVideoDocumentAdapter, createPlainMemoryAdapter, decodeDocVersionMark, derivePositionFromAbs, effectiveVideoClipDurationMs, encodeDocVersionMark, ensureEditorFoundation, ensureLaneTrack, fillMainTrackTimeGaps, findLaneTrack, fromVideoDocument, generatePartId, getAt, hostForAbsMs, importMediaAsset, isEmptyVideoClip, isImplementedSemanticOpKind, isMap, laneTrackId, mainTrackRanges, migrateLegacyTimelineToEntities, partDurationMs, partUnionSchema, projectEntityTimeline, readMainTrackItems, readMengineEventStream, readPart, readPartDurationMs, readVideoDocumentFromDraft, reassignSpeechesToVideoClipsByTime, recalculateTimelineDuration, relativePositionForAbs, replayJournal, resolveAllSpeechOverlaps, resolveEntityTimelineLayout, resolveSpeechOverlapByShiftingVideos, safeDurationMs, index_d_exports as schemas, snapshotToPlain, solveVideoDocument, speedOf, syncAggregatedClipsTimePosition, toVideoDocument, validateVideoDocument, videoDocumentMirrorSchema, videoDocumentSchema, writeVideoDocumentToDraft };
|