@powerhousedao/connect 1.0.10-dev.0 → 1.0.12-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.
Files changed (24) hide show
  1. package/dist/assets/{app-BIIVKAZr.css → app-B2wIHlkp.css} +1 -1
  2. package/dist/assets/{app-CsiwsM42.js → app-Dff9FF8i.js} +9 -9
  3. package/dist/assets/{app-loader-C7A2YjX4.js → app-loader-Cq4mceES.js} +75 -128
  4. package/dist/assets/{ccip-BG1d6viz.js → ccip-CHzBVJ_W.js} +3 -3
  5. package/dist/assets/{content-0UFgs2d1.js → content-DFdCvBBv.js} +3 -3
  6. package/dist/assets/{index-CTEGX1We.js → index-BLJi1OAo.js} +3 -3
  7. package/dist/assets/{index-yr0-SqYf.js → index-CTn3AlO1.js} +4 -4
  8. package/dist/assets/{index-BMDqhr-9.js → index-DHZwo9f0.js} +3 -3
  9. package/dist/assets/{main.BmcV9296.js → main.BzO0W8Ha.js} +1 -1
  10. package/dist/index.html +1 -1
  11. package/dist/modules/@powerhousedao/reactor-browser/{chunk-SQ5HIKYV.js → chunk-2GQV5NL6.js} +60 -79
  12. package/dist/modules/@powerhousedao/reactor-browser/{chunk-ISDEPHKP.js → chunk-JBIHRE7L.js} +11 -47
  13. package/dist/modules/@powerhousedao/reactor-browser/{chunk-5QJXNK35.js → chunk-JCLMFPZP.js} +1 -1
  14. package/dist/modules/@powerhousedao/reactor-browser/{chunk-3C54663M.js → chunk-SJYGEYNL.js} +1 -1
  15. package/dist/modules/@powerhousedao/reactor-browser/{chunk-XV42KZK3.js → chunk-T5LUZMLP.js} +1 -1
  16. package/dist/modules/@powerhousedao/reactor-browser/context/index.js +2 -2
  17. package/dist/modules/@powerhousedao/reactor-browser/context/read-mode.js +2 -2
  18. package/dist/modules/@powerhousedao/reactor-browser/hooks/index.js +3 -3
  19. package/dist/modules/@powerhousedao/reactor-browser/hooks/useDriveActions.js +2 -2
  20. package/dist/modules/@powerhousedao/reactor-browser/hooks/useDriveActionsWithUiNodes.js +3 -3
  21. package/dist/modules/@powerhousedao/reactor-browser/index.js +5 -5
  22. package/dist/modules/@powerhousedao/reactor-browser/reactor.js +2 -2
  23. package/dist/vite-envs.sh +1 -1
  24. package/package.json +9 -7
@@ -1,4 +1,4 @@
1
- /*! tailwindcss v4.1.2 | MIT License | https://tailwindcss.com */
1
+ /*! tailwindcss v4.1.3 | MIT License | https://tailwindcss.com */
2
2
  @layer properties;
3
3
  @layer theme, base, components, utilities;
