@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
|
@@ -2971,6 +2971,29 @@ const makeCreator = (arg) => {
|
|
|
2971
2971
|
* ```
|
|
2972
2972
|
*/
|
|
2973
2973
|
const create = makeCreator();
|
|
2974
|
+
/**
|
|
2975
|
+
* `original(draft)` to get original state in the draft mutation function.
|
|
2976
|
+
*
|
|
2977
|
+
* ## Example
|
|
2978
|
+
*
|
|
2979
|
+
* ```ts
|
|
2980
|
+
* import { create, original } from '../index';
|
|
2981
|
+
*
|
|
2982
|
+
* const baseState = { foo: { bar: 'str' }, arr: [] };
|
|
2983
|
+
* const state = create(
|
|
2984
|
+
* baseState,
|
|
2985
|
+
* (draft) => {
|
|
2986
|
+
* draft.foo.bar = 'str2';
|
|
2987
|
+
* expect(original(draft.foo)).toEqual({ bar: 'str' });
|
|
2988
|
+
* }
|
|
2989
|
+
* );
|
|
2990
|
+
* ```
|
|
2991
|
+
*/
|
|
2992
|
+
function original(target) {
|
|
2993
|
+
const proxyDraft = getProxyDraft(target);
|
|
2994
|
+
if (!proxyDraft) throw new Error(`original() is only used for a draft, parameter: ${target}`);
|
|
2995
|
+
return proxyDraft.original;
|
|
2996
|
+
}
|
|
2974
2997
|
Object.prototype.constructor.toString();
|
|
2975
2998
|
/**
|
|
2976
2999
|
* Cast a value to an Draft type value.
|
|
@@ -7328,36 +7351,36 @@ const logger = new class ConsoleLogger {
|
|
|
7328
7351
|
get #includeStack() {
|
|
7329
7352
|
return this.#level <= LOG_LEVELS.debug;
|
|
7330
7353
|
}
|
|
7331
|
-
verbose(message, ...replacements) {
|
|
7354
|
+
verbose = (message, ...replacements) => {
|
|
7332
7355
|
if (this.#level <= LOG_LEVELS.verbose) {
|
|
7333
7356
|
const [formattedMessage, meta] = formatMessage(this.#tagString, message, replacements, this.#includeStack);
|
|
7334
7357
|
console.debug(`[${meta["timestamp"]}] ${formattedMessage}`);
|
|
7335
7358
|
}
|
|
7336
|
-
}
|
|
7337
|
-
debug(message, ...replacements) {
|
|
7359
|
+
};
|
|
7360
|
+
debug = (message, ...replacements) => {
|
|
7338
7361
|
if (this.#level <= LOG_LEVELS.debug) {
|
|
7339
7362
|
const [formattedMessage, meta] = formatMessage(this.#tagString, message, replacements, this.#includeStack);
|
|
7340
7363
|
console.debug(`[${meta["timestamp"]}] ${formattedMessage}`);
|
|
7341
7364
|
}
|
|
7342
|
-
}
|
|
7343
|
-
info(message, ...replacements) {
|
|
7365
|
+
};
|
|
7366
|
+
info = (message, ...replacements) => {
|
|
7344
7367
|
if (this.#level <= LOG_LEVELS.info) {
|
|
7345
7368
|
const [formattedMessage, meta] = formatMessage(this.#tagString, message, replacements, this.#includeStack);
|
|
7346
7369
|
console.info(`[${meta["timestamp"]}] ${formattedMessage}`);
|
|
7347
7370
|
}
|
|
7348
|
-
}
|
|
7349
|
-
warn(message, ...replacements) {
|
|
7371
|
+
};
|
|
7372
|
+
warn = (message, ...replacements) => {
|
|
7350
7373
|
if (this.#level <= LOG_LEVELS.warn) {
|
|
7351
7374
|
const [formattedMessage, meta] = formatMessage(this.#tagString, message, replacements, this.#includeStack);
|
|
7352
7375
|
console.warn(`[${meta["timestamp"]}] ${formattedMessage}`);
|
|
7353
7376
|
}
|
|
7354
|
-
}
|
|
7355
|
-
error(message, ...replacements) {
|
|
7377
|
+
};
|
|
7378
|
+
error = (message, ...replacements) => {
|
|
7356
7379
|
if (this.#level <= LOG_LEVELS.error) {
|
|
7357
7380
|
const [formattedMessage, meta] = formatMessage(this.#tagString, message, replacements, this.#includeStack);
|
|
7358
7381
|
console.error(`[${meta["timestamp"]}] ${formattedMessage}`);
|
|
7359
7382
|
}
|
|
7360
|
-
}
|
|
7383
|
+
};
|
|
7361
7384
|
}();
|
|
7362
7385
|
//#endregion
|
|
7363
7386
|
//#region ../shared/dist/document-drive/index.js
|
|
@@ -7959,6 +7982,24 @@ function getNextCopyNumber(files, baseFilename) {
|
|
|
7959
7982
|
function escapeRegExp(string) {
|
|
7960
7983
|
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
7961
7984
|
}
|
|
7985
|
+
/**
|
|
7986
|
+
* The node list as plain objects for read-only scans. Inside a mutative draft
|
|
7987
|
+
* this returns the untouched base list, so a find or filter over it does not
|
|
7988
|
+
* create a child draft per element it visits. Callers must read before they
|
|
7989
|
+
* write: the base list does not see mutations made earlier in the same action.
|
|
7990
|
+
*/
|
|
7991
|
+
function readNodes(state) {
|
|
7992
|
+
return isDraft(state) ? original(state).nodes : state.nodes;
|
|
7993
|
+
}
|
|
7994
|
+
/**
|
|
7995
|
+
* The node list with a node added, ordered by id. The list is built and sorted
|
|
7996
|
+
* as plain objects, so inside a mutative draft the comparator never reads an
|
|
7997
|
+
* element through the draft proxy. Pass the list read with readNodes to get
|
|
7998
|
+
* that benefit; passing the draft's own list is correct but slow.
|
|
7999
|
+
*/
|
|
8000
|
+
function insertNodeSorted(nodes, node) {
|
|
8001
|
+
return [...nodes, node].sort((a, b) => a.id.localeCompare(b.id));
|
|
8002
|
+
}
|
|
7962
8003
|
function handleTargetNameCollisions(params) {
|
|
7963
8004
|
const { nodes, targetParentFolder, srcName, srcKind } = params;
|
|
7964
8005
|
const targetNodeChildrenNames = nodes.filter((node) => targetParentFolder === "" ? node.parentFolder === null : node.parentFolder === targetParentFolder).filter((node) => node.kind === srcKind).map((node) => node.name);
|
|
@@ -7969,23 +8010,22 @@ const isValidName = (name) => {
|
|
|
7969
8010
|
};
|
|
7970
8011
|
const nodeReducer = {
|
|
7971
8012
|
addFileOperation(state, action, dispatch) {
|
|
7972
|
-
|
|
8013
|
+
const nodes = readNodes(state);
|
|
8014
|
+
if (nodes.find((node) => node.id === action.input.id)) throw new Error(`Node with id ${action.input.id} already exists!`);
|
|
7973
8015
|
if (!isValidName(action.input.name)) throw new Error(`Invalid name: '${action.input.name}'. Names must not be empty or contain control characters.`);
|
|
7974
8016
|
const name = handleTargetNameCollisions({
|
|
7975
|
-
nodes
|
|
8017
|
+
nodes,
|
|
7976
8018
|
srcName: action.input.name,
|
|
7977
8019
|
srcKind: "file",
|
|
7978
8020
|
targetParentFolder: action.input.parentFolder || null
|
|
7979
8021
|
});
|
|
7980
|
-
|
|
8022
|
+
state.nodes = insertNodeSorted(nodes, {
|
|
7981
8023
|
id: action.input.id,
|
|
7982
8024
|
name,
|
|
7983
8025
|
kind: "file",
|
|
7984
8026
|
parentFolder: action.input.parentFolder ?? null,
|
|
7985
8027
|
documentType: action.input.documentType
|
|
7986
|
-
};
|
|
7987
|
-
state.nodes.push(fileNode);
|
|
7988
|
-
state.nodes.sort((a, b) => a.id.localeCompare(b.id));
|
|
8028
|
+
});
|
|
7989
8029
|
dispatch?.({
|
|
7990
8030
|
type: "CREATE_CHILD_DOCUMENT",
|
|
7991
8031
|
input: {
|
|
@@ -7995,21 +8035,21 @@ const nodeReducer = {
|
|
|
7995
8035
|
});
|
|
7996
8036
|
},
|
|
7997
8037
|
addFolderOperation(state, action) {
|
|
7998
|
-
|
|
8038
|
+
const nodes = readNodes(state);
|
|
8039
|
+
if (nodes.find((node) => node.id === action.input.id)) throw new Error(`Node with id ${action.input.id} already exists!`);
|
|
7999
8040
|
if (!isValidName(action.input.name)) throw new Error(`Invalid name: '${action.input.name}'. Names must not be empty or contain control characters.`);
|
|
8000
8041
|
const name = handleTargetNameCollisions({
|
|
8001
|
-
nodes
|
|
8042
|
+
nodes,
|
|
8002
8043
|
srcName: action.input.name,
|
|
8003
8044
|
srcKind: "folder",
|
|
8004
8045
|
targetParentFolder: action.input.parentFolder || null
|
|
8005
8046
|
});
|
|
8006
|
-
state.nodes
|
|
8047
|
+
state.nodes = insertNodeSorted(nodes, {
|
|
8007
8048
|
...action.input,
|
|
8008
8049
|
name,
|
|
8009
8050
|
kind: "folder",
|
|
8010
8051
|
parentFolder: action.input.parentFolder ?? null
|
|
8011
8052
|
});
|
|
8012
|
-
state.nodes.sort((a, b) => a.id.localeCompare(b.id));
|
|
8013
8053
|
},
|
|
8014
8054
|
deleteNodeOperation(state, action, dispatch) {
|
|
8015
8055
|
const node = state.nodes.find((node) => node.id === action.input.id);
|
|
@@ -8234,4 +8274,4 @@ const driveDocumentModelModule = {
|
|
|
8234
8274
|
//#endregion
|
|
8235
8275
|
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 };
|
|
8236
8276
|
|
|
8237
|
-
//# sourceMappingURL=document-drive-
|
|
8277
|
+
//# sourceMappingURL=document-drive-BEXJ-rHp.js.map
|