@mengine/medeo-client 2.1.1-dsl.0 → 2.1.1-dsl.2
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 +15 -1
- package/dist/dsl-EV6kCdr6.js +5852 -0
- package/dist/dsl.d.ts +1 -1
- package/dist/dsl.js +2 -2
- package/dist/index-Cu7SdKN5.d.ts +940 -0
- package/dist/{index-B7fC7q7P.d.ts → index-D-3rdfUP.d.ts} +22 -3
- package/dist/{index-DQZUkrpg.d.ts → index-D-6uebu4.d.ts} +2 -2
- package/dist/index.d.ts +4 -4
- package/dist/index.js +54 -4
- package/dist/legacy.d.ts +1 -1
- package/dist/legacy.js +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +2 -2
- package/dist/video-draft-types-TXRv3wS6.js +1419 -0
- package/package.json +8 -5
- package/dist/dsl-Dkecq_2c.js +0 -2814
- package/dist/index-DKDMTXUe.d.ts +0 -605
- package/dist/video-draft-types-DTXxvPt-.js +0 -449
package/README.md
CHANGED
|
@@ -23,6 +23,20 @@ session.destroy();
|
|
|
23
23
|
|
|
24
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
25
|
|
|
26
|
+
## Local persistence
|
|
27
|
+
|
|
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.
|
|
29
|
+
|
|
30
|
+
`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
|
+
|
|
32
|
+
`waitForLocalSave({ timeoutMs? })` waits until the local save queue drains, including in-flight writes and edits made while waiting (default deadline: 15 seconds). Continuous editing may keep it pending. Timing out only stops the wait; persistence continues. This does not wait for server acknowledgement.
|
|
33
|
+
|
|
34
|
+
For normal teardown, use `await session.close()`. It immediately rejects new edits and stops synchronization, then keeps local persistence alive until pending commits are saved before releasing connections. Storage failures remain retryable while closing. `destroy()` is immediate cancellation for exceptional teardown, including failed startup; it can discard unpersisted in-memory work. Neither API can guarantee a save after the browser process is forcibly terminated. Only completed local saves survive reopening.
|
|
35
|
+
|
|
36
|
+
Edits received from another local-storage peer also remain unconfirmed until covered by an authoritative server version. Receiving a cross-tab notification is not a server acknowledgement.
|
|
37
|
+
|
|
38
|
+
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
|
+
|
|
26
40
|
## Editing and conversion
|
|
27
41
|
|
|
28
42
|
- Track: create, reorder, hide and delete.
|
|
@@ -111,7 +125,7 @@ Each handle owns one long-lived Mirror. Ordinary fields and Tree read from its i
|
|
|
111
125
|
|
|
112
126
|
Mirror 2.3.3 cannot safely move an existing node under a parent created in the same draft. The document transaction rejects this combination before writing. When a business Action actually needs it, implement its scoped native path with one audited commit as specified by [K03](../../docs/projects/medeo-dsl/known-unfixed.md#k03-mirror-同批新建父节点并移入已有节点); that fallback is not implemented yet.
|
|
113
127
|
|
|
114
|
-
Loro 1.16.1 and loro-mirror 2.3.3 are the lockfile baseline. Mirror is pinned with a [workspace dependency patch](../../patches/README.md): its optional `setState(..., {applyNative})` hook runs after the ordinary draft reaches Loro and before one commit. The full native event updates Mirror before DSL subscribers are notified. The hook is internal to the DSL adapter; Actions never receive a native-write callback. It supports non-ephemeral Mirror instances, and must not commit/export/import or await. Native writes preserve marks and actual container identities; a plain Mirror string snapshot still does not contain rich-text marks. Tests cover snapshot/update round trips, concurrent moves and replacements, field merging, optional reset, malformed codecs, deletion/recreation, rich text, Cursor ownership, subscriptions and Action failure preflight. The conversion library is implemented; production server/editor/player entry points have not switched.
|
|
128
|
+
Loro 1.16.1 and loro-mirror 2.3.3 are the lockfile baseline. Mirror is pinned with a [workspace dependency patch](../../patches/README.md): its optional `setState(..., {applyNative})` hook runs after the ordinary draft reaches Loro and before one commit. The full native event updates Mirror before DSL subscribers are notified. The hook is internal to the DSL adapter; Actions never receive a native-write callback. It supports non-ephemeral Mirror instances, and must not commit/export/import or await. A registry install of loro-mirror never carries the patch, so the published package bundles the patched Mirror, runtime and declarations; consumers install only the `loro-crdt` peer and configure no patch. Transactions probe the Mirror once and refuse to write when the hook is missing rather than drop native edits. Native writes preserve marks and actual container identities; a plain Mirror string snapshot still does not contain rich-text marks. Tests cover snapshot/update round trips, concurrent moves and replacements, field merging, optional reset, malformed codecs, deletion/recreation, rich text, Cursor ownership, subscriptions and Action failure preflight. The conversion library is implemented; production server/editor/player entry points have not switched.
|
|
115
129
|
|
|
116
130
|
Run the package test/build tasks through `vp run @mengine/medeo-client#test` and `vp run @mengine/medeo-client#build`.
|
|
117
131
|
|