@powerhousedao/powerhouse-vetra-packages 6.2.0-dev.1 → 6.2.0-dev.11

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 (59) hide show
  1. package/dist/browser/assets/{entry-Bzani6_n.js → entry-D6VwthNk.js} +2 -2
  2. package/dist/browser/assets/{projection-entry-Bpu-8SnI.js → projection-entry-CemvPRT8.js} +2 -2
  3. package/dist/browser/{connect-ZnLjvmRt.js → connect-BMrgEG7X.js} +4 -4
  4. package/dist/browser/{connect-ZnLjvmRt.js.map → connect-BMrgEG7X.js.map} +1 -1
  5. package/dist/browser/{dist-C1nRM9t2.js → dist-B6zWOl4d.js} +44 -30
  6. package/dist/browser/dist-B6zWOl4d.js.map +1 -0
  7. package/dist/browser/{dist-DLFI75Zd.js → dist-DPeHVSov.js} +3 -3
  8. package/dist/browser/dist-DPeHVSov.js.map +1 -0
  9. package/dist/browser/{document-drive-oqv68jDU.js → document-drive-sTKoi6L4.js} +314 -9
  10. package/dist/browser/document-drive-sTKoi6L4.js.map +1 -0
  11. package/dist/browser/document-models/index.js +1 -1
  12. package/dist/browser/{editor-CoTq6fqT.js → editor-Clp9-uJE.js} +6 -6
  13. package/dist/browser/{editor-CoTq6fqT.js.map → editor-Clp9-uJE.js.map} +1 -1
  14. package/dist/browser/{editor-DC3bigBu.js → editor-CzsQw1pE.js} +5 -5
  15. package/dist/browser/{editor-DC3bigBu.js.map → editor-CzsQw1pE.js.map} +1 -1
  16. package/dist/browser/editors/document-model-editor/module.js +1 -1
  17. package/dist/browser/editors/generic-drive-explorer/index.js +4 -4
  18. package/dist/browser/editors/generic-drive-explorer/module.js +1 -1
  19. package/dist/browser/{folder-view-DmYBf2pP.js → folder-view-D9jBl4kJ.js} +3 -3
  20. package/dist/browser/{folder-view-DmYBf2pP.js.map → folder-view-D9jBl4kJ.js.map} +1 -1
  21. package/dist/browser/{graphql-editor-CiGd_Li7.js → graphql-editor-8bWqxqUN.js} +3 -3
  22. package/dist/browser/{graphql-editor-CiGd_Li7.js.map → graphql-editor-8bWqxqUN.js.map} +1 -1
  23. package/dist/browser/index.js +2 -2
  24. package/dist/browser/{json-editor-sEqd5piI.js → json-editor-DlvyzQQO.js} +3 -3
  25. package/dist/browser/{json-editor-sEqd5piI.js.map → json-editor-DlvyzQQO.js.map} +1 -1
  26. package/dist/browser/{state-schemas-DJmzG_M8.js → state-schemas-CVQyYhpH.js} +3 -3
  27. package/dist/browser/{state-schemas-DJmzG_M8.js.map → state-schemas-CVQyYhpH.js.map} +1 -1
  28. package/dist/node/{connect-BLC4PXD9.mjs → connect-C8Ur6M5x.mjs} +4 -4
  29. package/dist/node/{connect-BLC4PXD9.mjs.map → connect-C8Ur6M5x.mjs.map} +1 -1
  30. package/dist/node/{dist-Bm05eoTg.mjs → dist-D3qXr1ES.mjs} +44 -30
  31. package/dist/node/dist-D3qXr1ES.mjs.map +1 -0
  32. package/dist/node/{dist-Cn3iExnV.mjs → dist-vA9scgbK.mjs} +3 -3
  33. package/dist/node/dist-vA9scgbK.mjs.map +1 -0
  34. package/dist/node/{document-drive-sM33juXr.mjs → document-drive-DjL9iikf.mjs} +314 -9
  35. package/dist/node/document-drive-DjL9iikf.mjs.map +1 -0
  36. package/dist/node/document-models/index.mjs +1 -1
  37. package/dist/node/{editor-BrS98lEH.mjs → editor-B6gn6QpO.mjs} +5 -5
  38. package/dist/node/{editor-BrS98lEH.mjs.map → editor-B6gn6QpO.mjs.map} +1 -1
  39. package/dist/node/{editor-BFBa9nsO.mjs → editor-kdobbTut.mjs} +6 -6
  40. package/dist/node/{editor-BFBa9nsO.mjs.map → editor-kdobbTut.mjs.map} +1 -1
  41. package/dist/node/editors/document-model-editor/module.mjs +1 -1
  42. package/dist/node/editors/generic-drive-explorer/index.mjs +4 -4
  43. package/dist/node/editors/generic-drive-explorer/module.mjs +1 -1
  44. package/dist/node/{folder-view-DHph3Yuu.mjs → folder-view-C9m-Kbjh.mjs} +3 -3
  45. package/dist/node/{folder-view-DHph3Yuu.mjs.map → folder-view-C9m-Kbjh.mjs.map} +1 -1
  46. package/dist/node/{graphql-editor-CPq7oIbf.mjs → graphql-editor-BiK6s8_B.mjs} +3 -3
  47. package/dist/node/{graphql-editor-CPq7oIbf.mjs.map → graphql-editor-BiK6s8_B.mjs.map} +1 -1
  48. package/dist/node/index.mjs +2 -2
  49. package/dist/node/{json-editor-L32CP7TS.mjs → json-editor-rMZOlQFM.mjs} +3 -3
  50. package/dist/node/{json-editor-L32CP7TS.mjs.map → json-editor-rMZOlQFM.mjs.map} +1 -1
  51. package/dist/node/{state-schemas-XTTjQZOe.mjs → state-schemas-Dt2-S4R8.mjs} +3 -3
  52. package/dist/node/{state-schemas-XTTjQZOe.mjs.map → state-schemas-Dt2-S4R8.mjs.map} +1 -1
  53. package/package.json +6 -6
  54. package/dist/browser/dist-C1nRM9t2.js.map +0 -1
  55. package/dist/browser/dist-DLFI75Zd.js.map +0 -1
  56. package/dist/browser/document-drive-oqv68jDU.js.map +0 -1
  57. package/dist/node/dist-Bm05eoTg.mjs.map +0 -1
  58. package/dist/node/dist-Cn3iExnV.mjs.map +0 -1
  59. package/dist/node/document-drive-sM33juXr.mjs.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import { E as __commonJSMin, k as __toESM, t as capitalCase } from "./dist-CXoKspdx.js";
