@powerhousedao/powerhouse-vetra-packages 6.2.3-dev.2 → 6.2.3-dev.3
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-CYpBypPi.js} +3 -3
- package/dist/browser/{connect-BqgnsniX.js.map → connect-CYpBypPi.js.map} +1 -1
- package/dist/browser/{dist-C-xkNfyD.js → dist-BENap-vI.js} +2 -2
- package/dist/browser/{dist-C-xkNfyD.js.map → dist-BENap-vI.js.map} +1 -1
- package/dist/browser/{document-drive-ZQzPQfEL.js → document-drive-Ey3tYI7w.js} +39 -5
- package/dist/browser/{document-drive-ZQzPQfEL.js.map → document-drive-Ey3tYI7w.js.map} +1 -1
- package/dist/browser/document-models/index.js +1 -1
- package/dist/browser/{editor-DZP1WlYy.js → editor-BKPzL33m.js} +5 -5
- package/dist/browser/{editor-DZP1WlYy.js.map → editor-BKPzL33m.js.map} +1 -1
- package/dist/browser/{editor-BNgF9-uX.js → editor-BbSzjfzH.js} +6 -6
- package/dist/browser/{editor-BNgF9-uX.js.map → editor-BbSzjfzH.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-wqAFM7eh.js} +3 -3
- package/dist/browser/{folder-view-tx0A96ZI.js.map → folder-view-wqAFM7eh.js.map} +1 -1
- package/dist/browser/{graphql-editor-Cbkb5KRZ.js → graphql-editor-BtfOYQtr.js} +3 -3
- package/dist/browser/{graphql-editor-Cbkb5KRZ.js.map → graphql-editor-BtfOYQtr.js.map} +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/browser/{json-editor-CN6kPtl1.js → json-editor-BLxfoZqB.js} +3 -3
- package/dist/browser/{json-editor-CN6kPtl1.js.map → json-editor-BLxfoZqB.js.map} +1 -1
- package/dist/browser/{state-schemas-CKh98ehP.js → state-schemas-C-Guc5xg.js} +3 -3
- package/dist/browser/{state-schemas-CKh98ehP.js.map → state-schemas-C-Guc5xg.js.map} +1 -1
- package/dist/node/{connect-CeLh6yfj.mjs → connect-BAdugRlx.mjs} +3 -3
- package/dist/node/{connect-CeLh6yfj.mjs.map → connect-BAdugRlx.mjs.map} +1 -1
- package/dist/node/{dist-CUFTZwfc.mjs → dist-BK8DUMce.mjs} +2 -2
- package/dist/node/{dist-CUFTZwfc.mjs.map → dist-BK8DUMce.mjs.map} +1 -1
- package/dist/node/{document-drive-D1NMjQQc.mjs → document-drive-B4PLKJQi.mjs} +39 -5
- package/dist/node/{document-drive-D1NMjQQc.mjs.map → document-drive-B4PLKJQi.mjs.map} +1 -1
- package/dist/node/document-models/index.mjs +1 -1
- package/dist/node/{editor-Dg2OZEJu.mjs → editor-CMXL0OxP.mjs} +5 -5
- package/dist/node/{editor-Dg2OZEJu.mjs.map → editor-CMXL0OxP.mjs.map} +1 -1
- package/dist/node/{editor-CXQOsbup.mjs → editor-JHD7MGnX.mjs} +6 -6
- package/dist/node/{editor-CXQOsbup.mjs.map → editor-JHD7MGnX.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-C3PVgNy3.mjs} +3 -3
- package/dist/node/{folder-view-DZ0o2-Ef.mjs.map → folder-view-C3PVgNy3.mjs.map} +1 -1
- package/dist/node/{graphql-editor-DNxebuTn.mjs → graphql-editor-BLaGozb3.mjs} +3 -3
- package/dist/node/{graphql-editor-DNxebuTn.mjs.map → graphql-editor-BLaGozb3.mjs.map} +1 -1
- package/dist/node/index.mjs +1 -1
- package/dist/node/{json-editor-BpnEn9AS.mjs → json-editor-DmO6AItL.mjs} +3 -3
- package/dist/node/{json-editor-BpnEn9AS.mjs.map → json-editor-DmO6AItL.mjs.map} +1 -1
- package/dist/node/{state-schemas-CuSHxrn6.mjs → state-schemas-Gm2OX60J.mjs} +3 -3
- package/dist/node/{state-schemas-CuSHxrn6.mjs.map → state-schemas-Gm2OX60J.mjs.map} +1 -1
- package/package.json +7 -7
|
@@ -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.
|
|
@@ -7959,6 +7982,15 @@ 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
|
+
}
|
|
7962
7994
|
function handleTargetNameCollisions(params) {
|
|
7963
7995
|
const { nodes, targetParentFolder, srcName, srcKind } = params;
|
|
7964
7996
|
const targetNodeChildrenNames = nodes.filter((node) => targetParentFolder === "" ? node.parentFolder === null : node.parentFolder === targetParentFolder).filter((node) => node.kind === srcKind).map((node) => node.name);
|
|
@@ -7969,10 +8001,11 @@ const isValidName = (name) => {
|
|
|
7969
8001
|
};
|
|
7970
8002
|
const nodeReducer = {
|
|
7971
8003
|
addFileOperation(state, action, dispatch) {
|
|
7972
|
-
|
|
8004
|
+
const nodes = readNodes(state);
|
|
8005
|
+
if (nodes.find((node) => node.id === action.input.id)) throw new Error(`Node with id ${action.input.id} already exists!`);
|
|
7973
8006
|
if (!isValidName(action.input.name)) throw new Error(`Invalid name: '${action.input.name}'. Names must not be empty or contain control characters.`);
|
|
7974
8007
|
const name = handleTargetNameCollisions({
|
|
7975
|
-
nodes
|
|
8008
|
+
nodes,
|
|
7976
8009
|
srcName: action.input.name,
|
|
7977
8010
|
srcKind: "file",
|
|
7978
8011
|
targetParentFolder: action.input.parentFolder || null
|
|
@@ -7995,10 +8028,11 @@ const nodeReducer = {
|
|
|
7995
8028
|
});
|
|
7996
8029
|
},
|
|
7997
8030
|
addFolderOperation(state, action) {
|
|
7998
|
-
|
|
8031
|
+
const nodes = readNodes(state);
|
|
8032
|
+
if (nodes.find((node) => node.id === action.input.id)) throw new Error(`Node with id ${action.input.id} already exists!`);
|
|
7999
8033
|
if (!isValidName(action.input.name)) throw new Error(`Invalid name: '${action.input.name}'. Names must not be empty or contain control characters.`);
|
|
8000
8034
|
const name = handleTargetNameCollisions({
|
|
8001
|
-
nodes
|
|
8035
|
+
nodes,
|
|
8002
8036
|
srcName: action.input.name,
|
|
8003
8037
|
srcKind: "folder",
|
|
8004
8038
|
targetParentFolder: action.input.parentFolder || null
|
|
@@ -8234,4 +8268,4 @@ const driveDocumentModelModule = {
|
|
|
8234
8268
|
//#endregion
|
|
8235
8269
|
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
8270
|
|
|
8237
|
-
//# sourceMappingURL=document-drive-
|
|
8271
|
+
//# sourceMappingURL=document-drive-Ey3tYI7w.js.map
|