@mengine/medeo-client 1.4.1-alpha.1 → 1.4.1-alpha.3
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/dist/{document-CF-q_mRy.js → document-B1FlNEzF.js} +251 -14
- package/dist/index.d.ts +57 -1
- package/dist/index.js +2 -2
- package/dist/testing.js +1 -1
- package/package.json +4 -4
|
@@ -2230,6 +2230,8 @@ function validateVoicePayload(value, problems) {
|
|
|
2230
2230
|
if (voice.name !== void 0 && typeof voice.name !== "string") problems.push("voice.name must be a string when present");
|
|
2231
2231
|
}
|
|
2232
2232
|
function validateCaptionPayload(value, problems) {
|
|
2233
|
+
validateExternalLocator(value, problems);
|
|
2234
|
+
if (value.segmentRanges !== void 0) validateSegmentRanges(value.segmentRanges, problems);
|
|
2233
2235
|
const selections = value.selections;
|
|
2234
2236
|
if (!Array.isArray(selections)) problems.push("selections must be a non-empty array of AudioScript segment selections");
|
|
2235
2237
|
else {
|
|
@@ -2368,7 +2370,7 @@ function isOwnedLocalEntityValuePath(entityKind, path) {
|
|
|
2368
2370
|
"axvideo"
|
|
2369
2371
|
].includes(entityKind) && /^(?:sampling|coordinateSpace|coordinateSpace\.unit|extent\.kind)$/.test(path)) return true;
|
|
2370
2372
|
if (entityKind === "sequence-marker" && /^(?:durationPolicy|duration\.mode|timeRemapping\.(?:kind|mode))$/.test(path)) return true;
|
|
2371
|
-
if (entityKind === "sequence-marker" && /^segmentRanges\[\d+\]\.segmentId$/.test(path)) return true;
|
|
2373
|
+
if ((entityKind === "sequence-marker" || entityKind === "caption") && /^segmentRanges\[\d+\]\.segmentId$/.test(path)) return true;
|
|
2372
2374
|
if (entityKind === "asset" && /^(?:external\.(?:system|key)|storageKey)$/.test(path)) return true;
|
|
2373
2375
|
if (isMediaAssetVariantKind(entityKind) && /^(?:external\.(?:system|key)|storageKey)$/.test(path)) return true;
|
|
2374
2376
|
if (entityKind === "voice" && /^voice\.(?:system|key|name)$/.test(path)) return true;
|
|
@@ -2388,7 +2390,7 @@ function isOwnedLocalIdPath(entityKind, path) {
|
|
|
2388
2390
|
"phonetic-script"
|
|
2389
2391
|
].includes(entityKind) && /^segments\[\d+\]\.segmentId$/.test(path)) return true;
|
|
2390
2392
|
if (entityKind === "caption" && /^selections\[\d+\]\.segmentId$/.test(path)) return true;
|
|
2391
|
-
if (entityKind === "sequence-marker" && /^segmentRanges\[\d+\]\.segmentId$/.test(path)) return true;
|
|
2393
|
+
if ((entityKind === "sequence-marker" || entityKind === "caption") && /^segmentRanges\[\d+\]\.segmentId$/.test(path)) return true;
|
|
2392
2394
|
if (entityKind === "asset" && /^(?:tracks\[\d+\]\.trackId|renditions\[\d+\]\.renditionId)$/.test(path)) return true;
|
|
2393
2395
|
return false;
|
|
2394
2396
|
}
|
|
@@ -3303,7 +3305,7 @@ function videoSpeed(content, marker, placement) {
|
|
|
3303
3305
|
};
|
|
3304
3306
|
}
|
|
3305
3307
|
//#endregion
|
|
3306
|
-
//#region src/entity-crdt/
|
|
3308
|
+
//#region src/entity-crdt/field-changes.ts
|
|
3307
3309
|
const atomicFields = new Set([
|
|
3308
3310
|
"sequence",
|
|
3309
3311
|
"sourceRange",
|
|
@@ -3312,7 +3314,9 @@ const atomicFields = new Set([
|
|
|
3312
3314
|
"extent",
|
|
3313
3315
|
"timeRemapping",
|
|
3314
3316
|
"textRange",
|
|
3315
|
-
"external"
|
|
3317
|
+
"external",
|
|
3318
|
+
"coordinateSpace",
|
|
3319
|
+
"segmentRanges"
|
|
3316
3320
|
]);
|
|
3317
3321
|
const textFields = new Set(["text", "phonemeScript"]);
|
|
3318
3322
|
const orderedFields = new Set([
|
|
@@ -3320,6 +3324,121 @@ const orderedFields = new Set([
|
|
|
3320
3324
|
"selections",
|
|
3321
3325
|
"baseEntityIds"
|
|
3322
3326
|
]);
|
|
3327
|
+
const unsafeKeys = new Set([
|
|
3328
|
+
"__proto__",
|
|
3329
|
+
"prototype",
|
|
3330
|
+
"constructor"
|
|
3331
|
+
]);
|
|
3332
|
+
function listElementId(value) {
|
|
3333
|
+
const id = typeof value === "string" ? value : isJsonObject(value) ? value.segmentId : void 0;
|
|
3334
|
+
if (typeof id !== "string" || !id.trim()) throw new Error("List elements require a nonempty segmentId or string identity");
|
|
3335
|
+
return id;
|
|
3336
|
+
}
|
|
3337
|
+
function assertFieldChanges(changes) {
|
|
3338
|
+
if (!Array.isArray(changes) || changes.length === 0) throw new Error("changes must be a nonempty array");
|
|
3339
|
+
for (const change of changes) {
|
|
3340
|
+
if (!isJsonObject(change) || ![
|
|
3341
|
+
"set",
|
|
3342
|
+
"unset",
|
|
3343
|
+
"text.splice",
|
|
3344
|
+
"list.insert",
|
|
3345
|
+
"list.move",
|
|
3346
|
+
"list.remove"
|
|
3347
|
+
].includes(change.op)) throw new Error("Unknown field operation");
|
|
3348
|
+
if (!Array.isArray(change.path) || !change.path.length || typeof change.path[0] !== "string") throw new Error("Field paths must start with a field name");
|
|
3349
|
+
for (const part of change.path) if (typeof part === "string") {
|
|
3350
|
+
if (!part || unsafeKeys.has(part)) throw new Error("Invalid field name");
|
|
3351
|
+
} else if (!isJsonObject(part) || Object.keys(part).length !== 1 || typeof part.elementId !== "string" || !part.elementId.trim()) throw new Error("List paths require { elementId }; numeric indices are not supported");
|
|
3352
|
+
}
|
|
3353
|
+
}
|
|
3354
|
+
/** Resolve against the sequential causal view; the numeric path never crosses the API boundary. */
|
|
3355
|
+
function resolveFieldPath(payload, path) {
|
|
3356
|
+
let value = payload;
|
|
3357
|
+
const resolved = [];
|
|
3358
|
+
for (const [index, part] of path.entries()) if (typeof part === "string") {
|
|
3359
|
+
if (!isJsonObject(value)) throw new Error(`Field path does not reach a map: ${part}`);
|
|
3360
|
+
if (index < path.length - 1 && atomicFields.has(part)) throw new Error(`Atomic field ${part} must be changed as one value`);
|
|
3361
|
+
resolved.push(part);
|
|
3362
|
+
value = value[part];
|
|
3363
|
+
} else {
|
|
3364
|
+
if (!Array.isArray(value)) throw new Error("Element selector requires a list");
|
|
3365
|
+
const matches = value.flatMap((item, i) => listElementId(item) === part.elementId ? [i] : []);
|
|
3366
|
+
if (matches.length !== 1) throw new Error(`Missing or ambiguous list element ${part.elementId}`);
|
|
3367
|
+
resolved.push(matches[0]);
|
|
3368
|
+
value = value[matches[0]];
|
|
3369
|
+
}
|
|
3370
|
+
return resolved;
|
|
3371
|
+
}
|
|
3372
|
+
/** Detached plan evaluation. Native compilation replays the original operations, not this snapshot. */
|
|
3373
|
+
function applyFieldChanges(payload, changes) {
|
|
3374
|
+
assertFieldChanges(changes);
|
|
3375
|
+
const result = structuredClone(payload);
|
|
3376
|
+
for (const change of changes) {
|
|
3377
|
+
const path = resolveFieldPath(result, change.path);
|
|
3378
|
+
const key = path.at(-1);
|
|
3379
|
+
if (typeof key !== "string") throw new Error("Change fields inside a list element or use list operations");
|
|
3380
|
+
let parent = result;
|
|
3381
|
+
for (const part of path.slice(0, -1)) parent = parent[part];
|
|
3382
|
+
if (!isJsonObject(parent)) throw new Error("Field parent is not a map");
|
|
3383
|
+
const mutable = parent;
|
|
3384
|
+
const value = mutable[key];
|
|
3385
|
+
if ([
|
|
3386
|
+
"entityId",
|
|
3387
|
+
"entityKind",
|
|
3388
|
+
"entity_id",
|
|
3389
|
+
"entity_kind",
|
|
3390
|
+
"segmentId"
|
|
3391
|
+
].includes(key)) throw new Error(`Identity field ${key} cannot be edited`);
|
|
3392
|
+
switch (change.op) {
|
|
3393
|
+
case "set":
|
|
3394
|
+
if (textFields.has(key) || orderedFields.has(key) || !atomicFields.has(key) && (isJsonObject(value) || isJsonObject(change.value) || Array.isArray(value) || Array.isArray(change.value))) throw new Error(`Field ${key} requires a text, list, or leaf operation; snapshot replacement is not allowed`);
|
|
3395
|
+
if (change.value === void 0 || !isJsonObject({ value: change.value })) throw new Error("set requires a JSON value");
|
|
3396
|
+
if (value !== void 0 && value !== null && change.value !== null && typeof value !== typeof change.value) throw new Error(`Field ${key} cannot change type`);
|
|
3397
|
+
mutable[key] = structuredClone(change.value);
|
|
3398
|
+
break;
|
|
3399
|
+
case "unset":
|
|
3400
|
+
if (!Object.hasOwn(parent, key)) throw new Error(`Field ${key} is absent`);
|
|
3401
|
+
delete mutable[key];
|
|
3402
|
+
break;
|
|
3403
|
+
case "text.splice": {
|
|
3404
|
+
if (!textFields.has(key) || typeof value !== "string") throw new Error(`Field ${key} is not collaborative text`);
|
|
3405
|
+
const chars = Array.from(value);
|
|
3406
|
+
if (!Number.isSafeInteger(change.index) || !Number.isSafeInteger(change.deleteCount) || change.index < 0 || change.deleteCount < 0 || change.index + change.deleteCount > chars.length || typeof change.text !== "string") throw new Error("Invalid text splice range");
|
|
3407
|
+
chars.splice(change.index, change.deleteCount, ...Array.from(change.text));
|
|
3408
|
+
mutable[key] = chars.join("");
|
|
3409
|
+
break;
|
|
3410
|
+
}
|
|
3411
|
+
default: {
|
|
3412
|
+
if (!orderedFields.has(key) || !Array.isArray(value)) throw new Error(`Field ${key} is not a collaborative list`);
|
|
3413
|
+
const ids = value.map(listElementId);
|
|
3414
|
+
if (new Set(ids).size !== ids.length) throw new Error("Duplicate collaborative list identity");
|
|
3415
|
+
const requireIndex = (id) => {
|
|
3416
|
+
const index = ids.indexOf(id);
|
|
3417
|
+
if (index < 0) throw new Error(`Unknown list element ${id}`);
|
|
3418
|
+
return index;
|
|
3419
|
+
};
|
|
3420
|
+
if (change.op === "list.remove") value.splice(requireIndex(change.elementId), 1);
|
|
3421
|
+
else {
|
|
3422
|
+
if (change.beforeElementId !== null && typeof change.beforeElementId !== "string") throw new Error("beforeElementId must be an identity or null");
|
|
3423
|
+
const before = change.beforeElementId === null ? value.length : requireIndex(change.beforeElementId);
|
|
3424
|
+
if (change.op === "list.insert") {
|
|
3425
|
+
const id = listElementId(change.value);
|
|
3426
|
+
if (ids.includes(id)) throw new Error(`Duplicate list element ${id}`);
|
|
3427
|
+
value.splice(before, 0, structuredClone(change.value));
|
|
3428
|
+
} else {
|
|
3429
|
+
if (change.elementId === change.beforeElementId) throw new Error("Cannot move a list element before itself");
|
|
3430
|
+
const from = requireIndex(change.elementId);
|
|
3431
|
+
const [item] = value.splice(from, 1);
|
|
3432
|
+
value.splice(before > from ? before - 1 : before, 0, item);
|
|
3433
|
+
}
|
|
3434
|
+
}
|
|
3435
|
+
}
|
|
3436
|
+
}
|
|
3437
|
+
}
|
|
3438
|
+
return result;
|
|
3439
|
+
}
|
|
3440
|
+
//#endregion
|
|
3441
|
+
//#region src/entity-crdt/json-containers.ts
|
|
3323
3442
|
function equalJson(a, b) {
|
|
3324
3443
|
return canonicalJson(a) === canonicalJson(b);
|
|
3325
3444
|
}
|
|
@@ -3340,24 +3459,19 @@ function writeObject(map, before, after) {
|
|
|
3340
3459
|
else map.set(key, value);
|
|
3341
3460
|
}
|
|
3342
3461
|
}
|
|
3343
|
-
function itemKey(value) {
|
|
3344
|
-
if (typeof value === "string") return value;
|
|
3345
|
-
if (isJsonObject(value) && typeof value.segmentId === "string") return value.segmentId;
|
|
3346
|
-
throw new Error("Collaborative lists require stable segmentId or unique string identities");
|
|
3347
|
-
}
|
|
3348
3462
|
function readItem(list, index) {
|
|
3349
3463
|
const value = list.get(index);
|
|
3350
3464
|
return value instanceof LoroMap ? value.toJSON() : value;
|
|
3351
3465
|
}
|
|
3352
3466
|
function writeList(list, values) {
|
|
3353
|
-
const wanted = values.map(
|
|
3467
|
+
const wanted = values.map(listElementId);
|
|
3354
3468
|
if (new Set(wanted).size !== wanted.length) throw new Error("Duplicate collaborative list identity");
|
|
3355
|
-
for (let index = list.length - 1; index >= 0; index--) if (!wanted.includes(
|
|
3469
|
+
for (let index = list.length - 1; index >= 0; index--) if (!wanted.includes(listElementId(readItem(list, index)))) list.delete(index, 1);
|
|
3356
3470
|
for (let index = 0; index < values.length; index++) {
|
|
3357
3471
|
const value = values[index];
|
|
3358
3472
|
const key = wanted[index];
|
|
3359
3473
|
let found = -1;
|
|
3360
|
-
for (let cursor = index; cursor < list.length; cursor++) if (
|
|
3474
|
+
for (let cursor = index; cursor < list.length; cursor++) if (listElementId(readItem(list, cursor)) === key) {
|
|
3361
3475
|
found = cursor;
|
|
3362
3476
|
break;
|
|
3363
3477
|
}
|
|
@@ -3381,6 +3495,53 @@ function requireText(map, path) {
|
|
|
3381
3495
|
if (!(value instanceof LoroText)) throw new Error("Field is not collaborative text");
|
|
3382
3496
|
return value;
|
|
3383
3497
|
}
|
|
3498
|
+
/** Apply the authored operation directly, preserving text positions and moved item identity. */
|
|
3499
|
+
function applyNativeFieldChange(map, path, change) {
|
|
3500
|
+
let parent = map;
|
|
3501
|
+
for (const part of path.slice(0, -1)) if (parent instanceof LoroMap && typeof part === "string") parent = parent.get(part);
|
|
3502
|
+
else if (parent instanceof LoroMovableList && typeof part === "number") parent = parent.get(part);
|
|
3503
|
+
else throw new Error("Invalid native field path");
|
|
3504
|
+
const key = path.at(-1);
|
|
3505
|
+
if (!(parent instanceof LoroMap) || typeof key !== "string") throw new Error("Invalid native field parent");
|
|
3506
|
+
if (change.op === "set") {
|
|
3507
|
+
parent.set(key, change.value);
|
|
3508
|
+
return;
|
|
3509
|
+
}
|
|
3510
|
+
if (change.op === "unset") {
|
|
3511
|
+
parent.delete(key);
|
|
3512
|
+
return;
|
|
3513
|
+
}
|
|
3514
|
+
const value = parent.get(key);
|
|
3515
|
+
if (change.op === "text.splice") {
|
|
3516
|
+
if (!(value instanceof LoroText)) throw new Error("Field is not collaborative text");
|
|
3517
|
+
const start = value.convertPos(change.index, "unicode", "utf16");
|
|
3518
|
+
const end = value.convertPos(change.index + change.deleteCount, "unicode", "utf16");
|
|
3519
|
+
value.splice(start, end - start, change.text);
|
|
3520
|
+
return;
|
|
3521
|
+
}
|
|
3522
|
+
if (!(value instanceof LoroMovableList)) throw new Error("Field is not a collaborative list");
|
|
3523
|
+
applyNativeListChange(value, change);
|
|
3524
|
+
}
|
|
3525
|
+
function applyNativeListChange(list, change) {
|
|
3526
|
+
const ids = Array.from({ length: list.length }, (_, i) => listElementId(readItem(list, i)));
|
|
3527
|
+
const index = (id) => {
|
|
3528
|
+
const found = ids.indexOf(id);
|
|
3529
|
+
if (found < 0) throw new Error(`Unknown list element ${id}`);
|
|
3530
|
+
return found;
|
|
3531
|
+
};
|
|
3532
|
+
if (change.op === "list.remove") {
|
|
3533
|
+
list.delete(index(change.elementId), 1);
|
|
3534
|
+
return;
|
|
3535
|
+
}
|
|
3536
|
+
const before = change.beforeElementId === null ? list.length : index(change.beforeElementId);
|
|
3537
|
+
if (change.op === "list.insert") if (isJsonObject(change.value)) writeObject(list.insertContainer(before, new LoroMap()), {}, change.value);
|
|
3538
|
+
else list.insert(before, change.value);
|
|
3539
|
+
else {
|
|
3540
|
+
const from = index(change.elementId);
|
|
3541
|
+
const to = before > from ? before - 1 : before;
|
|
3542
|
+
if (from !== to) list.move(from, to);
|
|
3543
|
+
}
|
|
3544
|
+
}
|
|
3384
3545
|
//#endregion
|
|
3385
3546
|
//#region src/entity-crdt/ordering.ts
|
|
3386
3547
|
/** Domain order is scoped by membership; relation storage has no global order. */
|
|
@@ -3707,8 +3868,10 @@ var LoroEntityDraft = class {
|
|
|
3707
3868
|
doc;
|
|
3708
3869
|
commands = [];
|
|
3709
3870
|
selectedRoots = /* @__PURE__ */ new Set();
|
|
3871
|
+
relationAliases = /* @__PURE__ */ new Map();
|
|
3710
3872
|
constructor(doc) {
|
|
3711
3873
|
this.doc = doc;
|
|
3874
|
+
for (const row of this.snapshot().rows.relations) this.relationAliases.set(row.relationId, this.relationRoot(row.relationId));
|
|
3712
3875
|
}
|
|
3713
3876
|
snapshot() {
|
|
3714
3877
|
return readEntityDocument(this.doc, true);
|
|
@@ -3721,6 +3884,15 @@ var LoroEntityDraft = class {
|
|
|
3721
3884
|
token: globalThis.crypto.randomUUID()
|
|
3722
3885
|
});
|
|
3723
3886
|
}
|
|
3887
|
+
/** Project the final scalar placement intents onto the existing native ordering containers. */
|
|
3888
|
+
reconcileOrder(rows) {
|
|
3889
|
+
const before = new Map([...entityOrderGroups(this.snapshot().rows)].map(([id, ids]) => [family(this.doc, id), ids.map((id) => family(this.doc, id))]));
|
|
3890
|
+
const after = new Map([...entityOrderGroups(rows)].map(([id, ids]) => [family(this.doc, id), ids.map((id) => family(this.doc, id))]));
|
|
3891
|
+
for (const group of new Set([...before.keys(), ...after.keys()])) {
|
|
3892
|
+
const next = after.get(group) ?? [];
|
|
3893
|
+
if (!equalJson(before.get(group) ?? [], next)) this.order(group, next);
|
|
3894
|
+
}
|
|
3895
|
+
}
|
|
3724
3896
|
create(row) {
|
|
3725
3897
|
this.record({
|
|
3726
3898
|
type: "create",
|
|
@@ -3761,6 +3933,8 @@ var LoroEntityDraft = class {
|
|
|
3761
3933
|
});
|
|
3762
3934
|
}
|
|
3763
3935
|
relationRoot(relationId) {
|
|
3936
|
+
const alias = this.relationAliases.get(relationId);
|
|
3937
|
+
if (alias !== void 0) return alias;
|
|
3764
3938
|
const ids = currentIds(this.doc);
|
|
3765
3939
|
for (const key of section(this.doc, "relations").keys()) {
|
|
3766
3940
|
const map = section(this.doc, "relations").get(key);
|
|
@@ -3768,7 +3942,7 @@ var LoroEntityDraft = class {
|
|
|
3768
3942
|
const identity = map.get("identity");
|
|
3769
3943
|
if (identity.endpoints.some((id) => !ids.has(family(this.doc, id)))) continue;
|
|
3770
3944
|
const endpoints = identity.endpoints.map((id) => currentId(this.doc, id, ids));
|
|
3771
|
-
if ((equalJson(endpoints, identity.endpoints) ? key : `relation_${hash([key, endpoints])}`) === relationId) return key;
|
|
3945
|
+
if ((equalJson(endpoints, identity.endpoints) ? key : `relation_${hash([key, endpoints])}`) === relationId || key === relationId) return key;
|
|
3772
3946
|
}
|
|
3773
3947
|
throw new Error(`Unknown relation ${relationId}`);
|
|
3774
3948
|
}
|
|
@@ -3815,6 +3989,50 @@ var LoroEntityDraft = class {
|
|
|
3815
3989
|
token: globalThis.crypto.randomUUID()
|
|
3816
3990
|
});
|
|
3817
3991
|
}
|
|
3992
|
+
/** Generic assembled-field edit compiled at the author's causal position. */
|
|
3993
|
+
change(entityId, changes) {
|
|
3994
|
+
assertFieldChanges(changes);
|
|
3995
|
+
for (const raw of changes) {
|
|
3996
|
+
const change = clone(raw);
|
|
3997
|
+
if (change.path[0] === "baseEntityIds") {
|
|
3998
|
+
if (change.op === "list.insert" && typeof change.value === "string") change.value = currentId(this.doc, change.value);
|
|
3999
|
+
if (change.op === "list.remove" || change.op === "list.move") change.elementId = currentId(this.doc, change.elementId);
|
|
4000
|
+
if ((change.op === "list.insert" || change.op === "list.move") && change.beforeElementId !== null) change.beforeElementId = currentId(this.doc, change.beforeElementId);
|
|
4001
|
+
}
|
|
4002
|
+
const state = this.snapshot();
|
|
4003
|
+
const id = createEntityId(currentId(this.doc, entityId));
|
|
4004
|
+
const owner = resolveEntityFieldOwner(state.rows, id, change.path[0]);
|
|
4005
|
+
const row = state.rows.entities.find((row) => row.entityId === owner);
|
|
4006
|
+
if (equalJson(row.payload, applyFieldChanges(row.payload, [change]))) continue;
|
|
4007
|
+
this.record({
|
|
4008
|
+
type: "field",
|
|
4009
|
+
root: family(this.doc, owner),
|
|
4010
|
+
path: resolveFieldPath(row.payload, change.path),
|
|
4011
|
+
change: clone(change),
|
|
4012
|
+
token: globalThis.crypto.randomUUID()
|
|
4013
|
+
});
|
|
4014
|
+
}
|
|
4015
|
+
}
|
|
4016
|
+
changeRelation(relationId, changes) {
|
|
4017
|
+
assertFieldChanges(changes);
|
|
4018
|
+
const key = this.relationRoot(relationId);
|
|
4019
|
+
const map = section(this.doc, "relations").get(key);
|
|
4020
|
+
if (!(map instanceof LoroMap) || map.get("deleted") === true) throw new Error("Unknown relation");
|
|
4021
|
+
for (const change of changes) {
|
|
4022
|
+
if (!["metadata", "trace"].includes(change.path[0]) || change.path.length < 2) throw new Error("Relation changes may only edit metadata or trace fields");
|
|
4023
|
+
const payload = {
|
|
4024
|
+
metadata: requireMap(map, "metadata").toJSON(),
|
|
4025
|
+
trace: requireMap(map, "trace").toJSON()
|
|
4026
|
+
};
|
|
4027
|
+
applyFieldChanges(payload, [change]);
|
|
4028
|
+
this.record({
|
|
4029
|
+
type: "relation-field",
|
|
4030
|
+
root: key,
|
|
4031
|
+
path: resolveFieldPath(payload, change.path),
|
|
4032
|
+
change: clone(change)
|
|
4033
|
+
});
|
|
4034
|
+
}
|
|
4035
|
+
}
|
|
3818
4036
|
captureSelectionBaselines() {
|
|
3819
4037
|
const state = this.snapshot();
|
|
3820
4038
|
for (const key of this.selectedRoots) {
|
|
@@ -3831,6 +4049,7 @@ var LoroEntityDraft = class {
|
|
|
3831
4049
|
record(command) {
|
|
3832
4050
|
if (command.type === "create") this.selectedRoots.add(command.row.entityId);
|
|
3833
4051
|
if (command.type === "write" && !equalJson(content(workspace(this.doc, command.root)).selections, command.payload.selections)) this.selectedRoots.add(command.root);
|
|
4052
|
+
if (command.type === "field" && command.path[0] === "selections") this.selectedRoots.add(command.root);
|
|
3834
4053
|
apply(this.doc, command);
|
|
3835
4054
|
this.commands.push(command);
|
|
3836
4055
|
}
|
|
@@ -3875,6 +4094,24 @@ function apply(doc, command) {
|
|
|
3875
4094
|
map.ensureMergeableMap("changes").set(command.token, true);
|
|
3876
4095
|
break;
|
|
3877
4096
|
}
|
|
4097
|
+
case "field": {
|
|
4098
|
+
const map = workspace(doc, command.root);
|
|
4099
|
+
if (command.path[0] === "baseEntityIds") {
|
|
4100
|
+
const before = { baseEntityIds: bases(map).map((id) => currentId(doc, id)) };
|
|
4101
|
+
if (command.change.op === "list.move") throw new Error("Composition bases are unordered; list.move is not applicable");
|
|
4102
|
+
writeBases(doc, map, baseIds(applyFieldChanges(before, [command.change])));
|
|
4103
|
+
} else {
|
|
4104
|
+
applyNativeFieldChange(requireMap(map, "content"), command.path, command.change);
|
|
4105
|
+
map.ensureMergeableMap("changes").set(command.token, true);
|
|
4106
|
+
}
|
|
4107
|
+
break;
|
|
4108
|
+
}
|
|
4109
|
+
case "relation-field": {
|
|
4110
|
+
const map = section(doc, "relations").get(command.root);
|
|
4111
|
+
if (!(map instanceof LoroMap) || map.get("deleted") === true) throw new Error("Unknown relation");
|
|
4112
|
+
applyNativeFieldChange(map, command.path, command.change);
|
|
4113
|
+
break;
|
|
4114
|
+
}
|
|
3878
4115
|
case "delete":
|
|
3879
4116
|
workspace(doc, command.root).set("deleted", true);
|
|
3880
4117
|
break;
|
|
@@ -4282,4 +4519,4 @@ function createPlainMemoryAdapter(document, options) {
|
|
|
4282
4519
|
return new PlainMemoryAdapter(document, options);
|
|
4283
4520
|
}
|
|
4284
4521
|
//#endregion
|
|
4285
|
-
export {
|
|
4522
|
+
export { cascadeAfterVideoClipChanges as $, selectAudioScriptSegments as A, derivePositionFromAbs as B, decodeEntityRelationRows as C, assemblePhoneticScriptContent as D, assembleEntityContent as E, createRelationId as F, validateVideoDocument as G, toVideoDocument as H, hasSequence as I, LANE_KINDS_IN_STACK_ORDER as J, partUnionSchema as K, isMediaAssetVariantKind as L, variantBaseEntityIds as M, isJsonObject as N, assembleScriptText as O, createEntityId as P, solveVideoDocument as Q, buildInitialVideoDocument as R, EntityTimelineProjectionError as S, assembleCaptionContent as T, VideoDocumentValidationError as U, fromVideoDocument as V, assertValidVideoDocument as W, findLaneTrack as X, ensureLaneTrack as Y, laneTrackId as Z, assertFieldChanges as _, recordEntries as _t, applyEntityTimelineProjection as a, resolveSpeechOverlapByShiftingVideos as at, EntityProjectionGraph as b, bytesToBase64 as bt, writeVideoDocumentToDraft as c, isEmptyVideoClip as ct, LoroEntityDocument as d, DEFAULT_UNIT_TIME_MS as dt, arrangeMainTrackSeamlessly as et, LoroEntityDraft as f, ENTITY_TIMELINE_PROJECTION_SCHEMA_VERSION as ft, applyFieldChanges as g, partUnionToDraft as gt, equalJson as h, speedOf as ht, MirrorVideoDocumentAdapter as i, resolveAllSpeechOverlaps as it, updateEntityFields as j, findComposedAudioScript as k, readVideoDocumentFromDraft as l, partDurationMs as lt, entityOrderGroups as m, effectiveVideoClipDurationMs as mt, createPlainMemoryAdapter as n, reassignSpeechesToVideoClipsByTime as nt, createMirrorVideoDocument as o, syncAggregatedClipsTimePosition as ot, readEntityDocument as p, VIDEO_DOCUMENT_SCHEMA_VERSION as pt, videoDocumentSchema as q, generatePartId as r, recalculateTimelineDuration as rt, createMirrorVideoDocumentAdapter as s, TIMELINE_SKELETON_DURATION_MS as st, PlainMemoryAdapter as t, fillMainTrackTimeGaps as tt, LORO_ENTITY_SCHEMA as u, safeDurationMs as ut, resolveFieldPath as v, videoDocumentMirrorSchema as vt, ScriptCompositionError as w, resolveEntityTimelineLayout as x, projectEntityTimeline as y, base64ToBytes as yt, buildSpeechHostMap as z };
|
package/dist/index.d.ts
CHANGED
|
@@ -676,6 +676,45 @@ interface DocumentAudioScriptState {
|
|
|
676
676
|
/** Read only the attached version and preserve every segment; never aggregate other scripts. */
|
|
677
677
|
declare function readDocumentAudioScript(state: DocumentAudioScriptState): DocumentAudioScript;
|
|
678
678
|
//#endregion
|
|
679
|
+
//#region src/entity-crdt/field-changes.d.ts
|
|
680
|
+
/** List members are addressed by identity, never a transient array offset. */
|
|
681
|
+
type FieldPath = readonly (string | {
|
|
682
|
+
elementId: string;
|
|
683
|
+
})[];
|
|
684
|
+
type FieldChange = {
|
|
685
|
+
op: 'set';
|
|
686
|
+
path: FieldPath;
|
|
687
|
+
value: JsonValue;
|
|
688
|
+
} | {
|
|
689
|
+
op: 'unset';
|
|
690
|
+
path: FieldPath;
|
|
691
|
+
} | {
|
|
692
|
+
op: 'text.splice';
|
|
693
|
+
path: FieldPath;
|
|
694
|
+
index: number;
|
|
695
|
+
deleteCount: number;
|
|
696
|
+
text: string;
|
|
697
|
+
} | {
|
|
698
|
+
op: 'list.insert';
|
|
699
|
+
path: FieldPath;
|
|
700
|
+
value: JsonValue;
|
|
701
|
+
beforeElementId: string | null;
|
|
702
|
+
} | {
|
|
703
|
+
op: 'list.move';
|
|
704
|
+
path: FieldPath;
|
|
705
|
+
elementId: string;
|
|
706
|
+
beforeElementId: string | null;
|
|
707
|
+
} | {
|
|
708
|
+
op: 'list.remove';
|
|
709
|
+
path: FieldPath;
|
|
710
|
+
elementId: string;
|
|
711
|
+
};
|
|
712
|
+
declare function assertFieldChanges(changes: readonly FieldChange[]): void;
|
|
713
|
+
/** Resolve against the sequential causal view; the numeric path never crosses the API boundary. */
|
|
714
|
+
declare function resolveFieldPath(payload: JsonObject, path: FieldPath): (string | number)[];
|
|
715
|
+
/** Detached plan evaluation. Native compilation replays the original operations, not this snapshot. */
|
|
716
|
+
declare function applyFieldChanges(payload: JsonObject, changes: readonly FieldChange[]): JsonObject;
|
|
717
|
+
//#endregion
|
|
679
718
|
//#region src/entity-crdt/entity-document.d.ts
|
|
680
719
|
declare const LORO_ENTITY_SCHEMA = "medeo.entities.loro.v1";
|
|
681
720
|
interface EntityDocumentState {
|
|
@@ -707,6 +746,17 @@ type Command = {
|
|
|
707
746
|
deleteCount: number;
|
|
708
747
|
text: string;
|
|
709
748
|
token: string;
|
|
749
|
+
} | {
|
|
750
|
+
type: 'field';
|
|
751
|
+
root: string;
|
|
752
|
+
path: (string | number)[];
|
|
753
|
+
change: FieldChange;
|
|
754
|
+
token: string;
|
|
755
|
+
} | {
|
|
756
|
+
type: 'relation-field';
|
|
757
|
+
root: string;
|
|
758
|
+
path: (string | number)[];
|
|
759
|
+
change: FieldChange;
|
|
710
760
|
} | {
|
|
711
761
|
type: 'delete';
|
|
712
762
|
root: string;
|
|
@@ -754,9 +804,12 @@ declare class LoroEntityDraft {
|
|
|
754
804
|
private readonly doc;
|
|
755
805
|
readonly commands: Command[];
|
|
756
806
|
private readonly selectedRoots;
|
|
807
|
+
private readonly relationAliases;
|
|
757
808
|
constructor(doc: LoroDoc);
|
|
758
809
|
snapshot(): EntityDocumentState;
|
|
759
810
|
order(groupId: string, entityIds: readonly string[]): void;
|
|
811
|
+
/** Project the final scalar placement intents onto the existing native ordering containers. */
|
|
812
|
+
reconcileOrder(rows: EntityRelationRows): void;
|
|
760
813
|
create(row: EntityRow): void;
|
|
761
814
|
delete(entityId: string): void;
|
|
762
815
|
attach(slot: string, entityId: string): void;
|
|
@@ -768,6 +821,9 @@ declare class LoroEntityDraft {
|
|
|
768
821
|
declare(entityId: string, fields: JsonObject): void;
|
|
769
822
|
replaceOwned(entityId: string, payload: JsonObject): void;
|
|
770
823
|
editText(entityId: string, path: readonly (string | number)[], start: number, deleteCount: number, text: string): void;
|
|
824
|
+
/** Generic assembled-field edit compiled at the author's causal position. */
|
|
825
|
+
change(entityId: string, changes: readonly FieldChange[]): void;
|
|
826
|
+
changeRelation(relationId: string, changes: readonly FieldChange[]): void;
|
|
771
827
|
captureSelectionBaselines(): void;
|
|
772
828
|
private record;
|
|
773
829
|
}
|
|
@@ -1688,4 +1744,4 @@ declare function hostForAbsMs(ranges: MainClipRange[], absMs: number): MainClipR
|
|
|
1688
1744
|
*/
|
|
1689
1745
|
declare function relativePositionForAbs(ranges: MainClipRange[], absMs: number): TrackItemTimePosition;
|
|
1690
1746
|
//#endregion
|
|
1691
|
-
export { type Aggregation, type AssembledCaptionContent, type AssembledPhoneticScriptContent, type Attachment, type AudioMediaAssetFact, type BgmPart, type CaptionContentInput, type CaptionPart, type CaptionSegmentSelection, type CaptionStyle, type ClipEntityId, type ClipPlacement, type CommitOptions, DEFAULT_UNIT_TIME_MS, type DeleteBgmInput, type DeleteClipInput, type DeleteClipTreeInput, type DeleteVoiceoverInput, type DerivedItemPosition, type DocStorageLike, type DocVersionMark, type DocumentAudioScript, type DocumentAudioScriptState, ENTITY_TIMELINE_PROJECTION_SCHEMA_VERSION, type EditorFoundation, EntityDocumentState, type EntityGraphCommitOptions, EntityGraphHttpClient, type EntityGraphState, EntityTimelineEditor, type EntityTimelineIdFactory, EntityTimelineProjectionError, type EntityTimelineTrackRole, IMPLEMENTED_SEMANTIC_OP_KINDS, type ImageMediaAssetFact, type ImplementedSemanticOpKind, type ImportedMediaAsset, type InitialDocumentFacts, type InsertCaptionClipInput, type InsertClipInput, type InsertMediaClipInput, type InsertMediaClipsInput, type InsertPlacedClipInput, type JournalEntry, LANE_KINDS_IN_STACK_ORDER, LORO_ENTITY_SCHEMA, type LaneKind, type LinearClipSpeed, LoroEntityDocument, LoroEntityDraft, type MainClipRange, type MakeEmptyPart, ManualSyncDoc, type ManualSyncDocOptions, MedeoHttpDocStorage, type MedeoHttpDocStorageOptions, type MediaAssetFact, type MediaClipInsertion, MemoryDocStorage, MengineAckFailedError, type MengineAuditEntry, type MengineAuditResponse, MengineDocSession, type MengineDocSessionOptions, type MengineDocSessionUpdateEvent, type MengineDocumentVersion, type MengineEventStreamOptions, MengineHttpClient, type MengineHttpClientOptions, MengineHttpRequestError, MenginePushRejectedError, type MenginePushResponse, type MenginePushUpdateResponse, type MengineRejectedResponse, type MengineSnapshotResponse, type MengineSseUpdateEvent, type MengineSyncResponse, type MengineUpdateMeta, MirrorVideoDocumentAdapter, type MirrorVideoDocumentOptions, type MoveClipInput, type MoveClipsToStartsInput, type MoveSequentialClipsInput, type MoveVoiceoverInput, type OpActor, type PartAggregation, type PartIdFactory, type PartKind, type PartUnion, type PatchCaptionStyleInput, PlainMemoryAdapter, type PlainMemoryAdapterOptions, type PlannedSemanticOpKind, type PullFailureReason, type PullResult, type PushOutcome, type PushOutcomeKind, type PushResult, type PushResultKind, type ReplaceClipContentInput, type ReplaceMediaClipInput, type ReplaceSequentialClipsInput, type ReplacementMediaClipInput, type ResolvedEntityClipPlacement, type ResolvedEntityTimelineLayout, type ResolvedEntityTrack, SchemaValidator, ScriptCompositionError, type SemanticDocumentAdapter, SemanticEditor, type SemanticOpInput, type SemanticOpKind, type SemanticOpName, type SequentialClipAnchor, type SetBgmInput, type SetCaptionVisibilityInput, type SetClipPlacementInput, type SetClipSpeedInput, type SetClipVolumeInput, type SnapshotReadable, type SolvedVideoDocument, type SpeechHostMap, type SpeechPart, type SpeedShift, TIMELINE_SKELETON_DURATION_MS, type Timeline, type TimelineDoc, type TimelineItem, type Track, type TrackDraft, type TrackItem, type TrackItemDraft, type TrackItemTimePosition, type TransactAudit, type TrimClipInput, type UpdateClipInput, type UpdateClipMarkerInput, VIDEO_DOCUMENT_SCHEMA_VERSION, ValidationError, type VideoClipPart, type VideoDocument, type VideoDocumentDraft, type VideoDocumentMirrorSchema, type VideoDocumentSchemaVersion, VideoDocumentValidationError, type VideoDocumentValidationIssue, type VideoDocumentValidationIssueCode, type VideoDraft, type CaptionPart$1 as VideoDraftCaptionPart, type VideoDraftPartUnion, type Timeline$1 as VideoDraftTimeline, type Track$1 as VideoDraftTrack, type TrackItem$1 as VideoDraftTrackItem, type VideoMediaAssetFact, type VisualMediaAssetFact, type VoiceMediaAssetFact, type VoiceoverCaptionFact, type VoiceoverTakeInput, type VoiceoverTakeResult, type WaitForServerAckOptions, applyEntityRows, applyEntityTimelineProjection, arrangeMainTrackSeamlessly, assembleCaptionContent, assembleEntityContent, assemblePhoneticScriptContent, assembleScriptText, assertCanonicalEditorResources, assertEntityProjectionPreservesLegacy, assertMediaAssetWritePolicy, assertValidVideoDocument, base64ToBytes, buildInitialVideoDocument, buildSpeechHostMap, bytesToBase64, cascadeAfterVideoClipChanges, compileEntityRows, createEditSandbox, createMirrorVideoDocument, createMirrorVideoDocumentAdapter, createPlainMemoryAdapter, decodeDocVersionMark, derivePositionFromAbs, effectiveVideoClipDurationMs, encodeDocVersionMark, ensureEditorFoundation, ensureLaneTrack, fillMainTrackTimeGaps, findComposedAudioScript, findLaneTrack, fromVideoDocument, generatePartId, getAt, hostForAbsMs, importMediaAsset, isEmptyVideoClip, isImplementedSemanticOpKind, isMap, laneTrackId, mainTrackRanges, migrateLegacyTimelineToEntities, partDurationMs, partUnionSchema, prepareCaptionContent, projectEntityTimeline, readDocumentAudioScript, readEntityDocument, readMainTrackItems, readMengineEventStream, readPart, readPartDurationMs, readVideoDocumentFromDraft, reassignSpeechesToVideoClipsByTime, recalculateTimelineDuration, relativePositionForAbs, replayJournal, resolveAllSpeechOverlaps, resolveEntityTimelineLayout, resolveSpeechOverlapByShiftingVideos, safeDurationMs, index_d_exports as schemas, selectAudioScriptSegments, snapshotToPlain, solveVideoDocument, speedOf, syncAggregatedClipsTimePosition, toVideoDocument, validateVideoDocument, videoDocumentMirrorSchema, videoDocumentSchema, writeVideoDocumentToDraft };
|
|
1747
|
+
export { type Aggregation, type AssembledCaptionContent, type AssembledPhoneticScriptContent, type Attachment, type AudioMediaAssetFact, type BgmPart, type CaptionContentInput, type CaptionPart, type CaptionSegmentSelection, type CaptionStyle, type ClipEntityId, type ClipPlacement, type CommitOptions, DEFAULT_UNIT_TIME_MS, type DeleteBgmInput, type DeleteClipInput, type DeleteClipTreeInput, type DeleteVoiceoverInput, type DerivedItemPosition, type DocStorageLike, type DocVersionMark, type DocumentAudioScript, type DocumentAudioScriptState, ENTITY_TIMELINE_PROJECTION_SCHEMA_VERSION, type EditorFoundation, EntityDocumentState, type EntityGraphCommitOptions, EntityGraphHttpClient, type EntityGraphState, EntityTimelineEditor, type EntityTimelineIdFactory, EntityTimelineProjectionError, type EntityTimelineTrackRole, type FieldChange, type FieldPath, IMPLEMENTED_SEMANTIC_OP_KINDS, type ImageMediaAssetFact, type ImplementedSemanticOpKind, type ImportedMediaAsset, type InitialDocumentFacts, type InsertCaptionClipInput, type InsertClipInput, type InsertMediaClipInput, type InsertMediaClipsInput, type InsertPlacedClipInput, type JournalEntry, LANE_KINDS_IN_STACK_ORDER, LORO_ENTITY_SCHEMA, type LaneKind, type LinearClipSpeed, LoroEntityDocument, LoroEntityDraft, type MainClipRange, type MakeEmptyPart, ManualSyncDoc, type ManualSyncDocOptions, MedeoHttpDocStorage, type MedeoHttpDocStorageOptions, type MediaAssetFact, type MediaClipInsertion, MemoryDocStorage, MengineAckFailedError, type MengineAuditEntry, type MengineAuditResponse, MengineDocSession, type MengineDocSessionOptions, type MengineDocSessionUpdateEvent, type MengineDocumentVersion, type MengineEventStreamOptions, MengineHttpClient, type MengineHttpClientOptions, MengineHttpRequestError, MenginePushRejectedError, type MenginePushResponse, type MenginePushUpdateResponse, type MengineRejectedResponse, type MengineSnapshotResponse, type MengineSseUpdateEvent, type MengineSyncResponse, type MengineUpdateMeta, MirrorVideoDocumentAdapter, type MirrorVideoDocumentOptions, type MoveClipInput, type MoveClipsToStartsInput, type MoveSequentialClipsInput, type MoveVoiceoverInput, type OpActor, type PartAggregation, type PartIdFactory, type PartKind, type PartUnion, type PatchCaptionStyleInput, PlainMemoryAdapter, type PlainMemoryAdapterOptions, type PlannedSemanticOpKind, type PullFailureReason, type PullResult, type PushOutcome, type PushOutcomeKind, type PushResult, type PushResultKind, type ReplaceClipContentInput, type ReplaceMediaClipInput, type ReplaceSequentialClipsInput, type ReplacementMediaClipInput, type ResolvedEntityClipPlacement, type ResolvedEntityTimelineLayout, type ResolvedEntityTrack, SchemaValidator, ScriptCompositionError, type SemanticDocumentAdapter, SemanticEditor, type SemanticOpInput, type SemanticOpKind, type SemanticOpName, type SequentialClipAnchor, type SetBgmInput, type SetCaptionVisibilityInput, type SetClipPlacementInput, type SetClipSpeedInput, type SetClipVolumeInput, type SnapshotReadable, type SolvedVideoDocument, type SpeechHostMap, type SpeechPart, type SpeedShift, TIMELINE_SKELETON_DURATION_MS, type Timeline, type TimelineDoc, type TimelineItem, type Track, type TrackDraft, type TrackItem, type TrackItemDraft, type TrackItemTimePosition, type TransactAudit, type TrimClipInput, type UpdateClipInput, type UpdateClipMarkerInput, VIDEO_DOCUMENT_SCHEMA_VERSION, ValidationError, type VideoClipPart, type VideoDocument, type VideoDocumentDraft, type VideoDocumentMirrorSchema, type VideoDocumentSchemaVersion, VideoDocumentValidationError, type VideoDocumentValidationIssue, type VideoDocumentValidationIssueCode, type VideoDraft, type CaptionPart$1 as VideoDraftCaptionPart, type VideoDraftPartUnion, type Timeline$1 as VideoDraftTimeline, type Track$1 as VideoDraftTrack, type TrackItem$1 as VideoDraftTrackItem, type VideoMediaAssetFact, type VisualMediaAssetFact, type VoiceMediaAssetFact, type VoiceoverCaptionFact, type VoiceoverTakeInput, type VoiceoverTakeResult, type WaitForServerAckOptions, applyEntityRows, applyEntityTimelineProjection, applyFieldChanges, arrangeMainTrackSeamlessly, assembleCaptionContent, assembleEntityContent, assemblePhoneticScriptContent, assembleScriptText, assertCanonicalEditorResources, assertEntityProjectionPreservesLegacy, assertFieldChanges, assertMediaAssetWritePolicy, assertValidVideoDocument, base64ToBytes, buildInitialVideoDocument, buildSpeechHostMap, bytesToBase64, cascadeAfterVideoClipChanges, compileEntityRows, createEditSandbox, createMirrorVideoDocument, createMirrorVideoDocumentAdapter, createPlainMemoryAdapter, decodeDocVersionMark, derivePositionFromAbs, effectiveVideoClipDurationMs, encodeDocVersionMark, ensureEditorFoundation, ensureLaneTrack, fillMainTrackTimeGaps, findComposedAudioScript, findLaneTrack, fromVideoDocument, generatePartId, getAt, hostForAbsMs, importMediaAsset, isEmptyVideoClip, isImplementedSemanticOpKind, isMap, laneTrackId, mainTrackRanges, migrateLegacyTimelineToEntities, partDurationMs, partUnionSchema, prepareCaptionContent, projectEntityTimeline, readDocumentAudioScript, readEntityDocument, readMainTrackItems, readMengineEventStream, readPart, readPartDurationMs, readVideoDocumentFromDraft, reassignSpeechesToVideoClipsByTime, recalculateTimelineDuration, relativePositionForAbs, replayJournal, resolveAllSpeechOverlaps, resolveEntityTimelineLayout, resolveFieldPath, resolveSpeechOverlapByShiftingVideos, safeDurationMs, index_d_exports as schemas, selectAudioScriptSegments, snapshotToPlain, solveVideoDocument, speedOf, syncAggregatedClipsTimePosition, toVideoDocument, validateVideoDocument, videoDocumentMirrorSchema, videoDocumentSchema, writeVideoDocumentToDraft };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as cascadeAfterVideoClipChanges, A as selectAudioScriptSegments, B as derivePositionFromAbs, C as decodeEntityRelationRows, D as assemblePhoneticScriptContent, E as assembleEntityContent, F as createRelationId, G as validateVideoDocument, H as toVideoDocument, I as hasSequence, J as LANE_KINDS_IN_STACK_ORDER, K as partUnionSchema, L as isMediaAssetVariantKind, M as variantBaseEntityIds, N as isJsonObject, O as assembleScriptText, P as createEntityId, Q as solveVideoDocument, R as buildInitialVideoDocument, S as EntityTimelineProjectionError, T as assembleCaptionContent, U as VideoDocumentValidationError, V as fromVideoDocument, W as assertValidVideoDocument, X as findLaneTrack, Y as ensureLaneTrack, Z as laneTrackId, _ as assertFieldChanges, _t as recordEntries, a as applyEntityTimelineProjection, at as resolveSpeechOverlapByShiftingVideos, b as EntityProjectionGraph, bt as bytesToBase64, c as writeVideoDocumentToDraft, ct as isEmptyVideoClip, d as LoroEntityDocument, dt as DEFAULT_UNIT_TIME_MS, et as arrangeMainTrackSeamlessly, f as LoroEntityDraft, ft as ENTITY_TIMELINE_PROJECTION_SCHEMA_VERSION, g as applyFieldChanges, gt as partUnionToDraft, h as equalJson, ht as speedOf, i as MirrorVideoDocumentAdapter, it as resolveAllSpeechOverlaps, j as updateEntityFields, k as findComposedAudioScript, l as readVideoDocumentFromDraft, lt as partDurationMs, m as entityOrderGroups, mt as effectiveVideoClipDurationMs, n as createPlainMemoryAdapter, nt as reassignSpeechesToVideoClipsByTime, o as createMirrorVideoDocument, ot as syncAggregatedClipsTimePosition, p as readEntityDocument, pt as VIDEO_DOCUMENT_SCHEMA_VERSION, q as videoDocumentSchema, r as generatePartId, rt as recalculateTimelineDuration, s as createMirrorVideoDocumentAdapter, st as TIMELINE_SKELETON_DURATION_MS, t as PlainMemoryAdapter, tt as fillMainTrackTimeGaps, u as LORO_ENTITY_SCHEMA, ut as safeDurationMs, v as resolveFieldPath, vt as videoDocumentMirrorSchema, w as ScriptCompositionError, x as resolveEntityTimelineLayout, y as projectEntityTimeline, yt as base64ToBytes, z as buildSpeechHostMap } from "./document-B1FlNEzF.js";
|
|
2
2
|
import { addSpeechesInputSchema, addVideoClipsInputSchema, adjustBgmVolumeInputSchema, adjustSpeechVolumeInputSchema, adjustVideoClipDurationInputSchema, adjustVideoClipVolumeInputSchema, changeSpeechScriptInputSchema, changeSpeechVoiceInputSchema, deleteBgmInputSchema, deleteSpeechesInputSchema, deleteVideoClipsInputSchema, moveSpeechesInputSchema, moveVideoClipsByAnchorInputSchema, moveVideoClipsInputSchema, replaceVideoClipContentInputSchema, replaceVideoClipSequenceInputSchema, setBgmInputSchema, setCaptionStyleInputSchema, setCaptionVisibilityInputSchema, setVideoClipSpeedShiftInputSchema, t as schemas_exports } from "./schemas.js";
|
|
3
3
|
import { LoroDoc, VersionVector } from "loro-crdt";
|
|
4
4
|
import { ClientServerSynchronizer, DocManager } from "@mengine/sync";
|
|
@@ -4848,4 +4848,4 @@ function serverCovers(serverVV, target) {
|
|
|
4848
4848
|
return covers(server, target);
|
|
4849
4849
|
}
|
|
4850
4850
|
//#endregion
|
|
4851
|
-
export { DEFAULT_UNIT_TIME_MS, ENTITY_TIMELINE_PROJECTION_SCHEMA_VERSION, EntityGraphHttpClient, EntityTimelineEditor, EntityTimelineProjectionError, IMPLEMENTED_SEMANTIC_OP_KINDS, LANE_KINDS_IN_STACK_ORDER, LORO_ENTITY_SCHEMA, LoroEntityDocument, LoroEntityDraft, ManualSyncDoc, MedeoHttpDocStorage, MemoryDocStorage, MengineAckFailedError, MengineDocSession, MengineHttpClient, MengineHttpRequestError, MenginePushRejectedError, MirrorVideoDocumentAdapter, PlainMemoryAdapter, SchemaValidator, ScriptCompositionError, SemanticEditor, TIMELINE_SKELETON_DURATION_MS, VIDEO_DOCUMENT_SCHEMA_VERSION, ValidationError, VideoDocumentValidationError, applyEntityRows, applyEntityTimelineProjection, arrangeMainTrackSeamlessly, assembleCaptionContent, assembleEntityContent, assemblePhoneticScriptContent, assembleScriptText, assertCanonicalEditorResources, assertEntityProjectionPreservesLegacy, assertMediaAssetWritePolicy, assertValidVideoDocument, base64ToBytes, buildInitialVideoDocument, buildSpeechHostMap, bytesToBase64, cascadeAfterVideoClipChanges, compileEntityRows, createEditSandbox, createMirrorVideoDocument, createMirrorVideoDocumentAdapter, createPlainMemoryAdapter, decodeDocVersionMark, derivePositionFromAbs, effectiveVideoClipDurationMs, encodeDocVersionMark, ensureEditorFoundation, ensureLaneTrack, fillMainTrackTimeGaps, findComposedAudioScript, findLaneTrack, fromVideoDocument, generatePartId, getAt, hostForAbsMs, importMediaAsset, isEmptyVideoClip, isImplementedSemanticOpKind, isMap, laneTrackId, mainTrackRanges, migrateLegacyTimelineToEntities, partDurationMs, partUnionSchema, prepareCaptionContent, projectEntityTimeline, readDocumentAudioScript, readEntityDocument, readMainTrackItems, readMengineEventStream, readPart, readPartDurationMs, readVideoDocumentFromDraft, reassignSpeechesToVideoClipsByTime, recalculateTimelineDuration, relativePositionForAbs, replayJournal, resolveAllSpeechOverlaps, resolveEntityTimelineLayout, resolveSpeechOverlapByShiftingVideos, safeDurationMs, schemas_exports as schemas, selectAudioScriptSegments, snapshotToPlain, solveVideoDocument, speedOf, syncAggregatedClipsTimePosition, toVideoDocument, validateVideoDocument, videoDocumentMirrorSchema, videoDocumentSchema, writeVideoDocumentToDraft };
|
|
4851
|
+
export { DEFAULT_UNIT_TIME_MS, ENTITY_TIMELINE_PROJECTION_SCHEMA_VERSION, EntityGraphHttpClient, EntityTimelineEditor, EntityTimelineProjectionError, IMPLEMENTED_SEMANTIC_OP_KINDS, LANE_KINDS_IN_STACK_ORDER, LORO_ENTITY_SCHEMA, LoroEntityDocument, LoroEntityDraft, ManualSyncDoc, MedeoHttpDocStorage, MemoryDocStorage, MengineAckFailedError, MengineDocSession, MengineHttpClient, MengineHttpRequestError, MenginePushRejectedError, MirrorVideoDocumentAdapter, PlainMemoryAdapter, SchemaValidator, ScriptCompositionError, SemanticEditor, TIMELINE_SKELETON_DURATION_MS, VIDEO_DOCUMENT_SCHEMA_VERSION, ValidationError, VideoDocumentValidationError, applyEntityRows, applyEntityTimelineProjection, applyFieldChanges, arrangeMainTrackSeamlessly, assembleCaptionContent, assembleEntityContent, assemblePhoneticScriptContent, assembleScriptText, assertCanonicalEditorResources, assertEntityProjectionPreservesLegacy, assertFieldChanges, assertMediaAssetWritePolicy, assertValidVideoDocument, base64ToBytes, buildInitialVideoDocument, buildSpeechHostMap, bytesToBase64, cascadeAfterVideoClipChanges, compileEntityRows, createEditSandbox, createMirrorVideoDocument, createMirrorVideoDocumentAdapter, createPlainMemoryAdapter, decodeDocVersionMark, derivePositionFromAbs, effectiveVideoClipDurationMs, encodeDocVersionMark, ensureEditorFoundation, ensureLaneTrack, fillMainTrackTimeGaps, findComposedAudioScript, findLaneTrack, fromVideoDocument, generatePartId, getAt, hostForAbsMs, importMediaAsset, isEmptyVideoClip, isImplementedSemanticOpKind, isMap, laneTrackId, mainTrackRanges, migrateLegacyTimelineToEntities, partDurationMs, partUnionSchema, prepareCaptionContent, projectEntityTimeline, readDocumentAudioScript, readEntityDocument, readMainTrackItems, readMengineEventStream, readPart, readPartDurationMs, readVideoDocumentFromDraft, reassignSpeechesToVideoClipsByTime, recalculateTimelineDuration, relativePositionForAbs, replayJournal, resolveAllSpeechOverlaps, resolveEntityTimelineLayout, resolveFieldPath, resolveSpeechOverlapByShiftingVideos, safeDurationMs, schemas_exports as schemas, selectAudioScriptSegments, snapshotToPlain, solveVideoDocument, speedOf, syncAggregatedClipsTimePosition, toVideoDocument, validateVideoDocument, videoDocumentMirrorSchema, videoDocumentSchema, writeVideoDocumentToDraft };
|
package/dist/testing.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { bt as bytesToBase64, pt as VIDEO_DOCUMENT_SCHEMA_VERSION, s as createMirrorVideoDocumentAdapter, yt as base64ToBytes } from "./document-B1FlNEzF.js";
|
|
2
2
|
import { t as classifyUpdate } from "./loro-relay-doc-ssdYpuef.js";
|
|
3
3
|
import { LoroDoc, VersionVector, encodeFrontiers } from "loro-crdt";
|
|
4
4
|
//#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": "1.4.1-alpha.
|
|
3
|
+
"version": "1.4.1-alpha.3",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"immer": "^10.2.0",
|
|
29
29
|
"loro-mirror": "^2.2.0",
|
|
30
30
|
"zod": "^4.4.3",
|
|
31
|
-
"@mengine/
|
|
32
|
-
"@mengine/
|
|
33
|
-
"@mengine/utils": "1.4.1-alpha.
|
|
31
|
+
"@mengine/sync": "1.4.1-alpha.3",
|
|
32
|
+
"@mengine/storage": "1.4.1-alpha.3",
|
|
33
|
+
"@mengine/utils": "1.4.1-alpha.3"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/node": "^25.9.1",
|