@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.
Files changed (47) hide show
  1. package/dist/browser/{connect-BqgnsniX.js → connect-CYpBypPi.js} +3 -3
  2. package/dist/browser/{connect-BqgnsniX.js.map → connect-CYpBypPi.js.map} +1 -1
  3. package/dist/browser/{dist-C-xkNfyD.js → dist-BENap-vI.js} +2 -2
  4. package/dist/browser/{dist-C-xkNfyD.js.map → dist-BENap-vI.js.map} +1 -1
  5. package/dist/browser/{document-drive-ZQzPQfEL.js → document-drive-Ey3tYI7w.js} +39 -5
  6. package/dist/browser/{document-drive-ZQzPQfEL.js.map → document-drive-Ey3tYI7w.js.map} +1 -1
  7. package/dist/browser/document-models/index.js +1 -1
  8. package/dist/browser/{editor-DZP1WlYy.js → editor-BKPzL33m.js} +5 -5
  9. package/dist/browser/{editor-DZP1WlYy.js.map → editor-BKPzL33m.js.map} +1 -1
  10. package/dist/browser/{editor-BNgF9-uX.js → editor-BbSzjfzH.js} +6 -6
  11. package/dist/browser/{editor-BNgF9-uX.js.map → editor-BbSzjfzH.js.map} +1 -1
  12. package/dist/browser/editors/document-model-editor/module.js +1 -1
  13. package/dist/browser/editors/generic-drive-explorer/index.js +4 -4
  14. package/dist/browser/editors/generic-drive-explorer/module.js +1 -1
  15. package/dist/browser/{folder-view-tx0A96ZI.js → folder-view-wqAFM7eh.js} +3 -3
  16. package/dist/browser/{folder-view-tx0A96ZI.js.map → folder-view-wqAFM7eh.js.map} +1 -1
  17. package/dist/browser/{graphql-editor-Cbkb5KRZ.js → graphql-editor-BtfOYQtr.js} +3 -3
  18. package/dist/browser/{graphql-editor-Cbkb5KRZ.js.map → graphql-editor-BtfOYQtr.js.map} +1 -1
  19. package/dist/browser/index.js +1 -1
  20. package/dist/browser/{json-editor-CN6kPtl1.js → json-editor-BLxfoZqB.js} +3 -3
  21. package/dist/browser/{json-editor-CN6kPtl1.js.map → json-editor-BLxfoZqB.js.map} +1 -1
  22. package/dist/browser/{state-schemas-CKh98ehP.js → state-schemas-C-Guc5xg.js} +3 -3
  23. package/dist/browser/{state-schemas-CKh98ehP.js.map → state-schemas-C-Guc5xg.js.map} +1 -1
  24. package/dist/node/{connect-CeLh6yfj.mjs → connect-BAdugRlx.mjs} +3 -3
  25. package/dist/node/{connect-CeLh6yfj.mjs.map → connect-BAdugRlx.mjs.map} +1 -1
  26. package/dist/node/{dist-CUFTZwfc.mjs → dist-BK8DUMce.mjs} +2 -2
  27. package/dist/node/{dist-CUFTZwfc.mjs.map → dist-BK8DUMce.mjs.map} +1 -1
  28. package/dist/node/{document-drive-D1NMjQQc.mjs → document-drive-B4PLKJQi.mjs} +39 -5
  29. package/dist/node/{document-drive-D1NMjQQc.mjs.map → document-drive-B4PLKJQi.mjs.map} +1 -1
  30. package/dist/node/document-models/index.mjs +1 -1
  31. package/dist/node/{editor-Dg2OZEJu.mjs → editor-CMXL0OxP.mjs} +5 -5
  32. package/dist/node/{editor-Dg2OZEJu.mjs.map → editor-CMXL0OxP.mjs.map} +1 -1
  33. package/dist/node/{editor-CXQOsbup.mjs → editor-JHD7MGnX.mjs} +6 -6
  34. package/dist/node/{editor-CXQOsbup.mjs.map → editor-JHD7MGnX.mjs.map} +1 -1
  35. package/dist/node/editors/document-model-editor/module.mjs +1 -1
  36. package/dist/node/editors/generic-drive-explorer/index.mjs +4 -4
  37. package/dist/node/editors/generic-drive-explorer/module.mjs +1 -1
  38. package/dist/node/{folder-view-DZ0o2-Ef.mjs → folder-view-C3PVgNy3.mjs} +3 -3
  39. package/dist/node/{folder-view-DZ0o2-Ef.mjs.map → folder-view-C3PVgNy3.mjs.map} +1 -1
  40. package/dist/node/{graphql-editor-DNxebuTn.mjs → graphql-editor-BLaGozb3.mjs} +3 -3
  41. package/dist/node/{graphql-editor-DNxebuTn.mjs.map → graphql-editor-BLaGozb3.mjs.map} +1 -1
  42. package/dist/node/index.mjs +1 -1
  43. package/dist/node/{json-editor-BpnEn9AS.mjs → json-editor-DmO6AItL.mjs} +3 -3
  44. package/dist/node/{json-editor-BpnEn9AS.mjs.map → json-editor-DmO6AItL.mjs.map} +1 -1
  45. package/dist/node/{state-schemas-CuSHxrn6.mjs → state-schemas-Gm2OX60J.mjs} +3 -3
  46. package/dist/node/{state-schemas-CuSHxrn6.mjs.map → state-schemas-Gm2OX60J.mjs.map} +1 -1
  47. package/package.json +7 -7
