@mengine/medeo-client 1.2.1-alpha.9 → 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 +43 -11
- package/dist/{document-Df6awJDH.js → document-Caidonf8.js} +214 -66
- package/dist/{index-CbuWTReu.d.ts → index-WxMNUbOa.d.ts} +9 -5
- package/dist/index.d.ts +90 -19
- package/dist/index.js +271 -86
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as index_d_exports } from "./index-CMa6ZCtX.js";
|
|
2
|
-
import { $ as
|
|
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";
|
|
3
3
|
import { PeerID } from "loro-crdt";
|
|
4
4
|
import { DocState } from "@mengine/sync";
|
|
5
5
|
import { BaseDocStorage, Connection, DocDiff, DocPushReceipt, DocSnapshotRecord, DocStorage, DocStorageOptions, DocUpdate, DocUpdateRecord } from "@mengine/storage";
|
|
@@ -232,7 +232,8 @@ interface VoiceMediaAssetFact {
|
|
|
232
232
|
readonly kind: 'voice';
|
|
233
233
|
readonly durationMs: number;
|
|
234
234
|
readonly storageKey: string;
|
|
235
|
-
|
|
235
|
+
/** Present for synthesized voice, absent for original recorded audio. */
|
|
236
|
+
readonly voice?: VoiceDescriptor;
|
|
236
237
|
}
|
|
237
238
|
/** Facts resolved from media storage. A trim window never substitutes for intrinsic duration. */
|
|
238
239
|
type MediaAssetFact = ImageMediaAssetFact | VideoMediaAssetFact | AudioMediaAssetFact | VoiceMediaAssetFact;
|
|
@@ -292,18 +293,22 @@ interface VoiceoverCaptionFact {
|
|
|
292
293
|
readonly durationMs: number;
|
|
293
294
|
readonly style?: CaptionStyleFields;
|
|
294
295
|
}
|
|
295
|
-
|
|
296
|
-
readonly timelineEntityId: string;
|
|
297
|
-
/** Stable placed speech identity, distinct from media.assetId. */
|
|
296
|
+
type VoiceoverTakeInput = {
|
|
297
|
+
readonly timelineEntityId: string; /** Stable placed speech identity, distinct from media.assetId. */
|
|
298
298
|
readonly voiceoverClipEntityId: string;
|
|
299
|
-
readonly
|
|
300
|
-
readonly anchorOffset: number;
|
|
301
|
-
readonly media: VoiceMediaAssetFact;
|
|
302
|
-
/** Complete spoken text; the editor owns the deterministic local script segment identity. */
|
|
299
|
+
readonly media: VoiceMediaAssetFact; /** Complete spoken text; the editor owns the deterministic local script segment identity. */
|
|
303
300
|
readonly scriptText: string;
|
|
304
301
|
readonly volume: number;
|
|
305
302
|
readonly captions: readonly VoiceoverCaptionFact[];
|
|
306
|
-
}
|
|
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
|
+
});
|
|
307
312
|
type VisualMediaAssetFact = ImageMediaAssetFact | VideoMediaAssetFact;
|
|
308
313
|
interface InsertMediaClipInput {
|
|
309
314
|
readonly timelineEntityId: string;
|
|
@@ -396,6 +401,16 @@ interface PatchCaptionStyleInput {
|
|
|
396
401
|
readonly timelineEntityId: string;
|
|
397
402
|
readonly style: CaptionStyleFields;
|
|
398
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
|
+
}
|
|
399
414
|
interface InsertClipInput {
|
|
400
415
|
readonly trackEntityId: string;
|
|
401
416
|
/** Existing Sequence media Entity id. Asset ids and URLs are not content ids. */
|
|
@@ -474,6 +489,13 @@ declare class EntityTimelineEditor {
|
|
|
474
489
|
deleteBgm(input: DeleteBgmInput): void;
|
|
475
490
|
setCaptionVisibility(input: SetCaptionVisibilityInput): void;
|
|
476
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;
|
|
477
499
|
private insertPlacedClipIntoDraft;
|
|
478
500
|
private ensureRoleTrack;
|
|
479
501
|
private ensureAudioScript;
|
|
@@ -496,19 +518,68 @@ declare class EntityTimelineEditor {
|
|
|
496
518
|
private mintRelationId;
|
|
497
519
|
}
|
|
498
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.
|
|
536
|
+
*
|
|
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.
|
|
543
|
+
*/
|
|
544
|
+
declare function assertCanonicalEditorResources(rows: EntityRelationRows): void;
|
|
545
|
+
/**
|
|
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.
|
|
560
|
+
*/
|
|
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
|
|
499
565
|
//#region src/entity-editor/media-asset-import.d.ts
|
|
500
566
|
interface ImportedMediaAsset {
|
|
501
567
|
readonly rows: EntityRelationRows;
|
|
502
|
-
|
|
568
|
+
/** The single media variant identity for this asset id; it is its own Asset. */
|
|
503
569
|
readonly contentEntityId: string;
|
|
504
570
|
}
|
|
505
|
-
/**
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
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;
|
|
512
583
|
//#endregion
|
|
513
584
|
//#region src/entity-editor/legacy-entity-migration.d.ts
|
|
514
585
|
/** One-time import only. Ordinary editor operations must never reverse-diff a legacy document. */
|
|
@@ -1420,4 +1491,4 @@ declare function hostForAbsMs(ranges: MainClipRange[], absMs: number): MainClipR
|
|
|
1420
1491
|
*/
|
|
1421
1492
|
declare function relativePositionForAbs(ranges: MainClipRange[], absMs: number): TrackItemTimePosition;
|
|
1422
1493
|
//#endregion
|
|
1423
|
-
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 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
|
|
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 };
|