@powerhousedao/connect 1.0.0-dev.243 → 1.0.0-dev.245
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/assets/{app-D3TxLTK-.css → app-76Vr3j5e.css} +19 -1
- package/dist/assets/{app-OhsW1euo.js → app-BH-6rUAk.js} +337 -337
- package/dist/assets/{app-loader-CjrEwupY.css → app-loader-Bnp0H-wa.css} +16 -0
- package/dist/assets/{app-loader-A6VDzgXS.js → app-loader-CQdXsdrs.js} +188 -194
- package/dist/assets/{ccip-DzPI63xu.js → ccip-DzlgrM-Q.js} +3 -3
- package/dist/assets/{content-BxH7jEK7.js → content-CGSfY9bJ.js} +3 -3
- package/dist/assets/{index-D-8e_JCN.js → index-BR7pEetO.js} +3 -3
- package/dist/assets/{index-BZxn24lR.js → index-Boh2tg26.js} +4 -4
- package/dist/assets/{index-CJeYWUG4.js → index-Ck0OHqQ0.js} +3 -3
- package/dist/assets/{main.cdpmF4Pk.js → main.PwF6jbJu.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/modules/@powerhousedao/reactor-browser/{chunk-YOX3ZAET.js → chunk-4AV4NYOH.js} +145 -159
- package/dist/modules/@powerhousedao/reactor-browser/{chunk-P46ZMPJ3.js → chunk-GZM7UEXF.js} +1 -1
- package/dist/modules/@powerhousedao/reactor-browser/{chunk-POMUCSTC.js → chunk-K62SYQYI.js} +22 -16
- package/dist/modules/@powerhousedao/reactor-browser/{chunk-6AXML2S3.js → chunk-QVHWUIBE.js} +1 -1
- package/dist/modules/@powerhousedao/reactor-browser/{chunk-4LZZ55AN.js → chunk-UIXXJKR2.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/vite-envs.sh +1 -1
- package/package.json +9 -9
|
@@ -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-BH-6rUAk.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-CQdXsdrs.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.PwF6jbJu.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,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-BH-6rUAk.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-CQdXsdrs.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.PwF6jbJu.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.PwF6jbJu.js";
|
|
14
|
+
import { aW as getAugmentedNamespace, $ as getDefaultExportFromCjs, ah as connectConfig, ac as logger } from "./app-loader-CQdXsdrs.js";
|
|
15
|
+
import { e as eventsExports, R as RENOWN_URL, g as getEnsInfo } from "./app-BH-6rUAk.js";
|
|
16
|
+
import { d, c, b, f, a, r, s } from "./app-BH-6rUAk.js";
|
|
17
17
|
import "react/jsx-runtime";
|
|
18
18
|
import "react";
|
|
19
19
|
import "@powerhousedao/reactor-browser";
|
|
@@ -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-CQdXsdrs.js","assets/main.PwF6jbJu.js","assets/app-loader-Bnp0H-wa.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import { _ as __vitePreload } from "./main.PwF6jbJu.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-CQdXsdrs.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");
|
|
@@ -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-Ck0OHqQ0.js"), true ? [] : void 0);
|
|
103
103
|
export {
|
|
104
104
|
__vitePreload as _
|
|
105
105
|
};
|
package/dist/index.html
CHANGED
|
@@ -97,4 +97,4 @@
|
|
|
97
97
|
"@powerhousedao/reactor-browser/utils/index": "/modules/@powerhousedao/reactor-browser/utils/index.js",
|
|
98
98
|
"@powerhousedao/reactor-browser/utils/signature": "/modules/@powerhousedao/reactor-browser/utils/signature.js"
|
|
99
99
|
}
|
|
100
|
-
}</script><script type="module" crossorigin="" src="/assets/main.
|
|
100
|
+
}</script><script type="module" crossorigin="" src="/assets/main.PwF6jbJu.js"></script></head><body><div id="app"></div></body></html>
|
|
@@ -688,9 +688,110 @@ var require_lib = __commonJS({
|
|
|
688
688
|
}
|
|
689
689
|
});
|
|
690
690
|
|
|
691
|
+
// ../../packages/document-drive/dist/src/utils/logger.js
|
|
692
|
+
var LEVELS = {
|
|
693
|
+
verbose: 1,
|
|
694
|
+
debug: 2,
|
|
695
|
+
info: 3,
|
|
696
|
+
warn: 4,
|
|
697
|
+
error: 5,
|
|
698
|
+
silent: 6
|
|
699
|
+
};
|
|
700
|
+
var ConsoleLogger = class {
|
|
701
|
+
#tags;
|
|
702
|
+
#levelString = "env";
|
|
703
|
+
#errorHandler;
|
|
704
|
+
constructor(tags, errorHandler2) {
|
|
705
|
+
this.#tags = (tags || []).map((tag) => `[${tag}]`);
|
|
706
|
+
this.#errorHandler = errorHandler2;
|
|
707
|
+
this.log = this.log.bind(this);
|
|
708
|
+
this.info = this.info.bind(this);
|
|
709
|
+
this.warn = this.warn.bind(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];
|
|
738
|
+
}
|
|
739
|
+
log(...data) {
|
|
740
|
+
return this.debug(...data);
|
|
741
|
+
}
|
|
742
|
+
verbose(...data) {
|
|
743
|
+
if (this.#levelValue > LEVELS.verbose) {
|
|
744
|
+
return;
|
|
745
|
+
}
|
|
746
|
+
return this.debug(...data);
|
|
747
|
+
}
|
|
748
|
+
debug(...data) {
|
|
749
|
+
if (this.#levelValue > LEVELS.debug) {
|
|
750
|
+
return;
|
|
751
|
+
}
|
|
752
|
+
return console.debug(...[...this.#tags, ...data]);
|
|
753
|
+
}
|
|
754
|
+
info(...data) {
|
|
755
|
+
if (this.#levelValue > LEVELS.info) {
|
|
756
|
+
return;
|
|
757
|
+
}
|
|
758
|
+
return console.info(...[...this.#tags, ...data]);
|
|
759
|
+
}
|
|
760
|
+
warn(...data) {
|
|
761
|
+
if (this.#levelValue > LEVELS.warn) {
|
|
762
|
+
return;
|
|
763
|
+
}
|
|
764
|
+
return console.warn(...[...this.#tags, ...data]);
|
|
765
|
+
}
|
|
766
|
+
error(...data) {
|
|
767
|
+
if (this.#levelValue > LEVELS.error) {
|
|
768
|
+
return;
|
|
769
|
+
}
|
|
770
|
+
if (this.#errorHandler) {
|
|
771
|
+
this.#errorHandler(...data);
|
|
772
|
+
}
|
|
773
|
+
return console.error(...[...this.#tags, ...data]);
|
|
774
|
+
}
|
|
775
|
+
};
|
|
776
|
+
var loggerInstance = new ConsoleLogger();
|
|
777
|
+
var logLevel = "env";
|
|
778
|
+
var errorHandler;
|
|
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
|
+
|
|
691
789
|
// ../../packages/document-drive/dist/src/cache/memory.js
|
|
692
790
|
var InMemoryCache = class {
|
|
693
791
|
cache = /* @__PURE__ */ new Map();
|
|
792
|
+
clear() {
|
|
793
|
+
this.cache.clear();
|
|
794
|
+
}
|
|
694
795
|
async setDocument(drive, id, document) {
|
|
695
796
|
const global2 = document.operations.global.map((e) => {
|
|
696
797
|
delete e.resultingState;
|
|
@@ -713,6 +814,15 @@ var InMemoryCache = class {
|
|
|
713
814
|
async getDocument(drive, id) {
|
|
714
815
|
return this.cache.get(drive)?.get(id);
|
|
715
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;
|
|
824
|
+
}
|
|
825
|
+
}
|
|
716
826
|
};
|
|
717
827
|
var memory_default = InMemoryCache;
|
|
718
828
|
|
|
@@ -1077,104 +1187,6 @@ function handleTargetNameCollisions(params) {
|
|
|
1077
1187
|
return targetName;
|
|
1078
1188
|
}
|
|
1079
1189
|
|
|
1080
|
-
// ../../packages/document-drive/dist/src/utils/logger.js
|
|
1081
|
-
var LEVELS = {
|
|
1082
|
-
verbose: 1,
|
|
1083
|
-
debug: 2,
|
|
1084
|
-
info: 3,
|
|
1085
|
-
warn: 4,
|
|
1086
|
-
error: 5,
|
|
1087
|
-
silent: 6
|
|
1088
|
-
};
|
|
1089
|
-
var ConsoleLogger = class {
|
|
1090
|
-
#tags;
|
|
1091
|
-
#levelString = "env";
|
|
1092
|
-
#errorHandler;
|
|
1093
|
-
constructor(tags, errorHandler2) {
|
|
1094
|
-
this.#tags = (tags || []).map((tag) => `[${tag}]`);
|
|
1095
|
-
this.#errorHandler = errorHandler2;
|
|
1096
|
-
this.log = this.log.bind(this);
|
|
1097
|
-
this.info = this.info.bind(this);
|
|
1098
|
-
this.warn = this.warn.bind(this);
|
|
1099
|
-
this.error = this.error.bind(this);
|
|
1100
|
-
this.debug = this.debug.bind(this);
|
|
1101
|
-
this.verbose = this.verbose.bind(this);
|
|
1102
|
-
}
|
|
1103
|
-
get level() {
|
|
1104
|
-
return this.#levelString;
|
|
1105
|
-
}
|
|
1106
|
-
set level(level) {
|
|
1107
|
-
this.#levelString = level;
|
|
1108
|
-
}
|
|
1109
|
-
get errorHandler() {
|
|
1110
|
-
return this.#errorHandler;
|
|
1111
|
-
}
|
|
1112
|
-
set errorHandler(handler) {
|
|
1113
|
-
this.#errorHandler = handler;
|
|
1114
|
-
}
|
|
1115
|
-
get #levelValue() {
|
|
1116
|
-
if (this.#levelString === "env") {
|
|
1117
|
-
const envLevel = typeof process !== "undefined" ? process.env.LOG_LEVEL : void 0;
|
|
1118
|
-
if (!envLevel) {
|
|
1119
|
-
return LEVELS.debug;
|
|
1120
|
-
}
|
|
1121
|
-
if (!(envLevel in LEVELS)) {
|
|
1122
|
-
return LEVELS.debug;
|
|
1123
|
-
}
|
|
1124
|
-
return LEVELS[envLevel];
|
|
1125
|
-
}
|
|
1126
|
-
return LEVELS[this.#levelString];
|
|
1127
|
-
}
|
|
1128
|
-
log(...data) {
|
|
1129
|
-
return this.debug(...data);
|
|
1130
|
-
}
|
|
1131
|
-
verbose(...data) {
|
|
1132
|
-
if (this.#levelValue > LEVELS.verbose) {
|
|
1133
|
-
return;
|
|
1134
|
-
}
|
|
1135
|
-
return this.debug(...data);
|
|
1136
|
-
}
|
|
1137
|
-
debug(...data) {
|
|
1138
|
-
if (this.#levelValue > LEVELS.debug) {
|
|
1139
|
-
return;
|
|
1140
|
-
}
|
|
1141
|
-
return console.debug(...[...this.#tags, ...data]);
|
|
1142
|
-
}
|
|
1143
|
-
info(...data) {
|
|
1144
|
-
if (this.#levelValue > LEVELS.info) {
|
|
1145
|
-
return;
|
|
1146
|
-
}
|
|
1147
|
-
return console.info(...[...this.#tags, ...data]);
|
|
1148
|
-
}
|
|
1149
|
-
warn(...data) {
|
|
1150
|
-
if (this.#levelValue > LEVELS.warn) {
|
|
1151
|
-
return;
|
|
1152
|
-
}
|
|
1153
|
-
return console.warn(...[...this.#tags, ...data]);
|
|
1154
|
-
}
|
|
1155
|
-
error(...data) {
|
|
1156
|
-
if (this.#levelValue > LEVELS.error) {
|
|
1157
|
-
return;
|
|
1158
|
-
}
|
|
1159
|
-
if (this.#errorHandler) {
|
|
1160
|
-
this.#errorHandler(...data);
|
|
1161
|
-
}
|
|
1162
|
-
return console.error(...[...this.#tags, ...data]);
|
|
1163
|
-
}
|
|
1164
|
-
};
|
|
1165
|
-
var loggerInstance = new ConsoleLogger();
|
|
1166
|
-
var logLevel = "env";
|
|
1167
|
-
var errorHandler;
|
|
1168
|
-
loggerInstance.level = logLevel;
|
|
1169
|
-
loggerInstance.errorHandler = errorHandler;
|
|
1170
|
-
var logger = loggerInstance;
|
|
1171
|
-
var childLogger = (tags) => {
|
|
1172
|
-
const logger2 = new ConsoleLogger(tags);
|
|
1173
|
-
logger2.level = logLevel;
|
|
1174
|
-
logger2.errorHandler = errorHandler;
|
|
1175
|
-
return logger2;
|
|
1176
|
-
};
|
|
1177
|
-
|
|
1178
1190
|
// ../../packages/document-drive/dist/src/drive-document-model/gen/constants.js
|
|
1179
1191
|
var fileExtension = "phdd";
|
|
1180
1192
|
var documentType = "powerhouse/document-drive";
|
|
@@ -1652,19 +1664,16 @@ var ReadDocumentNotFoundError = class extends ReadDriveError {
|
|
|
1652
1664
|
// ../../packages/document-drive/dist/src/storage/memory.js
|
|
1653
1665
|
var MemoryStorage = class {
|
|
1654
1666
|
documents;
|
|
1655
|
-
drives;
|
|
1656
1667
|
driveManifests;
|
|
1657
|
-
slugToDriveId = {};
|
|
1658
1668
|
constructor() {
|
|
1659
1669
|
this.documents = {};
|
|
1660
|
-
this.drives = {};
|
|
1661
1670
|
this.driveManifests = {};
|
|
1662
1671
|
}
|
|
1663
1672
|
////////////////////////////////
|
|
1664
1673
|
// IDocumentStorage
|
|
1665
1674
|
////////////////////////////////
|
|
1666
1675
|
exists(documentId) {
|
|
1667
|
-
return Promise.resolve(!!this.documents[documentId]);
|
|
1676
|
+
return Promise.resolve(!!this.documents[documentId] || !!this.documents[`drive/${documentId}`]);
|
|
1668
1677
|
}
|
|
1669
1678
|
create(documentId, document) {
|
|
1670
1679
|
this.documents[documentId] = document;
|
|
@@ -1673,6 +1682,10 @@ var MemoryStorage = class {
|
|
|
1673
1682
|
get(documentId) {
|
|
1674
1683
|
const document = this.documents[documentId];
|
|
1675
1684
|
if (!document) {
|
|
1685
|
+
const drive = this.documents[`drive/${documentId}`];
|
|
1686
|
+
if (drive) {
|
|
1687
|
+
return Promise.resolve(drive);
|
|
1688
|
+
}
|
|
1676
1689
|
throw new Error(`Document with id ${documentId} not found`);
|
|
1677
1690
|
}
|
|
1678
1691
|
return Promise.resolve(document);
|
|
@@ -1690,17 +1703,9 @@ var MemoryStorage = class {
|
|
|
1690
1703
|
getDocument(driveId, id) {
|
|
1691
1704
|
return this.get(id);
|
|
1692
1705
|
}
|
|
1693
|
-
async saveDocument(drive, id, document) {
|
|
1694
|
-
this.documents[id] = document;
|
|
1695
|
-
const manifest = this.getDriveManifest(drive);
|
|
1696
|
-
manifest.documentIds.add(id);
|
|
1697
|
-
this.updateDriveManifest(drive, manifest);
|
|
1698
|
-
}
|
|
1699
1706
|
async clearStorage() {
|
|
1700
1707
|
this.documents = {};
|
|
1701
|
-
this.drives = {};
|
|
1702
1708
|
this.driveManifests = {};
|
|
1703
|
-
this.slugToDriveId = {};
|
|
1704
1709
|
}
|
|
1705
1710
|
async createDocument(drive, id, document) {
|
|
1706
1711
|
await this.create(id, document);
|
|
@@ -1732,34 +1737,43 @@ var MemoryStorage = class {
|
|
|
1732
1737
|
delete this.documents[id];
|
|
1733
1738
|
}
|
|
1734
1739
|
async getDrives() {
|
|
1735
|
-
return Object.keys(this.
|
|
1740
|
+
return Object.keys(this.driveManifests);
|
|
1736
1741
|
}
|
|
1737
1742
|
async getDrive(id) {
|
|
1738
|
-
const drive = this.
|
|
1743
|
+
const drive = this.documents[`drive/${id}`];
|
|
1739
1744
|
if (!drive) {
|
|
1740
1745
|
throw new DriveNotFoundError(id);
|
|
1741
1746
|
}
|
|
1742
1747
|
return drive;
|
|
1743
1748
|
}
|
|
1744
1749
|
async getDriveBySlug(slug) {
|
|
1745
|
-
const driveId
|
|
1746
|
-
|
|
1747
|
-
|
|
1750
|
+
for (const driveId of Object.keys(this.driveManifests)) {
|
|
1751
|
+
const drive = this.documents[`drive/${driveId}`];
|
|
1752
|
+
if (drive.initialState.state.global.slug === slug) {
|
|
1753
|
+
return drive;
|
|
1754
|
+
}
|
|
1748
1755
|
}
|
|
1749
|
-
|
|
1756
|
+
throw new Error(`Drive with slug ${slug} not found`);
|
|
1750
1757
|
}
|
|
1751
1758
|
async createDrive(id, drive) {
|
|
1752
|
-
|
|
1753
|
-
this.updateDriveManifest(id, { documentIds: /* @__PURE__ */ new Set() });
|
|
1754
|
-
const { slug } = drive.initialState.state.global;
|
|
1759
|
+
const slug = drive.initialState.state.global.slug;
|
|
1755
1760
|
if (slug) {
|
|
1756
|
-
|
|
1761
|
+
let existingDrive;
|
|
1762
|
+
try {
|
|
1763
|
+
existingDrive = await this.getDriveBySlug(slug);
|
|
1764
|
+
} catch {
|
|
1765
|
+
}
|
|
1766
|
+
if (existingDrive) {
|
|
1767
|
+
throw new Error(`Drive with slug ${slug} already exists`);
|
|
1768
|
+
}
|
|
1757
1769
|
}
|
|
1770
|
+
await this.create(`drive/${id}`, drive);
|
|
1771
|
+
this.updateDriveManifest(id, { documentIds: /* @__PURE__ */ new Set() });
|
|
1758
1772
|
}
|
|
1759
1773
|
async addDriveOperations(id, operations, header) {
|
|
1760
1774
|
const drive = await this.getDrive(id);
|
|
1761
1775
|
const mergedOperations = mergeOperations(drive.operations, operations);
|
|
1762
|
-
this.
|
|
1776
|
+
this.documents[`drive/${id}`] = {
|
|
1763
1777
|
...drive,
|
|
1764
1778
|
...header,
|
|
1765
1779
|
operations: mergedOperations
|
|
@@ -1781,24 +1795,18 @@ var MemoryStorage = class {
|
|
|
1781
1795
|
delete this.documents[docId];
|
|
1782
1796
|
}));
|
|
1783
1797
|
delete this.driveManifests[id];
|
|
1784
|
-
delete this.
|
|
1785
|
-
for (const [slug, driveId] of Object.entries(this.slugToDriveId)) {
|
|
1786
|
-
if (driveId === id) {
|
|
1787
|
-
delete this.slugToDriveId[slug];
|
|
1788
|
-
}
|
|
1789
|
-
}
|
|
1798
|
+
delete this.documents[id];
|
|
1790
1799
|
}
|
|
1791
1800
|
async getSynchronizationUnitsRevision(units) {
|
|
1792
1801
|
const results = await Promise.allSettled(units.map(async (unit) => {
|
|
1793
1802
|
try {
|
|
1794
|
-
const document = await
|
|
1803
|
+
const document = await this.get(unit.documentId);
|
|
1795
1804
|
if (!document) {
|
|
1796
1805
|
return void 0;
|
|
1797
1806
|
}
|
|
1798
1807
|
const operation = document.operations[unit.scope].at(-1);
|
|
1799
1808
|
if (operation) {
|
|
1800
1809
|
return {
|
|
1801
|
-
driveId: unit.driveId,
|
|
1802
1810
|
documentId: unit.documentId,
|
|
1803
1811
|
scope: unit.scope,
|
|
1804
1812
|
branch: unit.branch,
|
|
@@ -11851,7 +11859,7 @@ var PullResponderTransmitter = class _PullResponderTransmitter {
|
|
|
11851
11859
|
const syncUnits = await this.manager.getListenerSyncUnitIds(driveId, listenerId);
|
|
11852
11860
|
let success = true;
|
|
11853
11861
|
for (const revision of revisions) {
|
|
11854
|
-
const syncUnit = syncUnits.find((s) => s.scope === revision.scope && s.branch === revision.branch && s.
|
|
11862
|
+
const syncUnit = syncUnits.find((s) => s.scope === revision.scope && s.branch === revision.branch && s.documentId == revision.documentId);
|
|
11855
11863
|
if (!syncUnit) {
|
|
11856
11864
|
this.logger.warn("Unknown sync unit was acknowledged", revision);
|
|
11857
11865
|
success = false;
|
|
@@ -12185,17 +12193,6 @@ var BaseDocumentDriveServer = class {
|
|
|
12185
12193
|
taskQueueMethod: options?.taskQueueMethod === void 0 ? RunAsap.runAsap : options.taskQueueMethod
|
|
12186
12194
|
};
|
|
12187
12195
|
this.defaultDrivesManager = new DefaultDrivesManager(this, this.defaultDrivesManagerDelegate, options);
|
|
12188
|
-
this.storage.setStorageDelegate?.({
|
|
12189
|
-
getCachedOperations: async (drive, id) => {
|
|
12190
|
-
try {
|
|
12191
|
-
const document = await this.cache.getDocument(drive, id);
|
|
12192
|
-
return document?.operations;
|
|
12193
|
-
} catch (error) {
|
|
12194
|
-
logger.error(error);
|
|
12195
|
-
return void 0;
|
|
12196
|
-
}
|
|
12197
|
-
}
|
|
12198
|
-
});
|
|
12199
12196
|
this.initializePromise = this._initialize();
|
|
12200
12197
|
}
|
|
12201
12198
|
// workaround for testing the ephemeral listeners -- we don't have DI in place yet
|
|
@@ -12995,7 +12992,6 @@ var BaseDocumentDriveServer = class {
|
|
|
12995
12992
|
this.listenerManager.updateSynchronizationRevisions(driveId, [
|
|
12996
12993
|
{
|
|
12997
12994
|
syncId: "0",
|
|
12998
|
-
driveId,
|
|
12999
12995
|
documentId: "",
|
|
13000
12996
|
scope: "global",
|
|
13001
12997
|
branch: "main",
|
|
@@ -13306,7 +13302,7 @@ var ListenerManager = class _ListenerManager {
|
|
|
13306
13302
|
this.logger.verbose(`Abandoning push for sync unit ${syncUnit.syncId}: already up-to-date (${unitState.listenerRev} >= ${syncUnit.revision})`);
|
|
13307
13303
|
return;
|
|
13308
13304
|
} else {
|
|
13309
|
-
this.logger.verbose(`Listener out-of-date for sync unit (${syncUnit.
|
|
13305
|
+
this.logger.verbose(`Listener out-of-date for sync unit (${syncUnit.scope}, ${syncUnit.documentId}): ${unitState?.listenerRev} < ${syncUnit.revision}`);
|
|
13310
13306
|
}
|
|
13311
13307
|
const opData = [];
|
|
13312
13308
|
try {
|
|
@@ -13461,11 +13457,11 @@ var ListenerManager = class _ListenerManager {
|
|
|
13461
13457
|
if (entry && entry.listenerRev >= syncUnit.revision) {
|
|
13462
13458
|
return;
|
|
13463
13459
|
}
|
|
13464
|
-
const { documentId,
|
|
13460
|
+
const { documentId, scope, branch } = syncUnit;
|
|
13465
13461
|
try {
|
|
13466
13462
|
const operations = await this.syncManager.getOperationData(
|
|
13467
13463
|
// DEAL WITH INVALID SYNC ID ERROR
|
|
13468
|
-
|
|
13464
|
+
driveId,
|
|
13469
13465
|
syncUnit.syncId,
|
|
13470
13466
|
{
|
|
13471
13467
|
since: options?.since,
|
|
@@ -13478,7 +13474,7 @@ var ListenerManager = class _ListenerManager {
|
|
|
13478
13474
|
}
|
|
13479
13475
|
operationsCount += operations.length;
|
|
13480
13476
|
strands.push({
|
|
13481
|
-
driveId
|
|
13477
|
+
driveId,
|
|
13482
13478
|
documentId,
|
|
13483
13479
|
scope,
|
|
13484
13480
|
branch,
|
|
@@ -13639,26 +13635,18 @@ var SynchronizationManager = class {
|
|
|
13639
13635
|
async getSynchronizationUnitsRevision(driveId, syncUnitsQuery) {
|
|
13640
13636
|
const drive = await this.getDrive(driveId);
|
|
13641
13637
|
const revisions = await this.storage.getSynchronizationUnitsRevision(syncUnitsQuery);
|
|
13642
|
-
|
|
13638
|
+
return syncUnitsQuery.map((s) => ({
|
|
13643
13639
|
...s,
|
|
13644
13640
|
lastUpdated: drive.created,
|
|
13645
|
-
revision: -1
|
|
13641
|
+
revision: revisions.find((r) => r.documentId === s.documentId && r.scope === s.scope && r.branch === s.branch)?.revision ?? -1
|
|
13646
13642
|
}));
|
|
13647
|
-
for (const revision of revisions) {
|
|
13648
|
-
const syncUnit = synchronizationUnits.find((s) => revision.driveId === s.driveId && revision.documentId === s.documentId && revision.scope === s.scope && revision.branch === s.branch);
|
|
13649
|
-
if (syncUnit) {
|
|
13650
|
-
syncUnit.revision = revision.revision;
|
|
13651
|
-
syncUnit.lastUpdated = revision.lastUpdated;
|
|
13652
|
-
}
|
|
13653
|
-
}
|
|
13654
|
-
return synchronizationUnits;
|
|
13655
13643
|
}
|
|
13656
13644
|
async getSynchronizationUnitsIds(driveId, documentId, scope, branch, documentType2) {
|
|
13657
13645
|
const drive = await this.getDrive(driveId);
|
|
13658
13646
|
const nodes = drive.state.global.nodes.filter((node) => isFileNode(node) && (!documentId?.length || documentId.includes(node.id) || documentId.includes("*")) && (!documentType2?.length || documentType2.includes(node.documentType) || documentType2.includes("*")));
|
|
13659
13647
|
if ((!documentId || documentId.includes("*") || documentId.includes("")) && (!documentType2?.length || documentType2.includes("powerhouse/document-drive") || documentType2.includes("*"))) {
|
|
13660
13648
|
nodes.unshift({
|
|
13661
|
-
id:
|
|
13649
|
+
id: drive.state.global.id,
|
|
13662
13650
|
documentType: "powerhouse/document-drive",
|
|
13663
13651
|
synchronizationUnits: [
|
|
13664
13652
|
{
|
|
@@ -13700,7 +13688,6 @@ var SynchronizationManager = class {
|
|
|
13700
13688
|
syncId,
|
|
13701
13689
|
scope: syncUnit.scope,
|
|
13702
13690
|
branch: syncUnit.branch,
|
|
13703
|
-
driveId,
|
|
13704
13691
|
documentId: node.id,
|
|
13705
13692
|
documentType: node.documentType
|
|
13706
13693
|
};
|
|
@@ -13718,7 +13705,6 @@ var SynchronizationManager = class {
|
|
|
13718
13705
|
syncId,
|
|
13719
13706
|
scope,
|
|
13720
13707
|
branch,
|
|
13721
|
-
driveId,
|
|
13722
13708
|
documentId,
|
|
13723
13709
|
documentType: documentType2,
|
|
13724
13710
|
lastUpdated: lastOperation.timestamp ?? document.lastModified,
|