@autobe/agent 0.3.24 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/AutoBeAgent.d.ts +0 -7
- package/lib/AutoBeAgent.js +5 -5
- package/lib/AutoBeAgent.js.map +1 -1
- package/lib/constants/AutoBeSystemPromptConstant.d.ts +4 -4
- package/lib/factory/createAgenticaHistory.js +1 -1
- package/lib/factory/createAgenticaHistory.js.map +1 -1
- package/lib/factory/createAutoBeApplication.js +9 -9
- package/lib/factory/createAutoBeApplication.js.map +1 -1
- package/lib/index.d.ts +0 -4
- package/lib/index.mjs +3508 -504
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/interface/transformInterfaceHistories.js +3 -3
- package/lib/orchestrate/interface/transformInterfaceHistories.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrisma.js +13 -8
- package/lib/orchestrate/prisma/orchestratePrisma.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js +67 -26
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.d.ts +4 -0
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js +2010 -0
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -0
- package/lib/orchestrate/prisma/orchestratePrismaSchema.js +1649 -80
- package/lib/orchestrate/prisma/orchestratePrismaSchema.js.map +1 -1
- package/lib/orchestrate/prisma/transformPrismaComponentsHistories.js +1 -1
- package/lib/orchestrate/prisma/transformPrismaComponentsHistories.js.map +1 -1
- package/lib/orchestrate/prisma/transformPrismaCorrectHistories.d.ts +3 -0
- package/lib/orchestrate/prisma/{transformPrismaCompilerHistories.js → transformPrismaCorrectHistories.js} +11 -10
- package/lib/orchestrate/prisma/transformPrismaCorrectHistories.js.map +1 -0
- package/lib/orchestrate/prisma/transformPrismaHistories.js +1 -1
- package/lib/orchestrate/prisma/transformPrismaHistories.js.map +1 -1
- package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js +1 -1
- package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js.map +1 -1
- package/package.json +4 -4
- package/src/AutoBeAgent.ts +5 -5
- package/src/constants/AutoBeSystemPromptConstant.ts +4 -4
- package/src/factory/createAgenticaHistory.ts +1 -1
- package/src/factory/createAutoBeApplication.ts +9 -9
- package/src/orchestrate/interface/transformInterfaceHistories.ts +3 -3
- package/src/orchestrate/prisma/orchestratePrisma.ts +20 -12
- package/src/orchestrate/prisma/orchestratePrismaComponent.ts +6 -3
- package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +258 -0
- package/src/orchestrate/prisma/orchestratePrismaSchema.ts +16 -53
- package/src/orchestrate/prisma/{transformPrismaCompilerHistories.ts → transformPrismaCorrectHistories.ts} +10 -10
- package/lib/orchestrate/prisma/orchestratePrismaCompiler.d.ts +0 -4
- package/lib/orchestrate/prisma/orchestratePrismaCompiler.js +0 -443
- package/lib/orchestrate/prisma/orchestratePrismaCompiler.js.map +0 -1
- package/lib/orchestrate/prisma/transformPrismaCompilerHistories.d.ts +0 -3
- package/lib/orchestrate/prisma/transformPrismaCompilerHistories.js.map +0 -1
- package/src/orchestrate/prisma/orchestratePrismaCompiler.ts +0 -276
|
@@ -0,0 +1,2010 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
45
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
|
+
};
|
|
47
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
+
exports.orchestratePrismaCorrect = orchestratePrismaCorrect;
|
|
49
|
+
const __typia_transform__isUniqueItems = __importStar(require("typia/lib/internal/_isUniqueItems.js"));
|
|
50
|
+
const __typia_transform__validateReport = __importStar(require("typia/lib/internal/_validateReport.js"));
|
|
51
|
+
const core_1 = require("@agentica/core");
|
|
52
|
+
const typia_1 = __importDefault(require("typia"));
|
|
53
|
+
const assertSchemaModel_1 = require("../../context/assertSchemaModel");
|
|
54
|
+
const transformPrismaCorrectHistories_1 = require("./transformPrismaCorrectHistories");
|
|
55
|
+
function orchestratePrismaCorrect(ctx, application, retry = 8) {
|
|
56
|
+
return step(ctx, application, retry);
|
|
57
|
+
}
|
|
58
|
+
function step(ctx, application, life) {
|
|
59
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
var _a, _b, _c, _d, _e;
|
|
61
|
+
const result = yield ctx.compiler.prisma.validate(application);
|
|
62
|
+
if (result.success)
|
|
63
|
+
return result; // SUCCESS
|
|
64
|
+
// VALIDATION FAILED
|
|
65
|
+
const schemas = yield ctx.compiler.prisma.write(application);
|
|
66
|
+
ctx.dispatch({
|
|
67
|
+
type: "prismaValidate",
|
|
68
|
+
result,
|
|
69
|
+
schemas,
|
|
70
|
+
compiled: yield ctx.compiler.prisma.compile({
|
|
71
|
+
files: schemas,
|
|
72
|
+
}),
|
|
73
|
+
step: (_b = (_a = ctx.state().analyze) === null || _a === void 0 ? void 0 : _a.step) !== null && _b !== void 0 ? _b : 0,
|
|
74
|
+
created_at: new Date().toISOString(),
|
|
75
|
+
});
|
|
76
|
+
const pointer = {
|
|
77
|
+
value: null,
|
|
78
|
+
};
|
|
79
|
+
const agentica = new core_1.MicroAgentica({
|
|
80
|
+
model: ctx.model,
|
|
81
|
+
vendor: ctx.vendor,
|
|
82
|
+
config: Object.assign({}, ((_c = ctx.config) !== null && _c !== void 0 ? _c : {})),
|
|
83
|
+
histories: (0, transformPrismaCorrectHistories_1.transformPrismaCorrectHistories)(result),
|
|
84
|
+
tokenUsage: ctx.usage(),
|
|
85
|
+
controllers: [
|
|
86
|
+
createApplication({
|
|
87
|
+
model: ctx.model,
|
|
88
|
+
build: (next) => {
|
|
89
|
+
pointer.value = next;
|
|
90
|
+
},
|
|
91
|
+
}),
|
|
92
|
+
],
|
|
93
|
+
});
|
|
94
|
+
agentica.on("request", (event) => {
|
|
95
|
+
if (event.body.tools) {
|
|
96
|
+
event.body.tool_choice = "required";
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
// REQUEST CORRECTION
|
|
100
|
+
yield agentica.conversate("Resolve the compilation errors in the provided Prisma schema files.");
|
|
101
|
+
if (pointer.value === null) {
|
|
102
|
+
console.error("Unreachable error: PrismaCompilerAgent.pointer.value is null");
|
|
103
|
+
return result; // unreachable
|
|
104
|
+
}
|
|
105
|
+
ctx.dispatch({
|
|
106
|
+
type: "prismaCorrect",
|
|
107
|
+
failure: result,
|
|
108
|
+
correction: {
|
|
109
|
+
files: pointer.value.files,
|
|
110
|
+
},
|
|
111
|
+
planning: pointer.value.planning,
|
|
112
|
+
step: (_e = (_d = ctx.state().analyze) === null || _d === void 0 ? void 0 : _d.step) !== null && _e !== void 0 ? _e : 0,
|
|
113
|
+
created_at: new Date().toISOString(),
|
|
114
|
+
});
|
|
115
|
+
return step(ctx, {
|
|
116
|
+
files: pointer.value.files,
|
|
117
|
+
}, life - 1);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
function createApplication(props) {
|
|
121
|
+
(0, assertSchemaModel_1.assertSchemaModel)(props.model);
|
|
122
|
+
const application = collection[props.model];
|
|
123
|
+
return {
|
|
124
|
+
protocol: "class",
|
|
125
|
+
name: "Prisma Compiler",
|
|
126
|
+
application,
|
|
127
|
+
execute: {
|
|
128
|
+
correctPrismaSchemaFiles: (next) => {
|
|
129
|
+
props.build(next);
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
const claude = {
|
|
135
|
+
model: "claude",
|
|
136
|
+
options: {
|
|
137
|
+
reference: true,
|
|
138
|
+
separate: null
|
|
139
|
+
},
|
|
140
|
+
functions: [
|
|
141
|
+
{
|
|
142
|
+
name: "correctPrismaSchemaFiles",
|
|
143
|
+
parameters: {
|
|
144
|
+
description: "Current Type: {@link IModifyPrismaSchemaFilesProps}",
|
|
145
|
+
type: "object",
|
|
146
|
+
properties: {
|
|
147
|
+
planning: {
|
|
148
|
+
title: "Detailed execution plan for fixing AutoBePrisma validation errors",
|
|
149
|
+
description: "Detailed execution plan for fixing AutoBePrisma validation errors.\n\n\uD83C\uDFAF Purpose: Enable systematic reasoning and step-by-step error resolution\napproach for structured schema validation issues\n\n\uD83D\uDCCB Required Planning Content:\n\n1. **Error Analysis Summary**\n\n - List all validation errors from IAutoBePrismaValidation.IError[] array\n - Categorize errors by type (duplications, references, types, indexes)\n - Identify root causes and error interdependencies\n2. **Fix Strategy Overview**\n\n - Prioritize fixes based on dependencies (fix duplications first)\n - Outline minimal changes needed for each validation error\n - Identify potential impact on other models/relationships\n3. **Step-by-Step Fix Plan**\n\n - Model-by-model modification plan with specific changes\n - Exact field additions, removals, or renames required\n - Reference updates needed for renamed elements\n - Index corrections to comply with validation rules\n4. **Preservation Checklist**\n\n - Confirm which descriptions and business logic must be preserved\n - List relationships and constraints to maintain unchanged\n - Identify cross-model dependencies that must remain intact\n5. **Risk Assessment**\n\n - Potential side effects of each planned fix\n - Validation points to check after applying corrections\n - Ensure no new validation errors are introduced\n\n\uD83D\uDCA1 Example Planning Structure:\n\n ## Error Analysis\n - Error 1: Duplicate field 'name' in shopping_customers model\n - Error 2: Invalid targetModel 'shopping_customer' should be 'shopping_customers'\n\n ## Fix Strategy\n 1. Remove duplicate 'name' field (keep the more detailed one)\n 2. Update foreign key references to use correct plural model name\n\n ## Detailed Steps\n 1. shopping_customers model: Remove second 'name' field from plainFields\n 2. shopping_orders model: Update targetModel from 'shopping_customer' to 'shopping_customers'\n\n ## Preservation Notes\n - Keep business descriptions for remaining 'name' field\n - Maintain all relationship semantics\n - Preserve all indexes and constraints",
|
|
150
|
+
type: "string"
|
|
151
|
+
},
|
|
152
|
+
files: {
|
|
153
|
+
description: "Original AutoBePrisma.IApplication structure that contains validation\nerrors and needs correction.\n\n\uD83D\uDCE5 Input Structure:\n\n- Complete IApplication with files array containing validation errors\n- Each file contains models with potential structural issues\n- Errors may include duplications, invalid references, or constraint\n violations\n\n\uD83D\uDD0D Expected Validation Issues:\n\n- Duplicate model names across files\n- Duplicate field/relation names within models\n- Invalid foreign key references to non-existent models\n- Single foreign key fields in index arrays\n- Non-plural model names or invalid naming conventions\n\n\uD83D\uDCDD Application Content Analysis:\n\n- All models with their complete field definitions\n- All relationships with targetModel and targetfield configurations\n- All indexes (unique, plain, GIN) with field references\n- All business descriptions and requirement mappings\n- Cross-file model references and dependencies\n\n\u26A0\uFE0F Processing Notes:\n\n- Structure may contain validation errors that prevent code generation\n- Some models might reference non-existent targets\n- Field names might violate naming conventions\n- Index configurations might include forbidden single foreign keys\n- Business logic and descriptions must be preserved during fixes",
|
|
154
|
+
type: "array",
|
|
155
|
+
items: {
|
|
156
|
+
description: "Description of the current {@link AutoBePrisma.IFile} type:\n\n> Interface representing a single Prisma schema file within the application.\n> \n> Each file focuses on a specific business domain and contains related\n> models. File organization follows domain-driven design principles as seen\n> in the uploaded schemas.",
|
|
157
|
+
type: "object",
|
|
158
|
+
properties: {
|
|
159
|
+
filename: {
|
|
160
|
+
title: "Name of the schema file to be generated",
|
|
161
|
+
description: "Name of the schema file to be generated.\n\nShould follow the naming convention: \"schema-{number}-{domain}.prisma\"\nExamples: \"schema-02-systematic.prisma\", \"schema-03-actors.prisma\" The\nnumber indicates the dependency order for schema generation.",
|
|
162
|
+
type: "string",
|
|
163
|
+
pattern: "^[a-zA-Z0-9._-]+\\.prisma$"
|
|
164
|
+
},
|
|
165
|
+
namespace: {
|
|
166
|
+
title: "Business domain namespace that groups related models",
|
|
167
|
+
description: "Business domain namespace that groups related models.\n\nUsed in Prisma documentation comments as \"@\\namespace directive\".\nExamples from uploaded schemas: \"Systematic\", \"Actors\", \"Sales\", \"Carts\",\n\"Orders\", \"Coupons\", \"Coins\", \"Inquiries\", \"Favorites\", \"Articles\"",
|
|
168
|
+
type: "string"
|
|
169
|
+
},
|
|
170
|
+
models: {
|
|
171
|
+
title: "Array of Prisma models (database tables) within this domain",
|
|
172
|
+
description: "Array of Prisma models (database tables) within this domain.\n\nEach model represents a business entity or concept within the namespace.\nModels can reference each other through foreign key relationships.",
|
|
173
|
+
type: "array",
|
|
174
|
+
items: {
|
|
175
|
+
description: "Description of the current {@link AutoBePrisma.IModel} type:\n\n> Interface representing a single Prisma model (database table).\n> \n> Based 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_)",
|
|
176
|
+
type: "object",
|
|
177
|
+
properties: {
|
|
178
|
+
name: {
|
|
179
|
+
title: "Name of the Prisma model (database table name)",
|
|
180
|
+
description: "Name of the Prisma model (database table name).\n\nShould follow snake_case convention with domain prefix. Examples:\n\"shopping_customers\", \"shopping_sale_snapshots\", \"bbs_articles\"\nMaterialized views use \"mv_\" prefix: \"mv_shopping_sale_last_snapshots\"",
|
|
181
|
+
type: "string",
|
|
182
|
+
pattern: "^[a-z][a-z0-9_]*$"
|
|
183
|
+
},
|
|
184
|
+
description: {
|
|
185
|
+
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 Example:\n \"Customer information, but not a person but a **connection** basis...\"",
|
|
186
|
+
type: "string"
|
|
187
|
+
},
|
|
188
|
+
material: {
|
|
189
|
+
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",
|
|
190
|
+
type: "boolean"
|
|
191
|
+
},
|
|
192
|
+
primaryField: {
|
|
193
|
+
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.\n\n------------------------------\n\nDescription of the current {@link AutoBePrisma.IPrimaryField} type:\n\n> Interface representing the primary key field of a Prisma model.\n> \n> All models in the uploaded schemas use UUID as primary key for better\n> distributed system compatibility and security (no sequential ID exposure).",
|
|
194
|
+
type: "object",
|
|
195
|
+
properties: {
|
|
196
|
+
name: {
|
|
197
|
+
title: "Name of the primary key field",
|
|
198
|
+
description: "Name of the primary key field.\n\nConsistently named \"id\" across all models in the uploaded schemas.\nRepresents the unique identifier for each record in the table.",
|
|
199
|
+
type: "string",
|
|
200
|
+
pattern: "^[a-z][a-z0-9_]*$"
|
|
201
|
+
},
|
|
202
|
+
type: {
|
|
203
|
+
title: "Data type of the primary key field",
|
|
204
|
+
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.",
|
|
205
|
+
"const": "uuid"
|
|
206
|
+
},
|
|
207
|
+
description: {
|
|
208
|
+
title: "Description of the primary key field's purpose",
|
|
209
|
+
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.",
|
|
210
|
+
type: "string"
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
required: [
|
|
214
|
+
"name",
|
|
215
|
+
"type",
|
|
216
|
+
"description"
|
|
217
|
+
]
|
|
218
|
+
},
|
|
219
|
+
foreignFields: {
|
|
220
|
+
title: "Array of foreign key fields that reference other models",
|
|
221
|
+
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.",
|
|
222
|
+
type: "array",
|
|
223
|
+
items: {
|
|
224
|
+
description: "Description of the current {@link AutoBePrisma.IForeignField} type:\n\n> Interface representing a foreign key field that establishes relationships\n> between models.\n> \n> Foreign keys create associations between models, enabling relational data\n> modeling. They can represent 1:1, 1:N, or participate in M:N relationships\n> through junction tables.",
|
|
225
|
+
type: "object",
|
|
226
|
+
properties: {
|
|
227
|
+
name: {
|
|
228
|
+
title: "Name of the foreign key field",
|
|
229
|
+
description: "Name of the foreign key field.\n\nFollows convention: \"{target_model_name_without_prefix}_id\" Examples:\n\"shopping_customer_id\", \"bbs_article_id\", \"attachment_file_id\" For\nself-references: \"parent_id\" (e.g., in hierarchical structures)",
|
|
230
|
+
type: "string",
|
|
231
|
+
pattern: "^[a-z][a-z0-9_]*$"
|
|
232
|
+
},
|
|
233
|
+
type: {
|
|
234
|
+
title: "Data type of the foreign key field",
|
|
235
|
+
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.",
|
|
236
|
+
"const": "uuid"
|
|
237
|
+
},
|
|
238
|
+
description: {
|
|
239
|
+
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.",
|
|
240
|
+
type: "string"
|
|
241
|
+
},
|
|
242
|
+
relation: {
|
|
243
|
+
title: "Prisma relation configuration defining the association details",
|
|
244
|
+
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.",
|
|
245
|
+
type: "object",
|
|
246
|
+
properties: {
|
|
247
|
+
name: {
|
|
248
|
+
title: "Name of the relation property in the Prisma model",
|
|
249
|
+
description: "Name of the relation property in the Prisma model.\n\nUsed to access the related model instance. Usually a descriptive name\nof the relationship. Examples: \"customer\", \"channel\", \"parent\",\n\"snapshot\"",
|
|
250
|
+
type: "string",
|
|
251
|
+
pattern: "^[a-zA-Z_][a-zA-Z0-9_]*$"
|
|
252
|
+
},
|
|
253
|
+
targetModel: {
|
|
254
|
+
title: "Name of the target model being referenced",
|
|
255
|
+
description: "Name of the target model being referenced.\n\nMust match exactly with an existing model name in the schema. Examples:\n\"shopping_customers\", \"shopping_channels\", \"bbs_articles\"",
|
|
256
|
+
type: "string"
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
required: [
|
|
260
|
+
"name",
|
|
261
|
+
"targetModel"
|
|
262
|
+
]
|
|
263
|
+
},
|
|
264
|
+
unique: {
|
|
265
|
+
title: "Whether this foreign key has a unique constraint",
|
|
266
|
+
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.",
|
|
267
|
+
type: "boolean"
|
|
268
|
+
},
|
|
269
|
+
nullable: {
|
|
270
|
+
title: "Whether this foreign key can be null (optional relationship)",
|
|
271
|
+
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.",
|
|
272
|
+
type: "boolean"
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
required: [
|
|
276
|
+
"name",
|
|
277
|
+
"type",
|
|
278
|
+
"description",
|
|
279
|
+
"relation",
|
|
280
|
+
"unique",
|
|
281
|
+
"nullable"
|
|
282
|
+
]
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
plainFields: {
|
|
286
|
+
title: "Array of regular data fields that don't reference other models",
|
|
287
|
+
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.",
|
|
288
|
+
type: "array",
|
|
289
|
+
items: {
|
|
290
|
+
description: "Description of the current {@link AutoBePrisma.IPlainField} type:\n\n> Interface representing a regular data field that stores business\n> information.\n> \n> These fields contain the actual business data like names, amounts,\n> timestamps, flags, descriptions, and other domain-specific information.",
|
|
291
|
+
type: "object",
|
|
292
|
+
properties: {
|
|
293
|
+
name: {
|
|
294
|
+
title: "Name of the field in the database table",
|
|
295
|
+
description: "Name of the field in the database table.\n\nShould use snake_case convention. Common patterns from uploaded schemas:\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",
|
|
296
|
+
type: "string",
|
|
297
|
+
pattern: "^[a-z][a-z0-9_]*$"
|
|
298
|
+
},
|
|
299
|
+
type: {
|
|
300
|
+
title: "Data type of the field for Prisma schema generation",
|
|
301
|
+
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- Date: Date-only values (rare, mostly for business dates)\n- Datetime: Timestamp fields with date and time",
|
|
302
|
+
oneOf: [
|
|
303
|
+
{
|
|
304
|
+
"const": "string"
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
"const": "boolean"
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
"const": "uuid"
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
"const": "uri"
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
"const": "int"
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
"const": "double"
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
"const": "datetime"
|
|
323
|
+
}
|
|
324
|
+
]
|
|
325
|
+
},
|
|
326
|
+
description: {
|
|
327
|
+
title: "Description explaining the business purpose and usage of this field",
|
|
328
|
+
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 Example: \"Amount of cash payment.\" or\n \"Whether the unit is required or not.\"",
|
|
329
|
+
type: "string"
|
|
330
|
+
},
|
|
331
|
+
nullable: {
|
|
332
|
+
title: "Whether this field can contain null values",
|
|
333
|
+
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.",
|
|
334
|
+
type: "boolean"
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
required: [
|
|
338
|
+
"name",
|
|
339
|
+
"type",
|
|
340
|
+
"description",
|
|
341
|
+
"nullable"
|
|
342
|
+
]
|
|
343
|
+
}
|
|
344
|
+
},
|
|
345
|
+
uniqueIndexes: {
|
|
346
|
+
title: "Array of unique indexes for enforcing data integrity constraints",
|
|
347
|
+
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).",
|
|
348
|
+
type: "array",
|
|
349
|
+
items: {
|
|
350
|
+
description: "Description of the current {@link AutoBePrisma.IUniqueIndex} type:\n\n> Interface representing a unique index constraint on one or more fields.\n> \n> Unique indexes enforce data integrity by ensuring no duplicate values exist\n> for the specified field combination. Essential for business rules that\n> require uniqueness like email addresses, codes, or composite keys.",
|
|
351
|
+
type: "object",
|
|
352
|
+
properties: {
|
|
353
|
+
fieldNames: {
|
|
354
|
+
title: "Array of field names that together form the unique constraint",
|
|
355
|
+
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\"]",
|
|
356
|
+
type: "array",
|
|
357
|
+
items: {
|
|
358
|
+
type: "string"
|
|
359
|
+
},
|
|
360
|
+
minItems: 1,
|
|
361
|
+
uniqueItems: true
|
|
362
|
+
},
|
|
363
|
+
unique: {
|
|
364
|
+
title: "Explicit marker indicating this is a unique index",
|
|
365
|
+
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\".",
|
|
366
|
+
"const": true
|
|
367
|
+
}
|
|
368
|
+
},
|
|
369
|
+
required: [
|
|
370
|
+
"fieldNames",
|
|
371
|
+
"unique"
|
|
372
|
+
]
|
|
373
|
+
}
|
|
374
|
+
},
|
|
375
|
+
plainIndexes: {
|
|
376
|
+
title: "Array of regular indexes for query performance optimization",
|
|
377
|
+
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.",
|
|
378
|
+
type: "array",
|
|
379
|
+
items: {
|
|
380
|
+
description: "Description of the current {@link AutoBePrisma.IPlainIndex} type:\n\n> Interface representing a regular (non-unique) index for query performance.\n> \n> Regular indexes speed up database queries by creating optimized data\n> structures for common search patterns. Essential for foreign keys, date\n> ranges, and frequently filtered fields.",
|
|
381
|
+
type: "object",
|
|
382
|
+
properties: {
|
|
383
|
+
fieldNames: {
|
|
384
|
+
title: "Array of field names to include in the performance index",
|
|
385
|
+
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\"]",
|
|
386
|
+
type: "array",
|
|
387
|
+
items: {
|
|
388
|
+
type: "string"
|
|
389
|
+
},
|
|
390
|
+
minItems: 1,
|
|
391
|
+
uniqueItems: true
|
|
392
|
+
}
|
|
393
|
+
},
|
|
394
|
+
required: [
|
|
395
|
+
"fieldNames"
|
|
396
|
+
]
|
|
397
|
+
}
|
|
398
|
+
},
|
|
399
|
+
ginIndexes: {
|
|
400
|
+
title: "Array of GIN (Generalized Inverted Index) indexes for full-text search",
|
|
401
|
+
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.",
|
|
402
|
+
type: "array",
|
|
403
|
+
items: {
|
|
404
|
+
description: "Description of the current {@link AutoBePrisma.IGinIndex} type:\n\n> Interface representing a GIN (Generalized Inverted Index) for full-text\n> search.\n> \n> GIN indexes enable advanced PostgreSQL text search capabilities including\n> fuzzy matching and partial text search using trigram operations. Essential\n> for user-facing search features on text content.",
|
|
405
|
+
type: "object",
|
|
406
|
+
properties: {
|
|
407
|
+
fieldName: {
|
|
408
|
+
title: "Name of the text field to index for full-text search capabilities",
|
|
409
|
+
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.",
|
|
410
|
+
type: "string"
|
|
411
|
+
}
|
|
412
|
+
},
|
|
413
|
+
required: [
|
|
414
|
+
"fieldName"
|
|
415
|
+
]
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
},
|
|
419
|
+
required: [
|
|
420
|
+
"name",
|
|
421
|
+
"description",
|
|
422
|
+
"material",
|
|
423
|
+
"primaryField",
|
|
424
|
+
"foreignFields",
|
|
425
|
+
"plainFields",
|
|
426
|
+
"uniqueIndexes",
|
|
427
|
+
"plainIndexes",
|
|
428
|
+
"ginIndexes"
|
|
429
|
+
]
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
},
|
|
433
|
+
required: [
|
|
434
|
+
"filename",
|
|
435
|
+
"namespace",
|
|
436
|
+
"models"
|
|
437
|
+
]
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
},
|
|
441
|
+
required: [
|
|
442
|
+
"planning",
|
|
443
|
+
"files"
|
|
444
|
+
],
|
|
445
|
+
additionalProperties: false,
|
|
446
|
+
$defs: {}
|
|
447
|
+
},
|
|
448
|
+
description: "Fixes validation errors in AutoBePrisma.IApplication structure while\npreserving ALL existing business logic and model descriptions.\n\n## Core Rules\n\n1. Fix ONLY validation errors - never remove business descriptions\n2. Apply minimal changes - preserve original design intent\n3. Return COMPLETE corrected structure - no data loss allowed\n4. Maintain referential integrity across all models\n\n## Preservation Requirements\n\n- Keep ALL model and field descriptions\n- Keep business logic and architectural patterns\n- Maintain relationship semantics and cardinality\n- Remove descriptions only when removing duplicate elements\n\n## Fix Strategy\n\n- Resolve structural validation errors without changing business intent\n- Remove duplicate fields/relations while preserving most appropriate ones\n- Fix invalid references and type mismatches\n- Ensure naming conventions and index rules compliance",
|
|
449
|
+
validate: (() => { const _io0 = input => "string" === typeof input.planning && (Array.isArray(input.files) && input.files.every(elem => "object" === typeof elem && null !== elem && _io1(elem))); const _io1 = input => "string" === typeof input.filename && RegExp("^[a-zA-Z0-9._-]+\\.prisma$").test(input.filename) && "string" === typeof input.namespace && (Array.isArray(input.models) && input.models.every(elem => "object" === typeof elem && null !== elem && _io2(elem))); const _io2 = input => "string" === typeof input.name && RegExp("^[a-z][a-z0-9_]*$").test(input.name) && "string" === typeof input.description && "boolean" === typeof input.material && ("object" === typeof input.primaryField && null !== input.primaryField && _io3(input.primaryField)) && (Array.isArray(input.foreignFields) && input.foreignFields.every(elem => "object" === typeof elem && null !== elem && _io4(elem))) && (Array.isArray(input.plainFields) && input.plainFields.every(elem => "object" === typeof elem && null !== elem && _io6(elem))) && (Array.isArray(input.uniqueIndexes) && input.uniqueIndexes.every(elem => "object" === typeof elem && null !== elem && _io7(elem))) && (Array.isArray(input.plainIndexes) && input.plainIndexes.every(elem => "object" === typeof elem && null !== elem && _io8(elem))) && (Array.isArray(input.ginIndexes) && input.ginIndexes.every(elem => "object" === typeof elem && null !== elem && _io9(elem))); const _io3 = input => "string" === typeof input.name && RegExp("^[a-z][a-z0-9_]*$").test(input.name) && "uuid" === input.type && "string" === typeof input.description; const _io4 = 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 && _io5(input.relation)) && "boolean" === typeof input.unique && "boolean" === typeof input.nullable; const _io5 = input => "string" === typeof input.name && RegExp("^[a-zA-Z_][a-zA-Z0-9_]*$").test(input.name) && "string" === typeof input.targetModel; const _io6 = 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 _io7 = 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 _io8 = input => Array.isArray(input.fieldNames) && (1 <= input.fieldNames.length && __typia_transform__isUniqueItems._isUniqueItems(input.fieldNames) && input.fieldNames.every(elem => "string" === typeof elem)); const _io9 = input => "string" === typeof input.fieldName; const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.planning || _report(_exceptionable, {
|
|
450
|
+
path: _path + ".planning",
|
|
451
|
+
expected: "string",
|
|
452
|
+
value: input.planning
|
|
453
|
+
}), (Array.isArray(input.files) || _report(_exceptionable, {
|
|
454
|
+
path: _path + ".files",
|
|
455
|
+
expected: "Array<AutoBePrisma.IFile>",
|
|
456
|
+
value: input.files
|
|
457
|
+
})) && input.files.map((elem, _index10) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
458
|
+
path: _path + ".files[" + _index10 + "]",
|
|
459
|
+
expected: "AutoBePrisma.IFile",
|
|
460
|
+
value: elem
|
|
461
|
+
})) && _vo1(elem, _path + ".files[" + _index10 + "]", true && _exceptionable) || _report(_exceptionable, {
|
|
462
|
+
path: _path + ".files[" + _index10 + "]",
|
|
463
|
+
expected: "AutoBePrisma.IFile",
|
|
464
|
+
value: elem
|
|
465
|
+
})).every(flag => flag) || _report(_exceptionable, {
|
|
466
|
+
path: _path + ".files",
|
|
467
|
+
expected: "Array<AutoBePrisma.IFile>",
|
|
468
|
+
value: input.files
|
|
469
|
+
})].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => ["string" === typeof input.filename && (RegExp("^[a-zA-Z0-9._-]+\\.prisma$").test(input.filename) || _report(_exceptionable, {
|
|
470
|
+
path: _path + ".filename",
|
|
471
|
+
expected: "string & Pattern<\"^[a-zA-Z0-9._-]+\\\\.prisma$\">",
|
|
472
|
+
value: input.filename
|
|
473
|
+
})) || _report(_exceptionable, {
|
|
474
|
+
path: _path + ".filename",
|
|
475
|
+
expected: "(string & Pattern<\"^[a-zA-Z0-9._-]+\\\\.prisma$\">)",
|
|
476
|
+
value: input.filename
|
|
477
|
+
}), "string" === typeof input.namespace || _report(_exceptionable, {
|
|
478
|
+
path: _path + ".namespace",
|
|
479
|
+
expected: "string",
|
|
480
|
+
value: input.namespace
|
|
481
|
+
}), (Array.isArray(input.models) || _report(_exceptionable, {
|
|
482
|
+
path: _path + ".models",
|
|
483
|
+
expected: "Array<AutoBePrisma.IModel>",
|
|
484
|
+
value: input.models
|
|
485
|
+
})) && input.models.map((elem, _index11) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
486
|
+
path: _path + ".models[" + _index11 + "]",
|
|
487
|
+
expected: "AutoBePrisma.IModel",
|
|
488
|
+
value: elem
|
|
489
|
+
})) && _vo2(elem, _path + ".models[" + _index11 + "]", true && _exceptionable) || _report(_exceptionable, {
|
|
490
|
+
path: _path + ".models[" + _index11 + "]",
|
|
491
|
+
expected: "AutoBePrisma.IModel",
|
|
492
|
+
value: elem
|
|
493
|
+
})).every(flag => flag) || _report(_exceptionable, {
|
|
494
|
+
path: _path + ".models",
|
|
495
|
+
expected: "Array<AutoBePrisma.IModel>",
|
|
496
|
+
value: input.models
|
|
497
|
+
})].every(flag => flag); const _vo2 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[a-z][a-z0-9_]*$").test(input.name) || _report(_exceptionable, {
|
|
498
|
+
path: _path + ".name",
|
|
499
|
+
expected: "string & Pattern<\"^[a-z][a-z0-9_]*$\">",
|
|
500
|
+
value: input.name
|
|
501
|
+
})) || _report(_exceptionable, {
|
|
502
|
+
path: _path + ".name",
|
|
503
|
+
expected: "(string & Pattern<\"^[a-z][a-z0-9_]*$\">)",
|
|
504
|
+
value: input.name
|
|
505
|
+
}), "string" === typeof input.description || _report(_exceptionable, {
|
|
506
|
+
path: _path + ".description",
|
|
507
|
+
expected: "string",
|
|
508
|
+
value: input.description
|
|
509
|
+
}), "boolean" === typeof input.material || _report(_exceptionable, {
|
|
510
|
+
path: _path + ".material",
|
|
511
|
+
expected: "boolean",
|
|
512
|
+
value: input.material
|
|
513
|
+
}), ("object" === typeof input.primaryField && null !== input.primaryField || _report(_exceptionable, {
|
|
514
|
+
path: _path + ".primaryField",
|
|
515
|
+
expected: "AutoBePrisma.IPrimaryField",
|
|
516
|
+
value: input.primaryField
|
|
517
|
+
})) && _vo3(input.primaryField, _path + ".primaryField", true && _exceptionable) || _report(_exceptionable, {
|
|
518
|
+
path: _path + ".primaryField",
|
|
519
|
+
expected: "AutoBePrisma.IPrimaryField",
|
|
520
|
+
value: input.primaryField
|
|
521
|
+
}), (Array.isArray(input.foreignFields) || _report(_exceptionable, {
|
|
522
|
+
path: _path + ".foreignFields",
|
|
523
|
+
expected: "Array<AutoBePrisma.IForeignField>",
|
|
524
|
+
value: input.foreignFields
|
|
525
|
+
})) && input.foreignFields.map((elem, _index12) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
526
|
+
path: _path + ".foreignFields[" + _index12 + "]",
|
|
527
|
+
expected: "AutoBePrisma.IForeignField",
|
|
528
|
+
value: elem
|
|
529
|
+
})) && _vo4(elem, _path + ".foreignFields[" + _index12 + "]", true && _exceptionable) || _report(_exceptionable, {
|
|
530
|
+
path: _path + ".foreignFields[" + _index12 + "]",
|
|
531
|
+
expected: "AutoBePrisma.IForeignField",
|
|
532
|
+
value: elem
|
|
533
|
+
})).every(flag => flag) || _report(_exceptionable, {
|
|
534
|
+
path: _path + ".foreignFields",
|
|
535
|
+
expected: "Array<AutoBePrisma.IForeignField>",
|
|
536
|
+
value: input.foreignFields
|
|
537
|
+
}), (Array.isArray(input.plainFields) || _report(_exceptionable, {
|
|
538
|
+
path: _path + ".plainFields",
|
|
539
|
+
expected: "Array<AutoBePrisma.IPlainField>",
|
|
540
|
+
value: input.plainFields
|
|
541
|
+
})) && input.plainFields.map((elem, _index13) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
542
|
+
path: _path + ".plainFields[" + _index13 + "]",
|
|
543
|
+
expected: "AutoBePrisma.IPlainField",
|
|
544
|
+
value: elem
|
|
545
|
+
})) && _vo6(elem, _path + ".plainFields[" + _index13 + "]", true && _exceptionable) || _report(_exceptionable, {
|
|
546
|
+
path: _path + ".plainFields[" + _index13 + "]",
|
|
547
|
+
expected: "AutoBePrisma.IPlainField",
|
|
548
|
+
value: elem
|
|
549
|
+
})).every(flag => flag) || _report(_exceptionable, {
|
|
550
|
+
path: _path + ".plainFields",
|
|
551
|
+
expected: "Array<AutoBePrisma.IPlainField>",
|
|
552
|
+
value: input.plainFields
|
|
553
|
+
}), (Array.isArray(input.uniqueIndexes) || _report(_exceptionable, {
|
|
554
|
+
path: _path + ".uniqueIndexes",
|
|
555
|
+
expected: "Array<AutoBePrisma.IUniqueIndex>",
|
|
556
|
+
value: input.uniqueIndexes
|
|
557
|
+
})) && input.uniqueIndexes.map((elem, _index14) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
558
|
+
path: _path + ".uniqueIndexes[" + _index14 + "]",
|
|
559
|
+
expected: "AutoBePrisma.IUniqueIndex",
|
|
560
|
+
value: elem
|
|
561
|
+
})) && _vo7(elem, _path + ".uniqueIndexes[" + _index14 + "]", true && _exceptionable) || _report(_exceptionable, {
|
|
562
|
+
path: _path + ".uniqueIndexes[" + _index14 + "]",
|
|
563
|
+
expected: "AutoBePrisma.IUniqueIndex",
|
|
564
|
+
value: elem
|
|
565
|
+
})).every(flag => flag) || _report(_exceptionable, {
|
|
566
|
+
path: _path + ".uniqueIndexes",
|
|
567
|
+
expected: "Array<AutoBePrisma.IUniqueIndex>",
|
|
568
|
+
value: input.uniqueIndexes
|
|
569
|
+
}), (Array.isArray(input.plainIndexes) || _report(_exceptionable, {
|
|
570
|
+
path: _path + ".plainIndexes",
|
|
571
|
+
expected: "Array<AutoBePrisma.IPlainIndex>",
|
|
572
|
+
value: input.plainIndexes
|
|
573
|
+
})) && input.plainIndexes.map((elem, _index15) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
574
|
+
path: _path + ".plainIndexes[" + _index15 + "]",
|
|
575
|
+
expected: "AutoBePrisma.IPlainIndex",
|
|
576
|
+
value: elem
|
|
577
|
+
})) && _vo8(elem, _path + ".plainIndexes[" + _index15 + "]", true && _exceptionable) || _report(_exceptionable, {
|
|
578
|
+
path: _path + ".plainIndexes[" + _index15 + "]",
|
|
579
|
+
expected: "AutoBePrisma.IPlainIndex",
|
|
580
|
+
value: elem
|
|
581
|
+
})).every(flag => flag) || _report(_exceptionable, {
|
|
582
|
+
path: _path + ".plainIndexes",
|
|
583
|
+
expected: "Array<AutoBePrisma.IPlainIndex>",
|
|
584
|
+
value: input.plainIndexes
|
|
585
|
+
}), (Array.isArray(input.ginIndexes) || _report(_exceptionable, {
|
|
586
|
+
path: _path + ".ginIndexes",
|
|
587
|
+
expected: "Array<AutoBePrisma.IGinIndex>",
|
|
588
|
+
value: input.ginIndexes
|
|
589
|
+
})) && input.ginIndexes.map((elem, _index16) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
590
|
+
path: _path + ".ginIndexes[" + _index16 + "]",
|
|
591
|
+
expected: "AutoBePrisma.IGinIndex",
|
|
592
|
+
value: elem
|
|
593
|
+
})) && _vo9(elem, _path + ".ginIndexes[" + _index16 + "]", true && _exceptionable) || _report(_exceptionable, {
|
|
594
|
+
path: _path + ".ginIndexes[" + _index16 + "]",
|
|
595
|
+
expected: "AutoBePrisma.IGinIndex",
|
|
596
|
+
value: elem
|
|
597
|
+
})).every(flag => flag) || _report(_exceptionable, {
|
|
598
|
+
path: _path + ".ginIndexes",
|
|
599
|
+
expected: "Array<AutoBePrisma.IGinIndex>",
|
|
600
|
+
value: input.ginIndexes
|
|
601
|
+
})].every(flag => flag); const _vo3 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[a-z][a-z0-9_]*$").test(input.name) || _report(_exceptionable, {
|
|
602
|
+
path: _path + ".name",
|
|
603
|
+
expected: "string & Pattern<\"^[a-z][a-z0-9_]*$\">",
|
|
604
|
+
value: input.name
|
|
605
|
+
})) || _report(_exceptionable, {
|
|
606
|
+
path: _path + ".name",
|
|
607
|
+
expected: "(string & Pattern<\"^[a-z][a-z0-9_]*$\">)",
|
|
608
|
+
value: input.name
|
|
609
|
+
}), "uuid" === input.type || _report(_exceptionable, {
|
|
610
|
+
path: _path + ".type",
|
|
611
|
+
expected: "\"uuid\"",
|
|
612
|
+
value: input.type
|
|
613
|
+
}), "string" === typeof input.description || _report(_exceptionable, {
|
|
614
|
+
path: _path + ".description",
|
|
615
|
+
expected: "string",
|
|
616
|
+
value: input.description
|
|
617
|
+
})].every(flag => flag); const _vo4 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[a-z][a-z0-9_]*$").test(input.name) || _report(_exceptionable, {
|
|
618
|
+
path: _path + ".name",
|
|
619
|
+
expected: "string & Pattern<\"^[a-z][a-z0-9_]*$\">",
|
|
620
|
+
value: input.name
|
|
621
|
+
})) || _report(_exceptionable, {
|
|
622
|
+
path: _path + ".name",
|
|
623
|
+
expected: "(string & Pattern<\"^[a-z][a-z0-9_]*$\">)",
|
|
624
|
+
value: input.name
|
|
625
|
+
}), "uuid" === input.type || _report(_exceptionable, {
|
|
626
|
+
path: _path + ".type",
|
|
627
|
+
expected: "\"uuid\"",
|
|
628
|
+
value: input.type
|
|
629
|
+
}), "string" === typeof input.description || _report(_exceptionable, {
|
|
630
|
+
path: _path + ".description",
|
|
631
|
+
expected: "string",
|
|
632
|
+
value: input.description
|
|
633
|
+
}), ("object" === typeof input.relation && null !== input.relation || _report(_exceptionable, {
|
|
634
|
+
path: _path + ".relation",
|
|
635
|
+
expected: "__type",
|
|
636
|
+
value: input.relation
|
|
637
|
+
})) && _vo5(input.relation, _path + ".relation", true && _exceptionable) || _report(_exceptionable, {
|
|
638
|
+
path: _path + ".relation",
|
|
639
|
+
expected: "__type",
|
|
640
|
+
value: input.relation
|
|
641
|
+
}), "boolean" === typeof input.unique || _report(_exceptionable, {
|
|
642
|
+
path: _path + ".unique",
|
|
643
|
+
expected: "boolean",
|
|
644
|
+
value: input.unique
|
|
645
|
+
}), "boolean" === typeof input.nullable || _report(_exceptionable, {
|
|
646
|
+
path: _path + ".nullable",
|
|
647
|
+
expected: "boolean",
|
|
648
|
+
value: input.nullable
|
|
649
|
+
})].every(flag => flag); const _vo5 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[a-zA-Z_][a-zA-Z0-9_]*$").test(input.name) || _report(_exceptionable, {
|
|
650
|
+
path: _path + ".name",
|
|
651
|
+
expected: "string & Pattern<\"^[a-zA-Z_][a-zA-Z0-9_]*$\">",
|
|
652
|
+
value: input.name
|
|
653
|
+
})) || _report(_exceptionable, {
|
|
654
|
+
path: _path + ".name",
|
|
655
|
+
expected: "(string & Pattern<\"^[a-zA-Z_][a-zA-Z0-9_]*$\">)",
|
|
656
|
+
value: input.name
|
|
657
|
+
}), "string" === typeof input.targetModel || _report(_exceptionable, {
|
|
658
|
+
path: _path + ".targetModel",
|
|
659
|
+
expected: "string",
|
|
660
|
+
value: input.targetModel
|
|
661
|
+
})].every(flag => flag); const _vo6 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[a-z][a-z0-9_]*$").test(input.name) || _report(_exceptionable, {
|
|
662
|
+
path: _path + ".name",
|
|
663
|
+
expected: "string & Pattern<\"^[a-z][a-z0-9_]*$\">",
|
|
664
|
+
value: input.name
|
|
665
|
+
})) || _report(_exceptionable, {
|
|
666
|
+
path: _path + ".name",
|
|
667
|
+
expected: "(string & Pattern<\"^[a-z][a-z0-9_]*$\">)",
|
|
668
|
+
value: input.name
|
|
669
|
+
}), "string" === input.type || "boolean" === input.type || "uuid" === input.type || "uri" === input.type || "int" === input.type || "double" === input.type || "datetime" === input.type || _report(_exceptionable, {
|
|
670
|
+
path: _path + ".type",
|
|
671
|
+
expected: "(\"boolean\" | \"datetime\" | \"double\" | \"int\" | \"string\" | \"uri\" | \"uuid\")",
|
|
672
|
+
value: input.type
|
|
673
|
+
}), "string" === typeof input.description || _report(_exceptionable, {
|
|
674
|
+
path: _path + ".description",
|
|
675
|
+
expected: "string",
|
|
676
|
+
value: input.description
|
|
677
|
+
}), "boolean" === typeof input.nullable || _report(_exceptionable, {
|
|
678
|
+
path: _path + ".nullable",
|
|
679
|
+
expected: "boolean",
|
|
680
|
+
value: input.nullable
|
|
681
|
+
})].every(flag => flag); const _vo7 = (input, _path, _exceptionable = true) => [(Array.isArray(input.fieldNames) || _report(_exceptionable, {
|
|
682
|
+
path: _path + ".fieldNames",
|
|
683
|
+
expected: "(Array<string> & MinItems<1> & UniqueItems<true>)",
|
|
684
|
+
value: input.fieldNames
|
|
685
|
+
})) && ((1 <= input.fieldNames.length || _report(_exceptionable, {
|
|
686
|
+
path: _path + ".fieldNames",
|
|
687
|
+
expected: "Array<> & MinItems<1>",
|
|
688
|
+
value: input.fieldNames
|
|
689
|
+
})) && (__typia_transform__isUniqueItems._isUniqueItems(input.fieldNames) || _report(_exceptionable, {
|
|
690
|
+
path: _path + ".fieldNames",
|
|
691
|
+
expected: "Array<> & UniqueItems<true>",
|
|
692
|
+
value: input.fieldNames
|
|
693
|
+
})) && input.fieldNames.map((elem, _index17) => "string" === typeof elem || _report(_exceptionable, {
|
|
694
|
+
path: _path + ".fieldNames[" + _index17 + "]",
|
|
695
|
+
expected: "string",
|
|
696
|
+
value: elem
|
|
697
|
+
})).every(flag => flag)) || _report(_exceptionable, {
|
|
698
|
+
path: _path + ".fieldNames",
|
|
699
|
+
expected: "(Array<string> & MinItems<1> & UniqueItems<true>)",
|
|
700
|
+
value: input.fieldNames
|
|
701
|
+
}), true === input.unique || _report(_exceptionable, {
|
|
702
|
+
path: _path + ".unique",
|
|
703
|
+
expected: "true",
|
|
704
|
+
value: input.unique
|
|
705
|
+
})].every(flag => flag); const _vo8 = (input, _path, _exceptionable = true) => [(Array.isArray(input.fieldNames) || _report(_exceptionable, {
|
|
706
|
+
path: _path + ".fieldNames",
|
|
707
|
+
expected: "(Array<string> & MinItems<1> & UniqueItems<true>)",
|
|
708
|
+
value: input.fieldNames
|
|
709
|
+
})) && ((1 <= input.fieldNames.length || _report(_exceptionable, {
|
|
710
|
+
path: _path + ".fieldNames",
|
|
711
|
+
expected: "Array<> & MinItems<1>",
|
|
712
|
+
value: input.fieldNames
|
|
713
|
+
})) && (__typia_transform__isUniqueItems._isUniqueItems(input.fieldNames) || _report(_exceptionable, {
|
|
714
|
+
path: _path + ".fieldNames",
|
|
715
|
+
expected: "Array<> & UniqueItems<true>",
|
|
716
|
+
value: input.fieldNames
|
|
717
|
+
})) && input.fieldNames.map((elem, _index18) => "string" === typeof elem || _report(_exceptionable, {
|
|
718
|
+
path: _path + ".fieldNames[" + _index18 + "]",
|
|
719
|
+
expected: "string",
|
|
720
|
+
value: elem
|
|
721
|
+
})).every(flag => flag)) || _report(_exceptionable, {
|
|
722
|
+
path: _path + ".fieldNames",
|
|
723
|
+
expected: "(Array<string> & MinItems<1> & UniqueItems<true>)",
|
|
724
|
+
value: input.fieldNames
|
|
725
|
+
})].every(flag => flag); const _vo9 = (input, _path, _exceptionable = true) => ["string" === typeof input.fieldName || _report(_exceptionable, {
|
|
726
|
+
path: _path + ".fieldName",
|
|
727
|
+
expected: "string",
|
|
728
|
+
value: input.fieldName
|
|
729
|
+
})].every(flag => flag); const __is = input => "object" === typeof input && null !== input && _io0(input); let errors; let _report; return input => {
|
|
730
|
+
if (false === __is(input)) {
|
|
731
|
+
errors = [];
|
|
732
|
+
_report = __typia_transform__validateReport._validateReport(errors);
|
|
733
|
+
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
|
|
734
|
+
path: _path + "",
|
|
735
|
+
expected: "IModifyPrismaSchemaFilesProps",
|
|
736
|
+
value: input
|
|
737
|
+
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
738
|
+
path: _path + "",
|
|
739
|
+
expected: "IModifyPrismaSchemaFilesProps",
|
|
740
|
+
value: input
|
|
741
|
+
}))(input, "$input", true);
|
|
742
|
+
const success = 0 === errors.length;
|
|
743
|
+
return success ? {
|
|
744
|
+
success,
|
|
745
|
+
data: input
|
|
746
|
+
} : {
|
|
747
|
+
success,
|
|
748
|
+
errors,
|
|
749
|
+
data: input
|
|
750
|
+
};
|
|
751
|
+
}
|
|
752
|
+
return {
|
|
753
|
+
success: true,
|
|
754
|
+
data: input
|
|
755
|
+
};
|
|
756
|
+
}; })()
|
|
757
|
+
}
|
|
758
|
+
]
|
|
759
|
+
};
|
|
760
|
+
const collection = {
|
|
761
|
+
chatgpt: {
|
|
762
|
+
model: "chatgpt",
|
|
763
|
+
options: {
|
|
764
|
+
reference: true,
|
|
765
|
+
strict: false,
|
|
766
|
+
separate: null
|
|
767
|
+
},
|
|
768
|
+
functions: [
|
|
769
|
+
{
|
|
770
|
+
name: "correctPrismaSchemaFiles",
|
|
771
|
+
parameters: {
|
|
772
|
+
description: "Current Type: {@link IModifyPrismaSchemaFilesProps}",
|
|
773
|
+
type: "object",
|
|
774
|
+
properties: {
|
|
775
|
+
planning: {
|
|
776
|
+
title: "Detailed execution plan for fixing AutoBePrisma validation errors",
|
|
777
|
+
description: "Detailed execution plan for fixing AutoBePrisma validation errors.\n\n\uD83C\uDFAF Purpose: Enable systematic reasoning and step-by-step error resolution\napproach for structured schema validation issues\n\n\uD83D\uDCCB Required Planning Content:\n\n1. **Error Analysis Summary**\n\n - List all validation errors from IAutoBePrismaValidation.IError[] array\n - Categorize errors by type (duplications, references, types, indexes)\n - Identify root causes and error interdependencies\n2. **Fix Strategy Overview**\n\n - Prioritize fixes based on dependencies (fix duplications first)\n - Outline minimal changes needed for each validation error\n - Identify potential impact on other models/relationships\n3. **Step-by-Step Fix Plan**\n\n - Model-by-model modification plan with specific changes\n - Exact field additions, removals, or renames required\n - Reference updates needed for renamed elements\n - Index corrections to comply with validation rules\n4. **Preservation Checklist**\n\n - Confirm which descriptions and business logic must be preserved\n - List relationships and constraints to maintain unchanged\n - Identify cross-model dependencies that must remain intact\n5. **Risk Assessment**\n\n - Potential side effects of each planned fix\n - Validation points to check after applying corrections\n - Ensure no new validation errors are introduced\n\n\uD83D\uDCA1 Example Planning Structure:\n\n ## Error Analysis\n - Error 1: Duplicate field 'name' in shopping_customers model\n - Error 2: Invalid targetModel 'shopping_customer' should be 'shopping_customers'\n\n ## Fix Strategy\n 1. Remove duplicate 'name' field (keep the more detailed one)\n 2. Update foreign key references to use correct plural model name\n\n ## Detailed Steps\n 1. shopping_customers model: Remove second 'name' field from plainFields\n 2. shopping_orders model: Update targetModel from 'shopping_customer' to 'shopping_customers'\n\n ## Preservation Notes\n - Keep business descriptions for remaining 'name' field\n - Maintain all relationship semantics\n - Preserve all indexes and constraints",
|
|
778
|
+
type: "string"
|
|
779
|
+
},
|
|
780
|
+
files: {
|
|
781
|
+
description: "Original AutoBePrisma.IApplication structure that contains validation\nerrors and needs correction.\n\n\uD83D\uDCE5 Input Structure:\n\n- Complete IApplication with files array containing validation errors\n- Each file contains models with potential structural issues\n- Errors may include duplications, invalid references, or constraint\n violations\n\n\uD83D\uDD0D Expected Validation Issues:\n\n- Duplicate model names across files\n- Duplicate field/relation names within models\n- Invalid foreign key references to non-existent models\n- Single foreign key fields in index arrays\n- Non-plural model names or invalid naming conventions\n\n\uD83D\uDCDD Application Content Analysis:\n\n- All models with their complete field definitions\n- All relationships with targetModel and targetfield configurations\n- All indexes (unique, plain, GIN) with field references\n- All business descriptions and requirement mappings\n- Cross-file model references and dependencies\n\n\u26A0\uFE0F Processing Notes:\n\n- Structure may contain validation errors that prevent code generation\n- Some models might reference non-existent targets\n- Field names might violate naming conventions\n- Index configurations might include forbidden single foreign keys\n- Business logic and descriptions must be preserved during fixes",
|
|
782
|
+
type: "array",
|
|
783
|
+
items: {
|
|
784
|
+
description: "Description of the current {@link AutoBePrisma.IFile} type:\n\n> Interface representing a single Prisma schema file within the application.\n> \n> Each file focuses on a specific business domain and contains related\n> models. File organization follows domain-driven design principles as seen\n> in the uploaded schemas.",
|
|
785
|
+
type: "object",
|
|
786
|
+
properties: {
|
|
787
|
+
filename: {
|
|
788
|
+
title: "Name of the schema file to be generated",
|
|
789
|
+
description: "Name of the schema file to be generated.\n\nShould follow the naming convention: \"schema-{number}-{domain}.prisma\"\nExamples: \"schema-02-systematic.prisma\", \"schema-03-actors.prisma\" The\nnumber indicates the dependency order for schema generation.\n\n\n@pattern ^[a-zA-Z0-9._-]+\\.prisma$",
|
|
790
|
+
type: "string"
|
|
791
|
+
},
|
|
792
|
+
namespace: {
|
|
793
|
+
title: "Business domain namespace that groups related models",
|
|
794
|
+
description: "Business domain namespace that groups related models.\n\nUsed in Prisma documentation comments as \"@\\namespace directive\".\nExamples from uploaded schemas: \"Systematic\", \"Actors\", \"Sales\", \"Carts\",\n\"Orders\", \"Coupons\", \"Coins\", \"Inquiries\", \"Favorites\", \"Articles\"",
|
|
795
|
+
type: "string"
|
|
796
|
+
},
|
|
797
|
+
models: {
|
|
798
|
+
title: "Array of Prisma models (database tables) within this domain",
|
|
799
|
+
description: "Array of Prisma models (database tables) within this domain.\n\nEach model represents a business entity or concept within the namespace.\nModels can reference each other through foreign key relationships.",
|
|
800
|
+
type: "array",
|
|
801
|
+
items: {
|
|
802
|
+
description: "Description of the current {@link AutoBePrisma.IModel} type:\n\n> Interface representing a single Prisma model (database table).\n> \n> Based 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_)",
|
|
803
|
+
type: "object",
|
|
804
|
+
properties: {
|
|
805
|
+
name: {
|
|
806
|
+
title: "Name of the Prisma model (database table name)",
|
|
807
|
+
description: "Name of the Prisma model (database table name).\n\nShould follow snake_case convention with domain prefix. Examples:\n\"shopping_customers\", \"shopping_sale_snapshots\", \"bbs_articles\"\nMaterialized views use \"mv_\" prefix: \"mv_shopping_sale_last_snapshots\"\n\n\n@pattern ^[a-z][a-z0-9_]*$",
|
|
808
|
+
type: "string"
|
|
809
|
+
},
|
|
810
|
+
description: {
|
|
811
|
+
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 Example:\n \"Customer information, but not a person but a **connection** basis...\"",
|
|
812
|
+
type: "string"
|
|
813
|
+
},
|
|
814
|
+
material: {
|
|
815
|
+
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",
|
|
816
|
+
type: "boolean"
|
|
817
|
+
},
|
|
818
|
+
primaryField: {
|
|
819
|
+
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.\n\n------------------------------\n\nDescription of the current {@link AutoBePrisma.IPrimaryField} type:\n\n> Interface representing the primary key field of a Prisma model.\n> \n> All models in the uploaded schemas use UUID as primary key for better\n> distributed system compatibility and security (no sequential ID exposure).",
|
|
820
|
+
type: "object",
|
|
821
|
+
properties: {
|
|
822
|
+
name: {
|
|
823
|
+
title: "Name of the primary key field",
|
|
824
|
+
description: "Name of the primary key field.\n\nConsistently named \"id\" across all models in the uploaded schemas.\nRepresents the unique identifier for each record in the table.\n\n\n@pattern ^[a-z][a-z0-9_]*$",
|
|
825
|
+
type: "string"
|
|
826
|
+
},
|
|
827
|
+
type: {
|
|
828
|
+
title: "Data type of the primary key field",
|
|
829
|
+
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.",
|
|
830
|
+
type: "string",
|
|
831
|
+
"enum": [
|
|
832
|
+
"uuid"
|
|
833
|
+
]
|
|
834
|
+
},
|
|
835
|
+
description: {
|
|
836
|
+
title: "Description of the primary key field's purpose",
|
|
837
|
+
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.",
|
|
838
|
+
type: "string"
|
|
839
|
+
}
|
|
840
|
+
},
|
|
841
|
+
required: [
|
|
842
|
+
"name",
|
|
843
|
+
"type",
|
|
844
|
+
"description"
|
|
845
|
+
]
|
|
846
|
+
},
|
|
847
|
+
foreignFields: {
|
|
848
|
+
title: "Array of foreign key fields that reference other models",
|
|
849
|
+
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.",
|
|
850
|
+
type: "array",
|
|
851
|
+
items: {
|
|
852
|
+
description: "Description of the current {@link AutoBePrisma.IForeignField} type:\n\n> Interface representing a foreign key field that establishes relationships\n> between models.\n> \n> Foreign keys create associations between models, enabling relational data\n> modeling. They can represent 1:1, 1:N, or participate in M:N relationships\n> through junction tables.",
|
|
853
|
+
type: "object",
|
|
854
|
+
properties: {
|
|
855
|
+
name: {
|
|
856
|
+
title: "Name of the foreign key field",
|
|
857
|
+
description: "Name of the foreign key field.\n\nFollows convention: \"{target_model_name_without_prefix}_id\" Examples:\n\"shopping_customer_id\", \"bbs_article_id\", \"attachment_file_id\" For\nself-references: \"parent_id\" (e.g., in hierarchical structures)\n\n\n@pattern ^[a-z][a-z0-9_]*$",
|
|
858
|
+
type: "string"
|
|
859
|
+
},
|
|
860
|
+
type: {
|
|
861
|
+
title: "Data type of the foreign key field",
|
|
862
|
+
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.",
|
|
863
|
+
type: "string",
|
|
864
|
+
"enum": [
|
|
865
|
+
"uuid"
|
|
866
|
+
]
|
|
867
|
+
},
|
|
868
|
+
description: {
|
|
869
|
+
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.",
|
|
870
|
+
type: "string"
|
|
871
|
+
},
|
|
872
|
+
relation: {
|
|
873
|
+
title: "Prisma relation configuration defining the association details",
|
|
874
|
+
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.",
|
|
875
|
+
type: "object",
|
|
876
|
+
properties: {
|
|
877
|
+
name: {
|
|
878
|
+
title: "Name of the relation property in the Prisma model",
|
|
879
|
+
description: "Name of the relation property in the Prisma model.\n\nUsed to access the related model instance. Usually a descriptive name\nof the relationship. Examples: \"customer\", \"channel\", \"parent\",\n\"snapshot\"\n\n\n@pattern ^[a-zA-Z_][a-zA-Z0-9_]*$",
|
|
880
|
+
type: "string"
|
|
881
|
+
},
|
|
882
|
+
targetModel: {
|
|
883
|
+
title: "Name of the target model being referenced",
|
|
884
|
+
description: "Name of the target model being referenced.\n\nMust match exactly with an existing model name in the schema. Examples:\n\"shopping_customers\", \"shopping_channels\", \"bbs_articles\"",
|
|
885
|
+
type: "string"
|
|
886
|
+
}
|
|
887
|
+
},
|
|
888
|
+
required: [
|
|
889
|
+
"name",
|
|
890
|
+
"targetModel"
|
|
891
|
+
]
|
|
892
|
+
},
|
|
893
|
+
unique: {
|
|
894
|
+
title: "Whether this foreign key has a unique constraint",
|
|
895
|
+
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.",
|
|
896
|
+
type: "boolean"
|
|
897
|
+
},
|
|
898
|
+
nullable: {
|
|
899
|
+
title: "Whether this foreign key can be null (optional relationship)",
|
|
900
|
+
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.",
|
|
901
|
+
type: "boolean"
|
|
902
|
+
}
|
|
903
|
+
},
|
|
904
|
+
required: [
|
|
905
|
+
"name",
|
|
906
|
+
"type",
|
|
907
|
+
"description",
|
|
908
|
+
"relation",
|
|
909
|
+
"unique",
|
|
910
|
+
"nullable"
|
|
911
|
+
]
|
|
912
|
+
}
|
|
913
|
+
},
|
|
914
|
+
plainFields: {
|
|
915
|
+
title: "Array of regular data fields that don't reference other models",
|
|
916
|
+
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.",
|
|
917
|
+
type: "array",
|
|
918
|
+
items: {
|
|
919
|
+
description: "Description of the current {@link AutoBePrisma.IPlainField} type:\n\n> Interface representing a regular data field that stores business\n> information.\n> \n> These fields contain the actual business data like names, amounts,\n> timestamps, flags, descriptions, and other domain-specific information.",
|
|
920
|
+
type: "object",
|
|
921
|
+
properties: {
|
|
922
|
+
name: {
|
|
923
|
+
title: "Name of the field in the database table",
|
|
924
|
+
description: "Name of the field in the database table.\n\nShould use snake_case convention. Common patterns from uploaded schemas:\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_]*$",
|
|
925
|
+
type: "string"
|
|
926
|
+
},
|
|
927
|
+
type: {
|
|
928
|
+
title: "Data type of the field for Prisma schema generation",
|
|
929
|
+
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- Date: Date-only values (rare, mostly for business dates)\n- Datetime: Timestamp fields with date and time",
|
|
930
|
+
type: "string",
|
|
931
|
+
"enum": [
|
|
932
|
+
"string",
|
|
933
|
+
"boolean",
|
|
934
|
+
"uuid",
|
|
935
|
+
"uri",
|
|
936
|
+
"int",
|
|
937
|
+
"double",
|
|
938
|
+
"datetime"
|
|
939
|
+
]
|
|
940
|
+
},
|
|
941
|
+
description: {
|
|
942
|
+
title: "Description explaining the business purpose and usage of this field",
|
|
943
|
+
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 Example: \"Amount of cash payment.\" or\n \"Whether the unit is required or not.\"",
|
|
944
|
+
type: "string"
|
|
945
|
+
},
|
|
946
|
+
nullable: {
|
|
947
|
+
title: "Whether this field can contain null values",
|
|
948
|
+
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.",
|
|
949
|
+
type: "boolean"
|
|
950
|
+
}
|
|
951
|
+
},
|
|
952
|
+
required: [
|
|
953
|
+
"name",
|
|
954
|
+
"type",
|
|
955
|
+
"description",
|
|
956
|
+
"nullable"
|
|
957
|
+
]
|
|
958
|
+
}
|
|
959
|
+
},
|
|
960
|
+
uniqueIndexes: {
|
|
961
|
+
title: "Array of unique indexes for enforcing data integrity constraints",
|
|
962
|
+
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).",
|
|
963
|
+
type: "array",
|
|
964
|
+
items: {
|
|
965
|
+
description: "Description of the current {@link AutoBePrisma.IUniqueIndex} type:\n\n> Interface representing a unique index constraint on one or more fields.\n> \n> Unique indexes enforce data integrity by ensuring no duplicate values exist\n> for the specified field combination. Essential for business rules that\n> require uniqueness like email addresses, codes, or composite keys.",
|
|
966
|
+
type: "object",
|
|
967
|
+
properties: {
|
|
968
|
+
fieldNames: {
|
|
969
|
+
title: "Array of field names that together form the unique constraint",
|
|
970
|
+
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",
|
|
971
|
+
type: "array",
|
|
972
|
+
items: {
|
|
973
|
+
type: "string"
|
|
974
|
+
}
|
|
975
|
+
},
|
|
976
|
+
unique: {
|
|
977
|
+
title: "Explicit marker indicating this is a unique index",
|
|
978
|
+
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\".",
|
|
979
|
+
type: "boolean",
|
|
980
|
+
"enum": [
|
|
981
|
+
true
|
|
982
|
+
]
|
|
983
|
+
}
|
|
984
|
+
},
|
|
985
|
+
required: [
|
|
986
|
+
"fieldNames",
|
|
987
|
+
"unique"
|
|
988
|
+
]
|
|
989
|
+
}
|
|
990
|
+
},
|
|
991
|
+
plainIndexes: {
|
|
992
|
+
title: "Array of regular indexes for query performance optimization",
|
|
993
|
+
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.",
|
|
994
|
+
type: "array",
|
|
995
|
+
items: {
|
|
996
|
+
description: "Description of the current {@link AutoBePrisma.IPlainIndex} type:\n\n> Interface representing a regular (non-unique) index for query performance.\n> \n> Regular indexes speed up database queries by creating optimized data\n> structures for common search patterns. Essential for foreign keys, date\n> ranges, and frequently filtered fields.",
|
|
997
|
+
type: "object",
|
|
998
|
+
properties: {
|
|
999
|
+
fieldNames: {
|
|
1000
|
+
title: "Array of field names to include in the performance index",
|
|
1001
|
+
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",
|
|
1002
|
+
type: "array",
|
|
1003
|
+
items: {
|
|
1004
|
+
type: "string"
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
},
|
|
1008
|
+
required: [
|
|
1009
|
+
"fieldNames"
|
|
1010
|
+
]
|
|
1011
|
+
}
|
|
1012
|
+
},
|
|
1013
|
+
ginIndexes: {
|
|
1014
|
+
title: "Array of GIN (Generalized Inverted Index) indexes for full-text search",
|
|
1015
|
+
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.",
|
|
1016
|
+
type: "array",
|
|
1017
|
+
items: {
|
|
1018
|
+
description: "Description of the current {@link AutoBePrisma.IGinIndex} type:\n\n> Interface representing a GIN (Generalized Inverted Index) for full-text\n> search.\n> \n> GIN indexes enable advanced PostgreSQL text search capabilities including\n> fuzzy matching and partial text search using trigram operations. Essential\n> for user-facing search features on text content.",
|
|
1019
|
+
type: "object",
|
|
1020
|
+
properties: {
|
|
1021
|
+
fieldName: {
|
|
1022
|
+
title: "Name of the text field to index for full-text search capabilities",
|
|
1023
|
+
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.",
|
|
1024
|
+
type: "string"
|
|
1025
|
+
}
|
|
1026
|
+
},
|
|
1027
|
+
required: [
|
|
1028
|
+
"fieldName"
|
|
1029
|
+
]
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
},
|
|
1033
|
+
required: [
|
|
1034
|
+
"name",
|
|
1035
|
+
"description",
|
|
1036
|
+
"material",
|
|
1037
|
+
"primaryField",
|
|
1038
|
+
"foreignFields",
|
|
1039
|
+
"plainFields",
|
|
1040
|
+
"uniqueIndexes",
|
|
1041
|
+
"plainIndexes",
|
|
1042
|
+
"ginIndexes"
|
|
1043
|
+
]
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
},
|
|
1047
|
+
required: [
|
|
1048
|
+
"filename",
|
|
1049
|
+
"namespace",
|
|
1050
|
+
"models"
|
|
1051
|
+
]
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
},
|
|
1055
|
+
required: [
|
|
1056
|
+
"planning",
|
|
1057
|
+
"files"
|
|
1058
|
+
],
|
|
1059
|
+
additionalProperties: false,
|
|
1060
|
+
$defs: {}
|
|
1061
|
+
},
|
|
1062
|
+
description: "Fixes validation errors in AutoBePrisma.IApplication structure while\npreserving ALL existing business logic and model descriptions.\n\n## Core Rules\n\n1. Fix ONLY validation errors - never remove business descriptions\n2. Apply minimal changes - preserve original design intent\n3. Return COMPLETE corrected structure - no data loss allowed\n4. Maintain referential integrity across all models\n\n## Preservation Requirements\n\n- Keep ALL model and field descriptions\n- Keep business logic and architectural patterns\n- Maintain relationship semantics and cardinality\n- Remove descriptions only when removing duplicate elements\n\n## Fix Strategy\n\n- Resolve structural validation errors without changing business intent\n- Remove duplicate fields/relations while preserving most appropriate ones\n- Fix invalid references and type mismatches\n- Ensure naming conventions and index rules compliance",
|
|
1063
|
+
validate: (() => { const _io0 = input => "string" === typeof input.planning && (Array.isArray(input.files) && input.files.every(elem => "object" === typeof elem && null !== elem && _io1(elem))); const _io1 = input => "string" === typeof input.filename && RegExp("^[a-zA-Z0-9._-]+\\.prisma$").test(input.filename) && "string" === typeof input.namespace && (Array.isArray(input.models) && input.models.every(elem => "object" === typeof elem && null !== elem && _io2(elem))); const _io2 = input => "string" === typeof input.name && RegExp("^[a-z][a-z0-9_]*$").test(input.name) && "string" === typeof input.description && "boolean" === typeof input.material && ("object" === typeof input.primaryField && null !== input.primaryField && _io3(input.primaryField)) && (Array.isArray(input.foreignFields) && input.foreignFields.every(elem => "object" === typeof elem && null !== elem && _io4(elem))) && (Array.isArray(input.plainFields) && input.plainFields.every(elem => "object" === typeof elem && null !== elem && _io6(elem))) && (Array.isArray(input.uniqueIndexes) && input.uniqueIndexes.every(elem => "object" === typeof elem && null !== elem && _io7(elem))) && (Array.isArray(input.plainIndexes) && input.plainIndexes.every(elem => "object" === typeof elem && null !== elem && _io8(elem))) && (Array.isArray(input.ginIndexes) && input.ginIndexes.every(elem => "object" === typeof elem && null !== elem && _io9(elem))); const _io3 = input => "string" === typeof input.name && RegExp("^[a-z][a-z0-9_]*$").test(input.name) && "uuid" === input.type && "string" === typeof input.description; const _io4 = 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 && _io5(input.relation)) && "boolean" === typeof input.unique && "boolean" === typeof input.nullable; const _io5 = input => "string" === typeof input.name && RegExp("^[a-zA-Z_][a-zA-Z0-9_]*$").test(input.name) && "string" === typeof input.targetModel; const _io6 = 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 _io7 = 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 _io8 = input => Array.isArray(input.fieldNames) && (1 <= input.fieldNames.length && __typia_transform__isUniqueItems._isUniqueItems(input.fieldNames) && input.fieldNames.every(elem => "string" === typeof elem)); const _io9 = input => "string" === typeof input.fieldName; const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.planning || _report(_exceptionable, {
|
|
1064
|
+
path: _path + ".planning",
|
|
1065
|
+
expected: "string",
|
|
1066
|
+
value: input.planning
|
|
1067
|
+
}), (Array.isArray(input.files) || _report(_exceptionable, {
|
|
1068
|
+
path: _path + ".files",
|
|
1069
|
+
expected: "Array<AutoBePrisma.IFile>",
|
|
1070
|
+
value: input.files
|
|
1071
|
+
})) && input.files.map((elem, _index10) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
1072
|
+
path: _path + ".files[" + _index10 + "]",
|
|
1073
|
+
expected: "AutoBePrisma.IFile",
|
|
1074
|
+
value: elem
|
|
1075
|
+
})) && _vo1(elem, _path + ".files[" + _index10 + "]", true && _exceptionable) || _report(_exceptionable, {
|
|
1076
|
+
path: _path + ".files[" + _index10 + "]",
|
|
1077
|
+
expected: "AutoBePrisma.IFile",
|
|
1078
|
+
value: elem
|
|
1079
|
+
})).every(flag => flag) || _report(_exceptionable, {
|
|
1080
|
+
path: _path + ".files",
|
|
1081
|
+
expected: "Array<AutoBePrisma.IFile>",
|
|
1082
|
+
value: input.files
|
|
1083
|
+
})].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => ["string" === typeof input.filename && (RegExp("^[a-zA-Z0-9._-]+\\.prisma$").test(input.filename) || _report(_exceptionable, {
|
|
1084
|
+
path: _path + ".filename",
|
|
1085
|
+
expected: "string & Pattern<\"^[a-zA-Z0-9._-]+\\\\.prisma$\">",
|
|
1086
|
+
value: input.filename
|
|
1087
|
+
})) || _report(_exceptionable, {
|
|
1088
|
+
path: _path + ".filename",
|
|
1089
|
+
expected: "(string & Pattern<\"^[a-zA-Z0-9._-]+\\\\.prisma$\">)",
|
|
1090
|
+
value: input.filename
|
|
1091
|
+
}), "string" === typeof input.namespace || _report(_exceptionable, {
|
|
1092
|
+
path: _path + ".namespace",
|
|
1093
|
+
expected: "string",
|
|
1094
|
+
value: input.namespace
|
|
1095
|
+
}), (Array.isArray(input.models) || _report(_exceptionable, {
|
|
1096
|
+
path: _path + ".models",
|
|
1097
|
+
expected: "Array<AutoBePrisma.IModel>",
|
|
1098
|
+
value: input.models
|
|
1099
|
+
})) && input.models.map((elem, _index11) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
1100
|
+
path: _path + ".models[" + _index11 + "]",
|
|
1101
|
+
expected: "AutoBePrisma.IModel",
|
|
1102
|
+
value: elem
|
|
1103
|
+
})) && _vo2(elem, _path + ".models[" + _index11 + "]", true && _exceptionable) || _report(_exceptionable, {
|
|
1104
|
+
path: _path + ".models[" + _index11 + "]",
|
|
1105
|
+
expected: "AutoBePrisma.IModel",
|
|
1106
|
+
value: elem
|
|
1107
|
+
})).every(flag => flag) || _report(_exceptionable, {
|
|
1108
|
+
path: _path + ".models",
|
|
1109
|
+
expected: "Array<AutoBePrisma.IModel>",
|
|
1110
|
+
value: input.models
|
|
1111
|
+
})].every(flag => flag); const _vo2 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[a-z][a-z0-9_]*$").test(input.name) || _report(_exceptionable, {
|
|
1112
|
+
path: _path + ".name",
|
|
1113
|
+
expected: "string & Pattern<\"^[a-z][a-z0-9_]*$\">",
|
|
1114
|
+
value: input.name
|
|
1115
|
+
})) || _report(_exceptionable, {
|
|
1116
|
+
path: _path + ".name",
|
|
1117
|
+
expected: "(string & Pattern<\"^[a-z][a-z0-9_]*$\">)",
|
|
1118
|
+
value: input.name
|
|
1119
|
+
}), "string" === typeof input.description || _report(_exceptionable, {
|
|
1120
|
+
path: _path + ".description",
|
|
1121
|
+
expected: "string",
|
|
1122
|
+
value: input.description
|
|
1123
|
+
}), "boolean" === typeof input.material || _report(_exceptionable, {
|
|
1124
|
+
path: _path + ".material",
|
|
1125
|
+
expected: "boolean",
|
|
1126
|
+
value: input.material
|
|
1127
|
+
}), ("object" === typeof input.primaryField && null !== input.primaryField || _report(_exceptionable, {
|
|
1128
|
+
path: _path + ".primaryField",
|
|
1129
|
+
expected: "AutoBePrisma.IPrimaryField",
|
|
1130
|
+
value: input.primaryField
|
|
1131
|
+
})) && _vo3(input.primaryField, _path + ".primaryField", true && _exceptionable) || _report(_exceptionable, {
|
|
1132
|
+
path: _path + ".primaryField",
|
|
1133
|
+
expected: "AutoBePrisma.IPrimaryField",
|
|
1134
|
+
value: input.primaryField
|
|
1135
|
+
}), (Array.isArray(input.foreignFields) || _report(_exceptionable, {
|
|
1136
|
+
path: _path + ".foreignFields",
|
|
1137
|
+
expected: "Array<AutoBePrisma.IForeignField>",
|
|
1138
|
+
value: input.foreignFields
|
|
1139
|
+
})) && input.foreignFields.map((elem, _index12) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
1140
|
+
path: _path + ".foreignFields[" + _index12 + "]",
|
|
1141
|
+
expected: "AutoBePrisma.IForeignField",
|
|
1142
|
+
value: elem
|
|
1143
|
+
})) && _vo4(elem, _path + ".foreignFields[" + _index12 + "]", true && _exceptionable) || _report(_exceptionable, {
|
|
1144
|
+
path: _path + ".foreignFields[" + _index12 + "]",
|
|
1145
|
+
expected: "AutoBePrisma.IForeignField",
|
|
1146
|
+
value: elem
|
|
1147
|
+
})).every(flag => flag) || _report(_exceptionable, {
|
|
1148
|
+
path: _path + ".foreignFields",
|
|
1149
|
+
expected: "Array<AutoBePrisma.IForeignField>",
|
|
1150
|
+
value: input.foreignFields
|
|
1151
|
+
}), (Array.isArray(input.plainFields) || _report(_exceptionable, {
|
|
1152
|
+
path: _path + ".plainFields",
|
|
1153
|
+
expected: "Array<AutoBePrisma.IPlainField>",
|
|
1154
|
+
value: input.plainFields
|
|
1155
|
+
})) && input.plainFields.map((elem, _index13) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
1156
|
+
path: _path + ".plainFields[" + _index13 + "]",
|
|
1157
|
+
expected: "AutoBePrisma.IPlainField",
|
|
1158
|
+
value: elem
|
|
1159
|
+
})) && _vo6(elem, _path + ".plainFields[" + _index13 + "]", true && _exceptionable) || _report(_exceptionable, {
|
|
1160
|
+
path: _path + ".plainFields[" + _index13 + "]",
|
|
1161
|
+
expected: "AutoBePrisma.IPlainField",
|
|
1162
|
+
value: elem
|
|
1163
|
+
})).every(flag => flag) || _report(_exceptionable, {
|
|
1164
|
+
path: _path + ".plainFields",
|
|
1165
|
+
expected: "Array<AutoBePrisma.IPlainField>",
|
|
1166
|
+
value: input.plainFields
|
|
1167
|
+
}), (Array.isArray(input.uniqueIndexes) || _report(_exceptionable, {
|
|
1168
|
+
path: _path + ".uniqueIndexes",
|
|
1169
|
+
expected: "Array<AutoBePrisma.IUniqueIndex>",
|
|
1170
|
+
value: input.uniqueIndexes
|
|
1171
|
+
})) && input.uniqueIndexes.map((elem, _index14) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
1172
|
+
path: _path + ".uniqueIndexes[" + _index14 + "]",
|
|
1173
|
+
expected: "AutoBePrisma.IUniqueIndex",
|
|
1174
|
+
value: elem
|
|
1175
|
+
})) && _vo7(elem, _path + ".uniqueIndexes[" + _index14 + "]", true && _exceptionable) || _report(_exceptionable, {
|
|
1176
|
+
path: _path + ".uniqueIndexes[" + _index14 + "]",
|
|
1177
|
+
expected: "AutoBePrisma.IUniqueIndex",
|
|
1178
|
+
value: elem
|
|
1179
|
+
})).every(flag => flag) || _report(_exceptionable, {
|
|
1180
|
+
path: _path + ".uniqueIndexes",
|
|
1181
|
+
expected: "Array<AutoBePrisma.IUniqueIndex>",
|
|
1182
|
+
value: input.uniqueIndexes
|
|
1183
|
+
}), (Array.isArray(input.plainIndexes) || _report(_exceptionable, {
|
|
1184
|
+
path: _path + ".plainIndexes",
|
|
1185
|
+
expected: "Array<AutoBePrisma.IPlainIndex>",
|
|
1186
|
+
value: input.plainIndexes
|
|
1187
|
+
})) && input.plainIndexes.map((elem, _index15) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
1188
|
+
path: _path + ".plainIndexes[" + _index15 + "]",
|
|
1189
|
+
expected: "AutoBePrisma.IPlainIndex",
|
|
1190
|
+
value: elem
|
|
1191
|
+
})) && _vo8(elem, _path + ".plainIndexes[" + _index15 + "]", true && _exceptionable) || _report(_exceptionable, {
|
|
1192
|
+
path: _path + ".plainIndexes[" + _index15 + "]",
|
|
1193
|
+
expected: "AutoBePrisma.IPlainIndex",
|
|
1194
|
+
value: elem
|
|
1195
|
+
})).every(flag => flag) || _report(_exceptionable, {
|
|
1196
|
+
path: _path + ".plainIndexes",
|
|
1197
|
+
expected: "Array<AutoBePrisma.IPlainIndex>",
|
|
1198
|
+
value: input.plainIndexes
|
|
1199
|
+
}), (Array.isArray(input.ginIndexes) || _report(_exceptionable, {
|
|
1200
|
+
path: _path + ".ginIndexes",
|
|
1201
|
+
expected: "Array<AutoBePrisma.IGinIndex>",
|
|
1202
|
+
value: input.ginIndexes
|
|
1203
|
+
})) && input.ginIndexes.map((elem, _index16) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
1204
|
+
path: _path + ".ginIndexes[" + _index16 + "]",
|
|
1205
|
+
expected: "AutoBePrisma.IGinIndex",
|
|
1206
|
+
value: elem
|
|
1207
|
+
})) && _vo9(elem, _path + ".ginIndexes[" + _index16 + "]", true && _exceptionable) || _report(_exceptionable, {
|
|
1208
|
+
path: _path + ".ginIndexes[" + _index16 + "]",
|
|
1209
|
+
expected: "AutoBePrisma.IGinIndex",
|
|
1210
|
+
value: elem
|
|
1211
|
+
})).every(flag => flag) || _report(_exceptionable, {
|
|
1212
|
+
path: _path + ".ginIndexes",
|
|
1213
|
+
expected: "Array<AutoBePrisma.IGinIndex>",
|
|
1214
|
+
value: input.ginIndexes
|
|
1215
|
+
})].every(flag => flag); const _vo3 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[a-z][a-z0-9_]*$").test(input.name) || _report(_exceptionable, {
|
|
1216
|
+
path: _path + ".name",
|
|
1217
|
+
expected: "string & Pattern<\"^[a-z][a-z0-9_]*$\">",
|
|
1218
|
+
value: input.name
|
|
1219
|
+
})) || _report(_exceptionable, {
|
|
1220
|
+
path: _path + ".name",
|
|
1221
|
+
expected: "(string & Pattern<\"^[a-z][a-z0-9_]*$\">)",
|
|
1222
|
+
value: input.name
|
|
1223
|
+
}), "uuid" === input.type || _report(_exceptionable, {
|
|
1224
|
+
path: _path + ".type",
|
|
1225
|
+
expected: "\"uuid\"",
|
|
1226
|
+
value: input.type
|
|
1227
|
+
}), "string" === typeof input.description || _report(_exceptionable, {
|
|
1228
|
+
path: _path + ".description",
|
|
1229
|
+
expected: "string",
|
|
1230
|
+
value: input.description
|
|
1231
|
+
})].every(flag => flag); const _vo4 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[a-z][a-z0-9_]*$").test(input.name) || _report(_exceptionable, {
|
|
1232
|
+
path: _path + ".name",
|
|
1233
|
+
expected: "string & Pattern<\"^[a-z][a-z0-9_]*$\">",
|
|
1234
|
+
value: input.name
|
|
1235
|
+
})) || _report(_exceptionable, {
|
|
1236
|
+
path: _path + ".name",
|
|
1237
|
+
expected: "(string & Pattern<\"^[a-z][a-z0-9_]*$\">)",
|
|
1238
|
+
value: input.name
|
|
1239
|
+
}), "uuid" === input.type || _report(_exceptionable, {
|
|
1240
|
+
path: _path + ".type",
|
|
1241
|
+
expected: "\"uuid\"",
|
|
1242
|
+
value: input.type
|
|
1243
|
+
}), "string" === typeof input.description || _report(_exceptionable, {
|
|
1244
|
+
path: _path + ".description",
|
|
1245
|
+
expected: "string",
|
|
1246
|
+
value: input.description
|
|
1247
|
+
}), ("object" === typeof input.relation && null !== input.relation || _report(_exceptionable, {
|
|
1248
|
+
path: _path + ".relation",
|
|
1249
|
+
expected: "__type",
|
|
1250
|
+
value: input.relation
|
|
1251
|
+
})) && _vo5(input.relation, _path + ".relation", true && _exceptionable) || _report(_exceptionable, {
|
|
1252
|
+
path: _path + ".relation",
|
|
1253
|
+
expected: "__type",
|
|
1254
|
+
value: input.relation
|
|
1255
|
+
}), "boolean" === typeof input.unique || _report(_exceptionable, {
|
|
1256
|
+
path: _path + ".unique",
|
|
1257
|
+
expected: "boolean",
|
|
1258
|
+
value: input.unique
|
|
1259
|
+
}), "boolean" === typeof input.nullable || _report(_exceptionable, {
|
|
1260
|
+
path: _path + ".nullable",
|
|
1261
|
+
expected: "boolean",
|
|
1262
|
+
value: input.nullable
|
|
1263
|
+
})].every(flag => flag); const _vo5 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[a-zA-Z_][a-zA-Z0-9_]*$").test(input.name) || _report(_exceptionable, {
|
|
1264
|
+
path: _path + ".name",
|
|
1265
|
+
expected: "string & Pattern<\"^[a-zA-Z_][a-zA-Z0-9_]*$\">",
|
|
1266
|
+
value: input.name
|
|
1267
|
+
})) || _report(_exceptionable, {
|
|
1268
|
+
path: _path + ".name",
|
|
1269
|
+
expected: "(string & Pattern<\"^[a-zA-Z_][a-zA-Z0-9_]*$\">)",
|
|
1270
|
+
value: input.name
|
|
1271
|
+
}), "string" === typeof input.targetModel || _report(_exceptionable, {
|
|
1272
|
+
path: _path + ".targetModel",
|
|
1273
|
+
expected: "string",
|
|
1274
|
+
value: input.targetModel
|
|
1275
|
+
})].every(flag => flag); const _vo6 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[a-z][a-z0-9_]*$").test(input.name) || _report(_exceptionable, {
|
|
1276
|
+
path: _path + ".name",
|
|
1277
|
+
expected: "string & Pattern<\"^[a-z][a-z0-9_]*$\">",
|
|
1278
|
+
value: input.name
|
|
1279
|
+
})) || _report(_exceptionable, {
|
|
1280
|
+
path: _path + ".name",
|
|
1281
|
+
expected: "(string & Pattern<\"^[a-z][a-z0-9_]*$\">)",
|
|
1282
|
+
value: input.name
|
|
1283
|
+
}), "string" === input.type || "boolean" === input.type || "uuid" === input.type || "uri" === input.type || "int" === input.type || "double" === input.type || "datetime" === input.type || _report(_exceptionable, {
|
|
1284
|
+
path: _path + ".type",
|
|
1285
|
+
expected: "(\"boolean\" | \"datetime\" | \"double\" | \"int\" | \"string\" | \"uri\" | \"uuid\")",
|
|
1286
|
+
value: input.type
|
|
1287
|
+
}), "string" === typeof input.description || _report(_exceptionable, {
|
|
1288
|
+
path: _path + ".description",
|
|
1289
|
+
expected: "string",
|
|
1290
|
+
value: input.description
|
|
1291
|
+
}), "boolean" === typeof input.nullable || _report(_exceptionable, {
|
|
1292
|
+
path: _path + ".nullable",
|
|
1293
|
+
expected: "boolean",
|
|
1294
|
+
value: input.nullable
|
|
1295
|
+
})].every(flag => flag); const _vo7 = (input, _path, _exceptionable = true) => [(Array.isArray(input.fieldNames) || _report(_exceptionable, {
|
|
1296
|
+
path: _path + ".fieldNames",
|
|
1297
|
+
expected: "(Array<string> & MinItems<1> & UniqueItems<true>)",
|
|
1298
|
+
value: input.fieldNames
|
|
1299
|
+
})) && ((1 <= input.fieldNames.length || _report(_exceptionable, {
|
|
1300
|
+
path: _path + ".fieldNames",
|
|
1301
|
+
expected: "Array<> & MinItems<1>",
|
|
1302
|
+
value: input.fieldNames
|
|
1303
|
+
})) && (__typia_transform__isUniqueItems._isUniqueItems(input.fieldNames) || _report(_exceptionable, {
|
|
1304
|
+
path: _path + ".fieldNames",
|
|
1305
|
+
expected: "Array<> & UniqueItems<true>",
|
|
1306
|
+
value: input.fieldNames
|
|
1307
|
+
})) && input.fieldNames.map((elem, _index17) => "string" === typeof elem || _report(_exceptionable, {
|
|
1308
|
+
path: _path + ".fieldNames[" + _index17 + "]",
|
|
1309
|
+
expected: "string",
|
|
1310
|
+
value: elem
|
|
1311
|
+
})).every(flag => flag)) || _report(_exceptionable, {
|
|
1312
|
+
path: _path + ".fieldNames",
|
|
1313
|
+
expected: "(Array<string> & MinItems<1> & UniqueItems<true>)",
|
|
1314
|
+
value: input.fieldNames
|
|
1315
|
+
}), true === input.unique || _report(_exceptionable, {
|
|
1316
|
+
path: _path + ".unique",
|
|
1317
|
+
expected: "true",
|
|
1318
|
+
value: input.unique
|
|
1319
|
+
})].every(flag => flag); const _vo8 = (input, _path, _exceptionable = true) => [(Array.isArray(input.fieldNames) || _report(_exceptionable, {
|
|
1320
|
+
path: _path + ".fieldNames",
|
|
1321
|
+
expected: "(Array<string> & MinItems<1> & UniqueItems<true>)",
|
|
1322
|
+
value: input.fieldNames
|
|
1323
|
+
})) && ((1 <= input.fieldNames.length || _report(_exceptionable, {
|
|
1324
|
+
path: _path + ".fieldNames",
|
|
1325
|
+
expected: "Array<> & MinItems<1>",
|
|
1326
|
+
value: input.fieldNames
|
|
1327
|
+
})) && (__typia_transform__isUniqueItems._isUniqueItems(input.fieldNames) || _report(_exceptionable, {
|
|
1328
|
+
path: _path + ".fieldNames",
|
|
1329
|
+
expected: "Array<> & UniqueItems<true>",
|
|
1330
|
+
value: input.fieldNames
|
|
1331
|
+
})) && input.fieldNames.map((elem, _index18) => "string" === typeof elem || _report(_exceptionable, {
|
|
1332
|
+
path: _path + ".fieldNames[" + _index18 + "]",
|
|
1333
|
+
expected: "string",
|
|
1334
|
+
value: elem
|
|
1335
|
+
})).every(flag => flag)) || _report(_exceptionable, {
|
|
1336
|
+
path: _path + ".fieldNames",
|
|
1337
|
+
expected: "(Array<string> & MinItems<1> & UniqueItems<true>)",
|
|
1338
|
+
value: input.fieldNames
|
|
1339
|
+
})].every(flag => flag); const _vo9 = (input, _path, _exceptionable = true) => ["string" === typeof input.fieldName || _report(_exceptionable, {
|
|
1340
|
+
path: _path + ".fieldName",
|
|
1341
|
+
expected: "string",
|
|
1342
|
+
value: input.fieldName
|
|
1343
|
+
})].every(flag => flag); const __is = input => "object" === typeof input && null !== input && _io0(input); let errors; let _report; return input => {
|
|
1344
|
+
if (false === __is(input)) {
|
|
1345
|
+
errors = [];
|
|
1346
|
+
_report = __typia_transform__validateReport._validateReport(errors);
|
|
1347
|
+
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
|
|
1348
|
+
path: _path + "",
|
|
1349
|
+
expected: "IModifyPrismaSchemaFilesProps",
|
|
1350
|
+
value: input
|
|
1351
|
+
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
1352
|
+
path: _path + "",
|
|
1353
|
+
expected: "IModifyPrismaSchemaFilesProps",
|
|
1354
|
+
value: input
|
|
1355
|
+
}))(input, "$input", true);
|
|
1356
|
+
const success = 0 === errors.length;
|
|
1357
|
+
return success ? {
|
|
1358
|
+
success,
|
|
1359
|
+
data: input
|
|
1360
|
+
} : {
|
|
1361
|
+
success,
|
|
1362
|
+
errors,
|
|
1363
|
+
data: input
|
|
1364
|
+
};
|
|
1365
|
+
}
|
|
1366
|
+
return {
|
|
1367
|
+
success: true,
|
|
1368
|
+
data: input
|
|
1369
|
+
};
|
|
1370
|
+
}; })()
|
|
1371
|
+
}
|
|
1372
|
+
]
|
|
1373
|
+
},
|
|
1374
|
+
claude,
|
|
1375
|
+
llama: claude,
|
|
1376
|
+
deepseek: claude,
|
|
1377
|
+
"3.1": claude,
|
|
1378
|
+
"3.0": {
|
|
1379
|
+
model: "3.0",
|
|
1380
|
+
options: {
|
|
1381
|
+
constraint: true,
|
|
1382
|
+
recursive: 3,
|
|
1383
|
+
separate: null
|
|
1384
|
+
},
|
|
1385
|
+
functions: [
|
|
1386
|
+
{
|
|
1387
|
+
name: "correctPrismaSchemaFiles",
|
|
1388
|
+
parameters: {
|
|
1389
|
+
type: "object",
|
|
1390
|
+
properties: {
|
|
1391
|
+
planning: {
|
|
1392
|
+
type: "string",
|
|
1393
|
+
title: "Detailed execution plan for fixing AutoBePrisma validation errors",
|
|
1394
|
+
description: "Detailed execution plan for fixing AutoBePrisma validation errors.\n\n\uD83C\uDFAF Purpose: Enable systematic reasoning and step-by-step error resolution\napproach for structured schema validation issues\n\n\uD83D\uDCCB Required Planning Content:\n\n1. **Error Analysis Summary**\n\n - List all validation errors from IAutoBePrismaValidation.IError[] array\n - Categorize errors by type (duplications, references, types, indexes)\n - Identify root causes and error interdependencies\n2. **Fix Strategy Overview**\n\n - Prioritize fixes based on dependencies (fix duplications first)\n - Outline minimal changes needed for each validation error\n - Identify potential impact on other models/relationships\n3. **Step-by-Step Fix Plan**\n\n - Model-by-model modification plan with specific changes\n - Exact field additions, removals, or renames required\n - Reference updates needed for renamed elements\n - Index corrections to comply with validation rules\n4. **Preservation Checklist**\n\n - Confirm which descriptions and business logic must be preserved\n - List relationships and constraints to maintain unchanged\n - Identify cross-model dependencies that must remain intact\n5. **Risk Assessment**\n\n - Potential side effects of each planned fix\n - Validation points to check after applying corrections\n - Ensure no new validation errors are introduced\n\n\uD83D\uDCA1 Example Planning Structure:\n\n ## Error Analysis\n - Error 1: Duplicate field 'name' in shopping_customers model\n - Error 2: Invalid targetModel 'shopping_customer' should be 'shopping_customers'\n\n ## Fix Strategy\n 1. Remove duplicate 'name' field (keep the more detailed one)\n 2. Update foreign key references to use correct plural model name\n\n ## Detailed Steps\n 1. shopping_customers model: Remove second 'name' field from plainFields\n 2. shopping_orders model: Update targetModel from 'shopping_customer' to 'shopping_customers'\n\n ## Preservation Notes\n - Keep business descriptions for remaining 'name' field\n - Maintain all relationship semantics\n - Preserve all indexes and constraints"
|
|
1395
|
+
},
|
|
1396
|
+
files: {
|
|
1397
|
+
type: "array",
|
|
1398
|
+
items: {
|
|
1399
|
+
type: "object",
|
|
1400
|
+
properties: {
|
|
1401
|
+
filename: {
|
|
1402
|
+
type: "string",
|
|
1403
|
+
pattern: "^[a-zA-Z0-9._-]+\\.prisma$",
|
|
1404
|
+
title: "Name of the schema file to be generated",
|
|
1405
|
+
description: "Name of the schema file to be generated.\n\nShould follow the naming convention: \"schema-{number}-{domain}.prisma\"\nExamples: \"schema-02-systematic.prisma\", \"schema-03-actors.prisma\" The\nnumber indicates the dependency order for schema generation."
|
|
1406
|
+
},
|
|
1407
|
+
namespace: {
|
|
1408
|
+
type: "string",
|
|
1409
|
+
title: "Business domain namespace that groups related models",
|
|
1410
|
+
description: "Business domain namespace that groups related models.\n\nUsed in Prisma documentation comments as \"@\\namespace directive\".\nExamples from uploaded schemas: \"Systematic\", \"Actors\", \"Sales\", \"Carts\",\n\"Orders\", \"Coupons\", \"Coins\", \"Inquiries\", \"Favorites\", \"Articles\""
|
|
1411
|
+
},
|
|
1412
|
+
models: {
|
|
1413
|
+
type: "array",
|
|
1414
|
+
items: {
|
|
1415
|
+
type: "object",
|
|
1416
|
+
properties: {
|
|
1417
|
+
name: {
|
|
1418
|
+
type: "string",
|
|
1419
|
+
pattern: "^[a-z][a-z0-9_]*$",
|
|
1420
|
+
title: "Name of the Prisma model (database table name)",
|
|
1421
|
+
description: "Name of the Prisma model (database table name).\n\nShould follow snake_case convention with domain prefix. Examples:\n\"shopping_customers\", \"shopping_sale_snapshots\", \"bbs_articles\"\nMaterialized views use \"mv_\" prefix: \"mv_shopping_sale_last_snapshots\""
|
|
1422
|
+
},
|
|
1423
|
+
description: {
|
|
1424
|
+
type: "string",
|
|
1425
|
+
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 Example:\n \"Customer information, but not a person but a **connection** basis...\""
|
|
1426
|
+
},
|
|
1427
|
+
material: {
|
|
1428
|
+
type: "boolean",
|
|
1429
|
+
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"
|
|
1430
|
+
},
|
|
1431
|
+
primaryField: {
|
|
1432
|
+
type: "object",
|
|
1433
|
+
properties: {
|
|
1434
|
+
name: {
|
|
1435
|
+
type: "string",
|
|
1436
|
+
pattern: "^[a-z][a-z0-9_]*$",
|
|
1437
|
+
title: "Name of the primary key field",
|
|
1438
|
+
description: "Name of the primary key field.\n\nConsistently named \"id\" across all models in the uploaded schemas.\nRepresents the unique identifier for each record in the table."
|
|
1439
|
+
},
|
|
1440
|
+
type: {
|
|
1441
|
+
type: "string",
|
|
1442
|
+
"enum": [
|
|
1443
|
+
"uuid"
|
|
1444
|
+
],
|
|
1445
|
+
title: "Data type of the primary key field",
|
|
1446
|
+
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."
|
|
1447
|
+
},
|
|
1448
|
+
description: {
|
|
1449
|
+
type: "string",
|
|
1450
|
+
title: "Description of the primary key field's purpose",
|
|
1451
|
+
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."
|
|
1452
|
+
}
|
|
1453
|
+
},
|
|
1454
|
+
required: [
|
|
1455
|
+
"name",
|
|
1456
|
+
"type",
|
|
1457
|
+
"description"
|
|
1458
|
+
],
|
|
1459
|
+
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.\n\n------------------------------\n\nDescription of the current {@link AutoBePrisma.IPrimaryField} type:\n\n> Interface representing the primary key field of a Prisma model.\n> \n> All models in the uploaded schemas use UUID as primary key for better\n> distributed system compatibility and security (no sequential ID exposure).",
|
|
1460
|
+
additionalProperties: false
|
|
1461
|
+
},
|
|
1462
|
+
foreignFields: {
|
|
1463
|
+
type: "array",
|
|
1464
|
+
items: {
|
|
1465
|
+
type: "object",
|
|
1466
|
+
properties: {
|
|
1467
|
+
name: {
|
|
1468
|
+
type: "string",
|
|
1469
|
+
pattern: "^[a-z][a-z0-9_]*$",
|
|
1470
|
+
title: "Name of the foreign key field",
|
|
1471
|
+
description: "Name of the foreign key field.\n\nFollows convention: \"{target_model_name_without_prefix}_id\" Examples:\n\"shopping_customer_id\", \"bbs_article_id\", \"attachment_file_id\" For\nself-references: \"parent_id\" (e.g., in hierarchical structures)"
|
|
1472
|
+
},
|
|
1473
|
+
type: {
|
|
1474
|
+
type: "string",
|
|
1475
|
+
"enum": [
|
|
1476
|
+
"uuid"
|
|
1477
|
+
],
|
|
1478
|
+
title: "Data type of the foreign key field",
|
|
1479
|
+
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."
|
|
1480
|
+
},
|
|
1481
|
+
description: {
|
|
1482
|
+
type: "string",
|
|
1483
|
+
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."
|
|
1484
|
+
},
|
|
1485
|
+
relation: {
|
|
1486
|
+
type: "object",
|
|
1487
|
+
properties: {
|
|
1488
|
+
name: {
|
|
1489
|
+
type: "string",
|
|
1490
|
+
pattern: "^[a-zA-Z_][a-zA-Z0-9_]*$",
|
|
1491
|
+
title: "Name of the relation property in the Prisma model",
|
|
1492
|
+
description: "Name of the relation property in the Prisma model.\n\nUsed to access the related model instance. Usually a descriptive name\nof the relationship. Examples: \"customer\", \"channel\", \"parent\",\n\"snapshot\""
|
|
1493
|
+
},
|
|
1494
|
+
targetModel: {
|
|
1495
|
+
type: "string",
|
|
1496
|
+
title: "Name of the target model being referenced",
|
|
1497
|
+
description: "Name of the target model being referenced.\n\nMust match exactly with an existing model name in the schema. Examples:\n\"shopping_customers\", \"shopping_channels\", \"bbs_articles\""
|
|
1498
|
+
}
|
|
1499
|
+
},
|
|
1500
|
+
required: [
|
|
1501
|
+
"name",
|
|
1502
|
+
"targetModel"
|
|
1503
|
+
],
|
|
1504
|
+
title: "Prisma relation configuration defining the association details",
|
|
1505
|
+
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.",
|
|
1506
|
+
additionalProperties: false
|
|
1507
|
+
},
|
|
1508
|
+
unique: {
|
|
1509
|
+
type: "boolean",
|
|
1510
|
+
title: "Whether this foreign key has a unique constraint",
|
|
1511
|
+
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."
|
|
1512
|
+
},
|
|
1513
|
+
nullable: {
|
|
1514
|
+
type: "boolean",
|
|
1515
|
+
title: "Whether this foreign key can be null (optional relationship)",
|
|
1516
|
+
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."
|
|
1517
|
+
}
|
|
1518
|
+
},
|
|
1519
|
+
required: [
|
|
1520
|
+
"name",
|
|
1521
|
+
"type",
|
|
1522
|
+
"description",
|
|
1523
|
+
"relation",
|
|
1524
|
+
"unique",
|
|
1525
|
+
"nullable"
|
|
1526
|
+
],
|
|
1527
|
+
description: "Description of the current {@link AutoBePrisma.IForeignField} type:\n\n> Interface representing a foreign key field that establishes relationships\n> between models.\n> \n> Foreign keys create associations between models, enabling relational data\n> modeling. They can represent 1:1, 1:N, or participate in M:N relationships\n> through junction tables.",
|
|
1528
|
+
additionalProperties: false
|
|
1529
|
+
},
|
|
1530
|
+
title: "Array of foreign key fields that reference other models",
|
|
1531
|
+
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."
|
|
1532
|
+
},
|
|
1533
|
+
plainFields: {
|
|
1534
|
+
type: "array",
|
|
1535
|
+
items: {
|
|
1536
|
+
type: "object",
|
|
1537
|
+
properties: {
|
|
1538
|
+
name: {
|
|
1539
|
+
type: "string",
|
|
1540
|
+
pattern: "^[a-z][a-z0-9_]*$",
|
|
1541
|
+
title: "Name of the field in the database table",
|
|
1542
|
+
description: "Name of the field in the database table.\n\nShould use snake_case convention. Common patterns from uploaded schemas:\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"
|
|
1543
|
+
},
|
|
1544
|
+
type: {
|
|
1545
|
+
type: "string",
|
|
1546
|
+
"enum": [
|
|
1547
|
+
"string",
|
|
1548
|
+
"boolean",
|
|
1549
|
+
"uuid",
|
|
1550
|
+
"uri",
|
|
1551
|
+
"int",
|
|
1552
|
+
"double",
|
|
1553
|
+
"datetime"
|
|
1554
|
+
],
|
|
1555
|
+
title: "Data type of the field for Prisma schema generation",
|
|
1556
|
+
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- Date: Date-only values (rare, mostly for business dates)\n- Datetime: Timestamp fields with date and time"
|
|
1557
|
+
},
|
|
1558
|
+
description: {
|
|
1559
|
+
type: "string",
|
|
1560
|
+
title: "Description explaining the business purpose and usage of this field",
|
|
1561
|
+
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 Example: \"Amount of cash payment.\" or\n \"Whether the unit is required or not.\""
|
|
1562
|
+
},
|
|
1563
|
+
nullable: {
|
|
1564
|
+
type: "boolean",
|
|
1565
|
+
title: "Whether this field can contain null values",
|
|
1566
|
+
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."
|
|
1567
|
+
}
|
|
1568
|
+
},
|
|
1569
|
+
required: [
|
|
1570
|
+
"name",
|
|
1571
|
+
"type",
|
|
1572
|
+
"description",
|
|
1573
|
+
"nullable"
|
|
1574
|
+
],
|
|
1575
|
+
description: "Description of the current {@link AutoBePrisma.IPlainField} type:\n\n> Interface representing a regular data field that stores business\n> information.\n> \n> These fields contain the actual business data like names, amounts,\n> timestamps, flags, descriptions, and other domain-specific information.",
|
|
1576
|
+
additionalProperties: false
|
|
1577
|
+
},
|
|
1578
|
+
title: "Array of regular data fields that don't reference other models",
|
|
1579
|
+
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."
|
|
1580
|
+
},
|
|
1581
|
+
uniqueIndexes: {
|
|
1582
|
+
type: "array",
|
|
1583
|
+
items: {
|
|
1584
|
+
type: "object",
|
|
1585
|
+
properties: {
|
|
1586
|
+
fieldNames: {
|
|
1587
|
+
type: "array",
|
|
1588
|
+
items: {
|
|
1589
|
+
type: "string"
|
|
1590
|
+
},
|
|
1591
|
+
minItems: 1,
|
|
1592
|
+
uniqueItems: true,
|
|
1593
|
+
title: "Array of field names that together form the unique constraint",
|
|
1594
|
+
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\"]"
|
|
1595
|
+
},
|
|
1596
|
+
unique: {
|
|
1597
|
+
type: "boolean",
|
|
1598
|
+
"enum": [
|
|
1599
|
+
true
|
|
1600
|
+
],
|
|
1601
|
+
title: "Explicit marker indicating this is a unique index",
|
|
1602
|
+
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\"."
|
|
1603
|
+
}
|
|
1604
|
+
},
|
|
1605
|
+
required: [
|
|
1606
|
+
"fieldNames",
|
|
1607
|
+
"unique"
|
|
1608
|
+
],
|
|
1609
|
+
description: "Description of the current {@link AutoBePrisma.IUniqueIndex} type:\n\n> Interface representing a unique index constraint on one or more fields.\n> \n> Unique indexes enforce data integrity by ensuring no duplicate values exist\n> for the specified field combination. Essential for business rules that\n> require uniqueness like email addresses, codes, or composite keys.",
|
|
1610
|
+
additionalProperties: false
|
|
1611
|
+
},
|
|
1612
|
+
title: "Array of unique indexes for enforcing data integrity constraints",
|
|
1613
|
+
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)."
|
|
1614
|
+
},
|
|
1615
|
+
plainIndexes: {
|
|
1616
|
+
type: "array",
|
|
1617
|
+
items: {
|
|
1618
|
+
type: "object",
|
|
1619
|
+
properties: {
|
|
1620
|
+
fieldNames: {
|
|
1621
|
+
type: "array",
|
|
1622
|
+
items: {
|
|
1623
|
+
type: "string"
|
|
1624
|
+
},
|
|
1625
|
+
minItems: 1,
|
|
1626
|
+
uniqueItems: true,
|
|
1627
|
+
title: "Array of field names to include in the performance index",
|
|
1628
|
+
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\"]"
|
|
1629
|
+
}
|
|
1630
|
+
},
|
|
1631
|
+
required: [
|
|
1632
|
+
"fieldNames"
|
|
1633
|
+
],
|
|
1634
|
+
description: "Description of the current {@link AutoBePrisma.IPlainIndex} type:\n\n> Interface representing a regular (non-unique) index for query performance.\n> \n> Regular indexes speed up database queries by creating optimized data\n> structures for common search patterns. Essential for foreign keys, date\n> ranges, and frequently filtered fields.",
|
|
1635
|
+
additionalProperties: false
|
|
1636
|
+
},
|
|
1637
|
+
title: "Array of regular indexes for query performance optimization",
|
|
1638
|
+
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."
|
|
1639
|
+
},
|
|
1640
|
+
ginIndexes: {
|
|
1641
|
+
type: "array",
|
|
1642
|
+
items: {
|
|
1643
|
+
type: "object",
|
|
1644
|
+
properties: {
|
|
1645
|
+
fieldName: {
|
|
1646
|
+
type: "string",
|
|
1647
|
+
title: "Name of the text field to index for full-text search capabilities",
|
|
1648
|
+
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."
|
|
1649
|
+
}
|
|
1650
|
+
},
|
|
1651
|
+
required: [
|
|
1652
|
+
"fieldName"
|
|
1653
|
+
],
|
|
1654
|
+
description: "Description of the current {@link AutoBePrisma.IGinIndex} type:\n\n> Interface representing a GIN (Generalized Inverted Index) for full-text\n> search.\n> \n> GIN indexes enable advanced PostgreSQL text search capabilities including\n> fuzzy matching and partial text search using trigram operations. Essential\n> for user-facing search features on text content.",
|
|
1655
|
+
additionalProperties: false
|
|
1656
|
+
},
|
|
1657
|
+
title: "Array of GIN (Generalized Inverted Index) indexes for full-text search",
|
|
1658
|
+
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."
|
|
1659
|
+
}
|
|
1660
|
+
},
|
|
1661
|
+
required: [
|
|
1662
|
+
"name",
|
|
1663
|
+
"description",
|
|
1664
|
+
"material",
|
|
1665
|
+
"primaryField",
|
|
1666
|
+
"foreignFields",
|
|
1667
|
+
"plainFields",
|
|
1668
|
+
"uniqueIndexes",
|
|
1669
|
+
"plainIndexes",
|
|
1670
|
+
"ginIndexes"
|
|
1671
|
+
],
|
|
1672
|
+
description: "Description of the current {@link AutoBePrisma.IModel} type:\n\n> Interface representing a single Prisma model (database table).\n> \n> Based 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_)",
|
|
1673
|
+
additionalProperties: false
|
|
1674
|
+
},
|
|
1675
|
+
title: "Array of Prisma models (database tables) within this domain",
|
|
1676
|
+
description: "Array of Prisma models (database tables) within this domain.\n\nEach model represents a business entity or concept within the namespace.\nModels can reference each other through foreign key relationships."
|
|
1677
|
+
}
|
|
1678
|
+
},
|
|
1679
|
+
required: [
|
|
1680
|
+
"filename",
|
|
1681
|
+
"namespace",
|
|
1682
|
+
"models"
|
|
1683
|
+
],
|
|
1684
|
+
description: "Description of the current {@link AutoBePrisma.IFile} type:\n\n> Interface representing a single Prisma schema file within the application.\n> \n> Each file focuses on a specific business domain and contains related\n> models. File organization follows domain-driven design principles as seen\n> in the uploaded schemas.",
|
|
1685
|
+
additionalProperties: false
|
|
1686
|
+
},
|
|
1687
|
+
description: "Original AutoBePrisma.IApplication structure that contains validation\nerrors and needs correction.\n\n\uD83D\uDCE5 Input Structure:\n\n- Complete IApplication with files array containing validation errors\n- Each file contains models with potential structural issues\n- Errors may include duplications, invalid references, or constraint\n violations\n\n\uD83D\uDD0D Expected Validation Issues:\n\n- Duplicate model names across files\n- Duplicate field/relation names within models\n- Invalid foreign key references to non-existent models\n- Single foreign key fields in index arrays\n- Non-plural model names or invalid naming conventions\n\n\uD83D\uDCDD Application Content Analysis:\n\n- All models with their complete field definitions\n- All relationships with targetModel and targetfield configurations\n- All indexes (unique, plain, GIN) with field references\n- All business descriptions and requirement mappings\n- Cross-file model references and dependencies\n\n\u26A0\uFE0F Processing Notes:\n\n- Structure may contain validation errors that prevent code generation\n- Some models might reference non-existent targets\n- Field names might violate naming conventions\n- Index configurations might include forbidden single foreign keys\n- Business logic and descriptions must be preserved during fixes"
|
|
1688
|
+
}
|
|
1689
|
+
},
|
|
1690
|
+
required: [
|
|
1691
|
+
"planning",
|
|
1692
|
+
"files"
|
|
1693
|
+
],
|
|
1694
|
+
description: "Current Type: {@link IModifyPrismaSchemaFilesProps}",
|
|
1695
|
+
additionalProperties: false
|
|
1696
|
+
},
|
|
1697
|
+
description: "Fixes validation errors in AutoBePrisma.IApplication structure while\npreserving ALL existing business logic and model descriptions.\n\n## Core Rules\n\n1. Fix ONLY validation errors - never remove business descriptions\n2. Apply minimal changes - preserve original design intent\n3. Return COMPLETE corrected structure - no data loss allowed\n4. Maintain referential integrity across all models\n\n## Preservation Requirements\n\n- Keep ALL model and field descriptions\n- Keep business logic and architectural patterns\n- Maintain relationship semantics and cardinality\n- Remove descriptions only when removing duplicate elements\n\n## Fix Strategy\n\n- Resolve structural validation errors without changing business intent\n- Remove duplicate fields/relations while preserving most appropriate ones\n- Fix invalid references and type mismatches\n- Ensure naming conventions and index rules compliance",
|
|
1698
|
+
validate: (() => { const _io0 = input => "string" === typeof input.planning && (Array.isArray(input.files) && input.files.every(elem => "object" === typeof elem && null !== elem && _io1(elem))); const _io1 = input => "string" === typeof input.filename && RegExp("^[a-zA-Z0-9._-]+\\.prisma$").test(input.filename) && "string" === typeof input.namespace && (Array.isArray(input.models) && input.models.every(elem => "object" === typeof elem && null !== elem && _io2(elem))); const _io2 = input => "string" === typeof input.name && RegExp("^[a-z][a-z0-9_]*$").test(input.name) && "string" === typeof input.description && "boolean" === typeof input.material && ("object" === typeof input.primaryField && null !== input.primaryField && _io3(input.primaryField)) && (Array.isArray(input.foreignFields) && input.foreignFields.every(elem => "object" === typeof elem && null !== elem && _io4(elem))) && (Array.isArray(input.plainFields) && input.plainFields.every(elem => "object" === typeof elem && null !== elem && _io6(elem))) && (Array.isArray(input.uniqueIndexes) && input.uniqueIndexes.every(elem => "object" === typeof elem && null !== elem && _io7(elem))) && (Array.isArray(input.plainIndexes) && input.plainIndexes.every(elem => "object" === typeof elem && null !== elem && _io8(elem))) && (Array.isArray(input.ginIndexes) && input.ginIndexes.every(elem => "object" === typeof elem && null !== elem && _io9(elem))); const _io3 = input => "string" === typeof input.name && RegExp("^[a-z][a-z0-9_]*$").test(input.name) && "uuid" === input.type && "string" === typeof input.description; const _io4 = 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 && _io5(input.relation)) && "boolean" === typeof input.unique && "boolean" === typeof input.nullable; const _io5 = input => "string" === typeof input.name && RegExp("^[a-zA-Z_][a-zA-Z0-9_]*$").test(input.name) && "string" === typeof input.targetModel; const _io6 = 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 _io7 = 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 _io8 = input => Array.isArray(input.fieldNames) && (1 <= input.fieldNames.length && __typia_transform__isUniqueItems._isUniqueItems(input.fieldNames) && input.fieldNames.every(elem => "string" === typeof elem)); const _io9 = input => "string" === typeof input.fieldName; const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.planning || _report(_exceptionable, {
|
|
1699
|
+
path: _path + ".planning",
|
|
1700
|
+
expected: "string",
|
|
1701
|
+
value: input.planning
|
|
1702
|
+
}), (Array.isArray(input.files) || _report(_exceptionable, {
|
|
1703
|
+
path: _path + ".files",
|
|
1704
|
+
expected: "Array<AutoBePrisma.IFile>",
|
|
1705
|
+
value: input.files
|
|
1706
|
+
})) && input.files.map((elem, _index10) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
1707
|
+
path: _path + ".files[" + _index10 + "]",
|
|
1708
|
+
expected: "AutoBePrisma.IFile",
|
|
1709
|
+
value: elem
|
|
1710
|
+
})) && _vo1(elem, _path + ".files[" + _index10 + "]", true && _exceptionable) || _report(_exceptionable, {
|
|
1711
|
+
path: _path + ".files[" + _index10 + "]",
|
|
1712
|
+
expected: "AutoBePrisma.IFile",
|
|
1713
|
+
value: elem
|
|
1714
|
+
})).every(flag => flag) || _report(_exceptionable, {
|
|
1715
|
+
path: _path + ".files",
|
|
1716
|
+
expected: "Array<AutoBePrisma.IFile>",
|
|
1717
|
+
value: input.files
|
|
1718
|
+
})].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => ["string" === typeof input.filename && (RegExp("^[a-zA-Z0-9._-]+\\.prisma$").test(input.filename) || _report(_exceptionable, {
|
|
1719
|
+
path: _path + ".filename",
|
|
1720
|
+
expected: "string & Pattern<\"^[a-zA-Z0-9._-]+\\\\.prisma$\">",
|
|
1721
|
+
value: input.filename
|
|
1722
|
+
})) || _report(_exceptionable, {
|
|
1723
|
+
path: _path + ".filename",
|
|
1724
|
+
expected: "(string & Pattern<\"^[a-zA-Z0-9._-]+\\\\.prisma$\">)",
|
|
1725
|
+
value: input.filename
|
|
1726
|
+
}), "string" === typeof input.namespace || _report(_exceptionable, {
|
|
1727
|
+
path: _path + ".namespace",
|
|
1728
|
+
expected: "string",
|
|
1729
|
+
value: input.namespace
|
|
1730
|
+
}), (Array.isArray(input.models) || _report(_exceptionable, {
|
|
1731
|
+
path: _path + ".models",
|
|
1732
|
+
expected: "Array<AutoBePrisma.IModel>",
|
|
1733
|
+
value: input.models
|
|
1734
|
+
})) && input.models.map((elem, _index11) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
1735
|
+
path: _path + ".models[" + _index11 + "]",
|
|
1736
|
+
expected: "AutoBePrisma.IModel",
|
|
1737
|
+
value: elem
|
|
1738
|
+
})) && _vo2(elem, _path + ".models[" + _index11 + "]", true && _exceptionable) || _report(_exceptionable, {
|
|
1739
|
+
path: _path + ".models[" + _index11 + "]",
|
|
1740
|
+
expected: "AutoBePrisma.IModel",
|
|
1741
|
+
value: elem
|
|
1742
|
+
})).every(flag => flag) || _report(_exceptionable, {
|
|
1743
|
+
path: _path + ".models",
|
|
1744
|
+
expected: "Array<AutoBePrisma.IModel>",
|
|
1745
|
+
value: input.models
|
|
1746
|
+
})].every(flag => flag); const _vo2 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[a-z][a-z0-9_]*$").test(input.name) || _report(_exceptionable, {
|
|
1747
|
+
path: _path + ".name",
|
|
1748
|
+
expected: "string & Pattern<\"^[a-z][a-z0-9_]*$\">",
|
|
1749
|
+
value: input.name
|
|
1750
|
+
})) || _report(_exceptionable, {
|
|
1751
|
+
path: _path + ".name",
|
|
1752
|
+
expected: "(string & Pattern<\"^[a-z][a-z0-9_]*$\">)",
|
|
1753
|
+
value: input.name
|
|
1754
|
+
}), "string" === typeof input.description || _report(_exceptionable, {
|
|
1755
|
+
path: _path + ".description",
|
|
1756
|
+
expected: "string",
|
|
1757
|
+
value: input.description
|
|
1758
|
+
}), "boolean" === typeof input.material || _report(_exceptionable, {
|
|
1759
|
+
path: _path + ".material",
|
|
1760
|
+
expected: "boolean",
|
|
1761
|
+
value: input.material
|
|
1762
|
+
}), ("object" === typeof input.primaryField && null !== input.primaryField || _report(_exceptionable, {
|
|
1763
|
+
path: _path + ".primaryField",
|
|
1764
|
+
expected: "AutoBePrisma.IPrimaryField",
|
|
1765
|
+
value: input.primaryField
|
|
1766
|
+
})) && _vo3(input.primaryField, _path + ".primaryField", true && _exceptionable) || _report(_exceptionable, {
|
|
1767
|
+
path: _path + ".primaryField",
|
|
1768
|
+
expected: "AutoBePrisma.IPrimaryField",
|
|
1769
|
+
value: input.primaryField
|
|
1770
|
+
}), (Array.isArray(input.foreignFields) || _report(_exceptionable, {
|
|
1771
|
+
path: _path + ".foreignFields",
|
|
1772
|
+
expected: "Array<AutoBePrisma.IForeignField>",
|
|
1773
|
+
value: input.foreignFields
|
|
1774
|
+
})) && input.foreignFields.map((elem, _index12) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
1775
|
+
path: _path + ".foreignFields[" + _index12 + "]",
|
|
1776
|
+
expected: "AutoBePrisma.IForeignField",
|
|
1777
|
+
value: elem
|
|
1778
|
+
})) && _vo4(elem, _path + ".foreignFields[" + _index12 + "]", true && _exceptionable) || _report(_exceptionable, {
|
|
1779
|
+
path: _path + ".foreignFields[" + _index12 + "]",
|
|
1780
|
+
expected: "AutoBePrisma.IForeignField",
|
|
1781
|
+
value: elem
|
|
1782
|
+
})).every(flag => flag) || _report(_exceptionable, {
|
|
1783
|
+
path: _path + ".foreignFields",
|
|
1784
|
+
expected: "Array<AutoBePrisma.IForeignField>",
|
|
1785
|
+
value: input.foreignFields
|
|
1786
|
+
}), (Array.isArray(input.plainFields) || _report(_exceptionable, {
|
|
1787
|
+
path: _path + ".plainFields",
|
|
1788
|
+
expected: "Array<AutoBePrisma.IPlainField>",
|
|
1789
|
+
value: input.plainFields
|
|
1790
|
+
})) && input.plainFields.map((elem, _index13) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
1791
|
+
path: _path + ".plainFields[" + _index13 + "]",
|
|
1792
|
+
expected: "AutoBePrisma.IPlainField",
|
|
1793
|
+
value: elem
|
|
1794
|
+
})) && _vo6(elem, _path + ".plainFields[" + _index13 + "]", true && _exceptionable) || _report(_exceptionable, {
|
|
1795
|
+
path: _path + ".plainFields[" + _index13 + "]",
|
|
1796
|
+
expected: "AutoBePrisma.IPlainField",
|
|
1797
|
+
value: elem
|
|
1798
|
+
})).every(flag => flag) || _report(_exceptionable, {
|
|
1799
|
+
path: _path + ".plainFields",
|
|
1800
|
+
expected: "Array<AutoBePrisma.IPlainField>",
|
|
1801
|
+
value: input.plainFields
|
|
1802
|
+
}), (Array.isArray(input.uniqueIndexes) || _report(_exceptionable, {
|
|
1803
|
+
path: _path + ".uniqueIndexes",
|
|
1804
|
+
expected: "Array<AutoBePrisma.IUniqueIndex>",
|
|
1805
|
+
value: input.uniqueIndexes
|
|
1806
|
+
})) && input.uniqueIndexes.map((elem, _index14) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
1807
|
+
path: _path + ".uniqueIndexes[" + _index14 + "]",
|
|
1808
|
+
expected: "AutoBePrisma.IUniqueIndex",
|
|
1809
|
+
value: elem
|
|
1810
|
+
})) && _vo7(elem, _path + ".uniqueIndexes[" + _index14 + "]", true && _exceptionable) || _report(_exceptionable, {
|
|
1811
|
+
path: _path + ".uniqueIndexes[" + _index14 + "]",
|
|
1812
|
+
expected: "AutoBePrisma.IUniqueIndex",
|
|
1813
|
+
value: elem
|
|
1814
|
+
})).every(flag => flag) || _report(_exceptionable, {
|
|
1815
|
+
path: _path + ".uniqueIndexes",
|
|
1816
|
+
expected: "Array<AutoBePrisma.IUniqueIndex>",
|
|
1817
|
+
value: input.uniqueIndexes
|
|
1818
|
+
}), (Array.isArray(input.plainIndexes) || _report(_exceptionable, {
|
|
1819
|
+
path: _path + ".plainIndexes",
|
|
1820
|
+
expected: "Array<AutoBePrisma.IPlainIndex>",
|
|
1821
|
+
value: input.plainIndexes
|
|
1822
|
+
})) && input.plainIndexes.map((elem, _index15) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
1823
|
+
path: _path + ".plainIndexes[" + _index15 + "]",
|
|
1824
|
+
expected: "AutoBePrisma.IPlainIndex",
|
|
1825
|
+
value: elem
|
|
1826
|
+
})) && _vo8(elem, _path + ".plainIndexes[" + _index15 + "]", true && _exceptionable) || _report(_exceptionable, {
|
|
1827
|
+
path: _path + ".plainIndexes[" + _index15 + "]",
|
|
1828
|
+
expected: "AutoBePrisma.IPlainIndex",
|
|
1829
|
+
value: elem
|
|
1830
|
+
})).every(flag => flag) || _report(_exceptionable, {
|
|
1831
|
+
path: _path + ".plainIndexes",
|
|
1832
|
+
expected: "Array<AutoBePrisma.IPlainIndex>",
|
|
1833
|
+
value: input.plainIndexes
|
|
1834
|
+
}), (Array.isArray(input.ginIndexes) || _report(_exceptionable, {
|
|
1835
|
+
path: _path + ".ginIndexes",
|
|
1836
|
+
expected: "Array<AutoBePrisma.IGinIndex>",
|
|
1837
|
+
value: input.ginIndexes
|
|
1838
|
+
})) && input.ginIndexes.map((elem, _index16) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
1839
|
+
path: _path + ".ginIndexes[" + _index16 + "]",
|
|
1840
|
+
expected: "AutoBePrisma.IGinIndex",
|
|
1841
|
+
value: elem
|
|
1842
|
+
})) && _vo9(elem, _path + ".ginIndexes[" + _index16 + "]", true && _exceptionable) || _report(_exceptionable, {
|
|
1843
|
+
path: _path + ".ginIndexes[" + _index16 + "]",
|
|
1844
|
+
expected: "AutoBePrisma.IGinIndex",
|
|
1845
|
+
value: elem
|
|
1846
|
+
})).every(flag => flag) || _report(_exceptionable, {
|
|
1847
|
+
path: _path + ".ginIndexes",
|
|
1848
|
+
expected: "Array<AutoBePrisma.IGinIndex>",
|
|
1849
|
+
value: input.ginIndexes
|
|
1850
|
+
})].every(flag => flag); const _vo3 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[a-z][a-z0-9_]*$").test(input.name) || _report(_exceptionable, {
|
|
1851
|
+
path: _path + ".name",
|
|
1852
|
+
expected: "string & Pattern<\"^[a-z][a-z0-9_]*$\">",
|
|
1853
|
+
value: input.name
|
|
1854
|
+
})) || _report(_exceptionable, {
|
|
1855
|
+
path: _path + ".name",
|
|
1856
|
+
expected: "(string & Pattern<\"^[a-z][a-z0-9_]*$\">)",
|
|
1857
|
+
value: input.name
|
|
1858
|
+
}), "uuid" === input.type || _report(_exceptionable, {
|
|
1859
|
+
path: _path + ".type",
|
|
1860
|
+
expected: "\"uuid\"",
|
|
1861
|
+
value: input.type
|
|
1862
|
+
}), "string" === typeof input.description || _report(_exceptionable, {
|
|
1863
|
+
path: _path + ".description",
|
|
1864
|
+
expected: "string",
|
|
1865
|
+
value: input.description
|
|
1866
|
+
})].every(flag => flag); const _vo4 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[a-z][a-z0-9_]*$").test(input.name) || _report(_exceptionable, {
|
|
1867
|
+
path: _path + ".name",
|
|
1868
|
+
expected: "string & Pattern<\"^[a-z][a-z0-9_]*$\">",
|
|
1869
|
+
value: input.name
|
|
1870
|
+
})) || _report(_exceptionable, {
|
|
1871
|
+
path: _path + ".name",
|
|
1872
|
+
expected: "(string & Pattern<\"^[a-z][a-z0-9_]*$\">)",
|
|
1873
|
+
value: input.name
|
|
1874
|
+
}), "uuid" === input.type || _report(_exceptionable, {
|
|
1875
|
+
path: _path + ".type",
|
|
1876
|
+
expected: "\"uuid\"",
|
|
1877
|
+
value: input.type
|
|
1878
|
+
}), "string" === typeof input.description || _report(_exceptionable, {
|
|
1879
|
+
path: _path + ".description",
|
|
1880
|
+
expected: "string",
|
|
1881
|
+
value: input.description
|
|
1882
|
+
}), ("object" === typeof input.relation && null !== input.relation || _report(_exceptionable, {
|
|
1883
|
+
path: _path + ".relation",
|
|
1884
|
+
expected: "__type",
|
|
1885
|
+
value: input.relation
|
|
1886
|
+
})) && _vo5(input.relation, _path + ".relation", true && _exceptionable) || _report(_exceptionable, {
|
|
1887
|
+
path: _path + ".relation",
|
|
1888
|
+
expected: "__type",
|
|
1889
|
+
value: input.relation
|
|
1890
|
+
}), "boolean" === typeof input.unique || _report(_exceptionable, {
|
|
1891
|
+
path: _path + ".unique",
|
|
1892
|
+
expected: "boolean",
|
|
1893
|
+
value: input.unique
|
|
1894
|
+
}), "boolean" === typeof input.nullable || _report(_exceptionable, {
|
|
1895
|
+
path: _path + ".nullable",
|
|
1896
|
+
expected: "boolean",
|
|
1897
|
+
value: input.nullable
|
|
1898
|
+
})].every(flag => flag); const _vo5 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[a-zA-Z_][a-zA-Z0-9_]*$").test(input.name) || _report(_exceptionable, {
|
|
1899
|
+
path: _path + ".name",
|
|
1900
|
+
expected: "string & Pattern<\"^[a-zA-Z_][a-zA-Z0-9_]*$\">",
|
|
1901
|
+
value: input.name
|
|
1902
|
+
})) || _report(_exceptionable, {
|
|
1903
|
+
path: _path + ".name",
|
|
1904
|
+
expected: "(string & Pattern<\"^[a-zA-Z_][a-zA-Z0-9_]*$\">)",
|
|
1905
|
+
value: input.name
|
|
1906
|
+
}), "string" === typeof input.targetModel || _report(_exceptionable, {
|
|
1907
|
+
path: _path + ".targetModel",
|
|
1908
|
+
expected: "string",
|
|
1909
|
+
value: input.targetModel
|
|
1910
|
+
})].every(flag => flag); const _vo6 = (input, _path, _exceptionable = true) => ["string" === typeof input.name && (RegExp("^[a-z][a-z0-9_]*$").test(input.name) || _report(_exceptionable, {
|
|
1911
|
+
path: _path + ".name",
|
|
1912
|
+
expected: "string & Pattern<\"^[a-z][a-z0-9_]*$\">",
|
|
1913
|
+
value: input.name
|
|
1914
|
+
})) || _report(_exceptionable, {
|
|
1915
|
+
path: _path + ".name",
|
|
1916
|
+
expected: "(string & Pattern<\"^[a-z][a-z0-9_]*$\">)",
|
|
1917
|
+
value: input.name
|
|
1918
|
+
}), "string" === input.type || "boolean" === input.type || "uuid" === input.type || "uri" === input.type || "int" === input.type || "double" === input.type || "datetime" === input.type || _report(_exceptionable, {
|
|
1919
|
+
path: _path + ".type",
|
|
1920
|
+
expected: "(\"boolean\" | \"datetime\" | \"double\" | \"int\" | \"string\" | \"uri\" | \"uuid\")",
|
|
1921
|
+
value: input.type
|
|
1922
|
+
}), "string" === typeof input.description || _report(_exceptionable, {
|
|
1923
|
+
path: _path + ".description",
|
|
1924
|
+
expected: "string",
|
|
1925
|
+
value: input.description
|
|
1926
|
+
}), "boolean" === typeof input.nullable || _report(_exceptionable, {
|
|
1927
|
+
path: _path + ".nullable",
|
|
1928
|
+
expected: "boolean",
|
|
1929
|
+
value: input.nullable
|
|
1930
|
+
})].every(flag => flag); const _vo7 = (input, _path, _exceptionable = true) => [(Array.isArray(input.fieldNames) || _report(_exceptionable, {
|
|
1931
|
+
path: _path + ".fieldNames",
|
|
1932
|
+
expected: "(Array<string> & MinItems<1> & UniqueItems<true>)",
|
|
1933
|
+
value: input.fieldNames
|
|
1934
|
+
})) && ((1 <= input.fieldNames.length || _report(_exceptionable, {
|
|
1935
|
+
path: _path + ".fieldNames",
|
|
1936
|
+
expected: "Array<> & MinItems<1>",
|
|
1937
|
+
value: input.fieldNames
|
|
1938
|
+
})) && (__typia_transform__isUniqueItems._isUniqueItems(input.fieldNames) || _report(_exceptionable, {
|
|
1939
|
+
path: _path + ".fieldNames",
|
|
1940
|
+
expected: "Array<> & UniqueItems<true>",
|
|
1941
|
+
value: input.fieldNames
|
|
1942
|
+
})) && input.fieldNames.map((elem, _index17) => "string" === typeof elem || _report(_exceptionable, {
|
|
1943
|
+
path: _path + ".fieldNames[" + _index17 + "]",
|
|
1944
|
+
expected: "string",
|
|
1945
|
+
value: elem
|
|
1946
|
+
})).every(flag => flag)) || _report(_exceptionable, {
|
|
1947
|
+
path: _path + ".fieldNames",
|
|
1948
|
+
expected: "(Array<string> & MinItems<1> & UniqueItems<true>)",
|
|
1949
|
+
value: input.fieldNames
|
|
1950
|
+
}), true === input.unique || _report(_exceptionable, {
|
|
1951
|
+
path: _path + ".unique",
|
|
1952
|
+
expected: "true",
|
|
1953
|
+
value: input.unique
|
|
1954
|
+
})].every(flag => flag); const _vo8 = (input, _path, _exceptionable = true) => [(Array.isArray(input.fieldNames) || _report(_exceptionable, {
|
|
1955
|
+
path: _path + ".fieldNames",
|
|
1956
|
+
expected: "(Array<string> & MinItems<1> & UniqueItems<true>)",
|
|
1957
|
+
value: input.fieldNames
|
|
1958
|
+
})) && ((1 <= input.fieldNames.length || _report(_exceptionable, {
|
|
1959
|
+
path: _path + ".fieldNames",
|
|
1960
|
+
expected: "Array<> & MinItems<1>",
|
|
1961
|
+
value: input.fieldNames
|
|
1962
|
+
})) && (__typia_transform__isUniqueItems._isUniqueItems(input.fieldNames) || _report(_exceptionable, {
|
|
1963
|
+
path: _path + ".fieldNames",
|
|
1964
|
+
expected: "Array<> & UniqueItems<true>",
|
|
1965
|
+
value: input.fieldNames
|
|
1966
|
+
})) && input.fieldNames.map((elem, _index18) => "string" === typeof elem || _report(_exceptionable, {
|
|
1967
|
+
path: _path + ".fieldNames[" + _index18 + "]",
|
|
1968
|
+
expected: "string",
|
|
1969
|
+
value: elem
|
|
1970
|
+
})).every(flag => flag)) || _report(_exceptionable, {
|
|
1971
|
+
path: _path + ".fieldNames",
|
|
1972
|
+
expected: "(Array<string> & MinItems<1> & UniqueItems<true>)",
|
|
1973
|
+
value: input.fieldNames
|
|
1974
|
+
})].every(flag => flag); const _vo9 = (input, _path, _exceptionable = true) => ["string" === typeof input.fieldName || _report(_exceptionable, {
|
|
1975
|
+
path: _path + ".fieldName",
|
|
1976
|
+
expected: "string",
|
|
1977
|
+
value: input.fieldName
|
|
1978
|
+
})].every(flag => flag); const __is = input => "object" === typeof input && null !== input && _io0(input); let errors; let _report; return input => {
|
|
1979
|
+
if (false === __is(input)) {
|
|
1980
|
+
errors = [];
|
|
1981
|
+
_report = __typia_transform__validateReport._validateReport(errors);
|
|
1982
|
+
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
|
|
1983
|
+
path: _path + "",
|
|
1984
|
+
expected: "IModifyPrismaSchemaFilesProps",
|
|
1985
|
+
value: input
|
|
1986
|
+
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
1987
|
+
path: _path + "",
|
|
1988
|
+
expected: "IModifyPrismaSchemaFilesProps",
|
|
1989
|
+
value: input
|
|
1990
|
+
}))(input, "$input", true);
|
|
1991
|
+
const success = 0 === errors.length;
|
|
1992
|
+
return success ? {
|
|
1993
|
+
success,
|
|
1994
|
+
data: input
|
|
1995
|
+
} : {
|
|
1996
|
+
success,
|
|
1997
|
+
errors,
|
|
1998
|
+
data: input
|
|
1999
|
+
};
|
|
2000
|
+
}
|
|
2001
|
+
return {
|
|
2002
|
+
success: true,
|
|
2003
|
+
data: input
|
|
2004
|
+
};
|
|
2005
|
+
}; })()
|
|
2006
|
+
}
|
|
2007
|
+
]
|
|
2008
|
+
},
|
|
2009
|
+
};
|
|
2010
|
+
//# sourceMappingURL=orchestratePrismaCorrect.js.map
|