@mengine/medeo-client 3.1.1-dsl.0 → 3.1.1-issue-4970-recovery.1

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.
@@ -8921,4 +8921,273 @@ function normalizeLegacyVideoDraft(input, mediaFacts = []) {
8921
8921
  };
8922
8922
  }
8923
8923
  //#endregion
8924
- export { relationId as C, defaultIdFactory as S, tupleHash as T, timeAnchorCodec as _, createInitialMedeoDsl as a, BLANK_PLACEHOLDER as b, toAudioScriptViews as c, assertDslDocument as d, assertPhoneticBindingFormat as f, isInvalidAtomic as g, captionContentCodec as h, DEFAULT_UNIT_TIME_MS as i, MedeoDsl as l, medeoDslLoroShape as m, fromVideoDraft as n, DslEditor as o, documentFormat as p, toVideoDraft as r, spokenScripts as s, normalizeLegacyVideoDraft as t, UnsupportedDocumentFormatError as u, resolveDslLayout as v, resourceId as w, missingMediaPlaceholder as x, DslProjectionError as y };
8924
+ //#region src/dsl/projection/video-draft-history.ts
8925
+ /**
8926
+ * Brings `doc`, an initialized DSL document (see `createInitialMedeoDsl`) or one earlier calls to
8927
+ * this function brought to a version, to the content of `next`. `next` is applied exactly as
8928
+ * given: a stored Legacy Draft goes through `normalizeLegacyVideoDraft` first, like any migration.
8929
+ *
8930
+ * The result projects exactly as `fromVideoDraft(next)` would. Anything else throws, and before
8931
+ * it does the document's content is reverted to what it was, so a failed version never leaves a
8932
+ * partial edit at the head and a caller never records a revision that differs from its source.
8933
+ */
8934
+ function applyVideoDraftVersion(doc, next, options) {
8935
+ const before = doc.frontiers();
8936
+ try {
8937
+ return applyVersion(doc, next, options);
8938
+ } catch (error) {
8939
+ const revert = editOptions({
8940
+ ...options.audit,
8941
+ intent: "revert a version that failed to replay"
8942
+ });
8943
+ doc.commit(revert);
8944
+ if (!sameFrontiers(doc.frontiers(), before)) {
8945
+ doc.revertTo(before);
8946
+ doc.commit(revert);
8947
+ }
8948
+ throw error;
8949
+ }
8950
+ }
8951
+ function applyVersion(doc, next, options) {
8952
+ const current = readState(doc);
8953
+ const timelineIds = Object.keys(current["timeline-entities"]);
8954
+ if (timelineIds.length !== 1) throw new Error("Expected exactly one Timeline in the replayed document");
8955
+ const imported = fromVideoDraft(next, {
8956
+ mediaFacts: options.mediaFacts,
8957
+ audit: options.audit,
8958
+ timelineId: timelineIds[0]
8959
+ });
8960
+ try {
8961
+ const target = readState(imported.dsl.doc);
8962
+ const expected = projection(imported.dsl);
8963
+ const rename = matchIdentities(current, target);
8964
+ const ranges = rangeTargets(imported.dsl, target, rename);
8965
+ const state = renamedState(target, rename, current, ranges);
8966
+ keepTreeIds(state["contain-relations"], current["contain-relations"]);
8967
+ const mirror = new Mirror({
8968
+ doc,
8969
+ schema: medeoDslLoroShape,
8970
+ validateUpdates: false,
8971
+ ignoreUnknownProperties: true
8972
+ });
8973
+ try {
8974
+ const order = state["contain-relations"];
8975
+ mirror.setState(() => state, {
8976
+ ...editOptions(options.audit),
8977
+ applyNative: (d) => restoreOrder(d, order)
8978
+ });
8979
+ } finally {
8980
+ mirror.dispose();
8981
+ }
8982
+ const dsl = new MedeoDsl(doc);
8983
+ try {
8984
+ const stale = staleRanges(dsl, ranges);
8985
+ if (stale.length) dsl.applyMutations(stale.map(({ captionId, audioScriptId, segmentId, start, end }) => ({
8986
+ type: "set-caption-content",
8987
+ captionId,
8988
+ audioScriptId,
8989
+ segmentId,
8990
+ start,
8991
+ end
8992
+ })), options.audit);
8993
+ assertDslDocument(doc);
8994
+ const actual = projection(dsl);
8995
+ if (actual !== expected) throw new Error(`Replayed version does not project as its source version at ${firstDifference(JSON.parse(actual), JSON.parse(expected))}`);
8996
+ } finally {
8997
+ dsl.dispose();
8998
+ }
8999
+ return {
9000
+ frontiers: doc.frontiers(),
9001
+ diagnostics: imported.diagnostics
9002
+ };
9003
+ } finally {
9004
+ imported.dsl.dispose();
9005
+ }
9006
+ }
9007
+ /**
9008
+ * Replays a whole history into a new document that starts empty, as `initialize` creates one, so
9009
+ * the first version is an ordinary edit like the rest. Throws on the first version that cannot be
9010
+ * replayed; which versions to skip is the caller's policy.
9011
+ */
9012
+ function replayVideoDraftHistory(versions, options) {
9013
+ const dsl = createInitialMedeoDsl({ peerId: options.peerId });
9014
+ try {
9015
+ return {
9016
+ dsl,
9017
+ initial: dsl.doc.frontiers(),
9018
+ versions: versions.map((version) => applyVideoDraftVersion(dsl.doc, version, options))
9019
+ };
9020
+ } catch (error) {
9021
+ dsl.dispose();
9022
+ throw error;
9023
+ }
9024
+ }
9025
+ function sameFrontiers(a, b) {
9026
+ return a.length === b.length && a.every((id) => b.some((other) => other.peer === id.peer && other.counter === id.counter));
9027
+ }
9028
+ /** Every root the schema declares; a root no write has created yet reads as empty. */
9029
+ function readState(doc) {
9030
+ const mirror = new Mirror({
9031
+ doc,
9032
+ schema: medeoDslLoroShape,
9033
+ validateUpdates: false,
9034
+ ignoreUnknownProperties: true
9035
+ });
9036
+ try {
9037
+ const state = mirror.getState();
9038
+ return Object.fromEntries(Object.keys(medeoDslLoroShape.definition).map((root) => [root, state[root] ?? (root === "contain-relations" ? [] : {})]));
9039
+ } finally {
9040
+ mirror.dispose();
9041
+ }
9042
+ }
9043
+ function projection(dsl) {
9044
+ return JSON.stringify(toVideoDraft(dsl.getSnapshot()).content);
9045
+ }
9046
+ /** The path of the first value two projections disagree on, with both values, for diagnosis. */
9047
+ function firstDifference(actual, expected, path = "") {
9048
+ if (actual && expected && typeof actual === "object" && typeof expected === "object") {
9049
+ const a = actual, e = expected;
9050
+ for (const key of new Set([...Object.keys(a), ...Object.keys(e)])) if (JSON.stringify(a[key]) !== JSON.stringify(e[key])) return firstDifference(a[key], e[key], `${path}/${key}`);
9051
+ }
9052
+ return `${path || "/"}: ${JSON.stringify(actual)} != ${JSON.stringify(expected)}`;
9053
+ }
9054
+ function editOptions(audit) {
9055
+ return {
9056
+ origin: "mengine.semantic_editor",
9057
+ message: JSON.stringify({
9058
+ semantic_op: audit.semantic_op,
9059
+ payload: audit.payload ?? null,
9060
+ intent: audit.intent ?? null,
9061
+ actor: audit.actor ?? null
9062
+ })
9063
+ };
9064
+ }
9065
+ /**
9066
+ * Maps the IDs the import minted for `target` onto the IDs `current` gave the same content. Clips,
9067
+ * Tracks and resources keep their Legacy or locator IDs; only Captions, AudioScripts and segments
9068
+ * are minted. A Caption follows the Clip that plays it, a script the recording it transcribes, and
9069
+ * segments the longest run of unchanged lines; leftover lines between two kept ones pair in order
9070
+ * when both sides have the same count, so an edited line stays the same segment.
9071
+ */
9072
+ function matchIdentities(current, target) {
9073
+ const rename = /* @__PURE__ */ new Map();
9074
+ for (const [clipId, clip] of Object.entries(target["clip-entities"])) {
9075
+ const before = current["clip-entities"][clipId]?.source;
9076
+ const source = clip.source;
9077
+ if (typeof before === "string" && source in target["caption-entities"] && before in current["caption-entities"]) rename.set(source, before);
9078
+ }
9079
+ const scriptOf = (state) => new Map(Object.values(state["derived-from-relations"]).filter((r) => r.sourceId in state["audio-script-entities"]).map((r) => [r.entityId, r.sourceId]));
9080
+ const beforeScripts = scriptOf(current);
9081
+ for (const [recording, script] of scriptOf(target)) {
9082
+ const before = beforeScripts.get(recording);
9083
+ if (!before) continue;
9084
+ rename.set(script, before);
9085
+ const segments = (s, id) => s["audio-script-entities"][id].segments;
9086
+ for (const [to, from] of matchSegments(segments(target, script), segments(current, before))) rename.set(to, from);
9087
+ }
9088
+ return rename;
9089
+ }
9090
+ function matchSegments(next, before) {
9091
+ const text = (s) => String(s.text);
9092
+ const lcs = Array.from({ length: next.length + 1 }, () => Array.from({ length: before.length + 1 }, () => 0));
9093
+ for (let i = next.length - 1; i >= 0; i--) for (let j = before.length - 1; j >= 0; j--) lcs[i][j] = text(next[i]) === text(before[j]) ? lcs[i + 1][j + 1] + 1 : Math.max(lcs[i + 1][j], lcs[i][j + 1]);
9094
+ const anchors = [];
9095
+ for (let i = 0, j = 0; i < next.length && j < before.length;) if (text(next[i]) === text(before[j])) anchors.push([i++, j++]);
9096
+ else if (lcs[i + 1][j] >= lcs[i][j + 1]) i++;
9097
+ else j++;
9098
+ const pairs = [];
9099
+ let [pi, pj] = [-1, -1];
9100
+ for (const [i, j] of [...anchors, [next.length, before.length]]) {
9101
+ if (i - pi === j - pj) for (let k = 1; k < i - pi; k++) pairs.push([next[pi + k].id, before[pj + k].id]);
9102
+ if (i < next.length) pairs.push([next[i].id, before[j].id]);
9103
+ [pi, pj] = [i, j];
9104
+ }
9105
+ return pairs;
9106
+ }
9107
+ /**
9108
+ * The target's range selections as offsets, under their renamed IDs. Whole-segment selections carry
9109
+ * no Cursor and are renamed like any other value.
9110
+ */
9111
+ function rangeTargets(scratch, target, rename) {
9112
+ const texts = scratch.getSnapshot().captionText;
9113
+ const renamed = (id) => rename.get(id) ?? id;
9114
+ return Object.entries(target["caption-entities"]).flatMap(([id, caption]) => {
9115
+ const selection = caption.selection;
9116
+ if (!selection || selection.start === void 0) return [];
9117
+ const resolved = texts[id];
9118
+ if (!resolved) throw new Error(`Caption ${id} does not resolve in its source version`);
9119
+ return [{
9120
+ captionId: renamed(id),
9121
+ audioScriptId: renamed(selection.audioScriptId),
9122
+ segmentId: renamed(selection.segmentId),
9123
+ start: resolved.start,
9124
+ end: resolved.end
9125
+ }];
9126
+ });
9127
+ }
9128
+ /**
9129
+ * The target as plain state under the current IDs. A range selection keeps the current value when
9130
+ * there is one, so Mirror leaves it alone; whether it still selects the right run is only known
9131
+ * once the Text is applied, and `staleRanges` rewrites it then.
9132
+ */
9133
+ function renamedState(target, rename, current, ranges) {
9134
+ const ranged = new Set(ranges.map((r) => r.captionId));
9135
+ const copy = (value) => {
9136
+ if (typeof value === "string") return rename.get(value) ?? value;
9137
+ if (Array.isArray(value)) return value.map(copy);
9138
+ if (value && typeof value === "object") return Object.fromEntries(Object.entries(value).map(([key, v]) => [rename.get(key) ?? key, copy(v)]));
9139
+ return value;
9140
+ };
9141
+ const state = Object.fromEntries(Object.entries(target).map(([table, value]) => {
9142
+ if (table !== "caption-entities") return [table, copy(value)];
9143
+ const captions = {};
9144
+ for (const [id, caption] of Object.entries(value)) {
9145
+ const { selection, ...rest } = caption;
9146
+ const key = rename.get(id) ?? id;
9147
+ const row = copy(rest);
9148
+ if (!ranged.has(key)) {
9149
+ if (selection !== void 0) row.selection = copy(selection);
9150
+ } else if (current["caption-entities"][key]?.selection !== void 0) row.selection = current["caption-entities"][key].selection;
9151
+ captions[key] = row;
9152
+ }
9153
+ return [table, captions];
9154
+ }));
9155
+ state["derived-from-relations"] = Object.fromEntries(Object.values(state["derived-from-relations"]).map((value) => [relationId("derived-from-relations", value), value]));
9156
+ return state;
9157
+ }
9158
+ function keepTreeIds(next, before) {
9159
+ const ids = /* @__PURE__ */ new Map();
9160
+ const collect = (nodes) => nodes.forEach((node) => {
9161
+ ids.set(node.data.entityId, node.id);
9162
+ collect(node.children ?? []);
9163
+ });
9164
+ collect(before);
9165
+ const assign = (nodes) => nodes.forEach((node) => {
9166
+ const id = ids.get(node.data.entityId);
9167
+ if (id) node.id = id;
9168
+ else delete node.id;
9169
+ assign(node.children ?? []);
9170
+ });
9171
+ assign(next);
9172
+ }
9173
+ function restoreOrder(doc, target) {
9174
+ const tree = doc.getTree("contain-relations");
9175
+ const byEntity = new Map(tree.getNodes().map((node) => [node.data.get("entityId"), node]));
9176
+ const place = (nodes, parent) => nodes.forEach((want, index) => {
9177
+ const node = byEntity.get(want.data.entityId);
9178
+ if (!node) throw new Error(`Tree node for ${want.data.entityId} was not created`);
9179
+ if ((parent === void 0 ? tree.roots() : tree.getNodeByID(parent).children())[index]?.id !== node.id || node.parent()?.id !== parent) tree.move(node.id, parent, index);
9180
+ place(want.children ?? [], node.id);
9181
+ });
9182
+ place(target);
9183
+ }
9184
+ function staleRanges(dsl, ranges) {
9185
+ const snapshot = dsl.getSnapshot();
9186
+ return ranges.filter((range) => {
9187
+ const selection = snapshot["caption-entities"][range.captionId]?.selection;
9188
+ const resolved = snapshot.captionText[range.captionId];
9189
+ return !selection || selection.audioScriptId !== range.audioScriptId || selection.segmentId !== range.segmentId || !resolved || resolved.start !== range.start || resolved.end !== range.end;
9190
+ });
9191
+ }
9192
+ //#endregion
9193
+ export { missingMediaPlaceholder as C, tupleHash as D, resourceId as E, BLANK_PLACEHOLDER as S, relationId as T, captionContentCodec as _, toVideoDraft as a, resolveDslLayout as b, DslEditor as c, MedeoDsl as d, UnsupportedDocumentFormatError as f, medeoDslLoroShape as g, documentFormat as h, fromVideoDraft as i, spokenScripts as l, assertPhoneticBindingFormat as m, replayVideoDraftHistory as n, DEFAULT_UNIT_TIME_MS as o, assertDslDocument as p, normalizeLegacyVideoDraft as r, createInitialMedeoDsl as s, applyVideoDraftVersion as t, toAudioScriptViews as u, isInvalidAtomic as v, defaultIdFactory as w, DslProjectionError as x, timeAnchorCodec as y };
package/dist/dsl.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { $ as ClipSource, A as DslEditor, At as Media, B as assertDslDocument, Bt as TextMark, C as VideoDraftTrackItem, Ct as DslMutation, D as DslProjectionError, Dt as EntityValues, E as DslLayout, Et as EntityTables, F as CreateMedeoDslOptions, Ft as ResourceSystem, G as timeAnchorCodec, Gt as TrackRole, H as InvalidAtomic, Ht as TextRun, I as MedeoDsl, It as RichTextSnapshot, J as medeoDslLoroShape, K as MedeoDslDraft, Kt as Voice, L as DslAudit, Lt as StoredFile, M as ApplyVoiceoverInput, Mt as RelationTable, N as VoiceoverCaptionInput, Nt as RelationTables, O as DslTrackLayout, Ot as FieldPatch, P as VoiceoverResult, Pt as RelationValues, Q as AddDslClipsInput, R as DslTransaction, Rt as TextDelta, S as VideoDraftTrack, St as DslDiagnostic, T as DslClipLayout, Tt as EntityTable, U as captionContentCodec, Ut as TimeAnchor, V as documentFormat, Vt as TextMutation, W as isInvalidAtomic, Wt as Track, X as OpActor, Y as CommitOptions, Z as AddDslClip, _ as VideoDraftContent, _t as CaptionText, a as fromVideoDraft, at as missingMediaPlaceholder, b as VideoDraftPartUnion, bt as ContainNode, c as spokenScripts, ct as defaultIdFactory, d as toVideoDraft, dt as tupleHash, et as DslClipUpdate, f as CaptionDisplayCue, ft as AudioScript, g as VideoDraftCaptionStyle, gt as CaptionStyle, h as VideoDraft, ht as CaptionSelection, i as ImportedVideoDraft, it as BLANK_PLACEHOLDER, j as UploadText, jt as RelationMutation, k as createInitialMedeoDsl, kt as MedeoDslSnapshot, l as toAudioScriptViews, lt as relationId, m as VideoCreationSettings, mt as CaptionContent, n as normalizeLegacyVideoDraft, nt as ReplaceDslClipsInput, o as AudioScriptView, ot as DslIdFactory, p as DEFAULT_UNIT_TIME_MS, pt as Caption, q as MedeoDslLoroState, r as FromVideoDraftOptions, rt as ClipPlacement, s as SpokenScript, st as EntityIdKind, t as NormalizedLegacyVideoDraft, tt as MoveDslClipsInput, u as VideoDraftProjection, ut as resourceId, v as VideoDraftContentPartUnion, vt as Clip, w as resolveDslLayout, wt as EntityMutation, x as VideoDraftTimeline, xt as DeepReadonly, y as VideoDraftInput, yt as ContainMutation, z as UnsupportedDocumentFormatError, zt as TextEdit } from "./index-CQ8h3u9S.js";
2
- export { type AddDslClip, type AddDslClipsInput, type ApplyVoiceoverInput, type AudioScript, type AudioScriptView, BLANK_PLACEHOLDER, 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 NormalizedLegacyVideoDraft, type OpActor, type RelationMutation, type RelationTable, type RelationTables, type RelationValues, type ReplaceDslClipsInput, type ResourceSystem, type RichTextSnapshot, type SpokenScript, 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, missingMediaPlaceholder, normalizeLegacyVideoDraft, relationId, resolveDslLayout, resourceId, spokenScripts, timeAnchorCodec, toAudioScriptViews, toVideoDraft, tupleHash };
1
+ import { $ as CommitOptions, A as DslLayout, At as EntityTables, B as MedeoDsl, Bt as RichTextSnapshot, C as VideoDraftInput, Ct as ContainMutation, D as VideoDraftTrackItem, Dt as DslMutation, E as VideoDraftTrack, Et as DslDiagnostic, F as UploadText, Ft as RelationMutation, G as documentFormat, Gt as TextMutation, H as DslTransaction, Ht as TextDelta, I as ApplyVoiceoverInput, It as RelationTable, J as isInvalidAtomic, Jt as Track, K as InvalidAtomic, Kt as TextRun, L as VoiceoverCaptionInput, Lt as RelationTables, M as DslTrackLayout, Mt as FieldPatch, N as createInitialMedeoDsl, Nt as MedeoDslSnapshot, O as resolveDslLayout, Ot as EntityMutation, P as DslEditor, Pt as Media, Q as medeoDslLoroShape, R as VoiceoverResult, Rt as RelationValues, S as VideoDraftContentPartUnion, St as Clip, T as VideoDraftTimeline, Tt as DeepReadonly, U as UnsupportedDocumentFormatError, Ut as TextEdit, V as DslAudit, Vt as StoredFile, W as assertDslDocument, Wt as TextMark, X as MedeoDslDraft, Xt as Voice, Y as timeAnchorCodec, Yt as TrackRole, Z as MedeoDslLoroState, _ as DEFAULT_UNIT_TIME_MS, _t as Caption, a as NormalizedLegacyVideoDraft, at as MoveDslClipsInput, b as VideoDraftCaptionStyle, bt as CaptionStyle, c as ImportedVideoDraft, ct as BLANK_PLACEHOLDER, d as SpokenScript, dt as EntityIdKind, et as OpActor, f as spokenScripts, ft as defaultIdFactory, g as CaptionDisplayCue, gt as AudioScript, h as toVideoDraft, ht as tupleHash, i as replayVideoDraftHistory, it as DslClipUpdate, j as DslProjectionError, jt as EntityValues, k as DslClipLayout, kt as EntityTable, l as fromVideoDraft, lt as missingMediaPlaceholder, m as VideoDraftProjection, mt as resourceId, n as VideoDraftVersionOptions, nt as AddDslClipsInput, o as normalizeLegacyVideoDraft, ot as ReplaceDslClipsInput, p as toAudioScriptViews, pt as relationId, q as captionContentCodec, qt as TimeAnchor, r as applyVideoDraftVersion, rt as ClipSource, s as FromVideoDraftOptions, st as ClipPlacement, t as AppliedVideoDraftVersion, tt as AddDslClip, u as AudioScriptView, ut as DslIdFactory, v as VideoCreationSettings, vt as CaptionContent, w as VideoDraftPartUnion, wt as ContainNode, x as VideoDraftContent, xt as CaptionText, y as VideoDraft, yt as CaptionSelection, z as CreateMedeoDslOptions, zt as ResourceSystem } from "./index-AW1gLLLS.js";
2
+ export { type AddDslClip, type AddDslClipsInput, type AppliedVideoDraftVersion, type ApplyVoiceoverInput, type AudioScript, type AudioScriptView, BLANK_PLACEHOLDER, 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 NormalizedLegacyVideoDraft, type OpActor, type RelationMutation, type RelationTable, type RelationTables, type RelationValues, type ReplaceDslClipsInput, type ResourceSystem, type RichTextSnapshot, type SpokenScript, 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 VideoDraftVersionOptions, type Voice, type VoiceoverCaptionInput, type VoiceoverResult, applyVideoDraftVersion, assertDslDocument, captionContentCodec, createInitialMedeoDsl, defaultIdFactory, documentFormat, fromVideoDraft, isInvalidAtomic, medeoDslLoroShape, missingMediaPlaceholder, normalizeLegacyVideoDraft, relationId, replayVideoDraftHistory, resolveDslLayout, resourceId, spokenScripts, timeAnchorCodec, toAudioScriptViews, toVideoDraft, tupleHash };
package/dist/dsl.js CHANGED
@@ -1,2 +1,2 @@
1
- import { C as relationId, S as defaultIdFactory, T as tupleHash, _ as timeAnchorCodec, a as createInitialMedeoDsl, b as BLANK_PLACEHOLDER, c as toAudioScriptViews, d as assertDslDocument, g as isInvalidAtomic, h as captionContentCodec, i as DEFAULT_UNIT_TIME_MS, l as MedeoDsl, m as medeoDslLoroShape, n as fromVideoDraft, o as DslEditor, p as documentFormat, r as toVideoDraft, s as spokenScripts, t as normalizeLegacyVideoDraft, u as UnsupportedDocumentFormatError, v as resolveDslLayout, w as resourceId, x as missingMediaPlaceholder, y as DslProjectionError } from "./dsl-Xm5NW58k.js";
2
- export { BLANK_PLACEHOLDER, DEFAULT_UNIT_TIME_MS, DslEditor, DslProjectionError, MedeoDsl, UnsupportedDocumentFormatError, assertDslDocument, captionContentCodec, createInitialMedeoDsl, defaultIdFactory, documentFormat, fromVideoDraft, isInvalidAtomic, medeoDslLoroShape, missingMediaPlaceholder, normalizeLegacyVideoDraft, relationId, resolveDslLayout, resourceId, spokenScripts, timeAnchorCodec, toAudioScriptViews, toVideoDraft, tupleHash };
1
+ import { C as missingMediaPlaceholder, D as tupleHash, E as resourceId, S as BLANK_PLACEHOLDER, T as relationId, _ as captionContentCodec, a as toVideoDraft, b as resolveDslLayout, c as DslEditor, d as MedeoDsl, f as UnsupportedDocumentFormatError, g as medeoDslLoroShape, h as documentFormat, i as fromVideoDraft, l as spokenScripts, n as replayVideoDraftHistory, o as DEFAULT_UNIT_TIME_MS, p as assertDslDocument, r as normalizeLegacyVideoDraft, s as createInitialMedeoDsl, t as applyVideoDraftVersion, u as toAudioScriptViews, v as isInvalidAtomic, w as defaultIdFactory, x as DslProjectionError, y as timeAnchorCodec } from "./dsl-BwHZ5JqM.js";
2
+ export { BLANK_PLACEHOLDER, DEFAULT_UNIT_TIME_MS, DslEditor, DslProjectionError, MedeoDsl, UnsupportedDocumentFormatError, applyVideoDraftVersion, assertDslDocument, captionContentCodec, createInitialMedeoDsl, defaultIdFactory, documentFormat, fromVideoDraft, isInvalidAtomic, medeoDslLoroShape, missingMediaPlaceholder, normalizeLegacyVideoDraft, relationId, replayVideoDraftHistory, resolveDslLayout, resourceId, spokenScripts, timeAnchorCodec, toAudioScriptViews, toVideoDraft, tupleHash };
@@ -1890,4 +1890,48 @@ interface NormalizedLegacyVideoDraft {
1890
1890
  }
