@abraca/dabra 1.0.25 → 1.1.1

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.
@@ -3441,27 +3441,65 @@ var AbracadabraClient = class {
3441
3441
  async redeemInvite(code) {
3442
3442
  await this.request("POST", "/invites/redeem", { body: { code } });
3443
3443
  }
3444
- /** List spaces visible to the caller. No auth required for public spaces. */
3444
+ /** List root documents (replaces listSpaces for new code). */
3445
+ async listRootDocuments() {
3446
+ return (await this.request("GET", "/docs?root=true")).documents;
3447
+ }
3448
+ /** Get the hub document, or null if none is configured. */
3449
+ async getHubDocument() {
3450
+ return this.requestOrNull("GET", "/docs/hub");
3451
+ }
3452
+ /** Set the public_access level for a document. Pass null to inherit from parent. */
3453
+ async setDocumentAccess(docId, publicAccess) {
3454
+ await this.request("PATCH", `/docs/${encodeURIComponent(docId)}/access`, { body: { public_access: publicAccess } });
3455
+ }
3456
+ /** Get the public_access info for a document. */
3457
+ async getDocumentAccess(docId) {
3458
+ return this.request("GET", `/docs/${encodeURIComponent(docId)}/access`);
3459
+ }
3460
+ /** Update document metadata (label, description, is_hub). Requires manage permission. */
3461
+ async updateDocumentMeta(docId, opts) {
3462
+ await this.request("PATCH", `/docs/${encodeURIComponent(docId)}`, { body: opts });
3463
+ }
3464
+ /**
3465
+ * List spaces visible to the caller. No auth required for public spaces.
3466
+ * @deprecated Use {@link listRootDocuments} instead.
3467
+ */
3445
3468
  async listSpaces() {
3446
3469
  return (await this.request("GET", "/spaces", { auth: false })).spaces;
3447
3470
  }
3448
- /** Get a single space by ID. */
3471
+ /**
3472
+ * Get a single space by ID.
3473
+ * @deprecated Use {@link getDoc} instead.
3474
+ */
3449
3475
  async getSpace(spaceId) {
3450
3476
  return this.request("GET", `/spaces/${encodeURIComponent(spaceId)}`, { auth: false });
3451
3477
  }
3452
- /** Get the hub space, or null if none is configured. */
3478
+ /**
3479
+ * Get the hub space, or null if none is configured.
3480
+ * @deprecated Use {@link getHubDocument} instead.
3481
+ */
3453
3482
  async getHubSpace() {
3454
3483
  return this.requestOrNull("GET", "/spaces/hub", { auth: false });
3455
3484
  }
3456
- /** Create a new space (auth required). */
3485
+ /**
3486
+ * Create a new space (auth required).
3487
+ * @deprecated Use {@link createDoc} + {@link updateDocumentMeta} instead.
3488
+ */
3457
3489
  async createSpace(opts) {
3458
3490
  return this.request("POST", "/spaces", { body: opts });
3459
3491
  }
3460
- /** Update an existing space (Owner or admin required). */
3492
+ /**
3493
+ * Update an existing space (Owner or admin required).
3494
+ * @deprecated Use {@link updateDocumentMeta} + {@link setDocumentAccess} instead.
3495
+ */
3461
3496
  async updateSpace(spaceId, opts) {
3462
3497
  return this.request("PATCH", `/spaces/${encodeURIComponent(spaceId)}`, { body: opts });
3463
3498
  }
3464
- /** Delete a space and its root document (Owner or admin required). */
3499
+ /**
3500
+ * Delete a space and its root document (Owner or admin required).
3501
+ * @deprecated Use {@link deleteDoc} instead.
3502
+ */
3465
3503
  async deleteSpace(spaceId) {
3466
3504
  await this.request("DELETE", `/spaces/${encodeURIComponent(spaceId)}`);
3467
3505
  }
@@ -8672,6 +8710,15 @@ var BackgroundSyncManager = class extends EventEmitter {
8672
8710
  const childProvider = await this.rootProvider.loadChild(docId);
8673
8711
  await childProvider.ready;
8674
8712
  await this._waitForSynced(childProvider);
8713
+ {
8714
+ const treeEntry = this.rootProvider.document.getMap("doc-tree").get(docId);
8715
+ this.emit("docSynced", {
8716
+ docId,
8717
+ document: childProvider.document,
8718
+ label: treeEntry?.label ?? "",
8719
+ meta: treeEntry?.meta
8720
+ });
8721
+ }
8675
8722
  if (this.opts.prefetchFiles && this.fileBlobStore) this._prefetchDocFiles(docId, childProvider.document).catch(() => null);
8676
8723
  if (!alreadyCached) this.rootProvider.unloadChild(docId);
8677
8724
  return {
@@ -8701,6 +8748,15 @@ var BackgroundSyncManager = class extends EventEmitter {
8701
8748
  try {
8702
8749
  await childProvider.ready;
8703
8750
  await this._waitForSynced(childProvider);
8751
+ {
8752
+ const treeEntry = this.rootProvider.document.getMap("doc-tree").get(docId);
8753
+ this.emit("docSynced", {
8754
+ docId,
8755
+ document: childDoc,
8756
+ label: treeEntry?.label ?? "",
8757
+ meta: treeEntry?.meta
8758
+ });
8759
+ }
8704
8760
  if (this.opts.prefetchFiles && this.fileBlobStore) this._prefetchDocFiles(docId, childDoc).catch(() => null);
8705
8761
  return {
8706
8762
  docId,