@powerhousedao/connect 1.0.8 → 1.0.10-dev.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/LICENSE +661 -0
- package/dist/.env +0 -5
- package/dist/assets/{app-D3TxLTK-.css → app-BIIVKAZr.css} +241 -60
- package/dist/assets/{app-Bw1Ba-jV.js → app-CsiwsM42.js} +2262 -1224
- package/dist/assets/{app-loader-KTD3Q6e9.js → app-loader-C7A2YjX4.js} +876 -577
- package/dist/assets/{app-loader-CjrEwupY.css → app-loader-pcztQTL4.css} +189 -26
- package/dist/assets/{ccip-D3HujWHr.js → ccip-BG1d6viz.js} +3 -3
- package/dist/assets/{content-D3TuBhK9.js → content-0UFgs2d1.js} +37 -7
- package/dist/assets/{index-DpasqVlD.js → index-BMDqhr-9.js} +3 -3
- package/dist/assets/{index-DsNVpRhT.js → index-CTEGX1We.js} +670 -519
- package/dist/assets/{index-yFk8X8m1.js → index-yr0-SqYf.js} +4 -4
- package/dist/assets/{main.CzEw2R-H.js → main.BmcV9296.js} +1 -1
- package/dist/assets/{style-D4JhTt_m.css → style-Ce3V83BE.css} +31 -36
- package/dist/external-packages.js +5 -0
- package/dist/hmr.js +4 -1
- package/dist/index.html +1 -4
- package/dist/modules/@powerhousedao/reactor-browser/{chunk-G6LMXRY5.js → chunk-2ONJ2PX4.js} +1 -1
- package/dist/modules/@powerhousedao/reactor-browser/{chunk-P46ZMPJ3.js → chunk-3C54663M.js} +1 -1
- package/dist/modules/@powerhousedao/reactor-browser/{chunk-6AXML2S3.js → chunk-5QJXNK35.js} +1 -1
- package/dist/modules/@powerhousedao/reactor-browser/{chunk-FW7N6EJH.js → chunk-C7QRY43M.js} +3 -3
- package/dist/modules/@powerhousedao/reactor-browser/{chunk-45DCPCA7.js → chunk-CO2RVWYY.js} +1 -1
- package/dist/modules/@powerhousedao/reactor-browser/{chunk-POMUCSTC.js → chunk-ISDEPHKP.js} +74 -20
- package/dist/modules/@powerhousedao/reactor-browser/{chunk-F3RCGUF6.js → chunk-NHD6VUCD.js} +2 -2
- package/dist/modules/@powerhousedao/reactor-browser/{chunk-YOX3ZAET.js → chunk-SQ5HIKYV.js} +581 -334
- package/dist/modules/@powerhousedao/reactor-browser/{chunk-M2UUQ5LH.js → chunk-U34SEKEB.js} +2 -2
- package/dist/modules/@powerhousedao/reactor-browser/{chunk-4LZZ55AN.js → chunk-XV42KZK3.js} +1 -1
- package/dist/modules/@powerhousedao/reactor-browser/context/index.js +2 -2
- package/dist/modules/@powerhousedao/reactor-browser/context/read-mode.js +2 -2
- package/dist/modules/@powerhousedao/reactor-browser/hooks/index.js +8 -8
- package/dist/modules/@powerhousedao/reactor-browser/hooks/useAddDebouncedOperations.js +3 -3
- package/dist/modules/@powerhousedao/reactor-browser/hooks/useConnectCrypto.js +2 -2
- package/dist/modules/@powerhousedao/reactor-browser/hooks/useDocumentDrives.js +2 -2
- package/dist/modules/@powerhousedao/reactor-browser/hooks/useDocumentEditor.js +5 -5
- package/dist/modules/@powerhousedao/reactor-browser/hooks/useDriveActions.js +2 -2
- package/dist/modules/@powerhousedao/reactor-browser/hooks/useDriveActionsWithUiNodes.js +3 -3
- package/dist/modules/@powerhousedao/reactor-browser/index.js +10 -10
- package/dist/modules/@powerhousedao/reactor-browser/reactor.js +2 -2
- package/dist/swEnv.js +0 -3
- package/dist/vite-envs.sh +1 -28
- package/package.json +9 -9
|
@@ -10,10 +10,10 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
|
|
|
10
10
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
11
11
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
12
12
|
var _DB_NAME, _STORE_NAME, _KEY, _db, _BrowserKeyStorage_instances, useStore_fn, _subtleCrypto, _keyPair, _keyPairStorage, _did, _ConnectCrypto_instances, initCrypto_fn, initialize_fn, parseDid_fn, generateECDSAKeyPair_fn, exportKeyPair_fn, importKeyPair_fn, _sign, _verify, _store, _namespace, _BaseStorage_instances, buildKey_fn, _baseUrl, _store2, _connectId, _eventEmitter, _Renown_instances, updateUser_fn, getCredential_fn;
|
|
13
|
-
import { _ as __vitePreload } from "./main.
|
|
14
|
-
import { aW as getAugmentedNamespace, $ as getDefaultExportFromCjs, ah as connectConfig, ac as logger } from "./app-loader-
|
|
15
|
-
import { e as eventsExports, R as RENOWN_URL, g as getEnsInfo } from "./app-
|
|
16
|
-
import { d, c, b, f, a, r, s } from "./app-
|
|
13
|
+
import { _ as __vitePreload } from "./main.BmcV9296.js";
|
|
14
|
+
import { aW as getAugmentedNamespace, $ as getDefaultExportFromCjs, ah as connectConfig, ac as logger } from "./app-loader-C7A2YjX4.js";
|
|
15
|
+
import { e as eventsExports, R as RENOWN_URL, g as getEnsInfo } from "./app-CsiwsM42.js";
|
|
16
|
+
import { d, c, b, f, a, r, s } from "./app-CsiwsM42.js";
|
|
17
17
|
import "react/jsx-runtime";
|
|
18
18
|
import "react";
|
|
19
19
|
import "@powerhousedao/reactor-browser";
|
|
@@ -99,7 +99,7 @@ const __vitePreload = function preload(baseModule, deps, importerUrl) {
|
|
|
99
99
|
return baseModule().catch(handlePreloadError);
|
|
100
100
|
});
|
|
101
101
|
};
|
|
102
|
-
__vitePreload(() => import("./index-
|
|
102
|
+
__vitePreload(() => import("./index-BMDqhr-9.js"), true ? [] : void 0);
|
|
103
103
|
export {
|
|
104
104
|
__vitePreload as _
|
|
105
105
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");
|
|
2
2
|
|
|
3
|
-
/*! tailwindcss v4.0.
|
|
3
|
+
/*! tailwindcss v4.0.17 | MIT License | https://tailwindcss.com */
|
|
4
4
|
:root {
|
|
5
5
|
--toastify-color-light: #fff;
|
|
6
6
|
--toastify-color-dark: #121212;
|
|
@@ -687,9 +687,6 @@
|
|
|
687
687
|
@layer theme, base, components, utilities;
|
|
688
688
|
@layer theme {
|
|
689
689
|
:root, :host {
|
|
690
|
-
--font-sans: "Inter", sans-serif;
|
|
691
|
-
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
|
|
692
|
-
"Courier New", monospace;
|
|
693
690
|
--color-red-800: hsl(5 81% 61%);
|
|
694
691
|
--color-red-900: hsl(5 81% 56%);
|
|
695
692
|
--color-slate-50: hsl(210 20% 96%);
|
|
@@ -721,18 +718,6 @@
|
|
|
721
718
|
--radius-3xl: 1.5rem;
|
|
722
719
|
--default-transition-duration: 150ms;
|
|
723
720
|
--default-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
724
|
-
--default-font-family: var(--font-sans);
|
|
725
|
-
--default-font-feature-settings: var(--font-sans--font-feature-settings);
|
|
726
|
-
--default-font-variation-settings: var(
|
|
727
|
-
--font-sans--font-variation-settings
|
|
728
|
-
);
|
|
729
|
-
--default-mono-font-family: var(--font-mono);
|
|
730
|
-
--default-mono-font-feature-settings: var(
|
|
731
|
-
--font-mono--font-feature-settings
|
|
732
|
-
);
|
|
733
|
-
--default-mono-font-variation-settings: var(
|
|
734
|
-
--font-mono--font-variation-settings
|
|
735
|
-
);
|
|
736
721
|
}
|
|
737
722
|
}
|
|
738
723
|
@layer base {
|
|
@@ -746,14 +731,11 @@
|
|
|
746
731
|
line-height: 1.5;
|
|
747
732
|
-webkit-text-size-adjust: 100%;
|
|
748
733
|
tab-size: 4;
|
|
749
|
-
font-family:
|
|
750
|
-
font-feature-settings:
|
|
751
|
-
font-variation-settings:
|
|
734
|
+
font-family: "Inter", sans-serif;
|
|
735
|
+
font-feature-settings: initial;
|
|
736
|
+
font-variation-settings: initial;
|
|
752
737
|
-webkit-tap-highlight-color: transparent;
|
|
753
738
|
}
|
|
754
|
-
body {
|
|
755
|
-
line-height: inherit;
|
|
756
|
-
}
|
|
757
739
|
hr {
|
|
758
740
|
height: 0;
|
|
759
741
|
color: inherit;
|
|
@@ -776,9 +758,10 @@
|
|
|
776
758
|
font-weight: bolder;
|
|
777
759
|
}
|
|
778
760
|
code, kbd, samp, pre {
|
|
779
|
-
font-family:
|
|
780
|
-
|
|
781
|
-
font-
|
|
761
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
|
|
762
|
+
"Courier New", monospace;
|
|
763
|
+
font-feature-settings: initial;
|
|
764
|
+
font-variation-settings: initial;
|
|
782
765
|
font-size: 1em;
|
|
783
766
|
}
|
|
784
767
|
small {
|
|
@@ -842,7 +825,11 @@
|
|
|
842
825
|
}
|
|
843
826
|
::placeholder {
|
|
844
827
|
opacity: 1;
|
|
845
|
-
|
|
828
|
+
}
|
|
829
|
+
@supports (not (-webkit-appearance: -apple-pay-button)) or (contain-intrinsic-size: 1px) {
|
|
830
|
+
::placeholder {
|
|
831
|
+
color: color-mix(in oklab, currentColor 50%, transparent);
|
|
832
|
+
}
|
|
846
833
|
}
|
|
847
834
|
textarea {
|
|
848
835
|
resize: vertical;
|
|
@@ -1392,14 +1379,11 @@ input[type="number"] {
|
|
|
1392
1379
|
line-height: 1.5;
|
|
1393
1380
|
-webkit-text-size-adjust: 100%;
|
|
1394
1381
|
tab-size: 4;
|
|
1395
|
-
font-family:
|
|
1396
|
-
font-feature-settings:
|
|
1397
|
-
font-variation-settings:
|
|
1382
|
+
font-family: "Inter", sans-serif;
|
|
1383
|
+
font-feature-settings: initial;
|
|
1384
|
+
font-variation-settings: initial;
|
|
1398
1385
|
-webkit-tap-highlight-color: transparent;
|
|
1399
1386
|
}
|
|
1400
|
-
body {
|
|
1401
|
-
line-height: inherit;
|
|
1402
|
-
}
|
|
1403
1387
|
hr {
|
|
1404
1388
|
height: 0;
|
|
1405
1389
|
color: inherit;
|
|
@@ -1422,9 +1406,10 @@ input[type="number"] {
|
|
|
1422
1406
|
font-weight: bolder;
|
|
1423
1407
|
}
|
|
1424
1408
|
code, kbd, samp, pre {
|
|
1425
|
-
font-family:
|
|
1426
|
-
|
|
1427
|
-
font-
|
|
1409
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
|
|
1410
|
+
"Courier New", monospace;
|
|
1411
|
+
font-feature-settings: initial;
|
|
1412
|
+
font-variation-settings: initial;
|
|
1428
1413
|
font-size: 1em;
|
|
1429
1414
|
}
|
|
1430
1415
|
small {
|
|
@@ -1488,7 +1473,11 @@ input[type="number"] {
|
|
|
1488
1473
|
}
|
|
1489
1474
|
::placeholder {
|
|
1490
1475
|
opacity: 1;
|
|
1491
|
-
|
|
1476
|
+
}
|
|
1477
|
+
@supports (not (-webkit-appearance: -apple-pay-button)) or (contain-intrinsic-size: 1px) {
|
|
1478
|
+
::placeholder {
|
|
1479
|
+
color: color-mix(in oklab, currentColor 50%, transparent);
|
|
1480
|
+
}
|
|
1492
1481
|
}
|
|
1493
1482
|
textarea {
|
|
1494
1483
|
resize: vertical;
|
|
@@ -1523,6 +1512,12 @@ input[type="number"] {
|
|
|
1523
1512
|
}
|
|
1524
1513
|
}
|
|
1525
1514
|
@layer utilities;
|
|
1515
|
+
@layer base {
|
|
1516
|
+
* {
|
|
1517
|
+
scrollbar-color: initial;
|
|
1518
|
+
scrollbar-width: initial;
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1526
1521
|
@property --tw-rotate-x {
|
|
1527
1522
|
syntax: "*";
|
|
1528
1523
|
inherits: false;
|
package/dist/hmr.js
CHANGED
package/dist/index.html
CHANGED
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
"APP_VERSION": "IiI=",
|
|
8
8
|
"REQUIRES_HARD_REFRESH": "dHJ1ZQ==",
|
|
9
9
|
"SENTRY_RELEASE": "IiI=",
|
|
10
|
-
"LOAD_EXTERNAL_PACKAGES": "InRydWUi",
|
|
11
10
|
"BASE_PATH": "Ii8i",
|
|
12
11
|
"BASE_HREF": "Ii4vIg==",
|
|
13
12
|
"PH_CONNECT_APP_REQUIRES_HARD_REFRESH": "InRydWUi",
|
|
@@ -42,8 +41,6 @@
|
|
|
42
41
|
"PH_CONNECT_SENTRY_ENV": "InByb2Qi",
|
|
43
42
|
"PH_CONNECT_SENTRY_TRACING_ENABLED": "ImZhbHNlIg==",
|
|
44
43
|
"PH_CONNECT_GA_TRACKING_ID": "IiI=",
|
|
45
|
-
"LOCAL_DOCUMENT_MODELS": "IiI=",
|
|
46
|
-
"LOCAL_DOCUMENT_EDITORS": "IiI=",
|
|
47
44
|
"FILE_UPLOAD_OPERATIONS_CHUNK_SIZE": "IjUwIg==",
|
|
48
45
|
"PH_CONNECT_VERSION_CHECK_INTERVAL": "IjM2MDAwMDAi",
|
|
49
46
|
"PH_CONNECT_CLI_VERSION": "IiI="
|
|
@@ -97,4 +94,4 @@
|
|
|
97
94
|
"@powerhousedao/reactor-browser/utils/index": "/modules/@powerhousedao/reactor-browser/utils/index.js",
|
|
98
95
|
"@powerhousedao/reactor-browser/utils/signature": "/modules/@powerhousedao/reactor-browser/utils/signature.js"
|
|
99
96
|
}
|
|
100
|
-
}</script><script type="module" crossorigin="" src="/assets/main.
|
|
97
|
+
}</script><script type="module" crossorigin="" src="/assets/main.BmcV9296.js"></script></head><body><div id="app"></div></body></html>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// ../../node_modules/.pnpm/jotai@2.12.2_@types+react@18.3.
|
|
1
|
+
// ../../node_modules/.pnpm/jotai@2.12.2_@types+react@18.3.20_react@18.3.1/node_modules/jotai/esm/vanilla/internals.mjs
|
|
2
2
|
var isSelfAtom = (atom2, a) => atom2.unstable_is ? atom2.unstable_is(a) : a === atom2;
|
|
3
3
|
var hasInitialValue = (atom2) => "init" in atom2;
|
|
4
4
|
var isActuallyWritableAtom = (atom2) => !!atom2.write;
|
|
@@ -533,7 +533,7 @@ var INTERNAL_buildStoreRev1 = buildStore;
|
|
|
533
533
|
var INTERNAL_initializeStoreHooks = initializeStoreHooks;
|
|
534
534
|
var INTERNAL_registerAbortHandler = registerAbortHandler;
|
|
535
535
|
|
|
536
|
-
// ../../node_modules/.pnpm/jotai@2.12.2_@types+react@18.3.
|
|
536
|
+
// ../../node_modules/.pnpm/jotai@2.12.2_@types+react@18.3.20_react@18.3.1/node_modules/jotai/esm/vanilla.mjs
|
|
537
537
|
var keyCount = 0;
|
|
538
538
|
function atom(read, write) {
|
|
539
539
|
const key = `atom${++keyCount}`;
|
|
@@ -643,7 +643,7 @@ function getDefaultStore() {
|
|
|
643
643
|
return defaultStore;
|
|
644
644
|
}
|
|
645
645
|
|
|
646
|
-
// ../../node_modules/.pnpm/jotai@2.12.2_@types+react@18.3.
|
|
646
|
+
// ../../node_modules/.pnpm/jotai@2.12.2_@types+react@18.3.20_react@18.3.1/node_modules/jotai/esm/react.mjs
|
|
647
647
|
import ReactExports, { createContext, useContext, useRef, createElement, useReducer, useEffect, useDebugValue, useCallback } from "react";
|
|
648
648
|
var StoreContext = createContext(
|
|
649
649
|
void 0
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
ReactorBuilder,
|
|
5
5
|
memory_default,
|
|
6
6
|
mergeOperations
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-SQ5HIKYV.js";
|
|
8
8
|
import {
|
|
9
9
|
__commonJS,
|
|
10
10
|
__require,
|
|
@@ -2201,7 +2201,6 @@ var BrowserStorage = class _BrowserStorage {
|
|
|
2201
2201
|
db;
|
|
2202
2202
|
static DBName = "DOCUMENT_DRIVES";
|
|
2203
2203
|
static SEP = ":";
|
|
2204
|
-
static DRIVES_KEY = "DRIVES";
|
|
2205
2204
|
static DOCUMENT_KEY = "DOCUMENT";
|
|
2206
2205
|
static MANIFEST_KEY = "MANIFEST";
|
|
2207
2206
|
constructor(namespace) {
|
|
@@ -2209,6 +2208,10 @@ var BrowserStorage = class _BrowserStorage {
|
|
|
2209
2208
|
name: namespace ? `${namespace}:${_BrowserStorage.DBName}` : _BrowserStorage.DBName
|
|
2210
2209
|
}));
|
|
2211
2210
|
}
|
|
2211
|
+
async clear() {
|
|
2212
|
+
const db = await this.db;
|
|
2213
|
+
await db.clear();
|
|
2214
|
+
}
|
|
2212
2215
|
////////////////////////////////
|
|
2213
2216
|
// IDocumentStorage
|
|
2214
2217
|
////////////////////////////////
|
|
@@ -2229,13 +2232,57 @@ var BrowserStorage = class _BrowserStorage {
|
|
|
2229
2232
|
}
|
|
2230
2233
|
return document;
|
|
2231
2234
|
}
|
|
2235
|
+
async delete(documentId) {
|
|
2236
|
+
const db = await this.db;
|
|
2237
|
+
const document = await db.getItem(this.buildDocumentKey(documentId));
|
|
2238
|
+
if (!document) {
|
|
2239
|
+
return false;
|
|
2240
|
+
}
|
|
2241
|
+
const drives = await this.getDrives();
|
|
2242
|
+
for (const driveId of drives) {
|
|
2243
|
+
if (driveId === documentId)
|
|
2244
|
+
continue;
|
|
2245
|
+
await this.removeChild(driveId, documentId);
|
|
2246
|
+
}
|
|
2247
|
+
await db.removeItem(this.buildManifestKey(documentId));
|
|
2248
|
+
await db.removeItem(this.buildDocumentKey(documentId));
|
|
2249
|
+
return true;
|
|
2250
|
+
}
|
|
2251
|
+
async removeChild(parentId, childId) {
|
|
2252
|
+
const manifest = await this.getManifest(parentId);
|
|
2253
|
+
const docIndex = manifest.documentIds.indexOf(childId);
|
|
2254
|
+
if (docIndex !== -1) {
|
|
2255
|
+
manifest.documentIds.splice(docIndex, 1);
|
|
2256
|
+
await this.updateDriveManifest(parentId, manifest);
|
|
2257
|
+
return true;
|
|
2258
|
+
}
|
|
2259
|
+
return false;
|
|
2260
|
+
}
|
|
2261
|
+
async addChild(parentId, childId) {
|
|
2262
|
+
if (parentId === childId) {
|
|
2263
|
+
throw new Error("Cannot associate a document with itself");
|
|
2264
|
+
}
|
|
2265
|
+
const children = await this.getChildren(childId);
|
|
2266
|
+
if (children.includes(parentId)) {
|
|
2267
|
+
throw new Error("Cannot associate a document with its child");
|
|
2268
|
+
}
|
|
2269
|
+
const manifest = await this.getManifest(parentId);
|
|
2270
|
+
if (!manifest.documentIds.includes(childId)) {
|
|
2271
|
+
manifest.documentIds.push(childId);
|
|
2272
|
+
await this.updateDriveManifest(parentId, manifest);
|
|
2273
|
+
}
|
|
2274
|
+
}
|
|
2275
|
+
async getChildren(parentId) {
|
|
2276
|
+
const manifest = await this.getManifest(parentId);
|
|
2277
|
+
return manifest.documentIds;
|
|
2278
|
+
}
|
|
2232
2279
|
////////////////////////////////
|
|
2233
2280
|
// IDriveStorage
|
|
2234
2281
|
////////////////////////////////
|
|
2235
2282
|
checkDocumentExists(drive, documentId) {
|
|
2236
2283
|
return this.exists(documentId);
|
|
2237
2284
|
}
|
|
2238
|
-
async
|
|
2285
|
+
async getManifest(driveId) {
|
|
2239
2286
|
const db = await this.db;
|
|
2240
2287
|
const manifest = await db.getItem(this.buildManifestKey(driveId));
|
|
2241
2288
|
return manifest || { documentIds: [] };
|
|
@@ -2245,7 +2292,7 @@ var BrowserStorage = class _BrowserStorage {
|
|
|
2245
2292
|
await db.setItem(this.buildManifestKey(driveId), manifest);
|
|
2246
2293
|
}
|
|
2247
2294
|
async getDocuments(drive) {
|
|
2248
|
-
const manifest = await this.
|
|
2295
|
+
const manifest = await this.getManifest(drive);
|
|
2249
2296
|
return manifest.documentIds;
|
|
2250
2297
|
}
|
|
2251
2298
|
async getDocument(driveId, id) {
|
|
@@ -2253,7 +2300,7 @@ var BrowserStorage = class _BrowserStorage {
|
|
|
2253
2300
|
}
|
|
2254
2301
|
async createDocument(drive, id, document) {
|
|
2255
2302
|
await this.create(id, document);
|
|
2256
|
-
const manifest = await this.
|
|
2303
|
+
const manifest = await this.getManifest(drive);
|
|
2257
2304
|
if (!manifest.documentIds.includes(id)) {
|
|
2258
2305
|
manifest.documentIds.push(id);
|
|
2259
2306
|
await this.updateDriveManifest(drive, manifest);
|
|
@@ -2261,7 +2308,7 @@ var BrowserStorage = class _BrowserStorage {
|
|
|
2261
2308
|
}
|
|
2262
2309
|
async deleteDocument(drive, id) {
|
|
2263
2310
|
await (await this.db).removeItem(this.buildDocumentKey(id));
|
|
2264
|
-
const manifest = await this.
|
|
2311
|
+
const manifest = await this.getManifest(drive);
|
|
2265
2312
|
const docIndex = manifest.documentIds.indexOf(id);
|
|
2266
2313
|
if (docIndex !== -1) {
|
|
2267
2314
|
manifest.documentIds.splice(docIndex, 1);
|
|
@@ -2287,12 +2334,13 @@ var BrowserStorage = class _BrowserStorage {
|
|
|
2287
2334
|
async getDrives() {
|
|
2288
2335
|
const db = await this.db;
|
|
2289
2336
|
const keys = await db.keys();
|
|
2290
|
-
return keys.filter((key) => key.startsWith(_BrowserStorage.
|
|
2337
|
+
return keys.filter((key) => key.startsWith(_BrowserStorage.MANIFEST_KEY)).map((key) => key.slice(_BrowserStorage.MANIFEST_KEY.length + _BrowserStorage.SEP.length));
|
|
2291
2338
|
}
|
|
2292
2339
|
async getDrive(id) {
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2340
|
+
let drive;
|
|
2341
|
+
try {
|
|
2342
|
+
drive = await this.get(id);
|
|
2343
|
+
} catch {
|
|
2296
2344
|
throw new DriveNotFoundError(id);
|
|
2297
2345
|
}
|
|
2298
2346
|
return drive;
|
|
@@ -2308,8 +2356,18 @@ var BrowserStorage = class _BrowserStorage {
|
|
|
2308
2356
|
throw new Error(`Drive with slug ${slug} not found`);
|
|
2309
2357
|
}
|
|
2310
2358
|
async createDrive(id, drive) {
|
|
2311
|
-
const
|
|
2312
|
-
|
|
2359
|
+
const slug = drive.initialState.state.global.slug;
|
|
2360
|
+
if (slug) {
|
|
2361
|
+
let existingDrive;
|
|
2362
|
+
try {
|
|
2363
|
+
existingDrive = await this.getDriveBySlug(slug);
|
|
2364
|
+
} catch {
|
|
2365
|
+
}
|
|
2366
|
+
if (existingDrive) {
|
|
2367
|
+
throw new Error(`Drive with slug ${slug} already exists`);
|
|
2368
|
+
}
|
|
2369
|
+
}
|
|
2370
|
+
await this.create(id, drive);
|
|
2313
2371
|
await this.updateDriveManifest(id, { documentIds: [] });
|
|
2314
2372
|
}
|
|
2315
2373
|
async deleteDrive(id) {
|
|
@@ -2317,13 +2375,13 @@ var BrowserStorage = class _BrowserStorage {
|
|
|
2317
2375
|
await Promise.all(documents.map((doc) => this.deleteDocument(id, doc)));
|
|
2318
2376
|
const db = await this.db;
|
|
2319
2377
|
await db.removeItem(this.buildManifestKey(id));
|
|
2320
|
-
return db.removeItem(this.
|
|
2378
|
+
return db.removeItem(this.buildDocumentKey(id));
|
|
2321
2379
|
}
|
|
2322
2380
|
async addDriveOperations(id, operations, header) {
|
|
2323
2381
|
const drive = await this.getDrive(id);
|
|
2324
2382
|
const mergedOperations = mergeOperations(drive.operations, operations);
|
|
2325
2383
|
const db = await this.db;
|
|
2326
|
-
await db.setItem(this.
|
|
2384
|
+
await db.setItem(this.buildDocumentKey(id), {
|
|
2327
2385
|
...drive,
|
|
2328
2386
|
...header,
|
|
2329
2387
|
operations: mergedOperations
|
|
@@ -2332,14 +2390,13 @@ var BrowserStorage = class _BrowserStorage {
|
|
|
2332
2390
|
async getSynchronizationUnitsRevision(units) {
|
|
2333
2391
|
const results = await Promise.allSettled(units.map(async (unit) => {
|
|
2334
2392
|
try {
|
|
2335
|
-
const document = await
|
|
2393
|
+
const document = await this.get(unit.documentId);
|
|
2336
2394
|
if (!document) {
|
|
2337
2395
|
return void 0;
|
|
2338
2396
|
}
|
|
2339
2397
|
const operation = document.operations[unit.scope].at(-1);
|
|
2340
2398
|
if (operation) {
|
|
2341
2399
|
return {
|
|
2342
|
-
driveId: unit.driveId,
|
|
2343
2400
|
documentId: unit.documentId,
|
|
2344
2401
|
scope: unit.scope,
|
|
2345
2402
|
branch: unit.branch,
|
|
@@ -2371,7 +2428,7 @@ var BrowserStorage = class _BrowserStorage {
|
|
|
2371
2428
|
const drive = await this.getDrive(driveId);
|
|
2372
2429
|
const migratedDrive = migrateDocumentOperationSignatures(drive);
|
|
2373
2430
|
if (migratedDrive !== drive) {
|
|
2374
|
-
return (await this.db).setItem(this.
|
|
2431
|
+
return (await this.db).setItem(this.buildDocumentKey(driveId), migratedDrive);
|
|
2375
2432
|
}
|
|
2376
2433
|
}
|
|
2377
2434
|
async migrateDocument(drive, id) {
|
|
@@ -2384,9 +2441,6 @@ var BrowserStorage = class _BrowserStorage {
|
|
|
2384
2441
|
////////////////////////////////
|
|
2385
2442
|
// Private methods
|
|
2386
2443
|
////////////////////////////////
|
|
2387
|
-
buildDriveKey(driveId) {
|
|
2388
|
-
return `${_BrowserStorage.DRIVES_KEY}${_BrowserStorage.SEP}${driveId}`;
|
|
2389
|
-
}
|
|
2390
2444
|
buildDocumentKey(documentId) {
|
|
2391
2445
|
return `${_BrowserStorage.DOCUMENT_KEY}${_BrowserStorage.SEP}${documentId}`;
|
|
2392
2446
|
}
|
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
} from "./chunk-IQTSFTNF.js";
|
|
5
5
|
import {
|
|
6
6
|
useAddDebouncedOperations
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-CO2RVWYY.js";
|
|
8
8
|
import {
|
|
9
9
|
useConnectCrypto,
|
|
10
10
|
useConnectDid
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-2ONJ2PX4.js";
|
|
12
12
|
import {
|
|
13
13
|
useDocumentDispatch
|
|
14
14
|
} from "./chunk-GDP7BUIH.js";
|