@abraca/dabra 1.0.0 → 1.0.2

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.
@@ -3325,6 +3325,35 @@ var AbracadabraClient = class {
3325
3325
  async redeemInvite(code) {
3326
3326
  await this.request("POST", "/invites/redeem", { body: { code } });
3327
3327
  }
3328
+ /** List spaces visible to the caller. No auth required for public spaces. */
3329
+ async listSpaces() {
3330
+ return (await this.request("GET", "/spaces", { auth: false })).spaces;
3331
+ }
3332
+ /** Get a single space by ID. */
3333
+ async getSpace(spaceId) {
3334
+ return this.request("GET", `/spaces/${encodeURIComponent(spaceId)}`, { auth: false });
3335
+ }
3336
+ /** Get the hub space, or null if none is configured. */
3337
+ async getHubSpace() {
3338
+ try {
3339
+ return await this.request("GET", "/spaces/hub", { auth: false });
3340
+ } catch (e) {
3341
+ if (typeof e === "object" && e !== null && "status" in e && e.status === 404) return null;
3342
+ throw e;
3343
+ }
3344
+ }
3345
+ /** Create a new space (auth required). */
3346
+ async createSpace(opts) {
3347
+ return this.request("POST", "/spaces", { body: opts });
3348
+ }
3349
+ /** Update an existing space (Owner or admin required). */
3350
+ async updateSpace(spaceId, opts) {
3351
+ return this.request("PATCH", `/spaces/${encodeURIComponent(spaceId)}`, { body: opts });
3352
+ }
3353
+ /** Delete a space and its root document (Owner or admin required). */
3354
+ async deleteSpace(spaceId) {
3355
+ await this.request("DELETE", `/spaces/${encodeURIComponent(spaceId)}`);
3356
+ }
3328
3357
  /** Health check — no auth required. */
3329
3358
  async health() {
3330
3359
  return this.request("GET", "/health", { auth: false });
@@ -7501,6 +7530,30 @@ var FileBlobStore = class extends EventEmitter {
7501
7530
  this.objectUrls.set(key, url);
7502
7531
  return url;
7503
7532
  }
7533
+ /**
7534
+ * Store a blob directly into the cache under the given (docId, uploadId) key
7535
+ * and return its object URL. Use this to pre-populate the cache for files
7536
+ * that haven't been uploaded to the server yet (e.g. offline upload queue).
7537
+ */
7538
+ async putBlob(docId, uploadId, blob, filename) {
7539
+ if (typeof window === "undefined") return URL.createObjectURL(blob);
7540
+ const key = this.blobKey(docId, uploadId);
7541
+ const existing = this.objectUrls.get(key);
7542
+ if (existing) return existing;
7543
+ const db = await this.getDb();
7544
+ if (db) {
7545
+ const entry = {
7546
+ blob,
7547
+ mime_type: blob.type || "application/octet-stream",
7548
+ filename,
7549
+ cachedAt: Date.now()
7550
+ };
7551
+ db.transaction("blobs", "readwrite").objectStore("blobs").put(entry, key);
7552
+ }
7553
+ const url = URL.createObjectURL(blob);
7554
+ this.objectUrls.set(key, url);
7555
+ return url;
7556
+ }
7504
7557
  /** Revoke the object URL and remove the blob from cache. */
7505
7558
  async evictBlob(docId, uploadId) {
7506
7559
  const key = this.blobKey(docId, uploadId);