@autobe/agent 0.10.6 → 0.11.1
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 +13 -46
- package/lib/AutoBeAgent.js.map +1 -1
- package/lib/constants/AutoBeSystemPromptConstant.d.ts +11 -6
- package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
- package/lib/context/AutoBeContext.d.ts +3 -2
- package/lib/factory/getAutoBeGenerated.d.ts +5 -0
- package/lib/factory/getAutoBeGenerated.js +307 -0
- package/lib/factory/getAutoBeGenerated.js.map +1 -0
- package/lib/index.mjs +1652 -1402
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/analyze/AutoBeAnalyzeFileSystem.d.ts +2 -7
- package/lib/orchestrate/analyze/AutoBeAnalyzeFileSystem.js +1 -9
- package/lib/orchestrate/analyze/AutoBeAnalyzeFileSystem.js.map +1 -1
- package/lib/orchestrate/analyze/AutoBeAnalyzeRole.d.ts +13 -0
- package/lib/orchestrate/analyze/AutoBeAnalyzeRole.js +3 -0
- package/lib/orchestrate/analyze/AutoBeAnalyzeRole.js.map +1 -0
- package/lib/orchestrate/analyze/orchestrateAnalyze.d.ts +0 -25
- package/lib/orchestrate/analyze/orchestrateAnalyze.js +22 -420
- package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeComposer.d.ts +6 -0
- package/lib/orchestrate/analyze/orchestrateAnalyzeComposer.js +561 -0
- package/lib/orchestrate/analyze/orchestrateAnalyzeComposer.js.map +1 -0
- package/lib/orchestrate/analyze/orchestrateAnalyzeReviewer.d.ts +6 -0
- package/lib/orchestrate/analyze/orchestrateAnalyzeReviewer.js +41 -0
- package/lib/orchestrate/analyze/orchestrateAnalyzeReviewer.js.map +1 -0
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.d.ts +14 -0
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js +468 -0
- package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js.map +1 -0
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeComposerApplication.d.ts +68 -0
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeComposerApplication.js +3 -0
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeComposerApplication.js.map +1 -0
- package/lib/orchestrate/analyze/transformAnalyzeReviewerHistories.d.ts +5 -0
- package/lib/orchestrate/analyze/transformAnalyzeReviewerHistories.js +27 -0
- package/lib/orchestrate/analyze/transformAnalyzeReviewerHistories.js.map +1 -0
- package/lib/orchestrate/analyze/transformAnalyzeWriteHistories.d.ts +12 -0
- package/lib/orchestrate/analyze/transformAnalyzeWriteHistories.js +78 -0
- package/lib/orchestrate/analyze/transformAnalyzeWriteHistories.js.map +1 -0
- package/lib/orchestrate/analyze/writeDocumentUntilReviewPassed.d.ts +6 -0
- package/lib/orchestrate/analyze/writeDocumentUntilReviewPassed.js +58 -0
- package/lib/orchestrate/analyze/writeDocumentUntilReviewPassed.js.map +1 -0
- package/lib/orchestrate/interface/orchestrateInterface.js +0 -2
- package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceComponents.js +17 -137
- package/lib/orchestrate/interface/orchestrateInterfaceComponents.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +92 -141
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrisma.js +9 -5
- package/lib/orchestrate/prisma/orchestratePrisma.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js +54 -25
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js +4 -3
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
- package/lib/orchestrate/prisma/{orchestratePrismaSchema.d.ts → orchestratePrismaSchemas.d.ts} +2 -4
- package/lib/orchestrate/prisma/{orchestratePrismaSchema.js → orchestratePrismaSchemas.js} +269 -203
- package/lib/orchestrate/prisma/orchestratePrismaSchemas.js.map +1 -0
- package/lib/orchestrate/prisma/transformPrismaComponentsHistories.js +1 -1
- package/lib/orchestrate/prisma/transformPrismaComponentsHistories.js.map +1 -1
- package/lib/orchestrate/prisma/transformPrismaCorrectHistories.js +1 -1
- package/lib/orchestrate/prisma/transformPrismaHistories.js +1 -1
- package/lib/orchestrate/prisma/transformPrismaHistories.js.map +1 -1
- package/lib/orchestrate/prisma/transformPrismaSchemaHistories.d.ts +2 -6
- package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js +24 -32
- package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js.map +1 -1
- package/lib/orchestrate/realize/RealizePipe.d.ts +5 -0
- package/lib/orchestrate/realize/RealizePipe.js +14 -0
- package/lib/orchestrate/realize/RealizePipe.js.map +1 -0
- package/lib/orchestrate/realize/orchestrateRealize.d.ts +0 -6
- package/lib/orchestrate/realize/orchestrateRealize.js +6 -43
- package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealizeCoder.d.ts +3 -3
- package/lib/orchestrate/realize/orchestrateRealizeCoder.js +124 -59
- package/lib/orchestrate/realize/orchestrateRealizeCoder.js.map +1 -1
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.d.ts +188 -18
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCompile.d.ts +23 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCompile.js +3 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCompile.js.map +1 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeFailedSymbol.d.ts +2 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeFailedSymbol.js +5 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeFailedSymbol.js.map +1 -0
- package/lib/orchestrate/realize/transformRealizeCoderHistories.d.ts +2 -1
- package/lib/orchestrate/realize/transformRealizeCoderHistories.js +50 -36
- package/lib/orchestrate/realize/transformRealizeCoderHistories.js.map +1 -1
- package/lib/orchestrate/realize/writeCodeUntilCompilePassed.d.ts +5 -0
- package/lib/orchestrate/realize/writeCodeUntilCompilePassed.js +123 -0
- package/lib/orchestrate/realize/writeCodeUntilCompilePassed.js.map +1 -0
- package/lib/orchestrate/test/compile/getTestExternalDeclarations.js +4 -1
- package/lib/orchestrate/test/compile/getTestExternalDeclarations.js.map +1 -1
- package/lib/orchestrate/test/compile/getTestScenarioArtifacts.js +2 -1
- package/lib/orchestrate/test/compile/getTestScenarioArtifacts.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTest.js +11 -5
- package/lib/orchestrate/test/orchestrateTest.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrect.js +3 -2
- package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestWrite.js +22 -13
- package/lib/orchestrate/test/orchestrateTestWrite.js.map +1 -1
- package/lib/structures/IAutoBeProps.d.ts +8 -8
- package/lib/utils/pipe.d.ts +5 -0
- package/lib/utils/pipe.js +14 -0
- package/lib/utils/pipe.js.map +1 -0
- package/package.json +6 -6
- package/src/AutoBeAgent.ts +22 -76
- package/src/constants/AutoBeSystemPromptConstant.ts +11 -6
- package/src/context/AutoBeContext.ts +3 -1
- package/src/factory/getAutoBeGenerated.ts +113 -0
- package/src/orchestrate/analyze/AutoBeAnalyzeFileSystem.ts +5 -13
- package/src/orchestrate/analyze/AutoBeAnalyzeRole.ts +14 -0
- package/src/orchestrate/analyze/orchestrateAnalyze.ts +30 -165
- package/src/orchestrate/analyze/orchestrateAnalyzeComposer.ts +115 -0
- package/src/orchestrate/analyze/orchestrateAnalyzeReviewer.ts +39 -0
- package/src/orchestrate/analyze/orchestrateAnalyzeWrite.ts +106 -0
- package/src/orchestrate/analyze/structures/IAutoBeAnalyzeComposerApplication.ts +74 -0
- package/src/orchestrate/analyze/transformAnalyzeReviewerHistories.ts +31 -0
- package/src/orchestrate/analyze/transformAnalyzeWriteHistories.ts +94 -0
- package/src/orchestrate/analyze/writeDocumentUntilReviewPassed.ts +66 -0
- package/src/orchestrate/interface/orchestrateInterface.ts +0 -2
- package/src/orchestrate/interface/orchestrateInterfaceComponents.ts +2 -3
- package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +21 -0
- package/src/orchestrate/prisma/orchestratePrisma.ts +12 -5
- package/src/orchestrate/prisma/orchestratePrismaComponent.ts +4 -13
- package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +9 -4
- package/src/orchestrate/prisma/orchestratePrismaSchemas.ts +265 -0
- package/src/orchestrate/prisma/transformPrismaSchemaHistories.ts +26 -37
- package/src/orchestrate/realize/RealizePipe.ts +39 -0
- package/src/orchestrate/realize/orchestrateRealize.ts +3 -91
- package/src/orchestrate/realize/orchestrateRealizeCoder.ts +60 -25
- package/src/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.ts +192 -18
- package/src/orchestrate/realize/structures/IAutoBeRealizeCompile.ts +34 -0
- package/src/orchestrate/realize/structures/IAutoBeRealizeFailedSymbol.ts +2 -0
- package/src/orchestrate/realize/transformRealizeCoderHistories.ts +58 -34
- package/src/orchestrate/realize/writeCodeUntilCompilePassed.ts +178 -0
- package/src/orchestrate/test/compile/getTestExternalDeclarations.ts +5 -4
- package/src/orchestrate/test/compile/getTestScenarioArtifacts.ts +7 -2
- package/src/orchestrate/test/orchestrateTest.ts +14 -12
- package/src/orchestrate/test/orchestrateTestCorrect.ts +10 -9
- package/src/orchestrate/test/orchestrateTestWrite.ts +33 -27
- package/src/structures/IAutoBeProps.ts +10 -7
- package/src/utils/pipe.ts +39 -0
- package/lib/orchestrate/analyze/AutoBeAnalyzeAgent.d.ts +0 -20
- package/lib/orchestrate/analyze/AutoBeAnalyzeAgent.js +0 -735
- package/lib/orchestrate/analyze/AutoBeAnalyzeAgent.js.map +0 -1
- package/lib/orchestrate/analyze/AutoBeAnalyzeReviewer.d.ts +0 -15
- package/lib/orchestrate/analyze/AutoBeAnalyzeReviewer.js +0 -44
- package/lib/orchestrate/analyze/AutoBeAnalyzeReviewer.js.map +0 -1
- package/lib/orchestrate/prisma/orchestratePrismaSchema.js.map +0 -1
- package/src/orchestrate/analyze/AutoBeAnalyzeAgent.ts +0 -219
- package/src/orchestrate/analyze/AutoBeAnalyzeReviewer.ts +0 -62
- package/src/orchestrate/prisma/orchestratePrismaSchema.ts +0 -157
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.transformRealizeCoderHistories = void 0;
|
|
4
4
|
const uuid_1 = require("uuid");
|
|
5
|
-
const transformRealizeCoderHistories = (state, props, artifacts) => {
|
|
5
|
+
const transformRealizeCoderHistories = (state, props, artifacts, previous, total, diagnostics) => {
|
|
6
6
|
if (state.analyze === null)
|
|
7
7
|
return [
|
|
8
8
|
{
|
|
@@ -75,47 +75,61 @@ const transformRealizeCoderHistories = (state, props, artifacts) => {
|
|
|
75
75
|
id: (0, uuid_1.v4)(),
|
|
76
76
|
created_at: new Date().toISOString(),
|
|
77
77
|
type: "systemMessage",
|
|
78
|
-
text: [
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
"if you want to import this files, write this: 'import { something } from '../api/structures/something';'",
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
JSON.stringify(artifacts.
|
|
110
|
-
|
|
111
|
-
|
|
78
|
+
text: "# \uD83E\uDDE0 Realize Agent Role\n\nYou are the **Realize Coder Agent**, an expert-level backend developer trained to implement production-grade TypeScript logic in a consistent, type-safe, and maintainable format.\n\nYour primary role is to generate **correct and complete code** based on the provided input (such as operation description, input types, and system rules).\nYou must **never assume context beyond what's given**, and all code should be self-contained, logically consistent, and adhere strictly to the system conventions.\n\nYou possess a **deep understanding of the TypeScript type system**, and you write code with **strong, precise types** rather than relying on weak typing.\nYou **prefer literal types, union types, and branded types** over unsafe casts or generalizations. You **never use `as any` or `satisfies any`** unless it is the only viable solution to resolve an edge-case type incompatibility.\n\nWhen working with `Date` values, you always convert them properly using `.toISOString()`, because you understand that date fields must be typed as `string & tags.Format<'date-time'>` rather than using native `Date`.\n**Never assign native `Date` objects directly. Always convert them with `.toISOString()` before assignment, both in data creation and return objects.**\n\nYou specialize in identifying and resolving **TypeScript compilation errors**, especially those involving structural or branding mismatches. Your primary goal is to write code that **passes type-checking under strict mode**, without bypassing the type system.\n\n**When errors occur, you must fix the error first. However, you are also encouraged to refactor and improve other parts of the code beyond just the error locations, as long as the overall correctness and type safety remain intact. This means you may optimize, clean up, or enhance code clarity and maintainability even if those parts are not directly related to the reported errors.**\n\nYour thinking is guided by type safety, domain clarity, and runtime predictability.\n\n---\n\n## \uD83D\uDCCC Function Structure\n\nThe function must always take the following **three arguments**:\n\n```typescript\nexport async function something(\n user: { id: string & tags.Format<'uuid'>, type: string },\n parameters: Record<string, string>,\n body: Record<string, any>\n) {\n ...\n}\n```\n\nThis structure must be used even for GET requests or when `parameters` or `body` are unused.\nIn such cases, define them as:\n\n```typescript\nparameters: Record<string, never>\nbody: Record<string, never>\n```\n\n> \u26A0\uFE0F Do not omit any of the three arguments. All functions must include user, parameters, and body, even if some of them are unused. This ensures consistent structure and prevents runtime or compilation errors due to missing parameters.\n\n> \u26A0\uFE0F When throwing errors, please use Error objects and do not use any other error formats.\n\n---\n\n## \uD83D\uDEAB Strictly Prohibited\n\n1. Use of `as any` or `satisfies any`\n2. Use of `as` for type assertions is prohibited \n - \u274C Do not use `as` to bypass the type system or forcibly convert between incompatible types. \n - \u2705 You **may** use `as` for:\n - Narrowing to **literal union types** (e.g., `1 as 1 | 2`, `\"admin\" as Role`)\n - Applying **brand types** (e.g., `id as string & tags.Format<'uuid'>`)\n\n > \u26A0\uFE0F These are the only acceptable use cases. Do not use `as` in any other context.\n3. Assuming field presence without declaration (e.g., `parameters.id`)\n4. Manual validation (all values are assumed to be valid and present)\n5. Unapproved imports (e.g., lodash)\n - The type defined in `src/api/structures` can be imported and used indefinitely as an exception. prioritize the use of the type defined here over the type of Prisma.\n6. Using `MyGlobal.user`, `MyGlobal.requestUserId`, or similar \u2013 always use the provided `user` argument\n7. Do not use dynamic `import()` expressions; all imports must be static to ensure predictable module resolution.\n\n > \u26A0\uFE0F For example, avoid patterns like `import(\"@prisma/client\").Prisma.UserUpdateInput` or `import(\"typia\").assert`.\n > These can break type resolution and cause cryptic errors such as:\n > `\"Property 'assert' does not exist on type 'typeof import(\\\"node_modules/typia/lib/tags/index\\\")'\"`\n\n\n## \uD83E\uDDFE Auto-Injected Imports\n\nThe following modules are **automatically injected** at the top of every generated file:\n\n- `import { MyGlobal } from \"../MyGlobal\";`\n- `import typia, { tags } from \"typia\";`\n- `import { Prisma } from \"@prisma/client\";`\n- `import { jwtDecode } from \"./jwtDecode\";`\n- `import { v4 } from \"uuid\";`\n\n\u274C Do **NOT** include these imports manually. \n\u2705 You may use them directly in your implementation without declaring them.\n\nThese imports are globally available and will always be present.\n\n## \uD83E\uDDD1\u200D\uD83D\uDCBB Type Usage Guidelines\n\n- **Preferred Source:** Always prefer using types defined in `src/api/structures` or your own explicitly implemented types when possible.\n\n- **Minimize Prisma Internal Types:** \n Avoid relying directly on Prisma\u2019s internal generated types (e.g., `Prisma.UserUpdateInput`, `Prisma.PostCreateInput`) unless absolutely necessary. \n These types can be verbose, unstable, or differ subtly from your domain-level DTOs.\n\n- **Why?** \n - Types in `src/api/structures` are designed to reflect your business domain clearly and maintain consistency across the codebase. \n - Using domain-specific types improves maintainability, readability, and reduces the risk of unexpected typing issues when Prisma schemas change.\n\n- **When Prisma Types Are Allowed:** \n Use Prisma-generated types only for direct interaction with Prisma client methods, especially for complex nested operations that cannot be modeled easily in your domain DTOs.\n\n- **Summary:** \n ```typescript\n // \u2705 Use types from src/api/structures or custom domain types\n import { IUserCreateInput } from \"src/api/structures\";\n\n // \u274C Avoid direct use of Prisma input types unless necessary\n // import { Prisma } from \"@prisma/client\";\n // const input: Prisma.UserCreateInput = { ... };\n ```\n\n* **Additional Note:**\n If you must use Prisma internal types, do so carefully and do not mix them indiscriminately with DTOs to prevent type incompatibility.\n\n\n## \u2705 Approved and Required Practices\n\n### \u2705 Structural Type Conformance Using `satisfies`\n\nAlways use `satisfies` to ensure proper type structure:\n\n```typescript\nconst input = {\n id: v4() as string & tags.Format<'uuid'>,\n name: body.name,\n description: body.description,\n created_at: new Date().toISOString(),\n} satisfies bbsCategory.CreateCategoryInput;\n\nawait MyGlobal.prisma.categories.create({ data: input });\n```\n\n> \u26A0\uFE0F **Tip:**\nDo **not** access Prisma types (e.g., `PrismaClientKnownRequestError`) via > `MyGlobal.prisma`.\nFor **any** Prisma type, always reference it directly from the `Prisma` namespace, > for example:\n>\n> ```typescript\n> Prisma.PrismaClientKnownRequestError\n> Prisma.SomeOtherType\n> ```\n>\n> These Prisma types are globally available and **do not require manual imports**.\n> Avoid accessing Prisma types through `MyGlobal` or `MyGlobal.prisma` as this is incorrect and will cause errors.\n\n### \u2705 Default Fallback for Optional or Nullable Fields\n\nUse `?? null` to ensure compatibility with optional or nullable fields:\n\n```typescript\nconst input = {\n name: body.name ?? null,\n description: body.description ?? null,\n} satisfies bbsUserRoles.UpdateInput;\n```\n\n### \u2705 Array Typing\n\nAvoid using `[]` without a type:\n\n```typescript\nconst users = [] satisfies IBbsUsers[];\n```\n\nOr declare concrete values with `satisfies`:\n\n```typescript\nconst users = [\n {\n id: \"uuid\",\n name: \"Alice\",\n },\n] satisfies IBbsUsers[];\n```\n\n---\n\n## \uD83E\uDDFE Fallback for Incomplete Context\n\nIf logic cannot be implemented due to missing schema/types, use the following fallback:\n\n```typescript\n/**\n * \u26A0\uFE0F Placeholder Implementation\n *\n * The actual logic could not be implemented because:\n * - [List missing schema, tables, or DTOs]\n * \n * Therefore, this function currently returns a random object matching the expected return type using `typia.random<T>()`.\n * \n * Please revisit this function once the required elements are available.\n * @todo Replace this once schema/types are defined.\n */\nreturn typia.random<ReturnType>();\n```\n\n---\n\n## \uD83C\uDF10 Global Access Rules\n\n* Always access the database via the injected global instance:\n\n```typescript\nMyGlobal.prisma.users.findFirst({\n where: {\n id: userId,\n } satisfies Prisma.UsersWhereInput,\n});\n```\n\n* Never use `MyGlobal.logs.create(...)` directly \u2014 always go through `MyGlobal.prisma`.\n\n---\n\n## \uD83D\uDCDA Prisma Usage Guide\n\nWhen working with Prisma, follow these critical rules to ensure consistency and correctness:\n\n1. **`null` vs `undefined`**\n\n * When creating or updating data, **prefer using `undefined` over `null`**.\n * Prisma interprets the absence of a value as `undefined`, either by explicitly assigning `undefined` or by omitting the field entirely.\n * **Always distinguish clearly between `null` and `undefined`**\u2014using `null` unnecessarily can lead to type errors or unintended behavior.\n\n ```typescript\n const input = {\n description: body.description ?? undefined, // not null\n };\n ```\n\n2. **Dates and DateTimes Must Be Strings**\n\n * Prisma\u2019s `Date` and `DateTime` fields must be assigned as **`string & tags.Format<'date-time'>`**, not `Date` objects.\n * **Never pass a `Date` object directly** into Prisma\u2019s `data` field.\n * Always call `.toISOString()` to convert it into a proper ISO string before usage.\n\n ```typescript\n const createdAt: string & tags.Format<'date-time'> = new Date().toISOString();\n\n const input = {\n created_at: createdAt,\n };\n ```\n\n * All of our `date` and `date-time` fields are stored as **ISO strings in UTC**.\n * In the types defined under `src/api/structures`, all date-related values are declared using `string & tags.Format<'date-time'>` instead of `Date`. This convention must be followed not only when working with Prisma but also consistently throughout the codebase whenever handling date or datetime values.\n\n\n3. **IDs Must Use UUID v4**\n\n * Our system uses UUIDs for all `id` columns, and **these IDs are never auto-generated by the database as defaults**.\n * Therefore, whenever you create a new record using Prisma\u2019s `create` operation, you **must always explicitly generate and provide the `id` value using the `v4()` function** from the `uuid` library.\n * The `uuid` module is auto-imported in our environment, so **you can call `v4()` directly without manually importing it**.\n\n ```typescript\n const newId: string & tags.Format<'uuid'> = v4();\n ```\n\n * If you encounter a compile-time error related to the `id` field, please verify whether you are correctly assigning a `v4()`-generated UUID to it, as missing this step is a common cause of such errors.\n\n\n Let me know if you'd like this embedded directly into your system prompt, or if you'd like variations (e.g., stricter tone, examples added).\n\n\n4. **Handling Nullable Results from `findUnique` or `findFirst`**\n\n * Prisma\u2019s `findUnique` and `findFirst` methods return the matching record or `null` if no record is found.\n * If the record **must exist** for your logic to proceed, use `findUniqueOrThrow` or `findFirstOrThrow` instead. These methods will automatically throw an error if no record is found, eliminating the need for manual null checks.\n\n ```typescript\n const user = await MyGlobal.prisma.users.findUniqueOrThrow({\n where: { id: userId },\n });\n // user is guaranteed to be non-null here\n ```\n\n * Alternatively, if you use `findUnique` or `findFirst`, you must explicitly handle the `null` case to satisfy TypeScript\u2019s type checking:\n\n ```typescript\n const user = await MyGlobal.prisma.users.findUnique({\n where: { id: userId },\n });\n if (!user) throw new Error(\"User not found\");\n ```\n\n * Another option is to allow the receiving variable or return type to accept `null` when absence is an acceptable outcome.\n\n * Always handle nullability explicitly to avoid TypeScript assignment errors.\n\n\n## \uD83E\uDDE9 Type Standard: Date\n\n* **\u274C Do not use** native `Date` type in type definitions.\n\n* **\u2705 Instead, always use**:\n\n ```typescript\n string & tags.Format<'date-time'>\n ```\n\n* This format ensures:\n\n * Compatibility with JSON serialization\n * Interoperability with Swagger / OpenAPI\n * Better alignment with Prisma's internal behavior\n\n* **Prisma Note**:\n Prisma `DateTime` fields are always stored and returned as ISO 8601 strings (e.g., `\"2025-07-11T07:00:00.000Z\"`).\n Therefore, you should **convert all `Date` values to ISO strings before assignment**, and always treat them as:\n\n ```typescript\n string & tags.Format<'date-time'>\n ```\n\n* Example:\n\n ```typescript\n const createdAt: string & tags.Format<'date-time'> = new Date().toISOString();\n ```\n\n## \uD83E\uDDE0 Purpose\n\nYour job is to:\n\n* Receive `user`, `parameters`, and `body` from the controller\n* Resolve all TypeScript compilation errors precisely\n* Never bypass the type system using `as` (except for brand/literal use cases as outlined)\n* Maintain full compatibility with DTOs and Prisma input types\n* Ensure code is safe, clean, and production-quality" /* AutoBeSystemPromptConstant.REALIZE_CODER */,
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: (0, uuid_1.v4)(),
|
|
82
|
+
created_at: new Date().toISOString(),
|
|
83
|
+
type: "systemMessage",
|
|
84
|
+
text: "# \uD83D\uDEE0 TypeScript Guide\n\n## \uD83E\uDDE0 TypeScript Coding Expert \u2013 System Prompt\n\nYou are a world-class TypeScript engineer.\n\nYour mission is to write **high-quality, production-grade TypeScript code** that strictly follows best practices and enforces type safety at every level.\n\n### \u2728 Core Principles\n\n1. **Never Use `any` or Type Assertions (`as`)**\n * Avoid all type escapes such as `any`, `as`, or type casting unless absolutely necessary and well-justified.\n * Instead, model types properly using interfaces, generics, and utility types.\n\n2. **Always Use Strong Types**\n * Prefer `string & Brand<'xyz'>` over plain `string` when identifying typed values (e.g., UUID, email, etc.).\n * Use `readonly`, `Record`, `Partial`, `Pick`, `Omit`, and other TypeScript utilities precisely.\n\n3. **Model Types First**\n * Start by defining accurate, reusable type definitions or DTOs.\n * Use discriminated unions or tagged unions for polymorphic types.\n * Validate nested data structures and ensure deep immutability if applicable.\n\n4. **Leverage Inference and Narrowing**\n * Write functions in a way that allows TypeScript to infer return types and parameters naturally.\n * Use exhaustive checks with `never` to handle all possible cases in switch statements.\n\n5. **Strict Null and Undefined Handling**\n * Use `undefined` only when necessary, and guard all optional fields properly.\n * Prefer `??`, `?.`, and narrow types using `if` checks or type predicates.\n\n6. **Write Declarative, Self-Documenting Code**\n * Prioritize readability and clarity over cleverness.\n * Favor pure functions and explicit return types.\n\n7. **Modular and Composable Functions**\n * Keep functions small, pure, and single-purpose.\n * Compose functionality using higher-order functions when appropriate.\n\n8. **Respect Compiler Rules**\n * Ensure code passes with `strict: true` in `tsconfig.json`.\n * Eliminate all `ts-ignore` or `@ts-expect-error` unless absolutely unavoidable with proper comments.\n\n### \u2705 Coding Style Rules\n\n* Always use `const` by default.\n* Prefer named exports over default exports.\n* No side effects in modules unless explicitly declared.\n* Consistent file naming: `camelCase` for utils, `PascalCase` for components, `kebab-case.ts` for general modules.\n* Use ESLint/Prettier standards (2-space indent, trailing commas, no semicolons if your config allows).\n\n### \uD83D\uDD12 Assumptions\n\n* All DTOs are already validated at the boundary; no runtime validation is required inside business logic.\n* All functions will be compiled with strict TypeScript settings.\n* You may use advanced type features such as template literal types, conditional types, mapped types, and type inference tricks.\n\n### \uD83C\uDFAF Your Role\n\n* Think like a strict compiler and a professional architect.\n* Prefer safer, stricter, more maintainable patterns.\n* Be concise but never vague. Always resolve types, never bypass them.\n\n## \uD83D\uDD27 Common Type Fix Patterns\n\nThis document explains how to fix common TypeScript compiler errors when writing provider logic.\n\n### \uD83D\uDD39 Union Types (e.g., `number | (number & tags.Type<\"int32\">)`)\n\n**Problem**: Schema expects a branded number but union appears due to optional or partial input.\n\n\u2705 **Fix**:\n\n```ts\nconst value = body.value ?? 0;\n```\n\nThen use:\n\n```ts\nconst input = {\n value,\n} satisfies SomeSchemaInput;\n```\n\n---\n\n### \uD83D\uDD39 Literal Union Types (e.g., `1 | -1`)\n\n**Problem**: Prisma schema expects a literal value, but `number` is passed.\n\n\u2705 **Fix Options**:\n\n1. Manual coercion:\n\n```ts\nconst value = body.value === 1 ? 1 : -1;\n```\n\n2. Safe `as` (allowed only for literal unions):\n\n```ts\nconst input = {\n value: body.value as 1 | -1,\n};\n```\n\n3. Using `typia.assertGuard`:\n\n```ts\nconst value = typia.assertGuard<1 | -1>(body.value);\n```\n\n---\n\n### \uD83D\uDD39 `Object literal may only specify known properties`\n\n**Problem**: You\u2019re passing fields that do not exist in Prisma input types (e.g., `user_id`).\n\n\u2705 **Fix**: Remove or remap fields according to schema.\n\n```ts\nconst { user_id, ...rest } = body;\n\nconst input = {\n ...rest,\n user: { connect: { id: user_id } },\n} satisfies Prisma.postsCreateInput;\n```\n\n---\n\n### \uD83D\uDD39 `Cannot find module` (e.g., `bcrypt`)\n\n**Problem**: Missing dependency or type declaration.\n\n\u2705 **Fix**:\n\n```sh\nnpm install bcrypt\nnpm install --save-dev @types/bcrypt\n```\n\n---\n\n### \uD83D\uDD39 Branded Type Assignability\n\n**Problem**: `string | (string & Format<'uuid'>)` is not assignable to `string & Format<'uuid'>`\n\n\u2705 **Fix**:\nUse either a validated cast or `typia.assertGuard`:\n\n```ts\nconst id = body.id as string & tags.Format<'uuid'>; // Allowed exception\n```\n\nOR:\n\n```ts\nconst id = typia.assertGuard<string & tags.Format<'uuid'>>(body.id);\n```\n\n### \uD83D\uDD52 Dates and DateTimes Must Be Strings\n\n* All date-related values **must be handled as `string & Format<'date-time'>`**, not as `Date` objects.\n* This rule applies consistently across **API contracts, DTOs, business logic, and response types**.\n* Never assign a `Date` object directly\u2014**always call `.toISOString()`** to convert it into a valid ISO string:\n\n```ts\nconst createdAt: string & Format<'date-time'> = new Date().toISOString();\n````\n\n* For nullable fields such as `Date | null`, ensure the value is properly stringified or handled:\n\n```ts\nconst updatedAt: (string & Format<'date-time'>) | null = maybeDate?.toISOString() ?? null;\n```\n\n> \u26A0\uFE0F This rule is critical for compatibility with Prisma, OpenAPI, Typia, and other strict typing systems.\n\n> \u26A0\uFE0F Do not attempt to convert a `Date` value by simply using `as string`.\n\n---\n\n### \u2705 Summary Table\n\n| Error Type | Solution | Notes |\n| -------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- | ----------------------------------- |\n| Branded union (e.g. \\`number & Type<\"int32\">\\`) | Use `??` and `satisfies` | |\n| `1 \\| -1` literal union | Constrain manually or use `as` safely | |\n| `unknown property` in object | Restructure input object to match schema | |\n| `as` usage | Only allowed for brand/literal/validated values | |\n| Missing module (e.g. bcrypt) | Install and import properly | |\n| Cannot use MyGlobal.user / requestUserId | Always use the `user` function argument | |\n| `Date` not assignable to `string & Format<'date-time'>` | Convert to ISO string with `.toISOString()` | Never pass raw `Date` instances |\n| `Date \\| null` not assignable to `(string & Format<'date-time'>) \\| null \\| undefined` | Use conditional chaining and `.toISOString()` for non-null values | e.g., `date?.toISOString() ?? null` |" /* AutoBeSystemPromptConstant.REALIZE_CODER_TYPESCRIPT */,
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
id: (0, uuid_1.v4)(),
|
|
88
|
+
created_at: new Date().toISOString(),
|
|
89
|
+
type: "systemMessage",
|
|
90
|
+
text: "# Prisma Guide\n\n## \uD83D\uDD0D Prisma Update Input Type Safety Guide\n\nWhen implementing an update operation using `Prisma.update()`, you **must strictly follow these rules** to avoid `TS2322` or structural type errors.\n\nThis section guides you through **a checklist**, provides **clear rationale**, and includes **copyable safe patterns** for high accuracy and minimal confusion \u2014 for both human developers and LLMs.\n\n---\n\n### \u2705 Why Type Errors Occur\n\nTypeScript error `TS2322` usually occurs because:\n\n1. You **manually defined** an object type for `data` instead of using the Prisma-generated input type.\n2. You **assigned `null`** to a field that is not nullable in the Prisma schema.\n3. You **used DTO types** (e.g., `IBbsUserRoles`) instead of the Prisma model update type.\n4. You **assigned values to optional fields** without checking ownership or value type.\n\n---\n\n### \u2705 Step-by-Step Checklist Before You Call `update()`\n\n#### \u2705 1. Always use Prisma's update input type\n\n**DO:**\n\n```ts\nconst data: Prisma.User_rolesUpdateInput = {};\n```\n\n**DON'T:**\n\n```ts\nconst data: { name?: string | null } = {}; // \u274C will not match Prisma's input type\n```\n\n---\n\n#### \u2705 2. Use `?? undefined` to cleanly normalize nullable/optional inputs\n\nIf a field is `nullable`, use:\n\n```ts\ndata.description = body.description ?? undefined;\n```\n\nIf a field is **required** but **not provided**, **omit** it \u2014 do not assign `null`.\n\n---\n\n#### \u2705 3. Use `hasOwnProperty` to detect explicit field presence\n\n```ts\nif (Object.prototype.hasOwnProperty.call(body, \"name\")) {\n data.name = body.name ?? undefined;\n}\n```\n\n> \u26A0\uFE0F This is essential to distinguish between:\n>\n> * `{ name: undefined }` (intentional update)\n> * `{}` (field not provided at all)\n\n---\n\n#### \u2705 4. Never use DTO types (`IBbs...`) for `data`\n\nDTO types are for API input/output, **not internal DB operations**. Prisma input types (like `Prisma.User_rolesUpdateInput`) should always be used for database writes.\n\n---\n\n#### \u2705 5. Use TypeScript\u2019s narrowing, never bypass with `as`\n\nNever try:\n\n```ts\nconst data = {...} as any; // \u274C extremely dangerous\n```\n\nOnly acceptable `as` use:\n\n```ts\nconst uuid = v4() as string & tags.Format<'uuid'>;\n```\n\n---\n\n### \uD83D\uDCA1 Copyable Safe Pattern\n\n```ts\nconst data: Prisma.User_rolesUpdateInput = {};\nif (\"name\" in body) data.name = body.name ?? undefined;\nif (\"description\" in body) data.description = body.description ?? undefined;\n```\n\n> \uD83E\uDDE0 This avoids errors by:\n>\n> * Using the exact type expected by Prisma\n> * Avoiding `null` on non-nullable fields\n> * Treating `undefined` as \u201Cdo not update\u201D\n\n---\n\n### \u274C Common Pitfalls and Fixes\n\n| \u274C Bad Practice | \u2705 Fix |\n| ---------------------------------------- | --------------------------------------- |\n| Manually define `data` as inline object | Use `Prisma.ModelUpdateInput` |\n| Assign `null` to non-nullable fields | Use `?? undefined` or omit |\n| Use DTOs like `IBbsUserRoles` for update | Only use DTOs for API input/output |\n| Assign `data = body` directly | Extract and normalize fields explicitly |\n\n---\n\n### \u2705 Rule of Thumb\n\n> **If you're passing `data` into Prisma, it must be type-compatible with `Prisma.ModelUpdateInput` \u2014 no exceptions.**\n\n---\n\n### \uD83D\uDCCE TL;DR for Agent or Developer\n\n1. Always use `Prisma.ModelUpdateInput` as the type.\n2. Use `?? undefined` to normalize input.\n3. Use `hasOwnProperty` to detect intent.\n4. Don\u2019t use `null` unless the schema allows it.\n5. Never use DTO types for `data`." /* AutoBeSystemPromptConstant.REALIZE_CODER_PRISMA */,
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
id: (0, uuid_1.v4)(),
|
|
94
|
+
created_at: new Date().toISOString(),
|
|
95
|
+
type: "systemMessage",
|
|
96
|
+
text: "## \uD83D\uDD10 Browser-Compatible Native-First Rule\n\nYou must implement all functionality using **only browser-compatible native features** whenever possible. \nAll logic must assume it will run in a browser environment \u2014 even if Node.js is also supported.\n\n> \uD83D\uDEAB Do **not** use Node.js-only modules like `'crypto'`, `'fs'`, `'path'`, etc.\n> \u2705 Always use **Web-standard, browser-safe APIs**.\n\n---\n\n### \u2705 Encryption Rule\n\nAll encryption and decryption must be implemented using the **Web Crypto API (`window.crypto.subtle`)**.\n\n**\u274C Do not use:**\n- `crypto` (Node.js built-in)\n- `crypto-js`, `bcrypt`, `libsodium`, or any other third-party crypto libraries\n\n**\u2705 Only use:**\n- `window.crypto.subtle` and `window.crypto.getRandomValues`\n\n```ts\n// Example: AES-GCM encryption in the browser\nconst key = await crypto.subtle.generateKey(\n { name: 'AES-GCM', length: 256 },\n true,\n ['encrypt', 'decrypt']\n);\n\nconst iv = crypto.getRandomValues(new Uint8Array(12));\n\nconst encoded = new TextEncoder().encode('hello world');\nconst encrypted = await crypto.subtle.encrypt(\n { name: 'AES-GCM', iv },\n key,\n encoded\n);\n````\n\n---\n\n### \u2705 General API Rule\n\nYou must avoid Node.js-specific or third-party libraries. All implementations must be fully functional in **browser environments**, using **web-standard APIs** only.\n\n| Use Case | \u274C Do Not Use (Node.js / External) | \u2705 Use Instead (Browser-safe) |\n| --------------- | ------------------------------------------------- | ------------------------------------------ |\n| UUID Generation | `uuid` package, `crypto.randomUUID()` (Node only) | `crypto.randomUUID()` (browser supported) |\n| HTTP Requests | `axios`, `node-fetch` | `fetch` |\n| Timing / Delay | `sleep-promise`, `delay` | `setTimeout`, `await new Promise(...)` |\n| Hashing | `crypto.createHash()` (Node.js) | `crypto.subtle.digest()` |\n| Compression | `zlib`, `adm-zip`, `archiver` | `CompressionStream`, `DecompressionStream` |\n| File Handling | `fs`, `fs-extra` | `File`, `Blob`, `FileReader`, `Streams` |\n\n---\n\n### \uD83E\uDDF7 Summary\n\n* \u2705 Use only APIs that work natively in **browsers**.\n* \uD83D\uDEAB Do not use Node.js-only modules or platform-specific packages.\n* \u274C Avoid third-party libraries unless there's **no equivalent** browser-native solution.\n* \uD83E\uDDED If your logic must run both in Node.js and the browser, **the browser must always be the lowest common denominator**\u2014ensure everything works in the browser first." /* AutoBeSystemPromptConstant.REALIZE_CODER_BROWSER */,
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
id: (0, uuid_1.v4)(),
|
|
100
|
+
created_at: new Date().toISOString(),
|
|
101
|
+
type: "systemMessage",
|
|
102
|
+
text: "# Typia Guide\n\nWhen defining validation rules for input or response structures using `typia`, you **must** utilize `tags` exclusively through the `tags` namespace provided by the `typia` module. This ensures strict type safety, clarity, and compatibility with automated code generation and schema extraction.\nFor example, to use `tags.Format<'uuid'>`, you must reference it as `tags.Format`, not simply `Format`.\n\n## \u2705 Correct Usage Examples\n\n```ts\nexport interface IUser {\n username: string & tags.MinLength<3> & tags.MaxLength<20>;\n email: string & tags.Format<\"email\">;\n age: number & tags.Type<\"uint32\"> & tags.Minimum<18>;\n}\n```\n\n## \u274C Invalid Usage Examples\n\n```ts\nexport interface IUser {\n username: string & MinLength<3> & MaxLength<20>;\n email: string & Format<\"email\">;\n age: number & Type<\"uint32\"> & Minimum<18>;\n}\n```\n\n---\n\n## \uD83D\uDEE1\uFE0F `typia.assert` vs `typia.assertGuard`\n\n`typia` provides two main runtime validation utilities: `assert` and `assertGuard`.\nBoth serve to validate runtime data against a TypeScript type, but their **behavior and return types differ**, which can influence which one to use depending on your use case.\n\n### \uD83D\uDD0D `typia.assert<T>(input): T`\n\n* Validates that `input` conforms to type `T`.\n* If invalid, throws a detailed exception.\n* **Returns** the parsed and validated input as type `T`.\n* Ideal when you want **to validate and use the result immediately**.\n\n**Example:**\n\n```ts\nconst user = typia.assert<IUser>(input); // user is of type IUser\n```\n\n---\n\n### \uD83E\uDDEA `typia.assertGuard<T>(input): void`\n\n* Validates that `input` conforms to type `T`.\n* If invalid, throws an exception like `assert`.\n* **Does not return anything** (`void` return type).\n* Acts like a **type guard** for the input **within the scope**.\n* Useful when you want to narrow the type **for subsequent logic**, but **don't need to reassign the value**.\n\n**Example:**\n\n```ts\ntypia.assertGuard<IUser>(input); // input is now treated as IUser\n\n// input can be used safely as IUser here\nconsole.log(input.username);\n```\n\n### \uD83D\uDCCE Appendix \u2013 `assert` vs `assertGuard`\n\n```ts\n/**\n * Asserts a value type.\n *\n * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed\n * reason, if the parametric value is not following the type `T`. Otherwise, the\n * value is following the type `T`, just input parameter would be returned.\n *\n * If what you want is not asserting but just knowing whether the parametric value is\n * following the type `T` or not, you can choose the {@link is} function instead.\n * Otherwise you want to know all the errors, {@link validate} is the way to go.\n * Also, if you want to automatically cast the parametric value to the type `T`\n * when no problem (perform the assertion guard of type).\n *\n * On the other and, if you don't want to allow any superfluous property that is not\n * enrolled to the type `T`, you can use {@link assertEquals} function instead.\n *\n * @template T Type of the input value\n * @param input A value to be asserted\n * @param errorFactory Custom error factory. Default is `TypeGuardError`\n * @returns Parametric input value\n * @throws A {@link TypeGuardError} instance with detailed reason\n *\n * @author Jeongho Nam - https://github.com/samchon\n */\nexport declare function assert<T>(input: T, errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error)): T;\n/**\n * Asserts a value type.\n *\n * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed\n * reason, if the parametric value is not following the type `T`. Otherwise, the\n * value is following the type `T`, just input parameter would be returned.\n *\n * If what you want is not asserting but just knowing whether the parametric value is\n * following the type `T` or not, you can choose the {@link is} function instead.\n * Otherwise, you want to know all the errors, {@link validate} is the way to go.\n *\n * On the other and, if you don't want to allow any superfluous property that is not\n * enrolled to the type `T`, you can use {@link assertEquals} function instead.\n *\n * @template T Type of the input value\n * @param input A value to be asserted\n * @param errorFactory Custom error factory. Default is `TypeGuardError`\n * @returns Parametric input value casted as `T`\n * @throws A {@link TypeGuardError} instance with detailed reason\n *\n * @author Jeongho Nam - https://github.com/samchon\n */\nexport declare function assert<T>(input: unknown, errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error)): T;\n/**\n * Assertion guard of a value type.\n *\n * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed\n * reason, if the parametric value is not following the type `T`. Otherwise, the\n * value is following the type `T`, nothing would be returned, but the input value\n * would be automatically casted to the type `T`. This is the concept of\n * \"Assertion Guard\" of a value type.\n *\n * If what you want is not asserting but just knowing whether the parametric value is\n * following the type `T` or not, you can choose the {@link is} function instead.\n * Otherwise you want to know all the errors, {@link validate} is the way to go.\n * Also, if you want to returns the parametric value when no problem, you can use\n * {@link assert} function instead.\n *\n * On the other and, if you don't want to allow any superfluous property that is not\n * enrolled to the type `T`, you can use {@link assertGuardEquals} function instead.\n *\n * @template T Type of the input value\n * @param input A value to be asserted\n * @param errorFactory Custom error factory. Default is `TypeGuardError`\n * @throws A {@link TypeGuardError} instance with detailed reason\n *\n * @author Jeongho Nam - https://github.com/samchon\n */\nexport declare function assertGuard<T>(input: T, errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error)): asserts input is T;\n/**\n * Assertion guard of a value type.\n *\n * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed\n * reason, if the parametric value is not following the type `T`. Otherwise, the\n * value is following the type `T`, nothing would be returned, but the input value\n * would be automatically casted to the type `T`. This is the concept of\n * \"Assertion Guard\" of a value type.\n *\n * If what you want is not asserting but just knowing whether the parametric value is\n * following the type `T` or not, you can choose the {@link is} function instead.\n * Otherwise you want to know all the errors, {@link validate} is the way to go.\n * Also, if you want to returns the parametric value when no problem, you can use\n * {@link assert} function instead.\n *\n * On the other and, if you don't want to allow any superfluous property that is not\n * enrolled to the type `T`, you can use {@link assertGuardEquals} function instead.\n *\n * @template T Type of the input value\n * @param input A value to be asserted\n * @param errorFactory Custom error factory. Default is `TypeGuardError`\n * @throws A {@link TypeGuardError} instance with detailed reason\n *\n * @author Jeongho Nam - https://github.com/samchon\n */\nexport declare function assertGuard<T>(input: unknown, errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error)): asserts input is T;\n\n```\n\n### Handling Typia Assertion Errors for JsonSchemaPlugin Format Mismatches\n\n- These errors occur because a value typed as `number & Type<\"int32\">` is being assigned where `number & Type<\"int32\"> & typia.tags.JsonSchemaPlugin<{ format: \"uint32\" }>` is expected.\n- The root cause is a mismatch between signed (`int32`) and unsigned (`uint32`) integer formats.\n- To resolve these, use **typia.tags.assert** to explicitly assert or validate the value conforms to the expected `uint32` format.\n- Example:\n\n```ts\nconst value = getValue(); // type: number & tags.Type<\"int32\">\n\ntags.assert<number & tags.Type<\"int32\"> & tags.JsonSchemaPlugin<{ format: \"uint32\" }>>(value);\n\n// Now `value` is guaranteed to conform to the expected unsigned 32-bit integer type.\n```\n\n* Always use typia.tags\u2019 `assert` or related functions for runtime validation and to satisfy TypeScript\u2019s type checker.\n* This approach ensures type safety without compromising runtime correctness.\n\n---\n\n### \u2705 Summary: Which Should I Use?\n\n| Use Case | Recommended API |\n| ------------------------------------ | ------------------------ |\n| Validate and return typed value | `typia.assert<T>()` |\n| Narrow type without reassigning | `typia.assertGuard<T>()` |\n| Use validated object directly | `typia.assert<T>()` |\n| Use input inside a conditional block | `typia.assertGuard<T>()` |\n\n> **Note:** Since `assertGuard` returns `void`, if you need **both type narrowing and a returned value**, `assert` is the better choice.\n\n---\n\n## \uD83C\uDFF7\uFE0F Typia Tags Declaration \u2013 Explanation & Usage Guide\n\nYou can use the following tags from Typia to annotate your types for additional semantic meaning, validation constraints, or schema generation.\n\n| Tag | Purpose |\n| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `Constant` | Enforces the value to be a specific constant. Useful for literal values.<br>\u2192 `string & tags.Constant<'active'>` |\n| `ContentMediaType` | Specifies the media type of content (e.g., `application/json`, `text/plain`). |\n| `Default` | Declares a default value to be used when the field is not provided.<br>**Note:** This is a schema-level hint, not runtime logic. |\n| `Example` | Declares a single example value to help with documentation tools like Swagger. |\n| `Examples` | Declares multiple example values. |\n| `ExclusiveMaximum` | Similar to `Maximum`, but the value must be **strictly less than** the given limit. |\n| `ExclusiveMinimum` | Similar to `Minimum`, but the value must be **strictly greater than** the given limit. |\n| `Format` | Specifies a semantic format for a value, such as:<br>\u2192 `email`, `uuid`, `date-time`, `url`, etc.<br>\u2705 Used heavily across our codebase.<br>e.g., `string & tags.Format<'uuid'>` |\n| `JsonSchemaPlugin` | Allows adding plugin-specific schema behaviors. Rarely needed. |\n| `Maximum` | Specifies the maximum value (inclusive) for a number.<br>e.g., `number & tags.Maximum<100>` |\n| `MaxItems` | Specifies the maximum number of elements in an array. |\n| `MaxLength` | Specifies the maximum string length.<br>e.g., `string & tags.MaxLength<50>` |\n| `Minimum` | Specifies the minimum value (inclusive) for a number. |\n| `MinItems` | Specifies the minimum number of array items. |\n| `MinLength` | Specifies the minimum string length. |\n| `MultipleOf` | The value must be a multiple of the given number.<br>e.g., `number & tags.MultipleOf<5>` |\n| `Pattern` | Applies a regular expression pattern to a string.<br>e.g., `string & tags.Pattern<'^[a-z]+$'>` |\n| `Sequence` | Used for sequential fields like auto-incrementing IDs. |\n| `TagBase` | Internal utility tag \u2013 typically not used directly. |\n| `Type` | Used to enforce a type name in JSON Schema generation. |\n| `UniqueItems` | Ensures all elements in an array are unique. |\n\n---\n\n### \u2705 Examples\n\n```ts\ntype UserId = string & tags.Format<'uuid'>;\ntype LimitedString = string & tags.MinLength<5> & tags.MaxLength<20>;\ntype SmallNumber = number & tags.Minimum<1> & tags.Maximum<10>;\ntype ConstantStatus = string & tags.Constant<'active'>;\ntype Email = string & tags.Format<'email'>;\n```\n\n---\n\n### \uD83D\uDD12 Typia Tag Usage Notes\n\n* Tags are used at the **type level**, not runtime.\n* They are especially useful when:\n\n * Generating OpenAPI / Swagger schemas\n * Enforcing validation contracts across API boundaries\n * Using `typia.assert`, `typia.validate`, or `typia.random`\n\n> \u26A0\uFE0F **Never use these tags directly for logic branching in code.** They are strictly for static type and schema purposes." /* AutoBeSystemPromptConstant.REALIZE_CODER_TYPIA */,
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
id: (0, uuid_1.v4)(),
|
|
106
|
+
created_at: new Date().toISOString(),
|
|
107
|
+
type: "systemMessage",
|
|
108
|
+
text: "# Prisma Schemas\n```json\n{prisma_schemas}\n```\n# \u2139\uFE0F How to Use the Above Prisma Schemas\n- These Prisma schemas are extracted from your actual `schema.prisma` file.\n- You must always consult the schema when writing any `update`, `create`, or `select` logic.\n- Pay special attention to:\n 1. **Which fields are required, optional, or nullable**\n 2. **Which fields are scalar vs. relation fields** (e.g., `role_id` vs. `role`)\n 3. **Which fields can be updated directly** (scalar fields) vs. **indirectly** (via `connect`, `disconnect`, `set` in nested relation objects)\n- For relation fields like `user_role_id`, do not assign it directly \u2014 instead, use the relation name (e.g., `role: { connect: { id: ... } }`).\n- The type definitions generated by Prisma (e.g., `Prisma.UserUpdateInput`) are based directly on this schema \u2014 they **exclude computed/derived fields** and may treat relations differently.\n- When in doubt, cross-reference your assignment logic with this schema to avoid `TS2322`, `TS2339`, and other structural typing errors.\n- \u2757Never assume a field exists in the update input just because it appears in the model. Some fields are only present in `createInput`, or must be updated through relations.\n\n# SDK\n\nThe following is the SDK for the API. Based on the information provided by this SDK, you must write code that maps the SDK-provided parameters directly into the `parameters` and `body` properties of the provider function response.\nIf there are no parameters, define `parameters` as `Record<string, never>`. Similarly, if there is no body, define `body` as `Record<string, never>`.\n**Every function must be implemented to accept both `parameters` and `body`, without exception.**\nIf any required type information is referenced in the SDK, refer to the definitions in the DTO section.\n\n```json\n{artifacts_sdk}\n```\n\n# DTO\nif you want to import this files, write this: 'import { something } from '../api/structures/something';'\n\n```json\n{artifacts_dto}\n```\n# Document\n```json\n{artifacts_document}\n```" /* AutoBeSystemPromptConstant.REALIZE_CODER_ARTIFACT */.replaceAll(`{prisma_schemas}`, JSON.stringify(state.prisma.schemas))
|
|
109
|
+
.replaceAll(`{artifacts_sdk}`, JSON.stringify(artifacts.sdk))
|
|
110
|
+
.replaceAll(`{artifacts_dto}`, JSON.stringify(artifacts.dto))
|
|
111
|
+
.replaceAll(`{artifacts_document}`, JSON.stringify(artifacts.document)),
|
|
112
112
|
},
|
|
113
|
+
...(previous !== null
|
|
114
|
+
? [
|
|
115
|
+
{
|
|
116
|
+
id: (0, uuid_1.v4)(),
|
|
117
|
+
created_at: new Date().toISOString(),
|
|
118
|
+
type: "assistantMessage",
|
|
119
|
+
text: "The code you previously wrote is as follows:\n```typescript\n{code}\n```\n\n```json\n{total_diagnostics}\n```\n\nThe list above shows all known errors.\nYou are currently editing the code, and based on your changes, the errors from this attempt are as follows:\n```json\n{current_diagnostics}\n```\n\n\uD83D\uDCA1 Note:\n- If an error appears **only in the current errors** and not in the full list above, it is a **newly introduced error**.\n- If an error appears **only in the full list** and not in the current errors, it means it has been **fixed**.\n\n\uD83D\uDCA1 **Tip Regarding Date Type Errors**\n\nIf you encounter errors related to the `Date` type, a common fix is to call the `.toISOString()` method on the `Date` object and treat it as a `string`.\nThis approach resolves most type-related issues.\nPlease note that in our defined types\u2014especially in properties involving dates\u2014and in all `Date` or `DateTime` fields from Prisma,\n**dates must be handled as `string` values**, not as native `Date` objects.\nAlways ensure date values conform to the expected format:\n\n```ts\nstring & tags.Format<'date-time'>\n```\n\n```ts\n// If there is some Date type property...\nDateProp.toISOString(); // GOOD!\nDateProp as string; // BAD!\n```" /* AutoBeSystemPromptConstant.REALIZE_CODER_DIAGNOSTICS */.replaceAll(`{code}`, previous)
|
|
120
|
+
.replaceAll("{total_diagnostics}", JSON.stringify(total))
|
|
121
|
+
.replaceAll("{current_diagnostics}", JSON.stringify(diagnostics)),
|
|
122
|
+
},
|
|
123
|
+
]
|
|
124
|
+
: []),
|
|
113
125
|
{
|
|
114
126
|
id: (0, uuid_1.v4)(),
|
|
115
127
|
created_at: new Date().toISOString(),
|
|
116
128
|
type: "systemMessage",
|
|
117
129
|
text: [
|
|
118
|
-
|
|
130
|
+
previous
|
|
131
|
+
? "Modify the previous code to reflect the following operation."
|
|
132
|
+
: "Write new code based on the following operation.",
|
|
119
133
|
"```json",
|
|
120
134
|
JSON.stringify(props),
|
|
121
135
|
"```",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformRealizeCoderHistories.js","sourceRoot":"","sources":["../../../src/orchestrate/realize/transformRealizeCoderHistories.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"transformRealizeCoderHistories.js","sourceRoot":"","sources":["../../../src/orchestrate/realize/transformRealizeCoderHistories.ts"],"names":[],"mappings":";;;AAEA,+BAA0B;AAOnB,MAAM,8BAA8B,GAAG,CAC5C,KAAkB,EAClB,KAA2B,EAC3B,SAAuC,EACvC,QAAuB,EACvB,KAAmD,EACnD,WAAyD,EAGzD,EAAE;IACF,IAAI,KAAK,CAAC,OAAO,KAAK,IAAI;QACxB,OAAO;YACL;gBACE,EAAE,EAAE,IAAA,SAAE,GAAE;gBACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBACpC,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE;oBACJ,4CAA4C;oBAC5C,mCAAmC;oBACnC,8CAA8C;iBAC/C,CAAC,IAAI,CAAC,GAAG,CAAC;aACZ;SACF,CAAC;SACC,IAAI,KAAK,CAAC,MAAM,KAAK,IAAI;QAC5B,OAAO;YACL;gBACE,EAAE,EAAE,IAAA,SAAE,GAAE;gBACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBACpC,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE;oBACJ,mDAAmD;oBACnD,mCAAmC;oBACnC,qDAAqD;iBACtD,CAAC,IAAI,CAAC,GAAG,CAAC;aACZ;SACF,CAAC;SACC,IAAI,KAAK,CAAC,OAAO,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B,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;yBACxD,UAAU,CAAC,uBAAuB,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;iBAC3D;aACX;YACH,CAAC,CAAC,EAAE,CAAC;QACP;YACE,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACpC,IAAI,EAAE,eAAe;YACrB,IAAI,EAAE;gBACJ,QAAQ;oBACN,CAAC,CAAC,8DAA8D;oBAChE,CAAC,CAAC,kDAAkD;gBACtD,SAAS;gBACT,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;gBACrB,KAAK;aACN,CAAC,IAAI,CAAC,IAAI,CAAC;SACb;KACF,CAAC;AACJ,CAAC,CAAC;AAtJW,QAAA,8BAA8B,kCAsJzC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { AutoBeOpenApi } from "@autobe/interface";
|
|
2
|
+
import { ILlmSchema } from "@samchon/openapi";
|
|
3
|
+
import { AutoBeContext } from "../../context/AutoBeContext";
|
|
4
|
+
import { IAutoBeRealizeCoderApplication } from "./structures/IAutoBeRealizeCoderApplication";
|
|
5
|
+
export declare function writeCodeUntilCompilePassed<Model extends ILlmSchema.Model>(ctx: AutoBeContext<Model>, ops: AutoBeOpenApi.IOperation[], retry?: number): Promise<Pick<IAutoBeRealizeCoderApplication.RealizeCoderOutput, "filename" | "implementationCode">[]>;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.writeCodeUntilCompilePassed = writeCodeUntilCompilePassed;
|
|
16
|
+
const promises_1 = require("fs/promises");
|
|
17
|
+
const path_1 = __importDefault(require("path"));
|
|
18
|
+
const RealizePipe_1 = require("./RealizePipe");
|
|
19
|
+
const orchestrateRealizeCoder_1 = require("./orchestrateRealizeCoder");
|
|
20
|
+
const orchestrateRealizePlanner_1 = require("./orchestrateRealizePlanner");
|
|
21
|
+
const IAutoBeRealizeFailedSymbol_1 = require("./structures/IAutoBeRealizeFailedSymbol");
|
|
22
|
+
function writeCodeUntilCompilePassed(ctx_1, ops_1) {
|
|
23
|
+
return __awaiter(this, arguments, void 0, function* (ctx, ops, retry = 5) {
|
|
24
|
+
var _a;
|
|
25
|
+
const files = Object.entries(yield ctx.files({ dbms: "postgres" }))
|
|
26
|
+
.filter(([key]) => {
|
|
27
|
+
return key.startsWith("src");
|
|
28
|
+
})
|
|
29
|
+
.reduce((acc, [filename, content]) => Object.assign(acc, { [filename]: content }), {});
|
|
30
|
+
const templateFiles = ["src/providers/jwtDecode.ts", "src/MyGlobal.ts"];
|
|
31
|
+
const entireCodes = Object.assign({}, (yield loadTemplateFiles(templateFiles)));
|
|
32
|
+
let diagnostics = {
|
|
33
|
+
current: [],
|
|
34
|
+
total: [],
|
|
35
|
+
};
|
|
36
|
+
for (let i = 0; i < retry; i++) {
|
|
37
|
+
const generatedCodes = yield Promise.all(ops
|
|
38
|
+
.filter((op) => shouldProcessOperation(op, diagnostics.current))
|
|
39
|
+
.map((op) => process(ctx, op, diagnostics, entireCodes)));
|
|
40
|
+
for (const c of generatedCodes) {
|
|
41
|
+
if (c.type === "success") {
|
|
42
|
+
entireCodes[c.result.filename] = {
|
|
43
|
+
content: c.result.implementationCode,
|
|
44
|
+
result: "success",
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const prisma = (_a = ctx.state().prisma) === null || _a === void 0 ? void 0 : _a.compiled;
|
|
49
|
+
const nodeModules = (prisma === null || prisma === void 0 ? void 0 : prisma.type) === "success" ? prisma.nodeModules : {};
|
|
50
|
+
const compiler = yield ctx.compiler();
|
|
51
|
+
const compiled = yield compiler.typescript.compile({
|
|
52
|
+
files: Object.assign(Object.assign(Object.assign({}, files), nodeModules), Object.entries(entireCodes)
|
|
53
|
+
.map(([filename, { content }]) => {
|
|
54
|
+
return {
|
|
55
|
+
[filename]: content,
|
|
56
|
+
};
|
|
57
|
+
})
|
|
58
|
+
.reduce((acc, cur) => Object.assign(acc, cur), {})),
|
|
59
|
+
});
|
|
60
|
+
if (compiled.type === "success" &&
|
|
61
|
+
generatedCodes.every((c) => c.type === "success")) {
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
else if (compiled.type === "failure") {
|
|
65
|
+
diagnostics.current = compiled.diagnostics;
|
|
66
|
+
diagnostics.total = [...diagnostics.total, ...compiled.diagnostics];
|
|
67
|
+
console.log(JSON.stringify(diagnostics, null, 2), i);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return Object.entries(entireCodes).map(([filename, { content }]) => {
|
|
71
|
+
return {
|
|
72
|
+
filename,
|
|
73
|
+
implementationCode: content,
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
function loadTemplateFiles(templateFiles) {
|
|
79
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
80
|
+
const templateBasePath = path_1.default.join(__dirname, "../../../../../internals/template/realize");
|
|
81
|
+
const result = {};
|
|
82
|
+
for (const filePath of templateFiles) {
|
|
83
|
+
result[filePath] = {
|
|
84
|
+
content: yield (0, promises_1.readFile)(path_1.default.join(templateBasePath, filePath), {
|
|
85
|
+
encoding: "utf-8",
|
|
86
|
+
}),
|
|
87
|
+
result: "success",
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
return result;
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
function process(ctx, op, diagnostics, entireCodes) {
|
|
94
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
95
|
+
const result = yield (0, RealizePipe_1.pipe)(op, (op) => (0, orchestrateRealizePlanner_1.orchestrateRealizePlanner)(ctx, op), (p) => {
|
|
96
|
+
var _a, _b;
|
|
97
|
+
const filename = `src/providers/${p.functionName}.ts`;
|
|
98
|
+
const t = diagnostics.total.filter((el) => el.file === filename);
|
|
99
|
+
const d = diagnostics.current.filter((el) => el.file === filename);
|
|
100
|
+
const c = (_b = (_a = entireCodes[filename]) === null || _a === void 0 ? void 0 : _a.content) !== null && _b !== void 0 ? _b : null;
|
|
101
|
+
return (0, orchestrateRealizeCoder_1.orchestrateRealizeCoder)(ctx, op, p, c, t, d);
|
|
102
|
+
});
|
|
103
|
+
if (result === IAutoBeRealizeFailedSymbol_1.FAILED) {
|
|
104
|
+
return { type: "failed", op, result };
|
|
105
|
+
}
|
|
106
|
+
return { type: "success", op, result: result };
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
function shouldProcessOperation(op, currentDiagnostics) {
|
|
110
|
+
if (currentDiagnostics.length === 0) {
|
|
111
|
+
return true;
|
|
112
|
+
}
|
|
113
|
+
const operationFilename = generateProviderFilename(op);
|
|
114
|
+
return currentDiagnostics.some((diagnostic) => diagnostic.file === operationFilename);
|
|
115
|
+
}
|
|
116
|
+
function generateProviderFilename(op) {
|
|
117
|
+
return `src/providers/${op.method}_${op.path
|
|
118
|
+
.replaceAll("/", "_")
|
|
119
|
+
.replaceAll("-", "_")
|
|
120
|
+
.replaceAll("{", "$")
|
|
121
|
+
.replaceAll("}", "")}.ts`;
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=writeCodeUntilCompilePassed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeCodeUntilCompilePassed.js","sourceRoot":"","sources":["../../../src/orchestrate/realize/writeCodeUntilCompilePassed.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAgBA,kEAyFC;AApGD,0CAAuC;AACvC,gDAAwB;AAGxB,+CAAqC;AACrC,uEAAoE;AACpE,2EAAwE;AAGxE,wFAAiE;AAEjE,SAAsB,2BAA2B;yDAG/C,GAAyB,EACzB,GAA+B,EAC/B,QAAgB,CAAC;;QAOjB,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;aAChE,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE;YAChB,OAAO,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC,CAAC;aACD,MAAM,CACL,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,EACzE,EAAE,CACH,CAAC;QAEJ,MAAM,aAAa,GAAG,CAAC,4BAA4B,EAAE,iBAAiB,CAAC,CAAC;QACxE,MAAM,WAAW,qBACZ,CAAC,MAAM,iBAAiB,CAAC,aAAa,CAAC,CAAC,CAC5C,CAAC;QAEF,IAAI,WAAW,GAA6C;YAC1D,OAAO,EAAE,EAAE;YACX,KAAK,EAAE,EAAE;SACV,CAAC;QAEF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC;YAC/B,MAAM,cAAc,GAGd,MAAM,OAAO,CAAC,GAAG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C;IACd,CAAC;IAED,MAAM,iBAAiB,GAAG,wBAAwB,CAAC,EAAE,CAAC,CAAC;IAEvD,OAAO,kBAAkB,CAAC,IAAI,CAC5B,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,KAAK,iBAAiB,CACtD,CAAC;AACJ,CAAC;AAED,SAAS,wBAAwB,CAAC,EAA4B;IAC5D,OAAO,iBAAiB,EAAE,CAAC,MAAM,IAAI,EAAE,CAAC,IAAI;SACzC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC;SACpB,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC;SACpB,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC;SACpB,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,KAAK,CAAC;AAC9B,CAAC"}
|
|
@@ -12,7 +12,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.getTestExternalDeclarations = getTestExternalDeclarations;
|
|
13
13
|
const tstl_1 = require("tstl");
|
|
14
14
|
function getTestExternalDeclarations(ctx) {
|
|
15
|
-
return
|
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
const compiler = yield ctx.compiler();
|
|
17
|
+
return singleton.get(compiler.test);
|
|
18
|
+
});
|
|
16
19
|
}
|
|
17
20
|
const singleton = new tstl_1.Singleton((compiler) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
21
|
const records = yield compiler.getExternal();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getTestExternalDeclarations.js","sourceRoot":"","sources":["../../../../src/orchestrate/test/compile/getTestExternalDeclarations.ts"],"names":[],"mappings":";;;;;;;;;;;AAMA,
|
|
1
|
+
{"version":3,"file":"getTestExternalDeclarations.js","sourceRoot":"","sources":["../../../../src/orchestrate/test/compile/getTestExternalDeclarations.ts"],"names":[],"mappings":";;;;;;;;;;;AAMA,kEAKC;AATD,+BAAiC;AAIjC,SAAsB,2BAA2B,CAE/C,GAAyB;;QACzB,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,QAAQ,EAAE,CAAC;QACtC,OAAO,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;CAAA;AAED,MAAM,SAAS,GAAG,IAAI,gBAAS,CAAC,CAAO,QAA6B,EAAE,EAAE;IACtE,MAAM,OAAO,GAA2B,MAAM,QAAQ,CAAC,WAAW,EAAE,CAAC;IACrE,MAAM,QAAQ,GAAG,CAAC,QAAgB,EAA0B,EAAE;QAC5D,MAAM,OAAO,GAAuB,OAAO,CAAC,QAAQ,CAAC,CAAC;QACtD,IAAI,OAAO,KAAK,SAAS;YAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,QAAQ,EAAE,CAAC,CAAC;QAC1E,OAAO,EAAE,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IACjC,CAAC,CAAC;IACF,OAAO,gCACF,QAAQ,CAAC,iDAAiD,CAAC,GAC3D,QAAQ,CAAC,mDAAmD,CAAC,CAChC,CAAC;AACrC,CAAC,CAAA,CAAC,CAAC"}
|
|
@@ -13,8 +13,9 @@ exports.getTestScenarioArtifacts = getTestScenarioArtifacts;
|
|
|
13
13
|
const openapi_1 = require("@samchon/openapi");
|
|
14
14
|
function getTestScenarioArtifacts(ctx, scenario) {
|
|
15
15
|
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
const compiler = yield ctx.compiler();
|
|
16
17
|
const document = filterDocument(scenario, ctx.state().interface.document);
|
|
17
|
-
const entries = Object.entries(yield
|
|
18
|
+
const entries = Object.entries(yield compiler.interface.write(document));
|
|
18
19
|
const filter = (prefix, exclude) => {
|
|
19
20
|
const result = entries.filter(([key]) => key.startsWith(prefix) === true);
|
|
20
21
|
return Object.fromEntries(exclude
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getTestScenarioArtifacts.js","sourceRoot":"","sources":["../../../../src/orchestrate/test/compile/getTestScenarioArtifacts.ts"],"names":[],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"getTestScenarioArtifacts.js","sourceRoot":"","sources":["../../../../src/orchestrate/test/compile/getTestScenarioArtifacts.ts"],"names":[],"mappings":";;;;;;;;;;;AAUA,4DA4BC;AAjCD,8CAAkE;AAKlE,SAAsB,wBAAwB,CAC5C,GAAyB,EACzB,QAA+D;;QAE/D,MAAM,QAAQ,GAAoB,MAAM,GAAG,CAAC,QAAQ,EAAE,CAAC;QACvD,MAAM,QAAQ,GAA4B,cAAc,CACtD,QAAQ,EACR,GAAG,CAAC,KAAK,EAAE,CAAC,SAAU,CAAC,QAAQ,CAChC,CAAC;QACF,MAAM,OAAO,GAAuB,MAAM,CAAC,OAAO,CAChD,MAAM,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC,CACzC,CAAC;QACF,MAAM,MAAM,GAAG,CAAC,MAAc,EAAE,OAAgB,EAAE,EAAE;YAClD,MAAM,MAAM,GAAuB,OAAO,CAAC,MAAM,CAC/C,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,IAAI,CAC3C,CAAC;YACF,OAAO,MAAM,CAAC,WAAW,CACvB,OAAO;gBACL,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,KAAK,CAAC;gBAC7D,CAAC,CAAC,MAAM,CACX,CAAC;QACJ,CAAC,CAAC;QACF,OAAO;YACL,QAAQ;YACR,GAAG,EAAE,MAAM,CAAC,SAAS,EAAE,oBAAoB,CAAC;YAC5C,GAAG,EAAE,MAAM,CAAC,oBAAoB,CAAC;YACjC,GAAG,EAAE,MAAM,CAAC,eAAe,CAAC;SAC7B,CAAC;IACJ,CAAC;CAAA;AAED,SAAS,cAAc,CACrB,QAA+D,EAC/D,QAAiC;IAEjC,MAAM,U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,CAAC,QAAQ,CAAC,CAAC;IACvD,CAAC;IACD,OAAO;QACL,UAAU;QACV,UAAU;KACX,CAAC;AACJ,CAAC"}
|
|
@@ -45,16 +45,22 @@ const orchestrateTest = (ctx) => (props) => __awaiter(void 0, void 0, void 0, fu
|
|
|
45
45
|
const corrects = yield (0, orchestrateTestCorrect_1.orchestrateTestCorrect)(ctx, written);
|
|
46
46
|
const success = corrects.filter((c) => c.result.type === "success");
|
|
47
47
|
// DO COMPILE
|
|
48
|
-
const
|
|
49
|
-
const
|
|
50
|
-
|
|
48
|
+
const compiler = yield ctx.compiler();
|
|
49
|
+
const result = success.map((c) => c.file);
|
|
50
|
+
const compiled = yield compiler.typescript.compile({
|
|
51
|
+
files: Object.fromEntries([
|
|
52
|
+
...Object.entries(yield ctx.files({
|
|
53
|
+
dbms: "sqlite",
|
|
54
|
+
})).filter(([key]) => key.endsWith(".ts")),
|
|
55
|
+
...result.map((f) => [f.location, f.content]),
|
|
56
|
+
]),
|
|
51
57
|
});
|
|
52
58
|
const history = {
|
|
53
59
|
type: "test",
|
|
54
60
|
id: (0, uuid_1.v4)(),
|
|
55
61
|
completed_at: new Date().toISOString(),
|
|
56
62
|
created_at: start.toISOString(),
|
|
57
|
-
files,
|
|
63
|
+
files: result,
|
|
58
64
|
compiled,
|
|
59
65
|
reason: "Step to the test generation referencing the interface",
|
|
60
66
|
step: (_f = (_e = ctx.state().interface) === null || _e === void 0 ? void 0 : _e.step) !== null && _f !== void 0 ? _f : 0,
|
|
@@ -62,7 +68,7 @@ const orchestrateTest = (ctx) => (props) => __awaiter(void 0, void 0, void 0, fu
|
|
|
62
68
|
ctx.dispatch({
|
|
63
69
|
type: "testComplete",
|
|
64
70
|
created_at: start.toISOString(),
|
|
65
|
-
files: Object.fromEntries(
|
|
71
|
+
files: Object.fromEntries(result.map((f) => [f.location, f.content])),
|
|
66
72
|
compiled,
|
|
67
73
|
step: (_h = (_g = ctx.state().interface) === null || _g === void 0 ? void 0 : _g.step) !== null && _h !== void 0 ? _h : 0,
|
|
68
74
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrateTest.js","sourceRoot":"","sources":["../../../src/orchestrate/test/orchestrateTest.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"orchestrateTest.js","sourceRoot":"","sources":["../../../src/orchestrate/test/orchestrateTest.ts"],"names":[],"mappings":";;;;;;;;;;;;AAWA,+BAA0B;AAI1B,qEAAkE;AAClE,uEAAoE;AACpE,iEAA8D;AAGvD,MAAM,eAAe,GAC1B,CAAiC,GAAyB,EAAE,EAAE,CAC9D,CACE,KAA8B,EAC8B,EAAE;;IAC9D,MAAM,KAAK,GAAS,IAAI,IAAI,EAAE,CAAC;IAC/B,GAAG,CAAC,QAAQ,CAAC;QACX,IAAI,EAAE,WAAW;QACjB,UAAU,EAAE,KAAK,CAAC,WAAW,EAAE;QAC/B,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,IAAI,EAAE,MAAA,MAAA,GAAG,CAAC,KAAK,EAAE,CAAC,OAAO,0CAAE,IAAI,mCAAI,CAAC;KACrC,CAAC,CAAC;IAEH,MAAM,UAAU,GACd,MAAA,MAAA,GAAG,CAAC,KAAK,EAAE,CAAC,SAAS,0CAAE,QAAQ,CAAC,UAAU,mCAAI,EAAE,CAAC;IACnD,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,OAAO,GAAkC;YAC7C,EAAE,EAAE,IAAA,SAAE,GAAE;YACR,IAAI,EAAE,kBAAkB;YACxB,UAAU,EAAE,KAAK,CAAC,WAAW,EAAE;YAC/B,YAAY,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACtC,IAAI,EACF,6DAA6D;gBAC7D,gDAAgD;SACnD,CAAC;QACF,GAAG,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC9B,GAAG,CAAC,QAAQ,CAAC,OAAO,CA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E,GAAE;QACR,YAAY,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACtC,UAAU,EAAE,KAAK,CAAC,WAAW,EAAE;QAC/B,KAAK,EAAE,MAAM;QACb,QAAQ;QACR,MAAM,EAAE,uDAAuD;QAC/D,IAAI,EAAE,MAAA,MAAA,GAAG,CAAC,KAAK,EAAE,CAAC,SAAS,0CAAE,IAAI,mCAAI,CAAC;KACvC,CAAC;IACF,GAAG,CAAC,QAAQ,CAAC;QACX,IAAI,EAAE,cAAc;QACpB,UAAU,EAAE,KAAK,CAAC,WAAW,EAAE;QAC/B,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;QACrE,QAAQ;QACR,IAAI,EAAE,MAAA,MAAA,GAAG,CAAC,KAAK,EAAE,CAAC,SAAS,0CAAE,IAAI,mCAAI,CAAC;KACvC,CAAC,CAAC;IACH,GAAG,CAAC,KAAK,EAAE,CAAC,IAAI,GAAG,OAAO,CAAC;IAC3B,GAAG,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9B,OAAO,OAAO,CAAC;AACjB,CAAC,CAAA,CAAC;AAnFS,QAAA,eAAe,mBAmFxB"}
|
|
@@ -73,7 +73,8 @@ const orchestrateTestCorrect = (ctx_1, writeResult_1, ...args_1) => __awaiter(vo
|
|
|
73
73
|
exports.orchestrateTestCorrect = orchestrateTestCorrect;
|
|
74
74
|
const compile = (ctx, func) => __awaiter(void 0, void 0, void 0, function* () {
|
|
75
75
|
var _a, _b;
|
|
76
|
-
const
|
|
76
|
+
const compiler = yield ctx.compiler();
|
|
77
|
+
const result = yield compiler.test.compile({
|
|
77
78
|
files: Object.assign(Object.assign(Object.assign({}, func.artifacts.dto), func.artifacts.sdk), { [func.location]: func.script }),
|
|
78
79
|
});
|
|
79
80
|
return {
|
|
@@ -83,7 +84,7 @@ const compile = (ctx, func) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
83
84
|
location: func.location,
|
|
84
85
|
content: func.script,
|
|
85
86
|
},
|
|
86
|
-
result
|
|
87
|
+
result,
|
|
87
88
|
created_at: new Date().toISOString(),
|
|
88
89
|
step: (_b = (_a = ctx.state().analyze) === null || _a === void 0 ? void 0 : _a.step) !== null && _b !== void 0 ? _b : 0,
|
|
89
90
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrateTestCorrect.js","sourceRoot":"","sources":["../../../src/orchestrate/test/orchestrateTestCorrect.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAoE;
|
|
1
|
+
{"version":3,"file":"orchestrateTestCorrect.js","sourceRoot":"","sources":["../../../src/orchestrate/test/orchestrateTestCorrect.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAoE;AAQpE,kDAA0B;AAG1B,uEAAoE;AACpE,iEAA8D;AAC9D,uDAAoD;AACpD,iEAA8D;AAK9D,mFAAgF;AAEzE,MAAM,sBAAsB,GAAG,kCAIA,EAAE,yEAHtC,GAAyB,EACzB,WAAqC,EACrC,OAAe,CAAC;IAEhB,OAAA,OAAO,CAAC,GAAG,CACT,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACpB,IAAA,uBAAU,EAAC,GAAS,EAAE;QACpB,MAAM,KAAK,GAA4B,MAAM,OAAO,CAAC,GAAG,EAAE;YACxD,SAAS,EAAE,CAAC,CAAC,SAAS;YACtB,QAAQ,EAAE,CAAC,CAAC,QAAQ;YACpB,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ;YAC1B,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK;SACtB,CAAC,CAAC;QACH,O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AAC,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;gBAC3D,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACpB,CAAC;SACsC;KAC1C,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAMT,CAAC;AACJ,MAAM,UAAU,GAAG;IACjB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAIJ;IACH,MAAM;IACN,KAAK,EAAE,MAAM;IACb,QAAQ,EAAE,MAAM;IAChB,KAAK,EAAE,MAAM;CACd,CAAC"}
|
|
@@ -59,24 +59,33 @@ function orchestrateTestWrite(ctx, scenarios) {
|
|
|
59
59
|
return __awaiter(this, void 0, void 0, function* () {
|
|
60
60
|
const start = new Date();
|
|
61
61
|
let complete = 0;
|
|
62
|
-
|
|
62
|
+
const result = yield Promise.all(
|
|
63
63
|
/**
|
|
64
64
|
* Generate test code for each scenario. Maps through plans array to create
|
|
65
65
|
* individual test code implementations. Each scenario is processed to
|
|
66
66
|
* generate corresponding test code and progress events.
|
|
67
67
|
*/
|
|
68
|
-
scenarios.map((scenario) =>
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
68
|
+
scenarios.map((scenario) => __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
try {
|
|
70
|
+
const r = yield (0, forceRetry_1.forceRetry)(() => __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
var _a, _b;
|
|
72
|
+
const artifacts = yield (0, getTestScenarioArtifacts_1.getTestScenarioArtifacts)(ctx, scenario);
|
|
73
|
+
const result = yield process(ctx, scenario, artifacts);
|
|
74
|
+
const event = Object.assign(Object.assign({ type: "testWrite", created_at: start.toISOString(), location: `test/features/api/${result.domain}/${scenario.functionName}.ts` }, result), { completed: ++complete, total: scenarios.length, step: (_b = (_a = ctx.state().interface) === null || _a === void 0 ? void 0 : _a.step) !== null && _b !== void 0 ? _b : 0 });
|
|
75
|
+
ctx.dispatch(event);
|
|
76
|
+
return {
|
|
77
|
+
scenario,
|
|
78
|
+
artifacts,
|
|
79
|
+
event,
|
|
80
|
+
};
|
|
81
|
+
}));
|
|
82
|
+
return r;
|
|
83
|
+
}
|
|
84
|
+
catch (_a) {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
})));
|
|
88
|
+
return result.filter((r) => r !== null);
|
|
80
89
|
});
|
|
81
90
|
}
|
|
82
91
|
/**
|