@mengine/medeo-client 1.2.1-alpha.1 → 1.2.1-alpha.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 +91 -1
- package/dist/document-CC9M0bf9.js +3261 -0
- package/dist/index-CMa6ZCtX.d.ts +609 -0
- package/dist/{index-CZlTzzrm.d.ts → index-PAM9x_fu.d.ts} +267 -641
- package/dist/index.d.ts +428 -23
- package/dist/index.js +2423 -579
- 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-Dcu87api.js +0 -1666
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-PAM9x_fu.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,410 @@ 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
|
+
readonly voice: VoiceDescriptor;
|
|
236
|
+
}
|
|
237
|
+
/** Facts resolved from media storage. A trim window never substitutes for intrinsic duration. */
|
|
238
|
+
type MediaAssetFact = ImageMediaAssetFact | VideoMediaAssetFact | AudioMediaAssetFact | VoiceMediaAssetFact;
|
|
239
|
+
type ClipPlacement = {
|
|
240
|
+
readonly kind: 'sequential';
|
|
241
|
+
readonly order: number;
|
|
242
|
+
} | {
|
|
243
|
+
readonly kind: 'absolute';
|
|
244
|
+
readonly targetRange: SequenceRange<number>;
|
|
245
|
+
} | {
|
|
246
|
+
readonly kind: 'anchored';
|
|
247
|
+
readonly hostClipEntityId: string;
|
|
248
|
+
readonly anchorOffset: number;
|
|
249
|
+
};
|
|
250
|
+
interface InsertPlacedClipInput {
|
|
251
|
+
readonly trackEntityId: string;
|
|
252
|
+
readonly contentEntityId: string;
|
|
253
|
+
readonly sourceRange: SequenceRange<number>;
|
|
254
|
+
readonly duration: SequenceDuration<number>;
|
|
255
|
+
readonly placement: ClipPlacement;
|
|
256
|
+
readonly clipPayload?: JsonObject;
|
|
257
|
+
/** Stable caller-owned placement identity, when one already exists outside the graph. */
|
|
258
|
+
readonly clipEntityId?: string;
|
|
259
|
+
}
|
|
260
|
+
interface SetClipPlacementInput {
|
|
261
|
+
readonly clipEntityId: string;
|
|
262
|
+
readonly placement: ClipPlacement;
|
|
263
|
+
}
|
|
264
|
+
type SequentialClipAnchor = {
|
|
265
|
+
readonly position: 'before' | 'after';
|
|
266
|
+
readonly clipEntityId: string;
|
|
267
|
+
} | {
|
|
268
|
+
readonly position: 'trackStart';
|
|
269
|
+
};
|
|
270
|
+
interface MoveSequentialClipsInput {
|
|
271
|
+
readonly clipEntityIds: readonly string[];
|
|
272
|
+
readonly anchor: SequentialClipAnchor;
|
|
273
|
+
readonly onAnchored: 'follow' | 'keepAbsolute';
|
|
274
|
+
}
|
|
275
|
+
interface MoveClipsToStartsInput {
|
|
276
|
+
readonly moves: readonly {
|
|
277
|
+
readonly clipEntityId: string;
|
|
278
|
+
readonly newStartMs: number;
|
|
279
|
+
}[];
|
|
280
|
+
/** Absolute-time drags preserve every voiceover's current visible landing. */
|
|
281
|
+
readonly onAnchored: 'keepAbsolute';
|
|
282
|
+
}
|
|
283
|
+
interface DeleteClipTreeInput {
|
|
284
|
+
readonly clipEntityIds: readonly string[];
|
|
285
|
+
readonly onAnchored: 'cascade' | 'detach';
|
|
286
|
+
}
|
|
287
|
+
interface VoiceoverCaptionFact {
|
|
288
|
+
/** Stable placed caption identity supplied by the materialized side effect. */
|
|
289
|
+
readonly captionClipEntityId: string;
|
|
290
|
+
readonly text: string;
|
|
291
|
+
readonly startMs: number;
|
|
292
|
+
readonly durationMs: number;
|
|
293
|
+
readonly style?: CaptionStyleFields;
|
|
294
|
+
}
|
|
295
|
+
interface VoiceoverTakeInput {
|
|
296
|
+
readonly timelineEntityId: string;
|
|
297
|
+
/** Stable placed speech identity, distinct from media.assetId. */
|
|
298
|
+
readonly voiceoverClipEntityId: string;
|
|
299
|
+
readonly hostClipEntityId: string;
|
|
300
|
+
readonly anchorOffset: number;
|
|
301
|
+
readonly media: VoiceMediaAssetFact;
|
|
302
|
+
/** Complete spoken text; the editor owns the deterministic local script segment identity. */
|
|
303
|
+
readonly scriptText: string;
|
|
304
|
+
readonly volume: number;
|
|
305
|
+
readonly captions: readonly VoiceoverCaptionFact[];
|
|
306
|
+
}
|
|
307
|
+
type VisualMediaAssetFact = ImageMediaAssetFact | VideoMediaAssetFact;
|
|
308
|
+
interface InsertMediaClipInput {
|
|
309
|
+
readonly timelineEntityId: string;
|
|
310
|
+
readonly clipEntityId?: string;
|
|
311
|
+
readonly media: VisualMediaAssetFact;
|
|
312
|
+
/** Source/display window in whole milliseconds. Images use this as their finite display span. */
|
|
313
|
+
readonly sourceRange: SequenceRange<number>;
|
|
314
|
+
readonly placement: ClipPlacement;
|
|
315
|
+
readonly volume?: number;
|
|
316
|
+
}
|
|
317
|
+
interface ReplaceMediaClipInput {
|
|
318
|
+
readonly clipEntityId: string;
|
|
319
|
+
readonly media: VisualMediaAssetFact;
|
|
320
|
+
readonly sourceRange: SequenceRange<number>;
|
|
321
|
+
}
|
|
322
|
+
interface ReplacementMediaClipInput {
|
|
323
|
+
readonly clipEntityId?: string;
|
|
324
|
+
readonly media: VisualMediaAssetFact;
|
|
325
|
+
readonly sourceRange: SequenceRange<number>;
|
|
326
|
+
readonly volume?: number;
|
|
327
|
+
}
|
|
328
|
+
type MediaClipInsertion = {
|
|
329
|
+
readonly kind: 'before';
|
|
330
|
+
readonly clipEntityId: string;
|
|
331
|
+
} | {
|
|
332
|
+
readonly kind: 'after';
|
|
333
|
+
readonly clipEntityId: string;
|
|
334
|
+
} | {
|
|
335
|
+
readonly kind: 'firstStart';
|
|
336
|
+
readonly startMs: number;
|
|
337
|
+
};
|
|
338
|
+
interface InsertMediaClipsInput {
|
|
339
|
+
readonly timelineEntityId: string;
|
|
340
|
+
readonly clips: readonly ReplacementMediaClipInput[];
|
|
341
|
+
/** One placement decision for the whole input-ordered block. */
|
|
342
|
+
readonly insertion: MediaClipInsertion;
|
|
343
|
+
}
|
|
344
|
+
interface ReplaceSequentialClipsInput {
|
|
345
|
+
readonly timelineEntityId: string;
|
|
346
|
+
readonly oldClipEntityIds: readonly string[];
|
|
347
|
+
readonly newClips: readonly ReplacementMediaClipInput[];
|
|
348
|
+
readonly onAnchored: 'remap' | 'cascade';
|
|
349
|
+
}
|
|
350
|
+
interface SetClipVolumeInput {
|
|
351
|
+
readonly clipEntityId: string;
|
|
352
|
+
/** Playback gain in decibels. */
|
|
353
|
+
readonly volume: number;
|
|
354
|
+
}
|
|
355
|
+
interface LinearClipSpeed {
|
|
356
|
+
readonly kind: 'linear';
|
|
357
|
+
readonly rate: number;
|
|
358
|
+
readonly mode?: string;
|
|
359
|
+
}
|
|
360
|
+
interface SetClipSpeedInput {
|
|
361
|
+
readonly clipEntityId: string;
|
|
362
|
+
readonly timeRemapping: LinearClipSpeed | null;
|
|
363
|
+
}
|
|
364
|
+
interface TrimClipInput {
|
|
365
|
+
readonly clipEntityId: string;
|
|
366
|
+
readonly sourceRange: SequenceRange<number>;
|
|
367
|
+
}
|
|
368
|
+
interface VoiceoverTakeResult {
|
|
369
|
+
readonly voiceoverClipEntityId: string;
|
|
370
|
+
readonly voiceEntityId: string;
|
|
371
|
+
readonly audioScriptEntityId: string;
|
|
372
|
+
readonly captionClipEntityIds: readonly string[];
|
|
373
|
+
}
|
|
374
|
+
interface MoveVoiceoverInput {
|
|
375
|
+
readonly voiceoverClipEntityId: string;
|
|
376
|
+
/** Absolute requested timeline start; MEngine resolves and persists the host relation. */
|
|
377
|
+
readonly newStartMs: number;
|
|
378
|
+
}
|
|
379
|
+
interface DeleteVoiceoverInput {
|
|
380
|
+
readonly voiceoverClipEntityIds: readonly string[];
|
|
381
|
+
}
|
|
382
|
+
interface SetBgmInput {
|
|
383
|
+
readonly timelineEntityId: string;
|
|
384
|
+
readonly bgmClipEntityId: string;
|
|
385
|
+
readonly media: AudioMediaAssetFact;
|
|
386
|
+
readonly volume: number;
|
|
387
|
+
}
|
|
388
|
+
interface DeleteBgmInput {
|
|
389
|
+
readonly timelineEntityId: string;
|
|
390
|
+
}
|
|
391
|
+
interface SetCaptionVisibilityInput {
|
|
392
|
+
readonly timelineEntityId: string;
|
|
393
|
+
readonly hidden: boolean;
|
|
394
|
+
}
|
|
395
|
+
interface PatchCaptionStyleInput {
|
|
396
|
+
readonly timelineEntityId: string;
|
|
397
|
+
readonly style: CaptionStyleFields;
|
|
398
|
+
}
|
|
399
|
+
interface InsertClipInput {
|
|
400
|
+
readonly trackEntityId: string;
|
|
401
|
+
/** Existing Sequence media Entity id. Asset ids and URLs are not content ids. */
|
|
402
|
+
readonly contentEntityId: string;
|
|
403
|
+
readonly sourceRange: SequenceRange<number>;
|
|
404
|
+
readonly duration: SequenceDuration<number>;
|
|
405
|
+
readonly targetRange?: SequenceRange<number>;
|
|
406
|
+
readonly clipPayload?: JsonObject;
|
|
407
|
+
}
|
|
408
|
+
interface UpdateClipMarkerInput {
|
|
409
|
+
readonly clipEntityId: string;
|
|
410
|
+
readonly sourceRange?: SequenceRange<number>;
|
|
411
|
+
/** Passing `undefined` explicitly removes the optional target range. */
|
|
412
|
+
readonly targetRange?: SequenceRange<number> | undefined;
|
|
413
|
+
readonly duration?: SequenceDuration<number>;
|
|
414
|
+
/** Passing `undefined` explicitly removes the optional remapping value. */
|
|
415
|
+
readonly timeRemapping?: JsonValue | undefined;
|
|
416
|
+
}
|
|
417
|
+
interface MoveClipInput {
|
|
418
|
+
readonly clipEntityId: string;
|
|
419
|
+
readonly trackEntityId: string;
|
|
420
|
+
}
|
|
421
|
+
interface ReplaceClipContentInput {
|
|
422
|
+
readonly clipEntityId: string;
|
|
423
|
+
/** Existing Sequence media Entity id. Asset ids and URLs are not content ids. */
|
|
424
|
+
readonly contentEntityId: string;
|
|
425
|
+
readonly sourceRange: SequenceRange<number>;
|
|
426
|
+
readonly duration: SequenceDuration<number>;
|
|
427
|
+
readonly targetRange?: SequenceRange<number>;
|
|
428
|
+
readonly timeRemapping?: JsonValue;
|
|
429
|
+
}
|
|
430
|
+
interface DeleteClipInput {
|
|
431
|
+
readonly clipEntityId: string;
|
|
432
|
+
}
|
|
433
|
+
interface UpdateClipInput {
|
|
434
|
+
readonly clipEntityId: string;
|
|
435
|
+
/** Complete replacement for the Clip-owned payload. */
|
|
436
|
+
readonly payload: JsonObject;
|
|
437
|
+
}
|
|
438
|
+
type ClipEntityId = EntityId;
|
|
439
|
+
//#endregion
|
|
440
|
+
//#region src/entity-editor/entity-timeline-editor.d.ts
|
|
441
|
+
/**
|
|
442
|
+
* Graph-native timeline authoring over authoritative Medeo Entity and Relation rows.
|
|
443
|
+
*
|
|
444
|
+
* Each mutation is applied to a detached graph, validated as a complete DSL set,
|
|
445
|
+
* and committed only after validation succeeds.
|
|
446
|
+
*/
|
|
447
|
+
declare class EntityTimelineEditor {
|
|
448
|
+
private readonly idFactory;
|
|
449
|
+
private state;
|
|
450
|
+
constructor(initialRows: EntityRelationRows, idFactory?: EntityTimelineIdFactory);
|
|
451
|
+
rows(): EntityRelationRows;
|
|
452
|
+
insertClip(input: InsertClipInput): ClipEntityId;
|
|
453
|
+
insertPlacedClip(input: InsertPlacedClipInput): ClipEntityId;
|
|
454
|
+
updateClipMarker(input: UpdateClipMarkerInput): void;
|
|
455
|
+
setClipPlacement(input: SetClipPlacementInput): void;
|
|
456
|
+
moveSequentialClips(input: MoveSequentialClipsInput): void;
|
|
457
|
+
moveClipsToStarts(input: MoveClipsToStartsInput): void;
|
|
458
|
+
moveClip(input: MoveClipInput): void;
|
|
459
|
+
replaceClipContent(input: ReplaceClipContentInput): void;
|
|
460
|
+
insertMediaClip(input: InsertMediaClipInput): ClipEntityId;
|
|
461
|
+
insertMediaClips(input: InsertMediaClipsInput): readonly ClipEntityId[];
|
|
462
|
+
replaceMediaClip(input: ReplaceMediaClipInput): void;
|
|
463
|
+
setClipVolume(input: SetClipVolumeInput): void;
|
|
464
|
+
setClipSpeed(input: SetClipSpeedInput): void;
|
|
465
|
+
trimClip(input: TrimClipInput): void;
|
|
466
|
+
replaceSequentialClips(input: ReplaceSequentialClipsInput): readonly ClipEntityId[];
|
|
467
|
+
deleteClip(input: DeleteClipInput): void;
|
|
468
|
+
deleteClipTree(input: DeleteClipTreeInput): void;
|
|
469
|
+
updateClip(input: UpdateClipInput): void;
|
|
470
|
+
upsertVoiceoverTake(input: VoiceoverTakeInput): VoiceoverTakeResult;
|
|
471
|
+
moveVoiceover(input: MoveVoiceoverInput): void;
|
|
472
|
+
deleteVoiceover(input: DeleteVoiceoverInput): void;
|
|
473
|
+
setBgm(input: SetBgmInput): ClipEntityId;
|
|
474
|
+
deleteBgm(input: DeleteBgmInput): void;
|
|
475
|
+
setCaptionVisibility(input: SetCaptionVisibilityInput): void;
|
|
476
|
+
patchCaptionStyle(input: PatchCaptionStyleInput): void;
|
|
477
|
+
private insertPlacedClipIntoDraft;
|
|
478
|
+
private ensureRoleTrack;
|
|
479
|
+
private ensureAudioScript;
|
|
480
|
+
private reconcileVoiceoverCaptions;
|
|
481
|
+
private ensureRoleTrackForClip;
|
|
482
|
+
private replaceCaptionSemanticRelations;
|
|
483
|
+
private removeCaptionClipGraph;
|
|
484
|
+
private replaceAnchorHost;
|
|
485
|
+
/** Rebuild the legacy edit baseline from current visual order before a high-level cascade. */
|
|
486
|
+
private normalizeMainSequential;
|
|
487
|
+
private resolveOneVoiceoverOverlap;
|
|
488
|
+
private applyClipPlacement;
|
|
489
|
+
private reanchorAtAbsolute;
|
|
490
|
+
private removeAnchoredDescendants;
|
|
491
|
+
private removeClipGraph;
|
|
492
|
+
private transact;
|
|
493
|
+
private mintEntityId;
|
|
494
|
+
private createRelation;
|
|
495
|
+
private relinkRelation;
|
|
496
|
+
private mintRelationId;
|
|
497
|
+
}
|
|
498
|
+
//#endregion
|
|
499
|
+
//#region src/entity-editor/editor-resources.d.ts
|
|
500
|
+
declare const roleOrder: {
|
|
501
|
+
readonly caption: 0;
|
|
502
|
+
readonly video_clip: 1;
|
|
503
|
+
readonly speech: 2;
|
|
504
|
+
readonly bgm: 3;
|
|
505
|
+
};
|
|
506
|
+
type EditorTrackRole = keyof typeof roleOrder;
|
|
507
|
+
interface EditorFoundation {
|
|
508
|
+
readonly rows: EntityRelationRows;
|
|
509
|
+
readonly timelineEntityId: string;
|
|
510
|
+
readonly trackEntityIds: Readonly<Record<EditorTrackRole, string>>;
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* MEngine editor policy, not a cardinality restriction on the general-purpose DSL.
|
|
514
|
+
*
|
|
515
|
+
* Media variants share one entity identity with their Asset: every
|
|
516
|
+
* Image/Video/Audio/Voice Entity must carry its own external locator, every
|
|
517
|
+
* external asset id has exactly one claimant, and no media variant may be
|
|
518
|
+
* bound through a legacy `physical-asset` Relation. Dual-entity media graphs
|
|
519
|
+
* are rejected, not migrated. Caption inline text keeps its inline Asset and
|
|
520
|
+
* `physical-asset` binding.
|
|
521
|
+
*/
|
|
522
|
+
declare function assertCanonicalEditorResources(rows: EntityRelationRows): void;
|
|
181
523
|
/**
|
|
182
|
-
*
|
|
524
|
+
* Commit-transition policy shared by the editor, the HTTP commit boundary, the
|
|
525
|
+
* host tool, and the entity stores. It compares the authoritative before and
|
|
526
|
+
* after rows of one CAS commit and enforces the single-identity write rules
|
|
527
|
+
* on the complete after state, with no exemption for historical graphs:
|
|
183
528
|
*
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
* by emitting the same `<prefix>_<ULID>` bytes.
|
|
529
|
+
* 1. every Image/Video/Audio/Voice Entity carries its own Asset `external`
|
|
530
|
+
* identity;
|
|
531
|
+
* 2. no `physical-asset` Relation may bind a media variant (Caption inline
|
|
532
|
+
* text keeps its inline Asset and binding);
|
|
533
|
+
* 3. a self-carried media identity is immutable — it cannot be rewritten to
|
|
534
|
+
* another asset id.
|
|
191
535
|
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
* old generator (both `Math.random`-based) and it keeps `@mengine/medeo-client`
|
|
195
|
-
* dependency-free for a purely mechanical id string. Part ids only need to be
|
|
196
|
-
* unique and lexicographically time-sortable, which this satisfies.
|
|
536
|
+
* Dual-entity media graphs are rejected instead of being migrated or merged
|
|
537
|
+
* implicitly. Deleting media is explicit and allowed.
|
|
197
538
|
*/
|
|
539
|
+
declare function assertMediaAssetWritePolicy(before: EntityRelationRows, after: EntityRelationRows): void;
|
|
540
|
+
/** Add only missing editor structure; existing identities and owned settings are never replaced. */
|
|
541
|
+
declare function ensureEditorFoundation(initial: EntityRelationRows, idFactory?: EntityTimelineIdFactory, timelinePayload?: EntityRow['payload']): EditorFoundation;
|
|
542
|
+
//#endregion
|
|
543
|
+
//#region src/entity-editor/media-asset-import.d.ts
|
|
544
|
+
interface ImportedMediaAsset {
|
|
545
|
+
readonly rows: EntityRelationRows;
|
|
546
|
+
/** The single media variant identity for this asset id; it is its own Asset. */
|
|
547
|
+
readonly contentEntityId: string;
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* Import at the editor boundary, not at asset generation time. Existing
|
|
551
|
+
* provenance is retained.
|
|
552
|
+
*
|
|
553
|
+
* A media variant is a logical facet of its Asset and shares one entity
|
|
554
|
+
* identity: the import mints exactly one entity of the media kind that carries
|
|
555
|
+
* the external locator itself, and deduplicates only against existing variants
|
|
556
|
+
* that already carry the same `(system, key)`. Legacy dual-entity graphs
|
|
557
|
+
* (`asset` row plus a `physical-asset` binding) are not reused and are
|
|
558
|
+
* rejected by the canonical resource policy instead of being migrated.
|
|
559
|
+
*/
|
|
560
|
+
declare function importMediaAsset(initial: EntityRelationRows, fact: MediaAssetFact, idFactory?: EntityTimelineIdFactory): ImportedMediaAsset;
|
|
561
|
+
//#endregion
|
|
562
|
+
//#region src/entity-editor/legacy-entity-migration.d.ts
|
|
563
|
+
/** One-time import only. Ordinary editor operations must never reverse-diff a legacy document. */
|
|
564
|
+
declare function migrateLegacyTimelineToEntities(legacy: VideoDocument, assetFacts: readonly MediaAssetFact[], initial?: EntityRelationRows, idFactory?: EntityTimelineIdFactory): EntityRelationRows;
|
|
565
|
+
/** Server gate: a cutover may change representation, never the existing render facts. */
|
|
566
|
+
declare function assertEntityProjectionPreservesLegacy(legacy: VideoDocument, projection: VideoDocument, rows: EntityRelationRows): void;
|
|
567
|
+
//#endregion
|
|
568
|
+
//#region src/editor/journal.d.ts
|
|
569
|
+
/**
|
|
570
|
+
* Wire a plain-memory adapter + editor that share a recording id factory, so
|
|
571
|
+
* every mutating transact lands in `journal` with ordered `generated_ids`.
|
|
572
|
+
*/
|
|
573
|
+
declare function createEditSandbox(document: VideoDocument, options?: PlainMemoryAdapterOptions): {
|
|
574
|
+
adapter: PlainMemoryAdapter;
|
|
575
|
+
editor: SemanticEditor;
|
|
576
|
+
journal: readonly JournalEntry[];
|
|
577
|
+
};
|
|
198
578
|
/**
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
* `
|
|
203
|
-
* payloads, so the engine never generates them itself.
|
|
579
|
+
* Re-drive `doc` from a recorded journal, forcing each entry's `generated_ids`
|
|
580
|
+
* through a queue-backed id factory. Never mints fresh ids: an empty queue on
|
|
581
|
+
* demand throws `unrecorded id`; leftover ids after an entry throws
|
|
582
|
+
* `unconsumed ids`. Legacy entries without `generated_ids` are treated as `[]`.
|
|
204
583
|
*/
|
|
205
|
-
|
|
206
|
-
declare function generatePartId(prefix: PartIdPrefix): string;
|
|
584
|
+
declare function replayJournal(doc: SemanticDocumentAdapter, journal: readonly JournalEntry[]): Promise<void>;
|
|
207
585
|
//#endregion
|
|
208
586
|
//#region src/editor/snapshot-utils.d.ts
|
|
209
587
|
/** Main-track item identity read from a raw snapshot (only `part_id` is needed). */
|
|
@@ -422,6 +800,16 @@ declare class ManualSyncDoc {
|
|
|
422
800
|
editorPeerId(): PeerID;
|
|
423
801
|
/** Current document projected to the legacy `VideoDraft` read shape. */
|
|
424
802
|
draft(): VideoDraft;
|
|
803
|
+
/**
|
|
804
|
+
* Replay a deterministic sandbox journal into this document.
|
|
805
|
+
*
|
|
806
|
+
* The adapter stays private so callers cannot bypass the manual-sync
|
|
807
|
+
* lifecycle; journal replay is the one host-side operation that needs the
|
|
808
|
+
* adapter's transaction boundary and recorded id queue. Durability is still
|
|
809
|
+
* explicit: call {@link push} after replay and report success only from its
|
|
810
|
+
* verdict.
|
|
811
|
+
*/
|
|
812
|
+
replayJournal(journal: readonly JournalEntry[]): Promise<void>;
|
|
425
813
|
/**
|
|
426
814
|
* Mark the document state the caller has just observed, for a later
|
|
427
815
|
* {@link hasChangedSince}.
|
|
@@ -633,6 +1021,11 @@ interface MengineDocSessionOptions {
|
|
|
633
1021
|
*/
|
|
634
1022
|
localStorage?: DocStorageLike;
|
|
635
1023
|
sseReconnectDelayMs?: number;
|
|
1024
|
+
/**
|
|
1025
|
+
* Keep remote synchronization read-only: pull snapshot/diffs and subscribe to
|
|
1026
|
+
* SSE updates, but never POST local Loro updates to the server.
|
|
1027
|
+
*/
|
|
1028
|
+
readonlyMode?: boolean;
|
|
636
1029
|
}
|
|
637
1030
|
/**
|
|
638
1031
|
* A live editing session for one Medeo document — the single entry point clients
|
|
@@ -713,6 +1106,18 @@ declare class MengineDocSession {
|
|
|
713
1106
|
* step. The committed change drives DocManager's local-update push.
|
|
714
1107
|
*/
|
|
715
1108
|
get editor(): SemanticEditor;
|
|
1109
|
+
/**
|
|
1110
|
+
* Opaque version token of the local oplog (base64 `VersionVector.encode`).
|
|
1111
|
+
* Equality-comparable only: equal means no observed change (local or
|
|
1112
|
+
* remote-arrived) since the token was taken. Throws when not started.
|
|
1113
|
+
*/
|
|
1114
|
+
version(): string;
|
|
1115
|
+
/**
|
|
1116
|
+
* The live document adapter, exposed for journal replay (commit channel).
|
|
1117
|
+
* Replaying through it still goes SemanticEditor → Loro → mengine-server —
|
|
1118
|
+
* no write bypass. Typed by the narrow interface on purpose.
|
|
1119
|
+
*/
|
|
1120
|
+
get documentAdapter(): SemanticDocumentAdapter;
|
|
716
1121
|
/** Current document snapshot (read model). */
|
|
717
1122
|
snapshot(): VideoDocument;
|
|
718
1123
|
/**
|
|
@@ -1064,4 +1469,4 @@ declare function hostForAbsMs(ranges: MainClipRange[], absMs: number): MainClipR
|
|
|
1064
1469
|
*/
|
|
1065
1470
|
declare function relativePositionForAbs(ranges: MainClipRange[], absMs: number): TrackItemTimePosition;
|
|
1066
1471
|
//#endregion
|
|
1067
|
-
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 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 OpActor, type PartAggregation, type PartKind, type PartUnion, type PlannedSemanticOpKind, type PullFailureReason, type PullResult, type PushOutcome, type PushOutcomeKind, type PushResult, type PushResultKind, SchemaValidator, type SemanticDocumentAdapter, SemanticEditor, type SemanticOpInput, type SemanticOpKind, type SemanticOpName, 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, 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 WaitForServerAckOptions, arrangeMainTrackSeamlessly, assertValidVideoDocument, base64ToBytes, buildInitialVideoDocument, buildSpeechHostMap, bytesToBase64, cascadeAfterVideoClipChanges, createMirrorVideoDocument, createMirrorVideoDocumentAdapter, decodeDocVersionMark, derivePositionFromAbs, encodeDocVersionMark, ensureLaneTrack, fillMainTrackTimeGaps, findLaneTrack, fromVideoDocument, generatePartId, getAt, hostForAbsMs, isEmptyVideoClip, isImplementedSemanticOpKind, isMap, laneTrackId, mainTrackRanges, partDurationMs, partUnionSchema, readMainTrackItems, readMengineEventStream, readPart, readPartDurationMs, readVideoDocumentFromDraft, reassignSpeechesToVideoClipsByTime, recalculateTimelineDuration, relativePositionForAbs, resolveAllSpeechOverlaps, resolveSpeechOverlapByShiftingVideos, safeDurationMs, index_d_exports as schemas, snapshotToPlain, solveVideoDocument, syncAggregatedClipsTimePosition, toVideoDocument, validateVideoDocument, videoDocumentMirrorSchema, videoDocumentSchema };
|
|
1472
|
+
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 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 };
|