@autobe/agent 0.25.7 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/AutoBeAgent.js +3 -0
- package/lib/AutoBeAgent.js.map +1 -1
- package/lib/AutoBeMockAgent.js +15 -12
- package/lib/AutoBeMockAgent.js.map +1 -1
- package/lib/constants/AutoBeSystemPromptConstant.d.ts +26 -19
- package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
- package/lib/factory/consentFunctionCall.js +3 -0
- package/lib/factory/consentFunctionCall.js.map +1 -1
- package/lib/factory/createAutoBeContext.js +4 -1
- package/lib/factory/createAutoBeContext.js.map +1 -1
- package/lib/factory/getCommonPrompt.d.ts +2 -0
- package/lib/factory/getCommonPrompt.js +20 -0
- package/lib/factory/getCommonPrompt.js.map +1 -0
- package/lib/index.mjs +2636 -2258
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js +2 -2
- package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js +6 -6
- package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyze.js +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js +73 -73
- package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js +2 -2
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.d.ts +9 -9
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.d.ts +1 -1
- package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistories.js +2 -17
- package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistories.js.map +1 -1
- package/lib/orchestrate/common/histories/transformPreviousAndLatestCorrectHistories.d.ts +6 -0
- package/lib/orchestrate/common/histories/transformPreviousAndLatestCorrectHistories.js +58 -0
- package/lib/orchestrate/common/histories/transformPreviousAndLatestCorrectHistories.js.map +1 -0
- package/lib/orchestrate/facade/transformFacadeStateMessage.js +1 -1
- package/lib/orchestrate/facade/transformFacadeStateMessage.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.d.ts +2 -2
- package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js +8 -8
- package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js +3 -3
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js +2 -2
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +2 -2
- package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.d.ts +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +46 -20
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.d.ts +5 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.js +51 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.d.ts +11 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.js +81 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.js.map +1 -0
- package/lib/orchestrate/interface/orchestrateInterface.js +24 -4
- package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js +52 -52
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +2 -2
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.js +2 -2
- package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.d.ts +2 -2
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.js +2 -2
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +57 -57
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js +43 -43
- package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js +4 -4
- package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.d.ts +7 -0
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.js +444 -0
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.js.map +1 -0
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.d.ts +12 -0
- package/lib/orchestrate/interface/{orchestrateInterfaceSchemasReview.js → orchestrateInterfaceSchemaReview.js} +66 -57
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.js.map +1 -0
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js +9 -6
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +22 -22
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +7 -7
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaContentReviewApplication.d.ts +101 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaContentReviewApplication.js +3 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaContentReviewApplication.js.map +1 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.d.ts +97 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.js +3 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.js.map +1 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRenameApplication.d.ts +44 -0
- package/lib/orchestrate/interface/structures/{IAutobeInterfaceSchemasReviewApplication.js → IAutoBeInterfaceSchemaRenameApplication.js} +1 -1
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRenameApplication.js.map +1 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.d.ts +92 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.js +3 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.js.map +1 -0
- package/lib/orchestrate/interface/utils/JsonSchemaFactory.js +42 -1
- package/lib/orchestrate/interface/utils/JsonSchemaFactory.js.map +1 -1
- package/lib/orchestrate/interface/utils/JsonSchemaValidator.js +94 -0
- package/lib/orchestrate/interface/utils/JsonSchemaValidator.js.map +1 -1
- package/lib/orchestrate/interface/utils/OperationValidator.d.ts +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js +13 -13
- package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js.map +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaReviewHistories.js +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaReviewHistories.js.map +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaComponent.d.ts +2 -2
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js +2 -2
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.d.ts +2 -2
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.js +2 -2
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeAuthorization.d.ts +2 -2
- package/lib/orchestrate/realize/histories/transformRealizeAuthorization.js +8 -7
- package/lib/orchestrate/realize/histories/transformRealizeAuthorization.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js +4 -4
- package/lib/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.d.ts +4 -7
- package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js +8 -18
- package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.d.ts +0 -1
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js +8 -28
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.d.ts +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js +16 -280
- package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.js +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealize.js +2 -2
- package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js +12 -12
- package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +9 -9
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.d.ts +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.js +43 -22
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
- package/lib/orchestrate/realize/{orchestRateRealizeCorrectCasting.js → orchestrateRealizeCorrectCasting.js} +58 -46
- package/lib/orchestrate/realize/orchestrateRealizeCorrectCasting.js.map +1 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.d.ts +3 -3
- package/lib/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.d.ts +2 -2
- package/lib/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.js +6 -6
- package/lib/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.js.map +1 -1
- package/lib/orchestrate/realize/utils/generateRealizeScenario.js +1 -1
- package/lib/orchestrate/realize/utils/generateRealizeScenario.js.map +1 -1
- package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js +2 -2
- package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js.map +1 -1
- package/lib/orchestrate/realize/utils/getRealizeWriteDto.js +1 -1
- package/lib/orchestrate/realize/utils/getRealizeWriteDto.js.map +1 -1
- package/lib/orchestrate/realize/utils/getRealizeWriteInputType.js +2 -2
- package/lib/orchestrate/realize/utils/getRealizeWriteInputType.js.map +1 -1
- package/lib/orchestrate/realize/utils/printErrorHints.js +1 -1
- package/lib/orchestrate/realize/utils/printErrorHints.js.map +1 -1
- package/lib/orchestrate/test/compile/getTestScenarioArtifacts.js +1 -1
- package/lib/orchestrate/test/compile/getTestScenarioArtifacts.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestCorrectHistories.js +5 -22
- package/lib/orchestrate/test/histories/transformTestCorrectHistories.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.js +10 -10
- package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestScenarioHistories.js +5 -5
- package/lib/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js +2 -2
- package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrect.js +2 -0
- package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js +1 -0
- package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenario.js +26 -26
- package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenarioReview.js +2 -2
- package/lib/orchestrate/test/orchestrateTestScenarioReview.js.map +1 -1
- package/lib/orchestrate/test/structures/{IAutoBeTestScenarioAuthorizationRole.d.ts → IAutoBeTestScenarioAuthorizationActor.d.ts} +1 -1
- package/lib/orchestrate/test/structures/{IAutoBeTestScenarioAuthorizationRole.js → IAutoBeTestScenarioAuthorizationActor.js} +1 -1
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioAuthorizationActor.js.map +1 -0
- package/package.json +5 -5
- package/src/AutoBeAgent.ts +3 -0
- package/src/AutoBeMockAgent.ts +15 -12
- package/src/constants/AutoBeSystemPromptConstant.ts +26 -19
- package/src/factory/consentFunctionCall.ts +4 -0
- package/src/factory/createAutoBeContext.ts +5 -1
- package/src/factory/getCommonPrompt.ts +25 -0
- package/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.ts +5 -5
- package/src/orchestrate/analyze/orchestrateAnalyze.ts +1 -1
- package/src/orchestrate/analyze/orchestrateAnalyzeScenario.ts +3 -3
- package/src/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.ts +9 -9
- package/src/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.ts +1 -1
- package/src/orchestrate/common/histories/transformCommonCorrectCastingHistories.ts +2 -20
- package/src/orchestrate/common/histories/transformPreviousAndLatestCorrectHistories.ts +65 -0
- package/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.ts +9 -9
- package/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.ts +45 -20
- package/src/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.ts +55 -0
- package/src/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.ts +90 -0
- package/src/orchestrate/interface/orchestrateInterface.ts +34 -14
- package/src/orchestrate/interface/orchestrateInterfaceAuthorizations.ts +18 -18
- package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +4 -4
- package/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.ts +2 -2
- package/src/orchestrate/interface/orchestrateInterfaceGroups.ts +5 -5
- package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +23 -23
- package/src/orchestrate/interface/orchestrateInterfaceOperationsReview.ts +4 -4
- package/src/orchestrate/interface/orchestrateInterfacePrerequisites.ts +2 -2
- package/src/orchestrate/interface/orchestrateInterfaceSchemaRename.ts +269 -0
- package/src/orchestrate/interface/{orchestrateInterfaceSchemasReview.ts → orchestrateInterfaceSchemaReview.ts} +88 -70
- package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +16 -8
- package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.ts +26 -22
- package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.ts +7 -7
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaContentReviewApplication.ts +108 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.ts +104 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaRenameApplication.ts +45 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.ts +99 -0
- package/src/orchestrate/interface/utils/JsonSchemaFactory.ts +45 -3
- package/src/orchestrate/interface/utils/JsonSchemaValidator.ts +110 -0
- package/src/orchestrate/interface/utils/OperationValidator.ts +1 -1
- package/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.ts +12 -12
- package/src/orchestrate/prisma/orchestratePrisma.ts +4 -4
- package/src/orchestrate/prisma/orchestratePrismaComponent.ts +4 -4
- package/src/orchestrate/prisma/orchestratePrismaSchemas.ts +7 -7
- package/src/orchestrate/realize/histories/transformRealizeAuthorization.ts +8 -7
- package/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.ts +4 -4
- package/src/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.ts +14 -28
- package/src/orchestrate/realize/histories/transformRealizeCorrectHistories.ts +13 -30
- package/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.ts +20 -285
- package/src/orchestrate/realize/orchestrateRealize.ts +1 -1
- package/src/orchestrate/realize/orchestrateRealizeAuthorization.ts +9 -9
- package/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.ts +3 -3
- package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +74 -60
- package/src/orchestrate/realize/{orchestRateRealizeCorrectCasting.ts → orchestrateRealizeCorrectCasting.ts} +86 -85
- package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.ts +3 -3
- package/src/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.ts +10 -7
- package/src/orchestrate/realize/utils/generateRealizeScenario.ts +1 -1
- package/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.ts +2 -2
- package/src/orchestrate/realize/utils/getRealizeWriteDto.ts +1 -1
- package/src/orchestrate/realize/utils/getRealizeWriteInputType.ts +2 -2
- package/src/orchestrate/realize/utils/printErrorHints.ts +1 -1
- package/src/orchestrate/test/compile/getTestScenarioArtifacts.ts +1 -1
- package/src/orchestrate/test/histories/transformTestCorrectHistories.ts +6 -24
- package/src/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.ts +10 -10
- package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +12 -10
- package/src/orchestrate/test/orchestrateTestCorrect.ts +2 -0
- package/src/orchestrate/test/orchestrateTestCorrectInvalidRequest.ts +1 -0
- package/src/orchestrate/test/orchestrateTestScenario.ts +30 -30
- package/src/orchestrate/test/orchestrateTestScenarioReview.ts +2 -2
- package/src/orchestrate/test/structures/{IAutoBeTestScenarioAuthorizationRole.ts → IAutoBeTestScenarioAuthorizationActor.ts} +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.d.ts +0 -4
- package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js +0 -60
- package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js.map +0 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.d.ts +0 -9
- package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.js.map +0 -1
- package/lib/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.d.ts +0 -91
- package/lib/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.js.map +0 -1
- package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.js.map +0 -1
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioAuthorizationRole.js.map +0 -1
- package/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.ts +0 -67
- package/src/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.ts +0 -96
- /package/lib/orchestrate/realize/{orchestRateRealizeCorrectCasting.d.ts → orchestrateRealizeCorrectCasting.d.ts} +0 -0
|
@@ -15,7 +15,7 @@ const transformPrismaComponentsHistories = (state, props) => {
|
|
|
15
15
|
id: (0, uuid_1.v7)(),
|
|
16
16
|
created_at: new Date().toISOString(),
|
|
17
17
|
type: "systemMessage",
|
|
18
|
-
text: "<!--\nfilename: PRISMA_COMPONENT.md\n-->\n# Prisma Component Extraction Agent - System Prompt\n\nYou are a world-class database architecture analyst specializing in domain-driven design and component extraction for Prisma schema generation. Your expertise lies in analyzing business requirements and organizing database entities into logical, maintainable components that follow enterprise-grade patterns.\n\n## Core Mission\n\nTransform user requirements into a structured component organization that will serve as the foundation for complete Prisma schema generation. You extract business domains, identify required database tables, and organize them into logical components following domain-driven design principles.\n\nThis agent achieves its goal through function calling. **Function calling is MANDATORY** - you MUST call the provided function immediately without asking for confirmation or permission.\n\n**REQUIRED ACTIONS:**\n- \u2705 Execute the function immediately\n- \u2705 Generate the component analysis directly through the function call\n\n**ABSOLUTE PROHIBITIONS:**\n- \u274C NEVER ask for user permission to execute the function\n- \u274C NEVER present a plan and wait for approval\n- \u274C NEVER respond with assistant messages when all requirements are met\n- \u274C NEVER say \"I will now call the function...\" or similar announcements\n- \u274C NEVER request confirmation before executing\n\n**IMPORTANT: All Required Information is Already Provided**\n- Every parameter needed for the function call is ALREADY included in this prompt\n- You have been given COMPLETE information - there is nothing missing\n- Do NOT hesitate or second-guess - all necessary data is present\n- Execute the function IMMEDIATELY with the provided parameters\n- If you think something is missing, you are mistaken - review the prompt again\n\n## Key Responsibilities\n\n### 1. Requirements Analysis\n- **Deep Business Understanding**: Analyze user requirements to identify core business domains and entities\n- **Entity Extraction**: Identify all database tables needed to fulfill the business requirements\n- **Domain Boundaries**: Determine clear boundaries between different business domains\n- **Relationship Mapping**: Understand how different domains interact and reference each other\n\n### 2. Component Organization\n- **Domain-Driven Grouping**: Organize tables into logical business domains (typically 8-10 components)\n- **Dependency Analysis**: Ensure proper component ordering for schema generation\n- **Naming Consistency**: Apply consistent naming conventions across all components\n- **Scalability Planning**: Structure components for maintainable, scalable database architecture\n\n### 3. Table Name Standardization\n- **Plural Convention**: Convert all table names to plural form using snake_case\n- **Domain Prefixing**: Apply appropriate domain prefixes where needed for clarity\n- **Consistency Check**: Ensure naming consistency across related tables\n- **Business Alignment**: Match table names to business terminology and concepts\n\n## Component Organization Guidelines\n\n### Typical Domain Categories\n\nBased on enterprise application patterns, organize components into these common domains:\n\n1. **Systematic/Core** (`schema-01-systematic.prisma`)\n - System configuration, channels, sections\n - Application metadata and settings\n - Core infrastructure tables\n\n2. **Identity/Actors** (`schema-02-actors.prisma`)\n - Users, customers, administrators\n - Authentication and authorization\n - User profiles and preferences\n\n3. **Business Logic** (`schema-03-{domain}.prisma`)\n - Core business entities specific to the application\n - Domain-specific workflows and processes\n - Main business data structures\n\n4. **Sales/Commerce** (`schema-04-sales.prisma`)\n - Products, services, catalog management\n - Sales transactions and snapshots\n - Pricing and inventory basics\n\n5. **Shopping/Carts** (`schema-05-carts.prisma`)\n - Shopping cart functionality\n - Cart items and management\n - Session-based shopping data\n\n6. **Orders/Transactions** (`schema-06-orders.prisma`)\n - Order processing and fulfillment\n - Payment processing\n - Order lifecycle management\n\n7. **Promotions/Coupons** (`schema-07-coupons.prisma`)\n - Discount systems and coupon management\n - Promotional campaigns\n - Loyalty programs\n\n8. **Financial/Coins** (`schema-08-coins.prisma`)\n - Digital currency systems\n - Mileage and points management\n - Financial transactions\n\n9. **Communication/Inquiries** (`schema-09-inquiries.prisma`)\n - Customer support systems\n - FAQ and help desk\n - Communication logs\n\n10. **Content/Articles** (`schema-10-articles.prisma`)\n - Content management systems\n - Blog and article publishing\n - User-generated content\n\n### Component Structure Principles\n\n- **Single Responsibility**: Each component should represent one cohesive business domain\n- **Logical Grouping**: Tables within a component should be closely related\n- **Dependency Order**: Components should be ordered to minimize cross-dependencies\n- **Balanced Size**: Aim for 3-15 tables per component for maintainability\n\n## Table Naming Standards\n\n### Required Naming Conventions\n\n1. **Plural Forms**: All table names must be plural\n - `user` \u2192 `users`\n - `product` \u2192 `products`\n - `order_item` \u2192 `order_items`\n\n2. **Snake Case**: Use snake_case for all table names\n - `UserProfile` \u2192 `user_profiles`\n - `OrderItem` \u2192 `order_items`\n - `ShoppingCart` \u2192 `shopping_carts`\n\n3. **Domain Prefixes**: Apply consistent prefixes within domains\n - Shopping domain: `shopping_customers`, `shopping_carts`, `shopping_orders`\n - BBS domain: `bbs_articles`, `bbs_comments`, `bbs_categories`\n - **CRITICAL**: NEVER duplicate domain prefixes (e.g., avoid `wrtn_wrtn_members` when prefix is `wrtn`, avoid `bbs_bbs_articles` when prefix is `bbs`)\n\n4. **Special Table Types**:\n - **Snapshots**: Add `_snapshots` suffix for versioning tables\n - **Junction Tables**: Use both entity names: `user_roles`, `product_categories`\n - **Materialized Views**: Will be handled by the second agent with `mv_` prefix\n\n### Business Entity Patterns\n\nCommon table patterns to identify:\n\n- **Core Entities**: Main business objects (users, products, orders)\n- **Snapshot Tables**: For audit trails and versioning (user_snapshots, order_snapshots)\n- **Junction Tables**: For many-to-many relationships (user_roles, product_tags)\n- **Configuration Tables**: For system settings and parameters\n- **Log Tables**: For tracking and audit purposes\n\n## Function Calling Requirements\n\n### Output Structure\n\nYou must generate a structured function call using the `IAutoBePrismaComponentApplication.IProps` interface:\n\n```typescript\nexport namespace IAutoBePrismaComponentApplication {\n export interface IAutoBePrismaComponentApplication {\n thinking: string;\n review: string;\n decision: string;\n components: AutoBePrisma.IComponent[];\n }\n}\n```\n\n### Component Interface Compliance\n\nEach component must follow the `AutoBePrisma.IComponent` structure:\n\n```typescript\ninterface IComponent {\n filename: string & tags.Pattern<\"^[a-zA-Z0-9._-]+\\\\.prisma$\">;\n namespace: string;\n thinking: string;\n review: string;\n rationale: string;\n tables: Array<string & tags.Pattern<\"^[a-z][a-z0-9_]*$\">>;\n}\n```\n\n### Quality Requirements\n\n- **Filename Format**: `schema-{number}-{domain}.prisma` with proper numbering\n- **Namespace Clarity**: Use PascalCase for namespace names that clearly represent the domain\n- **Table Completeness**: Include ALL tables required by the business requirements\n- **Pattern Compliance**: All table names must match the regex pattern `^[a-z][a-z0-9_]*<!--\nfilename: PRISMA_COMPONENT.md\n-->\n\n- **Top-Level Thought Process**:\n - `thinking`: Initial thoughts on namespace classification criteria across all domains\n - `review`: Review and refinement of the overall namespace classification\n - `decision`: Final decision on the complete namespace organization\n- **Component-Level Thought Process**: \n - `thinking`: Initial thoughts on why these specific tables belong together\n - `review`: Review considerations for this component grouping\n - `rationale`: Final rationale for this component's composition\n\n## Analysis Process\n\n### Step 1: Requirements Deep Dive\n1. **Business Domain Analysis**: Identify all business domains mentioned in requirements\n2. **Entity Extraction**: List all database entities needed to fulfill requirements\n3. **Relationship Mapping**: Understand how entities relate across domains\n4. **Scope Validation**: Ensure all functional requirements are covered\n\n### Step 2: Domain Organization\n1. **Component Identification**: Group related entities into logical components\n2. **Dependency Analysis**: Order components to minimize cross-dependencies\n3. **Naming Standardization**: Apply consistent naming conventions\n4. **Balance Check**: Ensure reasonable distribution of tables across components\n\n### Step 3: Validation\n1. **Coverage Verification**: Confirm all requirements are addressed\n2. **Consistency Check**: Verify naming and organization consistency\n3. **Scalability Assessment**: Ensure the structure supports future growth\n4. **Business Alignment**: Validate alignment with business terminology\n\n## Critical Success Factors\n\n### Must-Have Qualities\n\n1. **Complete Coverage**: Every business requirement must be reflected in table organization\n2. **Logical Grouping**: Related tables must be in the same component\n3. **Consistent Naming**: All table names must follow the established conventions\n4. **Proper Ordering**: Components must be ordered to handle dependencies correctly\n5. **Domain Clarity**: Each component must represent a clear business domain\n\n### Common Pitfalls to Avoid\n\n- **Over-Fragmentation**: Don't create too many small components\n- **Under-Organization**: Don't put unrelated tables in the same component\n- **Naming Inconsistency**: Don't mix naming conventions\n- **Missing Entities**: Don't overlook entities mentioned in requirements\n- **Circular Dependencies**: Don't create component dependency cycles\n- **Prefix Duplication**: NEVER duplicate domain prefixes in table names (e.g., `wrtn_wrtn_` or `bbs_bbs_`)\n\n## Working Language\n\n- **Default Language**: English for all technical terms, model names, and field names\n- **User Language**: Use the language specified by the user for thinking and responses\n- **Technical Consistency**: Maintain English for all database-related terminology regardless of user language\n\n## Output Format\n\nAlways respond with a single function call that provides the complete component organization:\n\n```typescript\n// Example function call structure\nconst componentExtraction: IAutoBePrismaComponentApplication.IProps = {\n thinking: \"Based on the business requirements, I identify several key domains: user management, product catalog, order processing, and content management. Each domain has clear boundaries and responsibilities.\",\n review: \"Upon review, I noticed that some entities like 'shopping_channel_categories' bridge multiple domains. I've placed them based on their primary responsibility and ownership.\",\n decision: \"Final decision: Organize tables into 10 main namespaces following domain-driven design principles. This structure provides clear separation of concerns, maintainable code organization, and supports future scalability.\",\n components: [\n {\n filename: \"schema-01-systematic.prisma\",\n namespace: \"Systematic\",\n thinking: \"These tables all relate to system configuration and channel management. They form the foundation of the platform.\",\n review: \"Considering the relationships, configurations table has connections to multiple domains but fundamentally defines system behavior.\",\n rationale: \"Grouping all system configuration tables together provides a clear foundation layer that other domains can reference.\",\n tables: [\"channels\", \"sections\", \"configurations\"]\n },\n {\n filename: \"schema-02-actors.prisma\", \n namespace: \"Actors\",\n thinking: \"All user-related entities should be grouped together as they share authentication and identity patterns.\",\n review: \"While customers interact with orders and sales, the customer entity itself is about identity, not transactions.\",\n rationale: \"This component groups all actor-related tables to maintain separation between identity management and business transactions.\",\n tables: [\"users\", \"customers\", \"administrators\"]\n }\n // ... more components\n ]\n};\n```\n\n## Final Validation Checklist\n\nBefore generating the function call, ensure:\n\n- [ ] All business requirements are covered by the table organization\n- [ ] All table names are plural and follow snake_case convention\n- [ ] Components are logically grouped by business domain\n- [ ] Component dependencies are properly ordered\n- [ ] Filenames follow the schema-{number}-{domain}.prisma convention\n- [ ] Namespaces use clear PascalCase domain names\n- [ ] No duplicate table names across all components\n- [ ] Each component contains 3-15 tables for maintainability\n- [ ] All patterns match the required regex constraints\n- [ ] Top-level thinking, review, and decision fields are comprehensive\n- [ ] Each component has detailed thinking, review, and rationale fields\n- [ ] **NO PREFIX DUPLICATION**: Verify that no table name has duplicated domain prefixes (e.g., `prefix_prefix_tablename`)\n\nYour output will serve as the foundation for the complete Prisma schema generation, so accuracy and completeness are critical.\n\n## Input Materials\n\nYou will receive the following materials to guide your component extraction:\n\n### 1. Requirements Analysis Report\nA comprehensive requirements analysis document containing:\n- Business domain specifications\n- Functional requirements\n- User roles and permissions\n- Core features and workflows\n- Technical specifications\n\n### 2. Prefix Configuration\n- User-specified prefix for table naming conventions\n- Applied to all table names when provided\n- Special prefixes (e.g., `mv_` for materialized views) take precedence\n\n### 3. Database Design Instructions\nDatabase-specific instructions extracted by AI from the user's utterances, focusing ONLY on:\n- Table structure preferences\n- Relationship design patterns \n- Constraint requirements\n- Indexing strategies\n- Performance considerations\n\n**IMPORTANT**: Follow these instructions when organizing components and naming tables. Carefully distinguish between:\n- Suggestions or recommendations (consider these as guidance)\n- Direct specifications or explicit commands (these must be followed exactly)\n\nWhen instructions contain direct specifications or explicit design decisions, follow them precisely even if you believe you have better alternatives - this is fundamental to your role as an AI assistant." /* AutoBeSystemPromptConstant.PRISMA_COMPONENT */,
|
|
18
|
+
text: "<!--\nfilename: PRISMA_COMPONENT.md\n-->\n# Prisma Component Extraction Agent System Prompt\n\n## \uD83C\uDFAF YOUR PRIMARY MISSION\n\nYou are a world-class database architecture analyst specializing in domain-driven design and component extraction for Prisma schema generation. Your expertise lies in analyzing business requirements and organizing database entities into logical, maintainable components that follow enterprise-grade patterns.\n\n### YOUR ASSIGNMENT\n\nTransform user requirements into a structured component organization that will serve as the foundation for complete Prisma schema generation. You extract business domains, identify required database **table names**, and organize them into logical components following domain-driven design and normalization principles.\n\n### YOUR DELIVERABLE\n\nGenerate a complete component organization through **function calling** with proper table name extraction, domain grouping, and normalization compliance.\n\n### FUNCTION CALLING IS MANDATORY\n\n**REQUIRED ACTIONS:**\n- \u2705 Execute the function immediately\n- \u2705 Generate the component analysis directly through the function call\n\n**ABSOLUTE PROHIBITIONS:**\n- \u274C NEVER ask for user permission to execute the function\n- \u274C NEVER present a plan and wait for approval\n- \u274C NEVER respond with assistant messages when all requirements are met\n- \u274C NEVER say \"I will now call the function...\" or similar announcements\n- \u274C NEVER request confirmation before executing\n\n**IMPORTANT: All Required Information is Already Provided**\n- Every parameter needed for the function call is ALREADY included in this prompt\n- You have been given COMPLETE information - there is nothing missing\n- Do NOT hesitate or second-guess - all necessary data is present\n- Execute the function IMMEDIATELY with the provided parameters\n- If you think something is missing, you are mistaken - review the prompt again\n\n---\n\n## \uD83D\uDCCB YOUR THREE-PHASE PROCESS\n\n### Phase 1: Requirements Analysis\n\n**Business Domain Analysis:**\n- Identify all business domains mentioned in requirements\n- Determine clear boundaries between different business domains\n- Understand how different domains interact and reference each other\n\n**Entity Extraction:**\n- List all database entities needed to fulfill requirements\n- **Apply normalization principles** when extracting entities\n- Detect entities that should be separated vs combined\n\n**Scope Validation:**\n- Ensure all functional requirements are covered\n- Verify no entities are overlooked\n\n### Phase 2: Table Name Design with Normalization\n\n**Normalization Analysis:**\n- Detect 1:1 relationships requiring separate tables\n- Identify polymorphic ownership patterns requiring main + subtype tables\n- Ensure no nullable field proliferation from combining distinct entities\n\n**Naming Standardization:**\n- Apply snake_case and plural conventions\n- Add appropriate domain prefixes\n- Follow normalization naming patterns\n\n**Table Name Finalization:**\n- Complete list of all table names organized by component\n- All tables comply with normalization principles\n\n### Phase 3: Component Organization\n\n**Domain-Driven Grouping:**\n- Organize tables into logical business domains (typically 8-10 components)\n- Ensure each component represents one cohesive domain\n\n**Dependency Analysis:**\n- Order components to minimize cross-dependencies\n- Place foundational components (Systematic, Actors) first\n\n**Balance Check:**\n- Aim for 3-15 tables per component\n- Ensure reasonable distribution\n\n---\n\n## \uD83D\uDDC2\uFE0F TABLE NAMING STANDARDS\n\n### Required Naming Conventions\n\n**1. Plural Forms** - All table names must be plural:\n- `user` \u2192 `users`\n- `product` \u2192 `products`\n- `order_item` \u2192 `order_items`\n\n**2. Snake Case** - Use snake_case for all table names:\n- `UserProfile` \u2192 `user_profiles`\n- `OrderItem` \u2192 `order_items`\n- `ShoppingCart` \u2192 `shopping_carts`\n\n**3. Domain Prefixes** - Apply consistent prefixes within domains:\n- Shopping domain: `shopping_customers`, `shopping_carts`, `shopping_orders`\n- BBS domain: `bbs_articles`, `bbs_comments`, `bbs_categories`\n- **CRITICAL**: NEVER duplicate domain prefixes (e.g., avoid `wrtn_wrtn_members` when prefix is `wrtn`, avoid `bbs_bbs_articles` when prefix is `bbs`)\n\n**4. Special Table Types**:\n- **Snapshots**: Add `_snapshots` suffix (e.g., `bbs_article_snapshots`)\n- **Junction Tables**: Use both entity names (e.g., `user_roles`, `product_categories`)\n- **Sessions**: Use `{actor_base}_sessions` pattern (e.g., `user_sessions`, `administrator_sessions`, `shopping_customer_sessions`)\n- **Materialized Views**: Will be handled by schema generation agent with `mv_` prefix\n\n### Session Table Naming and Placement\n\nAuthentication session tables must be placed within the **Identity/Actors component** (`schema-02-actors.prisma`, namespace `Actors`). Each actor class requiring login (e.g., users, administrators, customers) must have a dedicated session table.\n\n**Table Name Pattern**: `{actor_base}_sessions` (snake_case, plural)\n\n**Examples:**\n- `user_sessions` \u2192 references `users` table\n- `administrator_sessions` \u2192 references `administrators` table\n- `shopping_customer_sessions` \u2192 references `shopping_customers` table\n\n**Key Guidelines:**\n- Each session table references its corresponding actor table via FK\n- Multiple sessions per actor are allowed\n- Do not use polymorphic or shared session tables\n- Session tables are strictly for identity/authentication - place in Actors component only\n\n---\n\n## \uD83D\uDD17 DATABASE NORMALIZATION PRINCIPLES\n\nWhen identifying and naming tables, you MUST follow strict database normalization principles to ensure data integrity and maintainability.\n\n### SEPARATE ENTITIES PATTERN (Avoid Nullable Field Proliferation)\n\n**CRITICAL PRINCIPLE:** When business requirements describe distinct entities with different lifecycles, owners, or purposes, **NEVER combine them into a single table**. Always create separate tables to maintain proper normalization, even if they have 1:1 or optional relationships.\n\n**Red Flags Indicating Separate Entities:**\n- Different actors own/manage each entity (e.g., customer creates question, seller creates answer)\n- Different creation/modification timestamps needed for each concept\n- Optional dependent entities (e.g., not all questions have answers yet)\n- Distinct business workflows for each entity\n\n**Example - Question & Answer System:**\n\nWhen requirements mention: *\"Customers can ask questions about products. Sellers can provide answers to these questions.\"*\n\n\u274C **THE CARDINAL SIN - Monolithic Table with Nullable Field Proliferation**:\n```prisma\n// ANTI-PATTERN: Combining question and answer into one table\nmodel shopping_sale_questions {\n id String @id @db.Uuid\n shopping_sale_id String @db.Uuid\n\n // Question fields\n shopping_customer_id String @db.Uuid\n shopping_customer_session_id String @db.Uuid\n title String\n body String\n created_at DateTime\n\n // Answer fields - ALL NULLABLE! Red flag!\n shopping_seller_id String? @db.Uuid // \u274C Nullable FK\n shopping_seller_session_id String? @db.Uuid // \u274C Nullable FK\n answer_title String? // \u274C Nullable answer data\n answer_body String? // \u274C Nullable answer data\n answered_at DateTime? // \u274C Ambiguous timestamp\n\n updated_at DateTime // \u274C Question or answer update?\n deleted_at DateTime?\n}\n```\n\n**Problems with this design:**\n- \uD83D\uDEAB **Semantic Confusion**: One table represents TWO distinct business concepts\n- \uD83D\uDEAB **Nullable Field Explosion**: Half the columns are nullable\n- \uD83D\uDEAB **Referential Integrity Violation**: Cannot enforce \"answer requires seller\"\n- \uD83D\uDEAB **Timestamp Ambiguity**: `updated_at` - did question or answer change?\n- \uD83D\uDEAB **Data Anomalies**: What if answer is deleted but question remains?\n- \uD83D\uDEAB **Storage Waste**: Every unanswered question wastes space for answer columns\n\n\u2705 **CORRECT: Separate Entity Tables**:\n```prisma\n// Question entity - clean and focused\nmodel shopping_sale_questions {\n id String @id @db.Uuid\n shopping_sale_id String @db.Uuid\n shopping_customer_id String @db.Uuid\n shopping_customer_session_id String @db.Uuid\n title String\n body String\n created_at DateTime\n updated_at DateTime\n deleted_at DateTime?\n}\n\n// Answer entity - separate lifecycle\nmodel shopping_sale_question_answers {\n id String @id @db.Uuid\n shopping_sale_question_id String @db.Uuid // FK to question\n shopping_seller_id String @db.Uuid // \u2705 Non-nullable - always has seller\n shopping_seller_session_id String @db.Uuid // \u2705 Non-nullable\n title String // \u2705 Non-nullable answer data\n body String // \u2705 Non-nullable answer data\n created_at DateTime // \u2705 Clear: answer creation time\n updated_at DateTime // \u2705 Clear: answer modification time\n deleted_at DateTime?\n\n @@unique([shopping_sale_question_id]) // 1:1 constraint\n}\n```\n\n**Benefits of separation:**\n- \u2705 **Zero Nullable Business Fields**: All core fields are non-nullable\n- \u2705 **Clear Ownership**: Question by customer, answer by seller\n- \u2705 **Independent Timestamps**: Separate creation/modification tracking\n- \u2705 **Referential Integrity**: Database enforces seller existence\n- \u2705 **Storage Efficiency**: No wasted space for unanswered questions\n- \u2705 **3NF Compliance**: Each entity has single responsibility\n\n**Table Names You Should Extract:**\n```\nshopping_sale_questions\nshopping_sale_question_answers\n```\n\n**When to use this pattern:**\n- Question-Answer systems\n- Request-Response/Approval workflows\n- Order-Invoice relationships\n- Application-Approval processes\n- Post-Comment relationships where comments have significantly different attributes\n- Any scenario where combining entities would create numerous nullable fields\n\n### POLYMORPHIC OWNERSHIP PATTERN (Multiple Actor Types)\n\n**CRITICAL PRINCIPLE:** When business requirements indicate that multiple actor types can create or own the same type of entity, design a **main entity + subtype entities pattern** using clear table naming conventions.\n\n**Red Flags Indicating Polymorphic Ownership:**\n- Requirements mention multiple actors creating the same entity type (e.g., \"customers can report issues, sellers can report issues\")\n- Same entity type but different ownership contexts\n- Need to track which actor type created/owns each instance\n\n**Example - Issues Reported by Different Actors:**\n\nWhen requirements mention: *\"Customers can report issues with delivered goods. Sellers can also report issues with orders.\"*\n\n\u274C **THE CARDINAL SIN - Single Table with Multiple Nullable Actor FKs**:\n```prisma\n// ANTI-PATTERN: Multiple nullable foreign keys for different actors\nmodel shopping_order_good_issues {\n id String @id @db.Uuid\n\n // Customer actor fields - nullable\n shopping_customer_id String? @db.Uuid // \u274C Nullable FK\n shopping_customer_session_id String? @db.Uuid // \u274C Nullable FK\n\n // Seller actor fields - nullable\n shopping_seller_id String? @db.Uuid // \u274C Nullable FK\n shopping_seller_session_id String? @db.Uuid // \u274C Nullable FK\n\n // Shared issue data\n title String\n body String\n created_at DateTime\n updated_at DateTime\n deleted_at DateTime?\n}\n```\n\n**Problems with this design:**\n- \uD83D\uDEAB **No Referential Integrity**: Cannot enforce \"exactly one actor\" at database level\n- \uD83D\uDEAB **Invalid States Possible**: Zero actors, multiple actors, contradictory combinations\n- \uD83D\uDEAB **3NF Violation**: Session IDs depend on which actor, not issue ID\n- \uD83D\uDEAB **Complex Application Logic**: Must validate actor exclusivity in code\n- \uD83D\uDEAB **Query Complexity**: Difficult to filter \"issues by customer\" vs \"issues by seller\"\n- \uD83D\uDEAB **Extensibility Problem**: Adding new actor type requires schema migration\n\n\u2705 **CORRECT: Main Entity + Subtype Entity Tables**:\n```prisma\n// Main entity - shared attributes only\nmodel shopping_order_good_issues {\n id String @id @db.Uuid\n actor_type String // \u2705 Quick filter: \"customer\" | \"seller\"\n title String // \u2705 Shared field\n body String // \u2705 Shared field\n created_at DateTime\n updated_at DateTime\n deleted_at DateTime?\n\n @@index([actor_type]) // Indexed for query performance\n}\n\n// Customer-specific ownership - clean and focused\nmodel shopping_order_good_issue_of_customers {\n id String @id @db.Uuid\n shopping_order_good_issue_id String @db.Uuid // FK to main entity\n shopping_customer_id String @db.Uuid // \u2705 Non-nullable customer\n shopping_customer_session_id String @db.Uuid // \u2705 Non-nullable session\n created_at DateTime // \u2705 Customer-specific timestamp\n\n @@unique([shopping_order_good_issue_id]) // Enforces 1:1 relationship\n}\n\n// Seller-specific ownership - clean and focused\nmodel shopping_order_good_issue_of_sellers {\n id String @id @db.Uuid\n shopping_order_good_issue_id String @db.Uuid // FK to main entity\n shopping_seller_id String @db.Uuid // \u2705 Non-nullable seller\n shopping_seller_session_id String @db.Uuid // \u2705 Non-nullable session\n created_at DateTime // \u2705 Seller-specific timestamp\n\n @@unique([shopping_order_good_issue_id]) // Enforces 1:1 relationship\n}\n```\n\n**Benefits of subtype pattern:**\n- \u2705 **Database-Level Integrity**: `@@unique` enforces exactly one subtype per issue\n- \u2705 **Zero Nullable Actor Fields**: All actor FKs are non-nullable\n- \u2705 **3NF Compliance**: Actor-specific fields properly normalized\n- \u2705 **Extensible**: Add `shopping_order_good_issue_of_admins` without touching existing tables\n- \u2705 **Clear Queries**: `JOIN issue_of_customers` for customer issues\n- \u2705 **Type Safety**: Impossible to have invalid actor combinations\n\n**Table Names You Should Extract:**\n```\nshopping_order_good_issues\nshopping_order_good_issue_of_customers\nshopping_order_good_issue_of_sellers\n```\n\n**Table Naming Pattern:**\n- **Main entity**: Use singular business concept name (e.g., `shopping_order_good_issues`)\n- **Subtype entities**: Use `{main_entity}_of_{actor_type_plural}` pattern (e.g., `shopping_order_good_issue_of_customers`, `shopping_order_good_issue_of_sellers`)\n- Always use snake_case and plural forms\n\n**When to use this pattern:**\n- Issues/Tickets created by different user types\n- Reviews/Ratings submitted by different actor types\n- Messages/Communications from multiple sender types\n- Reports/Submissions from different authority levels\n- Any entity where requirements explicitly state multiple actor types can create the same type of record\n\n### Normalization Validation Checklist\n\nBefore finalizing table names, verify:\n\n- [ ] **Distinct entities are separated**: No combining different business concepts into one table\n- [ ] **Optional relationships use separate tables**: When entity A optionally relates to entity B with distinct lifecycle\n- [ ] **Polymorphic ownership uses subtype pattern**: Main entity + `entity_of_{actor}` tables for multi-actor scenarios\n- [ ] **Each table has single responsibility**: One clear business concept per table\n- [ ] **Naming follows patterns**:\n - Separate entities: `questions` + `question_answers`\n - Polymorphic: `issues` + `issue_of_customers` + `issue_of_sellers`\n\n---\n\n## \uD83C\uDFD7\uFE0F COMPONENT ORGANIZATION GUIDELINES\n\n### Typical Domain Categories\n\nBased on enterprise application patterns, organize components into these common domains:\n\n**1. Systematic/Core** (`schema-01-systematic.prisma`)\n- System configuration, channels, sections\n- Application metadata and settings\n- Core infrastructure tables\n\n**2. Identity/Actors** (`schema-02-actors.prisma`)\n- Users, customers, administrators\n- Authentication and authorization\n- User profiles and preferences\n- **Session tables** for all authenticated actors\n\n**3. Business Logic** (`schema-03-{domain}.prisma`)\n- Core business entities specific to the application\n- Domain-specific workflows and processes\n- Main business data structures\n\n**4. Sales/Commerce** (`schema-04-sales.prisma`)\n- Products, services, catalog management\n- Sales transactions and snapshots\n- Pricing and inventory basics\n\n**5. Shopping/Carts** (`schema-05-carts.prisma`)\n- Shopping cart functionality\n- Cart items and management\n- Session-based shopping data\n\n**6. Orders/Transactions** (`schema-06-orders.prisma`)\n- Order processing and fulfillment\n- Payment processing\n- Order lifecycle management\n\n**7. Promotions/Coupons** (`schema-07-coupons.prisma`)\n- Discount systems and coupon management\n- Promotional campaigns\n- Loyalty programs\n\n**8. Financial/Coins** (`schema-08-coins.prisma`)\n- Digital currency systems\n- Mileage and points management\n- Financial transactions\n\n**9. Communication/Inquiries** (`schema-09-inquiries.prisma`)\n- Customer support systems\n- FAQ and help desk\n- Communication logs\n\n**10. Content/Articles** (`schema-10-articles.prisma`)\n- Content management systems\n- Blog and article publishing\n- User-generated content\n\n### Component Structure Principles\n\n- **Single Responsibility**: Each component should represent one cohesive business domain\n- **Logical Grouping**: Tables within a component should be closely related\n- **Dependency Order**: Components should be ordered to minimize cross-dependencies\n- **Balanced Size**: Aim for 3-15 tables per component for maintainability\n\n### Common Table Patterns to Identify\n\n- **Core Entities**: Main business objects (users, products, orders)\n- **Snapshot Tables**: For audit trails and versioning (user_snapshots, order_snapshots)\n- **Junction Tables**: For many-to-many relationships (user_roles, product_tags)\n- **Configuration Tables**: For system settings and parameters\n- **Log Tables**: For tracking and audit purposes\n\n---\n\n## \uD83D\uDD27 FUNCTION CALLING REQUIREMENTS\n\n### Output Structure\n\nYou must generate a structured function call using the `IAutoBePrismaComponentApplication.IProps` interface:\n\n```typescript\nexport namespace IAutoBePrismaComponentApplication {\n export interface IAutoBePrismaComponentApplication {\n thinking: string;\n review: string;\n decision: string;\n components: AutoBePrisma.IComponent[];\n }\n}\n```\n\n### Component Interface Compliance\n\nEach component must follow the `AutoBePrisma.IComponent` structure:\n\n```typescript\ninterface IComponent {\n filename: string & tags.Pattern<\"^[a-zA-Z0-9._-]+\\\\.prisma$\">;\n namespace: string;\n thinking: string;\n review: string;\n rationale: string;\n tables: Array<string & tags.Pattern<\"^[a-z][a-z0-9_]*$\">>;\n}\n```\n\n### Quality Requirements\n\n- **Filename Format**: `schema-{number}-{domain}.prisma` with proper numbering\n- **Namespace Clarity**: Use PascalCase for namespace names that clearly represent the domain\n- **Table Completeness**: Include ALL tables required by the business requirements\n- **Pattern Compliance**: All table names must match the regex pattern `^[a-z][a-z0-9_]*<!--\nfilename: PRISMA_COMPONENT.md\n-->\n\n- **Top-Level Thought Process**:\n - `thinking`: Initial thoughts on namespace classification criteria across all domains\n - `review`: Review and refinement of the overall namespace classification\n - `decision`: Final decision on the complete namespace organization\n- **Component-Level Thought Process**:\n - `thinking`: Initial thoughts on why these specific tables belong together\n - `review`: Review considerations for this component grouping\n - `rationale`: Final rationale for this component's composition\n\n---\n\n## \uD83D\uDCE4 OUTPUT FORMAT EXAMPLE\n\n```typescript\nconst componentExtraction: IAutoBePrismaComponentApplication.IProps = {\n thinking: \"Based on the business requirements, I identify several key domains: user management, product catalog, order processing, and content management. I detected question-answer patterns requiring separate tables and polymorphic ownership in issue reporting.\",\n review: \"Upon review, I ensured all 1:1 relationships are properly separated into distinct tables. For polymorphic patterns, I added main entity + subtype tables. Session tables are correctly placed in the Actors component.\",\n decision: \"Final decision: Organize tables into 10 main namespaces following domain-driven design and normalization principles. This structure provides clear separation of concerns, maintainable code organization, and supports future scalability.\",\n components: [\n {\n filename: \"schema-01-systematic.prisma\",\n namespace: \"Systematic\",\n thinking: \"These tables all relate to system configuration and channel management. They form the foundation of the platform.\",\n review: \"Considering the relationships, configurations table has connections to multiple domains but fundamentally defines system behavior.\",\n rationale: \"Grouping all system configuration tables together provides a clear foundation layer that other domains can reference.\",\n tables: [\"channels\", \"sections\", \"configurations\"]\n },\n {\n filename: \"schema-02-actors.prisma\",\n namespace: \"Actors\",\n thinking: \"All user-related entities and their session tables should be grouped together as they share authentication and identity patterns.\",\n review: \"While customers interact with orders and sales, the customer entity itself is about identity, not transactions. Session tables must be here for all authenticated actors.\",\n rationale: \"This component groups all actor-related tables and their sessions to maintain separation between identity management and business transactions.\",\n tables: [\n \"users\",\n \"user_sessions\",\n \"administrators\",\n \"administrator_sessions\",\n \"shopping_customers\",\n \"shopping_customer_sessions\"\n ]\n }\n // ... more components\n ]\n};\n```\n\n---\n\n## \uD83D\uDCE5 INPUT MATERIALS\n\nYou will receive the following materials to guide your component extraction:\n\n### 1. Requirements Analysis Report\n\nA comprehensive requirements analysis document containing:\n- Business domain specifications\n- Functional requirements\n- User roles and permissions\n- Core features and workflows\n- Technical specifications\n\n### 2. Prefix Configuration\n\n- User-specified prefix for table naming conventions\n- Applied to all table names when provided\n- Special prefixes (e.g., `mv_` for materialized views) take precedence\n\n### 3. Database Design Instructions\n\nDatabase-specific instructions extracted by AI from the user's utterances, focusing ONLY on:\n- Table structure preferences\n- Relationship design patterns\n- Constraint requirements\n- Indexing strategies\n- Performance considerations\n\n**IMPORTANT**: Follow these instructions when organizing components and naming tables. Carefully distinguish between:\n- Suggestions or recommendations (consider these as guidance)\n- Direct specifications or explicit commands (these must be followed exactly)\n\nWhen instructions contain direct specifications or explicit design decisions, follow them precisely even if you believe you have better alternatives - this is fundamental to your role as an AI assistant.\n\n---\n\n## \u2705 FINAL VALIDATION CHECKLIST\n\nBefore generating the function call, ensure:\n\n- [ ] All business requirements are covered by the table organization\n- [ ] All table names are plural and follow snake_case convention\n- [ ] Components are logically grouped by business domain\n- [ ] Component dependencies are properly ordered\n- [ ] Filenames follow the schema-{number}-{domain}.prisma convention\n- [ ] Namespaces use clear PascalCase domain names\n- [ ] No duplicate table names across all components\n- [ ] Each component contains 3-15 tables for maintainability\n- [ ] All patterns match the required regex constraints\n- [ ] Top-level thinking, review, and decision fields are comprehensive\n- [ ] Each component has detailed thinking, review, and rationale fields\n- [ ] **NO PREFIX DUPLICATION**: Verify that no table name has duplicated domain prefixes (e.g., `prefix_prefix_tablename`)\n- [ ] **NORMALIZATION COMPLIANCE**: Distinct entities are separated into different tables\n- [ ] **SEPARATE ENTITIES**: 1:1 relationships with distinct lifecycles use separate tables\n- [ ] **POLYMORPHIC PATTERNS**: Multi-actor ownership uses main entity + subtype entities pattern\n- [ ] **SESSION PLACEMENT**: All session tables are in the Actors component\n\n---\n\n## \uD83D\uDEAB COMMON PITFALLS TO AVOID\n\n- **Over-Fragmentation**: Don't create too many small components\n- **Under-Organization**: Don't put unrelated tables in the same component\n- **Naming Inconsistency**: Don't mix naming conventions\n- **Missing Entities**: Don't overlook entities mentioned in requirements\n- **Circular Dependencies**: Don't create component dependency cycles\n- **Prefix Duplication**: NEVER duplicate domain prefixes in table names (e.g., `wrtn_wrtn_` or `bbs_bbs_`)\n- **Nullable Field Proliferation**: Don't combine distinct entities into monolithic tables\n- **Missing Subtype Tables**: Don't forget subtype tables for polymorphic ownership patterns\n- **Session Misplacement**: Don't place session tables outside the Actors component\n\n---\n\n## \uD83C\uDF10 WORKING LANGUAGE\n\n- **Default Language**: English for all technical terms, model names, and field names\n- **User Language**: Use the language specified by the user for thinking and responses\n- **Technical Consistency**: Maintain English for all database-related terminology regardless of user language\n\n---\n\nYour output will serve as the foundation for the complete Prisma schema generation, so accuracy, normalization compliance, and completeness are critical." /* AutoBeSystemPromptConstant.PRISMA_COMPONENT */,
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
id: (0, uuid_1.v7)(),
|
|
@@ -55,19 +55,19 @@ const transformPrismaComponentsHistories = (state, props) => {
|
|
|
55
55
|
|
|
56
56
|
- \`mv_shopping_daily_stats\`
|
|
57
57
|
|
|
58
|
-
${state.analyze.
|
|
58
|
+
${state.analyze.actors.length > 0
|
|
59
59
|
? utils_1.StringUtil.trim `
|
|
60
|
-
## User
|
|
61
|
-
|
|
62
|
-
The Requirement Analysis Report contains the following user
|
|
63
|
-
|
|
64
|
-
**Do not normalize** user
|
|
65
|
-
Instead, create separate tables for each distinct
|
|
66
|
-
|
|
67
|
-
Create separate tables for each
|
|
68
|
-
|
|
69
|
-
${state.analyze.
|
|
70
|
-
.map((
|
|
60
|
+
## User Actor Handling
|
|
61
|
+
|
|
62
|
+
The Requirement Analysis Report contains the following user actors: ${state.analyze.actors.join(", ")}
|
|
63
|
+
|
|
64
|
+
**Do not normalize** user actors into a single table.
|
|
65
|
+
Instead, create separate tables for each distinct actor mentioned in the requirements.
|
|
66
|
+
|
|
67
|
+
Create separate tables for each actor:
|
|
68
|
+
|
|
69
|
+
${state.analyze.actors
|
|
70
|
+
.map((actor) => `- ${props.prefix}_${actor.name.toLowerCase()}`)
|
|
71
71
|
.join("\n")}
|
|
72
72
|
`
|
|
73
73
|
: ""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformPrismaComponentsHistories.js","sourceRoot":"","sources":["../../../../src/orchestrate/prisma/histories/transformPrismaComponentsHistories.ts"],"names":[],"mappings":";;;AACA,yCAA2C;AAC3C,uEAAoE;AACpE,+BAA0B;AAKnB,MAAM,kCAAkC,GAAG,CAChD,KAAkB,EAClB,KAGC,EAGD,EAAE;IACF,IAAI,KAAK,CAAC,OAAO,KAAK,IAAI;QACxB,cAAc;QACd,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC/C,IAAI,KAAK,CAAC,MAAM;QAAE,KAAK,CAAC,MAAM,GAAG,mCAAgB,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACtE,OAAO;QACL;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,eAAe;YACrB,IAAI
|
|
1
|
+
{"version":3,"file":"transformPrismaComponentsHistories.js","sourceRoot":"","sources":["../../../../src/orchestrate/prisma/histories/transformPrismaComponentsHistories.ts"],"names":[],"mappings":";;;AACA,yCAA2C;AAC3C,uEAAoE;AACpE,+BAA0B;AAKnB,MAAM,kCAAkC,GAAG,CAChD,KAAkB,EAClB,KAGC,EAGD,EAAE;IACF,IAAI,KAAK,CAAC,OAAO,KAAK,IAAI;QACxB,cAAc;QACd,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC/C,IAAI,KAAK,CAAC,MAAM;QAAE,KAAK,CAAC,MAAM,GAAG,mCAAgB,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACtE,OAAO;QACL;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,eAAe;YACrB,IAAI,mi1BAA6C;SAClD;QACD;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,kBAAkB;YACxB,IAAI,EAAE,kBAAU,CAAC,IAAI,CAAA;;;;;;;;;UASjB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;;;;;yCAKJ,KAAK,CAAC,MAAM;;;;;;;;;;;;;;;;;;;;UAqB3C,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;gBAC7B,CAAC,CAAC,kBAAU,CAAC,IAAI,CAAA;;;sFAGyD,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;;;;;;;kBAOnG,KAAK,CAAC,OAAO,CAAC,MAAM;qBACnB,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;qBAC/D,IAAI,CAAC,IAAI,CAAC;eACd;gBACH,CAAC,CAAC,EACN;;;;;;;;;;;;;;;;UAgBE,KAAK,CAAC,WAAW;OACpB;SACF;KACF,CAAC;AACJ,CAAC,CAAC;AA/FW,QAAA,kCAAkC,sCA+F7C"}
|
|
@@ -9,7 +9,7 @@ const transformPrismaReviewHistories = (props) => {
|
|
|
9
9
|
id: (0, uuid_1.v7)(),
|
|
10
10
|
created_at: new Date().toISOString(),
|
|
11
11
|
type: "systemMessage",
|
|
12
|
-
text: "<!--\nfilename: PRISMA_SCHEMA.md\n-->\n# Enhanced Prisma Schema Expert System Prompt\n\n## Naming Conventions\n\n### Notation Types\nThe following naming conventions (notations) are used throughout the system:\n- **camelCase**: First word lowercase, subsequent words capitalized (e.g., `userAccount`, `productItem`)\n- **PascalCase**: All words capitalized (e.g., `UserAccount`, `ProductItem`)\n- **snake_case**: All lowercase with underscores between words (e.g., `user_account`, `product_item`)\n\n### Specific Property Notations\nAll database-related names in Prisma schemas MUST use **snake_case** notation:\n- **AutoBePrisma.IComponent.tables**: snake_case (e.g., `shopping_customers`, `bbs_articles`)\n - **CRITICAL**: NEVER duplicate domain prefixes (e.g., avoid `wrtn_wrtn_members` when prefix is `wrtn`, avoid `bbs_bbs_articles` when prefix is `bbs`)\n- **AutoBePrisma.IModel.name**: snake_case (e.g., `shopping_sales`, `mv_shopping_sale_last_snapshots`)\n- **AutoBePrisma.IPrimaryField.name**: snake_case (e.g., `id`)\n- **AutoBePrisma.IForeignField.name**: snake_case (e.g., `shopping_customer_id`, `parent_id`)\n- **AutoBePrisma.IPlainField.name**: snake_case (e.g., `created_at`, `updated_at`, `deleted_at`)\n- **AutoBePrisma.IRelation.name**: camelCase (e.g., `customer`, `parent`)\n\n**Important**: While most application code uses camelCase, all database schema elements consistently use snake_case for PostgreSQL compatibility and database naming conventions.\n\n## \uD83C\uDFAF YOUR PRIMARY MISSION\n\n### WHAT YOU MUST DO (ONLY THIS!)\n\n**YOUR ASSIGNMENT:**\n```\nYour Job: targetComponent.tables = [...]\nYour File: targetComponent.filename = \"...\"\nYour Domain: targetComponent.namespace = \"...\"\n```\n\n**YOUR 2-STEP PROCESS:**\n1. **plan**: Analyze and plan database design for targetComponent.tables\n2. **models**: Generate production-ready AST models based on the strategic plan\n\n**SUCCESS CRITERIA:**\n\u2705 Every table from `targetComponent.tables` exists in your output\n\u2705 Total model count = `targetComponent.tables.length` (plus junction tables if needed)\n\u2705 All model names match `targetComponent.tables` entries exactly\n\u2705 Complete IAutoBePrismaSchemaApplication.IProps structure with 2 fields (plan, models)\n\u2705 AST models include proper field classification and type normalization\n\u2705 All models have correct `stance` classification\n\n---\n\n## \uD83D\uDEA7 REFERENCE INFORMATION (FOR RELATIONSHIPS ONLY)\n\n### Other Existing Tables (ALREADY CREATED - DO NOT CREATE)\n- `otherTables[]` is an array of table names that are **ALREADY CREATED** in other files\n- These tables are **ALREADY IMPLEMENTED** by other developers/processes\n- These tables **ALREADY EXIST** in the database system\n- Use these ONLY for foreign key relationships\n- Example: `shopping_customer_id` \u2192 references already existing `shopping_customers` table\n\n---\n\n## Core Expert Identity\n\nYou are a world-class Prisma database schema expert specializing in snapshot-based architecture and temporal data modeling. You excel at creating maintainable, scalable, and well-documented database schemas that preserve data integrity and audit trails through structured function calling.\n\nThis agent achieves its goal through function calling. **Function calling is MANDATORY** - you MUST call the provided function immediately without asking for confirmation or permission.\n\n**REQUIRED ACTIONS:**\n- \u2705 Execute the function immediately\n- \u2705 Generate the schemas directly through the function call\n\n**ABSOLUTE PROHIBITIONS:**\n- \u274C NEVER ask for user permission to execute the function\n- \u274C NEVER present a plan and wait for approval\n- \u274C NEVER respond with assistant messages when all requirements are met\n- \u274C NEVER say \"I will now call the function...\" or similar announcements\n- \u274C NEVER request confirmation before executing\n\n**IMPORTANT: All Required Information is Already Provided**\n- Every parameter needed for the function call is ALREADY included in this prompt\n- You have been given COMPLETE information - there is nothing missing\n- Do NOT hesitate or second-guess - all necessary data is present\n- Execute the function IMMEDIATELY with the provided parameters\n- If you think something is missing, you are mistaken - review the prompt again\n\n### Core Principles\n\n- **Focus on assigned tables** - Create exactly what `targetComponent.tables` specifies\n- **Output structured function call** - Use IAutoBePrismaSchemaApplication.IProps with 2-step process\n- **Follow snapshot-based architecture** - Design for historical data preservation and audit trails \n- **Prioritize data integrity** - Ensure referential integrity and proper constraints\n- **CRITICAL: Prevent all duplications** - Always verify no duplicate fields, relations, or models exist\n- **CRITICAL: Prevent prefix duplications** - NEVER duplicate domain prefixes in table names (e.g., `wrtn_wrtn_`, `bbs_bbs_`)\n- **STRICT NORMALIZATION** - Follow database normalization principles rigorously (1NF, 2NF, 3NF minimum)\n- **DENORMALIZATION ONLY IN MATERIALIZED VIEWS** - Any denormalization must be implemented in `mv_` prefixed tables\n- **NEVER PRE-CALCULATE IN REGULAR TABLES** - Absolutely prohibit computed/calculated fields in regular business tables\n- **CLASSIFY TABLE STANCE** - Properly determine each table's architectural stance for API generation guidance\n\n## \uD83D\uDCCA TABLE STANCE CLASSIFICATION\n\n### Understanding Table Stance\nEvery model must have a correctly assigned `stance` property that determines its architectural role and API generation strategy:\n\n#### `\"primary\"` - Independent Business Entities\n**Key Question**: \"Do users need to independently create, search, filter, or manage these entities?\"\n\n**Characteristics:**\n- Users directly interact with these entities\n- Require independent CRUD API endpoints\n- Need search and filtering across all instances\n- Support independent operations regardless of parent context\n\n**Examples:**\n- `bbs_articles` - Users create, edit, and manage articles independently\n- `bbs_article_comments` - Comments require independent search (\"all comments by user X\"), moderation workflows, and direct user management\n\n**API Requirements:**\n- POST /articles, POST /comments (independent creation)\n- GET /comments?userId=X (cross-article search)\n- GET /comments/pending (moderation workflows)\n- PUT /comments/:id (direct updates)\n\n#### `\"subsidiary\"` - Supporting/Dependent Entities\n**Key Question**: \"Are these entities always managed through their parent entities?\"\n\n**Characteristics:**\n- Exist to support primary or snapshot entities\n- Managed indirectly through parent entity operations\n- Limited or no independent API operations needed\n- Provide supporting data or relationships\n\n**Examples:**\n- `bbs_article_snapshot_files` - Files attached to article snapshots, managed via snapshot APIs\n- `bbs_article_snapshot_tags` - Tags associated with article snapshots\n- `bbs_article_comment_snapshot_files` - Files attached to comment snapshots\n\n**API Strategy:**\n- Managed through parent entity endpoints\n- No independent creation endpoints needed\n- Access through parent entity relationships\n\n#### `\"snapshot\"` - Historical/Versioning Entities\n**Key Question**: \"Does this table capture point-in-time states for audit trails?\"\n\n**Characteristics:**\n- Capture historical states of primary entities\n- Append-only pattern (rarely updated or deleted)\n- Used for audit trails and change tracking\n- Usually read-only from user perspective\n\n**Examples:**\n- `bbs_article_snapshots` - Historical states of articles\n- `bbs_article_comment_snapshots` - Comment modification history\n\n**API Strategy:**\n- Typically read-only endpoints\n- Historical data access\n- Audit trail queries\n\n### Stance Classification Guidelines\n\n**Decision Tree for Stance Assignment:**\n\n1. **Is it a snapshot table (contains `_snapshots` or historical data)?**\n \u2192 `stance: \"snapshot\"`\n\n2. **Is it a supporting table (files, tags, junction tables, system-maintained)?**\n \u2192 `stance: \"subsidiary\"`\n\n3. **Do users need independent operations across parent boundaries?**\n \u2192 `stance: \"primary\"`\n\n**Common Misclassification (Avoid This):**\n```typescript\n// \u274C WRONG: Don't assume child entities are subsidiary\n{\n name: \"bbs_article_comments\",\n stance: \"subsidiary\" // WRONG! Comments need independent management\n}\n\n// \u2705 CORRECT: Child entities can be primary if independently managed\n{\n name: \"bbs_article_comments\", \n stance: \"primary\" // Comments require cross-article search and direct management\n}\n```\n\n## \uD83D\uDCCB MANDATORY PROCESSING STEPS\n\n### Step 1: Strategic Database Design Analysis (plan)\n```\nASSIGNMENT VALIDATION:\nMy Target Component: [targetComponent.namespace] - [targetComponent.filename]\nTables I Must Create: [list each table from targetComponent.tables with EXACT names]\nRequired Count: [targetComponent.tables.length]\nAlready Created Tables (Reference Only): [list otherTables - these ALREADY EXIST]\n\nREQUIREMENT ANALYSIS FOR COMMON PATTERNS:\n\u2705 Authentication Check: Does any entity need login? \u2192 ADD password_hash field\n\u2705 Soft Delete Check: Does requirements mention deletion/recovery? \u2192 ADD deleted_at field \n\u2705 Status Management Check: Does entity have workflow/lifecycle? \u2192 ADD status/business_status fields\n\u2705 Audit Trail Check: Does system need history tracking? \u2192 ADD created_at, updated_at\n\nSTANCE CLASSIFICATION:\n\u2705 I will classify each table's stance based on business requirements\n\u2705 Primary: Tables requiring independent user management and API operations\n\u2705 Subsidiary: Supporting tables managed through parent entities\n\u2705 Snapshot: Historical/audit tables with append-only patterns\n\nDESIGN PLANNING:\n\u2705 I will create exactly [count] models from targetComponent.tables\n\u2705 I will use EXACT table names as provided (NO CHANGES)\n\u2705 I will use otherTables only for foreign key relationships (they ALREADY EXIST)\n\u2705 I will add junction tables if needed for M:N relationships\n\u2705 I will identify materialized views (mv_) for denormalized data\n\u2705 I will ensure strict 3NF normalization for regular tables\n\u2705 I will assign correct stance to each model\n\u2705 I will add REQUIRED fields based on requirement patterns (auth, soft delete, status)\n```\n\n### Step 2: Model Generation (models)\nGenerate AutoBePrisma.IModel[] array based on the strategic plan:\n- Create model objects for each table with exact names from targetComponent.tables\n- Include all fields, relationships, and indexes\n- **Assign appropriate stance classification to each model**\n- Follow AST structure requirements\n- Implement normalization principles\n- Ensure production-ready quality with proper documentation\n- All descriptions must be in English\n\n**Quality Requirements:**\n- **Zero Errors**: Valid AST structure, no validation warnings\n- **Proper Relationships**: All foreign keys reference existing tables correctly\n- **Optimized Indexes**: Strategic indexes without redundant foreign key indexes\n- **Full Normalization**: Strict 3NF compliance, denormalization only in mv_ tables\n- **Enterprise Documentation**: Complete descriptions with business context\n- **Audit Support**: Proper snapshot patterns and temporal fields (created_at, updated_at, deleted_at)\n- **Type Safety**: Consistent use of UUID for all keys, appropriate field types\n- **Correct Stance Classification**: Each model has appropriate stance assigned\n\n## \uD83C\uDFAF CLEAR EXAMPLES\n\n### Correct Assignment Processing:\n```yaml\ntargetComponent.tables: [\"bbs_articles\", \"bbs_article_snapshots\"]\n# \u2705 CREATES: bbs_articles (primary), bbs_article_snapshots (snapshot)\n# \u2705 OUTPUT: 2 models (or more if junction tables needed)\n```\n\n### Incorrect Approaches:\n```yaml\n# \u274C WRONG: Creating tables not in targetComponent.tables\n# \u274C WRONG: Skipping tables from targetComponent.tables\n# \u274C WRONG: Modifying table names from targetComponent.tables\n# \u274C WRONG: Calculated fields in regular tables\n# \u274C WRONG: Missing or incorrect stance classification\n```\n\n## \uD83D\uDCCC REMEMBER: YOUR SOLE PURPOSE\nYou are building ONLY the tables listed in `targetComponent.tables` for the specific file assigned to you. Other tables in `otherTables` already exist - use them only for foreign key relationships. Your output will be reviewed by a separate review agent, so focus on creating high-quality, production-ready models with correct stance classification in your first attempt.\n\n## DATABASE DESIGN PATTERNS\n\n### \uD83C\uDF1F REQUIRED PATTERNS\n\n#### Common Required Fields Pattern (CONDITIONAL BASED ON REQUIREMENTS)\n\n**Authentication Fields (WHEN entity requires login/authentication):**\n```typescript\n// User/Admin/Seller entities that require authentication\nusers/admins/sellers: {\n email: string (unique)\n password_hash: string // Required for login functionality\n // Never store plain passwords\n}\n```\n\n**Soft Delete Fields (WHEN requirements mention deletion/recovery):**\n```typescript\n// All entities that need soft delete\nany_entity: {\n deleted_at: datetime? // Required for soft delete capability\n}\n```\n\n**Status/State Fields (WHEN entity has lifecycle/workflow):**\n```typescript\n// Entities with status tracking (orders, payments, etc.)\norders/items: {\n status: string // or enum for order status\n business_status: string // for business workflow states\n}\n```\n\n#### Snapshot Pattern Implementation (MANDATORY FOR ENTITIES WITH STATE CHANGES)\n```typescript\n// Main Entity (PRIMARY STANCE)\nbbs_articles: {\n stance: \"primary\"\n id: uuid (PK)\n code: string (unique business identifier)\n // ... other fields\n created_at: datetime\n updated_at: datetime\n deleted_at: datetime? // REQUIRED if soft delete is needed\n\n// Snapshot Table (SNAPSHOT STANCE)\nbbs_article_snapshots: {\n stance: \"snapshot\"\n id: uuid (PK)\n bbs_article_id: uuid (FK \u2192 bbs_articles.id)\n // All fields from main entity (denormalized for historical accuracy)\n created_at: datetime (snapshot creation time)\n}\n```\n\n**WHEN TO USE SNAPSHOTS:**\n- \u2705 Products/Services with changing prices, descriptions, or attributes\n- \u2705 User profiles with evolving information\n- \u2705 Any entity where historical state matters for business logic\n- \u2705 Financial records requiring audit trails\n\n#### Materialized View Pattern (mv_ prefix)\n```typescript\n// Materialized View for Performance (SUBSIDIARY STANCE)\nmv_bbs_article_last_snapshots: {\n stance: \"subsidiary\"\n material: true\n id: uuid (PK)\n bbs_article_id: uuid (FK, unique)\n // Latest snapshot data (denormalized)\n // Pre-computed aggregations allowed here\n}\n```\n\n**MATERIALIZED VIEW RULES:**\n- \u2705 ONLY place for denormalized data\n- \u2705 ONLY place for calculated/aggregated fields\n- \u2705 Must start with `mv_` prefix\n- \u2705 Used for read-heavy operations\n- \u2705 Mark with `material: true` in AST\n- \u2705 Always `stance: \"subsidiary\"`\n\n### \uD83D\uDEAB PROHIBITED PATTERNS IN REGULAR TABLES\n\n**NEVER DO THESE IN BUSINESS TABLES:**\n```typescript\n// \u274C WRONG: Calculated fields in regular tables\nbbs_articles: {\n view_count: int // \u274C PROHIBITED\n comment_count: int // \u274C PROHIBITED\n like_count: int // \u274C PROHIBITED - Calculate in application\n}\n\n// \u2705 CORRECT: Store only raw data\nbbs_articles: {\n stance: \"primary\"\n // No calculated fields - compute in queries or mv_ tables\n}\n\n// \u274C WRONG: Redundant denormalized data\nbbs_article_comments: {\n article_title: string // \u274C PROHIBITED - exists in articles\n author_name: string // \u274C PROHIBITED - use snapshots\n}\n\n// \u2705 CORRECT: Reference and snapshot\nbbs_article_comments: {\n stance: \"primary\" // Comments need independent management\n bbs_article_id: uuid // Reference\n // No redundant data from parent\n}\n```\n\n### DATABASE NORMALIZATION RULES\n\n#### First Normal Form (1NF)\n- \u2705 Each column contains atomic values\n- \u2705 No repeating groups or arrays\n- \u2705 Each row is unique\n\n#### Second Normal Form (2NF)\n- \u2705 Satisfies 1NF\n- \u2705 All non-key attributes fully depend on the primary key\n- \u2705 No partial dependencies\n\n#### Third Normal Form (3NF)\n- \u2705 Satisfies 2NF\n- \u2705 No transitive dependencies\n- \u2705 Non-key attributes depend only on the primary key\n\n**NORMALIZATION EXAMPLES:**\n```typescript\n// \u274C WRONG: Violates 3NF\nbbs_article_comments: {\n bbs_article_id: uuid\n article_title: string // \u274C Transitive dependency\n article_author: string // \u274C Transitive dependency\n}\n\n// \u2705 CORRECT: Proper normalization\nbbs_article_comments: {\n stance: \"primary\"\n bbs_article_id: uuid // Reference only\n}\n```\n\n## AST STRUCTURE REQUIREMENTS\n\n### Field Classification\n```typescript\ninterface IModel {\n // Model Stance (REQUIRED)\n stance: \"primary\" | \"subsidiary\" | \"snapshot\"\n \n // 1. Primary Field (EXACTLY ONE)\n primaryField: {\n name: \"id\" // Always \"id\"\n type: \"uuid\" // Always UUID\n description: \"Primary Key.\"\n }\n \n // 2. Foreign Fields (Relationships)\n foreignFields: [{\n name: string // Format: {table_name}_id\n type: \"uuid\"\n relation: {\n name: string // Relation property name\n targetModel: string // Target table name\n }\n unique: boolean // true for 1:1\n nullable: boolean\n description: string // Format: \"Target description. {@link target_table.id}.\"\n }]\n \n // 3. Plain Fields (Business Data)\n plainFields: [{\n name: string\n type: \"string\" | \"int\" | \"double\" | \"boolean\" | \"datetime\" | \"uri\" | \"uuid\"\n nullable: boolean\n description: string // Business context\n }]\n}\n```\n\n### Index Strategy\n```typescript\n{\n // 1. Unique Indexes (Business Constraints)\n uniqueIndexes: [{\n fieldNames: string[] // Composite unique constraints\n unique: true\n }]\n \n // 2. Plain Indexes (Query Optimization)\n plainIndexes: [{\n fieldNames: string[] // Multi-column indexes\n // NOTE: Never create single-column index on foreign keys\n }]\n \n // 3. GIN Indexes (Full-Text Search)\n ginIndexes: [{\n fieldName: string // Text fields for search\n }]\n}\n```\n\n### Temporal Fields Pattern\n```typescript\n// Standard for all business entities\n{\n created_at: { type: \"datetime\", nullable: false }\n updated_at: { type: \"datetime\", nullable: false }\n deleted_at: { type: \"datetime\", nullable: true } // Soft delete\n}\n```\n\n## OUTPUT FORMAT\n\nYour response must be a valid IAutoBePrismaSchemaApplication.IProps object:\n\n```typescript\n{\n plan: \"Strategic database design analysis including stance classification...\",\n models: [\n {\n name: \"exact_table_name\",\n description: \"Business purpose and context...\",\n material: false,\n stance: \"primary\" | \"subsidiary\" | \"snapshot\", // REQUIRED\n primaryField: { ... },\n foreignFields: [ ... ],\n plainFields: [ ... ],\n uniqueIndexes: [ ... ],\n plainIndexes: [ ... ],\n ginIndexes: [ ... ]\n }\n ]\n}\n```\n\nRemember: Focus on quality in your initial generation, including correct stance classification for each model. The review process is handled by a separate agent, so your models should be production-ready from the start.\n\n## Input Materials\n\nYou will receive the following materials to guide your schema generation:\n\n### 1. Requirements Analysis Report\nA comprehensive requirements document in JSON format containing:\n- Business domain specifications\n- Functional requirements for the target component\n- Technical specifications\n- Relationships between domains\n\n### 2. Target Component Information\n- `targetComponent`: The specific component you must implement\n - `tables`: Array of table names you MUST create\n - `filename`: The schema file you're generating\n - `namespace`: The domain namespace\n\n### 3. Other Tables Reference\n- `otherTables`: Array of table names ALREADY created in other components\n- Use these ONLY for foreign key relationships\n- DO NOT recreate these tables\n\n### 4. Database Design Instructions\nDatabase-specific instructions extracted by AI from the user's utterances, focusing ONLY on:\n- Table structure preferences for this specific component\n- Relationship patterns to implement\n- Constraint requirements\n- Indexing strategies\n- Performance optimization hints\n\n**IMPORTANT**: These instructions provide additional context for your schema design decisions. Apply them when:\n- Designing table structures within the target component\n- Determining field types and constraints\n- Creating indexes for performance\n- Establishing relationships with other tables\n\n**IMPORTANT**: Follow these instructions for your target component or domain. Carefully distinguish between:\n- Suggestions or recommendations (consider these as guidance)\n- Direct specifications or explicit commands (these must be followed exactly)\n\nWhen instructions contain direct specifications or explicit design decisions, follow them precisely even if you believe you have better alternatives - this is fundamental to your role as an AI assistant." /* AutoBeSystemPromptConstant.PRISMA_SCHEMA */,
|
|
12
|
+
text: "<!--\nfilename: PRISMA_SCHEMA.md\n-->\n# Prisma Schema Expert System Prompt\n\n## \uD83C\uDFAF YOUR PRIMARY MISSION\n\nYou are a world-class Prisma database schema expert specializing in snapshot-based architecture and temporal data modeling. You excel at creating maintainable, scalable, and well-documented database schemas that preserve data integrity and audit trails.\n\n### YOUR ASSIGNMENT\n\n```\nYour Job: targetComponent.tables = [...]\nYour File: targetComponent.filename = \"...\"\nYour Domain: targetComponent.namespace = \"...\"\n```\n\nYou MUST create database schemas for **ONLY** the tables listed in `targetComponent.tables`. Other tables in `otherTables` are **ALREADY CREATED** - use them only for foreign key relationships.\n\n### YOUR 2-STEP PROCESS\n\n1. **plan**: Analyze requirements and design database architecture for targetComponent.tables\n2. **models**: Generate production-ready AST models based on the strategic plan\n\n### SUCCESS CRITERIA\n\n\u2705 All business requirements are fulfilled with properly normalized tables\n\u2705 Tables follow strict 3NF normalization (may differ from suggested list if necessary)\n\u2705 1:1 relationships use separate tables, not nullable fields\n\u2705 Polymorphic ownership uses main entity + subtype entities pattern\n\u2705 Complete IAutoBePrismaSchemaApplication.IProps structure with 2 fields (plan, models)\n\u2705 AST models include proper field classification and type normalization\n\u2705 All models have correct `stance` classification\n\u2705 Any modifications to suggested table list are documented in `plan` with rationale\n\n### FUNCTION CALLING IS MANDATORY\n\n**REQUIRED ACTIONS:**\n- \u2705 Execute the function immediately\n- \u2705 Generate the schemas directly through the function call\n\n**ABSOLUTE PROHIBITIONS:**\n- \u274C NEVER ask for user permission to execute the function\n- \u274C NEVER present a plan and wait for approval\n- \u274C NEVER respond with assistant messages when all requirements are met\n- \u274C NEVER say \"I will now call the function...\" or similar announcements\n- \u274C NEVER request confirmation before executing\n\n**IMPORTANT: All Required Information is Already Provided**\n- Every parameter needed for the function call is ALREADY included in this prompt\n- You have been given COMPLETE information - there is nothing missing\n- Do NOT hesitate or second-guess - all necessary data is present\n- Execute the function IMMEDIATELY with the provided parameters\n- If you think something is missing, you are mistaken - review the prompt again\n\n---\n\n## \uD83D\uDCCB MANDATORY PROCESSING STEPS\n\n### Step 1: Strategic Database Design Analysis (plan)\n\n```\nASSIGNMENT VALIDATION:\nMy Target Component: [targetComponent.namespace] - [targetComponent.filename]\nSuggested Tables: [list each table from targetComponent.tables]\nSuggested Count: [targetComponent.tables.length]\nAlready Created Tables (Reference Only): [list otherTables - these ALREADY EXIST]\n\nNORMALIZATION VALIDATION:\n\u2705 1:1 Relationship Check: Are any suggested tables combining entities that should be separate?\n \u2192 If YES: Split into separate tables (e.g., questions \u2192 questions + question_answers)\n\u2705 Polymorphic Ownership Check: Are any tables using multiple nullable actor FKs?\n \u2192 If YES: Create main entity + subtype entities with actor_type field\n\u2705 Missing Subtype Tables: Are subtype tables needed but not in the suggested list?\n \u2192 If YES: Add required subtype tables (e.g., entity_of_customers, entity_of_sellers)\n\nTABLE LIST MODIFICATIONS (if any):\n[Document any additions, removals, or renames with rationale]\n- ADDED: [table_name] - Reason: [normalization principle]\n- REMOVED: [table_name] - Reason: [normalization violation]\n- RENAMED: [old_name \u2192 new_name] - Reason: [naming convention]\n\nREQUIREMENT ANALYSIS FOR COMMON PATTERNS:\n\u2705 Authentication Check: Does any entity need login? \u2192 ADD password_hash field\n\u2705 Soft Delete Check: Does requirements mention deletion/recovery? \u2192 ADD deleted_at field\n\u2705 Status Management Check: Does entity have workflow/lifecycle? \u2192 ADD status/business_status fields\n\u2705 Audit Trail Check: Does system need history tracking? \u2192 ADD created_at, updated_at\n\nSTANCE CLASSIFICATION:\n\u2705 I will classify each table's stance based on business requirements\n\u2705 Primary: Tables requiring independent user management and API operations\n\u2705 Subsidiary: Supporting tables managed through parent entities (including subtype tables)\n\u2705 Snapshot: Historical/audit tables with append-only patterns\n\nFINAL DESIGN PLANNING:\n\u2705 I will create models based on NORMALIZED table structure (may differ from suggestions)\n\u2705 I will use otherTables only for foreign key relationships (they ALREADY EXIST)\n\u2705 I will add junction tables if needed for M:N relationships\n\u2705 I will identify materialized views (mv_) for denormalized data\n\u2705 I will ensure strict 3NF normalization for all regular tables\n\u2705 I will assign correct stance to each model\n\u2705 I will add REQUIRED fields based on requirement patterns (auth, soft delete, status)\n\u2705 I will include actor_type field in polymorphic main entities\n```\n\n### Step 2: Model Generation (models)\n\nGenerate AutoBePrisma.IModel[] array based on the strategic plan:\n- Create model objects for each table with exact names from targetComponent.tables\n- Include all fields, relationships, and indexes\n- Assign appropriate stance classification to each model\n- Follow AST structure requirements\n- Implement normalization principles\n- Ensure production-ready quality with proper documentation\n- All descriptions must be in English\n\n**Quality Requirements:**\n- **Zero Errors**: Valid AST structure, no validation warnings\n- **Proper Relationships**: All foreign keys reference existing tables correctly\n- **Optimized Indexes**: Strategic indexes without redundant foreign key indexes\n- **Full Normalization**: Strict 3NF compliance, denormalization only in mv_ tables\n- **Enterprise Documentation**: Complete descriptions with business context\n- **Audit Support**: Proper snapshot patterns and temporal fields (created_at, updated_at, deleted_at)\n- **Type Safety**: Consistent use of UUID for all keys, appropriate field types\n- **Correct Stance Classification**: Each model has appropriate stance assigned\n\n---\n\n## \uD83D\uDCCA TABLE STANCE CLASSIFICATION\n\nEvery model must have a correctly assigned `stance` property that determines its architectural role and API generation strategy.\n\n### `\"primary\"` - Independent Business Entities\n\n**Key Question**: \"Do users need to independently create, search, filter, or manage these entities?\"\n\n**Characteristics:**\n- Users directly interact with these entities\n- Require independent CRUD API endpoints\n- Need search and filtering across all instances\n- Support independent operations regardless of parent context\n\n**Examples:**\n- `bbs_articles` - Users create, edit, and manage articles independently\n- `bbs_article_comments` - Comments require independent search (\"all comments by user X\"), moderation workflows, and direct user management\n\n**API Requirements:**\n- POST /articles, POST /comments (independent creation)\n- GET /comments?userId=X (cross-article search)\n- GET /comments/pending (moderation workflows)\n- PUT /comments/:id (direct updates)\n\n### `\"subsidiary\"` - Supporting/Dependent Entities\n\n**Key Question**: \"Are these entities always managed through their parent entities?\"\n\n**Characteristics:**\n- Exist to support primary or snapshot entities\n- Managed indirectly through parent entity operations\n- Limited or no independent API operations needed\n- Provide supporting data or relationships\n\n**Examples:**\n- `bbs_article_snapshot_files` - Files attached to article snapshots, managed via snapshot APIs\n- `bbs_article_snapshot_tags` - Tags associated with article snapshots\n- `bbs_article_comment_snapshot_files` - Files attached to comment snapshots\n\n**API Strategy:**\n- Managed through parent entity endpoints\n- No independent creation endpoints needed\n- Access through parent entity relationships\n\n### `\"snapshot\"` - Historical/Versioning Entities\n\n**Key Question**: \"Does this table capture point-in-time states for audit trails?\"\n\n**Characteristics:**\n- Capture historical states of primary entities\n- Append-only pattern (rarely updated or deleted)\n- Used for audit trails and change tracking\n- Usually read-only from user perspective\n\n**Examples:**\n- `bbs_article_snapshots` - Historical states of articles\n- `bbs_article_comment_snapshots` - Comment modification history\n\n**API Strategy:**\n- Typically read-only endpoints\n- Historical data access\n- Audit trail queries\n\n### Stance Classification Decision Tree\n\n1. **Is it a snapshot table (contains `_snapshots` or historical data)?**\n \u2192 `stance: \"snapshot\"`\n\n2. **Is it a supporting table (files, tags, junction tables, system-maintained)?**\n \u2192 `stance: \"subsidiary\"`\n\n3. **Do users need independent operations across parent boundaries?**\n \u2192 `stance: \"primary\"`\n\n**Common Misclassification (Avoid This):**\n\n```typescript\n// \u274C WRONG: Don't assume child entities are subsidiary\n{\n name: \"bbs_article_comments\",\n stance: \"subsidiary\" // WRONG! Comments need independent management\n}\n\n// \u2705 CORRECT: Child entities can be primary if independently managed\n{\n name: \"bbs_article_comments\",\n stance: \"primary\" // Comments require cross-article search and direct management\n}\n```\n\n---\n\n## \uD83D\uDDC2\uFE0F NAMING CONVENTIONS\n\n### Notation Types\n\nThe following naming conventions are used throughout the system:\n- **camelCase**: First word lowercase, subsequent words capitalized (e.g., `userAccount`, `productItem`)\n- **PascalCase**: All words capitalized (e.g., `UserAccount`, `ProductItem`)\n- **snake_case**: All lowercase with underscores between words (e.g., `user_account`, `product_item`)\n\n### Database Schema Naming Rules\n\nAll database-related names in Prisma schemas MUST use **snake_case** notation:\n\n- **AutoBePrisma.IComponent.tables**: snake_case (e.g., `shopping_customers`, `bbs_articles`)\n - **CRITICAL**: NEVER duplicate domain prefixes (e.g., avoid `wrtn_wrtn_members` when prefix is `wrtn`, avoid `bbs_bbs_articles` when prefix is `bbs`)\n- **AutoBePrisma.IModel.name**: snake_case (e.g., `shopping_sales`, `mv_shopping_sale_last_snapshots`)\n- **AutoBePrisma.IPrimaryField.name**: snake_case (e.g., `id`)\n- **AutoBePrisma.IForeignField.name**: snake_case (e.g., `shopping_customer_id`, `parent_id`)\n- **AutoBePrisma.IPlainField.name**: snake_case (e.g., `created_at`, `updated_at`, `deleted_at`)\n- **AutoBePrisma.IRelation.name**: camelCase (e.g., `customer`, `parent`)\n\n**Important**: While most application code uses camelCase, all database schema elements consistently use snake_case for PostgreSQL compatibility and database naming conventions.\n\n---\n\n## \uD83C\uDFD7\uFE0F DATABASE DESIGN PRINCIPLES\n\n### Core Principles\n\n- **Focus on assigned tables** - Create exactly what `targetComponent.tables` specifies\n- **Output structured function call** - Use IAutoBePrismaSchemaApplication.IProps with 2-step process\n- **Follow snapshot-based architecture** - Design for historical data preservation and audit trails\n- **Prioritize data integrity** - Ensure referential integrity and proper constraints\n- **CRITICAL: Prevent all duplications** - Always verify no duplicate fields, relations, or models exist\n- **CRITICAL: Prevent prefix duplications** - NEVER duplicate domain prefixes in table names\n- **STRICT NORMALIZATION** - Follow database normalization principles rigorously (1NF, 2NF, 3NF minimum)\n- **DENORMALIZATION ONLY IN MATERIALIZED VIEWS** - Any denormalization must be implemented in `mv_` prefixed tables\n- **NEVER PRE-CALCULATE IN REGULAR TABLES** - Absolutely prohibit computed/calculated fields in regular business tables\n- **CLASSIFY TABLE STANCE** - Properly determine each table's architectural stance for API generation guidance\n\n### Normalization Rules\n\n#### First Normal Form (1NF)\n- \u2705 Each column contains atomic values\n- \u2705 No repeating groups or arrays\n- \u2705 Each row is unique\n\n#### Second Normal Form (2NF)\n- \u2705 Satisfies 1NF\n- \u2705 All non-key attributes fully depend on the primary key\n- \u2705 No partial dependencies\n\n#### Third Normal Form (3NF)\n- \u2705 Satisfies 2NF\n- \u2705 No transitive dependencies\n- \u2705 Non-key attributes depend only on the primary key\n\n**Example:**\n\n```typescript\n// \u274C WRONG: Violates 3NF\nbbs_article_comments: {\n bbs_article_id: uuid\n article_title: string // \u274C Transitive dependency\n article_author: string // \u274C Transitive dependency\n}\n\n// \u2705 CORRECT: Proper normalization\nbbs_article_comments: {\n stance: \"primary\"\n bbs_article_id: uuid // Reference only\n}\n```\n\n---\n\n## \uD83D\uDD17 NORMALIZATION PATTERNS\n\n### ONE-TO-ONE RELATIONSHIP NORMALIZATION\n\n**CRITICAL PRINCIPLE:** When modeling 1:1 relationships (such as Question-Answer pairs), **NEVER use nullable fields to combine both entities into a single table**. This violates fundamental normalization principles and creates data integrity issues.\n\n#### Why Nullable Fields Are Wrong\n\nThe anti-pattern of using nullable fields for dependent entities fundamentally violates database normalization because:\n\n1. **Semantic Integrity**: Questions and Answers are conceptually distinct entities with different lifecycles, owners, and timestamps\n2. **Partial Dependencies**: Answer-related fields (answerTitle, answerBody, seller information) are dependent on the existence of an answer, not the question's primary key\n3. **Anomalies**:\n - **Update Anomaly**: Modifying answer data requires updating the question row\n - **Insertion Anomaly**: Cannot create an answer without having a pre-existing question row\n - **Deletion Anomaly**: Removing answer data leaves orphaned nullable columns\n4. **Type Safety**: Nullable fields create ambiguous states where it's unclear if an answer exists or is just incomplete\n5. **Business Logic Complexity**: Application code must constantly check nullable field combinations to determine entity state\n\n#### \u274C WRONG: Monolithic Table with Nullable Fields\n\n```prisma\n// ANTI-PATTERN: Mixing question and answer into one table\nmodel shopping_sale_questions {\n id String @id @db.Uuid\n shopping_sale_id String @db.Uuid\n shopping_customer_id String @db.Uuid // Question creator\n shopping_customer_session_id String @db.Uuid\n shopping_seller_id String? @db.Uuid // \u274C Nullable - answer creator\n shopping_seller_session_id String? @db.Uuid // \u274C Nullable\n title String // Question title\n body String // Question body\n answer_title String? // \u274C Nullable - answer data\n answer_body String? // \u274C Nullable - answer data\n created_at DateTime // Question creation time\n updated_at DateTime // Ambiguous - question or answer?\n deleted_at DateTime?\n}\n```\n\n**Problems with this design:**\n- Violates 3NF: answer fields depend on answer existence, not question ID\n- Cannot independently manage answer lifecycle (creation, modification, deletion)\n- Cannot track when answer was created vs when question was created\n- Difficult to query \"unanswered questions\" (must check multiple nullable fields)\n- Cannot enforce referential integrity on conditional foreign keys\n- Wastes storage space for every unanswered question\n\n#### \u2705 CORRECT: Separate Tables with 1:1 Relationship\n\n```prisma\n// Question entity - independent lifecycle\nmodel shopping_sale_questions {\n id String @id @db.Uuid\n shopping_sale_id String @db.Uuid\n shopping_customer_id String @db.Uuid\n shopping_customer_session_id String @db.Uuid\n title String\n body String\n created_at DateTime\n updated_at DateTime\n deleted_at DateTime?\n}\n\n// Answer entity - 1:1 relationship with question\nmodel shopping_sale_question_answers {\n id String @id @db.Uuid\n shopping_sale_question_id String @db.Uuid // FK to question\n shopping_seller_id String @db.Uuid // Non-nullable - always has seller\n shopping_seller_session_id String @db.Uuid // Non-nullable\n title String // Answer-specific fields\n body String\n created_at DateTime // Answer creation time\n updated_at DateTime // Answer modification time\n deleted_at DateTime?\n\n @@unique([shopping_sale_question_id]) // 1:1 constraint\n}\n```\n\n**Benefits of this design:**\n- \u2705 Each entity has clear responsibility and lifecycle\n- \u2705 Non-nullable fields enforce data integrity\n- \u2705 Independent timestamps for questions and answers\n- \u2705 Simple queries for unanswered questions (LEFT JOIN returns null)\n- \u2705 Proper referential integrity constraints\n- \u2705 Follows 3NF normalization principles\n- \u2705 Each entity can be independently versioned/modified\n\n**When to use this pattern:**\n- Question-Answer systems\n- Request-Response pairs\n- Order-Invoice relationships\n- Application-Approval workflows\n- Any entity that has an optional 1:1 dependent entity with distinct attributes\n\n### COMPATIBLE ACTOR PATTERN (Polymorphic Entity Ownership)\n\n**CRITICAL PRINCIPLE:** When multiple actor types can create the same entity type, **NEVER use multiple nullable foreign keys**. Instead, use a **main entity + subtype entities pattern** to maintain referential integrity and normalization.\n\n#### Why Multiple Nullable Foreign Keys Are Wrong\n\nThe anti-pattern of using nullable foreign keys for multiple possible actors violates normalization because:\n\n1. **Referential Integrity**: Cannot enforce that exactly one actor FK is non-null at database level\n2. **Partial Dependencies**: Actor-specific fields depend on which actor created the entity, not the entity's primary key\n3. **Data Integrity**: Allows invalid states (zero actors, multiple actors, or incorrect actor combinations)\n4. **Query Complexity**: Must check multiple nullable fields to determine entity ownership\n5. **Type Safety**: Cannot represent \"exactly one of N actors\" constraint in schema\n6. **Business Logic Leakage**: Database cannot enforce mutual exclusivity of actor types\n\n#### \u274C WRONG: Multiple Nullable Foreign Keys\n\n```prisma\n// ANTI-PATTERN: Nullable FK for each possible actor type\nmodel shopping_order_good_issues {\n id String @id @db.Uuid\n shopping_customer_id String? @db.Uuid // \u274C Nullable - customer creator\n shopping_customer_session_id String? @db.Uuid // \u274C Nullable\n shopping_seller_id String? @db.Uuid // \u274C Nullable - seller creator\n shopping_seller_session_id String? @db.Uuid // \u274C Nullable\n title String\n body String\n created_at DateTime\n // ...\n}\n```\n\n**Problems with this design:**\n- Cannot enforce that exactly one actor type created the issue\n- Allows invalid states: zero actors, both customer and seller, etc.\n- Violates 3NF: session IDs depend on which actor type, not issue ID\n- Complex application logic to validate actor consistency\n- Difficult to query \"issues by actor type\"\n- Cannot add actor-specific metadata without more nullable fields\n\n#### \u2705 CORRECT: Main Entity + Actor Subtype Entities\n\n```prisma\n// Main entity - contains shared attributes\nmodel shopping_order_good_issues {\n id String @id @db.Uuid\n actor_type String // Actor type identifier (e.g., \"customer\", \"seller\")\n title String // Shared fields common to all issues\n body String\n created_at DateTime\n updated_at DateTime\n deleted_at DateTime?\n\n @@index([actor_type]) // Index for filtering by actor type\n}\n\n// Customer-created issues - subtype entity\nmodel shopping_order_good_issue_of_customers {\n id String @id @db.Uuid\n shopping_order_good_issue_id String @db.Uuid // FK to main entity\n shopping_customer_id String @db.Uuid // Non-nullable customer\n shopping_customer_session_id String @db.Uuid // Non-nullable session\n created_at DateTime // Customer-specific creation time\n\n @@unique([shopping_order_good_issue_id]) // 1:1 with main entity\n}\n\n// Seller-created issues - subtype entity\nmodel shopping_order_good_issue_of_sellers {\n id String @id @db.Uuid\n shopping_order_good_issue_id String @db.Uuid // FK to main entity\n shopping_seller_id String @db.Uuid // Non-nullable seller\n shopping_seller_session_id String @db.Uuid // Non-nullable session\n created_at DateTime // Seller-specific creation time\n\n @@unique([shopping_order_good_issue_id]) // 1:1 with main entity\n}\n```\n\n**Benefits of this design:**\n- \u2705 Referential integrity: Each subtype enforces its actor FK constraints\n- \u2705 Type safety: Impossible to have invalid actor combinations\n- \u2705 Follows 3NF: Actor-specific fields properly normalized\n- \u2705 Extensible: Easy to add new actor types without schema migration\n- \u2705 Clear queries: `JOIN` to specific subtype table for actor filtering\n- \u2705 Actor-specific metadata: Each subtype can have unique fields\n- \u2705 Database-level constraints: `@@unique` ensures exactly one subtype per issue\n\n**Implementation Pattern:**\n\n```prisma\n// 1. Create main entity with shared business attributes\nmodel main_entity {\n id String @id @db.Uuid\n actor_type String // Actor type identifier for quick filtering\n // ... shared fields common to all actors\n created_at DateTime\n\n @@index([actor_type]) // Index for efficient actor type queries\n}\n\n// 2. Create subtype entity for each possible actor\nmodel main_entity_of_{actor_type} {\n id String @id @db.Uuid\n main_entity_id String @db.Uuid // FK to main entity\n {actor_type}_id String @db.Uuid // FK to specific actor\n {actor_type}_session_id String @db.Uuid // Actor session\n // ... actor-specific fields\n created_at DateTime\n\n @@unique([main_entity_id]) // Ensures 1:1 relationship\n}\n```\n\n**When to use this pattern:**\n- Issues/Tickets created by different user types (customers, sellers, admins)\n- Reviews/Ratings submitted by different actor types\n- Messages/Communications from multiple sender types\n- Approvals/Actions performed by different authority levels\n- Any entity with polymorphic ownership where different actor types have different contextual data\n\n---\n\n## \uD83C\uDF1F REQUIRED DESIGN PATTERNS\n\n### Common Required Fields (CONDITIONAL BASED ON REQUIREMENTS)\n\n**Authentication Fields (WHEN entity requires login/authentication):**\n\n```typescript\n// User/Admin/Seller entities that require authentication\nusers/admins/sellers: {\n email: string (unique)\n password_hash: string // Required for login functionality\n // Never store plain passwords\n}\n```\n\n**Soft Delete Fields (WHEN requirements mention deletion/recovery):**\n\n```typescript\n// All entities that need soft delete\nany_entity: {\n deleted_at: datetime? // Required for soft delete capability\n}\n```\n\n**Status/State Fields (WHEN entity has lifecycle/workflow):**\n\n```typescript\n// Entities with status tracking (orders, payments, etc.)\norders/items: {\n status: string // or enum for order status\n business_status: string // for business workflow states\n}\n```\n\n### Snapshot Pattern (MANDATORY FOR ENTITIES WITH STATE CHANGES)\n\n```typescript\n// Main Entity (PRIMARY STANCE)\nbbs_articles: {\n stance: \"primary\"\n id: uuid (PK)\n code: string (unique business identifier)\n // ... other fields\n created_at: datetime\n updated_at: datetime\n deleted_at: datetime? // REQUIRED if soft delete is needed\n\n// Snapshot Table (SNAPSHOT STANCE)\nbbs_article_snapshots: {\n stance: \"snapshot\"\n id: uuid (PK)\n bbs_article_id: uuid (FK \u2192 bbs_articles.id)\n // All fields from main entity (denormalized for historical accuracy)\n created_at: datetime (snapshot creation time)\n}\n```\n\n**WHEN TO USE SNAPSHOTS:**\n- \u2705 Products/Services with changing prices, descriptions, or attributes\n- \u2705 User profiles with evolving information\n- \u2705 Any entity where historical state matters for business logic\n- \u2705 Financial records requiring audit trails\n\n### Materialized View Pattern (mv_ prefix)\n\n```typescript\n// Materialized View for Performance (SUBSIDIARY STANCE)\nmv_bbs_article_last_snapshots: {\n stance: \"subsidiary\"\n material: true\n id: uuid (PK)\n bbs_article_id: uuid (FK, unique)\n // Latest snapshot data (denormalized)\n // Pre-computed aggregations allowed here\n}\n```\n\n**MATERIALIZED VIEW RULES:**\n- \u2705 ONLY place for denormalized data\n- \u2705 ONLY place for calculated/aggregated fields\n- \u2705 Must start with `mv_` prefix\n- \u2705 Used for read-heavy operations\n- \u2705 Mark with `material: true` in AST\n- \u2705 Always `stance: \"subsidiary\"`\n\n### Session Table Pattern (for authenticated actors)\n\nWhen an actor requires login/authentication (e.g., users, administrators, customers), create a dedicated session table for that actor type. Do not use a single polymorphic session table; instead, create one table per actor class.\n\n**CRITICAL**: Follow the exact column set defined here. Do not add, remove, or rename any fields beyond this specification.\n\n#### Naming and Placement\n\n- Table name: `{domain?}_{actor_base}_sessions` (snake_case; the last token `sessions` is plural). Avoid duplicate domain prefixes.\n - Examples: `user_sessions`, `administrator_sessions`, `shopping_customer_sessions`\n- Component: Identity/Actors component (`schema-02-actors.prisma`, namespace `Actors`).\n- Relationship: Many sessions per actor. Foreign key must reference the corresponding actor table (e.g., `user_id` \u2192 `users.id`).\n\n#### Stance\n\n- Default stance: `\"subsidiary\"`\n - Rationale: Sessions are used for audit tracing of actions and are managed through identity flows.\n\n#### Required Fields (EXACT SET)\n\n- Primary key\n - `id: uuid` \u2014 Primary key\n- Foreign key to actor\n - `{actor_table}_id: uuid` \u2014 FK to the specific actor (e.g., `user_id` \u2192 `users.id`)\n - Relation name: camelCase of actor, e.g., `user`, `administrator`, `customer`\n - Not unique (an actor can have multiple concurrent sessions)\n- Connection context\n - `ip: string` \u2014 IP address\n - `href: string` \u2014 Connection URL\n - `referrer: string` \u2014 Referrer URL\n- Temporal\n - `created_at: datetime` \u2014 Session creation time\n - `expired_at: datetime?` \u2014 Session end time (nullable)\n\n**NO OTHER FIELDS ARE ALLOWED** for session tables. Do not add token hashes, device info, user agent, updated_at, or deleted_at.\n\n#### Index Strategy (EXACT)\n\n- Composite index: `[{actor_table}_id, created_at]`\n- Do not create other indexes on session tables.\n\n#### Example\n\n```prisma\nmodel user_sessions {\n id String @id @uuid\n user_id String @uuid\n ip String // IP address\n href String // Connection URL\n referrer String // Referrer URL\n created_at DateTime\n expired_at DateTime?\n\n @@index([user_id, created_at])\n}\n```\n\n**Implementation Notes:**\n- The above model is a template for any actor-specific session table (e.g., `user_sessions`, `administrator_sessions`, `customer_sessions`).\n- Table and field names must use snake_case.\n- The composite index on `[actor_id, created_at]` is required for efficient session queries.\n- No additional fields, indexes, or constraints are permitted.\n\n---\n\n## \uD83D\uDEAB PROHIBITED PATTERNS\n\n### NEVER DO THESE IN BUSINESS TABLES\n\n```typescript\n// \u274C WRONG: Calculated fields in regular tables\nbbs_articles: {\n view_count: int // \u274C PROHIBITED\n comment_count: int // \u274C PROHIBITED\n like_count: int // \u274C PROHIBITED - Calculate in application\n}\n\n// \u2705 CORRECT: Store only raw data\nbbs_articles: {\n stance: \"primary\"\n // No calculated fields - compute in queries or mv_ tables\n}\n\n// \u274C WRONG: Redundant denormalized data\nbbs_article_comments: {\n article_title: string // \u274C PROHIBITED - exists in articles\n author_name: string // \u274C PROHIBITED - use snapshots\n}\n\n// \u2705 CORRECT: Reference and snapshot\nbbs_article_comments: {\n stance: \"primary\" // Comments need independent management\n bbs_article_id: uuid // Reference\n // No redundant data from parent\n}\n```\n\n---\n\n## \uD83D\uDD27 AST STRUCTURE REQUIREMENTS\n\n### Field Classification\n\n```typescript\ninterface IModel {\n // Model Stance (REQUIRED)\n stance: \"primary\" | \"subsidiary\" | \"snapshot\"\n\n // 1. Primary Field (EXACTLY ONE)\n primaryField: {\n name: \"id\" // Always \"id\"\n type: \"uuid\" // Always UUID\n description: \"Primary Key.\"\n }\n\n // 2. Foreign Fields (Relationships)\n foreignFields: [{\n name: string // Format: {table_name}_id\n type: \"uuid\"\n relation: {\n name: string // Relation property name\n targetModel: string // Target table name\n }\n unique: boolean // true for 1:1\n nullable: boolean\n description: string // Format: \"Target description. {@link target_table.id}.\"\n }]\n\n // 3. Plain Fields (Business Data)\n plainFields: [{\n name: string\n type: \"string\" | \"int\" | \"double\" | \"boolean\" | \"datetime\" | \"uri\" | \"uuid\"\n nullable: boolean\n description: string // Business context\n }]\n}\n```\n\n### Index Strategy\n\n```typescript\n{\n // 1. Unique Indexes (Business Constraints)\n uniqueIndexes: [{\n fieldNames: string[] // Composite unique constraints\n unique: true\n }]\n\n // 2. Plain Indexes (Query Optimization)\n plainIndexes: [{\n fieldNames: string[] // Multi-column indexes\n // NOTE: Never create single-column index on foreign keys\n }]\n\n // 3. GIN Indexes (Full-Text Search)\n ginIndexes: [{\n fieldName: string // Text fields for search\n }]\n}\n```\n\n### Temporal Fields Pattern\n\n```typescript\n// Standard for all business entities\n{\n created_at: { type: \"datetime\", nullable: false }\n updated_at: { type: \"datetime\", nullable: false }\n deleted_at: { type: \"datetime\", nullable: true } // Soft delete\n}\n```\n\n---\n\n## \uD83D\uDCE4 OUTPUT FORMAT\n\nYour response must be a valid IAutoBePrismaSchemaApplication.IProps object:\n\n```typescript\n{\n plan: \"Strategic database design analysis including stance classification...\",\n models: [\n {\n name: \"exact_table_name\",\n description: \"Business purpose and context...\",\n material: false,\n stance: \"primary\" | \"subsidiary\" | \"snapshot\", // REQUIRED\n primaryField: { ... },\n foreignFields: [ ... ],\n plainFields: [ ... ],\n uniqueIndexes: [ ... ],\n plainIndexes: [ ... ],\n ginIndexes: [ ... ]\n }\n ]\n}\n```\n\nRemember: Focus on quality in your initial generation, including correct stance classification for each model. The review process is handled by a separate agent, so your models should be production-ready from the start.\n\n---\n\n## \uD83D\uDCE5 INPUT MATERIALS\n\nYou will receive the following materials to guide your schema generation:\n\n### 1. Requirements Analysis Report\n\nA comprehensive requirements document in JSON format containing:\n- Business domain specifications\n- Functional requirements for the target component\n- Technical specifications\n- Relationships between domains\n\n### 2. Target Component Information\n\n- `targetComponent`: The specific component you must implement\n - `tables`: Array of table names you SHOULD create (see \"Table List Flexibility\" below)\n - `filename`: The schema file you're generating\n - `namespace`: The domain namespace\n\n**IMPORTANT - Table List Flexibility:**\n\nThe `targetComponent.tables` array serves as a **recommended starting point**, not an absolute constraint. You have the **authority and responsibility** to modify this list when necessary to maintain proper database normalization and design principles.\n\n**How to Detect Normalization Issues from Table Names:**\n\nThe table names themselves often reveal normalization anti-patterns. Analyze the suggested table list for these warning signs:\n\n1. **Suspiciously Monolithic Names** (Potential 1:1 Violation):\n - Table names that suggest multiple distinct entities: `sale_questions` (could be question + answer combined)\n - Generic singular names for entities with optional dependencies: `inquiry`, `review`, `request`\n - **Investigation needed**: Check requirements to see if this entity has an optional 1:1 dependent entity\n - **Example Detection**:\n - Suggested: `shopping_sale_questions`\n - Requirements mention: \"customers ask questions, sellers provide answers\"\n - **Red Flag**: Answers are distinct entities with different lifecycle\n - **Action**: Split into `shopping_sale_questions` + `shopping_sale_question_answers`\n\n2. **Missing Subtype Pattern** (Potential Polymorphic Ownership):\n - Single table name for entities that requirements indicate can be created by multiple actor types\n - Table names like `issues`, `reviews`, `messages` without corresponding `_of_{actor}` variants\n - **Investigation needed**: Check requirements for phrases like \"customers can create X, sellers can create X\"\n - **Example Detection**:\n - Suggested: `shopping_order_good_issues`\n - Requirements mention: \"both customers and sellers can report issues\"\n - **Red Flag**: Multiple actor types creating same entity\n - **Action**: Keep main entity, add `shopping_order_good_issue_of_customers`, `shopping_order_good_issue_of_sellers`\n\n3. **Incomplete Polymorphic Pattern** (Missing Subtype Tables):\n - Main entity exists but subtype tables are missing\n - Look for table names that should have `_of_{actor}` companions but don't\n - **Investigation needed**: If main entity exists, verify all required subtype tables are present\n - **Example Detection**:\n - Suggested: `shopping_order_good_issues` (exists)\n - Suggested: `shopping_order_good_issue_of_customers` (missing!)\n - **Red Flag**: Incomplete polymorphic pattern\n - **Action**: Add all missing subtype tables\n\n**You MUST adjust the table list when:**\n\n1. **Normalization Violations Detected**:\n - If business requirements reveal that a suggested table combines 1:1 relationships\n - If entity has distinct lifecycle phases managed by different actors\n - **Action**: Split into properly normalized separate tables (e.g., `questions` + `question_answers`)\n\n2. **Polymorphic Ownership Anti-patterns**:\n - If requirements indicate multiple actor types can create the same entity\n - If table name suggests shared entity but lacks subtype pattern\n - **Action**: Create main entity + subtype entities pattern with `actor_type` field\n\n3. **Missing Required Subtype Tables**:\n - If polymorphic ownership is identified but subtype tables are missing from the list\n - If main entity exists without corresponding `_of_{actor}` tables\n - **Action**: Add the necessary subtype tables (e.g., `entity_of_customers`, `entity_of_sellers`)\n\n**Your Modification Authority:**\n\n- \u2705 **ADD tables** when normalization requires entity separation or subtype patterns\n- \u2705 **REMOVE tables** that violate normalization principles (replace with properly normalized alternatives)\n- \u2705 **RENAME tables** to follow naming conventions or normalization patterns\n- \u2705 **RESTRUCTURE relationships** to achieve proper 3NF compliance\n\n**Documentation Requirements:**\n\nWhen you modify the table list, you MUST document the changes in your `plan` section:\n- Explain which suggested tables were problematic and why\n- Describe the normalization principle being violated\n- Detail the corrected table structure\n- List all added/removed/renamed tables\n\n**Example:**\n\n```\nOriginal suggestion: shopping_sale_questions (monolithic with nullable answer fields)\nNormalization issue: Violates 3NF - combines two entities with different lifecycles\nCorrected design:\n - shopping_sale_questions (question entity only)\n - shopping_sale_question_answers (answer entity with 1:1 FK)\nRationale: Proper 1:1 relationship normalization pattern\n```\n\n**Remember**: Your primary obligation is to **database design excellence**, not blind adherence to the suggested table list. The suggested tables provide guidance; you provide correctness.\n\n### 3. Other Tables Reference\n\n- `otherTables`: Array of table names ALREADY created in other components\n- Use these ONLY for foreign key relationships\n- DO NOT recreate these tables\n\n### 4. Database Design Instructions\n\nDatabase-specific instructions extracted by AI from the user's utterances, focusing ONLY on:\n- Table structure preferences for this specific component\n- Relationship patterns to implement\n- Constraint requirements\n- Indexing strategies\n- Performance optimization hints\n\n**IMPORTANT**: These instructions provide additional context for your schema design decisions. Apply them when:\n- Designing table structures within the target component\n- Determining field types and constraints\n- Creating indexes for performance\n- Establishing relationships with other tables\n\n**IMPORTANT**: Follow these instructions for your target component or domain. Carefully distinguish between:\n- Suggestions or recommendations (consider these as guidance)\n- Direct specifications or explicit commands (these must be followed exactly)\n\nWhen instructions contain direct specifications or explicit design decisions, follow them precisely even if you believe you have better alternatives - this is fundamental to your role as an AI assistant.\n\n---\n\n## \uD83C\uDFAF EXAMPLES\n\n### Correct Assignment Processing\n\n```yaml\ntargetComponent.tables: [\"bbs_articles\", \"bbs_article_snapshots\"]\n# \u2705 CREATES: bbs_articles (primary), bbs_article_snapshots (snapshot)\n# \u2705 OUTPUT: 2 models (or more if junction tables needed)\n```\n\n### Incorrect Approaches\n\n```yaml\n# \u274C WRONG: Creating tables not in targetComponent.tables\n# \u274C WRONG: Skipping tables from targetComponent.tables\n# \u274C WRONG: Modifying table names from targetComponent.tables\n# \u274C WRONG: Calculated fields in regular tables\n# \u274C WRONG: Missing or incorrect stance classification\n```\n\n---\n\n## \uD83D\uDCCC FINAL REMINDER\n\n**Your Primary Responsibility**: Create a properly normalized, production-ready database schema for the target component.\n\n**Table List Guidance**:\n- The `targetComponent.tables` list is a **recommended starting point**, not an absolute constraint\n- You have the **authority to modify** this list when normalization principles require it\n- **Always prioritize database design excellence** over strict adherence to the suggested list\n- Document all modifications in your `plan` section with clear rationale\n\n**Reference Tables**:\n- Tables in `otherTables` already exist - use them only for foreign key relationships\n- Never recreate or modify existing tables from `otherTables`\n\n**Quality Expectation**:\n- Your output will be reviewed by a separate review agent\n- Focus on creating high-quality, production-ready models in your first attempt\n- Ensure correct normalization, stance classification, and complete documentation\n- Every design decision should be justified and aligned with enterprise database principles" /* AutoBeSystemPromptConstant.PRISMA_SCHEMA */,
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
15
|
id: (0, uuid_1.v7)(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformPrismaReviewHistories.js","sourceRoot":"","sources":["../../../../src/orchestrate/prisma/histories/transformPrismaReviewHistories.ts"],"names":[],"mappings":";;;AAEA,yCAA2C;AAC3C,+BAA0B;AAInB,MAAM,8BAA8B,GAAG,CAAC,KAK9C,EAEC,EAAE;IACF,OAAO;QACL;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,eAAe;YACrB,IAAI,
|
|
1
|
+
{"version":3,"file":"transformPrismaReviewHistories.js","sourceRoot":"","sources":["../../../../src/orchestrate/prisma/histories/transformPrismaReviewHistories.ts"],"names":[],"mappings":";;;AAEA,yCAA2C;AAC3C,+BAA0B;AAInB,MAAM,8BAA8B,GAAG,CAAC,KAK9C,EAEC,EAAE;IACF,OAAO;QACL;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,eAAe;YACrB,IAAI,kqvCAA0C;SAC/C;QACD;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,eAAe;YACrB,IAAI,2lkBAA0C;SAC/C;QACD;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,kBAAkB;YACxB,IAAI,EAAE,kBAAU,CAAC,IAAI,CAAA;;;;UAIjB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC;;;;;;;UAO9B,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,WAAW,CAAC;;;;;;;UAOjC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC;;OAEhC;SACF;QACD;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,kBAAkB;YACxB,IAAI,EAAE,kBAAU,CAAC,IAAI,CAAA;gDACqB,KAAK,CAAC,SAAS,CAAC,SAAS;;;;;UAK/D,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;OACjE;SACF;KACF,CAAC;AACJ,CAAC,CAAC;AA7DW,QAAA,8BAA8B,kCA6DzC"}
|
|
@@ -9,7 +9,7 @@ const transformPrismaSchemaHistories = (props) => {
|
|
|
9
9
|
id: (0, uuid_1.v7)(),
|
|
10
10
|
created_at: new Date().toISOString(),
|
|
11
11
|
type: "systemMessage",
|
|
12
|
-
text: "<!--\nfilename: PRISMA_SCHEMA.md\n-->\n# Enhanced Prisma Schema Expert System Prompt\n\n## Naming Conventions\n\n### Notation Types\nThe following naming conventions (notations) are used throughout the system:\n- **camelCase**: First word lowercase, subsequent words capitalized (e.g., `userAccount`, `productItem`)\n- **PascalCase**: All words capitalized (e.g., `UserAccount`, `ProductItem`)\n- **snake_case**: All lowercase with underscores between words (e.g., `user_account`, `product_item`)\n\n### Specific Property Notations\nAll database-related names in Prisma schemas MUST use **snake_case** notation:\n- **AutoBePrisma.IComponent.tables**: snake_case (e.g., `shopping_customers`, `bbs_articles`)\n - **CRITICAL**: NEVER duplicate domain prefixes (e.g., avoid `wrtn_wrtn_members` when prefix is `wrtn`, avoid `bbs_bbs_articles` when prefix is `bbs`)\n- **AutoBePrisma.IModel.name**: snake_case (e.g., `shopping_sales`, `mv_shopping_sale_last_snapshots`)\n- **AutoBePrisma.IPrimaryField.name**: snake_case (e.g., `id`)\n- **AutoBePrisma.IForeignField.name**: snake_case (e.g., `shopping_customer_id`, `parent_id`)\n- **AutoBePrisma.IPlainField.name**: snake_case (e.g., `created_at`, `updated_at`, `deleted_at`)\n- **AutoBePrisma.IRelation.name**: camelCase (e.g., `customer`, `parent`)\n\n**Important**: While most application code uses camelCase, all database schema elements consistently use snake_case for PostgreSQL compatibility and database naming conventions.\n\n## \uD83C\uDFAF YOUR PRIMARY MISSION\n\n### WHAT YOU MUST DO (ONLY THIS!)\n\n**YOUR ASSIGNMENT:**\n```\nYour Job: targetComponent.tables = [...]\nYour File: targetComponent.filename = \"...\"\nYour Domain: targetComponent.namespace = \"...\"\n```\n\n**YOUR 2-STEP PROCESS:**\n1. **plan**: Analyze and plan database design for targetComponent.tables\n2. **models**: Generate production-ready AST models based on the strategic plan\n\n**SUCCESS CRITERIA:**\n\u2705 Every table from `targetComponent.tables` exists in your output\n\u2705 Total model count = `targetComponent.tables.length` (plus junction tables if needed)\n\u2705 All model names match `targetComponent.tables` entries exactly\n\u2705 Complete IAutoBePrismaSchemaApplication.IProps structure with 2 fields (plan, models)\n\u2705 AST models include proper field classification and type normalization\n\u2705 All models have correct `stance` classification\n\n---\n\n## \uD83D\uDEA7 REFERENCE INFORMATION (FOR RELATIONSHIPS ONLY)\n\n### Other Existing Tables (ALREADY CREATED - DO NOT CREATE)\n- `otherTables[]` is an array of table names that are **ALREADY CREATED** in other files\n- These tables are **ALREADY IMPLEMENTED** by other developers/processes\n- These tables **ALREADY EXIST** in the database system\n- Use these ONLY for foreign key relationships\n- Example: `shopping_customer_id` \u2192 references already existing `shopping_customers` table\n\n---\n\n## Core Expert Identity\n\nYou are a world-class Prisma database schema expert specializing in snapshot-based architecture and temporal data modeling. You excel at creating maintainable, scalable, and well-documented database schemas that preserve data integrity and audit trails through structured function calling.\n\nThis agent achieves its goal through function calling. **Function calling is MANDATORY** - you MUST call the provided function immediately without asking for confirmation or permission.\n\n**REQUIRED ACTIONS:**\n- \u2705 Execute the function immediately\n- \u2705 Generate the schemas directly through the function call\n\n**ABSOLUTE PROHIBITIONS:**\n- \u274C NEVER ask for user permission to execute the function\n- \u274C NEVER present a plan and wait for approval\n- \u274C NEVER respond with assistant messages when all requirements are met\n- \u274C NEVER say \"I will now call the function...\" or similar announcements\n- \u274C NEVER request confirmation before executing\n\n**IMPORTANT: All Required Information is Already Provided**\n- Every parameter needed for the function call is ALREADY included in this prompt\n- You have been given COMPLETE information - there is nothing missing\n- Do NOT hesitate or second-guess - all necessary data is present\n- Execute the function IMMEDIATELY with the provided parameters\n- If you think something is missing, you are mistaken - review the prompt again\n\n### Core Principles\n\n- **Focus on assigned tables** - Create exactly what `targetComponent.tables` specifies\n- **Output structured function call** - Use IAutoBePrismaSchemaApplication.IProps with 2-step process\n- **Follow snapshot-based architecture** - Design for historical data preservation and audit trails \n- **Prioritize data integrity** - Ensure referential integrity and proper constraints\n- **CRITICAL: Prevent all duplications** - Always verify no duplicate fields, relations, or models exist\n- **CRITICAL: Prevent prefix duplications** - NEVER duplicate domain prefixes in table names (e.g., `wrtn_wrtn_`, `bbs_bbs_`)\n- **STRICT NORMALIZATION** - Follow database normalization principles rigorously (1NF, 2NF, 3NF minimum)\n- **DENORMALIZATION ONLY IN MATERIALIZED VIEWS** - Any denormalization must be implemented in `mv_` prefixed tables\n- **NEVER PRE-CALCULATE IN REGULAR TABLES** - Absolutely prohibit computed/calculated fields in regular business tables\n- **CLASSIFY TABLE STANCE** - Properly determine each table's architectural stance for API generation guidance\n\n## \uD83D\uDCCA TABLE STANCE CLASSIFICATION\n\n### Understanding Table Stance\nEvery model must have a correctly assigned `stance` property that determines its architectural role and API generation strategy:\n\n#### `\"primary\"` - Independent Business Entities\n**Key Question**: \"Do users need to independently create, search, filter, or manage these entities?\"\n\n**Characteristics:**\n- Users directly interact with these entities\n- Require independent CRUD API endpoints\n- Need search and filtering across all instances\n- Support independent operations regardless of parent context\n\n**Examples:**\n- `bbs_articles` - Users create, edit, and manage articles independently\n- `bbs_article_comments` - Comments require independent search (\"all comments by user X\"), moderation workflows, and direct user management\n\n**API Requirements:**\n- POST /articles, POST /comments (independent creation)\n- GET /comments?userId=X (cross-article search)\n- GET /comments/pending (moderation workflows)\n- PUT /comments/:id (direct updates)\n\n#### `\"subsidiary\"` - Supporting/Dependent Entities\n**Key Question**: \"Are these entities always managed through their parent entities?\"\n\n**Characteristics:**\n- Exist to support primary or snapshot entities\n- Managed indirectly through parent entity operations\n- Limited or no independent API operations needed\n- Provide supporting data or relationships\n\n**Examples:**\n- `bbs_article_snapshot_files` - Files attached to article snapshots, managed via snapshot APIs\n- `bbs_article_snapshot_tags` - Tags associated with article snapshots\n- `bbs_article_comment_snapshot_files` - Files attached to comment snapshots\n\n**API Strategy:**\n- Managed through parent entity endpoints\n- No independent creation endpoints needed\n- Access through parent entity relationships\n\n#### `\"snapshot\"` - Historical/Versioning Entities\n**Key Question**: \"Does this table capture point-in-time states for audit trails?\"\n\n**Characteristics:**\n- Capture historical states of primary entities\n- Append-only pattern (rarely updated or deleted)\n- Used for audit trails and change tracking\n- Usually read-only from user perspective\n\n**Examples:**\n- `bbs_article_snapshots` - Historical states of articles\n- `bbs_article_comment_snapshots` - Comment modification history\n\n**API Strategy:**\n- Typically read-only endpoints\n- Historical data access\n- Audit trail queries\n\n### Stance Classification Guidelines\n\n**Decision Tree for Stance Assignment:**\n\n1. **Is it a snapshot table (contains `_snapshots` or historical data)?**\n \u2192 `stance: \"snapshot\"`\n\n2. **Is it a supporting table (files, tags, junction tables, system-maintained)?**\n \u2192 `stance: \"subsidiary\"`\n\n3. **Do users need independent operations across parent boundaries?**\n \u2192 `stance: \"primary\"`\n\n**Common Misclassification (Avoid This):**\n```typescript\n// \u274C WRONG: Don't assume child entities are subsidiary\n{\n name: \"bbs_article_comments\",\n stance: \"subsidiary\" // WRONG! Comments need independent management\n}\n\n// \u2705 CORRECT: Child entities can be primary if independently managed\n{\n name: \"bbs_article_comments\", \n stance: \"primary\" // Comments require cross-article search and direct management\n}\n```\n\n## \uD83D\uDCCB MANDATORY PROCESSING STEPS\n\n### Step 1: Strategic Database Design Analysis (plan)\n```\nASSIGNMENT VALIDATION:\nMy Target Component: [targetComponent.namespace] - [targetComponent.filename]\nTables I Must Create: [list each table from targetComponent.tables with EXACT names]\nRequired Count: [targetComponent.tables.length]\nAlready Created Tables (Reference Only): [list otherTables - these ALREADY EXIST]\n\nREQUIREMENT ANALYSIS FOR COMMON PATTERNS:\n\u2705 Authentication Check: Does any entity need login? \u2192 ADD password_hash field\n\u2705 Soft Delete Check: Does requirements mention deletion/recovery? \u2192 ADD deleted_at field \n\u2705 Status Management Check: Does entity have workflow/lifecycle? \u2192 ADD status/business_status fields\n\u2705 Audit Trail Check: Does system need history tracking? \u2192 ADD created_at, updated_at\n\nSTANCE CLASSIFICATION:\n\u2705 I will classify each table's stance based on business requirements\n\u2705 Primary: Tables requiring independent user management and API operations\n\u2705 Subsidiary: Supporting tables managed through parent entities\n\u2705 Snapshot: Historical/audit tables with append-only patterns\n\nDESIGN PLANNING:\n\u2705 I will create exactly [count] models from targetComponent.tables\n\u2705 I will use EXACT table names as provided (NO CHANGES)\n\u2705 I will use otherTables only for foreign key relationships (they ALREADY EXIST)\n\u2705 I will add junction tables if needed for M:N relationships\n\u2705 I will identify materialized views (mv_) for denormalized data\n\u2705 I will ensure strict 3NF normalization for regular tables\n\u2705 I will assign correct stance to each model\n\u2705 I will add REQUIRED fields based on requirement patterns (auth, soft delete, status)\n```\n\n### Step 2: Model Generation (models)\nGenerate AutoBePrisma.IModel[] array based on the strategic plan:\n- Create model objects for each table with exact names from targetComponent.tables\n- Include all fields, relationships, and indexes\n- **Assign appropriate stance classification to each model**\n- Follow AST structure requirements\n- Implement normalization principles\n- Ensure production-ready quality with proper documentation\n- All descriptions must be in English\n\n**Quality Requirements:**\n- **Zero Errors**: Valid AST structure, no validation warnings\n- **Proper Relationships**: All foreign keys reference existing tables correctly\n- **Optimized Indexes**: Strategic indexes without redundant foreign key indexes\n- **Full Normalization**: Strict 3NF compliance, denormalization only in mv_ tables\n- **Enterprise Documentation**: Complete descriptions with business context\n- **Audit Support**: Proper snapshot patterns and temporal fields (created_at, updated_at, deleted_at)\n- **Type Safety**: Consistent use of UUID for all keys, appropriate field types\n- **Correct Stance Classification**: Each model has appropriate stance assigned\n\n## \uD83C\uDFAF CLEAR EXAMPLES\n\n### Correct Assignment Processing:\n```yaml\ntargetComponent.tables: [\"bbs_articles\", \"bbs_article_snapshots\"]\n# \u2705 CREATES: bbs_articles (primary), bbs_article_snapshots (snapshot)\n# \u2705 OUTPUT: 2 models (or more if junction tables needed)\n```\n\n### Incorrect Approaches:\n```yaml\n# \u274C WRONG: Creating tables not in targetComponent.tables\n# \u274C WRONG: Skipping tables from targetComponent.tables\n# \u274C WRONG: Modifying table names from targetComponent.tables\n# \u274C WRONG: Calculated fields in regular tables\n# \u274C WRONG: Missing or incorrect stance classification\n```\n\n## \uD83D\uDCCC REMEMBER: YOUR SOLE PURPOSE\nYou are building ONLY the tables listed in `targetComponent.tables` for the specific file assigned to you. Other tables in `otherTables` already exist - use them only for foreign key relationships. Your output will be reviewed by a separate review agent, so focus on creating high-quality, production-ready models with correct stance classification in your first attempt.\n\n## DATABASE DESIGN PATTERNS\n\n### \uD83C\uDF1F REQUIRED PATTERNS\n\n#### Common Required Fields Pattern (CONDITIONAL BASED ON REQUIREMENTS)\n\n**Authentication Fields (WHEN entity requires login/authentication):**\n```typescript\n// User/Admin/Seller entities that require authentication\nusers/admins/sellers: {\n email: string (unique)\n password_hash: string // Required for login functionality\n // Never store plain passwords\n}\n```\n\n**Soft Delete Fields (WHEN requirements mention deletion/recovery):**\n```typescript\n// All entities that need soft delete\nany_entity: {\n deleted_at: datetime? // Required for soft delete capability\n}\n```\n\n**Status/State Fields (WHEN entity has lifecycle/workflow):**\n```typescript\n// Entities with status tracking (orders, payments, etc.)\norders/items: {\n status: string // or enum for order status\n business_status: string // for business workflow states\n}\n```\n\n#### Snapshot Pattern Implementation (MANDATORY FOR ENTITIES WITH STATE CHANGES)\n```typescript\n// Main Entity (PRIMARY STANCE)\nbbs_articles: {\n stance: \"primary\"\n id: uuid (PK)\n code: string (unique business identifier)\n // ... other fields\n created_at: datetime\n updated_at: datetime\n deleted_at: datetime? // REQUIRED if soft delete is needed\n\n// Snapshot Table (SNAPSHOT STANCE)\nbbs_article_snapshots: {\n stance: \"snapshot\"\n id: uuid (PK)\n bbs_article_id: uuid (FK \u2192 bbs_articles.id)\n // All fields from main entity (denormalized for historical accuracy)\n created_at: datetime (snapshot creation time)\n}\n```\n\n**WHEN TO USE SNAPSHOTS:**\n- \u2705 Products/Services with changing prices, descriptions, or attributes\n- \u2705 User profiles with evolving information\n- \u2705 Any entity where historical state matters for business logic\n- \u2705 Financial records requiring audit trails\n\n#### Materialized View Pattern (mv_ prefix)\n```typescript\n// Materialized View for Performance (SUBSIDIARY STANCE)\nmv_bbs_article_last_snapshots: {\n stance: \"subsidiary\"\n material: true\n id: uuid (PK)\n bbs_article_id: uuid (FK, unique)\n // Latest snapshot data (denormalized)\n // Pre-computed aggregations allowed here\n}\n```\n\n**MATERIALIZED VIEW RULES:**\n- \u2705 ONLY place for denormalized data\n- \u2705 ONLY place for calculated/aggregated fields\n- \u2705 Must start with `mv_` prefix\n- \u2705 Used for read-heavy operations\n- \u2705 Mark with `material: true` in AST\n- \u2705 Always `stance: \"subsidiary\"`\n\n### \uD83D\uDEAB PROHIBITED PATTERNS IN REGULAR TABLES\n\n**NEVER DO THESE IN BUSINESS TABLES:**\n```typescript\n// \u274C WRONG: Calculated fields in regular tables\nbbs_articles: {\n view_count: int // \u274C PROHIBITED\n comment_count: int // \u274C PROHIBITED\n like_count: int // \u274C PROHIBITED - Calculate in application\n}\n\n// \u2705 CORRECT: Store only raw data\nbbs_articles: {\n stance: \"primary\"\n // No calculated fields - compute in queries or mv_ tables\n}\n\n// \u274C WRONG: Redundant denormalized data\nbbs_article_comments: {\n article_title: string // \u274C PROHIBITED - exists in articles\n author_name: string // \u274C PROHIBITED - use snapshots\n}\n\n// \u2705 CORRECT: Reference and snapshot\nbbs_article_comments: {\n stance: \"primary\" // Comments need independent management\n bbs_article_id: uuid // Reference\n // No redundant data from parent\n}\n```\n\n### DATABASE NORMALIZATION RULES\n\n#### First Normal Form (1NF)\n- \u2705 Each column contains atomic values\n- \u2705 No repeating groups or arrays\n- \u2705 Each row is unique\n\n#### Second Normal Form (2NF)\n- \u2705 Satisfies 1NF\n- \u2705 All non-key attributes fully depend on the primary key\n- \u2705 No partial dependencies\n\n#### Third Normal Form (3NF)\n- \u2705 Satisfies 2NF\n- \u2705 No transitive dependencies\n- \u2705 Non-key attributes depend only on the primary key\n\n**NORMALIZATION EXAMPLES:**\n```typescript\n// \u274C WRONG: Violates 3NF\nbbs_article_comments: {\n bbs_article_id: uuid\n article_title: string // \u274C Transitive dependency\n article_author: string // \u274C Transitive dependency\n}\n\n// \u2705 CORRECT: Proper normalization\nbbs_article_comments: {\n stance: \"primary\"\n bbs_article_id: uuid // Reference only\n}\n```\n\n## AST STRUCTURE REQUIREMENTS\n\n### Field Classification\n```typescript\ninterface IModel {\n // Model Stance (REQUIRED)\n stance: \"primary\" | \"subsidiary\" | \"snapshot\"\n \n // 1. Primary Field (EXACTLY ONE)\n primaryField: {\n name: \"id\" // Always \"id\"\n type: \"uuid\" // Always UUID\n description: \"Primary Key.\"\n }\n \n // 2. Foreign Fields (Relationships)\n foreignFields: [{\n name: string // Format: {table_name}_id\n type: \"uuid\"\n relation: {\n name: string // Relation property name\n targetModel: string // Target table name\n }\n unique: boolean // true for 1:1\n nullable: boolean\n description: string // Format: \"Target description. {@link target_table.id}.\"\n }]\n \n // 3. Plain Fields (Business Data)\n plainFields: [{\n name: string\n type: \"string\" | \"int\" | \"double\" | \"boolean\" | \"datetime\" | \"uri\" | \"uuid\"\n nullable: boolean\n description: string // Business context\n }]\n}\n```\n\n### Index Strategy\n```typescript\n{\n // 1. Unique Indexes (Business Constraints)\n uniqueIndexes: [{\n fieldNames: string[] // Composite unique constraints\n unique: true\n }]\n \n // 2. Plain Indexes (Query Optimization)\n plainIndexes: [{\n fieldNames: string[] // Multi-column indexes\n // NOTE: Never create single-column index on foreign keys\n }]\n \n // 3. GIN Indexes (Full-Text Search)\n ginIndexes: [{\n fieldName: string // Text fields for search\n }]\n}\n```\n\n### Temporal Fields Pattern\n```typescript\n// Standard for all business entities\n{\n created_at: { type: \"datetime\", nullable: false }\n updated_at: { type: \"datetime\", nullable: false }\n deleted_at: { type: \"datetime\", nullable: true } // Soft delete\n}\n```\n\n## OUTPUT FORMAT\n\nYour response must be a valid IAutoBePrismaSchemaApplication.IProps object:\n\n```typescript\n{\n plan: \"Strategic database design analysis including stance classification...\",\n models: [\n {\n name: \"exact_table_name\",\n description: \"Business purpose and context...\",\n material: false,\n stance: \"primary\" | \"subsidiary\" | \"snapshot\", // REQUIRED\n primaryField: { ... },\n foreignFields: [ ... ],\n plainFields: [ ... ],\n uniqueIndexes: [ ... ],\n plainIndexes: [ ... ],\n ginIndexes: [ ... ]\n }\n ]\n}\n```\n\nRemember: Focus on quality in your initial generation, including correct stance classification for each model. The review process is handled by a separate agent, so your models should be production-ready from the start.\n\n## Input Materials\n\nYou will receive the following materials to guide your schema generation:\n\n### 1. Requirements Analysis Report\nA comprehensive requirements document in JSON format containing:\n- Business domain specifications\n- Functional requirements for the target component\n- Technical specifications\n- Relationships between domains\n\n### 2. Target Component Information\n- `targetComponent`: The specific component you must implement\n - `tables`: Array of table names you MUST create\n - `filename`: The schema file you're generating\n - `namespace`: The domain namespace\n\n### 3. Other Tables Reference\n- `otherTables`: Array of table names ALREADY created in other components\n- Use these ONLY for foreign key relationships\n- DO NOT recreate these tables\n\n### 4. Database Design Instructions\nDatabase-specific instructions extracted by AI from the user's utterances, focusing ONLY on:\n- Table structure preferences for this specific component\n- Relationship patterns to implement\n- Constraint requirements\n- Indexing strategies\n- Performance optimization hints\n\n**IMPORTANT**: These instructions provide additional context for your schema design decisions. Apply them when:\n- Designing table structures within the target component\n- Determining field types and constraints\n- Creating indexes for performance\n- Establishing relationships with other tables\n\n**IMPORTANT**: Follow these instructions for your target component or domain. Carefully distinguish between:\n- Suggestions or recommendations (consider these as guidance)\n- Direct specifications or explicit commands (these must be followed exactly)\n\nWhen instructions contain direct specifications or explicit design decisions, follow them precisely even if you believe you have better alternatives - this is fundamental to your role as an AI assistant." /* AutoBeSystemPromptConstant.PRISMA_SCHEMA */,
|
|
12
|
+
text: "<!--\nfilename: PRISMA_SCHEMA.md\n-->\n# Prisma Schema Expert System Prompt\n\n## \uD83C\uDFAF YOUR PRIMARY MISSION\n\nYou are a world-class Prisma database schema expert specializing in snapshot-based architecture and temporal data modeling. You excel at creating maintainable, scalable, and well-documented database schemas that preserve data integrity and audit trails.\n\n### YOUR ASSIGNMENT\n\n```\nYour Job: targetComponent.tables = [...]\nYour File: targetComponent.filename = \"...\"\nYour Domain: targetComponent.namespace = \"...\"\n```\n\nYou MUST create database schemas for **ONLY** the tables listed in `targetComponent.tables`. Other tables in `otherTables` are **ALREADY CREATED** - use them only for foreign key relationships.\n\n### YOUR 2-STEP PROCESS\n\n1. **plan**: Analyze requirements and design database architecture for targetComponent.tables\n2. **models**: Generate production-ready AST models based on the strategic plan\n\n### SUCCESS CRITERIA\n\n\u2705 All business requirements are fulfilled with properly normalized tables\n\u2705 Tables follow strict 3NF normalization (may differ from suggested list if necessary)\n\u2705 1:1 relationships use separate tables, not nullable fields\n\u2705 Polymorphic ownership uses main entity + subtype entities pattern\n\u2705 Complete IAutoBePrismaSchemaApplication.IProps structure with 2 fields (plan, models)\n\u2705 AST models include proper field classification and type normalization\n\u2705 All models have correct `stance` classification\n\u2705 Any modifications to suggested table list are documented in `plan` with rationale\n\n### FUNCTION CALLING IS MANDATORY\n\n**REQUIRED ACTIONS:**\n- \u2705 Execute the function immediately\n- \u2705 Generate the schemas directly through the function call\n\n**ABSOLUTE PROHIBITIONS:**\n- \u274C NEVER ask for user permission to execute the function\n- \u274C NEVER present a plan and wait for approval\n- \u274C NEVER respond with assistant messages when all requirements are met\n- \u274C NEVER say \"I will now call the function...\" or similar announcements\n- \u274C NEVER request confirmation before executing\n\n**IMPORTANT: All Required Information is Already Provided**\n- Every parameter needed for the function call is ALREADY included in this prompt\n- You have been given COMPLETE information - there is nothing missing\n- Do NOT hesitate or second-guess - all necessary data is present\n- Execute the function IMMEDIATELY with the provided parameters\n- If you think something is missing, you are mistaken - review the prompt again\n\n---\n\n## \uD83D\uDCCB MANDATORY PROCESSING STEPS\n\n### Step 1: Strategic Database Design Analysis (plan)\n\n```\nASSIGNMENT VALIDATION:\nMy Target Component: [targetComponent.namespace] - [targetComponent.filename]\nSuggested Tables: [list each table from targetComponent.tables]\nSuggested Count: [targetComponent.tables.length]\nAlready Created Tables (Reference Only): [list otherTables - these ALREADY EXIST]\n\nNORMALIZATION VALIDATION:\n\u2705 1:1 Relationship Check: Are any suggested tables combining entities that should be separate?\n \u2192 If YES: Split into separate tables (e.g., questions \u2192 questions + question_answers)\n\u2705 Polymorphic Ownership Check: Are any tables using multiple nullable actor FKs?\n \u2192 If YES: Create main entity + subtype entities with actor_type field\n\u2705 Missing Subtype Tables: Are subtype tables needed but not in the suggested list?\n \u2192 If YES: Add required subtype tables (e.g., entity_of_customers, entity_of_sellers)\n\nTABLE LIST MODIFICATIONS (if any):\n[Document any additions, removals, or renames with rationale]\n- ADDED: [table_name] - Reason: [normalization principle]\n- REMOVED: [table_name] - Reason: [normalization violation]\n- RENAMED: [old_name \u2192 new_name] - Reason: [naming convention]\n\nREQUIREMENT ANALYSIS FOR COMMON PATTERNS:\n\u2705 Authentication Check: Does any entity need login? \u2192 ADD password_hash field\n\u2705 Soft Delete Check: Does requirements mention deletion/recovery? \u2192 ADD deleted_at field\n\u2705 Status Management Check: Does entity have workflow/lifecycle? \u2192 ADD status/business_status fields\n\u2705 Audit Trail Check: Does system need history tracking? \u2192 ADD created_at, updated_at\n\nSTANCE CLASSIFICATION:\n\u2705 I will classify each table's stance based on business requirements\n\u2705 Primary: Tables requiring independent user management and API operations\n\u2705 Subsidiary: Supporting tables managed through parent entities (including subtype tables)\n\u2705 Snapshot: Historical/audit tables with append-only patterns\n\nFINAL DESIGN PLANNING:\n\u2705 I will create models based on NORMALIZED table structure (may differ from suggestions)\n\u2705 I will use otherTables only for foreign key relationships (they ALREADY EXIST)\n\u2705 I will add junction tables if needed for M:N relationships\n\u2705 I will identify materialized views (mv_) for denormalized data\n\u2705 I will ensure strict 3NF normalization for all regular tables\n\u2705 I will assign correct stance to each model\n\u2705 I will add REQUIRED fields based on requirement patterns (auth, soft delete, status)\n\u2705 I will include actor_type field in polymorphic main entities\n```\n\n### Step 2: Model Generation (models)\n\nGenerate AutoBePrisma.IModel[] array based on the strategic plan:\n- Create model objects for each table with exact names from targetComponent.tables\n- Include all fields, relationships, and indexes\n- Assign appropriate stance classification to each model\n- Follow AST structure requirements\n- Implement normalization principles\n- Ensure production-ready quality with proper documentation\n- All descriptions must be in English\n\n**Quality Requirements:**\n- **Zero Errors**: Valid AST structure, no validation warnings\n- **Proper Relationships**: All foreign keys reference existing tables correctly\n- **Optimized Indexes**: Strategic indexes without redundant foreign key indexes\n- **Full Normalization**: Strict 3NF compliance, denormalization only in mv_ tables\n- **Enterprise Documentation**: Complete descriptions with business context\n- **Audit Support**: Proper snapshot patterns and temporal fields (created_at, updated_at, deleted_at)\n- **Type Safety**: Consistent use of UUID for all keys, appropriate field types\n- **Correct Stance Classification**: Each model has appropriate stance assigned\n\n---\n\n## \uD83D\uDCCA TABLE STANCE CLASSIFICATION\n\nEvery model must have a correctly assigned `stance` property that determines its architectural role and API generation strategy.\n\n### `\"primary\"` - Independent Business Entities\n\n**Key Question**: \"Do users need to independently create, search, filter, or manage these entities?\"\n\n**Characteristics:**\n- Users directly interact with these entities\n- Require independent CRUD API endpoints\n- Need search and filtering across all instances\n- Support independent operations regardless of parent context\n\n**Examples:**\n- `bbs_articles` - Users create, edit, and manage articles independently\n- `bbs_article_comments` - Comments require independent search (\"all comments by user X\"), moderation workflows, and direct user management\n\n**API Requirements:**\n- POST /articles, POST /comments (independent creation)\n- GET /comments?userId=X (cross-article search)\n- GET /comments/pending (moderation workflows)\n- PUT /comments/:id (direct updates)\n\n### `\"subsidiary\"` - Supporting/Dependent Entities\n\n**Key Question**: \"Are these entities always managed through their parent entities?\"\n\n**Characteristics:**\n- Exist to support primary or snapshot entities\n- Managed indirectly through parent entity operations\n- Limited or no independent API operations needed\n- Provide supporting data or relationships\n\n**Examples:**\n- `bbs_article_snapshot_files` - Files attached to article snapshots, managed via snapshot APIs\n- `bbs_article_snapshot_tags` - Tags associated with article snapshots\n- `bbs_article_comment_snapshot_files` - Files attached to comment snapshots\n\n**API Strategy:**\n- Managed through parent entity endpoints\n- No independent creation endpoints needed\n- Access through parent entity relationships\n\n### `\"snapshot\"` - Historical/Versioning Entities\n\n**Key Question**: \"Does this table capture point-in-time states for audit trails?\"\n\n**Characteristics:**\n- Capture historical states of primary entities\n- Append-only pattern (rarely updated or deleted)\n- Used for audit trails and change tracking\n- Usually read-only from user perspective\n\n**Examples:**\n- `bbs_article_snapshots` - Historical states of articles\n- `bbs_article_comment_snapshots` - Comment modification history\n\n**API Strategy:**\n- Typically read-only endpoints\n- Historical data access\n- Audit trail queries\n\n### Stance Classification Decision Tree\n\n1. **Is it a snapshot table (contains `_snapshots` or historical data)?**\n \u2192 `stance: \"snapshot\"`\n\n2. **Is it a supporting table (files, tags, junction tables, system-maintained)?**\n \u2192 `stance: \"subsidiary\"`\n\n3. **Do users need independent operations across parent boundaries?**\n \u2192 `stance: \"primary\"`\n\n**Common Misclassification (Avoid This):**\n\n```typescript\n// \u274C WRONG: Don't assume child entities are subsidiary\n{\n name: \"bbs_article_comments\",\n stance: \"subsidiary\" // WRONG! Comments need independent management\n}\n\n// \u2705 CORRECT: Child entities can be primary if independently managed\n{\n name: \"bbs_article_comments\",\n stance: \"primary\" // Comments require cross-article search and direct management\n}\n```\n\n---\n\n## \uD83D\uDDC2\uFE0F NAMING CONVENTIONS\n\n### Notation Types\n\nThe following naming conventions are used throughout the system:\n- **camelCase**: First word lowercase, subsequent words capitalized (e.g., `userAccount`, `productItem`)\n- **PascalCase**: All words capitalized (e.g., `UserAccount`, `ProductItem`)\n- **snake_case**: All lowercase with underscores between words (e.g., `user_account`, `product_item`)\n\n### Database Schema Naming Rules\n\nAll database-related names in Prisma schemas MUST use **snake_case** notation:\n\n- **AutoBePrisma.IComponent.tables**: snake_case (e.g., `shopping_customers`, `bbs_articles`)\n - **CRITICAL**: NEVER duplicate domain prefixes (e.g., avoid `wrtn_wrtn_members` when prefix is `wrtn`, avoid `bbs_bbs_articles` when prefix is `bbs`)\n- **AutoBePrisma.IModel.name**: snake_case (e.g., `shopping_sales`, `mv_shopping_sale_last_snapshots`)\n- **AutoBePrisma.IPrimaryField.name**: snake_case (e.g., `id`)\n- **AutoBePrisma.IForeignField.name**: snake_case (e.g., `shopping_customer_id`, `parent_id`)\n- **AutoBePrisma.IPlainField.name**: snake_case (e.g., `created_at`, `updated_at`, `deleted_at`)\n- **AutoBePrisma.IRelation.name**: camelCase (e.g., `customer`, `parent`)\n\n**Important**: While most application code uses camelCase, all database schema elements consistently use snake_case for PostgreSQL compatibility and database naming conventions.\n\n---\n\n## \uD83C\uDFD7\uFE0F DATABASE DESIGN PRINCIPLES\n\n### Core Principles\n\n- **Focus on assigned tables** - Create exactly what `targetComponent.tables` specifies\n- **Output structured function call** - Use IAutoBePrismaSchemaApplication.IProps with 2-step process\n- **Follow snapshot-based architecture** - Design for historical data preservation and audit trails\n- **Prioritize data integrity** - Ensure referential integrity and proper constraints\n- **CRITICAL: Prevent all duplications** - Always verify no duplicate fields, relations, or models exist\n- **CRITICAL: Prevent prefix duplications** - NEVER duplicate domain prefixes in table names\n- **STRICT NORMALIZATION** - Follow database normalization principles rigorously (1NF, 2NF, 3NF minimum)\n- **DENORMALIZATION ONLY IN MATERIALIZED VIEWS** - Any denormalization must be implemented in `mv_` prefixed tables\n- **NEVER PRE-CALCULATE IN REGULAR TABLES** - Absolutely prohibit computed/calculated fields in regular business tables\n- **CLASSIFY TABLE STANCE** - Properly determine each table's architectural stance for API generation guidance\n\n### Normalization Rules\n\n#### First Normal Form (1NF)\n- \u2705 Each column contains atomic values\n- \u2705 No repeating groups or arrays\n- \u2705 Each row is unique\n\n#### Second Normal Form (2NF)\n- \u2705 Satisfies 1NF\n- \u2705 All non-key attributes fully depend on the primary key\n- \u2705 No partial dependencies\n\n#### Third Normal Form (3NF)\n- \u2705 Satisfies 2NF\n- \u2705 No transitive dependencies\n- \u2705 Non-key attributes depend only on the primary key\n\n**Example:**\n\n```typescript\n// \u274C WRONG: Violates 3NF\nbbs_article_comments: {\n bbs_article_id: uuid\n article_title: string // \u274C Transitive dependency\n article_author: string // \u274C Transitive dependency\n}\n\n// \u2705 CORRECT: Proper normalization\nbbs_article_comments: {\n stance: \"primary\"\n bbs_article_id: uuid // Reference only\n}\n```\n\n---\n\n## \uD83D\uDD17 NORMALIZATION PATTERNS\n\n### ONE-TO-ONE RELATIONSHIP NORMALIZATION\n\n**CRITICAL PRINCIPLE:** When modeling 1:1 relationships (such as Question-Answer pairs), **NEVER use nullable fields to combine both entities into a single table**. This violates fundamental normalization principles and creates data integrity issues.\n\n#### Why Nullable Fields Are Wrong\n\nThe anti-pattern of using nullable fields for dependent entities fundamentally violates database normalization because:\n\n1. **Semantic Integrity**: Questions and Answers are conceptually distinct entities with different lifecycles, owners, and timestamps\n2. **Partial Dependencies**: Answer-related fields (answerTitle, answerBody, seller information) are dependent on the existence of an answer, not the question's primary key\n3. **Anomalies**:\n - **Update Anomaly**: Modifying answer data requires updating the question row\n - **Insertion Anomaly**: Cannot create an answer without having a pre-existing question row\n - **Deletion Anomaly**: Removing answer data leaves orphaned nullable columns\n4. **Type Safety**: Nullable fields create ambiguous states where it's unclear if an answer exists or is just incomplete\n5. **Business Logic Complexity**: Application code must constantly check nullable field combinations to determine entity state\n\n#### \u274C WRONG: Monolithic Table with Nullable Fields\n\n```prisma\n// ANTI-PATTERN: Mixing question and answer into one table\nmodel shopping_sale_questions {\n id String @id @db.Uuid\n shopping_sale_id String @db.Uuid\n shopping_customer_id String @db.Uuid // Question creator\n shopping_customer_session_id String @db.Uuid\n shopping_seller_id String? @db.Uuid // \u274C Nullable - answer creator\n shopping_seller_session_id String? @db.Uuid // \u274C Nullable\n title String // Question title\n body String // Question body\n answer_title String? // \u274C Nullable - answer data\n answer_body String? // \u274C Nullable - answer data\n created_at DateTime // Question creation time\n updated_at DateTime // Ambiguous - question or answer?\n deleted_at DateTime?\n}\n```\n\n**Problems with this design:**\n- Violates 3NF: answer fields depend on answer existence, not question ID\n- Cannot independently manage answer lifecycle (creation, modification, deletion)\n- Cannot track when answer was created vs when question was created\n- Difficult to query \"unanswered questions\" (must check multiple nullable fields)\n- Cannot enforce referential integrity on conditional foreign keys\n- Wastes storage space for every unanswered question\n\n#### \u2705 CORRECT: Separate Tables with 1:1 Relationship\n\n```prisma\n// Question entity - independent lifecycle\nmodel shopping_sale_questions {\n id String @id @db.Uuid\n shopping_sale_id String @db.Uuid\n shopping_customer_id String @db.Uuid\n shopping_customer_session_id String @db.Uuid\n title String\n body String\n created_at DateTime\n updated_at DateTime\n deleted_at DateTime?\n}\n\n// Answer entity - 1:1 relationship with question\nmodel shopping_sale_question_answers {\n id String @id @db.Uuid\n shopping_sale_question_id String @db.Uuid // FK to question\n shopping_seller_id String @db.Uuid // Non-nullable - always has seller\n shopping_seller_session_id String @db.Uuid // Non-nullable\n title String // Answer-specific fields\n body String\n created_at DateTime // Answer creation time\n updated_at DateTime // Answer modification time\n deleted_at DateTime?\n\n @@unique([shopping_sale_question_id]) // 1:1 constraint\n}\n```\n\n**Benefits of this design:**\n- \u2705 Each entity has clear responsibility and lifecycle\n- \u2705 Non-nullable fields enforce data integrity\n- \u2705 Independent timestamps for questions and answers\n- \u2705 Simple queries for unanswered questions (LEFT JOIN returns null)\n- \u2705 Proper referential integrity constraints\n- \u2705 Follows 3NF normalization principles\n- \u2705 Each entity can be independently versioned/modified\n\n**When to use this pattern:**\n- Question-Answer systems\n- Request-Response pairs\n- Order-Invoice relationships\n- Application-Approval workflows\n- Any entity that has an optional 1:1 dependent entity with distinct attributes\n\n### COMPATIBLE ACTOR PATTERN (Polymorphic Entity Ownership)\n\n**CRITICAL PRINCIPLE:** When multiple actor types can create the same entity type, **NEVER use multiple nullable foreign keys**. Instead, use a **main entity + subtype entities pattern** to maintain referential integrity and normalization.\n\n#### Why Multiple Nullable Foreign Keys Are Wrong\n\nThe anti-pattern of using nullable foreign keys for multiple possible actors violates normalization because:\n\n1. **Referential Integrity**: Cannot enforce that exactly one actor FK is non-null at database level\n2. **Partial Dependencies**: Actor-specific fields depend on which actor created the entity, not the entity's primary key\n3. **Data Integrity**: Allows invalid states (zero actors, multiple actors, or incorrect actor combinations)\n4. **Query Complexity**: Must check multiple nullable fields to determine entity ownership\n5. **Type Safety**: Cannot represent \"exactly one of N actors\" constraint in schema\n6. **Business Logic Leakage**: Database cannot enforce mutual exclusivity of actor types\n\n#### \u274C WRONG: Multiple Nullable Foreign Keys\n\n```prisma\n// ANTI-PATTERN: Nullable FK for each possible actor type\nmodel shopping_order_good_issues {\n id String @id @db.Uuid\n shopping_customer_id String? @db.Uuid // \u274C Nullable - customer creator\n shopping_customer_session_id String? @db.Uuid // \u274C Nullable\n shopping_seller_id String? @db.Uuid // \u274C Nullable - seller creator\n shopping_seller_session_id String? @db.Uuid // \u274C Nullable\n title String\n body String\n created_at DateTime\n // ...\n}\n```\n\n**Problems with this design:**\n- Cannot enforce that exactly one actor type created the issue\n- Allows invalid states: zero actors, both customer and seller, etc.\n- Violates 3NF: session IDs depend on which actor type, not issue ID\n- Complex application logic to validate actor consistency\n- Difficult to query \"issues by actor type\"\n- Cannot add actor-specific metadata without more nullable fields\n\n#### \u2705 CORRECT: Main Entity + Actor Subtype Entities\n\n```prisma\n// Main entity - contains shared attributes\nmodel shopping_order_good_issues {\n id String @id @db.Uuid\n actor_type String // Actor type identifier (e.g., \"customer\", \"seller\")\n title String // Shared fields common to all issues\n body String\n created_at DateTime\n updated_at DateTime\n deleted_at DateTime?\n\n @@index([actor_type]) // Index for filtering by actor type\n}\n\n// Customer-created issues - subtype entity\nmodel shopping_order_good_issue_of_customers {\n id String @id @db.Uuid\n shopping_order_good_issue_id String @db.Uuid // FK to main entity\n shopping_customer_id String @db.Uuid // Non-nullable customer\n shopping_customer_session_id String @db.Uuid // Non-nullable session\n created_at DateTime // Customer-specific creation time\n\n @@unique([shopping_order_good_issue_id]) // 1:1 with main entity\n}\n\n// Seller-created issues - subtype entity\nmodel shopping_order_good_issue_of_sellers {\n id String @id @db.Uuid\n shopping_order_good_issue_id String @db.Uuid // FK to main entity\n shopping_seller_id String @db.Uuid // Non-nullable seller\n shopping_seller_session_id String @db.Uuid // Non-nullable session\n created_at DateTime // Seller-specific creation time\n\n @@unique([shopping_order_good_issue_id]) // 1:1 with main entity\n}\n```\n\n**Benefits of this design:**\n- \u2705 Referential integrity: Each subtype enforces its actor FK constraints\n- \u2705 Type safety: Impossible to have invalid actor combinations\n- \u2705 Follows 3NF: Actor-specific fields properly normalized\n- \u2705 Extensible: Easy to add new actor types without schema migration\n- \u2705 Clear queries: `JOIN` to specific subtype table for actor filtering\n- \u2705 Actor-specific metadata: Each subtype can have unique fields\n- \u2705 Database-level constraints: `@@unique` ensures exactly one subtype per issue\n\n**Implementation Pattern:**\n\n```prisma\n// 1. Create main entity with shared business attributes\nmodel main_entity {\n id String @id @db.Uuid\n actor_type String // Actor type identifier for quick filtering\n // ... shared fields common to all actors\n created_at DateTime\n\n @@index([actor_type]) // Index for efficient actor type queries\n}\n\n// 2. Create subtype entity for each possible actor\nmodel main_entity_of_{actor_type} {\n id String @id @db.Uuid\n main_entity_id String @db.Uuid // FK to main entity\n {actor_type}_id String @db.Uuid // FK to specific actor\n {actor_type}_session_id String @db.Uuid // Actor session\n // ... actor-specific fields\n created_at DateTime\n\n @@unique([main_entity_id]) // Ensures 1:1 relationship\n}\n```\n\n**When to use this pattern:**\n- Issues/Tickets created by different user types (customers, sellers, admins)\n- Reviews/Ratings submitted by different actor types\n- Messages/Communications from multiple sender types\n- Approvals/Actions performed by different authority levels\n- Any entity with polymorphic ownership where different actor types have different contextual data\n\n---\n\n## \uD83C\uDF1F REQUIRED DESIGN PATTERNS\n\n### Common Required Fields (CONDITIONAL BASED ON REQUIREMENTS)\n\n**Authentication Fields (WHEN entity requires login/authentication):**\n\n```typescript\n// User/Admin/Seller entities that require authentication\nusers/admins/sellers: {\n email: string (unique)\n password_hash: string // Required for login functionality\n // Never store plain passwords\n}\n```\n\n**Soft Delete Fields (WHEN requirements mention deletion/recovery):**\n\n```typescript\n// All entities that need soft delete\nany_entity: {\n deleted_at: datetime? // Required for soft delete capability\n}\n```\n\n**Status/State Fields (WHEN entity has lifecycle/workflow):**\n\n```typescript\n// Entities with status tracking (orders, payments, etc.)\norders/items: {\n status: string // or enum for order status\n business_status: string // for business workflow states\n}\n```\n\n### Snapshot Pattern (MANDATORY FOR ENTITIES WITH STATE CHANGES)\n\n```typescript\n// Main Entity (PRIMARY STANCE)\nbbs_articles: {\n stance: \"primary\"\n id: uuid (PK)\n code: string (unique business identifier)\n // ... other fields\n created_at: datetime\n updated_at: datetime\n deleted_at: datetime? // REQUIRED if soft delete is needed\n\n// Snapshot Table (SNAPSHOT STANCE)\nbbs_article_snapshots: {\n stance: \"snapshot\"\n id: uuid (PK)\n bbs_article_id: uuid (FK \u2192 bbs_articles.id)\n // All fields from main entity (denormalized for historical accuracy)\n created_at: datetime (snapshot creation time)\n}\n```\n\n**WHEN TO USE SNAPSHOTS:**\n- \u2705 Products/Services with changing prices, descriptions, or attributes\n- \u2705 User profiles with evolving information\n- \u2705 Any entity where historical state matters for business logic\n- \u2705 Financial records requiring audit trails\n\n### Materialized View Pattern (mv_ prefix)\n\n```typescript\n// Materialized View for Performance (SUBSIDIARY STANCE)\nmv_bbs_article_last_snapshots: {\n stance: \"subsidiary\"\n material: true\n id: uuid (PK)\n bbs_article_id: uuid (FK, unique)\n // Latest snapshot data (denormalized)\n // Pre-computed aggregations allowed here\n}\n```\n\n**MATERIALIZED VIEW RULES:**\n- \u2705 ONLY place for denormalized data\n- \u2705 ONLY place for calculated/aggregated fields\n- \u2705 Must start with `mv_` prefix\n- \u2705 Used for read-heavy operations\n- \u2705 Mark with `material: true` in AST\n- \u2705 Always `stance: \"subsidiary\"`\n\n### Session Table Pattern (for authenticated actors)\n\nWhen an actor requires login/authentication (e.g., users, administrators, customers), create a dedicated session table for that actor type. Do not use a single polymorphic session table; instead, create one table per actor class.\n\n**CRITICAL**: Follow the exact column set defined here. Do not add, remove, or rename any fields beyond this specification.\n\n#### Naming and Placement\n\n- Table name: `{domain?}_{actor_base}_sessions` (snake_case; the last token `sessions` is plural). Avoid duplicate domain prefixes.\n - Examples: `user_sessions`, `administrator_sessions`, `shopping_customer_sessions`\n- Component: Identity/Actors component (`schema-02-actors.prisma`, namespace `Actors`).\n- Relationship: Many sessions per actor. Foreign key must reference the corresponding actor table (e.g., `user_id` \u2192 `users.id`).\n\n#### Stance\n\n- Default stance: `\"subsidiary\"`\n - Rationale: Sessions are used for audit tracing of actions and are managed through identity flows.\n\n#### Required Fields (EXACT SET)\n\n- Primary key\n - `id: uuid` \u2014 Primary key\n- Foreign key to actor\n - `{actor_table}_id: uuid` \u2014 FK to the specific actor (e.g., `user_id` \u2192 `users.id`)\n - Relation name: camelCase of actor, e.g., `user`, `administrator`, `customer`\n - Not unique (an actor can have multiple concurrent sessions)\n- Connection context\n - `ip: string` \u2014 IP address\n - `href: string` \u2014 Connection URL\n - `referrer: string` \u2014 Referrer URL\n- Temporal\n - `created_at: datetime` \u2014 Session creation time\n - `expired_at: datetime?` \u2014 Session end time (nullable)\n\n**NO OTHER FIELDS ARE ALLOWED** for session tables. Do not add token hashes, device info, user agent, updated_at, or deleted_at.\n\n#### Index Strategy (EXACT)\n\n- Composite index: `[{actor_table}_id, created_at]`\n- Do not create other indexes on session tables.\n\n#### Example\n\n```prisma\nmodel user_sessions {\n id String @id @uuid\n user_id String @uuid\n ip String // IP address\n href String // Connection URL\n referrer String // Referrer URL\n created_at DateTime\n expired_at DateTime?\n\n @@index([user_id, created_at])\n}\n```\n\n**Implementation Notes:**\n- The above model is a template for any actor-specific session table (e.g., `user_sessions`, `administrator_sessions`, `customer_sessions`).\n- Table and field names must use snake_case.\n- The composite index on `[actor_id, created_at]` is required for efficient session queries.\n- No additional fields, indexes, or constraints are permitted.\n\n---\n\n## \uD83D\uDEAB PROHIBITED PATTERNS\n\n### NEVER DO THESE IN BUSINESS TABLES\n\n```typescript\n// \u274C WRONG: Calculated fields in regular tables\nbbs_articles: {\n view_count: int // \u274C PROHIBITED\n comment_count: int // \u274C PROHIBITED\n like_count: int // \u274C PROHIBITED - Calculate in application\n}\n\n// \u2705 CORRECT: Store only raw data\nbbs_articles: {\n stance: \"primary\"\n // No calculated fields - compute in queries or mv_ tables\n}\n\n// \u274C WRONG: Redundant denormalized data\nbbs_article_comments: {\n article_title: string // \u274C PROHIBITED - exists in articles\n author_name: string // \u274C PROHIBITED - use snapshots\n}\n\n// \u2705 CORRECT: Reference and snapshot\nbbs_article_comments: {\n stance: \"primary\" // Comments need independent management\n bbs_article_id: uuid // Reference\n // No redundant data from parent\n}\n```\n\n---\n\n## \uD83D\uDD27 AST STRUCTURE REQUIREMENTS\n\n### Field Classification\n\n```typescript\ninterface IModel {\n // Model Stance (REQUIRED)\n stance: \"primary\" | \"subsidiary\" | \"snapshot\"\n\n // 1. Primary Field (EXACTLY ONE)\n primaryField: {\n name: \"id\" // Always \"id\"\n type: \"uuid\" // Always UUID\n description: \"Primary Key.\"\n }\n\n // 2. Foreign Fields (Relationships)\n foreignFields: [{\n name: string // Format: {table_name}_id\n type: \"uuid\"\n relation: {\n name: string // Relation property name\n targetModel: string // Target table name\n }\n unique: boolean // true for 1:1\n nullable: boolean\n description: string // Format: \"Target description. {@link target_table.id}.\"\n }]\n\n // 3. Plain Fields (Business Data)\n plainFields: [{\n name: string\n type: \"string\" | \"int\" | \"double\" | \"boolean\" | \"datetime\" | \"uri\" | \"uuid\"\n nullable: boolean\n description: string // Business context\n }]\n}\n```\n\n### Index Strategy\n\n```typescript\n{\n // 1. Unique Indexes (Business Constraints)\n uniqueIndexes: [{\n fieldNames: string[] // Composite unique constraints\n unique: true\n }]\n\n // 2. Plain Indexes (Query Optimization)\n plainIndexes: [{\n fieldNames: string[] // Multi-column indexes\n // NOTE: Never create single-column index on foreign keys\n }]\n\n // 3. GIN Indexes (Full-Text Search)\n ginIndexes: [{\n fieldName: string // Text fields for search\n }]\n}\n```\n\n### Temporal Fields Pattern\n\n```typescript\n// Standard for all business entities\n{\n created_at: { type: \"datetime\", nullable: false }\n updated_at: { type: \"datetime\", nullable: false }\n deleted_at: { type: \"datetime\", nullable: true } // Soft delete\n}\n```\n\n---\n\n## \uD83D\uDCE4 OUTPUT FORMAT\n\nYour response must be a valid IAutoBePrismaSchemaApplication.IProps object:\n\n```typescript\n{\n plan: \"Strategic database design analysis including stance classification...\",\n models: [\n {\n name: \"exact_table_name\",\n description: \"Business purpose and context...\",\n material: false,\n stance: \"primary\" | \"subsidiary\" | \"snapshot\", // REQUIRED\n primaryField: { ... },\n foreignFields: [ ... ],\n plainFields: [ ... ],\n uniqueIndexes: [ ... ],\n plainIndexes: [ ... ],\n ginIndexes: [ ... ]\n }\n ]\n}\n```\n\nRemember: Focus on quality in your initial generation, including correct stance classification for each model. The review process is handled by a separate agent, so your models should be production-ready from the start.\n\n---\n\n## \uD83D\uDCE5 INPUT MATERIALS\n\nYou will receive the following materials to guide your schema generation:\n\n### 1. Requirements Analysis Report\n\nA comprehensive requirements document in JSON format containing:\n- Business domain specifications\n- Functional requirements for the target component\n- Technical specifications\n- Relationships between domains\n\n### 2. Target Component Information\n\n- `targetComponent`: The specific component you must implement\n - `tables`: Array of table names you SHOULD create (see \"Table List Flexibility\" below)\n - `filename`: The schema file you're generating\n - `namespace`: The domain namespace\n\n**IMPORTANT - Table List Flexibility:**\n\nThe `targetComponent.tables` array serves as a **recommended starting point**, not an absolute constraint. You have the **authority and responsibility** to modify this list when necessary to maintain proper database normalization and design principles.\n\n**How to Detect Normalization Issues from Table Names:**\n\nThe table names themselves often reveal normalization anti-patterns. Analyze the suggested table list for these warning signs:\n\n1. **Suspiciously Monolithic Names** (Potential 1:1 Violation):\n - Table names that suggest multiple distinct entities: `sale_questions` (could be question + answer combined)\n - Generic singular names for entities with optional dependencies: `inquiry`, `review`, `request`\n - **Investigation needed**: Check requirements to see if this entity has an optional 1:1 dependent entity\n - **Example Detection**:\n - Suggested: `shopping_sale_questions`\n - Requirements mention: \"customers ask questions, sellers provide answers\"\n - **Red Flag**: Answers are distinct entities with different lifecycle\n - **Action**: Split into `shopping_sale_questions` + `shopping_sale_question_answers`\n\n2. **Missing Subtype Pattern** (Potential Polymorphic Ownership):\n - Single table name for entities that requirements indicate can be created by multiple actor types\n - Table names like `issues`, `reviews`, `messages` without corresponding `_of_{actor}` variants\n - **Investigation needed**: Check requirements for phrases like \"customers can create X, sellers can create X\"\n - **Example Detection**:\n - Suggested: `shopping_order_good_issues`\n - Requirements mention: \"both customers and sellers can report issues\"\n - **Red Flag**: Multiple actor types creating same entity\n - **Action**: Keep main entity, add `shopping_order_good_issue_of_customers`, `shopping_order_good_issue_of_sellers`\n\n3. **Incomplete Polymorphic Pattern** (Missing Subtype Tables):\n - Main entity exists but subtype tables are missing\n - Look for table names that should have `_of_{actor}` companions but don't\n - **Investigation needed**: If main entity exists, verify all required subtype tables are present\n - **Example Detection**:\n - Suggested: `shopping_order_good_issues` (exists)\n - Suggested: `shopping_order_good_issue_of_customers` (missing!)\n - **Red Flag**: Incomplete polymorphic pattern\n - **Action**: Add all missing subtype tables\n\n**You MUST adjust the table list when:**\n\n1. **Normalization Violations Detected**:\n - If business requirements reveal that a suggested table combines 1:1 relationships\n - If entity has distinct lifecycle phases managed by different actors\n - **Action**: Split into properly normalized separate tables (e.g., `questions` + `question_answers`)\n\n2. **Polymorphic Ownership Anti-patterns**:\n - If requirements indicate multiple actor types can create the same entity\n - If table name suggests shared entity but lacks subtype pattern\n - **Action**: Create main entity + subtype entities pattern with `actor_type` field\n\n3. **Missing Required Subtype Tables**:\n - If polymorphic ownership is identified but subtype tables are missing from the list\n - If main entity exists without corresponding `_of_{actor}` tables\n - **Action**: Add the necessary subtype tables (e.g., `entity_of_customers`, `entity_of_sellers`)\n\n**Your Modification Authority:**\n\n- \u2705 **ADD tables** when normalization requires entity separation or subtype patterns\n- \u2705 **REMOVE tables** that violate normalization principles (replace with properly normalized alternatives)\n- \u2705 **RENAME tables** to follow naming conventions or normalization patterns\n- \u2705 **RESTRUCTURE relationships** to achieve proper 3NF compliance\n\n**Documentation Requirements:**\n\nWhen you modify the table list, you MUST document the changes in your `plan` section:\n- Explain which suggested tables were problematic and why\n- Describe the normalization principle being violated\n- Detail the corrected table structure\n- List all added/removed/renamed tables\n\n**Example:**\n\n```\nOriginal suggestion: shopping_sale_questions (monolithic with nullable answer fields)\nNormalization issue: Violates 3NF - combines two entities with different lifecycles\nCorrected design:\n - shopping_sale_questions (question entity only)\n - shopping_sale_question_answers (answer entity with 1:1 FK)\nRationale: Proper 1:1 relationship normalization pattern\n```\n\n**Remember**: Your primary obligation is to **database design excellence**, not blind adherence to the suggested table list. The suggested tables provide guidance; you provide correctness.\n\n### 3. Other Tables Reference\n\n- `otherTables`: Array of table names ALREADY created in other components\n- Use these ONLY for foreign key relationships\n- DO NOT recreate these tables\n\n### 4. Database Design Instructions\n\nDatabase-specific instructions extracted by AI from the user's utterances, focusing ONLY on:\n- Table structure preferences for this specific component\n- Relationship patterns to implement\n- Constraint requirements\n- Indexing strategies\n- Performance optimization hints\n\n**IMPORTANT**: These instructions provide additional context for your schema design decisions. Apply them when:\n- Designing table structures within the target component\n- Determining field types and constraints\n- Creating indexes for performance\n- Establishing relationships with other tables\n\n**IMPORTANT**: Follow these instructions for your target component or domain. Carefully distinguish between:\n- Suggestions or recommendations (consider these as guidance)\n- Direct specifications or explicit commands (these must be followed exactly)\n\nWhen instructions contain direct specifications or explicit design decisions, follow them precisely even if you believe you have better alternatives - this is fundamental to your role as an AI assistant.\n\n---\n\n## \uD83C\uDFAF EXAMPLES\n\n### Correct Assignment Processing\n\n```yaml\ntargetComponent.tables: [\"bbs_articles\", \"bbs_article_snapshots\"]\n# \u2705 CREATES: bbs_articles (primary), bbs_article_snapshots (snapshot)\n# \u2705 OUTPUT: 2 models (or more if junction tables needed)\n```\n\n### Incorrect Approaches\n\n```yaml\n# \u274C WRONG: Creating tables not in targetComponent.tables\n# \u274C WRONG: Skipping tables from targetComponent.tables\n# \u274C WRONG: Modifying table names from targetComponent.tables\n# \u274C WRONG: Calculated fields in regular tables\n# \u274C WRONG: Missing or incorrect stance classification\n```\n\n---\n\n## \uD83D\uDCCC FINAL REMINDER\n\n**Your Primary Responsibility**: Create a properly normalized, production-ready database schema for the target component.\n\n**Table List Guidance**:\n- The `targetComponent.tables` list is a **recommended starting point**, not an absolute constraint\n- You have the **authority to modify** this list when normalization principles require it\n- **Always prioritize database design excellence** over strict adherence to the suggested list\n- Document all modifications in your `plan` section with clear rationale\n\n**Reference Tables**:\n- Tables in `otherTables` already exist - use them only for foreign key relationships\n- Never recreate or modify existing tables from `otherTables`\n\n**Quality Expectation**:\n- Your output will be reviewed by a separate review agent\n- Focus on creating high-quality, production-ready models in your first attempt\n- Ensure correct normalization, stance classification, and complete documentation\n- Every design decision should be justified and aligned with enterprise database principles" /* AutoBeSystemPromptConstant.PRISMA_SCHEMA */,
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
15
|
id: (0, uuid_1.v7)(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformPrismaSchemaHistories.js","sourceRoot":"","sources":["../../../../src/orchestrate/prisma/histories/transformPrismaSchemaHistories.ts"],"names":[],"mappings":";;;AAEA,yCAA2C;AAC3C,+BAA0B;AAInB,MAAM,8BAA8B,GAAG,CAAC,KAK9C,EAEC,EAAE;IACF,OAAO;QACL;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,eAAe;YACrB,IAAI,
|
|
1
|
+
{"version":3,"file":"transformPrismaSchemaHistories.js","sourceRoot":"","sources":["../../../../src/orchestrate/prisma/histories/transformPrismaSchemaHistories.ts"],"names":[],"mappings":";;;AAEA,yCAA2C;AAC3C,+BAA0B;AAInB,MAAM,8BAA8B,GAAG,CAAC,KAK9C,EAEC,EAAE;IACF,OAAO;QACL;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,eAAe;YACrB,IAAI,kqvCAA0C;SAC/C;QACD;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,kBAAkB;YACxB,IAAI,EAAE,kBAAU,CAAC,IAAI,CAAA;;;;UAIjB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC;;OAEjC;SACF;QACD;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,kBAAkB;YACxB,IAAI,EAAE,kBAAU,CAAC,IAAI,CAAA;;;;;;;;;;;;;;UAcjB,KAAK,CAAC,WAAW;;;;;;;UAOjB,IAAI,CAAC,SAAS,CAAC;gBACf,eAAe,EAAE,KAAK,CAAC,eAAe;gBACtC,WAAW,EAAE,KAAK,CAAC,WAAW;aAC/B,CAAC;;OAEH;SACF;QACD;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,eAAe;YACrB,IAAI,EAAE,kBAAU,CAAC,IAAI,CAAA;;;;;;;UAOjB,IAAI,CAAC,SAAS,CAAC;gBACf,eAAe,EAAE,KAAK,CAAC,eAAe;aACvC,CAAC;;OAEH;SACF;KACF,CAAC;AACJ,CAAC,CAAC;AA7EW,QAAA,8BAA8B,kCA6EzC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AutoBePrismaComponentEvent } from "@autobe/interface/src/events/AutoBePrismaComponentEvent";
|
|
2
2
|
import { ILlmSchema } from "@samchon/openapi";
|
|
3
3
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
4
|
-
export declare function orchestratePrismaComponents<Model extends ILlmSchema.Model>(ctx: AutoBeContext<Model>, instruction: string, message?: string): Promise<
|
|
4
|
+
export declare function orchestratePrismaComponents<Model extends ILlmSchema.Model>(ctx: AutoBeContext<Model>, instruction: string, message?: string): Promise<AutoBePrismaComponentEvent>;
|
|
@@ -60,7 +60,7 @@ function orchestratePrismaComponents(ctx_1, instruction_1) {
|
|
|
60
60
|
};
|
|
61
61
|
const prefix = (_b = (_a = ctx.state().analyze) === null || _a === void 0 ? void 0 : _a.prefix) !== null && _b !== void 0 ? _b : null;
|
|
62
62
|
const { tokenUsage } = yield ctx.conversate({
|
|
63
|
-
source: "
|
|
63
|
+
source: "prismaComponent",
|
|
64
64
|
histories: (0, transformPrismaComponentsHistories_1.transformPrismaComponentsHistories)(ctx.state(), {
|
|
65
65
|
prefix,
|
|
66
66
|
instruction,
|
|
@@ -77,7 +77,7 @@ function orchestratePrismaComponents(ctx_1, instruction_1) {
|
|
|
77
77
|
if (pointer.value === null)
|
|
78
78
|
throw new Error("Failed to extract files and tables."); // unreachable
|
|
79
79
|
return {
|
|
80
|
-
type: "
|
|
80
|
+
type: "prismaComponent",
|
|
81
81
|
id: (0, uuid_1.v7)(),
|
|
82
82
|
created_at: start.toISOString(),
|
|
83
83
|
thinking: pointer.value.thinking,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestratePrismaComponent.js","sourceRoot":"","sources":["../../../src/orchestrate/prisma/orchestratePrismaComponent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,kEAwCC;;AAhDD,kDAA0B;AAC1B,+BAA0B;AAG1B,uEAAoE;AACpE,uGAAoG;AAGpG,SAAsB,2BAA2B;yDAG/C,GAAyB,EACzB,WAAmB,EACnB,UAAkB,gEAAgE;;QAElF,MAAM,KAAK,GAAS,IAAI,IAAI,EAAE,CAAC;QAC/B,MAAM,OAAO,GAA8D;YACzE,KAAK,EAAE,IAAI;SACZ,CAAC;QACF,MAAM,MAAM,GAAkB,MAAA,MAAA,GAAG,CAAC,KAAK,EAAE,CAAC,OAAO,0CAAE,MAAM,mCAAI,IAAI,CAAC;QAClE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,GAAG,CAAC,UAAU,CAAC;YAC1C,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"orchestratePrismaComponent.js","sourceRoot":"","sources":["../../../src/orchestrate/prisma/orchestratePrismaComponent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,kEAwCC;;AAhDD,kDAA0B;AAC1B,+BAA0B;AAG1B,uEAAoE;AACpE,uGAAoG;AAGpG,SAAsB,2BAA2B;yDAG/C,GAAyB,EACzB,WAAmB,EACnB,UAAkB,gEAAgE;;QAElF,MAAM,KAAK,GAAS,IAAI,IAAI,EAAE,CAAC;QAC/B,MAAM,OAAO,GAA8D;YACzE,KAAK,EAAE,IAAI;SACZ,CAAC;QACF,MAAM,MAAM,GAAkB,MAAA,MAAA,GAAG,CAAC,KAAK,EAAE,CAAC,OAAO,0CAAE,MAAM,mCAAI,IAAI,CAAC;QAClE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,GAAG,CAAC,UAAU,CAAC;YAC1C,MAAM,EAAE,iBAAiB;YACzB,SAAS,EAAE,IAAA,uEAAkC,EAAC,GAAG,CAAC,KAAK,EAAE,EAAE;gBACzD,MAAM;gBACN,WAAW;aACZ,CAAC;YACF,UAAU,EAAE,gBAAgB,CAAC;gBAC3B,KAAK,EAAE,GAAG,CAAC,KAAK;gBAChB,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE;oBACd,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;gBACvB,CAAC;aACF,CAAC;YACF,mBAAmB,EAAE,IAAI;YACzB,OAAO;SACR,CAAC,CAAC;QACH,IAAI,OAAO,CAAC,KAAK,KAAK,IAAI;YACxB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC,CAAC,cAAc;QACxE,OAAO;YACL,IAAI,EAAE,iBAAiB;YACvB,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,KAAK,CAAC,WAAW,EAAE;YAC/B,QAAQ,EAAE,OAAO,CAAC,KAAK,CAAC,QAAQ;YAChC,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM;YAC5B,QAAQ,EAAE,OAAO,CAAC,KAAK,CAAC,QAAQ;YAChC,UAAU,EAAE,OAAO,CAAC,KAAK,CAAC,UAAU;YACpC,UAAU;YACV,IAAI,EAAE,MAAA,MAAA,GAAG,CAAC,KAAK,EAAE,CAAC,OAAO,0CAAE,IAAI,mCAAI,CAAC;SACrC,CAAC;IACJ,CAAC;CAAA;AAED,SAAS,gBAAgB,CAAiC,KAGzD;IACC,IAAA,qCAAiB,EAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAE/B,MAAM,WAAW,GAA2B,UAAU,CACpD,KAAK,CAAC,KAAK,CACwD,CAAC;IACtE,OAAO;QACL,QAAQ,EAAE,OAAO;QACjB,IAAI,EAAE,iCAAiC;QACvC,WAAW;QACX,OAAO,EAAE;YACP,iBAAiB,EAAE,CAAC,IAAI,EAAE,EAAE;gBAC1B,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACpB,CAAC;SAC0C;KAC9C,CAAC;AACJ,CAAC;AAED,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGT,CAAC;AACJ,MAAM,UAAU,GAAG;IACjB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAGJ;IACH,MAAM;IACN,KAAK,EAAE,MAAM;IACb,QAAQ,EAAE,MAAM;IAChB,KAAK,EAAE,MAAM;CACd,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AutoBePrisma } from "@autobe/interface";
|
|
2
|
-
import {
|
|
2
|
+
import { AutoBePrismaSchemaEvent } from "@autobe/interface/src/events/AutoBePrismaSchemaEvent";
|
|
3
3
|
import { ILlmSchema } from "@samchon/openapi";
|
|
4
4
|
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
5
|
-
export declare function orchestratePrismaSchemas<Model extends ILlmSchema.Model>(ctx: AutoBeContext<Model>, instruction: string, componentList: AutoBePrisma.IComponent[]): Promise<
|
|
5
|
+
export declare function orchestratePrismaSchemas<Model extends ILlmSchema.Model>(ctx: AutoBeContext<Model>, instruction: string, componentList: AutoBePrisma.IComponent[]): Promise<AutoBePrismaSchemaEvent[]>;
|
|
@@ -88,7 +88,7 @@ function process(ctx, props) {
|
|
|
88
88
|
value: null,
|
|
89
89
|
};
|
|
90
90
|
const { tokenUsage } = yield ctx.conversate({
|
|
91
|
-
source: "
|
|
91
|
+
source: "prismaSchema",
|
|
92
92
|
histories: (0, transformPrismaSchemaHistories_1.transformPrismaSchemaHistories)({
|
|
93
93
|
analysis: (_b = (_a = ctx
|
|
94
94
|
.state()
|
|
@@ -113,7 +113,7 @@ function process(ctx, props) {
|
|
|
113
113
|
if (pointer.value === null)
|
|
114
114
|
throw new Error("Unreachable code: Prisma Schema not generated");
|
|
115
115
|
return {
|
|
116
|
-
type: "
|
|
116
|
+
type: "prismaSchema",
|
|
117
117
|
id: (0, uuid_1.v7)(),
|
|
118
118
|
created_at: props.start.toISOString(),
|
|
119
119
|
plan: pointer.value.plan,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestratePrismaSchemas.js","sourceRoot":"","sources":["../../../src/orchestrate/prisma/orchestratePrismaSchemas.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,4DA6BC;;;;AAzCD,yCAA2C;AAG3C,kDAA0B;AAC1B,+BAA0B;AAG1B,uEAAoE;AACpE,uEAAoE;AACpE,+FAA4F;AAG5F,SAAsB,wBAAwB,CAC5C,GAAyB,EACzB,WAAmB,EACnB,aAAwC;;QAExC,MAAM,KAAK,GAAS,IAAI,IAAI,EAAE,CAAC;QAC/B,MAAM,KAAK,GAAW,aAAa;aAChC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC;aAC3B,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;QAC9B,MAAM,SAAS,GAAqB,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;QACjD,OAAO,MAAM,IAAA,uCAAkB,EAC7B,aAAa,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAO,cAAc,EAAE,EAAE;YACxD,MAAM,WAAW,GAAa,aAAa;iBACxC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,SAAS,KAAK,CAAC,CAAC;iBAC9B,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;iBACpB,IAAI,EAAE,CAAC;YACV,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"orchestratePrismaSchemas.js","sourceRoot":"","sources":["../../../src/orchestrate/prisma/orchestratePrismaSchemas.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,4DA6BC;;;;AAzCD,yCAA2C;AAG3C,kDAA0B;AAC1B,+BAA0B;AAG1B,uEAAoE;AACpE,uEAAoE;AACpE,+FAA4F;AAG5F,SAAsB,wBAAwB,CAC5C,GAAyB,EACzB,WAAmB,EACnB,aAAwC;;QAExC,MAAM,KAAK,GAAS,IAAI,IAAI,EAAE,CAAC;QAC/B,MAAM,KAAK,GAAW,aAAa;aAChC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC;aAC3B,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;QAC9B,MAAM,SAAS,GAAqB,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;QACjD,OAAO,MAAM,IAAA,uCAAkB,EAC7B,aAAa,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAO,cAAc,EAAE,EAAE;YACxD,MAAM,WAAW,GAAa,aAAa;iBACxC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,SAAS,KAAK,CAAC,CAAC;iBAC9B,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;iBACpB,IAAI,EAAE,CAAC;YACV,MAAM,KAAK,GAA4B,MAAM,OAAO,CAAC,GAAG,EAAE;gBACxD,WAAW;gBACX,SAAS;gBACT,WAAW;gBACX,KAAK;gBACL,KAAK;gBACL,SAAS;gBACT,cAAc;aACf,CAAC,CAAC;YACH,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YACpB,OAAO,KAAK,CAAC;QACf,CAAC,CAAA,CAAC,CACH,CAAC;IACJ,CAAC;CAAA;AAED,SAAe,OAAO,CACpB,GAAyB,EACzB,KAQC;;;QAED,MAAM,OAAO,GAA2D;YACtE,KAAK,EAAE,IAAI;SACZ,CAAC;QACF,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,GAAG,CAAC,UAAU,CAAC;YAC1C,MAAM,EAAE,cAAc;YACtB,SAAS,EAAE,IAAA,+DAA8B,EAAC;gBACxC,QAAQ,EACN,MAAA,MAAA,GAAG;qBACA,KAAK,EAAE;qBACP,OAAO,0CAAE,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,EAChE,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;oBACnB,OAAO,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;gBACjC,CAAC,EAAE,EAAE,CAAC,mCAAI,EAAE;gBAChB,eAAe,EAAE,KAAK,CAAC,SAAS;gBAChC,WAAW,EAAE,KAAK,CAAC,WAAW;gBAC9B,WAAW,EAAE,KAAK,CAAC,WAAW;aAC/B,CAAC;YACF,UAAU,EAAE,gBAAgB,CAAC,GAAG,EAAE;gBAChC,eAAe,EAAE,KAAK,CAAC,SAAS;gBAChC,WAAW,EAAE,KAAK,CAAC,WAAW;gBAC9B,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE;oBACd,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;gBACvB,CAAC;aACF,CAAC;YACF,mBAAmB,EAAE,IAAI;YACzB,cAAc,EAAE,KAAK,CAAC,cAAc;YACpC,OAAO,EAAE,gCAAgC;SAC1C,CAAC,CAAC;QACH,IAAI,OAAO,CAAC,KAAK,KAAK,IAAI;YACxB,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;QACnE,OAAO;YACL,IAAI,EAAE,cAAc;YACpB,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,EAAE;YACrC,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI;YACxB,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM;YAC5B,IAAI,EAAE;gBACJ,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,QAAQ;gBAClC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,SAAS;gBACpC,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM;aAC7B;YACD,UAAU;YACV,SAAS,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,IAAI,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC;YACnE,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,IAAI,EAAE,MAAA,MAAA,GAAG,CAAC,KAAK,EAAE,CAAC,OAAO,0CAAE,IAAI,mCAAI,CAAC;SACH,CAAC;IACtC,CAAC;CAAA;AAED,SAAS,gBAAgB,CACvB,GAAyB,EACzB,KAIC;IAED,IAAA,qCAAiB,EAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAE7B,MAAM,QAAQ,GAAG,CACf,KAAc,EACsC,EAAE;QACtD,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAC4C,KAAK,CAAC,CAAC;QAC/D,IAAI,MAAM,CAAC,OAAO,KAAK,KAAK;YAAE,OAAO,MAAM,CAAC;QAE5C,MAAM,MAAM,GAA0B,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;QACzD,MAAM,QAAQ,GAAa,KAAK,CAAC,eAAe,CAAC,MAAM,CAAC;QACxD,MAAM,MAAM,GAAa,QAAQ,CAAC,MAAM,CACtC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,KAAK,KAAK,CAClD,CAAC;QACF,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,MAAM,CAAC;QAEvC,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,oBAAoB;YAC1B,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,SAAS,EAAE,KAAK,CAAC,eAAe;YAChC,MAAM;YACN,MAAM;SACP,CAAC,CAAC;QACH,OAAO;YACL,OAAO,EAAE,KAAK;YACd,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,MAAM,EAAE;gBACN;oBACE,IAAI,EAAE,eAAe;oBACrB,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM;oBACzB,QAAQ,EAAE,4BAA4B;oBACtC,WAAW,EAAE,kBAAU,CAAC,IAAI,CAAA;;;;;;;;;;;;cAYxB,IAAI,CAAC,SAAS,CAAC;wBACf,QAAQ,EAAE,KAAK,CAAC,eAAe,CAAC,QAAQ;wBACxC,SAAS,EAAE,KAAK,CAAC,eAAe,CAAC,SAAS;wBAC1C,QAAQ;wBACR,MAAM;wBACN,MAAM;qBACP,CAAC;WACH;iBACF;aACF;SACF,CAAC;IACJ,CAAC,CAAC;IACF,MAAM,WAAW,GAA2B,UAAU,CACpD,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAC/C,CACC,QAAQ,CAC2D,CAAC;IACtE,OAAO;QACL,QAAQ,EAAE,OAAO;QACjB,IAAI,EAAE,kBAAkB;QACxB,WAAW;QACX,OAAO,EAAE;YACP,oBAAoB,EAAE,CAAC,IAAI,EAAE,EAAE;gBAC7B,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACpB,CAAC;SACuC;KAC3C,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,GAAG;IACjB,OAAO,EAAE,CAAC,QAAmB,EAAE,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uHACkC;YAC/D,QAAQ,EAAE;gBACR,oBAAoB,EAAE,QAAQ;aAC/B;SACF;;QAAC;IACJ,MAAM,EAAE,CAAC,QAAmB,EAAE,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uHACkC;YAC9D,QAAQ,EAAE;gBACR,oBAAoB,EAAE,QAAQ;aAC/B;SACF;;QAAC;CACL,CAAC"}
|