@autobe/agent 0.3.21 → 0.3.23
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 +1 -0
- package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
- package/lib/index.mjs +454 -150
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterface.js +5 -4
- package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.d.ts +4 -0
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js +482 -0
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -0
- package/lib/orchestrate/interface/orchestrateInterfaceComponents.js +3 -109
- package/lib/orchestrate/interface/orchestrateInterfaceComponents.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +5 -8
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +5 -8
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
- package/lib/orchestrate/interface/transformInterfaceHistories.js +2 -0
- package/lib/orchestrate/interface/transformInterfaceHistories.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaCompiler.js +3 -2
- package/lib/orchestrate/prisma/orchestratePrismaCompiler.js.map +1 -1
- package/package.json +4 -4
- package/src/constants/AutoBeSystemPromptConstant.ts +1 -0
- package/src/orchestrate/interface/orchestrateInterface.ts +6 -6
- package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +235 -0
- package/src/orchestrate/interface/orchestrateInterfaceComponents.ts +19 -57
- package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +4 -7
- package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +4 -7
- package/src/orchestrate/interface/transformInterfaceHistories.ts +2 -0
- package/src/orchestrate/prisma/orchestratePrismaCompiler.ts +4 -2
package/lib/index.mjs
CHANGED
|
@@ -50,24 +50,6 @@ function assertSchemaModel(model) {
|
|
|
50
50
|
if (model === "gemini") throw new Error([ "Error on AutoBeAgent.constructor(): gemini is not supported", "because it does not follow standard JSON schema specification.", "@autobe requires union type (`oneOf` or `anyOf`) for backend code generation,", "but gemini has banned them. Please wait until when `@agentica`", "supports prompt based function calling which can detour gemini's", "restriction of JSON schema specification." ].join(" "));
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
function divideArray(props) {
|
|
54
|
-
if (props.capacity <= 0) {
|
|
55
|
-
throw new Error("Capacity must be a positive integer");
|
|
56
|
-
}
|
|
57
|
-
if (Number.isNaN(props.capacity)) {
|
|
58
|
-
throw new TypeError("Capacity must be a positive integer");
|
|
59
|
-
}
|
|
60
|
-
if (props.capacity === Infinity) {
|
|
61
|
-
throw new Error("Capacity must be a positive integer");
|
|
62
|
-
}
|
|
63
|
-
const size = Math.ceil(props.array.length / props.capacity);
|
|
64
|
-
const capacity = Math.ceil(props.array.length / size);
|
|
65
|
-
const replica = props.array.slice();
|
|
66
|
-
return Array.from({
|
|
67
|
-
length: size
|
|
68
|
-
}, (() => replica.splice(0, capacity)));
|
|
69
|
-
}
|
|
70
|
-
|
|
71
53
|
const transformInterfaceHistories = (state, systemMessage) => {
|
|
72
54
|
if (state.analyze === null) return [ {
|
|
73
55
|
type: "systemMessage",
|
|
@@ -90,10 +72,450 @@ const transformInterfaceHistories = (state, systemMessage) => {
|
|
|
90
72
|
text: [ "Requirement analysis and Prisma DB schema generation are ready.", "", "Call the provided tool function to generate the OpenAPI document", "referencing below requirement analysis and Prisma DB schema.", "", `## User Request`, "", state.analyze.reason, "", `## Requirement Analysis Report`, "", "```json", JSON.stringify(state.analyze.files), "```" ].join("\n")
|
|
91
73
|
}, {
|
|
92
74
|
type: "assistantMessage",
|
|
93
|
-
text: [ "## Prisma DB Schema", "```json", JSON.stringify(state.prisma.result.schemas), "```", "", "## Entity Relationship Diagrams", "```json", JSON.stringify(state.prisma.result.diagrams), "```" ].join("\n")
|
|
75
|
+
text: [ "Database schema and entity relationship diagrams are ready.", "", "## Prisma DB Schema", "```json", JSON.stringify(state.prisma.result.schemas), "```", "", "## Entity Relationship Diagrams", "```json", JSON.stringify(state.prisma.result.diagrams), "```" ].join("\n")
|
|
94
76
|
} ];
|
|
95
77
|
};
|
|
96
78
|
|
|
79
|
+
function orchestrateInterfaceComplement(ctx, document, retry = 8) {
|
|
80
|
+
return step$1(ctx, document, retry);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
async function step$1(ctx, document, retry) {
|
|
84
|
+
const missed = getMissed(document);
|
|
85
|
+
if (missed.length === 0 || retry <= 0) return document.components;
|
|
86
|
+
const pointer = {
|
|
87
|
+
value: null
|
|
88
|
+
};
|
|
89
|
+
const agentica = new MicroAgentica({
|
|
90
|
+
model: ctx.model,
|
|
91
|
+
vendor: ctx.vendor,
|
|
92
|
+
config: {
|
|
93
|
+
...ctx.config ?? {},
|
|
94
|
+
executor: {
|
|
95
|
+
describe: null
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
histories: [ ...transformInterfaceHistories(ctx.state(), '# OpenAPI Schema Complement Agent\n\nYou are an AI agent specialized in complementing missing schema definitions in OpenAPI documents. Your primary responsibility is to identify and fill in schema types that are referenced via `$ref` but not yet defined in the `components.schemas` section.\n\n## Your Role\n\nYou analyze OpenAPI documents to find missing schema definitions and generate complete, accurate JSON Schema definitions for those missing types. You work as part of a larger OpenAPI document generation workflow, specifically handling the final step of ensuring all referenced schemas are properly defined.\n\n## Key Responsibilities\n\n1. **Identify Missing Schemas**: Scan the OpenAPI document for `$ref` references pointing to `#/components/schemas/[ISchemaName]` that don\'t have corresponding definitions\n2. **Generate Schema Definitions**: Create complete JSON Schema definitions for missing types based on context clues from API operations, database schemas, and usage patterns\n3. **Handle Nested References**: When creating new schemas, identify any new `$ref` references introduced in those schemas and ensure they are also defined\n4. **Iterative Completion**: Continue the process recursively until all referenced schemas (including nested ones) are properly defined\n5. **Ensure Completeness**: Make sure all generated schemas follow JSON Schema specifications and are consistent with OpenAPI 3.0+ standards\n\n## Function Calling\n\nYou have access to the `complementComponents` function which you should call when you identify missing schemas:\n\n```typescript\ncomplementComponents({\n schemas: {\n ISchemaName: {\n // Complete JSON Schema definition\n description: "Description must be clear and detailed"\n }\n }\n})\n```\n\n## Guidelines for Schema Generation\n\n1. **Type Inference**: Infer appropriate types based on context (API operations, database fields, naming conventions)\n2. **Property Requirements**: Determine which properties should be required vs optional based on usage patterns\n3. **Data Formats**: Apply appropriate formats (email, date-time, uri, etc.) when evident from context\n4. **Nested References**: Handle schemas that reference other schemas appropriately\n5. **Validation Rules**: Include reasonable validation constraints (minLength, maxLength, pattern, etc.) when applicable\n6. **Recursive Schema Detection**: When creating new schemas, scan them for additional `$ref` references and ensure those referenced schemas are also created\n7. **Dependency Chain Completion**: Continue generating schemas until no more missing references exist in the entire schema dependency chain\n8. **Comprehensive Descriptions**: Add detailed, clear descriptions to every schema and property that explain:\n - What the schema/property represents\n - Its purpose and usage context\n - Any business logic or constraints\n - Examples of valid values when helpful\n - Relationships to other entities or concepts\n\n## Response Format\n\n- Analyze the provided OpenAPI document systematically\n- Identify all missing schema references (including those in newly created schemas)\n- Generate appropriate schema definitions for all missing references\n- Recursively check for new `$ref` references introduced in generated schemas\n- Call the `complementComponents` function with all missing schemas (may require multiple calls if nested dependencies are discovered)\n- Provide a brief summary of what schemas were added and any dependency chains that were resolved\n\n## Quality Standards\n\n- Ensure all generated schemas are valid JSON Schema\n- Maintain consistency with existing schema patterns in the document\n- Use descriptive and clear property names\n- **Add comprehensive descriptions**: Every schema object and property must include detailed descriptions that are:\n - Clear and understandable to anyone reading the API documentation\n - Specific about the purpose and usage of each field\n - Include examples or context when helpful\n - Explain any business rules or constraints\n - Describe relationships between different entities\n- Follow OpenAPI best practices for schema design\n- Make the API documentation self-explanatory through excellent descriptions\n\nFocus on accuracy, completeness, and maintaining the integrity of the OpenAPI specification.'), {
|
|
99
|
+
type: "assistantMessage",
|
|
100
|
+
text: [ "Here is the OpenAPI document what you've made:", "", "```json", JSON.stringify(document), "```" ].join("\n")
|
|
101
|
+
}, {
|
|
102
|
+
type: "assistantMessage",
|
|
103
|
+
text: [ "You have missed below schema types in the document.components.schemas:", "", ...missed.map((s => `- ${s}`)) ].join("\n")
|
|
104
|
+
} ],
|
|
105
|
+
tokenUsage: ctx.usage(),
|
|
106
|
+
controllers: [ createApplication$6({
|
|
107
|
+
model: ctx.model,
|
|
108
|
+
build: next => {
|
|
109
|
+
pointer.value = OpenApiV3_1Emender.convertComponents({
|
|
110
|
+
schemas: next
|
|
111
|
+
}).schemas ?? {};
|
|
112
|
+
}
|
|
113
|
+
}) ]
|
|
114
|
+
});
|
|
115
|
+
agentica.on("request", (async event => {
|
|
116
|
+
event.body.tool_choice = "required";
|
|
117
|
+
}));
|
|
118
|
+
await agentica.conversate("Fill missing schema types please");
|
|
119
|
+
if (pointer.value === null) {
|
|
120
|
+
throw new Error("Failed to fill missing schema types. No response from agentica.");
|
|
121
|
+
}
|
|
122
|
+
ctx.dispatch({
|
|
123
|
+
type: "interfaceComplement",
|
|
124
|
+
missed,
|
|
125
|
+
schemas: pointer.value,
|
|
126
|
+
step: ctx.state().analyze?.step ?? 0,
|
|
127
|
+
created_at: (new Date).toISOString()
|
|
128
|
+
});
|
|
129
|
+
const newComponents = {
|
|
130
|
+
schemas: {
|
|
131
|
+
...pointer.value,
|
|
132
|
+
...document.components.schemas
|
|
133
|
+
},
|
|
134
|
+
authorization: document.components.authorization
|
|
135
|
+
};
|
|
136
|
+
return step$1(ctx, {
|
|
137
|
+
...document,
|
|
138
|
+
components: newComponents
|
|
139
|
+
}, retry - 1);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const getMissed = document => {
|
|
143
|
+
const missed = new Set;
|
|
144
|
+
const check = name => {
|
|
145
|
+
if (document.components.schemas[name] === undefined) missed.add(name);
|
|
146
|
+
};
|
|
147
|
+
for (const op of document.operations) {
|
|
148
|
+
if (op.requestBody !== null) check(op.requestBody.typeName);
|
|
149
|
+
if (op.responseBody !== null) check(op.responseBody.typeName);
|
|
150
|
+
}
|
|
151
|
+
for (const value of Object.values(document.components.schemas)) OpenApiTypeChecker.visit({
|
|
152
|
+
components: document.components,
|
|
153
|
+
schema: value,
|
|
154
|
+
closure: next => {
|
|
155
|
+
if (OpenApiTypeChecker.isReference(next)) check(next.$ref.split("/").pop());
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
return Array.from(missed);
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
function createApplication$6(props) {
|
|
162
|
+
assertSchemaModel(props.model);
|
|
163
|
+
const application = collection$8[props.model];
|
|
164
|
+
return {
|
|
165
|
+
protocol: "class",
|
|
166
|
+
name: "interface",
|
|
167
|
+
application,
|
|
168
|
+
execute: {
|
|
169
|
+
complementComponents: next => {
|
|
170
|
+
props.build(next.schemas);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const claude$8 = {
|
|
177
|
+
model: "claude",
|
|
178
|
+
options: {
|
|
179
|
+
reference: true,
|
|
180
|
+
separate: null
|
|
181
|
+
},
|
|
182
|
+
functions: [ {
|
|
183
|
+
name: "complementComponents",
|
|
184
|
+
parameters: {
|
|
185
|
+
description: "Current Type: {@link IComplementComponentsProps}",
|
|
186
|
+
type: "object",
|
|
187
|
+
properties: {
|
|
188
|
+
schemas: {
|
|
189
|
+
description: 'A collection of missing schema definitions that need to be added to the\nOpenAPI document\'s `components.schemas` section.\n\nThis object contains schema definitions for types that are referenced but\nnot yet defined:\n\n- Key: Schema name (`string`): The name of the schema type that will be\n referenced in $ref statements\n- Value: `AutoBeOpenApi.IJsonSchema` - The complete JSON Schema definition\n for that type\n\nExample structure:\n\n```typescript\n{\n "UserProfile": {\n "type": "object",\n "properties": {\n "id": { "type": "string" },\n "name": { "type": "string" },\n "email": { "type": "string", "format": "email" }\n },\n "required": ["id", "name", "email"]\n }\n}\n```\n\nEach schema definition follows the JSON Schema specification and will be\ndirectly inserted into the OpenAPI document\'s components.schemas section,\nmaking them available for $ref references throughout the API\nspecification.\n\n------------------------------\n\nDescription of the current {@link RecordstringAutoBeOpenApi.IJsonSchemaDescriptiveAutoBeOpenApi.IJsonSchema} type:\n\n> Construct a type with a set of properties K of type T',
|
|
190
|
+
type: "object",
|
|
191
|
+
properties: {},
|
|
192
|
+
required: [],
|
|
193
|
+
additionalProperties: {
|
|
194
|
+
description: "Description of the current {@link AutoBeOpenApi.IJsonSchemaDescriptiveAutoBeOpenApi.IJsonSchema} type:\n\n> Descriptive type schema info.\n> \n> `AutoBeOpenApi.IJsonSchemaDescriptive` is a type schema info of the OpenAPI\n> Generative, but it has a `description` property which is required.\n> \n> `AutoBeOpenApi.IJsonSchemaDescriptive` basically follows the JSON schema\n> specification of OpenAPI v3.1, but a little bit shrunk to remove ambiguous\n> and duplicated expressions of OpenAPI v3.1 for the convenience, clarity,\n> and AI generation.\n> \n> CRITICAL INSTRUCTIONS FOR OPTIMAL AI GENERATION:\n> \n> When creating descriptions for components, types, and properties:\n> \n> 1. ALWAYS refer to and incorporate the description comments from the\n> corresponding Prisma DB schema tables and columns. The descriptions\n> should match the style, level of detail, and terminology used in the\n> Prisma schema.\n> 2. ALL descriptions MUST be organized into MULTIPLE PARAGRAPHS separated by\n> line breaks. Single-paragraph descriptions should be avoided.\n> 3. Descriptions should comprehensively cover:\n> \n> - The purpose and business meaning of the type or property\n> - Relationships to other entities\n> - Validation rules, constraints, and edge cases\n> - Usage context and examples when helpful\n> 4. For each property of an object type, ensure its description reflects the\n> corresponding column description in the Prisma DB schema, maintaining\n> the same level of detail and terminology\n> 5. Descriptions should be so detailed and clear that anyone reading them can\n> fully understand the type or property without needing to reference any\n> other documentation",
|
|
195
|
+
type: "object",
|
|
196
|
+
properties: {
|
|
197
|
+
description: {
|
|
198
|
+
title: "Description about the type",
|
|
199
|
+
description: "Description about the type.\n\nCRITICAL: This description MUST be extensively detailed and MUST\nreference and align with the description comments from the\ncorresponding Prisma DB schema tables and columns.\n\nThe description MUST be organized into MULTIPLE PARAGRAPHS (separated\nby line breaks) based on different aspects of the type:\n\n- The purpose and business meaning of the type\n- Relationships to other entities in the system\n- Validation rules, constraints, and edge cases\n- Usage context and examples when helpful\n\nThis structured approach improves readability and helps readers better\nunderstand the type's various characteristics and use cases. The\ndescription should be so comprehensive that anyone reading it can fully\nunderstand the type without needing to reference other documentation.\n\n> MUST be written in English. Never use other languages.",
|
|
200
|
+
type: "string"
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
required: [ "description" ]
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
required: [ "schemas" ],
|
|
208
|
+
additionalProperties: false,
|
|
209
|
+
$defs: {}
|
|
210
|
+
},
|
|
211
|
+
description: 'Complements missing schema types\n\nThis method fills in schema definitions that are referenced via $ref but\nnot yet defined in the `components.schemas` section. For example, if an API\noperation references `{ "$ref": "#/components/schemas/UserProfile" }` but\n`UserProfile` type is not defined in `components.schemas`, this method will\nadd the missing schema definition.\n\nThis function is designed to be called via AI function calling mechanism to\nensure the OpenAPI document is complete and all referenced schemas are\nproperly defined.',
|
|
212
|
+
validate: (() => {
|
|
213
|
+
const _io0 = input => "object" === typeof input.schemas && null !== input.schemas && false === Array.isArray(input.schemas) && _io1(input.schemas);
|
|
214
|
+
const _io1 = input => Object.keys(input).every((key => {
|
|
215
|
+
const value = input[key];
|
|
216
|
+
if (undefined === value) return true;
|
|
217
|
+
return "object" === typeof value && null !== value && _io2(value);
|
|
218
|
+
}));
|
|
219
|
+
const _io2 = input => "string" === typeof input.description;
|
|
220
|
+
const _vo0 = (input, _path, _exceptionable = true) => [ ("object" === typeof input.schemas && null !== input.schemas && false === Array.isArray(input.schemas) || _report(_exceptionable, {
|
|
221
|
+
path: _path + ".schemas",
|
|
222
|
+
expected: "Record<string, AutoBeOpenApi.IJsonSchemaDescriptive<AutoBeOpenApi.IJsonSchema>>",
|
|
223
|
+
value: input.schemas
|
|
224
|
+
})) && _vo1(input.schemas, _path + ".schemas", _exceptionable) || _report(_exceptionable, {
|
|
225
|
+
path: _path + ".schemas",
|
|
226
|
+
expected: "Record<string, AutoBeOpenApi.IJsonSchemaDescriptive<AutoBeOpenApi.IJsonSchema>>",
|
|
227
|
+
value: input.schemas
|
|
228
|
+
}) ].every((flag => flag));
|
|
229
|
+
const _vo1 = (input, _path, _exceptionable = true) => [ false === _exceptionable || Object.keys(input).map((key => {
|
|
230
|
+
const value = input[key];
|
|
231
|
+
if (undefined === value) return true;
|
|
232
|
+
return ("object" === typeof value && null !== value || _report(_exceptionable, {
|
|
233
|
+
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
234
|
+
expected: "AutoBeOpenApi.IJsonSchemaDescriptive<AutoBeOpenApi.IJsonSchema>",
|
|
235
|
+
value
|
|
236
|
+
})) && _vo2(value, _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key), _exceptionable) || _report(_exceptionable, {
|
|
237
|
+
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
238
|
+
expected: "AutoBeOpenApi.IJsonSchemaDescriptive<AutoBeOpenApi.IJsonSchema>",
|
|
239
|
+
value
|
|
240
|
+
});
|
|
241
|
+
})).every((flag => flag)) ].every((flag => flag));
|
|
242
|
+
const _vo2 = (input, _path, _exceptionable = true) => [ "string" === typeof input.description || _report(_exceptionable, {
|
|
243
|
+
path: _path + ".description",
|
|
244
|
+
expected: "string",
|
|
245
|
+
value: input.description
|
|
246
|
+
}) ].every((flag => flag));
|
|
247
|
+
const __is = input => "object" === typeof input && null !== input && _io0(input);
|
|
248
|
+
let errors;
|
|
249
|
+
let _report;
|
|
250
|
+
return input => {
|
|
251
|
+
if (false === __is(input)) {
|
|
252
|
+
errors = [];
|
|
253
|
+
_report = __typia_transform__validateReport._validateReport(errors);
|
|
254
|
+
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
|
|
255
|
+
path: _path + "",
|
|
256
|
+
expected: "IComplementComponentsProps",
|
|
257
|
+
value: input
|
|
258
|
+
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
259
|
+
path: _path + "",
|
|
260
|
+
expected: "IComplementComponentsProps",
|
|
261
|
+
value: input
|
|
262
|
+
}))(input, "$input", true);
|
|
263
|
+
const success = 0 === errors.length;
|
|
264
|
+
return success ? {
|
|
265
|
+
success,
|
|
266
|
+
data: input
|
|
267
|
+
} : {
|
|
268
|
+
success,
|
|
269
|
+
errors,
|
|
270
|
+
data: input
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
return {
|
|
274
|
+
success: true,
|
|
275
|
+
data: input
|
|
276
|
+
};
|
|
277
|
+
};
|
|
278
|
+
})()
|
|
279
|
+
} ]
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
const collection$8 = {
|
|
283
|
+
chatgpt: {
|
|
284
|
+
model: "chatgpt",
|
|
285
|
+
options: {
|
|
286
|
+
reference: true,
|
|
287
|
+
strict: false,
|
|
288
|
+
separate: null
|
|
289
|
+
},
|
|
290
|
+
functions: [ {
|
|
291
|
+
name: "complementComponents",
|
|
292
|
+
parameters: {
|
|
293
|
+
description: "Current Type: {@link IComplementComponentsProps}",
|
|
294
|
+
type: "object",
|
|
295
|
+
properties: {
|
|
296
|
+
schemas: {
|
|
297
|
+
description: 'A collection of missing schema definitions that need to be added to the\nOpenAPI document\'s `components.schemas` section.\n\nThis object contains schema definitions for types that are referenced but\nnot yet defined:\n\n- Key: Schema name (`string`): The name of the schema type that will be\n referenced in $ref statements\n- Value: `AutoBeOpenApi.IJsonSchema` - The complete JSON Schema definition\n for that type\n\nExample structure:\n\n```typescript\n{\n "UserProfile": {\n "type": "object",\n "properties": {\n "id": { "type": "string" },\n "name": { "type": "string" },\n "email": { "type": "string", "format": "email" }\n },\n "required": ["id", "name", "email"]\n }\n}\n```\n\nEach schema definition follows the JSON Schema specification and will be\ndirectly inserted into the OpenAPI document\'s components.schemas section,\nmaking them available for $ref references throughout the API\nspecification.\n\n------------------------------\n\nDescription of the current {@link RecordstringAutoBeOpenApi.IJsonSchemaDescriptiveAutoBeOpenApi.IJsonSchema} type:\n\n> Construct a type with a set of properties K of type T',
|
|
298
|
+
type: "object",
|
|
299
|
+
properties: {},
|
|
300
|
+
required: [],
|
|
301
|
+
additionalProperties: {
|
|
302
|
+
description: "Description of the current {@link AutoBeOpenApi.IJsonSchemaDescriptiveAutoBeOpenApi.IJsonSchema} type:\n\n> Descriptive type schema info.\n> \n> `AutoBeOpenApi.IJsonSchemaDescriptive` is a type schema info of the OpenAPI\n> Generative, but it has a `description` property which is required.\n> \n> `AutoBeOpenApi.IJsonSchemaDescriptive` basically follows the JSON schema\n> specification of OpenAPI v3.1, but a little bit shrunk to remove ambiguous\n> and duplicated expressions of OpenAPI v3.1 for the convenience, clarity,\n> and AI generation.\n> \n> CRITICAL INSTRUCTIONS FOR OPTIMAL AI GENERATION:\n> \n> When creating descriptions for components, types, and properties:\n> \n> 1. ALWAYS refer to and incorporate the description comments from the\n> corresponding Prisma DB schema tables and columns. The descriptions\n> should match the style, level of detail, and terminology used in the\n> Prisma schema.\n> 2. ALL descriptions MUST be organized into MULTIPLE PARAGRAPHS separated by\n> line breaks. Single-paragraph descriptions should be avoided.\n> 3. Descriptions should comprehensively cover:\n> \n> - The purpose and business meaning of the type or property\n> - Relationships to other entities\n> - Validation rules, constraints, and edge cases\n> - Usage context and examples when helpful\n> 4. For each property of an object type, ensure its description reflects the\n> corresponding column description in the Prisma DB schema, maintaining\n> the same level of detail and terminology\n> 5. Descriptions should be so detailed and clear that anyone reading them can\n> fully understand the type or property without needing to reference any\n> other documentation",
|
|
303
|
+
type: "object",
|
|
304
|
+
properties: {
|
|
305
|
+
description: {
|
|
306
|
+
title: "Description about the type",
|
|
307
|
+
description: "Description about the type.\n\nCRITICAL: This description MUST be extensively detailed and MUST\nreference and align with the description comments from the\ncorresponding Prisma DB schema tables and columns.\n\nThe description MUST be organized into MULTIPLE PARAGRAPHS (separated\nby line breaks) based on different aspects of the type:\n\n- The purpose and business meaning of the type\n- Relationships to other entities in the system\n- Validation rules, constraints, and edge cases\n- Usage context and examples when helpful\n\nThis structured approach improves readability and helps readers better\nunderstand the type's various characteristics and use cases. The\ndescription should be so comprehensive that anyone reading it can fully\nunderstand the type without needing to reference other documentation.\n\n> MUST be written in English. Never use other languages.",
|
|
308
|
+
type: "string"
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
required: [ "description" ]
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
required: [ "schemas" ],
|
|
316
|
+
additionalProperties: false,
|
|
317
|
+
$defs: {}
|
|
318
|
+
},
|
|
319
|
+
description: 'Complements missing schema types\n\nThis method fills in schema definitions that are referenced via $ref but\nnot yet defined in the `components.schemas` section. For example, if an API\noperation references `{ "$ref": "#/components/schemas/UserProfile" }` but\n`UserProfile` type is not defined in `components.schemas`, this method will\nadd the missing schema definition.\n\nThis function is designed to be called via AI function calling mechanism to\nensure the OpenAPI document is complete and all referenced schemas are\nproperly defined.',
|
|
320
|
+
validate: (() => {
|
|
321
|
+
const _io0 = input => "object" === typeof input.schemas && null !== input.schemas && false === Array.isArray(input.schemas) && _io1(input.schemas);
|
|
322
|
+
const _io1 = input => Object.keys(input).every((key => {
|
|
323
|
+
const value = input[key];
|
|
324
|
+
if (undefined === value) return true;
|
|
325
|
+
return "object" === typeof value && null !== value && _io2(value);
|
|
326
|
+
}));
|
|
327
|
+
const _io2 = input => "string" === typeof input.description;
|
|
328
|
+
const _vo0 = (input, _path, _exceptionable = true) => [ ("object" === typeof input.schemas && null !== input.schemas && false === Array.isArray(input.schemas) || _report(_exceptionable, {
|
|
329
|
+
path: _path + ".schemas",
|
|
330
|
+
expected: "Record<string, AutoBeOpenApi.IJsonSchemaDescriptive<AutoBeOpenApi.IJsonSchema>>",
|
|
331
|
+
value: input.schemas
|
|
332
|
+
})) && _vo1(input.schemas, _path + ".schemas", _exceptionable) || _report(_exceptionable, {
|
|
333
|
+
path: _path + ".schemas",
|
|
334
|
+
expected: "Record<string, AutoBeOpenApi.IJsonSchemaDescriptive<AutoBeOpenApi.IJsonSchema>>",
|
|
335
|
+
value: input.schemas
|
|
336
|
+
}) ].every((flag => flag));
|
|
337
|
+
const _vo1 = (input, _path, _exceptionable = true) => [ false === _exceptionable || Object.keys(input).map((key => {
|
|
338
|
+
const value = input[key];
|
|
339
|
+
if (undefined === value) return true;
|
|
340
|
+
return ("object" === typeof value && null !== value || _report(_exceptionable, {
|
|
341
|
+
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
342
|
+
expected: "AutoBeOpenApi.IJsonSchemaDescriptive<AutoBeOpenApi.IJsonSchema>",
|
|
343
|
+
value
|
|
344
|
+
})) && _vo2(value, _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key), _exceptionable) || _report(_exceptionable, {
|
|
345
|
+
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
346
|
+
expected: "AutoBeOpenApi.IJsonSchemaDescriptive<AutoBeOpenApi.IJsonSchema>",
|
|
347
|
+
value
|
|
348
|
+
});
|
|
349
|
+
})).every((flag => flag)) ].every((flag => flag));
|
|
350
|
+
const _vo2 = (input, _path, _exceptionable = true) => [ "string" === typeof input.description || _report(_exceptionable, {
|
|
351
|
+
path: _path + ".description",
|
|
352
|
+
expected: "string",
|
|
353
|
+
value: input.description
|
|
354
|
+
}) ].every((flag => flag));
|
|
355
|
+
const __is = input => "object" === typeof input && null !== input && _io0(input);
|
|
356
|
+
let errors;
|
|
357
|
+
let _report;
|
|
358
|
+
return input => {
|
|
359
|
+
if (false === __is(input)) {
|
|
360
|
+
errors = [];
|
|
361
|
+
_report = __typia_transform__validateReport._validateReport(errors);
|
|
362
|
+
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
|
|
363
|
+
path: _path + "",
|
|
364
|
+
expected: "IComplementComponentsProps",
|
|
365
|
+
value: input
|
|
366
|
+
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
367
|
+
path: _path + "",
|
|
368
|
+
expected: "IComplementComponentsProps",
|
|
369
|
+
value: input
|
|
370
|
+
}))(input, "$input", true);
|
|
371
|
+
const success = 0 === errors.length;
|
|
372
|
+
return success ? {
|
|
373
|
+
success,
|
|
374
|
+
data: input
|
|
375
|
+
} : {
|
|
376
|
+
success,
|
|
377
|
+
errors,
|
|
378
|
+
data: input
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
return {
|
|
382
|
+
success: true,
|
|
383
|
+
data: input
|
|
384
|
+
};
|
|
385
|
+
};
|
|
386
|
+
})()
|
|
387
|
+
} ]
|
|
388
|
+
},
|
|
389
|
+
claude: claude$8,
|
|
390
|
+
llama: claude$8,
|
|
391
|
+
deepseek: claude$8,
|
|
392
|
+
3.1: claude$8,
|
|
393
|
+
"3.0": {
|
|
394
|
+
model: "3.0",
|
|
395
|
+
options: {
|
|
396
|
+
constraint: true,
|
|
397
|
+
recursive: 3,
|
|
398
|
+
separate: null
|
|
399
|
+
},
|
|
400
|
+
functions: [ {
|
|
401
|
+
name: "complementComponents",
|
|
402
|
+
parameters: {
|
|
403
|
+
type: "object",
|
|
404
|
+
properties: {
|
|
405
|
+
schemas: {
|
|
406
|
+
type: "object",
|
|
407
|
+
properties: {},
|
|
408
|
+
required: [],
|
|
409
|
+
description: 'A collection of missing schema definitions that need to be added to the\nOpenAPI document\'s `components.schemas` section.\n\nThis object contains schema definitions for types that are referenced but\nnot yet defined:\n\n- Key: Schema name (`string`): The name of the schema type that will be\n referenced in $ref statements\n- Value: `AutoBeOpenApi.IJsonSchema` - The complete JSON Schema definition\n for that type\n\nExample structure:\n\n```typescript\n{\n "UserProfile": {\n "type": "object",\n "properties": {\n "id": { "type": "string" },\n "name": { "type": "string" },\n "email": { "type": "string", "format": "email" }\n },\n "required": ["id", "name", "email"]\n }\n}\n```\n\nEach schema definition follows the JSON Schema specification and will be\ndirectly inserted into the OpenAPI document\'s components.schemas section,\nmaking them available for $ref references throughout the API\nspecification.\n\n------------------------------\n\nDescription of the current {@link RecordstringAutoBeOpenApi.IJsonSchemaDescriptiveAutoBeOpenApi.IJsonSchema} type:\n\n> Construct a type with a set of properties K of type T',
|
|
410
|
+
additionalProperties: {
|
|
411
|
+
type: "object",
|
|
412
|
+
properties: {
|
|
413
|
+
description: {
|
|
414
|
+
type: "string",
|
|
415
|
+
title: "Description about the type",
|
|
416
|
+
description: "Description about the type.\n\nCRITICAL: This description MUST be extensively detailed and MUST\nreference and align with the description comments from the\ncorresponding Prisma DB schema tables and columns.\n\nThe description MUST be organized into MULTIPLE PARAGRAPHS (separated\nby line breaks) based on different aspects of the type:\n\n- The purpose and business meaning of the type\n- Relationships to other entities in the system\n- Validation rules, constraints, and edge cases\n- Usage context and examples when helpful\n\nThis structured approach improves readability and helps readers better\nunderstand the type's various characteristics and use cases. The\ndescription should be so comprehensive that anyone reading it can fully\nunderstand the type without needing to reference other documentation.\n\n> MUST be written in English. Never use other languages."
|
|
417
|
+
}
|
|
418
|
+
},
|
|
419
|
+
required: [ "description" ],
|
|
420
|
+
description: "Description of the current {@link AutoBeOpenApi.IJsonSchemaDescriptiveAutoBeOpenApi.IJsonSchema} type:\n\n> Descriptive type schema info.\n> \n> `AutoBeOpenApi.IJsonSchemaDescriptive` is a type schema info of the OpenAPI\n> Generative, but it has a `description` property which is required.\n> \n> `AutoBeOpenApi.IJsonSchemaDescriptive` basically follows the JSON schema\n> specification of OpenAPI v3.1, but a little bit shrunk to remove ambiguous\n> and duplicated expressions of OpenAPI v3.1 for the convenience, clarity,\n> and AI generation.\n> \n> CRITICAL INSTRUCTIONS FOR OPTIMAL AI GENERATION:\n> \n> When creating descriptions for components, types, and properties:\n> \n> 1. ALWAYS refer to and incorporate the description comments from the\n> corresponding Prisma DB schema tables and columns. The descriptions\n> should match the style, level of detail, and terminology used in the\n> Prisma schema.\n> 2. ALL descriptions MUST be organized into MULTIPLE PARAGRAPHS separated by\n> line breaks. Single-paragraph descriptions should be avoided.\n> 3. Descriptions should comprehensively cover:\n> \n> - The purpose and business meaning of the type or property\n> - Relationships to other entities\n> - Validation rules, constraints, and edge cases\n> - Usage context and examples when helpful\n> 4. For each property of an object type, ensure its description reflects the\n> corresponding column description in the Prisma DB schema, maintaining\n> the same level of detail and terminology\n> 5. Descriptions should be so detailed and clear that anyone reading them can\n> fully understand the type or property without needing to reference any\n> other documentation",
|
|
421
|
+
additionalProperties: false
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
},
|
|
425
|
+
required: [ "schemas" ],
|
|
426
|
+
description: "Current Type: {@link IComplementComponentsProps}",
|
|
427
|
+
additionalProperties: false
|
|
428
|
+
},
|
|
429
|
+
description: 'Complements missing schema types\n\nThis method fills in schema definitions that are referenced via $ref but\nnot yet defined in the `components.schemas` section. For example, if an API\noperation references `{ "$ref": "#/components/schemas/UserProfile" }` but\n`UserProfile` type is not defined in `components.schemas`, this method will\nadd the missing schema definition.\n\nThis function is designed to be called via AI function calling mechanism to\nensure the OpenAPI document is complete and all referenced schemas are\nproperly defined.',
|
|
430
|
+
validate: (() => {
|
|
431
|
+
const _io0 = input => "object" === typeof input.schemas && null !== input.schemas && false === Array.isArray(input.schemas) && _io1(input.schemas);
|
|
432
|
+
const _io1 = input => Object.keys(input).every((key => {
|
|
433
|
+
const value = input[key];
|
|
434
|
+
if (undefined === value) return true;
|
|
435
|
+
return "object" === typeof value && null !== value && _io2(value);
|
|
436
|
+
}));
|
|
437
|
+
const _io2 = input => "string" === typeof input.description;
|
|
438
|
+
const _vo0 = (input, _path, _exceptionable = true) => [ ("object" === typeof input.schemas && null !== input.schemas && false === Array.isArray(input.schemas) || _report(_exceptionable, {
|
|
439
|
+
path: _path + ".schemas",
|
|
440
|
+
expected: "Record<string, AutoBeOpenApi.IJsonSchemaDescriptive<AutoBeOpenApi.IJsonSchema>>",
|
|
441
|
+
value: input.schemas
|
|
442
|
+
})) && _vo1(input.schemas, _path + ".schemas", _exceptionable) || _report(_exceptionable, {
|
|
443
|
+
path: _path + ".schemas",
|
|
444
|
+
expected: "Record<string, AutoBeOpenApi.IJsonSchemaDescriptive<AutoBeOpenApi.IJsonSchema>>",
|
|
445
|
+
value: input.schemas
|
|
446
|
+
}) ].every((flag => flag));
|
|
447
|
+
const _vo1 = (input, _path, _exceptionable = true) => [ false === _exceptionable || Object.keys(input).map((key => {
|
|
448
|
+
const value = input[key];
|
|
449
|
+
if (undefined === value) return true;
|
|
450
|
+
return ("object" === typeof value && null !== value || _report(_exceptionable, {
|
|
451
|
+
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
452
|
+
expected: "AutoBeOpenApi.IJsonSchemaDescriptive<AutoBeOpenApi.IJsonSchema>",
|
|
453
|
+
value
|
|
454
|
+
})) && _vo2(value, _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key), _exceptionable) || _report(_exceptionable, {
|
|
455
|
+
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
456
|
+
expected: "AutoBeOpenApi.IJsonSchemaDescriptive<AutoBeOpenApi.IJsonSchema>",
|
|
457
|
+
value
|
|
458
|
+
});
|
|
459
|
+
})).every((flag => flag)) ].every((flag => flag));
|
|
460
|
+
const _vo2 = (input, _path, _exceptionable = true) => [ "string" === typeof input.description || _report(_exceptionable, {
|
|
461
|
+
path: _path + ".description",
|
|
462
|
+
expected: "string",
|
|
463
|
+
value: input.description
|
|
464
|
+
}) ].every((flag => flag));
|
|
465
|
+
const __is = input => "object" === typeof input && null !== input && _io0(input);
|
|
466
|
+
let errors;
|
|
467
|
+
let _report;
|
|
468
|
+
return input => {
|
|
469
|
+
if (false === __is(input)) {
|
|
470
|
+
errors = [];
|
|
471
|
+
_report = __typia_transform__validateReport._validateReport(errors);
|
|
472
|
+
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
|
|
473
|
+
path: _path + "",
|
|
474
|
+
expected: "IComplementComponentsProps",
|
|
475
|
+
value: input
|
|
476
|
+
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
477
|
+
path: _path + "",
|
|
478
|
+
expected: "IComplementComponentsProps",
|
|
479
|
+
value: input
|
|
480
|
+
}))(input, "$input", true);
|
|
481
|
+
const success = 0 === errors.length;
|
|
482
|
+
return success ? {
|
|
483
|
+
success,
|
|
484
|
+
data: input
|
|
485
|
+
} : {
|
|
486
|
+
success,
|
|
487
|
+
errors,
|
|
488
|
+
data: input
|
|
489
|
+
};
|
|
490
|
+
}
|
|
491
|
+
return {
|
|
492
|
+
success: true,
|
|
493
|
+
data: input
|
|
494
|
+
};
|
|
495
|
+
};
|
|
496
|
+
})()
|
|
497
|
+
} ]
|
|
498
|
+
}
|
|
499
|
+
};
|
|
500
|
+
|
|
501
|
+
function divideArray(props) {
|
|
502
|
+
if (props.capacity <= 0) {
|
|
503
|
+
throw new Error("Capacity must be a positive integer");
|
|
504
|
+
}
|
|
505
|
+
if (Number.isNaN(props.capacity)) {
|
|
506
|
+
throw new TypeError("Capacity must be a positive integer");
|
|
507
|
+
}
|
|
508
|
+
if (props.capacity === Infinity) {
|
|
509
|
+
throw new Error("Capacity must be a positive integer");
|
|
510
|
+
}
|
|
511
|
+
const size = Math.ceil(props.array.length / props.capacity);
|
|
512
|
+
const capacity = Math.ceil(props.array.length / size);
|
|
513
|
+
const replica = props.array.slice();
|
|
514
|
+
return Array.from({
|
|
515
|
+
length: size
|
|
516
|
+
}, (() => replica.splice(0, capacity)));
|
|
517
|
+
}
|
|
518
|
+
|
|
97
519
|
async function orchestrateInterfaceComponents(ctx, operations, capacity = 12) {
|
|
98
520
|
const typeNames = new Set;
|
|
99
521
|
for (const op of operations) {
|
|
@@ -186,115 +608,6 @@ async function process$2(ctx, operations, oldbie, remained) {
|
|
|
186
608
|
function createApplication$5(props) {
|
|
187
609
|
assertSchemaModel(props.model);
|
|
188
610
|
const application = collection$7[props.model];
|
|
189
|
-
const validate = next => {
|
|
190
|
-
const result = (() => {
|
|
191
|
-
const _io0 = input => "object" === typeof input.components && null !== input.components && _io1(input.components);
|
|
192
|
-
const _io1 = input => "object" === typeof input.schemas && null !== input.schemas && false === Array.isArray(input.schemas) && _io2(input.schemas) && (undefined === input.authorization || "header" === input.authorization);
|
|
193
|
-
const _io2 = input => Object.keys(input).every((key => {
|
|
194
|
-
const value = input[key];
|
|
195
|
-
if (undefined === value) return true;
|
|
196
|
-
return "object" === typeof value && null !== value && _io3(value);
|
|
197
|
-
}));
|
|
198
|
-
const _io3 = input => "string" === typeof input.description;
|
|
199
|
-
const _vo0 = (input, _path, _exceptionable = true) => [ ("object" === typeof input.components && null !== input.components || _report(_exceptionable, {
|
|
200
|
-
path: _path + ".components",
|
|
201
|
-
expected: "AutoBeOpenApi.IComponents",
|
|
202
|
-
value: input.components
|
|
203
|
-
})) && _vo1(input.components, _path + ".components", _exceptionable) || _report(_exceptionable, {
|
|
204
|
-
path: _path + ".components",
|
|
205
|
-
expected: "AutoBeOpenApi.IComponents",
|
|
206
|
-
value: input.components
|
|
207
|
-
}) ].every((flag => flag));
|
|
208
|
-
const _vo1 = (input, _path, _exceptionable = true) => [ ("object" === typeof input.schemas && null !== input.schemas && false === Array.isArray(input.schemas) || _report(_exceptionable, {
|
|
209
|
-
path: _path + ".schemas",
|
|
210
|
-
expected: "Record<string, AutoBeOpenApi.IJsonSchemaDescriptive<AutoBeOpenApi.IJsonSchema>>",
|
|
211
|
-
value: input.schemas
|
|
212
|
-
})) && _vo2(input.schemas, _path + ".schemas", _exceptionable) || _report(_exceptionable, {
|
|
213
|
-
path: _path + ".schemas",
|
|
214
|
-
expected: "Record<string, AutoBeOpenApi.IJsonSchemaDescriptive<AutoBeOpenApi.IJsonSchema>>",
|
|
215
|
-
value: input.schemas
|
|
216
|
-
}), undefined === input.authorization || "header" === input.authorization || _report(_exceptionable, {
|
|
217
|
-
path: _path + ".authorization",
|
|
218
|
-
expected: '("header" | undefined)',
|
|
219
|
-
value: input.authorization
|
|
220
|
-
}) ].every((flag => flag));
|
|
221
|
-
const _vo2 = (input, _path, _exceptionable = true) => [ false === _exceptionable || Object.keys(input).map((key => {
|
|
222
|
-
const value = input[key];
|
|
223
|
-
if (undefined === value) return true;
|
|
224
|
-
return ("object" === typeof value && null !== value || _report(_exceptionable, {
|
|
225
|
-
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
226
|
-
expected: "AutoBeOpenApi.IJsonSchemaDescriptive<AutoBeOpenApi.IJsonSchema>",
|
|
227
|
-
value
|
|
228
|
-
})) && _vo3(value, _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key), _exceptionable) || _report(_exceptionable, {
|
|
229
|
-
path: _path + __typia_transform__accessExpressionAsString._accessExpressionAsString(key),
|
|
230
|
-
expected: "AutoBeOpenApi.IJsonSchemaDescriptive<AutoBeOpenApi.IJsonSchema>",
|
|
231
|
-
value
|
|
232
|
-
});
|
|
233
|
-
})).every((flag => flag)) ].every((flag => flag));
|
|
234
|
-
const _vo3 = (input, _path, _exceptionable = true) => [ "string" === typeof input.description || _report(_exceptionable, {
|
|
235
|
-
path: _path + ".description",
|
|
236
|
-
expected: "string",
|
|
237
|
-
value: input.description
|
|
238
|
-
}) ].every((flag => flag));
|
|
239
|
-
const __is = input => "object" === typeof input && null !== input && _io0(input);
|
|
240
|
-
let errors;
|
|
241
|
-
let _report;
|
|
242
|
-
return input => {
|
|
243
|
-
if (false === __is(input)) {
|
|
244
|
-
errors = [];
|
|
245
|
-
_report = __typia_transform__validateReport._validateReport(errors);
|
|
246
|
-
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
|
|
247
|
-
path: _path + "",
|
|
248
|
-
expected: "IMakeComponentsProps",
|
|
249
|
-
value: input
|
|
250
|
-
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
251
|
-
path: _path + "",
|
|
252
|
-
expected: "IMakeComponentsProps",
|
|
253
|
-
value: input
|
|
254
|
-
}))(input, "$input", true);
|
|
255
|
-
const success = 0 === errors.length;
|
|
256
|
-
return success ? {
|
|
257
|
-
success,
|
|
258
|
-
data: input
|
|
259
|
-
} : {
|
|
260
|
-
success,
|
|
261
|
-
errors,
|
|
262
|
-
data: input
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
|
-
return {
|
|
266
|
-
success: true,
|
|
267
|
-
data: input
|
|
268
|
-
};
|
|
269
|
-
};
|
|
270
|
-
})()(next);
|
|
271
|
-
if (result.success === false) return result;
|
|
272
|
-
props.pointer.value = result.data.components;
|
|
273
|
-
const errors = [];
|
|
274
|
-
for (const value of Object.values(result.data.components.schemas)) {
|
|
275
|
-
OpenApiTypeChecker.visit({
|
|
276
|
-
components: result.data.components,
|
|
277
|
-
schema: value,
|
|
278
|
-
closure: v => {
|
|
279
|
-
if (OpenApiTypeChecker.isReference(v)) {
|
|
280
|
-
const key = v.$ref.split("/").at(-1);
|
|
281
|
-
if (result.data.components.schemas?.[key] === undefined) errors.push({
|
|
282
|
-
path: `components.schemas.${key}`,
|
|
283
|
-
expected: "AutoBeOpenApi.IJsonSchemaDescriptive",
|
|
284
|
-
value: "undefined"
|
|
285
|
-
});
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
|
-
if (errors.length !== 0) return {
|
|
291
|
-
success: false,
|
|
292
|
-
data: result.data,
|
|
293
|
-
errors
|
|
294
|
-
};
|
|
295
|
-
return result;
|
|
296
|
-
};
|
|
297
|
-
application.functions[0].validate = validate;
|
|
298
611
|
return {
|
|
299
612
|
protocol: "class",
|
|
300
613
|
name: "interface",
|
|
@@ -302,9 +615,6 @@ function createApplication$5(props) {
|
|
|
302
615
|
execute: {
|
|
303
616
|
makeComponents: async next => {
|
|
304
617
|
await props.build(next.components);
|
|
305
|
-
return {
|
|
306
|
-
success: true
|
|
307
|
-
};
|
|
308
618
|
}
|
|
309
619
|
}
|
|
310
620
|
};
|
|
@@ -323,7 +633,7 @@ const claude$7 = {
|
|
|
323
633
|
type: "object",
|
|
324
634
|
properties: {
|
|
325
635
|
components: {
|
|
326
|
-
description: 'Complete set of schema components for the OpenAPI specification.\n\nThis property contains comprehensive type definitions for all entities in\nthe system. It is the central repository of all named schema types that\nwill be used throughout the API specification.\n\nCRITICAL REQUIREMENT: All object types MUST be defined as named types in\nthe components.schemas section. Inline anonymous object definitions are\nstrictly prohibited.\n\nThis components object should include:\n\n- Main entity types (IEntityName)\n- Operation-specific variants (.ICreate, .IUpdate, .ISummary, etc.)\n- Container types (IPage<T> for pagination)\n- Enumeration types\n\nAll schema definitions must include detailed descriptions that reference\nthe original Prisma schema comments and thoroughly document each property.\nEvery property that references an object must use a $ref to a named type in\nthe components.schemas section. This applies to all objects in request\nbodies, response bodies, and properties that are objects or arrays of\nobjects.\n\nExample structure:\n\n
|
|
636
|
+
description: 'Complete set of schema components for the OpenAPI specification.\n\nThis property contains comprehensive type definitions for all entities in\nthe system. It is the central repository of all named schema types that\nwill be used throughout the API specification.\n\nCRITICAL REQUIREMENT: All object types MUST be defined as named types in\nthe components.schemas section. Inline anonymous object definitions are\nstrictly prohibited.\n\nThis components object should include:\n\n- Main entity types (IEntityName)\n- Operation-specific variants (.ICreate, .IUpdate, .ISummary, etc.)\n- Container types (IPage<T> for pagination)\n- Enumeration types\n\nAll schema definitions must include detailed descriptions that reference\nthe original Prisma schema comments and thoroughly document each property.\nEvery property that references an object must use a $ref to a named type in\nthe components.schemas section. This applies to all objects in request\nbodies, response bodies, and properties that are objects or arrays of\nobjects.\n\nExample structure:\n\n```typescript\n{\n components: {\n schemas: {\n IUser: {\n type: "object",\n properties: {\n id: { type: "string", format: "uuid" },\n email: { type: "string", format: "email" },\n profile: { "$ref": "#/components/schemas/IUserProfile" }\n },\n required: ["id", "email"],\n description: "User entity representing system account holders..."\n },\n "IUser.ICreate": { ... },\n // Additional schemas\n }\n }\n}\n```\n\n------------------------------\n\nDescription of the current {@link AutoBeOpenApi.IComponents} type:\n\n> Reusable components in OpenAPI.\n> \n> A storage of reusable components in OpenAPI document.\n> \n> In other words, it is a storage of named DTO schemas and security schemes.',
|
|
327
637
|
type: "object",
|
|
328
638
|
properties: {
|
|
329
639
|
schemas: {
|
|
@@ -457,7 +767,7 @@ const collection$7 = {
|
|
|
457
767
|
type: "object",
|
|
458
768
|
properties: {
|
|
459
769
|
components: {
|
|
460
|
-
description: 'Complete set of schema components for the OpenAPI specification.\n\nThis property contains comprehensive type definitions for all entities in\nthe system. It is the central repository of all named schema types that\nwill be used throughout the API specification.\n\nCRITICAL REQUIREMENT: All object types MUST be defined as named types in\nthe components.schemas section. Inline anonymous object definitions are\nstrictly prohibited.\n\nThis components object should include:\n\n- Main entity types (IEntityName)\n- Operation-specific variants (.ICreate, .IUpdate, .ISummary, etc.)\n- Container types (IPage<T> for pagination)\n- Enumeration types\n\nAll schema definitions must include detailed descriptions that reference\nthe original Prisma schema comments and thoroughly document each property.\nEvery property that references an object must use a $ref to a named type in\nthe components.schemas section. This applies to all objects in request\nbodies, response bodies, and properties that are objects or arrays of\nobjects.\n\nExample structure:\n\n
|
|
770
|
+
description: 'Complete set of schema components for the OpenAPI specification.\n\nThis property contains comprehensive type definitions for all entities in\nthe system. It is the central repository of all named schema types that\nwill be used throughout the API specification.\n\nCRITICAL REQUIREMENT: All object types MUST be defined as named types in\nthe components.schemas section. Inline anonymous object definitions are\nstrictly prohibited.\n\nThis components object should include:\n\n- Main entity types (IEntityName)\n- Operation-specific variants (.ICreate, .IUpdate, .ISummary, etc.)\n- Container types (IPage<T> for pagination)\n- Enumeration types\n\nAll schema definitions must include detailed descriptions that reference\nthe original Prisma schema comments and thoroughly document each property.\nEvery property that references an object must use a $ref to a named type in\nthe components.schemas section. This applies to all objects in request\nbodies, response bodies, and properties that are objects or arrays of\nobjects.\n\nExample structure:\n\n```typescript\n{\n components: {\n schemas: {\n IUser: {\n type: "object",\n properties: {\n id: { type: "string", format: "uuid" },\n email: { type: "string", format: "email" },\n profile: { "$ref": "#/components/schemas/IUserProfile" }\n },\n required: ["id", "email"],\n description: "User entity representing system account holders..."\n },\n "IUser.ICreate": { ... },\n // Additional schemas\n }\n }\n}\n```\n\n------------------------------\n\nDescription of the current {@link AutoBeOpenApi.IComponents} type:\n\n> Reusable components in OpenAPI.\n> \n> A storage of reusable components in OpenAPI document.\n> \n> In other words, it is a storage of named DTO schemas and security schemes.',
|
|
461
771
|
type: "object",
|
|
462
772
|
properties: {
|
|
463
773
|
schemas: {
|
|
@@ -622,7 +932,7 @@ const collection$7 = {
|
|
|
622
932
|
}
|
|
623
933
|
},
|
|
624
934
|
required: [ "schemas" ],
|
|
625
|
-
description: 'Complete set of schema components for the OpenAPI specification.\n\nThis property contains comprehensive type definitions for all entities in\nthe system. It is the central repository of all named schema types that\nwill be used throughout the API specification.\n\nCRITICAL REQUIREMENT: All object types MUST be defined as named types in\nthe components.schemas section. Inline anonymous object definitions are\nstrictly prohibited.\n\nThis components object should include:\n\n- Main entity types (IEntityName)\n- Operation-specific variants (.ICreate, .IUpdate, .ISummary, etc.)\n- Container types (IPage<T> for pagination)\n- Enumeration types\n\nAll schema definitions must include detailed descriptions that reference\nthe original Prisma schema comments and thoroughly document each property.\nEvery property that references an object must use a $ref to a named type in\nthe components.schemas section. This applies to all objects in request\nbodies, response bodies, and properties that are objects or arrays of\nobjects.\n\nExample structure:\n\n
|
|
935
|
+
description: 'Complete set of schema components for the OpenAPI specification.\n\nThis property contains comprehensive type definitions for all entities in\nthe system. It is the central repository of all named schema types that\nwill be used throughout the API specification.\n\nCRITICAL REQUIREMENT: All object types MUST be defined as named types in\nthe components.schemas section. Inline anonymous object definitions are\nstrictly prohibited.\n\nThis components object should include:\n\n- Main entity types (IEntityName)\n- Operation-specific variants (.ICreate, .IUpdate, .ISummary, etc.)\n- Container types (IPage<T> for pagination)\n- Enumeration types\n\nAll schema definitions must include detailed descriptions that reference\nthe original Prisma schema comments and thoroughly document each property.\nEvery property that references an object must use a $ref to a named type in\nthe components.schemas section. This applies to all objects in request\nbodies, response bodies, and properties that are objects or arrays of\nobjects.\n\nExample structure:\n\n```typescript\n{\n components: {\n schemas: {\n IUser: {\n type: "object",\n properties: {\n id: { type: "string", format: "uuid" },\n email: { type: "string", format: "email" },\n profile: { "$ref": "#/components/schemas/IUserProfile" }\n },\n required: ["id", "email"],\n description: "User entity representing system account holders..."\n },\n "IUser.ICreate": { ... },\n // Additional schemas\n }\n }\n}\n```\n\n------------------------------\n\nDescription of the current {@link AutoBeOpenApi.IComponents} type:\n\n> Reusable components in OpenAPI.\n> \n> A storage of reusable components in OpenAPI document.\n> \n> In other words, it is a storage of named DTO schemas and security schemes.',
|
|
626
936
|
additionalProperties: false
|
|
627
937
|
}
|
|
628
938
|
},
|
|
@@ -747,7 +1057,7 @@ async function orchestrateInterfaceEndpoints(ctx, content = "Make API endpoints
|
|
|
747
1057
|
tokenUsage: ctx.usage(),
|
|
748
1058
|
controllers: [ createApplication$4({
|
|
749
1059
|
model: ctx.model,
|
|
750
|
-
build:
|
|
1060
|
+
build: endpoints => {
|
|
751
1061
|
pointer.value = endpoints;
|
|
752
1062
|
}
|
|
753
1063
|
}) ]
|
|
@@ -775,11 +1085,8 @@ function createApplication$4(props) {
|
|
|
775
1085
|
name: "interface",
|
|
776
1086
|
application,
|
|
777
1087
|
execute: {
|
|
778
|
-
makeEndpoints:
|
|
779
|
-
|
|
780
|
-
return {
|
|
781
|
-
success: true
|
|
782
|
-
};
|
|
1088
|
+
makeEndpoints: next => {
|
|
1089
|
+
props.build(next.endpoints);
|
|
783
1090
|
}
|
|
784
1091
|
}
|
|
785
1092
|
};
|
|
@@ -1172,7 +1479,7 @@ async function process$1(ctx, endpoints) {
|
|
|
1172
1479
|
tokenUsage: ctx.usage(),
|
|
1173
1480
|
controllers: [ createApplication$3({
|
|
1174
1481
|
model: ctx.model,
|
|
1175
|
-
build:
|
|
1482
|
+
build: endpoints => {
|
|
1176
1483
|
pointer.value = endpoints;
|
|
1177
1484
|
},
|
|
1178
1485
|
pointer
|
|
@@ -1471,11 +1778,8 @@ function createApplication$3(props) {
|
|
|
1471
1778
|
name: "interface",
|
|
1472
1779
|
application,
|
|
1473
1780
|
execute: {
|
|
1474
|
-
makeOperations:
|
|
1475
|
-
|
|
1476
|
-
return {
|
|
1477
|
-
success: true
|
|
1478
|
-
};
|
|
1781
|
+
makeOperations: next => {
|
|
1782
|
+
props.build(next.operations);
|
|
1479
1783
|
}
|
|
1480
1784
|
}
|
|
1481
1785
|
};
|
|
@@ -3015,11 +3319,11 @@ const orchestrateInterface = ctx => async props => {
|
|
|
3015
3319
|
return init;
|
|
3016
3320
|
} else ctx.dispatch(init);
|
|
3017
3321
|
const operations = await orchestrateInterfaceOperations(ctx, init.endpoints);
|
|
3018
|
-
const components = await orchestrateInterfaceComponents(ctx, operations);
|
|
3019
3322
|
const document = {
|
|
3020
3323
|
operations,
|
|
3021
|
-
components
|
|
3324
|
+
components: await orchestrateInterfaceComponents(ctx, operations)
|
|
3022
3325
|
};
|
|
3326
|
+
document.components = await orchestrateInterfaceComplement(ctx, document);
|
|
3023
3327
|
const result = {
|
|
3024
3328
|
type: "interface",
|
|
3025
3329
|
id: v4(),
|
|
@@ -4015,11 +4319,11 @@ const transformPrismaCompilerHistories = (files, result) => [ {
|
|
|
4015
4319
|
} ];
|
|
4016
4320
|
|
|
4017
4321
|
function orchestratePrismaCompiler(ctx, files, retry = 8) {
|
|
4018
|
-
files["main.prisma"] = MAIN_PRISMA_FILE;
|
|
4019
4322
|
return step(ctx, files, retry);
|
|
4020
4323
|
}
|
|
4021
4324
|
|
|
4022
4325
|
async function step(ctx, files, life) {
|
|
4326
|
+
files["main.prisma"] = MAIN_PRISMA_FILE;
|
|
4023
4327
|
const result = await ctx.compiler.prisma({
|
|
4024
4328
|
files
|
|
4025
4329
|
});
|
|
@@ -4393,7 +4697,7 @@ const MAIN_PRISMA_FILE = StringUtil.trim`
|
|
|
4393
4697
|
generator client {
|
|
4394
4698
|
provider = "prisma-client-js"
|
|
4395
4699
|
previewFeatures = ["postgresqlExtensions", "views"]
|
|
4396
|
-
binaryTargets = ["native"
|
|
4700
|
+
binaryTargets = ["native"]
|
|
4397
4701
|
}
|
|
4398
4702
|
|
|
4399
4703
|
datasource db {
|