@autobe/agent 0.27.0 → 0.28.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.
Files changed (109) hide show
  1. package/lib/constants/AutoBeSystemPromptConstant.d.ts +1 -1
  2. package/lib/context/assertSchemaModel.d.ts +1 -1
  3. package/lib/context/assertSchemaModel.js +4 -7
  4. package/lib/context/assertSchemaModel.js.map +1 -1
  5. package/lib/index.mjs +18395 -8004
  6. package/lib/index.mjs.map +1 -1
  7. package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js +1 -1
  8. package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistories.js.map +1 -1
  9. package/lib/orchestrate/analyze/orchestrateAnalyzeReview.js +164 -86
  10. package/lib/orchestrate/analyze/orchestrateAnalyzeReview.js.map +1 -1
  11. package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js +637 -321
  12. package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js.map +1 -1
  13. package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js +143 -74
  14. package/lib/orchestrate/analyze/orchestrateAnalyzeWrite.js.map +1 -1
  15. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.d.ts +17 -52
  16. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.d.ts +25 -22
  17. package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.d.ts +7 -23
  18. package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js +165 -2
  19. package/lib/orchestrate/common/orchestrateCommonCorrectCasting.js.map +1 -1
  20. package/lib/orchestrate/facade/createAutoBeFacadeController.js +773 -403
  21. package/lib/orchestrate/facade/createAutoBeFacadeController.js.map +1 -1
  22. package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js +739 -2
  23. package/lib/orchestrate/interface/orchestrateInterfaceAuthorizations.js.map +1 -1
  24. package/lib/orchestrate/interface/orchestrateInterfaceComplement.js +1625 -9
  25. package/lib/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
  26. package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +248 -131
  27. package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
  28. package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.js +255 -133
  29. package/lib/orchestrate/interface/orchestrateInterfaceEndpointsReview.js.map +1 -1
  30. package/lib/orchestrate/interface/orchestrateInterfaceGroups.js +339 -226
  31. package/lib/orchestrate/interface/orchestrateInterfaceGroups.js.map +1 -1
  32. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +625 -1
  33. package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
  34. package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js +776 -3
  35. package/lib/orchestrate/interface/orchestrateInterfaceOperationsReview.js.map +1 -1
  36. package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js +205 -3
  37. package/lib/orchestrate/interface/orchestrateInterfacePrerequisites.js.map +1 -1
  38. package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.js +107 -1
  39. package/lib/orchestrate/interface/orchestrateInterfaceSchemaRename.js.map +1 -1
  40. package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.js +1664 -9
  41. package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.js.map +1 -1
  42. package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js +1625 -9
  43. package/lib/orchestrate/interface/orchestrateInterfaceSchemas.js.map +1 -1
  44. package/lib/orchestrate/prisma/orchestratePrismaComponent.js +389 -196
  45. package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
  46. package/lib/orchestrate/prisma/orchestratePrismaCorrect.js +1166 -590
  47. package/lib/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
  48. package/lib/orchestrate/prisma/orchestratePrismaReview.js +1184 -599
  49. package/lib/orchestrate/prisma/orchestratePrismaReview.js.map +1 -1
  50. package/lib/orchestrate/prisma/orchestratePrismaSchemas.js +4 -2
  51. package/lib/orchestrate/prisma/orchestratePrismaSchemas.js.map +1 -1
  52. package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js +360 -179
  53. package/lib/orchestrate/realize/orchestrateRealizeAuthorization.js.map +1 -1
  54. package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js +396 -197
  55. package/lib/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.js.map +1 -1
  56. package/lib/orchestrate/realize/orchestrateRealizeCorrect.js +130 -2
  57. package/lib/orchestrate/realize/orchestrateRealizeCorrect.js.map +1 -1
  58. package/lib/orchestrate/realize/orchestrateRealizeCorrectCasting.js +165 -2
  59. package/lib/orchestrate/realize/orchestrateRealizeCorrectCasting.js.map +1 -1
  60. package/lib/orchestrate/realize/orchestrateRealizeWrite.js +130 -2
  61. package/lib/orchestrate/realize/orchestrateRealizeWrite.js.map +1 -1
  62. package/lib/orchestrate/test/histories/transformTestWriteHistories.js.map +1 -1
  63. package/lib/orchestrate/test/orchestrateTestCorrect.js +131 -2
  64. package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
  65. package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js +166 -2
  66. package/lib/orchestrate/test/orchestrateTestCorrectInvalidRequest.js.map +1 -1
  67. package/lib/orchestrate/test/orchestrateTestScenario.js +255 -3
  68. package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -1
  69. package/lib/orchestrate/test/orchestrateTestScenarioReview.js +281 -3
  70. package/lib/orchestrate/test/orchestrateTestScenarioReview.js.map +1 -1
  71. package/lib/orchestrate/test/orchestrateTestWrite.js +139 -2
  72. package/lib/orchestrate/test/orchestrateTestWrite.js.map +1 -1
  73. package/package.json +9 -9
  74. package/src/constants/AutoBeSystemPromptConstant.ts +1 -1
  75. package/src/context/assertSchemaModel.ts +5 -8
  76. package/src/orchestrate/analyze/orchestrateAnalyzeReview.ts +7 -9
  77. package/src/orchestrate/analyze/orchestrateAnalyzeScenario.ts +13 -9
  78. package/src/orchestrate/analyze/orchestrateAnalyzeWrite.ts +7 -9
  79. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeReviewApplication.ts +19 -54
  80. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.ts +25 -22
  81. package/src/orchestrate/analyze/structures/IAutoBeAnalyzeWriteApplication.ts +8 -24
  82. package/src/orchestrate/common/orchestrateCommonCorrectCasting.ts +15 -1
  83. package/src/orchestrate/facade/createAutoBeFacadeController.ts +7 -6
  84. package/src/orchestrate/interface/orchestrateInterfaceAuthorizations.ts +11 -1
  85. package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +11 -1
  86. package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +13 -9
  87. package/src/orchestrate/interface/orchestrateInterfaceEndpointsReview.ts +13 -9
  88. package/src/orchestrate/interface/orchestrateInterfaceGroups.ts +17 -14
  89. package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +11 -1
  90. package/src/orchestrate/interface/orchestrateInterfaceOperationsReview.ts +14 -1
  91. package/src/orchestrate/interface/orchestrateInterfacePrerequisites.ts +11 -1
  92. package/src/orchestrate/interface/orchestrateInterfaceSchemaRename.ts +9 -1
  93. package/src/orchestrate/interface/orchestrateInterfaceSchemaReview.ts +14 -1
  94. package/src/orchestrate/interface/orchestrateInterfaceSchemas.ts +11 -1
  95. package/src/orchestrate/prisma/orchestratePrismaComponent.ts +13 -9
  96. package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +7 -9
  97. package/src/orchestrate/prisma/orchestratePrismaReview.ts +7 -10
  98. package/src/orchestrate/realize/orchestrateRealizeAuthorization.ts +13 -9
  99. package/src/orchestrate/realize/orchestrateRealizeAuthorizationCorrect.ts +13 -9
  100. package/src/orchestrate/realize/orchestrateRealizeCorrect.ts +11 -1
  101. package/src/orchestrate/realize/orchestrateRealizeCorrectCasting.ts +15 -1
  102. package/src/orchestrate/realize/orchestrateRealizeWrite.ts +11 -1
  103. package/src/orchestrate/test/experimental/orchestrateTestWrite.ast +5 -1
  104. package/src/orchestrate/test/histories/transformTestWriteHistories.ts +1 -1
  105. package/src/orchestrate/test/orchestrateTestCorrect.ts +11 -1
  106. package/src/orchestrate/test/orchestrateTestCorrectInvalidRequest.ts +18 -1
  107. package/src/orchestrate/test/orchestrateTestScenario.ts +11 -1
  108. package/src/orchestrate/test/orchestrateTestScenarioReview.ts +11 -1
  109. package/src/orchestrate/test/orchestrateTestWrite.ts +11 -1
@@ -180,7 +180,11 @@ function execute(ctx, failure) {
180
180
  }
