@powerhousedao/reactor-browser 1.8.2 → 1.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.
- package/dist/context/read-mode.js +22 -22
- package/dist/crypto/browser.js +10 -10
- package/dist/hooks/useConnectCrypto.js +6 -6
- package/dist/hooks/useDocumentDispatch.js +13 -13
- package/package.json +13 -13
|
@@ -9,7 +9,7 @@ import { useUserPermissions as S } from "../hooks/useUserPermissions.js";
|
|
|
9
9
|
import "document-model/document";
|
|
10
10
|
import "../hooks/useConnectCrypto.js";
|
|
11
11
|
import "../hooks/useDocumentDrives.js";
|
|
12
|
-
var j = Object.defineProperty, _ = Object.getOwnPropertyDescriptor,
|
|
12
|
+
var j = Object.defineProperty, _ = Object.getOwnPropertyDescriptor, d = (t, e, r, o) => {
|
|
13
13
|
for (var s = _(e, r), c = t.length - 1, v; c >= 0; c--)
|
|
14
14
|
(v = t[c]) && (s = v(e, r, s) || s);
|
|
15
15
|
return s && j(e, r, s), s;
|
|
@@ -17,7 +17,7 @@ var j = Object.defineProperty, _ = Object.getOwnPropertyDescriptor, a = (t, e, r
|
|
|
17
17
|
const D = {
|
|
18
18
|
error: console.error
|
|
19
19
|
};
|
|
20
|
-
function
|
|
20
|
+
function a(t, e, r) {
|
|
21
21
|
const o = r.value;
|
|
22
22
|
r.value = function(...s) {
|
|
23
23
|
if (!this.server)
|
|
@@ -75,35 +75,35 @@ class n {
|
|
|
75
75
|
}
|
|
76
76
|
/* eslint-enable @typescript-eslint/no-non-null-assertion */
|
|
77
77
|
}
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
d([
|
|
79
|
+
a
|
|
80
80
|
], n.prototype, "migrateReadDrive");
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
d([
|
|
82
|
+
a
|
|
83
83
|
], n.prototype, "addReadDrive");
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
d([
|
|
85
|
+
a
|
|
86
86
|
], n.prototype, "getReadDrives");
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
d([
|
|
88
|
+
a
|
|
89
89
|
], n.prototype, "getReadDriveBySlug");
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
d([
|
|
91
|
+
a
|
|
92
92
|
], n.prototype, "getReadDrive");
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
d([
|
|
94
|
+
a
|
|
95
95
|
], n.prototype, "getReadDriveContext");
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
d([
|
|
97
|
+
a
|
|
98
98
|
], n.prototype, "fetchDrive");
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
d([
|
|
100
|
+
a
|
|
101
101
|
], n.prototype, "fetchDocument");
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
d([
|
|
103
|
+
a
|
|
104
104
|
], n.prototype, "deleteReadDrive");
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
d([
|
|
106
|
+
a
|
|
107
107
|
], n.prototype, "onReadDrivesUpdate");
|
|
108
108
|
const p = new n(), P = A({
|
|
109
109
|
...p,
|
package/dist/crypto/browser.js
CHANGED
|
@@ -2,21 +2,21 @@ var E = (s) => {
|
|
|
2
2
|
throw TypeError(s);
|
|
3
3
|
};
|
|
4
4
|
var b = (s, e, t) => e.has(s) || E("Cannot " + t);
|
|
5
|
-
var
|
|
5
|
+
var o = (s, e, t) => (b(s, e, "read from private field"), t ? t.call(s) : e.get(s)), a = (s, e, t) => e.has(s) ? E("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(s) : e.set(s, t), h = (s, e, t, r) => (b(s, e, "write to private field"), r ? r.call(s, t) : e.set(s, t), t), p = (s, e, t) => (b(s, e, "access private method"), t);
|
|
6
6
|
var l, c, y, i, u, w;
|
|
7
|
-
const
|
|
7
|
+
const n = class n {
|
|
8
8
|
constructor() {
|
|
9
9
|
a(this, u);
|
|
10
10
|
a(this, i);
|
|
11
11
|
h(this, i, new Promise((e, t) => {
|
|
12
|
-
const r = indexedDB.open(n
|
|
12
|
+
const r = indexedDB.open(o(n, l), 1);
|
|
13
13
|
r.onupgradeneeded = () => {
|
|
14
|
-
r.result.createObjectStore(n
|
|
14
|
+
r.result.createObjectStore(o(n, c));
|
|
15
15
|
}, r.onsuccess = () => e(r.result), r.onerror = () => t(r.error);
|
|
16
16
|
}));
|
|
17
17
|
}
|
|
18
18
|
async saveKeyPair(e) {
|
|
19
|
-
const r = (await p(this, u, w).call(this)).put(e, n
|
|
19
|
+
const r = (await p(this, u, w).call(this)).put(e, o(n, y));
|
|
20
20
|
return new Promise((d, P) => {
|
|
21
21
|
r.onsuccess = () => {
|
|
22
22
|
d();
|
|
@@ -38,12 +38,12 @@ const o = class o {
|
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
40
|
l = new WeakMap(), c = new WeakMap(), y = new WeakMap(), i = new WeakMap(), u = new WeakSet(), w = async function(e = "readwrite") {
|
|
41
|
-
return (await
|
|
42
|
-
n
|
|
41
|
+
return (await o(this, i)).transaction(
|
|
42
|
+
o(n, c),
|
|
43
43
|
e
|
|
44
|
-
).objectStore(n
|
|
45
|
-
}, a(
|
|
46
|
-
let k =
|
|
44
|
+
).objectStore(o(n, c));
|
|
45
|
+
}, a(n, l, "browserKeyDB"), a(n, c, "keyPairs"), a(n, y, "keyPair");
|
|
46
|
+
let k = n;
|
|
47
47
|
export {
|
|
48
48
|
k as BrowserKeyStorage
|
|
49
49
|
};
|
|
@@ -2,7 +2,7 @@ import { atom as e, useAtom as c } from "jotai";
|
|
|
2
2
|
import { useMemo as i, useEffect as s } from "react";
|
|
3
3
|
import { ConnectCrypto as a } from "../crypto/index.js";
|
|
4
4
|
import { BrowserKeyStorage as d } from "../crypto/browser.js";
|
|
5
|
-
const
|
|
5
|
+
const n = (async () => {
|
|
6
6
|
const t = new a(new d());
|
|
7
7
|
return await t.did(), t;
|
|
8
8
|
})();
|
|
@@ -10,21 +10,21 @@ function w() {
|
|
|
10
10
|
return i(
|
|
11
11
|
() => ({
|
|
12
12
|
async regenerateDid() {
|
|
13
|
-
return (await
|
|
13
|
+
return (await n).regenerateDid();
|
|
14
14
|
},
|
|
15
15
|
async did() {
|
|
16
|
-
return (await
|
|
16
|
+
return (await n).did();
|
|
17
17
|
},
|
|
18
|
-
sign: async (t) => await (await
|
|
18
|
+
sign: async (t) => await (await n).sign(t)
|
|
19
19
|
}),
|
|
20
20
|
[]
|
|
21
21
|
);
|
|
22
22
|
}
|
|
23
23
|
const p = e(void 0);
|
|
24
24
|
function C() {
|
|
25
|
-
const [t,
|
|
25
|
+
const [t, o] = c(p);
|
|
26
26
|
return s(() => {
|
|
27
|
-
t ||
|
|
27
|
+
t || n.then((r) => r.did()).then((r) => o(r)).catch(console.error);
|
|
28
28
|
}), t;
|
|
29
29
|
}
|
|
30
30
|
export {
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
function c(u,
|
|
3
|
-
const [m, f] =
|
|
1
|
+
import { useState as S, useEffect as x } from "react";
|
|
2
|
+
function c(u, o, g = console.error) {
|
|
3
|
+
const [m, f] = S(o), [D, h] = S(), i = (s) => {
|
|
4
4
|
h(s), g(s);
|
|
5
5
|
};
|
|
6
6
|
return x(() => {
|
|
7
|
-
f(
|
|
8
|
-
}, [
|
|
9
|
-
h(void 0), f((
|
|
10
|
-
if (!u || !
|
|
7
|
+
f(o);
|
|
8
|
+
}, [o]), [m, (s, r, e) => {
|
|
9
|
+
h(void 0), f((n) => {
|
|
10
|
+
if (!u || !n) return n;
|
|
11
11
|
try {
|
|
12
|
-
const t = u(
|
|
12
|
+
const t = u(n, s), v = s.scope ?? "global", d = t.operations[v], p = d[d.length - 1];
|
|
13
13
|
if (p.error) {
|
|
14
|
-
const
|
|
15
|
-
i(
|
|
14
|
+
const w = new Error(p.error);
|
|
15
|
+
i(w), e == null || e(w);
|
|
16
16
|
}
|
|
17
17
|
return r == null || r(p, {
|
|
18
|
-
prevState: { ...
|
|
18
|
+
prevState: { ...n },
|
|
19
19
|
newState: { ...t }
|
|
20
20
|
}), t;
|
|
21
21
|
} catch (t) {
|
|
22
|
-
return i(t), e == null || e(t),
|
|
22
|
+
return i(t), e == null || e(t), n;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
|
-
},
|
|
25
|
+
}, D];
|
|
26
26
|
}
|
|
27
27
|
export {
|
|
28
28
|
c as useDocumentDispatch
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerhousedao/reactor-browser",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"license": "AGPL-3.0-only",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -18,22 +18,22 @@
|
|
|
18
18
|
"@types/react-dom": "^18.3.1",
|
|
19
19
|
"react": "^18.3.1",
|
|
20
20
|
"react-dom": "^18.3.1",
|
|
21
|
-
"@powerhousedao/config": "1.
|
|
22
|
-
"@powerhousedao/design-system": "1.
|
|
23
|
-
"@powerhousedao/scalars": "1.
|
|
24
|
-
"document-drive": "1.
|
|
25
|
-
"document-model": "2.
|
|
26
|
-
"document-model-libs": "1.
|
|
21
|
+
"@powerhousedao/config": "1.16.0",
|
|
22
|
+
"@powerhousedao/design-system": "1.23.0",
|
|
23
|
+
"@powerhousedao/scalars": "1.22.0",
|
|
24
|
+
"document-drive": "1.17.0",
|
|
25
|
+
"document-model": "2.19.0",
|
|
26
|
+
"document-model-libs": "1.131.0"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"react": "^18.3.1",
|
|
30
30
|
"react-dom": "^18.3.1",
|
|
31
|
-
"@powerhousedao/
|
|
32
|
-
"@powerhousedao/
|
|
33
|
-
"
|
|
34
|
-
"document-
|
|
35
|
-
"
|
|
36
|
-
"document-model-libs": "1.
|
|
31
|
+
"@powerhousedao/config": "1.16.0",
|
|
32
|
+
"@powerhousedao/design-system": "1.23.0",
|
|
33
|
+
"@powerhousedao/scalars": "1.22.0",
|
|
34
|
+
"document-drive": "1.17.0",
|
|
35
|
+
"document-model": "2.19.0",
|
|
36
|
+
"document-model-libs": "1.131.0"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"did-key-creator": "^1.2.0",
|