@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, j as __toESM, t as capitalCase } from "./dist-fA4EItr0.mjs";
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-sM33juXr.mjs";
3
- import { a as SyncStatus, n as require_main, o as ModuleNotFoundError, s as driveCollectionId, t as reactorDriveDocumentModelModule } from "./dist-Cn3iExnV.mjs";
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-DjL9iikf.mjs";
3
+ import { a as SyncStatus, n as require_main, o as ModuleNotFoundError, s as driveCollectionId, t as reactorDriveDocumentModelModule } from "./dist-vA9scgbK.mjs";
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
  var import_main = require_main();
219
219
  const PhDocumentFieldsFragmentDoc = import_main.gql`
220
220
  fragment PHDocumentFields on PHDocument {
@@ -283,13 +283,6 @@ const GetDocumentWithOperationsDocument = import_main.gql`
283
283
  timestampUtcMs
284
284
  input
285
285
  scope
286
- attachments {
287
- data
288
- mimeType
289
- hash
290
- extension
291
- fileName
292
- }
293
286
  context {
294
287
  signer {
295
288
  user {
@@ -402,13 +395,6 @@ const GetDocumentOperationsDocument = import_main.gql`
402
395
  timestampUtcMs
403
396
  input
404
397
  scope
405
- attachments {
406
- data
407
- mimeType
408
- hash
409
- extension
410
- fileName
411
- }
412
398
  context {
413
399
  signer {
414
400
  user {
@@ -659,13 +645,6 @@ import_main.gql`
659
645
  timestampUtcMs
660
646
  input
661
647
  scope
662
- attachments {
663
- data
664
- mimeType
665
- hash
666
- extension
667
- fileName
668
- }
669
648
  context {
670
649
  signer {
671
650
  user {
@@ -2510,14 +2489,30 @@ async function exportFile(document, suggestedName) {
2510
2489
  if (!(e instanceof DOMException && e.name === "AbortError")) throw e;
2511
2490
  }
2512
2491
  }
2492
+ /**
2493
+ * Loads a document file and replays it with version-aware reducers from the registry.
2494
+ * Falls back to single-version legacy replay when no upgrade manifest is registered for
2495
+ * the document type.
2496
+ */
2513
2497
  async function loadFile(path) {
2514
2498
  const baseDocument = await baseLoadFromInput(path, (state) => state, { checkHashes: true });
2515
2499
  const reactorClient = window.ph?.reactorClient;
2516
2500
  if (!reactorClient) throw new Error("ReactorClient not initialized");
2501
+ const documentType = baseDocument.header.documentType;
2517
2502
  const { results: documentModelModules } = await reactorClient.getDocumentModelModules();
2518
- const documentModelModule = documentModelModules.find((module) => module.documentModel.global.id === baseDocument.header.documentType);
2519
- if (!documentModelModule) throw new DocumentModelNotFoundError(baseDocument.header.documentType);
2520
- return documentModelModule.utils.loadFromInput(path);
2503
+ const modulesForType = documentModelModules.filter((module) => module.documentModel.global.id === documentType);
2504
+ if (modulesForType.length === 0) throw new DocumentModelNotFoundError(documentType);
2505
+ const reducers = {};
2506
+ for (const module of modulesForType) reducers[module.version ?? 1] = module.reducer;
2507
+ const registry = window.ph?.reactorClientModule?.reactorModule?.documentModelRegistry;
2508
+ let upgradeManifest;
2509
+ if (registry) try {
2510
+ upgradeManifest = registry.getUpgradeManifest(documentType);
2511
+ } catch {}
2512
+ return baseLoadFromInputVersioned(path, {
2513
+ reducers,
2514
+ upgradeManifest
2515
+ });
2521
2516
  }
2522
2517
  async function addDocument(driveId, name, documentType, parentFolder, document, id, preferredEditor) {
2523
2518
  const { isAllowedToCreateDocuments } = getUserPermissions();
@@ -2639,9 +2634,28 @@ async function moveNode$1(driveId, src, target) {
2639
2634
  targetParentFolder: target?.id
2640
2635
  })]);
2641
2636
  }
2637
+ /**
2638
+ * Duplicates a document under a new id using version-aware replay.
2639
+ * Falls back gracefully when no upgrade manifest is registered for the document type.
2640
+ */
2642
2641
  async function _duplicateDocument(reactor, document, newId = generateId()) {
2643
- const documentModule = await reactor.getDocumentModelModule(document.header.documentType);
2644
- return replayDocument(document.initialState, document.operations, documentModule.reducer, createPresignedHeader(newId, document.header.documentType));
2642
+ const documentType = document.header.documentType;
2643
+ const { results: allModules } = await reactor.getDocumentModelModules();
2644
+ const modulesForType = allModules.filter((m) => m.documentModel.global.id === documentType);
2645
+ const reducers = {};
2646
+ for (const m of modulesForType) reducers[m.version ?? 1] = m.reducer;
2647
+ if (Object.keys(reducers).length === 0) throw new Error(`Document model module not found for type: ${documentType}`);
2648
+ const registry = window.ph?.reactorClientModule?.reactorModule?.documentModelRegistry;
2649
+ let upgradeManifest;
2650
+ if (registry) try {
2651
+ upgradeManifest = registry.getUpgradeManifest(documentType);
2652
+ } catch {}
2653
+ const config = {
2654
+ reducers,
2655
+ upgradeManifest
2656
+ };
2657
+ const header = createPresignedHeader(newId, documentType);
2658
+ return replayDocumentVersioned(document.initialState, document.operations, config, header);
2645
2659
  }
2646
2660
  async function copyNode$1(driveId, src, target) {
2647
2661
  const reactor = window.ph?.reactorClient;
@@ -3766,4 +3780,4 @@ createDebouncedRefreshReactorDataClient();
3766
3780
  //#endregion
3767
3781
  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 };
3768
3782
 
3769
- //# sourceMappingURL=dist-Bm05eoTg.mjs.map
3783
+ //# sourceMappingURL=dist-D3qXr1ES.mjs.map