@mengine/medeo-client 2.1.1-dsl.7 → 2.1.1-dsl.9
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 +10 -9
- package/dist/{dsl-DbYqFFOb.js → dsl-COyzz7Fp.js} +622 -298
- package/dist/dsl.d.ts +2 -2
- package/dist/dsl.js +2 -2
- package/dist/{index-DHcMMn2M.d.ts → index-C5wDKYqC.d.ts} +60 -35
- package/dist/{index-Cx5DojM1.d.ts → index-CHiPztZr.d.ts} +22 -7
- package/dist/{index-Dpl4bT94.d.ts → index-DAfOkcnZ.d.ts} +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -2
- package/dist/legacy.d.ts +2 -2
- package/dist/legacy.js +1 -1
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +4 -7
- package/dist/{video-draft-types-Ce8NDenQ.js → video-draft-types-BnbfWrBx.js} +64 -42
- package/dist/{video-draft-types-Bq15tPBP.d.ts → video-draft-types-GqXnsOzA.d.ts} +69 -21
- package/package.json +4 -4
package/dist/dsl.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { A as MedeoDslDraft, C as UnsupportedDocumentFormatError, D as captionContentCodec, E as InvalidAtomic, F as ClipSource, I as DslClipUpdate, L as MoveDslClipsInput, M as medeoDslLoroShape, N as AddDslClip, O as isInvalidAtomic, P as AddDslClipsInput, R as ReplaceDslClipsInput, S as DslTransaction, T as documentFormat, _ as VoiceoverCaptionInput, a as toAudioScriptViews, b as MedeoDsl, c as resolveDslLayout, d as DslProjectionError, f as DslTrackLayout, g as ApplyVoiceoverInput, h as UploadText, i as AudioScriptView, j as MedeoDslLoroState, k as timeAnchorCodec, l as DslClipLayout, m as DslEditor, n as ImportedVideoDraft, o as VideoDraftProjection, p as createInitialMedeoDsl, r as fromVideoDraft, s as toVideoDraft, t as FromVideoDraftOptions, u as DslLayout, v as VoiceoverResult, w as assertDslDocument, x as DslAudit, y as CreateMedeoDslOptions, z as ClipPlacement } from "./index-
|
|
1
|
+
import { $ as TextMutation, A as DeepReadonly, C as CaptionContent, D as Clip, E as CaptionText, F as EntityTables, G as ResourceSystem, H as RelationTable, I as EntityValues, K as RichTextSnapshot, L as FieldPatch, M as DslMutation, N as EntityMutation, O as ContainMutation, P as EntityTable, Q as TextMark, R as MedeoDslSnapshot, S as Caption, T as CaptionStyle, U as RelationTables, V as RelationMutation, W as RelationValues, X as TextDelta, Y as StoredFile, Z as TextEdit, _ as defaultIdFactory, a as VideoDraftCaptionStyle, b as tupleHash, c as VideoDraftInput, d as VideoDraftTrack, et as TextRun, f as VideoDraftTrackItem, g as EntityIdKind, h as DslIdFactory, i as VideoDraft, it as Voice, j as DslDiagnostic, k as ContainNode, l as VideoDraftPartUnion, m as OpActor, n as DEFAULT_UNIT_TIME_MS, nt as Track, o as VideoDraftContent, p as CommitOptions, r as VideoCreationSettings, rt as TrackRole, s as VideoDraftContentPartUnion, t as CaptionDisplayCue, tt as TimeAnchor, u as VideoDraftTimeline, v as relationId, w as CaptionSelection, x as AudioScript, y as resourceId, z as Media } from "./video-draft-types-GqXnsOzA.js";
|
|
2
|
+
import { A as MedeoDslDraft, C as UnsupportedDocumentFormatError, D as captionContentCodec, E as InvalidAtomic, F as ClipSource, I as DslClipUpdate, L as MoveDslClipsInput, M as medeoDslLoroShape, N as AddDslClip, O as isInvalidAtomic, P as AddDslClipsInput, R as ReplaceDslClipsInput, S as DslTransaction, T as documentFormat, _ as VoiceoverCaptionInput, a as toAudioScriptViews, b as MedeoDsl, c as resolveDslLayout, d as DslProjectionError, f as DslTrackLayout, g as ApplyVoiceoverInput, h as UploadText, i as AudioScriptView, j as MedeoDslLoroState, k as timeAnchorCodec, l as DslClipLayout, m as DslEditor, n as ImportedVideoDraft, o as VideoDraftProjection, p as createInitialMedeoDsl, r as fromVideoDraft, s as toVideoDraft, t as FromVideoDraftOptions, u as DslLayout, v as VoiceoverResult, w as assertDslDocument, x as DslAudit, y as CreateMedeoDslOptions, z as ClipPlacement } from "./index-C5wDKYqC.js";
|
|
3
3
|
export { type AddDslClip, type AddDslClipsInput, type ApplyVoiceoverInput, type AudioScript, type AudioScriptView, type Caption, type CaptionContent, type CaptionDisplayCue, type CaptionSelection, type CaptionStyle, type CaptionText, type Clip, type ClipPlacement, type ClipSource, type CommitOptions, type ContainMutation, type ContainNode, type CreateMedeoDslOptions, DEFAULT_UNIT_TIME_MS, type DeepReadonly, type DslAudit, type DslClipLayout, type DslClipUpdate, type DslDiagnostic, DslEditor, type DslIdFactory, type DslLayout, type DslMutation, DslProjectionError, type DslTrackLayout, type DslTransaction, type EntityIdKind, type EntityMutation, type EntityTable, type EntityTables, type EntityValues, type FieldPatch, type FromVideoDraftOptions, type ImportedVideoDraft, type InvalidAtomic, MedeoDsl, type MedeoDslDraft, type MedeoDslLoroState, type MedeoDslSnapshot, type Media, type MoveDslClipsInput, type OpActor, type RelationMutation, type RelationTable, type RelationTables, type RelationValues, type ReplaceDslClipsInput, type ResourceSystem, type RichTextSnapshot, type StoredFile, type TextDelta, type TextEdit, type TextMark, type TextMutation, type TextRun, type TimeAnchor, type Track, type TrackRole, UnsupportedDocumentFormatError, type UploadText, type VideoCreationSettings, type VideoDraft, type VideoDraftCaptionStyle, type VideoDraftContent, type VideoDraftContentPartUnion, type VideoDraftInput, type VideoDraftPartUnion, type VideoDraftProjection, type VideoDraftTimeline, type VideoDraftTrack, type VideoDraftTrackItem, type Voice, type VoiceoverCaptionInput, type VoiceoverResult, assertDslDocument, captionContentCodec, createInitialMedeoDsl, defaultIdFactory, documentFormat, fromVideoDraft, isInvalidAtomic, medeoDslLoroShape, relationId, resolveDslLayout, resourceId, timeAnchorCodec, toAudioScriptViews, toVideoDraft, tupleHash };
|
package/dist/dsl.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as documentFormat, c as isInvalidAtomic,
|
|
2
|
-
import { a as DslEditor, c as DslProjectionError, i as createInitialMedeoDsl, n as toVideoDraft, o as MedeoDsl, r as toAudioScriptViews, s as resolveDslLayout, t as fromVideoDraft } from "./dsl-
|
|
1
|
+
import { _t as tupleHash, a as documentFormat, c as isInvalidAtomic, gt as resourceId, ht as relationId, i as assertDslDocument, mt as defaultIdFactory, o as medeoDslLoroShape, r as UnsupportedDocumentFormatError, s as captionContentCodec, t as DEFAULT_UNIT_TIME_MS, u as timeAnchorCodec } from "./video-draft-types-BnbfWrBx.js";
|
|
2
|
+
import { a as DslEditor, c as DslProjectionError, i as createInitialMedeoDsl, n as toVideoDraft, o as MedeoDsl, r as toAudioScriptViews, s as resolveDslLayout, t as fromVideoDraft } from "./dsl-COyzz7Fp.js";
|
|
3
3
|
export { DEFAULT_UNIT_TIME_MS, DslEditor, DslProjectionError, MedeoDsl, UnsupportedDocumentFormatError, assertDslDocument, captionContentCodec, createInitialMedeoDsl, defaultIdFactory, documentFormat, fromVideoDraft, isInvalidAtomic, medeoDslLoroShape, relationId, resolveDslLayout, resourceId, timeAnchorCodec, toAudioScriptViews, toVideoDraft, tupleHash };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { B as PhonemeSelection, J as SegmentSelection, L as FieldPatch, M as DslMutation, R as MedeoDslSnapshot, T as CaptionStyle, Y as StoredFile, Z as TextEdit, c as VideoDraftInput, h as DslIdFactory, it as Voice, j as DslDiagnostic, o as VideoDraftContent, p as CommitOptions, q as SegmentRange, rt as TrackRole, tt as TimeAnchor, w as CaptionSelection, z as Media } from "./video-draft-types-GqXnsOzA.js";
|
|
2
2
|
import { ContainerType, Cursor, LoroDoc, PeerID, TreeID } from "loro-crdt";
|
|
3
3
|
|
|
4
4
|
//#region src/dsl/action-context.d.ts
|
|
@@ -396,7 +396,7 @@ type InferBooleanType<S extends SchemaType> = S extends {
|
|
|
396
396
|
//#endregion
|
|
397
397
|
//#region ../medeo-dsl/src/schema/loro-shape.d.ts
|
|
398
398
|
/**
|
|
399
|
-
* Only direct children inherit mergeable identity.
|
|
399
|
+
* Only direct children inherit mergeable identity. Text and ordinary entity rows keep normal
|
|
400
400
|
* identities, so deleting a row also drops what a peer wrote into it concurrently: a relation an
|
|
401
401
|
* entity holds at most one of is a field of that row and never outlives it.
|
|
402
402
|
*/
|
|
@@ -462,13 +462,13 @@ declare const medeoDslLoroShape: RootSchemaType<{
|
|
|
462
462
|
};
|
|
463
463
|
};
|
|
464
464
|
'audio-script-entities': LoroMapSchemaWithCatchall<{}, LoroMapSchema<{
|
|
465
|
-
|
|
465
|
+
segments: /*elided*/any;
|
|
466
466
|
defaultLanguage: /*elided*/any;
|
|
467
467
|
}> & {
|
|
468
468
|
options: {};
|
|
469
469
|
} & {
|
|
470
470
|
catchall: <C extends SchemaType>(catchallSchema: C) => LoroMapSchemaWithCatchall<{
|
|
471
|
-
|
|
471
|
+
segments: /*elided*/any;
|
|
472
472
|
defaultLanguage: /*elided*/any;
|
|
473
473
|
}, C>;
|
|
474
474
|
}> & {
|
|
@@ -598,8 +598,8 @@ interface AtomicCodec<T> {
|
|
|
598
598
|
}
|
|
599
599
|
/** A Clip's time anchor; the Clip holding it is the anchored end. */
|
|
600
600
|
declare const timeAnchorCodec: AtomicCodec<TimeAnchor>;
|
|
601
|
-
/** A Caption's selection
|
|
602
|
-
declare const captionContentCodec: AtomicCodec<
|
|
601
|
+
/** A Caption's selection. */
|
|
602
|
+
declare const captionContentCodec: AtomicCodec<SegmentSelection>;
|
|
603
603
|
//#endregion
|
|
604
604
|
//#region ../medeo-dsl/src/schema/document-format.d.ts
|
|
605
605
|
/** Format discrimination does not register containers or alter the document. */
|
|
@@ -627,10 +627,17 @@ interface DslTransaction {
|
|
|
627
627
|
readonly draft: MedeoDslDraft;
|
|
628
628
|
applyMutations(mutations: readonly DslMutation[]): void;
|
|
629
629
|
/** Offsets use the preview after preceding edits. Existing Text identities are checked when supplied. */
|
|
630
|
-
editText(audioScriptId: string, edits: readonly TextEdit[], expectedBodyId?: string): void;
|
|
631
|
-
/** Creates real Cursors during application; pending ranges are not exposed as draft Cursor objects. */
|
|
630
|
+
editText(audioScriptId: string, segmentId: string, edits: readonly TextEdit[], expectedBodyId?: string): void;
|
|
632
631
|
editCaptionText(captionId: string, edits: readonly TextEdit[], expectedBodyId?: string): void;
|
|
632
|
+
/** Adds a segment at `index` (the end by default); its id must be new to the script. */
|
|
633
|
+
insertSegment(audioScriptId: string, segmentId: string, text: string, index?: number): void;
|
|
634
|
+
/** `index` is measured after removing the segment. */
|
|
635
|
+
moveSegment(audioScriptId: string, segmentId: string, index: number): void;
|
|
636
|
+
deleteSegment(audioScriptId: string, segmentId: string): void;
|
|
637
|
+
/** Creates real Cursors during application; pending ranges are not exposed as draft Cursor objects. */
|
|
633
638
|
setCaptionContent(selection: CaptionSelection): void;
|
|
639
|
+
/** Writes a PhoneticScript's phoneme, its run turned into Cursors like a Caption's. */
|
|
640
|
+
setPhoneme(selection: PhonemeSelection): void;
|
|
634
641
|
}
|
|
635
642
|
//#endregion
|
|
636
643
|
//#region src/dsl/document/medeo-dsl.d.ts
|
|
@@ -668,10 +675,13 @@ declare class MedeoDsl {
|
|
|
668
675
|
transact(edit: (tx: DslTransaction) => void, audit: DslAudit): void;
|
|
669
676
|
/** Preferred vocabulary for ordinary entity/relation/Tree edits and serializable native commands. */
|
|
670
677
|
applyMutations(mutations: readonly DslMutation[], audit: DslAudit): void;
|
|
671
|
-
editText(scriptId: string, expectedBodyId: string, edits: readonly TextEdit[], audit: DslAudit): void;
|
|
678
|
+
editText(scriptId: string, segmentId: string, expectedBodyId: string, edits: readonly TextEdit[], audit: DslAudit): void;
|
|
672
679
|
editCaptionText(captionId: string, expectedBodyId: string, edits: readonly TextEdit[], audit: DslAudit): void;
|
|
673
|
-
/**
|
|
674
|
-
|
|
680
|
+
/**
|
|
681
|
+
* A run inside one segment as native Cursors. Local ranges exclude insertions at their start and
|
|
682
|
+
* include insertions at their end. K01 remains deferred.
|
|
683
|
+
*/
|
|
684
|
+
textRange(scriptId: string, segmentId: string, start: number, end: number): SegmentSelection;
|
|
675
685
|
dispose(): void;
|
|
676
686
|
private mutate;
|
|
677
687
|
private notify;
|
|
@@ -683,8 +693,10 @@ interface VoiceoverCaptionInput {
|
|
|
683
693
|
clipId?: string;
|
|
684
694
|
startMs: number;
|
|
685
695
|
durationMs: number;
|
|
686
|
-
/**
|
|
687
|
-
|
|
696
|
+
/** The segment of the voiceover's script it shows, by index; timing remains a separate fact. */
|
|
697
|
+
segment: number;
|
|
698
|
+
/** A UTF-16 run inside that segment; without one the whole segment shows. */
|
|
699
|
+
range?: {
|
|
688
700
|
start: number;
|
|
689
701
|
end: number;
|
|
690
702
|
};
|
|
@@ -700,23 +712,23 @@ interface ApplyVoiceoverInput {
|
|
|
700
712
|
kind: 'voiceover-recording';
|
|
701
713
|
};
|
|
702
714
|
/**
|
|
703
|
-
* What the recording says: an existing AudioScript, a new one
|
|
704
|
-
* was spoken from. A recording spoken from a PhoneticScript is derived-from it,
|
|
705
|
-
* select that variant's base script.
|
|
715
|
+
* What the recording says: an existing AudioScript, a new one of these `segments`, or a
|
|
716
|
+
* PhoneticScript it was spoken from. A recording spoken from a PhoneticScript is derived-from it,
|
|
717
|
+
* and its captions select segments of that variant's base script.
|
|
706
718
|
*/
|
|
707
719
|
script: {
|
|
708
720
|
audioScriptId: string;
|
|
709
|
-
|
|
721
|
+
segments?: never;
|
|
710
722
|
phoneticScriptId?: never;
|
|
711
723
|
} | {
|
|
712
|
-
|
|
724
|
+
segments: string[];
|
|
713
725
|
audioScriptId?: never;
|
|
714
726
|
phoneticScriptId?: never;
|
|
715
727
|
defaultLanguage?: string;
|
|
716
728
|
} | {
|
|
717
729
|
phoneticScriptId: string;
|
|
718
730
|
audioScriptId?: never;
|
|
719
|
-
|
|
731
|
+
segments?: never;
|
|
720
732
|
};
|
|
721
733
|
placement: ClipPlacement;
|
|
722
734
|
/**
|
|
@@ -733,6 +745,8 @@ interface VoiceoverResult {
|
|
|
733
745
|
clipId: string;
|
|
734
746
|
mediaId: string;
|
|
735
747
|
audioScriptId: string;
|
|
748
|
+
/** Ids of a new script's segments, in order; empty when the script already exists. */
|
|
749
|
+
segmentIds: string[];
|
|
736
750
|
captionClipIds: string[];
|
|
737
751
|
captionIds: string[];
|
|
738
752
|
}
|
|
@@ -762,22 +776,28 @@ declare class DslEditor {
|
|
|
762
776
|
rate: number;
|
|
763
777
|
} | undefined, options?: CommitOptions): void;
|
|
764
778
|
setClipVolume(clipId: string, volume: number | undefined, options?: CommitOptions): void;
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
779
|
+
/** A script of these segments, in order; each segment gets its own id. */
|
|
780
|
+
createAudioScript(segments: readonly string[], defaultLanguage?: string, options?: CommitOptions): string;
|
|
781
|
+
editAudioScript(scriptId: string, segmentId: string, expectedBodyId: string, edits: readonly TextEdit[], options?: CommitOptions): void;
|
|
782
|
+
/** Adds a segment at `index`, the end by default, and returns its id. */
|
|
783
|
+
insertScriptSegment(scriptId: string, text: string, index?: number, options?: CommitOptions): string;
|
|
784
|
+
/** `index` is measured after removing the segment. */
|
|
785
|
+
moveScriptSegment(scriptId: string, segmentId: string, index: number, options?: CommitOptions): void;
|
|
786
|
+
/** Captions and PhoneticScripts selecting the segment keep their selection, which then shows nothing (D72). */
|
|
787
|
+
deleteScriptSegment(scriptId: string, segmentId: string, options?: CommitOptions): void;
|
|
788
|
+
createCaption(input: ((SegmentRange & {
|
|
771
789
|
text?: never;
|
|
772
|
-
} | {
|
|
790
|
+
}) | {
|
|
773
791
|
text: string;
|
|
774
792
|
audioScriptId?: never;
|
|
793
|
+
segmentId?: never;
|
|
775
794
|
start?: never;
|
|
776
795
|
end?: never;
|
|
777
796
|
}) & {
|
|
778
797
|
style?: CaptionStyle;
|
|
779
798
|
}, options?: CommitOptions): string;
|
|
780
|
-
|
|
799
|
+
/** Show a segment of a script, or a run of it, in place of the Caption's own text. */
|
|
800
|
+
setCaptionContent(captionId: string, selection: SegmentRange, options?: CommitOptions): void;
|
|
781
801
|
setCaptionText(captionId: string, text: string, options?: CommitOptions): void;
|
|
782
802
|
editCaptionText(captionId: string, expectedBodyId: string, edits: readonly TextEdit[], options?: CommitOptions): void;
|
|
783
803
|
moveTrack(trackId: string, index: number, options?: CommitOptions): void;
|
|
@@ -796,14 +816,13 @@ declare class DslEditor {
|
|
|
796
816
|
applyVoiceover(input: ApplyVoiceoverInput, options?: CommitOptions): VoiceoverResult;
|
|
797
817
|
private voiceoverScriptId;
|
|
798
818
|
/**
|
|
799
|
-
* Write a PhoneticScript: create one for
|
|
800
|
-
*
|
|
801
|
-
*
|
|
802
|
-
* from it keep their derived-from.
|
|
819
|
+
* Write a PhoneticScript: create one for a segment of a script, or a run of it, or, given
|
|
820
|
+
* `phoneticScriptId`, replace its selection and what to synthesize together (D181). A
|
|
821
|
+
* `phonemeScript` is stored as a Memota text file first, and the file's facts are written with
|
|
822
|
+
* it; an unchanged one keeps its file. Recordings already spoken from it keep their derived-from.
|
|
803
823
|
*/
|
|
804
|
-
setPhoneticScript(input: {
|
|
824
|
+
setPhoneticScript(input: SegmentRange & {
|
|
805
825
|
phoneticScriptId?: string;
|
|
806
|
-
audioScriptId: string;
|
|
807
826
|
phonemeScript?: string;
|
|
808
827
|
}, options?: CommitOptions): Promise<string>;
|
|
809
828
|
/** The file holding `text`: the one the PhoneticScript keeps while its text is unchanged, else a new upload. */
|
|
@@ -873,16 +892,22 @@ declare function toVideoDraft(snapshot: MedeoDslSnapshot): VideoDraftProjection;
|
|
|
873
892
|
*/
|
|
874
893
|
interface AudioScriptView {
|
|
875
894
|
id: string;
|
|
876
|
-
/** Its
|
|
895
|
+
/** Its segments, in order. */
|
|
877
896
|
segments: {
|
|
897
|
+
id: string;
|
|
878
898
|
text: string;
|
|
879
899
|
language?: string;
|
|
880
900
|
}[];
|
|
881
901
|
/** Media the script was read off (a transcript), through derived-from. */
|
|
882
902
|
sourceMediaIds: string[];
|
|
883
|
-
/**
|
|
903
|
+
/**
|
|
904
|
+
* Its variants written for synthesis: the segment each is for (by index, absent once that
|
|
905
|
+
* segment is gone), what its selection holds, what to synthesize, and its file's digest.
|
|
906
|
+
*/
|
|
884
907
|
phoneticScripts: {
|
|
885
908
|
id: string;
|
|
909
|
+
segment?: number;
|
|
910
|
+
text?: string;
|
|
886
911
|
phonemeScript?: string;
|
|
887
912
|
digest?: string;
|
|
888
913
|
}[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { b as MedeoDsl, h as UploadText, i as AudioScriptView, m as DslEditor, o as VideoDraftProjection } from "./index-
|
|
3
|
-
import { _ as ManualSyncTransport, a as MengineDocSessionOptions, g as ManualSyncDocOptions, n as DocumentSession, r as DocumentSessionUpdateEvent } from "./index-
|
|
1
|
+
import { G as ResourceSystem, R as MedeoDslSnapshot, rt as TrackRole } from "./video-draft-types-GqXnsOzA.js";
|
|
2
|
+
import { b as MedeoDsl, h as UploadText, i as AudioScriptView, m as DslEditor, o as VideoDraftProjection } from "./index-C5wDKYqC.js";
|
|
3
|
+
import { _ as ManualSyncTransport, a as MengineDocSessionOptions, g as ManualSyncDocOptions, n as DocumentSession, r as DocumentSessionUpdateEvent } from "./index-DAfOkcnZ.js";
|
|
4
4
|
|
|
5
5
|
//#region src/manual-sync/manual-sync-doc.d.ts
|
|
6
6
|
/** Explicit synchronization over the same DSL/editor used by the live Session. */
|
|
@@ -66,15 +66,21 @@ declare class ManualSyncDoc extends ManualSyncTransport {
|
|
|
66
66
|
};
|
|
67
67
|
readonly "audio-script-entities": {
|
|
68
68
|
readonly [x: string]: {
|
|
69
|
-
readonly
|
|
69
|
+
readonly segments: readonly {
|
|
70
|
+
readonly id: string;
|
|
71
|
+
readonly text: string;
|
|
72
|
+
}[];
|
|
70
73
|
readonly defaultLanguage?: string | undefined;
|
|
71
74
|
};
|
|
72
75
|
};
|
|
73
76
|
readonly "phonetic-script-entities": {
|
|
74
77
|
readonly [x: string]: {
|
|
75
78
|
readonly phoneme: {
|
|
76
|
-
readonly audioScriptId: string;
|
|
77
79
|
readonly phonemeScript?: string | undefined;
|
|
80
|
+
readonly audioScriptId: string;
|
|
81
|
+
readonly segmentId: string;
|
|
82
|
+
readonly start?: import("loro-crdt").Cursor | undefined;
|
|
83
|
+
readonly end?: import("loro-crdt").Cursor | undefined;
|
|
78
84
|
};
|
|
79
85
|
readonly system?: "memota" | undefined;
|
|
80
86
|
readonly key?: string | undefined;
|
|
@@ -86,8 +92,9 @@ declare class ManualSyncDoc extends ManualSyncTransport {
|
|
|
86
92
|
readonly [x: string]: {
|
|
87
93
|
readonly selection?: {
|
|
88
94
|
readonly audioScriptId: string;
|
|
89
|
-
readonly
|
|
90
|
-
readonly
|
|
95
|
+
readonly segmentId: string;
|
|
96
|
+
readonly start?: import("loro-crdt").Cursor | undefined;
|
|
97
|
+
readonly end?: import("loro-crdt").Cursor | undefined;
|
|
91
98
|
} | undefined;
|
|
92
99
|
readonly text?: string | undefined;
|
|
93
100
|
readonly style?: {
|
|
@@ -152,6 +159,14 @@ declare class ManualSyncDoc extends ManualSyncTransport {
|
|
|
152
159
|
readonly bodyId: string;
|
|
153
160
|
};
|
|
154
161
|
};
|
|
162
|
+
readonly phoneticText: {
|
|
163
|
+
readonly [x: string]: {
|
|
164
|
+
readonly text: string;
|
|
165
|
+
readonly start: number;
|
|
166
|
+
readonly end: number;
|
|
167
|
+
readonly bodyId: string;
|
|
168
|
+
};
|
|
169
|
+
};
|
|
155
170
|
readonly diagnostics: readonly {
|
|
156
171
|
readonly code: string;
|
|
157
172
|
readonly path: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { j as DslDiagnostic, o as VideoDraftContent, p as CommitOptions } from "./video-draft-types-
|
|
1
|
+
import { j as DslDiagnostic, o as VideoDraftContent, p as CommitOptions } from "./video-draft-types-GqXnsOzA.js";
|
|
2
2
|
import { LoroDoc, PeerID, VersionVector } from "loro-crdt";
|
|
3
3
|
import { DocState, LocalSaveState } from "@mengine/sync";
|
|
4
4
|
import { BaseDocStorage, Connection, DocDiff, DocPushReceipt, DocSnapshotRecord, DocStorage, DocStorageOptions, DocUpdate, DocUpdateRecord } from "@mengine/storage";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { A as MedeoDslDraft, C as UnsupportedDocumentFormatError, D as captionContentCodec, E as InvalidAtomic, F as ClipSource, I as DslClipUpdate, L as MoveDslClipsInput, M as medeoDslLoroShape, N as AddDslClip, O as isInvalidAtomic, P as AddDslClipsInput, R as ReplaceDslClipsInput, S as DslTransaction, T as documentFormat, _ as VoiceoverCaptionInput, a as toAudioScriptViews, b as MedeoDsl, c as resolveDslLayout, d as DslProjectionError, f as DslTrackLayout, g as ApplyVoiceoverInput, h as UploadText, i as AudioScriptView, j as MedeoDslLoroState, k as timeAnchorCodec, l as DslClipLayout, m as DslEditor, n as ImportedVideoDraft, o as VideoDraftProjection, p as createInitialMedeoDsl, r as fromVideoDraft, s as toVideoDraft, t as FromVideoDraftOptions, u as DslLayout, v as VoiceoverResult, w as assertDslDocument, x as DslAudit, y as CreateMedeoDslOptions, z as ClipPlacement } from "./index-
|
|
3
|
-
import { A as MenginePushRejectedError, B as MengineSyncResponse, C as PushResult, D as MengineHttpClient, E as readMengineEventStream, F as MenginePushResponse, H as base64ToBytes, I as MenginePushUpdateResponse, L as MengineRejectedResponse, M as MengineAuditResponse, N as MengineDocumentVersion, O as MengineHttpClientOptions, P as MengineDraftResponse, R as MengineSnapshotResponse, S as PullResult, T as MengineEventStreamOptions, U as bytesToBase64, V as MengineUpdateMeta, a as MengineDocSessionOptions, b as DocVersionMark, c as WaitForLocalSaveOptions, d as MengineUndoState, f as MedeoHttpDocStorage, g as ManualSyncDocOptions, h as PushOutcomeKind, i as MengineAckFailedError, j as MengineAuditEntry, k as MengineHttpRequestError, l as WaitForServerAckOptions, m as PushOutcome, o as MengineDocSyncState, p as MedeoHttpDocStorageOptions, s as MengineLocalSaveState, t as MemoryDocStorage, u as DocStorageLike, v as decodeDocVersionMark, w as PushResultKind, x as PullFailureReason, y as encodeDocVersionMark, z as MengineSseUpdateEvent } from "./index-
|
|
4
|
-
import { n as MengineDocSessionUpdateEvent, r as ManualSyncDoc, t as MengineDocSession } from "./index-
|
|
1
|
+
import { $ as TextMutation, A as DeepReadonly, C as CaptionContent, D as Clip, E as CaptionText, F as EntityTables, G as ResourceSystem, H as RelationTable, I as EntityValues, K as RichTextSnapshot, L as FieldPatch, M as DslMutation, N as EntityMutation, O as ContainMutation, P as EntityTable, Q as TextMark, R as MedeoDslSnapshot, S as Caption, T as CaptionStyle, U as RelationTables, V as RelationMutation, W as RelationValues, X as TextDelta, Y as StoredFile, Z as TextEdit, _ as defaultIdFactory, a as VideoDraftCaptionStyle, b as tupleHash, c as VideoDraftInput, d as VideoDraftTrack, et as TextRun, f as VideoDraftTrackItem, g as EntityIdKind, h as DslIdFactory, i as VideoDraft, it as Voice, j as DslDiagnostic, k as ContainNode, l as VideoDraftPartUnion, m as OpActor, n as DEFAULT_UNIT_TIME_MS, nt as Track, o as VideoDraftContent, p as CommitOptions, r as VideoCreationSettings, rt as TrackRole, s as VideoDraftContentPartUnion, t as CaptionDisplayCue, tt as TimeAnchor, u as VideoDraftTimeline, v as relationId, w as CaptionSelection, x as AudioScript, y as resourceId, z as Media } from "./video-draft-types-GqXnsOzA.js";
|
|
2
|
+
import { A as MedeoDslDraft, C as UnsupportedDocumentFormatError, D as captionContentCodec, E as InvalidAtomic, F as ClipSource, I as DslClipUpdate, L as MoveDslClipsInput, M as medeoDslLoroShape, N as AddDslClip, O as isInvalidAtomic, P as AddDslClipsInput, R as ReplaceDslClipsInput, S as DslTransaction, T as documentFormat, _ as VoiceoverCaptionInput, a as toAudioScriptViews, b as MedeoDsl, c as resolveDslLayout, d as DslProjectionError, f as DslTrackLayout, g as ApplyVoiceoverInput, h as UploadText, i as AudioScriptView, j as MedeoDslLoroState, k as timeAnchorCodec, l as DslClipLayout, m as DslEditor, n as ImportedVideoDraft, o as VideoDraftProjection, p as createInitialMedeoDsl, r as fromVideoDraft, s as toVideoDraft, t as FromVideoDraftOptions, u as DslLayout, v as VoiceoverResult, w as assertDslDocument, x as DslAudit, y as CreateMedeoDslOptions, z as ClipPlacement } from "./index-C5wDKYqC.js";
|
|
3
|
+
import { A as MenginePushRejectedError, B as MengineSyncResponse, C as PushResult, D as MengineHttpClient, E as readMengineEventStream, F as MenginePushResponse, H as base64ToBytes, I as MenginePushUpdateResponse, L as MengineRejectedResponse, M as MengineAuditResponse, N as MengineDocumentVersion, O as MengineHttpClientOptions, P as MengineDraftResponse, R as MengineSnapshotResponse, S as PullResult, T as MengineEventStreamOptions, U as bytesToBase64, V as MengineUpdateMeta, a as MengineDocSessionOptions, b as DocVersionMark, c as WaitForLocalSaveOptions, d as MengineUndoState, f as MedeoHttpDocStorage, g as ManualSyncDocOptions, h as PushOutcomeKind, i as MengineAckFailedError, j as MengineAuditEntry, k as MengineHttpRequestError, l as WaitForServerAckOptions, m as PushOutcome, o as MengineDocSyncState, p as MedeoHttpDocStorageOptions, s as MengineLocalSaveState, t as MemoryDocStorage, u as DocStorageLike, v as decodeDocVersionMark, w as PushResultKind, x as PullFailureReason, y as encodeDocVersionMark, z as MengineSseUpdateEvent } from "./index-DAfOkcnZ.js";
|
|
4
|
+
import { n as MengineDocSessionUpdateEvent, r as ManualSyncDoc, t as MengineDocSession } from "./index-CHiPztZr.js";
|
|
5
5
|
export { type AddDslClip, type AddDslClipsInput, type ApplyVoiceoverInput, type AudioScript, type AudioScriptView, type Caption, type CaptionContent, type CaptionDisplayCue, type CaptionSelection, type CaptionStyle, type CaptionText, type Clip, type ClipPlacement, type ClipSource, type CommitOptions, type ContainMutation, type ContainNode, type CreateMedeoDslOptions, DEFAULT_UNIT_TIME_MS, type DeepReadonly, type DocStorageLike, type DocVersionMark, type DslAudit, type DslClipLayout, type DslClipUpdate, type DslDiagnostic, DslEditor, type DslIdFactory, type DslLayout, type DslMutation, DslProjectionError, type DslTrackLayout, type DslTransaction, type EntityIdKind, type EntityMutation, type EntityTable, type EntityTables, type EntityValues, type FieldPatch, type FromVideoDraftOptions, type ImportedVideoDraft, type InvalidAtomic, ManualSyncDoc, type ManualSyncDocOptions, MedeoDsl, type MedeoDslDraft, type MedeoDslLoroState, type MedeoDslSnapshot, MedeoHttpDocStorage, type MedeoHttpDocStorageOptions, type Media, MemoryDocStorage, MengineAckFailedError, type MengineAuditEntry, type MengineAuditResponse, MengineDocSession, type MengineDocSessionOptions, type MengineDocSessionUpdateEvent, type MengineDocSyncState, type MengineDocumentVersion, type MengineDraftResponse, type MengineEventStreamOptions, MengineHttpClient, type MengineHttpClientOptions, MengineHttpRequestError, type MengineLocalSaveState, MenginePushRejectedError, type MenginePushResponse, type MenginePushUpdateResponse, type MengineRejectedResponse, type MengineSnapshotResponse, type MengineSseUpdateEvent, type MengineSyncResponse, type MengineUndoState, type MengineUpdateMeta, type MoveDslClipsInput, type OpActor, type PullFailureReason, type PullResult, type PushOutcome, type PushOutcomeKind, type PushResult, type PushResultKind, type RelationMutation, type RelationTable, type RelationTables, type RelationValues, type ReplaceDslClipsInput, type ResourceSystem, type RichTextSnapshot, type StoredFile, type TextDelta, type TextEdit, type TextMark, type TextMutation, type TextRun, type TimeAnchor, type Track, type TrackRole, UnsupportedDocumentFormatError, type UploadText, type VideoCreationSettings, type VideoDraft, type VideoDraftCaptionStyle, type VideoDraftContent, type VideoDraftContentPartUnion, type VideoDraftInput, type VideoDraftPartUnion, type VideoDraftProjection, type VideoDraftTimeline, type VideoDraftTrack, type VideoDraftTrackItem, type Voice, type VoiceoverCaptionInput, type VoiceoverResult, type WaitForLocalSaveOptions, type WaitForServerAckOptions, assertDslDocument, base64ToBytes, bytesToBase64, captionContentCodec, createInitialMedeoDsl, decodeDocVersionMark, defaultIdFactory, documentFormat, encodeDocVersionMark, fromVideoDraft, isInvalidAtomic, medeoDslLoroShape, readMengineEventStream, relationId, resolveDslLayout, resourceId, timeAnchorCodec, toAudioScriptViews, toVideoDraft, tupleHash };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as bytesToBase64, t as base64ToBytes } from "./base64-D-jd-dr5.js";
|
|
2
2
|
import { a as covers, c as readMengineEventStream, d as MenginePushRejectedError, i as openManualDocument, l as MengineHttpClient, n as MedeoHttpDocStorage, o as decodeDocVersionMark, r as ManualSyncTransport, s as encodeDocVersionMark, t as MemoryDocStorage, u as MengineHttpRequestError } from "./storage-BW3tI_ER.js";
|
|
3
|
-
import { a as documentFormat, c as isInvalidAtomic,
|
|
4
|
-
import { a as DslEditor, c as DslProjectionError, i as createInitialMedeoDsl, n as toVideoDraft, o as MedeoDsl, r as toAudioScriptViews, s as resolveDslLayout, t as fromVideoDraft } from "./dsl-
|
|
3
|
+
import { _t as tupleHash, a as documentFormat, c as isInvalidAtomic, gt as resourceId, ht as relationId, i as assertDslDocument, mt as defaultIdFactory, o as medeoDslLoroShape, r as UnsupportedDocumentFormatError, s as captionContentCodec, t as DEFAULT_UNIT_TIME_MS, u as timeAnchorCodec } from "./video-draft-types-BnbfWrBx.js";
|
|
4
|
+
import { a as DslEditor, c as DslProjectionError, i as createInitialMedeoDsl, n as toVideoDraft, o as MedeoDsl, r as toAudioScriptViews, s as resolveDslLayout, t as fromVideoDraft } from "./dsl-COyzz7Fp.js";
|
|
5
5
|
import { UndoManager, VersionVector, decodeImportBlobMeta } from "loro-crdt";
|
|
6
6
|
import { ClientServerSynchronizer, DocManager } from "@mengine/sync";
|
|
7
7
|
import { DisposableSet, EventBus } from "@mengine/utils";
|
package/dist/legacy.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as VideoDraft, l as VideoDraftPartUnion, o as VideoDraftContent, p as CommitOptions, t as CaptionDisplayCue } from "./video-draft-types-
|
|
2
|
-
import { A as MenginePushRejectedError, B as MengineSyncResponse, C as PushResult, D as MengineHttpClient, E as readMengineEventStream, F as MenginePushResponse, H as base64ToBytes, I as MenginePushUpdateResponse, L as MengineRejectedResponse, M as MengineAuditResponse, N as MengineDocumentVersion, O as MengineHttpClientOptions, P as MengineDraftResponse, R as MengineSnapshotResponse, S as PullResult, T as MengineEventStreamOptions, U as bytesToBase64, V as MengineUpdateMeta, _ as ManualSyncTransport, a as MengineDocSessionOptions, b as DocVersionMark, d as MengineUndoState, f as MedeoHttpDocStorage, g as ManualSyncDocOptions, h as PushOutcomeKind, j as MengineAuditEntry, k as MengineHttpRequestError, l as WaitForServerAckOptions, m as PushOutcome, o as MengineDocSyncState, p as MedeoHttpDocStorageOptions, t as MemoryDocStorage, u as DocStorageLike, v as decodeDocVersionMark, w as PushResultKind, x as PullFailureReason, y as encodeDocVersionMark, z as MengineSseUpdateEvent } from "./index-
|
|
1
|
+
import { i as VideoDraft, l as VideoDraftPartUnion, o as VideoDraftContent, p as CommitOptions, t as CaptionDisplayCue } from "./video-draft-types-GqXnsOzA.js";
|
|
2
|
+
import { A as MenginePushRejectedError, B as MengineSyncResponse, C as PushResult, D as MengineHttpClient, E as readMengineEventStream, F as MenginePushResponse, H as base64ToBytes, I as MenginePushUpdateResponse, L as MengineRejectedResponse, M as MengineAuditResponse, N as MengineDocumentVersion, O as MengineHttpClientOptions, P as MengineDraftResponse, R as MengineSnapshotResponse, S as PullResult, T as MengineEventStreamOptions, U as bytesToBase64, V as MengineUpdateMeta, _ as ManualSyncTransport, a as MengineDocSessionOptions, b as DocVersionMark, d as MengineUndoState, f as MedeoHttpDocStorage, g as ManualSyncDocOptions, h as PushOutcomeKind, j as MengineAuditEntry, k as MengineHttpRequestError, l as WaitForServerAckOptions, m as PushOutcome, o as MengineDocSyncState, p as MedeoHttpDocStorageOptions, t as MemoryDocStorage, u as DocStorageLike, v as decodeDocVersionMark, w as PushResultKind, x as PullFailureReason, y as encodeDocVersionMark, z as MengineSseUpdateEvent } from "./index-DAfOkcnZ.js";
|
|
3
3
|
import { LoroDoc, PeerID } from "loro-crdt";
|
|
4
4
|
|
|
5
5
|
//#region ../medeo-dsl/depreacted/sandbox.d.ts
|
package/dist/legacy.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as bytesToBase64, t as base64ToBytes } from "./base64-D-jd-dr5.js";
|
|
2
2
|
import { c as readMengineEventStream, d as MenginePushRejectedError, i as openManualDocument, l as MengineHttpClient, n as MedeoHttpDocStorage, o as decodeDocVersionMark, r as ManualSyncTransport, s as encodeDocVersionMark, t as MemoryDocStorage, u as MengineHttpRequestError } from "./storage-BW3tI_ER.js";
|
|
3
|
-
import { a as documentFormat, r as UnsupportedDocumentFormatError, t as DEFAULT_UNIT_TIME_MS } from "./video-draft-types-
|
|
3
|
+
import { a as documentFormat, r as UnsupportedDocumentFormatError, t as DEFAULT_UNIT_TIME_MS } from "./video-draft-types-BnbfWrBx.js";
|
|
4
4
|
import { u as volumeSchema } from "./shared-iWnU2osE.js";
|
|
5
5
|
import { sha256 } from "@noble/hashes/sha2.js";
|
|
6
6
|
import { LoroDoc, LoroMap, LoroMovableList, LoroText, UndoManager } from "loro-crdt";
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as VideoDraft } from "./video-draft-types-
|
|
2
|
-
import { b as MedeoDsl } from "./index-
|
|
1
|
+
import { i as VideoDraft } from "./video-draft-types-GqXnsOzA.js";
|
|
2
|
+
import { b as MedeoDsl } from "./index-C5wDKYqC.js";
|
|
3
3
|
import { LoroDoc } from "loro-crdt";
|
|
4
4
|
|
|
5
5
|
//#region src/testing/in-memory-mengine-server.d.ts
|
package/dist/testing.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as bytesToBase64, t as base64ToBytes } from "./base64-D-jd-dr5.js";
|
|
2
|
-
import { a as documentFormat, i as assertDslDocument } from "./video-draft-types-
|
|
3
|
-
import { a as DslEditor, i as createInitialMedeoDsl, n as toVideoDraft, o as MedeoDsl } from "./dsl-
|
|
2
|
+
import { a as documentFormat, i as assertDslDocument } from "./video-draft-types-BnbfWrBx.js";
|
|
3
|
+
import { a as DslEditor, i as createInitialMedeoDsl, n as toVideoDraft, o as MedeoDsl } from "./dsl-COyzz7Fp.js";
|
|
4
4
|
import { t as classifyUpdate } from "./loro-relay-doc-Bi6JKqtQ.js";
|
|
5
5
|
import { LoroDoc, VersionVector, encodeFrontiers } from "loro-crdt";
|
|
6
6
|
//#region src/testing/in-memory-mengine-server.ts
|
|
@@ -450,7 +450,7 @@ function createTestDsl(options = {}) {
|
|
|
450
450
|
durationMs: 1e3,
|
|
451
451
|
storageKey: "speech.mp3"
|
|
452
452
|
},
|
|
453
|
-
script: {
|
|
453
|
+
script: { segments: ["hello"] },
|
|
454
454
|
volume: 1,
|
|
455
455
|
voice: {
|
|
456
456
|
system: "voice-library",
|
|
@@ -466,10 +466,7 @@ function createTestDsl(options = {}) {
|
|
|
466
466
|
clipId: "caption",
|
|
467
467
|
startMs: 0,
|
|
468
468
|
durationMs: 1e3,
|
|
469
|
-
|
|
470
|
-
start: 0,
|
|
471
|
-
end: 5
|
|
472
|
-
},
|
|
469
|
+
segment: 0,
|
|
473
470
|
style: {}
|
|
474
471
|
}]
|
|
475
472
|
});
|
|
@@ -131,21 +131,30 @@ const timeAnchorFields = {
|
|
|
131
131
|
function assertTimeAnchor(value) {
|
|
132
132
|
checkFields(value, timeAnchorFields);
|
|
133
133
|
}
|
|
134
|
-
const
|
|
134
|
+
const selectionFields = {
|
|
135
135
|
audioScriptId: required(id),
|
|
136
|
-
|
|
137
|
-
|
|
136
|
+
segmentId: required(id),
|
|
137
|
+
start: optional$1(cursor),
|
|
138
|
+
end: optional$1(cursor)
|
|
138
139
|
};
|
|
140
|
+
/** A whole segment, or a run inside it: both ends or neither. */
|
|
141
|
+
const segmentSelection = (fields) => (v) => object(fields)(v) && v.start === void 0 === (v.end === void 0);
|
|
139
142
|
function assertCaptionContent(value) {
|
|
140
|
-
|
|
143
|
+
if (!segmentSelection(selectionFields)(value)) throw new Error("Invalid segment selection");
|
|
141
144
|
}
|
|
142
145
|
const phonemeFields = {
|
|
143
|
-
|
|
146
|
+
...selectionFields,
|
|
144
147
|
phonemeScript: optional$1(string)
|
|
145
148
|
};
|
|
146
149
|
function assertPhoneme(value) {
|
|
147
|
-
|
|
150
|
+
if (!segmentSelection(phonemeFields)(value)) throw new Error("Invalid phoneme");
|
|
148
151
|
}
|
|
152
|
+
const segmentFields = {
|
|
153
|
+
id: required(id),
|
|
154
|
+
text: required(string)
|
|
155
|
+
};
|
|
156
|
+
/** A script's segments: each with its own id, unique within the script. */
|
|
157
|
+
const segments = (v) => Array.isArray(v) && v.every(object(segmentFields)) && new Set(v.map((segment) => segment.id)).size === v.length;
|
|
149
158
|
const locator = {
|
|
150
159
|
system: required(oneOf("memota", "memota-speech")),
|
|
151
160
|
key: required(nonempty)
|
|
@@ -170,18 +179,18 @@ const entityFields = {
|
|
|
170
179
|
digest: optional$1(nonempty)
|
|
171
180
|
},
|
|
172
181
|
"audio-script-entities": {
|
|
173
|
-
|
|
182
|
+
segments: required(segments),
|
|
174
183
|
defaultLanguage: optional$1(validLanguage)
|
|
175
184
|
},
|
|
176
185
|
"phonetic-script-entities": {
|
|
177
|
-
phoneme:
|
|
186
|
+
phoneme: optional$1(segmentSelection(phonemeFields)),
|
|
178
187
|
system: optional$1(oneOf("memota")),
|
|
179
188
|
key: optional$1(nonempty),
|
|
180
189
|
storageKey: optional$1(nonempty),
|
|
181
190
|
digest: optional$1(nonempty)
|
|
182
191
|
},
|
|
183
192
|
"caption-entities": {
|
|
184
|
-
selection: optional$1(
|
|
193
|
+
selection: optional$1(segmentSelection(selectionFields)),
|
|
185
194
|
text: optional$1(string),
|
|
186
195
|
style: optional$1(object(styleFields))
|
|
187
196
|
},
|
|
@@ -221,17 +230,19 @@ const fileFields = [
|
|
|
221
230
|
];
|
|
222
231
|
const phonemeScriptOf = (row) => isRecord(row.phoneme) ? row.phoneme.phonemeScript : void 0;
|
|
223
232
|
/**
|
|
224
|
-
* A PhoneticScript
|
|
225
|
-
*
|
|
233
|
+
* A PhoneticScript as a write leaves it: written for a segment (D181), and its phonemeScript is raw
|
|
234
|
+
* content stored as its file (D178) — with text the row names that file and its digest, without
|
|
235
|
+
* text it has no file, and rewritten text is a new file.
|
|
226
236
|
*/
|
|
227
|
-
function
|
|
228
|
-
if (
|
|
229
|
-
|
|
230
|
-
|
|
237
|
+
function assertPhoneticScript(before, after) {
|
|
238
|
+
if (!isRecord(after.phoneme)) throw new Error("A PhoneticScript is written for a segment of its base script");
|
|
239
|
+
if (phonemeScriptOf(after) === void 0) {
|
|
240
|
+
if (fileFields.some((field) => after[field] !== void 0)) throw new Error("A PhoneticScript without text has no file");
|
|
241
|
+
} else if (after.system === void 0 || after.key === void 0 || after.digest === void 0) throw new Error("A PhoneticScript stores its phonemeScript as a file: name it by system and key with its digest");
|
|
242
|
+
if (before !== void 0 && phonemeScriptOf(after) !== phonemeScriptOf(before) && after.digest !== void 0 && after.digest === before.digest) throw new Error("A rewritten phonemeScript is stored again: write its new file");
|
|
231
243
|
}
|
|
232
244
|
function assertEntity(table, value) {
|
|
233
245
|
checkFields(value, entityFields[table]);
|
|
234
|
-
if (table === "phonetic-script-entities") assertPhoneticFile(value);
|
|
235
246
|
if (table === "media-entities") {
|
|
236
247
|
if (value.kind === "image" && value.durationMs !== void 0) throw new Error("Image has no intrinsic duration");
|
|
237
248
|
if (value.kind !== "image" && !positive(value.durationMs)) throw new Error("Finite media requires durationMs");
|
|
@@ -241,7 +252,7 @@ function assertEntity(table, value) {
|
|
|
241
252
|
/** Validate only touched fields, so an unrelated edit can proceed in a merged, invalid document. */
|
|
242
253
|
function assertEntityPatch(table, patch, current) {
|
|
243
254
|
if (!isRecord(patch)) throw new Error("Expected an entity patch");
|
|
244
|
-
if (table === "audio-script-entities" && Object.hasOwn(patch, "
|
|
255
|
+
if (table === "audio-script-entities" && Object.hasOwn(patch, "segments")) throw new Error("Change segments with segment mutations and edit their text through the Text adapter");
|
|
245
256
|
if (table === "caption-entities" && current.style !== void 0 && Object.hasOwn(patch, "style") && patch.style === void 0) throw new Error("Reset individual style fields; retain the style Map");
|
|
246
257
|
if (table === "caption-entities" && current.text !== void 0 && patch.text !== void 0) throw new Error("Edit Caption text through the Text adapter");
|
|
247
258
|
const next = patchRow(table, current, patch);
|
|
@@ -249,10 +260,6 @@ function assertEntityPatch(table, patch, current) {
|
|
|
249
260
|
const field = entityFields[table][key];
|
|
250
261
|
if (!field || !field.optional && next[key] === void 0 || next[key] !== void 0 && !field.check(next[key])) throw new Error(`Invalid patch field: ${key}`);
|
|
251
262
|
}
|
|
252
|
-
if (table === "phonetic-script-entities" && ["phoneme", ...fileFields].some((field) => Object.hasOwn(patch, field))) {
|
|
253
|
-
assertPhoneticFile(next);
|
|
254
|
-
if (phonemeScriptOf(next) !== phonemeScriptOf(current) && next.digest !== void 0 && next.digest === current.digest) throw new Error("A rewritten phonemeScript is stored again: write its new file");
|
|
255
|
-
}
|
|
256
263
|
if (table === "media-entities" || table === "voice-entities") {
|
|
257
264
|
for (const key of [
|
|
258
265
|
"system",
|
|
@@ -1298,36 +1305,48 @@ const timeAnchorCodec = codec((v) => {
|
|
|
1298
1305
|
assertTimeAnchor(v);
|
|
1299
1306
|
return v;
|
|
1300
1307
|
});
|
|
1301
|
-
/** A
|
|
1308
|
+
/** A segment selection as stored: a run's Cursors as their native bytes in unpadded base64url. */
|
|
1309
|
+
function encodeSelection(v) {
|
|
1310
|
+
return {
|
|
1311
|
+
audioScriptId: v.audioScriptId,
|
|
1312
|
+
segmentId: v.segmentId,
|
|
1313
|
+
...v.start === void 0 || v.end === void 0 ? {} : {
|
|
1314
|
+
start: bytesToBase64url(v.start.encode()),
|
|
1315
|
+
end: bytesToBase64url(v.end.encode())
|
|
1316
|
+
}
|
|
1317
|
+
};
|
|
1318
|
+
}
|
|
1319
|
+
function decodeSelection(v) {
|
|
1320
|
+
if (!v || typeof v !== "object") throw new Error("Expected a segment selection");
|
|
1321
|
+
const { start, end, ...rest } = v;
|
|
1322
|
+
if (start === void 0 && end === void 0) return rest;
|
|
1323
|
+
if (typeof start !== "string" || typeof end !== "string") throw new Error("Expected encoded Cursor pair");
|
|
1324
|
+
return {
|
|
1325
|
+
...rest,
|
|
1326
|
+
start: Cursor.decode(base64urlToBytes(start)),
|
|
1327
|
+
end: Cursor.decode(base64urlToBytes(end))
|
|
1328
|
+
};
|
|
1329
|
+
}
|
|
1330
|
+
/** A Caption's selection. */
|
|
1302
1331
|
const captionContentCodec = codec((v) => {
|
|
1303
1332
|
assertCaptionContent(v);
|
|
1304
|
-
return JSON.stringify(
|
|
1305
|
-
audioScriptId: v.audioScriptId,
|
|
1306
|
-
start: bytesToBase64url(v.start.encode()),
|
|
1307
|
-
end: bytesToBase64url(v.end.encode())
|
|
1308
|
-
});
|
|
1333
|
+
return JSON.stringify(encodeSelection(v));
|
|
1309
1334
|
}, (raw) => {
|
|
1310
|
-
const
|
|
1311
|
-
if (typeof v?.start !== "string" || typeof v?.end !== "string") throw new Error("Expected encoded Cursor pair");
|
|
1312
|
-
const value = {
|
|
1313
|
-
...v,
|
|
1314
|
-
start: Cursor.decode(base64urlToBytes(v.start)),
|
|
1315
|
-
end: Cursor.decode(base64urlToBytes(v.end))
|
|
1316
|
-
};
|
|
1335
|
+
const value = decodeSelection(JSON.parse(raw));
|
|
1317
1336
|
assertCaptionContent(value);
|
|
1318
1337
|
return value;
|
|
1319
1338
|
});
|
|
1320
|
-
/** A
|
|
1339
|
+
/** A PhoneticScript's selection and what to synthesize for it, stored as one string so they move together. */
|
|
1321
1340
|
const phonemeCodec = codec((v) => {
|
|
1322
1341
|
assertPhoneme(v);
|
|
1323
1342
|
return JSON.stringify({
|
|
1324
|
-
|
|
1343
|
+
...encodeSelection(v),
|
|
1325
1344
|
...v.phonemeScript === void 0 ? {} : { phonemeScript: v.phonemeScript }
|
|
1326
1345
|
});
|
|
1327
1346
|
}, (raw) => {
|
|
1328
|
-
const
|
|
1329
|
-
assertPhoneme(
|
|
1330
|
-
return
|
|
1347
|
+
const value = decodeSelection(JSON.parse(raw));
|
|
1348
|
+
assertPhoneme(value);
|
|
1349
|
+
return value;
|
|
1331
1350
|
});
|
|
1332
1351
|
/** A Clip's sequence marker is stored as one string, so it is taken or replaced whole. */
|
|
1333
1352
|
const seqMarkerCodec = codec((v) => {
|
|
@@ -1358,7 +1377,7 @@ const transform = (codec) => ({
|
|
|
1358
1377
|
const atomicValue = (codec) => schema.String().transform(transform(codec));
|
|
1359
1378
|
const optionalAtomicValue = (codec) => schema.String(optional).transform(transform(codec));
|
|
1360
1379
|
/**
|
|
1361
|
-
* Only direct children inherit mergeable identity.
|
|
1380
|
+
* Only direct children inherit mergeable identity. Text and ordinary entity rows keep normal
|
|
1362
1381
|
* identities, so deleting a row also drops what a peer wrote into it concurrently: a relation an
|
|
1363
1382
|
* entity holds at most one of is a field of that row and never outlives it.
|
|
1364
1383
|
*/
|
|
@@ -1383,7 +1402,10 @@ const medeoDslLoroShape = schema({
|
|
|
1383
1402
|
digest: schema.String(optional)
|
|
1384
1403
|
}), mergeable),
|
|
1385
1404
|
"audio-script-entities": schema.LoroMapRecord(schema.LoroMap({
|
|
1386
|
-
|
|
1405
|
+
segments: schema.LoroMovableList(schema.LoroMap({
|
|
1406
|
+
id: schema.String(),
|
|
1407
|
+
text: schema.LoroText()
|
|
1408
|
+
}), (segment) => segment.id),
|
|
1387
1409
|
defaultLanguage: schema.String(optional)
|
|
1388
1410
|
})),
|
|
1389
1411
|
"phonetic-script-entities": schema.LoroMapRecord(schema.LoroMap({
|
|
@@ -1461,4 +1483,4 @@ const textStyles = { language: { expand: "after" } };
|
|
|
1461
1483
|
//#region src/dsl/projection/video-draft-types.ts
|
|
1462
1484
|
const DEFAULT_UNIT_TIME_MS = 33.333;
|
|
1463
1485
|
//#endregion
|
|
1464
|
-
export {
|
|
1486
|
+
export { assertEntityPatch as $, getRootContainerByType as A, isValueOfContainerType as B, applyEncode as C, decodeNestedJsonValues as D, containerIdToContainerType as E, isArrayLike as F, tryUpdateToContainer as G, schemaToContainerType as H, isObject as I, getChildContainerSchema as J, valuesEqual as K, isObjectLike as L, hasTransform as M, inferContainerTypeFromValue as N, deepEqual as O, insertChildToMap as P, assertEntity as Q, isStateAndSchemaOfType as R, applyDecode as S, cidsEqual as T, stripUndefined as U, safeStringify as V, tryInferContainerType as W, getMapFieldSchema as X, getChildSchema as Y, assertCaptionContent as Z, isLoroMovableListSchema as _, tupleHash as _t, documentFormat as a, atomicFields as at, schemaContainsIgnoreField as b, isInvalidAtomic as c, mergeFields as ct, schema as d, validLanguage as dt, assertId as et, getDefaultValue as f, assertRelationIdentity as ft, isLoroMapSchema as g, resourceId as gt, isLoroListSchema as h, relationId as ht, assertDslDocument as i, assertTimeAnchor as it, hardenCidDescriptors as j, defineCidProperty as k, phonemeCodec as l, patchRow as lt, isListLikeSchema as m, defaultIdFactory as mt, textStyles as n, assertPhoneticScript as nt, medeoDslLoroShape as o, entityTables as ot, isContainerSchema as p, assertResourceIdentity as pt, CID_KEY as q, UnsupportedDocumentFormatError as r, assertRelation as rt, captionContentCodec as s, isRecord as st, DEFAULT_UNIT_TIME_MS as t, assertPhoneme as tt, timeAnchorCodec as u, relationTables as ut, isLoroTreeSchema as v, applySchemaToInferOptions as w, validateSchema as x, isRootSchemaType as y, isTreeID as z };
|