@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.
@@ -3411,27 +3411,65 @@ var AbracadabraClient = class {
3411
3411
  async redeemInvite(code) {
3412
3412
  await this.request("POST", "/invites/redeem", { body: { code } });
3413
3413
  }
3414
- /** List spaces visible to the caller. No auth required for public spaces. */
3414
+ /** List root documents (replaces listSpaces for new code). */
3415
+ async listRootDocuments() {
3416
+ return (await this.request("GET", "/docs?root=true")).documents;
3417
+ }
3418
+ /** Get the hub document, or null if none is configured. */
3419
+ async getHubDocument() {
3420
+ return this.requestOrNull("GET", "/docs/hub");
3421
+ }
3422
+ /** Set the public_access level for a document. Pass null to inherit from parent. */
3423
+ async setDocumentAccess(docId, publicAccess) {
3424
+ await this.request("PATCH", `/docs/${encodeURIComponent(docId)}/access`, { body: { public_access: publicAccess } });
3425
+ }
3426
+ /** Get the public_access info for a document. */
3427
+ async getDocumentAccess(docId) {
3428
+ return this.request("GET", `/docs/${encodeURIComponent(docId)}/access`);
3429
+ }
3430
+ /** Update document metadata (label, description, is_hub). Requires manage permission. */
3431
+ async updateDocumentMeta(docId, opts) {
3432
+ await this.request("PATCH", `/docs/${encodeURIComponent(docId)}`, { body: opts });
3433
+ }
3434
+ /**
3435
+ * List spaces visible to the caller. No auth required for public spaces.
3436
+ * @deprecated Use {@link listRootDocuments} instead.
3437
+ */
3415
3438
  async listSpaces() {
3416
3439
  return (await this.request("GET", "/spaces", { auth: false })).spaces;
3417
3440
  }
3418
- /** Get a single space by ID. */
3441
+ /**
3442
+ * Get a single space by ID.
3443
+ * @deprecated Use {@link getDoc} instead.
3444
+ */
3419
3445
  async getSpace(spaceId) {
3420
3446
  return this.request("GET", `/spaces/${encodeURIComponent(spaceId)}`, { auth: false });
3421
3447
  }
3422
- /** Get the hub space, or null if none is configured. */
3448
+ /**
3449
+ * Get the hub space, or null if none is configured.
3450
+ * @deprecated Use {@link getHubDocument} instead.
3451
+ */
3423
3452
  async getHubSpace() {
3424
3453
  return this.requestOrNull("GET", "/spaces/hub", { auth: false });
3425
3454
  }
3426
- /** Create a new space (auth required). */
3455
+ /**
3456
+ * Create a new space (auth required).
3457
+ * @deprecated Use {@link createDoc} + {@link updateDocumentMeta} instead.
3458
+ */
3427
3459
  async createSpace(opts) {
3428
3460
  return this.request("POST", "/spaces", { body: opts });
3429
3461
  }
3430
- /** Update an existing space (Owner or admin required). */
3462
+ /**
3463
+ * Update an existing space (Owner or admin required).
3464
+ * @deprecated Use {@link updateDocumentMeta} + {@link setDocumentAccess} instead.
3465
+ */
3431
3466
  async updateSpace(spaceId, opts) {
3432
3467
  return this.request("PATCH", `/spaces/${encodeURIComponent(spaceId)}`, { body: opts });
3433
3468
  }
3434
- /** Delete a space and its root document (Owner or admin required). */
3469
+ /**
3470
+ * Delete a space and its root document (Owner or admin required).
3471
+ * @deprecated Use {@link deleteDoc} instead.
3472
+ */
3435
3473
  async deleteSpace(spaceId) {
3436
3474
  await this.request("DELETE", `/spaces/${encodeURIComponent(spaceId)}`);
3437
3475
  }
@@ -8620,6 +8658,15 @@ var BackgroundSyncManager = class extends EventEmitter {
8620
8658
  const childProvider = await this.rootProvider.loadChild(docId);
8621
8659
  await childProvider.ready;
8622
8660
  await this._waitForSynced(childProvider);
8661
+ {
8662
+ const treeEntry = this.rootProvider.document.getMap("doc-tree").get(docId);
8663
+ this.emit("docSynced", {
8664
+ docId,
8665
+ document: childProvider.document,
8666
+ label: treeEntry?.label ?? "",
8667
+ meta: treeEntry?.meta
8668
+ });
8669
+ }
8623
8670
  if (this.opts.prefetchFiles && this.fileBlobStore) this._prefetchDocFiles(docId, childProvider.document).catch(() => null);
8624
8671
  if (!alreadyCached) this.rootProvider.unloadChild(docId);
8625
8672
  return {
@@ -8649,6 +8696,15 @@ var BackgroundSyncManager = class extends EventEmitter {
8649
8696
  try {
8650
8697
  await childProvider.ready;
8651
8698
  await this._waitForSynced(childProvider);
8699
+ {
8700
+ const treeEntry = this.rootProvider.document.getMap("doc-tree").get(docId);
8701
+ this.emit("docSynced", {
8702
+ docId,
8703
+ document: childDoc,
8704
+ label: treeEntry?.label ?? "",
8705
+ meta: treeEntry?.meta
8706
+ });
8707
+ }
8652
8708
  if (this.opts.prefetchFiles && this.fileBlobStore) this._prefetchDocFiles(docId, childDoc).catch(() => null);
8653
8709
  return {
8654
8710
  docId,