2
- import { A as replayDocument, J as validateStateSchemaName, K as validateInitialState, S as createZip, Y as generateId, _ as baseSaveToFileHandle, a as handleTargetNameCollisions, c as moveNode, d as logger, g as baseLoadFromInput, i as generateNodesCopy, l as updateNode, n as copyNode, o as isFileNode, q as validateModules, r as driveDocumentModelModule, s as isFolderNode, t as addFolder$1, u as documentModelDocumentModelModule, v as buildSignedAction, y as createPresignedHeader, z as setName } from "./document-drive-oqv68jDU.js";
3
- import { c as driveCollectionId, n as gql, o as SyncStatus, s as ModuleNotFoundError, t as reactorDriveDocumentModelModule } from "./dist-DLFI75Zd.js";
2
+ import { B as setName, C as createZip, J as validateModules, X as generateId, Y as validateStateSchemaName, _ as baseLoadFromInputVersioned, a as handleTargetNameCollisions, b as createPresignedHeader, c as moveNode, d as logger, g as baseLoadFromInput, i as generateNodesCopy, j as replayDocumentVersioned, l as updateNode, n as copyNode, o as isFileNode, q as validateInitialState, r as driveDocumentModelModule, s as isFolderNode, t as addFolder$1, u as documentModelDocumentModelModule, v as baseSaveToFileHandle, y as buildSignedAction } from "./document-drive-sTKoi6L4.js";
3
+ import { c as driveCollectionId, n as gql, o as SyncStatus, s as ModuleNotFoundError, t as reactorDriveDocumentModelModule } from "./dist-DPeHVSov.js";
4
4
  import { Children, cloneElement, forwardRef, isValidElement, use, useEffect, useMemo, useState, useSyncExternalStore } from "react";
5
5
  import "react/jsx-runtime";
6
6
  //#region ../reactor-browser/dist/make-ph-event-functions-DwiD1zH9.js
@@ -214,7 +214,7 @@ function useDocumentById(id) {
214
214
  return [document, dispatch];
215
215
  }
216
216
  //#endregion
217
- //#region ../reactor-browser/dist/client-D7hUM13i.js
217
+ //#region ../reactor-browser/dist/client-CvgFU1Dv.js
218
218
  const PhDocumentFieldsFragmentDoc = gql`
219
219
  fragment PHDocumentFields on PHDocument {
220
220
  id
@@ -282,13 +282,6 @@ const GetDocumentWithOperationsDocument = gql`
282
282
  timestampUtcMs
283
283
  input
284
284
  scope