1891
1891
  declare function normalizeLegacyVideoDraft(input: VideoDraftInput, mediaFacts?: readonly Media[]): NormalizedLegacyVideoDraft;
1892
1892
  //#endregion
1893
- export { ClipSource as $, DslEditor as A, Media as At, assertDslDocument as B, TextMark as Bt, VideoDraftTrackItem as C, DslMutation as Ct, DslProjectionError as D, EntityValues as Dt, DslLayout as E, EntityTables as Et, CreateMedeoDslOptions as F, ResourceSystem as Ft, timeAnchorCodec as G, TrackRole as Gt, InvalidAtomic as H, TextRun as Ht, MedeoDsl as I, RichTextSnapshot as It, medeoDslLoroShape as J, MedeoDslDraft as K, Voice as Kt, DslAudit as L, StoredFile as Lt, ApplyVoiceoverInput as M, RelationTable as Mt, VoiceoverCaptionInput as N, RelationTables as Nt, DslTrackLayout as O, FieldPatch as Ot, VoiceoverResult as P, RelationValues as Pt, AddDslClipsInput as Q, DslTransaction as R, TextDelta as Rt, VideoDraftTrack as S, DslDiagnostic as St, DslClipLayout as T, EntityTable as Tt, captionContentCodec as U, TimeAnchor as Ut, documentFormat as V, TextMutation as Vt, isInvalidAtomic as W, Track$1 as Wt, OpActor as X, CommitOptions as Y, AddDslClip as Z, VideoDraftContent as _, CaptionText as _t, fromVideoDraft as a, missingMediaPlaceholder as at, VideoDraftPartUnion as b, ContainNode as bt, spokenScripts as c, defaultIdFactory as ct, toVideoDraft as d, tupleHash as dt, DslClipUpdate as et, CaptionDisplayCue as f, AudioScript as ft, VideoDraftCaptionStyle as g, CaptionStyle$1 as gt, VideoDraft as h, CaptionSelection as ht, ImportedVideoDraft as i, BLANK_PLACEHOLDER as it, UploadText as j, RelationMutation as jt, createInitialMedeoDsl as k, MedeoDslSnapshot as kt, toAudioScriptViews as l, relationId as lt, VideoCreationSettings as m, CaptionContent as mt, normalizeLegacyVideoDraft as n, ReplaceDslClipsInput as nt, AudioScriptView as o, DslIdFactory as ot, DEFAULT_UNIT_TIME_MS as p, Caption as pt, MedeoDslLoroState as q, FromVideoDraftOptions as r, ClipPlacement as rt, SpokenScript as s, EntityIdKind as st, NormalizedLegacyVideoDraft as t, MoveDslClipsInput as tt, VideoDraftProjection as u, resourceId as ut, VideoDraftContentPartUnion as v, Clip as vt, resolveDslLayout as w, EntityMutation as wt, VideoDraftTimeline as x, DeepReadonly as xt, VideoDraftInput as y, ContainMutation as yt, UnsupportedDocumentFormatError as z, TextEdit as zt };
1893
+ //#region src/dsl/projection/video-draft-history.d.ts
1894
+ /**
1895
+ * Replays saved Legacy Draft versions into one DSL document, one ordinary edit per version, so the
1896
+ * document's own history can be checked out at each of them.
1897
+ *
1898
+ * `fromVideoDraft` builds every version from scratch; two such builds share no Loro identity, so
1899
+ * Loro cannot diff them. Each later version is therefore imported into a scratch document, renamed
1900
+ * onto the identities the replayed document already has, and handed to Mirror, which diffs plain
1901
+ * state by key. What cannot be carried over as plain state is rebuilt instead: Tree nodes keep
1902
+ * their existing TreeIDs, and a Caption's range selection, whose Cursors name the scratch
1903
+ * document's Text, is written again from offsets after Mirror has applied the Text.
1904
+ */
1905
+ interface VideoDraftVersionOptions {
1906
+ /** Facts for every medium the version plays; versions of one draft may share one fact list. */
1907
+ mediaFacts?: readonly Media[];
1908
+ /** Recorded on the version's edit, like any DSL write. */
1909
+ audit: DslAudit;
1910
+ }
1911
+ interface AppliedVideoDraftVersion {
1912
+ /** The replayed document's heads once the version is applied: its revision boundary. */
1913
+ frontiers: ReturnType<LoroDoc['frontiers']>;
1914
+ diagnostics: DslDiagnostic[];
1915
+ }
1916
+ /**
1917
+ * Brings `doc`, an initialized DSL document (see `createInitialMedeoDsl`) or one earlier calls to
1918
+ * this function brought to a version, to the content of `next`. `next` is applied exactly as
1919
+ * given: a stored Legacy Draft goes through `normalizeLegacyVideoDraft` first, like any migration.
1920
+ *
1921
+ * The result projects exactly as `fromVideoDraft(next)` would. Anything else throws, and before
1922
+ * it does the document's content is reverted to what it was, so a failed version never leaves a
1923
+ * partial edit at the head and a caller never records a revision that differs from its source.
1924
+ */
1925
+ declare function applyVideoDraftVersion(doc: LoroDoc, next: VideoDraftInput, options: VideoDraftVersionOptions): AppliedVideoDraftVersion;
1926
+ /**
1927
+ * Replays a whole history into a new document that starts empty, as `initialize` creates one, so
1928
+ * the first version is an ordinary edit like the rest. Throws on the first version that cannot be
1929
+ * replayed; which versions to skip is the caller's policy.
1930
+ */
1931
+ declare function replayVideoDraftHistory(versions: readonly VideoDraftInput[], options: VideoDraftVersionOptions & Pick<CreateMedeoDslOptions, 'peerId'>): {
1932
+ dsl: MedeoDsl;
1933
+ initial: AppliedVideoDraftVersion['frontiers'];
1934
+ versions: AppliedVideoDraftVersion[];
1935
+ };
1936
+ //#endregion
1937
+ export { CommitOptions as $, DslLayout as A, EntityTables as At, MedeoDsl as B, RichTextSnapshot as Bt, VideoDraftInput as C, ContainMutation as Ct, VideoDraftTrackItem as D, DslMutation as Dt, VideoDraftTrack as E, DslDiagnostic as Et, UploadText as F, RelationMutation as Ft, documentFormat as G, TextMutation as Gt, DslTransaction as H, TextDelta as Ht, ApplyVoiceoverInput as I, RelationTable as It, isInvalidAtomic as J, Track$1 as Jt, InvalidAtomic as K, TextRun as Kt, VoiceoverCaptionInput as L, RelationTables as Lt, DslTrackLayout as M, FieldPatch as Mt, createInitialMedeoDsl as N, MedeoDslSnapshot as Nt, resolveDslLayout as O, EntityMutation as Ot, DslEditor as P, Media as Pt, medeoDslLoroShape as Q, VoiceoverResult as R, RelationValues as Rt, VideoDraftContentPartUnion as S, Clip as St, VideoDraftTimeline as T, DeepReadonly as Tt, UnsupportedDocumentFormatError as U, TextEdit as Ut, DslAudit as V, StoredFile as Vt, assertDslDocument as W, TextMark as Wt, MedeoDslDraft as X, Voice as Xt, timeAnchorCodec as Y, TrackRole as Yt, MedeoDslLoroState as Z, DEFAULT_UNIT_TIME_MS as _, Caption as _t, NormalizedLegacyVideoDraft as a, MoveDslClipsInput as at, VideoDraftCaptionStyle as b, CaptionStyle$1 as bt, ImportedVideoDraft as c, BLANK_PLACEHOLDER as ct, SpokenScript as d, EntityIdKind as dt, OpActor as et, spokenScripts as f, defaultIdFactory as ft, CaptionDisplayCue as g, AudioScript as gt, toVideoDraft as h, tupleHash as ht, replayVideoDraftHistory as i, DslClipUpdate as it, DslProjectionError as j, EntityValues as jt, DslClipLayout as k, EntityTable as kt, fromVideoDraft as l, missingMediaPlaceholder as lt, VideoDraftProjection as m, resourceId as mt, VideoDraftVersionOptions as n, AddDslClipsInput as nt, normalizeLegacyVideoDraft as o, ReplaceDslClipsInput as ot, toAudioScriptViews as p, relationId as pt, captionContentCodec as q, TimeAnchor as qt, applyVideoDraftVersion as r, ClipSource as rt, FromVideoDraftOptions as s, ClipPlacement as st, AppliedVideoDraftVersion as t, AddDslClip as tt, AudioScriptView as u, DslIdFactory as ut, VideoCreationSettings as v, CaptionContent as vt, VideoDraftPartUnion as w, ContainNode as wt, VideoDraftContent as x, CaptionText as xt, VideoDraft as y, CaptionSelection as yt, CreateMedeoDslOptions as z, ResourceSystem as zt };
@@ -1,4 +1,4 @@
1
- import { A as DslEditor, Ft as ResourceSystem, Gt as TrackRole, I as MedeoDsl, St as DslDiagnostic, Y as CommitOptions, _ as VideoDraftContent, j as UploadText, kt as MedeoDslSnapshot, o as AudioScriptView, u as VideoDraftProjection } from "./index-CQ8h3u9S.js";
1
+ import { $ as CommitOptions, B as MedeoDsl, Et as DslDiagnostic, F as UploadText, Nt as MedeoDslSnapshot, P as DslEditor, Yt as TrackRole, m as VideoDraftProjection, u as AudioScriptView, x as VideoDraftContent, zt as ResourceSystem } from "./index-AW1gLLLS.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,3 +1,3 @@
1
- import { $ as ClipSource, A as DslEditor, At as Media, B as assertDslDocument, Bt as TextMark, C as VideoDraftTrackItem, Ct as DslMutation, D as DslProjectionError, Dt as EntityValues, E as DslLayout, Et as EntityTables, F as CreateMedeoDslOptions, Ft as ResourceSystem, G as timeAnchorCodec, Gt as TrackRole, H as InvalidAtomic, Ht as TextRun, I as MedeoDsl, It as RichTextSnapshot, J as medeoDslLoroShape, K as MedeoDslDraft, Kt as Voice, L as DslAudit, Lt as StoredFile, M as ApplyVoiceoverInput, Mt as RelationTable, N as VoiceoverCaptionInput, Nt as RelationTables, O as DslTrackLayout, Ot as FieldPatch, P as VoiceoverResult, Pt as RelationValues, Q as AddDslClipsInput, R as DslTransaction, Rt as TextDelta, S as VideoDraftTrack, St as DslDiagnostic, T as DslClipLayout, Tt as EntityTable, U as captionContentCodec, Ut as TimeAnchor, V as documentFormat, Vt as TextMutation, W as isInvalidAtomic, Wt as Track, X as OpActor, Y as CommitOptions, Z as AddDslClip, _ as VideoDraftContent, _t as CaptionText, a as fromVideoDraft, at as missingMediaPlaceholder, b as VideoDraftPartUnion, bt as ContainNode, c as spokenScripts, ct as defaultIdFactory, d as toVideoDraft, dt as tupleHash, et as DslClipUpdate, f as CaptionDisplayCue, ft as AudioScript, g as VideoDraftCaptionStyle, gt as CaptionStyle, h as VideoDraft, ht as CaptionSelection, i as ImportedVideoDraft, it as BLANK_PLACEHOLDER, j as UploadText, jt as RelationMutation, k as createInitialMedeoDsl, kt as MedeoDslSnapshot, l as toAudioScriptViews, lt as relationId, m as VideoCreationSettings, mt as CaptionContent, n as normalizeLegacyVideoDraft, nt as ReplaceDslClipsInput, o as AudioScriptView, ot as DslIdFactory, p as DEFAULT_UNIT_TIME_MS, pt as Caption, q as MedeoDslLoroState, r as FromVideoDraftOptions, rt as ClipPlacement, s as SpokenScript, st as EntityIdKind, t as NormalizedLegacyVideoDraft, tt as MoveDslClipsInput, u as VideoDraftProjection, ut as resourceId, v as VideoDraftContentPartUnion, vt as Clip, w as resolveDslLayout, wt as EntityMutation, x as VideoDraftTimeline, xt as DeepReadonly, y as VideoDraftInput, yt as ContainMutation, z as UnsupportedDocumentFormatError, zt as TextEdit } from "./index-CQ8h3u9S.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 ManualSyncDocOptions, a as MengineDocSessionOptions, b as DocVersionMark, c as WaitForLocalSaveOptions, d as MengineUndoState, f as MedeoHttpDocStorage, g as ManualSyncDoc, h as PushOutcomeKind, i as MengineAckFailedError, j as MengineAuditEntry, k as MengineHttpRequestError, l as WaitForServerAckOptions, m as PushOutcome, n as MengineDocSession, o as MengineDocSyncState, p as MedeoHttpDocStorageOptions, r as MengineDocSessionUpdateEvent, 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-D48u9I25.js";
3
- export { type AddDslClip, type AddDslClipsInput, type ApplyVoiceoverInput, type AudioScript, type AudioScriptView, BLANK_PLACEHOLDER, 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 NormalizedLegacyVideoDraft, 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 SpokenScript, 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, missingMediaPlaceholder, normalizeLegacyVideoDraft, readMengineEventStream, relationId, resolveDslLayout, resourceId, spokenScripts, timeAnchorCodec, toAudioScriptViews, toVideoDraft, tupleHash };
1
+ import { $ as CommitOptions, A as DslLayout, At as EntityTables, B as MedeoDsl, Bt as RichTextSnapshot, C as VideoDraftInput, Ct as ContainMutation, D as VideoDraftTrackItem, Dt as DslMutation, E as VideoDraftTrack, Et as DslDiagnostic, F as UploadText, Ft as RelationMutation, G as documentFormat, Gt as TextMutation, H as DslTransaction, Ht as TextDelta, I as ApplyVoiceoverInput, It as RelationTable, J as isInvalidAtomic, Jt as Track, K as InvalidAtomic, Kt as TextRun, L as VoiceoverCaptionInput, Lt as RelationTables, M as DslTrackLayout, Mt as FieldPatch, N as createInitialMedeoDsl, Nt as MedeoDslSnapshot, O as resolveDslLayout, Ot as EntityMutation, P as DslEditor, Pt as Media, Q as medeoDslLoroShape, R as VoiceoverResult, Rt as RelationValues, S as VideoDraftContentPartUnion, St as Clip, T as VideoDraftTimeline, Tt as DeepReadonly, U as UnsupportedDocumentFormatError, Ut as TextEdit, V as DslAudit, Vt as StoredFile, W as assertDslDocument, Wt as TextMark, X as MedeoDslDraft, Xt as Voice, Y as timeAnchorCodec, Yt as TrackRole, Z as MedeoDslLoroState, _ as DEFAULT_UNIT_TIME_MS, _t as Caption, a as NormalizedLegacyVideoDraft, at as MoveDslClipsInput, b as VideoDraftCaptionStyle, bt as CaptionStyle, c as ImportedVideoDraft, ct as BLANK_PLACEHOLDER, d as SpokenScript, dt as EntityIdKind, et as OpActor, f as spokenScripts, ft as defaultIdFactory, g as CaptionDisplayCue, gt as AudioScript, h as toVideoDraft, ht as tupleHash, i as replayVideoDraftHistory, it as DslClipUpdate, j as DslProjectionError, jt as EntityValues, k as DslClipLayout, kt as EntityTable, l as fromVideoDraft, lt as missingMediaPlaceholder, m as VideoDraftProjection, mt as resourceId, n as VideoDraftVersionOptions, nt as AddDslClipsInput, o as normalizeLegacyVideoDraft, ot as ReplaceDslClipsInput, p as toAudioScriptViews, pt as relationId, q as captionContentCodec, qt as TimeAnchor, r as applyVideoDraftVersion, rt as ClipSource, s as FromVideoDraftOptions, st as ClipPlacement, t as AppliedVideoDraftVersion, tt as AddDslClip, u as AudioScriptView, ut as DslIdFactory, v as VideoCreationSettings, vt as CaptionContent, w as VideoDraftPartUnion, wt as ContainNode, x as VideoDraftContent, xt as CaptionText, y as VideoDraft, yt as CaptionSelection, z as CreateMedeoDslOptions, zt as ResourceSystem } from "./index-AW1gLLLS.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 ManualSyncDocOptions, a as MengineDocSessionOptions, b as DocVersionMark, c as WaitForLocalSaveOptions, d as MengineUndoState, f as MedeoHttpDocStorage, g as ManualSyncDoc, h as PushOutcomeKind, i as MengineAckFailedError, j as MengineAuditEntry, k as MengineHttpRequestError, l as WaitForServerAckOptions, m as PushOutcome, n as MengineDocSession, o as MengineDocSyncState, p as MedeoHttpDocStorageOptions, r as MengineDocSessionUpdateEvent, 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-Dpctu3Sj.js";
3
+ export { type AddDslClip, type AddDslClipsInput, type AppliedVideoDraftVersion, type ApplyVoiceoverInput, type AudioScript, type AudioScriptView, BLANK_PLACEHOLDER, 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 NormalizedLegacyVideoDraft, 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 SpokenScript, 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 VideoDraftVersionOptions, type Voice, type VoiceoverCaptionInput, type VoiceoverResult, type WaitForLocalSaveOptions, type WaitForServerAckOptions, applyVideoDraftVersion, assertDslDocument, base64ToBytes, bytesToBase64, captionContentCodec, createInitialMedeoDsl, decodeDocVersionMark, defaultIdFactory, documentFormat, encodeDocVersionMark, fromVideoDraft, isInvalidAtomic, medeoDslLoroShape, missingMediaPlaceholder, normalizeLegacyVideoDraft, readMengineEventStream, relationId, replayVideoDraftHistory, resolveDslLayout, resourceId, spokenScripts, timeAnchorCodec, toAudioScriptViews, toVideoDraft, tupleHash };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { n as bytesToBase64, t as base64ToBytes } from "./base64-D-jd-dr5.js";
2
- import { C as relationId, S as defaultIdFactory, T as tupleHash, _ as timeAnchorCodec, a as createInitialMedeoDsl, b as BLANK_PLACEHOLDER, c as toAudioScriptViews, d as assertDslDocument, g as isInvalidAtomic, h as captionContentCodec, i as DEFAULT_UNIT_TIME_MS, l as MedeoDsl, m as medeoDslLoroShape, n as fromVideoDraft, o as DslEditor, p as documentFormat, r as toVideoDraft, s as spokenScripts, t as normalizeLegacyVideoDraft, u as UnsupportedDocumentFormatError, v as resolveDslLayout, w as resourceId, x as missingMediaPlaceholder, y as DslProjectionError } from "./dsl-Xm5NW58k.js";
2
+ import { C as missingMediaPlaceholder, D as tupleHash, E as resourceId, S as BLANK_PLACEHOLDER, T as relationId, _ as captionContentCodec, a as toVideoDraft, b as resolveDslLayout, c as DslEditor, d as MedeoDsl, f as UnsupportedDocumentFormatError, g as medeoDslLoroShape, h as documentFormat, i as fromVideoDraft, l as spokenScripts, n as replayVideoDraftHistory, o as DEFAULT_UNIT_TIME_MS, p as assertDslDocument, r as normalizeLegacyVideoDraft, s as createInitialMedeoDsl, t as applyVideoDraftVersion, u as toAudioScriptViews, v as isInvalidAtomic, w as defaultIdFactory, x as DslProjectionError, y as timeAnchorCodec } from "./dsl-BwHZ5JqM.js";
3
3
  import { LoroDoc, UndoManager, VersionVector, decodeImportBlobMeta } from "loro-crdt";
