@powerhousedao/vetra 6.2.3-dev.78 → 6.2.3-dev.79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/codegen/index.d.ts +2 -2
- package/dist/codegen/index.js +2 -2
- package/dist/codegen/spec.js +1 -1
- package/dist/document-models/app-module/index.d.ts +2 -2
- package/dist/document-models/app-module/index.js +1 -1
- package/dist/document-models/index.d.ts +2 -2
- package/dist/document-models/index.js +2 -2
- package/dist/document-models/processor-module/index.d.ts +3 -3
- package/dist/document-models/processor-module/index.js +4 -4
- package/dist/{editor-DbE7t0TU.js → editor-CbT_8Z6A.js} +2 -2
- package/dist/{editor-DbE7t0TU.js.map → editor-CbT_8Z6A.js.map} +1 -1
- package/dist/editors/index.d.ts +4 -4
- package/dist/editors/index.js +1 -1
- package/dist/{factory-BLQkEgxk.js → factory-BQp6QPQO.js} +15 -11
- package/dist/factory-BQp6QPQO.js.map +1 -0
- package/dist/{index-CKCays-S.d.ts → index-BAeTvhwh.d.ts} +2 -2
- package/dist/{index-CKCays-S.d.ts.map → index-BAeTvhwh.d.ts.map} +1 -1
- package/dist/{index-mYlWU47F.d.ts → index-CBcJ_oc6.d.ts} +2 -2
- package/dist/{index-mYlWU47F.d.ts.map → index-CBcJ_oc6.d.ts.map} +1 -1
- package/dist/{index-cdL5k2sw.d.ts → index-CScZx1m9.d.ts} +9 -3
- package/dist/index-CScZx1m9.d.ts.map +1 -0
- package/dist/{index-B52jv-LY.d.ts → index-DIpsNezM.d.ts} +2 -2
- package/dist/{index-B52jv-LY.d.ts.map → index-DIpsNezM.d.ts.map} +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/{module-d1-9VDGb.js → module-23VayWKe.js} +5 -5
- package/dist/module-23VayWKe.js.map +1 -0
- package/dist/{module-CZLWjrD_.js → module-B6S4QGOx.js} +2 -2
- package/dist/{module-CZLWjrD_.js.map → module-B6S4QGOx.js.map} +1 -1
- package/dist/{module-Db8mmgzN.js → module-BktWa0rB.js} +11 -9
- package/dist/module-BktWa0rB.js.map +1 -0
- package/dist/{ph-factories-HuC7_vvF.js → ph-factories-fEke-Nr8.js} +2 -2
- package/dist/{ph-factories-HuC7_vvF.js.map → ph-factories-fEke-Nr8.js.map} +1 -1
- package/dist/{processor-kRJ48ypM.js → processor-C_zliXhw.js} +356 -322
- package/dist/processor-C_zliXhw.js.map +1 -0
- package/dist/processors/codegen/index.d.ts.map +1 -1
- package/dist/processors/codegen/index.js +2 -2
- package/dist/processors/index.js +1 -1
- package/dist/{spec-api-B01RpZM-.js → spec-api-BGj7gcQn.js} +16 -10
- package/dist/{spec-api-B01RpZM-.js.map → spec-api-BGj7gcQn.js.map} +1 -1
- package/dist/{switchboard-CZ87bHRJ.js → switchboard-DjCPLtMW.js} +2 -2
- package/dist/{switchboard-CZ87bHRJ.js.map → switchboard-DjCPLtMW.js.map} +1 -1
- package/dist/{utils-w_21RRK6.js → utils-BJk4_43W.js} +22 -2
- package/dist/utils-BJk4_43W.js.map +1 -0
- package/package.json +9 -9
- package/dist/factory-BLQkEgxk.js.map +0 -1
- package/dist/index-cdL5k2sw.d.ts.map +0 -1
- package/dist/module-Db8mmgzN.js.map +0 -1
- package/dist/module-d1-9VDGb.js.map +0 -1
- package/dist/processor-kRJ48ypM.js.map +0 -1
- package/dist/utils-w_21RRK6.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-cdL5k2sw.d.ts","names":[],"sources":["../document-models/processor-module/v1/gen/document-type.ts","../document-models/processor-module/v1/actions.ts","../document-models/processor-module/upgrades/versions.ts","../document-models/processor-module/upgrades/upgrade-manifest.ts"],"mappings":";;;;;;;cAIa;;;;cCKA;;;;;;4BAAA;;;;;;;;;;cCTA;cAEA;;;cCKA,gCAAgC,uBACpC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"module-Db8mmgzN.js","names":["genUtils","customUtils"],"sources":["../document-models/processor-module/v1/gen/document-model.ts","../document-models/processor-module/v1/src/utils.ts","../document-models/processor-module/v1/utils.ts","../document-models/processor-module/v1/module.ts"],"sourcesContent":["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","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":";;;;AAEA,MAAa,gBAA0C;CACrD,IAAI;CACJ,MAAM;CACN,QAAQ;EACN,MAAM;EACN,SAAS;CACX;CACA,WAAW;CACX,aACE;CACF,gBAAgB,CACd;EACE,OAAO;GACL,OAAO;IACL,QAAQ;IACR,UAAU,CAAC;IACX,cAAc;GAChB;GACA,QAAQ;IACN,QACE;IACF,UAAU,CAAC;IACX,cACE;GACJ;EACF;EACA,SAAS,CACP;GACE,IAAI;GACJ,MAAM;GACN,aACE;GACF,YAAY;IACV;KACE,IAAI;KACJ,MAAM;KACN,aACE;KACF,QAAQ;KACR,UAAU;KACV,SAAS;KACT,QAAQ,CAAC;KACT,UAAU,CAAC;KACX,OAAO;IACT;IACA;KACE,IAAI;KACJ,MAAM;KACN,aACE;KACF,QAAQ;KACR,UAAU;KACV,SAAS;KACT,QAAQ,CAAC;KACT,UAAU,CAAC;KACX,OAAO;IACT;IACA;KACE,IAAI;KACJ,MAAM;KACN,aACE;KACF,QACE;KACF,UAAU;KACV,SAAS;KACT,QAAQ,CAAC;KACT,UAAU,CAAC;KACX,OAAO;IACT;IACA;KACE,IAAI;KACJ,MAAM;KACN,aACE;KACF,QAAQ;KACR,UAAU;KACV,SAAS;KACT,QAAQ,CAAC;KACT,UAAU,CAAC;KACX,OAAO;IACT;IACA;KACE,IAAI;KACJ,MAAM;KACN,aACE;KACF,QACE;KACF,UAAU;KACV,SAAS;KACT,QAAQ,CAAC;KACT,UAAU,CAAC;KACX,OAAO;IACT;IACA;KACE,IAAI;KACJ,MAAM;KACN,aACE;KACF,QACE;KACF,UAAU;KACV,SAAS;KACT,QAAQ,CAAC;KACT,UAAU,CAAC;KACX,OAAO;IACT;IACA;KACE,IAAI;KACJ,MAAM;KACN,aACE;KACF,QACE;KACF,UAAU;KACV,SAAS;KACT,QAAQ,CAAC;KACT,UAAU,CAAC;KACX,OAAO;IACT;GACF;EACF,CACF;EACA,SAAS;EACT,WAAW,CAAC;CACd,CACF;AACF;;;;;;;AExHA,MAAa,QAAoD;CAC/D,GAAGA;CACH,GAAGC;AACL;;;;ACAA,MAAa,kBAAkB;CAC7B,SAAS;CACT;CACA;CACA;CACA,eAAe,YAAY,iBAAiB,GAAG,aAAa;AAC9D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"module-d1-9VDGb.js","names":["genUtils","customUtils"],"sources":["../document-models/app-module/v1/gen/document-model.ts","../document-models/app-module/v1/src/utils.ts","../document-models/app-module/v1/utils.ts","../document-models/app-module/v1/module.ts"],"sourcesContent":["import type { DocumentModelGlobalState } from \"document-model\";\n\nexport const documentModel: DocumentModelGlobalState = {\n id: \"powerhouse/app\",\n name: \"App Module\",\n author: {\n name: \"Powerhouse\",\n website: \"https://powerhouse.inc\",\n },\n extension: \".app\",\n description:\n \"Declares a custom Drive App (a drive-level UI surface) shipped by a Vetra Reactor Package. Use one App Module document per drive app: configure which document types it handles, whether it accepts drag-and-drop, and mark it CONFIRMED to trigger codegen of the corresponding app scaffold under `editors/<app-id>/`.\",\n specifications: [\n {\n state: {\n local: {\n schema: \"\",\n examples: [],\n initialValue: \"\",\n },\n global: {\n schema:\n '\"\"\"\\nConfiguration for a Drive App contributed by the package. Drive apps render a\\ncustom view at the drive level (instead of, or alongside, the document file\\ntree) and can opt into which document types they accept.\\n\"\"\"\\ntype AppModuleState {\\n \"\"\"Display name of the drive app. Also used as the source for the generated folder name under `editors/`.\"\"\"\\n name: String!\\n \"\"\"Lifecycle status. While DRAFT the app definition is editable and codegen is skipped; switching to CONFIRMED triggers app scaffold generation.\"\"\"\\n status: StatusType!\\n \"\"\"Document type ids this app handles. `null` means the app accepts any document type; an empty list means it accepts none.\"\"\"\\n allowedDocumentTypes: [String!]\\n \"\"\"Whether the app surface accepts dropped files from the user. Defaults to true.\"\"\"\\n isDragAndDropEnabled: Boolean!\\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 \"status\": \"DRAFT\",\\n \"allowedDocumentTypes\": null,\\n \"isDragAndDropEnabled\": true\\n}',\n },\n },\n modules: [\n {\n id: \"d274599a-ceb5-4f2b-8651-b25787306734\",\n name: \"base_operations\",\n description:\n \"Set the app's identity, lifecycle status, and the document types it handles.\",\n operations: [\n {\n id: \"f2ba2ddc-8527-4162-93bd-e045e9932013\",\n name: \"SET_APP_NAME\",\n description:\n \"Set the display name of the drive app. Also determines the generated folder name under `editors/`.\",\n schema: \"input SetAppNameInput {\\n name: String!\\n}\",\n template: \"\",\n reducer: \"\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"c842efa4-154c-4fd9-9d12-42bec51af4e9\",\n name: \"SET_APP_STATUS\",\n description:\n \"Move the app between DRAFT and CONFIRMED. Codegen only runs once the status is CONFIRMED.\",\n schema: \"input SetAppStatusInput {\\n status: StatusType!\\n}\",\n template: \"\",\n reducer: \"\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"7376f168-695f-4aef-94d0-6e381666358c\",\n name: \"ADD_DOCUMENT_TYPE\",\n description:\n \"Append a document type id to the list of types this app handles. Initializes the list if it was `null` (accept-any).\",\n schema:\n \"input AddDocumentTypeInput {\\n documentType: String!\\n}\",\n template: \"\",\n reducer: \"\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"310e4e5b-3f14-4e9a-8e09-5583c7698a65\",\n name: \"REMOVE_DOCUMENT_TYPE\",\n description:\n \"Remove a document type id from the handled list. No-op if the type is not present.\",\n schema:\n \"input RemoveDocumentTypeInput {\\n documentType: String!\\n}\",\n template: \"\",\n reducer: \"\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"b365727a-7df3-48f0-a4f8-02362f02ad1d\",\n name: \"SET_DOCUMENT_TYPES\",\n description:\n \"Replace the entire allowed-document-types list in one call. Pass an empty list to accept none.\",\n schema:\n \"input SetDocumentTypesInput {\\n documentTypes: [String!]!\\n}\",\n template: \"\",\n reducer: \"\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n ],\n },\n {\n id: \"270faa10-92e9-40d0-b128-2de32704bcb5\",\n name: \"dnd_operations\",\n description:\n \"Toggle drag-and-drop file handling for the app surface.\",\n operations: [\n {\n id: \"077b1ab8-cb32-4b4e-a1fa-76178188c6a1\",\n name: \"SET_DRAG_AND_DROP_ENABLED\",\n description:\n \"Enable or disable drag-and-drop file handling on the app surface.\",\n schema:\n \"input SetDragAndDropEnabledInput {\\n enabled: Boolean!\\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","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 { AppModulePHState } from \"./gen/types.js\";\nimport { utils as genUtils } from \"./gen/utils.js\";\nimport * as customUtils from \"./src/utils.js\";\n\n/** Utils for the AppModule document model */\nexport const utils: DocumentModelUtils<AppModulePHState> = {\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 { AppModulePHState } from \"./gen/types.js\";\nimport { utils } from \"./utils.js\";\n\n/** Document model module for the AppModule document type */\nexport const AppModule = {\n version: 1,\n reducer,\n actions,\n utils,\n documentModel: createState(defaultBaseState(), documentModel),\n} as const satisfies DocumentModelModule<AppModulePHState>;\n"],"mappings":";;;;AAEA,MAAa,gBAA0C;CACrD,IAAI;CACJ,MAAM;CACN,QAAQ;EACN,MAAM;EACN,SAAS;CACX;CACA,WAAW;CACX,aACE;CACF,gBAAgB,CACd;EACE,OAAO;GACL,OAAO;IACL,QAAQ;IACR,UAAU,CAAC;IACX,cAAc;GAChB;GACA,QAAQ;IACN,QACE;IACF,UAAU,CAAC;IACX,cACE;GACJ;EACF;EACA,SAAS,CACP;GACE,IAAI;GACJ,MAAM;GACN,aACE;GACF,YAAY;IACV;KACE,IAAI;KACJ,MAAM;KACN,aACE;KACF,QAAQ;KACR,UAAU;KACV,SAAS;KACT,QAAQ,CAAC;KACT,UAAU,CAAC;KACX,OAAO;IACT;IACA;KACE,IAAI;KACJ,MAAM;KACN,aACE;KACF,QAAQ;KACR,UAAU;KACV,SAAS;KACT,QAAQ,CAAC;KACT,UAAU,CAAC;KACX,OAAO;IACT;IACA;KACE,IAAI;KACJ,MAAM;KACN,aACE;KACF,QACE;KACF,UAAU;KACV,SAAS;KACT,QAAQ,CAAC;KACT,UAAU,CAAC;KACX,OAAO;IACT;IACA;KACE,IAAI;KACJ,MAAM;KACN,aACE;KACF,QACE;KACF,UAAU;KACV,SAAS;KACT,QAAQ,CAAC;KACT,UAAU,CAAC;KACX,OAAO;IACT;IACA;KACE,IAAI;KACJ,MAAM;KACN,aACE;KACF,QACE;KACF,UAAU;KACV,SAAS;KACT,QAAQ,CAAC;KACT,UAAU,CAAC;KACX,OAAO;IACT;GACF;EACF,GACA;GACE,IAAI;GACJ,MAAM;GACN,aACE;GACF,YAAY,CACV;IACE,IAAI;IACJ,MAAM;IACN,aACE;IACF,QACE;IACF,UAAU;IACV,SAAS;IACT,QAAQ,CAAC;IACT,UAAU,CAAC;IACX,OAAO;GACT,CACF;EACF,CACF;EACA,SAAS;EACT,WAAW,CAAC;CACd,CACF;AACF;;;;;;;AEpHA,MAAa,QAA8C;CACzD,GAAGA;CACH,GAAGC;AACL;;;;ACAA,MAAa,YAAY;CACvB,SAAS;CACT;CACA;CACA;CACA,eAAe,YAAY,iBAAiB,GAAG,aAAa;AAC9D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"processor-kRJ48ypM.js","names":[],"sources":["../processors/codegen/document-handlers/base-document-gen.ts","../processors/codegen/interactive-manager.ts","../processors/codegen/document-handlers/document-codegen-manager.ts","../processors/codegen/document-handlers/generators/utils.ts","../processors/codegen/document-handlers/generators/app-generator.ts","../processors/codegen/document-handlers/generators/document-editor-generator.ts","../processors/codegen/document-handlers/generators/document-model-generator.ts","../processors/codegen/document-handlers/generators/package-generator.ts","../processors/codegen/document-handlers/generators/processor-generator.ts","../processors/codegen/document-handlers/generators/subgraph-generator.ts","../processors/codegen/document-handlers/document-codegen-factory.ts","../processors/codegen/processor.ts"],"sourcesContent":["import type { Project } from \"ts-morph\";\nimport type { CodegenInput, Config } from \"./types.js\";\n/**\n * Abstract base class for document generators\n * Defines the interface that all document-type handlers must implement\n */\nexport abstract class BaseDocumentGen {\n /**\n * The document type(s) this generator supports\n * Can be a single string or an array of strings for generators that handle multiple types\n */\n abstract readonly supportedDocumentTypes: string | string[];\n project: Project;\n\n constructor(\n protected config: Config,\n project: Project,\n ) {\n this.project = project;\n }\n\n /**\n * Generate code for the given document\n * Must be implemented by each specific document generator\n */\n abstract generate(strand: CodegenInput): Promise<void>;\n\n /**\n * Check if this generator supports the given document type\n */\n supportsDocumentType(documentType: string): boolean {\n if (typeof this.supportedDocumentTypes === \"string\") {\n return this.supportedDocumentTypes === documentType;\n }\n return this.supportedDocumentTypes.includes(documentType);\n }\n\n /**\n * Get all supported document types as an array\n */\n getSupportedDocumentTypes(): string[] {\n if (typeof this.supportedDocumentTypes === \"string\") {\n return [this.supportedDocumentTypes];\n }\n return [...this.supportedDocumentTypes];\n }\n\n /**\n * Validate if this strand should be processed\n * Override this method in specific generators to add custom validation logic\n */\n shouldProcess(strand: CodegenInput): boolean {\n // Basic validation: ensure strand has required properties\n if (!strand.documentId || !strand.documentType) {\n return false;\n }\n\n // Basic validation: check if document type is supported\n if (!this.supportsDocumentType(strand.documentType)) {\n return false;\n }\n\n // Default to processing if basic validation passes\n return true;\n }\n}\n","import { createInterface } from \"node:readline\";\nimport type { CodegenInput } from \"./document-handlers/types.js\";\nimport { logger } from \"./logger.js\";\n\nexport interface QueuedStrand {\n strand: CodegenInput;\n timestamp: number;\n}\n\n/**\n * InteractiveManager handles user interaction for code generation confirmation\n * Supports both individual strand processing and queue-based batch processing\n */\nexport class InteractiveManager {\n private isInteractiveMode: boolean;\n private processingConfirmation = false;\n private strandQueue = new Map<string, QueuedStrand>();\n\n constructor(interactiveMode = false) {\n this.isInteractiveMode = interactiveMode;\n }\n\n private getDocumentKey(documentType: string, documentId: string): string {\n return `${documentType}:${documentId}`;\n }\n\n /**\n * Add a strand to the queue, replacing any existing strand for the same document\n */\n public queueStrand(strand: CodegenInput): void {\n const documentKey = this.getDocumentKey(\n strand.documentType,\n strand.documentId,\n );\n\n this.strandQueue.set(documentKey, {\n strand,\n timestamp: Date.now(),\n });\n\n logger.debug(\n `>>> Queued strand for ${documentKey}, queue size: ${this.strandQueue.size}`,\n );\n }\n\n /**\n * Drop the queued strands the predicate matches\n */\n public discardWhere(predicate: (strand: CodegenInput) => boolean): void {\n for (const [key, queued] of this.strandQueue) {\n if (predicate(queued.strand)) this.strandQueue.delete(key);\n }\n }\n\n /**\n * Get all queued strands\n */\n public getQueuedStrands(): QueuedStrand[] {\n return Array.from(this.strandQueue.values());\n }\n\n /**\n * Clear and return all queued strands\n */\n public clearQueue(): QueuedStrand[] {\n const queuedStrands = Array.from(this.strandQueue.values());\n this.strandQueue.clear();\n return queuedStrands;\n }\n\n /**\n * Get the current queue size\n */\n public getQueueSize(): number {\n return this.strandQueue.size;\n }\n\n private async promptUserConfirmation(): Promise<boolean> {\n return new Promise((resolve) => {\n const rl = createInterface({\n input: process.stdin,\n output: process.stdout,\n });\n\n console.log(\"\\n\" + \"=\".repeat(50));\n console.log(\"🔄 Code generation ready to run.\");\n console.log(\"=\".repeat(50));\n\n process.stdout.write(\n \"Do you want to proceed with code generation? (y/n): \\n\\n\",\n );\n\n rl.on(\"line\", (answer: string) => {\n rl.close();\n console.log(\"\"); // Add blank line after user input\n resolve(answer.toLowerCase() === \"y\" || answer.toLowerCase() === \"yes\");\n });\n });\n }\n\n /**\n * Process generation with user confirmation (legacy single-strand method)\n * This method assumes interactive mode is already enabled (checked by caller)\n */\n public async processWithConfirmation<T>(\n documentType: string,\n generator: () => Promise<T>,\n ): Promise<T | null> {\n if (this.processingConfirmation) {\n logger.debug(\"Already processing confirmation, skipping\");\n return null;\n }\n\n this.processingConfirmation = true;\n\n try {\n // Always prompt user since this method only called in interactive mode\n const shouldProceed = await this.promptUserConfirmation();\n\n if (!shouldProceed) {\n logger.info(`❌ Code generation cancelled by user for ${documentType}`);\n return null;\n }\n\n logger.info(`✅ User approved code generation for ${documentType}`);\n\n const result = await generator();\n return result;\n } catch (error) {\n logger.error(\n `❌ Error during interactive code generation for ${documentType}:`,\n error,\n );\n throw error;\n } finally {\n this.processingConfirmation = false;\n }\n }\n\n /**\n * Process all queued strands with a single user confirmation\n * This is the main method for queue-based interactive processing\n */\n public async processQueueWithConfirmation(\n processor: (strands: QueuedStrand[]) => Promise<void>,\n ): Promise<void> {\n if (this.processingConfirmation) {\n logger.debug(\n \"Already processing confirmation, skipping queue processing\",\n );\n return;\n }\n\n // Check if there are any strands to process\n let queuedStrands = this.getQueuedStrands();\n if (queuedStrands.length === 0) {\n logger.debug(\"No strands in queue to process\");\n return;\n }\n\n this.processingConfirmation = true;\n\n try {\n // Prompt user for confirmation\n const shouldProceed = await this.promptUserConfirmation();\n\n if (!shouldProceed) {\n logger.info(\"❌ Code generation cancelled by user\");\n // Clear the queue since user cancelled\n this.clearQueue();\n return;\n }\n\n // Get and clear the final queue state right before processing\n // (in case new strands were added while waiting for user input)\n queuedStrands = this.clearQueue();\n if (queuedStrands.length === 0) {\n logger.info(\"ℹ️ No documents to process\");\n return;\n }\n\n logger.info(\n `✅ User approved code generation for ${queuedStrands.length} document(s)`,\n );\n\n // Process all queued strands\n await processor(queuedStrands);\n logger.info(\"✅ Code generation completed\");\n } catch (error) {\n logger.error(\n \"❌ Error during interactive queue processing: @error\",\n error,\n );\n throw error;\n } finally {\n this.processingConfirmation = false;\n }\n }\n\n public setInteractiveMode(enabled: boolean): void {\n this.isInteractiveMode = enabled;\n logger.debug(`Interactive mode set to: ${enabled}`);\n }\n\n public isInteractive(): boolean {\n return this.isInteractiveMode;\n }\n\n public isProcessing(): boolean {\n return this.processingConfirmation;\n }\n}\n","import type { Project } from \"ts-morph\";\nimport type { QueuedStrand } from \"../interactive-manager.js\";\nimport { InteractiveManager } from \"../interactive-manager.js\";\nimport { logger } from \"../logger.js\";\nimport type { BaseDocumentGen } from \"./base-document-gen.js\";\nimport type { CodegenInput, Config } from \"./types.js\";\n\nconst DEFAULT_DEBOUNCE_TIME = 1000; // wait 1 second between codegen calls\n\n/** Whether a document belongs to what this manager generates from. */\nexport type DocumentScope = (documentId: string) => Promise<boolean>;\n\n/**\n * Manager class responsible for routing documents to the correct generator\n * and managing generator registration and instantiation\n */\nexport class DocumentCodegenManager {\n project: Project;\n private generators = new Map<string, BaseDocumentGen>();\n private debounceTimers = new Map<string, NodeJS.Timeout>();\n private processingQueue: Promise<void> = Promise.resolve();\n private interactiveManager: InteractiveManager;\n private isInScope: DocumentScope = () => Promise.resolve(true);\n\n constructor(\n private config: Config,\n project: Project,\n interactiveMode = false,\n ) {\n this.project = project;\n this.interactiveManager = new InteractiveManager(interactiveMode);\n }\n\n /**\n * Limit generation to the documents `isInScope` accepts, checked when the\n * debounce fires\n */\n setScope(isInScope: DocumentScope): void {\n this.isInScope = isInScope;\n }\n\n /**\n * Register a generator class for a specific document type\n */\n registerGenerator(\n documentType: string,\n generatorClass: new (config: Config, project: Project) => BaseDocumentGen,\n ): void {\n if (this.generators.has(documentType)) {\n logger.warn(\n `⚠️ Generator for document type \"${documentType}\" is already registered. Overwriting.`,\n );\n }\n\n this.generators.set(\n documentType,\n new generatorClass(this.config, this.project),\n );\n logger.debug(`✅ Registered generator for document type: ${documentType}`);\n }\n\n /**\n * Register a generator class that supports multiple document types\n */\n registerMultiTypeGenerator(\n generatorClass: new (config: Config, project: Project) => BaseDocumentGen,\n ): void {\n const generator = new generatorClass(this.config, this.project);\n const supportedTypes = generator.getSupportedDocumentTypes();\n\n for (const documentType of supportedTypes) {\n if (this.generators.has(documentType)) {\n logger.warn(\n `⚠️ Generator for document type \"${documentType}\" is already registered. Overwriting.`,\n );\n }\n this.generators.set(documentType, generator);\n }\n\n logger.debug(\n `✅ Registered multi-type generator for document types: ${supportedTypes.join(\", \")}`,\n );\n }\n\n /**\n * Get a generator instance for the given document type\n * Public method to allow external access for validation\n */\n public getGenerator(documentType: string): BaseDocumentGen | undefined {\n return this.generators.get(documentType);\n }\n\n /**\n * Get all registered document types\n */\n getRegisteredDocumentTypes(): string[] {\n return Array.from(this.generators.keys());\n }\n\n /**\n * Check if a document type is supported\n */\n isDocumentTypeSupported(documentType: string): boolean {\n return this.generators.has(documentType);\n }\n\n /**\n * Route a document to the appropriate generator and handle the generation\n * Handles both interactive and non-interactive modes with queue-based processing\n */\n routeAndGenerate(strand: CodegenInput): Promise<void> {\n const documentType = strand.documentType;\n\n if (!documentType) {\n logger.error(\"❌ Document type is missing from strand state\");\n throw new Error(\"Document type is missing from strand state\");\n }\n\n const generator = this.getGenerator(documentType);\n\n if (!generator) {\n logger.warn(`⚠️ No generator found for document type: ${documentType}`);\n logger.warn(\n `ℹ️ Supported document types: ${this.getRegisteredDocumentTypes().join(\", \")}`,\n );\n throw new Error(`Unsupported document type: ${documentType}`);\n }\n\n // Scope and validation are checked when the debounce fires, on the\n // document's final state.\n // Different flow for interactive vs non-interactive mode\n if (this.interactiveManager.isInteractive()) {\n // Interactive mode: queue strands and use debounce timer to trigger batch processing\n logger.debug(\n `>>> Queueing strand for interactive processing: ${documentType}:${strand.documentId}`,\n );\n\n // Add strand to queue (will replace any existing strand for same document)\n this.interactiveManager.queueStrand(strand);\n\n // Clear any existing debounce timer for interactive processing\n const existingTimer = this.debounceTimers.get(\"interactive\");\n if (existingTimer) {\n clearTimeout(existingTimer);\n }\n\n // Set up debounce timer for batch interactive processing\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n const debounceTimer = setTimeout(async () => {\n try {\n const rejected = new Set<CodegenInput>();\n for (const { strand } of this.interactiveManager.getQueuedStrands()) {\n if (!(await this.accepts(strand))) rejected.add(strand);\n }\n this.interactiveManager.discardWhere((queued) =>\n rejected.has(queued),\n );\n await this.interactiveManager.processQueueWithConfirmation(\n async (queuedStrands: QueuedStrand[]) => {\n await this.processQueuedStrands(queuedStrands);\n },\n );\n } catch (error) {\n logger.error(\n \"❌ Error during interactive batch processing: @error\",\n error,\n );\n } finally {\n // Clean up the timer reference\n this.debounceTimers.delete(\"interactive\");\n }\n }, DEFAULT_DEBOUNCE_TIME);\n\n // Store the timer reference using 'interactive' key\n this.debounceTimers.set(\"interactive\", debounceTimer);\n } else {\n // Non-interactive mode: use debouncing per document instance\n // Create unique key for this specific document instance\n const timerKey = `${documentType}:${strand.documentId}`;\n\n // Clear any existing debounce timer for this document instance\n const existingTimer = this.debounceTimers.get(timerKey);\n if (existingTimer) {\n clearTimeout(existingTimer);\n }\n\n // Set up new debounced generation (no interactive confirmation)\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n const debounceTimer = setTimeout(async () => {\n try {\n if (!(await this.accepts(strand))) return;\n logger.debug(\n `🔄 Routing document type \"${documentType}\" to generator (debounced)`,\n );\n\n // Direct generation, no interactive confirmation\n await generator.generate(strand);\n logger.debug(\n `✅ Successfully generated code for document type: ${documentType}`,\n );\n } catch (error) {\n logger.error(\n `❌ Error generating code for document type \"${documentType}\":`,\n error,\n );\n // Don't throw - let codegen continue with other documents\n } finally {\n // Clean up the timer reference\n this.debounceTimers.delete(timerKey);\n }\n }, DEFAULT_DEBOUNCE_TIME);\n\n // Store the timer reference\n this.debounceTimers.set(timerKey, debounceTimer);\n }\n return Promise.resolve();\n }\n\n /** In scope first, so documents out of scope are never validated or logged. */\n private async accepts(strand: CodegenInput): Promise<boolean> {\n const generator = this.getGenerator(strand.documentType);\n if (!generator) return false;\n if (!(await this.isInScope(strand.documentId))) {\n logger.debug(\n `Document ${strand.documentId} is not in the Vetra drive, skipping codegen`,\n );\n return false;\n }\n return generator.shouldProcess(strand);\n }\n\n /**\n * Process multiple strands in priority order (document-model types first)\n */\n private async processQueuedStrands(\n queuedStrands: QueuedStrand[],\n ): Promise<void> {\n logger.debug(`🔄 Processing ${queuedStrands.length} queued strand(s)`);\n\n // Sort by priority (document-model first to ensure dependencies exist)\n const documentModelStrands = queuedStrands.filter(\n (qs: QueuedStrand) =>\n qs.strand.documentType === \"powerhouse/document-model\",\n );\n const otherStrands = queuedStrands.filter(\n (qs: QueuedStrand) =>\n qs.strand.documentType !== \"powerhouse/document-model\",\n );\n\n // Process document models first\n for (const queuedStrand of documentModelStrands) {\n await this.processStrand(queuedStrand.strand);\n }\n\n // Then process other document types\n for (const queuedStrand of otherStrands) {\n await this.processStrand(queuedStrand.strand);\n }\n\n logger.debug(\n `✅ Successfully processed all ${queuedStrands.length} queued strand(s)`,\n );\n }\n\n /**\n * Process a single strand (used internally by processQueuedStrands)\n */\n private async processStrand(strand: CodegenInput): Promise<void> {\n const documentType = strand.documentType;\n const generator = this.getGenerator(documentType);\n\n if (!generator) {\n logger.warn(`⚠️ No generator found for document type: ${documentType}`);\n return;\n }\n\n try {\n logger.debug(`🔄 Generating code for document type: ${documentType}`);\n await generator.generate(strand);\n logger.debug(\n `✅ Successfully generated code for document type: ${documentType}`,\n );\n } catch (error) {\n logger.error(\n `❌ Error generating code for document type \"${documentType}\":`,\n error,\n );\n // Don't throw here to allow other strands to be processed\n }\n }\n\n /**\n * Clear all registered generators\n */\n clearGenerators(): void {\n this.generators.clear();\n logger.debug(\"🧹 Cleared all registered generators\");\n }\n\n /**\n * Get statistics about registered generators\n */\n getStats(): { totalGenerators: number; supportedTypes: string[] } {\n return {\n totalGenerators: this.generators.size,\n supportedTypes: this.getRegisteredDocumentTypes(),\n };\n }\n\n /**\n * Set interactive mode for code generation\n */\n setInteractiveMode(enabled: boolean): void {\n this.interactiveManager.setInteractiveMode(enabled);\n }\n\n /**\n * Check if interactive mode is enabled\n */\n isInteractiveMode(): boolean {\n return this.interactiveManager.isInteractive();\n }\n\n /**\n * Check if the manager is currently processing an interactive confirmation\n */\n isProcessingInteractive(): boolean {\n return this.interactiveManager.isProcessing();\n }\n}\n","import type {\n MinimalBackupData,\n PHBaseState,\n PHDocument,\n PHDocumentHeader,\n} from \"@powerhousedao/shared/document-model\";\nimport { baseMinimalSaveToFile, baseSaveToFile } from \"document-model/node\";\nimport { mkdir } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { lintSubgraphTypes } from \"../../../../codegen/subgraph-type-lint.js\";\nimport { logger } from \"../../logger.js\";\n\nconst BACKUP_FOLDER = \"backup-documents\";\n\n/**\n * Exports a document to the backup directory.\n * Creates the backup directory if it doesn't exist.\n *\n * @param document - The document to backup\n * @param workingDir - Current working directory\n * @param extension - File extension for the document type (without dot)\n * @param name - Name of the document to use for the backup file (optional)\n * @returns Promise resolving to the backup file path, or undefined if backup failed\n */\nexport async function backupDocument(\n document: PHDocument,\n workingDir: string,\n extension: string = \"\",\n name?: string,\n): Promise<string | undefined> {\n const docName = name ?? document.header.name;\n\n try {\n const backupPath = join(workingDir, BACKUP_FOLDER);\n await mkdir(backupPath, { recursive: true });\n\n const filePath = await baseSaveToFile(\n document,\n backupPath,\n extension,\n docName,\n );\n\n logger.debug(`📁 Document backed up to: ${filePath}`);\n return filePath;\n } catch (error) {\n logger.warn(`⚠️ Failed to backup document \"${docName}\":`, error);\n return undefined;\n }\n}\n\n/**\n * Creates a minimal backup of a document from strand data.\n * Used when the full document is not available (e.g., in onOperations handler).\n */\nexport async function minimalBackupDocument(\n data: MinimalBackupData,\n workingDir: string,\n extension?: string,\n): Promise<string | undefined> {\n // The reactor's resultingState carries the document header alongside the\n // state scopes; lift its protocol versions into the backup header.\n const { header, ...state } = data.state as PHBaseState & {\n header?: PHDocumentHeader;\n };\n\n try {\n const backupPath = join(workingDir, BACKUP_FOLDER);\n await mkdir(backupPath, { recursive: true });\n\n const filePath = await baseMinimalSaveToFile(\n {\n ...data,\n state,\n protocolVersions: data.protocolVersions ?? header?.protocolVersions,\n },\n backupPath,\n extension ?? \"\",\n );\n\n logger.debug(`Document backed up to: ${filePath}`);\n return filePath;\n } catch (error) {\n logger.warn(`Failed to backup document \"${data.name}\":`, error);\n return undefined;\n }\n}\n\nexport async function warnSubgraphTypeConflicts(\n workingDir: string,\n): Promise<void> {\n let warnings: string[];\n try {\n warnings = await lintSubgraphTypes(workingDir);\n } catch (error) {\n logger.warn(\n `Failed to check subgraph type names: ${error instanceof Error ? error.message : String(error)}`,\n );\n return;\n }\n for (const warning of warnings) logger.warn(`⚠️ ${warning}`);\n}\n","import { generateApp } from \"@powerhousedao/codegen\";\nimport type {\n AppModuleGlobalState,\n AppModulePHState,\n} from \"@powerhousedao/vetra/document-models/app-module\";\nimport { kebabCase } from \"change-case\";\nimport { logger } from \"../../logger.js\";\nimport { BaseDocumentGen } from \"../base-document-gen.js\";\nimport type { CodegenInput } from \"../types.js\";\nimport { minimalBackupDocument } from \"./utils.js\";\n\n/**\n * Generator for app documents\n */\nexport class AppGenerator extends BaseDocumentGen {\n readonly supportedDocumentTypes = \"powerhouse/app\";\n\n /**\n * Parse and extract the global state from the serialized state string\n */\n private extractGlobalState(\n input: CodegenInput,\n ): AppModuleGlobalState | undefined {\n if (!input.state) {\n return undefined;\n }\n const fullState = input.state as AppModulePHState;\n return fullState.global;\n }\n\n /**\n * Validate if this app strand should be processed\n */\n shouldProcess(input: CodegenInput): boolean {\n // First run base validation\n if (!super.shouldProcess(input)) {\n return false;\n }\n\n const state = this.extractGlobalState(input);\n if (!state) {\n logger.debug(`No state found for app: ${input.documentId}`);\n return false;\n }\n\n // Check if we have a valid app name and it's confirmed\n if (!state.name) {\n logger.debug(`No name found for app: ${input.documentId}`);\n return false;\n }\n\n if (state.status !== \"CONFIRMED\") {\n logger.debug(\n `App not confirmed: ${state.name} (status: ${state.status})`,\n );\n return false;\n }\n\n return true;\n }\n\n async generate(input: CodegenInput): Promise<void> {\n const state = this.extractGlobalState(input);\n if (!state) {\n logger.error(`No state found for app: ${input.documentId}`);\n return;\n }\n\n // Check if we have a valid app name and it's confirmed\n if (state.name && state.status === \"CONFIRMED\") {\n logger.info(`🔄 Starting app generation for app: ${state.name}`);\n try {\n // Generate app ID using kebabCase\n const appId: string = kebabCase(state.name);\n // Generate the app using the codegen function\n await generateApp(\n {\n ...this.config.PH_CONFIG,\n appName: state.name,\n appId: appId,\n allowedDocumentTypes: state.allowedDocumentTypes ?? [],\n isDragAndDropEnabled: state.isDragAndDropEnabled,\n },\n this.project,\n );\n await this.project.save();\n\n logger.info(\n `✅ App generation completed successfully for app: ${state.name}`,\n );\n\n // Backup the document\n const fullState = input.state as AppModulePHState;\n await minimalBackupDocument(\n {\n documentId: input.documentId,\n documentType: input.documentType,\n branch: input.branch,\n state: fullState,\n name: state.name,\n },\n this.config.CURRENT_WORKING_DIR,\n );\n } catch (error) {\n logger.error(\n `❌ Error during app generation for app ${state.name}:`,\n error,\n );\n if (error instanceof Error) {\n logger.error(`❌ Error message: ${error.message}`);\n }\n }\n } else {\n if (!state.name) {\n logger.error(`❌ Skipping app generation - missing name for app`);\n return;\n } else if (state.status !== \"CONFIRMED\") {\n logger.error(\n `❌ Skipping app generation - app \"${state.name}\" is not confirmed (status: ${state.status})`,\n );\n return;\n }\n }\n }\n}\n","import { generateEditor } from \"@powerhousedao/codegen\";\nimport { kebabCase } from \"change-case\";\nimport type {\n DocumentEditorPHState,\n DocumentEditorState,\n} from \"../../../../document-models/document-editor/index.js\";\nimport { logger } from \"../../logger.js\";\nimport { BaseDocumentGen } from \"../base-document-gen.js\";\nimport type { CodegenInput } from \"../types.js\";\nimport { minimalBackupDocument } from \"./utils.js\";\n\n/**\n * Generator for document editor documents\n */\nexport class DocumentEditorGenerator extends BaseDocumentGen {\n readonly supportedDocumentTypes = \"powerhouse/document-editor\";\n\n /**\n * Parse and extract the global state from the serialized state string\n */\n private extractGlobalState(\n input: CodegenInput,\n ): DocumentEditorState | undefined {\n if (!input.state) {\n return undefined;\n }\n const fullState = input.state as DocumentEditorPHState;\n return fullState.global;\n }\n\n /**\n * Validate if this document editor strand should be processed\n */\n shouldProcess(input: CodegenInput): boolean {\n // First run base validation\n if (!super.shouldProcess(input)) {\n return false;\n }\n\n const state = this.extractGlobalState(input);\n if (!state) {\n logger.debug(`No state found for document editor: ${input.documentId}`);\n return false;\n }\n\n // Check if we have a valid editor name, document types, and it's confirmed\n if (!state.name) {\n logger.debug(`No name found for document editor: ${input.documentId}`);\n return false;\n }\n\n if (!state.documentTypes || state.documentTypes.length === 0) {\n logger.debug(\n `No document types found for document editor: ${state.name}`,\n );\n return false;\n }\n\n if (state.status !== \"CONFIRMED\") {\n logger.debug(\n `Document editor not confirmed: ${state.name} (status: ${state.status})`,\n );\n return false;\n }\n\n return true;\n }\n\n async generate(input: CodegenInput): Promise<void> {\n const state = this.extractGlobalState(input);\n if (!state) {\n logger.error(`No state found for document editor: ${input.documentId}`);\n return;\n }\n\n // Validation is already done in shouldProcess, so we can proceed directly\n logger.info(`🔄 Starting editor generation for: ${state.name}`);\n try {\n // Extract document types from the state\n const documentTypes = state.documentTypes.map((dt) => dt.documentType);\n\n // Generate editor ID using kebabCase\n const editorId: string = kebabCase(state.name);\n\n // Generate the editor using the codegen function\n await generateEditor(\n {\n ...this.config.PH_CONFIG,\n editorName: state.name,\n documentTypes: documentTypes,\n editorId: editorId,\n },\n this.project,\n );\n await this.project.save();\n\n logger.info(\n `✅ Editor generation completed successfully for: ${state.name}`,\n );\n\n // Backup the document\n const fullState = input.state as DocumentEditorPHState;\n await minimalBackupDocument(\n {\n documentId: input.documentId,\n documentType: input.documentType,\n branch: input.branch,\n state: fullState,\n name: state.name,\n },\n this.config.CURRENT_WORKING_DIR,\n );\n } catch (error) {\n logger.error(\n `❌ Error during editor generation for ${state.name}:`,\n error,\n );\n if (error instanceof Error) {\n logger.error(`❌ Error message: ${error.message}`);\n }\n // Don't throw - let codegen continue with other documents\n return;\n }\n }\n}\n","import {\n generateDocumentModel,\n validateDocumentModelState,\n} from \"@powerhousedao/codegen\";\nimport type {\n DocumentModelGlobalState,\n DocumentModelPHState,\n} from \"@powerhousedao/shared/document-model\";\nimport { logger } from \"../../logger.js\";\nimport { BaseDocumentGen } from \"../base-document-gen.js\";\nimport type { CodegenInput } from \"../types.js\";\nimport { minimalBackupDocument, warnSubgraphTypeConflicts } from \"./utils.js\";\n\n/**\n * Generator for document model documents\n */\nexport class DocumentModelGenerator extends BaseDocumentGen {\n readonly supportedDocumentTypes = \"powerhouse/document-model\";\n\n /**\n * Parse and extract the global state from the serialized state string\n */\n private extractGlobalState(\n input: CodegenInput,\n ): DocumentModelGlobalState | undefined {\n if (!input.state) {\n return undefined;\n }\n const fullState = input.state as DocumentModelPHState;\n return fullState.global;\n }\n\n /**\n * Validate if this document model strand should be processed\n */\n shouldProcess(input: CodegenInput): boolean {\n // First run base validation\n if (!super.shouldProcess(input)) {\n return false;\n }\n\n // Extract the global state from the full document state\n const globalState = this.extractGlobalState(input);\n if (!globalState) {\n logger.debug(\n `>>> No global state found for document model: ${input.documentId}`,\n );\n return false;\n }\n\n const validationResult = validateDocumentModelState(globalState);\n if (!validationResult.isValid) {\n const errorList = validationResult.errors\n .map((error) => ` - ${error}`)\n .join(\"\\n\");\n logger.info(\n `⚠️ Skipped code generation for '${globalState.name || input.documentId}' due to validation errors:\\n${errorList}`,\n );\n return false;\n }\n\n logger.info(\n `Document model ${globalState.name} is valid, proceeding with code generation`,\n );\n\n return true;\n }\n\n async generate(input: CodegenInput): Promise<void> {\n const globalState = this.extractGlobalState(input);\n if (!globalState) {\n logger.error(\n `❌ No global state found for document model: ${input.documentId}`,\n );\n return;\n }\n // Validation is already done in shouldProcess, so we can proceed directly\n logger.debug(\n `🔄 Starting code generation for document model: ${globalState.name}`,\n );\n try {\n await generateDocumentModel(globalState, this.project);\n await this.project.save();\n logger.info(\n `✅ Code generation completed successfully for: ${globalState.name}`,\n );\n await warnSubgraphTypeConflicts(this.config.CURRENT_WORKING_DIR);\n\n // Backup the document\n const fullState = input.state as DocumentModelPHState;\n const extension = globalState.extension?.replace(/^\\.+|\\.+$/g, \"\") || \"\";\n await minimalBackupDocument(\n {\n documentId: input.documentId,\n documentType: input.documentType,\n branch: input.branch,\n state: fullState,\n name: globalState.name,\n },\n this.config.CURRENT_WORKING_DIR,\n extension,\n );\n } catch (error) {\n logger.error(\n `❌ Error during code generation for ${globalState.name}:`,\n error,\n );\n // Don't throw - let codegen continue with other documents\n return;\n }\n }\n}\n","import { createOrUpdateManifest } from \"@powerhousedao/codegen/file-builders\";\nimport type {\n VetraPackageGlobalState,\n VetraPackagePHState,\n} from \"../../../../document-models/vetra-package/index.js\";\nimport { logger } from \"../../logger.js\";\nimport { BaseDocumentGen } from \"../base-document-gen.js\";\nimport type { CodegenInput } from \"../types.js\";\nimport { minimalBackupDocument } from \"./utils.js\";\n\n/**\n * Generator for package documents\n */\nexport class PackageGenerator extends BaseDocumentGen {\n readonly supportedDocumentTypes = \"powerhouse/package\";\n\n /**\n * Validate if this package strand should be processed\n */\n shouldProcess(input: CodegenInput): boolean {\n // First run base validation\n if (!super.shouldProcess(input)) {\n return false;\n }\n\n if (!input.state) {\n logger.debug(`>>> No state found for package: ${input.documentId}`);\n return false;\n }\n\n return true;\n }\n\n async generate(input: CodegenInput): Promise<void> {\n const fullState = input.state as VetraPackagePHState;\n const state = fullState.global as VetraPackageGlobalState;\n\n await createOrUpdateManifest(\n {\n name: state.name ?? \"\",\n category: state.category ?? \"\",\n description: state.description ?? \"\",\n publisher: {\n name: state.author?.name ?? \"\",\n url: state.author?.website ?? \"\",\n },\n },\n this.config.CURRENT_WORKING_DIR,\n );\n\n // Backup the document\n await minimalBackupDocument(\n {\n documentId: input.documentId,\n documentType: input.documentType,\n branch: input.branch,\n state: fullState,\n name: \"vetra-package\",\n },\n this.config.CURRENT_WORKING_DIR,\n );\n }\n}\n","import { generateProcessor } from \"@powerhousedao/codegen\";\nimport {\n PROCESSOR_APPS,\n type ProcessorApp,\n type ProcessorApps,\n} from \"@powerhousedao/shared/processors\";\nimport type {\n ProcessorModulePHState,\n ProcessorModuleState,\n} from \"../../../../document-models/processor-module/index.js\";\nimport { logger } from \"../../logger.js\";\nimport { BaseDocumentGen } from \"../base-document-gen.js\";\nimport type { CodegenInput } from \"../types.js\";\nimport { minimalBackupDocument } from \"./utils.js\";\n\n/**\n * Generator for processor documents\n */\nexport class ProcessorGenerator extends BaseDocumentGen {\n readonly supportedDocumentTypes = \"powerhouse/processor\";\n\n /**\n * Parse and extract the global state from the serialized state string\n */\n private extractGlobalState(\n input: CodegenInput,\n ): ProcessorModuleState | undefined {\n if (!input.state) {\n return undefined;\n }\n const fullState = input.state as ProcessorModulePHState;\n return fullState.global;\n }\n\n /**\n * Validate if this processor strand should be processed\n */\n shouldProcess(input: CodegenInput): boolean {\n // First run base validation\n if (!super.shouldProcess(input)) {\n return false;\n }\n\n const state = this.extractGlobalState(input);\n if (!state) {\n logger.debug(`No state found for processor: ${input.documentId}`);\n return false;\n }\n\n // Check if we have a valid processor name, type, document types, and it's confirmed\n if (!state.name) {\n logger.debug(`No name found for processor: ${input.documentId}`);\n return false;\n }\n\n if (!state.type) {\n logger.debug(`No type found for processor: ${state.name}`);\n return false;\n }\n\n if (!state.documentTypes || state.documentTypes.length === 0) {\n logger.debug(`No document types found for processor: ${state.name}`);\n return false;\n }\n\n if (!state.processorApps || state.processorApps.length === 0) {\n logger.debug(`No processor apps found for processor: ${state.name}`);\n return false;\n }\n\n if (state.status !== \"CONFIRMED\") {\n logger.debug(\n `Processor not confirmed: ${state.name} (status: ${state.status})`,\n );\n return false;\n }\n\n return true;\n }\n\n async generate(input: CodegenInput): Promise<void> {\n const state = this.extractGlobalState(input);\n if (!state) {\n logger.error(`No state found for processor: ${input.documentId}`);\n return;\n }\n\n // Check if we have a valid processor name, type, document types, and it's confirmed\n if (\n state.name &&\n state.type &&\n state.documentTypes.length > 0 &&\n state.processorApps.length > 0 &&\n state.status === \"CONFIRMED\"\n ) {\n logger.info(`🔄 Starting processor generation for: ${state.name}`);\n try {\n // Map the type value from document state to generateProcessor expected values\n let processorType: \"analytics\" | \"relationalDb\";\n if (state.type === \"analytics\") {\n processorType = \"analytics\";\n } else if (state.type === \"relational\") {\n processorType = \"relationalDb\";\n } else {\n logger.error(`❌ Unsupported processor type: ${state.type}`);\n return;\n }\n\n // Extract document types from the state\n const documentTypes = state.documentTypes.map((dt) => dt.documentType);\n\n const processorApps = state.processorApps;\n\n if (!isProcessorApps(processorApps)) {\n logger.error(\n `❌ Unsupported processor apps: ${processorApps.join(\", \")}`,\n );\n return;\n }\n\n // Generate the processor using the codegen function\n await generateProcessor(\n {\n processorName: state.name,\n processorType,\n documentTypes,\n processorApps,\n },\n this.project,\n );\n await this.project.save();\n\n logger.info(\n `✅ Processor generation completed successfully for: ${state.name}`,\n );\n\n // Backup the document\n const fullState = input.state as ProcessorModulePHState;\n await minimalBackupDocument(\n {\n documentId: input.documentId,\n documentType: input.documentType,\n branch: input.branch,\n state: fullState,\n name: state.name,\n },\n this.config.CURRENT_WORKING_DIR,\n );\n } catch (error) {\n logger.error(\n `❌ Error during processor generation for ${state.name}:`,\n error,\n );\n if (error instanceof Error) {\n logger.error(`❌ Error message: ${error.message}`);\n }\n }\n } else {\n if (!state.name) {\n logger.error(\n `❌ Skipping processor generation - missing name for processor`,\n );\n return;\n } else if (!state.type) {\n logger.error(\n `❌ Skipping processor generation - missing type for processor \"${state.name}\"`,\n );\n return;\n } else if (state.documentTypes.length === 0) {\n logger.error(\n `❌ Skipping processor generation - missing document types for processor \"${state.name}\"`,\n );\n return;\n } else if (state.status !== \"CONFIRMED\") {\n logger.error(\n `❌ Skipping processor generation - processor \"${state.name}\" is not confirmed (status: ${state.status})`,\n );\n return;\n }\n }\n }\n}\n\nfunction isProcessorApps(input: readonly string[]): input is ProcessorApps {\n if (input.length === 0) return false;\n if (new Set(input).size !== input.length) {\n return false;\n }\n if (!input.every((i) => PROCESSOR_APPS.includes(i as ProcessorApp)))\n return false;\n\n return true;\n}\n","import { generateSubgraph } from \"@powerhousedao/codegen\";\nimport { findSubgraphNameConflict } from \"../../../../codegen/subgraph-type-lint.js\";\nimport type {\n SubgraphModulePHState,\n SubgraphModuleState,\n} from \"../../../../document-models/subgraph-module/index.js\";\nimport { logger } from \"../../logger.js\";\nimport { BaseDocumentGen } from \"../base-document-gen.js\";\nimport type { CodegenInput } from \"../types.js\";\nimport { minimalBackupDocument, warnSubgraphTypeConflicts } from \"./utils.js\";\n\n/**\n * Generator for subgraph documents\n */\nexport class SubgraphGenerator extends BaseDocumentGen {\n readonly supportedDocumentTypes = \"powerhouse/subgraph\";\n\n /**\n * Parse and extract the global state from the serialized state string\n */\n private extractGlobalState(\n input: CodegenInput,\n ): SubgraphModuleState | undefined {\n if (!input.state) {\n return undefined;\n }\n const fullState = input.state as SubgraphModulePHState;\n return fullState.global;\n }\n\n /**\n * Validate if this subgraph strand should be processed\n */\n shouldProcess(input: CodegenInput): boolean {\n // First run base validation\n if (!super.shouldProcess(input)) {\n return false;\n }\n\n const state = this.extractGlobalState(input);\n if (!state) {\n logger.debug(`No state found for subgraph: ${input.documentId}`);\n return false;\n }\n\n // Check if we have a valid subgraph name and it's confirmed\n if (!state.name) {\n logger.debug(`No name found for subgraph: ${input.documentId}`);\n return false;\n }\n\n if (state.status !== \"CONFIRMED\") {\n logger.debug(\n `Subgraph not confirmed: ${state.name} (status: ${state.status})`,\n );\n return false;\n }\n\n return true;\n }\n\n async generate(input: CodegenInput): Promise<void> {\n const state = this.extractGlobalState(input);\n if (!state) {\n logger.error(`No state found for subgraph: ${input.documentId}`);\n return;\n }\n\n // Check if we have a valid subgraph name and it's confirmed\n if (state.name && state.status === \"CONFIRMED\") {\n logger.info(`🔄 Starting subgraph generation for: ${state.name}`);\n try {\n const conflict = await findSubgraphNameConflict(\n this.config.CURRENT_WORKING_DIR,\n state.name,\n );\n if (conflict) {\n logger.error(`❌ Skipping subgraph generation: ${conflict}`);\n return;\n }\n await generateSubgraph(state.name, this.project);\n await this.project.save();\n logger.info(\n `✅ Subgraph generation completed successfully for: ${state.name}`,\n );\n await warnSubgraphTypeConflicts(this.config.CURRENT_WORKING_DIR);\n\n // Backup the document\n const fullState = input.state as SubgraphModulePHState;\n await minimalBackupDocument(\n {\n documentId: input.documentId,\n documentType: input.documentType,\n branch: input.branch,\n state: fullState,\n name: state.name,\n },\n this.config.CURRENT_WORKING_DIR,\n );\n } catch (error) {\n logger.error(\n `❌ Error during subgraph generation for ${state.name}:`,\n error,\n );\n }\n } else {\n if (!state.name) {\n logger.error(\n `❌ Skipping subgraph generation - missing name for subgraph`,\n );\n return;\n } else if (state.status !== \"CONFIRMED\") {\n logger.error(\n `❌ Skipping subgraph generation - subgraph \"${state.name}\" is not confirmed (status: ${state.status})`,\n );\n return;\n }\n }\n }\n}\n","import type { Project } from \"ts-morph\";\nimport type { BaseDocumentGen } from \"./base-document-gen.js\";\nimport { DocumentCodegenManager } from \"./document-codegen-manager.js\";\nimport {\n AppGenerator,\n DocumentEditorGenerator,\n DocumentModelGenerator,\n PackageGenerator,\n ProcessorGenerator,\n SubgraphGenerator,\n} from \"./generators/index.js\";\nimport type { Config } from \"./types.js\";\n\n/**\n * Factory class for creating and configuring DocumentCodegenManager instances\n * with all the standard generators pre-registered\n */\nexport class DocumentCodegenFactory {\n /**\n * Create a DocumentCodegenManager with all standard generators registered\n */\n static createManager(\n config: Config,\n project: Project,\n interactiveMode: boolean = false,\n ): DocumentCodegenManager {\n const manager = new DocumentCodegenManager(\n config,\n project,\n interactiveMode,\n );\n\n // Register all the standard generators\n manager.registerGenerator(\n \"powerhouse/document-model\",\n DocumentModelGenerator,\n );\n manager.registerGenerator(\"powerhouse/package\", PackageGenerator);\n manager.registerGenerator(\"powerhouse/app\", AppGenerator);\n manager.registerGenerator(\n \"powerhouse/document-editor\",\n DocumentEditorGenerator,\n );\n manager.registerGenerator(\"powerhouse/subgraph\", SubgraphGenerator);\n manager.registerGenerator(\"powerhouse/processor\", ProcessorGenerator);\n\n return manager;\n }\n\n /**\n * Create a DocumentCodegenManager with only specific generators\n */\n static createManagerWithGenerators(\n config: Config,\n generators: Array<new (config: Config) => any>,\n project: Project,\n interactiveMode: boolean = false,\n ): DocumentCodegenManager {\n const manager = new DocumentCodegenManager(\n config,\n project,\n interactiveMode,\n );\n\n for (const generatorClass of generators) {\n const generator = new generatorClass(config) as BaseDocumentGen;\n const supportedTypes = generator.getSupportedDocumentTypes();\n\n for (const documentType of supportedTypes) {\n manager.registerGenerator(documentType, generatorClass);\n }\n }\n\n return manager;\n }\n\n /**\n * Get all available generator classes\n */\n static getAvailableGenerators() {\n return {\n DocumentModelGenerator,\n PackageGenerator,\n AppGenerator,\n DocumentEditorGenerator,\n SubgraphGenerator,\n ProcessorGenerator,\n };\n }\n}\n","import type {\n IProcessor,\n IReactorClient,\n OperationWithContext,\n} from \"@powerhousedao/reactor-browser\";\nimport type { PowerhouseConfig } from \"@powerhousedao/shared\";\nimport type { DocumentDriveDocument } from \"@powerhousedao/shared/document-drive\";\nimport type { Project } from \"ts-morph\";\nimport type { DocumentCodegenManager } from \"./document-handlers/document-codegen-manager.js\";\nimport { DocumentCodegenFactory } from \"./document-handlers/index.js\";\nimport type { CodegenInput } from \"./document-handlers/types.js\";\nimport { logger } from \"./logger.js\";\n\nexport class CodegenProcessor implements IProcessor {\n private manager: DocumentCodegenManager;\n\n constructor(\n project: Project,\n config: PowerhouseConfig,\n cwd: string,\n private readonly driveId: string,\n private readonly client: IReactorClient,\n interactiveMode = false,\n ) {\n this.manager = DocumentCodegenFactory.createManager(\n {\n PH_CONFIG: config,\n CURRENT_WORKING_DIR: cwd,\n },\n project,\n interactiveMode,\n );\n this.manager.setScope((documentId) => this.isInDrive(documentId));\n\n if (interactiveMode) {\n logger.info(`CodegenProcessor initialized with interactive mode enabled`);\n } else {\n logger.debug(\n `CodegenProcessor initialized with interactive mode disabled`,\n );\n }\n }\n\n async onOperations(operations: OperationWithContext[]): Promise<void> {\n logger.debug(\"CodegenProcessor.onOperations()\");\n\n // Only a document's final state in the batch is generated from.\n const latest = new Map<string, OperationWithContext>();\n for (const operation of operations) {\n latest.set(operation.context.documentId, operation);\n }\n\n for (const { context } of latest.values()) {\n const generator = this.manager.getGenerator(context.documentType);\n if (!generator) {\n logger.debug(\n `No generator found for document type: ${context.documentType}`,\n );\n continue;\n }\n\n const input: CodegenInput = {\n documentId: context.documentId,\n documentType: context.documentType,\n scope: context.scope,\n branch: context.branch,\n state: context.resultingState\n ? JSON.parse(context.resultingState)\n : undefined,\n };\n\n await this.manager.routeAndGenerate(input);\n }\n }\n\n async onDisconnect() {}\n\n // Utility methods for external configuration and monitoring\n public setInteractiveMode(enabled: boolean): void {\n this.manager.setInteractiveMode(enabled);\n }\n\n public isInteractive(): boolean {\n return this.manager.isInteractiveMode();\n }\n\n public isProcessingInteractive(): boolean {\n return this.manager.isProcessingInteractive();\n }\n\n /**\n * The reactor delivers every drive's operations, so membership is checked\n * here: a node of the drive (in any folder, and in drives older than\n * relationship edges), or a child edge from it (a document attached by\n * relationship alone).\n */\n private async isInDrive(documentId: string): Promise<boolean> {\n try {\n const drive = await this.client.get<DocumentDriveDocument>(this.driveId);\n if (drive.state.global.nodes.some((node) => node.id === documentId)) {\n return true;\n }\n } catch (error) {\n logger.debug(`Could not read the Vetra drive ${this.driveId}:`, error);\n }\n try {\n const parents = await this.client.getIncomingRelationshipEdges(\n documentId,\n \"child\",\n );\n return parents.results.some((edge) => edge.sourceId === this.driveId);\n } catch (error) {\n logger.debug(`Could not read the parents of ${document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OAAO;GACd,OAAO,MAAM,iCAAiC,WAAW,IAAI,KAAK;GAClE,OAAO;EACT;CACF;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils-w_21RRK6.js","names":["z","processorModuleBaseOperationsActions"],"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/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"],"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 {\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} 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 return baseCreateDocument(\n utils.createState,\n state,\n processorModuleDocumentType,\n );\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"],"mappings":";;;;;;AAsBA,MAAa,uBAAuB,MAClC,MAAM,KAAA,KAAa,MAAM;AAE3B,MAAa,0BAA0BA,IACpC,IAAI,CAAC,CACL,QAAQ,MAAM,oBAAoB,CAAC,CAAC;AAEvC,MAAa,mBAAmBA,IAAE,KAAK,CAAC,aAAa,OAAO,CAAC;AAE7D,SAAgB,6BAEd;CACA,OAAOA,IAAE,OAAO;EACd,cAAcA,IAAE,OAAO;EACvB,IAAIA,IAAE,OAAO;CACf,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