285
- attachments {
286
- data
287
- mimeType
288
- hash
289
- extension
290
- fileName
291
- }
292
285
  context {
293
286
  signer {
294
287
  user {
@@ -401,13 +394,6 @@ const GetDocumentOperationsDocument = gql`
401
394
  timestampUtcMs
402
395
  input
403
396
  scope
404
- attachments {
405
- data
406
- mimeType
407
- hash
408
- extension
409
- fileName
410
- }
411
397
  context {
412
398
  signer {
413
399
  user {
@@ -658,13 +644,6 @@ gql`
658
644
  timestampUtcMs
659
645
  input
660
646
  scope
661
- attachments {
662
- data
663
- mimeType
664
- hash
665
- extension
666
- fileName
667
- }
668
647
  context {
669
648
  signer {
670
649
  user {
@@ -2509,14 +2488,30 @@ async function exportFile(document, suggestedName) {
2509
2488
  if (!(e instanceof DOMException && e.name === "AbortError")) throw e;
2510
2489
  }
2511
2490
  }
2491
+ /**
2492
+ * Loads a document file and replays it with version-aware reducers from the registry.
2493
+ * Falls back to single-version legacy replay when no upgrade manifest is registered for
2494
+ * the document type.
2495
+ */
2512
2496
  async function loadFile(path) {
2513
2497
  const baseDocument = await baseLoadFromInput(path, (state) => state, { checkHashes: true });
2514
2498
  const reactorClient = window.ph?.reactorClient;
2515
2499
  if (!reactorClient) throw new Error("ReactorClient not initialized");
2500
+ const documentType = baseDocument.header.documentType;
2516
2501
  const { results: documentModelModules } = await reactorClient.getDocumentModelModules();
2517
- const documentModelModule = documentModelModules.find((module) => module.documentModel.global.id === baseDocument.header.documentType);
2518
- if (!documentModelModule) throw new DocumentModelNotFoundError(baseDocument.header.documentType);
2519
- return documentModelModule.utils.loadFromInput(path);
2502
+ const modulesForType = documentModelModules.filter((module) => module.documentModel.global.id === documentType);
2503
+ if (modulesForType.length === 0) throw new DocumentModelNotFoundError(documentType);
2504
+ const reducers = {};
2505
+ for (const module of modulesForType) reducers[module.version ?? 1] = module.reducer;
2506
+ const registry = window.ph?.reactorClientModule?.reactorModule?.documentModelRegistry;
2507
+ let upgradeManifest;
2508
+ if (registry) try {
2509
+ upgradeManifest = registry.getUpgradeManifest(documentType);
2510
+ } catch {}
2511
+ return baseLoadFromInputVersioned(path, {
2512
+ reducers,
2513
+ upgradeManifest
2514
+ });
2520
2515
  }
2521
2516
  async function addDocument(driveId, name, documentType, parentFolder, document, id, preferredEditor) {
2522
2517
  const { isAllowedToCreateDocuments } = getUserPermissions();
@@ -2638,9 +2633,28 @@ async function moveNode$1(driveId, src, target) {
2638
2633
  targetParentFolder: target?.id
2639
2634
  })]);
2640
2635
  }
2636
+ /**
2637
+ * Duplicates a document under a new id using version-aware replay.
2638
+ * Falls back gracefully when no upgrade manifest is registered for the document type.
2639
+ */
2641
2640
  async function _duplicateDocument(reactor, document, newId = generateId()) {
2642
- const documentModule = await reactor.getDocumentModelModule(document.header.documentType);
2643
- return replayDocument(document.initialState, document.operations, documentModule.reducer, createPresignedHeader(newId, document.header.documentType));
2641
+ const documentType = document.header.documentType;
2642
+ const { results: allModules } = await reactor.getDocumentModelModules();
2643
+ const modulesForType = allModules.filter((m) => m.documentModel.global.id === documentType);
2644
+ const reducers = {};
2645
+ for (const m of modulesForType) reducers[m.version ?? 1] = m.reducer;
2646
+ if (Object.keys(reducers).length === 0) throw new Error(`Document model module not found for type: ${documentType}`);
2647
+ const registry = window.ph?.reactorClientModule?.reactorModule?.documentModelRegistry;
2648
+ let upgradeManifest;
2649
+ if (registry) try {
2650
+ upgradeManifest = registry.getUpgradeManifest(documentType);
2651
+ } catch {}
2652
+ const config = {
2653
+ reducers,
2654
+ upgradeManifest
2655
+ };
2656
+ const header = createPresignedHeader(newId, documentType);
2657
+ return replayDocumentVersioned(document.initialState, document.operations, config, header);
2644
2658
  }
2645
2659
  async function copyNode$1(driveId, src, target) {
2646
2660
  const reactor = window.ph?.reactorClient;
@@ -3765,4 +3779,4 @@ createDebouncedRefreshReactorDataClient();
3765
3779
  //#endregion
3766
3780
  export { e$4 as A, useSelectedDriveSafe as C, useTheme as D, useSetPHDocumentEditorConfig as E, t$5 as M, useDocumentById as N, useUserPermissions as O, useSelectedDriveId as S, useSetPHAppConfig as T, useNodeParentFolderById as _, setSelectedDrive as a, useSelectedDocumentOfType as b, showDeleteNodeModal as c, useDownloadDocument as d, useDragNode as f, useNodeById as g, useNodeActions as h, isFolderNodeKind as i, t$2 as j, e$1 as k, showRevisionHistory as l, useGetSwitchboardLink as m, getSyncStatusSync as n, setSelectedNode as o, useDropNode as p, isFileNodeKind as r, showCreateDocumentModal as s, addFolder as t, useDocumentModelModules as u, useNodesInSelectedDriveOrFolder as v, useSelectedNodePath as w, useSelectedDocumentSafe as x, usePHToast as y };
3767
3781
 
3768
- //# sourceMappingURL=dist-C1nRM9t2.js.map
3782
+ //# sourceMappingURL=dist-B6zWOl4d.js.map