@autobe/agent 0.25.6 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/AutoBeAgent.js +3 -0
- package/lib/AutoBeAgent.js.map +1 -1
- package/lib/AutoBeMockAgent.js +15 -12
- package/lib/AutoBeMockAgent.js.map +1 -1
- package/lib/constants/AutoBeSystemPromptConstant.d.ts +26 -19
- package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
- package/lib/factory/consentFunctionCall.js +3 -0
- package/lib/factory/consentFunctionCall.js.map +1 -1
- package/lib/factory/createAutoBeContext.js +4 -1
- package/lib/factory/createAutoBeContext.js.map +1 -1
- package/lib/factory/getCommonPrompt.d.ts +2 -0
- package/lib/factory/getCommonPrompt.js +20 -0
- package/lib/factory/getCommonPrompt.js.map +1 -0
- package/lib/index.mjs +2636 -2258
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeReviewHistories.js.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js +2 -2
- package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js +6 -6
- package/lib/orchestrate/analyze/histories/transformAnalyzeWriteHistories.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyze.js +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js +73 -73
- package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js +2 -2
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.d.ts +9 -9
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.d.ts +1 -1
- package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistories.js +2 -17
- package/lib/orchestrate/common/histories/transformCommonCorrectCastingHistories.js.map +1 -1
- package/lib/orchestrate/common/histories/transformPreviousAndLatestCorrectHistories.d.ts +6 -0
- package/lib/orchestrate/common/histories/transformPreviousAndLatestCorrectHistories.js +58 -0
- package/lib/orchestrate/common/histories/transformPreviousAndLatestCorrectHistories.js.map +1 -0
- package/lib/orchestrate/facade/transformFacadeStateMessage.js +1 -1
- package/lib/orchestrate/facade/transformFacadeStateMessage.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.d.ts +2 -2
- package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js +8 -8
- package/lib/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js +3 -3
- package/lib/orchestrate/interface/histories/transformInterfaceComplementHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceEndpointsReviewHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js +2 -2
- package/lib/orchestrate/interface/histories/transformInterfaceGroupHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js +2 -2
- package/lib/orchestrate/interface/histories/transformInterfaceOperationsReviewHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.d.ts +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js +46 -20
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaHistories.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.d.ts +5 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.js +51 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.js.map +1 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.d.ts +11 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.js +81 -0
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.js.map +1 -0
- package/lib/orchestrate/interface/orchestrateInterface.js +24 -4
- package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js +52 -52
- package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +2 -2
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.js +2 -2
- package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.d.ts +2 -2
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.js +2 -2
- package/lib/orchestrate/interface/orchestrateInterfaceGroups.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +57 -57
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js +43 -43
- package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js +4 -4
- package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.d.ts +7 -0
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.js +444 -0
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.js.map +1 -0
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.d.ts +12 -0
- package/lib/orchestrate/interface/{orchestrateInterfaceSchemasReview.js → orchestrateInterfaceSchemaReview.js} +66 -57
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.js.map +1 -0
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js +9 -6
- package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.d.ts +22 -22
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.d.ts +7 -7
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaContentReviewApplication.d.ts +101 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaContentReviewApplication.js +3 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaContentReviewApplication.js.map +1 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.d.ts +97 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.js +3 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.js.map +1 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRenameApplication.d.ts +44 -0
- package/lib/orchestrate/interface/structures/{IAutobeInterfaceSchemasReviewApplication.js → IAutoBeInterfaceSchemaRenameApplication.js} +1 -1
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaRenameApplication.js.map +1 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.d.ts +92 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.js +3 -0
- package/lib/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.js.map +1 -0
- package/lib/orchestrate/interface/utils/JsonSchemaFactory.js +42 -1
- package/lib/orchestrate/interface/utils/JsonSchemaFactory.js.map +1 -1
- package/lib/orchestrate/interface/utils/JsonSchemaValidator.js +94 -0
- package/lib/orchestrate/interface/utils/JsonSchemaValidator.js.map +1 -1
- package/lib/orchestrate/interface/utils/OperationValidator.d.ts +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js +13 -13
- package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistories.js.map +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaReviewHistories.js +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaReviewHistories.js.map +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistories.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaComponent.d.ts +2 -2
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js +2 -2
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.d.ts +2 -2
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.js +2 -2
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeAuthorization.d.ts +2 -2
- package/lib/orchestrate/realize/histories/transformRealizeAuthorization.js +8 -7
- package/lib/orchestrate/realize/histories/transformRealizeAuthorization.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js +4 -4
- package/lib/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.d.ts +4 -7
- package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js +8 -18
- package/lib/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.d.ts +0 -1
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js +8 -28
- package/lib/orchestrate/realize/histories/transformRealizeCorrectHistories.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.d.ts +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js +16 -280
- package/lib/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.js.map +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.js +1 -1
- package/lib/orchestrate/realize/histories/transformRealizeWriteHistories.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealize.js +2 -2
- package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js +12 -12
- package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +9 -9
- package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.d.ts +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.js +43 -22
- package/lib/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
- package/lib/orchestrate/realize/{orchestRateRealizeCorrectCasting.js → orchestrateRealizeCorrectCasting.js} +58 -46
- package/lib/orchestrate/realize/orchestrateRealizeCorrectCasting.js.map +1 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.d.ts +3 -3
- package/lib/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.d.ts +2 -2
- package/lib/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.js +6 -6
- package/lib/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.js.map +1 -1
- package/lib/orchestrate/realize/utils/generateRealizeScenario.js +1 -1
- package/lib/orchestrate/realize/utils/generateRealizeScenario.js.map +1 -1
- package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js +2 -2
- package/lib/orchestrate/realize/utils/getRealizeWriteCodeTemplate.js.map +1 -1
- package/lib/orchestrate/realize/utils/getRealizeWriteDto.js +1 -1
- package/lib/orchestrate/realize/utils/getRealizeWriteDto.js.map +1 -1
- package/lib/orchestrate/realize/utils/getRealizeWriteInputType.js +2 -2
- package/lib/orchestrate/realize/utils/getRealizeWriteInputType.js.map +1 -1
- package/lib/orchestrate/realize/utils/printErrorHints.js +1 -1
- package/lib/orchestrate/realize/utils/printErrorHints.js.map +1 -1
- package/lib/orchestrate/test/compile/getTestScenarioArtifacts.js +1 -1
- package/lib/orchestrate/test/compile/getTestScenarioArtifacts.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestCorrectHistories.js +5 -22
- package/lib/orchestrate/test/histories/transformTestCorrectHistories.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.js +10 -10
- package/lib/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestScenarioHistories.js +5 -5
- package/lib/orchestrate/test/histories/transformTestScenarioHistories.js.map +1 -1
- package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js +2 -2
- package/lib/orchestrate/test/histories/transformTestScenarioReviewHistories.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrect.js +2 -0
- package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js +1 -0
- package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenario.js +26 -26
- package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenarioReview.js +2 -2
- package/lib/orchestrate/test/orchestrateTestScenarioReview.js.map +1 -1
- package/lib/orchestrate/test/structures/{IAutoBeTestScenarioAuthorizationRole.d.ts → IAutoBeTestScenarioAuthorizationActor.d.ts} +1 -1
- package/lib/orchestrate/test/structures/{IAutoBeTestScenarioAuthorizationRole.js → IAutoBeTestScenarioAuthorizationActor.js} +1 -1
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioAuthorizationActor.js.map +1 -0
- package/package.json +5 -5
- package/src/AutoBeAgent.ts +3 -0
- package/src/AutoBeMockAgent.ts +15 -12
- package/src/constants/AutoBeSystemPromptConstant.ts +26 -19
- package/src/factory/consentFunctionCall.ts +4 -0
- package/src/factory/createAutoBeContext.ts +5 -1
- package/src/factory/getCommonPrompt.ts +25 -0
- package/src/orchestrate/analyze/histories/transformAnalyzeWriteHistories.ts +5 -5
- package/src/orchestrate/analyze/orchestrateAnalyze.ts +1 -1
- package/src/orchestrate/analyze/orchestrateAnalyzeScenario.ts +3 -3
- package/src/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.ts +9 -9
- package/src/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.ts +1 -1
- package/src/orchestrate/common/histories/transformCommonCorrectCastingHistories.ts +2 -20
- package/src/orchestrate/common/histories/transformPreviousAndLatestCorrectHistories.ts +65 -0
- package/src/orchestrate/interface/histories/transformInterfaceAuthorizationsHistories.ts +9 -9
- package/src/orchestrate/interface/histories/transformInterfaceSchemaHistories.ts +45 -20
- package/src/orchestrate/interface/histories/transformInterfaceSchemaRenameHistories.ts +55 -0
- package/src/orchestrate/interface/histories/transformInterfaceSchemaReviewHistories.ts +90 -0
- package/src/orchestrate/interface/orchestrateInterface.ts +34 -14
- package/src/orchestrate/interface/orchestrateInterfaceAuthorizations.ts +18 -18
- package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +4 -4
- package/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.ts +2 -2
- package/src/orchestrate/interface/orchestrateInterfaceGroups.ts +5 -5
- package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +23 -23
- package/src/orchestrate/interface/orchestrateInterfaceOperationsReview.ts +4 -4
- package/src/orchestrate/interface/orchestrateInterfacePrerequisites.ts +2 -2
- package/src/orchestrate/interface/orchestrateInterfaceSchemaRename.ts +269 -0
- package/src/orchestrate/interface/{orchestrateInterfaceSchemasReview.ts → orchestrateInterfaceSchemaReview.ts} +88 -70
- package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +16 -8
- package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationApplication.ts +26 -22
- package/src/orchestrate/interface/structures/IAutoBeInterfaceOperationsReviewApplication.ts +7 -7
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaContentReviewApplication.ts +108 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.ts +104 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaRenameApplication.ts +45 -0
- package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.ts +99 -0
- package/src/orchestrate/interface/utils/JsonSchemaFactory.ts +45 -3
- package/src/orchestrate/interface/utils/JsonSchemaValidator.ts +110 -0
- package/src/orchestrate/interface/utils/OperationValidator.ts +1 -1
- package/src/orchestrate/prisma/histories/transformPrismaComponentsHistories.ts +12 -12
- package/src/orchestrate/prisma/orchestratePrisma.ts +4 -4
- package/src/orchestrate/prisma/orchestratePrismaComponent.ts +4 -4
- package/src/orchestrate/prisma/orchestratePrismaSchemas.ts +7 -7
- package/src/orchestrate/realize/histories/transformRealizeAuthorization.ts +8 -7
- package/src/orchestrate/realize/histories/transformRealizeAuthorizationCorrectHistories.ts +4 -4
- package/src/orchestrate/realize/histories/transformRealizeCorrectCastingHistories.ts +14 -28
- package/src/orchestrate/realize/histories/transformRealizeCorrectHistories.ts +13 -30
- package/src/orchestrate/realize/histories/transformRealizeWriteAuthorizationsHistories.ts +20 -285
- package/src/orchestrate/realize/orchestrateRealize.ts +1 -1
- package/src/orchestrate/realize/orchestrateRealizeAuthorization.ts +9 -9
- package/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.ts +3 -3
- package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +74 -60
- package/src/orchestrate/realize/{orchestRateRealizeCorrectCasting.ts → orchestrateRealizeCorrectCasting.ts} +86 -85
- package/src/orchestrate/realize/structures/IAutoBeRealizeAuthorizationApplication.ts +3 -3
- package/src/orchestrate/realize/utils/AutoBeRealizeAuthorizationReplaceImport.ts +10 -7
- package/src/orchestrate/realize/utils/generateRealizeScenario.ts +1 -1
- package/src/orchestrate/realize/utils/getRealizeWriteCodeTemplate.ts +2 -2
- package/src/orchestrate/realize/utils/getRealizeWriteDto.ts +1 -1
- package/src/orchestrate/realize/utils/getRealizeWriteInputType.ts +2 -2
- package/src/orchestrate/realize/utils/printErrorHints.ts +1 -1
- package/src/orchestrate/test/compile/getTestScenarioArtifacts.ts +1 -1
- package/src/orchestrate/test/histories/transformTestCorrectHistories.ts +6 -24
- package/src/orchestrate/test/histories/transformTestCorrectInvalidRequestHistories.ts +10 -10
- package/src/orchestrate/test/histories/transformTestScenarioHistories.ts +12 -10
- package/src/orchestrate/test/orchestrateTestCorrect.ts +2 -0
- package/src/orchestrate/test/orchestrateTestCorrectInvalidRequest.ts +1 -0
- package/src/orchestrate/test/orchestrateTestScenario.ts +30 -30
- package/src/orchestrate/test/orchestrateTestScenarioReview.ts +2 -2
- package/src/orchestrate/test/structures/{IAutoBeTestScenarioAuthorizationRole.ts → IAutoBeTestScenarioAuthorizationActor.ts} +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.d.ts +0 -4
- package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js +0 -60
- package/lib/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.js.map +0 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.d.ts +0 -9
- package/lib/orchestrate/interface/orchestrateInterfaceSchemasReview.js.map +0 -1
- package/lib/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.d.ts +0 -91
- package/lib/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.js.map +0 -1
- package/lib/orchestrate/realize/orchestRateRealizeCorrectCasting.js.map +0 -1
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioAuthorizationRole.js.map +0 -1
- package/src/orchestrate/interface/histories/transformInterfaceSchemasReviewHistories.ts +0 -67
- package/src/orchestrate/interface/structures/IAutobeInterfaceSchemasReviewApplication.ts +0 -96
- /package/lib/orchestrate/realize/{orchestRateRealizeCorrectCasting.d.ts → orchestrateRealizeCorrectCasting.d.ts} +0 -0
package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaRelationReviewApplication.ts
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { AutoBeOpenApi } from "@autobe/interface";
|
|
2
|
+
|
|
3
|
+
export interface IAutoBeInterfaceSchemaRelationReviewApplication {
|
|
4
|
+
/**
|
|
5
|
+
* Reviews and validates DTO relations and structural patterns in OpenAPI
|
|
6
|
+
* schemas.
|
|
7
|
+
*
|
|
8
|
+
* This specialized relation review function focuses exclusively on data
|
|
9
|
+
* relations, foreign key transformations, and structural integrity. It
|
|
10
|
+
* ensures proper modeling of business domains while preventing circular
|
|
11
|
+
* references and enabling efficient code generation.
|
|
12
|
+
*
|
|
13
|
+
* The review process validates and corrects:
|
|
14
|
+
*
|
|
15
|
+
* - Relation classifications (Composition vs Association vs Aggregation)
|
|
16
|
+
* - Foreign key to object transformations in response DTOs
|
|
17
|
+
* - Actor reversal violations (e.g., User containing articles array)
|
|
18
|
+
* - Inline object extractions to named types with $ref
|
|
19
|
+
* - IInvert pattern applications for alternative perspectives
|
|
20
|
+
*
|
|
21
|
+
* @param props Relation review results including violations found, fixes
|
|
22
|
+
* applied, and modified schemas
|
|
23
|
+
*/
|
|
24
|
+
review: (
|
|
25
|
+
props: IAutoBeInterfaceSchemaRelationReviewApplication.IProps,
|
|
26
|
+
) => void;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export namespace IAutoBeInterfaceSchemaRelationReviewApplication {
|
|
30
|
+
/**
|
|
31
|
+
* Output structure for the relation review function.
|
|
32
|
+
*
|
|
33
|
+
* Contains the relation analysis, structural fixes, and schemas modified for
|
|
34
|
+
* proper relations during the validation process.
|
|
35
|
+
*/
|
|
36
|
+
export interface IProps {
|
|
37
|
+
/** Relation analysis and structural planning information. */
|
|
38
|
+
think: IThink;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Modified schemas resulting from relation and structural fixes.
|
|
42
|
+
*
|
|
43
|
+
* Contains ONLY the schemas that were modified for relation or structural
|
|
44
|
+
* reasons during review. This includes both modified existing schemas and
|
|
45
|
+
* newly created schemas (extracted types, IInvert types).
|
|
46
|
+
*
|
|
47
|
+
* Relation modifications include:
|
|
48
|
+
*
|
|
49
|
+
* - Extracting inline objects to named types with $ref
|
|
50
|
+
* - Transforming foreign keys to object references
|
|
51
|
+
* - Removing incorrect reverse relations
|
|
52
|
+
* - Creating new IInvert types for alternative views
|
|
53
|
+
* - Correcting relation types (composition/association/aggregation)
|
|
54
|
+
*
|
|
55
|
+
* Return empty object {} when all relations are already correct and no
|
|
56
|
+
* structural fixes were needed.
|
|
57
|
+
*/
|
|
58
|
+
content: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface IThink {
|
|
62
|
+
/**
|
|
63
|
+
* Relation and structural violation findings from the review process.
|
|
64
|
+
*
|
|
65
|
+
* Documents all relation issues discovered during validation, categorized
|
|
66
|
+
* by severity and type. Each violation includes the affected schema,
|
|
67
|
+
* specific relation problem, and theoretical justification.
|
|
68
|
+
*
|
|
69
|
+
* Common violations documented:
|
|
70
|
+
*
|
|
71
|
+
* - CRITICAL: Inline object types instead of named types with $ref
|
|
72
|
+
* - CRITICAL: Actor reversal violations (User.articles[], Seller.sales[])
|
|
73
|
+
* - HIGH: Raw foreign keys instead of object references
|
|
74
|
+
* - HIGH: Wrong relation types (event-driven data as composition)
|
|
75
|
+
* - MEDIUM: Missing IInvert types for independent child views
|
|
76
|
+
* - LOW: Naming convention violations (plural instead of singular)
|
|
77
|
+
*
|
|
78
|
+
* Should state "No relation or structure issues found." when all schemas
|
|
79
|
+
* have correct relations.
|
|
80
|
+
*/
|
|
81
|
+
review: string;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Relation corrections and structural fixes applied during review.
|
|
85
|
+
*
|
|
86
|
+
* Lists all relation modifications implemented, organized by fix type and
|
|
87
|
+
* impact. Documents both schemas modified and new schemas created during
|
|
88
|
+
* the fix process.
|
|
89
|
+
*
|
|
90
|
+
* Typical fixes documented:
|
|
91
|
+
*
|
|
92
|
+
* - Inline objects extracted to named types
|
|
93
|
+
* - Foreign keys transformed to object references
|
|
94
|
+
* - Actor reversal arrays removed with API endpoint suggestions
|
|
95
|
+
* - IInvert types created with parent context
|
|
96
|
+
* - Relation types corrected based on lifecycle analysis
|
|
97
|
+
* - Naming conventions standardized
|
|
98
|
+
*
|
|
99
|
+
* Should state "No relation issues require fixes. All relations are
|
|
100
|
+
* properly structured." when no modifications were necessary.
|
|
101
|
+
*/
|
|
102
|
+
plan: string;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { AutoBeInterfaceSchemaRefactor } from "@autobe/interface";
|
|
2
|
+
|
|
3
|
+
export interface IAutoBeInterfaceSchemaRenameApplication {
|
|
4
|
+
/**
|
|
5
|
+
* Analyze DTO type names and identify naming violations.
|
|
6
|
+
*
|
|
7
|
+
* This method examines existing DTO type names to detect violations of the
|
|
8
|
+
* CRITICAL naming rule: ALL words from the Prisma table name MUST be
|
|
9
|
+
* preserved in the DTO type name. Omitting intermediate words breaks
|
|
10
|
+
* type-to-table traceability and causes system failures.
|
|
11
|
+
*
|
|
12
|
+
* The method receives a list of Prisma table names and current DTO type
|
|
13
|
+
* names, then identifies which type names incorrectly omit service prefixes
|
|
14
|
+
* or intermediate components from their corresponding table names.
|
|
15
|
+
*
|
|
16
|
+
* @param props Properties containing refactoring operations to fix naming
|
|
17
|
+
* violations.
|
|
18
|
+
*/
|
|
19
|
+
rename(props: IAutoBeInterfaceSchemaRenameApplication.IProps): void;
|
|
20
|
+
}
|
|
21
|
+
export namespace IAutoBeInterfaceSchemaRenameApplication {
|
|
22
|
+
export interface IProps {
|
|
23
|
+
/**
|
|
24
|
+
* List of refactoring operations to rename incorrectly named DTO types.
|
|
25
|
+
*
|
|
26
|
+
* Each refactor specifies:
|
|
27
|
+
*
|
|
28
|
+
* - `from`: The current INCORRECT type name (e.g., "ISale", "IBbsComment")
|
|
29
|
+
* - `to`: The CORRECT type name with all components preserved (e.g.,
|
|
30
|
+
* "IShoppingSale", "IBbsArticleComment")
|
|
31
|
+
*
|
|
32
|
+
* IMPORTANT: Only include type names that violate the naming rules. If a
|
|
33
|
+
* type name correctly preserves all components from the table name, do NOT
|
|
34
|
+
* include it in the refactors list.
|
|
35
|
+
*
|
|
36
|
+
* The orchestrator will automatically handle:
|
|
37
|
+
*
|
|
38
|
+
* - Renaming the base type (e.g., ISale → IShoppingSale)
|
|
39
|
+
* - Renaming all variants (e.g., ISale.ICreate → IShoppingSale.ICreate)
|
|
40
|
+
* - Renaming page types (e.g., IPageISale → IPageIShoppingSale)
|
|
41
|
+
* - Updating all $ref references throughout the OpenAPI document
|
|
42
|
+
*/
|
|
43
|
+
refactors: AutoBeInterfaceSchemaRefactor[];
|
|
44
|
+
}
|
|
45
|
+
}
|
package/src/orchestrate/interface/structures/IAutoBeInterfaceSchemaSecurityReviewApplication.ts
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { AutoBeOpenApi } from "@autobe/interface";
|
|
2
|
+
|
|
3
|
+
export interface IAutoBeInterfaceSchemaSecurityReviewApplication {
|
|
4
|
+
/**
|
|
5
|
+
* Reviews and validates OpenAPI schema definitions for security compliance.
|
|
6
|
+
*
|
|
7
|
+
* This specialized security review function focuses exclusively on
|
|
8
|
+
* authentication boundaries, data protection, and system integrity. It
|
|
9
|
+
* enforces strict security policies to prevent authentication bypass, data
|
|
10
|
+
* exposure, and unauthorized access.
|
|
11
|
+
*
|
|
12
|
+
* The review process identifies and removes:
|
|
13
|
+
*
|
|
14
|
+
* - Authentication context fields in request DTOs (e.g., bbs_member_id)
|
|
15
|
+
* - Password and token fields in response DTOs
|
|
16
|
+
* - System-managed fields in request DTOs
|
|
17
|
+
* - Phantom fields that don't exist in Prisma schema
|
|
18
|
+
*
|
|
19
|
+
* @param props Security review results including violations found, fixes
|
|
20
|
+
* applied, and modified schemas
|
|
21
|
+
*/
|
|
22
|
+
review: (
|
|
23
|
+
props: IAutoBeInterfaceSchemaSecurityReviewApplication.IProps,
|
|
24
|
+
) => void;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export namespace IAutoBeInterfaceSchemaSecurityReviewApplication {
|
|
28
|
+
/**
|
|
29
|
+
* Output structure for the security review function.
|
|
30
|
+
*
|
|
31
|
+
* Contains the security analysis, remediation actions, and schemas modified
|
|
32
|
+
* for security compliance during the validation process.
|
|
33
|
+
*/
|
|
34
|
+
export interface IProps {
|
|
35
|
+
/** Security analysis and remediation planning information. */
|
|
36
|
+
think: IThink;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Modified schemas resulting from security fixes.
|
|
40
|
+
*
|
|
41
|
+
* Contains ONLY the schemas that were modified for security reasons during
|
|
42
|
+
* review. This focused output enables precise tracking of security-related
|
|
43
|
+
* changes.
|
|
44
|
+
*
|
|
45
|
+
* Security modifications include:
|
|
46
|
+
*
|
|
47
|
+
* - Removing authentication context fields (user_id, session_id, etc.)
|
|
48
|
+
* - Removing password/token fields from responses
|
|
49
|
+
* - Removing system-managed fields from requests
|
|
50
|
+
* - Removing phantom fields not in Prisma schema
|
|
51
|
+
*
|
|
52
|
+
* Return empty object {} when all schemas are already secure and no
|
|
53
|
+
* security fixes were needed.
|
|
54
|
+
*/
|
|
55
|
+
content: Record<string, AutoBeOpenApi.IJsonSchemaDescriptive>;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface IThink {
|
|
59
|
+
/**
|
|
60
|
+
* Security violation findings from the review process.
|
|
61
|
+
*
|
|
62
|
+
* Documents all security issues discovered during validation, categorized
|
|
63
|
+
* by severity level (CRITICAL, HIGH, MEDIUM, LOW). Each violation includes
|
|
64
|
+
* the affected schema name, field name, and specific security rule
|
|
65
|
+
* violated.
|
|
66
|
+
*
|
|
67
|
+
* Common violations documented:
|
|
68
|
+
*
|
|
69
|
+
* - CRITICAL: Authentication context in requests (bbs_member_id, session_id)
|
|
70
|
+
* - CRITICAL: Password/token exposure in responses
|
|
71
|
+
* - CRITICAL: Phantom fields not existing in Prisma schema
|
|
72
|
+
* - HIGH: System-managed fields in requests
|
|
73
|
+
* - HIGH: Immutable ownership fields in updates
|
|
74
|
+
*
|
|
75
|
+
* Should state "No security violations found." when all schemas pass
|
|
76
|
+
* security validation.
|
|
77
|
+
*/
|
|
78
|
+
review: string;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Security remediation actions applied to fix identified violations.
|
|
82
|
+
*
|
|
83
|
+
* Lists all security fixes implemented during the review process, organized
|
|
84
|
+
* by fix type and priority. Each fix documents which field was removed or
|
|
85
|
+
* modified and from which schema.
|
|
86
|
+
*
|
|
87
|
+
* Typical fixes documented:
|
|
88
|
+
*
|
|
89
|
+
* - Authentication context fields removed from request DTOs
|
|
90
|
+
* - Sensitive data removed from response DTOs
|
|
91
|
+
* - Phantom fields deleted to match Prisma schema
|
|
92
|
+
* - System fields removed from client-controllable DTOs
|
|
93
|
+
*
|
|
94
|
+
* Should state "No security issues require fixes. All schemas are secure."
|
|
95
|
+
* when no security modifications were necessary.
|
|
96
|
+
*/
|
|
97
|
+
plan: string;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AutoBeOpenApi, AutoBePrisma } from "@autobe/interface";
|
|
2
2
|
import { AutoBeOpenApiTypeChecker, StringUtil } from "@autobe/utils";
|
|
3
|
-
import { OpenApiTypeChecker } from "@samchon/openapi";
|
|
3
|
+
import { OpenApi, OpenApiTypeChecker } from "@samchon/openapi";
|
|
4
4
|
import typia, { tags } from "typia";
|
|
5
5
|
|
|
6
6
|
export namespace JsonSchemaFactory {
|
|
@@ -53,6 +53,7 @@ export namespace JsonSchemaFactory {
|
|
|
53
53
|
application: AutoBePrisma.IApplication;
|
|
54
54
|
}): void => {
|
|
55
55
|
removeUnused(props.document);
|
|
56
|
+
removeDuplicated(props.document);
|
|
56
57
|
fixTimestamps(props);
|
|
57
58
|
};
|
|
58
59
|
|
|
@@ -84,6 +85,47 @@ export namespace JsonSchemaFactory {
|
|
|
84
85
|
if (used.has(key) === false) delete document.components.schemas[key];
|
|
85
86
|
};
|
|
86
87
|
|
|
88
|
+
const removeDuplicated = (document: AutoBeOpenApi.IDocument): void => {
|
|
89
|
+
// gather duplicated schemas
|
|
90
|
+
const correct: Map<string, string> = new Map();
|
|
91
|
+
for (const key of Object.keys(document.components.schemas)) {
|
|
92
|
+
if (key.includes(".") === false) continue;
|
|
93
|
+
const dotRemoved: string = key.replace(".", "");
|
|
94
|
+
if (document.components.schemas[dotRemoved] === undefined) continue;
|
|
95
|
+
correct.set(dotRemoved, key);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// fix operations' references
|
|
99
|
+
for (const op of document.operations) {
|
|
100
|
+
if (op.requestBody && correct.has(op.requestBody.typeName))
|
|
101
|
+
op.requestBody.typeName = correct.get(op.requestBody.typeName)!;
|
|
102
|
+
if (op.responseBody && correct.has(op.responseBody.typeName))
|
|
103
|
+
op.responseBody.typeName = correct.get(op.responseBody.typeName)!;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// fix schemas' references
|
|
107
|
+
const $refChangers: Map<OpenApi.IJsonSchema, () => void> = new Map();
|
|
108
|
+
for (const value of Object.values(document.components.schemas))
|
|
109
|
+
OpenApiTypeChecker.visit({
|
|
110
|
+
components: { schemas: document.components.schemas },
|
|
111
|
+
schema: value,
|
|
112
|
+
closure: (next) => {
|
|
113
|
+
if (OpenApiTypeChecker.isReference(next) === false) return;
|
|
114
|
+
const x: string = next.$ref.split("/").pop()!;
|
|
115
|
+
const y: string | undefined = correct.get(x);
|
|
116
|
+
if (y === undefined) return;
|
|
117
|
+
$refChangers.set(
|
|
118
|
+
next,
|
|
119
|
+
() => (next.$ref = `#/components/schemas/${y}`),
|
|
120
|
+
);
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
for (const fn of $refChangers.values()) fn();
|
|
124
|
+
|
|
125
|
+
// remove duplicated schemas
|
|
126
|
+
for (const key of correct.keys()) delete document.components.schemas[key];
|
|
127
|
+
};
|
|
128
|
+
|
|
87
129
|
const fixTimestamps = (props: {
|
|
88
130
|
document: AutoBeOpenApi.IDocument;
|
|
89
131
|
application: AutoBePrisma.IApplication;
|
|
@@ -220,8 +262,8 @@ namespace IPage {
|
|
|
220
262
|
* refresh tokens along with their expiration information.
|
|
221
263
|
*
|
|
222
264
|
* This token structure is automatically included in API schemas when the system
|
|
223
|
-
* detects authorization
|
|
224
|
-
* standard format for JWT-based authentication across the generated backend
|
|
265
|
+
* detects authorization actors in the requirements analysis phase. It provides
|
|
266
|
+
* a standard format for JWT-based authentication across the generated backend
|
|
225
267
|
* applications.
|
|
226
268
|
*/
|
|
227
269
|
interface IAuthorizationToken {
|
|
@@ -13,6 +13,7 @@ export namespace JsonSchemaValidator {
|
|
|
13
13
|
export const validateSchemas = (props: IProps): void => {
|
|
14
14
|
validateAuthorization(props);
|
|
15
15
|
validatePrismaSchema(props.errors);
|
|
16
|
+
validateRecursive(props);
|
|
16
17
|
for (const key of Object.keys(props.schemas))
|
|
17
18
|
validateKey({
|
|
18
19
|
errors: props.errors,
|
|
@@ -174,4 +175,113 @@ export namespace JsonSchemaValidator {
|
|
|
174
175
|
`;
|
|
175
176
|
}
|
|
176
177
|
};
|
|
178
|
+
|
|
179
|
+
const validateRecursive = (props: IProps): void => {
|
|
180
|
+
for (const [key, value] of Object.entries(props.schemas)) {
|
|
181
|
+
const report = (description: string) =>
|
|
182
|
+
props.errors.push({
|
|
183
|
+
path: `${props.path}[${JSON.stringify(key)}]`,
|
|
184
|
+
expected: "Non-infinite recursive schema definition",
|
|
185
|
+
value,
|
|
186
|
+
description,
|
|
187
|
+
});
|
|
188
|
+
if (
|
|
189
|
+
AutoBeOpenApiTypeChecker.isReference(value) &&
|
|
190
|
+
value.$ref === `#/components/schemas/${key}`
|
|
191
|
+
)
|
|
192
|
+
report(StringUtil.trim`
|
|
193
|
+
You have defined a nonsensible type like below:
|
|
194
|
+
|
|
195
|
+
\`\`\`typescript
|
|
196
|
+
type ${key} = ${key};
|
|
197
|
+
\`\`\`
|
|
198
|
+
|
|
199
|
+
This is an infinite recursive type definition that cannot exist in any
|
|
200
|
+
programming language. A type cannot be defined as itself - this creates
|
|
201
|
+
a circular definition with no base case, making the type impossible to
|
|
202
|
+
instantiate or validate.
|
|
203
|
+
|
|
204
|
+
If you need tree or graph structures, use explicit relationships with
|
|
205
|
+
ID references (e.g., parentId: string) instead of recursive type definitions.
|
|
206
|
+
Remove the self-reference and redesign the schema at the next time.
|
|
207
|
+
`);
|
|
208
|
+
else if (
|
|
209
|
+
AutoBeOpenApiTypeChecker.isArray(value) &&
|
|
210
|
+
AutoBeOpenApiTypeChecker.isReference(value.items) &&
|
|
211
|
+
value.items.$ref === `#/components/schemas/${key}`
|
|
212
|
+
)
|
|
213
|
+
report(StringUtil.trim`
|
|
214
|
+
You have defined a nonsensible type like below:
|
|
215
|
+
|
|
216
|
+
\`\`\`typescript
|
|
217
|
+
type ${key} = Array<${key}>;
|
|
218
|
+
\`\`\`
|
|
219
|
+
|
|
220
|
+
This is an infinite recursive array type that cannot exist in any
|
|
221
|
+
programming language. An array of itself creates a circular definition
|
|
222
|
+
with no base case, making the type impossible to instantiate or validate.
|
|
223
|
+
|
|
224
|
+
If you need nested structures, define explicit depth levels with separate
|
|
225
|
+
types, or use parent-child relationships with ID references.
|
|
226
|
+
Remove the self-reference and redesign the schema at the next time.
|
|
227
|
+
`);
|
|
228
|
+
else if (
|
|
229
|
+
AutoBeOpenApiTypeChecker.isOneOf(value) &&
|
|
230
|
+
value.oneOf.some(
|
|
231
|
+
(v) =>
|
|
232
|
+
AutoBeOpenApiTypeChecker.isReference(v) &&
|
|
233
|
+
v.$ref === `#/components/schemas/${key}`,
|
|
234
|
+
) === true
|
|
235
|
+
)
|
|
236
|
+
report(StringUtil.trim`
|
|
237
|
+
You have defined a nonsensible type like below:
|
|
238
|
+
|
|
239
|
+
\`\`\`typescript
|
|
240
|
+
type ${key} = ${key} | ...;
|
|
241
|
+
\`\`\`
|
|
242
|
+
|
|
243
|
+
This is an infinite recursive union type that cannot exist in any
|
|
244
|
+
programming language. A union that includes itself as a variant creates
|
|
245
|
+
a circular definition with no base case, making the type impossible to
|
|
246
|
+
instantiate or validate.
|
|
247
|
+
|
|
248
|
+
If you need polymorphic hierarchies, define separate concrete types for
|
|
249
|
+
each variant without including the union type itself as a variant.
|
|
250
|
+
Remove the self-reference and redesign the schema at the next time.
|
|
251
|
+
`);
|
|
252
|
+
else if (
|
|
253
|
+
AutoBeOpenApiTypeChecker.isObject(value) &&
|
|
254
|
+
value.properties &&
|
|
255
|
+
value.required &&
|
|
256
|
+
Object.entries(value.properties).some(
|
|
257
|
+
([k, v]) =>
|
|
258
|
+
AutoBeOpenApiTypeChecker.isReference(v) &&
|
|
259
|
+
v.$ref === `#/components/schemas/${key}` &&
|
|
260
|
+
value.required.includes(k),
|
|
261
|
+
)
|
|
262
|
+
)
|
|
263
|
+
report(StringUtil.trim`
|
|
264
|
+
You have defined a nonsensible type like below:
|
|
265
|
+
|
|
266
|
+
\`\`\`typescript
|
|
267
|
+
interface ${key} {
|
|
268
|
+
someProperty: ${key}; // required, non-nullable
|
|
269
|
+
}
|
|
270
|
+
\`\`\`
|
|
271
|
+
|
|
272
|
+
This is an infinite recursive object type that cannot exist in any
|
|
273
|
+
programming language. A required non-nullable property referencing its
|
|
274
|
+
own type creates a circular definition with no base case, making the
|
|
275
|
+
type impossible to instantiate.
|
|
276
|
+
|
|
277
|
+
To create an instance of ${key}, you would need an instance of ${key},
|
|
278
|
+
which requires another instance of ${key}, infinitely. This is logically
|
|
279
|
+
impossible.
|
|
280
|
+
|
|
281
|
+
If you need parent-child or graph relationships, make the self-referencing
|
|
282
|
+
property either nullable or optional, or use ID references (e.g., parentId: string).
|
|
283
|
+
Remove the required self-reference and redesign the schema at the next time.
|
|
284
|
+
`);
|
|
285
|
+
}
|
|
286
|
+
};
|
|
177
287
|
}
|
|
@@ -65,19 +65,19 @@ export const transformPrismaComponentsHistories = (
|
|
|
65
65
|
- \`mv_shopping_daily_stats\`
|
|
66
66
|
|
|
67
67
|
${
|
|
68
|
-
state.analyze.
|
|
68
|
+
state.analyze.actors.length > 0
|
|
69
69
|
? StringUtil.trim`
|
|
70
|
-
## User
|
|
71
|
-
|
|
72
|
-
The Requirement Analysis Report contains the following user
|
|
73
|
-
|
|
74
|
-
**Do not normalize** user
|
|
75
|
-
Instead, create separate tables for each distinct
|
|
76
|
-
|
|
77
|
-
Create separate tables for each
|
|
78
|
-
|
|
79
|
-
${state.analyze.
|
|
80
|
-
.map((
|
|
70
|
+
## User Actor Handling
|
|
71
|
+
|
|
72
|
+
The Requirement Analysis Report contains the following user actors: ${state.analyze.actors.join(", ")}
|
|
73
|
+
|
|
74
|
+
**Do not normalize** user actors into a single table.
|
|
75
|
+
Instead, create separate tables for each distinct actor mentioned in the requirements.
|
|
76
|
+
|
|
77
|
+
Create separate tables for each actor:
|
|
78
|
+
|
|
79
|
+
${state.analyze.actors
|
|
80
|
+
.map((actor) => `- ${props.prefix}_${actor.name.toLowerCase()}`)
|
|
81
81
|
.join("\n")}
|
|
82
82
|
`
|
|
83
83
|
: ""
|
|
@@ -2,13 +2,13 @@ import {
|
|
|
2
2
|
AutoBeAssistantMessageHistory,
|
|
3
3
|
AutoBePrisma,
|
|
4
4
|
AutoBePrismaCompleteEvent,
|
|
5
|
-
|
|
5
|
+
AutoBePrismaComponentEvent,
|
|
6
6
|
AutoBePrismaHistory,
|
|
7
7
|
AutoBePrismaReviewEvent,
|
|
8
8
|
IAutoBeCompiler,
|
|
9
9
|
IAutoBePrismaValidation,
|
|
10
10
|
} from "@autobe/interface";
|
|
11
|
-
import {
|
|
11
|
+
import { AutoBePrismaSchemaEvent } from "@autobe/interface/src/events/AutoBePrismaSchemaEvent";
|
|
12
12
|
import { ILlmSchema } from "@samchon/openapi";
|
|
13
13
|
import { v7 } from "uuid";
|
|
14
14
|
|
|
@@ -44,12 +44,12 @@ export const orchestratePrisma = async <Model extends ILlmSchema.Model>(
|
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
// COMPONENTS
|
|
47
|
-
const componentEvent:
|
|
47
|
+
const componentEvent: AutoBePrismaComponentEvent =
|
|
48
48
|
await orchestratePrismaComponents(ctx, props.instruction);
|
|
49
49
|
ctx.dispatch(componentEvent);
|
|
50
50
|
|
|
51
51
|
// CONSTRUCT AST DATA
|
|
52
|
-
const schemaEvents:
|
|
52
|
+
const schemaEvents: AutoBePrismaSchemaEvent[] =
|
|
53
53
|
await orchestratePrismaSchemas(
|
|
54
54
|
ctx,
|
|
55
55
|
props.instruction,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IAgenticaController } from "@agentica/core";
|
|
2
|
-
import {
|
|
2
|
+
import { AutoBePrismaComponentEvent } from "@autobe/interface/src/events/AutoBePrismaComponentEvent";
|
|
3
3
|
import { ILlmApplication, ILlmSchema } from "@samchon/openapi";
|
|
4
4
|
import { IPointer } from "tstl";
|
|
5
5
|
import typia from "typia";
|
|
@@ -16,14 +16,14 @@ export async function orchestratePrismaComponents<
|
|
|
16
16
|
ctx: AutoBeContext<Model>,
|
|
17
17
|
instruction: string,
|
|
18
18
|
message: string = "Design database from the given requirement analysis documents.",
|
|
19
|
-
): Promise<
|
|
19
|
+
): Promise<AutoBePrismaComponentEvent> {
|
|
20
20
|
const start: Date = new Date();
|
|
21
21
|
const pointer: IPointer<IAutoBePrismaComponentApplication.IProps | null> = {
|
|
22
22
|
value: null,
|
|
23
23
|
};
|
|
24
24
|
const prefix: string | null = ctx.state().analyze?.prefix ?? null;
|
|
25
25
|
const { tokenUsage } = await ctx.conversate({
|
|
26
|
-
source: "
|
|
26
|
+
source: "prismaComponent",
|
|
27
27
|
histories: transformPrismaComponentsHistories(ctx.state(), {
|
|
28
28
|
prefix,
|
|
29
29
|
instruction,
|
|
@@ -40,7 +40,7 @@ export async function orchestratePrismaComponents<
|
|
|
40
40
|
if (pointer.value === null)
|
|
41
41
|
throw new Error("Failed to extract files and tables."); // unreachable
|
|
42
42
|
return {
|
|
43
|
-
type: "
|
|
43
|
+
type: "prismaComponent",
|
|
44
44
|
id: v7(),
|
|
45
45
|
created_at: start.toISOString(),
|
|
46
46
|
thinking: pointer.value.thinking,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IAgenticaController } from "@agentica/core";
|
|
2
2
|
import { AutoBePrisma } from "@autobe/interface";
|
|
3
|
-
import {
|
|
3
|
+
import { AutoBePrismaSchemaEvent } from "@autobe/interface/src/events/AutoBePrismaSchemaEvent";
|
|
4
4
|
import { StringUtil } from "@autobe/utils";
|
|
5
5
|
import { ILlmApplication, ILlmSchema, IValidation } from "@samchon/openapi";
|
|
6
6
|
import { IPointer } from "tstl";
|
|
@@ -17,7 +17,7 @@ export async function orchestratePrismaSchemas<Model extends ILlmSchema.Model>(
|
|
|
17
17
|
ctx: AutoBeContext<Model>,
|
|
18
18
|
instruction: string,
|
|
19
19
|
componentList: AutoBePrisma.IComponent[],
|
|
20
|
-
): Promise<
|
|
20
|
+
): Promise<AutoBePrismaSchemaEvent[]> {
|
|
21
21
|
const start: Date = new Date();
|
|
22
22
|
const total: number = componentList
|
|
23
23
|
.map((c) => c.tables.length)
|
|
@@ -29,7 +29,7 @@ export async function orchestratePrismaSchemas<Model extends ILlmSchema.Model>(
|
|
|
29
29
|
.filter((y) => component !== y)
|
|
30
30
|
.map((c) => c.tables)
|
|
31
31
|
.flat();
|
|
32
|
-
const event:
|
|
32
|
+
const event: AutoBePrismaSchemaEvent = await process(ctx, {
|
|
33
33
|
instruction,
|
|
34
34
|
component,
|
|
35
35
|
otherTables,
|
|
@@ -55,12 +55,12 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
55
55
|
completed: IPointer<number>;
|
|
56
56
|
promptCacheKey: string;
|
|
57
57
|
},
|
|
58
|
-
): Promise<
|
|
58
|
+
): Promise<AutoBePrismaSchemaEvent> {
|
|
59
59
|
const pointer: IPointer<IAutoBePrismaSchemaApplication.IProps | null> = {
|
|
60
60
|
value: null,
|
|
61
61
|
};
|
|
62
62
|
const { tokenUsage } = await ctx.conversate({
|
|
63
|
-
source: "
|
|
63
|
+
source: "prismaSchema",
|
|
64
64
|
histories: transformPrismaSchemaHistories({
|
|
65
65
|
analysis:
|
|
66
66
|
ctx
|
|
@@ -87,7 +87,7 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
87
87
|
if (pointer.value === null)
|
|
88
88
|
throw new Error("Unreachable code: Prisma Schema not generated");
|
|
89
89
|
return {
|
|
90
|
-
type: "
|
|
90
|
+
type: "prismaSchema",
|
|
91
91
|
id: v7(),
|
|
92
92
|
created_at: props.start.toISOString(),
|
|
93
93
|
plan: pointer.value.plan,
|
|
@@ -101,7 +101,7 @@ async function process<Model extends ILlmSchema.Model>(
|
|
|
101
101
|
completed: (props.completed.value += props.component.tables.length),
|
|
102
102
|
total: props.total,
|
|
103
103
|
step: ctx.state().analyze?.step ?? 0,
|
|
104
|
-
} satisfies
|
|
104
|
+
} satisfies AutoBePrismaSchemaEvent;
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
function createController<Model extends ILlmSchema.Model>(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IAgenticaHistoryJson } from "@agentica/core";
|
|
2
|
-
import {
|
|
2
|
+
import { AutoBeAnalyzeActor } from "@autobe/interface";
|
|
3
3
|
import { StringUtil } from "@autobe/utils";
|
|
4
4
|
import { ILlmSchema } from "@samchon/openapi";
|
|
5
5
|
import { v7 } from "uuid";
|
|
@@ -11,7 +11,7 @@ export const transformRealizeAuthorizationHistories = <
|
|
|
11
11
|
Model extends ILlmSchema.Model,
|
|
12
12
|
>(
|
|
13
13
|
ctx: AutoBeContext<Model>,
|
|
14
|
-
|
|
14
|
+
actor: AutoBeAnalyzeActor,
|
|
15
15
|
): Array<
|
|
16
16
|
IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage
|
|
17
17
|
> => {
|
|
@@ -27,9 +27,10 @@ export const transformRealizeAuthorizationHistories = <
|
|
|
27
27
|
created_at: new Date().toISOString(),
|
|
28
28
|
type: "systemMessage",
|
|
29
29
|
text: StringUtil.trim`
|
|
30
|
-
##
|
|
30
|
+
## Actor
|
|
31
|
+
|
|
31
32
|
\`\`\`json
|
|
32
|
-
${JSON.stringify(
|
|
33
|
+
${JSON.stringify(actor)}
|
|
33
34
|
\`\`\`
|
|
34
35
|
|
|
35
36
|
## Prisma Schema
|
|
@@ -42,9 +43,9 @@ export const transformRealizeAuthorizationHistories = <
|
|
|
42
43
|
|
|
43
44
|
Please follow this naming convention for the authorization components:
|
|
44
45
|
|
|
45
|
-
- Provider Name: ${
|
|
46
|
-
- Decorator Name: ${
|
|
47
|
-
- Payload Name: ${
|
|
46
|
+
- Provider Name: ${actor.name}Authorize (e.g. ${actor.name}Authorize)
|
|
47
|
+
- Decorator Name: ${actor.name.charAt(0).toUpperCase() + actor.name.slice(1)}Auth (e.g. ${actor.name.charAt(0).toUpperCase() + actor.name.slice(1)}Auth)
|
|
48
|
+
- Payload Name: ${actor.name.charAt(0).toUpperCase() + actor.name.slice(1)}Payload (e.g. ${actor.name.charAt(0).toUpperCase() + actor.name.slice(1)}Payload)
|
|
48
49
|
`,
|
|
49
50
|
},
|
|
50
51
|
];
|
|
@@ -57,7 +57,7 @@ export const transformRealizeAuthorizationCorrectHistories = <
|
|
|
57
57
|
name: auth.payload.name,
|
|
58
58
|
content: auth.payload.content,
|
|
59
59
|
},
|
|
60
|
-
} satisfies Omit<AutoBeRealizeAuthorization, "
|
|
60
|
+
} satisfies Omit<AutoBeRealizeAuthorization, "actor">)}
|
|
61
61
|
\`\`\`
|
|
62
62
|
|
|
63
63
|
## Prisma Schema
|
|
@@ -86,9 +86,9 @@ export const transformRealizeAuthorizationCorrectHistories = <
|
|
|
86
86
|
|
|
87
87
|
Please follow this naming convention for the authorization components:
|
|
88
88
|
|
|
89
|
-
- Provider Name: ${auth.
|
|
90
|
-
- Decorator Name: ${auth.
|
|
91
|
-
- Payload Name: ${auth.
|
|
89
|
+
- Provider Name: ${auth.actor.name.toLowerCase()}Authorize (e.g. ${auth.actor.name.toLowerCase()}Authorize)
|
|
90
|
+
- Decorator Name: ${auth.actor.name.charAt(0).toUpperCase() + auth.actor.name.slice(1).toLowerCase()}Auth (e.g. ${auth.actor.name.charAt(0).toUpperCase() + auth.actor.name.slice(1).toLowerCase()}Auth)
|
|
91
|
+
- Payload Name: ${auth.actor.name.charAt(0).toUpperCase() + auth.actor.name.slice(1).toLowerCase()}Payload (e.g. ${auth.actor.name.charAt(0).toUpperCase() + auth.actor.name.slice(1).toLowerCase()}Payload)
|
|
92
92
|
`,
|
|
93
93
|
},
|
|
94
94
|
];
|