@powerhousedao/vetra 6.0.0-dev.249 → 6.0.0-dev.250

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 (121) hide show
  1. package/dist/app-module-Bbj7PI-S.js +94 -0
  2. package/dist/app-module-Bbj7PI-S.js.map +1 -0
  3. package/dist/connect-CTIucT0o.js +6 -0
  4. package/dist/connect-CTIucT0o.js.map +1 -0
  5. package/dist/document-editor-DS-bZMKx.js +93 -0
  6. package/dist/document-editor-DS-bZMKx.js.map +1 -0
  7. package/dist/document-models/app-module/index.d.ts +349 -2
  8. package/dist/document-models/app-module/index.d.ts.map +1 -0
  9. package/dist/document-models/app-module/index.js +3 -2
  10. package/dist/document-models/document-editor/index.d.ts +325 -2
  11. package/dist/document-models/document-editor/index.d.ts.map +1 -0
  12. package/dist/document-models/document-editor/index.js +3 -2
  13. package/dist/document-models/index.d.ts +6 -29
  14. package/dist/document-models/index.js +6 -2
  15. package/dist/document-models/processor-module/index.d.ts +357 -2
  16. package/dist/document-models/processor-module/index.d.ts.map +1 -0
  17. package/dist/document-models/processor-module/index.js +3 -2
  18. package/dist/document-models/subgraph-module/index.d.ts +296 -2
  19. package/dist/document-models/subgraph-module/index.d.ts.map +1 -0
  20. package/dist/document-models/subgraph-module/index.js +3 -2
  21. package/dist/document-models/vetra-package/index.d.ts +386 -2
  22. package/dist/document-models/vetra-package/index.d.ts.map +1 -0
  23. package/dist/document-models/vetra-package/index.js +3 -2
  24. package/dist/{editor-DqkJ0B4G.js → editor-BSQfwcdz.js} +5 -4
  25. package/dist/{editor-DqkJ0B4G.js.map → editor-BSQfwcdz.js.map} +1 -1
  26. package/dist/{editor-CGNcK2z0.js → editor-Bku8e2dr.js} +5 -5
  27. package/dist/{editor-CGNcK2z0.js.map → editor-Bku8e2dr.js.map} +1 -1
  28. package/dist/{editor-ddcGG42r.js → editor-CbtrPBTP.js} +5 -4
  29. package/dist/{editor-ddcGG42r.js.map → editor-CbtrPBTP.js.map} +1 -1
  30. package/dist/{editor-D4FHn5u4.js → editor-D70FYIwV.js} +2 -2
  31. package/dist/{editor-D4FHn5u4.js.map → editor-D70FYIwV.js.map} +1 -1
  32. package/dist/{editor-CdzYJozI.js → editor-Dtg8STyT.js} +5 -5
  33. package/dist/{editor-CdzYJozI.js.map → editor-Dtg8STyT.js.map} +1 -1
  34. package/dist/{editor-CgkzQJ4g.js → editor-SfVorwsP.js} +6 -6
  35. package/dist/{editor-CgkzQJ4g.js.map → editor-SfVorwsP.js.map} +1 -1
  36. package/dist/editors/hooks/index.js +1 -1
  37. package/dist/editors/index.d.ts +13 -12
  38. package/dist/editors/index.d.ts.map +1 -1
  39. package/dist/editors/index.js +2 -2
  40. package/dist/{codegen-PnsnCMkw.js → factory-CweZppg6.js} +51 -3
  41. package/dist/factory-CweZppg6.js.map +1 -0
  42. package/dist/factory-D8ZDOMP3.js +79 -0
  43. package/dist/factory-D8ZDOMP3.js.map +1 -0
  44. package/dist/{hooks-Vx4YtE1e.js → hooks-Xexr33XS.js} +1 -1
  45. package/dist/{hooks-Vx4YtE1e.js.map → hooks-Xexr33XS.js.map} +1 -1
  46. package/dist/index.d.ts +7 -2
  47. package/dist/index.d.ts.map +1 -1
  48. package/dist/index.js +13 -5
  49. package/dist/index.js.map +1 -1
  50. package/dist/{processor-module-CkuQiq7B.js → module-BWlCj_0C.js} +159 -204
  51. package/dist/module-BWlCj_0C.js.map +1 -0
  52. package/dist/{subgraph-module-CU_-umq2.js → module-BoGgbKmO.js} +111 -153
  53. package/dist/module-BoGgbKmO.js.map +1 -0
  54. package/dist/module-BoX1rWiq.d.ts +6 -0
  55. package/dist/module-BoX1rWiq.d.ts.map +1 -0
  56. package/dist/module-CG6K37P8.d.ts +6 -0
  57. package/dist/module-CG6K37P8.d.ts.map +1 -0
  58. package/dist/{app-module-BbhoykB5.js → module-CTPfENDU.js} +149 -189
  59. package/dist/module-CTPfENDU.js.map +1 -0
  60. package/dist/{module-BW12i5H3.js → module-CXIFrq-R.js} +15 -11
  61. package/dist/module-CXIFrq-R.js.map +1 -0
  62. package/dist/{vetra-package-VqptqKzx.js → module-CZLiUtDI.js} +186 -236
  63. package/dist/module-CZLiUtDI.js.map +1 -0
  64. package/dist/module-Cr-9knz_.d.ts +6 -0
  65. package/dist/module-Cr-9knz_.d.ts.map +1 -0
  66. package/dist/{document-editor-CHM7Pu4m.js → module-D0SK3Nds.js} +137 -180
  67. package/dist/module-D0SK3Nds.js.map +1 -0
  68. package/dist/module-DhhQLYnQ.d.ts +6 -0
  69. package/dist/module-DhhQLYnQ.d.ts.map +1 -0
  70. package/dist/module-J-kGIl1E.d.ts +6 -0
  71. package/dist/module-J-kGIl1E.d.ts.map +1 -0
  72. package/dist/powerhouse.manifest.d.ts +8 -5
  73. package/dist/powerhouse.manifest.d.ts.map +1 -1
  74. package/dist/powerhouse.manifest.js +19 -12
  75. package/dist/processor-module-D0lRrrpW.js +95 -0
  76. package/dist/processor-module-D0lRrrpW.js.map +1 -0
  77. package/dist/processors/codegen/index.d.ts +21322 -2
  78. package/dist/processors/codegen/index.d.ts.map +1 -0
  79. package/dist/processors/codegen/index.js +2 -2
  80. package/dist/processors/index.d.ts +4 -15
  81. package/dist/processors/index.d.ts.map +1 -1
  82. package/dist/processors/index.js +8 -81
  83. package/dist/processors/index.js.map +1 -1
  84. package/dist/processors/vetra-read-model/index.d.ts +18599 -2
  85. package/dist/processors/vetra-read-model/index.d.ts.map +1 -0
  86. package/dist/processors/vetra-read-model/index.js +2 -54
  87. package/dist/subgraph-module-B3ipwOza.js +92 -0
  88. package/dist/subgraph-module-B3ipwOza.js.map +1 -0
  89. package/dist/switchboard-JOTFVXuj.js +8 -0
  90. package/dist/switchboard-JOTFVXuj.js.map +1 -0
  91. package/dist/{useVetraDocument-DF0teXXM.js → useVetraDocument-DoAwvHVi.js} +1 -1
  92. package/dist/{useVetraDocument-DF0teXXM.js.map → useVetraDocument-DoAwvHVi.js.map} +1 -1
  93. package/dist/vetra-package-YNLxEA-U.js +100 -0
  94. package/dist/vetra-package-YNLxEA-U.js.map +1 -0
  95. package/package.json +9 -8
  96. package/dist/app-module-BbhoykB5.js.map +0 -1
  97. package/dist/codegen-PnsnCMkw.js.map +0 -1
  98. package/dist/document-editor-CHM7Pu4m.js.map +0 -1
  99. package/dist/document-models/index.d.ts.map +0 -1
  100. package/dist/editor-Bsu4yikl.js +0 -2
  101. package/dist/index-CHfOF-Et.d.ts +0 -363
  102. package/dist/index-CHfOF-Et.d.ts.map +0 -1
  103. package/dist/index-CL_CHW_Z.d.ts +0 -330
  104. package/dist/index-CL_CHW_Z.d.ts.map +0 -1
  105. package/dist/index-C_kUPMNf.d.ts +0 -298
  106. package/dist/index-C_kUPMNf.d.ts.map +0 -1
  107. package/dist/index-CxWUNzph.d.ts +0 -21319
  108. package/dist/index-CxWUNzph.d.ts.map +0 -1
  109. package/dist/index-Ofk3NYAC.d.ts +0 -18596
  110. package/dist/index-Ofk3NYAC.d.ts.map +0 -1
  111. package/dist/index-Qr_rU6VS.d.ts +0 -271
  112. package/dist/index-Qr_rU6VS.d.ts.map +0 -1
  113. package/dist/index-cBMMID-w.d.ts +0 -323
  114. package/dist/index-cBMMID-w.d.ts.map +0 -1
  115. package/dist/module-BW12i5H3.js.map +0 -1
  116. package/dist/module-XCoMwFat.js +0 -59
  117. package/dist/module-XCoMwFat.js.map +0 -1
  118. package/dist/processor-module-CkuQiq7B.js.map +0 -1
  119. package/dist/processors/vetra-read-model/index.js.map +0 -1
  120. package/dist/subgraph-module-CU_-umq2.js.map +0 -1
  121. package/dist/vetra-package-VqptqKzx.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"hooks-Vx4YtE1e.js","names":[],"sources":["../editors/hooks/useAvailableDocumentTypes.ts","../editors/hooks/useDebounce.ts"],"sourcesContent":["import {\n useDocumentsInSelectedDrive,\n useSupportedDocumentTypesInReactor,\n} from \"@powerhousedao/reactor-browser\";\nimport type {\n DocumentModelDocument,\n PHDocument,\n} from \"@powerhousedao/shared/document-model\";\n\nfunction isDocumentModelDocument(\n document: PHDocument,\n): document is DocumentModelDocument {\n return document.header.documentType === \"powerhouse/document-model\";\n}\n\nexport function useAvailableDocumentTypes(\n onlyDocumentTypesFromDriveDocuments = false,\n): string[] {\n const supportedDocumentTypes = useSupportedDocumentTypesInReactor() ?? [];\n const documents = useDocumentsInSelectedDrive() ?? [];\n const documentModelDocumentsInSelectedDrive = documents.filter(\n isDocumentModelDocument,\n );\n const documentTypesFromDocumentModelDocuments =\n documentModelDocumentsInSelectedDrive.map((doc) => doc.state.global.id);\n\n if (onlyDocumentTypesFromDriveDocuments)\n return [...new Set(documentTypesFromDocumentModelDocuments)];\n\n return [\n ...new Set([\n ...supportedDocumentTypes,\n ...documentTypesFromDocumentModelDocuments,\n ]),\n ];\n}\n","import { useEffect } from \"react\";\n\n/**\n * Reusable debounce hook that calls a callback function after a specified delay\n * when the value changes. Useful for API calls, search inputs, etc.\n *\n * @param value - The value to debounce\n * @param callback - Function to call with the debounced value (optional)\n * @param delay - Delay in milliseconds\n */\nexport function useDebounce<T>(\n value: T,\n callback: ((value: T) => void) | undefined,\n delay: number,\n) {\n useEffect(() => {\n if (!callback) return;\n\n const timer = setTimeout(() => {\n callback(value);\n }, delay);\n\n return () => clearTimeout(timer);\n }, [value, callback, delay]);\n}\n"],"mappings":";;;AASA,SAAS,wBACP,UACmC;AACnC,QAAO,SAAS,OAAO,iBAAiB;;AAG1C,SAAgB,0BACd,sCAAsC,OAC5B;CACV,MAAM,yBAAyB,oCAAoC,IAAI,EAAE;CAKzE,MAAM,2CAJY,6BAA6B,IAAI,EAAE,EACG,OACtD,wBACD,CAEuC,KAAK,QAAQ,IAAI,MAAM,OAAO,GAAG;AAEzE,KAAI,oCACF,QAAO,CAAC,GAAG,IAAI,IAAI,wCAAwC,CAAC;AAE9D,QAAO,CACL,GAAG,IAAI,IAAI,CACT,GAAG,wBACH,GAAG,wCACJ,CAAC,CACH;;;;;;;;;;;;ACxBH,SAAgB,YACd,OACA,UACA,OACA;AACA,iBAAgB;AACd,MAAI,CAAC,SAAU;EAEf,MAAM,QAAQ,iBAAiB;AAC7B,YAAS,MAAM;KACd,MAAM;AAET,eAAa,aAAa,MAAM;IAC/B;EAAC;EAAO;EAAU;EAAM,CAAC"}
