@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.
@@ -2835,9 +2835,10 @@ var AbracadabraProvider = class AbracadabraProvider extends AbracadabraBaseProvi
2835
2835
  owner: "owner",
2836
2836
  editor: "editor",
2837
2837
  viewer: "viewer",
2838
+ observer: "observer",
2838
2839
  "read-write": "editor",
2839
2840
  readonly: "viewer"
2840
- }[scope] ?? "viewer";
2841
+ }[scope] ?? "observer";
2841
2842
  this.offlineStore?.savePermissionSnapshot(this.effectiveRole);
2842
2843
  }
2843
2844
  /**
@@ -2892,7 +2893,10 @@ var AbracadabraProvider = class AbracadabraProvider extends AbracadabraBaseProvi
2892
2893
  if (role && !this.effectiveRole) this.effectiveRole = role;
2893
2894
  }
2894
2895
  get canWrite() {
2895
- return this.effectiveRole != null && this.effectiveRole !== "viewer";
2896
+ return this.effectiveRole != null && this.effectiveRole !== "viewer" && this.effectiveRole !== "observer";
2897
+ }
2898
+ get canAwareness() {
2899
+ return this.effectiveRole != null && this.effectiveRole !== "observer";
2896
2900
  }
2897
2901
  /** The AbracadabraClient instance for REST API access, if configured. */
2898
2902
  get client() {
@@ -3275,6 +3279,10 @@ var AbracadabraClient = class {
3275
3279
  async createChild(docId, opts) {
3276
3280
  return this.request("POST", `/docs/${encodeURIComponent(docId)}/children`, { body: opts ?? {} });
3277
3281
  }
3282
+ /** Broadcast a stateless message to all connected clients on a document (requires manage permission). */
3283
+ async broadcast(docId, payload) {
3284
+ await this.request("POST", `/docs/${encodeURIComponent(docId)}/broadcast`, { body: { payload } });
3285
+ }
3278
3286
  /** List all permissions for a document (requires read access). */
3279
3287
  async listPermissions(docId) {
3280
3288
  if (this.cache) {
@@ -3390,6 +3398,26 @@ var AbracadabraClient = class {
3390
3398
  async deleteSpace(spaceId) {
3391
3399
  await this.request("DELETE", `/spaces/${encodeURIComponent(spaceId)}`);
3392
3400
  }
3401
+ /** List all users (requires elevated role: admin or service). */
3402
+ async adminListUsers() {
3403
+ return this.request("GET", "/admin/users");
3404
+ }
3405
+ /** Promote a user to admin (requires service role). */
3406
+ async adminPromote(userId) {
3407
+ await this.request("POST", `/admin/users/${encodeURIComponent(userId)}/admin`);
3408
+ }
3409
+ /** Demote an admin user back to regular (requires service role). */
3410
+ async adminDemote(userId) {
3411
+ await this.request("DELETE", `/admin/users/${encodeURIComponent(userId)}/admin`);
3412
+ }
3413
+ /** Sweep orphaned file blobs from storage (requires elevated role). */
3414
+ async adminStorageSweep() {
3415
+ return this.request("POST", "/admin/storage/sweep");
3416
+ }
3417
+ /** Repair blob ref-counts and sweep orphans (requires elevated role). */
3418
+ async adminStorageRepair() {
3419
+ return this.request("POST", "/admin/storage/repair");
3420
+ }
3393
3421
  /** Health check — no auth required. */
3394
3422
  async health() {
3395
3423
  return this.request("GET", "/health", { auth: false });