@powerhousedao/connect 1.0.0-dev.245 → 1.0.0-dev.246
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/.env +0 -5
- package/dist/assets/{app-BH-6rUAk.js → app-BT03qzg4.js} +14 -56
- package/dist/assets/{app-76Vr3j5e.css → app-D9QJBr8i.css} +1 -1
- package/dist/assets/{app-loader-CQdXsdrs.js → app-loader-Cp_C_kSQ.js} +282 -172
- package/dist/assets/{ccip-DzlgrM-Q.js → ccip-rCu2dOKk.js} +3 -3
- package/dist/assets/{content-CGSfY9bJ.js → content-B1RXkSXz.js} +3 -3
- package/dist/assets/{index-Ck0OHqQ0.js → index-CJbQZ7hP.js} +3 -3
- package/dist/assets/{index-BR7pEetO.js → index-DX2bXpNe.js} +3 -3
- package/dist/assets/{index-Boh2tg26.js → index-a5VEmfQw.js} +4 -4
- package/dist/assets/{main.PwF6jbJu.js → main.Hm4UID1Z.js} +1 -1
- 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-4AV4NYOH.js → chunk-A4GIWVYS.js} +216 -149
- package/dist/modules/@powerhousedao/reactor-browser/{chunk-QVHWUIBE.js → chunk-PQ4UODLR.js} +1 -1
- package/dist/modules/@powerhousedao/reactor-browser/{chunk-GZM7UEXF.js → chunk-UP4DC4D2.js} +1 -1
- package/dist/modules/@powerhousedao/reactor-browser/{chunk-K62SYQYI.js → chunk-XXFOSD4A.js} +53 -5
- package/dist/modules/@powerhousedao/reactor-browser/{chunk-UIXXJKR2.js → chunk-YDERCA5J.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 +3 -3
- 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 +5 -5
- 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 +6 -6
|
@@ -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-
|
|
2
|
-
import "./main.
|
|
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-BT03qzg4.js";
|
|
2
|
+
import "./main.Hm4UID1Z.js";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
|
-
import "./app-loader-
|
|
4
|
+
import "./app-loader-Cp_C_kSQ.js";
|
|
5
5
|
import "react";
|
|
6
6
|
import "@powerhousedao/reactor-browser";
|
|
7
7
|
import "react-dom";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
|
|
2
|
-
import { t as twMerge, B as Button, m as mergeClassNameProps, E as ERROR, M as MISSING, C as CONFLICT, S as SUCCESS, h as SYNCING, I as INITIAL_SYNC, i as ConnectDropdownMenu, u as useOnClickOutside, j as useEventListener, k as useCopyToClipboard, l as Select, n as ENSAvatar, P as Provider, o as Root3, T as Trigger, p as Portal, q as Content2, v as validateInitialState, w as validateStateSchemaName, x as validateModules, y as useUnwrappedReactor, z as useConnectDid, A as useConnectCrypto, D as useTranslation, F as useModal, G as useAtomValue, H as themeAtom, J as useUser, K as useUserPermissions, L as useUiNodes, N as exportFile, O as useGetDocumentModelModule, Q as addActionContext, U as signOperation, V as useDocumentDriveServer, W as useHotkeys, X as useGetEditor, Y as isSameDocument, Z as useNavigate, _ as ErrorBoundary, $ as DriveLayout, a0 as SearchBar, a1 as useAsyncReactor, a2 as useFilteredDocumentModels, a3 as useDriveEditor, a4 as useDocumentDriveById } from "./app-
|
|
2
|
+
import { t as twMerge, B as Button, m as mergeClassNameProps, E as ERROR, M as MISSING, C as CONFLICT, S as SUCCESS, h as SYNCING, I as INITIAL_SYNC, i as ConnectDropdownMenu, u as useOnClickOutside, j as useEventListener, k as useCopyToClipboard, l as Select, n as ENSAvatar, P as Provider, o as Root3, T as Trigger, p as Portal, q as Content2, v as validateInitialState, w as validateStateSchemaName, x as validateModules, y as useUnwrappedReactor, z as useConnectDid, A as useConnectCrypto, D as useTranslation, F as useModal, G as useAtomValue, H as themeAtom, J as useUser, K as useUserPermissions, L as useUiNodes, N as exportFile, O as useGetDocumentModelModule, Q as addActionContext, U as signOperation, V as useDocumentDriveServer, W as useHotkeys, X as useGetEditor, Y as isSameDocument, Z as useNavigate, _ as ErrorBoundary, $ as DriveLayout, a0 as SearchBar, a1 as useAsyncReactor, a2 as useFilteredDocumentModels, a3 as useDriveEditor, a4 as useDocumentDriveById } from "./app-BT03qzg4.js";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import React__default, { useState, useCallback, useMemo, useEffect, Fragment, useRef, useLayoutEffect, memo as memo$1, createElement, useSyncExternalStore, Suspense } from "react";
|
|
5
|
-
import { _ as Icon, aX as getDimensions, aY as READ, aZ as nodeOptionsMap, a_ as defaultFileOptions, a$ as DELETE, b0 as RENAME, b1 as WRITE, b2 as DUPLICATE, b3 as defaultFolderOptions, b4 as garbageCollect, b5 as sortOperations, b6 as UI_NODE, aO as DRIVE, ay as FILE, b7 as undo, b8 as redo, ac as logger, b9 as useDocumentDispatch, aP as FOLDER, ak as driveDocumentModelModule } from "./app-loader-
|
|
5
|
+
import { _ as Icon, aX as getDimensions, aY as READ, aZ as nodeOptionsMap, a_ as defaultFileOptions, a$ as DELETE, b0 as RENAME, b1 as WRITE, b2 as DUPLICATE, b3 as defaultFolderOptions, b4 as garbageCollect, b5 as sortOperations, b6 as UI_NODE, aO as DRIVE, ay as FILE, b7 as undo, b8 as redo, ac as logger, b9 as useDocumentDispatch, aP as FOLDER, ak as driveDocumentModelModule } from "./app-loader-Cp_C_kSQ.js";
|
|
6
6
|
import { useDocument, useDocumentEditorProps } from "@powerhousedao/reactor-browser";
|
|
7
7
|
import { useUiNodesContext, FILE as FILE$1 } from "@powerhousedao/reactor-browser/hooks/useUiNodesContext";
|
|
8
8
|
import { useDriveActionsWithUiNodes } from "@powerhousedao/reactor-browser/hooks/useDriveActionsWithUiNodes";
|
|
@@ -10,7 +10,7 @@ import { useDriveContext, DriveContextProvider } from "@powerhousedao/reactor-br
|
|
|
10
10
|
import "@powerhousedao/reactor-browser/uiNodes/constants";
|
|
11
11
|
import { makeDriveDocumentStateHook } from "@powerhousedao/reactor-browser/hooks/document-state";
|
|
12
12
|
import { flushSync } from "react-dom";
|
|
13
|
-
import "./main.
|
|
13
|
+
import "./main.Hm4UID1Z.js";
|
|
14
14
|
const PaginationButton = ({ active = false, ...props }) => {
|
|
15
15
|
const className = twMerge("h-8 min-w-8 border border-solid border-gray-300 bg-white px-3 py-1 text-xs text-gray-900 hover:bg-gray-100", !active && "border-0");
|
|
16
16
|
return jsx(Button, { color: "light", size: "small", ...mergeClassNameProps(props, className), children: props.children });
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/app-loader-
|
|
2
|
-
import { _ as __vitePreload } from "./main.
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/app-loader-Cp_C_kSQ.js","assets/main.Hm4UID1Z.js","assets/app-loader-Bnp0H-wa.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import { _ as __vitePreload } from "./main.Hm4UID1Z.js";
|
|
3
3
|
import { createRoot } from "react-dom/client";
|
|
4
4
|
async function renderApp(element) {
|
|
5
|
-
const AppLoader = await __vitePreload(() => import("./app-loader-
|
|
5
|
+
const AppLoader = await __vitePreload(() => import("./app-loader-Cp_C_kSQ.js").then((n) => n.c9), true ? __vite__mapDeps([0,1,2]) : void 0);
|
|
6
6
|
createRoot(element).render(AppLoader.default);
|
|
7
7
|
}
|
|
8
8
|
const AppElement = document.getElementById("app");
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { t as twMerge, a5 as clsx, a6 as get, a7 as set, a8 as appendErrors, a9 as useFormContext, aa as Primitive, ab as cva, ac as FormProvider, ad as Controller, ae as Slot, af as useForm, ag as Root2, ah as List, ai as Trigger, aj as Content, ak as setModelName, al as setModelId, am as setModelDescription, an as setModelExtension, ao as setAuthorName, ap as setAuthorWebsite, aq as setStateSchema, ar as setInitialState, as as addModule, at as setModuleName, au as deleteModule, av as addOperation, aw as setOperationName, ax as setOperationSchema, ay as setOperationDescription, az as deleteOperation, aA as addOperationError, aB as deleteOperationError, aC as setOperationErrorName } from "./app-
|
|
3
|
-
import { ba as inspect$1, bb as GraphQLError$1, bc as getNamedType, bd as invariant$2, be as isInputObjectType, bf as isScalarType, bg as isObjectType, bh as isInterfaceType, bi as isUnionType, bj as isEnumType, bk as print, bl as isPrintableAsBlockString, bm as Kind, bn as astFromValue$1, bo as DEFAULT_DEPRECATION_REASON, bp as isSpecifiedDirective, bq as isSpecifiedScalarType, br as isIntrospectionType, bs as z, bt as GraphQLScalarType, Z as pascalCase, bu as parse, bv as visit, bw as buildASTSchema, bx as extendSchema, by as getNullableType, bz as isListType, $ as getDefaultExportFromCjs, bA as snakeCase, bB as constantCase, bC as isAbstractType, bD as BREAK, bE as GraphQLInputObjectType, bF as GraphQLList, bG as GraphQLEnumType, bH as GraphQLObjectType, bI as GraphQLInterfaceType, bJ as SchemaMetaFieldDef, bK as TypeMetaFieldDef, bL as TypeNameMetaFieldDef, bM as isCompositeType, bN as isOutputType, bO as isInputType, bP as GraphQLBoolean, bQ as assertAbstractType, bR as doTypesOverlap, bS as DirectiveLocation, bT as specifiedRules$1, bU as NoUnusedFragmentsRule$1, bV as ExecutableDefinitionsRule$1, bW as validate$2, bX as validateSchema, bY as GraphQLID, bZ as GraphQLString, b_ as GraphQLFloat, b$ as GraphQLInt, c0 as GraphQLDirective, c1 as GraphQLUnionType, c2 as isNonNullType, c3 as GraphQLNonNull, c4 as isNamedType, c5 as isLeafType, c6 as GraphQLSchema, c7 as buildSchema, c8 as sentenceCase, am as hashKey } from "./app-loader-
|
|
2
|
+
import { t as twMerge, a5 as clsx, a6 as get, a7 as set, a8 as appendErrors, a9 as useFormContext, aa as Primitive, ab as cva, ac as FormProvider, ad as Controller, ae as Slot, af as useForm, ag as Root2, ah as List, ai as Trigger, aj as Content, ak as setModelName, al as setModelId, am as setModelDescription, an as setModelExtension, ao as setAuthorName, ap as setAuthorWebsite, aq as setStateSchema, ar as setInitialState, as as addModule, at as setModuleName, au as deleteModule, av as addOperation, aw as setOperationName, ax as setOperationSchema, ay as setOperationDescription, az as deleteOperation, aA as addOperationError, aB as deleteOperationError, aC as setOperationErrorName } from "./app-BT03qzg4.js";
|
|
3
|
+
import { ba as inspect$1, bb as GraphQLError$1, bc as getNamedType, bd as invariant$2, be as isInputObjectType, bf as isScalarType, bg as isObjectType, bh as isInterfaceType, bi as isUnionType, bj as isEnumType, bk as print, bl as isPrintableAsBlockString, bm as Kind, bn as astFromValue$1, bo as DEFAULT_DEPRECATION_REASON, bp as isSpecifiedDirective, bq as isSpecifiedScalarType, br as isIntrospectionType, bs as z, bt as GraphQLScalarType, Z as pascalCase, bu as parse, bv as visit, bw as buildASTSchema, bx as extendSchema, by as getNullableType, bz as isListType, $ as getDefaultExportFromCjs, bA as snakeCase, bB as constantCase, bC as isAbstractType, bD as BREAK, bE as GraphQLInputObjectType, bF as GraphQLList, bG as GraphQLEnumType, bH as GraphQLObjectType, bI as GraphQLInterfaceType, bJ as SchemaMetaFieldDef, bK as TypeMetaFieldDef, bL as TypeNameMetaFieldDef, bM as isCompositeType, bN as isOutputType, bO as isInputType, bP as GraphQLBoolean, bQ as assertAbstractType, bR as doTypesOverlap, bS as DirectiveLocation, bT as specifiedRules$1, bU as NoUnusedFragmentsRule$1, bV as ExecutableDefinitionsRule$1, bW as validate$2, bX as validateSchema, bY as GraphQLID, bZ as GraphQLString, b_ as GraphQLFloat, b$ as GraphQLInt, c0 as GraphQLDirective, c1 as GraphQLUnionType, c2 as isNonNullType, c3 as GraphQLNonNull, c4 as isNamedType, c5 as isLeafType, c6 as GraphQLSchema, c7 as buildSchema, c8 as sentenceCase, am as hashKey } from "./app-loader-Cp_C_kSQ.js";
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import React__default, { forwardRef, useRef, useCallback, useImperativeHandle, useEffect, useState, createContext, useContext, memo, useId, useMemo } from "react";
|
|
6
|
-
import "./main.
|
|
6
|
+
import "./main.Hm4UID1Z.js";
|
|
7
7
|
import "@powerhousedao/reactor-browser";
|
|
8
8
|
import "react-dom";
|
|
9
9
|
import "@powerhousedao/reactor-browser/hooks/useUiNodesContext";
|
|
@@ -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.Hm4UID1Z.js";
|
|
14
|
+
import { aW as getAugmentedNamespace, $ as getDefaultExportFromCjs, ah as connectConfig, ac as logger } from "./app-loader-Cp_C_kSQ.js";
|
|
15
|
+
import { e as eventsExports, R as RENOWN_URL, g as getEnsInfo } from "./app-BT03qzg4.js";
|
|
16
|
+
import { d, c, b, f, a, r, s } from "./app-BT03qzg4.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-CJbQZ7hP.js"), true ? [] : void 0);
|
|
103
103
|
export {
|
|
104
104
|
__vitePreload as _
|
|
105
105
|
};
|
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.Hm4UID1Z.js"></script></head><body><div id="app"></div></body></html>
|
|
@@ -688,140 +688,79 @@ var require_lib = __commonJS({
|
|
|
688
688
|
}
|
|
689
689
|
});
|
|
690
690
|
|
|
691
|
-
// ../../packages/document-drive/dist/src/
|
|
692
|
-
var
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
691
|
+
// ../../packages/document-drive/dist/src/cache/util.js
|
|
692
|
+
var trimResultingState = (document) => {
|
|
693
|
+
const global2 = document.operations.global.map((e) => {
|
|
694
|
+
delete e.resultingState;
|
|
695
|
+
return e;
|
|
696
|
+
});
|
|
697
|
+
const local = document.operations.local.map((e) => {
|
|
698
|
+
delete e.resultingState;
|
|
699
|
+
return e;
|
|
700
|
+
});
|
|
701
|
+
return { ...document, operations: { global: global2, local } };
|
|
699
702
|
};
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
this.
|
|
708
|
-
this.
|
|
709
|
-
this.
|
|
710
|
-
this.error = this.error.bind(this);
|
|
711
|
-
this.debug = this.debug.bind(this);
|
|
712
|
-
this.verbose = this.verbose.bind(this);
|
|
713
|
-
}
|
|
714
|
-
get level() {
|
|
715
|
-
return this.#levelString;
|
|
716
|
-
}
|
|
717
|
-
set level(level) {
|
|
718
|
-
this.#levelString = level;
|
|
719
|
-
}
|
|
720
|
-
get errorHandler() {
|
|
721
|
-
return this.#errorHandler;
|
|
722
|
-
}
|
|
723
|
-
set errorHandler(handler) {
|
|
724
|
-
this.#errorHandler = handler;
|
|
725
|
-
}
|
|
726
|
-
get #levelValue() {
|
|
727
|
-
if (this.#levelString === "env") {
|
|
728
|
-
const envLevel = typeof process !== "undefined" ? process.env.LOG_LEVEL : void 0;
|
|
729
|
-
if (!envLevel) {
|
|
730
|
-
return LEVELS.debug;
|
|
731
|
-
}
|
|
732
|
-
if (!(envLevel in LEVELS)) {
|
|
733
|
-
return LEVELS.debug;
|
|
734
|
-
}
|
|
735
|
-
return LEVELS[envLevel];
|
|
736
|
-
}
|
|
737
|
-
return LEVELS[this.#levelString];
|
|
703
|
+
|
|
704
|
+
// ../../packages/document-drive/dist/src/cache/memory.js
|
|
705
|
+
var InMemoryCache = class {
|
|
706
|
+
idTodocument = /* @__PURE__ */ new Map();
|
|
707
|
+
idToDrive = /* @__PURE__ */ new Map();
|
|
708
|
+
slugToDriveId = /* @__PURE__ */ new Map();
|
|
709
|
+
clear() {
|
|
710
|
+
this.idTodocument.clear();
|
|
711
|
+
this.idToDrive.clear();
|
|
712
|
+
this.slugToDriveId.clear();
|
|
738
713
|
}
|
|
739
|
-
|
|
740
|
-
|
|
714
|
+
/////////////////////////////////////////////////////////////////////////////
|
|
715
|
+
// ICache
|
|
716
|
+
/////////////////////////////////////////////////////////////////////////////
|
|
717
|
+
async setDocument(documentId, document) {
|
|
718
|
+
const doc = trimResultingState(document);
|
|
719
|
+
this.idTodocument.set(documentId, doc);
|
|
741
720
|
}
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
return;
|
|
745
|
-
}
|
|
746
|
-
return this.debug(...data);
|
|
721
|
+
async getDocument(documentId) {
|
|
722
|
+
return this.idTodocument.get(documentId);
|
|
747
723
|
}
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
return;
|
|
751
|
-
}
|
|
752
|
-
return console.debug(...[...this.#tags, ...data]);
|
|
724
|
+
async deleteDocument(documentId) {
|
|
725
|
+
return this.idTodocument.delete(documentId);
|
|
753
726
|
}
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
}
|
|
758
|
-
return console.info(...[...this.#tags, ...data]);
|
|
727
|
+
async setDrive(driveId, drive) {
|
|
728
|
+
const doc = trimResultingState(drive);
|
|
729
|
+
this.idToDrive.set(driveId, doc);
|
|
759
730
|
}
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
return;
|
|
763
|
-
}
|
|
764
|
-
return console.warn(...[...this.#tags, ...data]);
|
|
731
|
+
async getDrive(driveId) {
|
|
732
|
+
return this.idToDrive.get(driveId);
|
|
765
733
|
}
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
734
|
+
async deleteDrive(driveId) {
|
|
735
|
+
const drive = this.idToDrive.get(driveId);
|
|
736
|
+
if (!drive) {
|
|
737
|
+
return false;
|
|
769
738
|
}
|
|
770
|
-
|
|
771
|
-
|
|
739
|
+
const slug = drive.state.global.slug;
|
|
740
|
+
if (slug) {
|
|
741
|
+
this.slugToDriveId.delete(slug);
|
|
772
742
|
}
|
|
773
|
-
return
|
|
743
|
+
return this.idToDrive.delete(driveId);
|
|
774
744
|
}
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
loggerInstance.level = logLevel;
|
|
780
|
-
loggerInstance.errorHandler = errorHandler;
|
|
781
|
-
var logger = loggerInstance;
|
|
782
|
-
var childLogger = (tags) => {
|
|
783
|
-
const logger2 = new ConsoleLogger(tags);
|
|
784
|
-
logger2.level = logLevel;
|
|
785
|
-
logger2.errorHandler = errorHandler;
|
|
786
|
-
return logger2;
|
|
787
|
-
};
|
|
788
|
-
|
|
789
|
-
// ../../packages/document-drive/dist/src/cache/memory.js
|
|
790
|
-
var InMemoryCache = class {
|
|
791
|
-
cache = /* @__PURE__ */ new Map();
|
|
792
|
-
clear() {
|
|
793
|
-
this.cache.clear();
|
|
745
|
+
async setDriveBySlug(slug, drive) {
|
|
746
|
+
const driveId = drive.state.global.id;
|
|
747
|
+
this.slugToDriveId.set(slug, driveId);
|
|
748
|
+
this.setDrive(driveId, drive);
|
|
794
749
|
}
|
|
795
|
-
async
|
|
796
|
-
const
|
|
797
|
-
|
|
798
|
-
return
|
|
799
|
-
});
|
|
800
|
-
const local = document.operations.local.map((e) => {
|
|
801
|
-
delete e.resultingState;
|
|
802
|
-
return e;
|
|
803
|
-
});
|
|
804
|
-
const doc = { ...document, operations: { global: global2, local } };
|
|
805
|
-
if (!this.cache.has(drive)) {
|
|
806
|
-
this.cache.set(drive, /* @__PURE__ */ new Map());
|
|
750
|
+
async getDriveBySlug(slug) {
|
|
751
|
+
const driveId = this.slugToDriveId.get(slug);
|
|
752
|
+
if (!driveId) {
|
|
753
|
+
return void 0;
|
|
807
754
|
}
|
|
808
|
-
this.
|
|
809
|
-
return true;
|
|
755
|
+
return this.getDrive(driveId);
|
|
810
756
|
}
|
|
811
|
-
async
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
return this.cache.get(drive)?.get(id);
|
|
816
|
-
}
|
|
817
|
-
async getCachedOperations(drive, id) {
|
|
818
|
-
try {
|
|
819
|
-
const document = await this.getDocument(drive, id);
|
|
820
|
-
return document?.operations;
|
|
821
|
-
} catch (error) {
|
|
822
|
-
logger.error(error);
|
|
823
|
-
return void 0;
|
|
757
|
+
async deleteDriveBySlug(slug) {
|
|
758
|
+
const driveId = this.slugToDriveId.get(slug);
|
|
759
|
+
if (!driveId) {
|
|
760
|
+
return false;
|
|
824
761
|
}
|
|
762
|
+
this.slugToDriveId.delete(slug);
|
|
763
|
+
return this.deleteDrive(driveId);
|
|
825
764
|
}
|
|
826
765
|
};
|
|
827
766
|
var memory_default = InMemoryCache;
|
|
@@ -1187,6 +1126,104 @@ function handleTargetNameCollisions(params) {
|
|
|
1187
1126
|
return targetName;
|
|
1188
1127
|
}
|
|
1189
1128
|
|
|
1129
|
+
// ../../packages/document-drive/dist/src/utils/logger.js
|
|
1130
|
+
var LEVELS = {
|
|
1131
|
+
verbose: 1,
|
|
1132
|
+
debug: 2,
|
|
1133
|
+
info: 3,
|
|
1134
|
+
warn: 4,
|
|
1135
|
+
error: 5,
|
|
1136
|
+
silent: 6
|
|
1137
|
+
};
|
|
1138
|
+
var ConsoleLogger = class {
|
|
1139
|
+
#tags;
|
|
1140
|
+
#levelString = "env";
|
|
1141
|
+
#errorHandler;
|
|
1142
|
+
constructor(tags, errorHandler2) {
|
|
1143
|
+
this.#tags = (tags || []).map((tag) => `[${tag}]`);
|
|
1144
|
+
this.#errorHandler = errorHandler2;
|
|
1145
|
+
this.log = this.log.bind(this);
|
|
1146
|
+
this.info = this.info.bind(this);
|
|
1147
|
+
this.warn = this.warn.bind(this);
|
|
1148
|
+
this.error = this.error.bind(this);
|
|
1149
|
+
this.debug = this.debug.bind(this);
|
|
1150
|
+
this.verbose = this.verbose.bind(this);
|
|
1151
|
+
}
|
|
1152
|
+
get level() {
|
|
1153
|
+
return this.#levelString;
|
|
1154
|
+
}
|
|
1155
|
+
set level(level) {
|
|
1156
|
+
this.#levelString = level;
|
|
1157
|
+
}
|
|
1158
|
+
get errorHandler() {
|
|
1159
|
+
return this.#errorHandler;
|
|
1160
|
+
}
|
|
1161
|
+
set errorHandler(handler) {
|
|
1162
|
+
this.#errorHandler = handler;
|
|
1163
|
+
}
|
|
1164
|
+
get #levelValue() {
|
|
1165
|
+
if (this.#levelString === "env") {
|
|
1166
|
+
const envLevel = typeof process !== "undefined" ? process.env.LOG_LEVEL : void 0;
|
|
1167
|
+
if (!envLevel) {
|
|
1168
|
+
return LEVELS.debug;
|
|
1169
|
+
}
|
|
1170
|
+
if (!(envLevel in LEVELS)) {
|
|
1171
|
+
return LEVELS.debug;
|
|
1172
|
+
}
|
|
1173
|
+
return LEVELS[envLevel];
|
|
1174
|
+
}
|
|
1175
|
+
return LEVELS[this.#levelString];
|
|
1176
|
+
}
|
|
1177
|
+
log(...data) {
|
|
1178
|
+
return this.debug(...data);
|
|
1179
|
+
}
|
|
1180
|
+
verbose(...data) {
|
|
1181
|
+
if (this.#levelValue > LEVELS.verbose) {
|
|
1182
|
+
return;
|
|
1183
|
+
}
|
|
1184
|
+
return this.debug(...data);
|
|
1185
|
+
}
|
|
1186
|
+
debug(...data) {
|
|
1187
|
+
if (this.#levelValue > LEVELS.debug) {
|
|
1188
|
+
return;
|
|
1189
|
+
}
|
|
1190
|
+
return console.debug(...[...this.#tags, ...data]);
|
|
1191
|
+
}
|
|
1192
|
+
info(...data) {
|
|
1193
|
+
if (this.#levelValue > LEVELS.info) {
|
|
1194
|
+
return;
|
|
1195
|
+
}
|
|
1196
|
+
return console.info(...[...this.#tags, ...data]);
|
|
1197
|
+
}
|
|
1198
|
+
warn(...data) {
|
|
1199
|
+
if (this.#levelValue > LEVELS.warn) {
|
|
1200
|
+
return;
|
|
1201
|
+
}
|
|
1202
|
+
return console.warn(...[...this.#tags, ...data]);
|
|
1203
|
+
}
|
|
1204
|
+
error(...data) {
|
|
1205
|
+
if (this.#levelValue > LEVELS.error) {
|
|
1206
|
+
return;
|
|
1207
|
+
}
|
|
1208
|
+
if (this.#errorHandler) {
|
|
1209
|
+
this.#errorHandler(...data);
|
|
1210
|
+
}
|
|
1211
|
+
return console.error(...[...this.#tags, ...data]);
|
|
1212
|
+
}
|
|
1213
|
+
};
|
|
1214
|
+
var loggerInstance = new ConsoleLogger();
|
|
1215
|
+
var logLevel = "env";
|
|
1216
|
+
var errorHandler;
|
|
1217
|
+
loggerInstance.level = logLevel;
|
|
1218
|
+
loggerInstance.errorHandler = errorHandler;
|
|
1219
|
+
var logger = loggerInstance;
|
|
1220
|
+
var childLogger = (tags) => {
|
|
1221
|
+
const logger2 = new ConsoleLogger(tags);
|
|
1222
|
+
logger2.level = logLevel;
|
|
1223
|
+
logger2.errorHandler = errorHandler;
|
|
1224
|
+
return logger2;
|
|
1225
|
+
};
|
|
1226
|
+
|
|
1190
1227
|
// ../../packages/document-drive/dist/src/drive-document-model/gen/constants.js
|
|
1191
1228
|
var fileExtension = "phdd";
|
|
1192
1229
|
var documentType = "powerhouse/document-drive";
|
|
@@ -1690,6 +1727,44 @@ var MemoryStorage = class {
|
|
|
1690
1727
|
}
|
|
1691
1728
|
return Promise.resolve(document);
|
|
1692
1729
|
}
|
|
1730
|
+
async delete(documentId) {
|
|
1731
|
+
const drives = await this.getDrives();
|
|
1732
|
+
for (const driveId of drives) {
|
|
1733
|
+
if (driveId === documentId)
|
|
1734
|
+
continue;
|
|
1735
|
+
await this.removeChild(driveId, documentId);
|
|
1736
|
+
}
|
|
1737
|
+
delete this.driveManifests[documentId];
|
|
1738
|
+
if (this.documents[documentId]) {
|
|
1739
|
+
delete this.documents[documentId];
|
|
1740
|
+
return Promise.resolve(true);
|
|
1741
|
+
}
|
|
1742
|
+
return Promise.resolve(false);
|
|
1743
|
+
}
|
|
1744
|
+
async addChild(parentId, childId) {
|
|
1745
|
+
if (parentId === childId) {
|
|
1746
|
+
throw new Error("Cannot associate a document with itself");
|
|
1747
|
+
}
|
|
1748
|
+
const children = await this.getChildren(childId);
|
|
1749
|
+
if (children.includes(parentId)) {
|
|
1750
|
+
throw new Error("Cannot associate a document with its child");
|
|
1751
|
+
}
|
|
1752
|
+
const manifest = this.getManifest(parentId);
|
|
1753
|
+
manifest.documentIds.add(childId);
|
|
1754
|
+
this.updateDriveManifest(parentId, manifest);
|
|
1755
|
+
}
|
|
1756
|
+
async removeChild(parentId, childId) {
|
|
1757
|
+
const manifest = this.getManifest(parentId);
|
|
1758
|
+
if (manifest.documentIds.delete(childId)) {
|
|
1759
|
+
this.updateDriveManifest(parentId, manifest);
|
|
1760
|
+
return true;
|
|
1761
|
+
}
|
|
1762
|
+
return false;
|
|
1763
|
+
}
|
|
1764
|
+
async getChildren(parentId) {
|
|
1765
|
+
const manifest = this.getManifest(parentId);
|
|
1766
|
+
return [...manifest.documentIds];
|
|
1767
|
+
}
|
|
1693
1768
|
////////////////////////////////
|
|
1694
1769
|
// IDriveStorage
|
|
1695
1770
|
////////////////////////////////
|
|
@@ -1697,7 +1772,7 @@ var MemoryStorage = class {
|
|
|
1697
1772
|
return this.exists(id);
|
|
1698
1773
|
}
|
|
1699
1774
|
getDocuments(drive) {
|
|
1700
|
-
const manifest = this.
|
|
1775
|
+
const manifest = this.getManifest(drive);
|
|
1701
1776
|
return Promise.resolve([...manifest.documentIds]);
|
|
1702
1777
|
}
|
|
1703
1778
|
getDocument(driveId, id) {
|
|
@@ -1709,7 +1784,7 @@ var MemoryStorage = class {
|
|
|
1709
1784
|
}
|
|
1710
1785
|
async createDocument(drive, id, document) {
|
|
1711
1786
|
await this.create(id, document);
|
|
1712
|
-
const manifest = this.
|
|
1787
|
+
const manifest = this.getManifest(drive);
|
|
1713
1788
|
manifest.documentIds.add(id);
|
|
1714
1789
|
this.updateDriveManifest(drive, manifest);
|
|
1715
1790
|
}
|
|
@@ -1726,15 +1801,7 @@ var MemoryStorage = class {
|
|
|
1726
1801
|
};
|
|
1727
1802
|
}
|
|
1728
1803
|
async deleteDocument(drive, id) {
|
|
1729
|
-
|
|
1730
|
-
for (const driveId of drives) {
|
|
1731
|
-
const manifest = this.getDriveManifest(driveId);
|
|
1732
|
-
if (manifest.documentIds.has(id)) {
|
|
1733
|
-
manifest.documentIds.delete(id);
|
|
1734
|
-
this.updateDriveManifest(driveId, manifest);
|
|
1735
|
-
}
|
|
1736
|
-
}
|
|
1737
|
-
delete this.documents[id];
|
|
1804
|
+
this.delete(id);
|
|
1738
1805
|
}
|
|
1739
1806
|
async getDrives() {
|
|
1740
1807
|
return Object.keys(this.driveManifests);
|
|
@@ -1780,14 +1847,14 @@ var MemoryStorage = class {
|
|
|
1780
1847
|
};
|
|
1781
1848
|
}
|
|
1782
1849
|
async deleteDrive(id) {
|
|
1783
|
-
const manifest = this.
|
|
1850
|
+
const manifest = this.getManifest(id);
|
|
1784
1851
|
const drives = await this.getDrives();
|
|
1785
1852
|
await Promise.all([...manifest.documentIds].map((docId) => {
|
|
1786
1853
|
for (const driveId of drives) {
|
|
1787
1854
|
if (driveId === id) {
|
|
1788
1855
|
continue;
|
|
1789
1856
|
}
|
|
1790
|
-
const manifest2 = this.
|
|
1857
|
+
const manifest2 = this.getManifest(driveId);
|
|
1791
1858
|
if (manifest2.documentIds.has(docId)) {
|
|
1792
1859
|
return;
|
|
1793
1860
|
}
|
|
@@ -1828,7 +1895,7 @@ var MemoryStorage = class {
|
|
|
1828
1895
|
////////////////////////////////
|
|
1829
1896
|
// Private
|
|
1830
1897
|
////////////////////////////////
|
|
1831
|
-
|
|
1898
|
+
getManifest(driveId) {
|
|
1832
1899
|
if (!this.driveManifests[driveId]) {
|
|
1833
1900
|
this.driveManifests[driveId] = { documentIds: /* @__PURE__ */ new Set() };
|
|
1834
1901
|
}
|
|
@@ -12377,7 +12444,7 @@ var BaseDocumentDriveServer = class {
|
|
|
12377
12444
|
};
|
|
12378
12445
|
await this.storage.createDrive(id, document);
|
|
12379
12446
|
if (input.global.slug) {
|
|
12380
|
-
await this.cache.
|
|
12447
|
+
await this.cache.deleteDriveBySlug(input.global.slug);
|
|
12381
12448
|
}
|
|
12382
12449
|
await this._initializeDrive(id);
|
|
12383
12450
|
this.eventEmitter.emit("driveAdded", document);
|
|
@@ -12409,7 +12476,7 @@ var BaseDocumentDriveServer = class {
|
|
|
12409
12476
|
const result = await Promise.allSettled([
|
|
12410
12477
|
this.stopSyncRemoteDrive(driveId),
|
|
12411
12478
|
this.listenerManager.removeDrive(driveId),
|
|
12412
|
-
this.cache.
|
|
12479
|
+
this.cache.deleteDrive(driveId),
|
|
12413
12480
|
this.storage.deleteDrive(driveId)
|
|
12414
12481
|
]);
|
|
12415
12482
|
result.forEach((r) => {
|
|
@@ -12424,7 +12491,7 @@ var BaseDocumentDriveServer = class {
|
|
|
12424
12491
|
async getDrive(driveId, options) {
|
|
12425
12492
|
let document;
|
|
12426
12493
|
try {
|
|
12427
|
-
const cachedDocument = await this.cache.
|
|
12494
|
+
const cachedDocument = await this.cache.getDrive(driveId);
|
|
12428
12495
|
if (cachedDocument && isDocumentDrive(cachedDocument)) {
|
|
12429
12496
|
document = cachedDocument;
|
|
12430
12497
|
if (isAtRevision(document, options?.revisions)) {
|
|
@@ -12440,16 +12507,16 @@ var BaseDocumentDriveServer = class {
|
|
|
12440
12507
|
throw new Error(`Document with id ${driveId} is not a Document Drive`);
|
|
12441
12508
|
} else {
|
|
12442
12509
|
if (!options?.revisions) {
|
|
12443
|
-
this.cache.
|
|
12510
|
+
this.cache.setDrive(driveId, result).catch(logger.error);
|
|
12444
12511
|
}
|
|
12445
12512
|
return result;
|
|
12446
12513
|
}
|
|
12447
12514
|
}
|
|
12448
12515
|
async getDriveBySlug(slug, options) {
|
|
12449
12516
|
try {
|
|
12450
|
-
const
|
|
12451
|
-
if (
|
|
12452
|
-
return
|
|
12517
|
+
const drive = await this.cache.getDriveBySlug(slug);
|
|
12518
|
+
if (drive) {
|
|
12519
|
+
return drive;
|
|
12453
12520
|
}
|
|
12454
12521
|
} catch (e) {
|
|
12455
12522
|
logger.error("Error getting drive from cache", e);
|
|
@@ -12459,14 +12526,14 @@ var BaseDocumentDriveServer = class {
|
|
|
12459
12526
|
if (!isDocumentDrive(document)) {
|
|
12460
12527
|
throw new Error(`Document with slug ${slug} is not a Document Drive`);
|
|
12461
12528
|
} else {
|
|
12462
|
-
this.cache.
|
|
12529
|
+
this.cache.setDriveBySlug(slug, document).catch(logger.error);
|
|
12463
12530
|
return document;
|
|
12464
12531
|
}
|
|
12465
12532
|
}
|
|
12466
12533
|
async getDocument(driveId, documentId, options) {
|
|
12467
12534
|
let cachedDocument;
|
|
12468
12535
|
try {
|
|
12469
|
-
cachedDocument = await this.cache.getDocument(
|
|
12536
|
+
cachedDocument = await this.cache.getDocument(documentId);
|
|
12470
12537
|
if (cachedDocument && isAtRevision(cachedDocument, options?.revisions)) {
|
|
12471
12538
|
return cachedDocument;
|
|
12472
12539
|
}
|
|
@@ -12476,7 +12543,7 @@ var BaseDocumentDriveServer = class {
|
|
|
12476
12543
|
const documentStorage = cachedDocument ?? await this.storage.getDocument(driveId, documentId);
|
|
12477
12544
|
const document = this._buildDocument(documentStorage, options);
|
|
12478
12545
|
if (!options?.revisions) {
|
|
12479
|
-
this.cache.setDocument(
|
|
12546
|
+
this.cache.setDocument(documentId, document).catch(logger.error);
|
|
12480
12547
|
}
|
|
12481
12548
|
return document;
|
|
12482
12549
|
}
|
|
@@ -12533,7 +12600,7 @@ var BaseDocumentDriveServer = class {
|
|
|
12533
12600
|
} catch (error) {
|
|
12534
12601
|
logger.warn("Error deleting document", error);
|
|
12535
12602
|
}
|
|
12536
|
-
await this.cache.deleteDocument(
|
|
12603
|
+
await this.cache.deleteDocument(documentId);
|
|
12537
12604
|
return this.storage.deleteDocument(driveId, documentId);
|
|
12538
12605
|
}
|
|
12539
12606
|
async _processOperations(driveId, documentId, documentStorage, operations) {
|
|
@@ -12821,7 +12888,7 @@ var BaseDocumentDriveServer = class {
|
|
|
12821
12888
|
};
|
|
12822
12889
|
});
|
|
12823
12890
|
if (document) {
|
|
12824
|
-
this.cache.setDocument(
|
|
12891
|
+
this.cache.setDocument(documentId, document).catch(logger.error);
|
|
12825
12892
|
}
|
|
12826
12893
|
const { scopes, branches } = operationsApplied.reduce((acc, operation) => {
|
|
12827
12894
|
if (!acc.scopes.includes(operation.scope)) {
|
|
@@ -12983,7 +13050,7 @@ var BaseDocumentDriveServer = class {
|
|
|
12983
13050
|
if (!document || !isDocumentDrive(document)) {
|
|
12984
13051
|
throw error ?? new Error("Invalid Document Drive document");
|
|
12985
13052
|
}
|
|
12986
|
-
this.cache.
|
|
13053
|
+
this.cache.setDrive(driveId, document).catch(logger.error);
|
|
12987
13054
|
const lastOperation = operationsApplied.filter((op) => op.scope === "global").slice().pop();
|
|
12988
13055
|
if (lastOperation) {
|
|
12989
13056
|
const newOp = operationsApplied.find((appliedOp) => !operations.find((o) => o.id === appliedOp.id && o.index === appliedOp.index && o.skip === appliedOp.skip && o.hash === appliedOp.hash));
|
|
@@ -13733,7 +13800,7 @@ var SynchronizationManager = class {
|
|
|
13733
13800
|
}
|
|
13734
13801
|
async getDrive(driveId) {
|
|
13735
13802
|
try {
|
|
13736
|
-
const cachedDocument = await this.cache.
|
|
13803
|
+
const cachedDocument = await this.cache.getDrive(driveId);
|
|
13737
13804
|
if (cachedDocument && isDocumentDrive(cachedDocument)) {
|
|
13738
13805
|
return cachedDocument;
|
|
13739
13806
|
}
|
|
@@ -13749,7 +13816,7 @@ var SynchronizationManager = class {
|
|
|
13749
13816
|
}
|
|
13750
13817
|
async getDocument(driveId, documentId) {
|
|
13751
13818
|
try {
|
|
13752
|
-
const cachedDocument = await this.cache.getDocument(
|
|
13819
|
+
const cachedDocument = await this.cache.getDocument(documentId);
|
|
13753
13820
|
if (cachedDocument) {
|
|
13754
13821
|
return cachedDocument;
|
|
13755
13822
|
}
|