@powerhousedao/powerhouse-vetra-packages 6.2.3-dev.2 → 6.2.3-dev.4
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/browser/{connect-BqgnsniX.js → connect-BtHSAuSc.js} +10 -4
- package/dist/browser/{connect-BqgnsniX.js.map → connect-BtHSAuSc.js.map} +1 -1
- package/dist/browser/{dist-C-xkNfyD.js → dist-D69hfRZN.js} +8 -8
- package/dist/browser/dist-D69hfRZN.js.map +1 -0
- package/dist/browser/{document-drive-ZQzPQfEL.js → document-drive-BEXJ-rHp.js} +61 -21
- package/dist/browser/{document-drive-ZQzPQfEL.js.map → document-drive-BEXJ-rHp.js.map} +1 -1
- package/dist/browser/document-models/index.js +1 -1
- package/dist/browser/{editor-DZP1WlYy.js → editor-Cbl_EDjI.js} +5 -5
- package/dist/browser/{editor-DZP1WlYy.js.map → editor-Cbl_EDjI.js.map} +1 -1
- package/dist/browser/{editor-BNgF9-uX.js → editor-mNThkZOv.js} +6 -6
- package/dist/browser/{editor-BNgF9-uX.js.map → editor-mNThkZOv.js.map} +1 -1
- package/dist/browser/editors/document-model-editor/module.js +1 -1
- package/dist/browser/editors/generic-drive-explorer/index.js +4 -4
- package/dist/browser/editors/generic-drive-explorer/module.js +1 -1
- package/dist/browser/{folder-view-tx0A96ZI.js → folder-view-D8AkN1Oj.js} +3 -3
- package/dist/browser/{folder-view-tx0A96ZI.js.map → folder-view-D8AkN1Oj.js.map} +1 -1
- package/dist/browser/{graphql-editor-Cbkb5KRZ.js → graphql-editor-BcL3-Zha.js} +3 -3
- package/dist/browser/{graphql-editor-Cbkb5KRZ.js.map → graphql-editor-BcL3-Zha.js.map} +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/browser/{json-editor-CN6kPtl1.js → json-editor-DHXQRIN5.js} +3 -3
- package/dist/browser/{json-editor-CN6kPtl1.js.map → json-editor-DHXQRIN5.js.map} +1 -1
- package/dist/browser/lib-ewnRj2dJ.js.map +1 -1
- package/dist/browser/{state-schemas-CKh98ehP.js → state-schemas-C4F8lReN.js} +3 -3
- package/dist/browser/{state-schemas-CKh98ehP.js.map → state-schemas-C4F8lReN.js.map} +1 -1
- package/dist/node/{connect-CeLh6yfj.mjs → connect-B6IQsY6u.mjs} +10 -4
- package/dist/node/{connect-CeLh6yfj.mjs.map → connect-B6IQsY6u.mjs.map} +1 -1
- package/dist/node/{dist-CUFTZwfc.mjs → dist-hd-KLWy7.mjs} +8 -8
- package/dist/node/dist-hd-KLWy7.mjs.map +1 -0
- package/dist/node/{document-drive-D1NMjQQc.mjs → document-drive-CkV9NvD7.mjs} +61 -21
- package/dist/node/{document-drive-D1NMjQQc.mjs.map → document-drive-CkV9NvD7.mjs.map} +1 -1
- package/dist/node/document-models/index.mjs +1 -1
- package/dist/node/{editor-CXQOsbup.mjs → editor-C93fdI28.mjs} +6 -6
- package/dist/node/{editor-CXQOsbup.mjs.map → editor-C93fdI28.mjs.map} +1 -1
- package/dist/node/{editor-Dg2OZEJu.mjs → editor-DG1q4Y55.mjs} +5 -5
- package/dist/node/{editor-Dg2OZEJu.mjs.map → editor-DG1q4Y55.mjs.map} +1 -1
- package/dist/node/editors/document-model-editor/module.mjs +1 -1
- package/dist/node/editors/generic-drive-explorer/index.mjs +4 -4
- package/dist/node/editors/generic-drive-explorer/module.mjs +1 -1
- package/dist/node/{folder-view-DZ0o2-Ef.mjs → folder-view-BGabHV7H.mjs} +3 -3
- package/dist/node/{folder-view-DZ0o2-Ef.mjs.map → folder-view-BGabHV7H.mjs.map} +1 -1
- package/dist/node/{graphql-editor-DNxebuTn.mjs → graphql-editor-B-XIb6az.mjs} +3 -3
- package/dist/node/{graphql-editor-DNxebuTn.mjs.map → graphql-editor-B-XIb6az.mjs.map} +1 -1
- package/dist/node/index.mjs +1 -1
- package/dist/node/{json-editor-BpnEn9AS.mjs → json-editor-DB0vi6tV.mjs} +3 -3
- package/dist/node/{json-editor-BpnEn9AS.mjs.map → json-editor-DB0vi6tV.mjs.map} +1 -1
- package/dist/node/main-B1tRsYOp.mjs.map +1 -1
- package/dist/node/{state-schemas-CuSHxrn6.mjs → state-schemas-BGsgtEG1.mjs} +3 -3
- package/dist/node/{state-schemas-CuSHxrn6.mjs.map → state-schemas-BGsgtEG1.mjs.map} +1 -1
- package/package.json +7 -7
- package/dist/browser/dist-C-xkNfyD.js.map +0 -1
- package/dist/node/dist-CUFTZwfc.mjs.map +0 -1
|
@@ -2988,6 +2988,29 @@ const makeCreator = (arg) => {
|
|
|
2988
2988
|
* ```
|
|
2989
2989
|
*/
|
|
2990
2990
|
const create = makeCreator();
|
|
2991
|
+
/**
|
|
2992
|
+
* `original(draft)` to get original state in the draft mutation function.
|
|
2993
|
+
*
|
|
2994
|
+
* ## Example
|
|
2995
|
+
*
|
|
2996
|
+
* ```ts
|
|
2997
|
+
* import { create, original } from '../index';
|
|
2998
|
+
*
|
|
2999
|
+
* const baseState = { foo: { bar: 'str' }, arr: [] };
|
|
3000
|
+
* const state = create(
|
|
3001
|
+
* baseState,
|
|
3002
|
+
* (draft) => {
|
|
3003
|
+
* draft.foo.bar = 'str2';
|
|
3004
|
+
* expect(original(draft.foo)).toEqual({ bar: 'str' });
|
|
3005
|
+
* }
|
|
3006
|
+
* );
|
|
3007
|
+
* ```
|
|
3008
|
+
*/
|
|
3009
|
+
function original(target) {
|
|
3010
|
+
const proxyDraft = getProxyDraft(target);
|
|
3011
|
+
if (!proxyDraft) throw new Error(`original() is only used for a draft, parameter: ${target}`);
|
|
3012
|
+
return proxyDraft.original;
|
|
3013
|
+
}
|
|
2991
3014
|
Object.prototype.constructor.toString();
|
|
2992
3015
|
/**
|
|
2993
3016
|
* Cast a value to an Draft type value.
|
|
@@ -7345,36 +7368,36 @@ const logger = new class ConsoleLogger {
|
|
|
7345
7368
|
get #includeStack() {
|
|
7346
7369
|
return this.#level <= LOG_LEVELS.debug;
|
|
7347
7370
|
}
|
|
7348
|
-
verbose(message, ...replacements) {
|
|
7371
|
+
verbose = (message, ...replacements) => {
|
|
7349
7372
|
if (this.#level <= LOG_LEVELS.verbose) {
|
|
7350
7373
|
const [formattedMessage, meta] = formatMessage(this.#tagString, message, replacements, this.#includeStack);
|
|
7351
7374
|
console.debug(`[${meta["timestamp"]}] ${formattedMessage}`);
|
|
7352
7375
|
}
|
|
7353
|
-
}
|
|
7354
|
-
debug(message, ...replacements) {
|
|
7376
|
+
};
|
|
7377
|
+
debug = (message, ...replacements) => {
|
|
7355
7378
|
if (this.#level <= LOG_LEVELS.debug) {
|
|
7356
7379
|
const [formattedMessage, meta] = formatMessage(this.#tagString, message, replacements, this.#includeStack);
|
|
7357
7380
|
console.debug(`[${meta["timestamp"]}] ${formattedMessage}`);
|
|
7358
7381
|
}
|
|
7359
|
-
}
|
|
7360
|
-
info(message, ...replacements) {
|
|
7382
|
+
};
|
|
7383
|
+
info = (message, ...replacements) => {
|
|
7361
7384
|
if (this.#level <= LOG_LEVELS.info) {
|
|
7362
7385
|
const [formattedMessage, meta] = formatMessage(this.#tagString, message, replacements, this.#includeStack);
|
|
7363
7386
|
console.info(`[${meta["timestamp"]}] ${formattedMessage}`);
|
|
7364
7387
|
}
|
|
7365
|
-
}
|
|
7366
|
-
warn(message, ...replacements) {
|
|
7388
|
+
};
|
|
7389
|
+
warn = (message, ...replacements) => {
|
|
7367
7390
|
if (this.#level <= LOG_LEVELS.warn) {
|
|
7368
7391
|
const [formattedMessage, meta] = formatMessage(this.#tagString, message, replacements, this.#includeStack);
|
|
7369
7392
|
console.warn(`[${meta["timestamp"]}] ${formattedMessage}`);
|
|
7370
7393
|
}
|
|
7371
|
-
}
|
|
7372
|
-
error(message, ...replacements) {
|
|
7394
|
+
};
|
|
7395
|
+
error = (message, ...replacements) => {
|
|
7373
7396
|
if (this.#level <= LOG_LEVELS.error) {
|
|
7374
7397
|
const [formattedMessage, meta] = formatMessage(this.#tagString, message, replacements, this.#includeStack);
|
|
7375
7398
|
console.error(`[${meta["timestamp"]}] ${formattedMessage}`);
|
|
7376
7399
|
}
|
|
7377
|
-
}
|
|
7400
|
+
};
|
|
7378
7401
|
}();
|
|
7379
7402
|
//#endregion
|
|
7380
7403
|
//#region ../shared/dist/document-drive/index.js
|
|
@@ -7976,6 +7999,24 @@ function getNextCopyNumber(files, baseFilename) {
|
|
|
7976
7999
|
function escapeRegExp(string) {
|
|
7977
8000
|
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
7978
8001
|
}
|
|
8002
|
+
/**
|
|
8003
|
+
* The node list as plain objects for read-only scans. Inside a mutative draft
|
|
8004
|
+
* this returns the untouched base list, so a find or filter over it does not
|
|
8005
|
+
* create a child draft per element it visits. Callers must read before they
|
|
8006
|
+
* write: the base list does not see mutations made earlier in the same action.
|
|
8007
|
+
*/
|
|
8008
|
+
function readNodes(state) {
|
|
8009
|
+
return isDraft(state) ? original(state).nodes : state.nodes;
|
|
8010
|
+
}
|
|
8011
|
+
/**
|
|
8012
|
+
* The node list with a node added, ordered by id. The list is built and sorted
|
|
8013
|
+
* as plain objects, so inside a mutative draft the comparator never reads an
|
|
8014
|
+
* element through the draft proxy. Pass the list read with readNodes to get
|
|
8015
|
+
* that benefit; passing the draft's own list is correct but slow.
|
|
8016
|
+
*/
|
|
8017
|
+
function insertNodeSorted(nodes, node) {
|
|
8018
|
+
return [...nodes, node].sort((a, b) => a.id.localeCompare(b.id));
|
|
8019
|
+
}
|
|
7979
8020
|
function handleTargetNameCollisions(params) {
|
|
7980
8021
|
const { nodes, targetParentFolder, srcName, srcKind } = params;
|
|
7981
8022
|
const targetNodeChildrenNames = nodes.filter((node) => targetParentFolder === "" ? node.parentFolder === null : node.parentFolder === targetParentFolder).filter((node) => node.kind === srcKind).map((node) => node.name);
|
|
@@ -7986,23 +8027,22 @@ const isValidName = (name) => {
|
|
|
7986
8027
|
};
|
|
7987
8028
|
const nodeReducer = {
|
|
7988
8029
|
addFileOperation(state, action, dispatch) {
|
|
7989
|
-
|
|
8030
|
+
const nodes = readNodes(state);
|
|
8031
|
+
if (nodes.find((node) => node.id === action.input.id)) throw new Error(`Node with id ${action.input.id} already exists!`);
|
|
7990
8032
|
if (!isValidName(action.input.name)) throw new Error(`Invalid name: '${action.input.name}'. Names must not be empty or contain control characters.`);
|
|
7991
8033
|
const name = handleTargetNameCollisions({
|
|
7992
|
-
nodes
|
|
8034
|
+
nodes,
|
|
7993
8035
|
srcName: action.input.name,
|
|
7994
8036
|
srcKind: "file",
|
|
7995
8037
|
targetParentFolder: action.input.parentFolder || null
|
|
7996
8038
|
});
|
|
7997
|
-
|
|
8039
|
+
state.nodes = insertNodeSorted(nodes, {
|
|
7998
8040
|
id: action.input.id,
|
|
7999
8041
|
name,
|
|
8000
8042
|
kind: "file",
|
|
8001
8043
|
parentFolder: action.input.parentFolder ?? null,
|
|
8002
8044
|
documentType: action.input.documentType
|
|
8003
|
-
};
|
|
8004
|
-
state.nodes.push(fileNode);
|
|
8005
|
-
state.nodes.sort((a, b) => a.id.localeCompare(b.id));
|
|
8045
|
+
});
|
|
8006
8046
|
dispatch?.({
|
|
8007
8047
|
type: "CREATE_CHILD_DOCUMENT",
|
|
8008
8048
|
input: {
|
|
@@ -8012,21 +8052,21 @@ const nodeReducer = {
|
|
|
8012
8052
|
});
|
|
8013
8053
|
},
|
|
8014
8054
|
addFolderOperation(state, action) {
|
|
8015
|
-
|
|
8055
|
+
const nodes = readNodes(state);
|
|
8056
|
+
if (nodes.find((node) => node.id === action.input.id)) throw new Error(`Node with id ${action.input.id} already exists!`);
|
|
8016
8057
|
if (!isValidName(action.input.name)) throw new Error(`Invalid name: '${action.input.name}'. Names must not be empty or contain control characters.`);
|
|
8017
8058
|
const name = handleTargetNameCollisions({
|
|
8018
|
-
nodes
|
|
8059
|
+
nodes,
|
|
8019
8060
|
srcName: action.input.name,
|
|
8020
8061
|
srcKind: "folder",
|
|
8021
8062
|
targetParentFolder: action.input.parentFolder || null
|
|
8022
8063
|
});
|
|
8023
|
-
state.nodes
|
|
8064
|
+
state.nodes = insertNodeSorted(nodes, {
|
|
8024
8065
|
...action.input,
|
|
8025
8066
|
name,
|
|
8026
8067
|
kind: "folder",
|
|
8027
8068
|
parentFolder: action.input.parentFolder ?? null
|
|
8028
8069
|
});
|
|
8029
|
-
state.nodes.sort((a, b) => a.id.localeCompare(b.id));
|
|
8030
8070
|
},
|
|
8031
8071
|
deleteNodeOperation(state, action, dispatch) {
|
|
8032
8072
|
const node = state.nodes.find((node) => node.id === action.input.id);
|
|
@@ -8251,4 +8291,4 @@ const driveDocumentModelModule = {
|
|
|
8251
8291
|
//#endregion
|
|
8252
8292
|
export { setModuleName as $, createPresignedHeader as A, hashDocumentStateForScope as B, baseCreateDocument as C, buildSignedAction as D, baseSaveToFileHandle as E, deleteModule as F, replayDocumentVersioned as G, normalizeDocumentModelVersion as H, deleteOperation as I, setInitialState as J, setAuthorName as K, deleteOperationError as L, createState as M, createZip as N, createAction as O, defaultBaseState as P, setModelName as Q, deserializeSignature as R, baseActions as S, baseLoadFromInputVersioned as T, redo as U, isDocumentAction as V, releaseNewVersion as W, setModelExtension as X, setModelDescription as Y, setModelId as Z, UnsupportedDocumentModelVersionError as _, getDescendants as a, setStateSchema as at, addOperationError as b, isFileNode as c, validateInitialState as ct, moveNode as d, zipEntries as dt, setName as et, updateNode as f, generateId as ft, BaseDocumentStateSchema as g, BaseDocumentHeaderSchema as h, generateNodesCopy as i, setOperationSchema as it, createReducer as j, createBaseState as k, isFolderNode as l, validateModules as lt, logger as m, copyNode as n, setOperationErrorName as nt, getNextCopyNumber as o, toTransportAction as ot, documentModelDocumentModelModule as p, setAuthorWebsite as q, driveDocumentModelModule as r, setOperationName as rt, handleTargetNameCollisions as s, undo as st, addFolder as t, setOperationDescription as tt, isValidName as u, validateStateSchemaName as ut, addModule as v, baseLoadFromInput as w, assertAuthPreservedOnDuplicate as x, addOperation as y, documentModelDocumentType as z };
|
|
8253
8293
|
|
|
8254
|
-
//# sourceMappingURL=document-drive-
|
|
8294
|
+
//# sourceMappingURL=document-drive-CkV9NvD7.mjs.map
|