1
+ {"version":3,"file":"hooks-Xexr33XS.js","names":[],"sources":["../editors/hooks/useAvailableDocumentTypes.ts","../editors/hooks/useDebounce.ts"],"sourcesContent":["import {\n useDocumentsInSelectedDrive,\n useSupportedDocumentTypesInReactor,\n} from \"@powerhousedao/reactor-browser\";\nimport type {\n DocumentModelDocument,\n PHDocument,\n} from \"@powerhousedao/shared/document-model\";\n\nfunction isDocumentModelDocument(\n document: PHDocument,\n): document is DocumentModelDocument {\n return document.header.documentType === \"powerhouse/document-model\";\n}\n\nexport function useAvailableDocumentTypes(\n onlyDocumentTypesFromDriveDocuments = false,\n): string[] {\n const supportedDocumentTypes = useSupportedDocumentTypesInReactor() ?? [];\n const documents = useDocumentsInSelectedDrive() ?? [];\n const documentModelDocumentsInSelectedDrive = documents.filter(\n isDocumentModelDocument,\n );\n const documentTypesFromDocumentModelDocuments =\n documentModelDocumentsInSelectedDrive.map((doc) => doc.state.global.id);\n\n if (onlyDocumentTypesFromDriveDocuments)\n return [...new Set(documentTypesFromDocumentModelDocuments)];\n\n return [\n ...new Set([\n ...supportedDocumentTypes,\n ...documentTypesFromDocumentModelDocuments,\n ]),\n ];\n}\n","import { useEffect } from \"react\";\n\n/**\n * Reusable debounce hook that calls a callback function after a specified delay\n * when the value changes. Useful for API calls, search inputs, etc.\n *\n * @param value - The value to debounce\n * @param callback - Function to call with the debounced value (optional)\n * @param delay - Delay in milliseconds\n */\nexport function useDebounce<T>(\n value: T,\n callback: ((value: T) => void) | undefined,\n delay: number,\n) {\n useEffect(() => {\n if (!callback) return;\n\n const timer = setTimeout(() => {\n callback(value);\n }, delay);\n\n return () => clearTimeout(timer);\n }, [value, callback, delay]);\n}\n"],"mappings":";;;AASA,SAAS,wBACP,UACmC;AACnC,QAAO,SAAS,OAAO,iBAAiB;;AAG1C,SAAgB,0BACd,sCAAsC,OAC5B;CACV,MAAM,yBAAyB,oCAAoC,IAAI,EAAE;CAKzE,MAAM,2CAJY,6BAA6B,IAAI,EAAE,EACG,OACtD,wBACD,CAEuC,KAAK,QAAQ,IAAI,MAAM,OAAO,GAAG;AAEzE,KAAI,oCACF,QAAO,CAAC,GAAG,IAAI,IAAI,wCAAwC,CAAC;AAE9D,QAAO,CACL,GAAG,IAAI,IAAI,CACT,GAAG,wBACH,GAAG,wCACJ,CAAC,CACH;;;;;;;;;;;;ACxBH,SAAgB,YACd,OACA,UACA,OACA;AACA,iBAAgB;AACd,MAAI,CAAC,SAAU;EAEf,MAAM,QAAQ,iBAAiB;AAC7B,YAAS,MAAM;KACd,MAAM;AAET,eAAa,aAAa,MAAM;IAC/B;EAAC;EAAO;EAAU;EAAM,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,7 +1,12 @@
1
- import { DocumentModelModule, EditorModule, Manifest } from "@powerhousedao/shared/document-model";
1
+ import { EditorModule } from "document-model";
2
+ import { Manifest } from "@powerhousedao/shared/document-model";
2
3
 
3
4
  //#region document-models/document-models.d.ts
4
- declare const documentModels: DocumentModelModule<any>[];
5
+ /**
6
+ * WARNING: DO NOT EDIT
7
+ * This file is auto-generated and updated by codegen
8
+ */
9
+ declare const documentModels: readonly [DocumentModelModule<any>, DocumentModelModule<any>, DocumentModelModule<any>, DocumentModelModule<any>, DocumentModelModule<any>];
5
10
  //#endregion
6
11
  //#region editors/editors.d.ts
7
12
  declare const editors: EditorModule[];
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../document-models/document-models.ts","../editors/editors.ts","../index.ts"],"mappings":";;;cAOa,cAAA,EAAgB,mBAAA;;;cCChB,OAAA,EAAS,YAAA;;;cCJT,QAAA,EAAU,QAAA"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../document-models/document-models.ts","../editors/editors.ts","../index.ts"],"mappings":";;;;;;;;cAWa,cAAA,YAAc,mBAAA,OAAA,mBAAA,OAAA,mBAAA,OAAA,mBAAA,OAAA,mBAAA;;;cCCd,OAAA,EAAS,YAAA;;;cCRT,QAAA,EAAU,QAAA"}
package/dist/index.js CHANGED
@@ -1,7 +1,15 @@
1
1
  import powerhouse_manifest_default from "./powerhouse.manifest.js";
2
- import { a as AppModule, i as DocumentEditor, n as SubgraphModule, r as ProcessorModule, t as VetraPackage } from "./module-XCoMwFat.js";
3
- import { a as DocumentEditor$1, i as ProcessorEditor, n as VetraDriveApp, o as AppEditor, r as SubgraphEditor, t as VetraPackageEditor } from "./module-BW12i5H3.js";
2
+ import { t as AppModule } from "./module-CTPfENDU.js";
3
+ import { t as DocumentEditor } from "./module-D0SK3Nds.js";
4
+ import { t as ProcessorModule } from "./module-BWlCj_0C.js";
5
+ import { t as SubgraphModule } from "./module-BoGgbKmO.js";
6
+ import { t as VetraPackage } from "./module-CZLiUtDI.js";
7
+ import { a as DocumentEditorEditor, i as ProcessorModuleEditor, n as VetraDriveApp, o as AppEditor, r as SubgraphModuleEditor, t as VetraPackageEditor } from "./module-CXIFrq-R.js";
4
8
  //#region document-models/document-models.ts
