@interncom/diplomatic 0.0.35 → 0.0.36

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.
Files changed (2) hide show
  1. package/dist/index.mjs +17 -10
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -501,18 +501,21 @@ var IDBStore = class {
501
501
  await db.put("metaKV", str, "lastFetchedAt");
502
502
  }
503
503
  enqueueUpload = async (sha256, cipherOp) => {
504
- await db.put("uploadQueue", { sha256, cipherOp });
504
+ const hex = btoh(sha256);
505
+ await db.put("uploadQueue", { sha256: hex, cipherOp });
505
506
  };
506
507
  dequeueUpload = async (sha256) => {
507
- await db.delete("uploadQueue", sha256);
508
+ const hex = btoh(sha256);
509
+ await db.delete("uploadQueue", hex);
508
510
  };
509
511
  peekUpload = async (sha256) => {
510
- const row = await db.get("uploadQueue", sha256);
512
+ const hex = btoh(sha256);
513
+ const row = await db.get("uploadQueue", hex);
511
514
  return row?.cipherOp;
512
515
  };
513
516
  listUploads = async () => {
514
- const sha256s = await db.getAllKeys("uploadQueue");
515
- return sha256s;
517
+ const hexes = await db.getAllKeys("uploadQueue");
518
+ return hexes.map(htob);
516
519
  };
517
520
  numUploads = async () => {
518
521
  const num = await db.count("uploadQueue");
@@ -520,24 +523,28 @@ var IDBStore = class {
520
523
  };
521
524
  downloadQueue = /* @__PURE__ */ new Set();
522
525
  enqueueDownload = async (sha256, recordedAt) => {
523
- await db.put("downloadQueue", { sha256, recordedAt });
526
+ const hex = btoh(sha256);
527
+ await db.put("downloadQueue", { sha256: hex, recordedAt });
524
528
  };
525
529
  dequeueDownload = async (sha256) => {
526
- await db.delete("downloadQueue", sha256);
530
+ const hex = btoh(sha256);
531
+ await db.delete("downloadQueue", hex);
527
532
  };
528
533
  listDownloads = async () => {
529
534
  const list = await db.getAll("downloadQueue");
530
- return list;
535
+ return list.map((item) => ({ sha256: htob(item.sha256), recordedAt: item.recordedAt }));
531
536
  };
532
537
  numDownloads = async () => {
533
538
  const num = await db.count("downloadQueue");
534
539
  return num;
535
540
  };
536
541
  storeOp = async (sha256, cipherOp) => {
537
- await db.put("ops", { sha256, cipherOp });
542
+ const hex = btoh(sha256);
543
+ await db.put("ops", { sha256: hex, cipherOp });
538
544
  };
539
545
  clearOp = async (sha256) => {
540
- await db.delete("ops", sha256);
546
+ const hex = btoh(sha256);
547
+ await db.delete("ops", hex);
541
548
  };
542
549
  };
543
550
  var idbStore = new IDBStore();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@interncom/diplomatic",
3
- "version": "0.0.35",
3
+ "version": "0.0.36",
4
4
  "type": "module",
5
5
  "description": "Secure sync layer",
6
6
  "main": "dist/index.mjs",