@mengine/medeo-client 2.1.1-dsl.9 → 3.0.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 +9 -9
- package/dist/{dsl-COyzz7Fp.js → dsl-Cpk8WxcZ.js} +2275 -143
- package/dist/dsl.d.ts +1 -2
- package/dist/dsl.js +1 -2
- package/dist/{index-DAfOkcnZ.d.ts → index-Dldi944U.d.ts} +199 -3
- package/dist/{index-C5wDKYqC.d.ts → index-DuM7I4Ku.d.ts} +912 -10
- package/dist/index.d.ts +2 -4
- package/dist/index.js +815 -7
- package/dist/testing.d.ts +1 -2
- package/dist/testing.js +4 -4
- package/package.json +9 -12
- package/dist/index-CHiPztZr.d.ts +0 -194
- package/dist/legacy.d.ts +0 -1044
- package/dist/legacy.js +0 -4349
- package/dist/schemas.d.ts +0 -606
- package/dist/schemas.js +0 -442
- package/dist/shared-iWnU2osE.js +0 -39
- package/dist/storage-BW3tI_ER.js +0 -801
- package/dist/video-draft-types-BnbfWrBx.js +0 -1486
- package/dist/video-draft-types-GqXnsOzA.d.ts +0 -869
package/README.md
CHANGED
|
@@ -16,16 +16,14 @@ const [clipId] = session.editor.addClips({
|
|
|
16
16
|
session.editor.setClipVolume(clipId, -3, { actor: { user_id: userId, role: 'user' } });
|
|
17
17
|
await session.waitForServerAck(); // Local completion is separate from durable confirmation.
|
|
18
18
|
const { content, diagnostics } = session.projectVideoDraft();
|
|
19
|
-
session.
|
|
19
|
+
await session.close();
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
`start()`, `snapshot()` and subscription events expose `MedeoDslSnapshot`. `session.dsl` exposes controlled `transact`/`applyMutations`; ordinary business callers use `session.editor`. Rich text uses the native text adapter. `readonlyMode` blocks editing and Undo/Redo. Closing a session also invalidates captured editor/document references.
|
|
23
23
|
|
|
24
|
-
For explicit synchronization, use `ManualSyncDoc.open({client, peerId})`, then `pull()`, `editor`, `push()` and `dispose()`. Both lifecycles use the same binary snapshot/update and version-coverage contracts. Neither silently upgrades old documents or overwrites an incompatible cache.
|
|
25
|
-
|
|
26
24
|
## Local persistence
|
|
27
25
|
|
|
28
|
-
Browser hosts can inject `IndexedDBDocStorage` through `localStorage`. An optional `initialSnapshot` merges a freshly fetched server snapshot into that storage before DocManager loads it; it never replaces locally saved, unconfirmed edits. The host can require a successful online fetch before constructing the session.
|
|
26
|
+
Browser hosts can inject `IndexedDBDocStorage` through `localStorage`. An optional `initialSnapshot` merges a freshly fetched server snapshot into that storage before DocManager loads it; it never replaces locally saved, unconfirmed edits. The incoming snapshot and combined local history are format-checked before the merge is persisted. The host can require a successful online fetch before constructing the session.
|
|
29
27
|
|
|
30
28
|
`getLocalSaveState()` / `subscribeLocalSaveState()` report `{ status: 'saving' | 'saved' | 'failed', error }` for this session's local commits. This is separate from `getSyncState()` and server confirmation. The storage adapter determines durability: IndexedDB resolves only after its transaction commits; MemoryDocStorage remains in memory. Failed saves retain their causal order and retry without blocking other documents.
|
|
31
29
|
|
|
@@ -37,6 +35,8 @@ Edits received from another local-storage peer also remain unconfirmed until cov
|
|
|
37
35
|
|
|
38
36
|
Reopening uses the stored Loro history and the server's version vector to derive missing updates, without replaying semantic operations or their external side effects. Undo history remains limited to the current session.
|
|
39
37
|
|
|
38
|
+
For explicit synchronization, use `ManualSyncDoc.open({client, peerId})`, then `pull()`, `editor`, `push()` and `dispose()`. Both lifecycles use the same binary snapshot/update and version-coverage contracts. Neither silently upgrades old documents or overwrites an incompatible cache.
|
|
39
|
+
|
|
40
40
|
## Editing and conversion
|
|
41
41
|
|
|
42
42
|
- Track: create, reorder, hide and delete.
|
|
@@ -44,10 +44,10 @@ Reopening uses the stored Loro history and the server's version vector to derive
|
|
|
44
44
|
- Placement: sequential, absolute or anchored. Reordering and replacement require an explicit associated-content policy.
|
|
45
45
|
- Voiceover: `applyVoiceover` consumes materialized recording/script/caption results in one commit. Upload, ASR and TTS belong to the host.
|
|
46
46
|
- BGM: `setBgm` requires full resource facts and explicitly fills the Timeline; trim/speed are not enabled.
|
|
47
|
-
- AudioScript: segmented text; segments are inserted, moved and deleted by id, each with its own native Text.
|
|
47
|
+
- AudioScript: segmented text; segments are inserted, moved and deleted by id, each with its own native Text. A transcript names the transcription file it was read from, and its segments keep the `startMs`/`endMs` that file gave them (`tx.insertSegment(..., time)`); a segment's time is written when it is added and never edited.
|
|
48
48
|
- Caption: independent native Text or a selection of one script segment (whole, or a Cursor run inside it); style and source switching.
|
|
49
49
|
|
|
50
|
-
`resolveDslLayout`, `toVideoDraft`, `fromVideoDraft`, `MedeoDsl` and the model types are exported from the root and `/dsl`. Projection returns diagnostics; unrepresentable legacy output throws `DslProjectionError`. `MengineHttpClient.fetchDraft()` / `fetchDraftAt(seq)` read the server's content, diagnostics and matching version.
|
|
50
|
+
`resolveDslLayout`, `toVideoDraft`, `fromVideoDraft`, `toAudioScriptViews`, `MedeoDsl` and the model types are exported from the root and `/dsl`. `toAudioScriptViews` (on a session, `projectAudioScripts()`) reads the same snapshot as the VideoDraft and lists every AudioScript with its segments — a transcript's with their `startMs`/`endMs` and a `timelineMs`, the position on the earliest Clip playing the transcribed medium whose window holds that moment — its PhoneticScripts with their digests, the speech Clips saying it (with `applied`) and the Caption Clips showing one of its segments. Projection returns diagnostics; unrepresentable legacy output throws `DslProjectionError`. `MengineHttpClient.fetchDraft()` / `fetchDraftAt(seq)` read the server's content, diagnostics and matching version.
|
|
51
51
|
|
|
52
52
|
## The DSL document
|
|
53
53
|
|
|
@@ -87,7 +87,7 @@ dsl.dispose();
|
|
|
87
87
|
- `getSnapshot()` returns a frozen, read-only `MedeoDslSnapshot`: entity tables, the voice-timbre and derived-from relation tables, effective containment, rich-text runs, resolved Caption text and diagnostics. A relation an entity holds at most one of is a field of its row: a Clip's `source` and `anchor`, a Caption's `selection`, a PhoneticScript's `phoneme`. An unreadable optional field is dropped from the row with a diagnostic; the row stays. A Caption's own text wins over its selection when a merge leaves both. It does not compute layout or VideoDraft. Reads reuse the same snapshot until a DSL content event invalidates it; no-op Actions and repeated imports retain it. Reading never commits changes.
|
|
88
88
|
- `subscribe(listener)` includes text-only and marks-only changes. The returned function unsubscribes; dispose is idempotent. As with other synchronous document observers, listeners should not throw or initiate nested writes.
|
|
89
89
|
- `applyMutations(mutations, audit)` is the preferred interface for typed entity, relation, Tree, Text and Caption-selection commands. It opens one `transact`; `tx.applyMutations` inside an existing callback uses the same draft and commit.
|
|
90
|
-
- `transact(edit, audit)` exposes a guarded `tx.draft` for ordinary fields and Tree, `tx.editText(scriptId, segmentId, edits, expectedBodyId?)`, `tx.editCaptionText(captionId, edits, expectedBodyId?)`, `tx.insertSegment` / `tx.moveSegment` / `tx.deleteSegment`, `tx.setCaptionContent({captionId, audioScriptId, segmentId, start?, end?})` and `tx.setPhoneme({phoneticScriptId, audioScriptId, segmentId, start?, end?, phonemeScript?})`. The synchronous callback and every draft reference expire on return. Async callbacks, nested writes, identity changes, direct overwrites of existing bodies, and same-transaction entity deletion/recreation are rejected. Catching a guard/command error inside the callback does not allow a partial commit.
|
|
90
|
+
- `transact(edit, audit)` exposes a guarded `tx.draft` for ordinary fields and Tree, `tx.editText(scriptId, segmentId, edits, expectedBodyId?)`, `tx.editCaptionText(captionId, edits, expectedBodyId?)`, `tx.insertSegment(scriptId, segmentId, text, index?, time?)` / `tx.moveSegment` / `tx.deleteSegment`, `tx.setCaptionContent({captionId, audioScriptId, segmentId, start?, end?})` and `tx.setPhoneme({phoneticScriptId, audioScriptId, segmentId, start?, end?, phonemeScript?})`. The synchronous callback and every draft reference expire on return. Async callbacks, nested writes, identity changes, direct overwrites of existing bodies, and same-transaction entity deletion/recreation are rejected. Catching a guard/command error inside the callback does not allow a partial commit.
|
|
91
91
|
- `editText(scriptId, segmentId, expectedBodyId, edits, audit)` delegates to the same transaction. Text supports insert/delete/mark/unmark/editing Delta; offsets are UTF-16 and cannot split surrogate pairs. `tx.draft` exposes the text preview after preceding edits, while existing body strings are never sent through Mirror's full-text diff. A supplied body identity must match the current Text; Actions editing an existing body retain that stale-view check.
|
|
92
92
|
- Caption selections are interpreted at their position in the command sequence. Their Cursors are created after earlier native edits, and follow later edits. New selections are deferred commands, not synthetic Cursor values in `tx.draft`; do not read a Caption's `selection` from the draft to retrieve a pending one. Explicit Cursor values written to `selection`, and its removal, also replay in sequence with Text edits.
|
|
93
93
|
- `textRange(scriptId, segmentId, start, end)` returns native Cursors for a nonempty run inside one segment. A Caption's `selection` stores their native bytes through the central codec. The permanent first-boundary limitation remains deferred.
|
|
@@ -156,9 +156,9 @@ Caption text is matched forward in `speech.caption_ids` order. A failed exact ma
|
|
|
156
156
|
|
|
157
157
|
`richText` is keyed by script segment ID or inline Caption entity ID; `captionText` resolves either content source and `phoneticText` what each PhoneticScript selects. Optional Caption Texts have ordinary identities and are created in the native hook, preserving mergeable style/font while avoiding duplicate text on mergeable-Text deletion Undo. See [RFC 02](../../docs/projects/medeo-dsl/rfc/02-videodraft-projection.md) for layout, import normalization and compatibility limits.
|
|
158
158
|
|
|
159
|
-
##
|
|
159
|
+
## Current entrypoints
|
|
160
160
|
|
|
161
|
-
`SemanticEditor`, `VideoDocument`,
|
|
161
|
+
`SemanticEditor`, `VideoDocument`, `EntityTimelineEditor`, the old entity CRDT and their projections have been removed, along with `/legacy` and the old `/schemas` input contract. The current `ManualSyncDoc` remains the tool's explicit pull/push document handle over `MedeoDsl` and `DslEditor`; its shared transport is retained. The sandbox contract lives in medeo-dsl and is implemented by medeo-tool.
|
|
162
162
|
|
|
163
163
|
`/relay` and `/testing` remain host/test-only entrypoints. The private DSL package is bundled into the client distribution.
|
|
164
164
|
|