monoidentity 0.10.0 → 0.10.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.
@@ -8,7 +8,7 @@ const unprefixed = (key) => {
8
8
  };
9
9
  export const createLocalStorage = () => createStore({
10
10
  has(key) {
11
- return typeof key == "string" && localStorage[prefixed(key)] !== null;
11
+ return typeof key == "string" && localStorage[prefixed(key)] !== undefined;
12
12
  },
13
13
  get(key) {
14
14
  if (typeof key != "string")
@@ -1,27 +1,22 @@
1
1
  import {} from "./createstore.js";
2
2
  import { wrapWithReplay } from "./_replay.js";
3
3
  import { canBackup } from "../utils-transport.js";
4
- import { openDB } from "idb";
4
+ import { get, set, createStore } from "idb-keyval";
5
5
  export const wrapBackup = (storage, requestBackup) => {
6
6
  if (!canBackup)
7
7
  return storage;
8
8
  if (localStorage["monoidentity-x/backup"] == "off")
9
9
  return storage;
10
10
  const { proxy, flush, setTransmit, load } = wrapWithReplay(storage);
11
+ const store = createStore("monoidentity-x", "handles");
11
12
  const getDir = async () => {
12
- const db = await openDB("monoidentity-x");
13
- const handle = (await db.get("handles", "backup"));
13
+ const handle = await get("backup", store);
14
14
  if (!handle)
15
15
  throw new Error("No backup handle found");
16
16
  return handle;
17
17
  };
18
18
  const setDir = async (dir) => {
19
- const db = await openDB("monoidentity-x", 1, {
20
- upgrade(db) {
21
- db.createObjectStore("handles");
22
- },
23
- });
24
- await db.put("handles", dir, "backup");
19
+ await set("backup", dir, store);
25
20
  };
26
21
  const init = async (dir) => {
27
22
  let dirCache = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monoidentity",
3
- "version": "0.10.0",
3
+ "version": "0.10.2",
4
4
  "repository": "KTibow/monoidentity",
5
5
  "author": {
6
6
  "name": "KTibow"
@@ -32,8 +32,9 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@tsndr/cloudflare-worker-jwt": "^3.2.0",
35
+ "aws4fetch": "^1.0.20",
35
36
  "devalue": "^5.3.2",
36
- "idb": "^8.0.3",
37
+ "idb-keyval": "^6.2.2",
37
38
  "valibot": "^1.1.0"
38
39
  },
39
40
  "devDependencies": {
@@ -42,7 +43,6 @@
42
43
  "@sveltejs/package": "^2.5.4",
43
44
  "@sveltejs/vite-plugin-svelte": "^6.2.1",
44
45
  "@types/wicg-file-system-access": "^2023.10.6",
45
- "aws4fetch": "^1.0.20",
46
46
  "fast-xml-parser": "^5.2.5",
47
47
  "knip": "^5.64.1",
48
48
  "monoserve": "^2.2.0",