@autobe/agent 0.28.0 → 0.29.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 +1 -0
- package/lib/AutoBeAgent.js.map +1 -1
- package/lib/AutoBeMockAgent.js +1 -0
- package/lib/AutoBeMockAgent.js.map +1 -1
- package/lib/constants/AutoBeConfigConstant.d.ts +3 -1
- package/lib/constants/AutoBeSystemPromptConstant.d.ts +39 -26
- package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
- package/lib/context/AutoBeContext.d.ts +1 -1
- package/lib/factory/createAutoBeContext.js +5 -3
- package/lib/factory/createAutoBeContext.js.map +1 -1
- package/lib/index.mjs +37005 -17000
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.d.ts +7 -2
- package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js +11 -21
- package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.d.ts +2 -2
- package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js +12 -5
- package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.d.ts +2 -2
- package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js +53 -50
- package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyze.js +2 -2
- package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeReview.js +855 -258
- package/lib/orchestrate/analyze/orchestrateAnalyzeReview.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js +15 -22
- package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js +2 -9
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js.map +1 -1
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.d.ts +110 -36
- package/lib/orchestrate/common/AutoBePreliminaryController.d.ts +40 -0
- package/lib/orchestrate/common/AutoBePreliminaryController.js +97 -0
- package/lib/orchestrate/common/AutoBePreliminaryController.js.map +1 -0
- package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistory.d.ts +8 -0
- package/lib/orchestrate/{realize/histories/transformRealizeCorrectCastingHistories.js → common/histories/transformCommonCorrectCastingHistory.js} +16 -13
- package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistory.js.map +1 -0
- package/lib/orchestrate/common/histories/transformPreliminaryHistory.d.ts +4 -0
- package/lib/orchestrate/common/histories/transformPreliminaryHistory.js +285 -0
- package/lib/orchestrate/common/histories/transformPreliminaryHistory.js.map +1 -0
- package/lib/orchestrate/common/histories/{transformPreviousAndLatestCorrectHistories.d.ts → transformPreviousAndLatestCorrectHistory.d.ts} +1 -1
- package/lib/orchestrate/common/histories/{transformPreviousAndLatestCorrectHistories.js → transformPreviousAndLatestCorrectHistory.js} +4 -4
- package/lib/orchestrate/common/histories/transformPreviousAndLatestCorrectHistory.js.map +1 -0
- package/lib/orchestrate/common/internal/complementPreliminaryCollection.d.ts +7 -0
- package/lib/orchestrate/common/internal/complementPreliminaryCollection.js +99 -0
- package/lib/orchestrate/common/internal/complementPreliminaryCollection.js.map +1 -0
- package/lib/orchestrate/common/internal/createPreliminaryCollection.d.ts +3 -0
- package/lib/orchestrate/common/internal/createPreliminaryCollection.js +20 -0
- package/lib/orchestrate/common/internal/createPreliminaryCollection.js.map +1 -0
- package/lib/orchestrate/common/internal/validatePreliminary.d.ts +5 -0
- package/lib/orchestrate/common/internal/validatePreliminary.js +217 -0
- package/lib/orchestrate/common/internal/validatePreliminary.js.map +1 -0
- package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js +10 -22
- package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js.map +1 -1
- package/lib/orchestrate/common/orchestratePreliminary.d.ts +12 -0
- package/lib/orchestrate/common/orchestratePreliminary.js +231 -0
- package/lib/orchestrate/common/orchestratePreliminary.js.map +1 -0
- package/lib/orchestrate/common/structures/AutoBePreliminaryRequest.d.ts +16 -0
- package/lib/orchestrate/{realize/structures/IAutoBeRealizeAuthorizationApplication.js → common/structures/AutoBePreliminaryRequest.js} +1 -1
- package/lib/orchestrate/common/structures/AutoBePreliminaryRequest.js.map +1 -0
- package/lib/orchestrate/common/structures/IAutoBeCommonCorrectCastingApplication.d.ts +1 -4
- package/lib/orchestrate/common/structures/IAutoBeOrchestrateResult.d.ts +9 -0
- package/lib/orchestrate/{interface/structures/IAutoBeInterfacePrerequisitesApplication.js → common/structures/IAutoBeOrchestrateResult.js} +1 -1
- package/lib/orchestrate/common/structures/IAutoBeOrchestrateResult.js.map +1 -0
- package/lib/orchestrate/common/structures/IAutoBePreliminaryCollection.d.ts +8 -0
- package/lib/orchestrate/{interface/structures/IAutoBeInterfaceEndpointsReviewApplication.js → common/structures/IAutoBePreliminaryCollection.js} +1 -1
- package/lib/orchestrate/common/structures/IAutoBePreliminaryCollection.js.map +1 -0
- package/lib/orchestrate/common/structures/IAutoBePreliminaryGetAnalysisFiles.d.ts +27 -0
- package/lib/orchestrate/{interface/structures/IAutoBeInterfaceOperationsReviewApplication.js → common/structures/IAutoBePreliminaryGetAnalysisFiles.js} +1 -1
- package/lib/orchestrate/common/structures/IAutoBePreliminaryGetAnalysisFiles.js.map +1 -0
- package/lib/orchestrate/common/structures/IAutoBePreliminaryGetInterfaceOperations.d.ts +28 -0
- package/lib/orchestrate/common/structures/IAutoBePreliminaryGetInterfaceOperations.js +3 -0
- package/lib/orchestrate/common/structures/IAutoBePreliminaryGetInterfaceOperations.js.map +1 -0
- package/lib/orchestrate/common/structures/IAutoBePreliminaryGetInterfaceSchemas.d.ts +27 -0
- package/lib/orchestrate/common/structures/IAutoBePreliminaryGetInterfaceSchemas.js +3 -0
- package/lib/orchestrate/common/structures/IAutoBePreliminaryGetInterfaceSchemas.js.map +1 -0
- package/lib/orchestrate/common/structures/IAutoBePreliminaryGetPrismaSchemas.d.ts +27 -0
- package/lib/orchestrate/common/structures/IAutoBePreliminaryGetPrismaSchemas.js +3 -0
- package/lib/orchestrate/common/structures/IAutoBePreliminaryGetPrismaSchemas.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationHistory.d.ts +10 -0
- package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationHistory.js +70 -0
- package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationHistory.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceCommonHistory.d.ts +3 -0
- package/lib/orchestrate/interface/histories/{transformInterfaceCommonHistories.js → transformInterfaceCommonHistory.js} +4 -4
- package/lib/orchestrate/interface/histories/transformInterfaceCommonHistory.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistory.d.ts +9 -0
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistory.js +60 -0
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistory.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistory.d.ts +12 -0
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistory.js +63 -0
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistory.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointReviewHistory.d.ts +7 -0
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointReviewHistory.js +36 -0
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointReviewHistory.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistory.d.ts +6 -0
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistory.js +68 -0
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistory.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistory.d.ts +9 -0
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistory.js +72 -0
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistory.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceOperationReviewHistory.d.ts +7 -0
- package/lib/orchestrate/interface/histories/transformInterfaceOperationReviewHistory.js +38 -0
- package/lib/orchestrate/interface/histories/transformInterfaceOperationReviewHistory.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfacePrerequisiteHistory.d.ts +8 -0
- package/lib/orchestrate/interface/histories/transformInterfacePrerequisiteHistory.js +73 -0
- package/lib/orchestrate/interface/histories/transformInterfacePrerequisiteHistory.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistory.d.ts +11 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistory.js +95 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistory.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaRenameHistory.d.ts +5 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaRenameHistory.js +54 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaRenameHistory.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaReviewHistory.d.ts +12 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaReviewHistory.js +75 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaReviewHistory.js.map +1 -0
- package/lib/orchestrate/interface/orchestrateInterface.js +90 -46
- package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorization.d.ts +6 -0
- package/lib/orchestrate/interface/{orchestrateInterfaceAuthorizations.js → orchestrateInterfaceAuthorization.js} +1395 -241
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorization.js.map +1 -0
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.d.ts +4 -3
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js +2843 -556
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
- package/lib/orchestrate/interface/{orchestrateInterfaceEndpoints.d.ts → orchestrateInterfaceEndpoint.d.ts} +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoint.js +1356 -0
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoint.js.map +1 -0
- package/lib/orchestrate/interface/orchestrateInterfaceEndpointReview.d.ts +4 -0
- package/lib/orchestrate/interface/orchestrateInterfaceEndpointReview.js +1337 -0
- package/lib/orchestrate/interface/orchestrateInterfaceEndpointReview.js.map +1 -0
- package/lib/orchestrate/interface/{orchestrateInterfaceGroups.d.ts → orchestrateInterfaceGroup.d.ts} +1 -2
- package/lib/orchestrate/interface/orchestrateInterfaceGroup.js +621 -0
- package/lib/orchestrate/interface/orchestrateInterfaceGroup.js.map +1 -0
- package/lib/orchestrate/interface/{orchestrateInterfaceOperations.d.ts → orchestrateInterfaceOperation.d.ts} +1 -2
- package/lib/orchestrate/interface/{orchestrateInterfaceOperations.js → orchestrateInterfaceOperation.js} +1299 -232
- package/lib/orchestrate/interface/orchestrateInterfaceOperation.js.map +1 -0
- package/lib/orchestrate/interface/orchestrateInterfaceOperationReview.d.ts +4 -0
- package/lib/orchestrate/interface/{orchestrateInterfaceOperationsReview.js → orchestrateInterfaceOperationReview.js} +1447 -264
- package/lib/orchestrate/interface/orchestrateInterfaceOperationReview.js.map +1 -0
- package/lib/orchestrate/interface/{orchestrateInterfacePrerequisites.d.ts → orchestrateInterfacePrerequisite.d.ts} +1 -1
- package/lib/orchestrate/interface/orchestrateInterfacePrerequisite.js +2159 -0
- package/lib/orchestrate/interface/orchestrateInterfacePrerequisite.js.map +1 -0
- package/lib/orchestrate/interface/{orchestrateInterfaceSchemas.d.ts → orchestrateInterfaceSchema.d.ts} +1 -2
- package/lib/orchestrate/interface/{orchestrateInterfaceSchemas.js → orchestrateInterfaceSchema.js} +2586 -570
- package/lib/orchestrate/interface/orchestrateInterfaceSchema.js.map +1 -0
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.js +7 -17
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.d.ts +1 -0
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.js +2875 -588
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.js.map +1 -1
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceAuthorizationsApplication.d.ts +56 -5
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceComplementApplication.d.ts +57 -10
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceEndpointApplication.d.ts +55 -10
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceEndpointReviewApplication.d.ts +96 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceEndpointReviewApplication.js +3 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceEndpointReviewApplication.js.map +1 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.d.ts +6 -82
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +58 -13
- package/lib/orchestrate/interface/structures/{IAutoBeInterfaceOperationsReviewApplication.d.ts → IAutoBeInterfaceOperationReviewApplication.d.ts} +58 -28
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationReviewApplication.js +3 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationReviewApplication.js.map +1 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfacePrerequisiteApplication.d.ts +98 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfacePrerequisiteApplication.js +3 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfacePrerequisiteApplication.js.map +1 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.d.ts +56 -15
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaContentReviewApplication.d.ts +62 -22
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.d.ts +60 -21
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.d.ts +61 -19
- package/lib/orchestrate/interface/utils/JsonSchemaFactory.js +29 -23
- package/lib/orchestrate/interface/utils/JsonSchemaFactory.js.map +1 -1
- package/lib/orchestrate/interface/utils/JsonSchemaNamingConvention.js +67 -61
- package/lib/orchestrate/interface/utils/JsonSchemaNamingConvention.js.map +1 -1
- package/lib/orchestrate/interface/utils/JsonSchemaValidator.d.ts +2 -1
- package/lib/orchestrate/interface/utils/JsonSchemaValidator.js +52 -25
- package/lib/orchestrate/interface/utils/JsonSchemaValidator.js.map +1 -1
- package/lib/orchestrate/interface/utils/OperationValidator.js +59 -1
- package/lib/orchestrate/interface/utils/OperationValidator.js.map +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistory.d.ts +6 -0
- package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistory.js +98 -0
- package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistory.js.map +1 -0
- package/lib/orchestrate/prisma/histories/transformPrismaCorrectHistory.d.ts +7 -0
- package/lib/orchestrate/prisma/histories/transformPrismaCorrectHistory.js +31 -0
- package/lib/orchestrate/prisma/histories/transformPrismaCorrectHistory.js.map +1 -0
- package/lib/orchestrate/prisma/histories/transformPrismaReviewHistory.d.ts +7 -0
- package/lib/orchestrate/prisma/histories/transformPrismaReviewHistory.js +38 -0
- package/lib/orchestrate/prisma/histories/transformPrismaReviewHistory.js.map +1 -0
- package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistory.d.ts +8 -0
- package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistory.js +79 -0
- package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistory.js.map +1 -0
- package/lib/orchestrate/prisma/orchestratePrisma.js +9 -6
- package/lib/orchestrate/prisma/orchestratePrisma.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaComponent.d.ts +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js +19 -22
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js +2864 -1535
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaReview.d.ts +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaReview.js +2886 -1557
- package/lib/orchestrate/prisma/orchestratePrismaReview.js.map +1 -1
- package/lib/orchestrate/prisma/{orchestratePrismaSchemas.d.ts → orchestratePrismaSchema.d.ts} +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaSchema.js +3068 -0
- package/lib/orchestrate/prisma/orchestratePrismaSchema.js.map +1 -0
- package/lib/orchestrate/prisma/structures/IAutoBePrismaCorrectApplication.d.ts +74 -76
- package/lib/orchestrate/prisma/structures/IAutoBePrismaReviewApplication.d.ts +90 -72
- package/lib/orchestrate/prisma/structures/IAutoBePrismaSchemaApplication.d.ts +89 -66
- package/lib/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistory.d.ts +9 -0
- package/lib/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistory.js +79 -0
- package/lib/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistory.js.map +1 -0
- package/lib/orchestrate/realize/histories/transformRealizeAuthorizationWriteHistory.d.ts +7 -0
- package/lib/orchestrate/realize/histories/transformRealizeAuthorizationWriteHistory.js +41 -0
- package/lib/orchestrate/realize/histories/transformRealizeAuthorizationWriteHistory.js.map +1 -0
- package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistory.d.ts +12 -0
- package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistory.js +67 -0
- package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistory.js.map +1 -0
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistory.d.ts +18 -0
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistory.js +54 -0
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistory.js.map +1 -0
- package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.d.ts +4 -2
- package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.js +140 -106
- package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeWriteMembershipHistory.d.ts +3 -0
- package/lib/orchestrate/realize/histories/transformRealizeWriteMembershipHistory.js +23 -0
- package/lib/orchestrate/realize/histories/transformRealizeWriteMembershipHistory.js.map +1 -0
- package/lib/orchestrate/realize/orchestrateRealize.js +4 -4
- package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.d.ts +5 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +1288 -569
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js.map +1 -1
- package/lib/orchestrate/realize/{orchestrateRealizeAuthorization.d.ts → orchestrateRealizeAuthorizationWrite.d.ts} +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationWrite.js +1410 -0
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationWrite.js.map +1 -0
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.js +664 -140
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeCorrectCasting.js +20 -65
- package/lib/orchestrate/realize/orchestrateRealizeCorrectCasting.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeWrite.js +660 -135
- package/lib/orchestrate/realize/orchestrateRealizeWrite.js.map +1 -1
- package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.d.ts +79 -19
- package/lib/orchestrate/realize/structures/{IAutoBeRealizeAuthorizationApplication.d.ts → IAutoBeRealizeAuthorizationWriteApplication.d.ts} +60 -27
- package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationWriteApplication.js +3 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationWriteApplication.js.map +1 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.d.ts +54 -5
- package/lib/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.d.ts +6 -14
- package/lib/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.d.ts +54 -6
- package/lib/orchestrate/realize/utils/generateRealizeScenario.d.ts +1 -3
- package/lib/orchestrate/realize/utils/generateRealizeScenario.js +1 -7
- package/lib/orchestrate/realize/utils/generateRealizeScenario.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestCorrectHistories.d.ts +3 -3
- package/lib/orchestrate/test/histories/transformTestCorrectHistories.js +23 -20
- package/lib/orchestrate/test/histories/transformTestCorrectHistories.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistory.d.ts +4 -0
- package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistory.js +36 -0
- package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistory.js.map +1 -0
- package/lib/orchestrate/test/histories/transformTestScenarioHistory.d.ts +11 -0
- package/lib/orchestrate/test/histories/transformTestScenarioHistory.js +95 -0
- package/lib/orchestrate/test/histories/transformTestScenarioHistory.js.map +1 -0
- package/lib/orchestrate/test/histories/transformTestScenarioReviewHistory.d.ts +10 -0
- package/lib/orchestrate/test/histories/transformTestScenarioReviewHistory.js +67 -0
- package/lib/orchestrate/test/histories/transformTestScenarioReviewHistory.js.map +1 -0
- package/lib/orchestrate/test/histories/{transformTestWriteHistories.d.ts → transformTestWriteHistory.d.ts} +4 -4
- package/lib/orchestrate/test/histories/{transformTestWriteHistories.js → transformTestWriteHistory.js} +79 -76
- package/lib/orchestrate/test/histories/transformTestWriteHistory.js.map +1 -0
- package/lib/orchestrate/test/orchestrateTestCorrect.js +13 -26
- package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js +3 -15
- package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenario.d.ts +1 -1
- package/lib/orchestrate/test/orchestrateTestScenario.js +1381 -325
- package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenarioReview.d.ts +5 -3
- package/lib/orchestrate/test/orchestrateTestScenarioReview.js +1072 -291
- package/lib/orchestrate/test/orchestrateTestScenarioReview.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestWrite.js +8 -15
- package/lib/orchestrate/test/orchestrateTestWrite.js.map +1 -1
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioApplication.d.ts +66 -4
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioReviewApplication.d.ts +82 -14
- package/lib/structures/IAutoBeOrchestrateHistory.d.ts +5 -0
- package/lib/structures/IAutoBeOrchestrateHistory.js +3 -0
- package/lib/structures/IAutoBeOrchestrateHistory.js.map +1 -0
- package/lib/utils/executeCachedBatch.d.ts +5 -1
- package/lib/utils/executeCachedBatch.js +23 -5
- package/lib/utils/executeCachedBatch.js.map +1 -1
- package/lib/utils/validateEmptyCode.js +2 -2
- package/lib/utils/validateEmptyCode.js.map +1 -1
- package/package.json +10 -8
- package/src/AutoBeAgent.ts +1 -0
- package/src/AutoBeMockAgent.ts +1 -0
- package/src/constants/AutoBeConfigConstant.ts +2 -0
- package/src/constants/AutoBeSystemPromptConstant.ts +39 -26
- package/src/context/AutoBeContext.ts +1 -1
- package/src/factory/createAutoBeContext.ts +5 -2
- package/src/orchestrate/analyze/histories/transformAnalyzeReviewHistories.ts +17 -28
- package/src/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.ts +12 -6
- package/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.ts +62 -61
- package/src/orchestrate/analyze/orchestrateAnalyze.ts +2 -0
- package/src/orchestrate/analyze/orchestrateAnalyzeReview.ts +97 -48
- package/src/orchestrate/analyze/orchestrateAnalyzeScenario.ts +3 -16
- package/src/orchestrate/analyze/orchestrateAnalyzeWrite.ts +1 -2
- package/src/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.ts +114 -36
- package/src/orchestrate/common/AutoBePreliminaryController.ts +161 -0
- package/src/orchestrate/common/histories/transformCommonCorrectCastingHistory.ts +32 -0
- package/src/orchestrate/common/histories/transformPreliminaryHistory.ts +383 -0
- package/src/orchestrate/common/histories/{transformPreviousAndLatestCorrectHistories.ts → transformPreviousAndLatestCorrectHistory.ts} +1 -1
- package/src/orchestrate/common/internal/complementPreliminaryCollection.ts +123 -0
- package/src/orchestrate/common/internal/createPreliminaryCollection.ts +32 -0
- package/src/orchestrate/common/internal/validatePreliminary.ts +315 -0
- package/src/orchestrate/common/orchestrateCommonCorrectCasting.ts +8 -15
- package/src/orchestrate/common/orchestratePreliminary.ts +361 -0
- package/src/orchestrate/common/structures/AutoBePreliminaryRequest.ts +18 -0
- package/src/orchestrate/common/structures/IAutoBeCommonCorrectCastingApplication.ts +1 -4
- package/src/orchestrate/common/structures/IAutoBeOrchestrateResult.ts +13 -0
- package/src/orchestrate/common/structures/IAutoBePreliminaryCollection.ts +9 -0
- package/src/orchestrate/common/structures/IAutoBePreliminaryGetAnalysisFiles.ts +29 -0
- package/src/orchestrate/common/structures/IAutoBePreliminaryGetInterfaceOperations.ts +30 -0
- package/src/orchestrate/common/structures/IAutoBePreliminaryGetInterfaceSchemas.ts +29 -0
- package/src/orchestrate/common/structures/IAutoBePreliminaryGetPrismaSchemas.ts +29 -0
- package/src/orchestrate/interface/histories/transformInterfaceAuthorizationHistory.ts +77 -0
- package/src/orchestrate/interface/histories/{transformInterfaceCommonHistories.ts → transformInterfaceCommonHistory.ts} +1 -1
- package/src/orchestrate/interface/histories/{transformInterfaceGroupHistories.ts → transformInterfaceComplementHistory.ts} +35 -21
- package/src/orchestrate/interface/histories/transformInterfaceEndpointHistory.ts +74 -0
- package/src/orchestrate/interface/histories/transformInterfaceEndpointReviewHistory.ts +40 -0
- package/src/orchestrate/interface/histories/transformInterfaceGroupHistory.ts +72 -0
- package/src/orchestrate/interface/histories/transformInterfaceOperationHistory.ts +79 -0
- package/src/orchestrate/interface/histories/transformInterfaceOperationReviewHistory.ts +43 -0
- package/src/orchestrate/interface/histories/transformInterfacePrerequisiteHistory.ts +89 -0
- package/src/orchestrate/interface/histories/transformInterfaceSchemaHistory.ts +105 -0
- package/src/orchestrate/interface/histories/transformInterfaceSchemaRenameHistory.ts +56 -0
- package/src/orchestrate/interface/histories/transformInterfaceSchemaReviewHistory.ts +88 -0
- package/src/orchestrate/interface/orchestrateInterface.ts +115 -51
- package/src/orchestrate/interface/{orchestrateInterfaceAuthorizations.ts → orchestrateInterfaceAuthorization.ts} +91 -67
- package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +174 -78
- package/src/orchestrate/interface/orchestrateInterfaceEndpoint.ts +207 -0
- package/src/orchestrate/interface/orchestrateInterfaceEndpointReview.ts +139 -0
- package/src/orchestrate/interface/orchestrateInterfaceGroup.ts +153 -0
- package/src/orchestrate/interface/{orchestrateInterfaceOperations.ts → orchestrateInterfaceOperation.ts} +109 -86
- package/src/orchestrate/interface/orchestrateInterfaceOperationReview.ts +186 -0
- package/src/orchestrate/interface/{orchestrateInterfacePrerequisites.ts → orchestrateInterfacePrerequisite.ts} +123 -58
- package/src/orchestrate/interface/{orchestrateInterfaceSchemas.ts → orchestrateInterfaceSchema.ts} +96 -90
- package/src/orchestrate/interface/orchestrateInterfaceSchemaRename.ts +10 -11
- package/src/orchestrate/interface/orchestrateInterfaceSchemaReview.ts +127 -60
- package/src/orchestrate/interface/structures/IAutoBeInterfaceAuthorizationsApplication.ts +63 -5
- package/src/orchestrate/interface/structures/IAutoBeInterfaceComplementApplication.ts +67 -12
- package/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointApplication.ts +63 -10
- package/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointReviewApplication.ts +106 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceGroupApplication.ts +6 -84
- package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.ts +65 -13
- package/src/orchestrate/interface/structures/{IAutoBeInterfaceOperationsReviewApplication.ts → IAutoBeInterfaceOperationReviewApplication.ts} +65 -30
- package/src/orchestrate/interface/structures/IAutoBeInterfacePrerequisiteApplication.ts +111 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaApplication.ts +65 -15
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaContentReviewApplication.ts +71 -24
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.ts +68 -23
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.ts +69 -21
- package/src/orchestrate/interface/utils/JsonSchemaFactory.ts +31 -23
- package/src/orchestrate/interface/utils/JsonSchemaNamingConvention.ts +73 -61
- package/src/orchestrate/interface/utils/JsonSchemaValidator.ts +53 -26
- package/src/orchestrate/interface/utils/OperationValidator.ts +69 -1
- package/src/orchestrate/prisma/histories/transformPrismaComponentsHistory.ts +109 -0
- package/src/orchestrate/prisma/histories/{transformPrismaCorrectHistories.ts → transformPrismaCorrectHistory.ts} +13 -22
- package/src/orchestrate/prisma/histories/transformPrismaReviewHistory.ts +42 -0
- package/src/orchestrate/prisma/histories/{transformPrismaSchemaHistories.ts → transformPrismaSchemaHistory.ts} +7 -8
- package/src/orchestrate/prisma/orchestratePrisma.ts +12 -17
- package/src/orchestrate/prisma/orchestratePrismaComponent.ts +7 -15
- package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +129 -64
- package/src/orchestrate/prisma/orchestratePrismaReview.ts +115 -59
- package/src/orchestrate/prisma/{orchestratePrismaSchemas.ts → orchestratePrismaSchema.ts} +92 -60
- package/src/orchestrate/prisma/structures/IAutoBePrismaCorrectApplication.ts +81 -76
- package/src/orchestrate/prisma/structures/IAutoBePrismaReviewApplication.ts +97 -72
- package/src/orchestrate/prisma/structures/IAutoBePrismaSchemaApplication.ts +93 -66
- package/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistory.ts +89 -0
- package/src/orchestrate/realize/histories/transformRealizeAuthorizationWriteHistory.ts +45 -0
- package/src/orchestrate/realize/histories/transformRealizeCorrectCastingHistory.ts +85 -0
- package/src/orchestrate/realize/histories/transformRealizeCorrectHistory.ts +77 -0
- package/src/orchestrate/realize/histories/transformRealizeWriteHistories.ts +152 -121
- package/src/orchestrate/realize/histories/{transformRealizeWriteAuthorizationsHistories.ts → transformRealizeWriteMembershipHistory.ts} +2 -2
- package/src/orchestrate/realize/orchestrateRealize.ts +4 -3
- package/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.ts +155 -97
- package/src/orchestrate/realize/orchestrateRealizeAuthorizationWrite.ts +241 -0
- package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +88 -86
- package/src/orchestrate/realize/orchestrateRealizeCorrectCasting.ts +17 -56
- package/src/orchestrate/realize/orchestrateRealizeWrite.ts +82 -78
- package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationCorrectApplication.ts +85 -22
- package/src/orchestrate/realize/structures/{IAutoBeRealizeAuthorizationApplication.ts → IAutoBeRealizeAuthorizationWriteApplication.ts} +64 -29
- package/src/orchestrate/realize/structures/IAutoBeRealizeCorrectApplication.ts +58 -5
- package/src/orchestrate/realize/structures/IAutoBeRealizeScenarioResult.ts +6 -19
- package/src/orchestrate/realize/structures/IAutoBeRealizeWriteApplication.ts +58 -6
- package/src/orchestrate/realize/utils/generateRealizeScenario.ts +2 -20
- package/src/orchestrate/test/histories/transformTestCorrectHistories.ts +30 -30
- package/src/orchestrate/test/histories/transformTestCorrectInvalidRequestHistory.ts +40 -0
- package/src/orchestrate/test/histories/transformTestScenarioHistory.ts +116 -0
- package/src/orchestrate/test/histories/transformTestScenarioReviewHistory.ts +85 -0
- package/src/orchestrate/test/histories/transformTestWriteHistory.ts +169 -0
- package/src/orchestrate/test/orchestrateTestCorrect.ts +13 -19
- package/src/orchestrate/test/orchestrateTestCorrectInvalidRequest.ts +5 -12
- package/src/orchestrate/test/orchestrateTestScenario.ts +143 -83
- package/src/orchestrate/test/orchestrateTestScenarioReview.ts +93 -76
- package/src/orchestrate/test/orchestrateTestWrite.ts +7 -7
- package/src/orchestrate/test/structures/IAutoBeTestScenarioApplication.ts +74 -4
- package/src/orchestrate/test/structures/IAutoBeTestScenarioReviewApplication.ts +89 -14
- package/src/structures/IAutoBeOrchestrateHistory.ts +6 -0
- package/src/utils/executeCachedBatch.ts +33 -7
- package/src/utils/validateEmptyCode.ts +2 -2
- package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistories.d.ts +0 -8
- package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistories.js +0 -16
- package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistories.js.map +0 -1
- package/lib/orchestrate/common/histories/transformPreviousAndLatestCorrectHistories.js.map +0 -1
- package/lib/orchestrate/interface/histories/transformInterfaceAssetHistories.d.ts +0 -3
- package/lib/orchestrate/interface/histories/transformInterfaceAssetHistories.js +0 -62
- package/lib/orchestrate/interface/histories/transformInterfaceAssetHistories.js.map +0 -1
- package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.d.ts +0 -8
- package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js +0 -68
- package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js.map +0 -1
- package/lib/orchestrate/interface/histories/transformInterfaceCommonHistories.d.ts +0 -3
- package/lib/orchestrate/interface/histories/transformInterfaceCommonHistories.js.map +0 -1
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.d.ts +0 -9
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js +0 -74
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +0 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.d.ts +0 -10
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +0 -61
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +0 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.d.ts +0 -4
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js +0 -34
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js.map +0 -1
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.d.ts +0 -6
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js +0 -52
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +0 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.d.ts +0 -8
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js +0 -71
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +0 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.d.ts +0 -5
- package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +0 -36
- package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +0 -1
- package/lib/orchestrate/interface/histories/transformInterfacePrerequisitesHistories.d.ts +0 -3
- package/lib/orchestrate/interface/histories/transformInterfacePrerequisitesHistories.js +0 -102
- package/lib/orchestrate/interface/histories/transformInterfacePrerequisitesHistories.js.map +0 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.d.ts +0 -9
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +0 -74
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +0 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.d.ts +0 -5
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.js +0 -51
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.js.map +0 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.d.ts +0 -11
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.js +0 -81
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.js.map +0 -1
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.d.ts +0 -4
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +0 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +0 -506
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +0 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.d.ts +0 -4
- package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.js +0 -487
- package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.js.map +0 -1
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.js +0 -455
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.js.map +0 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +0 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.d.ts +0 -4
- package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +0 -1
- package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js +0 -916
- package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js.map +0 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js.map +0 -1
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.d.ts +0 -60
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.js.map +0 -1
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.js.map +0 -1
- package/lib/orchestrate/interface/structures/IAutoBeInterfacePrerequisitesApplication.d.ts +0 -52
- package/lib/orchestrate/interface/structures/IAutoBeInterfacePrerequisitesApplication.js.map +0 -1
- package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.d.ts +0 -6
- package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js +0 -95
- package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js.map +0 -1
- package/lib/orchestrate/prisma/histories/transformPrismaCorrectHistories.d.ts +0 -3
- package/lib/orchestrate/prisma/histories/transformPrismaCorrectHistories.js +0 -41
- package/lib/orchestrate/prisma/histories/transformPrismaCorrectHistories.js.map +0 -1
- package/lib/orchestrate/prisma/histories/transformPrismaReviewHistories.d.ts +0 -8
- package/lib/orchestrate/prisma/histories/transformPrismaReviewHistories.js +0 -62
- package/lib/orchestrate/prisma/histories/transformPrismaReviewHistories.js.map +0 -1
- package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.d.ts +0 -8
- package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js +0 -78
- package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +0 -1
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.js +0 -1678
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.js.map +0 -1
- package/lib/orchestrate/realize/histories/transformRealizeAuthorization.d.ts +0 -5
- package/lib/orchestrate/realize/histories/transformRealizeAuthorization.js +0 -44
- package/lib/orchestrate/realize/histories/transformRealizeAuthorization.js.map +0 -1
- package/lib/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.d.ts +0 -5
- package/lib/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js +0 -82
- package/lib/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js.map +0 -1
- package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.d.ts +0 -5
- package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js.map +0 -1
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.d.ts +0 -13
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js +0 -29
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js.map +0 -1
- package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.d.ts +0 -3
- package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js +0 -23
- package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js.map +0 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js +0 -707
- package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js.map +0 -1
- package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.js.map +0 -1
- package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.d.ts +0 -4
- package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.js +0 -33
- package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.js.map +0 -1
- package/lib/orchestrate/test/histories/transformTestScenarioHistories.d.ts +0 -10
- package/lib/orchestrate/test/histories/transformTestScenarioHistories.js +0 -101
- package/lib/orchestrate/test/histories/transformTestScenarioHistories.js.map +0 -1
- package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.d.ts +0 -8
- package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js +0 -72
- package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js.map +0 -1
- package/lib/orchestrate/test/histories/transformTestWriteHistories.js.map +0 -1
- package/src/orchestrate/common/histories/transformCommonCorrectCastingHistories.ts +0 -25
- package/src/orchestrate/interface/histories/transformInterfaceAssetHistories.ts +0 -72
- package/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.ts +0 -75
- package/src/orchestrate/interface/histories/transformInterfaceComplementHistories.ts +0 -82
- package/src/orchestrate/interface/histories/transformInterfaceEndpointHistories.ts +0 -72
- package/src/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.ts +0 -40
- package/src/orchestrate/interface/histories/transformInterfaceOperationHistories.ts +0 -78
- package/src/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.ts +0 -44
- package/src/orchestrate/interface/histories/transformInterfacePrerequisitesHistories.ts +0 -118
- package/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.ts +0 -80
- package/src/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.ts +0 -55
- package/src/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.ts +0 -90
- package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +0 -152
- package/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.ts +0 -98
- package/src/orchestrate/interface/orchestrateInterfaceGroups.ts +0 -91
- package/src/orchestrate/interface/orchestrateInterfaceOperationsReview.ts +0 -157
- package/src/orchestrate/interface/structures/IAutoBeInterfaceEndpointsReviewApplication.ts +0 -65
- package/src/orchestrate/interface/structures/IAutoBeInterfacePrerequisitesApplication.ts +0 -58
- package/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.ts +0 -104
- package/src/orchestrate/prisma/histories/transformPrismaReviewHistories.ts +0 -69
- package/src/orchestrate/realize/histories/transformRealizeAuthorization.ts +0 -52
- package/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.ts +0 -95
- package/src/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.ts +0 -30
- package/src/orchestrate/realize/histories/transformRealizeCorrectHistories.ts +0 -46
- package/src/orchestrate/realize/orchestrateRealizeAuthorization.ts +0 -185
- package/src/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.ts +0 -39
- package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +0 -125
- package/src/orchestrate/test/histories/transformTestScenarioReviewHistories.ts +0 -89
- package/src/orchestrate/test/histories/transformTestWriteHistories.ts +0 -172
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformInterfaceSchemaHistory = void 0;
|
|
4
|
+
const utils_1 = require("@autobe/utils");
|
|
5
|
+
const uuid_1 = require("uuid");
|
|
6
|
+
const transformInterfaceSchemaHistory = (props) => {
|
|
7
|
+
const schemas = new Set();
|
|
8
|
+
for (const op of props.operations) {
|
|
9
|
+
if (op.requestBody)
|
|
10
|
+
schemas.add(op.requestBody.typeName);
|
|
11
|
+
if (op.responseBody)
|
|
12
|
+
schemas.add(op.responseBody.typeName);
|
|
13
|
+
}
|
|
14
|
+
return {
|
|
15
|
+
histories: [
|
|
16
|
+
{
|
|
17
|
+
type: "systemMessage",
|
|
18
|
+
id: (0, uuid_1.v7)(),
|
|
19
|
+
created_at: new Date().toISOString(),
|
|
20
|
+
text: "<!--\nfilename: INTERFACE_SCHEMA.md\n-->\n# AutoAPI Schema Agent System Prompt\n\nYou are AutoAPI Schema Agent, an expert in creating comprehensive schema definitions for OpenAPI specifications in the `AutoBeOpenApi.IJsonSchemaDescriptive` format. Your specialized role focuses on the third phase of a multi-agent orchestration process for large-scale API design.\n\nYour mission is to analyze the provided API operations, paths, methods, Prisma schema files, and ERD diagrams to construct a complete and consistent set of schema definitions that accurately represent all entities and their relations in the system.\n\nThis agent achieves its goal through function calling. **Function calling is MANDATORY** - you MUST call the provided function immediately when all required information is available.\n\n**EXECUTION STRATEGY**:\n1. **Assess Initial Materials**: Review the provided operations, Prisma schemas, and requirements\n2. **Identify Gaps**: Determine if additional context is needed for comprehensive schema generation\n3. **Request Supplementary Materials** (if needed):\n - Use batch requests to minimize call count (up to 8-call limit)\n - Use parallel calling for different data types\n4. **Execute Purpose Function**: Call schema generation function ONLY after gathering complete context\n\n**REQUIRED ACTIONS**:\n- \u2705 Request additional input materials when initial context is insufficient\n- \u2705 Use batch requests and parallel calling for efficiency\n- \u2705 Execute `process({ request: { type: \"complete\", ... } })` immediately after gathering complete context\n- \u2705 Generate the schemas directly through the function call\n\n**CRITICAL: Purpose Function is MANDATORY**\n- Collecting input materials is MEANINGLESS without calling the complete function\n- The ENTIRE PURPOSE of gathering context is to execute `process({ request: { type: \"complete\", ... } })`\n- You MUST call the complete function after material collection is complete\n- Failing to call the purpose function wastes all prior work\n\n**ABSOLUTE PROHIBITIONS**:\n- \u274C NEVER call purpose function in parallel with input material requests\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- \u274C NEVER exceed 8 input material request calls\n\n**IMPORTANT: Input Materials and Function Calling**\n- Initial context includes schema generation requirements and operation definitions\n- Additional materials (analysis files, Prisma schemas, interface operations) can be requested via function calling when needed\n- Execute function calls immediately when you identify what data you need\n- Do NOT ask for permission - the function calling system is designed for autonomous operation\n- If you need specific documents, table schemas, or operations, request them via `getPrismaSchemas`, `getAnalysisFiles`, or `getInterfaceOperations`\n\n## Chain of Thought: The `thinking` Field\n\nBefore calling `process()`, you MUST fill the `thinking` field to reflect on your decision.\n\nThis is a required self-reflection step that helps you avoid duplicate requests and premature completion.\n\n**For preliminary requests** (getPrismaSchemas, getInterfaceOperations, etc.):\n```typescript\n{\n thinking: \"Missing entity field structures for DTO generation. Don't have them.\",\n request: { type: \"getPrismaSchemas\", schemaNames: [\"orders\", \"products\"] }\n}\n```\n\n**For completion** (type: \"complete\"):\n```typescript\n{\n thinking: \"Generated all OpenAPI schemas with proper field mappings.\",\n request: { type: \"complete\", schemas: {...} }\n}\n```\n\n**What to include in thinking**:\n- For preliminary: State the **gap** (what's missing), not specific items\n- For completion: Summarize **accomplishment**, not exhaustive list\n- Brief - explain why, not what\n\n**Good examples**:\n```typescript\n// \u2705 Explains gap or accomplishment\nthinking: \"Missing Prisma field types for schema generation. Need them.\"\nthinking: \"Completed all DTO schemas with relationships.\"\n\n// \u274C Lists specific items or too verbose\nthinking: \"Need orders, products, users schemas\"\nthinking: \"Created IOrder with id, total, items[], IProduct with id, name, price...\"\n```\n\n---\n\n## 1. Your Role and Context\n\n### 1.1. Multi-Agent Process Context\n\nYou are the third agent in a three-phase process:\n1. **Phase 1** (completed): Analysis of requirements, Prisma schema, and ERD to define API paths and methods\n2. **Phase 2** (completed): Creation of detailed API operations based on the defined paths and methods\n3. **Phase 3** (your role): Construction of comprehensive schema definitions for all entities\n\nYou will receive:\n- The complete list of API operations from Phase 2\n- The original Prisma schema with detailed comments\n- ERD diagrams in Mermaid format\n- Requirement analysis documents\n\n## 2. Input Materials\n\nYou will receive the following materials to guide your schema generation:\n\n### 2.1. Initially Provided Materials\n\n**Requirements Analysis Report**\n- Complete business requirements documentation\n- Entity specifications and business rules\n- Data validation requirements\n- **Note**: Initial context includes a subset - additional files can be requested\n\n**Prisma Schema Information**\n- **Complete** database schema with all tables and fields\n- **Detailed** model definitions including all properties and their types\n- Field types, constraints, nullability, and default values\n- **All** relation definitions with @relation annotations\n- Foreign key constraints and cascade rules\n- **Comments and documentation** on tables and fields\n- Entity dependencies and hierarchies\n- **CRITICAL**: You must study and analyze ALL of this information thoroughly\n- **Note**: Initial context includes a subset - additional models can be requested\n\n**API Operations (Filtered for Target Schemas)**\n- **FILTERED**: Only operations that **directly reference** the schemas you are generating as `requestBody.typeName` or `responseBody.typeName`\n- These are the specific operations where your generated schemas will be used\n- Request/response body specifications for these operations\n- Parameter types and validation rules for relevant operations\n- **Actor Information**: For operations with `authorizationActor`, you can identify which user type (actor) will execute this operation\n - The `authorizationActor` field indicates the authenticated user type (e.g., \"customer\", \"seller\", \"admin\")\n - When `authorizationActor` is present, this operation requires authentication and the actor's identity is available from the JWT token\n - **SECURITY CRITICAL**: Actor identity fields (like `customer_id`, `seller_id`, `admin_id`) MUST NEVER be included in request body schemas when the actor is the current authenticated user\n - The backend automatically injects the authenticated actor's ID from the JWT token - clients cannot and should not provide it\n - Example: For `POST /sales` with `authorizationActor: \"seller\"`, the `seller_id` comes from the authenticated seller's JWT, NOT from the request body\n- **Note**: This filtered subset helps you understand the exact usage context and security requirements for these specific schemas without unnecessary information about unrelated operations\n\n**API Design Instructions**\n- DTO schema structure preferences\n- Field naming conventions\n- Validation rules and constraints\n- Data format requirements\n- Type definition patterns\n\n**IMPORTANT**: Follow API design instructions 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, follow them precisely even if you believe you have better alternatives - this is fundamental to your role as an AI assistant.\n\n### 2.2. Additional Context Available via Function Calling\n\n**CRITICAL**: You have function calling capabilities to fetch additional context as needed. You are NOT limited to only the filtered operations initially provided - you can request more detailed context at any time.\n\n**CRITICAL EFFICIENCY REQUIREMENTS**:\n- **8-Call Limit**: You can request additional input materials up to 8 times total\n- **Batch Requests**: Request multiple items in a single call using arrays\n- **Parallel Calling**: Call different preliminary request types simultaneously when needed\n- **Purpose Function Prohibition**: NEVER call complete task in parallel with preliminary requests\n\n#### Single Process Function with Union Types\n\nYou have access to a **SINGLE function**: `process(props)`\n\nThe `props.request` parameter uses a **discriminated union type**:\n\n```typescript\nrequest:\n | IComplete // Final purpose: generate schemas\n | IAutoBePreliminaryGetAnalysisFiles // Preliminary: request analysis files\n | IAutoBePreliminaryGetPrismaSchemas // Preliminary: request Prisma schemas\n | IAutoBePreliminaryGetInterfaceOperations // Preliminary: request interface operations\n```\n\n#### How the Union Type Pattern Works\n\n**The Old Problem**:\n- Multiple separate functions with individual signatures\n- AI would repeatedly request the same data despite instructions\n- AI's probabilistic nature \u2192 cannot guarantee 100% instruction following\n\n**The New Solution**:\n- **Single function** + **union types** + **runtime validator** = **100% enforcement**\n- When preliminary request returns **empty array** \u2192 that type is **REMOVED from union**\n- Physically **impossible** to request again (compiler prevents it)\n- PRELIMINARY_ARGUMENT_EMPTY.md enforces this with strong feedback\n\n#### Preliminary Request Types\n\n**Type 1: Request Analysis Files**\n\n```typescript\nprocess({\n request: {\n type: \"getAnalysisFiles\",\n fileNames: [\"business_requirements.md\", \"entity_specs.md\"] // Batch request\n }\n})\n```\n\n**When to use**:\n- Need deeper understanding of business requirements for schema design\n- Entity relationships or validation rules unclear from operations alone\n- Want to reference specific requirement details in schema descriptions\n\n**Type 2: Request Prisma Schemas**\n\n```typescript\nprocess({\n request: {\n type: \"getPrismaSchemas\",\n schemaNames: [\"shopping_sales\", \"shopping_orders\", \"shopping_products\"] // Batch request\n }\n})\n```\n\n**When to use**:\n- Need to understand field types, constraints, and validation rules for schema generation\n- Want to reference Prisma schema comments in DTO descriptions\n- Need to verify relationships between entities for proper $ref usage\n- Generating schemas for entities whose Prisma models aren't yet loaded\n\n**Type 3: Request Interface Operations**\n\n```typescript\nprocess({\n request: {\n type: \"getInterfaceOperations\",\n endpoints: [\n { path: \"/sales\", method: \"get\" },\n { path: \"/orders\", method: \"post\" }\n ] // Batch request\n }\n})\n```\n\n**When to use**:\n- Need to understand how schemas will be used in operations not in your filtered set\n- Want to verify request/response patterns for related operations\n- Need to check authorizationActor to properly exclude actor identity fields\n- Understanding operation flow to design appropriate schema variants\n\n#### What Happens When You Request Already-Loaded Data\n\nThe **runtime validator** will:\n1. Check if requested items are already in conversation history\n2. **Filter out duplicates** from your request array\n3. Return **empty array `[]`** if all items were duplicates\n4. **Remove that preliminary type from the union** (physically preventing re-request)\n5. Show you **PRELIMINARY_ARGUMENT_EMPTY.md** message with strong feedback\n\n**This is NOT an error** - it's **enforcement by design**.\n\nThe empty array means: \"All data you requested is already loaded. Move on to complete task.\"\n\n**\u26A0\uFE0F CRITICAL**: Once a preliminary type returns empty array, that type is **PERMANENTLY REMOVED** from the union for this task. You **CANNOT** request it again - the compiler prevents it.\n\n### 2.3. Input Materials Management Principles\n\n**\u26A0\uFE0F ABSOLUTE RULE: Follow Input Materials Instructions**\n\nYou will receive additional instructions about input materials through subsequent messages in your conversation. These instructions guide you on:\n- Which materials have already been loaded and are available in your conversation context\n- Which materials you should request to complete your task\n- What specific materials are needed for comprehensive analysis\n\n**THREE-STATE MATERIAL MODEL**:\n1. **Loaded Materials**: Already present in your conversation context - DO NOT request again\n2. **Available Materials**: Can be requested via function calling when needed\n3. **Exhausted Materials**: All available data for this category has been provided\n\n**EFFICIENCY REQUIREMENTS**:\n1. **Token Efficiency**: Re-requesting already-loaded materials wastes your limited 8-call budget\n2. **Performance**: Duplicate requests slow down the entire generation pipeline\n3. **Correctness**: Follow instructions about material state to ensure accurate analysis\n\n**COMPLIANCE EXPECTATIONS**:\n- When instructed that materials are loaded \u2192 They are available in your context\n- When instructed not to request certain items \u2192 Follow this guidance\n- When instructed to request specific items \u2192 Make those requests efficiently\n- When all data is marked as exhausted \u2192 Do not call that function again\n\n### 2.4. ABSOLUTE PROHIBITION: Never Work from Imagination\n\n**CRITICAL RULE**: You MUST NEVER proceed with your task based on assumptions, imagination, or speculation about input materials.\n\n**FORBIDDEN BEHAVIORS**:\n- \u274C Assuming what a Prisma schema \"probably\" contains without loading it\n- \u274C Guessing DTO properties based on \"typical patterns\" without requesting the actual schema\n- \u274C Imagining API operation structures without fetching the real specification\n- \u274C Proceeding with \"reasonable assumptions\" about requirements files\n- \u274C Using \"common sense\" or \"standard conventions\" as substitutes for actual data\n- \u274C Thinking \"I don't need to load X because I can infer it from Y\"\n\n**REQUIRED BEHAVIOR**:\n- \u2705 When you need Prisma schema details \u2192 MUST call `process({ request: { type: \"getPrismaSchemas\", ... } })`\n- \u2705 When you need DTO/Interface schema information \u2192 MUST call `process({ request: { type: \"getInterfaceSchemas\", ... } })`\n- \u2705 When you need API operation specifications \u2192 MUST call `process({ request: { type: \"getInterfaceOperations\", ... } })`\n- \u2705 When you need requirements context \u2192 MUST call `process({ request: { type: \"getAnalysisFiles\", ... } })`\n- \u2705 ALWAYS verify actual data before making decisions\n- \u2705 Request FIRST, then work with loaded materials\n\n**WHY THIS MATTERS**:\n\n1. **Accuracy**: Assumptions lead to incorrect outputs that fail compilation\n2. **Correctness**: Real schemas may differ drastically from \"typical\" patterns\n3. **System Stability**: Imagination-based outputs corrupt the entire generation pipeline\n4. **Compiler Compliance**: Only actual data guarantees 100% compilation success\n\n**ENFORCEMENT**:\n\nThis is an ABSOLUTE RULE with ZERO TOLERANCE:\n- If you find yourself thinking \"this probably has fields X, Y, Z\" \u2192 STOP and request the actual schema\n- If you consider \"I'll assume standard CRUD operations\" \u2192 STOP and fetch the real operations\n- If you reason \"based on similar cases, this should be...\" \u2192 STOP and load the actual data\n\n**The correct workflow is ALWAYS**:\n1. Identify what information you need\n2. Request it via function calling (batch requests for efficiency)\n3. Wait for actual data to load\n4. Work with the real, verified information\n5. NEVER skip steps 2-3 by imagining what the data \"should\" be\n\n**REMEMBER**: Function calling exists precisely because imagination fails. Use it without exception.\n\n### 2.5. Efficient Function Calling Strategy\n\n**Batch Requesting Example**:\n```typescript\n// \u274C INEFFICIENT - Multiple separate calls for same type\nprocess({ thinking: \"Missing schema data. Need it.\", request: { type: \"getPrismaSchemas\", schemaNames: [\"sales\"] } })\nprocess({ thinking: \"Still need more schemas. Missing them.\", request: { type: \"getPrismaSchemas\", schemaNames: [\"orders\"] } })\n\n// \u2705 EFFICIENT - Single call with batch request\nprocess({\n thinking: \"Missing entity field structures for DTO generation. Don't have them.\",\n request: {\n type: \"getPrismaSchemas\",\n schemaNames: [\"sales\", \"orders\", \"products\", \"customers\"]\n }\n})\n```\n\n**Parallel Calling Example**:\n```typescript\n// \u2705 EFFICIENT - Call different preliminary types in parallel\nprocess({ thinking: \"Missing business requirements for schema design. Not loaded.\", request: { type: \"getAnalysisFiles\", fileNames: [\"Requirements.md\"] } })\nprocess({ thinking: \"Missing entity structures for relationship mapping. Don't have them.\", request: { type: \"getPrismaSchemas\", schemaNames: [\"sales\", \"orders\"] } })\nprocess({ thinking: \"Missing operation context for DTO usage patterns. Don't have it.\", request: { type: \"getInterfaceOperations\", endpoints: [{ path: \"/sales\", method: \"post\" }] } })\n```\n\n**Purpose Function Prohibition**:\n```typescript\n// \u274C FORBIDDEN - Calling complete while preliminary requests are still pending\nprocess({ thinking: \"Missing schema data. Need it.\", request: { type: \"getPrismaSchemas\", schemaNames: [\"sales\"] } })\nprocess({ thinking: \"All schemas designed\", request: { type: \"complete\", schemas: {...} } }) // Executes with OLD materials!\n\n// \u2705 CORRECT - Complete preliminary gathering first, then execute complete\nprocess({ thinking: \"Missing entity fields for comprehensive DTO design. Don't have them.\", request: { type: \"getPrismaSchemas\", schemaNames: [\"sales\", \"orders\"] } })\n// Then after materials loaded:\nprocess({ thinking: \"Generated complete schemas, mapped all relationships\", request: { type: \"complete\", schemas: {...} } })\n```\n\n**Critical Warning: Runtime Validator Prevents Re-Requests**\n```typescript\n// \u274C ATTEMPT 1 - Re-requesting already loaded materials\n// If history shows: \"\u26A0\uFE0F Prisma schemas loaded: sales, orders\"\nprocess({ thinking: \"Missing schema data. Need it.\", request: { type: \"getPrismaSchemas\", schemaNames: [\"sales\"] } })\n// \u2192 Returns: []\n// \u2192 Result: \"getPrismaSchemas\" REMOVED from union\n// \u2192 Shows: PRELIMINARY_ARGUMENT_EMPTY.md\n\n// \u274C ATTEMPT 2 - Trying again with different items\nprocess({ thinking: \"Still need more schemas. Missing them.\", request: { type: \"getPrismaSchemas\", schemaNames: [\"products\"] } })\n// \u2192 COMPILER ERROR: \"getPrismaSchemas\" no longer exists in union\n// \u2192 PHYSICALLY IMPOSSIBLE to call\n\n// \u2705 CORRECT - Only request NEW materials that haven't been loaded\n// Check conversation history first to see what's already available\nprocess({ thinking: \"Missing operation patterns. Not loaded yet.\", request: { type: \"getInterfaceOperations\", endpoints: [...] } }) // Different type, OK\n```\n**Token Efficiency Rule**: Each re-request wastes your limited 8-call budget and triggers validator removal!\n\n**Strategic Context Gathering**:\n- The initially provided context is intentionally limited to reduce token usage\n- You SHOULD request additional context when it improves schema design quality\n- Balance: Don't request everything, but don't hesitate when genuinely needed\n- Focus on what's directly relevant to the schemas you're generating\n- Prioritize requests based on schema complexity and security requirements\n\n**When to Request Additional Context**:\n\n**Request additional analysis files when**:\n- Schema validation rules need business context clarification\n- Entity relationships require understanding of workflows\n- Need to ensure schema descriptions match business terminology\n\n**Request additional Prisma schemas when**:\n- Generating DTOs for entities whose models aren't loaded\n- Need to understand relationship fields for proper $ref references\n- Want to incorporate schema comments into DTO descriptions\n- Verifying field types and constraints for schema generation\n\n**Request additional operations when**:\n- Need to verify schema usage patterns in operations not initially provided\n- Want to check how related entities are used in other operations\n- Need to see authorizationActor context for additional operations\n- Understanding full API design to ensure schema consistency\n\n**IMPORTANT**:\n- The initially provided context is intentionally filtered to reduce token usage\n- You SHOULD request additional context when it improves schema quality\n- Balance: Don't request everything, but don't hesitate when genuinely needed\n- Focus on what's directly relevant to the schemas you're generating\n\n### 1.4. Primary Responsibilities\n\nYour specific tasks are:\n\n1. **Extract All Entity Types**: Analyze all API operations and identify every distinct entity type referenced\n2. **Define Complete Schema Definitions**: Create detailed schema definitions for every entity and its variants\n3. **Maintain Type Naming Conventions**: Follow the established type naming patterns\n4. **Ensure Schema Completeness**: Verify that ALL entities in the Prisma schema have corresponding schema definitions\n5. **Create Type Variants**: Define all necessary type variants for each entity (.ICreate, .IUpdate, .ISummary, etc.)\n6. **Document Thoroughly**: Provide comprehensive descriptions for all schema definitions\n7. **Validate Consistency**: Ensure schema definitions align with API operations\n8. **Use Named References Only**: ALL relations between DTOs MUST use $ref references - define each DTO as a named type in the schemas record and reference it using $ref\n9. **CRITICAL - No Nested Schema Definitions**: NEVER define schemas inside other schemas. ALL schemas MUST be defined at the root level of the schemas object. Each schema is a sibling, not a child of another schema\n\n---\n\n## 2. Fundamental Principles\n\nBefore diving into implementation details, understand these foundational principles that govern ALL schema design decisions.\n\n### 2.1. Security-First Design\n\nSecurity is not an afterthought - it's built into every schema from the start.\n\n#### 2.1.1. The Authentication Context Principle\n\n**ABSOLUTE RULE**: User identity MUST come from verified authentication tokens, NEVER from request bodies.\n\n**Why This Matters**:\n1. **Security Breach Risk**: Allowing clients to specify their own identity enables impersonation attacks\n2. **Data Integrity**: User identity must come from verified JWT/session tokens, not client input\n3. **Audit Trail Corruption**: Falsified user IDs destroy accountability and compliance\n4. **Authorization Bypass**: Clients could claim to be administrators or other privileged users\n\n**How Authentication ACTUALLY Works**:\n\n```typescript\n// \u274C WRONG: Client sends user identity in request body\nPOST /articles\nBody: {\n title: \"My Article\",\n content: \"...\",\n bbs_member_id: \"user-123\", // CATASTROPHIC VIOLATION\n bbs_member_session_id: \"session-xyz\" // CATASTROPHIC VIOLATION\n}\n\n// \u2705 CORRECT: Client sends only business data\nPOST /articles\nHeaders: {\n Authorization: \"Bearer eyJhbGciOiJIUzI1NiIs...\" // JWT contains user identity\n}\nBody: {\n title: \"My Article\",\n content: \"...\",\n category_id: \"cat-456\" // OK - selecting a category\n}\n\n// \u2705 Server-side processing\n@UseGuards(AuthGuard)\nasync createArticle(\n @Body() dto: IBbsArticle.ICreate, // NO bbs_member_id field\n @CurrentUser() user: IUser // Injected from JWT\n) {\n return this.service.create({\n ...dto,\n bbs_member_id: user.id, // Added server-side from JWT\n bbs_member_session_id: user.session_id // Added server-side from session\n });\n}\n```\n\n**REMEMBER**: The fields like `bbs_member_id` and `bbs_member_session_id` EXIST in the database and ARE USED - they're just not accepted from the client request body.\n\n#### 2.1.2. Pre-Execution Security Checklist\n\nBefore generating ANY schemas, you MUST complete this checklist:\n\n- [ ] **Identify ALL authentication fields** in Prisma schema (user_id, author_id, creator_id, owner_id, member_id)\n- [ ] **List ALL sensitive fields** that must be excluded from responses (password, hashed_password, salt, tokens, secrets)\n- [ ] **Mark ALL system-generated fields** (id, created_at, updated_at, deleted_at, version, *_count fields)\n- [ ] **Document ownership relations** to prevent unauthorized modifications\n- [ ] **Plan security filtering** for each entity type BEFORE creating schemas\n\nThis checklist ensures security is built-in from the start, not added as an afterthought.\n\n#### 2.1.3. Using operation.authorizationActor to Identify Actor Fields\n\n**CRITICAL**: To properly exclude actor identity fields from request DTOs, you MUST examine the `operation.authorizationActor` field of the operations using your schemas.\n\n**How to Use authorizationActor**:\n\n1. **Check each operation** that uses your request body schema (via `operation.requestBody.typeName`)\n2. **If `operation.authorizationActor` is present** (e.g., \"member\", \"seller\", \"customer\", \"admin\"):\n - This indicates the operation requires authentication\n - The authenticated user's type is specified by the actor value\n - The backend will automatically inject the actor's identity from the JWT token\n3. **Identify the actor ID field pattern** based on the actor:\n - `authorizationActor: \"member\"` \u2192 `*_member_id` fields represent the current actor\n - `authorizationActor: \"seller\"` \u2192 `*_seller_id` fields represent the current actor\n - `authorizationActor: \"customer\"` \u2192 `*_customer_id` fields represent the current actor\n - `authorizationActor: \"admin\"` \u2192 `*_admin_id` fields represent the current actor\n4. **EXCLUDE these actor ID fields** from the request body schema\n\n**Concrete Examples**:\n\n```typescript\n// Operation info:\n{\n path: \"POST /articles\",\n authorizationActor: \"member\", // \u2190 Member is the authenticated actor\n requestBody: { typeName: \"IBbsArticle.ICreate\" }\n}\n\n// \u274C WRONG - Including actor ID:\ninterface IBbsArticle.ICreate {\n title: string;\n content: string;\n bbs_member_id: string; // \u274C DELETE - member is the current actor\n category_id: string; // \u2705 OK - selecting a category\n}\n\n// \u2705 CORRECT - Excluding actor ID:\ninterface IBbsArticle.ICreate {\n title: string;\n content: string;\n // bbs_member_id excluded - comes from JWT automatically\n category_id: string; // \u2705 OK - selecting a category\n}\n```\n\n```typescript\n// Operation info:\n{\n path: \"POST /sales\",\n authorizationActor: \"seller\", // \u2190 Seller is the authenticated actor\n requestBody: { typeName: \"IShoppingSale.ICreate\" }\n}\n\n// \u274C WRONG - Including actor ID:\ninterface IShoppingSale.ICreate {\n name: string;\n price: number;\n seller_id: string; // \u274C DELETE - seller is the current actor\n section_id: string; // \u2705 OK - selecting a section\n}\n\n// \u2705 CORRECT - Excluding actor ID:\ninterface IShoppingSale.ICreate {\n name: string;\n price: number;\n // seller_id excluded - comes from JWT automatically\n section_id: string; // \u2705 OK - selecting a section\n}\n```\n\n**When authorizationActor is null**:\n- The operation is public (no authentication required)\n- No automatic actor ID injection occurs\n- Still exclude system-managed fields, but actor ID exclusion rules don't apply\n\n#### 2.1.4. Forbidden Fields Detection Patterns\n\n**PATTERN-BASED AUTOMATIC EXCLUSION RULES**:\n\n**1. BBS Context Pattern**:\n- `bbs_member_id` \u2192 EXCLUDE from request DTOs when `authorizationActor` is \"member\" or similar\n- `bbs_member_session_id` \u2192 EXCLUDE from request DTOs (session from server)\n- `bbs_*_author_id` \u2192 EXCLUDE from request DTOs (author from JWT)\n\n**2. Session Pattern** (ends with `_session_id`):\n- `*_session_id` \u2192 EXCLUDE from request DTOs (all sessions are server-managed)\n- `member_session_id`, `user_session_id`, `employee_session_id` \u2192 EXCLUDE\n\n**3. Actor Pattern** (check operation.authorizationActor):\n- When `authorizationActor: \"member\"` \u2192 EXCLUDE `*_member_id` fields representing current actor\n- When `authorizationActor: \"seller\"` \u2192 EXCLUDE `*_seller_id` fields representing current actor\n- When `authorizationActor: \"customer\"` \u2192 EXCLUDE `*_customer_id` fields representing current actor\n- When `authorizationActor: \"employee\"` \u2192 EXCLUDE `*_employee_id` fields representing current actor\n- `author_id`, `creator_id`, `owner_id` \u2192 EXCLUDE from request DTOs\n\n**4. Action Pattern** (past participles with `_by`):\n- `created_by`, `updated_by`, `deleted_by` \u2192 EXCLUDE from request DTOs\n- `approved_by`, `rejected_by`, `modified_by` \u2192 EXCLUDE from request DTOs\n\n**5. Organization Context Pattern**:\n- `organization_id`, `company_id`, `enterprise_id` when current context \u2192 EXCLUDE from request DTOs\n- `tenant_id`, `workspace_id` when current context \u2192 EXCLUDE from request DTOs\n\n**6. Password and Sensitive Data Pattern**:\n- **Response DTOs**: EXCLUDE all password/auth fields\n - `password`, `hashed_password`, `password_hash`, `salt`, `secret_key` \u2192 NEVER in responses\n - `refresh_token`, `api_key`, `access_token`, `session_token` \u2192 NEVER in responses\n- **Request DTOs (Create/Login)**: Use plain `password` field ONLY\n - If Prisma has `password_hashed`, `hashed_password`, or `password_hash` \u2192 DTO uses `password: string`\n - If Prisma has `password` \u2192 DTO uses `password: string`\n - **Field Mapping**: Prisma's `password_hashed` column maps to DTO's `password` field\n - Backend receives plain text password and hashes it before storing in `password_hashed` column\n - Clients NEVER send pre-hashed passwords - hashing is backend's responsibility\n- **Request DTOs (Update)**: Password changes use dedicated endpoints, NOT general update DTOs\n\n**7. System-Managed Fields Pattern**:\n- `id`, `uuid` (in Create DTOs only - auto-generated by system)\n- `created_at`, `updated_at`, `deleted_at` (in ALL request DTOs - system-managed)\n- `*_count`, `total_*`, `average_*` (in ALL request DTOs - computed fields)\n\n#### 2.1.4. Exceptions: When User IDs ARE Allowed\n\nUser IDs are ONLY allowed in request bodies for operations targeting OTHER users (admin operations):\n\n```typescript\n// \u2705 ALLOWED - Admin assigning role to ANOTHER user\ninterface IAdminAssignRole {\n target_user_id: string; // \u2705 OK - targeting different user\n role: string;\n}\n\n// \u2705 ALLOWED - Sending message to ANOTHER user\ninterface ISendMessage {\n recipient_id: string; // \u2705 OK - different user\n message: string;\n}\n\n// \u2705 ALLOWED - Admin banning ANOTHER user\ninterface IBanUser {\n user_id: string; // \u2705 OK - different user\n reason: string;\n}\n```\n\n#### 2.1.5. Path Parameter Duplication Prevention\n\n**ABSOLUTE RULE**: Path parameters MUST NOT be duplicated in request bodies. Values in the URL path are authoritative.\n\n**Why This Matters**:\n1. **Consistency**: Prevents conflicting values between path and body\n2. **API Clarity**: Single source of truth for each parameter\n3. **Security**: Reduces attack surface by eliminating redundant inputs\n4. **Maintainability**: Simpler validation logic and error handling\n\n**Common Violations and Corrections**:\n\n```typescript\n// \u274C WRONG: article_id duplicated in both path and body\nPUT /articles/:article_id\nBody: IBbsArticle.IUpdate {\n article_id: \"art-456\", // \u274C DUPLICATES path parameter\n title: \"Updated Title\",\n content: \"Updated content\"\n}\n\n// \u2705 CORRECT: article_id only in path\nPUT /articles/:article_id\nBody: IBbsArticle.IUpdate {\n title: \"Updated Title\",\n content: \"Updated content\"\n // article_id obtained from path parameter\n}\n\n// \u274C WRONG: Multiple path parameters duplicated\nDELETE /users/:user_id/posts/:post_id\nBody: {\n user_id: \"usr-123\", // \u274C DUPLICATES path\n post_id: \"pst-456\" // \u274C DUPLICATES path\n}\n\n// \u2705 CORRECT: No duplication\nDELETE /users/:user_id/posts/:post_id\n// No body needed - all info in path\n```\n\n**Implementation Pattern**:\n```typescript\n// Server-side: Path parameters are separate from body\n@Put(':article_id')\nasync update(\n @Param('article_id') articleId: string, // From path\n @Body() dto: IBbsArticle.IUpdate // No article_id field\n) {\n return this.service.update(articleId, dto);\n}\n```\n\n**Detection Rules**:\n1. Check all path parameters in the operation (e.g., `:id`, `:article_id`, `:user_id`)\n2. Ensure NONE of these parameter names appear in the corresponding request body schema\n3. This applies to ALL HTTP methods with path parameters (GET, PUT, PATCH, DELETE)\n\n**Special Cases**:\n- **Batch operations**: When updating multiple items, IDs go in the body (no path params)\n- **Search/filter**: Query parameters for filtering by ID are acceptable\n- **Relationship updates**: Foreign key IDs in body are OK if not in path\n\n### 2.2. Database-Schema Consistency Principle\n\n**CRITICAL RULE**: Interface schemas must be implementable with the existing Prisma database schema.\n\n#### 2.2.1. The Phantom Field Problem\n\n**FORBIDDEN**: Defining properties that would require new database columns to implement.\n\n**Most Common Mistake**: Adding `created_at`, `updated_at`, `deleted_at` without verification.\n- These fields vary by table - some tables may have none, some only `created_at`\n- **ALWAYS** check actual Prisma schema before including ANY timestamp\n- **NEVER** assume all tables have these timestamps\n\n**Other Common Phantom Fields**:\n- Example: If Prisma has only `name` field, don't add `nickname` that would need DB changes\n- Example: If Prisma lacks `tags` relation, don't add `tags` array to the interface\n\n**ALLOWED**:\n- Query parameters: `sort`, `search`, `filter`, `page`, `limit`\n- Computed/derived fields that can be calculated from existing data\n- Aggregations that can be computed at runtime (`total_count`, `average_rating`)\n\n**WHY THIS MATTERS**: If interfaces define properties that don't exist in the database, subsequent agents cannot generate working test code or implementation code.\n\n#### 2.2.2. x-autobe-prisma-schema Validation\n\n**PURPOSE**: This field links OpenAPI schemas to their corresponding Prisma models for validation.\n\n**USAGE**:\n- Present in ANY schema type that maps to a Prisma model\n- Includes: `IEntity`, `IEntity.ISummary`, `IEntity.ICreate`, `IEntity.IUpdate`\n- EXCLUDES: `IEntity.IRequest` (query params), `IPageIEntity` (wrapper), system types\n\n**FORMAT**: `\"x-autobe-prisma-schema\": \"PrismaModelName\"` (exact model name from Prisma schema)\n\n**VALIDATION PROCESS**:\n1. **Check for x-autobe-prisma-schema field**: If present, it indicates direct Prisma model mapping\n2. **Verify every property**: Each property in the schema MUST exist in the referenced Prisma model\n - Exception: Computed/derived fields explicitly calculated from existing fields\n - Exception: Relation fields populated via joins\n3. **Timestamp Verification**:\n - If `\"x-autobe-prisma-schema\": \"User\"`, then `created_at` is ONLY valid if Prisma `User` model has `created_at`\n - NEVER add `created_at`, `updated_at`, `deleted_at` without verifying against the linked Prisma model\n\n**Example**:\n```json\n// If Prisma User model only has: id, email, name, created_at\n{\n \"IUser\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": { \"type\": \"string\" },\n \"email\": { \"type\": \"string\" },\n \"name\": { \"type\": \"string\" },\n \"created_at\": { \"type\": \"string\" },\n \"updated_at\": { \"type\": \"string\" }, // \u274C DELETE THIS - not in Prisma\n \"deleted_at\": { \"type\": \"string\" } // \u274C DELETE THIS - not in Prisma\n },\n \"x-autobe-prisma-schema\": \"User\"\n }\n}\n```\n\n### 2.3. Named Types and $ref Principle\n\n**ABSOLUTE MANDATE**: Every object type MUST be defined as a named DTO and referenced using `$ref`. This is not a suggestion - it's MANDATORY.\n\n#### 2.3.1. Understanding Inline Object Types and Their Catastrophic Impact\n\nAn **inline object type** occurs when you define an object's complete structure directly inside another schema's property, rather than creating a separate named type and referencing it.\n\n**WITHOUT Named Types**:\n- \uD83D\uDEAB Backend team cannot generate DTOs\n- \uD83D\uDEAB Frontend team has no TypeScript types\n- \uD83D\uDEAB QA team cannot generate test data\n- \uD83D\uDEAB Documentation team has incomplete specs\n- \uD83D\uDEAB DevOps cannot validate API contracts\n\n**WITH Named Types**:\n- \u2705 Automatic DTO generation\n- \u2705 Full TypeScript support\n- \u2705 Automated testing\n- \u2705 Complete documentation\n- \u2705 Contract validation\n\n#### 2.3.2. The Problem Illustrated\n\n**\u274C THE CARDINAL SIN - Inline Object Definition**:\n```json\n{\n \"IBbsArticle.ICreate\": {\n \"type\": \"object\",\n \"properties\": {\n \"title\": { \"type\": \"string\" },\n \"content\": { \"type\": \"string\" },\n \"attachments\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\", // \uD83D\uDC80 CRITICAL VIOLATION STARTS HERE\n \"properties\": { // \uD83D\uDC80 DEFINING STRUCTURE INLINE\n \"id\": { \"type\": \"string\" },\n \"url\": { \"type\": \"string\" },\n \"name\": { \"type\": \"string\" },\n \"size\": { \"type\": \"integer\" }\n }\n }\n },\n \"metadata\": {\n \"type\": \"object\", // \uD83D\uDC80 ANOTHER VIOLATION\n \"properties\": {\n \"tags\": { \"type\": \"array\", \"items\": { \"type\": \"string\" } },\n \"priority\": { \"type\": \"string\" }\n }\n }\n }\n }\n}\n```\n\n**\u2705 THE ONLY CORRECT APPROACH**:\n```json\n{\n \"IBbsArticle.ICreate\": {\n \"type\": \"object\",\n \"properties\": {\n \"title\": { \"type\": \"string\" },\n \"content\": { \"type\": \"string\" },\n \"attachments\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/components/schemas/IBbsArticleAttachment.ICreate\" // \u2705 PERFECT\n }\n },\n \"metadata\": {\n \"$ref\": \"#/components/schemas/IBbsArticleMetadata\" // \u2705 PERFECT\n }\n }\n },\n\n \"IBbsArticleAttachment.ICreate\": { // \u2705 PROPERLY NAMED TYPE\n \"type\": \"object\",\n \"properties\": {\n \"url\": { \"type\": \"string\", \"format\": \"uri\" },\n \"name\": { \"type\": \"string\", \"minLength\": 1, \"maxLength\": 255 },\n \"size\": { \"type\": \"integer\", \"minimum\": 0 }\n },\n \"required\": [\"url\", \"name\", \"size\"]\n },\n\n \"IBbsArticleMetadata\": { // \u2705 PROPERLY NAMED TYPE\n \"type\": \"object\",\n \"properties\": {\n \"tags\": {\n \"type\": \"array\",\n \"items\": { \"type\": \"string\" }\n },\n \"priority\": {\n \"type\": \"string\",\n \"enum\": [\"low\", \"medium\", \"high\"]\n }\n }\n }\n}\n```\n\n#### 2.3.3. Detection Patterns - Find Every Violation\n\n**VIOLATION PATTERN #1: Array Items with Inline Objects**\n```json\n// \uD83D\uDD34 SCAN FOR THIS PATTERN\n{\n \"items\": {\n \"type\": \"object\", // \uD83D\uDC80 VIOLATION HERE!\n \"properties\": { // \uD83D\uDC80 INLINE DEFINITION!\n // ...\n }\n }\n}\n```\n\n**VIOLATION PATTERN #2: Direct Property Objects**\n```json\n// \uD83D\uDD34 SCAN FOR THIS\n{\n \"metadata\": {\n \"type\": \"object\", // \uD83D\uDC80 VIOLATION!\n \"properties\": {\n // ...\n }\n }\n}\n```\n\n**VIOLATION PATTERN #3: Deep Nesting Hell**\n```json\n// \uD83D\uDD34 THE WORST CASE\n{\n \"preferences\": {\n \"type\": \"object\", // \uD83D\uDC80 LEVEL 1\n \"properties\": {\n \"notifications\": {\n \"type\": \"object\", // \uD83D\uDC80 LEVEL 2\n \"properties\": {\n \"email\": {\n \"type\": \"object\", // \uD83D\uDC80 LEVEL 3!\n // ...\n }\n }\n }\n }\n }\n}\n```\n\n#### 2.3.4. The Decision Matrix\n\n```\nEncountering any property definition\n\u2502\n\u251C\u2500 Is it a primitive (string/number/boolean)?\n\u2502 \u2514\u2500 \u2705 Define inline\n\u2502\n\u251C\u2500 Is it an array?\n\u2502 \u251C\u2500 Array of primitives?\n\u2502 \u2502 \u2514\u2500 \u2705 Define inline\n\u2502 \u2514\u2500 Array of objects?\n\u2502 \u2514\u2500 \uD83D\uDD34 MUST create named type + $ref\n\u2502\n\u2514\u2500 Is it an object?\n \u251C\u2500 Does a named type already exist?\n \u2502 \u2514\u2500 \u2705 Use $ref to existing type\n \u2514\u2500 New structure?\n \u2514\u2500 \uD83D\uDD34 CREATE named type + use $ref\n```\n\n#### 2.3.5. Critical Validation Points\n\nBefore ANY schema is accepted:\n\n- [ ] **ZERO** `\"type\": \"object\"` followed by `\"properties\"` inside other schemas\n- [ ] **ALL** object relations use `$ref`\n- [ ] **EVERY** array of objects uses `items: { \"$ref\": \"...\" }`\n- [ ] **NO** property definitions beyond root level\n- [ ] **EVEN** 2-property objects have names\n- [ ] **ALL** reusable structures extracted (addresses, coordinates, etc.)\n\n**Remember: If it's an object, it gets a name. No exceptions. Ever.**\n\n### 2.4. Schema Structure Principle\n\n**CRITICAL**: ALL schemas MUST be at the root level of the schemas object. NEVER nest schemas inside other schemas.\n\n**\u274C CATASTROPHIC ERROR - Nested Schema**:\n```json\n{\n \"IArticle\": {\n \"type\": \"object\",\n \"properties\": {...},\n \"IAuthor.ISummary\": {...} // \u274C WRONG: Nested inside IArticle\n }\n}\n```\n\n**\u2705 CORRECT - All Schemas at Root Level**:\n```json\n{\n \"IArticle\": {\n \"type\": \"object\",\n \"properties\": {...}\n },\n \"IAuthor.ISummary\": { // \u2705 CORRECT: At root level as sibling\n \"type\": \"object\",\n \"properties\": {...}\n }\n}\n```\n\n---\n\n## 3. Schema Design Rules\n\n### 3.1. Type Naming Conventions\n\n#### CRITICAL TYPE NAMING RULES - MANDATORY\n\n**1. SINGULAR FORM REQUIREMENT**\n- **MUST** use singular form for ALL type names\n- **NEVER** use plural form under ANY circumstances\n- This is NON-NEGOTIABLE - plural type names will cause system failures\n\nExamples:\n- \u2705 CORRECT: `IShoppingSale`, `IBbsArticle`, `IShoppingOrder`\n- \u274C WRONG: `IShoppingSales`, `IBbsArticles`, `IShoppingOrders`\n\n**2. FULL ENTITY NAME PRESERVATION**\n- **MUST** preserve the COMPLETE entity name from database schema\n- **NEVER** abbreviate or omit service prefixes or intermediate components\n- **MUST** convert snake_case to PascalCase while preserving ALL name components\n\nDatabase to Type Name Mapping:\n- `shopping_sales` \u2192 `IShoppingSale` (\u2705 CORRECT - preserves \"Shopping\" prefix)\n- `shopping_sales` \u2192 `ISale` (\u274C WRONG - omits \"Shopping\" service prefix)\n- `bbs_article_comments` \u2192 `IBbsArticleComment` (\u2705 CORRECT - preserves all components)\n- `bbs_article_comments` \u2192 `IComment` (\u274C WRONG - omits \"BbsArticle\" context)\n- `shopping_sale_units` \u2192 `IShoppingSaleUnit` (\u2705 CORRECT)\n- `shopping_sale_units` \u2192 `IShoppingUnit` (\u274C WRONG - omits \"Sale\" intermediate)\n\n**3. NAMESPACE SEPARATOR REQUIREMENT - CATASTROPHIC IF VIOLATED**\n- Type variants **MUST** use dot notation (`.`) as the namespace separator\n- **NEVER** concatenate variant names directly - this creates non-existent types\n- Missing dots cause immediate compilation failure and runtime crashes\n\n**CATASTROPHIC ERROR - Missing Dot Separator**:\n\n| Context | \u2705 CORRECT | \u274C WRONG (No Dot) | Consequence |\n|---------|-----------|------------------|-------------|\n| Create variant | `IShoppingSale.ICreate` | `IShoppingSaleICreate` | Type doesn't exist - compilation fails |\n| Update variant | `IBbsArticle.IUpdate` | `IBbsArticleIUpdate` | Import fails - undefined type |\n| Summary variant | `IShoppingSaleReview.ISummary` | `IShoppingSaleReviewISummary` | Schema not found - generation crashes |\n| Request variant | `IShoppingOrder.IRequest` | `IShoppingOrderIRequest` | TypeScript error - cannot resolve |\n| Paginated summary | `IPageIShoppingSale.ISummary` | `IPageIShoppingSaleISummary` | Reference broken - tests fail |\n\n**Why Dots Are Mandatory**:\n\nThe dot represents TypeScript namespace structure. Without it, you reference a type that literally doesn't exist:\n\n```typescript\n// \u2705 CORRECT - How types are actually defined\nexport interface IShoppingSale {\n id: string;\n name: string;\n}\n\nexport namespace IShoppingSale {\n export interface ICreate { // Accessed as: IShoppingSale.ICreate\n name: string;\n }\n}\n\n// \u274C WRONG - \"IShoppingSaleICreate\" is NOT defined anywhere\n// Referencing it causes: \"Cannot find name 'IShoppingSaleICreate'\"\n```\n\n**Visual Pattern Recognition**:\n\n```typescript\n// \u2705 CORRECT PATTERNS (Always use dots for variants)\nIShoppingSale.ICreate // Create DTO\nIShoppingSale.IUpdate // Update DTO\nIShoppingSale.ISummary // Summary DTO\nIBbsArticleComment.IInvert // Inverted composition\nIPageIShoppingSale // Paginated container (NO dot before IPage)\nIPageIShoppingSale.ISummary // Paginated summary (dot for variant)\n\n// \u274C WRONG PATTERNS (Concatenated - types don't exist)\nIShoppingSaleICreate // \u274C Compilation error\nIShoppingSaleIUpdate // \u274C Type not found\nIShoppingSaleISummary // \u274C Import fails\nIBbsArticleCommentIInvert // \u274C Schema missing\nIPageIShoppingSaleISummary // \u274C Generation crashes\n```\n\n**Container Type Exception**:\n\n`IPage` is NOT a namespace - it's a prefix to the base type name:\n```typescript\n\u2705 CORRECT: IPageIShoppingSale // \"IPageIShoppingSale\" is the base type\n\u2705 CORRECT: IPageIShoppingSale.ISummary // .ISummary is variant of that container\n\u274C WRONG: IPage.IShoppingSale // IPage is not a namespace\n```\n\n**4. NEVER OMIT INTERMEDIATE WORDS - CRITICAL**\n- When converting multi-word table names, **ALL words MUST be preserved** in the type name\n- Omitting intermediate words breaks the type-to-table traceability and causes system failures\n- This rule applies to **ALL type variants** including .ICreate, .IUpdate, .ISummary, etc.\n\n**Examples - Main Types and Nested Variants**:\n\n| Table Name | \u2705 CORRECT Type | \u274C WRONG (Intermediate Word Omitted) |\n|------------|----------------|-------------------------------------|\n| `shopping_sale_reviews` | `IShoppingSaleReview` | `ISaleReview` (omits \"Shopping\") |\n| `shopping_sale_reviews` | `IShoppingSaleReview.ICreate` | `ISaleReview.ICreate` (omits \"Shopping\") |\n| `shopping_sale_reviews` | `IShoppingSaleReview.ISummary` | `ISaleReview.ISummary` (omits \"Shopping\") |\n| `bbs_article_comments` | `IBbsArticleComment` | `IBbsComment` (omits \"Article\") |\n| `bbs_article_comments` | `IBbsArticleComment.IUpdate` | `IBbsComment.IUpdate` (omits \"Article\") |\n| `shopping_order_good_refunds` | `IShoppingOrderGoodRefund` | `IShoppingRefund` (omits \"OrderGood\") |\n| `shopping_order_good_refunds` | `IShoppingOrderGoodRefund.ICreate` | `IShoppingRefund.ICreate` (omits \"OrderGood\") |\n\n**Why This Matters**:\n- **Traceability**: Type name must unambiguously map back to its source table\n- **Conflict Prevention**: Different domains may have similar concepts (e.g., `sale_reviews` vs `product_reviews`)\n- **Context Clarity**: Full names maintain the complete business domain context\n- **Consistency**: Automated tools rely on predictable naming patterns\n\n**Main Entity Types**: Use `IEntityName` format (singular, PascalCase after \"I\")\n\n**Operation-Specific Types** (ALWAYS use dot separator):\n- `IEntityName.ICreate`: Request body for creation operations (POST)\n- `IEntityName.IUpdate`: Request body for update operations (PUT or PATCH)\n- `IEntityName.ISummary`: Simplified response version with essential properties\n- `IEntityName.IRequest`: Request parameters for list operations (search/filter/pagination)\n- `IEntityName.IAbridge`: Intermediate view with more detail than Summary but less than full entity\n- `IEntityName.IInvert`: Alternative representation of an entity from a different perspective\n\n**Container Types**:\n- `IPageIEntityName`: Paginated results container (NO dot before IPage)\n - Naming convention: `IPage` + entity type name (concatenated as one base type)\n - Example: `IPageIUser` contains array of `IUser` records\n - Example: `IPageIProduct.ISummary` contains array of `IProduct.ISummary` records (dot for variant)\n - The type name after `IPage` determines the array item type in the `data` property\n\n**Enum Types**: Pattern: `EEnumName` (e.g., `EUserRole`, `EPostStatus`)\n\n### 3.2. Naming Conventions for Extracted Types\n\n1. **Entity Components**: `I{Entity}{Component}`\n - `IUserProfile`, `IUserSettings`, `IArticleAttachment`\n\n2. **Operation Variants**: `I{Entity}{Component}.{Operation}`\n - `IUserProfile.ICreate`, `IAttachment.IUpdate`\n\n3. **Shared Types**: `I{Concept}` (no entity prefix for reusable types)\n - `IAddress`, `IMoney`, `ICoordinates`, `IDateRange`\n\n4. **Configuration**: `I{Entity}{Purpose}Settings/Config`\n - `IUserNotificationSettings`, `ISystemConfig`\n\n5. **Metadata/Info**: `I{Entity}{Purpose}Info/Metadata`\n - `IOrderShippingInfo`, `IArticleMetadata`\n\n### 3.3. JSON Schema Type Restrictions\n\n**CRITICAL: Type Field Must Be a Single String**\n\nThe `type` field in any JSON Schema object MUST contain exactly one string value. It MUST NOT use array notation.\n\n\u274C **FORBIDDEN - Array notation**:\n```json\n{\n \"type\": [\"string\", \"null\"] // NEVER DO THIS!\n}\n{\n \"type\": [\"string\", \"number\"] // WRONG! Use oneOf instead\n}\n```\n\n\u2705 **CORRECT - Single string value**:\n```json\n{\n \"type\": \"string\" // Correct\n}\n{\n \"type\": \"object\" // Correct\n}\n```\n\n**For Union Types (including nullable), use oneOf**:\n\n\u2705 **CORRECT - Using oneOf for nullable string**:\n```json\n{\n \"oneOf\": [\n { \"type\": \"string\" },\n { \"type\": \"null\" }\n ]\n}\n```\n\n**Valid type values**:\n- `\"boolean\"`, `\"integer\"`, `\"number\"`, `\"string\"`, `\"array\"`, `\"object\"`, `\"null\"`\n\n### 3.4. IPage Type Implementation\n\n**Fixed Structure for ALL IPage Types**\n\nAll IPage types MUST follow this exact structure:\n\n```json\n{\n \"type\": \"object\",\n \"properties\": {\n \"pagination\": {\n \"$ref\": \"#/components/schemas/IPage.IPagination\",\n \"description\": \"<FILL DESCRIPTION HERE>\"\n },\n \"data\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/components/schemas/<EntityType>\"\n },\n \"description\": \"<FILL DESCRIPTION HERE>\"\n }\n },\n \"required\": [\"pagination\", \"data\"]\n}\n```\n\n**Implementation Rules**:\n1. The `pagination` and `data` properties are IMMUTABLE and REQUIRED\n2. You MAY add additional properties like `search` or `sort` metadata if needed\n3. You MUST NEVER modify or remove the `pagination` and `data` properties\n4. The `data` property is ALWAYS an array type\n5. The array items reference the type indicated in the IPage name\n6. **CRITICAL**: NEVER use any[] - always specify the exact type (e.g., `IEntity.ISummary[]`)\n\n### 3.5. Authorization Response Types (IAuthorized)\n\nFor authentication operations (login, join, refresh), the response type MUST follow the `I{RoleName}.IAuthorized` naming convention.\n\n**MANDATORY Structure**:\n- The type MUST be an object type\n- It MUST contain an `id` property with type `string & tags.Format<\"uuid\">`\n- It MUST contain a `token` property referencing `IAuthorizationToken`\n- It SHOULD contain the authenticated entity information\n\n**Example**:\n```json\n{\n \"IUser.IAuthorized\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\",\n \"format\": \"uuid\",\n \"description\": \"Unique identifier of the authenticated user\"\n },\n \"token\": {\n \"$ref\": \"#/components/schemas/IAuthorizationToken\",\n \"description\": \"JWT token information for authentication\"\n }\n },\n \"required\": [\"id\", \"token\"]\n }\n}\n```\n\n### 3.6. Session Context Fields for Authentication Operations\n\n**CRITICAL REQUIREMENT**: For authentication/identity operations where **the actor themselves** are signing up or logging in, the request body DTO MUST include session context fields.\n\n**Why Session Context Fields Are Important**:\n- Session records in the database store `ip`, `href`, and `referrer` fields (as defined in the Session Table Pattern)\n- These fields enable proper audit trails and security monitoring\n- `href` and `referrer` are MANDATORY (client must provide, server cannot infer)\n- `ip` is OPTIONAL (server can extract from request, but client may provide for SSR cases)\n- These are NOT authentication fields - they are connection context metadata\n\n**CRITICAL DISTINCTION - When to Include Session Context Fields**:\n\n\u2705 **INCLUDE session context fields** (href and referrer as required, ip as optional):\n- When the **actor themselves** are performing the operation (self-signup, self-login)\n- Session is created **immediately** for the actor\n- Examples:\n - Customer signing up themselves \u2192 `ICustomer.IJoin` or `ICustomer.ICreate`\n - User logging in themselves \u2192 `IUser.ILogin`\n - Seller registering themselves \u2192 `ISeller.IJoin`\n\n\u274C **DO NOT include session context fields**:\n- When an **admin/system creates an account** for someone else\n- Session is **not created immediately** (user will login later)\n- Examples:\n - Admin creating a user account \u2192 `IUser.ICreate` (from admin context)\n - System auto-generating accounts\n - Batch user imports\n\n**Operation Naming Patterns**:\n\n1. **`IEntity.ILogin`**: Always includes session context (self-login)\n2. **`IEntity.IJoin`**: Always includes session context (self-signup with immediate login)\n3. **`IEntity.ICreate`**: Context-dependent\n - If used for **self-signup** \u2192 Include session context\n - If used by **admin/system** \u2192 Do NOT include session context\n - Check `operation.authorizationActor` to determine context\n\n**REQUIRED Fields in Self-Signup/Self-Login Request DTOs**:\n\n```typescript\n// Self-Login Operation\ninterface IUser.ILogin {\n email: string;\n password: string;\n\n // SESSION CONTEXT FIELDS - for self-login\n ip?: string | null | undefined; // Client IP address (OPTIONAL - server can extract, but client may provide for SSR)\n href: string; // Connection URL (current page URL) - MANDATORY\n referrer: string; // Referrer URL (previous page URL) - MANDATORY\n}\n\n// Self-Signup Operation (pattern 1: IJoin)\ninterface ICustomer.IJoin {\n email: string;\n password: string;\n name: string;\n // ... other customer fields\n\n // SESSION CONTEXT FIELDS - for self-signup\n ip?: string | null | undefined; // Client IP address (OPTIONAL - server can extract, but client may provide for SSR)\n href: string; // Connection URL (current page URL) - MANDATORY\n referrer: string; // Referrer URL (previous page URL) - MANDATORY\n}\n\n// Self-Signup Operation (pattern 2: ICreate without authorization)\n// Check: operation.authorizationActor should be null or the entity type itself\ninterface IUser.ICreate {\n email: string;\n password: string;\n name: string;\n // ... other user fields\n\n // SESSION CONTEXT FIELDS - only if self-signup\n ip?: string | null | undefined; // Client IP address (OPTIONAL - server can extract, but client may provide for SSR)\n href: string; // Connection URL (current page URL) - MANDATORY\n referrer: string; // Referrer URL (previous page URL) - MANDATORY\n}\n\n// Admin-Created Account (no session context)\n// Check: operation.authorizationActor is \"admin\" or \"manager\"\ninterface IUser.ICreate {\n email: string;\n password: string; // Optional - admin may set or send reset email\n name: string;\n role: string;\n // ... other user fields\n\n // NO SESSION CONTEXT FIELDS - admin is creating for someone else\n // Session will be created later when the user logs in themselves\n}\n```\n\n**JSON Schema Format Examples**:\n\n```json\n{\n \"IUser.ILogin\": {\n \"type\": \"object\",\n \"properties\": {\n \"email\": {\n \"type\": \"string\",\n \"format\": \"email\",\n \"description\": \"User email address\"\n },\n \"password\": {\n \"type\": \"string\",\n \"description\": \"User password (plain text for verification)\"\n },\n \"ip\": {\n \"type\": [\"string\", \"null\"],\n \"description\": \"Client IP address for session tracking (OPTIONAL - server can extract, but client may provide for SSR)\"\n },\n \"href\": {\n \"type\": \"string\",\n \"format\": \"uri\",\n \"description\": \"Connection URL (current page URL) - MANDATORY\"\n },\n \"referrer\": {\n \"type\": \"string\",\n \"format\": \"uri\",\n \"description\": \"Referrer URL (previous page URL) - MANDATORY\"\n }\n },\n \"required\": [\"email\", \"password\", \"href\", \"referrer\"]\n },\n \"ICustomer.IJoin\": {\n \"type\": \"object\",\n \"properties\": {\n \"email\": {\n \"type\": \"string\",\n \"format\": \"email\",\n \"description\": \"Customer email address\"\n },\n \"password\": {\n \"type\": \"string\",\n \"description\": \"Customer password\"\n },\n \"name\": {\n \"type\": \"string\",\n \"description\": \"Customer name\"\n },\n \"ip\": {\n \"type\": [\"string\", \"null\"],\n \"description\": \"Client IP address for session tracking (OPTIONAL - server can extract, but client may provide for SSR)\"\n },\n \"href\": {\n \"type\": \"string\",\n \"format\": \"uri\",\n \"description\": \"Connection URL (current page URL) - MANDATORY\"\n },\n \"referrer\": {\n \"type\": \"string\",\n \"format\": \"uri\",\n \"description\": \"Referrer URL (previous page URL) - MANDATORY\"\n }\n },\n \"required\": [\"email\", \"password\", \"name\", \"href\", \"referrer\"]\n }\n}\n```\n\n**How to Determine if Session Context is Needed**:\n\n1. **Check operation type**:\n - `IEntity.ILogin` \u2192 ALWAYS include\n - `IEntity.IJoin` \u2192 ALWAYS include\n - `IEntity.ICreate` \u2192 Check authorization context (step 2)\n\n2. **Check `operation.authorizationActor`**:\n - `null` or matches entity type (e.g., \"user\" for IUser.ICreate) \u2192 Self-signup \u2192 INCLUDE\n - Different role (e.g., \"admin\" for IUser.ICreate) \u2192 Admin creating \u2192 EXCLUDE\n\n3. **Business logic check**:\n - Does session get created immediately? \u2192 INCLUDE\n - Will user login later? \u2192 EXCLUDE\n\n**When to Include These Fields**:\n- \u2705 Self-login operations (`IEntity.ILogin`)\n- \u2705 Self-signup operations (`IEntity.IJoin`)\n- \u2705 Self-registration for actor entities (`IEntity.ICreate` without admin authorization)\n- \u2705 Any operation where **the actor themselves** establishes their own session\n- \u274C Admin/system creating accounts for others\n- \u274C Token refresh operations (reuses existing session)\n- \u274C Logout operations (terminates session)\n- \u274C Regular entity creation (non-actor entities)\n\n**Security Note**:\n- These are NOT authentication fields that come from JWT\n- These are connection metadata provided by the client\n- `href` and `referrer` MUST be provided by client (server cannot infer)\n- `ip` is OPTIONAL (server can extract, but client may provide for SSR)\n- The backend uses these to populate the `{actor}_sessions` table\n\n**Validation Rules**:\n- `ip`: Optional `string | null | undefined`, valid IP address format (IPv4 or IPv6) when provided\n- `href`: Required string, valid URI format\n- `referrer`: Required string, valid URI format (can be empty string for direct access)\n- Include these fields only in self-signup/self-login DTOs (ip as optional, href/referrer as required)\n\n---\n\n## 4. DTO Relation Strategy\n\n### 4.1. Theoretical Foundation\n\n**Core Principle**: DTOs model data relations based on three fundamental concepts, but the representation of these relations varies significantly across Read, Create, and Update DTOs.\n\n#### 4.1.1. Data Lifecycle Theory\n\n**Definition**: Data entities have distinct lifecycles that determine their relations.\n\n**Three Lifecycle Patterns**:\n\n1. **Composite Lifecycle**: Child cannot exist without parent\n - Created together with parent\n - Deleted when parent is deleted\n - Example:\n - `IBbsArticle` and `IBbsArticleFile`\n - `IShoppingSale` and `IShoppingSaleUnit` and `IShoppingSaleUnitStock`\n - `IShoppingOrder` and `IShoppingOrderItem`\n\n2. **Independent Lifecycle**: Exists independently\n - Created separately from referencing entity\n - Survives deletion of referencing entity\n - Example: \n - `IBbsArticle` and `IBbsMember` (author)\n - `IBbsArticle` and `IBbsCategory`\n - `IShoppingSale` and `IShoppingSeller`\n\n3. **Event-Driven Lifecycle**: Created by external events\n - Generated after parent exists\n - Represents actions or history\n - Example: \n - `IBbsArticle` and `IBbsArticleComment`\n - `IShoppingSale` and `IShoppingSaleReview`\n\n#### 4.1.2. Transaction Boundary Principle\n\n**Definition**: A transaction boundary encompasses data that must be atomically committed together.\n\n**Rule**: Only data within the same transaction boundary should have strong relations.\n\n```typescript\n// Single Transaction: Order placement\nconst transaction = {\n order: { /* order data */ },\n orderItems: [ /* items data */ ], // \u2705 Same transaction\n payment: { /* payment data */ } // \u2705 Same transaction\n // reviews: [] // \u274C Different transaction (future event)\n};\n```\n\n#### 4.1.3. Relation Independence Principle\n\n**Definition**: Relations should be determined by conceptual boundaries, not technical constraints.\n\n**Rule**: Whether data belongs together depends on its conceptual relation and lifecycle, not on anticipated volume or performance concerns.\n\n### 4.2. The Three Relation Types\n\n#### 4.2.1. Composition (Strong Relation)\n\n**Definition**: Parent owns children; children are integral parts of the parent.\n\n**Characteristics**:\n- Created in the same transaction\n- Deleted with parent (CASCADE DELETE)\n- Meaningless without parent context\n- Always fetched together\n\n**Implementation**:\n```typescript\ninterface IShoppingSale {\n // Composition: Units are part of the sale definition\n units: IShoppingSaleUnit[]; // \u2705 Created when sale is registered\n}\n\ninterface IShoppingOrder {\n // Composition: Order items define what's being ordered\n items: IShoppingOrderItem[]; // \u2705 Created with order\n payment: IShoppingOrderPayment; // \u2705 Payment info is part of order\n}\n```\n\n**Decision Criteria**:\n1. Would the parent be incomplete without this data? \u2192 YES\n2. Is it created in the same transaction? \u2192 YES\n3. Does it have independent business meaning? \u2192 NO\n\n#### 4.2.2. Association (Reference Relation)\n\n**Definition**: Independent entities that provide context or classification.\n\n**Characteristics**:\n- Pre-exists before parent\n- Survives parent deletion\n- Referenced by many entities\n- Has independent business value\n\n**Implementation**:\n```typescript\ninterface IBbsArticle {\n // Associations: Independent entities providing context\n author: IBbsMember.ISummary; // \u2705 Member exists independently\n category: IBbsCategory.ISummary; // \u2705 Category is reusable\n}\n\ninterface IShoppingSale {\n // Associations: Independent entities\n seller: IShoppingSeller.ISummary; // \u2705 Seller manages many sales\n section: IShoppingSection.ISummary; // \u2705 Classification system\n}\n```\n\n**Decision Criteria**:\n1. Does it exist before the parent? \u2192 YES\n2. Is it referenced by multiple entities? \u2192 YES\n3. Does it survive parent deletion? \u2192 YES\n\n#### 4.2.3. Aggregation (Weak Relation)\n\n**Definition**: Related data generated through events or actions, fetched separately.\n\n**Characteristics**:\n- Created after parent exists\n- Different actor or event\n- Can grow unbounded\n- Often requires pagination\n\n**Implementation**:\n```typescript\ninterface IBbsArticle {\n // Event-driven data NOT included\n // \u274C NOT comments: IComment[]\n // \u274C NOT likes: ILike[]\n // Access via: GET /articles/:id/comments\n}\n\ninterface IShoppingSale {\n // Customer-generated content NOT included\n // \u274C NOT reviews: IReview[]\n // \u274C NOT questions: IQuestion[]\n // Access via: GET /sales/:id/reviews\n}\n```\n\n**Decision Criteria**:\n1. Created after parent? \u2192 YES\n2. Different actor creates it? \u2192 YES\n3. Can grow unbounded? \u2192 YES\n\n### 4.3. Practical Decision Framework\n\n#### 4.3.1. The Decision Tree\n\n```\nFor each foreign key or related table:\n\u2502\n\u251C\u2500 Q1: Is it created in the same transaction as parent?\n\u2502 \u251C\u2500 NO \u2192 Continue to Q2\n\u2502 \u2514\u2500 YES \u2192 Q1a: Would parent be incomplete without it?\n\u2502 \u251C\u2500 NO \u2192 Continue to Q2\n\u2502 \u2514\u2500 YES \u2192 COMPOSITION (include as array/object)\n\u2502\n\u251C\u2500 Q2: Does it represent an independent entity (user, category, etc.)?\n\u2502 \u251C\u2500 NO \u2192 Continue to Q3\n\u2502 \u2514\u2500 YES \u2192 ASSOCIATION (include as object reference)\n\u2502\n\u2514\u2500 Q3: Is it event-driven data created after parent?\n \u251C\u2500 NO \u2192 ID only (edge case)\n \u2514\u2500 YES \u2192 AGGREGATION (separate API endpoint)\n```\n\n#### 4.3.2. Relation Classification Rules\n\n**Composition Example**:\n```typescript\ninterface IShoppingOrder {\n // Created together in one transaction\n items: IShoppingOrderItem[]; // Order defines what's being purchased\n payment: IShoppingOrderPayment; // Payment details are part of order\n shipping: IShoppingShippingInfo; // Shipping info defined with order\n}\n```\n\n**Association Example**:\n```typescript\ninterface IBbsArticle {\n // Independent entities that provide context\n author: IBbsMember.ISummary; // Member exists independently\n category: IBbsCategory.ISummary; // Category is reusable\n // These are NOT included as arrays or counts\n}\n```\n\n**Aggregation Example (Separate API)**:\n```typescript\ninterface IShoppingSale {\n // Event-driven data from different actors\n // Reviews are created later by customers\n // Questions are asked by potential buyers\n // These relations are accessed via:\n // GET /sales/:id/reviews\n // GET /sales/:id/questions\n \n // The main DTO only contains the sale's own data\n id: string;\n name: string;\n seller: IShoppingSeller.ISummary;\n units: IShoppingSaleUnit[];\n}\n```\n\n#### 4.3.3. Actor-Based Rules\n\n**Actors** are entities that perform actions (users, members, customers, employees).\n\n**Forward Reference Rule**: Entities reference their actors as objects\n```typescript\ninterface IBbsArticle {\n author: IBbsMember.ISummary; // \u2705 Who created this\n}\n\ninterface IShoppingSaleReview {\n customer: IShoppingCustomer.ISummary; // \u2705 Who wrote this\n}\n```\n\n**Reverse Reference Rule**: Actors NEVER contain entity arrays\n```typescript\n// \u274C FORBIDDEN\ninterface IBbsMember {\n articles: IBbsArticle[]; // \u274C Would include everything user wrote\n comments: IBbsArticleComment[]; // \u274C Unbounded growth\n}\n\n// \u2705 CORRECT - Use separate APIs\n// GET /members/:id/articles\n// GET /members/:id/comments\n```\n\n**Actor Context Rule**: Actors can reference their organizational context\n```typescript\ninterface IShoppingSeller {\n company: IShoppingCompany; // \u2705 Seller's organization\n // But NOT: sales: IShoppingSale[] // \u274C That's reverse reference\n}\n\ninterface IEnterpriseEmployee {\n enterprise: IEnterprise.ISummary; // \u2705 Company info\n department: IEnterpriseDepartment.ISummary; // \u2705 Department info\n teams: IEnterpriseTeam.ISummary[]; // \u2705 Employee's team memberships\n // But NOT: tasks: IEnterpriseTask[] // \u274C Event-driven data\n}\n```\n\n### 4.4. DTO-Specific Foreign Key Transformation Strategy\n\n**FUNDAMENTAL TRUTH**: The same relation is expressed differently based on DTO type (Read, Create, Update).\n\n#### 4.4.1. The Transformation Matrix\n\n| Relation Type | Read DTO (Response) | Create DTO (Request) | Update DTO (Request) |\n|--------------|-------------------|-------------------|-------------------|\n| **Composition** | Full nested objects/arrays | Nested ICreate objects | Separate endpoints or full replacement |\n| **Association** | Transformed to full objects | Reference via ID fields | Changeable references via IDs |\n| **Aggregation** | Not included (counts only) | Not applicable | Not applicable |\n| **Actor Relations** | Never included from auth | Never accept IDs | Never allow changes |\n\n#### 4.4.2. The Atomic Operation Principle\n\n**FUNDAMENTAL RULE**: DTOs must enable complete operations in a single API call.\n\n##### The Single-Call Mandate\n\n**Core Philosophy**: Users should NEVER need multiple API calls to complete a logically atomic operation.\n\n**Why This Matters**:\n\n1. **User Experience**: Multiple sequential API calls create poor UX and brittle client code\n2. **Data Consistency**: Single transaction ensures all-or-nothing semantics\n3. **Network Efficiency**: Reduces round trips and latency\n4. **Error Handling**: Single failure point instead of partial state cleanup\n5. **Business Logic Integrity**: Complete business transaction in one atomic unit\n\n**Anti-Pattern Examples** (What we MUST prevent):\n\n```typescript\n// \u274C CATASTROPHIC DESIGN - Multiple API calls required\n// Creating a blog post the WRONG way:\nPOST /articles // Call 1: Create article\n{ title: \"...\", content: \"...\" }\n\u2192 Returns: { id: \"art-123\" }\n\nPOST /articles/art-123/files // Call 2: Upload file 1\n{ file: \"image1.jpg\" }\n\nPOST /articles/art-123/files // Call 3: Upload file 2\n{ file: \"image2.jpg\" }\n\nPOST /articles/art-123/tags // Call 4: Add tags\n{ tags: [\"tech\", \"ai\"] }\n\n// Problems:\n// - 4 network round trips\n// - Article exists with incomplete data between calls\n// - Any failure leaves orphaned/incomplete data\n// - Complex client-side orchestration required\n// - Race conditions possible\n\n// \u274C SHOPPING DISASTER - Creating a product sale\nPOST /sales // Call 1: Create sale\n{ name: \"Laptop\", price: 1000 }\n\u2192 Returns: { id: \"sale-456\" }\n\nPOST /sales/sale-456/units // Call 2: Create unit 1\n{ name: \"16GB RAM\", price: 1200 }\n\u2192 Returns: { id: \"unit-1\" }\n\nPOST /sales/sale-456/units // Call 3: Create unit 2\n{ name: \"32GB RAM\", price: 1500 }\n\u2192 Returns: { id: \"unit-2\" }\n\nPOST /units/unit-1/options // Call 4: Add option to unit 1\n{ name: \"Color\", type: \"select\" }\n\u2192 Returns: { id: \"opt-1\" }\n\nPOST /options/opt-1/candidates // Call 5: Add candidate\n{ value: \"Silver\", price_delta: 0 }\n\nPOST /options/opt-1/candidates // Call 6: Add candidate\n{ value: \"Black\", price_delta: 0 }\n\nPOST /units/unit-1/stocks // Call 7: Set stock for unit 1\n{ warehouse_id: \"wh-1\", quantity: 50 }\n\nPOST /units/unit-2/stocks // Call 8: Set stock for unit 2\n{ warehouse_id: \"wh-1\", quantity: 30 }\n\n// This is INSANE! 8 API calls to register one product!\n// Sale exists incomplete during the entire process\n// If any call fails, rollback is nightmarish\n```\n\n**\u2705 THE CORRECT APPROACH - Single Atomic Call**:\n\n```typescript\n// \u2705 ATOMIC ARTICLE CREATION\nPOST /articles\n{\n title: \"My Article\",\n content: \"Article content here...\",\n category_id: \"cat-123\", // Reference existing category\n\n // Composition: Files created atomically with article\n files: [\n {\n filename: \"image1.jpg\",\n url: \"https://cdn.../image1.jpg\",\n size: 524288,\n mimetype: \"image/jpeg\"\n },\n {\n filename: \"image2.jpg\",\n url: \"https://cdn.../image2.jpg\",\n size: 786432,\n mimetype: \"image/jpeg\"\n }\n ],\n\n // Tags as part of article creation\n tags: [\"tech\", \"ai\", \"innovation\"]\n}\n\n// Result: Complete article with ALL components in ONE call\n// Single transaction, single failure point, clean rollback\n\n// \u2705 ATOMIC SALE CREATION\nPOST /sales\n{\n name: \"Premium Laptop\",\n description: \"High-performance laptop\",\n section_id: \"electronics\", // Reference existing section\n category_ids: [\"laptops\", \"computers\"], // Reference categories\n\n // Deep nested composition - ALL created together\n units: [\n {\n name: \"16GB RAM Model\",\n price: 1200,\n sku: \"LAP-16GB\",\n\n // Nested options (Depth 2)\n options: [\n {\n name: \"Color\",\n type: \"select\",\n required: true,\n\n // Nested candidates (Depth 3)\n candidates: [\n { value: \"Silver\", price_delta: 0 },\n { value: \"Space Gray\", price_delta: 0 },\n { value: \"Gold\", price_delta: 50 }\n ]\n },\n {\n name: \"Storage\",\n type: \"select\",\n required: true,\n candidates: [\n { value: \"512GB SSD\", price_delta: 0 },\n { value: \"1TB SSD\", price_delta: 200 }\n ]\n }\n ],\n\n // Stock allocation (Depth 2)\n stocks: [\n { warehouse_id: \"wh-seoul\", quantity: 50 },\n { warehouse_id: \"wh-busan\", quantity: 30 }\n ]\n },\n {\n name: \"32GB RAM Model\",\n price: 1500,\n sku: \"LAP-32GB\",\n options: [\n {\n name: \"Color\",\n type: \"select\",\n required: true,\n candidates: [\n { value: \"Silver\", price_delta: 0 },\n { value: \"Space Gray\", price_delta: 0 }\n ]\n }\n ],\n stocks: [\n { warehouse_id: \"wh-seoul\", quantity: 20 },\n { warehouse_id: \"wh-busan\", quantity: 15 }\n ]\n }\n ],\n\n images: [\n { url: \"https://cdn.../main.jpg\", is_primary: true, order: 1 },\n { url: \"https://cdn.../side.jpg\", is_primary: false, order: 2 }\n ]\n}\n\n// Result: Complete product with ALL variants, options, stock in ONE call!\n// Single database transaction\n// All-or-nothing: either everything succeeds or nothing is created\n```\n\n##### Theoretical Foundation\n\n**Transaction Cohesion Principle**: Data that forms a single business transaction MUST be creatable in a single API call.\n\n**Definition of Transaction Cohesion**:\n- Data created by the **same actor** at the **same moment** for the **same business purpose** belongs together\n- The entity would be **incomplete or invalid** without all its components\n- All components share the **same lifecycle** and are **conceptually inseparable**\n\n**Decision Framework**:\n\n```\nQ: Should this data be nested in the Create DTO or accessed via separate endpoint?\n\n\u251C\u2500 Q1: Is it created by the SAME ACTOR at the SAME TIME?\n\u2502 \u251C\u2500 NO \u2192 Separate endpoint (different transaction context)\n\u2502 \u2514\u2500 YES \u2192 Continue to Q2\n\u2502\n\u251C\u2500 Q2: Would the parent entity be INCOMPLETE without this data?\n\u2502 \u251C\u2500 NO \u2192 Consider separate endpoint (optional enhancement)\n\u2502 \u2514\u2500 YES \u2192 Continue to Q3\n\u2502\n\u251C\u2500 Q3: Does this data DEFINE the parent's core structure?\n\u2502 \u251C\u2500 NO \u2192 Consider separate endpoint\n\u2502 \u2514\u2500 YES \u2192 MUST be nested in Create DTO (composition)\n\u2502\n\u2514\u2500 RESULT: Include as nested ICreate object/array\n```\n\n**Application Examples**:\n\n```typescript\n// Shopping Sale Creation\n// Q1: Same actor (seller) at same time? YES\n// Q2: Sale incomplete without units? YES (can't sell nothing)\n// Q3: Units define what's being sold? YES\n// \u2192 MUST nest units in IShoppingSale.ICreate\n\n// Q1: Units created at same time? YES\n// Q2: Unit incomplete without options? YES (defines variants)\n// Q3: Options define the SKU structure? YES\n// \u2192 MUST nest options in IShoppingSaleUnit.ICreate\n\n// Q1: Options created at same time? YES\n// Q2: Option incomplete without candidates? YES (select needs choices)\n// Q3: Candidates define the option's choices? YES\n// \u2192 MUST nest candidates in IShoppingSaleUnitOption.ICreate\n\n// Article Comments\n// Q1: Comments by same actor as article? NO (different users)\n// Q2: Article incomplete without comments? NO\n// Q3: Comments define article structure? NO\n// \u2192 Separate endpoint: POST /articles/:id/comments\n```\n\n##### The Atomic Operation Principle for Read DTOs\n\n**FUNDAMENTAL RULE**: Read DTOs must enable complete information retrieval in a single API call. This is the READ side of the atomic operation principle.\n\n**Core Philosophy**: Users should NEVER need multiple API calls to retrieve all necessary information to understand and display an entity.\n\n**Why This Matters**:\n\n1. **User Experience**: Multiple GET calls to render a single view create poor UX and N+1 query problems\n2. **Network Efficiency**: Reduces round trips and latency for data retrieval\n3. **Data Consistency**: Single snapshot ensures temporal consistency across related data\n4. **Developer Experience**: Complete data structures eliminate guesswork about what to fetch next\n5. **Performance**: Backend can optimize joins vs multiple client-side requests\n\n**Anti-Pattern Examples** (What we MUST prevent):\n\n```typescript\n// \u274C CATASTROPHIC DESIGN - Multiple API calls to display article\nGET /articles/123 // Call 1: Get article\n\u2192 Returns: {\n id: \"123\",\n title: \"My Article\",\n bbs_member_id: \"user-456\", // \u274C Just an ID\n category_id: \"cat-789\" // \u274C Just an ID\n}\n\nGET /members/user-456 // Call 2: Get author info\n\u2192 Returns: { name: \"John Doe\", avatar: \"...\" }\n\nGET /categories/cat-789 // Call 3: Get category info\n\u2192 Returns: { name: \"Technology\", slug: \"tech\" }\n\nGET /articles/123/files // Call 4: Get attachments\n\u2192 Returns: [{ url: \"...\", name: \"...\" }]\n\n// Problems:\n// - 4 network round trips to display ONE article\n// - N+1 query problem for lists\n// - Temporal inconsistencies (data changes between calls)\n// - Complex client-side state management\n// - Poor performance on high-latency networks\n\n// \u274C SHOPPING DISASTER - Multiple calls to display sale\nGET /sales/456 // Call 1: Get sale\n\u2192 Returns: {\n id: \"456\",\n name: \"Laptop\",\n seller_id: \"seller-123\", // \u274C Just an ID\n section_id: \"electronics\" // \u274C Just an ID\n}\n\nGET /sellers/seller-123 // Call 2: Get seller\nGET /sections/electronics // Call 3: Get section\nGET /sales/456/units // Call 4: Get units\nGET /sales/456/images // Call 5: Get images\n\n// This is INSANE! 5 API calls to display one product!\n```\n\n**\u2705 THE CORRECT APPROACH - Complete Information in Single Call**:\n\n```typescript\n// \u2705 ATOMIC ARTICLE READ\nGET /articles/123\n\u2192 Returns: {\n id: \"123\",\n title: \"My Article\",\n content: \"...\",\n created_at: \"2024-01-15T10:00:00Z\",\n\n // COMPOSITION: Full nested objects\n author: { // \u2705 Complete author info\n id: \"user-456\",\n name: \"John Doe\",\n avatar: \"https://cdn.../avatar.jpg\",\n reputation: 1250\n },\n\n category: { // \u2705 Complete category info\n id: \"cat-789\",\n name: \"Technology\",\n slug: \"tech\",\n icon: \"\uD83D\uDCBB\"\n },\n\n // COMPOSITION: Nested arrays\n files: [ // \u2705 All attachments included\n {\n id: \"file-1\",\n url: \"https://cdn.../doc.pdf\",\n name: \"specification.pdf\",\n size: 524288,\n mimetype: \"application/pdf\"\n },\n {\n id: \"file-2\",\n url: \"https://cdn.../image.jpg\",\n name: \"diagram.jpg\",\n size: 786432,\n mimetype: \"image/jpeg\"\n }\n ],\n\n // AGGREGATION: Counts only (not full arrays)\n comments_count: 42, // \u2705 Use GET /articles/123/comments for list\n likes_count: 128 // \u2705 Use GET /articles/123/likes for list\n}\n\n// Result: Complete article with ALL necessary info in ONE call\n// Client can immediately render the full article view\n// No cascading requests, no N+1 problems\n\n// \u2705 ATOMIC SALE READ\nGET /sales/456\n\u2192 Returns: {\n id: \"456\",\n name: \"Premium Laptop\",\n description: \"High-performance laptop\",\n price: 1200,\n created_at: \"2024-01-15T10:00:00Z\",\n\n // ASSOCIATION: Complete seller info\n seller: { // \u2705 All seller context\n id: \"seller-123\",\n name: \"TechStore Inc.\",\n rating: 4.8,\n total_sales: 5420,\n verified: true\n },\n\n section: { // \u2705 Complete section info\n id: \"electronics\",\n name: \"Electronics\",\n path: [\"Home\", \"Electronics\"]\n },\n\n // COMPOSITION: Deep nested structure with ALL data\n units: [ // \u2705 Complete unit array\n {\n id: \"unit-1\",\n name: \"16GB RAM Model\",\n price: 1200,\n sku: \"LAP-16GB\",\n\n // Nested composition (Depth 2)\n options: [ // \u2705 All options included\n {\n id: \"opt-1\",\n name: \"Color\",\n type: \"select\",\n required: true,\n\n // Nested composition (Depth 3)\n candidates: [ // \u2705 All choices included\n { id: \"cand-1\", value: \"Silver\", price_delta: 0 },\n { id: \"cand-2\", value: \"Space Gray\", price_delta: 0 },\n { id: \"cand-3\", value: \"Gold\", price_delta: 50 }\n ]\n },\n {\n id: \"opt-2\",\n name: \"Storage\",\n type: \"select\",\n required: true,\n candidates: [\n { id: \"cand-4\", value: \"512GB SSD\", price_delta: 0 },\n { id: \"cand-5\", value: \"1TB SSD\", price_delta: 200 }\n ]\n }\n ],\n\n stocks: [ // \u2705 Stock info included\n {\n id: \"stock-1\",\n quantity: 50,\n warehouse: { // \u2705 Warehouse context\n id: \"wh-seoul\",\n name: \"Seoul Warehouse\",\n location: \"Seoul, Korea\"\n }\n },\n {\n id: \"stock-2\",\n quantity: 30,\n warehouse: {\n id: \"wh-busan\",\n name: \"Busan Warehouse\",\n location: \"Busan, Korea\"\n }\n }\n ]\n },\n {\n id: \"unit-2\",\n name: \"32GB RAM Model\",\n price: 1500,\n sku: \"LAP-32GB\",\n options: [...], // \u2705 Complete options\n stocks: [...] // \u2705 Complete stocks\n }\n ],\n\n images: [ // \u2705 All product images\n { id: \"img-1\", url: \"https://cdn.../main.jpg\", is_primary: true, order: 1 },\n { id: \"img-2\", url: \"https://cdn.../side.jpg\", is_primary: false, order: 2 }\n ],\n\n // AGGREGATION: Counts only\n reviews_count: 324, // GET /sales/456/reviews for list\n questions_count: 18 // GET /sales/456/questions for list\n}\n\n// Result: Complete product with ALL structural data in ONE call!\n// Client can render full product page immediately\n// All variants, options, stock info available without additional calls\n```\n\n**Read DTO Atomic Operation Decision Framework**:\n\n```\nQ: Should this related data be included in the Read DTO?\n\n\u251C\u2500 Q1: Is it COMPOSITION (created with parent)?\n\u2502 \u251C\u2500 YES \u2192 Q1a: Is it BOUNDED (reasonable size)?\n\u2502 \u2502 \u251C\u2500 YES \u2192 INCLUDE as nested objects/arrays\n\u2502 \u2502 \u2514\u2500 NO \u2192 Consider pagination, but generally include\n\u2502 \u2514\u2500 NO \u2192 Continue to Q2\n\n\u251C\u2500 Q2: Is it ASSOCIATION (independent entity providing context)?\n\u2502 \u251C\u2500 YES \u2192 TRANSFORM FK to full object\n\u2502 \u2514\u2500 NO \u2192 Continue to Q3\n\n\u2514\u2500 Q3: Is it AGGREGATION (event-driven, different actor)?\n \u251C\u2500 YES \u2192 Q3a: Is list UNBOUNDED (comments, reviews)?\n \u2502 \u251C\u2500 YES \u2192 EXCLUDE, provide count only\n \u2502 \u2514\u2500 NO \u2192 Could include, but evaluate if needed\n \u2514\u2500 NO \u2192 Special case, evaluate individually\n```\n\n**Application Examples**:\n\n```typescript\n// Article Files\n// Q1: Composition? YES (uploaded with article)\n// Q1a: Bounded? YES (typically 1-20 files)\n// \u2192 INCLUDE as files: IArticleFile[]\n\n// Article Author\n// Q2: Association? YES (member exists independently)\n// \u2192 INCLUDE as author: IBbsMember.ISummary (transformed FK)\n\n// Article Comments\n// Q3: Aggregation? YES (written later by different users)\n// Q3a: Unbounded? YES (could have thousands)\n// \u2192 EXCLUDE, provide comments_count, separate API: GET /articles/:id/comments\n\n// Sale Units\n// Q1: Composition? YES (define what's being sold)\n// Q1a: Bounded? YES (typically 1-50 variants)\n// \u2192 INCLUDE as units: ISaleUnit[] with deep nesting\n\n// Sale Reviews\n// Q3: Aggregation? YES (customer feedback over time)\n// Q3a: Unbounded? YES (hundreds to thousands)\n// \u2192 EXCLUDE, provide reviews_count, separate API: GET /sales/:id/reviews\n```\n\n**Read DTO Violation Patterns**:\n\n```typescript\n// \u274C VIOLATION 1: Raw FK IDs instead of objects\ninterface IBbsArticle {\n title: string;\n bbs_member_id: string; // \u274C Should be author: IBbsMember.ISummary\n category_id: string; // \u274C Should be category: IBbsCategory\n}\n// Forces client to make additional API calls for author and category info\n\n// \u274C VIOLATION 1.5: Redundant FK fields alongside reference objects\ninterface IShoppingSale {\n name: string;\n shopping_seller_id: string; // \u274C REDUNDANT - seller object contains this ID\n seller: IShoppingSeller.ISummary; // \u2705 Correct object, but FK should be REMOVED\n shopping_section_id: string; // \u274C REDUNDANT - section object contains this ID\n section: IShoppingSection.ISummary; // \u2705 Correct object, but FK should be REMOVED\n}\n// CRITICAL ERROR: When you transform FK to reference object, the original FK MUST be eliminated\n// The reference object CONTAINS the ID (seller.id), making the separate FK field pure redundancy\n// This creates: data duplication, client confusion, unclear semantics, maintenance burden\n// CORRECT: Remove ALL raw FK fields - keep ONLY the reference objects\n\n// \u274C VIOLATION 2: Missing compositional data\ninterface IShoppingSale {\n name: string;\n seller: IShoppingSeller.ISummary; // \u2705 Good\n // units ??? WHERE ARE THE UNITS? // \u274C Missing composition\n}\n// Forces client to call GET /sales/:id/units separately\n// Sale is INCOMPLETE without its units\n\n// \u274C VIOLATION 3: Including unbounded aggregations\ninterface IBbsArticle {\n title: string;\n author: IBbsMember.ISummary;\n comments: IComment[]; // \u274C Could be thousands, breaks pagination\n likes: ILike[]; // \u274C Could be millions, catastrophic\n}\n// Should use comments_count and separate endpoint\n\n// \u2705 CORRECT: Complete atomic read\ninterface IBbsArticle {\n id: string;\n title: string;\n content: string;\n author: IBbsMember.ISummary; // \u2705 Association transformed (bbs_member_id REMOVED)\n category: IBbsCategory.ISummary; // \u2705 Association transformed (category_id REMOVED)\n files: IBbsArticleFile[]; // \u2705 Composition included\n comments_count: number; // \u2705 Aggregation as count\n likes_count: number; // \u2705 Aggregation as count\n}\n// Notice: NO raw FK fields (bbs_member_id, category_id) - they are ELIMINATED\n// The reference objects (author, category) contain the IDs, so separate FK fields are redundant\n```\n\n**Depth Consistency with Create DTOs**:\n\n```typescript\n// Read DTO depth MUST match Create DTO depth\n\n// If Create DTO supports this depth:\ninterface IShoppingSale.ICreate {\n units: IShoppingSaleUnit.ICreate[] { // Depth 1\n options: IShoppingSaleUnitOption.ICreate[] { // Depth 2\n candidates: IOptionCandidate.ICreate[]; // Depth 3\n };\n stocks: IStock.ICreate[]; // Depth 2\n };\n}\n\n// Then Read DTO MUST provide this depth:\ninterface IShoppingSale {\n units: IShoppingSaleUnit[] { // Depth 1\n options: IShoppingSaleUnitOption[] { // Depth 2\n candidates: IOptionCandidate[]; // Depth 3\n };\n stocks: IStock[]; // Depth 2\n };\n}\n\n// \u274C VIOLATION: Read DTO provides less depth than Create DTO\ninterface IShoppingSale {\n unit_ids: string[]; // \u274C Just IDs, client needs GET /units/:id for each\n}\n// This breaks read-write symmetry and forces multiple calls\n```\n\n##### Read-Write Symmetry Principle\n\n**CRITICAL RULE**: The atomic operation principle applies symmetrically to BOTH Read and Create operations.\n\n**Read DTOs (Response)** - Atomic Information Retrieval:\n- Must provide **complete information** without requiring additional API calls\n- Transform all **contextual FKs to full objects** (associations)\n- Include all **compositional relations** as nested arrays/objects\n- User can render complete UI from single GET request\n- **This IS the atomic operation for READ**: One call, complete entity\n\n**Create DTOs (Request)** - Atomic Entity Creation:\n- Must accept **complete data** for atomic creation\n- Accept **nested ICreate objects** for compositions\n- Accept **ID references** for associations (existing entities)\n- User can create complete entity with single POST request\n- **This IS the atomic operation for WRITE**: One call, complete creation\n\n**Symmetry Example**:\n\n```typescript\n// If your Read DTO has this structure:\ninterface IShoppingSale {\n id: string;\n name: string;\n seller: IShoppingSeller.ISummary; // Complete seller info\n section: IShoppingSection.ISummary; // Complete section info\n units: IShoppingSaleUnit[] { // Complete unit array\n id: string;\n name: string;\n options: IShoppingSaleUnitOption[]; // Complete options\n stocks: IShoppingSaleUnitStock[]; // Complete stocks\n };\n}\n\n// Then your Create DTO MUST support equivalent creation:\ninterface IShoppingSale.ICreate {\n name: string;\n section_id: string; // Reference existing (ID)\n units: IShoppingSaleUnit.ICreate[] { // Create nested (objects)\n name: string;\n options: IShoppingSaleUnitOption.ICreate[];\n stocks: IShoppingSaleUnitStock.ICreate[];\n };\n // seller_id from JWT (auth context)\n}\n\n// \u274C VIOLATION: Read shows units but Create requires separate calls\ninterface IShoppingSale.ICreate {\n name: string;\n section_id: string;\n // units ??? <- WHERE ARE THE UNITS?\n // This forces: POST /sales, then POST /sales/:id/units\n // This is UNACCEPTABLE\n}\n```\n\n##### Depth Limits and Practical Boundaries\n\n**Rule**: No artificial depth limits for business-necessary nesting.\n\n**Common Depths by Domain**:\n\n1. **Depth 1** (Simple composition):\n ```typescript\n IArticle.ICreate {\n files: IArticleFile.ICreate[]; // 1 level\n }\n ```\n\n2. **Depth 2** (Moderate composition):\n ```typescript\n IOrder.ICreate {\n items: IOrderItem.ICreate[] { // Level 1\n selected_options: ISelectedOption.ICreate[]; // Level 2\n };\n }\n ```\n\n3. **Depth 3+** (Complex composition):\n ```typescript\n ISale.ICreate {\n units: ISaleUnit.ICreate[] { // Level 1\n options: IUnitOption.ICreate[] { // Level 2\n candidates: IOptionCandidate.ICreate[]; // Level 3\n };\n };\n }\n ```\n\n**No Arbitrary Limits**: If business logic requires 4 or 5 levels, support it. Don't artificially restrict based on \"complexity concerns.\"\n\n##### Common Violations and Corrections\n\n**Violation 1: Split Composition**\n```typescript\n// \u274C WRONG\ninterface IArticle.ICreate {\n title: string;\n content: string;\n // No files field\n}\n// Requires: POST /articles/:id/files after creation\n\n// \u2705 CORRECT\ninterface IArticle.ICreate {\n title: string;\n content: string;\n files: IArticleFile.ICreate[]; // Atomic\n}\n```\n\n**Violation 2: Shallow Nesting**\n```typescript\n// \u274C WRONG - Units separated\ninterface ISale.ICreate {\n name: string;\n units: string[]; // Just IDs? Requires pre-creation?\n}\n\n// \u2705 CORRECT - Deep nesting\ninterface ISale.ICreate {\n name: string;\n units: ISaleUnit.ICreate[] {\n name: string;\n options: IUnitOption.ICreate[];\n stocks: IStock.ICreate[];\n };\n}\n```\n\n**Violation 3: Reference Confusion**\n```typescript\n// \u274C WRONG - Mixing compositions and references incorrectly\ninterface IOrder.ICreate {\n customer_id: string; // \u274C Should be from JWT\n items: string[]; // \u274C Should be nested objects\n payment_method_id: string; // \u2705 OK - selecting saved method\n}\n\n// \u2705 CORRECT\ninterface IOrder.ICreate {\n // customer_id from JWT (auth)\n items: IOrderItem.ICreate[] { // Nested composition\n sale_id: string; // Reference to existing sale\n quantity: number;\n };\n payment_method_id?: string; // Optional saved method\n payment?: IPayment.ICreate; // Or create new payment\n}\n```\n\n##### Implementation Checklist\n\n**Before finalizing ANY Read DTO (Response)**:\n\n- [ ] **FK Transformation Check**: All contextual FKs transformed to full objects (not raw IDs)?\n- [ ] **Composition Inclusion**: All bounded compositions included as nested arrays/objects?\n- [ ] **Aggregation Exclusion**: Unbounded aggregations excluded (counts only)?\n- [ ] **Single-Call Test**: Can client display complete entity from one GET?\n- [ ] **N+1 Prevention**: No scenarios requiring multiple follow-up calls per list item?\n- [ ] **Depth Validation**: Nesting depth matches business domain complexity?\n- [ ] **Symmetry Check**: Read DTO structure matches what Create DTO can produce?\n\n**Before finalizing ANY Create DTO (Request)**:\n\n- [ ] **Composition Check**: All compositional data nested in Create DTO?\n- [ ] **Single-Call Test**: Can user create complete entity in one POST?\n- [ ] **Association Check**: References to existing entities use ID fields?\n- [ ] **Depth Validation**: Nesting depth matches business complexity?\n- [ ] **Symmetry Check**: Create DTO matches Read DTO structure?\n- [ ] **Actor Exclusion**: No actor IDs (come from JWT)?\n- [ ] **Transaction Boundary**: All data in single DB transaction?\n\n**If ANY check fails for either DTO type, the design is incomplete and violates the atomic operation principle.**\n\n#### 4.4.3. The Circular Reference Prevention Rule\n\n**THE GOLDEN RULE**: ALL reference relations (belongs-to) MUST use `.ISummary`, ALL composition relations (has-many/has-one) use detail types (base interface).\n\n**Why This Rule Exists**:\n\nCross-references between entities can create infinite expansion chains if not properly contained:\n\n```typescript\n// \u274C CATASTROPHIC: Detail types in references\ninterface IShoppingSale {\n seller: IShoppingSeller; // Detail type!\n section: IShoppingSection; // Detail type!\n units: IShoppingSaleUnit[];\n}\n\n// These create infinite expansion chains:\n// Sale \u2192 Seller \u2192 Company \u2192 Seller \u2192 Company \u2192 ...\n// Sale \u2192 Section \u2192 Parent Section \u2192 Parent Section \u2192 ...\n\n// \u2705 CORRECT: ALL references use .ISummary\ninterface IShoppingSale {\n seller: IShoppingSeller.ISummary; // \u2705 Summary stops expansion\n section: IShoppingSection.ISummary; // \u2705 Summary stops expansion\n units: IShoppingSaleUnit[]; // \u2705 Composition uses detail (owned)\n}\n\ninterface IShoppingSeller.ISummary {\n id: string;\n name: string;\n rating: number;\n\n // \u26A0\uFE0F CRITICAL RULES for .ISummary:\n // \u2705 INCLUDE: BELONGS-TO references (as .ISummary) - provides context\n // \u2705 INCLUDE: Owned 1:1 compositions - structural integrity\n // \u274C EXCLUDE: HAS-MANY arrays (actor reversal, aggregations)\n\n company: IShoppingCompany.ISummary; // \u2705 BELONGS-TO reference included\n verification?: ISellerVerification.ISummary; // \u2705 1:1 composition included\n // NO sales[] array (HAS-MANY - actor reversal)\n}\n```\n\n**Type Selection Matrix** (Simple and Universal):\n\n| Relation Type | Type to Use | Reason |\n|--------------|-------------|---------|\n| **BELONGS-TO** (Reference/Association) | `.ISummary` ALWAYS | Prevents circular expansion - no exceptions |\n| **HAS-MANY** (Owns children array) | Base type (detail) | Parent owns - no circular risk |\n| **HAS-ONE** (Owns single child) | Base type (detail) | Parent owns - no circular risk |\n\n**No Case-by-Case Judgment**: Every BELONGS-TO reference uses `.ISummary` regardless of entity size or complexity.\n\n**Why ALWAYS create .ISummary?** (Even for \"small\" entities)\n1. **Consistency**: Uniform pattern across entire codebase - easier to maintain\n2. **Future-proofing**: Today's 4-field entity becomes tomorrow's 12-field entity\n3. **Code generation**: AutoBE generates thousands of entities - consistent rules essential\n4. **Circular prevention**: Even small entities can create circular chains if they reference back\n5. **Performance**: Explicit .ISummary types enable better serialization optimization\n\n**Never skip .ISummary for BELONGS-TO relations** - even if the entity seems \"already minimal\".\n\n**Practical Examples**:\n\n```typescript\n// E-Commerce Domain\ninterface IShoppingSale {\n seller: IShoppingSeller.ISummary; // \u2705 Reference \u2192 .ISummary (always)\n section: IShoppingSection.ISummary; // \u2705 Reference \u2192 .ISummary (always)\n category: IShoppingCategory.ISummary; // \u2705 Reference \u2192 .ISummary (even if small!)\n units: IShoppingSaleUnit[]; // \u2705 Composition \u2192 Detail\n warranty: IShoppingSaleWarranty; // \u2705 Composition \u2192 Detail\n}\n\n// BBS Domain\ninterface IBbsArticle {\n author: IBbsMember.ISummary; // \u2705 Reference \u2192 .ISummary (always)\n category: IBbsCategory.ISummary; // \u2705 Reference \u2192 .ISummary (always)\n files: IBbsArticleFile[]; // \u2705 Composition \u2192 Detail\n}\n```\n\n**Universal Rule**: If it's a foreign key to an independent entity (BELONGS-TO), use `.ISummary`. No exceptions, no case-by-case judgment.\n\n**Why This Matters**:\n\n1. **Prevents ALL circular reference possibilities**\n2. **Consistent pattern** - no complex judgment needed\n3. **Future-proof** - reference entity can evolve without breaking\n4. **Performance** - Smaller payloads (3-5x reduction)\n5. **Caching** - Independent cache strategies for different entities\n6. **Client can fetch detailed reference via separate API if needed**\n\n#### 4.4.4. Response DTOs (Read Operations)\n\n**CRITICAL DISTINCTION**: Response DTOs come in TWO forms - Detail and Summary - each with different relation inclusion rules.\n\n##### 4.4.4.1. Understanding Detail vs Summary Response DTOs\n\n**Detail Response DTOs (Main Entity Type - `IEntity`)**:\n- **Purpose**: Complete entity representation for single-entity retrieval (GET /entities/:id)\n- **Use Case**: Displaying full entity detail page\n- **Relation Strategy**: Include BOTH belongs-to references AND has-many/has-one compositions\n\n**Summary Response DTOs (`IEntity.ISummary`)**:\n- **Purpose**: Lightweight representation for lists and embeddings (GET /entities)\n- **Use Case**: Displaying entity in list views or as reference in other entities\n- **Relation Strategy**: Include ONLY belongs-to references, EXCLUDE has-many compositions\n\n**Why This Distinction Matters**:\n- **Performance**: Summary DTOs are 3-10x smaller (5-15KB vs 50KB per entity)\n- **List Efficiency**: 20-item list = 100-300KB vs 1MB\n- **Both use `.ISummary` for references**: But Detail includes compositions, Summary excludes them\n\n**Example Comparison**:\n\n```typescript\n// Detail DTO - Complete entity with everything\ninterface IShoppingSale {\n id: string;\n name: string;\n description: string; // Full description\n\n // \u2705 BELONGS-TO references - use .ISummary\n seller: IShoppingSeller.ISummary;\n section: IShoppingSection.ISummary;\n categories: IShoppingCategory.ISummary[];\n\n // \u2705 HAS-MANY compositions - include full arrays\n units: IShoppingSaleUnit[];\n images: IShoppingSaleImage[];\n\n // \u2705 Aggregations - counts only\n reviews_count: number;\n}\n\n// Summary DTO - Lightweight for lists\ninterface IShoppingSale.ISummary {\n id: string;\n name: string;\n price: number;\n thumbnail?: string; // Just one image\n\n // \u2705 BELONGS-TO references - use .ISummary (same as Detail)\n seller: IShoppingSeller.ISummary;\n section: IShoppingSection.ISummary;\n primary_category?: IShoppingCategory.ISummary;\n\n // \u274C HAS-MANY compositions - EXCLUDE for efficiency\n // units: NO\n // images: NO\n\n // \u2705 Aggregations - counts only\n reviews_count: number;\n}\n```\n\n**The Universal `.ISummary` Rule Applies to BOTH**:\n- Detail DTOs: Use `.ISummary` for BELONGS-TO, include HAS-MANY compositions\n- Summary DTOs: Use `.ISummary` for BELONGS-TO, EXCLUDE HAS-MANY compositions\n\n##### 4.4.4.2. Foreign Key Transformation Rules for Response DTOs\n\n**Rule**: Transform ALL contextual FKs to objects for complete information. When transforming, the original FK field MUST be eliminated (atomic replacement, not addition).\n\n**Two Categories of FKs in Response DTOs**:\n\n1. **Hierarchical Parent FK**: Keep as ID to prevent circular references\n - Direct parent in a composition hierarchy\n - Example: `article_id` in comment when article contains comments[]\n\n2. **Contextual Reference FK**: Transform to object (and REMOVE original FK field)\n - Any FK providing context or additional information\n - Examples: `author_id`, `category_id`, `seller_id`\n - **CRITICAL**: When you add `author: IBbsMember.ISummary`, you MUST remove `bbs_member_id: string`\n - **WHY**: The reference object contains the ID (`author.id`), making the separate FK field pure redundancy\n - **Transformation = Replacement**, not addition - never have both fields simultaneously\n\n```typescript\n// \u2705 CORRECT: Response DTOs with transformed FKs (original FK fields ELIMINATED)\ninterface IBbsArticle {\n // Associations \u2192 Full objects (.ISummary)\n author: IBbsMember.ISummary; // bbs_member_id REMOVED, replaced with object\n category: IBbsCategory.ISummary; // category_id REMOVED, replaced with object\n\n // Compositions \u2192 Full arrays\n attachments: IBbsArticleAttachment[]; // Created with article\n\n // Aggregations \u2192 Not included (counts only)\n comments_count: number; // GET /articles/:id/comments\n likes_count: number; // GET /articles/:id/likes\n\n // Notice: NO raw FK fields (bbs_member_id, category_id) exist\n // The reference objects contain IDs: author.id, category.id\n}\n\ninterface IBbsArticleComment {\n // Hierarchical parent \u2192 Keep as ID (ONLY exception)\n article_id: string; // Parent contains this, prevents circular\n\n // Association \u2192 Transform to object\n author: IBbsMember.ISummary; // commenter_id REMOVED, replaced with object\n\n // Notice: article_id kept ONLY because IBbsArticle.comments[] contains this\n}\n\ninterface IShoppingSale {\n // All associations transformed (.ISummary), original FKs REMOVED\n seller: IShoppingSeller.ISummary; // shopping_seller_id REMOVED\n section: IShoppingSection.ISummary; // shopping_section_id REMOVED\n categories: IShoppingCategory.ISummary[]; // category_ids REMOVED\n\n // Compositions included\n units: IShoppingSaleUnit[]; // Deep composition tree\n\n // Notice: NO shopping_seller_id, NO shopping_section_id, NO category_ids\n // Access via: seller.id, section.id, categories.map(c => c.id)\n}\n```\n\n#### 4.4.5. Create DTOs (Request Operations)\n\n**Rule**: Use IDs for references, nested objects for compositions.\n\n**CRITICAL: Prefer Unique Code Fields Over UUID IDs in References**\n\nWhen defining reference fields in Create/Update DTOs, **CHECK THE TARGET SCHEMA FIRST**:\n\n1. **If the referenced entity has a unique `code` field** (or similar: `username`, `slug`, `sku`), use `entity_code` instead of `entity_id`\n2. **Only use `entity_id` (UUID) when the referenced entity has no human-readable unique identifier**\n\n**Path to DTO Consistency**:\n- This rule **MUST** match the path parameter rules from INTERFACE_ENDPOINT.md\n- If endpoint uses `/enterprises/{enterpriseCode}`, then DTOs referencing enterprises MUST use `enterprise_code`\n- If endpoint uses `/orders/{orderId}`, then DTOs referencing orders MUST use `order_id`\n\n**Field Naming Priority for References**:\n- `entity_code` (when target has unique `code` field)\n- `entity_username`, `entity_handle`, `entity_slug` (when target has these)\n- `entity_sku`, `entity_serial_number` (for product entities)\n- `entity_id` (UUID - only when target has no unique code)\n\n**Benefits**:\n- \u2705 Consistency with API path parameters\n- \u2705 More readable request bodies\n- \u2705 Easier debugging (can see what's being referenced)\n- \u2705 Better developer experience\n\n**Examples:**\n\n```typescript\n// Example 1: Referencing entity WITH unique code\n// Schema: enterprises(id UUID, code STRING UNIQUE)\ninterface ITeam.ICreate {\n name: string;\n enterprise_code: string; // \u2705 Use code, NOT enterprise_id\n}\n\n// Example 2: Referencing entities with codes in nested composition\n// Schema: teams(code), projects(code)\ninterface IProjectAssignment.ICreate {\n team_code: string; // \u2705 Use code\n project_code: string; // \u2705 Use code\n role: string;\n}\n\n// Example 3: Referencing entity WITHOUT unique code\n// Schema: orders(id UUID) with NO code field\ninterface IOrderItem.ICreate {\n order_id: string; // \u2705 Use UUID id (no code exists)\n product_sku: string; // \u2705 But product HAS sku, so use it\n quantity: number;\n}\n\n// Example 4: Mixed references in same DTO\n// Schemas: categories(code), warehouses(id only)\ninterface IProduct.ICreate {\n name: string;\n category_code: string; // \u2705 Category has code\n warehouse_id: string; // \u2705 Warehouse has no code (UUID)\n sku: string; // \u2705 This entity's own unique code\n}\n```\n\n**CRITICAL: Path Parameters vs Request Body Fields**\n\nBefore defining any reference fields, understand this fundamental rule:\n\n**ABSOLUTE RULE #1: Never Duplicate Path Parameters in Request Body**\n\nIf parent identifiers are already in the endpoint path, they are AUTOMATICALLY available to the server.\n**DO NOT include them in the request body** - this creates:\n- \u274C Redundancy and confusion\n- \u274C Potential conflicts (path says \"acme\" but body says \"globex\"?)\n- \u274C API consumer confusion\n- \u274C Unnecessary validation overhead\n\n**Examples of Path Context (DO NOT DUPLICATE):**\n\n```typescript\n// \u2705 CORRECT: Path provides parent context\n// Endpoint: POST /enterprises/{enterpriseCode}/teams\ninterface ITeam.ICreate {\n name: string;\n code: string;\n description: string;\n // \u2705 NO enterprise_code field - already in path parameter\n // Server extracts enterpriseCode from path automatically\n}\n\n// Server implementation:\n@Post('/enterprises/:enterpriseCode/teams')\nasync createTeam(\n @Param('enterpriseCode') enterpriseCode: string, // \u2190 From path\n @Body() dto: ITeam.ICreate // \u2190 From body\n) {\n return this.service.create({\n ...dto,\n enterprise_code: enterpriseCode // \u2705 Injected from path\n });\n}\n\n// \u2705 CORRECT: Nested path with multiple parent levels\n// Endpoint: POST /enterprises/{enterpriseCode}/teams/{teamCode}/companions\ninterface ITeamCompanion.ICreate {\n name: string;\n email: string;\n role: string;\n // \u2705 NO enterprise_code - already in path\n // \u2705 NO team_code - already in path\n // Both parent contexts provided by path\n}\n\n// \u274C WRONG: Duplicating path parameters\n// Endpoint: POST /enterprises/{enterpriseCode}/teams/{teamCode}/companions\ninterface ITeamCompanion.ICreate {\n name: string;\n email: string;\n role: string;\n enterprise_code: string; // \u274C REDUNDANT - already in path!\n team_code: string; // \u274C REDUNDANT - already in path!\n}\n```\n\n**RULE #2: External References Require Complete Context (Composite Unique)**\n\nWhen DTO references a DIFFERENT entity (not a parent in the path), and that entity has a composite unique constraint, provide complete context:\n\n```typescript\n// Endpoint: POST /projects\n// Project references team, but team is NOT in path\n\n// Prisma Schema:\n// model teams {\n// @@unique([enterprise_id, code]) // Composite unique\n// }\n\n// \u274C WRONG: Incomplete reference\ninterface IProject.ICreate {\n name: string;\n team_code: string; // Which enterprise's team?!\n}\n\n// \u2705 CORRECT: Complete reference with parent context\ninterface IProject.ICreate {\n name: string;\n enterprise_code: string; // Parent context\n team_code: string; // Now unambiguous\n}\n```\n\n**Decision Tree for Reference Fields:**\n\n```\nIs the referenced entity in the endpoint path?\n\u2502\n\u251C\u2500 YES \u2192 DO NOT include in request body\n\u2502 \u2502 Path provides context automatically\n\u2502 \u2502\n\u2502 \u2514\u2500 Example: POST /enterprises/{enterpriseCode}/teams\n\u2502 Body: { name, code }\n\u2502 \u2705 NO enterprise_code field needed\n\u2502\n\u2514\u2500 NO \u2192 Check referenced entity's @@unique constraint\n \u2502\n \u251C\u2500 @@unique([code]) \u2192 Global unique\n \u2502 \u2502 Use single code field\n \u2502 \u2502\n \u2502 \u2514\u2500 Example: categories with @@unique([code])\n \u2502 Body: { ..., category_code }\n \u2502\n \u2514\u2500 @@unique([parent_id, code]) \u2192 Composite unique\n \u2502 Must provide parent context\n \u2502\n \u2514\u2500 Example: teams with @@unique([enterprise_id, code])\n Body: { ..., enterprise_code, team_code }\n```\n\n**Three Patterns for Relations in Create DTOs**:\n\n1. **Parent Context from Path**: DO NOT duplicate in body\n - Parent identifiers already in path parameters\n - Server extracts automatically\n - Example: `/enterprises/{enterpriseCode}/teams` \u2192 NO `enterprise_code` in body\n\n2. **Reference Relations (Association/Aggregation)**: Use code fields (or ID if no code)\n - Selecting existing entities NOT in path\n - Check target's `@@unique` constraint\n - Global unique: single code field\n - Composite unique: parent code + child code\n - Example: `category_code` (global), `enterprise_code + team_code` (composite)\n\n3. **Composition Relations**: Use nested ICreate objects\n - Creating entities together in same transaction\n - Example: `attachments`, `units`, `items`\n\n```typescript\n// Example 1: Path provides parent context (DO NOT DUPLICATE)\n// Endpoint: POST /enterprises/{enterpriseCode}/teams\ninterface ITeam.ICreate {\n name: string;\n code: string;\n description: string;\n // \u2705 NO enterprise_code - path provides it\n}\n\n// Example 2: Deep nesting - path provides all parent context\n// Endpoint: POST /enterprises/{enterpriseCode}/teams/{teamCode}/companions\ninterface ITeamCompanion.ICreate {\n name: string;\n email: string;\n role: string;\n // \u2705 NO enterprise_code - path provides it\n // \u2705 NO team_code - path provides it\n}\n\n// Example 3: External reference to entity with global unique\n// Endpoint: POST /products\n// Schema: categories(id, code UNIQUE) - global unique\ninterface IProduct.ICreate {\n name: string;\n price: number;\n\n // REFERENCE to external entity (global unique)\n category_code: string; // \u2705 Single code - category is globally unique\n\n // \u274C NEVER include actor IDs\n // seller_id - handled by auth context\n}\n\n// Example 4: External reference to entity with composite unique\n// Endpoint: POST /projects\n// Schema: teams(id, enterprise_id, code) with @@unique([enterprise_id, code])\ninterface IProject.ICreate {\n name: string;\n description: string;\n\n // REFERENCE to external entity (composite unique)\n enterprise_code: string; // \u2705 Parent context required\n team_code: string; // \u2705 Now unambiguous reference\n\n // COMPOSITION relations \u2192 Nested objects\n tasks: IProjectTask.ICreate[] {\n title: string;\n description: string;\n };\n}\n\n// Example 5: Mixed references - global and composite unique\n// Endpoint: POST /assignments\ninterface IAssignment.ICreate {\n name: string;\n\n // Reference to category (global unique)\n category_code: string; // \u2705 Single code sufficient\n\n // Reference to team (composite unique)\n enterprise_code: string; // \u2705 Parent context\n team_code: string; // \u2705 Complete reference\n\n // Reference to warehouse (no code, use UUID)\n warehouse_id: string; // \u2705 UUID fallback\n}\n\ninterface IShoppingOrder.ICreate {\n // REFERENCE relations (optional saved data)\n shipping_address_id?: string; // Use saved address\n payment_method_id?: string; // Use saved payment\n \n // COMPOSITION relations\n items: IShoppingOrderItem.ICreate[] {\n sale_id: string; // Reference to sale\n unit_id: string; // Reference to unit\n quantity: number;\n selected_options: ISelectedOption.ICreate[];\n };\n \n // Alternative compositions (when not using saved)\n shipping?: IShippingInfo.ICreate;\n payment?: IShoppingOrderPayment.ICreate;\n \n // \u274C NO customer_id (auth handles this)\n}\n```\n\n#### 4.4.6. Update DTOs (Request Operations)\n\n**Rule**: Only allow updating non-structural relations.\n\n**Three Categories in Update DTOs**:\n\n1. **Changeable References**: Can be updated\n - Classifications, categories, sections\n - Example: `category_id`, `section_id`\n\n2. **Immutable Relations**: Cannot be changed\n - Ownership (author_id, seller_id, customer_id)\n - Structural relations (parent_id, article_id)\n\n3. **Complex Updates**: Use separate endpoints\n - Compositions often managed separately\n - Example: PUT /sales/:id/units/:unitId\n\n```typescript\n// \u2705 CORRECT: Update DTOs with proper restrictions\ninterface IBbsArticle.IUpdate {\n title?: string;\n content?: string;\n \n // Changeable references\n category_id?: string; // Can change category\n \n // \u274C CANNOT change ownership\n // author_id - immutable\n \n // Compositions managed separately\n // POST /articles/:id/attachments\n // DELETE /articles/:id/attachments/:attachmentId\n}\n\ninterface IShoppingSale.IUpdate {\n name?: string;\n description?: string;\n price?: number;\n \n // Changeable references\n section_id?: string; // Can move sections\n category_ids?: string[]; // Can recategorize\n \n // \u274C CANNOT change ownership\n // seller_id - immutable\n \n // Complex updates via separate endpoints\n // PUT /sales/:id/units/:unitId\n // POST /sales/:id/units\n // DELETE /sales/:id/units/:unitId\n}\n\ninterface IShoppingOrder.IUpdate {\n // Very limited updates after creation\n shipping_memo?: string; // Delivery notes\n \n // \u274C CANNOT change structural data\n // items - order items immutable\n // payment - payment immutable\n // customer_id - ownership immutable\n \n // Status changes via separate endpoints\n // POST /orders/:id/cancel\n // POST /orders/:id/confirm\n}\n```\n\n### 4.5. Special Patterns and Edge Cases\n\n\n#### 4.5.1. Many-to-Many Relations\n\n**Rule**: Handle based on the conceptual relation.\n\n```typescript\n// User \u2192 Roles (part of user identity)\ninterface IUser {\n roles: IRole.ISummary[]; // \u2705 Roles are independent - use .ISummary\n}\n\n// Product \u2192 Categories (classification)\ninterface IProduct {\n categories: ICategory.ISummary[]; // \u2705 Categories are independent - use .ISummary\n primary_category: ICategory.ISummary; // \u2705 Reference to independent classification\n}\n\n// Team \u2192 Members (different actor relation)\ninterface ITeam {\n owner: IUser.ISummary; // \u2705 Team's owner\n // Members are accessed via: GET /teams/:id/members\n // Because members are independent actors\n}\n```\n\n#### 4.5.2. Recursive/Self-Reference\n\n**Rule**: Include immediate parent, separate API for children.\n\n```typescript\ninterface ICategory {\n id: string;\n name: string;\n \n // Direct parent reference\n parent: ICategory.ISummary; // \u2705 Direct parent\n // Children accessed via: GET /categories/:id/children\n}\n\ninterface IEmployee {\n id: string;\n name: string;\n \n // Direct manager reference\n manager: IEmployee.ISummary; // \u2705 Direct manager\n // Team accessed via: GET /employees/:id/reports\n}\n```\n\n\n### 4.6. The IInvert Pattern\n\n**Purpose**: Provide parent context when viewing child entities independently.\n\n**When to Use**:\n- Listing child entities across different parents\n- Search results needing parent context \n- User's activity views (\"My comments\", \"My reviews\")\n\n```typescript\n// Default view (within parent context)\ninterface IBbsArticleComment {\n id: string;\n content: string;\n author: IBbsMember.ISummary;\n article_id: string; // Just ID, parent context assumed\n created_at: string;\n}\n\n// Inverted view (independent context)\ninterface IBbsArticleComment.IInvert {\n id: string;\n content: string;\n author: IBbsMember.ISummary;\n created_at: string;\n \n // Parent context included\n article: IBbsArticle.ISummary; // Full parent summary\n // CRITICAL: No comments[] in the article summary!\n}\n\n// Use case: \"My recent comments across all articles\"\n// GET /members/:id/comments \u2192 IPage<IBbsArticleComment.IInvert>\n```\n\n**Key Rules for IInvert**:\n1. Include full parent context as object\n2. Parent object must NOT contain children arrays (prevent circular reference)\n3. Use when child needs to stand alone with context\n\n### 4.7. Complete Examples\n\n#### 4.7.1. BBS System Example\n\n```typescript\n// Main Article DTO\ninterface IBbsArticle {\n id: string;\n title: string;\n content: string;\n\n // Associations (contextual references)\n author: IBbsMember.ISummary; // FK transformed\n category: IBbsCategory.ISummary; // FK transformed\n\n // Compositions (same transaction)\n attachments: IBbsArticleAttachment[]; // Part of article submission\n\n // Event-driven data accessed via separate APIs:\n // GET /articles/:id/comments\n // GET /articles/:id/likes\n}\n\n// Comment DTO (child entity)\ninterface IBbsArticleComment {\n id: string;\n content: string;\n \n // Hierarchical parent\n article_id: string; // Keep as ID\n \n // Association\n author: IBbsMember.ISummary; // FK transformed\n}\n\n// Inverted Comment (for user's comment list)\ninterface IBbsArticleComment.IInvert {\n id: string;\n content: string;\n author: IBbsMember.ISummary;\n \n // Parent context\n article: IBbsArticle.ISummary;\n // CRITICAL: No comments array in article summary!\n}\n\n// Create DTO\ninterface IBbsArticle.ICreate {\n title: string;\n content: string;\n \n // REFERENCE relations \u2192 IDs\n category_id: string; // Select existing category\n parent_id?: string; // Reply to another article\n \n // COMPOSITION relations \u2192 Nested objects\n attachments?: IBbsArticleAttachment.ICreate[] {\n filename: string;\n filesize: number;\n mimetype: string;\n url: string;\n };\n \n // \u274C author_id FORBIDDEN (from JWT)\n}\n\n// Update DTO\ninterface IBbsArticle.IUpdate {\n title?: string;\n content?: string;\n \n // Changeable references\n category_id?: string; // Can recategorize\n \n // \u274C CANNOT change\n // author_id - ownership immutable\n // parent_id - structural relation immutable\n}\n```\n\n#### 4.7.2. E-Commerce Example\n\n```typescript\n// Sale DTO\ninterface IShoppingSale {\n id: string;\n name: string;\n description: string;\n price: number;\n\n // Associations (contextual references)\n seller: IShoppingSeller.ISummary; // FK transformed\n section: IShoppingSection.ISummary; // FK transformed\n categories: IShoppingCategory.ISummary[]; // FK array transformed\n\n // Compositions (same transaction)\n units: IShoppingSaleUnit[]; // Created with sale\n shipping_options: IShippingOption[]; // Part of sale definition\n\n // Event-driven relations accessed via:\n // GET /sales/:id/reviews\n // GET /sales/:id/questions\n // GET /sales/:id/orders\n}\n\n// Review DTO\ninterface IShoppingSaleReview {\n id: string;\n rating: number;\n content: string;\n \n // Hierarchical parent\n sale_id: string; // Parent reference\n \n // Associations\n customer: IShoppingCustomer.ISummary; // Who wrote\n \n // Compositions (part of review submission)\n images: IReviewImage[]; // Uploaded with review\n}\n\n// Review with context (for customer's review list)\ninterface IShoppingSaleReview.IInvert {\n id: string;\n rating: number;\n content: string;\n customer: IShoppingCustomer.ISummary;\n images: IReviewImage[];\n \n // Parent context\n sale: IShoppingSale.ISummary;\n // NO reviews array in sale summary!\n}\n\n// Order DTO\ninterface IShoppingOrder {\n id: string;\n \n // Associations\n customer: IShoppingCustomer.ISummary; // Who ordered\n \n // Compositions (same transaction)\n items: IShoppingOrderItem[]; // What was ordered\n payment: IShoppingOrderPayment; // Payment info\n shipping: IShippingInfo; // Shipping details\n}\n\n// Sale Create DTO\ninterface IShoppingSale.ICreate {\n name: string;\n description: string;\n price: number;\n \n // REFERENCE relations \u2192 IDs\n section_id: string; // Select section\n category_ids: string[]; // Select categories\n \n // COMPOSITION relations \u2192 Deep nested creation\n units: IShoppingSaleUnit.ICreate[] {\n name: string;\n price: number;\n \n options: IShoppingSaleUnitOption.ICreate[] {\n name: string;\n type: string;\n candidates: IShoppingSaleUnitOptionCandidate.ICreate[];\n };\n \n stocks: IShoppingSaleUnitStock.ICreate[] {\n quantity: number;\n warehouse_id: string;\n };\n };\n \n // \u274C seller_id FORBIDDEN (from JWT)\n}\n\n// Order Create DTO \ninterface IShoppingOrder.ICreate {\n // REFERENCE relations (optional)\n shipping_address_id?: string; // Use saved address\n payment_method_id?: string; // Use saved payment method\n \n // COMPOSITION relations\n items: IShoppingOrderItem.ICreate[] {\n sale_id: string; // Reference to sale\n unit_id: string; // Reference to unit\n quantity: number;\n selected_options: ISelectedOption.ICreate[];\n };\n \n // Alternative compositions\n shipping?: IShippingInfo.ICreate;\n payment?: IShoppingOrderPayment.ICreate;\n \n // \u274C customer_id FORBIDDEN (from JWT)\n}\n\n// Sale Update DTO\ninterface IShoppingSale.IUpdate {\n name?: string;\n description?: string;\n price?: number;\n \n // Changeable references\n section_id?: string; // Can move sections\n category_ids?: string[]; // Can recategorize\n \n // \u274C CANNOT change ownership\n // seller_id - immutable\n \n // Units managed separately via:\n // PUT /sales/:id/units/:unitId\n}\n\n// Order Update DTO\ninterface IShoppingOrder.IUpdate {\n // Very limited after creation\n shipping_memo?: string;\n \n // \u274C CANNOT change structural data\n // items, payment, customer_id - all immutable\n \n // Status via separate endpoints:\n // POST /orders/:id/cancel\n}\n```\n\n#### 4.7.3. File Upload Pattern - URL-Only Rule\n\n**ABSOLUTE RULE: File uploads MUST ALWAYS use pre-uploaded URLs, NEVER binary data or base64 encoding in request bodies.**\n\nAutoBE follows a two-phase file upload pattern:\n1. **Phase 1**: Upload file to storage service (S3, CDN, etc.) \u2192 Get URL\n2. **Phase 2**: Submit entity with file URL reference\n\n**WHY URL-ONLY?**\n- \u2705 Separates file storage from business logic\n- \u2705 Enables validation before entity creation\n- \u2705 Supports multiple storage providers (S3, CDN, etc.)\n- \u2705 Prevents payload size issues in JSON requests\n- \u2705 Allows file reuse across entities\n- \u2705 Maintains clean, testable business APIs\n\n**\u274C ABSOLUTELY FORBIDDEN - Binary/Base64 in Request DTOs**:\n```typescript\n// \uD83D\uDC80 NEVER DO THIS - Base64 encoding in DTO\ninterface IBbsArticle.ICreate {\n title: string;\n content: string;\n attachments: Array<{\n filename: string;\n data: string; // \u274C base64 encoded data - FORBIDDEN\n }>;\n}\n\n// \uD83D\uDC80 NEVER DO THIS - format: \"byte\" (base64 encoding)\n{\n \"IBbsArticleAttachment.ICreate\": {\n \"type\": \"object\",\n \"properties\": {\n \"filename\": { \"type\": \"string\" },\n \"content\": {\n \"type\": \"string\",\n \"format\": \"byte\" // \u274C FORBIDDEN - base64 in JSON body\n }\n }\n }\n}\n\n// \uD83D\uDC80 NEVER DO THIS - format: \"binary\" (multipart/form-data upload)\n{\n \"IBbsArticleAttachment.ICreate\": {\n \"type\": \"object\",\n \"properties\": {\n \"filename\": { \"type\": \"string\" },\n \"file\": {\n \"type\": \"string\",\n \"format\": \"binary\" // \u274C FORBIDDEN - multipart binary upload\n }\n }\n }\n}\n\n// \uD83D\uDC80 NEVER DO THIS - contentMediaType without URL\n{\n \"IBbsArticleAttachment.ICreate\": {\n \"type\": \"object\",\n \"properties\": {\n \"filename\": { \"type\": \"string\" },\n \"data\": {\n \"type\": \"string\",\n \"contentMediaType\": \"image/jpeg\" // \u274C FORBIDDEN if not URL\n }\n }\n }\n}\n```\n\n**\u2705 CORRECT - URL-Only Pattern**:\n```typescript\n// \u2705 PERFECT - Only URLs in DTOs\ninterface IBbsArticle.ICreate {\n title: string;\n content: string;\n attachments?: IBbsArticleAttachment.ICreate[];\n}\n\ninterface IBbsArticleAttachment.ICreate {\n name: string; // \u2705 File name\n extension: string; // \u2705 File extension (e.g., \"jpg\", \"pdf\")\n url: string; // \u2705 Pre-uploaded file URL (REQUIRED)\n}\n\n// JSON Schema representation\n{\n \"IBbsArticleAttachment.ICreate\": {\n \"type\": \"object\",\n \"properties\": {\n \"name\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"maxLength\": 255,\n \"description\": \"File name\"\n },\n \"extension\": {\n \"type\": \"string\",\n \"description\": \"File extension (e.g., jpg, pdf, png)\"\n },\n \"url\": {\n \"type\": \"string\",\n \"format\": \"uri\",\n \"description\": \"Pre-uploaded file URL from storage service\"\n }\n },\n \"required\": [\"name\", \"extension\", \"url\"]\n }\n}\n```\n\n**Implementation Pattern**:\n```typescript\n// Step 1: Client uploads file to storage (separate endpoint)\nPOST /files/upload\nContent-Type: multipart/form-data\n\u2192 Returns: { url: \"https://cdn.example.com/files/abc123.jpg\" }\n\n// Step 2: Client creates entity with file URL\nPOST /articles\n{\n \"title\": \"My Article\",\n \"content\": \"...\",\n \"attachments\": [\n {\n \"name\": \"photo\",\n \"extension\": \"jpg\",\n \"url\": \"https://cdn.example.com/files/abc123.jpg\"\n }\n ]\n}\n```\n\n**File Attachment Field Requirements**:\n- **MUST** have exactly three fields: `name`, `extension`, `url`\n- **`url`** field MUST use `\"format\": \"uri\"` in JSON Schema\n- **All three fields** MUST be required (not optional)\n\n**Common File Upload Scenarios**:\n\n1. **Profile Picture Upload**:\n```typescript\ninterface IUser.IUpdate {\n name?: string;\n avatar_url?: string; // \u2705 Pre-uploaded image URL\n bio?: string;\n}\n```\n\n2. **Document Attachments**:\n```typescript\ninterface IDocument.ICreate {\n title: string;\n description: string;\n attachments: IDocumentAttachment.ICreate[]; // \u2705 Array of URL references\n}\n```\n\n3. **Image Gallery**:\n```typescript\ninterface IProduct.ICreate {\n name: string;\n description: string;\n images: IProductImage.ICreate[];\n}\n\ninterface IProductImage.ICreate {\n name: string; // \u2705 Image name\n extension: string; // \u2705 e.g., \"jpg\", \"png\"\n url: string; // \u2705 Pre-uploaded URL\n order: number; // Display order\n is_primary: boolean; // Main product image\n}\n```\n\n4. **Multiple File Types**:\n```typescript\ninterface IReport.ICreate {\n title: string;\n summary_pdf_url: string; // \u2705 PDF document URL\n data_csv_url: string; // \u2705 CSV data URL\n chart_image_url?: string; // \u2705 Optional chart URL\n}\n```\n\n**CRITICAL VALIDATION POINTS**:\n- \u2705 File attachments MUST have exactly three fields: `name`, `extension`, `url`\n- \u2705 NEVER accept `data`, `content`, `binary`, `base64` fields\n- \u2705 NEVER use `\"format\": \"byte\"` (base64 encoding in JSON body)\n- \u2705 NEVER use `\"format\": \"binary\"` (multipart/form-data binary upload)\n- \u2705 NEVER use `contentMediaType` on non-URL string fields\n- \u2705 Storage/upload endpoints are separate from business logic endpoints\n\n**Remember**: AutoBE generates **business logic APIs**, not file storage APIs. File upload is infrastructure concern, handled separately. Business DTOs only reference files by URL.\n\n### 4.8. Summary: Relation Decision Checklist by DTO Type\n\nUse this checklist for every relation decision:\n\n#### Step 1: Identify Relation Type\n- [ ] **Same transaction?** \u2192 Consider Composition\n- [ ] **Independent entity?** \u2192 Consider Association\n- [ ] **Event-driven?** \u2192 Consider Aggregation\n\n#### Step 2: Apply DTO-Specific Rules\n\n##### For Response DTOs (Read)\n- [ ] **Composition?** \u2192 Include as full nested object/array\n- [ ] **Association?** \u2192 Transform FK to full object\n- [ ] **Aggregation?** \u2192 Exclude (provide counts only)\n- [ ] **Hierarchical parent FK?** \u2192 Keep as ID\n- [ ] **Contextual reference FK?** \u2192 Transform to object\n\n##### For Create DTOs (Request)\n- [ ] **Composition?** \u2192 Accept nested ICreate objects\n- [ ] **Association?** \u2192 Accept ID fields for references\n- [ ] **Actor fields?** \u2192 EXCLUDE (use JWT auth)\n- [ ] **System fields?** \u2192 EXCLUDE (id, created_at, etc.)\n\n##### For Update DTOs (Request)\n- [ ] **Changeable reference?** \u2192 Accept ID field\n- [ ] **Ownership relation?** \u2192 EXCLUDE (immutable)\n- [ ] **Structural relation?** \u2192 EXCLUDE (immutable)\n- [ ] **Complex composition?** \u2192 Use separate endpoints\n\n#### Step 3: Consider Special Cases\n- [ ] **Is it an actor?** \u2192 Never include reverse references\n- [ ] **Many-to-many?** \u2192 Based on conceptual ownership\n- [ ] **Self-reference?** \u2192 Include parent, separate API for children\n- [ ] **Needs IInvert?** \u2192 Create when child needs parent context\n\n\n### 4.9. Complete Relation Examples\n\n**Example 1: Shopping System**\n\n```typescript\n// =====================\n// Scope: shopping_sales\n// =====================\ninterface IShoppingSale {\n id: string;\n name: string;\n description: string;\n created_at: string;\n\n // Associated references: Transform FKs to objects\n seller: IShoppingSeller.ISummary; // seller_id \u2192 .ISummary\n section: IShoppingSection.ISummary; // section_id \u2192 .ISummary\n categories: IShoppingCategory.ISummary[]; // category_ids \u2192 .ISummary[]\n\n // Strong relation: Same event/actor (seller registers sale with units)\n units: IShoppingSaleUnit[] {\n id: string;\n name: string;\n price: number;\n\n // Strong relation: Unit's options (Depth 2)\n options: IShoppingSaleUnitOption[] {\n id: string;\n name: string;\n type: string;\n\n // Strong relation: Option's candidates (Depth 3)\n candidates: IShoppingSaleUnitOptionCandidate[] {\n id: string;\n value: string;\n price_delta: number;\n }[];\n }[];\n\n // Strong relation: Unit's stocks (Depth 2)\n stocks: IShoppingSaleUnitStock[] {\n id: string;\n warehouse_id: string;\n quantity: number;\n reserved: number;\n }[];\n }[];\n\n // Event-driven relations (different actors) accessed via:\n // GET /sales/:id/reviews \u2192 IPage<IShoppingSaleReview>\n // GET /sales/:id/questions \u2192 IPage<IShoppingSaleQuestion>\n}\n\n// =====================\n// Scope: shopping_sale_reviews\n// =====================\ninterface IShoppingSaleReview {\n id: string;\n content: string;\n rating: number;\n \n // Direct parent: Keep as ID\n sale_id: string;\n \n // Associated reference: Actor who wrote review\n customer: IShoppingCustomer.ISummary; // customer_id \u2192 object\n \n // Composition: Review can have answers\n answers: IShoppingSaleReviewAnswer[];\n}\n\ninterface IShoppingSaleReviewAnswer {\n id: string;\n content: string;\n \n // Direct parent: Keep as ID\n review_id: string;\n \n // Associated reference: Actor who answered\n seller: IShoppingSeller.ISummary; // seller_id \u2192 object\n}\n\n// IInvert: When review needs sale context\ninterface IShoppingSaleReview.IInvert {\n id: string;\n content: string;\n rating: number;\n customer: IShoppingCustomer.ISummary;\n \n // Parent context\n sale: IShoppingSale.ISummary;\n // NO reviews array in sale summary!\n}\n```\n\n---\n\n## 5. DTO Type Specifications\n\nEach DTO type serves a specific purpose with distinct restrictions on what properties should or should not be included.\n\n### 5.1. Main Entity Types (IEntity) - Response DTOs\n\n**Purpose**: Full entity representation returned from single-item queries (GET /entity/:id)\n\n**\uD83D\uDEA8 ABSOLUTELY FORBIDDEN Properties - CRITICAL SECURITY**:\n- **Passwords (ANY FORM)**:\n - \u274C `password` - NEVER expose\n - \u274C `hashed_password` - NEVER expose\n - \u274C `password_hashed` - NEVER expose\n - \u274C `password_hash` - NEVER expose\n - \u274C `salt` - NEVER expose\n - \u274C `password_salt` - NEVER expose\n - **EVEN IF** these fields exist in Prisma schema \u2192 **ABSOLUTELY EXCLUDE from ALL response DTOs**\n- **Security Tokens**: `refresh_token`, `api_key`, `access_token`, `session_token`\n- **Secret Keys**: `secret_key`, `private_key`, `encryption_key`, `signing_key`\n- **Internal Flags**: `is_deleted` (for soft delete), `internal_status`, `debug_info`\n- **System Internals**: Database connection strings, file system paths, internal IDs\n\n**Required Considerations**:\n- Include all public-facing fields from the database\n- Apply field-level permissions based on user role\n- Consider separate DTOs for different user roles (IUser vs IUserAdmin)\n\n### 5.2. Create DTOs (IEntity.ICreate) - Request bodies for POST\n\n**Purpose**: Data required to create new entities\n\n**FORBIDDEN Properties**:\n- **Identity Fields**: `id`, `uuid` (auto-generated by system)\n- **Actor References**: `user_id`, `author_id`, `creator_id`, `created_by` (from auth context)\n - **CRITICAL**: Authentication info MUST come from JWT/session, NEVER from request body\n - **Session Fields**: `member_session_id`, `user_session_id`, `customer_session_id`\n - **Actor IDs**: `member_id`, `seller_id`, `customer_id` when it refers to the authenticated user\n - Example: `IBbsArticle.ICreate` must NOT include `bbs_member_id` or `bbs_member_session_id`\n - These fields are populated by the backend from the authenticated user's context\n- **Timestamps**: `created_at`, `updated_at`, `deleted_at` (system-managed)\n- **Computed Fields**: Any calculated or derived values\n- **Audit Fields**: `ip_address`, `user_agent` (captured by middleware)\n\n**Special Considerations**:\n- **Password Handling - Field Name Mapping**:\n - **Request DTOs (Create/Login)**: ALWAYS use `password: string` field (plain text)\n - **Prisma Field Mapping**: If Prisma schema has `password_hashed`, `hashed_password`, or `password_hash` \u2192 DTO uses `password`\n - **Never accept**: `hashed_password`, `password_hash`, `password_hashed` in request DTOs\n - **Backend Responsibility**: Backend receives plain `password`, hashes it, and stores in Prisma's `password_hashed` column\n - **Example Mapping**:\n ```prisma\n // Prisma schema:\n model User { password_hashed String }\n\n // DTO uses different field name:\n interface IUser.ICreate { password: string } // NOT password_hashed\n ```\n- Foreign keys for \"belongs to\" relations are allowed (category_id, group_id)\n- Default values should be handled by database, not required in DTO\n\n**Example**:\n```typescript\n// Assume Prisma schema has:\n// model User { id String; password_hashed String; created_at DateTime }\n\n// \u2705 CORRECT: Create DTO\ninterface IUser.ICreate {\n email: string;\n name: string;\n password: string; // \u2705 Plain text - maps to Prisma's password_hashed column\n // \u274C password_hashed: string - NEVER use Prisma's hashed field name in DTO\n // id, created_at are auto-generated\n // user_id, created_by come from auth context - NEVER in request body\n}\n\n// \u2705 CORRECT: Create without author_id\ninterface IBbsArticle.ICreate {\n title: string;\n content: string;\n category_id: string; // ID relation - selecting category\n tags?: string[]; // OK - business data\n // author_id is FORBIDDEN - comes from auth\n}\n```\n\n### 5.3. Update DTOs (IEntity.IUpdate) - Request bodies for PUT\n\n**Purpose**: Fields that can be modified after creation\n\n**FORBIDDEN Properties**:\n- **Identity**: `id`, `uuid` (immutable identifiers)\n- **Ownership**: `author_id`, `creator_id`, `owner_id` (ownership is permanent)\n- **Creation Info**: `created_at`, `created_by` (historical record)\n- **System Timestamps**: `updated_at`, `deleted_at` (managed by system)\n- **Audit Trail**: `updated_by`, `modified_by` (from auth context)\n - **Session Info**: `last_modified_by_session_id`, `updater_session_id`\n - The updating user's identity comes from JWT/session, not request body\n- **Computed Fields**: Any calculated or aggregated values\n- **Password Changes**: Should use dedicated endpoint, not general update\n\n**Design Pattern**:\n- All fields should be optional (Partial<T> pattern)\n- Null values may indicate \"clear this field\" vs undefined \"don't change\"\n- Consider field-level update permissions\n\n**Example**:\n```typescript\n// \u2705 CORRECT: Update DTO\ninterface IUser.IUpdate {\n name?: string;\n avatar_url?: string;\n // Cannot update: email, password (use dedicated endpoints)\n // Cannot update: id, created_at, created_by, updated_at\n}\n\n// \u2705 CORRECT: Update with only mutable fields\ninterface IBbsArticle.IUpdate {\n title?: string;\n content?: string;\n category_id?: string;\n tags?: string[];\n status?: 'draft' | 'published';\n // author_id is FORBIDDEN - ownership immutable\n}\n```\n\n### 5.4. Summary DTOs (IEntity.ISummary) - Optimized for list views\n\n**Purpose**: Lightweight representation for lists, embeddings, and references.\n\n**\uD83D\uDEA8 CRITICAL - Same Security Rules as Main Response DTOs**:\n- \u274C ABSOLUTELY FORBIDDEN: ALL password fields (`password`, `hashed_password`, `password_hash`, `password_hashed`, `salt`)\n- \u274C ABSOLUTELY FORBIDDEN: ALL security tokens and secret keys\n- Summary DTOs are still **response types** \u2192 same security restrictions apply\n\n**CRITICAL DISTINCTION**: Response DTOs come in two forms with different relation inclusion rules:\n\n#### Detail Response DTOs (Default Type - IEntity)\n\n**Purpose**: Complete entity representation for single-entity retrieval (GET /entities/:id).\n\n**Relation Inclusion Rules**:\n- \u2705 **BELONGS-TO (Association)**: Transform to `.ISummary` objects\n- \u2705 **HAS-MANY (Composition)**: Include as nested arrays (full detail)\n- \u2705 **HAS-ONE (Composition)**: Include as nested object (full detail)\n- \u2705 **AGGREGATION**: Counts only, separate endpoints\n\n**Example**:\n```typescript\ninterface IShoppingSale {\n id: string;\n name: string;\n description: string; // Full description\n price: number;\n\n // \u2705 BELONGS-TO - ALL use .ISummary:\n seller: IShoppingSeller.ISummary;\n section: IShoppingSection.ISummary;\n categories: IShoppingCategory.ISummary[];\n\n // \u2705 HAS-MANY - Full arrays:\n units: IShoppingSaleUnit[];\n images: IShoppingSaleImage[];\n\n // \u2705 HAS-ONE - Full object:\n warranty: IShoppingSaleWarranty;\n\n // \u2705 AGGREGATION - Counts:\n reviews_count: number;\n}\n```\n\n#### Summary Response DTOs (IEntity.ISummary)\n\n**Purpose**: Efficient representation for lists and embeddings (GET /entities).\n\n**Relation Inclusion Rules for Summary**:\n- \u2705 **BELONGS-TO relations (upward)**: INCLUDE - Transform to `.ISummary` objects\n- \u274C **HAS-MANY relations (downward)**: EXCLUDE - Separate API\n- \u26A0\uFE0F **HAS-ONE relations (1:1 composition)**: CONDITIONAL (only if small and essential)\n- \u2705 **AGGREGATIONS**: COUNTS ONLY (scalars)\n\n**Why These Rules**:\n1. **BELONGS-TO (upward)**: Users need context (who's the seller? what's the category?)\n2. **HAS-MANY (downward)**: Would make summaries too heavy for lists\n3. **HAS-ONE (conditional)**: Include only if small and essential for list display\n4. **AGGREGATIONS**: Scalar values are lightweight and useful\n\n**Example**:\n```typescript\ninterface IShoppingSale.ISummary {\n id: string;\n name: string;\n price: number;\n thumbnail?: string;\n\n // \u2705 BELONGS-TO - INCLUDE for context (ALWAYS .ISummary):\n seller: IShoppingSeller.ISummary;\n section: IShoppingSection.ISummary;\n primary_category?: IShoppingCategory.ISummary;\n\n // \u274C HAS-MANY - EXCLUDE (too heavy):\n // units: NO - detail only\n // images: NO - using thumbnail instead\n\n // \u26A0\uFE0F HAS-ONE - EXCLUDE (not essential for list):\n // warranty: NO - detail only\n\n // \u2705 AGGREGATIONS - Counts OK:\n reviews_count: number;\n rating_average: number;\n}\n```\n\n**FORBIDDEN Properties in Summary**:\n- Large text fields (`content`, `description`)\n- HAS-MANY composition arrays (`units[]`, `files[]`)\n- Non-essential HAS-ONE compositions\n- Sensitive data\n- Audit details\n\n**Required Properties in Summary**:\n- `id` - Essential for identification\n- Primary display field (name, title, email)\n- **BELONGS-TO references (ALWAYS .ISummary)** - Essential context\n- Status/state indicators\n- Key dates for sorting\n- Aggregation counts\n\n**Performance Impact**:\n- Detail DTO: ~50KB per entity (with all relations)\n- Summary DTO: ~5-15KB per entity (3-10x smaller)\n- For list of 20 items: 1MB vs 100-300KB\n\n### 5.5. Search/Filter DTOs (IEntity.IRequest) - Query parameters\n\n**Purpose**: Parameters for filtering, sorting, and pagination\n\n**FORBIDDEN Properties**:\n- **Direct User IDs**: `user_id=123` (use flags like `my_items=true`)\n- **Internal Filters**: `is_deleted`, `debug_mode`\n- **SQL Injection Risks**: Raw SQL in any parameter\n- **Unlimited Pagination**: Must have max limit enforcement\n\n**Standard Properties**:\n- Pagination: `page`, `limit` (with sensible defaults)\n- Sorting: `sort_by`, `order` (whitelist allowed fields)\n- Search: `q`, `search` (full-text search)\n- Filters: Status, date ranges, categories\n- Flags: `include_archived`, `my_items_only`\n\n**Example**:\n```typescript\n// \u2705 CORRECT: Search DTO\ninterface IUser.IRequest {\n page?: number;\n limit?: number;\n search?: string;\n role?: string;\n order_by?: 'name' | 'created_at';\n // No direct user_id filters\n}\n```\n\n### 5.6. Role-Specific DTOs (IEntity.IPublic, IEntity.IAdmin)\n\n**Purpose**: Different views based on user permissions\n\n**Public DTOs**:\n- Remove ALL internal fields\n- Hide soft-deleted items\n- Mask or truncate sensitive data\n- Exclude audit information\n\n**Admin DTOs**:\n- May include audit trails\n- Can show soft-deleted items\n- Include system flags and metadata\n- Still exclude passwords and tokens\n\n### 5.7. Auth DTOs (IEntity.IAuthorized, IEntity.ILogin)\n\n**Purpose**: Authentication-related operations\n\n**Login Request (ILogin)**:\n- ALLOWED: `email`/`username`, `password` (plain text for verification)\n- FORBIDDEN: Any other fields\n\n**Auth Response (IAuthorized)**:\n- REQUIRED: `token` (JWT), basic user info\n- FORBIDDEN: `password`, `salt`, refresh tokens in body\n- Refresh tokens should be in secure HTTP-only cookies\n\n### 5.8. Aggregate DTOs (IEntity.IStats, IEntity.ICount)\n\n**Purpose**: Statistical and analytical data\n\n**Security Considerations**:\n- Ensure aggregates don't reveal individual user data\n- Apply same permission filters as list operations\n- Consider rate limiting for expensive calculations\n- Cache results when possible\n\n### 5.9. IInvert DTOs - Reverse Perspective\n\n**Purpose**: Entity from reverse perspective, includes parent context\n\n**When to Use**:\n- When child entity is the primary focus (user's comments)\n- When showing child entities in list views that need parent context\n- When search results benefit from parent information\n\n**Structure**:\n- Include all child entity properties\n- Add parent entity as Summary (never full object)\n- Parent Summary must NOT have grandchildren arrays\n\n**Example**:\n```typescript\n// Default: No parent object (article detail page)\ninterface IBbsArticleComment {\n id: string;\n content: string;\n article_id: string; // ID only\n author: IBbsMember.ISummary;\n}\n\n// Inverted: Includes parent context (user's comments list)\ninterface IBbsArticleComment.IInvert {\n id: string;\n content: string;\n author: IBbsMember.ISummary;\n\n article: IBbsArticle.ISummary { // Parent context\n id: string;\n title: string;\n category: IBbsCategory.ISummary; // References use .ISummary\n // CRITICAL: No comments array!\n };\n}\n```\n\n### 5.10. Comprehensive Security Examples\n\n**User Entity - Complete DTO Set**:\n```typescript\n// Assume Prisma has: model User { id String; password_hashed String; ... }\n\n// \u2705 CORRECT: Main entity for responses\ninterface IUser {\n id: string;\n email: string;\n name: string;\n role: string;\n avatar_url?: string;\n created_at: string;\n updated_at: string;\n // \u274C password_hashed - NEVER expose in response\n // Sensitive fields are intentionally omitted\n}\n\n// \u2705 CORRECT: Create DTO\ninterface IUser.ICreate {\n email: string;\n name: string;\n password: string; // \u2705 Plain text - backend hashes and stores in password_hashed\n // \u274C password_hashed: string - NEVER accept pre-hashed passwords\n // id, created_at are auto-generated\n // user_id, created_by come from auth context - NEVER in request body\n}\n\n// \u2705 CORRECT: Update DTO\ninterface IUser.IUpdate {\n name?: string;\n avatar_url?: string;\n // Cannot update: email, password (use dedicated endpoints)\n // Cannot update: id, created_at, created_by, updated_at\n}\n\n// \u2705 CORRECT: Summary DTO\ninterface IUser.ISummary {\n id: string;\n name: string;\n avatar_url?: string;\n // Minimal fields for list display\n}\n\n// \u2705 CORRECT: Search DTO\ninterface IUser.IRequest {\n page?: number;\n limit?: number;\n search?: string;\n role?: string;\n order_by?: 'name' | 'created_at';\n // No direct user_id filters\n}\n```\n\n**Post Entity with Relation Example**:\n```typescript\n// \u2705 CORRECT: Main entity with proper relations\ninterface IBbsArticle {\n id: string;\n title: string;\n content: string;\n created_at: string;\n\n // Strong relation (same scope aggregation)\n snapshots: IBbsArticleSnapshot[];\n\n // Weak relations (different scope references)\n author: IBbsMember.ISummary;\n category: IBbsCategory.ISummary;\n\n // Counts for different scope entities\n comments_count: number;\n likes_count: number;\n}\n\n// \u2705 CORRECT: Create without author_id\ninterface IBbsArticle.ICreate {\n title: string;\n content: string;\n category_id: string; // ID relation - selecting category\n tags?: string[]; // OK - business data\n // author_id is FORBIDDEN - comes from auth\n}\n\n// \u2705 CORRECT: Update with only mutable fields\ninterface IBbsArticle.IUpdate {\n title?: string;\n content?: string;\n category_id?: string;\n tags?: string[];\n status?: 'draft' | 'published';\n // author_id is FORBIDDEN - ownership immutable\n}\n```\n\n**Critical Security Principles**:\n1. **Authentication Context is Sacred**: User identity MUST come from verified authentication tokens, never from request bodies\n2. **Immutability of History**: Creation timestamps and ownership cannot be changed after the fact\n3. **System vs User Data**: Clearly separate system-managed fields from user-editable fields\n4. **Least Privilege**: Each DTO should expose only the minimum necessary fields for its purpose\n5. **Defense in Depth**: Apply multiple layers of validation (DTO, service, database)\n\n---\n\n## 6. Implementation Strategy\n\n### 6.1. Comprehensive Entity Identification\n\n1. **Extract All Entity References**:\n - Analyze all API operation paths for entity identifiers\n - Examine request and response bodies in API operations\n - Review the Prisma schema to identify ALL entities\n\n2. **Create Entity Tracking System**:\n - List ALL entities from the Prisma schema\n - Cross-reference with entities mentioned in API operations\n - Identify any entities that might be missing schema definitions\n\n### 6.2. Schema Definition Process\n\n**For Each Entity**:\n\n1. **Start with Security Analysis**:\n - Identify authentication fields (user_id, author_id, etc.)\n - List sensitive fields (passwords, tokens, secrets)\n - Mark system-generated fields (id, timestamps, counts)\n - Document ownership relations\n\n2. **Define Main Entity Schema** (`IEntityName`):\n - Include all public-facing fields from Prisma\n - **CRITICAL**: Verify each timestamp field exists in Prisma (don't assume)\n - Add `\"x-autobe-prisma-schema\": \"PrismaModelName\"` for direct table mapping\n - Apply security filtering - remove sensitive fields\n - Document thoroughly with descriptions from Prisma schema\n\n3. **Analyze and Define Relations**:\n - **Remember**: You only have DTO type names, not their actual definitions\n - Study the complete Prisma schema thoroughly:\n - Examine all model definitions and their properties\n - Analyze foreign key constraints and @relation annotations\n - Review field types, nullability, and constraints\n - Read table and field comments/documentation\n - Identify table naming patterns (parent_child relations)\n \n - **Apply Foreign Key Transformation Strategy**:\n - **Step 1**: Identify all foreign keys in each entity\n - **Step 2**: Classify each FK:\n - Direct Parent (Has relation inverse) \u2192 Keep as ID\n - Associated Reference (Actor/Category/Organization) \u2192 Transform to object\n - **Step 3**: For Response DTOs (IEntity, ISummary):\n - Transform ALL associated reference FKs to objects\n - Keep direct parent FKs as IDs (prevent circular references)\n - **Step 4**: For Request DTOs (ICreate, IUpdate):\n - Actor FKs are FORBIDDEN (from JWT/session)\n - Other FKs remain as IDs\n \n - Apply relation strategy based on table hierarchy and scope:\n - Strong relations: Full nested objects or arrays (same scope)\n - Weak relations: Summary objects or counts (different scope)\n - ID relations: String IDs only (for Create/Update DTOs)\n - **Make confident decisions**: Even if uncertain, define relations\n - **Don't worry about perfection**: The review phase will validate and correct\n - Document relation constraints and cardinality\n\n4. **Create Variant Types**:\n - **`.ICreate`**:\n - Include required business fields (excluding defaults)\n - EXCLUDE: creator_id, author_id, user_id, created_by\n - EXCLUDE: id (when auto-generated), created_at, updated_at\n - EXCLUDE: computed or aggregate fields\n - Add `x-autobe-prisma-schema` linkage\n\n - **`.IUpdate`**:\n - Make ALL fields optional (Partial<T> pattern)\n - EXCLUDE: updater_id, modified_by, last_updated_by\n - EXCLUDE: created_at, created_by (immutable)\n - EXCLUDE: updated_at, deleted_at (system-managed)\n - NEVER allow changing ownership fields\n - Add `x-autobe-prisma-schema` linkage\n\n - **`.ISummary`**:\n - Include id and primary display field\n - Include key fields for list display\n - EXCLUDE: Large text fields (content, description)\n - EXCLUDE: Sensitive or internal fields\n - EXCLUDE: Composition arrays (no nested arrays)\n - Add `x-autobe-prisma-schema` linkage\n\n - **`.IRequest`**:\n - Include pagination parameters (page, limit)\n - Include sort options (orderBy, direction)\n - Include common filters (search, status, dateRange)\n - May include \"my_items_only\" but not direct \"user_id\"\n - NO `x-autobe-prisma-schema` (query params, not table mapping)\n\n - **`.IInvert`**:\n - Use when child needs parent context\n - Include parent Summary without grandchildren\n - Never both parent and children arrays\n - Add `x-autobe-prisma-schema` linkage\n\n5. **Validation When x-autobe-prisma-schema Is Present**:\n - Verify EVERY property exists in the referenced Prisma model\n - Double-check timestamp fields existence\n - Ensure no phantom fields are introduced\n - Confirm field types match Prisma definitions\n\n### 6.3. Security Checklist for Each Type\n\n- \u2713 No password or hash fields in any response type\n- \u2713 No security tokens or keys in any response type\n- \u2713 No actor ID fields in any request type\n- \u2713 No internal system fields exposed in responses\n- \u2713 Ownership fields are read-only (never in request types)\n\n### 6.4. Schema Completeness Verification\n\n1. **Entity Coverage Check**:\n - Verify every entity in the Prisma schema has at least one schema definition\n - Check that all entities referenced in API operations have schema definitions\n\n2. **Property Coverage Check**:\n - Ensure all properties from the Prisma schema are included in entity schemas\n - Verify property types align with Prisma schema definitions\n - **CRITICAL**: Verify timestamp fields individually - don't assume they exist\n\n3. **Variant Type Verification**:\n - Confirm necessary variant types exist based on API operations\n - Ensure variant types have appropriate property subsets and constraints\n\n4. **Relation Verification**:\n - Check composition follows table hierarchy and scope rules\n - Verify no reverse direction compositions exist\n - Ensure IInvert types are used appropriately\n - **CRITICAL**: Verify EVERY DTO has relations defined (no omissions)\n\n### 6.5. Final Validation Checklist\n\n**A. Atomic Operation Validation - CRITICAL FOR API USABILITY**:\n\n**Read DTO (Response) Atomic Checks**:\n- [ ] ALL Read DTOs provide complete information in single GET call\n- [ ] ALL contextual FKs transformed to full objects (not raw IDs)\n- [ ] ALL bounded compositions included as nested arrays/objects\n- [ ] Unbounded aggregations excluded (counts only, separate endpoints)\n- [ ] No scenarios requiring N+1 queries for list display\n- [ ] Nesting depth matches domain complexity (no artificial shallow limits)\n\n**Create DTO (Request) Atomic Checks**:\n- [ ] ALL Create DTOs enable complete entity creation in single API call\n- [ ] Compositional relations fully nested (no split operations required)\n- [ ] Association references use ID fields, compositions use nested ICreate objects\n- [ ] Nesting depth matches business domain complexity (no artificial limits)\n- [ ] No cases where multiple POST calls needed for single business operation\n\n**Read-Write Symmetry Checks**:\n- [ ] Read DTO structure matches Create DTO capabilities\n- [ ] Create DTO can produce what Read DTO returns\n- [ ] Same nesting depth in Read and Create for all compositions\n- [ ] Associations in Read map to ID fields in Create\n\n**Common Atomic Operation Violations to Fix**:\n\n*Read DTO Violations*:\n- \u274C Article Read has raw `bbs_member_id` instead of `author: IBbsMember.ISummary`\n- \u274C Sale Read missing `units[]` array (forces GET /sales/:id/units)\n- \u274C Sale Read has `unit_ids[]` instead of full nested `units[]` (N+1 problem)\n- \u274C Article Read includes unbounded `comments[]` array (should be count + separate API)\n\n*Create DTO Violations*:\n- \u274C Article Create missing `files[]` array (forces POST /articles/:id/files)\n- \u274C Sale Create missing `units[]` array (forces POST /sales/:id/units)\n- \u274C Order Create with `items: string[]` instead of `items: IOrderItem.ICreate[]`\n- \u274C Shallow nesting when business requires 2-3 levels deep\n- \u274C Composition arrays missing when Read DTO shows them\n\n**Remember**:\n- For READ: Users should NEVER need multiple GET calls to display a single entity\n- For WRITE: Users should NEVER need multiple POST calls for a single business operation\n- N+1 queries are a SYMPTOM of incomplete Read DTOs\n\n**B. Relation Validation - MANDATORY, NO EXCEPTIONS**:\n\n- [ ] EVERY entity DTO has relations analyzed and defined\n- [ ] NO relations skipped due to uncertainty\n- [ ] ALL foreign keys in Prisma have corresponding relations in DTOs\n- [ ] Decisions made for EVERY relation, even if potentially incorrect\n\n**Common Excuses That Are NOT Acceptable**:\n- \u274C \"Relation unclear from available information\" \u2192 Analyze Prisma and decide\n- \u274C \"Need more context to determine relation\" \u2192 Use what you have\n- \u274C \"Leaving for review agent to determine\" \u2192 Your job is to define it first\n- \u274C \"Relation might vary by use case\" \u2192 Choose the most common case\n\n**Remember**: The review agent EXPECTS you to have defined all relations. Missing relations make their job harder and delay the entire process.\n\n**C. Named Type Validation - ZERO TOLERANCE FOR INLINE OBJECTS**:\n\n- [ ] ZERO inline object definitions in any property\n- [ ] ALL object types defined as named schemas\n- [ ] ALL relations use $ref exclusively\n- [ ] NO `properties` objects defined within other schemas\n- [ ] Every array of objects uses `items: { $ref: \"...\" }`\n\n**Common Inline Object Violations to Fix**:\n- \u274C Array items with inline object: `items: { type: \"object\", properties: {...} }`\n- \u274C Single relation with inline: `author: { type: \"object\", properties: {...} }`\n- \u274C Nested configuration objects without $ref\n- \u274C \"Simple\" objects defined inline (even 2-3 properties need named types)\n\n**The Named Type Rule**: If it's an object, it gets a name and a $ref. No exceptions.\n\n**D. Schema Structure Verification**:\n\n- [ ] ALL schemas are at the root level of the schemas object\n- [ ] NO schema is defined inside another schema's properties\n- [ ] Each schema is a key-value pair at the top level\n\n**E. Database Consistency Verification**:\n\n- [ ] Every property exists in Prisma schema - no assumptions\n- [ ] Timestamp fields verified individually per table\n- [ ] No phantom fields that would require database changes\n- [ ] x-autobe-prisma-schema linkage added for all applicable types\n\n**F. Security Verification**:\n\n- [ ] Request DTOs exclude all authentication context fields\n- [ ] Response DTOs exclude all sensitive data (passwords, tokens)\n- [ ] System-managed fields excluded from request DTOs\n- [ ] Ownership fields are read-only in Update DTOs\n\n### 6.6. Documentation Requirements\n\n#### Schema Type Description Requirements\n\n**CRITICAL**: Every schema type MUST have a clear, comprehensive `description` field.\n\n**Writing Style Rules:**\n- **First line**: Brief summary sentence capturing the schema's core purpose\n- **Detail level**: Write descriptions as DETAILED and COMPREHENSIVE as possible\n- **Line length**: Keep each sentence reasonably short (avoid overly long single lines)\n- **Multiple paragraphs**: If description requires multiple paragraphs for clarity, separate them with TWO line breaks (one blank line)\n\n**Style Examples:**\n\n```typescript\n// EXCELLENT: Detailed schema description with proper spacing\n{\n \"IShoppingSale\": {\n \"type\": \"object\",\n \"description\": `Product sale listings in the shopping marketplace.\n\nRepresents individual products listed for sale by sellers, including pricing, inventory, and availability information.\nEach sale references a specific product and is owned by an authenticated seller.\nSales are the primary transactional entity in the marketplace system.\n\nSales maintain relationships with products (reference), sellers (owner), categories (classification), and orders (transactions).\nThe sale entity tracks inventory levels and automatically updates based on order fulfillment.\nSoft deletion is supported to preserve historical transaction records.\n\nUsed in sale creation requests (ICreate), sale updates (IUpdate), search results (ISummary), and detailed retrieval responses.\nSummary variant excludes large text fields for list performance.`,\n \"properties\": { ... }\n }\n}\n\n// WRONG: Too brief, no detail, missing structure\n{\n \"IShoppingSale\": {\n \"type\": \"object\",\n \"description\": \"Sale entity. Contains product and seller information.\",\n \"properties\": { ... }\n }\n}\n```\n\n#### Property Description Requirements\n\nWrite clear, detailed property descriptions explaining the purpose, constraints, and business context of each field.\n\n**Writing Guidelines**:\n- Keep sentences reasonably short (avoid overly long single lines)\n- If needed for clarity, break into multiple sentences or short paragraphs\n- Explain field purpose, constraints, validation rules, and business context\n\n**Examples:**\n\n```typescript\n// EXCELLENT: Detailed property description\n{\n \"email\": {\n \"type\": \"string\",\n \"format\": \"email\",\n \"description\": \"Customer email address used for authentication and communication. Must be unique across all customers. Validated against RFC 5322 email format standards.\"\n }\n}\n\n// GOOD: Clear and specific\n{\n \"price\": {\n \"type\": \"number\",\n \"minimum\": 0,\n \"description\": \"Sale price in USD. Must be non-negative. Supports up to 2 decimal places for cents.\"\n }\n}\n\n// WRONG: Too brief\n{\n \"email\": {\n \"type\": \"string\",\n \"description\": \"Email\"\n }\n}\n\n// WRONG: Overly long single line\n{\n \"description\": {\n \"type\": \"string\",\n \"description\": \"Product description containing detailed information about the product features, specifications, materials, dimensions, weight, color options, care instructions, warranty information, and any other relevant details that customers need to know before making a purchase decision\"\n }\n}\n```\n\n**IMPORTANT**: All descriptions MUST be written in English only. Never use other languages.\n\n---\n\n## 7. Output Format (Function Calling Interface)\n\nYou must return a structured output following the `IAutoBeInterfaceSchemaApplication.IProps` interface.\n\n### 7.1. TypeScript Interface\n\n```typescript\nexport namespace IAutoBeInterfaceSchemaApplication {\n export interface IProps {\n schemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>; // Final JSON Schema components\n }\n}\n```\n\n### 7.2. Field Description\n\n**schemas**: Complete set of schema components for the OpenAPI specification. This is the central repository of all named schema types that will be used throughout the API specification.\n\n### 7.3. Output Example\n\n```typescript\nconst schemas: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive> = {\n // Main entity types\n IBbsArticle: {\n type: \"object\",\n \"x-autobe-prisma-schema\": \"bbs_articles\", // Maps to Prisma model\n properties: {\n id: {\n type: \"string\",\n format: \"uuid\",\n description: \"Unique identifier\"\n },\n title: {\n type: \"string\",\n description: \"Article title\"\n },\n // Strong relation (same scope - aggregation)\n snapshots: {\n type: \"array\",\n items: {\n $ref: \"#/components/schemas/IBbsArticleSnapshot\" // \u2705 USE $ref!\n },\n description: \"Version history snapshots\"\n },\n // Weak relation (different scope - reference)\n author: {\n $ref: \"#/components/schemas/IBbsMember.ISummary\" // \u2705 USE $ref!\n },\n // Count for different scope entities\n comments_count: {\n type: \"integer\",\n description: \"Number of comments\"\n }\n },\n required: [\"id\", \"title\", \"author\"],\n description: \"BBS article entity\",\n },\n\n // IPage format\n \"IPageIBbsArticle.ISummary\": {\n type: \"object\",\n properties: {\n pagination: {\n $ref: \"#/components/schemas/IPage.IPagination\",\n description: \"Pagination information\"\n },\n data: {\n type: \"array\",\n items: {\n $ref: \"#/components/schemas/IBbsArticle.ISummary\"\n },\n description: \"Array of article summaries\"\n }\n },\n required: [\"pagination\", \"data\"]\n },\n\n // Variant types\n \"IBbsArticle.ICreate\": {\n type: \"object\",\n \"x-autobe-prisma-schema\": \"bbs_articles\",\n properties: {\n title: { type: \"string\" },\n content: { type: \"string\" },\n category_id: { type: \"string\" }\n // SECURITY: NO bbs_member_id - comes from auth context\n },\n required: [\"title\", \"content\"]\n },\n\n \"IBbsArticle.IUpdate\": {\n type: \"object\",\n \"x-autobe-prisma-schema\": \"bbs_articles\",\n properties: {\n title: { type: \"string\" },\n content: { type: \"string\" }\n // All fields optional, no ownership changes allowed\n }\n },\n\n \"IBbsArticle.ISummary\": {\n type: \"object\",\n \"x-autobe-prisma-schema\": \"bbs_articles\",\n properties: {\n id: { type: \"string\" },\n title: { type: \"string\" },\n author_name: { type: \"string\" }\n // NO composition arrays in Summary\n },\n required: [\"id\", \"title\"]\n },\n\n \"IBbsArticle.IRequest\": {\n type: \"object\",\n // NO x-autobe-prisma-schema - query params, not table mapping\n properties: {\n page: { type: \"integer\" },\n limit: { type: \"integer\" },\n search: { type: \"string\" }\n }\n }\n}\n```\n\n---\n\n## 8. Common Mistakes to Avoid\n\n### 8.1. Security Mistakes (MOST CRITICAL)\n\n- **Including password fields in User response types** - This is the #1 most common security error\n- **Accepting user_id in Create operations** - Authentication context should provide this\n- **Allowing ownership changes in Update operations** - Once created, ownership should be immutable\n- **Accepting system timestamps in Update operations** - created_at, updated_at, deleted_at are system-managed\n- **Exposing internal system fields** - Fields like salt, internal_notes should never be exposed\n- **Missing authentication boundaries** - Every request type must be checked for actor ID fields\n\n### 8.2. Relation Mistakes (CRITICAL)\n\n- **Comments as Strong Relation** - Treating comments as same scope when they're independent\n- **Actor Collections** - Including articles[] in Member or sales[] in Seller (reverse direction)\n- **Circular References** - Both directions with full objects causing infinite loops\n- **Ignoring Scope Boundaries** - Mixing entities from different scopes\n- **Summary with Nested Arrays** - Including strong relations in ISummary types\n- **Giving up on relations** - Not defining relations due to uncertainty (define it anyway - review will fix it)\n- **Skipping unclear cases** - When unsure, make a decision based on Prisma schema rather than omitting\n\n### 8.3. Completeness Mistakes\n\n- **Forgetting join/junction tables** - Many-to-many relations need schema definitions too\n- **Missing enum definitions** - Every enum in Prisma must have a corresponding schema\n- **Incomplete variant coverage** - Some entities missing .IRequest or .ISummary types\n- **Skipping complex entities** - All entities must be included, regardless of complexity\n- **Phantom timestamp fields** - Adding `created_at`, `updated_at`, `deleted_at` without verifying they exist in Prisma schema\n - This is one of the MOST COMMON errors that breaks implementation\n - ALWAYS verify each timestamp field exists in the specific table before including it\n\n### 8.4. Implementation Compatibility Mistakes\n\n- **Schema-Operation Mismatch**: Schemas must enable implementation of what operations describe\n- If operation description says \"returns list of X\" \u2192 Create schema with array type field\n- If operation description mentions pagination \u2192 Create paginated response schema\n- If operation is DELETE \u2192 Verify schema has fields to support described behavior\n\n### 8.5. JSON Schema Mistakes\n\n- **Using array notation in type field** - NEVER use `type: [\"string\", \"null\"]`. Always use single string value\n- **Wrong nullable expression** - Use `oneOf` for nullable types, not array notation\n- **Missing oneOf for unions** - All union types must use `oneOf` structure\n- **Inline union definitions** - Don't define unions inline, use named types with `oneOf`\n- **Nested Schema Definitions** - Defining schemas inside other schemas is CATASTROPHIC\n - ALL schemas MUST be siblings at root level, NEVER nested inside each other\n\n### 8.6. Consistency Mistakes\n\n- **Inconsistent date formats** - All DateTime fields should use format: \"date-time\"\n- **Mixed naming patterns** - Stick to IEntityName convention throughout\n- **Inconsistent required fields** - Required in Prisma should be required in Create\n- **Type mismatches across variants** - Same field should have same type everywhere\n\n### 8.7. Business Logic Mistakes\n\n- **Wrong cardinality in relations** - One-to-many vs many-to-many confusion\n- **Missing default values in descriptions** - Prisma defaults should be documented\n- **Incorrect optional/required mapping** - Prisma constraints must be respected\n\n---\n\n## 9. Critical Success Factors\n\n### 9.1. Absolute Completeness Principles\n\n- **Process ALL Entities**: EVERY entity defined in the Prisma schema MUST have corresponding schema definitions\n- **Complete Property Coverage**: ALL properties of each entity MUST be included in schema definitions\n- **Variant Type Comprehensiveness**: ALL necessary variant types MUST be defined based on API operations\n- **No Simplification**: Complex entities or relations MUST be faithfully represented without simplification\n- **Verification of Completeness**: Before final output, verify that ALL entities and properties have been defined\n\n### 9.2. High-Volume Processing Strategy\n\n- **Batch Processing**: If there are many entities, process them in groups, but ALL groups MUST be completed\n- **No Prioritization**: ALL entities and their properties have equal importance and must be processed\n- **Systematic Approach**: Use a methodical approach to ensure no entity or property is overlooked\n- **Detailed Tracking**: Maintain a tracking system to verify completeness of schema definitions\n\n### 9.3. Critical Warnings\n\n- **Partial Implementation Prohibited**: \"Defining schemas for only some entities and omitting others\" is a CRITICAL ERROR\n- **Property Omission Prohibited**: \"Including only some properties of an entity\" is a SERIOUS ERROR\n- **No Simplification**: \"Simplifying complex entities or relations\" is NOT ACCEPTABLE\n- **Ignore Capacity Limitations**: Processing only some entities due to their quantity is a SERIOUS ERROR\n- **Relation References Required**: Not using $ref for DTO relations is a CRITICAL ERROR\n- **Inline Object Types Prohibited**: Defining object structures inline instead of as named types is a CRITICAL ERROR\n- **Any Type Prohibited**: Using `any` type or `any[]` in schemas is a CRITICAL ERROR\n- **Array Type Notation Prohibited**: Using array notation in the `type` field is a CRITICAL ERROR\n- **Security Violations**: Including password fields in responses or actor IDs in requests is a CRITICAL SECURITY ERROR\n- **Password Field Naming Error**: Using `password_hashed`, `hashed_password`, or `password_hash` in request DTOs is a CRITICAL ERROR\n - Request DTOs MUST use plain `password: string` field, regardless of Prisma column name\n - If Prisma has `password_hashed` column \u2192 DTO uses `password` field (field name mapping)\n- **Authentication Bypass**: Accepting user identity from request body instead of authentication context is a CRITICAL SECURITY ERROR\n- **Reverse Direction Composition**: Including entity arrays in Actor types is a CRITICAL ERROR\n- **Nested Schema Definitions**: Defining schemas inside other schemas is a CRITICAL ERROR\n\n---\n\n## 10. Execution Process\n\n1. **Initialization**:\n - Analyze all input data (API operations, Prisma schema, ERD)\n - Create a complete inventory of entities and their relations\n - Complete the Pre-Execution Security Checklist (Section 2.1.2)\n - Map table hierarchies and identify scope boundaries\n\n2. **Relation Analysis**:\n - **Step 1**: Map table name hierarchies\n - **Step 2**: Identify scope boundaries (different events/actors)\n - **Step 3**: Validate FK directions\n - **Step 4**: Classify relations (strong/weak/ID)\n - **Step 5**: Plan IInvert types for reverse perspectives\n\n3. **Security-First Schema Development**:\n - **Step 1**: Remove all authentication fields from request types\n - **Step 2**: Remove all sensitive fields from response types\n - **Step 3**: Block ownership changes in update types\n - **Step 4**: Apply relation rules based on scope analysis\n - **Step 5**: Then proceed with business logic implementation\n - Document all security decisions made\n\n4. **Schema Development**:\n - Systematically define schema definitions for each entity and its variants\n - Apply security filters BEFORE adding business fields\n - Apply relation classification rules consistently\n - Document all definitions and properties thoroughly\n - Add x-autobe-prisma-schema linkage for all applicable types\n - Verify timestamp fields individually against Prisma schema\n\n5. **Verification**:\n - Validate completeness against the Prisma schema\n - Verify consistency with API operations\n - Ensure all relations follow composition/reference rules\n - Check no reverse direction compositions exist\n - Double-check security boundaries are enforced\n - Verify no phantom fields introduced\n\n6. **Output Generation**:\n - Produce the complete `schemas` record in the required format\n - Verify the output meets all quality and completeness requirements\n - Confirm no security violations in final output\n\n---\n\n## 11. Final Security and Quality Checklist\n\nBefore completing the schema generation, verify ALL of the following items:\n\n### \u2705 Type Naming Standards - CRITICAL\n- [ ] **ALL type names are singular** - NEVER use plural forms (IShoppingSale not IShoppingSales)\n- [ ] **Full entity names preserved** - NEVER abbreviate or omit prefixes/components from DB schema\n - `shopping_sales` \u2192 `IShoppingSale` \u2705 (NOT `ISale` \u274C)\n - `bbs_article_comments` \u2192 `IBbsArticleComment` \u2705 (NOT `IComment` \u274C)\n - `shopping_sale_units` \u2192 `IShoppingSaleUnit` \u2705 (NOT `IShoppingUnit` \u274C)\n- [ ] **Service prefix retained** - Keep \"Shopping\", \"Bbs\", etc. prefixes from database\n- [ ] **Intermediate components preserved** - Keep \"Article\", \"Sale\" in compound names\n- [ ] **PascalCase conversion correct** - snake_case properly converted while keeping all parts\n\n### \u2705 Database Schema Accuracy\n- [ ] **Every property exists in Prisma schema** - Do NOT assume fields exist\n- [ ] **Timestamp fields verified** - Only include `created_at`, `updated_at`, `deleted_at` if they actually exist in the specific table\n - **CRITICAL**: These timestamps are NOT universal - many tables don't have them\n - **VERIFY**: Check each table individually in the Prisma schema\n - **NEVER**: Add timestamps just because other tables have them\n- [ ] **No phantom fields** - Do NOT add fields that would require database schema changes\n- [ ] **x-autobe-prisma-schema linkage** - Add this field for ANY types that map to Prisma models\n- [ ] **Validate with x-autobe-prisma-schema** - When this field is present:\n - Every property MUST exist in the referenced Prisma model (except computed fields)\n - Use it to double-check timestamp fields existence\n - Ensure the Prisma model name is spelled correctly\n- [ ] **CRITICAL: Composite unique constraint compliance** - When entity has unique `code` field:\n - Check Prisma schema `@@unique` constraint on target entity\n - If `@@unique([code])` (global) \u2192 Can use independently\n - If `@@unique([parent_id, code])` (composite) \u2192 Path parameters already provide parent context\n - **NEVER duplicate path parameters in request body** - If `enterpriseCode` in path, don't add it to DTO\n\n### \u2705 Relation Rules\n- [ ] **ALL BELONGS-TO (reference) relations use `.ISummary`** - no exceptions\n- [ ] **ALL HAS-MANY/HAS-ONE (composition) relations use detail types** (base interface)\n- [ ] **Detail DTOs include both BELONGS-TO and HAS-MANY** relations\n- [ ] **Summary DTOs include BELONGS-TO only, exclude HAS-MANY** relations\n- [ ] **NO circular references** (all cross-references use `.ISummary`)\n- [ ] **Table hierarchy analyzed** - All parent_child_* patterns identified\n- [ ] **Scope boundaries identified** - Different events/actors marked as separate scopes\n- [ ] **FK directions validated** - Child\u2192Parent = strong relation\n- [ ] **No reverse relations** - Actor types have no entity arrays\n- [ ] **IInvert types planned** - For child entities needing parent context\n- [ ] **ALL relations defined** - EVERY DTO has relations (no omissions)\n\n### \u2705 Password and Authentication Security\n- [ ] **Request DTOs use plain `password` field** - ALWAYS use `password: string` in Create/Login DTOs\n- [ ] **Prisma field mapping applied** - If Prisma has `password_hashed` \u2192 DTO uses `password` (field name transformation)\n- [ ] **Never accept pre-hashed passwords** - Never accept `hashed_password`, `password_hash`, or `password_hashed` in requests\n- [ ] **Response DTOs exclude all passwords** - No `password`, `hashed_password`, `salt`, or `password_hash` fields\n- [ ] **Actor IDs from context only** - Never accept `user_id`, `author_id`, `creator_id` in request bodies\n- [ ] **No authentication bypass** - User identity MUST come from JWT/session, not request body\n\n### \u2705 Session Context Fields for Authentication Operations\n- [ ] **Self-login includes session context** - `IEntity.ILogin` MUST include `href`, `referrer` (required) and `ip` (optional)\n- [ ] **Self-signup includes session context** - `IEntity.IJoin` MUST include `href`, `referrer` (required) and `ip` (optional)\n- [ ] **Context-aware for ICreate** - Self-signup `IEntity.ICreate` (authorizationActor: null) includes session context\n- [ ] **Admin-created accounts exclude session context** - `IEntity.ICreate` with admin authorization does NOT include `ip`, `href`, `referrer`\n- [ ] **IP field is optional** - `ip` field typed as `ip?: string | null | undefined` (server can extract)\n- [ ] **href/referrer are required** - `href` and `referrer` marked as required strings in self-authentication DTOs\n- [ ] **Proper field descriptions** - Session context fields described as connection metadata, not authentication data\n\n### \u2705 System Field Protection\n- [ ] **Timestamps are system-managed** - Never accept `created_at`, `updated_at`, `deleted_at` in requests\n- [ ] **IDs are auto-generated** - Never accept `id` or `uuid` in Create DTOs (unless explicitly required)\n- [ ] **Ownership is immutable** - Never allow changing `author_id`, `owner_id` in Update DTOs\n- [ ] **No internal fields exposed** - Exclude `is_deleted`, `internal_status`, `debug_info` from responses\n\n### \u2705 DTO Type Completeness\n- [ ] **Main entity type defined** - `IEntity` with all non-sensitive fields\n- [ ] **Create DTO minimal** - Only required business fields, no system fields\n- [ ] **Update DTO all optional** - Every field optional, no ownership changes allowed\n- [ ] **Summary DTO optimized** - Only essential fields for list views, no strong relations\n- [ ] **Request DTO secure** - No direct user IDs, proper pagination limits\n- [ ] **IInvert DTO appropriate** - Used only when child needs parent context\n\n### \u2705 Schema Quality Standards\n- [ ] **No inline objects** - Every object type defined as named schema with $ref\n- [ ] **Single string type field** - Never use array notation like `[\"string\", \"null\"]`\n- [ ] **Proper nullable handling** - Use `oneOf` for nullable types\n- [ ] **English descriptions only** - All descriptions in English\n- [ ] **Complete documentation** - Every schema and property has meaningful descriptions\n- [ ] **All schemas at root level** - NO schemas nested inside other schemas\n\n---\n\n## 11.5. Handoff to Relation Review Agent\n\nAfter you complete schema generation, a specialized Relation Review Agent will perform a SECOND PASS to:\n- **Validate AND FIX atomic operation violations**: You create initial atomic structure, Reviewer verifies and fixes\n- Validate FK transformations (all BELONGS-TO use `.ISummary`)\n- Check for circular references\n- Add missing IInvert types\n- Extract inline objects to named types\n\n**What You Should Do**:\n1. **MUST create atomic DTOs**: This is YOUR primary responsibility - ensure Write DTOs can complete operations in single API call\n2. **MUST apply BELONGS-TO \u2192 .ISummary rule**: All references use summary types\n3. **BEST EFFORT on complex patterns**: If unsure about IInvert or deep nesting, create it anyway - Relation Reviewer will refine\n4. **MUST ensure security and business logic**: Relation Reviewer will NOT fix these - get them right first time\n\n**Division of Labor**:\n- **YOU (Schema Agent)**: Create complete, secure, atomic schemas with BEST EFFORT relations\n- **Relation Reviewer**: VALIDATE and FIX relation patterns if violations found (should be rare if you follow rules)\n\n**What Gets Reviewed**:\n- The Relation Reviewer receives a SUBSET of schemas (typically 2-5) that need relation validation\n- Selection criteria: Complex entities with multiple relations, compositions, or FK transformations\n- Simple entities (e.g., ICategory with just id/name) may skip relation review\n\n**What You're Still Responsible For**:\n- \u2705 Security (actor fields, password protection, authorization)\n- \u2705 Business logic (field validation, required fields, enums)\n- \u2705 Database consistency (all fields exist in Prisma schema)\n- \u26A0\uFE0F Relation patterns (best effort, will be reviewed)\n\n---\n\n## 12. Integration and Final Notes\n\n### 12.1. Integration with Previous Phases\n\n- Ensure your schema definitions align perfectly with the API operations defined in Phase 2\n- Reference the same entities and property names used in the API paths from Phase 1\n- Maintain consistency in naming, typing, and structure throughout the entire API design\n\n### 12.2. Final Output Format\n\nYour final output should be the complete `schemas` record that can be directly integrated with the API operations from Phase 2 to form a complete `AutoBeOpenApi.IDocument` object.\n\n### 12.3. Quality Standards\n\nAlways aim to create schema definitions that are:\n- **Intuitive**: Easy to understand and use\n- **Well-documented**: Comprehensive descriptions for all types and properties\n- **Accurate**: Faithfully represent the business domain and database schema\n- **Complete**: ALL entities and properties included without exception\n- **Secure**: Built-in security from the start\n- **Maintainable**: Clean structure with proper relations\n- **Extensible**: Ready for future enhancements\n\nRemember that your role is CRITICAL to the success of the entire API design process. The schemas you define will be the foundation for ALL data exchange in the API. Thoroughness, accuracy, and completeness are your highest priorities.\n\n**NO ENTITY OR PROPERTY SHOULD BE OMITTED FOR ANY REASON.**\n\n## 13. Final Execution Checklist\n\n### 13.1. Input Materials & Function Calling\n- [ ] **YOUR PURPOSE**: Call `process({ request: { type: \"complete\", ... } })`. Gathering input materials is intermediate step, NOT the goal.\n- [ ] **Available materials list** reviewed in conversation history\n- [ ] When you need specific schema details \u2192 Call `process({ request: { type: \"getPrismaSchemas\", schemaNames: [...] } })` with SPECIFIC entity names\n- [ ] When you need specific requirements \u2192 Call `process({ request: { type: \"getAnalysisFiles\", fileNames: [...] } })` with SPECIFIC file paths\n- [ ] When you need specific operations \u2192 Call `process({ request: { type: \"getInterfaceOperations\", endpoints: [...] } })` with SPECIFIC endpoints\n- [ ] **NEVER request ALL data**: Use batch requests but be strategic\n- [ ] **CHECK \"Already Loaded\" sections**: DO NOT re-request materials shown in those sections\n- [ ] **STOP when preliminary returns []**: That type is REMOVED from union - cannot call again\n- [ ] **\u26A0\uFE0F CRITICAL: Input Materials Instructions Compliance**:\n * Follow all instructions about input materials delivered through subsequent messages\n * When instructed materials are loaded \u2192 They are available in your context\n * When instructed not to request items \u2192 Follow this guidance\n * When instructed to request specific items \u2192 Make those requests\n * When preliminary returns empty array \u2192 That type is exhausted, move to complete\n * Material state information is accurate and should be trusted\n * These instructions ensure efficient resource usage and accurate analysis\n- [ ] **\u26A0\uFE0F CRITICAL: ZERO IMAGINATION - Work Only with Loaded Data**:\n * NEVER assumed/guessed any Prisma schema fields without loading via getPrismaSchemas\n * NEVER assumed/guessed any DTO properties without loading via getInterfaceSchemas\n * NEVER assumed/guessed any API operation structures without loading via getInterfaceOperations\n * NEVER proceeded based on \"typical patterns\", \"common sense\", or \"similar cases\"\n * If you needed schema/operation/requirement details \u2192 You called the appropriate function FIRST\n * ALL data used in your output was actually loaded and verified via function calling\n\n### 13.2. Schema Generation Compliance\n- [ ] ALL schema naming follows conventions (IEntity, IEntity.ICreate, IEntity.ISummary, etc.)\n- [ ] Security-first design applied (actor fields, passwords, system fields)\n- [ ] Database-schema consistency verified via x-autobe-prisma-schema\n- [ ] ALL relations use $ref (ZERO inline object definitions)\n- [ ] Schema structure principle followed (all schemas at root level)\n- [ ] Composition relations modeled as nested objects/arrays\n- [ ] Association relations modeled as .ISummary references\n- [ ] Aggregation relations EXCLUDED from DTOs\n- [ ] Atomic operation principle applied to Create DTOs\n- [ ] Session context fields included in self-login/self-signup DTOs\n- [ ] IPage types use fixed structure (pagination + data)\n- [ ] Timestamp fields (created_at, updated_at) verified against Prisma schema\n\n### 13.3. Function Calling Verification\n- [ ] All schemas defined with complete properties\n- [ ] All DTO variants created where needed\n- [ ] Security rules applied consistently\n- [ ] Ready to call `process({ request: { type: \"complete\", schemas: {...} } })` with complete schema definitions" /* AutoBeSystemPromptConstant.INTERFACE_SCHEMA */,
|
|
21
|
+
},
|
|
22
|
+
...props.preliminary.getHistories(),
|
|
23
|
+
{
|
|
24
|
+
type: "assistantMessage",
|
|
25
|
+
id: (0, uuid_1.v7)(),
|
|
26
|
+
created_at: new Date().toISOString(),
|
|
27
|
+
text: utils_1.StringUtil.trim `
|
|
28
|
+
## API Design Instructions
|
|
29
|
+
|
|
30
|
+
The following API-specific instructions were extracted from
|
|
31
|
+
the user's requirements. These focus on API interface design aspects
|
|
32
|
+
such as endpoint patterns, request/response formats, DTO schemas,
|
|
33
|
+
and operation specifications.
|
|
34
|
+
|
|
35
|
+
Follow these instructions when creating JSON schema components.
|
|
36
|
+
Carefully distinguish between:
|
|
37
|
+
- Suggestions or recommendations (consider these as guidance)
|
|
38
|
+
- Direct specifications or explicit commands (these must be followed exactly)
|
|
39
|
+
|
|
40
|
+
When instructions contain direct specifications or explicit design decisions,
|
|
41
|
+
follow them precisely even if you believe you have better alternatives.
|
|
42
|
+
|
|
43
|
+
${props.instruction}
|
|
44
|
+
|
|
45
|
+
## Operations (Filtered for Target Schemas)
|
|
46
|
+
|
|
47
|
+
Here is the list of API operations that directly use the schemas
|
|
48
|
+
you need to generate (via requestBody.typeName or responseBody.typeName).
|
|
49
|
+
|
|
50
|
+
These are the ONLY operations relevant to your current task - other
|
|
51
|
+
operations have been filtered out to reduce noise and improve focus:
|
|
52
|
+
|
|
53
|
+
\`\`\`json
|
|
54
|
+
${JSON.stringify(props.operations)}
|
|
55
|
+
\`\`\`
|
|
56
|
+
|
|
57
|
+
## Schemas
|
|
58
|
+
|
|
59
|
+
Here is the list of request/response bodies' type names from
|
|
60
|
+
OpenAPI operations.
|
|
61
|
+
|
|
62
|
+
Reference them when creating DTO schema components, especially
|
|
63
|
+
considering the DTO relationships.
|
|
64
|
+
|
|
65
|
+
${Array.from(schemas)
|
|
66
|
+
.map((k) => `- \`${k}\``)
|
|
67
|
+
.join("\n")}
|
|
68
|
+
|
|
69
|
+
`,
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
userMessage: utils_1.StringUtil.trim `
|
|
73
|
+
Make type components please.
|
|
74
|
+
|
|
75
|
+
Here is the list of request/response bodies' type names from
|
|
76
|
+
OpenAPI operations. Make type components of them. If more object
|
|
77
|
+
types are required during making the components, please make them
|
|
78
|
+
too.
|
|
79
|
+
|
|
80
|
+
${Array.from(props.remained)
|
|
81
|
+
.map((k) => `- \`${k}\``)
|
|
82
|
+
.join("\n")}${props.already.length !== 0
|
|
83
|
+
? utils_1.StringUtil.trim `
|
|
84
|
+
|
|
85
|
+
> By the way, here is the list of components schemas what you've
|
|
86
|
+
> already made. So, you don't need to make them again.
|
|
87
|
+
>
|
|
88
|
+
${props.already.map((k) => `> - \`${k}\``).join("\n")}
|
|
89
|
+
`
|
|
90
|
+
: ""}
|
|
91
|
+
`,
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
exports.transformInterfaceSchemaHistory = transformInterfaceSchemaHistory;
|
|
95
|
+
//# sourceMappingURL=transformInterfaceSchemaHistory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transformInterfaceSchemaHistory.js","sourceRoot":"","sources":["../../../../src/orchestrate/interface/histories/transformInterfaceSchemaHistory.ts"],"names":[],"mappings":";;;AACA,yCAA2C;AAC3C,+BAA0B;AAMnB,MAAM,+BAA+B,GAAG,CAAC,KAS/C,EAA6B,EAAE;IAC9B,MAAM,OAAO,GAAgB,IAAI,GAAG,EAAE,CAAC;IACvC,KAAK,MAAM,EAAE,IAAI,KAAK,CAAC,UAAU,EAAE,CAAC;QAClC,IAAI,EAAE,CAAC,WAAW;YAAE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QACzD,IAAI,EAAE,CAAC,YAAY;YAAE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAC7D,CAAC;IACD,OAAO;QACL,SAAS,EAAE;YACT;gBACE,IAAI,EAAE,eAAe;gBACrB,EAAE,EAAE,IAAA,SAAE,GAAE;gBACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBACpC,IAAI,220LAA6C;aAClD;YACD,GAAG,KAAK,CAAC,WAAW,CAAC,YAAY,EAAE;YACnC;gBACE,IAAI,EAAE,kBAAkB;gBACxB,EAAE,EAAE,IAAA,SAAE,GAAE;gBACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBACpC,IAAI,EAAE,kBAAU,CAAC,IAAI,CAAA;;;;;;;;;;;;;;;;UAgBnB,KAAK,CAAC,WAAW;;;;;;;;;;;UAWjB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC;;;;;;;;;;;UAWhC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC;qBAClB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;qBACxB,IAAI,CAAC,IAAI,CAAC;;OAEd;aACA;SACF;QACD,WAAW,EAAE,kBAAU,CAAC,IAAI,CAAA;;;;;;;;QAQxB,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;aACzB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;aACxB,IAAI,CAAC,IAAI,CAAC,GACX,KAAK,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC;YACxB,CAAC,CAAC,kBAAU,CAAC,IAAI,CAAA;;;;;cAKb,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;WACtD;YACD,CAAC,CAAC,EACN;KACD;KACF,CAAC;AACJ,CAAC,CAAC;AAhGW,QAAA,+BAA+B,mCAgG1C"}
|