@abraca/dabra 1.1.0 → 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.
package/dist/index.d.ts CHANGED
@@ -434,22 +434,57 @@ declare class AbracadabraClient {
434
434
  revokeInvite(code: string): Promise<void>;
435
435
  /** Redeem an invite code for the currently authenticated user. */
436
436
  redeemInvite(code: string): Promise<void>;
437
- /** List spaces visible to the caller. No auth required for public spaces. */
437
+ /** List root documents (replaces listSpaces for new code). */
438
+ listRootDocuments(): Promise<DocumentMeta[]>;
439
+ /** Get the hub document, or null if none is configured. */
440
+ getHubDocument(): Promise<DocumentMeta | null>;
441
+ /** Set the public_access level for a document. Pass null to inherit from parent. */
442
+ setDocumentAccess(docId: string, publicAccess: string | null): Promise<void>;
443
+ /** Get the public_access info for a document. */
444
+ getDocumentAccess(docId: string): Promise<{
445
+ public_access: string | null;
446
+ effective_public_access: string | null;
447
+ }>;
448
+ /** Update document metadata (label, description, is_hub). Requires manage permission. */
449
+ updateDocumentMeta(docId: string, opts: {
450
+ label?: string;
451
+ description?: string | null;
452
+ is_hub?: boolean;
453
+ }): Promise<void>;
454
+ /**
455
+ * List spaces visible to the caller. No auth required for public spaces.
456
+ * @deprecated Use {@link listRootDocuments} instead.
457
+ */
438
458
  listSpaces(): Promise<SpaceMeta[]>;
439
- /** Get a single space by ID. */
459
+ /**
460
+ * Get a single space by ID.
461
+ * @deprecated Use {@link getDoc} instead.
462
+ */
440
463
  getSpace(spaceId: string): Promise<SpaceMeta>;
441
- /** Get the hub space, or null if none is configured. */
464
+ /**
465
+ * Get the hub space, or null if none is configured.
466
+ * @deprecated Use {@link getHubDocument} instead.
467
+ */
442
468
  getHubSpace(): Promise<SpaceMeta | null>;
443
- /** Create a new space (auth required). */
469
+ /**
470
+ * Create a new space (auth required).
471
+ * @deprecated Use {@link createDoc} + {@link updateDocumentMeta} instead.
472
+ */
444
473
  createSpace(opts: {
445
474
  name: string;
446
475
  description?: string;
447
476
  visibility?: SpaceMeta["visibility"];
448
477
  id?: string;
449
478
  }): Promise<SpaceMeta>;
450
- /** Update an existing space (Owner or admin required). */
479
+ /**
480
+ * Update an existing space (Owner or admin required).
481
+ * @deprecated Use {@link updateDocumentMeta} + {@link setDocumentAccess} instead.
482
+ */
451
483
  updateSpace(spaceId: string, opts: Partial<Pick<SpaceMeta, "name" | "description" | "visibility" | "is_hub">>): Promise<SpaceMeta>;
452
- /** Delete a space and its root document (Owner or admin required). */
484
+ /**
485
+ * Delete a space and its root document (Owner or admin required).
486
+ * @deprecated Use {@link deleteDoc} instead.
487
+ */
453
488
  deleteSpace(spaceId: string): Promise<void>;
454
489
  /** List all users (requires elevated role: admin or service). */
455
490
  adminListUsers(): Promise<{
@@ -1025,6 +1060,11 @@ interface DocumentMeta {
1025
1060
  parent_id: string | null;
1026
1061
  doc_type?: string | null;
1027
1062
  label?: string | null;
1063
+ description?: string | null;
1064
+ public_access?: string | null;
1065
+ owner_id?: string | null;
1066
+ is_hub?: boolean;
1067
+ updated_at?: number | null;
1028
1068
  }
1029
1069
  interface UploadMeta {
1030
1070
  id: string;
@@ -1107,6 +1147,7 @@ interface SpaceMeta {
1107
1147
  owner_id: string | null;
1108
1148
  created_at: number;
1109
1149
  updated_at: number;
1150
+ public_access?: string | null;
1110
1151
  }
1111
1152
  interface InviteRow {
1112
1153
  code: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abraca/dabra",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "abracadabra provider",
5
5
  "keywords": [
6
6
  "abracadabra",
@@ -543,25 +543,70 @@ export class AbracadabraClient {
543
543
  await this.request("POST", "/invites/redeem", { body: { code } });
544
544
  }
545
545
 
546
- // ── Spaces ───────────────────────────────────────────────────────────────
546
+ // ── Document Access & Discovery ──────────────────────────────────────────
547
547
 
548
- /** List spaces visible to the caller. No auth required for public spaces. */
548
+ /** List root documents (replaces listSpaces for new code). */
549
+ async listRootDocuments(): Promise<DocumentMeta[]> {
550
+ const res = await this.request<{ documents: DocumentMeta[] }>("GET", "/docs?root=true");
551
+ return res.documents;
552
+ }
553
+
554
+ /** Get the hub document, or null if none is configured. */
555
+ async getHubDocument(): Promise<DocumentMeta | null> {
556
+ return this.requestOrNull<DocumentMeta>("GET", "/docs/hub");
557
+ }
558
+
559
+ /** Set the public_access level for a document. Pass null to inherit from parent. */
560
+ async setDocumentAccess(docId: string, publicAccess: string | null): Promise<void> {
561
+ await this.request("PATCH", `/docs/${encodeURIComponent(docId)}/access`, {
562
+ body: { public_access: publicAccess },
563
+ });
564
+ }
565
+
566
+ /** Get the public_access info for a document. */
567
+ async getDocumentAccess(docId: string): Promise<{ public_access: string | null; effective_public_access: string | null }> {
568
+ return this.request("GET", `/docs/${encodeURIComponent(docId)}/access`);
569
+ }
570
+
571
+ /** Update document metadata (label, description, is_hub). Requires manage permission. */
572
+ async updateDocumentMeta(
573
+ docId: string,
574
+ opts: { label?: string; description?: string | null; is_hub?: boolean },
575
+ ): Promise<void> {
576
+ await this.request("PATCH", `/docs/${encodeURIComponent(docId)}`, { body: opts });
577
+ }
578
+
579
+ // ── Spaces (deprecated — use document-based methods) ─────────────────────
580
+
581
+ /**
582
+ * List spaces visible to the caller. No auth required for public spaces.
583
+ * @deprecated Use {@link listRootDocuments} instead.
584
+ */
549
585
  async listSpaces(): Promise<SpaceMeta[]> {
550
586
  const res = await this.request<{ spaces: SpaceMeta[] }>("GET", "/spaces", { auth: false });
551
587
  return res.spaces;
552
588
  }
553
589
 
554
- /** Get a single space by ID. */
590
+ /**
591
+ * Get a single space by ID.
592
+ * @deprecated Use {@link getDoc} instead.
593
+ */
555
594
  async getSpace(spaceId: string): Promise<SpaceMeta> {
556
595
  return this.request<SpaceMeta>("GET", `/spaces/${encodeURIComponent(spaceId)}`, { auth: false });
557
596
  }
558
597
 
559
- /** Get the hub space, or null if none is configured. */
598
+ /**
599
+ * Get the hub space, or null if none is configured.
600
+ * @deprecated Use {@link getHubDocument} instead.
601
+ */
560
602
  async getHubSpace(): Promise<SpaceMeta | null> {
561
603
  return this.requestOrNull<SpaceMeta>("GET", "/spaces/hub", { auth: false });
562
604
  }
563
605
 
564
- /** Create a new space (auth required). */
606
+ /**
607
+ * Create a new space (auth required).
608
+ * @deprecated Use {@link createDoc} + {@link updateDocumentMeta} instead.
609
+ */
565
610
  async createSpace(opts: {
566
611
  name: string;
567
612
  description?: string;
@@ -571,7 +616,10 @@ export class AbracadabraClient {
571
616
  return this.request<SpaceMeta>("POST", "/spaces", { body: opts });
572
617
  }
573
618
 
574
- /** Update an existing space (Owner or admin required). */
619
+ /**
620
+ * Update an existing space (Owner or admin required).
621
+ * @deprecated Use {@link updateDocumentMeta} + {@link setDocumentAccess} instead.
622
+ */
575
623
  async updateSpace(
576
624
  spaceId: string,
577
625
  opts: Partial<Pick<SpaceMeta, "name" | "description" | "visibility" | "is_hub">>,
@@ -579,7 +627,10 @@ export class AbracadabraClient {
579
627
  return this.request<SpaceMeta>("PATCH", `/spaces/${encodeURIComponent(spaceId)}`, { body: opts });
580
628
  }
581
629
 
582
- /** Delete a space and its root document (Owner or admin required). */
630
+ /**
631
+ * Delete a space and its root document (Owner or admin required).
632
+ * @deprecated Use {@link deleteDoc} instead.
633
+ */
583
634
  async deleteSpace(spaceId: string): Promise<void> {
584
635
  await this.request("DELETE", `/spaces/${encodeURIComponent(spaceId)}`);
585
636
  }
package/src/types.ts CHANGED
@@ -175,6 +175,11 @@ export interface DocumentMeta {
175
175
  parent_id: string | null;
176
176
  doc_type?: string | null;
177
177
  label?: string | null;
178
+ description?: string | null;
179
+ public_access?: string | null;
180
+ owner_id?: string | null;
181
+ is_hub?: boolean;
182
+ updated_at?: number | null;
178
183
  }
179
184
 
180
185
  export interface UploadMeta {
@@ -268,6 +273,7 @@ export interface SpaceMeta {
268
273
  owner_id: string | null;
269
274
  created_at: number;
270
275
  updated_at: number;
276
+ public_access?: string | null;
271
277
  }
272
278
 
273
279
  // ── Invites ──────────────────────────────────────────────────────────────────