9
+ /**
10
+ * WARNING: DO NOT EDIT
11
+ * This file is auto-generated and updated by codegen
12
+ */
5
13
  const documentModels = [
6
14
  AppModule,
7
15
  DocumentEditor,
@@ -13,9 +21,9 @@ const documentModels = [
13
21
  //#region editors/editors.ts
14
22
  const editors = [
15
23
  AppEditor,
16
- DocumentEditor$1,
17
- ProcessorEditor,
18
- SubgraphEditor,
24
+ DocumentEditorEditor,
25
+ ProcessorModuleEditor,
26
+ SubgraphModuleEditor,
19
27
  VetraDriveApp,
20
28
  VetraPackageEditor
21
29
  ];
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["DocumentEditor","manifestJson"],"sources":["../document-models/document-models.ts","../editors/editors.ts","../index.ts"],"sourcesContent":["import type { DocumentModelModule } from \"@powerhousedao/shared/document-model\";\nimport { AppModule } from \"./app-module/module.js\";\nimport { DocumentEditor } from \"./document-editor/module.js\";\nimport { ProcessorModule } from \"./processor-module/module.js\";\nimport { SubgraphModule } from \"./subgraph-module/module.js\";\nimport { VetraPackage } from \"./vetra-package/module.js\";\n\nexport const documentModels: DocumentModelModule<any>[] = [\n AppModule,\n DocumentEditor,\n ProcessorModule,\n SubgraphModule,\n VetraPackage,\n];\n","import type { EditorModule } from \"@powerhousedao/shared/document-model\";\nimport { AppEditor } from \"./app-editor/module.js\";\nimport { DocumentEditor } from \"./document-editor/module.js\";\nimport { ProcessorEditor } from \"./processor-editor/module.js\";\nimport { SubgraphEditor } from \"./subgraph-editor/module.js\";\nimport { VetraDriveApp } from \"./vetra-drive-app/module.js\";\nimport { VetraPackageEditor } from \"./vetra-package/module.js\";\n\nexport const editors: EditorModule[] = [\n AppEditor,\n DocumentEditor,\n ProcessorEditor,\n SubgraphEditor,\n VetraDriveApp,\n VetraPackageEditor,\n];\n","import type { Manifest } from \"@powerhousedao/shared/document-model\";\nimport manifestJson from \"./powerhouse.manifest.json\" with { type: \"json\" };\nexport { documentModels } from \"./document-models/document-models.js\";\nexport { editors } from \"./editors/editors.js\";\nexport const manifest: Manifest = manifestJson;\n"],"mappings":";;;;AAOA,MAAa,iBAA6C;CACxD;CACA;CACA;CACA;CACA;CACD;;;ACLD,MAAa,UAA0B;CACrC;CACAA;CACA;CACA;CACA;CACA;CACD;;;ACXD,MAAa,WAAqBC"}
1
+ {"version":3,"file":"index.js","names":["AppModuleV1","DocumentEditorV1","ProcessorModuleV1","SubgraphModuleV1","VetraPackageV1","manifestJson"],"sources":["../document-models/document-models.ts","../editors/editors.ts","../index.ts"],"sourcesContent":["import { AppModule as AppModuleV1 } from \"document-models/app-module/v1\";\nimport { DocumentEditor as DocumentEditorV1 } from \"document-models/document-editor/v1\";\nimport { ProcessorModule as ProcessorModuleV1 } from \"document-models/processor-module/v1\";\nimport { SubgraphModule as SubgraphModuleV1 } from \"document-models/subgraph-module/v1\";\nimport { VetraPackage as VetraPackageV1 } from \"document-models/vetra-package/v1\";\n\n/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\n\nexport const documentModels = [\n AppModuleV1,\n DocumentEditorV1,\n ProcessorModuleV1,\n SubgraphModuleV1,\n VetraPackageV1,\n] as const;\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { EditorModule } from \"document-model\";\nimport { AppEditor } from \"./app-editor/module.js\";\nimport { DocumentEditorEditor } from \"./document-editor/module.js\";\nimport { ProcessorModuleEditor } from \"./processor-editor/module.js\";\nimport { SubgraphModuleEditor } from \"./subgraph-editor/module.js\";\nimport { VetraDriveApp } from \"./vetra-drive-app/module.js\";\nimport { VetraPackageEditor } from \"./vetra-package/module.js\";\n\nexport const editors: EditorModule[] = [\n AppEditor,\n DocumentEditorEditor,\n ProcessorModuleEditor,\n SubgraphModuleEditor,\n VetraDriveApp,\n VetraPackageEditor,\n];\n","import type { Manifest } from \"@powerhousedao/shared/document-model\";\nimport manifestJson from \"./powerhouse.manifest.json\" with { type: \"json\" };\nexport { documentModels } from \"./document-models/document-models.js\";\nexport { editors } from \"./editors/editors.js\";\nexport const manifest: Manifest = manifestJson;\n"],"mappings":";;;;;;;;;;;;AAWA,MAAa,iBAAiB;CAC5BA;CACAC;CACAC;CACAC;CACAC;CACD;;;ACLD,MAAa,UAA0B;CACrC;CACA;CACA;CACA;CACA;CACA;CACD;;;ACfD,MAAa,WAAqBC"}
@@ -1,43 +1,119 @@
1
1
  import { t as __exportAll } from "./chunk-pbuEa-1d.js";
2
- import { BaseDocumentHeaderSchema, BaseDocumentStateSchema, baseActions, baseCreateDocument, baseLoadFromInput, baseSaveToFileHandle, createAction, createBaseState, createReducer, defaultBaseState, generateId, isDocumentAction } from "@powerhousedao/shared/document-model";
2
+ import { BaseDocumentHeaderSchema, BaseDocumentStateSchema, baseActions, baseCreateDocument, baseLoadFromInput, baseSaveToFileHandle, createAction, createReducer, createState, defaultBaseState, generateId, isDocumentAction } from "document-model";
3
3
  import * as z$1 from "zod";
4
4
  import { z } from "zod";
5
- import { useDocumentById, useDocumentsInSelectedDrive, useDocumentsInSelectedFolder, useSelectedDocument } from "@powerhousedao/reactor-browser";
6
5
  import { PROCESSOR_APPS } from "@powerhousedao/shared/processors";
7
- //#region document-models/processor-module/gen/document-model.ts
6
+ //#region document-models/processor-module/v1/gen/schema/zod.ts
7
+ const isDefinedNonNullAny = (v) => v !== void 0 && v !== null;
8
+ const definedNonNullAnySchema = z$1.any().refine((v) => isDefinedNonNullAny(v));
9
+ const StatusTypeSchema = z$1.enum(["CONFIRMED", "DRAFT"]);
10
+ function AddDocumentTypeInputSchema() {
11
+ return z$1.object({
12
+ documentType: z$1.string(),
13
+ id: z$1.string()
14
+ });
15
+ }
16
+ function AddProcessorAppInputSchema() {
17
+ return z$1.object({ processorApp: z$1.string() });
18
+ }
19
+ function DocumentTypeItemSchema() {
20
+ return z$1.object({
21
+ __typename: z$1.literal("DocumentTypeItem").optional(),
22
+ documentType: z$1.string(),
23
+ id: z$1.string()
24
+ });
25
+ }
26
+ function ProcessorModuleStateSchema() {
27
+ return z$1.object({
28
+ __typename: z$1.literal("ProcessorModuleState").optional(),
29
+ documentTypes: z$1.array(z$1.lazy(() => DocumentTypeItemSchema())),
30
+ name: z$1.string(),
31
+ processorApps: z$1.array(z$1.string()),
32
+ status: StatusTypeSchema,
33
+ type: z$1.string()
34
+ });
35
+ }
36
+ function RemoveDocumentTypeInputSchema() {
37
+ return z$1.object({ id: z$1.string() });
38
+ }
39
+ function RemoveProcessorAppInputSchema() {
40
+ return z$1.object({ processorApp: z$1.string() });
41
+ }
42
+ function SetProcessorNameInputSchema() {
43
+ return z$1.object({ name: z$1.string() });
44
+ }
45
+ function SetProcessorStatusInputSchema() {
46
+ return z$1.object({ status: StatusTypeSchema });
47
+ }
48
+ function SetProcessorTypeInputSchema() {
49
+ return z$1.object({ type: z$1.string() });
50
+ }
51
+ //#endregion
52
+ //#region document-models/processor-module/v1/gen/base-operations/creators.ts
53
+ /**
54
+ * WARNING: DO NOT EDIT
55
+ * This file is auto-generated and updated by codegen
56
+ */
57
+ var creators_exports = /* @__PURE__ */ __exportAll({
58
+ addDocumentType: () => addDocumentType,
59
+ addProcessorApp: () => addProcessorApp,
60
+ removeDocumentType: () => removeDocumentType,
61
+ removeProcessorApp: () => removeProcessorApp,
62
+ setProcessorName: () => setProcessorName,
63
+ setProcessorStatus: () => setProcessorStatus,
64
+ setProcessorType: () => setProcessorType
65
+ });
66
+ const setProcessorName = (input) => createAction("SET_PROCESSOR_NAME", { ...input }, void 0, SetProcessorNameInputSchema, "global");
67
+ const setProcessorType = (input) => createAction("SET_PROCESSOR_TYPE", { ...input }, void 0, SetProcessorTypeInputSchema, "global");
68
+ const addDocumentType = (input) => createAction("ADD_DOCUMENT_TYPE", { ...input }, void 0, AddDocumentTypeInputSchema, "global");
69
+ const removeDocumentType = (input) => createAction("REMOVE_DOCUMENT_TYPE", { ...input }, void 0, RemoveDocumentTypeInputSchema, "global");
70
+ const addProcessorApp = (input) => createAction("ADD_PROCESSOR_APP", { ...input }, void 0, AddProcessorAppInputSchema, "global");
71
+ const removeProcessorApp = (input) => createAction("REMOVE_PROCESSOR_APP", { ...input }, void 0, RemoveProcessorAppInputSchema, "global");
72
+ const setProcessorStatus = (input) => createAction("SET_PROCESSOR_STATUS", { ...input }, void 0, SetProcessorStatusInputSchema, "global");
73
+ //#endregion
74
+ //#region document-models/processor-module/v1/actions.ts
75
+ /**
76
+ * WARNING: DO NOT EDIT
77
+ * This file is auto-generated and updated by codegen
78
+ */
79
+ /** Actions for the ProcessorModule document model */
80
+ const actions = {
81
+ ...baseActions,
82
+ ...creators_exports
83
+ };
84
+ //#endregion
85
+ //#region document-models/processor-module/v1/gen/document-model.ts
8
86
  const documentModel = {
9
87
  id: "powerhouse/processor",
10
88
  name: "Processor Module",
11
- extension: ".phdm",
12
- description: "",
13
89
  author: {
14
90
  name: "Powerhouse",
15
91
  website: "https://powerhouse.inc"
16
92
  },
93
+ extension: ".processor",
94
+ description: "Declares a processor (a server-side function that reacts to document operations to build read models, send notifications, sync to external systems, etc.) shipped by a Vetra Reactor Package. Create one Processor Module document per processor: pick the processor type, list the document types it subscribes to, attach it to any drive apps that should run it, and mark it CONFIRMED to trigger codegen of the processor scaffold under `processors/`.",
17
95
  specifications: [{
18
- version: 1,
19
- changeLog: [],
20
96
  state: {
21
- global: {
22
- schema: "type ProcessorModuleState {\n name: String!\n type: String!\n documentTypes: [DocumentTypeItem!]!\n status: StatusType!\n processorApps: [String!]! \n}\n\ntype DocumentTypeItem {\n id: OID!\n documentType: String!\n}\n\nenum StatusType {\n DRAFT\n CONFIRMED\n}",
23
- initialValue: "{\n \"name\": \"\",\n \"type\": \"\",\n \"documentTypes\": [],\n \"status\": \"DRAFT\",\n processorApps: [] \n}",
24
- examples: []
25
- },
26
97
  local: {
27
98
  schema: "",
28
- initialValue: "",
29
- examples: []
99
+ examples: [],
100
+ initialValue: ""
101
+ },
102
+ global: {
103
+ schema: "\"\"\"\nConfiguration for a processor contributed by the package. A processor receives\noperations from documents of matching types and runs server-side logic (e.g.\nbuilding a read model, indexing, syncing to an external system).\n\"\"\"\ntype ProcessorModuleState {\n \"\"\"Display name of the processor. Also determines the generated folder name under `processors/`.\"\"\"\n name: String!\n \"\"\"Processor implementation kind (e.g. 'read-model', 'relational-db'). Determines which scaffold codegen emits.\"\"\"\n type: String!\n \"\"\"Document types this processor subscribes to. Each entry has a stable id so it can be removed individually.\"\"\"\n documentTypes: [DocumentTypeItem!]!\n \"\"\"Lifecycle status. While DRAFT the processor definition is editable and codegen is skipped; switching to CONFIRMED triggers scaffold generation.\"\"\"\n status: StatusType!\n \"\"\"Drive-app names this processor is attached to. The processor runs in the context of each listed app.\"\"\"\n processorApps: [String!]!\n}\n\n\"\"\"A document type id (e.g. 'my-org/invoice') attached to the processor with a stable entry id.\"\"\"\ntype DocumentTypeItem {\n \"\"\"Stable identifier for the entry; used to remove it.\"\"\"\n id: OID!\n \"\"\"Document type id this processor subscribes to.\"\"\"\n documentType: String!\n}\n\n\"\"\"\nLifecycle status of a module definition.\n- DRAFT: still being edited; codegen does not run.\n- CONFIRMED: locked in; codegen produces the corresponding scaffold.\n\"\"\"\nenum StatusType {\n DRAFT\n CONFIRMED\n}",
104
+ examples: [],
105
+ initialValue: "{\n \"name\": \"\",\n \"type\": \"\",\n \"documentTypes\": [],\n \"status\": \"DRAFT\",\n \"processorApps\": []\n}"
30
106
  }
31
107
  },
32
108
  modules: [{
33
109
  id: "91ad39c1-4e8b-4127-b3c8-e835b85e6360",
34
110
  name: "base_operations",
35
- description: "",
111
+ description: "Set the processor's identity, kind, lifecycle status, subscribed document types, and attached drive apps.",
36
112
  operations: [
37
113
  {
38
114
  id: "6f3a5c90-39f2-4302-a073-6195a71c5054",
39
115
  name: "SET_PROCESSOR_NAME",
40
- description: "",
116
+ description: "Set the display name of the processor. Also determines the generated folder name under `processors/`.",
41
117
  schema: "input SetProcessorNameInput {\n name: String!\n}",
42
118
  template: "",
43
119
  reducer: "",
@@ -48,7 +124,7 @@ const documentModel = {
48
124
  {
49
125
  id: "b8f28bb4-c6ae-40e6-86fa-29ef14ff8667",
50
126
  name: "SET_PROCESSOR_TYPE",
51
- description: "",
127
+ description: "Set the processor implementation kind (e.g. 'read-model', 'relational-db'). Determines which scaffold codegen emits.",
52
128
  schema: "input SetProcessorTypeInput {\n type: String!\n}",
53
129
  template: "",
54
130
  reducer: "",
@@ -59,7 +135,7 @@ const documentModel = {
59
135
  {
60
136
  id: "fbbd7a71-c495-4efc-b8f6-1e57798dbbb4",
61
137
  name: "ADD_DOCUMENT_TYPE",
62
- description: "",
138
+ description: "Subscribe the processor to a document type. Caller supplies a stable id so the entry can be removed later.",
63
139
  schema: "input AddDocumentTypeInput {\n id: OID!\n documentType: String!\n}",
64
140
  template: "",
65
141
  reducer: "",
@@ -70,7 +146,7 @@ const documentModel = {
70
146
  {
71
147
  id: "544d413f-423c-4d97-9570-84a19bffeab9",
72
148
  name: "REMOVE_DOCUMENT_TYPE",
73
- description: "",
149
+ description: "Unsubscribe the processor from a document type by removing its entry id.",
74
150
  schema: "input RemoveDocumentTypeInput {\n id: OID!\n}",
75
151
  template: "",
76
152
  reducer: "",
@@ -81,8 +157,8 @@ const documentModel = {
81
157
  {
82
158
  id: "df5eb500-7308-498c-9b80-028878ee198b",
83
159
  name: "ADD_PROCESSOR_APP",
84
- description: "",
85
- schema: "input AddProcessorAppInput {\n processorApp: String! \n}",
160
+ description: "Attach the processor to a drive app by name. The processor will run in the context of that app.",
161
+ schema: "input AddProcessorAppInput {\n processorApp: String!\n}",
86
162
  template: "",
87
163
  reducer: "",
88
164
  errors: [],
@@ -92,8 +168,8 @@ const documentModel = {
92
168
  {
93
169
  id: "07e4168f-1a7b-41ef-953d-219028be7bb9",
94
170
  name: "REMOVE_PROCESSOR_APP",
95
- description: "",
96
- schema: "input RemoveProcessorAppInput {\n processorApp: String! \n}",
171
+ description: "Detach the processor from a drive app by name. No-op if the app is not currently attached.",
172
+ schema: "input RemoveProcessorAppInput {\n processorApp: String!\n}",
97
173
  template: "",
98
174
  reducer: "",
99
175
  errors: [],
@@ -103,7 +179,7 @@ const documentModel = {
103
179
  {
104
180
  id: "7b6706eb-5e25-4d64-829a-e3a251380fd1",
105
181
  name: "SET_PROCESSOR_STATUS",
106
- description: "",
182
+ description: "Move the processor between DRAFT and CONFIRMED. Codegen only runs once the status is CONFIRMED.",
107
183
  schema: "input SetProcessorStatusInput {\n status: StatusType!\n}",
108
184
  template: "",
109
185
  reducer: "",
@@ -112,105 +188,13 @@ const documentModel = {
112
188
  scope: "global"
113
189
  }
114
190
  ]
115
- }]
191
+ }],
192
+ version: 1,
193
+ changeLog: []
116
194
  }]
117
195
  };
118
196
  //#endregion
119
- //#region document-models/processor-module/gen/schema/zod.ts
120
- const isDefinedNonNullAny = (v) => v !== void 0 && v !== null;
121
- const definedNonNullAnySchema = z$1.any().refine((v) => isDefinedNonNullAny(v));
122
- const StatusTypeSchema = z$1.enum(["CONFIRMED", "DRAFT"]);
123
- function AddDocumentTypeInputSchema() {
124
- return z$1.object({
125
- documentType: z$1.string(),
126
- id: z$1.string()
127
- });
128
- }
129
- function AddProcessorAppInputSchema() {
130
- return z$1.object({ processorApp: z$1.string() });
131
- }
132
- function DocumentTypeItemSchema() {
133
- return z$1.object({
134
- __typename: z$1.literal("DocumentTypeItem").optional(),
135
- documentType: z$1.string(),
136
- id: z$1.string()
137
- });
138
- }
139
- function ProcessorModuleStateSchema() {
140
- return z$1.object({
141
- __typename: z$1.literal("ProcessorModuleState").optional(),
142
- documentTypes: z$1.array(z$1.lazy(() => DocumentTypeItemSchema())),
143
- name: z$1.string(),
144
- processorApps: z$1.array(z$1.string()),
145
- status: StatusTypeSchema,
146
- type: z$1.string()
147
- });
148
- }
149
- function RemoveDocumentTypeInputSchema() {
150
- return z$1.object({ id: z$1.string() });
151
- }
152
- function RemoveProcessorAppInputSchema() {
153
- return z$1.object({ processorApp: z$1.string() });
154
- }
155
- function SetProcessorNameInputSchema() {
156
- return z$1.object({ name: z$1.string() });
157
- }
158
- function SetProcessorStatusInputSchema() {
159
- return z$1.object({ status: StatusTypeSchema });
160
- }
161
- function SetProcessorTypeInputSchema() {
162
- return z$1.object({ type: z$1.string() });
163
- }
164
- //#endregion
165
- //#region document-models/processor-module/gen/base-operations/creators.ts
166
- var creators_exports = /* @__PURE__ */ __exportAll({
167
- addDocumentType: () => addDocumentType,
168
- addProcessorApp: () => addProcessorApp,
169
- removeDocumentType: () => removeDocumentType,
170
- removeProcessorApp: () => removeProcessorApp,
171
- setProcessorName: () => setProcessorName,
172
- setProcessorStatus: () => setProcessorStatus,
173
- setProcessorType: () => setProcessorType
174
- });
175
- const setProcessorName = (input) => createAction("SET_PROCESSOR_NAME", { ...input }, void 0, SetProcessorNameInputSchema, "global");
176
- const setProcessorType = (input) => createAction("SET_PROCESSOR_TYPE", { ...input }, void 0, SetProcessorTypeInputSchema, "global");
177
- const addDocumentType = (input) => createAction("ADD_DOCUMENT_TYPE", { ...input }, void 0, AddDocumentTypeInputSchema, "global");
178
- const removeDocumentType = (input) => createAction("REMOVE_DOCUMENT_TYPE", { ...input }, void 0, RemoveDocumentTypeInputSchema, "global");
179
- const addProcessorApp = (input) => createAction("ADD_PROCESSOR_APP", { ...input }, void 0, AddProcessorAppInputSchema, "global");
180
- const removeProcessorApp = (input) => createAction("REMOVE_PROCESSOR_APP", { ...input }, void 0, RemoveProcessorAppInputSchema, "global");
181
- const setProcessorStatus = (input) => createAction("SET_PROCESSOR_STATUS", { ...input }, void 0, SetProcessorStatusInputSchema, "global");
182
- //#endregion
183
- //#region document-models/processor-module/gen/document-type.ts
184
- const processorModuleDocumentType = "powerhouse/processor";
185
- //#endregion
186
- //#region document-models/processor-module/gen/document-schema.ts
187
- /** Schema for validating the header object of a ProcessorModule document */
188
- const ProcessorModuleDocumentHeaderSchema = BaseDocumentHeaderSchema.extend({ documentType: z.literal(processorModuleDocumentType) });
189
- /** Schema for validating the state object of a ProcessorModule document */
190
- const ProcessorModulePHStateSchema = BaseDocumentStateSchema.extend({ global: ProcessorModuleStateSchema() });
191
- const ProcessorModuleDocumentSchema = z.object({
192
- header: ProcessorModuleDocumentHeaderSchema,
193
- state: ProcessorModulePHStateSchema,
194
- initialState: ProcessorModulePHStateSchema
195
- });
196
- /** Simple helper function to check if a state object is a ProcessorModule document state object */
197
- function isProcessorModuleState(state) {
198
- return ProcessorModulePHStateSchema.safeParse(state).success;
199
- }
200
- /** Simple helper function to assert that a document state object is a ProcessorModule document state object */
201
- function assertIsProcessorModuleState(state) {
202
- ProcessorModulePHStateSchema.parse(state);
203
- }
204
- /** Simple helper function to check if a document is a ProcessorModule document */
205
- function isProcessorModuleDocument(document) {
206
- return ProcessorModuleDocumentSchema.safeParse(document).success;
207
- }
208
- /** Simple helper function to assert that a document is a ProcessorModule document */
209
- function assertIsProcessorModuleDocument(document) {
210
- ProcessorModuleDocumentSchema.parse(document);
211
- }
212
- //#endregion
213
- //#region document-models/processor-module/src/reducers/base-operations.ts
197
+ //#region document-models/processor-module/v1/src/reducers/base-operations.ts
214
198
  const processorModuleBaseOperationsOperations = {
215
199
  setProcessorNameOperation(state, action, dispatch) {
216
200
  const trimmedName = action.input.name.trim();
@@ -246,7 +230,7 @@ const processorModuleBaseOperationsOperations = {
246
230
  }
247
231
  };
248
232
  //#endregion
249
- //#region document-models/processor-module/gen/reducer.ts
233
+ //#region document-models/processor-module/v1/gen/reducer.ts
250
234
  const stateReducer = (state, action, dispatch) => {
251
235
  if (isDocumentAction(action)) return state;
252
236
  switch (action.type) {
@@ -283,7 +267,45 @@ const stateReducer = (state, action, dispatch) => {
283
267
  };
284
268
  const reducer = createReducer(stateReducer);
285
269
  //#endregion
286
- //#region document-models/processor-module/gen/utils.ts
270
+ //#region document-models/processor-module/v1/gen/document-type.ts
271
+ /**
272
+ * WARNING: DO NOT EDIT
273
+ * This file is auto-generated and updated by codegen
274
+ */
275
+ const processorModuleDocumentType = "powerhouse/processor";
276
+ //#endregion
277
+ //#region document-models/processor-module/v1/gen/document-schema.ts
278
+ /**
279
+ * WARNING: DO NOT EDIT
280
+ * This file is auto-generated and updated by codegen
281
+ */
282
+ /** Schema for validating the header object of a ProcessorModule document */
283
+ const ProcessorModuleDocumentHeaderSchema = BaseDocumentHeaderSchema.extend({ documentType: z.literal(processorModuleDocumentType) });
284
+ /** Schema for validating the state object of a ProcessorModule document */
285
+ const ProcessorModulePHStateSchema = BaseDocumentStateSchema.extend({ global: ProcessorModuleStateSchema() });
286
+ const ProcessorModuleDocumentSchema = z.object({
287
+ header: ProcessorModuleDocumentHeaderSchema,
288
+ state: ProcessorModulePHStateSchema,
289
+ initialState: ProcessorModulePHStateSchema
290
+ });
291
+ /** Simple helper function to check if a state object is a ProcessorModule document state object */
292
+ function isProcessorModuleState(state) {
293
+ return ProcessorModulePHStateSchema.safeParse(state).success;
294
+ }
295
+ /** Simple helper function to assert that a document state object is a ProcessorModule document state object */
296
+ function assertIsProcessorModuleState(state) {
297
+ ProcessorModulePHStateSchema.parse(state);
298
+ }
299
+ /** Simple helper function to check if a document is a ProcessorModule document */
300
+ function isProcessorModuleDocument(document) {
301
+ return ProcessorModuleDocumentSchema.safeParse(document).success;
302
+ }
303
+ /** Simple helper function to assert that a document is a ProcessorModule document */
304
+ function assertIsProcessorModuleDocument(document) {
305
+ ProcessorModuleDocumentSchema.parse(document);
306
+ }
307
+ //#endregion
308
+ //#region document-models/processor-module/v1/gen/utils.ts
287
309
  const initialGlobalState = {
288
310
  name: "",
289
311
  type: "",
@@ -293,7 +315,7 @@ const initialGlobalState = {
293
315
  };
294
316
  const initialLocalState = {};
295
317
  const utils$1 = {
296
- fileExtension: ".phdm",
318
+ fileExtension: ".processor",
297
319
  createState(state) {
298
320
  return {
299
321
  ...defaultBaseState(),
@@ -333,93 +355,26 @@ const utils$1 = {
333
355
  }
334
356
  };
335
357
  //#endregion
336
- //#region document-models/processor-module/gen/ph-factories.ts
337
- function defaultGlobalState() {
338
- return {
339
- name: "",
340
- type: "",
341
- documentTypes: [],
342
- status: "DRAFT",
343
- processorApps: []
344
- };
345
- }
346
- function defaultLocalState() {
347
- return {};
348
- }
349
- function defaultPHState() {
350
- return {
351
- ...defaultBaseState(),
352
- global: defaultGlobalState(),
353
- local: defaultLocalState()
354
- };
355
- }
356
- function createGlobalState(state) {
357
- return {
358
- ...defaultGlobalState(),
359
- ...state || {}
360
- };
361
- }
362
- function createLocalState(state) {
363
- return {
364
- ...defaultLocalState(),
365
- ...state || {}
366
- };
367
- }
368
- function createState$1(baseState, globalState, localState) {
369
- return {
370
- ...createBaseState(baseState?.auth, baseState?.document),
371
- global: createGlobalState(globalState),
372
- local: createLocalState(localState)
373
- };
374
- }
375
- /**
376
- * Creates a ProcessorModuleDocument with custom global and local state
377
- * This properly handles the PHBaseState requirements while allowing
378
- * document-specific state to be set.
379
- */
380
- function createProcessorModuleDocument(state) {
381
- return utils$1.createDocument(state ? createState$1(createBaseState(state.auth, state.document), state.global, state.local) : void 0);
382
- }
383
- //#endregion
384
- //#region document-models/processor-module/src/utils.ts
358
+ //#region document-models/processor-module/v1/src/utils.ts
385
359
  var utils_exports = /* @__PURE__ */ __exportAll({});
386
360
  //#endregion
387
- //#region document-models/processor-module/hooks.ts
388
- /** Hook to get a ProcessorModule document by its id */
389
- function useProcessorModuleDocumentById(documentId) {
390
- const [document, dispatch] = useDocumentById(documentId);
391
- if (!isProcessorModuleDocument(document)) return [void 0, void 0];
392
- return [document, dispatch];
393
- }
394
- /** Hook to get the selected ProcessorModule document */
395
- function useSelectedProcessorModuleDocument() {
396
- const [document, dispatch] = useSelectedDocument();
397
- assertIsProcessorModuleDocument(document);
398
- return [document, dispatch];
399
- }
400
- /** Hook to get all ProcessorModule documents in the selected drive */
401
- function useProcessorModuleDocumentsInSelectedDrive() {
402
- return useDocumentsInSelectedDrive()?.filter(isProcessorModuleDocument);
403
- }
404
- /** Hook to get all ProcessorModule documents in the selected folder */
405
- function useProcessorModuleDocumentsInSelectedFolder() {
406
- return useDocumentsInSelectedFolder()?.filter(isProcessorModuleDocument);
407
- }
408
- //#endregion
409
- //#region document-models/processor-module/actions.ts
410
- /** Actions for the ProcessorModule document model */
411
- const actions = {
412
- ...baseActions,
413
- ...creators_exports
414
- };
415
- //#endregion
416
- //#region document-models/processor-module/utils.ts
361
+ //#region document-models/processor-module/v1/utils.ts
417
362
  /** Utils for the ProcessorModule document model */
418
363
  const utils = {
419
364
  ...utils$1,
420
365
  ...utils_exports
421
366
  };
422
367
  //#endregion
423
- export { setProcessorType as A, StatusTypeSchema as B, addDocumentType as C, removeProcessorApp as D, removeDocumentType as E, RemoveDocumentTypeInputSchema as F, isDefinedNonNullAny as H, RemoveProcessorAppInputSchema as I, SetProcessorNameInputSchema as L, AddProcessorAppInputSchema as M, DocumentTypeItemSchema as N, setProcessorName as O, ProcessorModuleStateSchema as P, SetProcessorStatusInputSchema as R, processorModuleDocumentType as S, creators_exports as T, documentModel as U, definedNonNullAnySchema as V, ProcessorModulePHStateSchema as _, useProcessorModuleDocumentsInSelectedFolder as a, isProcessorModuleDocument as b, createState$1 as c, defaultPHState as d, initialGlobalState as f, ProcessorModuleDocumentSchema as g, ProcessorModuleDocumentHeaderSchema as h, useProcessorModuleDocumentsInSelectedDrive as i, AddDocumentTypeInputSchema as j, setProcessorStatus as k, defaultGlobalState as l, reducer as m, actions as n, useSelectedProcessorModuleDocument as o, initialLocalState as p, useProcessorModuleDocumentById as r, createProcessorModuleDocument as s, utils as t, defaultLocalState as u, assertIsProcessorModuleDocument as v, addProcessorApp as w, isProcessorModuleState as x, assertIsProcessorModuleState as y, SetProcessorTypeInputSchema as z };
368
+ //#region document-models/processor-module/v1/module.ts
369
+ /** Document model module for the ProcessorModule document type */
370
+ const ProcessorModule = {
371
+ version: 1,
372
+ reducer,
373
+ actions,
374
+ utils,
375
+ documentModel: createState(defaultBaseState(), documentModel)
376
+ };
377
+ //#endregion
378
+ export { RemoveProcessorAppInputSchema as A, setProcessorStatus as C, DocumentTypeItemSchema as D, AddProcessorAppInputSchema as E, definedNonNullAnySchema as F, isDefinedNonNullAny as I, SetProcessorStatusInputSchema as M, SetProcessorTypeInputSchema as N, ProcessorModuleStateSchema as O, StatusTypeSchema as P, setProcessorName as S, AddDocumentTypeInputSchema as T, addDocumentType as _, utils$1 as a, removeDocumentType as b, ProcessorModulePHStateSchema as c, isProcessorModuleDocument as d, isProcessorModuleState as f, actions as g, documentModel as h, initialLocalState as i, SetProcessorNameInputSchema as j, RemoveDocumentTypeInputSchema as k, assertIsProcessorModuleDocument as l, reducer as m, utils as n, ProcessorModuleDocumentHeaderSchema as o, processorModuleDocumentType as p, initialGlobalState as r, ProcessorModuleDocumentSchema as s, ProcessorModule as t, assertIsProcessorModuleState as u, addProcessorApp as v, setProcessorType as w, removeProcessorApp as x, creators_exports as y };
424
379
 
425
- //# sourceMappingURL=processor-module-CkuQiq7B.js.map
380
+ //# sourceMappingURL=module-BWlCj_0C.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module-BWlCj_0C.js","names":["z","processorModuleBaseOperationsActions","utils","genUtils","customUtils"],"sources":["../document-models/processor-module/v1/gen/schema/zod.ts","../document-models/processor-module/v1/gen/base-operations/creators.ts","../document-models/processor-module/v1/actions.ts","../document-models/processor-module/v1/gen/document-model.ts","../document-models/processor-module/v1/src/reducers/base-operations.ts","../document-models/processor-module/v1/gen/reducer.ts","../document-models/processor-module/v1/gen/document-type.ts","../document-models/processor-module/v1/gen/document-schema.ts","../document-models/processor-module/v1/gen/utils.ts","../document-models/processor-module/v1/src/utils.ts","../document-models/processor-module/v1/utils.ts","../document-models/processor-module/v1/module.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-object-type */\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport * as z from \"zod\";\nimport type {\n AddDocumentTypeInput,\n AddProcessorAppInput,\n DocumentTypeItem,\n ProcessorModuleState,\n RemoveDocumentTypeInput,\n RemoveProcessorAppInput,\n SetProcessorNameInput,\n SetProcessorStatusInput,\n SetProcessorTypeInput,\n StatusType,\n} from \"./types.js\";\n\ntype Properties<T> = Required<{\n [K in keyof T]: z.ZodType<T[K]>;\n}>;\n\ntype definedNonNullAny = {};\n\nexport const isDefinedNonNullAny = (v: any): v is definedNonNullAny =>\n v !== undefined && v !== null;\n\nexport const definedNonNullAnySchema = z\n .any()\n .refine((v) => isDefinedNonNullAny(v));\n\nexport const StatusTypeSchema = z.enum([\"CONFIRMED\", \"DRAFT\"]);\n\nexport function AddDocumentTypeInputSchema(): z.ZodObject<\n Properties<AddDocumentTypeInput>\n> {\n return z.object({\n documentType: z.string(),\n id: z.string(),\n });\n}\n\nexport function AddProcessorAppInputSchema(): z.ZodObject<\n Properties<AddProcessorAppInput>\n> {\n return z.object({\n processorApp: z.string(),\n });\n}\n\nexport function DocumentTypeItemSchema(): z.ZodObject<\n Properties<DocumentTypeItem>\n> {\n return z.object({\n __typename: z.literal(\"DocumentTypeItem\").optional(),\n documentType: z.string(),\n id: z.string(),\n });\n}\n\nexport function ProcessorModuleStateSchema(): z.ZodObject<\n Properties<ProcessorModuleState>\n> {\n return z.object({\n __typename: z.literal(\"ProcessorModuleState\").optional(),\n documentTypes: z.array(z.lazy(() => DocumentTypeItemSchema())),\n name: z.string(),\n processorApps: z.array(z.string()),\n status: StatusTypeSchema,\n type: z.string(),\n });\n}\n\nexport function RemoveDocumentTypeInputSchema(): z.ZodObject<\n Properties<RemoveDocumentTypeInput>\n> {\n return z.object({\n id: z.string(),\n });\n}\n\nexport function RemoveProcessorAppInputSchema(): z.ZodObject<\n Properties<RemoveProcessorAppInput>\n> {\n return z.object({\n processorApp: z.string(),\n });\n}\n\nexport function SetProcessorNameInputSchema(): z.ZodObject<\n Properties<SetProcessorNameInput>\n> {\n return z.object({\n name: z.string(),\n });\n}\n\nexport function SetProcessorStatusInputSchema(): z.ZodObject<\n Properties<SetProcessorStatusInput>\n> {\n return z.object({\n status: StatusTypeSchema,\n });\n}\n\nexport function SetProcessorTypeInputSchema(): z.ZodObject<\n Properties<SetProcessorTypeInput>\n> {\n return z.object({\n type: z.string(),\n });\n}\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { createAction } from \"document-model\";\nimport {\n AddDocumentTypeInputSchema,\n AddProcessorAppInputSchema,\n RemoveDocumentTypeInputSchema,\n RemoveProcessorAppInputSchema,\n SetProcessorNameInputSchema,\n SetProcessorStatusInputSchema,\n SetProcessorTypeInputSchema,\n} from \"../schema/zod.js\";\nimport type {\n AddDocumentTypeInput,\n AddProcessorAppInput,\n RemoveDocumentTypeInput,\n RemoveProcessorAppInput,\n SetProcessorNameInput,\n SetProcessorStatusInput,\n SetProcessorTypeInput,\n} from \"../types.js\";\nimport type {\n AddDocumentTypeAction,\n AddProcessorAppAction,\n RemoveDocumentTypeAction,\n RemoveProcessorAppAction,\n SetProcessorNameAction,\n SetProcessorStatusAction,\n SetProcessorTypeAction,\n} from \"./actions.js\";\n\nexport const setProcessorName = (input: SetProcessorNameInput) =>\n createAction<SetProcessorNameAction>(\n \"SET_PROCESSOR_NAME\",\n { ...input },\n undefined,\n SetProcessorNameInputSchema,\n \"global\",\n );\n\nexport const setProcessorType = (input: SetProcessorTypeInput) =>\n createAction<SetProcessorTypeAction>(\n \"SET_PROCESSOR_TYPE\",\n { ...input },\n undefined,\n SetProcessorTypeInputSchema,\n \"global\",\n );\n\nexport const addDocumentType = (input: AddDocumentTypeInput) =>\n createAction<AddDocumentTypeAction>(\n \"ADD_DOCUMENT_TYPE\",\n { ...input },\n undefined,\n AddDocumentTypeInputSchema,\n \"global\",\n );\n\nexport const removeDocumentType = (input: RemoveDocumentTypeInput) =>\n createAction<RemoveDocumentTypeAction>(\n \"REMOVE_DOCUMENT_TYPE\",\n { ...input },\n undefined,\n RemoveDocumentTypeInputSchema,\n \"global\",\n );\n\nexport const addProcessorApp = (input: AddProcessorAppInput) =>\n createAction<AddProcessorAppAction>(\n \"ADD_PROCESSOR_APP\",\n { ...input },\n undefined,\n AddProcessorAppInputSchema,\n \"global\",\n );\n\nexport const removeProcessorApp = (input: RemoveProcessorAppInput) =>\n createAction<RemoveProcessorAppAction>(\n \"REMOVE_PROCESSOR_APP\",\n { ...input },\n undefined,\n RemoveProcessorAppInputSchema,\n \"global\",\n );\n\nexport const setProcessorStatus = (input: SetProcessorStatusInput) =>\n createAction<SetProcessorStatusAction>(\n \"SET_PROCESSOR_STATUS\",\n { ...input },\n undefined,\n SetProcessorStatusInputSchema,\n \"global\",\n );\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { baseActions } from \"document-model\";\nimport { processorModuleBaseOperationsActions } from \"./gen/creators.js\";\n\n/** Actions for the ProcessorModule document model */\n\nexport const actions = {\n ...baseActions,\n ...processorModuleBaseOperationsActions,\n};\n","import type { DocumentModelGlobalState } from \"document-model\";\n\nexport const documentModel: DocumentModelGlobalState = {\n id: \"powerhouse/processor\",\n name: \"Processor Module\",\n author: {\n name: \"Powerhouse\",\n website: \"https://powerhouse.inc\",\n },\n extension: \".processor\",\n description:\n \"Declares a processor (a server-side function that reacts to document operations to build read models, send notifications, sync to external systems, etc.) shipped by a Vetra Reactor Package. Create one Processor Module document per processor: pick the processor type, list the document types it subscribes to, attach it to any drive apps that should run it, and mark it CONFIRMED to trigger codegen of the processor scaffold under `processors/`.\",\n specifications: [\n {\n state: {\n local: {\n schema: \"\",\n examples: [],\n initialValue: \"\",\n },\n global: {\n schema:\n '\"\"\"\\nConfiguration for a processor contributed by the package. A processor receives\\noperations from documents of matching types and runs server-side logic (e.g.\\nbuilding a read model, indexing, syncing to an external system).\\n\"\"\"\\ntype ProcessorModuleState {\\n \"\"\"Display name of the processor. Also determines the generated folder name under `processors/`.\"\"\"\\n name: String!\\n \"\"\"Processor implementation kind (e.g. \\'read-model\\', \\'relational-db\\'). Determines which scaffold codegen emits.\"\"\"\\n type: String!\\n \"\"\"Document types this processor subscribes to. Each entry has a stable id so it can be removed individually.\"\"\"\\n documentTypes: [DocumentTypeItem!]!\\n \"\"\"Lifecycle status. While DRAFT the processor definition is editable and codegen is skipped; switching to CONFIRMED triggers scaffold generation.\"\"\"\\n status: StatusType!\\n \"\"\"Drive-app names this processor is attached to. The processor runs in the context of each listed app.\"\"\"\\n processorApps: [String!]!\\n}\\n\\n\"\"\"A document type id (e.g. \\'my-org/invoice\\') attached to the processor with a stable entry id.\"\"\"\\ntype DocumentTypeItem {\\n \"\"\"Stable identifier for the entry; used to remove it.\"\"\"\\n id: OID!\\n \"\"\"Document type id this processor subscribes to.\"\"\"\\n documentType: String!\\n}\\n\\n\"\"\"\\nLifecycle status of a module definition.\\n- DRAFT: still being edited; codegen does not run.\\n- CONFIRMED: locked in; codegen produces the corresponding scaffold.\\n\"\"\"\\nenum StatusType {\\n DRAFT\\n CONFIRMED\\n}',\n examples: [],\n initialValue:\n '{\\n \"name\": \"\",\\n \"type\": \"\",\\n \"documentTypes\": [],\\n \"status\": \"DRAFT\",\\n \"processorApps\": []\\n}',\n },\n },\n modules: [\n {\n id: \"91ad39c1-4e8b-4127-b3c8-e835b85e6360\",\n name: \"base_operations\",\n description:\n \"Set the processor's identity, kind, lifecycle status, subscribed document types, and attached drive apps.\",\n operations: [\n {\n id: \"6f3a5c90-39f2-4302-a073-6195a71c5054\",\n name: \"SET_PROCESSOR_NAME\",\n description:\n \"Set the display name of the processor. Also determines the generated folder name under `processors/`.\",\n schema: \"input SetProcessorNameInput {\\n name: String!\\n}\",\n template: \"\",\n reducer: \"\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"b8f28bb4-c6ae-40e6-86fa-29ef14ff8667\",\n name: \"SET_PROCESSOR_TYPE\",\n description:\n \"Set the processor implementation kind (e.g. 'read-model', 'relational-db'). Determines which scaffold codegen emits.\",\n schema: \"input SetProcessorTypeInput {\\n type: String!\\n}\",\n template: \"\",\n reducer: \"\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"fbbd7a71-c495-4efc-b8f6-1e57798dbbb4\",\n name: \"ADD_DOCUMENT_TYPE\",\n description:\n \"Subscribe the processor to a document type. Caller supplies a stable id so the entry can be removed later.\",\n schema:\n \"input AddDocumentTypeInput {\\n id: OID!\\n documentType: String!\\n}\",\n template: \"\",\n reducer: \"\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"544d413f-423c-4d97-9570-84a19bffeab9\",\n name: \"REMOVE_DOCUMENT_TYPE\",\n description:\n \"Unsubscribe the processor from a document type by removing its entry id.\",\n schema: \"input RemoveDocumentTypeInput {\\n id: OID!\\n}\",\n template: \"\",\n reducer: \"\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"df5eb500-7308-498c-9b80-028878ee198b\",\n name: \"ADD_PROCESSOR_APP\",\n description:\n \"Attach the processor to a drive app by name. The processor will run in the context of that app.\",\n schema:\n \"input AddProcessorAppInput {\\n processorApp: String!\\n}\",\n template: \"\",\n reducer: \"\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"07e4168f-1a7b-41ef-953d-219028be7bb9\",\n name: \"REMOVE_PROCESSOR_APP\",\n description:\n \"Detach the processor from a drive app by name. No-op if the app is not currently attached.\",\n schema:\n \"input RemoveProcessorAppInput {\\n processorApp: String!\\n}\",\n template: \"\",\n reducer: \"\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"7b6706eb-5e25-4d64-829a-e3a251380fd1\",\n name: \"SET_PROCESSOR_STATUS\",\n description:\n \"Move the processor between DRAFT and CONFIRMED. Codegen only runs once the status is CONFIRMED.\",\n schema:\n \"input SetProcessorStatusInput {\\n status: StatusType!\\n}\",\n template: \"\",\n reducer: \"\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n ],\n },\n ],\n version: 1,\n changeLog: [],\n },\n ],\n};\n","import {\n PROCESSOR_APPS,\n type ProcessorApp,\n} from \"@powerhousedao/shared/processors\";\nimport type { ProcessorModuleBaseOperationsOperations } from \"document-models/processor-module/v1\";\n\nexport const processorModuleBaseOperationsOperations: ProcessorModuleBaseOperationsOperations =\n {\n setProcessorNameOperation(state, action, dispatch) {\n const trimmedName = action.input.name.trim();\n if (trimmedName === \"\") {\n throw new Error(\"Processor name cannot be empty\");\n }\n state.name = trimmedName;\n },\n setProcessorTypeOperation(state, action, dispatch) {\n const trimmedType = action.input.type.trim();\n if (trimmedType === \"\") {\n throw new Error(\"Processor type cannot be empty\");\n }\n state.type = trimmedType;\n },\n addDocumentTypeOperation(state, action, dispatch) {\n // Check for duplicate ID\n const existingId = state.documentTypes.find(\n (dt) => dt.id === action.input.id,\n );\n if (existingId) {\n throw new Error(\n `Document type with id \"${action.input.id}\" already exists`,\n );\n }\n\n state.documentTypes.push({\n id: action.input.id,\n documentType: action.input.documentType,\n });\n },\n removeDocumentTypeOperation(state, action, dispatch) {\n state.documentTypes = state.documentTypes.filter(\n (documentType) => documentType.id !== action.input.id,\n );\n },\n setProcessorStatusOperation(state, action, dispatch) {\n state.status = action.input.status;\n },\n addProcessorAppOperation(state, action) {\n const { processorApp } = action.input;\n if (!PROCESSOR_APPS.includes(processorApp as ProcessorApp)) {\n throw new Error(\n `${processorApp} is not a valid processor app. Must be one of ${PROCESSOR_APPS.join(\", \")}.`,\n );\n }\n state.processorApps = [\n ...new Set([...state.processorApps, processorApp]),\n ];\n },\n removeProcessorAppOperation(state, action) {\n const { processorApp } = action.input;\n state.processorApps = state.processorApps.filter(\n (p) => p !== processorApp,\n );\n },\n };\n","/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-unsafe-argument */\nimport type { Reducer, StateReducer } from \"document-model\";\nimport { createReducer, isDocumentAction } from \"document-model\";\nimport type { ProcessorModulePHState } from \"document-models/processor-module/v1\";\n\nimport { processorModuleBaseOperationsOperations } from \"../src/reducers/base-operations.js\";\n\nimport {\n AddDocumentTypeInputSchema,\n AddProcessorAppInputSchema,\n RemoveDocumentTypeInputSchema,\n RemoveProcessorAppInputSchema,\n SetProcessorNameInputSchema,\n SetProcessorStatusInputSchema,\n SetProcessorTypeInputSchema,\n} from \"./schema/zod.js\";\n\nconst stateReducer: StateReducer<ProcessorModulePHState> = (\n state,\n action,\n dispatch,\n) => {\n if (isDocumentAction(action)) {\n return state;\n }\n switch (action.type) {\n case \"SET_PROCESSOR_NAME\": {\n SetProcessorNameInputSchema().parse(action.input);\n\n processorModuleBaseOperationsOperations.setProcessorNameOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_PROCESSOR_TYPE\": {\n SetProcessorTypeInputSchema().parse(action.input);\n\n processorModuleBaseOperationsOperations.setProcessorTypeOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"ADD_DOCUMENT_TYPE\": {\n AddDocumentTypeInputSchema().parse(action.input);\n\n processorModuleBaseOperationsOperations.addDocumentTypeOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"REMOVE_DOCUMENT_TYPE\": {\n RemoveDocumentTypeInputSchema().parse(action.input);\n\n processorModuleBaseOperationsOperations.removeDocumentTypeOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"ADD_PROCESSOR_APP\": {\n AddProcessorAppInputSchema().parse(action.input);\n\n processorModuleBaseOperationsOperations.addProcessorAppOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"REMOVE_PROCESSOR_APP\": {\n RemoveProcessorAppInputSchema().parse(action.input);\n\n processorModuleBaseOperationsOperations.removeProcessorAppOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_PROCESSOR_STATUS\": {\n SetProcessorStatusInputSchema().parse(action.input);\n\n processorModuleBaseOperationsOperations.setProcessorStatusOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n default:\n return state;\n }\n};\n\nexport const reducer: Reducer<ProcessorModulePHState> =\n createReducer(stateReducer);\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nexport const processorModuleDocumentType = \"powerhouse/processor\";\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport {\n BaseDocumentHeaderSchema,\n BaseDocumentStateSchema,\n} from \"document-model\";\nimport { z } from \"zod\";\nimport { processorModuleDocumentType } from \"./document-type.js\";\nimport { ProcessorModuleStateSchema } from \"./schema/zod.js\";\nimport type {\n ProcessorModuleDocument,\n ProcessorModulePHState,\n} from \"./types.js\";\n\n/** Schema for validating the header object of a ProcessorModule document */\nexport const ProcessorModuleDocumentHeaderSchema =\n BaseDocumentHeaderSchema.extend({\n documentType: z.literal(processorModuleDocumentType),\n });\n\n/** Schema for validating the state object of a ProcessorModule document */\nexport const ProcessorModulePHStateSchema = BaseDocumentStateSchema.extend({\n global: ProcessorModuleStateSchema(),\n});\n\nexport const ProcessorModuleDocumentSchema = z.object({\n header: ProcessorModuleDocumentHeaderSchema,\n state: ProcessorModulePHStateSchema,\n initialState: ProcessorModulePHStateSchema,\n});\n\n/** Simple helper function to check if a state object is a ProcessorModule document state object */\nexport function isProcessorModuleState(\n state: unknown,\n): state is ProcessorModulePHState {\n return ProcessorModulePHStateSchema.safeParse(state).success;\n}\n\n/** Simple helper function to assert that a document state object is a ProcessorModule document state object */\nexport function assertIsProcessorModuleState(\n state: unknown,\n): asserts state is ProcessorModulePHState {\n ProcessorModulePHStateSchema.parse(state);\n}\n\n/** Simple helper function to check if a document is a ProcessorModule document */\nexport function isProcessorModuleDocument(\n document: unknown,\n): document is ProcessorModuleDocument {\n return ProcessorModuleDocumentSchema.safeParse(document).success;\n}\n\n/** Simple helper function to assert that a document is a ProcessorModule document */\nexport function assertIsProcessorModuleDocument(\n document: unknown,\n): asserts document is ProcessorModuleDocument {\n ProcessorModuleDocumentSchema.parse(document);\n}\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { DocumentModelUtils } from \"document-model\";\nimport {\n baseCreateDocument,\n baseLoadFromInput,\n baseSaveToFileHandle,\n defaultBaseState,\n generateId,\n} from \"document-model\";\nimport {\n assertIsProcessorModuleDocument,\n assertIsProcessorModuleState,\n isProcessorModuleDocument,\n isProcessorModuleState,\n} from \"./document-schema.js\";\nimport { processorModuleDocumentType } from \"./document-type.js\";\nimport { reducer } from \"./reducer.js\";\nimport type {\n ProcessorModuleGlobalState,\n ProcessorModuleLocalState,\n ProcessorModulePHState,\n} from \"./types.js\";\n\nexport const initialGlobalState: ProcessorModuleGlobalState = {\n name: \"\",\n type: \"\",\n documentTypes: [],\n status: \"DRAFT\",\n processorApps: [],\n};\nexport const initialLocalState: ProcessorModuleLocalState = {};\n\nexport const utils: DocumentModelUtils<ProcessorModulePHState> = {\n fileExtension: \".processor\",\n createState(state) {\n return {\n ...defaultBaseState(),\n global: { ...initialGlobalState, ...state?.global },\n local: { ...initialLocalState, ...state?.local },\n };\n },\n createDocument(state) {\n const document = baseCreateDocument(utils.createState, state);\n\n document.header.documentType = processorModuleDocumentType;\n\n // for backwards compatibility, but this is NOT a valid signed document id\n document.header.id = generateId();\n\n return document;\n },\n saveToFileHandle(document, input) {\n return baseSaveToFileHandle(document, input);\n },\n loadFromInput(input) {\n return baseLoadFromInput(input, reducer);\n },\n isStateOfType(state) {\n return isProcessorModuleState(state);\n },\n assertIsStateOfType(state) {\n return assertIsProcessorModuleState(state);\n },\n isDocumentOfType(document) {\n return isProcessorModuleDocument(document);\n },\n assertIsDocumentOfType(document) {\n return assertIsProcessorModuleDocument(document);\n },\n};\n","export {};\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { DocumentModelUtils } from \"document-model\";\nimport type { ProcessorModulePHState } from \"./gen/types.js\";\nimport { utils as genUtils } from \"./gen/utils.js\";\nimport * as customUtils from \"./src/utils.js\";\n\n/** Utils for the ProcessorModule document model */\nexport const utils: DocumentModelUtils<ProcessorModulePHState> = {\n ...genUtils,\n ...customUtils,\n};\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { DocumentModelModule } from \"document-model\";\nimport { createState, defaultBaseState } from \"document-model\";\nimport { actions } from \"./actions.js\";\nimport { documentModel } from \"./gen/document-model.js\";\nimport { reducer } from \"./gen/reducer.js\";\nimport type { ProcessorModulePHState } from \"./gen/types.js\";\nimport { utils } from \"./utils.js\";\n\n/** Document model module for the ProcessorModule document type */\nexport const ProcessorModule = {\n version: 1,\n reducer,\n actions,\n utils,\n documentModel: createState(defaultBaseState(), documentModel),\n} as const satisfies DocumentModelModule<ProcessorModulePHState>;\n"],"mappings":";;;;;;AAsBA,MAAa,uBAAuB,MAClC,MAAM,KAAA,KAAa,MAAM;AAE3B,MAAa,0BAA0BA,IACpC,KAAK,CACL,QAAQ,MAAM,oBAAoB,EAAE,CAAC;AAEx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