@mengine/medeo-client 1.3.1-alpha.8 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -100
- package/dist/document-DKPAavs9.js +1709 -0
- package/dist/{index-BUkDsU7c.d.ts → index-CX7IXsnp.d.ts} +655 -304
- package/dist/index.d.ts +95 -539
- package/dist/index.js +864 -2631
- package/dist/{loro-relay-doc-ssdYpuef.js → loro-relay-doc-cJSY-uau.js} +7 -2
- package/dist/relay.js +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +2 -41
- package/package.json +8 -12
- package/dist/document-BLYcbv8E.js +0 -3623
- package/dist/index-CMa6ZCtX.d.ts +0 -609
- package/dist/schemas.d.ts +0 -2
- package/dist/schemas.js +0 -482
- package/dist/shared-iWnU2osE.js +0 -39
package/README.md
CHANGED
|
@@ -2,113 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
Medeo domain client for the `mengine` document path.
|
|
4
4
|
|
|
5
|
-
This package owns
|
|
6
|
-
compatibility projection, and the runtime-neutral HTTP/SSE clients. UI intent
|
|
7
|
-
adapters stay in product repositories; Harness only supplies environment and
|
|
8
|
-
asset facts, not an entity store implementation.
|
|
5
|
+
This package owns the shared `VideoDocument` contract, semantic editing layer, and runtime-neutral HTTP/SSE client used by medeo-web, agent-harness, and server-side validation code. UI adapters such as `DraftMutationDriver` stay in product repositories.
|
|
9
6
|
|
|
10
|
-
|
|
7
|
+
## Session undo/redo
|
|
11
8
|
|
|
12
|
-
|
|
13
|
-
2. `ensureEditorFoundation` gets or creates one Timeline and four role Tracks,
|
|
14
|
-
retaining all existing identities and settings. `importMediaAsset` groups and
|
|
15
|
-
deduplicates only by direct media variants carrying the same external asset
|
|
16
|
-
id `(system, key)`. Imports mint exactly one media variant Entity
|
|
17
|
-
(Video/Image/Audio/Voice) that carries the Asset locator itself; no separate
|
|
18
|
-
`asset` Entity and no `physical-asset` Relation are created, and the returned
|
|
19
|
-
identity is that single Entity. Video duration must come from asset
|
|
20
|
-
metadata, never a clip trim window. Dual-entity media graphs (`asset` row
|
|
21
|
-
plus a `physical-asset` binding) are not reused and fail explicitly instead
|
|
22
|
-
of minting a second identity. This policy is local to the MEngine editor, not
|
|
23
|
-
the general-purpose DSL.
|
|
24
|
-
3. `EntityTimelineEditor` edits Clip/Marker/Track relations and payloads.
|
|
25
|
-
4. `EntityGraphHttpClient.commit(baseState, nextRows)` performs revision CAS,
|
|
26
|
-
including explicit net deletions. The server writes entities and the derived
|
|
27
|
-
Loro read view in the same transaction.
|
|
9
|
+
After `await session.start()`, `session.undo(options?)` and `session.redo(options?)` synchronously apply local history and return whether they produced a document update. `options` accepts the same actor/intent metadata as semantic edits. Read the resulting document through `session.snapshot()`; use `waitForServerAck()` only when durable confirmation is required.
|
|
28
10
|
|
|
29
|
-
|
|
30
|
-
Clips and SequenceMarkers. Asset generation alone still does not create editor
|
|
31
|
-
Entities. Two commit-level guards protect the single-identity policy:
|
|
32
|
-
`assertCanonicalEditorResources(rows)` checks one complete state — every media
|
|
33
|
-
variant carries its own external locator, one external asset id has exactly one
|
|
34
|
-
claimant, and no media variant is bound through a `physical-asset` Relation.
|
|
35
|
-
The exported `assertMediaAssetWritePolicy(before, after)` checks one CAS
|
|
36
|
-
transition and is reusable by the host tool and the entity stores: it applies
|
|
37
|
-
the same rules to the complete after state, and a self-carried identity cannot
|
|
38
|
-
be rewritten to another asset id. The editor applies it to every transaction
|
|
39
|
-
and `EntityGraphHttpClient.commit` applies it to `(baseState.rows, nextRows)`
|
|
40
|
-
before any request. There is no historical exemption: dual-entity media graphs
|
|
41
|
-
are rejected rather than kept editable — the shared `decodeEntityRelationRows`
|
|
42
|
-
boundary already fails rows whose media variants lack `external` or carry a
|
|
43
|
-
`physical-asset` binding, so editors and commits never observe them — deleting
|
|
44
|
-
media is an explicit caller decision, and no implicit historical merge or
|
|
45
|
-
identity rewriting occurs. The
|
|
46
|
-
compatibility reader reads physical facts directly from the media variant;
|
|
47
|
-
Caption text is assembled from its required AudioScript composition and never stored in an inline Asset.
|
|
11
|
+
`getUndoState()` returns the current `{ canUndo, canRedo }` immediately. `subscribeUndoState(callback)` immediately provides that state, then coalesces subsequent stack changes in a microtask after mutations settle. Several synchronous commands may produce only one availability notification; use the getter when reading directly after a command. Teardown publishes empty availability synchronously and cancels pending notifications. Dispose the returned subscription with the host. Loading and closed sessions report an empty history; history commands require a ready session.
|
|
48
12
|
|
|
49
|
-
|
|
50
|
-
owns clip properties such as volume; `Track` owns track properties. References
|
|
51
|
-
between entities belong in Relations, not in payload IDs. There is no separate
|
|
52
|
-
timing profile. The compatibility reader supports the existing four lanes:
|
|
53
|
-
one image/video main track, Voice, Caption, and background Audio. It accepts
|
|
54
|
-
explicit millisecond media coordinates and linear visual remapping
|
|
55
|
-
`{ kind: 'linear', rate: 2 }` (including still-image display speed). Nonlinear
|
|
56
|
-
speed and multiple visual overlay tracks are not existing editor capabilities
|
|
57
|
-
and remain outside this adapter; unsupported layouts fail before persistence.
|
|
58
|
-
Effective duration and absolute target coordinates must be whole milliseconds
|
|
59
|
-
for this reader; generic DSL coordinates are not globally restricted to that
|
|
60
|
-
unit or precision. Sequential placement stays `Clip.order` plus no targetRange,
|
|
61
|
-
so later duration edits continue to move following Clips.
|
|
13
|
+
History belongs to one document/session peer. The loaded baseline and remote imports are not recorded. Each semantic commit is a separate step (up to 100); a new local edit invalidates redo. Reconnecting preserves history, while reopening starts empty. Empty or ineffective history actions return false. Never reuse a peer ID across concurrent sessions.
|
|
62
14
|
|
|
63
|
-
|
|
64
|
-
server-authored compatibility view. Configure that session as read-only: even
|
|
65
|
-
cold-start reconciliation must not POST legacy `/updates`. Entity writes use
|
|
66
|
-
the independent graph CAS endpoint.
|
|
15
|
+
Use `beginUndoGroup()` / `endUndoGroup()` to combine existing semantic operations into one undo step, or to combine repeated commits during one gesture. Always end in `finally`. Every constituent commit is immediately visible locally and enters synchronization independently; if a later operation fails, earlier commits remain applied. Conflicting remote imports may split/end a group early, and unrelated local edits in the same session would join an open group.
|
|
67
16
|
|
|
68
|
-
|
|
69
|
-
plus `SequenceMarker.anchorOffset`. Voice and Caption can be independently
|
|
70
|
-
placed or explicitly anchored; generation relations do not choose a host. `resolveEntityTimelineLayout` resolves this graph
|
|
71
|
-
without reparenting or synthesizing content. Move/delete operations must write
|
|
72
|
-
their follow, keep-absolute, cascade, or detach decisions into the same entity
|
|
73
|
-
plan. A speech-overlap shift is explicit placement on the real visual Clips;
|
|
74
|
-
an uncovered time interval does not require an invented empty-media entity.
|
|
17
|
+
Mirror's draft callback and commit are synchronous. SemanticEditor methods return promises, but their document mutations currently finish synchronously before the promise resolves. Await external asset generation before opening a group, then compose the local semantic operations. Keeping a group open across asynchronous work does not provide transaction isolation, deferred publication, or rollback. If several changes must be atomic, implement one semantic operation with one synchronous draft callback. A gesture that uses only local previews and commits once on release already needs no group.
|
|
75
18
|
|
|
76
|
-
|
|
77
|
-
Caption and PhoneticScript each compose a real AudioScript by directly holding `baseEntityIds`, an array that may compose multiple entities. AudioScript owns
|
|
78
|
-
`segments[].text`; assembly never automatically persists a copy on the variants. Read complete content
|
|
79
|
-
with `assembleCaptionContent` or `assemblePhoneticScriptContent`. Broken composition
|
|
80
|
-
fails explicitly. Same-name fields from different bases are rejected even for equal values and even if the variant declares that field. After base fields are unambiguous, explicit own fields may override them without mutating the bases. Recorded Audio/Video/Voice can be the ASR source via
|
|
81
|
-
`audio-script-source`, without creating a synthesis variant.
|
|
19
|
+
Flush pending local preview/debounce work before undo/redo. Mutating again from a document-update observer during a mutation is rejected; schedule the next command after the current one returns.
|
|
82
20
|
|
|
83
|
-
|
|
84
|
-
names a source `segmentId` and optionally a half-open Unicode code-point
|
|
85
|
-
`textRange: {start, end}`. This permits display re-segmentation without rewriting
|
|
86
|
-
the original script. `upsertVoiceoverTake` requires the real
|
|
87
|
-
`phoneticScriptEntityId` used for synthesis; its captions supply their own `baseEntityIds` and select the same script.
|
|
88
|
-
External speech identity and storage key stay on Voice.
|
|
21
|
+
The session assembles SemanticEditor with MirrorVideoDocumentAdapter directly. DocumentUndoManager independently observes the same LoroDoc and owns undo/redo, grouping and audit metadata. Both write paths share a synchronous DocumentMutationGuard; the session closes it before teardown callbacks, and each component releases its own resources. Standalone adapters create their own guard by default and reject use after disposal while leaving the borrowed LoroDoc usable.
|
|
89
22
|
|
|
90
|
-
|
|
91
|
-
attaches directly assigned `segmentRanges` timing; annotation Markers never refer
|
|
92
|
-
to upstream Markers and cannot be Clip display Markers. Moving or aligning a
|
|
93
|
-
Caption changes its external display Marker, preserving intrinsic Caption extent.
|
|
94
|
-
Caption owns its styles and text selection. Background Audio's Marker declares
|
|
95
|
-
`durationPolicy: 'timeline'`: its source duration stays factual,
|
|
96
|
-
while the view fills the non-BGM timeline duration.
|
|
23
|
+
Undo/redo append ordinary synchronized updates and retain audit metadata (`Undo`/`Redo`, actor, and `payload.source` identifying an original local change). Existing revision bindings remain immutable. Redo reuses already materialized assets without repeating generation, billing, or attachment requests. Network failures do not automatically reverse history.
|
|
97
24
|
|
|
98
|
-
|
|
99
|
-
ordinary editing diff adapter. A configured legacy document requires a separate
|
|
100
|
-
CAS commit with `migrationBaseVv` equal to its current canonical base64 Loro
|
|
101
|
-
oplog version. The server calls `assertEntityProjectionPreservesLegacy` to reject
|
|
102
|
-
stale or lossy migrations. Only then can a new edit be committed.
|
|
103
|
-
|
|
104
|
-
The legacy `SemanticEditor` remains available for pre-cutover library consumers.
|
|
105
|
-
It rejects `video-document/entity-projection-v1` documents. Production entity
|
|
106
|
-
tools and editor adapters must not fall back to it or raw `/updates` on failure.
|
|
107
|
-
For an entity projection, `meta.version` is the committed entity revision; the
|
|
108
|
-
Loro version vector remains the transport-sync cursor.
|
|
109
|
-
|
|
110
|
-
### Transparent variant fields in the DSL sandbox
|
|
111
|
-
|
|
112
|
-
`entities.get/list` return complete assembled fields. Consumers do not query base IDs or merge source payloads. `entities.update` patches supplied fields, preserves omitted fields, and routes inherited fields to their declaring entity. Explicit own-field declarations use `entities.declareFields`; these override unambiguous base fields without changing the base. Persisted entity rows and command payloads contain owned fields only. Base collisions are validated before own overrides.
|
|
113
|
-
|
|
114
|
-
`prepareCaptionContent` accepts caption authoring intent and handles source composition, visible text selection, and preservation of existing intrinsic timing inside the SDK.
|
|
25
|
+
Loro history uses new writes: undo on a shared LWW field restores its value before the local edit, potentially overwriting a later remote write to the same field; redo restores the value visible before undo. Unrelated remote fields remain intact. Undoing a local insertion removes the object and makes dependent remote edits invisible until redo restores the object. Caption creation includes its style container, even when empty, so a later style edit only changes fields and undo preserves another peer's independently edited fields. Initial document seeding preserves supplied styles and creates empty maps for captions without styles. No write-time repair or migration of older CRDT documents is provided.
|