@powerhousedao/vetra 6.1.0-dev.1 → 6.1.0-dev.10

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 (82) hide show
  1. package/dist/{app-module-D_cAVvt0.js → app-module-CHTbm_9a.js} +3 -3
  2. package/dist/{app-module-D_cAVvt0.js.map → app-module-CHTbm_9a.js.map} +1 -1
  3. package/dist/codegen/index.js +8 -8
  4. package/dist/{document-editor-1NFr9t3a.js → document-editor--pHInvi3.js} +3 -3
  5. package/dist/{document-editor-1NFr9t3a.js.map → document-editor--pHInvi3.js.map} +1 -1
  6. package/dist/document-models/app-module/index.js +4 -4
  7. package/dist/document-models/document-editor/index.js +4 -4
  8. package/dist/document-models/index.js +5 -5
  9. package/dist/document-models/processor-module/index.js +4 -4
  10. package/dist/document-models/subgraph-module/index.js +4 -4
  11. package/dist/document-models/vetra-package/index.js +2 -2
  12. package/dist/{editor-BwbJ65NZ.js → editor-Bba0kIIP.js} +4 -4
  13. package/dist/editor-Bba0kIIP.js.map +1 -0
  14. package/dist/{editor-DWufJcmG.js → editor-BsM-iHdN.js} +2 -2
  15. package/dist/{editor-DWufJcmG.js.map → editor-BsM-iHdN.js.map} +1 -1
  16. package/dist/{editor-CJAn9WTA.js → editor-BuV8eJum.js} +3 -3
  17. package/dist/{editor-CJAn9WTA.js.map → editor-BuV8eJum.js.map} +1 -1
  18. package/dist/{editor-DabfMxkF.js → editor-CsLmxkXj.js} +11 -11
  19. package/dist/{editor-DabfMxkF.js.map → editor-CsLmxkXj.js.map} +1 -1
  20. package/dist/{editor-WWMGVelM.js → editor-D-IzvjvS.js} +2 -2
  21. package/dist/{editor-WWMGVelM.js.map → editor-D-IzvjvS.js.map} +1 -1
  22. package/dist/editors/index.js +1 -1
  23. package/dist/{factory-CjFOr45i.js → factory-4o53XqHE.js} +3 -3
  24. package/dist/{factory-CjFOr45i.js.map → factory-4o53XqHE.js.map} +1 -1
  25. package/dist/{factory-KNJv2C2k.js → factory-Dexxeo5C.js} +5 -4
  26. package/dist/factory-Dexxeo5C.js.map +1 -0
  27. package/dist/index-BPoF8P3O.d.ts.map +1 -1
  28. package/dist/index-BoGed4Fa.d.ts.map +1 -1
  29. package/dist/index-C4s0aLv3.d.ts.map +1 -1
  30. package/dist/index-ClaOdn_F.d.ts.map +1 -1
  31. package/dist/index.js +6 -6
  32. package/dist/{logger-DLnGUZk9.js → logger-CYkStoEb.js} +1 -1
  33. package/dist/{logger-DLnGUZk9.js.map → logger-CYkStoEb.js.map} +1 -1
  34. package/dist/{module-pK0hpO6c.js → module-BAE-Cdy6.js} +2 -2
  35. package/dist/{module-pK0hpO6c.js.map → module-BAE-Cdy6.js.map} +1 -1
  36. package/dist/{module-ryHOwQp-.js → module-BSpVJEfF.js} +2 -2
  37. package/dist/{module-ryHOwQp-.js.map → module-BSpVJEfF.js.map} +1 -1
  38. package/dist/{module-dDKBr6QY.js → module-BV5uKc_X.js} +11 -11
  39. package/dist/module-BV5uKc_X.js.map +1 -0
  40. package/dist/{module-jWN6gsmi.js → module-CC1BnDod.js} +6 -6
  41. package/dist/{module-jWN6gsmi.js.map → module-CC1BnDod.js.map} +1 -1
  42. package/dist/{module-x2Liyk0-.js → module-D8H1Oetz.js} +2 -2
  43. package/dist/{module-x2Liyk0-.js.map → module-D8H1Oetz.js.map} +1 -1
  44. package/dist/module-Drla4Vmn.d.ts.map +1 -1
  45. package/dist/{module-DPyV2vUY.js → module-wcMEGEcg.js} +2 -2
  46. package/dist/{module-DPyV2vUY.js.map → module-wcMEGEcg.js.map} +1 -1
  47. package/dist/{ph-factories-B6PSPkPQ.js → ph-factories-4ifueM1H.js} +2 -2
  48. package/dist/{ph-factories-B6PSPkPQ.js.map → ph-factories-4ifueM1H.js.map} +1 -1
  49. package/dist/{ph-factories-CJXfT_Z1.js → ph-factories-BIe1kTJb.js} +2 -2
  50. package/dist/{ph-factories-CJXfT_Z1.js.map → ph-factories-BIe1kTJb.js.map} +1 -1
  51. package/dist/{ph-factories-B0_E6LY6.js → ph-factories-Bep45EPP.js} +2 -2
  52. package/dist/{ph-factories-B0_E6LY6.js.map → ph-factories-Bep45EPP.js.map} +1 -1
  53. package/dist/{ph-factories-Bn_HTUfT.js → ph-factories-D6cQKmns.js} +2 -2
  54. package/dist/{ph-factories-Bn_HTUfT.js.map → ph-factories-D6cQKmns.js.map} +1 -1
  55. package/dist/{processor-module-B7IAItXQ.js → processor-module-D7kxj_HT.js} +3 -3
  56. package/dist/{processor-module-B7IAItXQ.js.map → processor-module-D7kxj_HT.js.map} +1 -1
  57. package/dist/processors/codegen/index.js +1 -1
  58. package/dist/processors/index.js +1 -1
  59. package/dist/processors/vetra-read-model/index.js +1 -1
  60. package/dist/{subgraph-module-CfzSZTNC.js → subgraph-module-DqsecQjc.js} +3 -3
  61. package/dist/{subgraph-module-CfzSZTNC.js.map → subgraph-module-DqsecQjc.js.map} +1 -1
  62. package/dist/switchboard-C2L9IAfe.js +8 -0
  63. package/dist/{switchboard-Ciqw67L4.js.map → switchboard-C2L9IAfe.js.map} +1 -1
  64. package/dist/{utils-BRx88WW3.js → utils-A2M9gfq4.js} +7 -7
  65. package/dist/utils-A2M9gfq4.js.map +1 -0
  66. package/dist/{utils-Byjf33qt.js → utils-CSA5LPj9.js} +6 -6
  67. package/dist/utils-CSA5LPj9.js.map +1 -0
  68. package/dist/{utils-CnZc-0E4.js → utils-D3lwZ3L6.js} +5 -5
  69. package/dist/utils-D3lwZ3L6.js.map +1 -0
  70. package/dist/{utils-CWO5kDus.js → utils-DL6w0tV1.js} +3 -3
  71. package/dist/utils-DL6w0tV1.js.map +1 -0
  72. package/dist/{vetra-package-BgTjv343.js → vetra-package-C0hmmUZX.js} +2 -2
  73. package/dist/{vetra-package-BgTjv343.js.map → vetra-package-C0hmmUZX.js.map} +1 -1
  74. package/package.json +10 -8
  75. package/dist/editor-BwbJ65NZ.js.map +0 -1
  76. package/dist/factory-KNJv2C2k.js.map +0 -1
  77. package/dist/module-dDKBr6QY.js.map +0 -1
  78. package/dist/switchboard-Ciqw67L4.js +0 -8
  79. package/dist/utils-BRx88WW3.js.map +0 -1
  80. package/dist/utils-Byjf33qt.js.map +0 -1
  81. package/dist/utils-CWO5kDus.js.map +0 -1
  82. package/dist/utils-CnZc-0E4.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"factory-KNJv2C2k.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","../processors/codegen/factory.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 * 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/**\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\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 * 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 async 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 // Validate if this strand should be processed\n if (!generator.shouldProcess(strand)) {\n logger.debug(\n `>>> Generator validation failed for ${documentType}:${strand.documentId}, skipping processing`,\n );\n return;\n }\n\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 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 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 }\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 PHDocument,\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 { 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 try {\n const backupPath = join(workingDir, BACKUP_FOLDER);\n await mkdir(backupPath, { recursive: true });\n\n const filePath = await baseMinimalSaveToFile(\n data,\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","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 } 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\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 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 } 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 await generateSubgraph(state.name, this.project);\n await this.project.save();\n logger.info(\n `✅ Subgraph generation completed successfully for: ${state.name}`,\n );\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 OperationWithContext,\n} from \"@powerhousedao/reactor-browser\";\nimport type { PowerhouseConfig } from \"@powerhousedao/shared\";\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 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\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.info(\"CodegenProcessor.onOperations()\");\n\n for (const { context } of operations) {\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 const shouldProcess = generator.shouldProcess(input);\n if (shouldProcess) {\n await this.manager.routeAndGenerate(input);\n }\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","import { buildTsMorphProject } from \"@powerhousedao/codegen/utils\";\nimport type { VetraProcessorConfigType } from \"@powerhousedao/config\";\nimport { VETRA_PROCESSOR_CONFIG_KEY } from \"@powerhousedao/config\";\nimport { getConfig } from \"@powerhousedao/config/node\";\nimport type {\n IProcessorHostModule,\n ProcessorFactoryBuilder,\n ProcessorRecord,\n} from \"@powerhousedao/reactor-browser\";\nimport type { PHDocumentHeader } from \"@powerhousedao/shared/document-model\";\nimport { logger } from \"./logger.js\";\nimport { CodegenProcessor } from \"./processor.js\";\n\n/**\n * Determines if a drive header matches the Vetra drive criteria.\n * @param driveHeader - The drive header to check\n * @param explicitDriveId - Optional explicit drive ID from config (if set, uses exact match)\n * @returns true if the drive is a Vetra drive, false otherwise\n */\nfunction isDriveVetra(\n driveHeader: PHDocumentHeader,\n driveIdFromConfig?: string,\n): boolean {\n // If explicit drive ID is configured, use exact match\n if (driveIdFromConfig) {\n return (\n driveHeader.slug === driveIdFromConfig ||\n driveHeader.id === driveIdFromConfig\n );\n }\n\n // Otherwise, check if slug/id matches Vetra pattern\n // Matches \"vetra\" exactly or IDs starting with \"vetra-\" (case-insensitive)\n const matchesPattern = (identifier: string): boolean => {\n const lower = identifier.toLowerCase();\n return lower === \"vetra\" || lower.startsWith(\"vetra-\");\n };\n\n return matchesPattern(driveHeader.slug) || matchesPattern(driveHeader.id);\n}\n\nexport const codegenFactoryBuilder: ProcessorFactoryBuilder = (\n module: IProcessorHostModule,\n) => {\n return (driveHeader: PHDocumentHeader): ProcessorRecord[] => {\n const config = getConfig();\n const cwd = process.cwd();\n /* Use one instance of ts-morph project, which handles race conditions */\n const project = buildTsMorphProject(cwd);\n const processorsConfig = module.config ?? new Map<string, unknown>();\n const vetraConfig = processorsConfig.get(VETRA_PROCESSOR_CONFIG_KEY) as\n | VetraProcessorConfigType\n | undefined;\n\n // Check if this drive should use the Vetra processor\n if (!isDriveVetra(driveHeader, vetraConfig?.driveId)) {\n logger.debug(\n `Drive ${driveHeader.slug} is not a Vetra drive, skipping codegen processor`,\n );\n return [];\n }\n\n logger.info(\n `Drive ${driveHeader.slug} is a Vetra drive, using codegen processor`,\n );\n const processor = new CodegenProcessor(\n project,\n config,\n cwd,\n vetraConfig?.interactive,\n );\n return [\n {\n processor,\n filter: {\n branch: [\"main\"],\n documentId: [\"*\"],\n documentType: [\n \"powerhouse/document-model\",\n \"powerhouse/package\",\n \"powerhouse/document-editor\",\n \"powerhouse/subgraph\",\n \"powerhouse/processor\",\n \"powerhouse/app\",\n ],\n scope: [\"global\"],\n },\n },\n ];\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAMA,IAAsB,kBAAtB,MAAsC;CAMpC;CAEA,YACE,QACA,SACA;AAFU,OAAA,SAAA;AAGV,OAAK,UAAU;;;;;CAYjB,qBAAqB,cAA+B;AAClD,MAAI,OAAO,KAAK,2BAA2B,SACzC,QAAO,KAAK,2BAA2B;AAEzC,SAAO,KAAK,uBAAuB,SAAS,aAAa;;;;;CAM3D,4BAAs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BAAqD;EAC3D,MAAM,SAAS,WAAW;EAC1B,MAAM,MAAM,QAAQ,KAAK;EAEzB,MAAM,UAAU,oBAAoB,IAAI;EAExC,MAAM,eADmB,OAAO,0BAAU,IAAI,KAAsB,EAC/B,IAAI,2BAA2B;AAKpE,MAAI,CAAC,aAAa,aAAa,aAAa,QAAQ,EAAE;AACpD,UAAO,MACL,SAAS,YAAY,KAAK,mDAC3B;AACD,UAAO,EAAE;;AAGX,SAAO,KACL,SAAS,YAAY,KAAK,4CAC3B;AAOD,SAAO,CACL;GACE,WARc,IAAI,iBACpB,SACA,QACA,KACA,aAAa,YACd;GAIG,QAAQ;IACN,QAAQ,CAAC,OAAO;IAChB,YAAY,CAAC,IAAI;IACjB,cAAc;KACZ;KACA;KACA;KACA;KACA;KACA;KACD;IACD,OAAO,CAAC,SAAS;IAClB;GACF,CACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"module-dDKBr6QY.js","names":["z","vetraPackageBaseOperationsActions","utils","genUtils","customUtils"],"sources":["../document-models/vetra-package/v1/gen/schema/zod.ts","../document-models/vetra-package/v1/gen/base-operations/creators.ts","../document-models/vetra-package/v1/actions.ts","../document-models/vetra-package/v1/gen/document-model.ts","../document-models/vetra-package/v1/src/reducers/base-operations.ts","../document-models/vetra-package/v1/gen/reducer.ts","../document-models/vetra-package/v1/gen/document-type.ts","../document-models/vetra-package/v1/gen/document-schema.ts","../document-models/vetra-package/v1/gen/utils.ts","../document-models/vetra-package/v1/src/utils.ts","../document-models/vetra-package/v1/utils.ts","../document-models/vetra-package/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 AddPackageKeywordInput,\n Author,\n Keyword,\n RemovePackageKeywordInput,\n SetPackageAuthorInput,\n SetPackageAuthorNameInput,\n SetPackageAuthorWebsiteInput,\n SetPackageCategoryInput,\n SetPackageDescriptionInput,\n SetPackageGithubUrlInput,\n SetPackageNameInput,\n SetPackageNpmUrlInput,\n VetraPackageState,\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 function AddPackageKeywordInputSchema(): z.ZodObject<\n Properties<AddPackageKeywordInput>\n> {\n return z.object({\n id: z.string(),\n label: z.string(),\n });\n}\n\nexport function AuthorSchema(): z.ZodObject<Properties<Author>> {\n return z.object({\n __typename: z.literal(\"Author\").optional(),\n name: z.string().nullish(),\n website: z.url().nullish(),\n });\n}\n\nexport function KeywordSchema(): z.ZodObject<Properties<Keyword>> {\n return z.object({\n __typename: z.literal(\"Keyword\").optional(),\n id: z.string(),\n label: z.string(),\n });\n}\n\nexport function RemovePackageKeywordInputSchema(): z.ZodObject<\n Properties<RemovePackageKeywordInput>\n> {\n return z.object({\n id: z.string(),\n });\n}\n\nexport function SetPackageAuthorInputSchema(): z.ZodObject<\n Properties<SetPackageAuthorInput>\n> {\n return z.object({\n name: z.string().nullish(),\n website: z.url().nullish(),\n });\n}\n\nexport function SetPackageAuthorNameInputSchema(): z.ZodObject<\n Properties<SetPackageAuthorNameInput>\n> {\n return z.object({\n name: z.string(),\n });\n}\n\nexport function SetPackageAuthorWebsiteInputSchema(): z.ZodObject<\n Properties<SetPackageAuthorWebsiteInput>\n> {\n return z.object({\n website: z.url(),\n });\n}\n\nexport function SetPackageCategoryInputSchema(): z.ZodObject<\n Properties<SetPackageCategoryInput>\n> {\n return z.object({\n category: z.string(),\n });\n}\n\nexport function SetPackageDescriptionInputSchema(): z.ZodObject<\n Properties<SetPackageDescriptionInput>\n> {\n return z.object({\n description: z.string(),\n });\n}\n\nexport function SetPackageGithubUrlInputSchema(): z.ZodObject<\n Properties<SetPackageGithubUrlInput>\n> {\n return z.object({\n url: z.url(),\n });\n}\n\nexport function SetPackageNameInputSchema(): z.ZodObject<\n Properties<SetPackageNameInput>\n> {\n return z.object({\n name: z.string(),\n });\n}\n\nexport function SetPackageNpmUrlInputSchema(): z.ZodObject<\n Properties<SetPackageNpmUrlInput>\n> {\n return z.object({\n url: z.url(),\n });\n}\n\nexport function VetraPackageStateSchema(): z.ZodObject<\n Properties<VetraPackageState>\n> {\n return z.object({\n __typename: z.literal(\"VetraPackageState\").optional(),\n author: z.lazy(() => AuthorSchema()),\n category: z.string().nullish(),\n description: z.string().nullish(),\n githubUrl: z.url().nullish(),\n keywords: z.array(z.lazy(() => KeywordSchema())),\n name: z.string().nullish(),\n npmUrl: z.url().nullish(),\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 AddPackageKeywordInputSchema,\n RemovePackageKeywordInputSchema,\n SetPackageAuthorInputSchema,\n SetPackageAuthorNameInputSchema,\n SetPackageAuthorWebsiteInputSchema,\n SetPackageCategoryInputSchema,\n SetPackageDescriptionInputSchema,\n SetPackageGithubUrlInputSchema,\n SetPackageNameInputSchema,\n SetPackageNpmUrlInputSchema,\n} from \"../schema/zod.js\";\nimport type {\n AddPackageKeywordInput,\n RemovePackageKeywordInput,\n SetPackageAuthorInput,\n SetPackageAuthorNameInput,\n SetPackageAuthorWebsiteInput,\n SetPackageCategoryInput,\n SetPackageDescriptionInput,\n SetPackageGithubUrlInput,\n SetPackageNameInput,\n SetPackageNpmUrlInput,\n} from \"../types.js\";\nimport type {\n AddPackageKeywordAction,\n RemovePackageKeywordAction,\n SetPackageAuthorAction,\n SetPackageAuthorNameAction,\n SetPackageAuthorWebsiteAction,\n SetPackageCategoryAction,\n SetPackageDescriptionAction,\n SetPackageGithubUrlAction,\n SetPackageNameAction,\n SetPackageNpmUrlAction,\n} from \"./actions.js\";\n\nexport const setPackageName = (input: SetPackageNameInput) =>\n createAction<SetPackageNameAction>(\n \"SET_PACKAGE_NAME\",\n { ...input },\n undefined,\n SetPackageNameInputSchema,\n \"global\",\n );\n\nexport const setPackageDescription = (input: SetPackageDescriptionInput) =>\n createAction<SetPackageDescriptionAction>(\n \"SET_PACKAGE_DESCRIPTION\",\n { ...input },\n undefined,\n SetPackageDescriptionInputSchema,\n \"global\",\n );\n\nexport const setPackageCategory = (input: SetPackageCategoryInput) =>\n createAction<SetPackageCategoryAction>(\n \"SET_PACKAGE_CATEGORY\",\n { ...input },\n undefined,\n SetPackageCategoryInputSchema,\n \"global\",\n );\n\nexport const setPackageAuthor = (input: SetPackageAuthorInput) =>\n createAction<SetPackageAuthorAction>(\n \"SET_PACKAGE_AUTHOR\",\n { ...input },\n undefined,\n SetPackageAuthorInputSchema,\n \"global\",\n );\n\nexport const setPackageAuthorName = (input: SetPackageAuthorNameInput) =>\n createAction<SetPackageAuthorNameAction>(\n \"SET_PACKAGE_AUTHOR_NAME\",\n { ...input },\n undefined,\n SetPackageAuthorNameInputSchema,\n \"global\",\n );\n\nexport const setPackageAuthorWebsite = (input: SetPackageAuthorWebsiteInput) =>\n createAction<SetPackageAuthorWebsiteAction>(\n \"SET_PACKAGE_AUTHOR_WEBSITE\",\n { ...input },\n undefined,\n SetPackageAuthorWebsiteInputSchema,\n \"global\",\n );\n\nexport const addPackageKeyword = (input: AddPackageKeywordInput) =>\n createAction<AddPackageKeywordAction>(\n \"ADD_PACKAGE_KEYWORD\",\n { ...input },\n undefined,\n AddPackageKeywordInputSchema,\n \"global\",\n );\n\nexport const removePackageKeyword = (input: RemovePackageKeywordInput) =>\n createAction<RemovePackageKeywordAction>(\n \"REMOVE_PACKAGE_KEYWORD\",\n { ...input },\n undefined,\n RemovePackageKeywordInputSchema,\n \"global\",\n );\n\nexport const setPackageGithubUrl = (input: SetPackageGithubUrlInput) =>\n createAction<SetPackageGithubUrlAction>(\n \"SET_PACKAGE_GITHUB_URL\",\n { ...input },\n undefined,\n SetPackageGithubUrlInputSchema,\n \"global\",\n );\n\nexport const setPackageNpmUrl = (input: SetPackageNpmUrlInput) =>\n createAction<SetPackageNpmUrlAction>(\n \"SET_PACKAGE_NPM_URL\",\n { ...input },\n undefined,\n SetPackageNpmUrlInputSchema,\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 { vetraPackageBaseOperationsActions } from \"./gen/creators.js\";\n\n/** Actions for the VetraPackage document model */\n\nexport const actions = { ...baseActions, ...vetraPackageBaseOperationsActions };\n","import type { DocumentModelGlobalState } from \"document-model\";\n\nexport const documentModel: DocumentModelGlobalState = {\n id: \"powerhouse/package\",\n name: \"Vetra Package\",\n author: {\n name: \"Powerhouse\",\n website: \"https://powerhouse.inc\",\n },\n extension: \".pkg\",\n description:\n \"Manifest for a Vetra Reactor Package: bundles the metadata (name, description, category, author, keywords, source links) used to publish and discover the package in the Powerhouse ecosystem. Create one Vetra Package document per project; the document models, editors, processors, and subgraphs you add to the project are registered against this package at build time.\",\n specifications: [\n {\n state: {\n local: {\n schema: \"\",\n examples: [],\n initialValue: \"\",\n },\n global: {\n schema:\n '\"\"\"\\nPackage metadata used to publish a Vetra Reactor Package to npm and surface\\nit inside Connect/Switchboard. All fields are optional so a package can be\\ncreated empty and filled in incrementally during development.\\n\"\"\"\\ntype VetraPackageState {\\n \"\"\"Human-readable package name (e.g. \\'Pizza Plaza\\'). Distinct from the npm package id.\"\"\"\\n name: String\\n \"\"\"One-paragraph summary of what the package provides. Shown on package listing pages.\"\"\"\\n description: String\\n \"\"\"Free-form category label used to group packages in directories (e.g. \\'Finance\\', \\'Productivity\\').\"\"\"\\n category: String\\n \"\"\"Author/maintainer information surfaced in the published package metadata.\"\"\"\\n author: Author!\\n \"\"\"Search keywords associated with the package. Each keyword has a stable id so it can be removed individually.\"\"\"\\n keywords: [Keyword!]!\\n \"\"\"Public source code URL (typically a GitHub repository).\"\"\"\\n githubUrl: URL\\n \"\"\"Published npm package URL. Set once the package has been released.\"\"\"\\n npmUrl: URL\\n}\\n\\n\"\"\"Author/maintainer of the Vetra Package.\"\"\"\\ntype Author {\\n \"\"\"Display name of the author or organization.\"\"\"\\n name: String\\n \"\"\"Author\\'s website URL.\"\"\"\\n website: URL\\n}\\n\\n\"\"\"A single search keyword attached to the package.\"\"\"\\ntype Keyword {\\n \"\"\"Stable identifier for the keyword entry; used to remove it.\"\"\"\\n id: OID!\\n \"\"\"Display label for the keyword (e.g. \\'invoicing\\', \\'defi\\').\"\"\"\\n label: String!\\n}',\n examples: [],\n initialValue:\n '{\\n \"name\": null,\\n \"description\": null,\\n \"category\": null,\\n \"author\": {\\n \"name\": null,\\n \"website\": null\\n },\\n \"keywords\": [],\\n \"githubUrl\": null,\\n \"npmUrl\": null\\n}',\n },\n },\n modules: [\n {\n id: \"a6156f32-8120-43a5-be8b-51c7feaa3460\",\n name: \"base_operations\",\n description:\n \"Setters for the package's identity, author, keywords, and source/distribution links.\",\n operations: [\n {\n id: \"33f2eab7-9e07-497f-a4e6-53e50968c3c9\",\n name: \"SET_PACKAGE_NAME\",\n description:\n \"Set the human-readable package name shown in listings and the Connect UI.\",\n schema: \"input SetPackageNameInput {\\n name: String!\\n}\",\n template: \"\",\n reducer: \"\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"a07bee80-c2a8-40d7-891b-822ee298d7d9\",\n name: \"SET_PACKAGE_DESCRIPTION\",\n description:\n \"Set the one-paragraph summary describing what the package does.\",\n schema:\n \"input SetPackageDescriptionInput {\\n description: String!\\n}\",\n template: \"\",\n reducer: \"\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"f3ad82f8-580a-4c6e-b930-e203cda998bb\",\n name: \"SET_PACKAGE_CATEGORY\",\n description:\n 'Set the category label used to group the package in directories (e.g. \"Finance\", \"Productivity\").',\n schema: \"input SetPackageCategoryInput {\\n category: String!\\n}\",\n template: \"\",\n reducer: \"\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"67f43579-ce98-47e6-bf48-27c0f44818b9\",\n name: \"SET_PACKAGE_AUTHOR\",\n description:\n \"Replace the author block in a single call. Either field may be omitted to clear it.\",\n schema:\n \"input SetPackageAuthorInput {\\n name: OID\\n website: URL\\n}\",\n template: \"\",\n reducer: \"\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"94ba44c4-9627-405e-9ea2-34e9da1c283a\",\n name: \"SET_PACKAGE_AUTHOR_NAME\",\n description:\n \"Set only the author's display name without touching the website field.\",\n schema: \"input SetPackageAuthorNameInput {\\n name: String!\\n}\",\n template: \"\",\n reducer: \"\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"3d5c08df-6c14-480b-915b-875941979fd0\",\n name: \"SET_PACKAGE_AUTHOR_WEBSITE\",\n description:\n \"Set only the author's website URL without touching the name field.\",\n schema:\n \"input SetPackageAuthorWebsiteInput {\\n website: URL!\\n}\",\n template: \"\",\n reducer: \"\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"ed95f841-6fd0-4552-898d-e915599b7495\",\n name: \"ADD_PACKAGE_KEYWORD\",\n description:\n \"Append a search keyword. Caller supplies a stable id so the entry can be removed later.\",\n schema:\n \"input AddPackageKeywordInput {\\n id: String!\\n label: String!\\n}\",\n template: \"\",\n reducer: \"\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"83c4db24-bd2f-424d-9e26-751580d6307b\",\n name: \"REMOVE_PACKAGE_KEYWORD\",\n description:\n \"Remove a keyword by its id. No-op if the id does not exist.\",\n schema: \"input RemovePackageKeywordInput {\\n id: String!\\n}\",\n template: \"\",\n reducer: \"\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"83a90530-8535-4ea7-ab53-7865532398f7\",\n name: \"SET_PACKAGE_GITHUB_URL\",\n description:\n \"Set the public source code URL (typically a GitHub repository).\",\n schema: \"input SetPackageGithubUrlInput {\\n url: URL!\\n}\",\n template: \"\",\n reducer: \"\",\n errors: [],\n examples: [],\n scope: \"global\",\n },\n {\n id: \"e789859a-01ee-4b60-8e7e-a3ad928a26d1\",\n name: \"SET_PACKAGE_NPM_URL\",\n description:\n \"Set the published npm package URL once the package has been released.\",\n schema: \"input SetPackageNpmUrlInput {\\n url: URL!\\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 type { VetraPackageBaseOperationsOperations } from \"document-models/vetra-package/v1\";\n\nexport const vetraPackageBaseOperationsOperations: VetraPackageBaseOperationsOperations =\n {\n setPackageNameOperation(state, action, dispatch) {\n state.name = action.input.name;\n },\n setPackageDescriptionOperation(state, action, dispatch) {\n state.description = action.input.description;\n },\n setPackageCategoryOperation(state, action, dispatch) {\n state.category = action.input.category;\n },\n setPackageAuthorOperation(state, action, dispatch) {\n state.author = {\n name: action.input.name ?? null,\n website: action.input.website ?? null,\n };\n },\n setPackageAuthorNameOperation(state, action, dispatch) {\n state.author.name = action.input.name;\n },\n setPackageAuthorWebsiteOperation(state, action, dispatch) {\n state.author.website = action.input.website;\n },\n addPackageKeywordOperation(state, action, dispatch) {\n // Check for duplicate ID\n const existingId = state.keywords.find(\n (keyword) => keyword.id === action.input.id,\n );\n if (existingId) {\n throw new Error(`Keyword with id \"${action.input.id}\" already exists`);\n }\n\n state.keywords.push(action.input);\n },\n removePackageKeywordOperation(state, action, dispatch) {\n state.keywords = state.keywords.filter(\n (keyword) => keyword.id !== action.input.id,\n );\n },\n setPackageGithubUrlOperation(state, action, dispatch) {\n state.githubUrl = action.input.url;\n },\n setPackageNpmUrlOperation(state, action, dispatch) {\n state.npmUrl = action.input.url;\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 { VetraPackagePHState } from \"document-models/vetra-package/v1\";\n\nimport { vetraPackageBaseOperationsOperations } from \"../src/reducers/base-operations.js\";\n\nimport {\n AddPackageKeywordInputSchema,\n RemovePackageKeywordInputSchema,\n SetPackageAuthorInputSchema,\n SetPackageAuthorNameInputSchema,\n SetPackageAuthorWebsiteInputSchema,\n SetPackageCategoryInputSchema,\n SetPackageDescriptionInputSchema,\n SetPackageGithubUrlInputSchema,\n SetPackageNameInputSchema,\n SetPackageNpmUrlInputSchema,\n} from \"./schema/zod.js\";\n\nconst stateReducer: StateReducer<VetraPackagePHState> = (\n state,\n action,\n dispatch,\n) => {\n if (isDocumentAction(action)) {\n return state;\n }\n switch (action.type) {\n case \"SET_PACKAGE_NAME\": {\n SetPackageNameInputSchema().parse(action.input);\n\n vetraPackageBaseOperationsOperations.setPackageNameOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_PACKAGE_DESCRIPTION\": {\n SetPackageDescriptionInputSchema().parse(action.input);\n\n vetraPackageBaseOperationsOperations.setPackageDescriptionOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_PACKAGE_CATEGORY\": {\n SetPackageCategoryInputSchema().parse(action.input);\n\n vetraPackageBaseOperationsOperations.setPackageCategoryOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_PACKAGE_AUTHOR\": {\n SetPackageAuthorInputSchema().parse(action.input);\n\n vetraPackageBaseOperationsOperations.setPackageAuthorOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_PACKAGE_AUTHOR_NAME\": {\n SetPackageAuthorNameInputSchema().parse(action.input);\n\n vetraPackageBaseOperationsOperations.setPackageAuthorNameOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_PACKAGE_AUTHOR_WEBSITE\": {\n SetPackageAuthorWebsiteInputSchema().parse(action.input);\n\n vetraPackageBaseOperationsOperations.setPackageAuthorWebsiteOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"ADD_PACKAGE_KEYWORD\": {\n AddPackageKeywordInputSchema().parse(action.input);\n\n vetraPackageBaseOperationsOperations.addPackageKeywordOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"REMOVE_PACKAGE_KEYWORD\": {\n RemovePackageKeywordInputSchema().parse(action.input);\n\n vetraPackageBaseOperationsOperations.removePackageKeywordOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_PACKAGE_GITHUB_URL\": {\n SetPackageGithubUrlInputSchema().parse(action.input);\n\n vetraPackageBaseOperationsOperations.setPackageGithubUrlOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_PACKAGE_NPM_URL\": {\n SetPackageNpmUrlInputSchema().parse(action.input);\n\n vetraPackageBaseOperationsOperations.setPackageNpmUrlOperation(\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<VetraPackagePHState> =\n createReducer(stateReducer);\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nexport const vetraPackageDocumentType = \"powerhouse/package\";\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 { vetraPackageDocumentType } from \"./document-type.js\";\nimport { VetraPackageStateSchema } from \"./schema/zod.js\";\nimport type { VetraPackageDocument, VetraPackagePHState } from \"./types.js\";\n\n/** Schema for validating the header object of a VetraPackage document */\nexport const VetraPackageDocumentHeaderSchema = BaseDocumentHeaderSchema.extend(\n {\n documentType: z.literal(vetraPackageDocumentType),\n },\n);\n\n/** Schema for validating the state object of a VetraPackage document */\nexport const VetraPackagePHStateSchema = BaseDocumentStateSchema.extend({\n global: VetraPackageStateSchema(),\n});\n\nexport const VetraPackageDocumentSchema = z.object({\n header: VetraPackageDocumentHeaderSchema,\n state: VetraPackagePHStateSchema,\n initialState: VetraPackagePHStateSchema,\n});\n\n/** Simple helper function to check if a state object is a VetraPackage document state object */\nexport function isVetraPackageState(\n state: unknown,\n): state is VetraPackagePHState {\n return VetraPackagePHStateSchema.safeParse(state).success;\n}\n\n/** Simple helper function to assert that a document state object is a VetraPackage document state object */\nexport function assertIsVetraPackageState(\n state: unknown,\n): asserts state is VetraPackagePHState {\n VetraPackagePHStateSchema.parse(state);\n}\n\n/** Simple helper function to check if a document is a VetraPackage document */\nexport function isVetraPackageDocument(\n document: unknown,\n): document is VetraPackageDocument {\n return VetraPackageDocumentSchema.safeParse(document).success;\n}\n\n/** Simple helper function to assert that a document is a VetraPackage document */\nexport function assertIsVetraPackageDocument(\n document: unknown,\n): asserts document is VetraPackageDocument {\n VetraPackageDocumentSchema.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 assertIsVetraPackageDocument,\n assertIsVetraPackageState,\n isVetraPackageDocument,\n isVetraPackageState,\n} from \"./document-schema.js\";\nimport { vetraPackageDocumentType } from \"./document-type.js\";\nimport { reducer } from \"./reducer.js\";\nimport type {\n VetraPackageGlobalState,\n VetraPackageLocalState,\n VetraPackagePHState,\n} from \"./types.js\";\n\nexport const initialGlobalState: VetraPackageGlobalState = {\n name: null,\n description: null,\n category: null,\n author: {\n name: null,\n website: null,\n },\n keywords: [],\n githubUrl: null,\n npmUrl: null,\n};\nexport const initialLocalState: VetraPackageLocalState = {};\n\nexport const utils: DocumentModelUtils<VetraPackagePHState> = {\n fileExtension: \".pkg\",\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 = vetraPackageDocumentType;\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 isVetraPackageState(state);\n },\n assertIsStateOfType(state) {\n return assertIsVetraPackageState(state);\n },\n isDocumentOfType(document) {\n return isVetraPackageDocument(document);\n },\n assertIsDocumentOfType(document) {\n return assertIsVetraPackageDocument(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 { VetraPackagePHState } from \"./gen/types.js\";\nimport { utils as genUtils } from \"./gen/utils.js\";\nimport * as customUtils from \"./src/utils.js\";\n\n/** Utils for the VetraPackage document model */\nexport const utils: DocumentModelUtils<VetraPackagePHState> = {\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 { VetraPackagePHState } from \"./gen/types.js\";\nimport { utils } from \"./utils.js\";\n\n/** Document model module for the VetraPackage document type */\nexport const VetraPackage = {\n version: 1,\n reducer,\n actions,\n utils,\n documentModel: createState(defaultBaseState(), documentModel),\n} as const satisfies DocumentModelModule<VetraPackagePHState>;\n"],"mappings":";;;;;AAyBA,MAAa,uBAAuB,MAClC,MAAM,KAAA,KAAa,MAAM;AAE3B,MAAa,0BAA0BA,IACpC,KAAK,CACL,QAAQ,MAAM,oBAAoB,EAAE,CAAC;AAExC,SAAgB,+BAEd;AACA,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nB,SAAO,oBAAoB,MAAM;;CAEnC,oBAAoB,OAAO;AACzB,SAAO,0BAA0B,MAAM;;CAEzC,iBAAiB,UAAU;AACzB,SAAO,uBAAuB,SAAS;;CAEzC,uBAAuB,UAAU;AAC/B,SAAO,6BAA6B,SAAS;;CAEhD;;;;;;;AEnED,MAAa,QAAiD;CAC5D,GAAGC;CACH,GAAGC;CACJ;;;;ACAD,MAAa,eAAe;CAC1B,SAAS;CACT;CACA;CACA;CACA,eAAe,YAAY,kBAAkB,EAAE,cAAc;CAC9D"}
@@ -1,8 +0,0 @@
1
- import { t as vetraReadModelFactoryBuilder } from "./factory-CjFOr45i.js";
2
- import { t as codegenFactoryBuilder } from "./factory-KNJv2C2k.js";
3
- //#region processors/switchboard.ts
4
- const processorFactoryBuilders = [vetraReadModelFactoryBuilder, codegenFactoryBuilder];
5
- //#endregion
6
- export { processorFactoryBuilders };
7
-
8
- //# sourceMappingURL=switchboard-Ciqw67L4.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils-BRx88WW3.js","names":["z","appModuleBaseOperationsActions","appModuleDndOperationsActions"],"sources":["../document-models/app-module/v1/gen/schema/zod.ts","../document-models/app-module/v1/gen/base-operations/creators.ts","../document-models/app-module/v1/gen/dnd-operations/creators.ts","../document-models/app-module/v1/actions.ts","../document-models/app-module/v1/src/reducers/base-operations.ts","../document-models/app-module/v1/src/reducers/dnd-operations.ts","../document-models/app-module/v1/gen/reducer.ts","../document-models/app-module/v1/gen/document-type.ts","../document-models/app-module/v1/gen/document-schema.ts","../document-models/app-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 AppModuleState,\n RemoveDocumentTypeInput,\n SetAppNameInput,\n SetAppStatusInput,\n SetDocumentTypesInput,\n SetDragAndDropEnabledInput,\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 });\n}\n\nexport function AppModuleStateSchema(): z.ZodObject<\n Properties<AppModuleState>\n> {\n return z.object({\n __typename: z.literal(\"AppModuleState\").optional(),\n allowedDocumentTypes: z.array(z.string()).nullish(),\n isDragAndDropEnabled: z.boolean(),\n name: z.string(),\n status: StatusTypeSchema,\n });\n}\n\nexport function RemoveDocumentTypeInputSchema(): z.ZodObject<\n Properties<RemoveDocumentTypeInput>\n> {\n return z.object({\n documentType: z.string(),\n });\n}\n\nexport function SetAppNameInputSchema(): z.ZodObject<\n Properties<SetAppNameInput>\n> {\n return z.object({\n name: z.string(),\n });\n}\n\nexport function SetAppStatusInputSchema(): z.ZodObject<\n Properties<SetAppStatusInput>\n> {\n return z.object({\n status: StatusTypeSchema,\n });\n}\n\nexport function SetDocumentTypesInputSchema(): z.ZodObject<\n Properties<SetDocumentTypesInput>\n> {\n return z.object({\n documentTypes: z.array(z.string()),\n });\n}\n\nexport function SetDragAndDropEnabledInputSchema(): z.ZodObject<\n Properties<SetDragAndDropEnabledInput>\n> {\n return z.object({\n enabled: z.boolean(),\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 RemoveDocumentTypeInputSchema,\n SetAppNameInputSchema,\n SetAppStatusInputSchema,\n SetDocumentTypesInputSchema,\n} from \"../schema/zod.js\";\nimport type {\n AddDocumentTypeInput,\n RemoveDocumentTypeInput,\n SetAppNameInput,\n SetAppStatusInput,\n SetDocumentTypesInput,\n} from \"../types.js\";\nimport type {\n AddDocumentTypeAction,\n RemoveDocumentTypeAction,\n SetAppNameAction,\n SetAppStatusAction,\n SetDocumentTypesAction,\n} from \"./actions.js\";\n\nexport const setAppName = (input: SetAppNameInput) =>\n createAction<SetAppNameAction>(\n \"SET_APP_NAME\",\n { ...input },\n undefined,\n SetAppNameInputSchema,\n \"global\",\n );\n\nexport const setAppStatus = (input: SetAppStatusInput) =>\n createAction<SetAppStatusAction>(\n \"SET_APP_STATUS\",\n { ...input },\n undefined,\n SetAppStatusInputSchema,\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 setDocumentTypes = (input: SetDocumentTypesInput) =>\n createAction<SetDocumentTypesAction>(\n \"SET_DOCUMENT_TYPES\",\n { ...input },\n undefined,\n SetDocumentTypesInputSchema,\n \"global\",\n );\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { createAction } from \"document-model\";\nimport { SetDragAndDropEnabledInputSchema } from \"../schema/zod.js\";\nimport type { SetDragAndDropEnabledInput } from \"../types.js\";\nimport type { SetDragAndDropEnabledAction } from \"./actions.js\";\n\nexport const setDragAndDropEnabled = (input: SetDragAndDropEnabledInput) =>\n createAction<SetDragAndDropEnabledAction>(\n \"SET_DRAG_AND_DROP_ENABLED\",\n { ...input },\n undefined,\n SetDragAndDropEnabledInputSchema,\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 {\n appModuleBaseOperationsActions,\n appModuleDndOperationsActions,\n} from \"./gen/creators.js\";\n\n/** Actions for the AppModule document model */\n\nexport const actions = {\n ...baseActions,\n ...appModuleBaseOperationsActions,\n ...appModuleDndOperationsActions,\n};\n","import type { AppModuleBaseOperationsOperations } from \"document-models/app-module/v1\";\n\nexport const appModuleBaseOperationsOperations: AppModuleBaseOperationsOperations =\n {\n setAppNameOperation(state, action, dispatch) {\n const trimmedName = action.input.name.trim();\n if (trimmedName === \"\") {\n throw new Error(\"App name cannot be empty\");\n }\n state.name = trimmedName;\n },\n setAppStatusOperation(state, action, dispatch) {\n state.status = action.input.status;\n },\n addDocumentTypeOperation(state, action, dispatch) {\n const existingAllowedDocumentTypes = state.allowedDocumentTypes ?? [];\n const newDocumentType = action.input.documentType;\n const newAllowedDocumentTypesSet = new Set(\n existingAllowedDocumentTypes,\n ).add(newDocumentType);\n const newAllowedDocumentTypes = [...newAllowedDocumentTypesSet];\n state.allowedDocumentTypes = newAllowedDocumentTypes;\n },\n removeDocumentTypeOperation(state, action, dispatch) {\n const existingAllowedDocumentTypes = state.allowedDocumentTypes;\n const documentTypeToRemove = action.input.documentType;\n const newAllowedDocumentTypes = existingAllowedDocumentTypes?.filter(\n (dt) => dt !== documentTypeToRemove,\n );\n state.allowedDocumentTypes = newAllowedDocumentTypes ?? [];\n },\n setDocumentTypesOperation(state, action, dispatch) {\n state.allowedDocumentTypes = action.input.documentTypes;\n },\n };\n","import type { AppModuleDndOperationsOperations } from \"document-models/app-module/v1\";\n\nexport const appModuleDndOperationsOperations: AppModuleDndOperationsOperations =\n {\n setDragAndDropEnabledOperation(state, action, dispatch) {\n state.isDragAndDropEnabled = action.input.enabled;\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 { AppModulePHState } from \"document-models/app-module/v1\";\n\nimport { appModuleBaseOperationsOperations } from \"../src/reducers/base-operations.js\";\nimport { appModuleDndOperationsOperations } from \"../src/reducers/dnd-operations.js\";\n\nimport {\n AddDocumentTypeInputSchema,\n RemoveDocumentTypeInputSchema,\n SetAppNameInputSchema,\n SetAppStatusInputSchema,\n SetDocumentTypesInputSchema,\n SetDragAndDropEnabledInputSchema,\n} from \"./schema/zod.js\";\n\nconst stateReducer: StateReducer<AppModulePHState> = (\n state,\n action,\n dispatch,\n) => {\n if (isDocumentAction(action)) {\n return state;\n }\n switch (action.type) {\n case \"SET_APP_NAME\": {\n SetAppNameInputSchema().parse(action.input);\n\n appModuleBaseOperationsOperations.setAppNameOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_APP_STATUS\": {\n SetAppStatusInputSchema().parse(action.input);\n\n appModuleBaseOperationsOperations.setAppStatusOperation(\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 appModuleBaseOperationsOperations.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 appModuleBaseOperationsOperations.removeDocumentTypeOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_DOCUMENT_TYPES\": {\n SetDocumentTypesInputSchema().parse(action.input);\n\n appModuleBaseOperationsOperations.setDocumentTypesOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_DRAG_AND_DROP_ENABLED\": {\n SetDragAndDropEnabledInputSchema().parse(action.input);\n\n appModuleDndOperationsOperations.setDragAndDropEnabledOperation(\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<AppModulePHState> = createReducer(stateReducer);\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nexport const appModuleDocumentType = \"powerhouse/app\";\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 { appModuleDocumentType } from \"./document-type.js\";\nimport { AppModuleStateSchema } from \"./schema/zod.js\";\nimport type { AppModuleDocument, AppModulePHState } from \"./types.js\";\n\n/** Schema for validating the header object of a AppModule document */\nexport const AppModuleDocumentHeaderSchema = BaseDocumentHeaderSchema.extend({\n documentType: z.literal(appModuleDocumentType),\n});\n\n/** Schema for validating the state object of a AppModule document */\nexport const AppModulePHStateSchema = BaseDocumentStateSchema.extend({\n global: AppModuleStateSchema(),\n});\n\nexport const AppModuleDocumentSchema = z.object({\n header: AppModuleDocumentHeaderSchema,\n state: AppModulePHStateSchema,\n initialState: AppModulePHStateSchema,\n});\n\n/** Simple helper function to check if a state object is a AppModule document state object */\nexport function isAppModuleState(state: unknown): state is AppModulePHState {\n return AppModulePHStateSchema.safeParse(state).success;\n}\n\n/** Simple helper function to assert that a document state object is a AppModule document state object */\nexport function assertIsAppModuleState(\n state: unknown,\n): asserts state is AppModulePHState {\n AppModulePHStateSchema.parse(state);\n}\n\n/** Simple helper function to check if a document is a AppModule document */\nexport function isAppModuleDocument(\n document: unknown,\n): document is AppModuleDocument {\n return AppModuleDocumentSchema.safeParse(document).success;\n}\n\n/** Simple helper function to assert that a document is a AppModule document */\nexport function assertIsAppModuleDocument(\n document: unknown,\n): asserts document is AppModuleDocument {\n AppModuleDocumentSchema.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 assertIsAppModuleDocument,\n assertIsAppModuleState,\n isAppModuleDocument,\n isAppModuleState,\n} from \"./document-schema.js\";\nimport { appModuleDocumentType } from \"./document-type.js\";\nimport { reducer } from \"./reducer.js\";\nimport type {\n AppModuleGlobalState,\n AppModuleLocalState,\n AppModulePHState,\n} from \"./types.js\";\n\nexport const initialGlobalState: AppModuleGlobalState = {\n name: \"\",\n status: \"DRAFT\",\n allowedDocumentTypes: null,\n isDragAndDropEnabled: true,\n};\nexport const initialLocalState: AppModuleLocalState = {};\n\nexport const utils: DocumentModelUtils<AppModulePHState> = {\n fileExtension: \".app\",\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 = appModuleDocumentType;\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 isAppModuleState(state);\n },\n assertIsStateOfType(state) {\n return assertIsAppModuleState(state);\n },\n isDocumentOfType(document) {\n return isAppModuleDocument(document);\n },\n assertIsDocumentOfType(document) {\n return assertIsAppModuleDocument(document);\n },\n};\n"],"mappings":";;;;;AAoBA,MAAa,uBAAuB,MAClC,MAAM,KAAA,KAAa,MAAM;AAE3B,MAAa,0BAA0BA,IACpC,KAAK,CACL,QAAQ,MAAM,oBAAoB,EAAE,CAAC;AAExC,MAAa,mBAAmBA,IAAE,KAAK,CAAC,aAAa,QAAQ,CAAC;AAE9D,SAAgB,6BAEd;AACA,QAAOA,IAAE,OAAO,EACd,cAAcA,IAAE,QAAQ,EACzB,CAAC;;AAGJ,SAAgB,uBAEd;AACA,QAAOA,IAAE,OAAO;EACd,YAAYA,IAAE,QAAQ,iBAAiB,CAAC,UAAU;EAClD,sBAAsBA,IAAE,MAAMA,IAAE,QAA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ACnB,SAAO,kBAAkB,OAAO,QAAQ;;CAE1C,cAAc,OAAO;AACnB,SAAO,iBAAiB,MAAM;;CAEhC,oBAAoB,OAAO;AACzB,SAAO,uBAAuB,MAAM;;CAEtC,iBAAiB,UAAU;AACzB,SAAO,oBAAoB,SAAS;;CAEtC,uBAAuB,UAAU;AAC/B,SAAO,0BAA0B,SAAS;;CAE7C"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils-Byjf33qt.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 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"],"mappings":";;;;;;AAsBA,MAAa,uBAAuB,MAClC,MAAM,KAAA,KAAa,MAAM;AAE3B,MAAa,0BAA0BA,IACpC,K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M;;CAEtC,oBAAoB,OAAO;AACzB,SAAO,6BAA6B,MAAM;;CAE5C,iBAAiB,UAAU;AACzB,SAAO,0BAA0B,SAAS;;CAE5C,uBAAuB,UAAU;AAC/B,SAAO,gCAAgC,SAAS;;CAEnD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils-CWO5kDus.js","names":["z","subgraphModuleBaseOperationsActions"],"sources":["../document-models/subgraph-module/v1/gen/schema/zod.ts","../document-models/subgraph-module/v1/gen/base-operations/creators.ts","../document-models/subgraph-module/v1/actions.ts","../document-models/subgraph-module/v1/src/reducers/base-operations.ts","../document-models/subgraph-module/v1/gen/reducer.ts","../document-models/subgraph-module/v1/gen/document-type.ts","../document-models/subgraph-module/v1/gen/document-schema.ts","../document-models/subgraph-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 SetSubgraphNameInput,\n SetSubgraphStatusInput,\n StatusType,\n SubgraphModuleState,\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 SetSubgraphNameInputSchema(): z.ZodObject<\n Properties<SetSubgraphNameInput>\n> {\n return z.object({\n name: z.string(),\n });\n}\n\nexport function SetSubgraphStatusInputSchema(): z.ZodObject<\n Properties<SetSubgraphStatusInput>\n> {\n return z.object({\n status: StatusTypeSchema,\n });\n}\n\nexport function SubgraphModuleStateSchema(): z.ZodObject<\n Properties<SubgraphModuleState>\n> {\n return z.object({\n __typename: z.literal(\"SubgraphModuleState\").optional(),\n name: z.string(),\n status: StatusTypeSchema,\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 SetSubgraphNameInputSchema,\n SetSubgraphStatusInputSchema,\n} from \"../schema/zod.js\";\nimport type { SetSubgraphNameInput, SetSubgraphStatusInput } from \"../types.js\";\nimport type {\n SetSubgraphNameAction,\n SetSubgraphStatusAction,\n} from \"./actions.js\";\n\nexport const setSubgraphName = (input: SetSubgraphNameInput) =>\n createAction<SetSubgraphNameAction>(\n \"SET_SUBGRAPH_NAME\",\n { ...input },\n undefined,\n SetSubgraphNameInputSchema,\n \"global\",\n );\n\nexport const setSubgraphStatus = (input: SetSubgraphStatusInput) =>\n createAction<SetSubgraphStatusAction>(\n \"SET_SUBGRAPH_STATUS\",\n { ...input },\n undefined,\n SetSubgraphStatusInputSchema,\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 { subgraphModuleBaseOperationsActions } from \"./gen/creators.js\";\n\n/** Actions for the SubgraphModule document model */\n\nexport const actions = {\n ...baseActions,\n ...subgraphModuleBaseOperationsActions,\n};\n","import type { SubgraphModuleBaseOperationsOperations } from \"document-models/subgraph-module/v1\";\n\nexport const subgraphModuleBaseOperationsOperations: SubgraphModuleBaseOperationsOperations =\n {\n setSubgraphNameOperation(state, action, dispatch) {\n const trimmedName = action.input.name.trim();\n if (trimmedName === \"\") {\n throw new Error(\"Subgraph name cannot be empty\");\n }\n state.name = trimmedName;\n },\n setSubgraphStatusOperation(state, action, dispatch) {\n state.status = action.input.status;\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 { SubgraphModulePHState } from \"document-models/subgraph-module/v1\";\n\nimport { subgraphModuleBaseOperationsOperations } from \"../src/reducers/base-operations.js\";\n\nimport {\n SetSubgraphNameInputSchema,\n SetSubgraphStatusInputSchema,\n} from \"./schema/zod.js\";\n\nconst stateReducer: StateReducer<SubgraphModulePHState> = (\n state,\n action,\n dispatch,\n) => {\n if (isDocumentAction(action)) {\n return state;\n }\n switch (action.type) {\n case \"SET_SUBGRAPH_NAME\": {\n SetSubgraphNameInputSchema().parse(action.input);\n\n subgraphModuleBaseOperationsOperations.setSubgraphNameOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_SUBGRAPH_STATUS\": {\n SetSubgraphStatusInputSchema().parse(action.input);\n\n subgraphModuleBaseOperationsOperations.setSubgraphStatusOperation(\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<SubgraphModulePHState> =\n createReducer(stateReducer);\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nexport const subgraphModuleDocumentType = \"powerhouse/subgraph\";\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 { subgraphModuleDocumentType } from \"./document-type.js\";\nimport { SubgraphModuleStateSchema } from \"./schema/zod.js\";\nimport type { SubgraphModuleDocument, SubgraphModulePHState } from \"./types.js\";\n\n/** Schema for validating the header object of a SubgraphModule document */\nexport const SubgraphModuleDocumentHeaderSchema =\n BaseDocumentHeaderSchema.extend({\n documentType: z.literal(subgraphModuleDocumentType),\n });\n\n/** Schema for validating the state object of a SubgraphModule document */\nexport const SubgraphModulePHStateSchema = BaseDocumentStateSchema.extend({\n global: SubgraphModuleStateSchema(),\n});\n\nexport const SubgraphModuleDocumentSchema = z.object({\n header: SubgraphModuleDocumentHeaderSchema,\n state: SubgraphModulePHStateSchema,\n initialState: SubgraphModulePHStateSchema,\n});\n\n/** Simple helper function to check if a state object is a SubgraphModule document state object */\nexport function isSubgraphModuleState(\n state: unknown,\n): state is SubgraphModulePHState {\n return SubgraphModulePHStateSchema.safeParse(state).success;\n}\n\n/** Simple helper function to assert that a document state object is a SubgraphModule document state object */\nexport function assertIsSubgraphModuleState(\n state: unknown,\n): asserts state is SubgraphModulePHState {\n SubgraphModulePHStateSchema.parse(state);\n}\n\n/** Simple helper function to check if a document is a SubgraphModule document */\nexport function isSubgraphModuleDocument(\n document: unknown,\n): document is SubgraphModuleDocument {\n return SubgraphModuleDocumentSchema.safeParse(document).success;\n}\n\n/** Simple helper function to assert that a document is a SubgraphModule document */\nexport function assertIsSubgraphModuleDocument(\n document: unknown,\n): asserts document is SubgraphModuleDocument {\n SubgraphModuleDocumentSchema.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 assertIsSubgraphModuleDocument,\n assertIsSubgraphModuleState,\n isSubgraphModuleDocument,\n isSubgraphModuleState,\n} from \"./document-schema.js\";\nimport { subgraphModuleDocumentType } from \"./document-type.js\";\nimport { reducer } from \"./reducer.js\";\nimport type {\n SubgraphModuleGlobalState,\n SubgraphModuleLocalState,\n SubgraphModulePHState,\n} from \"./types.js\";\n\nexport const initialGlobalState: SubgraphModuleGlobalState = {\n name: \"\",\n status: \"DRAFT\",\n};\nexport const initialLocalState: SubgraphModuleLocalState = {};\n\nexport const utils: DocumentModelUtils<SubgraphModulePHState> = {\n fileExtension: \".subgraph\",\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 = subgraphModuleDocumentType;\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 isSubgraphModuleState(state);\n },\n assertIsStateOfType(state) {\n return assertIsSubgraphModuleState(state);\n },\n isDocumentOfType(document) {\n return isSubgraphModuleDocument(document);\n },\n assertIsDocumentOfType(document) {\n return assertIsSubgraphModuleDocument(document);\n },\n};\n"],"mappings":";;;;;AAgBA,MAAa,uBAAuB,MAClC,MAAM,KAAA,KAAa,MAAM;AAE3B,MAAa,0BAA0BA,IACpC,KAAK,CACL,QAAQ,MAAM,oBAAoB,EAAE,CAAC;AAExC,MAAa,mBAAmBA,IAAE,KAAK,CAAC,aAAa,QAAQ,CAAC;AAE9D,SAAgB,6BAEd;AACA,QAAOA,IAAE,OAAO,EACd,MAAMA,IAAE,QAAQ,EACjB,CAAC;;AAGJ,SAAgB,+BAEd;AACA,QAAOA,IAAE,OAAO,EACd,QAAQ,kBACT,CAAC;;AAGJ,SAAgB,4BAEd;AACA,QAAOA,IAAE,OAAO;EACd,YAAYA,IAAE,QAAQ,sBAAsB,CAAC,UAAU;EACvD,MAAMA,IAAE,QAAQ;EAChB,QAAQ;EACT,CAAC;;;;;;;;;;;;ACjCJ,MAAa,mBAAmB,UAC9B,aACE,qBACA,EAAE,GAAG,OAAO,EACZ,KAAA,GACA,4BACA,SACD;AAEH,MAAa,qBAAqB,UAChC,aACE,uBACA,EAAE,GAAG,OAAO,EACZ,KAAA,GACA,8BACA,SACD;;;;;;;;ACtBH,MAAa,UAAU;CACrB,GAAG;CACH,GAAGC;CACJ;;;ACVD,MAAa,yCACX;CACE,yBAAyB,OAAO,QAAQ,UAAU;EAChD,MAAM,cAAc,OAAO,MAAM,KAAK,MAAM;AAC5C,MAAI,gBAAgB,GAClB,OAAM,IAAI,MAAM,gCAAgC;AAElD,QAAM,OAAO;;CAEf,2BAA2B,OAAO,QAAQ,UAAU;AAClD,QAAM,SAAS,OAAO,MAAM;;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AAG/B,WAAS,OAAO,KAAK,YAAY;AAEjC,SAAO;;CAET,iBAAiB,UAAU,OAAO;AAChC,SAAO,qBAAqB,UAAU,MAAM;;CAE9C,cAAc,OAAO;AACnB,SAAO,kBAAkB,OAAO,QAAQ;;CAE1C,cAAc,OAAO;AACnB,SAAO,sBAAsB,MAAM;;CAErC,oBAAoB,OAAO;AACzB,SAAO,4BAA4B,MAAM;;CAE3C,iBAAiB,UAAU;AACzB,SAAO,yBAAyB,SAAS;;CAE3C,uBAAuB,UAAU;AAC/B,SAAO,+BAA+B,SAAS;;CAElD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils-CnZc-0E4.js","names":["z","documentEditorBaseOperationsActions"],"sources":["../document-models/document-editor/v1/gen/schema/zod.ts","../document-models/document-editor/v1/gen/base-operations/creators.ts","../document-models/document-editor/v1/actions.ts","../document-models/document-editor/v1/src/reducers/base-operations.ts","../document-models/document-editor/v1/gen/reducer.ts","../document-models/document-editor/v1/gen/document-type.ts","../document-models/document-editor/v1/gen/document-schema.ts","../document-models/document-editor/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 DocumentEditorState,\n DocumentTypeItem,\n RemoveDocumentTypeInput,\n SetEditorNameInput,\n SetEditorStatusInput,\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 DocumentEditorStateSchema(): z.ZodObject<\n Properties<DocumentEditorState>\n> {\n return z.object({\n __typename: z.literal(\"DocumentEditorState\").optional(),\n documentTypes: z.array(z.lazy(() => DocumentTypeItemSchema())),\n name: z.string(),\n status: StatusTypeSchema,\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 RemoveDocumentTypeInputSchema(): z.ZodObject<\n Properties<RemoveDocumentTypeInput>\n> {\n return z.object({\n id: z.string(),\n });\n}\n\nexport function SetEditorNameInputSchema(): z.ZodObject<\n Properties<SetEditorNameInput>\n> {\n return z.object({\n name: z.string(),\n });\n}\n\nexport function SetEditorStatusInputSchema(): z.ZodObject<\n Properties<SetEditorStatusInput>\n> {\n return z.object({\n status: StatusTypeSchema,\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 RemoveDocumentTypeInputSchema,\n SetEditorNameInputSchema,\n SetEditorStatusInputSchema,\n} from \"../schema/zod.js\";\nimport type {\n AddDocumentTypeInput,\n RemoveDocumentTypeInput,\n SetEditorNameInput,\n SetEditorStatusInput,\n} from \"../types.js\";\nimport type {\n AddDocumentTypeAction,\n RemoveDocumentTypeAction,\n SetEditorNameAction,\n SetEditorStatusAction,\n} from \"./actions.js\";\n\nexport const setEditorName = (input: SetEditorNameInput) =>\n createAction<SetEditorNameAction>(\n \"SET_EDITOR_NAME\",\n { ...input },\n undefined,\n SetEditorNameInputSchema,\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 setEditorStatus = (input: SetEditorStatusInput) =>\n createAction<SetEditorStatusAction>(\n \"SET_EDITOR_STATUS\",\n { ...input },\n undefined,\n SetEditorStatusInputSchema,\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 { documentEditorBaseOperationsActions } from \"./gen/creators.js\";\n\n/** Actions for the DocumentEditor document model */\n\nexport const actions = {\n ...baseActions,\n ...documentEditorBaseOperationsActions,\n};\n","import type { DocumentEditorBaseOperationsOperations } from \"document-models/document-editor/v1\";\n\nexport const documentEditorBaseOperationsOperations: DocumentEditorBaseOperationsOperations =\n {\n setEditorNameOperation(state, action, dispatch) {\n const trimmedName = action.input.name.trim();\n if (trimmedName === \"\") {\n throw new Error(\"Editor name cannot be empty\");\n }\n state.name = trimmedName;\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 setEditorStatusOperation(state, action, dispatch) {\n state.status = action.input.status;\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 { DocumentEditorPHState } from \"document-models/document-editor/v1\";\n\nimport { documentEditorBaseOperationsOperations } from \"../src/reducers/base-operations.js\";\n\nimport {\n AddDocumentTypeInputSchema,\n RemoveDocumentTypeInputSchema,\n SetEditorNameInputSchema,\n SetEditorStatusInputSchema,\n} from \"./schema/zod.js\";\n\nconst stateReducer: StateReducer<DocumentEditorPHState> = (\n state,\n action,\n dispatch,\n) => {\n if (isDocumentAction(action)) {\n return state;\n }\n switch (action.type) {\n case \"SET_EDITOR_NAME\": {\n SetEditorNameInputSchema().parse(action.input);\n\n documentEditorBaseOperationsOperations.setEditorNameOperation(\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 documentEditorBaseOperationsOperations.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 documentEditorBaseOperationsOperations.removeDocumentTypeOperation(\n (state as any)[action.scope],\n action as any,\n dispatch,\n );\n\n break;\n }\n\n case \"SET_EDITOR_STATUS\": {\n SetEditorStatusInputSchema().parse(action.input);\n\n documentEditorBaseOperationsOperations.setEditorStatusOperation(\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<DocumentEditorPHState> =\n createReducer(stateReducer);\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nexport const documentEditorDocumentType = \"powerhouse/document-editor\";\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 { documentEditorDocumentType } from \"./document-type.js\";\nimport { DocumentEditorStateSchema } from \"./schema/zod.js\";\nimport type { DocumentEditorDocument, DocumentEditorPHState } from \"./types.js\";\n\n/** Schema for validating the header object of a DocumentEditor document */\nexport const DocumentEditorDocumentHeaderSchema =\n BaseDocumentHeaderSchema.extend({\n documentType: z.literal(documentEditorDocumentType),\n });\n\n/** Schema for validating the state object of a DocumentEditor document */\nexport const DocumentEditorPHStateSchema = BaseDocumentStateSchema.extend({\n global: DocumentEditorStateSchema(),\n});\n\nexport const DocumentEditorDocumentSchema = z.object({\n header: DocumentEditorDocumentHeaderSchema,\n state: DocumentEditorPHStateSchema,\n initialState: DocumentEditorPHStateSchema,\n});\n\n/** Simple helper function to check if a state object is a DocumentEditor document state object */\nexport function isDocumentEditorState(\n state: unknown,\n): state is DocumentEditorPHState {\n return DocumentEditorPHStateSchema.safeParse(state).success;\n}\n\n/** Simple helper function to assert that a document state object is a DocumentEditor document state object */\nexport function assertIsDocumentEditorState(\n state: unknown,\n): asserts state is DocumentEditorPHState {\n DocumentEditorPHStateSchema.parse(state);\n}\n\n/** Simple helper function to check if a document is a DocumentEditor document */\nexport function isDocumentEditorDocument(\n document: unknown,\n): document is DocumentEditorDocument {\n return DocumentEditorDocumentSchema.safeParse(document).success;\n}\n\n/** Simple helper function to assert that a document is a DocumentEditor document */\nexport function assertIsDocumentEditorDocument(\n document: unknown,\n): asserts document is DocumentEditorDocument {\n DocumentEditorDocumentSchema.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 assertIsDocumentEditorDocument,\n assertIsDocumentEditorState,\n isDocumentEditorDocument,\n isDocumentEditorState,\n} from \"./document-schema.js\";\nimport { documentEditorDocumentType } from \"./document-type.js\";\nimport { reducer } from \"./reducer.js\";\nimport type {\n DocumentEditorGlobalState,\n DocumentEditorLocalState,\n DocumentEditorPHState,\n} from \"./types.js\";\n\nexport const initialGlobalState: DocumentEditorGlobalState = {\n name: \"\",\n documentTypes: [],\n status: \"DRAFT\",\n};\nexport const initialLocalState: DocumentEditorLocalState = {};\n\nexport const utils: DocumentModelUtils<DocumentEditorPHState> = {\n fileExtension: \".editor\",\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 = documentEditorDocumentType;\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 isDocumentEditorState(state);\n },\n assertIsStateOfType(state) {\n return assertIsDocumentEditorState(state);\n },\n isDocumentOfType(document) {\n return isDocumentEditorDocument(document);\n },\n assertIsDocumentOfType(document) {\n return assertIsDocumentEditorDocument(document);\n },\n};\n"],"mappings":";;;;;AAmBA,MAAa,uBAAuB,MAClC,MAAM,KAAA,KAAa,MAAM;AAE3B,MAAa,0BAA0BA,IACpC,KAAK,CACL,QAAQ,MAAM,oBAAoB,EAAE,CAAC;AAExC,MAAa,mBAAmBA,IAAE,KAAK,CAAC,aAAa,QAAQ,CAAC;AAE9D,SAAgB,6BAEd;AACA,QAAOA,IAAE,OAAO;EACd,cAAcA,IAAE,QAAQ;EACxB,IAAIA,IAAE,QAAQ;EACf,CAAC;;AAGJ,SAAgB,4BAEd;AACA,QAAOA,IAAE,OAAO;EACd,YAAYA,IAAE,QAAQ,sBAAsB,CAAC,UAAU;EACvD,eAAeA,IAAE,MAAMA,IAAE,WAAW,wBAAwB,CAAC,CAAC;EAC9D,MAAMA,IAAE,QAAQ;EAChB,QAAQ;EACT,CAAC;;AAGJ,SAAgB,yBAEd;AACA,QAAOA,IAAE,OAAO;EACd,YAAYA,IAAE,QAAQ,mBAAmB,CAAC,UAAU;EACpD,cAAcA,IAAE,QAAQ;EACxB,IAAIA,IAAE,QAAQ;EACf,CAAC;;AAGJ,SAAgB,gCAEd;AACA,QAAOA,IAAE,OAAO,EAC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