@powerhousedao/powerhouse-vetra-packages 6.2.3-dev.6 → 6.2.3-dev.7
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/assets/{entry-5_Eh4a2Z.js → entry-DSBtQnit.js} +2 -2
- package/dist/browser/assets/{projection-entry-5PVbP10h.js → projection-entry-Bem3exmO.js} +3 -3
- package/dist/browser/{connect-BtHSAuSc.js → connect-5NZDVmbb.js} +4 -4
- package/dist/browser/{connect-BtHSAuSc.js.map → connect-5NZDVmbb.js.map} +1 -1
- package/dist/browser/{dist-D69hfRZN.js → dist-1yB-AuT-.js} +3 -3
- package/dist/browser/{dist-D69hfRZN.js.map → dist-1yB-AuT-.js.map} +1 -1
- package/dist/browser/{document-drive-BEXJ-rHp.js → document-drive-CrvzV1D4.js} +79 -37
- package/dist/browser/{document-drive-BEXJ-rHp.js.map → document-drive-CrvzV1D4.js.map} +1 -1
- package/dist/browser/document-models/index.js +1 -1
- package/dist/browser/{editor-mNThkZOv.js → editor-6T4WF2og.js} +6 -6
- package/dist/browser/{editor-mNThkZOv.js.map → editor-6T4WF2og.js.map} +1 -1
- package/dist/browser/{editor-Cbl_EDjI.js → editor-DHysndk4.js} +5 -5
- package/dist/browser/{editor-Cbl_EDjI.js.map → editor-DHysndk4.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-D8AkN1Oj.js → folder-view-DTewe8q8.js} +3 -3
- package/dist/browser/{folder-view-D8AkN1Oj.js.map → folder-view-DTewe8q8.js.map} +1 -1
- package/dist/browser/{graphql-editor-BcL3-Zha.js → graphql-editor-C2EtXqb9.js} +3 -3
- package/dist/browser/{graphql-editor-BcL3-Zha.js.map → graphql-editor-C2EtXqb9.js.map} +1 -1
- package/dist/browser/index.js +2 -2
- package/dist/browser/{json-editor-DHXQRIN5.js → json-editor-xI_oaxyT.js} +3 -3
- package/dist/browser/{json-editor-DHXQRIN5.js.map → json-editor-xI_oaxyT.js.map} +1 -1
- package/dist/browser/{lib-ewnRj2dJ.js → lib-CPkPeg_u.js} +2 -2
- package/dist/browser/lib-CPkPeg_u.js.map +1 -0
- package/dist/browser/{state-schemas-C4F8lReN.js → state-schemas-CpcWN_Qo.js} +3 -3
- package/dist/browser/{state-schemas-C4F8lReN.js.map → state-schemas-CpcWN_Qo.js.map} +1 -1
- package/dist/node/{connect-B6IQsY6u.mjs → connect-cjzsd2cR.mjs} +4 -4
- package/dist/node/{connect-B6IQsY6u.mjs.map → connect-cjzsd2cR.mjs.map} +1 -1
- package/dist/node/{dist-hd-KLWy7.mjs → dist-C30J_pcg.mjs} +3 -3
- package/dist/node/{dist-hd-KLWy7.mjs.map → dist-C30J_pcg.mjs.map} +1 -1
- package/dist/node/{document-drive-CkV9NvD7.mjs → document-drive-BByBwg-I.mjs} +79 -37
- package/dist/node/{document-drive-CkV9NvD7.mjs.map → document-drive-BByBwg-I.mjs.map} +1 -1
- package/dist/node/document-models/index.mjs +1 -1
- package/dist/node/{editor-C93fdI28.mjs → editor-B4vhYrmV.mjs} +6 -6
- package/dist/node/{editor-C93fdI28.mjs.map → editor-B4vhYrmV.mjs.map} +1 -1
- package/dist/node/{editor-DG1q4Y55.mjs → editor-DPv5LEug.mjs} +5 -5
- package/dist/node/{editor-DG1q4Y55.mjs.map → editor-DPv5LEug.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-BGabHV7H.mjs → folder-view-BhackcXO.mjs} +3 -3
- package/dist/node/{folder-view-BGabHV7H.mjs.map → folder-view-BhackcXO.mjs.map} +1 -1
- package/dist/node/{graphql-editor-B-XIb6az.mjs → graphql-editor-D0CHQeCL.mjs} +3 -3
- package/dist/node/{graphql-editor-B-XIb6az.mjs.map → graphql-editor-D0CHQeCL.mjs.map} +1 -1
- package/dist/node/index.mjs +2 -2
- package/dist/node/{json-editor-DB0vi6tV.mjs → json-editor-Ckaem6ky.mjs} +3 -3
- package/dist/node/{json-editor-DB0vi6tV.mjs.map → json-editor-Ckaem6ky.mjs.map} +1 -1
- package/dist/node/{main-B1tRsYOp.mjs → main-BhH_ajBM.mjs} +2 -2
- package/dist/node/main-BhH_ajBM.mjs.map +1 -0
- package/dist/node/{state-schemas-BGsgtEG1.mjs → state-schemas-B1SNl8Ob.mjs} +3 -3
- package/dist/node/{state-schemas-BGsgtEG1.mjs.map → state-schemas-B1SNl8Ob.mjs.map} +1 -1
- package/package.json +7 -7
- package/dist/browser/lib-ewnRj2dJ.js.map +0 -1
- package/dist/node/main-B1tRsYOp.mjs.map +0 -1
|
@@ -7983,22 +7983,63 @@ function escapeRegExp(string) {
|
|
|
7983
7983
|
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
7984
7984
|
}
|
|
7985
7985
|
/**
|
|
7986
|
-
*
|
|
7987
|
-
*
|
|
7988
|
-
* create a child draft per element it visits
|
|
7989
|
-
*
|
|
7986
|
+
* A plain, unfrozen copy of the node list for read-only scans. Inside a
|
|
7987
|
+
* mutative draft the copy is taken from the untouched base list, so a find or
|
|
7988
|
+
* filter over it does not create a child draft per element it visits, and it is
|
|
7989
|
+
* a copy because the stored list is frozen and V8 scans a frozen array several
|
|
7990
|
+
* times slower than a normal one. Callers must read before they write: the base
|
|
7991
|
+
* list does not see mutations made earlier in the same action.
|
|
7990
7992
|
*/
|
|
7991
7993
|
function readNodes(state) {
|
|
7992
|
-
return isDraft(state) ? original(state).nodes : state.nodes;
|
|
7994
|
+
return [...isDraft(state) ? original(state).nodes : state.nodes];
|
|
7993
7995
|
}
|
|
7994
7996
|
/**
|
|
7995
|
-
* The
|
|
7996
|
-
*
|
|
7997
|
-
*
|
|
7998
|
-
*
|
|
7997
|
+
* The given array sorted by id and frozen, in place -- it takes ownership of
|
|
7998
|
+
* the array it is handed, which is why it is private to this module and only
|
|
7999
|
+
* ever given a list built at the call site. The freeze is what makes assigning
|
|
8000
|
+
* the list to a mutative draft cheap: assigning a draftable value to a draft
|
|
8001
|
+
* property queues a finalize pass that walks every element of the assigned
|
|
8002
|
+
* value, and the walk exits at its Object.isFrozen check instead. Elements must
|
|
8003
|
+
* be plain nodes -- an element that is still a draft would never be replaced by
|
|
8004
|
+
* its final value, because the walk that does that replacement is the one being
|
|
8005
|
+
* skipped.
|
|
8006
|
+
*/
|
|
8007
|
+
function freezeSortedById(nodes) {
|
|
8008
|
+
nodes.sort((a, b) => a.id.localeCompare(b.id));
|
|
8009
|
+
return Object.freeze(nodes);
|
|
8010
|
+
}
|
|
8011
|
+
/**
|
|
8012
|
+
* A copy of the given list, sorted by id and frozen, which is the shape the
|
|
8013
|
+
* node reducer assigns. Read the list with readNodes, build the new list from
|
|
8014
|
+
* it, and pass what this returns to assignNodes. The copy is what keeps the
|
|
8015
|
+
* freeze off the caller's array.
|
|
8016
|
+
*/
|
|
8017
|
+
function sortNodesById(nodes) {
|
|
8018
|
+
return freezeSortedById([...nodes]);
|
|
8019
|
+
}
|
|
8020
|
+
/**
|
|
8021
|
+
* The node list with a node added, ordered by id and frozen, in the same shape
|
|
8022
|
+
* sortNodesById returns. The list is built and sorted as plain objects, so
|
|
8023
|
+
* inside a mutative draft the comparator never reads an element through the
|
|
8024
|
+
* draft proxy. Pass the list read with readNodes: the draft's own list would
|
|
8025
|
+
* put child drafts in the result, which the freeze then keeps mutative from
|
|
8026
|
+
* resolving.
|
|
7999
8027
|
*/
|
|
8000
8028
|
function insertNodeSorted(nodes, node) {
|
|
8001
|
-
return [...nodes, node]
|
|
8029
|
+
return freezeSortedById([...nodes, node]);
|
|
8030
|
+
}
|
|
8031
|
+
/**
|
|
8032
|
+
* Installs a node list as state.nodes. Every assignment the node reducer makes
|
|
8033
|
+
* goes through here, and this is the one place a frozen array crosses into
|
|
8034
|
+
* state: the generated DocumentDriveGlobalState types nodes as a mutable
|
|
8035
|
+
* Node[], so the cast below is where that gap is paid rather than spread over
|
|
8036
|
+
* the reducer. Consumers must treat drive.state.global.nodes as read-only --
|
|
8037
|
+
* mutating it in place (push, sort, splice) throws in strict mode; copy it
|
|
8038
|
+
* first, as readNodes does. Note that LOAD_STATE replaces a whole scope and can
|
|
8039
|
+
* install a list this function never saw.
|
|
8040
|
+
*/
|
|
8041
|
+
function assignNodes(state, nodes) {
|
|
8042
|
+
state.nodes = nodes;
|
|
8002
8043
|
}
|
|
8003
8044
|
function handleTargetNameCollisions(params) {
|
|
8004
8045
|
const { nodes, targetParentFolder, srcName, srcKind } = params;
|
|
@@ -8019,13 +8060,13 @@ const nodeReducer = {
|
|
|
8019
8060
|
srcKind: "file",
|
|
8020
8061
|
targetParentFolder: action.input.parentFolder || null
|
|
8021
8062
|
});
|
|
8022
|
-
state
|
|
8063
|
+
assignNodes(state, insertNodeSorted(nodes, {
|
|
8023
8064
|
id: action.input.id,
|
|
8024
8065
|
name,
|
|
8025
8066
|
kind: "file",
|
|
8026
8067
|
parentFolder: action.input.parentFolder ?? null,
|
|
8027
8068
|
documentType: action.input.documentType
|
|
8028
|
-
});
|
|
8069
|
+
}));
|
|
8029
8070
|
dispatch?.({
|
|
8030
8071
|
type: "CREATE_CHILD_DOCUMENT",
|
|
8031
8072
|
input: {
|
|
@@ -8044,18 +8085,19 @@ const nodeReducer = {
|
|
|
8044
8085
|
srcKind: "folder",
|
|
8045
8086
|
targetParentFolder: action.input.parentFolder || null
|
|
8046
8087
|
});
|
|
8047
|
-
state
|
|
8088
|
+
assignNodes(state, insertNodeSorted(nodes, {
|
|
8048
8089
|
...action.input,
|
|
8049
8090
|
name,
|
|
8050
8091
|
kind: "folder",
|
|
8051
8092
|
parentFolder: action.input.parentFolder ?? null
|
|
8052
|
-
});
|
|
8093
|
+
}));
|
|
8053
8094
|
},
|
|
8054
8095
|
deleteNodeOperation(state, action, dispatch) {
|
|
8055
|
-
const
|
|
8096
|
+
const nodes = readNodes(state);
|
|
8097
|
+
const node = nodes.find((node) => node.id === action.input.id);
|
|
8056
8098
|
if (!node) throw new Error(`Node with id ${action.input.id} not found`);
|
|
8057
|
-
const descendants = getDescendants(node,
|
|
8058
|
-
state
|
|
8099
|
+
const descendants = getDescendants(node, nodes);
|
|
8100
|
+
assignNodes(state, sortNodesById(nodes.filter((node) => node.id !== action.input.id && !descendants.find((descendant) => descendant.id === node.id))));
|
|
8059
8101
|
[node, ...descendants].filter((node) => isFileNode(node)).forEach((node) => {
|
|
8060
8102
|
dispatch?.({
|
|
8061
8103
|
type: "DELETE_CHILD_DOCUMENT",
|
|
@@ -8065,38 +8107,39 @@ const nodeReducer = {
|
|
|
8065
8107
|
},
|
|
8066
8108
|
updateFileOperation(state, action) {
|
|
8067
8109
|
if (action.input.name && !isValidName(action.input.name)) throw new Error(`Invalid name: '${action.input.name}'. Names must not be empty or contain control characters.`);
|
|
8068
|
-
|
|
8110
|
+
const nodes = readNodes(state);
|
|
8111
|
+
assignNodes(state, sortNodesById(nodes.map((node) => node.id === action.input.id ? {
|
|
8069
8112
|
...node,
|
|
8070
8113
|
name: handleTargetNameCollisions({
|
|
8071
|
-
nodes:
|
|
8114
|
+
nodes: nodes.filter((n) => n.id !== action.input.id),
|
|
8072
8115
|
srcName: action.input.name ?? node.name,
|
|
8073
8116
|
srcKind: "file",
|
|
8074
8117
|
targetParentFolder: action.input.parentFolder ?? node.parentFolder
|
|
8075
8118
|
}),
|
|
8076
8119
|
documentType: action.input.documentType ?? node.documentType
|
|
8077
|
-
} : node);
|
|
8078
|
-
state.nodes.sort((a, b) => a.id.localeCompare(b.id));
|
|
8120
|
+
} : node)));
|
|
8079
8121
|
},
|
|
8080
8122
|
updateNodeOperation(state, action) {
|
|
8081
8123
|
if (action.input.name && !isValidName(action.input.name)) throw new Error(`Invalid name: '${action.input.name}'. Names must not be empty or contain control characters.`);
|
|
8082
|
-
|
|
8124
|
+
const nodes = readNodes(state);
|
|
8125
|
+
assignNodes(state, sortNodesById(nodes.map((node) => node.id === action.input.id ? {
|
|
8083
8126
|
...node,
|
|
8084
8127
|
name: handleTargetNameCollisions({
|
|
8085
|
-
nodes:
|
|
8128
|
+
nodes: nodes.filter((n) => n.id !== action.input.id),
|
|
8086
8129
|
srcName: action.input.name ?? node.name,
|
|
8087
8130
|
srcKind: node.kind === "file" ? "file" : "folder",
|
|
8088
8131
|
targetParentFolder: action.input.parentFolder ?? node.parentFolder
|
|
8089
8132
|
}),
|
|
8090
8133
|
parentFolder: action.input.parentFolder === null ? null : node.parentFolder
|
|
8091
|
-
} : node);
|
|
8092
|
-
state.nodes.sort((a, b) => a.id.localeCompare(b.id));
|
|
8134
|
+
} : node)));
|
|
8093
8135
|
},
|
|
8094
8136
|
copyNodeOperation(state, action, dispatch) {
|
|
8095
|
-
const
|
|
8137
|
+
const nodes = readNodes(state);
|
|
8138
|
+
const node = nodes.find((node) => node.id === action.input.srcId);
|
|
8096
8139
|
if (!node) throw new Error(`Node with id ${action.input.srcId} not found`);
|
|
8097
|
-
if (
|
|
8140
|
+
if (nodes.find((node) => node.id === action.input.targetId)) throw new Error(`Node with id ${action.input.targetId} already exists`);
|
|
8098
8141
|
const name = handleTargetNameCollisions({
|
|
8099
|
-
nodes
|
|
8142
|
+
nodes,
|
|
8100
8143
|
srcName: action.input.targetName || node.name,
|
|
8101
8144
|
srcKind: node.kind === "file" ? "file" : "folder",
|
|
8102
8145
|
targetParentFolder: action.input.targetParentFolder || null
|
|
@@ -8108,8 +8151,7 @@ const nodeReducer = {
|
|
|
8108
8151
|
name,
|
|
8109
8152
|
parentFolder: action.input.targetParentFolder || null
|
|
8110
8153
|
};
|
|
8111
|
-
state
|
|
8112
|
-
state.nodes.sort((a, b) => a.id.localeCompare(b.id));
|
|
8154
|
+
assignNodes(state, insertNodeSorted(nodes, newNode));
|
|
8113
8155
|
if (isFileNode(newNode)) dispatch?.({
|
|
8114
8156
|
type: "COPY_CHILD_DOCUMENT",
|
|
8115
8157
|
input: {
|
|
@@ -8120,26 +8162,26 @@ const nodeReducer = {
|
|
|
8120
8162
|
},
|
|
8121
8163
|
moveNodeOperation(state, action) {
|
|
8122
8164
|
if (action.input.srcFolder === action.input.targetParentFolder) throw new Error("Circular Reference Error: Attempting to move a node to its current parent folder");
|
|
8123
|
-
const
|
|
8165
|
+
const nodes = readNodes(state);
|
|
8166
|
+
const node = nodes.find((node) => node.id === action.input.srcFolder);
|
|
8124
8167
|
if (!node) throw new Error(`Node with id ${action.input.srcFolder} not found`);
|
|
8125
8168
|
const name = handleTargetNameCollisions({
|
|
8126
|
-
nodes
|
|
8169
|
+
nodes,
|
|
8127
8170
|
srcName: node.name,
|
|
8128
8171
|
srcKind: node.kind === "file" ? "file" : "folder",
|
|
8129
8172
|
targetParentFolder: action.input.targetParentFolder || null
|
|
8130
8173
|
});
|
|
8131
8174
|
if (isFolderNode(node)) {
|
|
8132
|
-
if (getDescendants(node,
|
|
8175
|
+
if (getDescendants(node, nodes).find((descendant) => descendant.id === action.input.targetParentFolder)) throw new Error("Circular Reference Error: Cannot move a folder to one of its descendants");
|
|
8133
8176
|
}
|
|
8134
|
-
state
|
|
8177
|
+
assignNodes(state, sortNodesById(nodes.map((node) => {
|
|
8135
8178
|
if (node.id === action.input.srcFolder) return {
|
|
8136
8179
|
...node,
|
|
8137
8180
|
name,
|
|
8138
8181
|
parentFolder: action.input.targetParentFolder || null
|
|
8139
8182
|
};
|
|
8140
8183
|
return node;
|
|
8141
|
-
});
|
|
8142
|
-
state.nodes.sort((a, b) => a.id.localeCompare(b.id));
|
|
8184
|
+
})));
|
|
8143
8185
|
}
|
|
8144
8186
|
};
|
|
8145
8187
|
const driveStateReducer = (state, action, dispatch) => {
|
|
@@ -8274,4 +8316,4 @@ const driveDocumentModelModule = {
|
|
|
8274
8316
|
//#endregion
|
|
8275
8317
|
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 };
|
|
8276
8318
|
|
|
8277
|
-
//# sourceMappingURL=document-drive-
|
|
8319
|
+
//# sourceMappingURL=document-drive-CrvzV1D4.js.map
|