@abraca/dabra 1.0.16 → 1.0.17

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.
@@ -2865,9 +2865,10 @@ var AbracadabraProvider = class AbracadabraProvider extends AbracadabraBaseProvi
2865
2865
  owner: "owner",
2866
2866
  editor: "editor",
2867
2867
  viewer: "viewer",
2868
+ observer: "observer",
2868
2869
  "read-write": "editor",
2869
2870
  readonly: "viewer"
2870
- }[scope] ?? "viewer";
2871
+ }[scope] ?? "observer";
2871
2872
  this.offlineStore?.savePermissionSnapshot(this.effectiveRole);
2872
2873
  }
2873
2874
  /**
@@ -2922,7 +2923,10 @@ var AbracadabraProvider = class AbracadabraProvider extends AbracadabraBaseProvi
2922
2923
  if (role && !this.effectiveRole) this.effectiveRole = role;
2923
2924
  }
2924
2925
  get canWrite() {
2925
- return this.effectiveRole != null && this.effectiveRole !== "viewer";
2926
+ return this.effectiveRole != null && this.effectiveRole !== "viewer" && this.effectiveRole !== "observer";
2927
+ }
2928
+ get canAwareness() {
2929
+ return this.effectiveRole != null && this.effectiveRole !== "observer";
2926
2930
  }
2927
2931
  /** The AbracadabraClient instance for REST API access, if configured. */
2928
2932
  get client() {
@@ -3305,6 +3309,10 @@ var AbracadabraClient = class {
3305
3309
  async createChild(docId, opts) {
3306
3310
  return this.request("POST", `/docs/${encodeURIComponent(docId)}/children`, { body: opts ?? {} });
3307
3311
  }
3312
+ /** Broadcast a stateless message to all connected clients on a document (requires manage permission). */
3313
+ async broadcast(docId, payload) {
3314
+ await this.request("POST", `/docs/${encodeURIComponent(docId)}/broadcast`, { body: { payload } });
3315
+ }
3308
3316
  /** List all permissions for a document (requires read access). */
3309
3317
  async listPermissions(docId) {
3310
3318
  if (this.cache) {
@@ -3420,6 +3428,26 @@ var AbracadabraClient = class {
3420
3428
  async deleteSpace(spaceId) {
3421
3429
  await this.request("DELETE", `/spaces/${encodeURIComponent(spaceId)}`);
3422
3430
  }
3431
+ /** List all users (requires elevated role: admin or service). */
3432
+ async adminListUsers() {
3433
+ return this.request("GET", "/admin/users");
3434
+ }
3435
+ /** Promote a user to admin (requires service role). */
3436
+ async adminPromote(userId) {
3437
+ await this.request("POST", `/admin/users/${encodeURIComponent(userId)}/admin`);
3438
+ }
3439
+ /** Demote an admin user back to regular (requires service role). */
3440
+ async adminDemote(userId) {
3441
+ await this.request("DELETE", `/admin/users/${encodeURIComponent(userId)}/admin`);
3442
+ }
3443
+ /** Sweep orphaned file blobs from storage (requires elevated role). */
3444
+ async adminStorageSweep() {
3445
+ return this.request("POST", "/admin/storage/sweep");
3446
+ }
3447
+ /** Repair blob ref-counts and sweep orphans (requires elevated role). */
3448
+ async adminStorageRepair() {
3449
+ return this.request("POST", "/admin/storage/repair");
3450
+ }
3423
3451
  /** Health check — no auth required. */
3424
3452
  async health() {
3425
3453
  return this.request("GET", "/health", { auth: false });