@@ -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.
@@ -7976,6 +7999,15 @@ 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
+ }
7979
8011
  function handleTargetNameCollisions(params) {
7980
8012
  const { nodes, targetParentFolder, srcName, srcKind } = params;
7981
8013
  const targetNodeChildrenNames = nodes.filter((node) => targetParentFolder === "" ? node.parentFolder === null : node.parentFolder === targetParentFolder).filter((node) => node.kind === srcKind).map((node) => node.name);
@@ -7986,10 +8018,11 @@ const isValidName = (name) => {
7986
8018
  };
7987
8019
  const nodeReducer = {
7988
8020
  addFileOperation(state, action, dispatch) {
7989
- if (state.nodes.find((node) => node.id === action.input.id)) throw new Error(`Node with id ${action.input.id} already exists!`);
8021
+ const nodes = readNodes(state);
8022
+ if (nodes.find((node) => node.id === action.input.id)) throw new Error(`Node with id ${action.input.id} already exists!`);
7990
8023
  if (!isValidName(action.input.name)) throw new Error(`Invalid name: '${action.input.name}'. Names must not be empty or contain control characters.`);
7991
8024
  const name = handleTargetNameCollisions({
7992
- nodes: state.nodes,
8025
+ nodes,
7993
8026
  srcName: action.input.name,
7994
8027
  srcKind: "file",
7995
8028
  targetParentFolder: action.input.parentFolder || null
@@ -8012,10 +8045,11 @@ const nodeReducer = {
8012
8045
  });
8013
8046
  },
8014
8047
  addFolderOperation(state, action) {
8015
- if (state.nodes.find((node) => node.id === action.input.id)) throw new Error(`Node with id ${action.input.id} already exists!`);
8048
+ const nodes = readNodes(state);
8049
+ if (nodes.find((node) => node.id === action.input.id)) throw new Error(`Node with id ${action.input.id} already exists!`);
8016
8050
  if (!isValidName(action.input.name)) throw new Error(`Invalid name: '${action.input.name}'. Names must not be empty or contain control characters.`);
8017
8051
  const name = handleTargetNameCollisions({
8018
- nodes: state.nodes,
8052
+ nodes,
8019
8053
  srcName: action.input.name,
8020
8054
  srcKind: "folder",
8021
8055
  targetParentFolder: action.input.parentFolder || null
@@ -8251,4 +8285,4 @@ const driveDocumentModelModule = {
8251
8285
  //#endregion
8252
8286
  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
8287
 
8254
- //# sourceMappingURL=document-drive-D1NMjQQc.mjs.map
8288
+ //# sourceMappingURL=document-drive-B4PLKJQi.mjs.map