@mengine/medeo-client 2.0.1-alpha.4 → 2.0.1-alpha.5
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 +110 -45
- package/dist/document-Bzzcn3g7.js +4585 -0
- package/dist/{index-CnZ9l3rb.d.ts → index-B31KeDzA.d.ts} +409 -708
- package/dist/index-CMa6ZCtX.d.ts +609 -0
- package/dist/index.d.ts +747 -131
- package/dist/index.js +2696 -939
- package/dist/{loro-relay-doc-cJSY-uau.js → loro-relay-doc-ssdYpuef.js} +2 -7
- package/dist/relay.js +1 -1
- package/dist/schemas.d.ts +2 -0
- package/dist/schemas.js +482 -0
- package/dist/shared-iWnU2osE.js +39 -0
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +58 -4
- package/package.json +12 -7
- package/dist/document-B_JQwrC5.js +0 -1630
package/README.md
CHANGED
|
@@ -2,48 +2,113 @@
|
|
|
2
2
|
|
|
3
3
|
Medeo domain client for the `mengine` document path.
|
|
4
4
|
|
|
5
|
-
This package owns
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
5
|
+
This package owns graph-native Medeo editing, its one-way `VideoDocument`
|
|
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.
|
|
9
|
+
|
|
10
|
+
For entity-authoritative documents:
|
|
11
|
+
|
|
12
|
+
1. `EntityGraphHttpClient.fetchState()` obtains the complete graph and revision.
|
|
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.
|
|
28
|
+
|
|
29
|
+
Repeated placement reuses the same single media identity but creates independent
|
|
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. The host may associate Caption with a real text Asset through `physical-asset`, keyed by Caption identity; the sandbox does not manage Assets. The association is optional and does not replace composition. Editing inherited text through Caption advances the AudioScript version and its base reference, preserving the Caption ID unless its own fields change.
|
|
48
|
+
|
|
49
|
+
`SequenceMarker` owns source/target ranges, duration, and time remapping. `Clip`
|
|
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.
|
|
62
|
+
|
|
63
|
+
Entity-authoritative editor consumers use the Loro session only to receive the
|
|
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.
|
|
67
|
+
|
|
68
|
+
Anchored placement is a `clip-anchor` Relation from child Clip to host Clip
|
|
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.
|
|
75
|
+
|
|
76
|
+
Generated Voice links to a pre-existing PhoneticScript through `phonetic-script-render`.
|
|
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.
|
|
82
|
+
|
|
83
|
+
`insertCaptionClip` requires `baseEntityIds` and one `selection` object; its optional `captionEntityId` preserves a generation-provided business identity independently of `captionClipEntityId`. The selection
|
|
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.
|
|
89
|
+
|
|
90
|
+
AudioScript has no intrinsic Sequence and cannot enter a Clip. `audio-script-marker`
|
|
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.
|
|
97
|
+
|
|
98
|
+
`migrateLegacyTimelineToEntities` is a one-time migration utility, **not** an
|
|
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.
|