4
4
  import { ClientServerSynchronizer, DocManager } from "@mengine/sync";
5
5
  import { DisposableSet, EventBus, Task } from "@mengine/utils";
@@ -1472,4 +1472,4 @@ var MengineDocSession = class extends DocumentSession {
1472
1472
  }
1473
1473
  };
1474
1474
  //#endregion
1475
- export { BLANK_PLACEHOLDER, DEFAULT_UNIT_TIME_MS, DslEditor, DslProjectionError, ManualSyncDoc, MedeoDsl, MedeoHttpDocStorage, MemoryDocStorage, MengineAckFailedError, MengineDocSession, MengineHttpClient, MengineHttpRequestError, MenginePushRejectedError, UnsupportedDocumentFormatError, assertDslDocument, base64ToBytes, bytesToBase64, captionContentCodec, createInitialMedeoDsl, decodeDocVersionMark, defaultIdFactory, documentFormat, encodeDocVersionMark, fromVideoDraft, isInvalidAtomic, medeoDslLoroShape, missingMediaPlaceholder, normalizeLegacyVideoDraft, readMengineEventStream, relationId, resolveDslLayout, resourceId, spokenScripts, timeAnchorCodec, toAudioScriptViews, toVideoDraft, tupleHash };
1475
+ export { BLANK_PLACEHOLDER, DEFAULT_UNIT_TIME_MS, DslEditor, DslProjectionError, ManualSyncDoc, MedeoDsl, MedeoHttpDocStorage, MemoryDocStorage, MengineAckFailedError, MengineDocSession, MengineHttpClient, MengineHttpRequestError, MenginePushRejectedError, UnsupportedDocumentFormatError, applyVideoDraftVersion, assertDslDocument, base64ToBytes, bytesToBase64, captionContentCodec, createInitialMedeoDsl, decodeDocVersionMark, defaultIdFactory, documentFormat, encodeDocVersionMark, fromVideoDraft, isInvalidAtomic, medeoDslLoroShape, missingMediaPlaceholder, normalizeLegacyVideoDraft, readMengineEventStream, relationId, replayVideoDraftHistory, resolveDslLayout, resourceId, spokenScripts, timeAnchorCodec, toAudioScriptViews, toVideoDraft, tupleHash };
package/dist/testing.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { I as MedeoDsl, h as VideoDraft } from "./index-CQ8h3u9S.js";
1
+ import { B as MedeoDsl, y as VideoDraft } from "./index-AW1gLLLS.js";
2
2
  import { LoroDoc } from "loro-crdt";
