@abraca/dabra 0.7.0 → 0.9.0

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.
@@ -2267,7 +2267,15 @@ var AbracadabraProvider = class AbracadabraProvider extends AbracadabraBaseProvi
2267
2267
  }
2268
2268
  authenticatedHandler(scope) {
2269
2269
  super.authenticatedHandler(scope);
2270
- this.effectiveRole = scope === "read-write" ? "editor" : "viewer";
2270
+ this.effectiveRole = {
2271
+ service: "service",
2272
+ admin: "admin",
2273
+ owner: "owner",
2274
+ editor: "editor",
2275
+ viewer: "viewer",
2276
+ "read-write": "editor",
2277
+ readonly: "viewer"
2278
+ }[scope] ?? "viewer";
2271
2279
  this.offlineStore?.savePermissionSnapshot(this.effectiveRole);
2272
2280
  }
2273
2281
  /**
@@ -2322,7 +2330,7 @@ var AbracadabraProvider = class AbracadabraProvider extends AbracadabraBaseProvi
2322
2330
  if (role && !this.effectiveRole) this.effectiveRole = role;
2323
2331
  }
2324
2332
  get canWrite() {
2325
- return this.effectiveRole === "owner" || this.effectiveRole === "editor";
2333
+ return this.effectiveRole != null && this.effectiveRole !== "viewer";
2326
2334
  }
2327
2335
  /** The AbracadabraClient instance for REST API access, if configured. */
2328
2336
  get client() {
@@ -2532,7 +2540,8 @@ var AbracadabraClient = class {
2532
2540
  identityPublicKey: opts.publicKey,
2533
2541
  deviceName: opts.deviceName,
2534
2542
  displayName: opts.displayName,
2535
- email: opts.email
2543
+ email: opts.email,
2544
+ inviteCode: opts.inviteCode
2536
2545
  },
2537
2546
  auth: false
2538
2547
  });
@@ -2698,6 +2707,22 @@ var AbracadabraClient = class {
2698
2707
  await this.request("DELETE", `/docs/${encodeURIComponent(docId)}/uploads/${encodeURIComponent(uploadId)}`);
2699
2708
  if (this.cache) await this.cache.invalidateUploads(docId).catch(() => null);
2700
2709
  }
2710
+ /** Create an invite code (requires permission per server config). */
2711
+ async createInvite(opts) {
2712
+ return this.request("POST", "/invites", { body: opts ?? {} });
2713
+ }
2714
+ /** List invite codes visible to the current user. */
2715
+ async listInvites() {
2716
+ return (await this.request("GET", "/invites")).invites;
2717
+ }
2718
+ /** Revoke an invite by its code. */
2719
+ async revokeInvite(code) {
2720
+ await this.request("DELETE", `/invites/${encodeURIComponent(code)}`);
2721
+ }
2722
+ /** Redeem an invite code for the currently authenticated user. */
2723
+ async redeemInvite(code) {
2724
+ await this.request("POST", "/invites/redeem", { body: { code } });
2725
+ }
2701
2726
  /** Health check — no auth required. */
2702
2727
  async health() {
2703
2728
  return this.request("GET", "/health", { auth: false });