4
4
  @layer theme {
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ccip-BG1d6viz.js","assets/main.BmcV9296.js","assets/app-loader-C7A2YjX4.js","assets/app-loader-pcztQTL4.css","assets/index-CTEGX1We.js","assets/style-Ce3V83BE.css","assets/index-yr0-SqYf.js","assets/content-0UFgs2d1.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ccip-CHzBVJ_W.js","assets/main.BzO0W8Ha.js","assets/app-loader-Cq4mceES.js","assets/app-loader-pcztQTL4.css","assets/index-BLJi1OAo.js","assets/style-Ce3V83BE.css","assets/index-CTn3AlO1.js","assets/content-DFdCvBBv.js"])))=>i.map(i=>d[i]);
2
2
  var __defProp = Object.defineProperty;
3
3
  var __typeError = (msg) => {
4
4
  throw TypeError(msg);
@@ -19,9 +19,9 @@ var __privateWrapper = (obj, member, setter, getter) => ({
19
19
  }
20
20
  });
21
21
  var _focused, _cleanup, _setup, _a, _online, _cleanup2, _setup2, _b, _gcTimeout, _c, _initialState, _revertState, _cache, _client, _retryer, _defaultOptions, _abortSignalConsumed, _Query_instances, dispatch_fn, _d, _queries, _e2, _observers, _mutationCache, _retryer2, _Mutation_instances, dispatch_fn2, _f, _mutations, _scopes, _mutationId, _g, _queryCache, _mutationCache2, _defaultOptions2, _queryDefaults, _mutationDefaults, _mountCount, _unsubscribeFocus, _unsubscribeOnline, _h, _client2, _currentQuery, _currentQueryInitialState, _currentResult, _currentResultState, _currentResultOptions, _currentThenable, _selectError, _selectFn, _selectResult, _lastQueryWithDefinedData, _staleTimeoutId, _refetchIntervalId, _currentRefetchInterval, _trackedProps, _QueryObserver_instances, executeFetch_fn, updateStaleTimeout_fn, computeRefetchInterval_fn, updateRefetchInterval_fn, updateTimers_fn, clearStaleTimeout_fn, clearRefetchInterval_fn, updateQuery_fn, notify_fn, _i;
22
- import { _ as __vitePreload } from "./main.BmcV9296.js";
22
+ import { _ as __vitePreload } from "./main.BzO0W8Ha.js";
23
23
  import { jsx as jsx$1, Fragment, jsxs } from "react/jsx-runtime";
24
- import { c as createAction, a as createReducer, i as isDocumentAction, R as ReorderStateExamplesInputSchema, D as DeleteStateExampleInputSchema, U as UpdateStateExampleInputSchema, A as AddStateExampleInputSchema, S as SetInitialStateInputSchema, b as SetStateSchemaInputSchema, d as ReorderModuleOperationsInputSchema, e as DeleteOperationInputSchema, M as MoveOperationInputSchema, f as SetOperationReducerInputSchema, g as SetOperationTemplateInputSchema, h as SetOperationDescriptionInputSchema, j as SetOperationSchemaInputSchema, k as SetOperationScopeInputSchema, l as SetOperationNameInputSchema, m as AddOperationInputSchema, n as ReorderOperationExamplesInputSchema, o as DeleteOperationExampleInputSchema, p as UpdateOperationExampleInputSchema, q as AddOperationExampleInputSchema, r as ReorderOperationErrorsInputSchema, s as DeleteOperationErrorInputSchema, t as SetOperationErrorTemplateInputSchema, u as SetOperationErrorDescriptionInputSchema, v as SetOperationErrorNameInputSchema, w as SetOperationErrorCodeInputSchema, x as AddOperationErrorInputSchema, y as ReorderModulesInputSchema, z as DeleteModuleInputSchema, B as SetModuleDescriptionInputSchema, C as SetModuleNameInputSchema, E as AddModuleInputSchema, F as ReorderChangeLogItemsInputSchema, G as DeleteChangeLogItemInputSchema, H as UpdateChangeLogItemInputSchema, I as AddChangeLogItemInputSchema, J as SetAuthorWebsiteInputSchema, K as SetAuthorNameInputSchema, L as SetModelDescriptionInputSchema, N as SetModelExtensionInputSchema, O as SetModelIdInputSchema, P as SetModelNameInputSchema, Q as baseCreateExtendedState, T as baseCreateDocument, V as baseSaveToFile, W as baseSaveToFileHandle, X as baseLoadFromFile, Y as baseLoadFromInput, Z as pascalCase, _ as Icon, $ as getDefaultExportFromCjs, a0 as LOCAL, a1 as commonjsGlobal, a2 as PUBLIC, a3 as SWITCHBOARD, a4 as locationInfoByLocation, a5 as sharingTypeOptions, a6 as objectType, a7 as recordType, a8 as stringType, a9 as capitalCase, aa as CLOUD, ab as createZip, ac as logger$1, ad as LZString, ae as buildSignedOperation, af as getI18n, ag as getDefaults, ah as connectConfig, ai as hashDocumentStateForScope, aj as setErrorHandler, ak as driveDocumentModelModule, al as createBrowserDocumentDriveServer, am as hashKey$1, an as childLogger, ao as reducer$8, ap as isDocumentDrive, aq as generateAddNodeAction, ar as isFileNode, as as uploadDocumentOperations, at as updateFile, au as addFolder, av as isFolderNode, aw as deleteNode, ax as updateNode, ay as FILE, az as moveNode, aA as generateNodesCopy, aB as copyNode, aC as createState$1, aD as setDriveName, aE as setAvailableOffline, aF as setSharingType, aG as SynchronizationUnitNotFoundError, aH as removeTrigger, aI as generateUUID, aJ as PullResponderTransmitter, aK as addTrigger, aL as ReadDriveNotFoundError, aM as openUrl, aN as getNodeOptions, aO as DRIVE, aP as FOLDER, aQ as requestPublicDrive, aR as serviceWorkerManager, aS as packageJson, aT as t$1, aU as gql, aV as request } from "./app-loader-C7A2YjX4.js";
24
+ import { c as createAction, a as createReducer, i as isDocumentAction, R as ReorderStateExamplesInputSchema, D as DeleteStateExampleInputSchema, U as UpdateStateExampleInputSchema, A as AddStateExampleInputSchema, S as SetInitialStateInputSchema, b as SetStateSchemaInputSchema, d as ReorderModuleOperationsInputSchema, e as DeleteOperationInputSchema, M as MoveOperationInputSchema, f as SetOperationReducerInputSchema, g as SetOperationTemplateInputSchema, h as SetOperationDescriptionInputSchema, j as SetOperationSchemaInputSchema, k as SetOperationScopeInputSchema, l as SetOperationNameInputSchema, m as AddOperationInputSchema, n as ReorderOperationExamplesInputSchema, o as DeleteOperationExampleInputSchema, p as UpdateOperationExampleInputSchema, q as AddOperationExampleInputSchema, r as ReorderOperationErrorsInputSchema, s as DeleteOperationErrorInputSchema, t as SetOperationErrorTemplateInputSchema, u as SetOperationErrorDescriptionInputSchema, v as SetOperationErrorNameInputSchema, w as SetOperationErrorCodeInputSchema, x as AddOperationErrorInputSchema, y as ReorderModulesInputSchema, z as DeleteModuleInputSchema, B as SetModuleDescriptionInputSchema, C as SetModuleNameInputSchema, E as AddModuleInputSchema, F as ReorderChangeLogItemsInputSchema, G as DeleteChangeLogItemInputSchema, H as UpdateChangeLogItemInputSchema, I as AddChangeLogItemInputSchema, J as SetAuthorWebsiteInputSchema, K as SetAuthorNameInputSchema, L as SetModelDescriptionInputSchema, N as SetModelExtensionInputSchema, O as SetModelIdInputSchema, P as SetModelNameInputSchema, Q as baseCreateExtendedState, T as baseCreateDocument, V as baseSaveToFile, W as baseSaveToFileHandle, X as baseLoadFromFile, Y as baseLoadFromInput, Z as pascalCase, _ as Icon, $ as getDefaultExportFromCjs, a0 as LOCAL, a1 as commonjsGlobal, a2 as PUBLIC, a3 as SWITCHBOARD, a4 as locationInfoByLocation, a5 as sharingTypeOptions, a6 as objectType, a7 as recordType, a8 as stringType, a9 as capitalCase, aa as CLOUD, ab as createZip, ac as logger$1, ad as LZString, ae as buildSignedOperation, af as getI18n, ag as getDefaults, ah as connectConfig, ai as hashDocumentStateForScope, aj as setErrorHandler, ak as driveDocumentModelModule, al as createBrowserDocumentDriveServer, am as hashKey$1, an as childLogger, ao as reducer$8, ap as isDocumentDrive, aq as generateAddNodeAction, ar as isFileNode, as as uploadDocumentOperations, at as updateFile, au as addFolder, av as isFolderNode, aw as deleteNode, ax as updateNode, ay as FILE, az as moveNode, aA as generateNodesCopy, aB as copyNode, aC as createState$1, aD as setDriveName, aE as setAvailableOffline, aF as setSharingType, aG as SynchronizationUnitNotFoundError, aH as removeTrigger, aI as generateUUID, aJ as PullResponderTransmitter, aK as addTrigger, aL as ReadDriveNotFoundError, aM as openUrl, aN as getNodeOptions, aO as DRIVE, aP as FOLDER, aQ as requestPublicDrive, aR as serviceWorkerManager, aS as packageJson, aT as t$1, aU as gql, aV as request } from "./app-loader-Cq4mceES.js";
25
25
  import * as React from "react";
26
26
  import React__default, { useLayoutEffect, useEffect, useState, forwardRef, useRef, useCallback, useContext, useMemo, createContext, Component, Fragment as Fragment$1, createElement, useSyncExternalStore, useId as useId$1, isValidElement, cloneElement, Children, useReducer, useDebugValue, Suspense } from "react";
27
27
  import "@powerhousedao/reactor-browser";
@@ -20574,7 +20574,7 @@ async function call(client2, args) {
20574
20574
  } catch (err) {
20575
20575
  const data2 = getRevertErrorData(err);
20576
20576
  const { offchainLookup, offchainLookupSignature } = await __vitePreload(async () => {
20577
- const { offchainLookup: offchainLookup2, offchainLookupSignature: offchainLookupSignature2 } = await import("./ccip-BG1d6viz.js");
20577
+ const { offchainLookup: offchainLookup2, offchainLookupSignature: offchainLookupSignature2 } = await import("./ccip-CHzBVJ_W.js");
20578
20578
  return { offchainLookup: offchainLookup2, offchainLookupSignature: offchainLookupSignature2 };
20579
20579
  }, true ? __vite__mapDeps([0,1,2,3]) : void 0);
20580
20580
  if (client2.ccipRead !== false && (data2 == null ? void 0 : data2.slice(0, 10)) === offchainLookupSignature && to)
@@ -71667,7 +71667,7 @@ const useFilteredDocumentModels = () => {
71667
71667
  return filteredDocumentModels;
71668
71668
  };
71669
71669
  async function loadBaseEditors() {
71670
- const documentModelEditor = await __vitePreload(() => import("./index-CTEGX1We.js"), true ? __vite__mapDeps([4,2,1,3]) : void 0);
71670
+ const documentModelEditor = await __vitePreload(() => import("./index-BLJi1OAo.js"), true ? __vite__mapDeps([4,2,1,3]) : void 0);
71671
71671
  await __vitePreload(() => Promise.resolve({}), true ? __vite__mapDeps([5]) : void 0);
71672
71672
  const module = documentModelEditor.documentModelEditorModule;
71673
71673
  return [module];
@@ -71818,11 +71818,11 @@ const connectCrypto = (async () => {
71818
71818
  return window.connectCrypto;
71819
71819
  }
71820
71820
  const { ConnectCrypto } = await __vitePreload(async () => {
71821
- const { ConnectCrypto: ConnectCrypto2 } = await import("./index-yr0-SqYf.js");
71821
+ const { ConnectCrypto: ConnectCrypto2 } = await import("./index-CTn3AlO1.js");
71822
71822
  return { ConnectCrypto: ConnectCrypto2 };
71823
71823
  }, true ? __vite__mapDeps([6,1,2,3]) : void 0);
71824
71824
  const { BrowserKeyStorage } = await __vitePreload(async () => {
71825
- const { BrowserKeyStorage: BrowserKeyStorage2 } = await import("./index-yr0-SqYf.js");
71825
+ const { BrowserKeyStorage: BrowserKeyStorage2 } = await import("./index-CTn3AlO1.js");
71826
71826
  return { BrowserKeyStorage: BrowserKeyStorage2 };
71827
71827
  }, true ? __vite__mapDeps([6,1,2,3]) : void 0);
71828
71828
  const connectCrypto2 = new ConnectCrypto(new BrowserKeyStorage());
@@ -71871,7 +71871,7 @@ function useRenown() {
71871
71871
  return;
71872
71872
  }
71873
71873
  const { initRenownBrowser } = await __vitePreload(async () => {
71874
- const { initRenownBrowser: initRenownBrowser2 } = await import("./index-yr0-SqYf.js");
71874
+ const { initRenownBrowser: initRenownBrowser2 } = await import("./index-CTn3AlO1.js");
71875
71875
  return { initRenownBrowser: initRenownBrowser2 };
71876
71876
  }, true ? __vite__mapDeps([6,1,2,3]) : void 0);
71877
71877
  const renownBrowser = initRenownBrowser(did2);
@@ -80201,7 +80201,7 @@ function Home() {
80201
80201
  /* @__PURE__ */ jsx$1(HomeScreenAddDriveItem, { onClick: onAddDriveClick })
80202
80202
  ] });
80203
80203
  }
80204
- const Content = React__default.lazy(() => __vitePreload(() => import("./content-0UFgs2d1.js"), true ? __vite__mapDeps([7,2,1,3]) : void 0));
80204
+ const Content = React__default.lazy(() => __vitePreload(() => import("./content-DFdCvBBv.js"), true ? __vite__mapDeps([7,2,1,3]) : void 0));
80205
80205
  async function createRouter(routes) {
80206
80206
  var _a2;
80207
80207
  const isPackaged = await ((_a2 = window.electronAPI) == null ? void 0 : _a2.isPackaged());
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/app-CsiwsM42.js","assets/main.BmcV9296.js","assets/app-BIIVKAZr.css"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/app-Dff9FF8i.js","assets/main.BzO0W8Ha.js","assets/app-B2wIHlkp.css"])))=>i.map(i=>d[i]);
2
2
  var __defProp = Object.defineProperty;