181
181
  function createController(props) {
182
182
  (0, assertSchemaModel_1.assertSchemaModel)(props.model);
183
- const application = collection[props.model];
183
+ const application = collection[props.model === "chatgpt"
184
+ ? "chatgpt"
185
+ : props.model === "gemini"
186
+ ? "gemini"
187
+ : "claude"];
184
188
  return {
185
189
  protocol: "class",
186
190
  name: "Prisma Compiler",
@@ -196,604 +200,1178 @@ const getTableCount = (failure) => {
196
200
  const unique = new Set(failure.errors.map((error) => { var _a; return (_a = error.table) !== null && _a !== void 0 ? _a : null; }));
197
201
  return unique.size;
198
202
  };
199
- const claude = {
200
- model: "claude",
201
- options: {
202
- reference: true,
203
- separate: null
204
- },
205
- functions: [
206
- {
207
- name: "correctPrismaSchemaFiles",
208
- parameters: {
209
- description: "Current Type: {@link IAutoBePrismaCorrectApplication.IProps}",
210
- type: "object",
211
- properties: {
212
- planning: {
213
- description: "Detailed execution plan for fixing `AutoBePrisma` validation errors in\nspecific models.\n\n\uD83C\uDFAF Purpose: Enable systematic reasoning and step-by-step error resolution\napproach for targeted model validation issues\n\n\uD83D\uDCCB Required Planning Content:\n\n1. **Error Scope Analysis**\n\n - List all validation errors from IAutoBePrismaValidation.IError[] array\n - Extract unique table names from errors to identify affected models\n - Categorize errors by type (field duplications, references, types,\n indexes)\n - Identify which models need correction vs. which remain unchanged\n2. **Targeted Fix Strategy**\n\n - Focus ONLY on models mentioned in validation errors\n - Outline minimal changes needed for each affected model\n - Plan cross-model reference updates (if any) without modifying non-error\n models\n - Ensure unchanged models maintain valid references to corrected models\n3. **Model-Specific Fix Plan**\n\n - Model-by-model modification plan for ONLY affected models\n - Exact field additions, renames, or type corrections required\n - Reference updates within corrected models only\n - Index corrections limited to affected models\n4. **Minimal Scope Validation**\n\n - Confirm which models will be included in output (error models only)\n - List models that will remain unchanged in original schema\n - Identify cross-model dependencies without including unchanged models\n - Preserve all business logic within corrected models\n5. **Targeted Impact Assessment**\n\n - Potential effects of fixes on unchanged models (reference validation)\n - Verification points for corrected models only\n - Ensure no new validation errors in targeted models\n - Confirm minimal output scope compliance\n\n\uD83D\uDCA1 Example Planning Structure:\n\n ## Error Scope\n - Target Models: shopping_customers, shopping_orders (2 models only)\n - Unchanged Models: All others remain in original schema\n\n ## Targeted Fixes\n - shopping_customers: Remove duplicate 'email' field\n - shopping_orders: Update targetModel reference to 'shopping_customers'\n\n ## Output Scope\n - Return: Only shopping_customers and shopping_orders models\n - Preserve: All other models unchanged in original schema\n\n ## Cross-Model Impact\n - Verify: shopping_orders still references shopping_customers correctly\n - No changes needed in other models referencing these",
214
- type: "string"
215
- },
216
- models: {
217
- description: "ONLY the specific models that contain validation errors and need\ncorrection.\n\n\uD83D\uDCE5 Input Structure:\n\n- Contains ONLY models mentioned in IAutoBePrismaValidation.IError[] array\n- Each model has specific validation errors that need targeted correction\n- Models not mentioned in errors are excluded from this input\n- Represents minimal scope for error correction\n\n\uD83D\uDD0D Expected Validation Issues (Model-Specific):\n\n- Duplicate field/relation names within these specific models\n- Invalid foreign key references from these models to other models\n- Single foreign key fields in index arrays within these models\n- Invalid naming conventions within these specific models\n- Type validation errors in fields of these models\n\n\uD83D\uDCDD Model Content Analysis (Targeted Scope):\n\n- Complete field definitions for each error model only\n- Relationships from these models (may reference unchanged models)\n- Indexes within these models that need correction\n- Business descriptions specific to these models\n- Cross-model references that need validation (read-only for targets)\n\n\u26A0\uFE0F Processing Notes (Focused Approach):\n\n- Input contains ONLY models with validation errors\n- May reference other models not included in this input\n- Cross-model references must be validated but target models won't be\n modified\n- Output should return corrected versions of ONLY these input models\n- All business logic and descriptions within these models must be preserved\n- Corrections must not break references from unchanged models\n\n\uD83C\uDFAF Correction Scope:\n\n- Fix validation errors within these specific models\n- Update internal model structure (fields, relations, indexes)\n- Correct references to external models (without modifying targets)\n- Maintain compatibility with unchanged models in the full schema\n- Return corrected versions of ONLY these models",
218
- type: "array",
219
- items: {
220
- $ref: "#/$defs/AutoBePrisma.IModel"
221
- }
222
- }
223
- },
224
- required: [
225
- "planning",
226
- "models"
227
- ],
228
- additionalProperties: false,
229
- $defs: {
230
- "AutoBePrisma.IModel": {
231
- description: "Interface representing a single Prisma model (database table).\n\nBased on the uploaded schemas, models follow specific patterns:\n\n- Main business entities (e.g., shopping_sales, shopping_customers)\n- Snapshot/versioning entities for audit trails (e.g.,\n shopping_sale_snapshots)\n- Junction tables for M:N relationships (e.g.,\n shopping_cart_commodity_stocks)\n- Materialized views for performance (prefixed with mv_)",
232
- type: "object",
233
- properties: {
234
- name: {
235
- description: "Name of the Prisma model (database table name).\n\nMUST use snake_case naming convention. Examples: \"shopping_customers\",\n\"shopping_sale_snapshots\", \"bbs_articles\" Materialized views use \"mv_\"\nprefix: \"mv_shopping_sale_last_snapshots\"",
236
- type: "string",
237
- pattern: "^[a-z][a-z0-9_]*$"
238
- },
239
- description: {
240
- description: "Detailed description explaining the business purpose and usage of the\nmodel.\n\nShould include:\n\n- Business context and purpose\n- Key relationships with other models\n- Important behavioral notes or constraints\n- References to related entities using \"{@\\link ModelName}\" syntax\n\n**IMPORTANT**: Description must be written in English. Example: \"Customer\ninformation, but not a person but a **connection** basis...\"",
241
- type: "string"
242
- },
243
- material: {
244
- description: "Indicates whether this model represents a materialized view for\nperformance optimization.\n\nMaterialized views are read-only computed tables that cache complex query\nresults. They're marked as \"@\\hidden\" in documentation and prefixed with\n\"mv_\" in naming. Examples: mv_shopping_sale_last_snapshots,\nmv_shopping_cart_commodity_prices",
245
- type: "boolean"
246
- },
247
- stance: {
248
- description: "Specifies the architectural stance of this model within the database\nsystem.\n\nThis property defines how the table positions itself in relation to other\ntables and what role it plays in the overall data architecture,\nparticularly for API endpoint generation and business logic\norganization.\n\n## Values:\n\n### `\"primary\"` - Main Business Entity\n\nTables that represent core business concepts and serve as the primary\nsubjects of user operations. These tables typically warrant independent\nCRUD API endpoints since users directly interact with these entities.\n\n**Key principle**: If users need to independently create, search, filter,\nor manage entities regardless of their parent context, the table should\nbe primary stance.\n\n**API Requirements:**\n\n- Independent creation endpoints (POST /articles, POST /comments)\n- Search and filtering capabilities across all instances\n- Direct update and delete operations\n- List/pagination endpoints for browsing\n\n**Why `bbs_article_comments` is primary, not subsidiary:**\n\nAlthough comments belong to articles, they require independent\nmanagement:\n\n- **Search across articles**: \"Find all comments by user X across all\n articles\"\n- **Moderation workflows**: \"List all pending comments for review\"\n- **User activity**: \"Show all comments made by this user\"\n- **Independent operations**: Users edit/delete their comments directly\n- **Notification systems**: \"Alert when any comment is posted\"\n\nIf comments were subsidiary, these operations would be impossible or\nrequire inefficient nested queries through parent articles.\n\n**Characteristics:**\n\n- Represents tangible business concepts that users manage\n- Serves as reference points for other tables\n- Requires comprehensive API operations (CREATE, READ, UPDATE, DELETE)\n- Forms the backbone of the application's business logic\n\n**Examples:**\n\n- `bbs_articles` - Forum posts that users create, edit, and manage\n- `bbs_article_comments` - User comments that require independent\n management\n\n### `\"subsidiary\"` - Supporting/Dependent Entity\n\nTables that exist to support primary entities but are not independently\nmanaged by users. These tables are typically managed through their parent\nentities and may not need standalone API endpoints.\n\n**Characteristics:**\n\n- Depends on primary or snapshot entities for context\n- Often managed indirectly through parent entity operations\n- May have limited or no independent API operations\n- Provides supporting data or relationships\n\n**Examples:**\n\n- `bbs_article_snapshot_files` - Files attached to article snapshots\n- `bbs_article_snapshot_tags` - Tags associated with article snapshots\n- `bbs_article_comment_snapshot_files` - Files attached to comment\n snapshots\n\n### `\"snapshot\"` - Historical/Versioning Entity\n\nTables that capture point-in-time states of primary entities for audit\ntrails, version control, or historical tracking. These tables record\nchanges but are rarely modified directly by users.\n\n**Characteristics:**\n\n- Captures historical states of primary entities\n- Typically append-only (rarely updated or deleted)\n- Referenced for audit trails and change tracking\n- Usually read-only from user perspective\n\n**Examples:**\n\n- `bbs_article_snapshots` - Historical states of articles\n- `bbs_article_comment_snapshots` - Comment modification history\n\n## API Generation Guidelines:\n\nThe stance property guides automatic API endpoint generation:\n\n- **`\"primary\"`** \u2192 Generate full CRUD endpoints based on business\n requirements\n- **`\"subsidiary\"`** \u2192 Evaluate carefully; often managed through parent\n entities\n- **`\"snapshot\"`** \u2192 Typically read-only endpoints for historical data\n access",
249
- oneOf: [
250
- {
251
- "const": "primary"
252
- },
253
- {
254
- "const": "subsidiary"
255
- },
256
- {
257
- "const": "snapshot"
258
- }
259
- ]
260
- },
261
- primaryField: {
262
- description: "The primary key field of the model.\n\nIn all uploaded schemas, primary keys are always UUID type with \"@\\id\"\ndirective. Usually named \"id\" and marked with \"@\\db.Uuid\" for PostgreSQL\nmapping.",
263
- $ref: "#/$defs/AutoBePrisma.IPrimaryField"
264
- },
265
- foreignFields: {
266
- description: "Array of foreign key fields that reference other models.\n\nThese establish relationships between models and include Prisma relation\ndirectives. Can be nullable (optional relationships) or required\n(mandatory relationships). May have unique constraints for 1:1\nrelationships.",
267
- type: "array",
268
- items: {
269
- $ref: "#/$defs/AutoBePrisma.IForeignField"
270
- }
271
- },
272
- plainFields: {
273
- description: "Array of regular data fields that don't reference other models.\n\nInclude business data like names, descriptions, timestamps, flags,\namounts, etc. Common patterns: created_at, updated_at, deleted_at for\nsoft deletion and auditing.",
274
- type: "array",
275
- items: {
276
- $ref: "#/$defs/AutoBePrisma.IPlainField"
277
- }
278
- },
279
- uniqueIndexes: {
280
- description: "Array of unique indexes for enforcing data integrity constraints.\n\nEnsure uniqueness across single or multiple columns. Examples: unique\nemail addresses, unique codes within a channel, unique combinations like\n(channel_id, nickname).",
281
- type: "array",
282
- items: {
283
- $ref: "#/$defs/AutoBePrisma.IUniqueIndex"
284
- }
285
- },
286
- plainIndexes: {
287
- description: "Array of regular indexes for query performance optimization.\n\nSpeed up common query patterns like filtering by foreign keys, date\nranges, or frequently searched fields. Examples: indexes on created_at,\nforeign key fields, search fields.",
288
- type: "array",
289
- items: {
290
- $ref: "#/$defs/AutoBePrisma.IPlainIndex"
291
- }
292
- },
293
- ginIndexes: {
294
- description: "Array of GIN (Generalized Inverted Index) indexes for full-text search.\n\nUsed specifically for PostgreSQL text search capabilities using trigram\noperations. Applied to text fields that need fuzzy matching or partial\ntext search. Examples: searching names, nicknames, titles, content\nbodies.",
295
- type: "array",
296
- items: {
297
- $ref: "#/$defs/AutoBePrisma.IGinIndex"
298
- }
299
- }
203
+ const collection = {
204
+ chatgpt: {
205
+ model: "chatgpt",
206
+ options: {
207
+ reference: true,
208
+ strict: false,
209
+ separate: null
210
+ },
211
+ functions: [
212
+ {
213
+ name: "correctPrismaSchemaFiles",
214
+ parameters: {
215
+ description: "Current Type: {@link IAutoBePrismaCorrectApplication.IProps}",
216
+ type: "object",
217
+ properties: {
218
+ planning: {
219
+ description: "Detailed execution plan for fixing `AutoBePrisma` validation errors in\nspecific models.\n\n\uD83C\uDFAF Purpose: Enable systematic reasoning and step-by-step error resolution\napproach for targeted model validation issues\n\n\uD83D\uDCCB Required Planning Content:\n\n1. **Error Scope Analysis**\n\n - List all validation errors from IAutoBePrismaValidation.IError[] array\n - Extract unique table names from errors to identify affected models\n - Categorize errors by type (field duplications, references, types,\n indexes)\n - Identify which models need correction vs. which remain unchanged\n2. **Targeted Fix Strategy**\n\n - Focus ONLY on models mentioned in validation errors\n - Outline minimal changes needed for each affected model\n - Plan cross-model reference updates (if any) without modifying non-error\n models\n - Ensure unchanged models maintain valid references to corrected models\n3. **Model-Specific Fix Plan**\n\n - Model-by-model modification plan for ONLY affected models\n - Exact field additions, renames, or type corrections required\n - Reference updates within corrected models only\n - Index corrections limited to affected models\n4. **Minimal Scope Validation**\n\n - Confirm which models will be included in output (error models only)\n - List models that will remain unchanged in original schema\n - Identify cross-model dependencies without including unchanged models\n - Preserve all business logic within corrected models\n5. **Targeted Impact Assessment**\n\n - Potential effects of fixes on unchanged models (reference validation)\n - Verification points for corrected models only\n - Ensure no new validation errors in targeted models\n - Confirm minimal output scope compliance\n\n\uD83D\uDCA1 Example Planning Structure:\n\n ## Error Scope\n - Target Models: shopping_customers, shopping_orders (2 models only)\n - Unchanged Models: All others remain in original schema\n\n ## Targeted Fixes\n - shopping_customers: Remove duplicate 'email' field\n - shopping_orders: Update targetModel reference to 'shopping_customers'\n\n ## Output Scope\n - Return: Only shopping_customers and shopping_orders models\n - Preserve: All other models unchanged in original schema\n\n ## Cross-Model Impact\n - Verify: shopping_orders still references shopping_customers correctly\n - No changes needed in other models referencing these",
220
+ type: "string"
300
221
  },
301
- required: [
302
- "name",
303
- "description",
304
- "material",
305
- "stance",
306
- "primaryField",
307
- "foreignFields",
308
- "plainFields",
309
- "uniqueIndexes",
310
- "plainIndexes",
311
- "ginIndexes"
312
- ]
313
- },
314
- "AutoBePrisma.IPrimaryField": {
315
- description: "Interface representing the primary key field of a Prisma model.\n\nAll models in the uploaded schemas use UUID as primary key for better\ndistributed system compatibility and security (no sequential ID exposure).",
316
- type: "object",
317
- properties: {
318
- name: {
319
- description: "Name of the primary key field.\n\nMUST use snake_case naming convention. Consistently named \"id\" across all\nmodels in the uploaded schemas. Represents the unique identifier for each\nrecord in the table.",
320
- type: "string",
321
- pattern: "^[a-z][a-z0-9_]*$"
322
- },
323
- type: {
324
- description: "Data type of the primary key field.\n\nAlways \"uuid\" in the uploaded schemas for better distributed system\nsupport and to avoid exposing sequential IDs that could reveal business\ninformation.",
325
- "const": "uuid"
326
- },
327
- description: {
328
- description: "Description of the primary key field's purpose.\n\nStandard description is \"Primary Key.\" across all models. Serves as the\nunique identifier for the model instance.\n\n**IMPORTANT**: Description must be written in English.",
329
- type: "string"
222
+ models: {
223
+ description: "ONLY the specific models that contain validation errors and need\ncorrection.\n\n\uD83D\uDCE5 Input Structure:\n\n- Contains ONLY models mentioned in IAutoBePrismaValidation.IError[] array\n- Each model has specific validation errors that need targeted correction\n- Models not mentioned in errors are excluded from this input\n- Represents minimal scope for error correction\n\n\uD83D\uDD0D Expected Validation Issues (Model-Specific):\n\n- Duplicate field/relation names within these specific models\n- Invalid foreign key references from these models to other models\n- Single foreign key fields in index arrays within these models\n- Invalid naming conventions within these specific models\n- Type validation errors in fields of these models\n\n\uD83D\uDCDD Model Content Analysis (Targeted Scope):\n\n- Complete field definitions for each error model only\n- Relationships from these models (may reference unchanged models)\n- Indexes within these models that need correction\n- Business descriptions specific to these models\n- Cross-model references that need validation (read-only for targets)\n\n\u26A0\uFE0F Processing Notes (Focused Approach):\n\n- Input contains ONLY models with validation errors\n- May reference other models not included in this input\n- Cross-model references must be validated but target models won't be\n modified\n- Output should return corrected versions of ONLY these input models\n- All business logic and descriptions within these models must be preserved\n- Corrections must not break references from unchanged models\n\n\uD83C\uDFAF Correction Scope:\n\n- Fix validation errors within these specific models\n- Update internal model structure (fields, relations, indexes)\n- Correct references to external models (without modifying targets)\n- Maintain compatibility with unchanged models in the full schema\n- Return corrected versions of ONLY these models",
224
+ type: "array",
225
+ items: {
226
+ $ref: "#/$defs/AutoBePrisma.IModel"
330
227
  }
331
- },
332
- required: [
333
- "name",
334
- "type",
335
- "description"
336
- ]
228
+ }
337
229
  },
338
- "AutoBePrisma.IForeignField": {
339
- description: "Interface representing a foreign key field that establishes relationships\nbetween models.\n\nForeign keys create associations between models, enabling relational data\nmodeling. They can represent 1:1, 1:N, or participate in M:N relationships\nthrough junction tables.",
340
- type: "object",
341
- properties: {
342
- name: {
343
- description: "Name of the foreign key field.\n\nMUST use snake_case naming convention. Follows convention:\n\"{target_model_name_without_prefix}_id\" Examples: \"shopping_customer_id\",\n\"bbs_article_id\", \"attachment_file_id\" For self-references: \"parent_id\"\n(e.g., in hierarchical structures)",
344
- type: "string",
345
- pattern: "^[a-z][a-z0-9_]*$"
346
- },
347
- type: {
348
- description: "Data type of the foreign key field.\n\nAlways \"uuid\" to match the primary key type of referenced models. Ensures\nreferential integrity and consistency across the schema.",
349
- "const": "uuid"
350
- },
351
- description: {
352
- description: "Description explaining the purpose and target of this foreign key\nrelationship.\n\nShould reference the target model using format: \"Target model's {@\\link\nModelName.id}\" Examples: \"Belonged customer's {@\\link\nshopping_customers.id}\" May include additional context about the\nrelationship's business meaning.\n\n**IMPORTANT**: Description must be written in English.",
353
- type: "string"
354
- },
355
- relation: {
356
- description: "Prisma relation configuration defining the association details.\n\nSpecifies how this foreign key connects to the target model, including\nrelation name, target model, and target field. This configuration is used\nto generate the appropriate Prisma relation directive in the schema.",
357
- $ref: "#/$defs/AutoBePrisma.IRelation"
358
- },
359
- unique: {
360
- description: "Whether this foreign key has a unique constraint.\n\nTrue: Creates a 1:1 relationship (e.g., user profile, order publish\ndetails) false: Allows 1:N relationship (e.g., customer to multiple\norders) Used for enforcing business rules about relationship\ncardinality.",
361
- type: "boolean"
230
+ required: [
231
+ "planning",
232
+ "models"
233
+ ],
234
+ additionalProperties: false,
235
+ $defs: {
236
+ "AutoBePrisma.IModel": {
237
+ description: "Interface representing a single Prisma model (database table).\n\nBased on the uploaded schemas, models follow specific patterns:\n\n- Main business entities (e.g., shopping_sales, shopping_customers)\n- Snapshot/versioning entities for audit trails (e.g.,\n shopping_sale_snapshots)\n- Junction tables for M:N relationships (e.g.,\n shopping_cart_commodity_stocks)\n- Materialized views for performance (prefixed with mv_)",
238
+ type: "object",
239
+ properties: {
240
+ name: {
241
+ description: "Name of the Prisma model (database table name).\n\nMUST use snake_case naming convention. Examples: \"shopping_customers\",\n\"shopping_sale_snapshots\", \"bbs_articles\" Materialized views use \"mv_\"\nprefix: \"mv_shopping_sale_last_snapshots\"\n\n\n@pattern ^[a-z][a-z0-9_]*$",
242
+ type: "string"
243
+ },
244
+ description: {
245
+ description: "Detailed description explaining the business purpose and usage of the\nmodel.\n\nShould include:\n\n- Business context and purpose\n- Key relationships with other models\n- Important behavioral notes or constraints\n- References to related entities using \"{@\\link ModelName}\" syntax\n\n**IMPORTANT**: Description must be written in English. Example: \"Customer\ninformation, but not a person but a **connection** basis...\"",
246
+ type: "string"
247
+ },
248
+ material: {
249
+ description: "Indicates whether this model represents a materialized view for\nperformance optimization.\n\nMaterialized views are read-only computed tables that cache complex query\nresults. They're marked as \"@\\hidden\" in documentation and prefixed with\n\"mv_\" in naming. Examples: mv_shopping_sale_last_snapshots,\nmv_shopping_cart_commodity_prices",
250
+ type: "boolean"
251
+ },
252
+ stance: {
253
+ description: "Specifies the architectural stance of this model within the database\nsystem.\n\nThis property defines how the table positions itself in relation to other\ntables and what role it plays in the overall data architecture,\nparticularly for API endpoint generation and business logic\norganization.\n\n## Values:\n\n### `\"primary\"` - Main Business Entity\n\nTables that represent core business concepts and serve as the primary\nsubjects of user operations. These tables typically warrant independent\nCRUD API endpoints since users directly interact with these entities.\n\n**Key principle**: If users need to independently create, search, filter,\nor manage entities regardless of their parent context, the table should\nbe primary stance.\n\n**API Requirements:**\n\n- Independent creation endpoints (POST /articles, POST /comments)\n- Search and filtering capabilities across all instances\n- Direct update and delete operations\n- List/pagination endpoints for browsing\n\n**Why `bbs_article_comments` is primary, not subsidiary:**\n\nAlthough comments belong to articles, they require independent\nmanagement:\n\n- **Search across articles**: \"Find all comments by user X across all\n articles\"\n- **Moderation workflows**: \"List all pending comments for review\"\n- **User activity**: \"Show all comments made by this user\"\n- **Independent operations**: Users edit/delete their comments directly\n- **Notification systems**: \"Alert when any comment is posted\"\n\nIf comments were subsidiary, these operations would be impossible or\nrequire inefficient nested queries through parent articles.\n\n**Characteristics:**\n\n- Represents tangible business concepts that users manage\n- Serves as reference points for other tables\n- Requires comprehensive API operations (CREATE, READ, UPDATE, DELETE)\n- Forms the backbone of the application's business logic\n\n**Examples:**\n\n- `bbs_articles` - Forum posts that users create, edit, and manage\n- `bbs_article_comments` - User comments that require independent\n management\n\n### `\"subsidiary\"` - Supporting/Dependent Entity\n\nTables that exist to support primary entities but are not independently\nmanaged by users. These tables are typically managed through their parent\nentities and may not need standalone API endpoints.\n\n**Characteristics:**\n\n- Depends on primary or snapshot entities for context\n- Often managed indirectly through parent entity operations\n- May have limited or no independent API operations\n- Provides supporting data or relationships\n\n**Examples:**\n\n- `bbs_article_snapshot_files` - Files attached to article snapshots\n- `bbs_article_snapshot_tags` - Tags associated with article snapshots\n- `bbs_article_comment_snapshot_files` - Files attached to comment\n snapshots\n\n### `\"snapshot\"` - Historical/Versioning Entity\n\nTables that capture point-in-time states of primary entities for audit\ntrails, version control, or historical tracking. These tables record\nchanges but are rarely modified directly by users.\n\n**Characteristics:**\n\n- Captures historical states of primary entities\n- Typically append-only (rarely updated or deleted)\n- Referenced for audit trails and change tracking\n- Usually read-only from user perspective\n\n**Examples:**\n\n- `bbs_article_snapshots` - Historical states of articles\n- `bbs_article_comment_snapshots` - Comment modification history\n\n## API Generation Guidelines:\n\nThe stance property guides automatic API endpoint generation:\n\n- **`\"primary\"`** \u2192 Generate full CRUD endpoints based on business\n requirements\n- **`\"subsidiary\"`** \u2192 Evaluate carefully; often managed through parent\n entities\n- **`\"snapshot\"`** \u2192 Typically read-only endpoints for historical data\n access",
254
+ type: "string",
255
+ "enum": [
256
+ "primary",
257
+ "subsidiary",
258
+ "snapshot"
259
+ ]
260
+ },
261
+ primaryField: {
262
+ description: "The primary key field of the model.\n\nIn all uploaded schemas, primary keys are always UUID type with \"@\\id\"\ndirective. Usually named \"id\" and marked with \"@\\db.Uuid\" for PostgreSQL\nmapping.",
263
+ $ref: "#/$defs/AutoBePrisma.IPrimaryField"
264
+ },
265
+ foreignFields: {
266
+ description: "Array of foreign key fields that reference other models.\n\nThese establish relationships between models and include Prisma relation\ndirectives. Can be nullable (optional relationships) or required\n(mandatory relationships). May have unique constraints for 1:1\nrelationships.",
267
+ type: "array",
268
+ items: {
269
+ $ref: "#/$defs/AutoBePrisma.IForeignField"
270
+ }
271
+ },
272
+ plainFields: {
273
+ description: "Array of regular data fields that don't reference other models.\n\nInclude business data like names, descriptions, timestamps, flags,\namounts, etc. Common patterns: created_at, updated_at, deleted_at for\nsoft deletion and auditing.",
274
+ type: "array",
275
+ items: {
276
+ $ref: "#/$defs/AutoBePrisma.IPlainField"
277
+ }
278
+ },
279
+ uniqueIndexes: {
280
+ description: "Array of unique indexes for enforcing data integrity constraints.\n\nEnsure uniqueness across single or multiple columns. Examples: unique\nemail addresses, unique codes within a channel, unique combinations like\n(channel_id, nickname).",
281
+ type: "array",
282
+ items: {
283
+ $ref: "#/$defs/AutoBePrisma.IUniqueIndex"
284
+ }
285
+ },
286
+ plainIndexes: {
287
+ description: "Array of regular indexes for query performance optimization.\n\nSpeed up common query patterns like filtering by foreign keys, date\nranges, or frequently searched fields. Examples: indexes on created_at,\nforeign key fields, search fields.",
288
+ type: "array",
289
+ items: {
290
+ $ref: "#/$defs/AutoBePrisma.IPlainIndex"
291
+ }
292
+ },
293
+ ginIndexes: {
294
+ description: "Array of GIN (Generalized Inverted Index) indexes for full-text search.\n\nUsed specifically for PostgreSQL text search capabilities using trigram\noperations. Applied to text fields that need fuzzy matching or partial\ntext search. Examples: searching names, nicknames, titles, content\nbodies.",
295
+ type: "array",
296
+ items: {
297
+ $ref: "#/$defs/AutoBePrisma.IGinIndex"
298
+ }
299
+ }
362
300
  },
363
- nullable: {
364
- description: "Whether this foreign key can be null (optional relationship).\n\nTrue: Relationship is optional, foreign key can be null false:\nRelationship is required, foreign key cannot be null Reflects business\nrules about mandatory vs optional associations.",
365
- type: "boolean"
366
- }
301
+ required: [
302
+ "name",
303
+ "description",
304
+ "material",
305
+ "stance",
306
+ "primaryField",
307
+ "foreignFields",
308
+ "plainFields",
309
+ "uniqueIndexes",
310
+ "plainIndexes",
311
+ "ginIndexes"
312
+ ]
367
313
  },
368
- required: [
369
- "name",
370
- "type",
371
- "description",
372
- "relation",
373
- "unique",
374
- "nullable"
375
- ]
376
- },
377
- "AutoBePrisma.IRelation": {
378
- description: "Interface representing a Prisma relation configuration between models.\n\nThis interface defines how foreign key fields establish relationships with\ntheir target models. It provides the necessary information for Prisma to\ngenerate appropriate relation directives (@relation) in the schema,\nenabling proper relational data modeling and ORM functionality.\n\nThe relation configuration is essential for:\n\n- Generating correct Prisma relation syntax\n- Establishing bidirectional relationships between models\n- Enabling proper type-safe querying through Prisma client\n- Supporting complex relationship patterns (1:1, 1:N, M:N)",
379
- type: "object",
380
- properties: {
381
- name: {
382
- description: "Name of the relation property in the Prisma model.\n\nThis becomes the property name used to access the related model instance\nthrough the Prisma client. Should be descriptive and reflect the business\nrelationship being modeled.\n\nExamples:\n\n- \"customer\" for shopping_customer_id field\n- \"channel\" for shopping_channel_id field\n- \"parent\" for parent_id field in hierarchical structures\n- \"snapshot\" for versioning relationships\n- \"article\" for bbs_article_id field\n\nNaming convention: camelCase, descriptive of the relationship's business\nmeaning",
383
- type: "string",
384
- pattern: "^[a-z][a-zA-Z0-9]*$"
314
+ "AutoBePrisma.IPrimaryField": {
315
+ description: "Interface representing the primary key field of a Prisma model.\n\nAll models in the uploaded schemas use UUID as primary key for better\ndistributed system compatibility and security (no sequential ID exposure).",
316
+ type: "object",
317
+ properties: {
318
+ name: {
319
+ description: "Name of the primary key field.\n\nMUST use snake_case naming convention. Consistently named \"id\" across all\nmodels in the uploaded schemas. Represents the unique identifier for each\nrecord in the table.\n\n\n@pattern ^[a-z][a-z0-9_]*$",
320
+ type: "string"
321
+ },
322
+ type: {
323
+ description: "Data type of the primary key field.\n\nAlways \"uuid\" in the uploaded schemas for better distributed system\nsupport and to avoid exposing sequential IDs that could reveal business\ninformation.",
324
+ type: "string",
325
+ "enum": [
326
+ "uuid"
327
+ ]
328
+ },
329
+ description: {
330
+ description: "Description of the primary key field's purpose.\n\nStandard description is \"Primary Key.\" across all models. Serves as the\nunique identifier for the model instance.\n\n**IMPORTANT**: Description must be written in English.",
331
+ type: "string"
332
+ }
385
333
  },
386
- targetModel: {
387
- description: "Name of the target model being referenced by this relation.\n\nMust exactly match an existing model name in the schema. This is used by\nPrisma to establish the foreign key constraint and generate the\nappropriate relation mapping.\n\nExamples:\n\n- \"shopping_customers\" for customer relationships\n- \"shopping_channels\" for channel relationships\n- \"bbs_articles\" for article relationships\n- \"attachment_files\" for file attachments\n\nThe target model should exist in the same schema or be accessible through\nthe Prisma schema configuration.",
388
- type: "string"
389
- }
334
+ required: [
335
+ "name",
336
+ "type",
337
+ "description"
338
+ ]
390
339
  },
391
- required: [
392
- "name",
393
- "targetModel"
394
- ]
395
- },
396
- "AutoBePrisma.IPlainField": {
397
- description: "Interface representing a regular data field that stores business\ninformation.\n\nThese fields contain the actual business data like names, amounts,\ntimestamps, flags, descriptions, and other domain-specific information.",
398
- type: "object",
399
- properties: {
400
- name: {
401
- description: "Name of the field in the database table.\n\nMUST use snake_case naming convention. Common patterns from uploaded\nschemas:\n\n- Timestamps: created_at, updated_at, deleted_at, opened_at, closed_at\n- Identifiers: code, name, nickname, title\n- Business data: value, quantity, price, volume, balance\n- Flags: primary, required, exclusive, secret, multiplicative",
402
- type: "string",
403
- pattern: "^[a-z][a-z0-9_]*$"
404
- },
405
- type: {
406
- description: "Data type of the field for Prisma schema generation.\n\nMaps to appropriate Prisma/PostgreSQL types:\n\n- Boolean: Boolean flags and yes/no values\n- Int: Integer numbers, quantities, sequences\n- Double: Decimal numbers, prices, monetary values, percentages\n- String: Text data, names, descriptions, codes\n- Uri: URL/URI fields for links and references\n- Uuid: UUID fields (for non-foreign-key UUIDs)\n- Datetime: Timestamp fields with date and time",
407
- oneOf: [
408
- {
409
- "const": "string"
410
- },
411
- {
412
- "const": "boolean"
413
- },
414
- {
415
- "const": "uuid"
416
- },
417
- {
418
- "const": "uri"
419
- },
420
- {
421
- "const": "int"
422
- },
423
- {
424
- "const": "double"
425
- },
426
- {
427
- "const": "datetime"
428
- }
429
- ]
430
- },
431
- description: {
432
- description: "Description explaining the business purpose and usage of this field.\n\nShould clearly explain:\n\n- What business concept this field represents\n- Valid values or constraints if applicable\n- How it relates to business processes\n- Any special behavioral notes\n\n**IMPORTANT**: Description must be written in English. Example: \"Amount\nof cash payment.\" or \"Whether the unit is required or not.\"",
433
- type: "string"
340
+ "AutoBePrisma.IForeignField": {
341
+ description: "Interface representing a foreign key field that establishes relationships\nbetween models.\n\nForeign keys create associations between models, enabling relational data\nmodeling. They can represent 1:1, 1:N, or participate in M:N relationships\nthrough junction tables.",
342
+ type: "object",
343
+ properties: {
344
+ name: {
345
+ description: "Name of the foreign key field.\n\nMUST use snake_case naming convention. Follows convention:\n\"{target_model_name_without_prefix}_id\" Examples: \"shopping_customer_id\",\n\"bbs_article_id\", \"attachment_file_id\" For self-references: \"parent_id\"\n(e.g., in hierarchical structures)\n\n\n@pattern ^[a-z][a-z0-9_]*$",
346
+ type: "string"
347
+ },
348
+ type: {
349
+ description: "Data type of the foreign key field.\n\nAlways \"uuid\" to match the primary key type of referenced models. Ensures\nreferential integrity and consistency across the schema.",
350
+ type: "string",
351
+ "enum": [
352
+ "uuid"
353
+ ]
354
+ },
355
+ description: {
356
+ description: "Description explaining the purpose and target of this foreign key\nrelationship.\n\nShould reference the target model using format: \"Target model's {@\\link\nModelName.id}\" Examples: \"Belonged customer's {@\\link\nshopping_customers.id}\" May include additional context about the\nrelationship's business meaning.\n\n**IMPORTANT**: Description must be written in English.",
357
+ type: "string"
358
+ },
359
+ relation: {
360
+ description: "Prisma relation configuration defining the association details.\n\nSpecifies how this foreign key connects to the target model, including\nrelation name, target model, and target field. This configuration is used\nto generate the appropriate Prisma relation directive in the schema.",
361
+ $ref: "#/$defs/AutoBePrisma.IRelation"
362
+ },
363
+ unique: {
364
+ description: "Whether this foreign key has a unique constraint.\n\nTrue: Creates a 1:1 relationship (e.g., user profile, order publish\ndetails) false: Allows 1:N relationship (e.g., customer to multiple\norders) Used for enforcing business rules about relationship\ncardinality.",
365
+ type: "boolean"
366
+ },
367
+ nullable: {
368
+ description: "Whether this foreign key can be null (optional relationship).\n\nTrue: Relationship is optional, foreign key can be null false:\nRelationship is required, foreign key cannot be null Reflects business\nrules about mandatory vs optional associations.",
369
+ type: "boolean"
370
+ }
434
371
  },
435
- nullable: {
436
- description: "Whether this field can contain null values.\n\nTrue: Field is optional and can be null (e.g., middle name, description)\nfalse: Field is required and cannot be null (e.g., creation timestamp,\nname) Reflects business rules about mandatory vs optional data.",
437
- type: "boolean"
438
- }
372
+ required: [
373
+ "name",
374
+ "type",
375
+ "description",
376
+ "relation",
377
+ "unique",
378
+ "nullable"
379
+ ]
439
380
  },
440
- required: [
441
- "name",
442
- "type",
443
- "description",
444
- "nullable"
445
- ]
446
- },
447
- "AutoBePrisma.IUniqueIndex": {
448
- description: "Interface representing a unique index constraint on one or more fields.\n\nUnique indexes enforce data integrity by ensuring no duplicate values exist\nfor the specified field combination. Essential for business rules that\nrequire uniqueness like email addresses, codes, or composite keys.",
449
- type: "object",
450
- properties: {
451
- fieldNames: {
452
- description: "Array of field names that together form the unique constraint.\n\nCan be single field (e.g., [\"email\"]) or composite (e.g., [\"channel_id\",\n\"code\"]). All field names must exist in the model. Order matters for\ncomposite indexes. Examples: [\"code\"], [\"shopping_channel_id\",\n\"nickname\"], [\"email\"]",
453
- type: "array",
454
- items: {
381
+ "AutoBePrisma.IRelation": {
382
+ description: "Interface representing a Prisma relation configuration between models.\n\nThis interface defines how foreign key fields establish relationships with\ntheir target models. It provides the necessary information for Prisma to\ngenerate appropriate relation directives (@relation) in the schema,\nenabling proper relational data modeling and ORM functionality.\n\nThe relation configuration is essential for:\n\n- Generating correct Prisma relation syntax\n- Establishing bidirectional relationships between models\n- Enabling proper type-safe querying through Prisma client\n- Supporting complex relationship patterns (1:1, 1:N, M:N)",
383
+ type: "object",
384
+ properties: {
385
+ name: {
386
+ description: "Name of the relation property in the Prisma model.\n\nThis becomes the property name used to access the related model instance\nthrough the Prisma client. Should be descriptive and reflect the business\nrelationship being modeled.\n\nExamples:\n\n- \"customer\" for shopping_customer_id field\n- \"channel\" for shopping_channel_id field\n- \"parent\" for parent_id field in hierarchical structures\n- \"snapshot\" for versioning relationships\n- \"article\" for bbs_article_id field\n\nNaming convention: camelCase, descriptive of the relationship's business\nmeaning\n\n\n@pattern ^[a-z][a-zA-Z0-9]*$",
455
387
  type: "string"
456
388
  },
457
- minItems: 1,
458
- uniqueItems: true
389
+ targetModel: {
390
+ description: "Name of the target model being referenced by this relation.\n\nMust exactly match an existing model name in the schema. This is used by\nPrisma to establish the foreign key constraint and generate the\nappropriate relation mapping.\n\nExamples:\n\n- \"shopping_customers\" for customer relationships\n- \"shopping_channels\" for channel relationships\n- \"bbs_articles\" for article relationships\n- \"attachment_files\" for file attachments\n\nThe target model should exist in the same schema or be accessible through\nthe Prisma schema configuration.",
391
+ type: "string"
392
+ }
459
393
  },
460
- unique: {
461
- description: "Explicit marker indicating this is a unique index.\n\nAlways true to distinguish from regular indexes. Used by code generator\nto emit \"@@unique\" directive in Prisma schema instead of \"@@index\".",
462
- "const": true
463
- }
394
+ required: [
395
+ "name",
396
+ "targetModel"
397
+ ]
464
398
  },
465
- required: [
466
- "fieldNames",
467
- "unique"
468
- ]
469
- },
470
- "AutoBePrisma.IPlainIndex": {
471
- description: "Interface representing a regular (non-unique) index for query performance.\n\nRegular indexes speed up database queries by creating optimized data\nstructures for common search patterns. Essential for foreign keys, date\nranges, and frequently filtered fields.",
472
- type: "object",
473
- properties: {
474
- fieldNames: {
475
- description: "Array of field names to include in the performance index.\n\nCan be single field (e.g., [\"created_at\"]) or composite (e.g.,\n[\"customer_id\", \"created_at\"]). All field names must exist in the model.\nOrder matters for composite indexes and should match common query\npatterns. Examples: [\"created_at\"], [\"shopping_customer_id\",\n\"created_at\"], [\"ip\"]",
476
- type: "array",
477
- items: {
399
+ "AutoBePrisma.IPlainField": {
400
+ description: "Interface representing a regular data field that stores business\ninformation.\n\nThese fields contain the actual business data like names, amounts,\ntimestamps, flags, descriptions, and other domain-specific information.",
401
+ type: "object",
402
+ properties: {
403
+ name: {
404
+ description: "Name of the field in the database table.\n\nMUST use snake_case naming convention. Common patterns from uploaded\nschemas:\n\n- Timestamps: created_at, updated_at, deleted_at, opened_at, closed_at\n- Identifiers: code, name, nickname, title\n- Business data: value, quantity, price, volume, balance\n- Flags: primary, required, exclusive, secret, multiplicative\n\n\n@pattern ^[a-z][a-z0-9_]*$",
478
405
  type: "string"
479
406
  },
480
- minItems: 1,
481
- uniqueItems: true
482
- }
483
- },
484
- required: [
485
- "fieldNames"
486
- ]
487
- },
488
- "AutoBePrisma.IGinIndex": {
489
- description: "Interface representing a GIN (Generalized Inverted Index) for full-text\nsearch.\n\nGIN indexes enable advanced PostgreSQL text search capabilities including\nfuzzy matching and partial text search using trigram operations. Essential\nfor user-facing search features on text content.",
490
- type: "object",
491
- properties: {
492
- fieldName: {
493
- description: "Name of the text field to index for full-text search capabilities.\n\nMust be a string field in the model that contains searchable text.\nExamples from uploaded schemas: \"nickname\", \"title\", \"body\", \"name\" Used\nwith PostgreSQL gin_trgm_ops for trigram-based fuzzy text search.",
494
- type: "string"
495
- }
496
- },
497
- required: [
498
- "fieldName"
499
- ]
500
- }
501
- }
502
- },
503
- description: "Fixes validation errors in specific AutoBePrisma models while preserving\nALL existing business logic and model descriptions.\n\n## Core Rules\n\n1. Fix ONLY validation errors in provided models - never remove business\n descriptions\n2. Apply minimal changes to error models only - preserve original design\n intent\n3. Return ONLY corrected models - unchanged models remain in original schema\n4. Maintain referential integrity with unchanged models\n\n## Targeted Scope\n\n- Process ONLY models with validation errors from IError[] array\n- Exclude models without errors from processing and output\n- Minimize context usage by returning corrected models only\n- Preserve unchanged models in their original state\n\n## Fix Strategy\n\n- Resolve validation errors within specific models only\n- Fix field duplications, invalid references, and type mismatches\n- Update cross-model references without modifying target models\n- Ensure naming conventions and index rules compliance in corrected models",
504
- validate: (() => { const _io0 = input => "string" === typeof input.planning && (Array.isArray(input.models) && input.models.every(elem => "object" === typeof elem && null !== elem && _io1(elem))); const _io1 = input => "string" === typeof input.name && RegExp("^[a-z][a-z0-9_]*$").test(input.name) && "string" === typeof input.description && "boolean" === typeof input.material && ("primary" === input.stance || "subsidiary" === input.stance || "snapshot" === input.stance) && ("object" === typeof input.primaryField && null !== input.primaryField && _io2(input.primaryField)) && (Array.isArray(input.foreignFields) && input.foreignFields.every(elem => "object" === typeof elem && null !== elem && _io3(elem))) && (Array.isArray(input.plainFields) && input.plainFields.every(elem => "object" === typeof elem && null !== elem && _io5(elem))) && (Array.isArray(input.uniqueIndexes) && input.uniqueIndexes.every(elem => "object" === typeof elem && null !== elem && _io6(elem))) && (Array.isArray(input.plainIndexes) && input.plainIndexes.every(elem => "object" === typeof elem && null !== elem && _io7(elem))) && (Array.isArray(input.ginIndexes) && input.ginIndexes.every(elem => "object" === typeof elem && null !== elem && _io8(elem))); const _io2 = input => "string" === typeof input.name && RegExp("^[a-z][a-z0-9_]*$").test(input.name) && "uuid" === input.type && "string" === typeof input.description; const _io3 = input => "string" === typeof input.name && RegExp("^[a-z][a-z0-9_]*$").test(input.name) && "uuid" === input.type && "string" === typeof input.description && ("object" === typeof input.relation && null !== input.relation && _io4(input.relation)) && "boolean" === typeof input.unique && "boolean" === typeof input.nullable; const _io4 = input => "string" === typeof input.name && RegExp("^[a-z][a-zA-Z0-9]*$").test(input.name) && "string" === typeof input.targetModel; const _io5 = input => "string" === typeof input.name && RegExp("^[a-z][a-z0-9_]*$").test(input.name) && ("string" === input.type || "boolean" === input.type || "uuid" === input.type || "uri" === input.type || "int" === input.type || "double" === input.type || "datetime" === input.type) && "string" === typeof input.description && "boolean" === typeof input.nullable; const _io6 = input => Array.isArray(input.fieldNames) && (1 <= input.fieldNames.length && __typia_transform__isUniqueItems._isUniqueItems(input.fieldNames) && input.fieldNames.every(elem => "string" === typeof elem)) && true === input.unique; const _io7 = input => Array.isArray(input.fieldNames) && (1 <= input.fieldNames.length && __typia_transform__isUniqueItems._isUniqueItems(input.fieldNames) && input.fieldNames.every(elem => "string" === typeof elem)); const _io8 = input => "string" === typeof input.fieldName; const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.planning || _report(_exceptionable, {
505
- path: _path + ".planning",
506
- expected: "string",
507
- value: input.planning
508
- }), (Array.isArray(input.models) || _report(_exceptionable, {
509
- path: _path + ".models",
510
- expected: "Array<AutoBePrisma.IModel>",
511
- value: input.models
512
- })) && input.models.map((elem, _index9) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
513
- path: _path + ".models[" + _index9 + "]",
514
- expected: "AutoBePrisma.IModel",
515
- value: elem
516
- })) && _vo1(elem, _path + ".models[" + _index9 + "]", true && _exceptionable) || _report(_exceptionable, {
517
- path: _path + ".models[" + _index9 + "]",
518
- expected: "AutoBePrisma.IModel",
519
- value: elem
520
- })).every(flag => flag) || _report(_exceptionable, {
521
- path: _path + ".models",
522
- expected: "Array<AutoBePrisma.IModel>",
523
- value: input.models
524
- })].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[a-z][a-z0-9_]*$").test(input.name) || _report(_exceptionable, {
525
- path: _path + ".name",
526
- expected: "string & SnakeCasePattern",
527
- value: input.name
528
- })) || _report(_exceptionable, {
529
- path: _path + ".name",
530
- expected: "(string & SnakeCasePattern)",
531
- value: input.name
532
- }), "string" === typeof input.description || _report(_exceptionable, {
533
- path: _path + ".description",
534
- expected: "string",
535
- value: input.description
536
- }), "boolean" === typeof input.material || _report(_exceptionable, {
537
- path: _path + ".material",
538
- expected: "boolean",
539
- value: input.material
540
- }), "primary" === input.stance || "subsidiary" === input.stance || "snapshot" === input.stance || _report(_exceptionable, {
541
- path: _path + ".stance",
542
- expected: "(\"primary\" | \"snapshot\" | \"subsidiary\")",
543
- value: input.stance
544
- }), ("object" === typeof input.primaryField && null !== input.primaryField || _report(_exceptionable, {
545
- path: _path + ".primaryField",
546
- expected: "AutoBePrisma.IPrimaryField",
547
- value: input.primaryField
548
- })) && _vo2(input.primaryField, _path + ".primaryField", true && _exceptionable) || _report(_exceptionable, {
549
- path: _path + ".primaryField",
550
- expected: "AutoBePrisma.IPrimaryField",
551
- value: input.primaryField
552
- }), (Array.isArray(input.foreignFields) || _report(_exceptionable, {
553
- path: _path + ".foreignFields",
554
- expected: "Array<AutoBePrisma.IForeignField>",
555
- value: input.foreignFields
556
- })) && input.foreignFields.map((elem, _index10) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
557
- path: _path + ".foreignFields[" + _index10 + "]",
558
- expected: "AutoBePrisma.IForeignField",
559
- value: elem
560
- })) && _vo3(elem, _path + ".foreignFields[" + _index10 + "]", true && _exceptionable) || _report(_exceptionable, {
561
- path: _path + ".foreignFields[" + _index10 + "]",
562
- expected: "AutoBePrisma.IForeignField",
563
- value: elem
564
- })).every(flag => flag) || _report(_exceptionable, {
565
- path: _path + ".foreignFields",
566
- expected: "Array<AutoBePrisma.IForeignField>",
567
- value: input.foreignFields
568
- }), (Array.isArray(input.plainFields) || _report(_exceptionable, {
569
- path: _path + ".plainFields",
570
- expected: "Array<AutoBePrisma.IPlainField>",
571
- value: input.plainFields
572
- })) && input.plainFields.map((elem, _index11) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
573
- path: _path + ".plainFields[" + _index11 + "]",
574
- expected: "AutoBePrisma.IPlainField",
575
- value: elem
576
- })) && _vo5(elem, _path + ".plainFields[" + _index11 + "]", true && _exceptionable) || _report(_exceptionable, {
577
- path: _path + ".plainFields[" + _index11 + "]",
578
- expected: "AutoBePrisma.IPlainField",
579
- value: elem
580
- })).every(flag => flag) || _report(_exceptionable, {
581
- path: _path + ".plainFields",
582
- expected: "Array<AutoBePrisma.IPlainField>",
583
- value: input.plainFields
584
- }), (Array.isArray(input.uniqueIndexes) || _report(_exceptionable, {
585
- path: _path + ".uniqueIndexes",
586
- expected: "Array<AutoBePrisma.IUniqueIndex>",
587
- value: input.uniqueIndexes
588
- })) && input.uniqueIndexes.map((elem, _index12) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
589
- path: _path + ".uniqueIndexes[" + _index12 + "]",
590
- expected: "AutoBePrisma.IUniqueIndex",
591
- value: elem
592
- })) && _vo6(elem, _path + ".uniqueIndexes[" + _index12 + "]", true && _exceptionable) || _report(_exceptionable, {
593
- path: _path + ".uniqueIndexes[" + _index12 + "]",
594
- expected: "AutoBePrisma.IUniqueIndex",
595
- value: elem
596
- })).every(flag => flag) || _report(_exceptionable, {
597
- path: _path + ".uniqueIndexes",
598
- expected: "Array<AutoBePrisma.IUniqueIndex>",
599
- value: input.uniqueIndexes
600
- }), (Array.isArray(input.plainIndexes) || _report(_exceptionable, {
601
- path: _path + ".plainIndexes",
602
- expected: "Array<AutoBePrisma.IPlainIndex>",
603
- value: input.plainIndexes
604
- })) && input.plainIndexes.map((elem, _index13) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
605
- path: _path + ".plainIndexes[" + _index13 + "]",
606
- expected: "AutoBePrisma.IPlainIndex",
607
- value: elem
608
- })) && _vo7(elem, _path + ".plainIndexes[" + _index13 + "]", true && _exceptionable) || _report(_exceptionable, {
609
- path: _path + ".plainIndexes[" + _index13 + "]",
610
- expected: "AutoBePrisma.IPlainIndex",
611
- value: elem
612
- })).every(flag => flag) || _report(_exceptionable, {
613
- path: _path + ".plainIndexes",
614
- expected: "Array<AutoBePrisma.IPlainIndex>",
615
- value: input.plainIndexes
616
- }), (Array.isArray(input.ginIndexes) || _report(_exceptionable, {
617
- path: _path + ".ginIndexes",
618
- expected: "Array<AutoBePrisma.IGinIndex>",
619
- value: input.ginIndexes
620
- })) && input.ginIndexes.map((elem, _index14) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
621
- path: _path + ".ginIndexes[" + _index14 + "]",
622
- expected: "AutoBePrisma.IGinIndex",
623
- value: elem
624
- })) && _vo8(elem, _path + ".ginIndexes[" + _index14 + "]", true && _exceptionable) || _report(_exceptionable, {
625
- path: _path + ".ginIndexes[" + _index14 + "]",
626
- expected: "AutoBePrisma.IGinIndex",
627
- value: elem
628
- })).every(flag => flag) || _report(_exceptionable, {
629
- path: _path + ".ginIndexes",
630
- expected: "Array<AutoBePrisma.IGinIndex>",
631
- value: input.ginIndexes
632
- })].every(flag => flag); const _vo2 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[a-z][a-z0-9_]*$").test(input.name) || _report(_exceptionable, {
633
- path: _path + ".name",
634
- expected: "string & SnakeCasePattern",
635
- value: input.name
636
- })) || _report(_exceptionable, {
637
- path: _path + ".name",
638
- expected: "(string & SnakeCasePattern)",
639
- value: input.name
640
- }), "uuid" === input.type || _report(_exceptionable, {
641
- path: _path + ".type",
642
- expected: "\"uuid\"",
643
- value: input.type
644
- }), "string" === typeof input.description || _report(_exceptionable, {
645
- path: _path + ".description",
646
- expected: "string",
647
- value: input.description
648
- })].every(flag => flag); const _vo3 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[a-z][a-z0-9_]*$").test(input.name) || _report(_exceptionable, {
649
- path: _path + ".name",
650
- expected: "string & SnakeCasePattern",
651
- value: input.name
652
- })) || _report(_exceptionable, {
653
- path: _path + ".name",
654
- expected: "(string & SnakeCasePattern)",
655
- value: input.name
656
- }), "uuid" === input.type || _report(_exceptionable, {
657
- path: _path + ".type",
658
- expected: "\"uuid\"",
659
- value: input.type
660
- }), "string" === typeof input.description || _report(_exceptionable, {
661
- path: _path + ".description",
662
- expected: "string",
663
- value: input.description
664
- }), ("object" === typeof input.relation && null !== input.relation || _report(_exceptionable, {
665
- path: _path + ".relation",
666
- expected: "AutoBePrisma.IRelation",
667
- value: input.relation
668
- })) && _vo4(input.relation, _path + ".relation", true && _exceptionable) || _report(_exceptionable, {
669
- path: _path + ".relation",
670
- expected: "AutoBePrisma.IRelation",
671
- value: input.relation
672
- }), "boolean" === typeof input.unique || _report(_exceptionable, {
673
- path: _path + ".unique",
674
- expected: "boolean",
675
- value: input.unique
676
- }), "boolean" === typeof input.nullable || _report(_exceptionable, {
677
- path: _path + ".nullable",
678
- expected: "boolean",
679
- value: input.nullable
680
- })].every(flag => flag); const _vo4 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[a-z][a-zA-Z0-9]*$").test(input.name) || _report(_exceptionable, {
681
- path: _path + ".name",
682
- expected: "string & CamelCasePattern",
683
- value: input.name
684
- })) || _report(_exceptionable, {
685
- path: _path + ".name",
686
- expected: "(string & CamelCasePattern)",
687
- value: input.name
688
- }), "string" === typeof input.targetModel || _report(_exceptionable, {
689
- path: _path + ".targetModel",
690
- expected: "string",
691
- value: input.targetModel
692
- })].every(flag => flag); const _vo5 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[a-z][a-z0-9_]*$").test(input.name) || _report(_exceptionable, {
693
- path: _path + ".name",
694
- expected: "string & SnakeCasePattern",
695
- value: input.name
696
- })) || _report(_exceptionable, {
697
- path: _path + ".name",
698
- expected: "(string & SnakeCasePattern)",
699
- value: input.name
700
- }), "string" === input.type || "boolean" === input.type || "uuid" === input.type || "uri" === input.type || "int" === input.type || "double" === input.type || "datetime" === input.type || _report(_exceptionable, {
701
- path: _path + ".type",
702
- expected: "(\"boolean\" | \"datetime\" | \"double\" | \"int\" | \"string\" | \"uri\" | \"uuid\")",
703
- value: input.type
704
- }), "string" === typeof input.description || _report(_exceptionable, {
705
- path: _path + ".description",
706
- expected: "string",
707
- value: input.description
708
- }), "boolean" === typeof input.nullable || _report(_exceptionable, {
709
- path: _path + ".nullable",
710
- expected: "boolean",
711
- value: input.nullable
712
- })].every(flag => flag); const _vo6 = (input, _path, _exceptionable = true) => [(Array.isArray(input.fieldNames) || _report(_exceptionable, {
713
- path: _path + ".fieldNames",
714
- expected: "(Array<string> & MinItems<1> & UniqueItems<true>)",
715
- value: input.fieldNames
716
- })) && ((1 <= input.fieldNames.length || _report(_exceptionable, {
717
- path: _path + ".fieldNames",
718
- expected: "Array<> & MinItems<1>",
719
- value: input.fieldNames
720
- })) && (__typia_transform__isUniqueItems._isUniqueItems(input.fieldNames) || _report(_exceptionable, {
721
- path: _path + ".fieldNames",
722
- expected: "Array<> & UniqueItems<true>",
723
- value: input.fieldNames
724
- })) && input.fieldNames.map((elem, _index15) => "string" === typeof elem || _report(_exceptionable, {
725
- path: _path + ".fieldNames[" + _index15 + "]",
726
- expected: "string",
727
- value: elem
728
- })).every(flag => flag)) || _report(_exceptionable, {
729
- path: _path + ".fieldNames",
730
- expected: "(Array<string> & MinItems<1> & UniqueItems<true>)",
731
- value: input.fieldNames
732
- }), true === input.unique || _report(_exceptionable, {
733
- path: _path + ".unique",
734
- expected: "true",
735
- value: input.unique
736
- })].every(flag => flag); const _vo7 = (input, _path, _exceptionable = true) => [(Array.isArray(input.fieldNames) || _report(_exceptionable, {
737
- path: _path + ".fieldNames",
738
- expected: "(Array<string> & MinItems<1> & UniqueItems<true>)",
739
- value: input.fieldNames
740
- })) && ((1 <= input.fieldNames.length || _report(_exceptionable, {
741
- path: _path + ".fieldNames",
742
- expected: "Array<> & MinItems<1>",
743
- value: input.fieldNames
744
- })) && (__typia_transform__isUniqueItems._isUniqueItems(input.fieldNames) || _report(_exceptionable, {
745
- path: _path + ".fieldNames",
746
- expected: "Array<> & UniqueItems<true>",
747
- value: input.fieldNames
748
- })) && input.fieldNames.map((elem, _index16) => "string" === typeof elem || _report(_exceptionable, {
749
- path: _path + ".fieldNames[" + _index16 + "]",
750
- expected: "string",
751
- value: elem
752
- })).every(flag => flag)) || _report(_exceptionable, {
753
- path: _path + ".fieldNames",
754
- expected: "(Array<string> & MinItems<1> & UniqueItems<true>)",
755
- value: input.fieldNames
756
- })].every(flag => flag); const _vo8 = (input, _path, _exceptionable = true) => ["string" === typeof input.fieldName || _report(_exceptionable, {
757
- path: _path + ".fieldName",
758
- expected: "string",
759
- value: input.fieldName
760
- })].every(flag => flag); const __is = input => "object" === typeof input && null !== input && _io0(input); let errors; let _report; return input => {
761
- if (false === __is(input)) {
762
- errors = [];
763
- _report = __typia_transform__validateReport._validateReport(errors);
764
- ((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
765
- path: _path + "",
766
- expected: "IAutoBePrismaCorrectApplication.IProps",
767
- value: input
768
- })) && _vo0(input, _path + "", true) || _report(true, {
769
- path: _path + "",
770
- expected: "IAutoBePrismaCorrectApplication.IProps",
771
- value: input
772
- }))(input, "$input", true);
773
- const success = 0 === errors.length;
774
- return success ? {
775
- success,
776
- data: input
777
- } : {
778
- success,
779
- errors,
780
- data: input
781
- };
782
- }
783
- return {
784
- success: true,
785
- data: input
786
- };
787
- }; })()
788
- }
789
- ]
790
- };
791
- const collection = {
792
- chatgpt: {
793
- model: "chatgpt",
794
- options: {
795
- reference: true,
796
- strict: false,
407
+ type: {
408
+ description: "Data type of the field for Prisma schema generation.\n\nMaps to appropriate Prisma/PostgreSQL types:\n\n- Boolean: Boolean flags and yes/no values\n- Int: Integer numbers, quantities, sequences\n- Double: Decimal numbers, prices, monetary values, percentages\n- String: Text data, names, descriptions, codes\n- Uri: URL/URI fields for links and references\n- Uuid: UUID fields (for non-foreign-key UUIDs)\n- Datetime: Timestamp fields with date and time",
409
+ type: "string",
410
+ "enum": [
411
+ "string",
412
+ "boolean",
413
+ "uuid",
414
+ "uri",
415
+ "int",
416
+ "double",
417
+ "datetime"
418
+ ]
419
+ },
420
+ description: {
421
+ description: "Description explaining the business purpose and usage of this field.\n\nShould clearly explain:\n\n- What business concept this field represents\n- Valid values or constraints if applicable\n- How it relates to business processes\n- Any special behavioral notes\n\n**IMPORTANT**: Description must be written in English. Example: \"Amount\nof cash payment.\" or \"Whether the unit is required or not.\"",
422
+ type: "string"
423
+ },
424
+ nullable: {
425
+ description: "Whether this field can contain null values.\n\nTrue: Field is optional and can be null (e.g., middle name, description)\nfalse: Field is required and cannot be null (e.g., creation timestamp,\nname) Reflects business rules about mandatory vs optional data.",
426
+ type: "boolean"
427
+ }
428
+ },
429
+ required: [
430
+ "name",
431
+ "type",
432
+ "description",
433
+ "nullable"
434
+ ]
435
+ },
436
+ "AutoBePrisma.IUniqueIndex": {
437
+ description: "Interface representing a unique index constraint on one or more fields.\n\nUnique indexes enforce data integrity by ensuring no duplicate values exist\nfor the specified field combination. Essential for business rules that\nrequire uniqueness like email addresses, codes, or composite keys.",
438
+ type: "object",
439
+ properties: {
440
+ fieldNames: {
441
+ description: "Array of field names that together form the unique constraint.\n\nCan be single field (e.g., [\"email\"]) or composite (e.g., [\"channel_id\",\n\"code\"]). All field names must exist in the model. Order matters for\ncomposite indexes. Examples: [\"code\"], [\"shopping_channel_id\",\n\"nickname\"], [\"email\"]\n\n\n@minItems 1\n@uniqueItems",
442
+ type: "array",
443
+ items: {
444
+ type: "string"
445
+ }
446
+ },
447
+ unique: {
448
+ description: "Explicit marker indicating this is a unique index.\n\nAlways true to distinguish from regular indexes. Used by code generator\nto emit \"@@unique\" directive in Prisma schema instead of \"@@index\".",
449
+ type: "boolean",
450
+ "enum": [
451
+ true
452
+ ]
453
+ }
454
+ },
455
+ required: [
456
+ "fieldNames",
457
+ "unique"
458
+ ]
459
+ },
460
+ "AutoBePrisma.IPlainIndex": {
461
+ description: "Interface representing a regular (non-unique) index for query performance.\n\nRegular indexes speed up database queries by creating optimized data\nstructures for common search patterns. Essential for foreign keys, date\nranges, and frequently filtered fields.",
462
+ type: "object",
463
+ properties: {
464
+ fieldNames: {
465
+ description: "Array of field names to include in the performance index.\n\nCan be single field (e.g., [\"created_at\"]) or composite (e.g.,\n[\"customer_id\", \"created_at\"]). All field names must exist in the model.\nOrder matters for composite indexes and should match common query\npatterns. Examples: [\"created_at\"], [\"shopping_customer_id\",\n\"created_at\"], [\"ip\"]\n\n\n@minItems 1\n@uniqueItems",
466
+ type: "array",
467
+ items: {
468
+ type: "string"
469
+ }
470
+ }
471
+ },
472
+ required: [
473
+ "fieldNames"
474
+ ]
475
+ },
476
+ "AutoBePrisma.IGinIndex": {
477
+ description: "Interface representing a GIN (Generalized Inverted Index) for full-text\nsearch.\n\nGIN indexes enable advanced PostgreSQL text search capabilities including\nfuzzy matching and partial text search using trigram operations. Essential\nfor user-facing search features on text content.",
478
+ type: "object",
479
+ properties: {
480
+ fieldName: {
481
+ description: "Name of the text field to index for full-text search capabilities.\n\nMust be a string field in the model that contains searchable text.\nExamples from uploaded schemas: \"nickname\", \"title\", \"body\", \"name\" Used\nwith PostgreSQL gin_trgm_ops for trigram-based fuzzy text search.",
482
+ type: "string"
483
+ }
484
+ },
485
+ required: [
486
+ "fieldName"
487
+ ]
488
+ }
489
+ }
490
+ },
491
+ description: "Fixes validation errors in specific AutoBePrisma models while preserving\nALL existing business logic and model descriptions.\n\n## Core Rules\n\n1. Fix ONLY validation errors in provided models - never remove business\n descriptions\n2. Apply minimal changes to error models only - preserve original design\n intent\n3. Return ONLY corrected models - unchanged models remain in original schema\n4. Maintain referential integrity with unchanged models\n\n## Targeted Scope\n\n- Process ONLY models with validation errors from IError[] array\n- Exclude models without errors from processing and output\n- Minimize context usage by returning corrected models only\n- Preserve unchanged models in their original state\n\n## Fix Strategy\n\n- Resolve validation errors within specific models only\n- Fix field duplications, invalid references, and type mismatches\n- Update cross-model references without modifying target models\n- Ensure naming conventions and index rules compliance in corrected models",
492
+ validate: (() => { const _io0 = input => "string" === typeof input.planning && (Array.isArray(input.models) && input.models.every(elem => "object" === typeof elem && null !== elem && _io1(elem))); const _io1 = input => "string" === typeof input.name && RegExp("^[a-z][a-z0-9_]*$").test(input.name) && "string" === typeof input.description && "boolean" === typeof input.material && ("primary" === input.stance || "subsidiary" === input.stance || "snapshot" === input.stance) && ("object" === typeof input.primaryField && null !== input.primaryField && _io2(input.primaryField)) && (Array.isArray(input.foreignFields) && input.foreignFields.every(elem => "object" === typeof elem && null !== elem && _io3(elem))) && (Array.isArray(input.plainFields) && input.plainFields.every(elem => "object" === typeof elem && null !== elem && _io5(elem))) && (Array.isArray(input.uniqueIndexes) && input.uniqueIndexes.every(elem => "object" === typeof elem && null !== elem && _io6(elem))) && (Array.isArray(input.plainIndexes) && input.plainIndexes.every(elem => "object" === typeof elem && null !== elem && _io7(elem))) && (Array.isArray(input.ginIndexes) && input.ginIndexes.every(elem => "object" === typeof elem && null !== elem && _io8(elem))); const _io2 = input => "string" === typeof input.name && RegExp("^[a-z][a-z0-9_]*$").test(input.name) && "uuid" === input.type && "string" === typeof input.description; const _io3 = input => "string" === typeof input.name && RegExp("^[a-z][a-z0-9_]*$").test(input.name) && "uuid" === input.type && "string" === typeof input.description && ("object" === typeof input.relation && null !== input.relation && _io4(input.relation)) && "boolean" === typeof input.unique && "boolean" === typeof input.nullable; const _io4 = input => "string" === typeof input.name && RegExp("^[a-z][a-zA-Z0-9]*$").test(input.name) && "string" === typeof input.targetModel; const _io5 = input => "string" === typeof input.name && RegExp("^[a-z][a-z0-9_]*$").test(input.name) && ("string" === input.type || "boolean" === input.type || "uuid" === input.type || "uri" === input.type || "int" === input.type || "double" === input.type || "datetime" === input.type) && "string" === typeof input.description && "boolean" === typeof input.nullable; const _io6 = input => Array.isArray(input.fieldNames) && (1 <= input.fieldNames.length && __typia_transform__isUniqueItems._isUniqueItems(input.fieldNames) && input.fieldNames.every(elem => "string" === typeof elem)) && true === input.unique; const _io7 = input => Array.isArray(input.fieldNames) && (1 <= input.fieldNames.length && __typia_transform__isUniqueItems._isUniqueItems(input.fieldNames) && input.fieldNames.every(elem => "string" === typeof elem)); const _io8 = input => "string" === typeof input.fieldName; const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.planning || _report(_exceptionable, {
493
+ path: _path + ".planning",
494
+ expected: "string",
495
+ value: input.planning
496
+ }), (Array.isArray(input.models) || _report(_exceptionable, {
497
+ path: _path + ".models",
498
+ expected: "Array<AutoBePrisma.IModel>",
499
+ value: input.models
500
+ })) && input.models.map((elem, _index9) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
501
+ path: _path + ".models[" + _index9 + "]",
502
+ expected: "AutoBePrisma.IModel",
503
+ value: elem
504
+ })) && _vo1(elem, _path + ".models[" + _index9 + "]", true && _exceptionable) || _report(_exceptionable, {
505
+ path: _path + ".models[" + _index9 + "]",
506
+ expected: "AutoBePrisma.IModel",
507
+ value: elem
508
+ })).every(flag => flag) || _report(_exceptionable, {
509
+ path: _path + ".models",
510
+ expected: "Array<AutoBePrisma.IModel>",
511
+ value: input.models
512
+ })].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[a-z][a-z0-9_]*$").test(input.name) || _report(_exceptionable, {
513
+ path: _path + ".name",
514
+ expected: "string & SnakeCasePattern",
515
+ value: input.name
516
+ })) || _report(_exceptionable, {
517
+ path: _path + ".name",
518
+ expected: "(string & SnakeCasePattern)",
519
+ value: input.name
520
+ }), "string" === typeof input.description || _report(_exceptionable, {
521
+ path: _path + ".description",
522
+ expected: "string",
523
+ value: input.description
524
+ }), "boolean" === typeof input.material || _report(_exceptionable, {
525
+ path: _path + ".material",
526
+ expected: "boolean",
527
+ value: input.material
528
+ }), "primary" === input.stance || "subsidiary" === input.stance || "snapshot" === input.stance || _report(_exceptionable, {
529
+ path: _path + ".stance",
530
+ expected: "(\"primary\" | \"snapshot\" | \"subsidiary\")",
531
+ value: input.stance
532
+ }), ("object" === typeof input.primaryField && null !== input.primaryField || _report(_exceptionable, {
533
+ path: _path + ".primaryField",
534
+ expected: "AutoBePrisma.IPrimaryField",
535
+ value: input.primaryField
536
+ })) && _vo2(input.primaryField, _path + ".primaryField", true && _exceptionable) || _report(_exceptionable, {
537
+ path: _path + ".primaryField",
538
+ expected: "AutoBePrisma.IPrimaryField",
539
+ value: input.primaryField
540
+ }), (Array.isArray(input.foreignFields) || _report(_exceptionable, {
541
+ path: _path + ".foreignFields",
542
+ expected: "Array<AutoBePrisma.IForeignField>",
543
+ value: input.foreignFields
544
+ })) && input.foreignFields.map((elem, _index10) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
545
+ path: _path + ".foreignFields[" + _index10 + "]",
546
+ expected: "AutoBePrisma.IForeignField",
547
+ value: elem
548
+ })) && _vo3(elem, _path + ".foreignFields[" + _index10 + "]", true && _exceptionable) || _report(_exceptionable, {
549
+ path: _path + ".foreignFields[" + _index10 + "]",
550
+ expected: "AutoBePrisma.IForeignField",
551
+ value: elem
552
+ })).every(flag => flag) || _report(_exceptionable, {
553
+ path: _path + ".foreignFields",
554
+ expected: "Array<AutoBePrisma.IForeignField>",
555
+ value: input.foreignFields
556
+ }), (Array.isArray(input.plainFields) || _report(_exceptionable, {
557
+ path: _path + ".plainFields",
558
+ expected: "Array<AutoBePrisma.IPlainField>",
559
+ value: input.plainFields
560
+ })) && input.plainFields.map((elem, _index11) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
561
+ path: _path + ".plainFields[" + _index11 + "]",
562
+ expected: "AutoBePrisma.IPlainField",
563
+ value: elem
564
+ })) && _vo5(elem, _path + ".plainFields[" + _index11 + "]", true && _exceptionable) || _report(_exceptionable, {
565
+ path: _path + ".plainFields[" + _index11 + "]",
566
+ expected: "AutoBePrisma.IPlainField",
567
+ value: elem
568
+ })).every(flag => flag) || _report(_exceptionable, {
569
+ path: _path + ".plainFields",
570
+ expected: "Array<AutoBePrisma.IPlainField>",
571
+ value: input.plainFields
572
+ }), (Array.isArray(input.uniqueIndexes) || _report(_exceptionable, {
573
+ path: _path + ".uniqueIndexes",
574
+ expected: "Array<AutoBePrisma.IUniqueIndex>",
575
+ value: input.uniqueIndexes
576
+ })) && input.uniqueIndexes.map((elem, _index12) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
577
+ path: _path + ".uniqueIndexes[" + _index12 + "]",
578
+ expected: "AutoBePrisma.IUniqueIndex",
579
+ value: elem
580
+ })) && _vo6(elem, _path + ".uniqueIndexes[" + _index12 + "]", true && _exceptionable) || _report(_exceptionable, {
581
+ path: _path + ".uniqueIndexes[" + _index12 + "]",
582
+ expected: "AutoBePrisma.IUniqueIndex",
583
+ value: elem
584
+ })).every(flag => flag) || _report(_exceptionable, {
585
+ path: _path + ".uniqueIndexes",
586
+ expected: "Array<AutoBePrisma.IUniqueIndex>",
587
+ value: input.uniqueIndexes
588
+ }), (Array.isArray(input.plainIndexes) || _report(_exceptionable, {
589
+ path: _path + ".plainIndexes",
590
+ expected: "Array<AutoBePrisma.IPlainIndex>",
591
+ value: input.plainIndexes
592
+ })) && input.plainIndexes.map((elem, _index13) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
593
+ path: _path + ".plainIndexes[" + _index13 + "]",
594
+ expected: "AutoBePrisma.IPlainIndex",
595
+ value: elem
596
+ })) && _vo7(elem, _path + ".plainIndexes[" + _index13 + "]", true && _exceptionable) || _report(_exceptionable, {
597
+ path: _path + ".plainIndexes[" + _index13 + "]",
598
+ expected: "AutoBePrisma.IPlainIndex",
599
+ value: elem
600
+ })).every(flag => flag) || _report(_exceptionable, {
601
+ path: _path + ".plainIndexes",
602
+ expected: "Array<AutoBePrisma.IPlainIndex>",
603
+ value: input.plainIndexes
604
+ }), (Array.isArray(input.ginIndexes) || _report(_exceptionable, {
605
+ path: _path + ".ginIndexes",
606
+ expected: "Array<AutoBePrisma.IGinIndex>",
607
+ value: input.ginIndexes
608
+ })) && input.ginIndexes.map((elem, _index14) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
609
+ path: _path + ".ginIndexes[" + _index14 + "]",
610
+ expected: "AutoBePrisma.IGinIndex",
611
+ value: elem
612
+ })) && _vo8(elem, _path + ".ginIndexes[" + _index14 + "]", true && _exceptionable) || _report(_exceptionable, {
613
+ path: _path + ".ginIndexes[" + _index14 + "]",
614
+ expected: "AutoBePrisma.IGinIndex",
615
+ value: elem
616
+ })).every(flag => flag) || _report(_exceptionable, {
617
+ path: _path + ".ginIndexes",
618
+ expected: "Array<AutoBePrisma.IGinIndex>",
619
+ value: input.ginIndexes
620
+ })].every(flag => flag); const _vo2 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[a-z][a-z0-9_]*$").test(input.name) || _report(_exceptionable, {
621
+ path: _path + ".name",
622
+ expected: "string & SnakeCasePattern",
623
+ value: input.name
624
+ })) || _report(_exceptionable, {
625
+ path: _path + ".name",
626
+ expected: "(string & SnakeCasePattern)",
627
+ value: input.name
628
+ }), "uuid" === input.type || _report(_exceptionable, {
629
+ path: _path + ".type",
630
+ expected: "\"uuid\"",
631
+ value: input.type
632
+ }), "string" === typeof input.description || _report(_exceptionable, {
633
+ path: _path + ".description",
634
+ expected: "string",
635
+ value: input.description
636
+ })].every(flag => flag); const _vo3 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[a-z][a-z0-9_]*$").test(input.name) || _report(_exceptionable, {
637
+ path: _path + ".name",
638
+ expected: "string & SnakeCasePattern",
639
+ value: input.name
640
+ })) || _report(_exceptionable, {
641
+ path: _path + ".name",
642
+ expected: "(string & SnakeCasePattern)",
643
+ value: input.name
644
+ }), "uuid" === input.type || _report(_exceptionable, {
645
+ path: _path + ".type",
646
+ expected: "\"uuid\"",
647
+ value: input.type
648
+ }), "string" === typeof input.description || _report(_exceptionable, {
649
+ path: _path + ".description",
650
+ expected: "string",
651
+ value: input.description
652
+ }), ("object" === typeof input.relation && null !== input.relation || _report(_exceptionable, {
653
+ path: _path + ".relation",
654
+ expected: "AutoBePrisma.IRelation",
655
+ value: input.relation
656
+ })) && _vo4(input.relation, _path + ".relation", true && _exceptionable) || _report(_exceptionable, {
657
+ path: _path + ".relation",
658
+ expected: "AutoBePrisma.IRelation",
659
+ value: input.relation
660
+ }), "boolean" === typeof input.unique || _report(_exceptionable, {
661
+ path: _path + ".unique",
662
+ expected: "boolean",
663
+ value: input.unique
664
+ }), "boolean" === typeof input.nullable || _report(_exceptionable, {
665
+ path: _path + ".nullable",
666
+ expected: "boolean",
667
+ value: input.nullable
668
+ })].every(flag => flag); const _vo4 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[a-z][a-zA-Z0-9]*$").test(input.name) || _report(_exceptionable, {
669
+ path: _path + ".name",
670
+ expected: "string & CamelCasePattern",
671
+ value: input.name
672
+ })) || _report(_exceptionable, {
673
+ path: _path + ".name",
674
+ expected: "(string & CamelCasePattern)",
675
+ value: input.name
676
+ }), "string" === typeof input.targetModel || _report(_exceptionable, {
677
+ path: _path + ".targetModel",
678
+ expected: "string",
679
+ value: input.targetModel
680
+ })].every(flag => flag); const _vo5 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[a-z][a-z0-9_]*$").test(input.name) || _report(_exceptionable, {
681
+ path: _path + ".name",
682
+ expected: "string & SnakeCasePattern",
683
+ value: input.name
684
+ })) || _report(_exceptionable, {
685
+ path: _path + ".name",
686
+ expected: "(string & SnakeCasePattern)",
687
+ value: input.name
688
+ }), "string" === input.type || "boolean" === input.type || "uuid" === input.type || "uri" === input.type || "int" === input.type || "double" === input.type || "datetime" === input.type || _report(_exceptionable, {
689
+ path: _path + ".type",
690
+ expected: "(\"boolean\" | \"datetime\" | \"double\" | \"int\" | \"string\" | \"uri\" | \"uuid\")",
691
+ value: input.type
692
+ }), "string" === typeof input.description || _report(_exceptionable, {
693
+ path: _path + ".description",
694
+ expected: "string",
695
+ value: input.description
696
+ }), "boolean" === typeof input.nullable || _report(_exceptionable, {
697
+ path: _path + ".nullable",
698
+ expected: "boolean",
699
+ value: input.nullable
700
+ })].every(flag => flag); const _vo6 = (input, _path, _exceptionable = true) => [(Array.isArray(input.fieldNames) || _report(_exceptionable, {
701
+ path: _path + ".fieldNames",
702
+ expected: "(Array<string> & MinItems<1> & UniqueItems<true>)",
703
+ value: input.fieldNames
704
+ })) && ((1 <= input.fieldNames.length || _report(_exceptionable, {
705
+ path: _path + ".fieldNames",
706
+ expected: "Array<> & MinItems<1>",
707
+ value: input.fieldNames
708
+ })) && (__typia_transform__isUniqueItems._isUniqueItems(input.fieldNames) || _report(_exceptionable, {
709
+ path: _path + ".fieldNames",
710
+ expected: "Array<> & UniqueItems<true>",
711
+ value: input.fieldNames
712
+ })) && input.fieldNames.map((elem, _index15) => "string" === typeof elem || _report(_exceptionable, {
713
+ path: _path + ".fieldNames[" + _index15 + "]",
714
+ expected: "string",
715
+ value: elem
716
+ })).every(flag => flag)) || _report(_exceptionable, {
717
+ path: _path + ".fieldNames",
718
+ expected: "(Array<string> & MinItems<1> & UniqueItems<true>)",
719
+ value: input.fieldNames
720
+ }), true === input.unique || _report(_exceptionable, {
721
+ path: _path + ".unique",
722
+ expected: "true",
723
+ value: input.unique
724
+ })].every(flag => flag); const _vo7 = (input, _path, _exceptionable = true) => [(Array.isArray(input.fieldNames) || _report(_exceptionable, {
725
+ path: _path + ".fieldNames",
726
+ expected: "(Array<string> & MinItems<1> & UniqueItems<true>)",
727
+ value: input.fieldNames
728
+ })) && ((1 <= input.fieldNames.length || _report(_exceptionable, {
729
+ path: _path + ".fieldNames",
730
+ expected: "Array<> & MinItems<1>",
731
+ value: input.fieldNames
732
+ })) && (__typia_transform__isUniqueItems._isUniqueItems(input.fieldNames) || _report(_exceptionable, {
733
+ path: _path + ".fieldNames",
734
+ expected: "Array<> & UniqueItems<true>",
735
+ value: input.fieldNames
736
+ })) && input.fieldNames.map((elem, _index16) => "string" === typeof elem || _report(_exceptionable, {
737
+ path: _path + ".fieldNames[" + _index16 + "]",
738
+ expected: "string",
739
+ value: elem
740
+ })).every(flag => flag)) || _report(_exceptionable, {
741
+ path: _path + ".fieldNames",
742
+ expected: "(Array<string> & MinItems<1> & UniqueItems<true>)",
743
+ value: input.fieldNames
744
+ })].every(flag => flag); const _vo8 = (input, _path, _exceptionable = true) => ["string" === typeof input.fieldName || _report(_exceptionable, {
745
+ path: _path + ".fieldName",
746
+ expected: "string",
747
+ value: input.fieldName
748
+ })].every(flag => flag); const __is = input => "object" === typeof input && null !== input && _io0(input); let errors; let _report; return input => {
749
+ if (false === __is(input)) {
750
+ errors = [];
751
+ _report = __typia_transform__validateReport._validateReport(errors);
752
+ ((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
753
+ path: _path + "",
754
+ expected: "IAutoBePrismaCorrectApplication.IProps",
755
+ value: input
756
+ })) && _vo0(input, _path + "", true) || _report(true, {
757
+ path: _path + "",
758
+ expected: "IAutoBePrismaCorrectApplication.IProps",
759
+ value: input
760
+ }))(input, "$input", true);
761
+ const success = 0 === errors.length;
762
+ return success ? {
763
+ success,
764
+ data: input
765
+ } : {
766
+ success,
767
+ errors,
768
+ data: input
769
+ };
770
+ }
771
+ return {
772
+ success: true,
773
+ data: input
774
+ };
775
+ }; })()
776
+ }
777
+ ]
778
+ },
779
+ claude: {
780
+ model: "claude",
781
+ options: {
782
+ reference: true,
783
+ separate: null
784
+ },
785
+ functions: [
786
+ {
787
+ name: "correctPrismaSchemaFiles",
788
+ parameters: {
789
+ description: "Current Type: {@link IAutoBePrismaCorrectApplication.IProps}",
790
+ type: "object",
791
+ properties: {
792
+ planning: {
793
+ description: "Detailed execution plan for fixing `AutoBePrisma` validation errors in\nspecific models.\n\n\uD83C\uDFAF Purpose: Enable systematic reasoning and step-by-step error resolution\napproach for targeted model validation issues\n\n\uD83D\uDCCB Required Planning Content:\n\n1. **Error Scope Analysis**\n\n - List all validation errors from IAutoBePrismaValidation.IError[] array\n - Extract unique table names from errors to identify affected models\n - Categorize errors by type (field duplications, references, types,\n indexes)\n - Identify which models need correction vs. which remain unchanged\n2. **Targeted Fix Strategy**\n\n - Focus ONLY on models mentioned in validation errors\n - Outline minimal changes needed for each affected model\n - Plan cross-model reference updates (if any) without modifying non-error\n models\n - Ensure unchanged models maintain valid references to corrected models\n3. **Model-Specific Fix Plan**\n\n - Model-by-model modification plan for ONLY affected models\n - Exact field additions, renames, or type corrections required\n - Reference updates within corrected models only\n - Index corrections limited to affected models\n4. **Minimal Scope Validation**\n\n - Confirm which models will be included in output (error models only)\n - List models that will remain unchanged in original schema\n - Identify cross-model dependencies without including unchanged models\n - Preserve all business logic within corrected models\n5. **Targeted Impact Assessment**\n\n - Potential effects of fixes on unchanged models (reference validation)\n - Verification points for corrected models only\n - Ensure no new validation errors in targeted models\n - Confirm minimal output scope compliance\n\n\uD83D\uDCA1 Example Planning Structure:\n\n ## Error Scope\n - Target Models: shopping_customers, shopping_orders (2 models only)\n - Unchanged Models: All others remain in original schema\n\n ## Targeted Fixes\n - shopping_customers: Remove duplicate 'email' field\n - shopping_orders: Update targetModel reference to 'shopping_customers'\n\n ## Output Scope\n - Return: Only shopping_customers and shopping_orders models\n - Preserve: All other models unchanged in original schema\n\n ## Cross-Model Impact\n - Verify: shopping_orders still references shopping_customers correctly\n - No changes needed in other models referencing these",
794
+ type: "string"
795
+ },
796
+ models: {
797
+ description: "ONLY the specific models that contain validation errors and need\ncorrection.\n\n\uD83D\uDCE5 Input Structure:\n\n- Contains ONLY models mentioned in IAutoBePrismaValidation.IError[] array\n- Each model has specific validation errors that need targeted correction\n- Models not mentioned in errors are excluded from this input\n- Represents minimal scope for error correction\n\n\uD83D\uDD0D Expected Validation Issues (Model-Specific):\n\n- Duplicate field/relation names within these specific models\n- Invalid foreign key references from these models to other models\n- Single foreign key fields in index arrays within these models\n- Invalid naming conventions within these specific models\n- Type validation errors in fields of these models\n\n\uD83D\uDCDD Model Content Analysis (Targeted Scope):\n\n- Complete field definitions for each error model only\n- Relationships from these models (may reference unchanged models)\n- Indexes within these models that need correction\n- Business descriptions specific to these models\n- Cross-model references that need validation (read-only for targets)\n\n\u26A0\uFE0F Processing Notes (Focused Approach):\n\n- Input contains ONLY models with validation errors\n- May reference other models not included in this input\n- Cross-model references must be validated but target models won't be\n modified\n- Output should return corrected versions of ONLY these input models\n- All business logic and descriptions within these models must be preserved\n- Corrections must not break references from unchanged models\n\n\uD83C\uDFAF Correction Scope:\n\n- Fix validation errors within these specific models\n- Update internal model structure (fields, relations, indexes)\n- Correct references to external models (without modifying targets)\n- Maintain compatibility with unchanged models in the full schema\n- Return corrected versions of ONLY these models",
798
+ type: "array",
799
+ items: {
800
+ $ref: "#/$defs/AutoBePrisma.IModel"
801
+ }
802
+ }
803
+ },
804
+ required: [
805
+ "planning",
806
+ "models"
807
+ ],
808
+ additionalProperties: false,
809
+ $defs: {
810
+ "AutoBePrisma.IModel": {
811
+ description: "Interface representing a single Prisma model (database table).\n\nBased on the uploaded schemas, models follow specific patterns:\n\n- Main business entities (e.g., shopping_sales, shopping_customers)\n- Snapshot/versioning entities for audit trails (e.g.,\n shopping_sale_snapshots)\n- Junction tables for M:N relationships (e.g.,\n shopping_cart_commodity_stocks)\n- Materialized views for performance (prefixed with mv_)",
812
+ type: "object",
813
+ properties: {
814
+ name: {
815
+ description: "Name of the Prisma model (database table name).\n\nMUST use snake_case naming convention. Examples: \"shopping_customers\",\n\"shopping_sale_snapshots\", \"bbs_articles\" Materialized views use \"mv_\"\nprefix: \"mv_shopping_sale_last_snapshots\"",
816
+ type: "string",
817
+ pattern: "^[a-z][a-z0-9_]*$"
818
+ },
819
+ description: {
820
+ description: "Detailed description explaining the business purpose and usage of the\nmodel.\n\nShould include:\n\n- Business context and purpose\n- Key relationships with other models\n- Important behavioral notes or constraints\n- References to related entities using \"{@\\link ModelName}\" syntax\n\n**IMPORTANT**: Description must be written in English. Example: \"Customer\ninformation, but not a person but a **connection** basis...\"",
821
+ type: "string"
822
+ },
823
+ material: {
824
+ description: "Indicates whether this model represents a materialized view for\nperformance optimization.\n\nMaterialized views are read-only computed tables that cache complex query\nresults. They're marked as \"@\\hidden\" in documentation and prefixed with\n\"mv_\" in naming. Examples: mv_shopping_sale_last_snapshots,\nmv_shopping_cart_commodity_prices",
825
+ type: "boolean"
826
+ },
827
+ stance: {
828
+ description: "Specifies the architectural stance of this model within the database\nsystem.\n\nThis property defines how the table positions itself in relation to other\ntables and what role it plays in the overall data architecture,\nparticularly for API endpoint generation and business logic\norganization.\n\n## Values:\n\n### `\"primary\"` - Main Business Entity\n\nTables that represent core business concepts and serve as the primary\nsubjects of user operations. These tables typically warrant independent\nCRUD API endpoints since users directly interact with these entities.\n\n**Key principle**: If users need to independently create, search, filter,\nor manage entities regardless of their parent context, the table should\nbe primary stance.\n\n**API Requirements:**\n\n- Independent creation endpoints (POST /articles, POST /comments)\n- Search and filtering capabilities across all instances\n- Direct update and delete operations\n- List/pagination endpoints for browsing\n\n**Why `bbs_article_comments` is primary, not subsidiary:**\n\nAlthough comments belong to articles, they require independent\nmanagement:\n\n- **Search across articles**: \"Find all comments by user X across all\n articles\"\n- **Moderation workflows**: \"List all pending comments for review\"\n- **User activity**: \"Show all comments made by this user\"\n- **Independent operations**: Users edit/delete their comments directly\n- **Notification systems**: \"Alert when any comment is posted\"\n\nIf comments were subsidiary, these operations would be impossible or\nrequire inefficient nested queries through parent articles.\n\n**Characteristics:**\n\n- Represents tangible business concepts that users manage\n- Serves as reference points for other tables\n- Requires comprehensive API operations (CREATE, READ, UPDATE, DELETE)\n- Forms the backbone of the application's business logic\n\n**Examples:**\n\n- `bbs_articles` - Forum posts that users create, edit, and manage\n- `bbs_article_comments` - User comments that require independent\n management\n\n### `\"subsidiary\"` - Supporting/Dependent Entity\n\nTables that exist to support primary entities but are not independently\nmanaged by users. These tables are typically managed through their parent\nentities and may not need standalone API endpoints.\n\n**Characteristics:**\n\n- Depends on primary or snapshot entities for context\n- Often managed indirectly through parent entity operations\n- May have limited or no independent API operations\n- Provides supporting data or relationships\n\n**Examples:**\n\n- `bbs_article_snapshot_files` - Files attached to article snapshots\n- `bbs_article_snapshot_tags` - Tags associated with article snapshots\n- `bbs_article_comment_snapshot_files` - Files attached to comment\n snapshots\n\n### `\"snapshot\"` - Historical/Versioning Entity\n\nTables that capture point-in-time states of primary entities for audit\ntrails, version control, or historical tracking. These tables record\nchanges but are rarely modified directly by users.\n\n**Characteristics:**\n\n- Captures historical states of primary entities\n- Typically append-only (rarely updated or deleted)\n- Referenced for audit trails and change tracking\n- Usually read-only from user perspective\n\n**Examples:**\n\n- `bbs_article_snapshots` - Historical states of articles\n- `bbs_article_comment_snapshots` - Comment modification history\n\n## API Generation Guidelines:\n\nThe stance property guides automatic API endpoint generation:\n\n- **`\"primary\"`** \u2192 Generate full CRUD endpoints based on business\n requirements\n- **`\"subsidiary\"`** \u2192 Evaluate carefully; often managed through parent\n entities\n- **`\"snapshot\"`** \u2192 Typically read-only endpoints for historical data\n access",
829
+ oneOf: [
830
+ {
831
+ "const": "primary"
832
+ },
833
+ {
834
+ "const": "subsidiary"
835
+ },
836
+ {
837
+ "const": "snapshot"
838
+ }
839
+ ]
840
+ },
841
+ primaryField: {
842
+ description: "The primary key field of the model.\n\nIn all uploaded schemas, primary keys are always UUID type with \"@\\id\"\ndirective. Usually named \"id\" and marked with \"@\\db.Uuid\" for PostgreSQL\nmapping.",
843
+ $ref: "#/$defs/AutoBePrisma.IPrimaryField"
844
+ },
845
+ foreignFields: {
846
+ description: "Array of foreign key fields that reference other models.\n\nThese establish relationships between models and include Prisma relation\ndirectives. Can be nullable (optional relationships) or required\n(mandatory relationships). May have unique constraints for 1:1\nrelationships.",
847
+ type: "array",
848
+ items: {
849
+ $ref: "#/$defs/AutoBePrisma.IForeignField"
850
+ }
851
+ },
852
+ plainFields: {
853
+ description: "Array of regular data fields that don't reference other models.\n\nInclude business data like names, descriptions, timestamps, flags,\namounts, etc. Common patterns: created_at, updated_at, deleted_at for\nsoft deletion and auditing.",
854
+ type: "array",
855
+ items: {
856
+ $ref: "#/$defs/AutoBePrisma.IPlainField"
857
+ }
858
+ },
859
+ uniqueIndexes: {
860
+ description: "Array of unique indexes for enforcing data integrity constraints.\n\nEnsure uniqueness across single or multiple columns. Examples: unique\nemail addresses, unique codes within a channel, unique combinations like\n(channel_id, nickname).",
861
+ type: "array",
862
+ items: {
863
+ $ref: "#/$defs/AutoBePrisma.IUniqueIndex"
864
+ }
865
+ },
866
+ plainIndexes: {
867
+ description: "Array of regular indexes for query performance optimization.\n\nSpeed up common query patterns like filtering by foreign keys, date\nranges, or frequently searched fields. Examples: indexes on created_at,\nforeign key fields, search fields.",
868
+ type: "array",
869
+ items: {
870
+ $ref: "#/$defs/AutoBePrisma.IPlainIndex"
871
+ }
872
+ },
873
+ ginIndexes: {
874
+ description: "Array of GIN (Generalized Inverted Index) indexes for full-text search.\n\nUsed specifically for PostgreSQL text search capabilities using trigram\noperations. Applied to text fields that need fuzzy matching or partial\ntext search. Examples: searching names, nicknames, titles, content\nbodies.",
875
+ type: "array",
876
+ items: {
877
+ $ref: "#/$defs/AutoBePrisma.IGinIndex"
878
+ }
879
+ }
880
+ },
881
+ required: [
882
+ "name",
883
+ "description",
884
+ "material",
885
+ "stance",
886
+ "primaryField",
887
+ "foreignFields",
888
+ "plainFields",
889
+ "uniqueIndexes",
890
+ "plainIndexes",
891
+ "ginIndexes"
892
+ ]
893
+ },
894
+ "AutoBePrisma.IPrimaryField": {
895
+ description: "Interface representing the primary key field of a Prisma model.\n\nAll models in the uploaded schemas use UUID as primary key for better\ndistributed system compatibility and security (no sequential ID exposure).",
896
+ type: "object",
897
+ properties: {
898
+ name: {
899
+ description: "Name of the primary key field.\n\nMUST use snake_case naming convention. Consistently named \"id\" across all\nmodels in the uploaded schemas. Represents the unique identifier for each\nrecord in the table.",
900
+ type: "string",
901
+ pattern: "^[a-z][a-z0-9_]*$"
902
+ },
903
+ type: {
904
+ description: "Data type of the primary key field.\n\nAlways \"uuid\" in the uploaded schemas for better distributed system\nsupport and to avoid exposing sequential IDs that could reveal business\ninformation.",
905
+ "const": "uuid"
906
+ },
907
+ description: {
908
+ description: "Description of the primary key field's purpose.\n\nStandard description is \"Primary Key.\" across all models. Serves as the\nunique identifier for the model instance.\n\n**IMPORTANT**: Description must be written in English.",
909
+ type: "string"
910
+ }
911
+ },
912
+ required: [
913
+ "name",
914
+ "type",
915
+ "description"
916
+ ]
917
+ },
918
+ "AutoBePrisma.IForeignField": {
919
+ description: "Interface representing a foreign key field that establishes relationships\nbetween models.\n\nForeign keys create associations between models, enabling relational data\nmodeling. They can represent 1:1, 1:N, or participate in M:N relationships\nthrough junction tables.",
920
+ type: "object",
921
+ properties: {
922
+ name: {
923
+ description: "Name of the foreign key field.\n\nMUST use snake_case naming convention. Follows convention:\n\"{target_model_name_without_prefix}_id\" Examples: \"shopping_customer_id\",\n\"bbs_article_id\", \"attachment_file_id\" For self-references: \"parent_id\"\n(e.g., in hierarchical structures)",
924
+ type: "string",
925
+ pattern: "^[a-z][a-z0-9_]*$"
926
+ },
927
+ type: {
928
+ description: "Data type of the foreign key field.\n\nAlways \"uuid\" to match the primary key type of referenced models. Ensures\nreferential integrity and consistency across the schema.",
929
+ "const": "uuid"
930
+ },
931
+ description: {
932
+ description: "Description explaining the purpose and target of this foreign key\nrelationship.\n\nShould reference the target model using format: \"Target model's {@\\link\nModelName.id}\" Examples: \"Belonged customer's {@\\link\nshopping_customers.id}\" May include additional context about the\nrelationship's business meaning.\n\n**IMPORTANT**: Description must be written in English.",
933
+ type: "string"
934
+ },
935
+ relation: {
936
+ description: "Prisma relation configuration defining the association details.\n\nSpecifies how this foreign key connects to the target model, including\nrelation name, target model, and target field. This configuration is used\nto generate the appropriate Prisma relation directive in the schema.",
937
+ $ref: "#/$defs/AutoBePrisma.IRelation"
938
+ },
939
+ unique: {
940
+ description: "Whether this foreign key has a unique constraint.\n\nTrue: Creates a 1:1 relationship (e.g., user profile, order publish\ndetails) false: Allows 1:N relationship (e.g., customer to multiple\norders) Used for enforcing business rules about relationship\ncardinality.",
941
+ type: "boolean"
942
+ },
943
+ nullable: {
944
+ description: "Whether this foreign key can be null (optional relationship).\n\nTrue: Relationship is optional, foreign key can be null false:\nRelationship is required, foreign key cannot be null Reflects business\nrules about mandatory vs optional associations.",
945
+ type: "boolean"
946
+ }
947
+ },
948
+ required: [
949
+ "name",
950
+ "type",
951
+ "description",
952
+ "relation",
953
+ "unique",
954
+ "nullable"
955
+ ]
956
+ },
957
+ "AutoBePrisma.IRelation": {
958
+ description: "Interface representing a Prisma relation configuration between models.\n\nThis interface defines how foreign key fields establish relationships with\ntheir target models. It provides the necessary information for Prisma to\ngenerate appropriate relation directives (@relation) in the schema,\nenabling proper relational data modeling and ORM functionality.\n\nThe relation configuration is essential for:\n\n- Generating correct Prisma relation syntax\n- Establishing bidirectional relationships between models\n- Enabling proper type-safe querying through Prisma client\n- Supporting complex relationship patterns (1:1, 1:N, M:N)",
959
+ type: "object",
960
+ properties: {
961
+ name: {
962
+ description: "Name of the relation property in the Prisma model.\n\nThis becomes the property name used to access the related model instance\nthrough the Prisma client. Should be descriptive and reflect the business\nrelationship being modeled.\n\nExamples:\n\n- \"customer\" for shopping_customer_id field\n- \"channel\" for shopping_channel_id field\n- \"parent\" for parent_id field in hierarchical structures\n- \"snapshot\" for versioning relationships\n- \"article\" for bbs_article_id field\n\nNaming convention: camelCase, descriptive of the relationship's business\nmeaning",
963
+ type: "string",
964
+ pattern: "^[a-z][a-zA-Z0-9]*$"
965
+ },
966
+ targetModel: {
967
+ description: "Name of the target model being referenced by this relation.\n\nMust exactly match an existing model name in the schema. This is used by\nPrisma to establish the foreign key constraint and generate the\nappropriate relation mapping.\n\nExamples:\n\n- \"shopping_customers\" for customer relationships\n- \"shopping_channels\" for channel relationships\n- \"bbs_articles\" for article relationships\n- \"attachment_files\" for file attachments\n\nThe target model should exist in the same schema or be accessible through\nthe Prisma schema configuration.",
968
+ type: "string"
969
+ }
970
+ },
971
+ required: [
972
+ "name",
973
+ "targetModel"
974
+ ]
975
+ },
976
+ "AutoBePrisma.IPlainField": {
977
+ description: "Interface representing a regular data field that stores business\ninformation.\n\nThese fields contain the actual business data like names, amounts,\ntimestamps, flags, descriptions, and other domain-specific information.",
978
+ type: "object",
979
+ properties: {
980
+ name: {
981
+ description: "Name of the field in the database table.\n\nMUST use snake_case naming convention. Common patterns from uploaded\nschemas:\n\n- Timestamps: created_at, updated_at, deleted_at, opened_at, closed_at\n- Identifiers: code, name, nickname, title\n- Business data: value, quantity, price, volume, balance\n- Flags: primary, required, exclusive, secret, multiplicative",
982
+ type: "string",
983
+ pattern: "^[a-z][a-z0-9_]*$"
984
+ },
985
+ type: {
986
+ description: "Data type of the field for Prisma schema generation.\n\nMaps to appropriate Prisma/PostgreSQL types:\n\n- Boolean: Boolean flags and yes/no values\n- Int: Integer numbers, quantities, sequences\n- Double: Decimal numbers, prices, monetary values, percentages\n- String: Text data, names, descriptions, codes\n- Uri: URL/URI fields for links and references\n- Uuid: UUID fields (for non-foreign-key UUIDs)\n- Datetime: Timestamp fields with date and time",
987
+ oneOf: [
988
+ {
989
+ "const": "string"
990
+ },
991
+ {
992
+ "const": "boolean"
993
+ },
994
+ {
995
+ "const": "uuid"
996
+ },
997
+ {
998
+ "const": "uri"
999
+ },
1000
+ {
1001
+ "const": "int"
1002
+ },
1003
+ {
1004
+ "const": "double"
1005
+ },
1006
+ {
1007
+ "const": "datetime"
1008
+ }
1009
+ ]
1010
+ },
1011
+ description: {
1012
+ description: "Description explaining the business purpose and usage of this field.\n\nShould clearly explain:\n\n- What business concept this field represents\n- Valid values or constraints if applicable\n- How it relates to business processes\n- Any special behavioral notes\n\n**IMPORTANT**: Description must be written in English. Example: \"Amount\nof cash payment.\" or \"Whether the unit is required or not.\"",
1013
+ type: "string"
1014
+ },
1015
+ nullable: {
1016
+ description: "Whether this field can contain null values.\n\nTrue: Field is optional and can be null (e.g., middle name, description)\nfalse: Field is required and cannot be null (e.g., creation timestamp,\nname) Reflects business rules about mandatory vs optional data.",
1017
+ type: "boolean"
1018
+ }
1019
+ },
1020
+ required: [
1021
+ "name",
1022
+ "type",
1023
+ "description",
1024
+ "nullable"
1025
+ ]
1026
+ },
1027
+ "AutoBePrisma.IUniqueIndex": {
1028
+ description: "Interface representing a unique index constraint on one or more fields.\n\nUnique indexes enforce data integrity by ensuring no duplicate values exist\nfor the specified field combination. Essential for business rules that\nrequire uniqueness like email addresses, codes, or composite keys.",
1029
+ type: "object",
1030
+ properties: {
1031
+ fieldNames: {
1032
+ description: "Array of field names that together form the unique constraint.\n\nCan be single field (e.g., [\"email\"]) or composite (e.g., [\"channel_id\",\n\"code\"]). All field names must exist in the model. Order matters for\ncomposite indexes. Examples: [\"code\"], [\"shopping_channel_id\",\n\"nickname\"], [\"email\"]",
1033
+ type: "array",
1034
+ items: {
1035
+ type: "string"
1036
+ },
1037
+ minItems: 1,
1038
+ uniqueItems: true
1039
+ },
1040
+ unique: {
1041
+ description: "Explicit marker indicating this is a unique index.\n\nAlways true to distinguish from regular indexes. Used by code generator\nto emit \"@@unique\" directive in Prisma schema instead of \"@@index\".",
1042
+ "const": true
1043
+ }
1044
+ },
1045
+ required: [
1046
+ "fieldNames",
1047
+ "unique"
1048
+ ]
1049
+ },
1050
+ "AutoBePrisma.IPlainIndex": {
1051
+ description: "Interface representing a regular (non-unique) index for query performance.\n\nRegular indexes speed up database queries by creating optimized data\nstructures for common search patterns. Essential for foreign keys, date\nranges, and frequently filtered fields.",
1052
+ type: "object",
1053
+ properties: {
1054
+ fieldNames: {
1055
+ description: "Array of field names to include in the performance index.\n\nCan be single field (e.g., [\"created_at\"]) or composite (e.g.,\n[\"customer_id\", \"created_at\"]). All field names must exist in the model.\nOrder matters for composite indexes and should match common query\npatterns. Examples: [\"created_at\"], [\"shopping_customer_id\",\n\"created_at\"], [\"ip\"]",
1056
+ type: "array",
1057
+ items: {
1058
+ type: "string"
1059
+ },
1060
+ minItems: 1,
1061
+ uniqueItems: true
1062
+ }
1063
+ },
1064
+ required: [
1065
+ "fieldNames"
1066
+ ]
1067
+ },
1068
+ "AutoBePrisma.IGinIndex": {
1069
+ description: "Interface representing a GIN (Generalized Inverted Index) for full-text\nsearch.\n\nGIN indexes enable advanced PostgreSQL text search capabilities including\nfuzzy matching and partial text search using trigram operations. Essential\nfor user-facing search features on text content.",
1070
+ type: "object",
1071
+ properties: {
1072
+ fieldName: {
1073
+ description: "Name of the text field to index for full-text search capabilities.\n\nMust be a string field in the model that contains searchable text.\nExamples from uploaded schemas: \"nickname\", \"title\", \"body\", \"name\" Used\nwith PostgreSQL gin_trgm_ops for trigram-based fuzzy text search.",
1074
+ type: "string"
1075
+ }
1076
+ },
1077
+ required: [
1078
+ "fieldName"
1079
+ ]
1080
+ }
1081
+ }
1082
+ },
1083
+ description: "Fixes validation errors in specific AutoBePrisma models while preserving\nALL existing business logic and model descriptions.\n\n## Core Rules\n\n1. Fix ONLY validation errors in provided models - never remove business\n descriptions\n2. Apply minimal changes to error models only - preserve original design\n intent\n3. Return ONLY corrected models - unchanged models remain in original schema\n4. Maintain referential integrity with unchanged models\n\n## Targeted Scope\n\n- Process ONLY models with validation errors from IError[] array\n- Exclude models without errors from processing and output\n- Minimize context usage by returning corrected models only\n- Preserve unchanged models in their original state\n\n## Fix Strategy\n\n- Resolve validation errors within specific models only\n- Fix field duplications, invalid references, and type mismatches\n- Update cross-model references without modifying target models\n- Ensure naming conventions and index rules compliance in corrected models",
1084
+ validate: (() => { const _io0 = input => "string" === typeof input.planning && (Array.isArray(input.models) && input.models.every(elem => "object" === typeof elem && null !== elem && _io1(elem))); const _io1 = input => "string" === typeof input.name && RegExp("^[a-z][a-z0-9_]*$").test(input.name) && "string" === typeof input.description && "boolean" === typeof input.material && ("primary" === input.stance || "subsidiary" === input.stance || "snapshot" === input.stance) && ("object" === typeof input.primaryField && null !== input.primaryField && _io2(input.primaryField)) && (Array.isArray(input.foreignFields) && input.foreignFields.every(elem => "object" === typeof elem && null !== elem && _io3(elem))) && (Array.isArray(input.plainFields) && input.plainFields.every(elem => "object" === typeof elem && null !== elem && _io5(elem))) && (Array.isArray(input.uniqueIndexes) && input.uniqueIndexes.every(elem => "object" === typeof elem && null !== elem && _io6(elem))) && (Array.isArray(input.plainIndexes) && input.plainIndexes.every(elem => "object" === typeof elem && null !== elem && _io7(elem))) && (Array.isArray(input.ginIndexes) && input.ginIndexes.every(elem => "object" === typeof elem && null !== elem && _io8(elem))); const _io2 = input => "string" === typeof input.name && RegExp("^[a-z][a-z0-9_]*$").test(input.name) && "uuid" === input.type && "string" === typeof input.description; const _io3 = input => "string" === typeof input.name && RegExp("^[a-z][a-z0-9_]*$").test(input.name) && "uuid" === input.type && "string" === typeof input.description && ("object" === typeof input.relation && null !== input.relation && _io4(input.relation)) && "boolean" === typeof input.unique && "boolean" === typeof input.nullable; const _io4 = input => "string" === typeof input.name && RegExp("^[a-z][a-zA-Z0-9]*$").test(input.name) && "string" === typeof input.targetModel; const _io5 = input => "string" === typeof input.name && RegExp("^[a-z][a-z0-9_]*$").test(input.name) && ("string" === input.type || "boolean" === input.type || "uuid" === input.type || "uri" === input.type || "int" === input.type || "double" === input.type || "datetime" === input.type) && "string" === typeof input.description && "boolean" === typeof input.nullable; const _io6 = input => Array.isArray(input.fieldNames) && (1 <= input.fieldNames.length && __typia_transform__isUniqueItems._isUniqueItems(input.fieldNames) && input.fieldNames.every(elem => "string" === typeof elem)) && true === input.unique; const _io7 = input => Array.isArray(input.fieldNames) && (1 <= input.fieldNames.length && __typia_transform__isUniqueItems._isUniqueItems(input.fieldNames) && input.fieldNames.every(elem => "string" === typeof elem)); const _io8 = input => "string" === typeof input.fieldName; const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.planning || _report(_exceptionable, {
1085
+ path: _path + ".planning",
1086
+ expected: "string",
1087
+ value: input.planning
1088
+ }), (Array.isArray(input.models) || _report(_exceptionable, {
1089
+ path: _path + ".models",
1090
+ expected: "Array<AutoBePrisma.IModel>",
1091
+ value: input.models
1092
+ })) && input.models.map((elem, _index9) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
1093
+ path: _path + ".models[" + _index9 + "]",
1094
+ expected: "AutoBePrisma.IModel",
1095
+ value: elem
1096
+ })) && _vo1(elem, _path + ".models[" + _index9 + "]", true && _exceptionable) || _report(_exceptionable, {
1097
+ path: _path + ".models[" + _index9 + "]",
1098
+ expected: "AutoBePrisma.IModel",
1099
+ value: elem
1100
+ })).every(flag => flag) || _report(_exceptionable, {
1101
+ path: _path + ".models",
1102
+ expected: "Array<AutoBePrisma.IModel>",
1103
+ value: input.models
1104
+ })].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[a-z][a-z0-9_]*$").test(input.name) || _report(_exceptionable, {
1105
+ path: _path + ".name",
1106
+ expected: "string & SnakeCasePattern",
1107
+ value: input.name
1108
+ })) || _report(_exceptionable, {
1109
+ path: _path + ".name",
1110
+ expected: "(string & SnakeCasePattern)",
1111
+ value: input.name
1112
+ }), "string" === typeof input.description || _report(_exceptionable, {
1113
+ path: _path + ".description",
1114
+ expected: "string",
1115
+ value: input.description
1116
+ }), "boolean" === typeof input.material || _report(_exceptionable, {
1117
+ path: _path + ".material",
1118
+ expected: "boolean",
1119
+ value: input.material
1120
+ }), "primary" === input.stance || "subsidiary" === input.stance || "snapshot" === input.stance || _report(_exceptionable, {
1121
+ path: _path + ".stance",
1122
+ expected: "(\"primary\" | \"snapshot\" | \"subsidiary\")",
1123
+ value: input.stance
1124
+ }), ("object" === typeof input.primaryField && null !== input.primaryField || _report(_exceptionable, {
1125
+ path: _path + ".primaryField",
1126
+ expected: "AutoBePrisma.IPrimaryField",
1127
+ value: input.primaryField
1128
+ })) && _vo2(input.primaryField, _path + ".primaryField", true && _exceptionable) || _report(_exceptionable, {
1129
+ path: _path + ".primaryField",
1130
+ expected: "AutoBePrisma.IPrimaryField",
1131
+ value: input.primaryField
1132
+ }), (Array.isArray(input.foreignFields) || _report(_exceptionable, {
1133
+ path: _path + ".foreignFields",
1134
+ expected: "Array<AutoBePrisma.IForeignField>",
1135
+ value: input.foreignFields
1136
+ })) && input.foreignFields.map((elem, _index10) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
1137
+ path: _path + ".foreignFields[" + _index10 + "]",
1138
+ expected: "AutoBePrisma.IForeignField",
1139
+ value: elem
1140
+ })) && _vo3(elem, _path + ".foreignFields[" + _index10 + "]", true && _exceptionable) || _report(_exceptionable, {
1141
+ path: _path + ".foreignFields[" + _index10 + "]",
1142
+ expected: "AutoBePrisma.IForeignField",
1143
+ value: elem
1144
+ })).every(flag => flag) || _report(_exceptionable, {
1145
+ path: _path + ".foreignFields",
1146
+ expected: "Array<AutoBePrisma.IForeignField>",
1147
+ value: input.foreignFields
1148
+ }), (Array.isArray(input.plainFields) || _report(_exceptionable, {
1149
+ path: _path + ".plainFields",
1150
+ expected: "Array<AutoBePrisma.IPlainField>",
1151
+ value: input.plainFields
1152
+ })) && input.plainFields.map((elem, _index11) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
1153
+ path: _path + ".plainFields[" + _index11 + "]",
1154
+ expected: "AutoBePrisma.IPlainField",
1155
+ value: elem
1156
+ })) && _vo5(elem, _path + ".plainFields[" + _index11 + "]", true && _exceptionable) || _report(_exceptionable, {
1157
+ path: _path + ".plainFields[" + _index11 + "]",
1158
+ expected: "AutoBePrisma.IPlainField",
1159
+ value: elem
1160
+ })).every(flag => flag) || _report(_exceptionable, {
1161
+ path: _path + ".plainFields",
1162
+ expected: "Array<AutoBePrisma.IPlainField>",
1163
+ value: input.plainFields
1164
+ }), (Array.isArray(input.uniqueIndexes) || _report(_exceptionable, {
1165
+ path: _path + ".uniqueIndexes",
1166
+ expected: "Array<AutoBePrisma.IUniqueIndex>",
1167
+ value: input.uniqueIndexes
1168
+ })) && input.uniqueIndexes.map((elem, _index12) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
1169
+ path: _path + ".uniqueIndexes[" + _index12 + "]",
1170
+ expected: "AutoBePrisma.IUniqueIndex",
1171
+ value: elem
1172
+ })) && _vo6(elem, _path + ".uniqueIndexes[" + _index12 + "]", true && _exceptionable) || _report(_exceptionable, {
1173
+ path: _path + ".uniqueIndexes[" + _index12 + "]",
1174
+ expected: "AutoBePrisma.IUniqueIndex",
1175
+ value: elem
1176
+ })).every(flag => flag) || _report(_exceptionable, {
1177
+ path: _path + ".uniqueIndexes",
1178
+ expected: "Array<AutoBePrisma.IUniqueIndex>",
1179
+ value: input.uniqueIndexes
1180
+ }), (Array.isArray(input.plainIndexes) || _report(_exceptionable, {
1181
+ path: _path + ".plainIndexes",
1182
+ expected: "Array<AutoBePrisma.IPlainIndex>",
1183
+ value: input.plainIndexes
1184
+ })) && input.plainIndexes.map((elem, _index13) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
1185
+ path: _path + ".plainIndexes[" + _index13 + "]",
1186
+ expected: "AutoBePrisma.IPlainIndex",
1187
+ value: elem
1188
+ })) && _vo7(elem, _path + ".plainIndexes[" + _index13 + "]", true && _exceptionable) || _report(_exceptionable, {
1189
+ path: _path + ".plainIndexes[" + _index13 + "]",
1190
+ expected: "AutoBePrisma.IPlainIndex",
1191
+ value: elem
1192
+ })).every(flag => flag) || _report(_exceptionable, {
1193
+ path: _path + ".plainIndexes",
1194
+ expected: "Array<AutoBePrisma.IPlainIndex>",
1195
+ value: input.plainIndexes
1196
+ }), (Array.isArray(input.ginIndexes) || _report(_exceptionable, {
1197
+ path: _path + ".ginIndexes",
1198
+ expected: "Array<AutoBePrisma.IGinIndex>",
1199
+ value: input.ginIndexes
1200
+ })) && input.ginIndexes.map((elem, _index14) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
1201
+ path: _path + ".ginIndexes[" + _index14 + "]",
1202
+ expected: "AutoBePrisma.IGinIndex",
1203
+ value: elem
1204
+ })) && _vo8(elem, _path + ".ginIndexes[" + _index14 + "]", true && _exceptionable) || _report(_exceptionable, {
1205
+ path: _path + ".ginIndexes[" + _index14 + "]",
1206
+ expected: "AutoBePrisma.IGinIndex",
1207
+ value: elem
1208
+ })).every(flag => flag) || _report(_exceptionable, {
1209
+ path: _path + ".ginIndexes",
1210
+ expected: "Array<AutoBePrisma.IGinIndex>",
1211
+ value: input.ginIndexes
1212
+ })].every(flag => flag); const _vo2 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[a-z][a-z0-9_]*$").test(input.name) || _report(_exceptionable, {
1213
+ path: _path + ".name",
1214
+ expected: "string & SnakeCasePattern",
1215
+ value: input.name
1216
+ })) || _report(_exceptionable, {
1217
+ path: _path + ".name",
1218
+ expected: "(string & SnakeCasePattern)",
1219
+ value: input.name
1220
+ }), "uuid" === input.type || _report(_exceptionable, {
1221
+ path: _path + ".type",
1222
+ expected: "\"uuid\"",
1223
+ value: input.type
1224
+ }), "string" === typeof input.description || _report(_exceptionable, {
1225
+ path: _path + ".description",
1226
+ expected: "string",
1227
+ value: input.description
1228
+ })].every(flag => flag); const _vo3 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[a-z][a-z0-9_]*$").test(input.name) || _report(_exceptionable, {
1229
+ path: _path + ".name",
1230
+ expected: "string & SnakeCasePattern",
1231
+ value: input.name
1232
+ })) || _report(_exceptionable, {
1233
+ path: _path + ".name",
1234
+ expected: "(string & SnakeCasePattern)",
1235
+ value: input.name
1236
+ }), "uuid" === input.type || _report(_exceptionable, {
1237
+ path: _path + ".type",
1238
+ expected: "\"uuid\"",
1239
+ value: input.type
1240
+ }), "string" === typeof input.description || _report(_exceptionable, {
1241
+ path: _path + ".description",
1242
+ expected: "string",
1243
+ value: input.description
1244
+ }), ("object" === typeof input.relation && null !== input.relation || _report(_exceptionable, {
1245
+ path: _path + ".relation",
1246
+ expected: "AutoBePrisma.IRelation",
1247
+ value: input.relation
1248
+ })) && _vo4(input.relation, _path + ".relation", true && _exceptionable) || _report(_exceptionable, {
1249
+ path: _path + ".relation",
1250
+ expected: "AutoBePrisma.IRelation",
1251
+ value: input.relation
1252
+ }), "boolean" === typeof input.unique || _report(_exceptionable, {
1253
+ path: _path + ".unique",
1254
+ expected: "boolean",
1255
+ value: input.unique
1256
+ }), "boolean" === typeof input.nullable || _report(_exceptionable, {
1257
+ path: _path + ".nullable",
1258
+ expected: "boolean",
1259
+ value: input.nullable
1260
+ })].every(flag => flag); const _vo4 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[a-z][a-zA-Z0-9]*$").test(input.name) || _report(_exceptionable, {
1261
+ path: _path + ".name",
1262
+ expected: "string & CamelCasePattern",
1263
+ value: input.name
1264
+ })) || _report(_exceptionable, {
1265
+ path: _path + ".name",
1266
+ expected: "(string & CamelCasePattern)",
1267
+ value: input.name
1268
+ }), "string" === typeof input.targetModel || _report(_exceptionable, {
1269
+ path: _path + ".targetModel",
1270
+ expected: "string",
1271
+ value: input.targetModel
1272
+ })].every(flag => flag); const _vo5 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[a-z][a-z0-9_]*$").test(input.name) || _report(_exceptionable, {
1273
+ path: _path + ".name",
1274
+ expected: "string & SnakeCasePattern",
1275
+ value: input.name
1276
+ })) || _report(_exceptionable, {
1277
+ path: _path + ".name",
1278
+ expected: "(string & SnakeCasePattern)",
1279
+ value: input.name
1280
+ }), "string" === input.type || "boolean" === input.type || "uuid" === input.type || "uri" === input.type || "int" === input.type || "double" === input.type || "datetime" === input.type || _report(_exceptionable, {
1281
+ path: _path + ".type",
1282
+ expected: "(\"boolean\" | \"datetime\" | \"double\" | \"int\" | \"string\" | \"uri\" | \"uuid\")",
1283
+ value: input.type
1284
+ }), "string" === typeof input.description || _report(_exceptionable, {
1285
+ path: _path + ".description",
1286
+ expected: "string",
1287
+ value: input.description
1288
+ }), "boolean" === typeof input.nullable || _report(_exceptionable, {
1289
+ path: _path + ".nullable",
1290
+ expected: "boolean",
1291
+ value: input.nullable
1292
+ })].every(flag => flag); const _vo6 = (input, _path, _exceptionable = true) => [(Array.isArray(input.fieldNames) || _report(_exceptionable, {
1293
+ path: _path + ".fieldNames",
1294
+ expected: "(Array<string> & MinItems<1> & UniqueItems<true>)",
1295
+ value: input.fieldNames
1296
+ })) && ((1 <= input.fieldNames.length || _report(_exceptionable, {
1297
+ path: _path + ".fieldNames",
1298
+ expected: "Array<> & MinItems<1>",
1299
+ value: input.fieldNames
1300
+ })) && (__typia_transform__isUniqueItems._isUniqueItems(input.fieldNames) || _report(_exceptionable, {
1301
+ path: _path + ".fieldNames",
1302
+ expected: "Array<> & UniqueItems<true>",
1303
+ value: input.fieldNames
1304
+ })) && input.fieldNames.map((elem, _index15) => "string" === typeof elem || _report(_exceptionable, {
1305
+ path: _path + ".fieldNames[" + _index15 + "]",
1306
+ expected: "string",
1307
+ value: elem
1308
+ })).every(flag => flag)) || _report(_exceptionable, {
1309
+ path: _path + ".fieldNames",
1310
+ expected: "(Array<string> & MinItems<1> & UniqueItems<true>)",
1311
+ value: input.fieldNames
1312
+ }), true === input.unique || _report(_exceptionable, {
1313
+ path: _path + ".unique",
1314
+ expected: "true",
1315
+ value: input.unique
1316
+ })].every(flag => flag); const _vo7 = (input, _path, _exceptionable = true) => [(Array.isArray(input.fieldNames) || _report(_exceptionable, {
1317
+ path: _path + ".fieldNames",
1318
+ expected: "(Array<string> & MinItems<1> & UniqueItems<true>)",
1319
+ value: input.fieldNames
1320
+ })) && ((1 <= input.fieldNames.length || _report(_exceptionable, {
1321
+ path: _path + ".fieldNames",
1322
+ expected: "Array<> & MinItems<1>",
1323
+ value: input.fieldNames
1324
+ })) && (__typia_transform__isUniqueItems._isUniqueItems(input.fieldNames) || _report(_exceptionable, {
1325
+ path: _path + ".fieldNames",
1326
+ expected: "Array<> & UniqueItems<true>",
1327
+ value: input.fieldNames
1328
+ })) && input.fieldNames.map((elem, _index16) => "string" === typeof elem || _report(_exceptionable, {
1329
+ path: _path + ".fieldNames[" + _index16 + "]",
1330
+ expected: "string",
1331
+ value: elem
1332
+ })).every(flag => flag)) || _report(_exceptionable, {
1333
+ path: _path + ".fieldNames",
1334
+ expected: "(Array<string> & MinItems<1> & UniqueItems<true>)",
1335
+ value: input.fieldNames
1336
+ })].every(flag => flag); const _vo8 = (input, _path, _exceptionable = true) => ["string" === typeof input.fieldName || _report(_exceptionable, {
1337
+ path: _path + ".fieldName",
1338
+ expected: "string",
1339
+ value: input.fieldName
1340
+ })].every(flag => flag); const __is = input => "object" === typeof input && null !== input && _io0(input); let errors; let _report; return input => {
1341
+ if (false === __is(input)) {
1342
+ errors = [];
1343
+ _report = __typia_transform__validateReport._validateReport(errors);
1344
+ ((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
1345
+ path: _path + "",
1346
+ expected: "IAutoBePrismaCorrectApplication.IProps",
1347
+ value: input
1348
+ })) && _vo0(input, _path + "", true) || _report(true, {
1349
+ path: _path + "",
1350
+ expected: "IAutoBePrismaCorrectApplication.IProps",
1351
+ value: input
1352
+ }))(input, "$input", true);
1353
+ const success = 0 === errors.length;
1354
+ return success ? {
1355
+ success,
1356
+ data: input
1357
+ } : {
1358
+ success,
1359
+ errors,
1360
+ data: input
1361
+ };
1362
+ }
1363
+ return {
1364
+ success: true,
1365
+ data: input
1366
+ };
1367
+ }; })()
1368
+ }
1369
+ ]
1370
+ },
1371
+ gemini: {
1372
+ model: "gemini",
1373
+ options: {
1374
+ reference: true,
797
1375
  separate: null
798
1376
  },
799
1377
  functions: [
@@ -822,7 +1400,7 @@ const collection = {
822
1400
  additionalProperties: false,
823
1401
  $defs: {
824
1402
  "AutoBePrisma.IModel": {
825
- description: "Interface representing a single Prisma model (database table).\n\nBased on the uploaded schemas, models follow specific patterns:\n\n- Main business entities (e.g., shopping_sales, shopping_customers)\n- Snapshot/versioning entities for audit trails (e.g.,\n shopping_sale_snapshots)\n- Junction tables for M:N relationships (e.g.,\n shopping_cart_commodity_stocks)\n- Materialized views for performance (prefixed with mv_)\n\n### Description of {@link primaryField} property:\n\n> The primary key field of the model.\n> \n> In all uploaded schemas, primary keys are always UUID type with \"@\\id\"\n> directive. Usually named \"id\" and marked with \"@\\db.Uuid\" for PostgreSQL\n> mapping.",
1403
+ description: "Interface representing a single Prisma model (database table).\n\nBased on the uploaded schemas, models follow specific patterns:\n\n- Main business entities (e.g., shopping_sales, shopping_customers)\n- Snapshot/versioning entities for audit trails (e.g.,\n shopping_sale_snapshots)\n- Junction tables for M:N relationships (e.g.,\n shopping_cart_commodity_stocks)\n- Materialized views for performance (prefixed with mv_)",
826
1404
  type: "object",
827
1405
  properties: {
828
1406
  name: {
@@ -847,6 +1425,7 @@ const collection = {
847
1425
  ]
848
1426
  },
849
1427
  primaryField: {
1428
+ description: "The primary key field of the model.\n\nIn all uploaded schemas, primary keys are always UUID type with \"@\\id\"\ndirective. Usually named \"id\" and marked with \"@\\db.Uuid\" for PostgreSQL\nmapping.",
850
1429
  $ref: "#/$defs/AutoBePrisma.IPrimaryField"
851
1430
  },
852
1431
  foreignFields: {
@@ -925,7 +1504,7 @@ const collection = {
925
1504
  ]
926
1505
  },
927
1506
  "AutoBePrisma.IForeignField": {
928
- description: "Interface representing a foreign key field that establishes relationships\nbetween models.\n\nForeign keys create associations between models, enabling relational data\nmodeling. They can represent 1:1, 1:N, or participate in M:N relationships\nthrough junction tables.\n\n### Description of {@link relation} property:\n\n> Prisma relation configuration defining the association details.\n> \n> Specifies how this foreign key connects to the target model, including\n> relation name, target model, and target field. This configuration is used\n> to generate the appropriate Prisma relation directive in the schema.",
1507
+ description: "Interface representing a foreign key field that establishes relationships\nbetween models.\n\nForeign keys create associations between models, enabling relational data\nmodeling. They can represent 1:1, 1:N, or participate in M:N relationships\nthrough junction tables.",
929
1508
  type: "object",
930
1509
  properties: {
931
1510
  name: {
@@ -944,6 +1523,7 @@ const collection = {
944
1523
  type: "string"
945
1524
  },
946
1525
  relation: {
1526
+ description: "Prisma relation configuration defining the association details.\n\nSpecifies how this foreign key connects to the target model, including\nrelation name, target model, and target field. This configuration is used\nto generate the appropriate Prisma relation directive in the schema.",
947
1527
  $ref: "#/$defs/AutoBePrisma.IRelation"
948
1528
  },
949
1529
  unique: {
@@ -1362,9 +1942,5 @@ const collection = {
1362
1942
  }
1363
1943
  ]
1364
1944
  },
1365
- claude,
1366
- llama: claude,
1367
- deepseek: claude,
1368
- "3.1": claude,
1369
1945
  };
1370
1946
  //# sourceMappingURL=orchestratePrismaCorrect.js.map