@abraca/dabra 2.24.0 → 2.26.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/dist/abracadabra-provider.cjs +18 -11
- package/dist/abracadabra-provider.cjs.map +1 -1
- package/dist/abracadabra-provider.esm.js +15 -8
- package/dist/abracadabra-provider.esm.js.map +1 -1
- package/dist/index.d.ts +10 -4
- package/package.json +2 -2
- package/src/AbracadabraClient.ts +9 -3
- package/src/TreeTimestamps.ts +17 -8
|
@@ -11073,9 +11073,14 @@ var AbracadabraClient = class {
|
|
|
11073
11073
|
return this.request("GET", `/docs/${encodeURIComponent(docId)}/access`);
|
|
11074
11074
|
}
|
|
11075
11075
|
/**
|
|
11076
|
-
* Update document metadata (label, description, kind, parent_id).
|
|
11077
|
-
* manage permission on the doc; reparenting additionally requires
|
|
11078
|
-
* the new parent (or admin if moving under the server root).
|
|
11076
|
+
* Update document metadata (label, description, kind, doc_type, parent_id).
|
|
11077
|
+
* Requires manage permission on the doc; reparenting additionally requires
|
|
11078
|
+
* manage on the new parent (or admin if moving under the server root).
|
|
11079
|
+
*
|
|
11080
|
+
* `doc_type` is the renderer hint (`"kanban"`, `"graph"`, …) — orthogonal
|
|
11081
|
+
* to `kind` (the structural role). Use it for post-create type changes;
|
|
11082
|
+
* never write renderer strings into `kind`. Servers older than migration
|
|
11083
|
+
* 0014 ignore the field (unknown JSON fields are dropped server-side).
|
|
11079
11084
|
*/
|
|
11080
11085
|
async updateDocumentMeta(docId, opts) {
|
|
11081
11086
|
await this.request("PATCH", `/docs/${encodeURIComponent(docId)}`, { body: opts });
|
|
@@ -15956,9 +15961,9 @@ function patchEntry(treeMap, id, patch, removeKeys = [], opts = {}) {
|
|
|
15956
15961
|
/**
|
|
15957
15962
|
* TreeTimestamps
|
|
15958
15963
|
*
|
|
15959
|
-
* Attaches an
|
|
15960
|
-
*
|
|
15961
|
-
*
|
|
15964
|
+
* Attaches an afterTransaction observer on a child Y.Doc so that whenever a
|
|
15965
|
+
* LOCAL edit is made, the `updatedAt` timestamp on the corresponding entry
|
|
15966
|
+
* in the root doc's `doc-tree` map is written.
|
|
15962
15967
|
*
|
|
15963
15968
|
* This propagates "last edited" timestamps to all peers via the root CRDT,
|
|
15964
15969
|
* without requiring any server-side changes.
|
|
@@ -15969,7 +15974,7 @@ function patchEntry(treeMap, id, patch, removeKeys = [], opts = {}) {
|
|
|
15969
15974
|
*/
|
|
15970
15975
|
/**
|
|
15971
15976
|
* Attach an observer that writes `updatedAt` to the root doc-tree entry for
|
|
15972
|
-
* `childDocId` whenever the child doc receives a
|
|
15977
|
+
* `childDocId` whenever the child doc receives a local edit.
|
|
15973
15978
|
*
|
|
15974
15979
|
* @param treeMap The root doc's "doc-tree" Y.Map.
|
|
15975
15980
|
* @param childDocId The child document's UUID (key in treeMap).
|
|
@@ -15999,8 +16004,10 @@ function attachUpdatedAtObserver(treeMap, childDocId, childDoc, offlineStore, op
|
|
|
15999
16004
|
pendingTs = 0;
|
|
16000
16005
|
writeTs(ts);
|
|
16001
16006
|
}
|
|
16002
|
-
function handler(
|
|
16003
|
-
if (
|
|
16007
|
+
function handler(tr) {
|
|
16008
|
+
if (!tr.local) return;
|
|
16009
|
+
if (offlineStore !== null && tr.origin === offlineStore) return;
|
|
16010
|
+
if (tr.changed.size === 0) return;
|
|
16004
16011
|
const now = Date.now();
|
|
16005
16012
|
if (now - lastFlushedAt >= throttleMs) {
|
|
16006
16013
|
writeTs(now);
|
|
@@ -16009,9 +16016,9 @@ function attachUpdatedAtObserver(treeMap, childDocId, childDoc, offlineStore, op
|
|
|
16009
16016
|
pendingTs = now;
|
|
16010
16017
|
if (timer === null) timer = setTimeout(flushPending, throttleMs - (now - lastFlushedAt));
|
|
16011
16018
|
}
|
|
16012
|
-
childDoc.on("
|
|
16019
|
+
childDoc.on("afterTransaction", handler);
|
|
16013
16020
|
return () => {
|
|
16014
|
-
childDoc.off("
|
|
16021
|
+
childDoc.off("afterTransaction", handler);
|
|
16015
16022
|
if (timer !== null) {
|
|
16016
16023
|
clearTimeout(timer);
|
|
16017
16024
|
flushPending();
|