3
3
  var __typeError = (msg) => {
4
4
  throw TypeError(msg);
@@ -11,7 +11,7 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
11
11
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
12
12
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
13
13
  var _tags, _levelString, _errorHandler, _ConsoleLogger_instances, levelValue_get, _getDocumentModelModule, _drives, _ReadModeService_instances, parseGraphQLErrors_fn, fetchDrive_fn, _a, _ServiceWorkerManager_instances, handleServiceWorkerMessage_fn, handleServiceWorker_fn;
14
- import { _ as __vitePreload } from "./main.BmcV9296.js";
14
+ import { _ as __vitePreload } from "./main.BzO0W8Ha.js";
15
15
  import { jsx, jsxs } from "react/jsx-runtime";
16
16
  import { useState, useEffect, Suspense, lazy } from "react";
17
17
  function _mergeNamespaces(n, m) {
@@ -11554,13 +11554,6 @@ class DriveAlreadyExistsError extends Error {
11554
11554
  this.driveId = driveId;
11555
11555
  }
11556
11556
  }
11557
- class DriveNotFoundError extends Error {
11558
- constructor(driveId) {
11559
- super(`Drive with id ${driveId} not found`);
11560
- __publicField(this, "driveId");
11561
- this.driveId = driveId;
11562
- }
11563
- }
11564
11557
  class SynchronizationUnitNotFoundError extends Error {
11565
11558
  constructor(message, syncUnitId) {
11566
11559
  super(message);
@@ -11815,7 +11808,7 @@ class BaseQueueManager {
11815
11808
  if (await queue.isDeleted()) {
11816
11809
  throw new Error("Queue is deleted");
11817
11810
  }
11818
- const newDocument = job.documentId && !await this.delegate.checkDocumentExists(job.documentId);
11811
+ const newDocument = job.documentId && !await this.delegate.exists(job.documentId);
11819
11812
  if (newDocument && !await queue.isBlocked()) {
11820
11813
  await queue.setBlocked(true);
11821
11814
  const driveQueue = this.getQueue(job.driveId);
@@ -22368,9 +22361,7 @@ class DefaultDrivesManager {
22368
22361
  try {
22369
22362
  await this.server.deleteDrive(driveId);
22370
22363
  } catch (error) {
22371
- if (!(error instanceof DriveNotFoundError)) {
22372
- logger$1.error(error);
22373
- }
22364
+ logger$1.error(error);
22374
22365
  }
22375
22366
  }
22376
22367
  async preserveDrivesById(driveIdsToPreserve, drives, removeStrategy = "detach") {
@@ -23088,7 +23079,7 @@ class BaseDocumentDriveServer {
23088
23079
  __publicField(this, "logger", childLogger(["BaseDocumentDriveServer"]));
23089
23080
  // external dependencies
23090
23081
  __publicField(this, "documentModelModules");
23091
- __publicField(this, "storage");
23082
+ __publicField(this, "legacyStorage");
23092
23083
  __publicField(this, "documentStorage");
23093
23084
  __publicField(this, "cache");
23094
23085
  __publicField(this, "queueManager");
@@ -23103,9 +23094,9 @@ class BaseDocumentDriveServer {
23103
23094
  emit: (...args) => this.eventEmitter.emit("defaultRemoteDrive", ...args)
23104
23095
  });
23105
23096
  __publicField(this, "queueDelegate", {
23106
- checkDocumentExists: (documentId) => this.documentStorage.exists(documentId),
23097
+ exists: (documentId) => this.documentStorage.exists(documentId),
23107
23098
  processOperationJob: async ({ driveId, documentId, operations, options }) => {
23108
- return documentId ? this.addOperations(driveId, documentId, operations, options) : this.addDriveOperations(driveId, operations, options);
23099
+ return !documentId || driveId === documentId ? this.addDriveOperations(driveId, operations, options) : this.addOperations(driveId, documentId, operations, options);
23109
23100
  },
23110
23101
  processActionJob: async ({ driveId, documentId, actions: actions2, options }) => {
23111
23102
  return documentId ? this.addActions(driveId, documentId, actions2, options) : this.addDriveActions(driveId, actions2, options);
@@ -23124,7 +23115,7 @@ class BaseDocumentDriveServer {
23124
23115
  __publicField(this, "triggerMap", /* @__PURE__ */ new Map());
23125
23116
  __publicField(this, "initializePromise");
23126
23117
  this.documentModelModules = documentModelModules;
23127
- this.storage = storage;
23118
+ this.legacyStorage = storage;
23128
23119
  this.documentStorage = documentStorage;
23129
23120
  this.cache = cache;
23130
23121
  this.queueManager = queueManager;
@@ -23366,7 +23357,7 @@ class BaseDocumentDriveServer {
23366
23357
  if (!id) {
23367
23358
  throw new Error("Invalid Drive Id");
23368
23359
  }
23369
- const drives = await this.storage.getDrives();
23360
+ const drives = await this.legacyStorage.getDrives();
23370
23361
  if (drives.includes(id)) {
23371
23362
  throw new DriveAlreadyExistsError(id);
23372
23363
  }
@@ -23376,7 +23367,7 @@ class BaseDocumentDriveServer {
23376
23367
  document.meta = {
23377
23368
  preferredEditor
23378
23369
  };
23379
- await this.storage.createDrive(id, document);
23370
+ await this.legacyStorage.createDrive(id, document);
23380
23371
  if (input.global.slug) {
23381
23372
  await this.cache.deleteDriveBySlug(input.global.slug);
23382
23373
  }
@@ -23411,7 +23402,7 @@ class BaseDocumentDriveServer {
23411
23402
  this.stopSyncRemoteDrive(driveId),
23412
23403
  this.listenerManager.removeDrive(driveId),
23413
23404
  this.cache.deleteDrive(driveId),
23414
- this.storage.deleteDrive(driveId)
23405
+ this.legacyStorage.deleteDrive(driveId)
23415
23406
  ]);
23416
23407
  result.forEach((r) => {
23417
23408
  if (r.status === "rejected") {
@@ -23420,7 +23411,7 @@ class BaseDocumentDriveServer {
23420
23411
  });
23421
23412
  }
23422
23413
  getDrives() {
23423
- return this.storage.getDrives();
23414
+ return this.legacyStorage.getDrives();
23424
23415
  }
23425
23416
  async getDrive(driveId, options) {
23426
23417
  let document;
@@ -23435,7 +23426,7 @@ class BaseDocumentDriveServer {
23435
23426
  } catch (e) {
23436
23427
  this.logger.error("Error getting drive from cache", e);
23437
23428
  }
23438
- const driveStorage = document ?? await this.storage.getDrive(driveId);
23429
+ const driveStorage = document ?? await this.documentStorage.get(driveId);
23439
23430
  const result = this._buildDocument(driveStorage, options);
23440
23431
  if (!isDocumentDrive(result)) {
23441
23432
  throw new Error(`Document with id ${driveId} is not a Document Drive`);
@@ -23455,7 +23446,7 @@ class BaseDocumentDriveServer {
23455
23446
  } catch (e) {
23456
23447
  this.logger.error("Error getting drive from cache", e);
23457
23448
  }
23458
- const driveStorage = await this.storage.getDriveBySlug(slug);
23449
+ const driveStorage = await this.legacyStorage.getDriveBySlug(slug);
23459
23450
  const document = this._buildDocument(driveStorage, options);
23460
23451
  if (!isDocumentDrive(document)) {
23461
23452
  throw new Error(`Document with slug ${slug} is not a Document Drive`);
@@ -23474,7 +23465,7 @@ class BaseDocumentDriveServer {
23474
23465
  } catch (e) {
23475
23466
  this.logger.error("Error getting document from cache", e);
23476
23467
  }
23477
- const documentStorage = cachedDocument ?? await this.storage.getDocument(driveId, documentId);
23468
+ const documentStorage = cachedDocument ?? await this.documentStorage.get(documentId);
23478
23469
  const document = this._buildDocument(documentStorage, options);
23479
23470
  if (!(options == null ? void 0 : options.revisions)) {
23480
23471
  this.cache.setDocument(documentId, document).catch(this.logger.error);
@@ -23482,7 +23473,7 @@ class BaseDocumentDriveServer {
23482
23473
  return document;
23483
23474
  }
23484
23475
  getDocuments(driveId) {
23485
- return this.storage.getDocuments(driveId);
23476
+ return this.documentStorage.getChildren(driveId);
23486
23477
  }
23487
23478
  async createDocument(driveId, input) {
23488
23479
  let state = void 0;
@@ -23505,7 +23496,18 @@ class BaseDocumentDriveServer {
23505
23496
  clipboard: [],
23506
23497
  state: state ?? document.state
23507
23498
  };
23508
- await this.storage.createDocument(driveId, input.id, documentStorage);
23499
+ await this.documentStorage.create(input.id, documentStorage);
23500
+ try {
23501
+ await this.documentStorage.addChild(driveId, input.id);
23502
+ } catch (e) {
23503
+ this.logger.error("Error adding child document", e);
23504
+ try {
23505
+ await this.documentStorage.delete(input.id);
23506
+ } catch (e2) {
23507
+ this.logger.error("FATAL: Could not revert document creation. This means that we created a document but failed to add it to the drive..", e2);
23508
+ }
23509
+ throw e;
23510
+ }
23509
23511
  for (const syncUnit of input.synchronizationUnits) {
23510
23512
  this.synchronizationManager.updateSyncStatus(syncUnit.syncId, {
23511
23513
  pull: this.triggerMap.get(driveId) ? "INITIAL_SYNC" : void 0,
@@ -23515,9 +23517,9 @@ class BaseDocumentDriveServer {
23515
23517
  const operations = Object.values(document.operations).flat();
23516
23518
  if (operations.length) {
23517
23519
  if (isDocumentDrive(document)) {
23518
- await this.storage.addDriveOperations(driveId, operations, document);
23520
+ await this.legacyStorage.addDriveOperations(driveId, operations, document);
23519
23521
  } else {
23520
- await this.storage.addDocumentOperations(driveId, input.id, operations, document);
23522
+ await this.legacyStorage.addDocumentOperations(driveId, input.id, operations, document);
23521
23523
  }
23522
23524
  }
23523
23525
  return document;
@@ -23535,7 +23537,7 @@ class BaseDocumentDriveServer {
23535
23537
  this.logger.warn("Error deleting document", error);
23536
23538
  }
23537
23539
  await this.cache.deleteDocument(documentId);
23538
- return this.storage.deleteDocument(driveId, documentId);
23540
+ return this.documentStorage.delete(documentId);
23539
23541
  }
23540
23542
  async _processOperations(driveId, documentId, documentStorage, operations) {
23541
23543
  const operationsApplied = [];
@@ -23587,7 +23589,7 @@ class BaseDocumentDriveServer {
23587
23589
  for (const scope of Object.keys(documentOperations)) {
23588
23590
  const lastRemainingOperation = documentOperations[scope].at(-1);
23589
23591
  if (lastRemainingOperation && !lastRemainingOperation.resultingState) {
23590
- lastRemainingOperation.resultingState = await (documentId ? (_b = (_a2 = this.storage).getOperationResultingState) == null ? void 0 : _b.call(_a2, driveId, documentId, lastRemainingOperation.index, lastRemainingOperation.scope, "main") : (_d = (_c = this.storage).getDriveOperationResultingState) == null ? void 0 : _d.call(_c, driveId, lastRemainingOperation.index, lastRemainingOperation.scope, "main"));
23592
+ lastRemainingOperation.resultingState = await (documentId ? (_b = (_a2 = this.legacyStorage).getOperationResultingState) == null ? void 0 : _b.call(_a2, driveId, documentId, lastRemainingOperation.index, lastRemainingOperation.scope, "main") : (_d = (_c = this.legacyStorage).getDriveOperationResultingState) == null ? void 0 : _d.call(_c, driveId, lastRemainingOperation.index, lastRemainingOperation.scope, "main"));
23591
23593
  }
23592
23594
  }
23593
23595
  return {
@@ -23620,7 +23622,7 @@ class BaseDocumentDriveServer {
23620
23622
  });
23621
23623
  const lastRemainingOperation = documentOperations[scope].at(-1);
23622
23624
  if (lastRemainingOperation && !lastRemainingOperation.resultingState) {
23623
- lastRemainingOperation.resultingState = await (documentId ? (_b = (_a2 = this.storage).getOperationResultingState) == null ? void 0 : _b.call(_a2, driveId, documentId, lastRemainingOperation.index, lastRemainingOperation.scope, "main") : (_d = (_c = this.storage).getDriveOperationResultingState) == null ? void 0 : _d.call(_c, driveId, lastRemainingOperation.index, lastRemainingOperation.scope, "main"));
23625
+ lastRemainingOperation.resultingState = await (documentId ? (_b = (_a2 = this.legacyStorage).getOperationResultingState) == null ? void 0 : _b.call(_a2, driveId, documentId, lastRemainingOperation.index, lastRemainingOperation.scope, "main") : (_d = (_c = this.legacyStorage).getDriveOperationResultingState) == null ? void 0 : _d.call(_c, driveId, lastRemainingOperation.index, lastRemainingOperation.scope, "main"));
23624
23626
  }
23625
23627
  const operationSignals = [];
23626
23628
  newDocument = documentModelModule.reducer(newDocument, operation, (signal) => {
@@ -23667,14 +23669,14 @@ class BaseDocumentDriveServer {
23667
23669
  return this.addOperations(driveId, documentId, [operation], options);
23668
23670
  }
23669
23671
  async _addOperations(driveId, documentId, callback) {
23670
- if (!this.storage.addDocumentOperationsWithTransaction) {
23671
- const documentStorage = await this.storage.getDocument(driveId, documentId);
23672
+ if (!this.legacyStorage.addDocumentOperationsWithTransaction) {
23673
+ const documentStorage = await this.documentStorage.get(documentId);
23672
23674
  const result = await callback(documentStorage);
23673
23675
  if (result.operations.length > 0) {
23674
- await this.storage.addDocumentOperations(driveId, documentId, result.operations, result.header);
23676
+ await this.legacyStorage.addDocumentOperations(driveId, documentId, result.operations, result.header);
23675
23677
  }
23676
23678
  } else {
23677
- await this.storage.addDocumentOperationsWithTransaction(driveId, documentId, callback);
23679
+ await this.legacyStorage.addDocumentOperationsWithTransaction(driveId, documentId, callback);
23678
23680
  }
23679
23681
  }
23680
23682
  queueOperation(driveId, documentId, operation, options) {
@@ -23897,18 +23899,18 @@ class BaseDocumentDriveServer {
23897
23899
  for (const drive of await this.getDrives()) {
23898
23900
  await this.deleteDrive(drive);
23899
23901
  }
23900
- await ((_b = (_a2 = this.storage).clearStorage) == null ? void 0 : _b.call(_a2));
23902
+ await ((_b = (_a2 = this.legacyStorage).clearStorage) == null ? void 0 : _b.call(_a2));
23901
23903
  }
23902
23904
  async _addDriveOperations(driveId, callback) {
23903
- if (!this.storage.addDriveOperationsWithTransaction) {
23904
- const documentStorage = await this.storage.getDrive(driveId);
23905
+ if (!this.legacyStorage.addDriveOperationsWithTransaction) {
23906
+ const documentStorage = await this.documentStorage.get(driveId);
23905
23907
  const result = await callback(documentStorage);
23906
23908
  if (result.operations.length > 0) {
23907
- await this.storage.addDriveOperations(driveId, result.operations, result.header);
23909
+ await this.legacyStorage.addDriveOperations(driveId, result.operations, result.header);
23908
23910
  }
23909
23911
  return result;
23910
23912
  } else {
23911
- return this.storage.addDriveOperationsWithTransaction(driveId, callback);
23913
+ return this.legacyStorage.addDriveOperationsWithTransaction(driveId, callback);
23912
23914
  }
23913
23915
  }
23914
23916
  queueDriveOperation(driveId, operation, options) {
@@ -24161,8 +24163,9 @@ class MemoryStorage {
24161
24163
  // IDocumentStorage
24162
24164
  ////////////////////////////////
24163
24165
  exists(documentId) {
24164
- return Promise.resolve(!!this.documents[documentId] || !!this.documents[`drive/${documentId}`]);
24166
+ return Promise.resolve(!!this.documents[documentId]);
24165
24167
  }
24168
+ // TODO: this should throw an error if the document already exists.
24166
24169
  create(documentId, document) {
24167
24170
  this.documents[documentId] = document;
24168
24171
  return Promise.resolve();
@@ -24170,10 +24173,6 @@ class MemoryStorage {
24170
24173
  get(documentId) {
24171
24174
  const document = this.documents[documentId];
24172
24175
  if (!document) {
24173
- const drive = this.documents[`drive/${documentId}`];
24174
- if (drive) {
24175
- return Promise.resolve(drive);
24176
- }
24177
24176
  throw new Error(`Document with id ${documentId} not found`);
24178
24177
  }
24179
24178
  return Promise.resolve(document);
@@ -24219,28 +24218,12 @@ class MemoryStorage {
24219
24218
  ////////////////////////////////
24220
24219
  // IDriveStorage
24221
24220
  ////////////////////////////////
24222
- checkDocumentExists(drive, id) {
24223
- return this.exists(id);
24224
- }
24225
- getDocuments(drive) {
24226
- const manifest = this.getManifest(drive);
24227
- return Promise.resolve([...manifest.documentIds]);
24228
- }
24229
- getDocument(driveId, id) {
24230
- return this.get(id);
24231
- }
24232
24221
  async clearStorage() {
24233
24222
  this.documents = {};
24234
24223
  this.driveManifests = {};
24235
24224
  }
24236
- async createDocument(drive, id, document) {
24237
- await this.create(id, document);
24238
- const manifest = this.getManifest(drive);
24239
- manifest.documentIds.add(id);
24240
- this.updateDriveManifest(drive, manifest);
24241
- }
24242
24225
  async addDocumentOperations(drive, id, operations, header) {
24243
- const document = await this.getDocument(drive, id);
24226
+ const document = await this.get(id);
24244
24227
  if (!document) {
24245
24228
  throw new Error(`Document with id ${id} not found`);
24246
24229
  }
@@ -24251,22 +24234,12 @@ class MemoryStorage {
24251
24234
  operations: mergedOperations
24252
24235
  };
24253
24236
  }
24254
- async deleteDocument(drive, id) {
24255
- this.delete(id);
24256
- }
24257
24237
  async getDrives() {
24258
24238
  return Object.keys(this.driveManifests);
24259
24239
  }
24260
- async getDrive(id) {
24261
- const drive = this.documents[`drive/${id}`];
24262
- if (!drive) {
24263
- throw new DriveNotFoundError(id);
24264
- }
24265
- return drive;
24266
- }
24267
24240
  async getDriveBySlug(slug) {
24268
24241
  for (const driveId of Object.keys(this.driveManifests)) {
24269
- const drive = this.documents[`drive/${driveId}`];
24242
+ const drive = this.documents[driveId];
24270
24243
  if (drive.initialState.state.global.slug === slug) {
24271
24244
  return drive;
24272
24245
  }
@@ -24285,13 +24258,13 @@ class MemoryStorage {
24285
24258
  throw new Error(`Drive with slug ${slug} already exists`);
24286
24259
  }
24287
24260
  }
24288
- await this.create(`drive/${id}`, drive);
24261
+ await this.create(id, drive);
24289
24262
  this.updateDriveManifest(id, { documentIds: /* @__PURE__ */ new Set() });
24290
24263
  }
24291
24264
  async addDriveOperations(id, operations, header) {
24292
- const drive = await this.getDrive(id);
24265
+ const drive = await this.get(id);
24293
24266
  const mergedOperations = mergeOperations(drive.operations, operations);
24294
- this.documents[`drive/${id}`] = {
24267
+ this.documents[id] = {
24295
24268
  ...drive,
24296
24269
  ...header,
24297
24270
  operations: mergedOperations
@@ -24789,14 +24762,16 @@ class TransmitterFactory {
24789
24762
  }
24790
24763
  }
24791
24764
  class SynchronizationManager {
24792
- constructor(storage, cache, documentModelModules, eventEmitter) {
24765
+ constructor(storage, documentStorage, cache, documentModelModules, eventEmitter) {
24793
24766
  __publicField(this, "storage");
24767
+ __publicField(this, "documentStorage");
24794
24768
  __publicField(this, "cache");
24795
24769
  __publicField(this, "documentModelModules");
24796
24770
  __publicField(this, "eventEmitter");
24797
24771
  __publicField(this, "syncStatus", /* @__PURE__ */ new Map());
24798
24772
  __publicField(this, "logger", childLogger(["SynchronizationManager"]));
24799
24773
  this.storage = storage;
24774
+ this.documentStorage = documentStorage;
24800
24775
  this.cache = cache;
24801
24776
  this.documentModelModules = documentModelModules;
24802
24777
  this.eventEmitter = eventEmitter;
@@ -24936,7 +24911,7 @@ class SynchronizationManager {
24936
24911
  } catch (e) {
24937
24912
  this.logger.error("Error getting drive from cache", e);
24938
24913
  }
24939
- const driveStorage = await this.storage.getDrive(driveId);
24914
+ const driveStorage = await this.documentStorage.get(driveId);
24940
24915
  const result = this._buildDocument(driveStorage);
24941
24916
  if (!isDocumentDrive(result)) {
24942
24917
  throw new Error(`Document with id ${driveId} is not a Document Drive`);
@@ -24952,7 +24927,7 @@ class SynchronizationManager {
24952
24927
  } catch (e) {
24953
24928
  this.logger.error("Error getting document from cache", e);
24954
24929
  }
24955
- const documentStorage = await this.storage.getDocument(driveId, documentId);
24930
+ const documentStorage = await this.documentStorage.get(documentId);
24956
24931
  return this._buildDocument(documentStorage);
24957
24932
  }
24958
24933
  _buildDocument(documentStorage) {
@@ -25113,7 +25088,14 @@ class ReactorBuilder {
25113
25088
  this.eventEmitter = new DefaultEventEmitter();
25114
25089
  }
25115
25090
  if (!this.synchronizationManager) {
25116
- this.synchronizationManager = new SynchronizationManager(this.storage, this.cache, this.documentModelModules, this.eventEmitter);
25091
+ this.synchronizationManager = new SynchronizationManager(
25092
+ this.storage,
25093
+ // as we refactor, we're secretly making all the IStorage implementations also implement IDocumentStorage
25094
+ this.storage,
25095
+ this.cache,
25096
+ this.documentModelModules,
25097
+ this.eventEmitter
25098
+ );
25117
25099
  }
25118
25100
  if (!this.listenerManager) {
25119
25101
  const config = {
@@ -25790,7 +25772,7 @@ const nodeOptionsMap = {
25790
25772
  };
25791
25773
  const name = "@powerhousedao/connect";
25792
25774
  const productName = "Powerhouse-Connect";
25793
- const version$1 = "1.0.10-dev.0";
25775
+ const version$1 = "1.0.12-dev.0";
25794
25776
  const description = "Powerhouse Connect";
25795
25777
  const main = "./dist/index.html";
25796
25778
  const type = "module";
@@ -25801,7 +25783,7 @@ const author = "acaldas@powerhouse.inc";
25801
25783
  const repository = { "type": "git", "url": "git+https://github.com/powerhouse-inc/document-model-electron.git" };
25802
25784
  const bugs = { "url": "https://github.com/powerhouse-inc/document-model-electron/issues" };
25803
25785
  const homepage = "https://github.com/powerhouse-inc/document-model-electron#readme";
25804
- const scripts = { "build:tsc": "tsc --build", "start": "electron-forge start", "package": "electron-forge package", "make": "PH_CONNECT_BASE_HREF=./ electron-forge make", "make:mac": "PH_CONNECT_BASE_HREF=./ electron-forge make -p darwin", "make:linux": "PH_CONNECT_BASE_HREF=./ electron-forge make -p linux", "make:windows": "PH_CONNECT_BASE_HREF=./ electron-forge make -p win32", "publish:electron": "electron-forge publish", "prepublishOnly": "npm run build", "lint": "eslint .", "lint:fix": "eslint --fix .", "lint:nx": "eslint --quiet --fix .", "format": 'prettier --write "**/*.+(js|ts|jsx|tsx|json)"', "dev": "vite -c vite.renderer.config.mts", "dev:nocache": "rm -rf node_modules/.vite && rm -rf node_modules/.cache && npm run dev", "prebuild": "tsc --build --noEmit", "build": "NODE_OPTIONS=--max-old-space-size=6144 vite build -c vite.renderer.config.mts", "preview:web": "vite preview -c vite.renderer.config.mts", "e2e": "playwright test", "cy:open": "cypress open", "build:service-worker": "tsc --build ./tsconfig.sw.json" };
25786
+ const scripts = { "build:tsc": "tsc --build", "start": "electron-forge start", "package": "electron-forge package", "make": "PH_CONNECT_BASE_HREF=./ electron-forge make", "make:mac": "PH_CONNECT_BASE_HREF=./ electron-forge make -p darwin", "make:linux": "PH_CONNECT_BASE_HREF=./ electron-forge make -p linux", "make:windows": "PH_CONNECT_BASE_HREF=./ electron-forge make -p win32", "publish:electron": "electron-forge publish", "prepublishOnly": "npm run build", "lint": "eslint .", "lint:fix": "eslint --fix .", "lint:nx": "eslint --quiet --fix .", "format": 'prettier --write "**/*.+(js|ts|jsx|tsx|json)"', "dev": "vite -c vite.renderer.config.mts", "dev:nocache": "rm -rf node_modules/.vite && rm -rf node_modules/.cache && npm run dev", "prebuild": "tsc --build --noEmit", "build": "NODE_OPTIONS=--max-old-space-size=6144 vite build -c vite.renderer.config.mts", "preview:web": "vite preview -c vite.renderer.config.mts", "e2e": "playwright test", "cy:open": "cypress open", "build:service-worker": "tsc --build ./tsconfig.sw.json", "clean": "rimraf dist", "clean:node_modules": "rimraf node_modules" };
25805
25787
  const devDependencies = { "@electron-forge/cli": "^6.1.1", "@electron-forge/maker-deb": "^6.1.1", "@electron-forge/maker-rpm": "^6.1.1", "@electron-forge/maker-squirrel": "^6.1.1", "@electron-forge/maker-zip": "^6.1.1", "@electron-forge/plugin-vite": "^6.1.1", "@electron-forge/publisher-electron-release-server": "^6.2.1", "@electron-forge/publisher-github": "^7.2.0", "@electron-forge/shared-types": "^7.7.0", "@playwright/test": "^1.41.2", "@powerhousedao/builder-tools": "workspace:*", "@powerhousedao/common": "workspace:*", "@powerhousedao/config": "workspace:*", "@powerhousedao/design-system": "workspace:*", "@powerhousedao/reactor-browser": "workspace:*", "@powerhousedao/scalars": "workspace:*", "@rollup/plugin-node-resolve": "^15.2.3", "@sentry/browser": "^9.1.0", "@sentry/react": "^7.109.0", "@sentry/vite-plugin": "^2.22.2", "@tailwindcss/vite": "^4.0.9", "@tanstack/react-virtual": "^3.8.1", "@types/node": "^22.13.10", "@types/react": "^18.2.79", "@types/react-dom": "^18.2.18", "@types/uuid": "^9.0.7", "@types/wicg-file-system-access": "^2020.9.6", "@vitejs/plugin-basic-ssl": "^1.2.0", "@vitejs/plugin-react": "^4.2.1", "asar": "^3.2.0", "did-key-creator": "^1.2.0", "document-drive": "workspace:*", "document-model": "workspace:*", "electron": "30.0.0", "electron-is-dev": "^3.0.1", "electron-playwright-helpers": "^1.7.1", "electron-squirrel-startup": "^1.0.0", "electron-store": "^8.1.0", "esbuild": "^0.24.0", "graphql": "^16.8.1", "graphql-request": "^6.1.0", "i18next": "^23.7.6", "jotai": "^2.1.0", "jotai-effect": "^1.1.6", "localforage": "^1.10.0", "lz-string": "^1.5.0", "playwright": "^1.41.2", "playwright-core": "^1.41.2", "react": "^18.2.0", "react-dom": "^18.2.0", "react-error-boundary": "^4.0.11", "react-hotkeys-hook": "^4.5.0", "react-i18next": "^13.5.0", "react-router-dom": "^6.11.2", "tailwind-merge": "^3.0.2", "tailwindcss": "^4.0.9", "uuid": "^9.0.1", "viem": "^2.8.13", "vite": "^6.2.2", "vite-envs": "^4.4.11", "vite-plugin-html": "^3.2.2", "vite-plugin-node-polyfills": "^0.23.0", "vite-plugin-svgr": "^4.2.0", "vite-tsconfig-paths": "^4.3.2", "xvfb-maybe": "^0.2.1" };
25806
25788
  const optionalDependencies = { "@esbuild/linux-x64": "^0.21.4", "@rollup/rollup-linux-x64-musl": "4.14.3" };
25807
25789
  const packageJson = {
@@ -28595,6 +28577,7 @@ const _BrowserStorage = class _BrowserStorage {
28595
28577
  const document = await db.getItem(this.buildDocumentKey(documentId));
28596
28578
  return !!document;
28597
28579
  }
28580
+ // TODO: this should throw an error if the document already exists.
28598
28581
  async create(documentId, document) {
28599
28582
  const db = await this.db;
28600
28583
  await db.setItem(this.buildDocumentKey(documentId), document);
@@ -28654,9 +28637,6 @@ const _BrowserStorage = class _BrowserStorage {
28654
28637
  ////////////////////////////////
28655
28638
  // IDriveStorage
28656
28639
  ////////////////////////////////
28657
- checkDocumentExists(drive, documentId) {
28658
- return this.exists(documentId);
28659
- }
28660
28640
  async getManifest(driveId) {
28661
28641
  const db = await this.db;
28662
28642
  const manifest = await db.getItem(this.buildManifestKey(driveId));
@@ -28666,35 +28646,11 @@ const _BrowserStorage = class _BrowserStorage {
28666
28646
  const db = await this.db;
28667
28647
  await db.setItem(this.buildManifestKey(driveId), manifest);
28668
28648
  }
28669
- async getDocuments(drive) {
28670
- const manifest = await this.getManifest(drive);
28671
- return manifest.documentIds;
28672
- }
28673
- async getDocument(driveId, id) {
28674
- return this.get(id);
28675
- }
28676
- async createDocument(drive, id, document) {
28677
- await this.create(id, document);
28678
- const manifest = await this.getManifest(drive);
28679
- if (!manifest.documentIds.includes(id)) {
28680
- manifest.documentIds.push(id);
28681
- await this.updateDriveManifest(drive, manifest);
28682
- }
28683
- }
28684
- async deleteDocument(drive, id) {
28685
- await (await this.db).removeItem(this.buildDocumentKey(id));
28686
- const manifest = await this.getManifest(drive);
28687
- const docIndex = manifest.documentIds.indexOf(id);
28688
- if (docIndex !== -1) {
28689
- manifest.documentIds.splice(docIndex, 1);
28690
- await this.updateDriveManifest(drive, manifest);
28691
- }
28692
- }
28693
28649
  async clearStorage() {
28694
28650
  return (await this.db).clear();
28695
28651
  }
28696
28652
  async addDocumentOperations(drive, id, operations, header) {
28697
- const document = await this.getDocument(drive, id);
28653
+ const document = await this.get(id);
28698
28654
  if (!document) {
28699
28655
  throw new Error(`Document with id ${id} not found`);
28700
28656
  }
@@ -28711,21 +28667,12 @@ const _BrowserStorage = class _BrowserStorage {
28711
28667
  const keys = await db.keys();
28712
28668
  return keys.filter((key) => key.startsWith(_BrowserStorage.MANIFEST_KEY)).map((key) => key.slice(_BrowserStorage.MANIFEST_KEY.length + _BrowserStorage.SEP.length));
28713
28669
  }
28714
- async getDrive(id) {
28715
- let drive;
28716
- try {
28717
- drive = await this.get(id);
28718
- } catch {
28719
- throw new DriveNotFoundError(id);
28720
- }
28721
- return drive;
28722
- }
28723
28670
  async getDriveBySlug(slug) {
28724
28671
  const drives = (await this.getDrives()).reverse();
28725
28672
  for (const drive of drives) {
28726
- const driveData = await this.getDrive(drive);
28673
+ const driveData = await this.get(drive);
28727
28674
  if (driveData.initialState.state.global.slug === slug) {
28728
- return this.getDrive(drive);
28675
+ return driveData;
28729
28676
  }
28730
28677
  }
28731
28678
  throw new Error(`Drive with slug ${slug} not found`);
@@ -28746,14 +28693,14 @@ const _BrowserStorage = class _BrowserStorage {
28746
28693
  await this.updateDriveManifest(id, { documentIds: [] });
28747
28694
  }
28748
28695
  async deleteDrive(id) {
28749
- const documents = await this.getDocuments(id);
28750
- await Promise.all(documents.map((doc) => this.deleteDocument(id, doc)));
28696
+ const documents = await this.getChildren(id);
28697
+ await Promise.all(documents.map((doc) => this.delete(doc)));
28751
28698
  const db = await this.db;
28752
28699
  await db.removeItem(this.buildManifestKey(id));
28753
28700
  return db.removeItem(this.buildDocumentKey(id));
28754
28701
  }
28755
28702
  async addDriveOperations(id, operations, header) {
28756
- const drive = await this.getDrive(id);
28703
+ const drive = await this.get(id);
28757
28704
  const mergedOperations = mergeOperations(drive.operations, operations);
28758
28705
  const db = await this.db;
28759
28706
  await db.setItem(this.buildDocumentKey(id), {
@@ -28795,19 +28742,19 @@ const _BrowserStorage = class _BrowserStorage {
28795
28742
  const drives = await this.getDrives();
28796
28743
  for (const drive of drives) {
28797
28744
  await this.migrateDrive(drive);
28798
- const documents = await this.getDocuments(drive);
28745
+ const documents = await this.getChildren(drive);
28799
28746
  await Promise.all(documents.map(async (docId) => this.migrateDocument(drive, docId)));
28800
28747
  }
28801
28748
  }
28802
28749
  async migrateDrive(driveId) {
28803
- const drive = await this.getDrive(driveId);
28750
+ const drive = await this.get(driveId);
28804
28751
  const migratedDrive = migrateDocumentOperationSignatures(drive);
28805
28752
  if (migratedDrive !== drive) {
28806
28753
  return (await this.db).setItem(this.buildDocumentKey(driveId), migratedDrive);
28807
28754
  }
28808
28755
  }
28809
28756
  async migrateDocument(drive, id) {
28810
- const document = await this.getDocument(drive, id);
28757
+ const document = await this.get(id);
28811
28758
  const migratedDocument = migrateDocumentOperationSignatures(document);
28812
28759
  if (migratedDocument !== document) {
28813
28760
  return (await this.db).setItem(this.buildDocumentKey(id), migratedDocument);
@@ -31430,7 +31377,7 @@ if (window.__VITE_ENVS.MODE === "development") {
31430
31377
  } else {
31431
31378
  serviceWorkerManager.registerServiceWorker(false);
31432
31379
  }
31433
- const App = lazy(() => __vitePreload(() => import("./app-CsiwsM42.js").then((n) => n.aN), true ? __vite__mapDeps([0,1,2]) : void 0));
31380
+ const App = lazy(() => __vitePreload(() => import("./app-Dff9FF8i.js").then((n) => n.aN), true ? __vite__mapDeps([0,1,2]) : void 0));
31434
31381
  const AppLoader = /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(App, {}) });
31435
31382
  const appLoader = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
31436
31383
  __proto__: null,
@@ -1,7 +1,7 @@
1
- import { aD as BaseError, aE as getUrl, aF as stringify, aG as decodeErrorResult, aH as isAddressEqual, aI as call, aJ as concat, aK as encodeAbiParameters, aL as HttpRequestError, aM as isHex } from "./app-CsiwsM42.js";
2
- import "./main.BmcV9296.js";
1
+ import { aD as BaseError, aE as getUrl, aF as stringify, aG as decodeErrorResult, aH as isAddressEqual, aI as call, aJ as concat, aK as encodeAbiParameters, aL as HttpRequestError, aM as isHex } from "./app-Dff9FF8i.js";
2
+ import "./main.BzO0W8Ha.js";
3
3
  import "react/jsx-runtime";
4
- import "./app-loader-C7A2YjX4.js";
4
+ import "./app-loader-Cq4mceES.js";
5
5
  import "react";
6
6
  import "@powerhousedao/reactor-browser";
7
7
  import "react-dom";