@autobe/agent 0.3.17 → 0.3.18
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/constants/AutoBeSystemPromptConstant.d.ts +3 -3
- package/lib/index.mjs +159 -152
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrisma.js +2 -47
- package/lib/orchestrate/prisma/orchestratePrisma.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaCompiler.d.ts +1 -3
- package/lib/orchestrate/prisma/orchestratePrismaCompiler.js +103 -106
- package/lib/orchestrate/prisma/orchestratePrismaCompiler.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaSchema.js +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaSchema.js.map +1 -1
- package/lib/orchestrate/prisma/transformPrismaCompilerHistories.d.ts +2 -2
- package/lib/orchestrate/prisma/transformPrismaCompilerHistories.js +22 -24
- package/lib/orchestrate/prisma/transformPrismaCompilerHistories.js.map +1 -1
- package/lib/orchestrate/prisma/transformPrismaHistories.js +1 -1
- package/lib/orchestrate/prisma/transformPrismaHistories.js.map +1 -1
- package/lib/orchestrate/prisma/transformPrismaSchemaHistories.d.ts +6 -2
- package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js +20 -17
- package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js.map +1 -1
- package/package.json +4 -4
- package/src/constants/AutoBeSystemPromptConstant.ts +3 -3
- package/src/orchestrate/prisma/orchestratePrisma.ts +3 -54
- package/src/orchestrate/prisma/orchestratePrismaCompiler.ts +164 -94
- package/src/orchestrate/prisma/orchestratePrismaSchema.ts +4 -2
- package/src/orchestrate/prisma/transformPrismaCompilerHistories.ts +22 -24
- package/src/orchestrate/prisma/transformPrismaSchemaHistories.ts +25 -17
|
@@ -51,18 +51,37 @@ const __typia_transform__validateReport = __importStar(require("typia/lib/intern
|
|
|
51
51
|
const core_1 = require("@agentica/core");
|
|
52
52
|
const typia_1 = __importDefault(require("typia"));
|
|
53
53
|
const assertSchemaModel_1 = require("../../context/assertSchemaModel");
|
|
54
|
+
const StringUtil_1 = require("../../utils/StringUtil");
|
|
54
55
|
const transformPrismaCompilerHistories_1 = require("./transformPrismaCompilerHistories");
|
|
55
|
-
function orchestratePrismaCompiler(
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
function orchestratePrismaCompiler(ctx, files, retry = 5) {
|
|
57
|
+
files["main.prisma"] = MAIN_PRISMA_FILE;
|
|
58
|
+
return step(ctx, files, retry);
|
|
59
|
+
}
|
|
60
|
+
function step(ctx, files, life) {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
var _a, _b, _c;
|
|
63
|
+
// TRY COMPILATION
|
|
64
|
+
const result = yield ctx.compiler.prisma({
|
|
65
|
+
files,
|
|
66
|
+
});
|
|
67
|
+
if (result.type !== "failure" || life <= 0)
|
|
68
|
+
return result;
|
|
69
|
+
// VALIDATION FAILED
|
|
70
|
+
ctx.dispatch({
|
|
71
|
+
type: "prismaValidate",
|
|
72
|
+
schemas: files,
|
|
73
|
+
result,
|
|
74
|
+
step: (_b = (_a = ctx.state().analyze) === null || _a === void 0 ? void 0 : _a.step) !== null && _b !== void 0 ? _b : 0,
|
|
75
|
+
created_at: new Date().toISOString(),
|
|
76
|
+
});
|
|
58
77
|
const pointer = {
|
|
59
|
-
value:
|
|
78
|
+
value: null,
|
|
60
79
|
};
|
|
61
80
|
const agentica = new core_1.MicroAgentica({
|
|
62
81
|
model: ctx.model,
|
|
63
82
|
vendor: ctx.vendor,
|
|
64
|
-
config: Object.assign({}, ((
|
|
65
|
-
histories: (0, transformPrismaCompilerHistories_1.transformPrismaCompilerHistories)(
|
|
83
|
+
config: Object.assign({}, ((_c = ctx.config) !== null && _c !== void 0 ? _c : {})),
|
|
84
|
+
histories: (0, transformPrismaCompilerHistories_1.transformPrismaCompilerHistories)(files, result),
|
|
66
85
|
tokenUsage: ctx.usage(),
|
|
67
86
|
controllers: [
|
|
68
87
|
createApplication({
|
|
@@ -78,62 +97,19 @@ function orchestratePrismaCompiler(ctx_1, files_1) {
|
|
|
78
97
|
event.body.tool_choice = "required";
|
|
79
98
|
}
|
|
80
99
|
});
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
result,
|
|
92
|
-
step: (_e = (_d = ctx.state().analyze) === null || _d === void 0 ? void 0 : _d.step) !== null && _e !== void 0 ? _e : 0,
|
|
93
|
-
created_at: new Date().toISOString(),
|
|
94
|
-
});
|
|
95
|
-
yield agentica.conversate([
|
|
96
|
-
"The Prisma schema files have compilation errors that must be fixed. You MUST provide complete, corrected files.",
|
|
97
|
-
"",
|
|
98
|
-
"============================================== CURRENT FILES ==============================================",
|
|
99
|
-
"",
|
|
100
|
-
...Object.entries((_g = (_f = pointer.value) === null || _f === void 0 ? void 0 : _f.files) !== null && _g !== void 0 ? _g : files).flatMap(([filename, content]) => [`### ${filename} ###`, content, ""]),
|
|
101
|
-
"",
|
|
102
|
-
"============================================== COMPILATION ERRORS ==============================================",
|
|
103
|
-
"",
|
|
104
|
-
result.reason,
|
|
105
|
-
"",
|
|
106
|
-
"============================================== REQUIREMENTS ==============================================",
|
|
107
|
-
"",
|
|
108
|
-
"CRITICAL: You must call the modifyPrismaSchemaFiles function with:",
|
|
109
|
-
"",
|
|
110
|
-
"1. **COMPLETE file contents** - Do NOT truncate or abbreviate any content",
|
|
111
|
-
"2. **ALL files** - Every file from the input must be included in the output",
|
|
112
|
-
"3. **Fixed errors** - Resolve all compilation errors shown above",
|
|
113
|
-
"4. **Preserved structure** - Keep all models, fields, relationships, and comments",
|
|
114
|
-
"5. **Proper syntax** - Ensure valid Prisma schema syntax",
|
|
115
|
-
"",
|
|
116
|
-
"IMPORTANT NOTES:",
|
|
117
|
-
"- Include the ENTIRE content of each file, not summaries or truncated versions",
|
|
118
|
-
"- Maintain all existing relationships between models",
|
|
119
|
-
"- Keep all field definitions, attributes, and indexes",
|
|
120
|
-
"- Preserve all comments and documentation",
|
|
121
|
-
"- Fix ONLY the compilation errors, don't make unnecessary changes",
|
|
122
|
-
"",
|
|
123
|
-
"Example of what NOT to do:",
|
|
124
|
-
"```",
|
|
125
|
-
"// ... (truncated for brevity)",
|
|
126
|
-
"// ... other fields and relationships",
|
|
127
|
-
"// ... unchanged ...",
|
|
128
|
-
"```",
|
|
129
|
-
"",
|
|
130
|
-
"You must provide the COMPLETE file content for each file.",
|
|
131
|
-
].join("\n"));
|
|
132
|
-
if (i === retry - 1) {
|
|
133
|
-
throw new Error("Prisma schema compiler failed");
|
|
134
|
-
}
|
|
100
|
+
// REQUEST CORRECTION
|
|
101
|
+
yield agentica.conversate(StringUtil_1.StringUtil.trim `
|
|
102
|
+
Resolve the compilation errors in the provided Prisma schema files.
|
|
103
|
+
|
|
104
|
+
Don't remake every schema files. Fix only some of the files that have
|
|
105
|
+
compilation errors. You MUST provide complete, corrected files.
|
|
106
|
+
`);
|
|
107
|
+
if (pointer.value === null) {
|
|
108
|
+
console.error("Unreachable error: PrismaCompilerAgent.pointer.value is null");
|
|
109
|
+
return result; // unreachable
|
|
135
110
|
}
|
|
136
|
-
|
|
111
|
+
const newFiles = Object.assign(Object.assign({}, files), pointer.value.files);
|
|
112
|
+
return step(ctx, newFiles, life - 1);
|
|
137
113
|
});
|
|
138
114
|
}
|
|
139
115
|
function createApplication(props) {
|
|
@@ -160,37 +136,42 @@ const claude = {
|
|
|
160
136
|
{
|
|
161
137
|
name: "modifyPrismaSchemaFiles",
|
|
162
138
|
parameters: {
|
|
163
|
-
description: "
|
|
139
|
+
description: "Current Type: {@link IModifyPrismaSchemaFilesProps}",
|
|
164
140
|
type: "object",
|
|
165
141
|
properties: {
|
|
142
|
+
planning: {
|
|
143
|
+
title: "Detailed execution plan for fixing Prisma compilation errors",
|
|
144
|
+
description: "Detailed execution plan for fixing Prisma compilation errors.\n\n\uD83C\uDFAF Purpose: Enable systematic reasoning and step-by-step error resolution\napproach\n\n\uD83D\uDCCB Required Planning Content:\n\n1. **Error Analysis Summary**\n\n - List all identified compilation errors with their locations\n - Categorize errors by type (syntax, relationships, types, constraints)\n - Identify root causes and error interdependencies\n2. **Fix Strategy Overview**\n\n - Prioritize fixes based on dependencies (fix foundational errors first)\n - Outline minimal changes needed for each error\n - Identify potential impact on other schema parts\n3. **Step-by-Step Fix Plan**\n\n - File-by-file modification plan with specific changes\n - Exact line numbers or sections to be modified\n - New code additions or corrections to be applied\n - Verification steps to ensure fixes don't break other parts\n4. **Preservation Checklist**\n\n - Confirm which comments/documentation must be preserved\n - List relationships and business logic to maintain unchanged\n - Identify cross-file dependencies that must remain intact\n5. **Risk Assessment**\n\n - Potential side effects of each planned fix\n - Validation points to check after applying fixes\n - Rollback considerations if fixes introduce new issues\n\n\uD83D\uDCA1 Example Planning Structure:\n\n ## Error Analysis\n - Error 1: Missing foreign key field 'userId' in Post model (schema-02-posts.prisma:15)\n - Error 2: Invalid",
|
|
145
|
+
type: "string"
|
|
146
|
+
},
|
|
166
147
|
files: {
|
|
167
|
-
description: "
|
|
148
|
+
description: "Original Prisma schema files that contain compilation errors and need\ncorrection.\n\n\uD83D\uDCE5 Input Structure:\n\n- Key: filename (e.g., \"schema-01-users.prisma\")\n- Value: COMPLETE original file content with compilation errors\n\n\uD83D\uDD0D Expected Input File Types:\n\n- Domain-specific schema files: \"schema-XX-domain.prisma\" \u2192 Contains complete\n model definitions for specific business domains\n\n\uD83D\uDCDD Input File Content Analysis:\n\n- All models with their complete field definitions\n- All relationships (@relation directives with field mappings)\n- All indexes, constraints, and unique identifiers\n- All enums and their complete value sets\n- All comments and documentation\n- Cross-file model references and dependencies\n\n\u26A0\uFE0F Input Processing Notes:\n\n- Files may contain syntax errors, type mismatches, or missing references\n- Some models might reference non-existent fields or models\n- Relationship mappings might be incorrect or incomplete\n- Foreign key fields might be missing or incorrectly defined\n- Cross-file dependencies might be broken or circular\n\n------------------------------\n\nDescription of the current {@link Recordstringstring} type:\n\n> Construct a type with a set of properties K of type T",
|
|
168
149
|
type: "object",
|
|
169
150
|
properties: {},
|
|
170
151
|
required: [],
|
|
171
152
|
additionalProperties: {
|
|
172
153
|
type: "string"
|
|
173
154
|
}
|
|
174
|
-
},
|
|
175
|
-
description: {
|
|
176
|
-
description: "Brief description of what was fixed or modified in the schema files. Should\nsummarize the changes made to resolve compilation errors.",
|
|
177
|
-
type: "string"
|
|
178
155
|
}
|
|
179
156
|
},
|
|
180
157
|
required: [
|
|
181
|
-
"
|
|
182
|
-
"
|
|
158
|
+
"planning",
|
|
159
|
+
"files"
|
|
183
160
|
],
|
|
184
161
|
additionalProperties: false,
|
|
185
162
|
$defs: {}
|
|
186
163
|
},
|
|
187
|
-
description: "Fixes compilation errors
|
|
188
|
-
validate: (() => { const _io0 = input => "object" === typeof input.files && null !== input.files && false === Array.isArray(input.files) && _io1(input.files)
|
|
164
|
+
description: "Fixes Prisma compilation errors while preserving ALL existing comments,\ndocumentation, and schema structure.\n\n## Core Rules\n\n1. Fix ONLY compilation errors - never remove comments/documentation\n2. Apply minimal changes - preserve original design and relationships\n3. Return COMPLETE files - no truncation allowed\n4. NEVER use mapping names in",
|
|
165
|
+
validate: (() => { const _io0 = input => "string" === typeof input.planning && ("object" === typeof input.files && null !== input.files && false === Array.isArray(input.files) && _io1(input.files)); const _io1 = input => Object.keys(input).every(key => {
|
|
189
166
|
const value = input[key];
|
|
190
167
|
if (undefined === value)
|
|
191
168
|
return true;
|
|
192
169
|
return "string" === typeof value;
|
|
193
|
-
}); const _vo0 = (input, _path, _exceptionable = true) => [
|
|
170
|
+
}); const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.planning || _report(_exceptionable, {
|
|
171
|
+
path: _path + ".planning",
|
|
172
|
+
expected: "string",
|
|
173
|
+
value: input.planning
|
|
174
|
+
}), ("object" === typeof input.files && null !== input.files && false === Array.isArray(input.files) || _report(_exceptionable, {
|
|
194
175
|
path: _path + ".files",
|
|
195
176
|
expected: "Record<string, string>",
|
|
196
177
|
value: input.files
|
|
@@ -198,10 +179,6 @@ const claude = {
|
|
|
198
179
|
path: _path + ".files",
|
|
199
180
|
expected: "Record<string, string>",
|
|
200
181
|
value: input.files
|
|
201
|
-
}), "string" === typeof input.description || _report(_exceptionable, {
|
|
202
|
-
path: _path + ".description",
|
|
203
|
-
expected: "string",
|
|
204
|
-
value: input.description
|
|
205
182
|
})].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => [false === _exceptionable || Object.keys(input).map(key => {
|
|
206
183
|
const value = input[key];
|
|
207
184
|
if (undefined === value)
|
|
@@ -254,37 +231,42 @@ const collection = {
|
|
|
254
231
|
{
|
|
255
232
|
name: "modifyPrismaSchemaFiles",
|
|
256
233
|
parameters: {
|
|
257
|
-
description: "
|
|
234
|
+
description: "Current Type: {@link IModifyPrismaSchemaFilesProps}",
|
|
258
235
|
type: "object",
|
|
259
236
|
properties: {
|
|
237
|
+
planning: {
|
|
238
|
+
title: "Detailed execution plan for fixing Prisma compilation errors",
|
|
239
|
+
description: "Detailed execution plan for fixing Prisma compilation errors.\n\n\uD83C\uDFAF Purpose: Enable systematic reasoning and step-by-step error resolution\napproach\n\n\uD83D\uDCCB Required Planning Content:\n\n1. **Error Analysis Summary**\n\n - List all identified compilation errors with their locations\n - Categorize errors by type (syntax, relationships, types, constraints)\n - Identify root causes and error interdependencies\n2. **Fix Strategy Overview**\n\n - Prioritize fixes based on dependencies (fix foundational errors first)\n - Outline minimal changes needed for each error\n - Identify potential impact on other schema parts\n3. **Step-by-Step Fix Plan**\n\n - File-by-file modification plan with specific changes\n - Exact line numbers or sections to be modified\n - New code additions or corrections to be applied\n - Verification steps to ensure fixes don't break other parts\n4. **Preservation Checklist**\n\n - Confirm which comments/documentation must be preserved\n - List relationships and business logic to maintain unchanged\n - Identify cross-file dependencies that must remain intact\n5. **Risk Assessment**\n\n - Potential side effects of each planned fix\n - Validation points to check after applying fixes\n - Rollback considerations if fixes introduce new issues\n\n\uD83D\uDCA1 Example Planning Structure:\n\n ## Error Analysis\n - Error 1: Missing foreign key field 'userId' in Post model (schema-02-posts.prisma:15)\n - Error 2: Invalid",
|
|
240
|
+
type: "string"
|
|
241
|
+
},
|
|
260
242
|
files: {
|
|
261
|
-
description: "
|
|
243
|
+
description: "Original Prisma schema files that contain compilation errors and need\ncorrection.\n\n\uD83D\uDCE5 Input Structure:\n\n- Key: filename (e.g., \"schema-01-users.prisma\")\n- Value: COMPLETE original file content with compilation errors\n\n\uD83D\uDD0D Expected Input File Types:\n\n- Domain-specific schema files: \"schema-XX-domain.prisma\" \u2192 Contains complete\n model definitions for specific business domains\n\n\uD83D\uDCDD Input File Content Analysis:\n\n- All models with their complete field definitions\n- All relationships (@relation directives with field mappings)\n- All indexes, constraints, and unique identifiers\n- All enums and their complete value sets\n- All comments and documentation\n- Cross-file model references and dependencies\n\n\u26A0\uFE0F Input Processing Notes:\n\n- Files may contain syntax errors, type mismatches, or missing references\n- Some models might reference non-existent fields or models\n- Relationship mappings might be incorrect or incomplete\n- Foreign key fields might be missing or incorrectly defined\n- Cross-file dependencies might be broken or circular\n\n------------------------------\n\nDescription of the current {@link Recordstringstring} type:\n\n> Construct a type with a set of properties K of type T",
|
|
262
244
|
type: "object",
|
|
263
245
|
properties: {},
|
|
264
246
|
required: [],
|
|
265
247
|
additionalProperties: {
|
|
266
248
|
type: "string"
|
|
267
249
|
}
|
|
268
|
-
},
|
|
269
|
-
description: {
|
|
270
|
-
description: "Brief description of what was fixed or modified in the schema files. Should\nsummarize the changes made to resolve compilation errors.",
|
|
271
|
-
type: "string"
|
|
272
250
|
}
|
|
273
251
|
},
|
|
274
252
|
required: [
|
|
275
|
-
"
|
|
276
|
-
"
|
|
253
|
+
"planning",
|
|
254
|
+
"files"
|
|
277
255
|
],
|
|
278
256
|
additionalProperties: false,
|
|
279
257
|
$defs: {}
|
|
280
258
|
},
|
|
281
|
-
description: "Fixes compilation errors
|
|
282
|
-
validate: (() => { const _io0 = input => "object" === typeof input.files && null !== input.files && false === Array.isArray(input.files) && _io1(input.files)
|
|
259
|
+
description: "Fixes Prisma compilation errors while preserving ALL existing comments,\ndocumentation, and schema structure.\n\n## Core Rules\n\n1. Fix ONLY compilation errors - never remove comments/documentation\n2. Apply minimal changes - preserve original design and relationships\n3. Return COMPLETE files - no truncation allowed\n4. NEVER use mapping names in",
|
|
260
|
+
validate: (() => { const _io0 = input => "string" === typeof input.planning && ("object" === typeof input.files && null !== input.files && false === Array.isArray(input.files) && _io1(input.files)); const _io1 = input => Object.keys(input).every(key => {
|
|
283
261
|
const value = input[key];
|
|
284
262
|
if (undefined === value)
|
|
285
263
|
return true;
|
|
286
264
|
return "string" === typeof value;
|
|
287
|
-
}); const _vo0 = (input, _path, _exceptionable = true) => [
|
|
265
|
+
}); const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.planning || _report(_exceptionable, {
|
|
266
|
+
path: _path + ".planning",
|
|
267
|
+
expected: "string",
|
|
268
|
+
value: input.planning
|
|
269
|
+
}), ("object" === typeof input.files && null !== input.files && false === Array.isArray(input.files) || _report(_exceptionable, {
|
|
288
270
|
path: _path + ".files",
|
|
289
271
|
expected: "Record<string, string>",
|
|
290
272
|
value: input.files
|
|
@@ -292,10 +274,6 @@ const collection = {
|
|
|
292
274
|
path: _path + ".files",
|
|
293
275
|
expected: "Record<string, string>",
|
|
294
276
|
value: input.files
|
|
295
|
-
}), "string" === typeof input.description || _report(_exceptionable, {
|
|
296
|
-
path: _path + ".description",
|
|
297
|
-
expected: "string",
|
|
298
|
-
value: input.description
|
|
299
277
|
})].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => [false === _exceptionable || Object.keys(input).map(key => {
|
|
300
278
|
const value = input[key];
|
|
301
279
|
if (undefined === value)
|
|
@@ -353,34 +331,39 @@ const collection = {
|
|
|
353
331
|
parameters: {
|
|
354
332
|
type: "object",
|
|
355
333
|
properties: {
|
|
334
|
+
planning: {
|
|
335
|
+
type: "string",
|
|
336
|
+
title: "Detailed execution plan for fixing Prisma compilation errors",
|
|
337
|
+
description: "Detailed execution plan for fixing Prisma compilation errors.\n\n\uD83C\uDFAF Purpose: Enable systematic reasoning and step-by-step error resolution\napproach\n\n\uD83D\uDCCB Required Planning Content:\n\n1. **Error Analysis Summary**\n\n - List all identified compilation errors with their locations\n - Categorize errors by type (syntax, relationships, types, constraints)\n - Identify root causes and error interdependencies\n2. **Fix Strategy Overview**\n\n - Prioritize fixes based on dependencies (fix foundational errors first)\n - Outline minimal changes needed for each error\n - Identify potential impact on other schema parts\n3. **Step-by-Step Fix Plan**\n\n - File-by-file modification plan with specific changes\n - Exact line numbers or sections to be modified\n - New code additions or corrections to be applied\n - Verification steps to ensure fixes don't break other parts\n4. **Preservation Checklist**\n\n - Confirm which comments/documentation must be preserved\n - List relationships and business logic to maintain unchanged\n - Identify cross-file dependencies that must remain intact\n5. **Risk Assessment**\n\n - Potential side effects of each planned fix\n - Validation points to check after applying fixes\n - Rollback considerations if fixes introduce new issues\n\n\uD83D\uDCA1 Example Planning Structure:\n\n ## Error Analysis\n - Error 1: Missing foreign key field 'userId' in Post model (schema-02-posts.prisma:15)\n - Error 2: Invalid"
|
|
338
|
+
},
|
|
356
339
|
files: {
|
|
357
340
|
type: "object",
|
|
358
341
|
properties: {},
|
|
359
342
|
required: [],
|
|
360
|
-
description: "
|
|
343
|
+
description: "Original Prisma schema files that contain compilation errors and need\ncorrection.\n\n\uD83D\uDCE5 Input Structure:\n\n- Key: filename (e.g., \"schema-01-users.prisma\")\n- Value: COMPLETE original file content with compilation errors\n\n\uD83D\uDD0D Expected Input File Types:\n\n- Domain-specific schema files: \"schema-XX-domain.prisma\" \u2192 Contains complete\n model definitions for specific business domains\n\n\uD83D\uDCDD Input File Content Analysis:\n\n- All models with their complete field definitions\n- All relationships (@relation directives with field mappings)\n- All indexes, constraints, and unique identifiers\n- All enums and their complete value sets\n- All comments and documentation\n- Cross-file model references and dependencies\n\n\u26A0\uFE0F Input Processing Notes:\n\n- Files may contain syntax errors, type mismatches, or missing references\n- Some models might reference non-existent fields or models\n- Relationship mappings might be incorrect or incomplete\n- Foreign key fields might be missing or incorrectly defined\n- Cross-file dependencies might be broken or circular\n\n------------------------------\n\nDescription of the current {@link Recordstringstring} type:\n\n> Construct a type with a set of properties K of type T",
|
|
361
344
|
additionalProperties: {
|
|
362
345
|
type: "string"
|
|
363
346
|
}
|
|
364
|
-
},
|
|
365
|
-
description: {
|
|
366
|
-
type: "string",
|
|
367
|
-
description: "Brief description of what was fixed or modified in the schema files. Should\nsummarize the changes made to resolve compilation errors."
|
|
368
347
|
}
|
|
369
348
|
},
|
|
370
349
|
required: [
|
|
371
|
-
"
|
|
372
|
-
"
|
|
350
|
+
"planning",
|
|
351
|
+
"files"
|
|
373
352
|
],
|
|
374
|
-
description: "
|
|
353
|
+
description: "Current Type: {@link IModifyPrismaSchemaFilesProps}",
|
|
375
354
|
additionalProperties: false
|
|
376
355
|
},
|
|
377
|
-
description: "Fixes compilation errors
|
|
378
|
-
validate: (() => { const _io0 = input => "object" === typeof input.files && null !== input.files && false === Array.isArray(input.files) && _io1(input.files)
|
|
356
|
+
description: "Fixes Prisma compilation errors while preserving ALL existing comments,\ndocumentation, and schema structure.\n\n## Core Rules\n\n1. Fix ONLY compilation errors - never remove comments/documentation\n2. Apply minimal changes - preserve original design and relationships\n3. Return COMPLETE files - no truncation allowed\n4. NEVER use mapping names in",
|
|
357
|
+
validate: (() => { const _io0 = input => "string" === typeof input.planning && ("object" === typeof input.files && null !== input.files && false === Array.isArray(input.files) && _io1(input.files)); const _io1 = input => Object.keys(input).every(key => {
|
|
379
358
|
const value = input[key];
|
|
380
359
|
if (undefined === value)
|
|
381
360
|
return true;
|
|
382
361
|
return "string" === typeof value;
|
|
383
|
-
}); const _vo0 = (input, _path, _exceptionable = true) => [
|
|
362
|
+
}); const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.planning || _report(_exceptionable, {
|
|
363
|
+
path: _path + ".planning",
|
|
364
|
+
expected: "string",
|
|
365
|
+
value: input.planning
|
|
366
|
+
}), ("object" === typeof input.files && null !== input.files && false === Array.isArray(input.files) || _report(_exceptionable, {
|
|
384
367
|
path: _path + ".files",
|
|
385
368
|
expected: "Record<string, string>",
|
|
386
369
|
value: input.files
|
|
@@ -388,10 +371,6 @@ const collection = {
|
|
|
388
371
|
path: _path + ".files",
|
|
389
372
|
expected: "Record<string, string>",
|
|
390
373
|
value: input.files
|
|
391
|
-
}), "string" === typeof input.description || _report(_exceptionable, {
|
|
392
|
-
path: _path + ".description",
|
|
393
|
-
expected: "string",
|
|
394
|
-
value: input.description
|
|
395
374
|
})].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => [false === _exceptionable || Object.keys(input).map(key => {
|
|
396
375
|
const value = input[key];
|
|
397
376
|
if (undefined === value)
|
|
@@ -433,4 +412,22 @@ const collection = {
|
|
|
433
412
|
]
|
|
434
413
|
},
|
|
435
414
|
};
|
|
415
|
+
const MAIN_PRISMA_FILE = StringUtil_1.StringUtil.trim `
|
|
416
|
+
generator client {
|
|
417
|
+
provider = "prisma-client-js"
|
|
418
|
+
previewFeatures = ["postgresqlExtensions", "views"]
|
|
419
|
+
binaryTargets = ["native", "linux-musl-arm64-openssl-3.0.x"]
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
datasource db {
|
|
423
|
+
provider = "postgresql"
|
|
424
|
+
url = env("DATABASE_URL")
|
|
425
|
+
extensions = []
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
generator markdown {
|
|
429
|
+
provider = "prisma-markdown"
|
|
430
|
+
output = "../docs/ERD.md"
|
|
431
|
+
}
|
|
432
|
+
`;
|
|
436
433
|
//# sourceMappingURL=orchestratePrismaCompiler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestratePrismaCompiler.js","sourceRoot":"","sources":["../../../src/orchestrate/prisma/orchestratePrismaCompiler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"orchestratePrismaCompiler.js","sourceRoot":"","sources":["../../../src/orchestrate/prisma/orchestratePrismaCompiler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,8DAOC;;;AAlBD,yCAAoE;AAIpE,kDAA0B;AAG1B,uEAAoE;AACpE,uDAAoD;AACpD,yFAAsF;AAEtF,SAAgB,yBAAyB,CACvC,GAAyB,EACzB,KAA6B,EAC7B,QAAgB,CAAC;IAEjB,KAAK,CAAC,aAAa,CAAC,GAAG,gBAAgB,CAAC;IACxC,OAAO,IAAI,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AACjC,CAAC;AAED,SAAe,IAAI,CACjB,GAAyB,EACzB,KAA6B,EAC7B,IAAY;;;QAEZ,kBAAkB;QAClB,MAAM,MAAM,GAAgC,MAAM,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC;YACpE,KAAK;SACN,CAAC,CAAC;QACH,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,IAAI,CAAC;YAAE,OAAO,MAAM,CAAC;QAE1D,oBAAoB;QACpB,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,gBAAgB;YACtB,OAAO,EAAE,KAAK;YACd,MAAM;YACN,IAAI,EAAE,MAAA,MAAA,GAAG,CAAC,KAAK,EAAE,CAAC,OAAO,0CAAE,IAAI,mCAAI,CAAC;YACpC,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACrC,CAAC,CAAC;QAEH,MAAM,OAAO,GAAmD;YAC9D,KAAK,EAAE,IAAI;SACZ,CAAC;QACF,MAAM,QAAQ,GAAyB,IAAI,oBAAa,CAAC;YACvD,KAAK,EAAE,GAAG,CAAC,KAAK;YAChB,MAAM,EAAE,GAAG,CAAC,MAAM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AE,iBAAiB;QACvB,WAAW;QACX,OAAO,EAAE;YACP,uBAAuB,EAAE,CAAC,IAAI,EAAE,EAAE;gBAChC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACpB,CAAC;SACqB;KACzB,CAAC;AACJ,CAAC;AAED,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAIT,CAAC;AACJ,MAAM,UAAU,GAAG;IACjB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAIJ;IACH,MAAM;IACN,KAAK,EAAE,MAAM;IACb,QAAQ,EAAE,MAAM;IAChB,KAAK,EAAE,MAAM;IACb,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAA8C;CACpD,CAAC;AAyHF,MAAM,gBAAgB,GAAG,uBAAU,CAAC,IAAI,CAAA;;;;;;;;;;;;;;;;;CAiBvC,CAAC"}
|
|
@@ -88,7 +88,7 @@ function process(ctx, component) {
|
|
|
88
88
|
model: ctx.model,
|
|
89
89
|
vendor: ctx.vendor,
|
|
90
90
|
config: Object.assign({}, ((_a = ctx.config) !== null && _a !== void 0 ? _a : {})),
|
|
91
|
-
histories: (0, transformPrismaSchemaHistories_1.transformPrismaSchemaHistories)(ctx.state()),
|
|
91
|
+
histories: (0, transformPrismaSchemaHistories_1.transformPrismaSchemaHistories)(ctx.state().analyze, component),
|
|
92
92
|
tokenUsage: ctx.usage(),
|
|
93
93
|
controllers: [
|
|
94
94
|
createApplication({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestratePrismaSchema.js","sourceRoot":"","sources":["../../../src/orchestrate/pr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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAIJ;IACH,MAAM;IACN,KAAK,EAAE,MAAM;IACb,QAAQ,EAAE,MAAM;IAChB,KAAK,EAAE,MAAM;IACb,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAA8C;CACpD,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { IAgenticaHistoryJson } from "@agentica/core";
|
|
2
|
-
import {
|
|
3
|
-
export declare const transformPrismaCompilerHistories: (
|
|
2
|
+
import { IAutoBePrismaCompilerResult } from "@autobe/interface";
|
|
3
|
+
export declare const transformPrismaCompilerHistories: (files: Record<string, string>, result: IAutoBePrismaCompilerResult.IFailure) => Array<IAgenticaHistoryJson.IAssistantMessage | IAgenticaHistoryJson.ISystemMessage>;
|
|
@@ -1,41 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.transformPrismaCompilerHistories = void 0;
|
|
4
|
-
const transformPrismaCompilerHistories = (
|
|
5
|
-
if (state.analyze === null)
|
|
6
|
-
return [
|
|
7
|
-
{
|
|
8
|
-
type: "systemMessage",
|
|
9
|
-
text: [
|
|
10
|
-
"Requirement analysis is not yet completed.",
|
|
11
|
-
"Don't call any tool function,",
|
|
12
|
-
"but say to process the requirement analysis.",
|
|
13
|
-
].join(" "),
|
|
14
|
-
},
|
|
15
|
-
];
|
|
4
|
+
const transformPrismaCompilerHistories = (files, result) => {
|
|
16
5
|
return [
|
|
17
6
|
{
|
|
18
7
|
type: "systemMessage",
|
|
19
|
-
text: "
|
|
8
|
+
text: "# Prisma Schema Error Fixing Agent\n\nYou are a world-class Prisma schema validation and error resolution specialist. Your primary mission is to analyze Prisma compilation errors and provide precise fixes while maintaining complete schema integrity and preserving ALL existing documentation.\n\n## Core Operating Principles\n\n### \uD83D\uDEAB ABSOLUTE PROHIBITIONS\n- **NEVER remove or modify existing comments** (`//` or `///`)\n- **NEVER delete field documentation or descriptions**\n- **NEVER remove model-level documentation**\n- **NEVER truncate or abbreviate file contents**\n- **NEVER use placeholders** like \"... existing content preserved ...\"\n- **NEVER ask for clarification** - analyze and fix directly\n- **NEVER use mapping names in @relation directives** - This causes compilation errors\n\nOf course, if you're planning to erase some property or relationship from a model, it is okay to remove its description comments.\n\n### \u2705 MANDATORY REQUIREMENTS\n- **Preserve ALL comments and documentation** exactly as they appear\n- **Apply minimal changes** - fix ONLY compilation errors\n- **Return COMPLETE file contents** without any truncation\n- **Maintain original design intent** and architectural patterns\n- **Preserve ALL existing relationships, indexes, and constraints**\n- **Use ONLY `@relation(fields: [...], references: [...])` format WITHOUT mapping names**\n\n## Error Resolution Strategy\n\n### 1. Error Analysis Process\n1. **Identify compilation errors** from the provided error history\n2. **Categorize error types**: syntax, relationships, types, constraints\n3. **Locate exact error sources** in the schema files\n4. **Plan minimal fixes** that resolve errors without affecting other parts\n\n### 2. Common Error Types & Solutions\n\n#### Relationship Errors\n- **Missing models**: Create referenced models or update references\n- **Invalid @relation mappings**: Fix field names and references WITHOUT using mapping names\n- **Mapping name conflicts**: Remove ALL mapping names from @relation directives\n- **Missing foreign keys**: Add required foreign key fields\n- **Circular dependencies**: Restructure relationships carefully\n- **Forbidden**: \n - `article bbs_articles @relation(\"article\", fields: [bbs_article_id], references: [id], onDelete: Cascade)`\n - `to_files bbs_articles_snapshot_files @relation(\"to_files\")`\n - `mv_last mv_bbs_article_last_snapshots? @relation(\"mv_last\")`\n- **Correct**:\n - `article bbs_articles @relation(fields: [bbs_article_id], references: [id], onDelete: Cascade)`\n - `to_files bbs_article_snapshot_files[]`\n - `mv_last mv_bbs_article_last_snapshots?`\n\n#### Type & Constraint Errors\n- **Invalid data types**: Correct to supported Prisma types\n- **Missing @id/@unique**: Add required constraints\n- **Invalid attributes**: Fix attribute syntax and placement\n\n#### Syntax & Naming Errors\n- **Reserved keywords**: Rename conflicting fields\n- **Invalid identifiers**: Fix naming conventions\n- **Syntax errors**: Correct Prisma schema syntax\n\n#### Cross-File Reference Errors\n- **Model not found**: Ensure referenced models exist\n- **Invalid field references**: Update to match actual field names\n\n### 3. Fix Implementation Rules\n\n#### Minimal Changes Principle\n- Change **only what causes compilation errors**\n- Preserve **all original field names, types, and structures**\n- Maintain **all existing comments and documentation**\n- Keep **all business logic intact**\n\n#### Relationship Fixing Rules\n- **Remove ALL mapping names** from @relation directives if present\n- **Keep only field mapping**: `@relation(fields: [...], references: [...])`\n- **Ensure bidirectional relationships** work without mapping names\n- **Add onDelete/onUpdate behaviors** as needed for data integrity\n\n#### Documentation Preservation\n- **Keep ALL comments** (`//` and `///`)\n- **Keep ALL field descriptions** and explanations\n- **Keep ALL model documentation** and annotations\n- **Keep ALL enum value descriptions**\n\n#### Quality Assurance\n- Ensure **all compilation errors are resolved**\n- Verify **no new errors are introduced**\n- Confirm **all relationships remain properly mapped**\n- Validate **cross-file references work correctly**\n- Verify **no mapping names are used anywhere**\n\n## Input/Output Format\n\n### Input Expectation\nYou will receive a `files` object containing:\n```typescript\n{\n \"main.prisma\": \"// Complete original file with potential errors\",\n \"schema-01-users.prisma\": \"// Complete domain file with potential errors\",\n \"schema-02-posts.prisma\": \"// Complete domain file with potential errors\"\n}\n```\n\n### Output Requirement\nReturn the exact same file structure with ALL errors fixed:\n```typescript\n{\n \"schema-01-users.prisma\": \"// COMPLETE corrected file - ALL comments preserved\", \n \"schema-02-posts.prisma\": \"// COMPLETE corrected file - ALL documentation preserved\"\n}\n```\n\n## Critical Success Criteria\n\n### \u2705 Must Achieve\n- [ ] All compilation errors resolved\n- [ ] All original comments preserved exactly\n- [ ] All field documentation maintained\n- [ ] All model descriptions kept intact\n- [ ] Complete file contents returned (no truncation)\n- [ ] Original business logic preserved\n- [ ] Relationships remain properly mapped\n- [ ] No new errors introduced\n- [ ] **NO mapping names used in any @relation directive**\n\n### \uD83D\uDEAB Must Avoid\n- [ ] Removing any comments or documentation\n- [ ] Truncating or abbreviating content\n- [ ] Using placeholder text or shortcuts\n- [ ] Making unnecessary changes beyond error fixes\n- [ ] Breaking existing functionality\n- [ ] Altering business logic or design patterns\n- [ ] **Using mapping names in @relation directives**\n\n## Error Resolution Workflow\n\n1. **Parse Input**: Analyze provided schema files and identify structure\n2. **Error Detection**: Review compilation errors and locate problem areas\n3. **Mapping Name Removal**: Remove ALL mapping names from @relation directives if present\n4. **Impact Assessment**: Determine minimal changes needed for each error\n5. **Apply Fixes**: Make targeted corrections while preserving everything else\n6. **Validation**: Ensure fixes resolve errors without breaking other parts\n7. **Complete Output**: Return all files with complete content preserved\n\n## Response Format\n\nAlways return your response as a properly formatted object containing the corrected schema files. Each file must be complete and contain all original content with only the necessary error fixes applied.\n\nRemember: Your goal is to be a surgical error-fixer, not a schema rewriter. Preserve everything, fix only what's broken, and NEVER use mapping names in @relation directives." /* AutoBeSystemPromptConstant.PRISMA_COMPILER */,
|
|
20
9
|
},
|
|
21
10
|
{
|
|
22
11
|
type: "assistantMessage",
|
|
23
12
|
text: [
|
|
24
13
|
"Below are the current schema files that failed compilation:",
|
|
25
14
|
"",
|
|
26
|
-
"
|
|
15
|
+
"```json",
|
|
16
|
+
JSON.stringify(files),
|
|
17
|
+
"```",
|
|
18
|
+
].join("\n"),
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
type: "assistantMessage",
|
|
22
|
+
text: [
|
|
23
|
+
`Here is the compiler error message. Please fix the schema files`,
|
|
24
|
+
`referencing the error message.`,
|
|
27
25
|
"",
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
.join("\n\n"),
|
|
26
|
+
result.reason,
|
|
27
|
+
].join("\n"),
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
type: "systemMessage",
|
|
31
|
+
text: [
|
|
32
|
+
"Before fixing the schema files,",
|
|
33
|
+
"study about Prisma schema language",
|
|
34
|
+
"from the best practices and examples",
|
|
38
35
|
"",
|
|
36
|
+
"Study the following comprehensive BBS (bullet-in board system) project schema as a reference for implementing all the patterns and best practices outlined above. \n\nThis enterprise-level implementation demonstrates proper domain organization, relationship modeling, documentation standards, and advanced patterns like snapshots, inheritance, and materialized views.\n\n## Input (Requirement Analysis)\n\n```json\n{% EXAMPLE_BBS_REQUIREMENT_ANALYSIS %}\n```\n\nWhen such requirement analysis report comes\n\n## Output (Prisma Schema Files)\n\n```json\n{\"main.prisma\":\"datasource db {\\n provider = \\\"postgresql\\\"\\n url = env(\\\"BBS_POSTGRES_URL\\\")\\n}\\n\\ngenerator client {\\n provider = \\\"prisma-client-js\\\"\\n previewFeatures = [\\\"views\\\"]\\n binaryTargets = [\\\"native\\\"]\\n}\\n\\ngenerator markdown {\\n provider = \\\"prisma-markdown\\\"\\n title = \\\"Bullet-in Board System\\\"\\n output = \\\"../../docs/ERD.md\\\"\\n}\\n\\n//-----------------------------------------------------------\\n// ARTICLES\\n//-----------------------------------------------------------\\n/// Attachment File.\\n///\\n/// Every attachment files that are managed in current system.\\n///\\n/// @namespace Articles\\n/// @author Samchon\\nmodel attachment_files {\\n //----\\n // COLUMNS\\n //----\\n /// Primary Key.\\n id String @id @db.Uuid\\n\\n /// File name, except extension.\\n name String @db.VarChar\\n\\n /// Extension.\\n ///\\n /// Possible to omit like `README` case.\\n extension String? @db.VarChar\\n\\n /// URL path of the real file.\\n url String @db.VarChar\\n\\n /// Creation time of file.\\n created_at DateTime @db.Timestamptz\\n\\n //----\\n // RELATIONS\\n //----\\n bbs_article_snapshot_files bbs_article_snapshot_files[]\\n bbs_article_comment_snapshots_files bbs_article_comment_snapshot_files[]\\n}\\n\\n/// Article entity.\\n/// \\n/// `bbs_articles` is a super-type entity of all kinds of articles in the \\n/// current backend system, literally shaping individual articles of \\n/// the bulletin board.\\n///\\n/// And, as you can see, the elements that must inevitably exist in the \\n/// article, such as the title or the body, do not exist in the `bbs_articles`, \\n/// but exist in the subsidiary entity, {@link bbs_article_snapshots}, as a \\n/// 1: N relationship, which is because a new snapshot record is published \\n/// every time the article is modified.\\n///\\n/// The reason why a new snapshot record is published every time the article \\n/// is modified is to preserve the evidence. Due to the nature of e-community, \\n/// there is always a threat of dispute among the participants. And it can \\n/// happen that disputes arise through articles or comments, and to prevent \\n/// such things as modifying existing articles to manipulate the situation, \\n/// the article is designed in this structure.\\n///\\n/// In other words, to keep evidence, and prevent fraud.\\n///\\n/// @namespace Articles\\n/// @author Samchon\\nmodel bbs_articles {\\n /// Primary Key.\\n id String @id @db.Uuid\\n\\n /// Writer's name.\\n writer String @db.VarChar\\n\\n /// Password for modification.\\n password String @db.VarChar\\n\\n /// Creation time of article.\\n created_at DateTime @db.Timestamptz\\n\\n /// Deletion time of article.\\n ///\\n /// To keep evidence, do not delete the article, but just mark it as \\n /// deleted.\\n deleted_at DateTime? @db.Timestamptz\\n\\n //----\\n // RELATIONS\\n //----\\n /// List of snapshots.\\n ///\\n /// It is created for the first time when an article is created, and is\\n /// accumulated every time the article is modified.\\n snapshots bbs_article_snapshots[]\\n\\n /// List of comments.\\n comments bbs_article_comments[]\\n\\n mv_last mv_bbs_article_last_snapshots?\\n\\n @@index([created_at])\\n}\\n\\n/// Snapshot of article.\\n///\\n/// `bbs_article_snapshots` is a snapshot entity that contains the contents of\\n/// the article, as mentioned in {@link bbs_articles}, the contents of the \\n/// article are separated from the article record to keep evidence and prevent \\n/// fraud.\\n///\\n/// @namespace Articles\\n/// @author Samchon\\nmodel bbs_article_snapshots {\\n //----\\n // COLUMNS\\n //----\\n /// Primary Key.\\n id String @id @db.Uuid\\n\\n /// Belong article's {@link bbs_articles.id}\\n bbs_article_id String @db.Uuid\\n\\n /// Format of body.\\n ///\\n /// Same meaning with extension like `html`, `md`, `txt`.\\n format String @db.VarChar\\n\\n /// Title of article.\\n title String @db.VarChar\\n\\n /// Content body of article.\\n body String\\n\\n /// IP address of the snapshot writer.\\n ip String @db.VarChar\\n\\n /// Creation time of record.\\n ///\\n /// It means creation time or update time or article.\\n created_at DateTime @db.Timestamptz\\n\\n //----\\n // RELATIONS\\n //----\\n /// Belong article info.\\n article bbs_articles @relation(fields: [bbs_article_id], references: [id], onDelete: Cascade)\\n\\n /// List of wrappers of attachment files.\\n to_files bbs_article_snapshot_files[]\\n\\n mv_last mv_bbs_article_last_snapshots?\\n\\n @@index([bbs_article_id, created_at])\\n}\\n\\n/// Attachment file of article snapshot.\\n///\\n/// `bbs_article_snapshot_files` is an entity that shapes the attached files of\\n/// the article snapshot.\\n///\\n/// `bbs_article_snapshot_files` is a typical pair relationship table to \\n/// resolve the M: N relationship between {@link bbs_article_snapshots} and\\n/// {@link attachment_files} tables. Also, to ensure the order of the attached\\n/// files, it has an additional `sequence` attribute, which we will continue to\\n/// see in this documents.\\n///\\n/// @namespace Articles\\n/// @author Samchon\\nmodel bbs_article_snapshot_files {\\n //----\\n // COLUMNS\\n //----\\n /// Primary Key.\\n id String @id @db.Uuid\\n\\n /// Belonged snapshot's {@link bbs_article_snapshots.id}\\n bbs_article_snapshot_id String @db.Uuid\\n\\n /// Belonged file's {@link attachment_files.id}\\n attachment_file_id String @db.Uuid\\n\\n /// Sequence of attachment file in the snapshot.\\n sequence Int @db.Integer\\n\\n //----\\n // RELATIONS\\n //----\\n /// Belonged article.\\n snapshot bbs_article_snapshots @relation(fields: [bbs_article_snapshot_id], references: [id], onDelete: Cascade)\\n\\n /// Belonged file.\\n file attachment_files @relation(fields: [attachment_file_id], references: [id], onDelete: Cascade)\\n\\n @@index([bbs_article_snapshot_id])\\n @@index([attachment_file_id])\\n}\\n\\n/// Comment written on an article.\\n///\\n/// `bbs_article_comments` is an entity that shapes the comments written on an\\n/// article.\\n///\\n/// And for this comment, as in the previous relationship between \\n/// {@link bbs_articles} and {@link bbs_article_snapshots}, the content body \\n/// of the comment is stored in the sub {@link bbs_article_comment_snapshots} \\n/// table for evidentialism, and a new snapshot record is issued every time \\n/// the comment is modified.\\n///\\n/// Also, `bbs_article_comments` is expressing the relationship of the \\n/// hierarchical reply structure through the `parent_id` attribute.\\n///\\n/// @namespace Articles\\n/// @author Samchon\\nmodel bbs_article_comments {\\n //----\\n // COLUMNS\\n //----\\n /// Primary Key.\\n id String @id @db.Uuid\\n\\n /// Belonged article's {@link bbs_articles.id}\\n bbs_article_id String @db.Uuid\\n\\n /// Parent comment's {@link bbs_article_comments.id}\\n ///\\n /// Used to express the hierarchical reply structure.\\n parent_id String? @db.Uuid\\n\\n /// Writer's name.\\n writer String @db.VarChar\\n\\n /// Password for modification.\\n password String @db.VarChar\\n\\n /// Creation time of comment.\\n created_at DateTime @db.Timestamptz\\n\\n /// Deletion time of comment.\\n ///\\n /// Do not allow to delete the comment, but just mark it as deleted, \\n /// to keep evidence.\\n deleted_at DateTime? @db.Timestamptz\\n\\n //----\\n // RELATIONS\\n //----\\n /// Belonged article.\\n article bbs_articles @relation(fields: [bbs_article_id], references: [id], onDelete: Cascade)\\n\\n /// Parent comment.\\n ///\\n /// Only when reply case.\\n parent bbs_article_comments? @relation(\\\"bbs_article_comments_reply\\\", fields: [parent_id], references: [id], onDelete: Cascade)\\n\\n /// List of children comments.\\n ///\\n /// Reply comments of current.\\n children bbs_article_comments[] @relation(\\\"bbs_article_comments_reply\\\")\\n\\n /// List of snapshots.\\n ///\\n /// It is created for the first time when a comment is created, and is\\n /// accumulated every time the comment is modified.\\n snapshots bbs_article_comment_snapshots[]\\n\\n @@index([bbs_article_id, parent_id, created_at])\\n}\\n\\n/// Snapshot of comment.\\n///\\n/// `bbs_article_comment_snapshots` is a snapshot entity that contains the \\n/// contents of the comment.\\n///\\n/// As mentioned in {@link bbs_article_comments}, designed to keep evidence \\n/// and prevent fraud.\\n///\\n/// @namespace Articles\\n/// @author Samchon\\nmodel bbs_article_comment_snapshots {\\n //----\\n // COLUMNS\\n //----\\n /// Primary Key.\\n id String @id @db.Uuid\\n\\n /// Belonged article's {@link bbs_article_comments.id}\\n bbs_article_comment_id String @db.Uuid\\n\\n /// Format of content body.\\n ///\\n /// Same meaning with extension like `html`, `md`, `txt`.\\n format String @db.VarChar\\n\\n /// Content body of comment.\\n body String\\n\\n /// IP address of the snapshot writer.\\n ip String @db.VarChar\\n\\n /// Creation time of record.\\n ///\\n /// It means creation time or update time or comment.\\n created_at DateTime @db.Timestamptz\\n\\n //----\\n // RELATIONS\\n //----\\n /// Belong comment info.\\n comment bbs_article_comments @relation(fields: [bbs_article_comment_id], references: [id], onDelete: Cascade)\\n\\n /// List of wrappers of attachment files.\\n to_files bbs_article_comment_snapshot_files[]\\n\\n @@index([bbs_article_comment_id, created_at])\\n}\\n\\n/// Attachment file of comment snapshot.\\n/// \\n/// `bbs_article_comment_snapshot_files` is an entity resolving the M:N \\n/// relationship between {@link bbs_article_comment_snapshots} and \\n/// {@link attachment_files} tables.\\n/// \\n/// @namespace Articles\\n/// @author Samchon\\nmodel bbs_article_comment_snapshot_files {\\n //----\\n // COLUMNS\\n //----\\n /// Primary Key.\\n id String @id @db.Uuid\\n\\n /// Belonged snapshot's {@link bbs_article_comment_snapshots.id}\\n bbs_article_comment_snapshot_id String @db.Uuid\\n\\n /// Belonged file's {@link attachment_files.id}\\n attachment_file_id String @db.Uuid\\n\\n /// Sequence order.\\n ///\\n /// Sequence order of the attached file in the belonged snapshot.\\n sequence Int @db.Integer\\n\\n //----\\n // RELATIONS\\n //----\\n /// Belonged article.\\n snapshot bbs_article_comment_snapshots @relation(fields: [bbs_article_comment_snapshot_id], references: [id], onDelete: Cascade)\\n\\n /// Belonged file.\\n file attachment_files @relation(fields: [attachment_file_id], references: [id], onDelete: Cascade)\\n\\n @@index([bbs_article_comment_snapshot_id])\\n @@index([attachment_file_id])\\n}\\n\\n/// @hidden\\n/// @author Samchon\\nmodel mv_bbs_article_last_snapshots {\\n bbs_article_id String @id @db.Uuid\\n bbs_article_snapshot_id String @db.Uuid\\n\\n article bbs_articles @relation(fields: [bbs_article_id], references: [id], onDelete: Cascade)\\n snapshot bbs_article_snapshots @relation(fields: [bbs_article_snapshot_id], references: [id], onDelete: Cascade)\\n\\n @@unique([bbs_article_snapshot_id])\\n}\\n\"}\n```\n\nYou have to make above like prisma schema files.\n\nStudy the above schema files, and follow its coding style." /* AutoBeSystemPromptConstant.PRISMA_EXAMPLE */,
|
|
39
37
|
].join("\n"),
|
|
40
38
|
},
|
|
41
39
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformPrismaCompilerHistories.js","sourceRoot":"","sources":["../../../src/orchestrate/prisma/transformPrismaCompilerHistories.ts"],"names":[],"mappings":";;;AAKO,MAAM,gCAAgC,GAAG,CAC9C,
|
|
1
|
+
{"version":3,"file":"transformPrismaCompilerHistories.js","sourceRoot":"","sources":["../../../src/orchestrate/prisma/transformPrismaCompilerHistories.ts"],"names":[],"mappings":";;;AAKO,MAAM,gCAAgC,GAAG,CAC9C,KAA6B,EAC7B,MAA4C,EAG5C,EAAE;IACF,OAAO;QACL;YACE,IAAI,EAAE,eAAe;YACrB,IAAI,wpNAA4C;SACjD;QACD;YACE,IAAI,EAAE,kBAAkB;YACxB,IAAI,EAAE;gBACJ,6DAA6D;gBAC7D,EAAE;gBACF,SAAS;gBACT,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;gBACrB,KAAK;aACN,CAAC,IAAI,CAAC,IAAI,CAAC;SACb;QACD;YACE,IAAI,EAAE,kBAAkB;YACxB,IAAI,EAAE;gBACJ,iEAAiE;gBACjE,gCAAgC;gBAChC,EAAE;gBACF,MAAM,CAAC,MAAM;aACd,CAAC,IAAI,CAAC,IAAI,CAAC;SACb;QACD;YACE,IAAI,EAAE,eAAe;YACrB,IAAI,EAAE;gBACJ,iCAAiC;gBACjC,oCAAoC;gBACpC,sCAAsC;gBACtC,EAAE;;aAEH,CAAC,IAAI,CAAC,IAAI,CAAC;SACb;KACF,CAAC;AACJ,CAAC,CAAC;AAzCW,QAAA,gCAAgC,oCAyC3C"}
|