3
3
 
4
4
  //#region src/testing/in-memory-mengine-server.d.ts
package/dist/testing.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { n as bytesToBase64, t as base64ToBytes } from "./base64-D-jd-dr5.js";
2
- import { a as createInitialMedeoDsl, d as assertDslDocument, f as assertPhoneticBindingFormat, l as MedeoDsl, o as DslEditor, p as documentFormat, r as toVideoDraft, y as DslProjectionError } from "./dsl-Xm5NW58k.js";
2
+ import { a as toVideoDraft, c as DslEditor, d as MedeoDsl, h as documentFormat, m as assertPhoneticBindingFormat, p as assertDslDocument, s as createInitialMedeoDsl, x as DslProjectionError } from "./dsl-BwHZ5JqM.js";
3
3
  import { t as classifyUpdate } from "./loro-relay-doc-Bi6JKqtQ.js";
4
4
  import { LoroDoc, VersionVector, encodeFrontiers } from "loro-crdt";
5
5
  //#region src/testing/in-memory-mengine-server.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mengine/medeo-client",
3
- "version": "3.1.1-dsl.0",
3
+ "version": "3.1.1-issue-4970-recovery.1",
4
4
  "license": "UNLICENSED",
5
5
  "repository": {
6
6
  "type": "git",
@@ -27,9 +27,9 @@
27
27
  "dependencies": {
28
28
  "@noble/hashes": "^2.4.0",
29
29
  "zod": "^4.4.3",
30
- "@mengine/storage": "3.1.1-dsl.0",
31
- "@mengine/sync": "3.1.1-dsl.0",
32
- "@mengine/utils": "3.1.1-dsl.0"
30
+ "@mengine/storage": "3.1.1-issue-4970-recovery.1",
31
+ "@mengine/sync": "3.1.1-issue-4970-recovery.1",
32
+ "@mengine/utils": "3.1.1-issue-4970-recovery.1"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/node": "^25.9.1",