@autobe/agent
Version:
AI backend server code generator
684 lines • 101 kB
JavaScript
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.orchestrateInterfaceEndpointReview = orchestrateInterfaceEndpointReview;
const __typia_transform__validateReport = __importStar(require("typia/lib/internal/_validateReport.js"));
const __typia_transform__llmApplicationFinalize = __importStar(require("typia/lib/internal/_llmApplicationFinalize.js"));
const typia_1 = __importDefault(require("typia"));
const uuid_1 = require("uuid");
const assertSchemaModel_1 = require("../../context/assertSchemaModel");
const AutoBePreliminaryController_1 = require("../common/AutoBePreliminaryController");
const transformInterfaceEndpointReviewHistory_1 = require("./histories/transformInterfaceEndpointReviewHistory");
function orchestrateInterfaceEndpointReview(ctx, endpoints) {
return __awaiter(this, void 0, void 0, function* () {
const preliminary = new AutoBePreliminaryController_1.AutoBePreliminaryController({
application: {
version: "3.1",
components: {
schemas: {
"IAutoBeInterfaceEndpointReviewApplication.IProps": {
type: "object",
properties: {
thinking: {
type: "string",
description: "Think before you act.\n\nBefore requesting preliminary data or completing your task, reflect on your\ncurrent state and explain your reasoning:\n\nFor preliminary requests (getAnalysisFiles, getPrismaSchemas, etc.):\n- What critical information is missing that you don't already have?\n- Why do you need it specifically right now?\n- Be brief - state the gap, don't list everything you have.\n\nFor completion (complete):\n- What key assets did you acquire?\n- What did you accomplish?\n- Why is it sufficient to complete?\n- Summarize - don't enumerate every single item.\n\nThis reflection helps you avoid duplicate requests and premature completion."
},
request: {
oneOf: [
{
$ref: "#/components/schemas/IAutoBePreliminaryGetAnalysisFiles"
},
{
$ref: "#/components/schemas/IAutoBePreliminaryGetPrismaSchemas"
},
{
$ref: "#/components/schemas/IAutoBeInterfaceEndpointReviewApplication.IComplete"
}
],
discriminator: {
propertyName: "type",
mapping: {
getAnalysisFiles: "#/components/schemas/IAutoBePreliminaryGetAnalysisFiles",
getPrismaSchemas: "#/components/schemas/IAutoBePreliminaryGetPrismaSchemas",
complete: "#/components/schemas/IAutoBeInterfaceEndpointReviewApplication.IComplete"
}
},
description: "Type discriminator for the request.\n\nDetermines which action to perform: preliminary data retrieval\n(getAnalysisFiles, getPrismaSchemas) or final endpoint review (complete).\nWhen preliminary returns empty array, that type is removed from the\nunion, physically preventing repeated calls."
}
},
required: [
"thinking",
"request"
]
},
IAutoBePreliminaryGetAnalysisFiles: {
type: "object",
properties: {
type: {
"const": "getAnalysisFiles",
description: "Type discriminator for the request.\n\nDetermines which action to perform: preliminary data retrieval or actual\ntask execution. Value \"getAnalysisFiles\" indicates this is a preliminary\ndata request for analysis files."
},
fileNames: {
type: "array",
items: {
type: "string"
},
minItems: 1,
description: "List of analysis file names to retrieve.\n\nFile names from the analyze phase containing requirements, use cases, and\nbusiness logic documentation.\n\nCRITICAL: DO NOT request the same file names that you have already\nrequested in previous calls."
}
},
required: [
"type",
"fileNames"
],
description: "Request to retrieve requirements analysis files for context.\n\nThis type is used in the preliminary phase to request specific analysis files\nthat provide business requirements and domain context."
},
IAutoBePreliminaryGetPrismaSchemas: {
type: "object",
properties: {
type: {
"const": "getPrismaSchemas",
description: "Type discriminator for the request.\n\nDetermines which action to perform: preliminary data retrieval or actual\ntask execution. Value \"getPrismaSchemas\" indicates this is a preliminary\ndata request for Prisma schemas."
},
schemaNames: {
type: "array",
items: {
type: "string"
},
minItems: 1,
description: "List of Prisma table names to retrieve.\n\nTable names from the Prisma schema file representing database entities\n(e.g., \"user\", \"post\", \"comment\").\n\nCRITICAL: DO NOT request the same schema names that you have already\nrequested in previous calls."
}
},
required: [
"type",
"schemaNames"
],
description: "Request to retrieve Prisma database schema definitions for context.\n\nThis type is used in the preliminary phase to request specific Prisma table\nschemas needed for generating type-safe API operations."
},
"IAutoBeInterfaceEndpointReviewApplication.IComplete": {
type: "object",
properties: {
type: {
"const": "complete",
description: "Type discriminator for the request.\n\nDetermines which action to perform: preliminary data retrieval or actual\ntask execution. Value \"complete\" indicates this is the final task\nexecution request."
},
review: {
type: "string",
description: "Comprehensive review analysis of all collected endpoints.\n\nContains detailed findings from the holistic review including:\n\n- Identified inconsistencies in naming conventions\n- Duplicate endpoints that serve the same purpose\n- Over-engineered solutions that add unnecessary complexity\n- Violations of REST API design principles\n- Recommendations for improvement and standardization\n\nThe review provides actionable feedback for creating a clean, consistent,\nand maintainable API structure."
},
endpoints: {
type: "array",
items: {
$ref: "#/components/schemas/AutoBeOpenApi.IEndpoint"
},
description: "Refined collection of API endpoints after review and cleanup.\n\nThe final optimized set of endpoints after:\n\n- Removing duplicates and redundant endpoints\n- Standardizing naming conventions across all paths\n- Simplifying over-engineered solutions\n- Ensuring consistent REST patterns\n- Aligning HTTP methods with their semantic meanings\n\nThis collection represents the production-ready API structure that\nbalances functionality with simplicity and maintainability."
}
},
required: [
"type",
"review",
"endpoints"
],
description: "Request to review and refine API endpoints.\n\nExecutes comprehensive endpoint review to consolidate independently\ngenerated endpoints, ensure consistency, eliminate redundancy, and create a\nclean, maintainable API structure following REST best practices."
},
"AutoBeOpenApi.IEndpoint": {
type: "object",
properties: {
path: {
type: "string",
pattern: "^\\/[a-zA-Z0-9\\/_{}.-]*$",
description: "HTTP path of the API operation.\n\nThe URL path for accessing this API operation, using path parameters\nenclosed in curly braces (e.g., `/shoppings/customers/sales/{saleId}`).\n\nIt must be corresponded to the {@link parameters path parameters}.\n\nThe path structure should clearly indicate which database entity this\noperation is manipulating, helping to ensure all entities have\nappropriate API coverage.\n\nPath validation rules:\n\n- Must start with a forward slash (/)\n- Can contain only: letters (a-z, A-Z), numbers (0-9), forward slashes (/),\n curly braces for parameters ({paramName}), hyphens (-), and underscores\n (_)\n- Parameters must be enclosed in curly braces: {paramName}\n- Resource names should be in camelCase\n- No quotes, spaces, or invalid special characters allowed\n- No domain or role-based prefixes\n\nValid examples:\n\n- \"/users\"\n- \"/users/{userId}\"\n- \"/articles/{articleId}/comments\"\n- \"/attachmentFiles\"\n- \"/orders/{orderId}/items/{itemId}\"\n\nInvalid examples:\n\n- \"'/users'\" (contains quotes)\n- \"/user profile\" (contains space)\n- \"/users/[userId]\" (wrong bracket format)\n- \"/admin/users\" (role prefix)\n- \"/api/v1/users\" (API prefix)"
},
method: {
oneOf: [
{
"const": "get"
},
{
"const": "post"
},
{
"const": "put"
},
{
"const": "delete"
},
{
"const": "patch"
}
],
description: "HTTP method of the API operation.\n\n**IMPORTANT**: Methods must be written in lowercase only (e.g., \"get\",\nnot \"GET\").\n\nNote that, if the API operation has {@link requestBody}, method must not\nbe `get`.\n\nAlso, even though the API operation has been designed to only get\ninformation, but it needs complicated request information, it must be\ndefined as `patch` method with {@link requestBody} data specification.\n\n- `get`: get information\n- `patch`: get information with complicated request data\n ({@link requestBody})\n- `post`: create new record\n- `put`: update existing record\n- `delete`: remove record"
}
},
required: [
"path",
"method"
],
description: "API endpoint information."
}
}
},
functions: [
{
name: "process",
async: false,
parameters: [
{
name: "props",
description: " Request containing either preliminary data request or complete\ntask",
required: true,
schema: {
$ref: "#/components/schemas/IAutoBeInterfaceEndpointReviewApplication.IProps"
}
}
],
description: "Process endpoint review task or preliminary data requests.\n\nConsolidates all endpoints generated independently and performs holistic\nreview to ensure consistency, remove duplicates, eliminate\nover-engineering, and verify REST API design principles."
}
]
},
source: SOURCE,
kinds: ["analysisFiles", "prismaSchemas"],
state: ctx.state(),
});
return yield preliminary.orchestrate(ctx, () => __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c, _d, _e;
const pointer = {
value: null,
};
const result = yield ctx.conversate(Object.assign({ source: SOURCE, controller: createController({
preliminary,
model: ctx.model,
build: (props) => {
pointer.value = props;
},
}), enforceFunctionCall: true }, (0, transformInterfaceEndpointReviewHistory_1.transformInterfaceEndpointReviewHistory)({
preliminary,
endpoints,
})));
const out = (value) => (Object.assign(Object.assign({}, result), { value }));
if (pointer.value !== null) {
const response = (_b = (_a = pointer.value) === null || _a === void 0 ? void 0 : _a.endpoints) !== null && _b !== void 0 ? _b : [];
ctx.dispatch({
id: (0, uuid_1.v7)(),
type: SOURCE,
endpoints,
content: response,
created_at: new Date().toISOString(),
review: (_c = pointer.value) === null || _c === void 0 ? void 0 : _c.review,
step: (_e = (_d = ctx.state().analyze) === null || _d === void 0 ? void 0 : _d.step) !== null && _e !== void 0 ? _e : 0,
metric: result.metric,
tokenUsage: result.tokenUsage,
});
return out(response);
}
return out(null);
}));
});
}
function createController(props) {
(0, assertSchemaModel_1.assertSchemaModel)(props.model);
const validate = (input) => {
const result = (() => { const _io0 = input => "string" === typeof input.thinking && ("object" === typeof input.request && null !== input.request && _iu0(input.request)); const _io1 = input => "getAnalysisFiles" === input.type && (Array.isArray(input.fileNames) && (1 <= input.fileNames.length && input.fileNames.every(elem => "string" === typeof elem))); const _io2 = input => "getPrismaSchemas" === input.type && (Array.isArray(input.schemaNames) && (1 <= input.schemaNames.length && input.schemaNames.every(elem => "string" === typeof elem))); const _io3 = input => "complete" === input.type && "string" === typeof input.review && (Array.isArray(input.endpoints) && input.endpoints.every(elem => "object" === typeof elem && null !== elem && _io4(elem))); const _io4 = input => "string" === typeof input.path && RegExp("^\\/[a-zA-Z0-9\\/_{}.-]*$").test(input.path) && ("get" === input.method || "post" === input.method || "put" === input.method || "delete" === input.method || "patch" === input.method); const _iu0 = input => (() => {
if ("getAnalysisFiles" === input.type)
return _io1(input);
else if ("getPrismaSchemas" === input.type)
return _io2(input);
else if ("complete" === input.type)
return _io3(input);
else
return false;
})(); const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.thinking || _report(_exceptionable, {
path: _path + ".thinking",
expected: "string",
value: input.thinking
}), ("object" === typeof input.request && null !== input.request || _report(_exceptionable, {
path: _path + ".request",
expected: "(IAutoBeInterfaceEndpointReviewApplication.IComplete | IAutoBePreliminaryGetAnalysisFiles | IAutoBePreliminaryGetPrismaSchemas)",
value: input.request
})) && _vu0(input.request, _path + ".request", true && _exceptionable) || _report(_exceptionable, {
path: _path + ".request",
expected: "(IAutoBeInterfaceEndpointReviewApplication.IComplete | IAutoBePreliminaryGetAnalysisFiles | IAutoBePreliminaryGetPrismaSchemas)",
value: input.request
})].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => ["getAnalysisFiles" === input.type || _report(_exceptionable, {
path: _path + ".type",
expected: "\"getAnalysisFiles\"",
value: input.type
}), (Array.isArray(input.fileNames) || _report(_exceptionable, {
path: _path + ".fileNames",
expected: "(Array<string> & MinItems<1>)",
value: input.fileNames
})) && ((1 <= input.fileNames.length || _report(_exceptionable, {
path: _path + ".fileNames",
expected: "Array<> & MinItems<1>",
value: input.fileNames
})) && input.fileNames.map((elem, _index4) => "string" === typeof elem || _report(_exceptionable, {
path: _path + ".fileNames[" + _index4 + "]",
expected: "string",
value: elem
})).every(flag => flag)) || _report(_exceptionable, {
path: _path + ".fileNames",
expected: "(Array<string> & MinItems<1>)",
value: input.fileNames
})].every(flag => flag); const _vo2 = (input, _path, _exceptionable = true) => ["getPrismaSchemas" === input.type || _report(_exceptionable, {
path: _path + ".type",
expected: "\"getPrismaSchemas\"",
value: input.type
}), (Array.isArray(input.schemaNames) || _report(_exceptionable, {
path: _path + ".schemaNames",
expected: "(Array<string> & MinItems<1>)",
value: input.schemaNames
})) && ((1 <= input.schemaNames.length || _report(_exceptionable, {
path: _path + ".schemaNames",
expected: "Array<> & MinItems<1>",
value: input.schemaNames
})) && input.schemaNames.map((elem, _index5) => "string" === typeof elem || _report(_exceptionable, {
path: _path + ".schemaNames[" + _index5 + "]",
expected: "string",
value: elem
})).every(flag => flag)) || _report(_exceptionable, {
path: _path + ".schemaNames",
expected: "(Array<string> & MinItems<1>)",
value: input.schemaNames
})].every(flag => flag); const _vo3 = (input, _path, _exceptionable = true) => ["complete" === input.type || _report(_exceptionable, {
path: _path + ".type",
expected: "\"complete\"",
value: input.type
}), "string" === typeof input.review || _report(_exceptionable, {
path: _path + ".review",
expected: "string",
value: input.review
}), (Array.isArray(input.endpoints) || _report(_exceptionable, {
path: _path + ".endpoints",
expected: "Array<AutoBeOpenApi.IEndpoint>",
value: input.endpoints
})) && input.endpoints.map((elem, _index6) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
path: _path + ".endpoints[" + _index6 + "]",
expected: "AutoBeOpenApi.IEndpoint",
value: elem
})) && _vo4(elem, _path + ".endpoints[" + _index6 + "]", true && _exceptionable) || _report(_exceptionable, {
path: _path + ".endpoints[" + _index6 + "]",
expected: "AutoBeOpenApi.IEndpoint",
value: elem
})).every(flag => flag) || _report(_exceptionable, {
path: _path + ".endpoints",
expected: "Array<AutoBeOpenApi.IEndpoint>",
value: input.endpoints
})].every(flag => flag); const _vo4 = (input, _path, _exceptionable = true) => ["string" === typeof input.path && (RegExp("^\\/[a-zA-Z0-9\\/_{}.-]*$").test(input.path) || _report(_exceptionable, {
path: _path + ".path",
expected: "string & Pattern<\"^\\\\/[a-zA-Z0-9\\\\/_{}.-]*$\">",
value: input.path
})) || _report(_exceptionable, {
path: _path + ".path",
expected: "(string & Pattern<\"^\\\\/[a-zA-Z0-9\\\\/_{}.-]*$\">)",
value: input.path
}), "get" === input.method || "post" === input.method || "put" === input.method || "delete" === input.method || "patch" === input.method || _report(_exceptionable, {
path: _path + ".method",
expected: "(\"delete\" | \"get\" | \"patch\" | \"post\" | \"put\")",
value: input.method
})].every(flag => flag); const _vu0 = (input, _path, _exceptionable = true) => (() => {
if ("getAnalysisFiles" === input.type)
return _vo1(input, _path, true && _exceptionable);
else if ("getPrismaSchemas" === input.type)
return _vo2(input, _path, true && _exceptionable);
else if ("complete" === input.type)
return _vo3(input, _path, true && _exceptionable);
else
return _report(_exceptionable, {
path: _path,
expected: "(IAutoBePreliminaryGetAnalysisFiles | IAutoBePreliminaryGetPrismaSchemas | IAutoBeInterfaceEndpointReviewApplication.IComplete)",
value: input
});
})(); const __is = input => "object" === typeof input && null !== input && _io0(input); let errors; let _report; return input => {
if (false === __is(input)) {
errors = [];
_report = __typia_transform__validateReport._validateReport(errors);
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
path: _path + "",
expected: "IAutoBeInterfaceEndpointReviewApplication.IProps",
value: input
})) && _vo0(input, _path + "", true) || _report(true, {
path: _path + "",
expected: "IAutoBeInterfaceEndpointReviewApplication.IProps",
value: input
}))(input, "$input", true);
const success = 0 === errors.length;
return success ? {
success,
data: input
} : {
success,
errors,
data: input
};
}
return {
success: true,
data: input
};
}; })()(input);
if (result.success === false || result.data.request.type === "complete")
return result;
return props.preliminary.validate({
thinking: result.data.thinking,
request: result.data.request,
});
};
const application = collection[props.model === "chatgpt"
? "chatgpt"
: props.model === "gemini"
? "gemini"
: "claude"](validate);
return {
protocol: "class",
name: SOURCE,
application,
execute: {
process: (next) => {
if (next.request.type === "complete")
props.build(next.request);
},
},
};
}
const collection = {
chatgpt: (validate) => (() => {
const application = {
model: "chatgpt",
options: {
reference: true,
strict: false,
separate: null
},
functions: [
{
name: "process",
parameters: {
description: " Request containing either preliminary data request or complete\ntask\n\n------------------------------\n\nCurrent Type: {@link IAutoBeInterfaceEndpointReviewApplication.IProps}",
type: "object",
properties: {
thinking: {
description: "Think before you act.\n\nBefore requesting preliminary data or completing your task, reflect on your\ncurrent state and explain your reasoning:\n\nFor preliminary requests (getAnalysisFiles, getPrismaSchemas, etc.):\n- What critical information is missing that you don't already have?\n- Why do you need it specifically right now?\n- Be brief - state the gap, don't list everything you have.\n\nFor completion (complete):\n- What key assets did you acquire?\n- What did you accomplish?\n- Why is it sufficient to complete?\n- Summarize - don't enumerate every single item.\n\nThis reflection helps you avoid duplicate requests and premature completion.",
type: "string"
},
request: {
description: "Type discriminator for the request.\n\nDetermines which action to perform: preliminary data retrieval\n(getAnalysisFiles, getPrismaSchemas) or final endpoint review (complete).\nWhen preliminary returns empty array, that type is removed from the\nunion, physically preventing repeated calls.",
anyOf: [
{
$ref: "#/$defs/IAutoBePreliminaryGetAnalysisFiles"
},
{
$ref: "#/$defs/IAutoBePreliminaryGetPrismaSchemas"
},
{
$ref: "#/$defs/IAutoBeInterfaceEndpointReviewApplication.IComplete"
}
],
"x-discriminator": {
propertyName: "type",
mapping: {
getAnalysisFiles: "#/$defs/IAutoBePreliminaryGetAnalysisFiles",
getPrismaSchemas: "#/$defs/IAutoBePreliminaryGetPrismaSchemas",
complete: "#/$defs/IAutoBeInterfaceEndpointReviewApplication.IComplete"
}
}
}
},
required: [
"thinking",
"request"
],
additionalProperties: false,
$defs: {
IAutoBePreliminaryGetAnalysisFiles: {
description: "Request to retrieve requirements analysis files for context.\n\nThis type is used in the preliminary phase to request specific analysis files\nthat provide business requirements and domain context.",
type: "object",
properties: {
type: {
description: "Type discriminator for the request.\n\nDetermines which action to perform: preliminary data retrieval or actual\ntask execution. Value \"getAnalysisFiles\" indicates this is a preliminary\ndata request for analysis files.",
type: "string",
"enum": [
"getAnalysisFiles"
]
},
fileNames: {
description: "List of analysis file names to retrieve.\n\nFile names from the analyze phase containing requirements, use cases, and\nbusiness logic documentation.\n\nCRITICAL: DO NOT request the same file names that you have already\nrequested in previous calls.\n\n\n@minItems 1",
type: "array",
items: {
type: "string"
}
}
},
required: [
"type",
"fileNames"
]
},
IAutoBePreliminaryGetPrismaSchemas: {
description: "Request to retrieve Prisma database schema definitions for context.\n\nThis type is used in the preliminary phase to request specific Prisma table\nschemas needed for generating type-safe API operations.",
type: "object",
properties: {
type: {
description: "Type discriminator for the request.\n\nDetermines which action to perform: preliminary data retrieval or actual\ntask execution. Value \"getPrismaSchemas\" indicates this is a preliminary\ndata request for Prisma schemas.",
type: "string",
"enum": [
"getPrismaSchemas"
]
},
schemaNames: {
description: "List of Prisma table names to retrieve.\n\nTable names from the Prisma schema file representing database entities\n(e.g., \"user\", \"post\", \"comment\").\n\nCRITICAL: DO NOT request the same schema names that you have already\nrequested in previous calls.\n\n\n@minItems 1",
type: "array",
items: {
type: "string"
}
}
},
required: [
"type",
"schemaNames"
]
},
"IAutoBeInterfaceEndpointReviewApplication.IComplete": {
description: "Request to review and refine API endpoints.\n\nExecutes comprehensive endpoint review to consolidate independently\ngenerated endpoints, ensure consistency, eliminate redundancy, and create a\nclean, maintainable API structure following REST best practices.",
type: "object",
properties: {
type: {
description: "Type discriminator for the request.\n\nDetermines which action to perform: preliminary data retrieval or actual\ntask execution. Value \"complete\" indicates this is the final task\nexecution request.",
type: "string",
"enum": [
"complete"
]
},
review: {
description: "Comprehensive review analysis of all collected endpoints.\n\nContains detailed findings from the holistic review including:\n\n- Identified inconsistencies in naming conventions\n- Duplicate endpoints that serve the same purpose\n- Over-engineered solutions that add unnecessary complexity\n- Violations of REST API design principles\n- Recommendations for improvement and standardization\n\nThe review provides actionable feedback for creating a clean, consistent,\nand maintainable API structure.",
type: "string"
},
endpoints: {
description: "Refined collection of API endpoints after review and cleanup.\n\nThe final optimized set of endpoints after:\n\n- Removing duplicates and redundant endpoints\n- Standardizing naming conventions across all paths\n- Simplifying over-engineered solutions\n- Ensuring consistent REST patterns\n- Aligning HTTP methods with their semantic meanings\n\nThis collection represents the production-ready API structure that\nbalances functionality with simplicity and maintainability.",
type: "array",
items: {
$ref: "#/$defs/AutoBeOpenApi.IEndpoint"
}
}
},
required: [
"type",
"review",
"endpoints"
]
},
"AutoBeOpenApi.IEndpoint": {
description: "API endpoint information.",
type: "object",
properties: {
path: {
description: "HTTP path of the API operation.\n\nThe URL path for accessing this API operation, using path parameters\nenclosed in curly braces (e.g., `/shoppings/customers/sales/{saleId}`).\n\nIt must be corresponded to the {@link parameters path parameters}.\n\nThe path structure should clearly indicate which database entity this\noperation is manipulating, helping to ensure all entities have\nappropriate API coverage.\n\nPath validation rules:\n\n- Must start with a forward slash (/)\n- Can contain only: letters (a-z, A-Z), numbers (0-9), forward slashes (/),\n curly braces for parameters ({paramName}), hyphens (-), and underscores\n (_)\n- Parameters must be enclosed in curly braces: {paramName}\n- Resource names should be in camelCase\n- No quotes, spaces, or invalid special characters allowed\n- No domain or role-based prefixes\n\nValid examples:\n\n- \"/users\"\n- \"/users/{userId}\"\n- \"/articles/{articleId}/comments\"\n- \"/attachmentFiles\"\n- \"/orders/{orderId}/items/{itemId}\"\n\nInvalid examples:\n\n- \"'/users'\" (contains quotes)\n- \"/user profile\" (contains space)\n- \"/users/[userId]\" (wrong bracket format)\n- \"/admin/users\" (role prefix)\n- \"/api/v1/users\" (API prefix)\n\n\n@pattern ^\\/[a-zA-Z0-9\\/_{}.-]*$",
type: "string"
},
method: {
description: "HTTP method of the API operation.\n\n**IMPORTANT**: Methods must be written in lowercase only (e.g., \"get\",\nnot \"GET\").\n\nNote that, if the API operation has {@link requestBody}, method must not\nbe `get`.\n\nAlso, even though the API operation has been designed to only get\ninformation, but it needs complicated request information, it must be\ndefined as `patch` method with {@link requestBody} data specification.\n\n- `get`: get information\n- `patch`: get information with complicated request data\n ({@link requestBody})\n- `post`: create new record\n- `put`: update existing record\n- `delete`: remove record",
type: "string",
"enum": [
"get",
"post",
"put",
"delete",
"patch"
]
}
},
required: [
"path",
"method"
]
}
}
},
description: "Process endpoint review task or preliminary data requests.\n\nConsolidates all endpoints generated independently and performs holistic\nreview to ensure consistency, remove duplicates, eliminate\nover-engineering, and verify REST API design principles.",
validate: (() => { const _io0 = input => "string" === typeof input.thinking && ("object" === typeof input.request && null !== input.request && _iu0(input.request)); const _io1 = input => "getAnalysisFiles" === input.type && (Array.isArray(input.fileNames) && (1 <= input.fileNames.length && input.fileNames.every(elem => "string" === typeof elem))); const _io2 = input => "getPrismaSchemas" === input.type && (Array.isArray(input.schemaNames) && (1 <= input.schemaNames.length && input.schemaNames.every(elem => "string" === typeof elem))); const _io3 = input => "complete" === input.type && "string" === typeof input.review && (Array.isArray(input.endpoints) && input.endpoints.every(elem => "object" === typeof elem && null !== elem && _io4(elem))); const _io4 = input => "string" === typeof input.path && RegExp("^\\/[a-zA-Z0-9\\/_{}.-]*$").test(input.path) && ("get" === input.method || "post" === input.method || "put" === input.method || "delete" === input.method || "patch" === input.method); const _iu0 = input => (() => {
if ("getAnalysisFiles" === input.type)
return _io1(input);
else if ("getPrismaSchemas" === input.type)
return _io2(input);
else if ("complete" === input.type)
return _io3(input);
else
return false;
})(); const _vo0 = (input, _path, _exceptionable = true) => ["string" === typeof input.thinking || _report(_exceptionable, {
path: _path + ".thinking",
expected: "string",
value: input.thinking
}), ("object" === typeof input.request && null !== input.request || _report(_exceptionable, {
path: _path + ".request",
expected: "(IAutoBeInterfaceEndpointReviewApplication.IComplete | IAutoBePreliminaryGetAnalysisFiles | IAutoBePreliminaryGetPrismaSchemas)",
value: input.request
})) && _vu0(input.request, _path + ".request", true && _exceptionable) || _report(_exceptionable, {
path: _path + ".request",
expected: "(IAutoBeInterfaceEndpointReviewApplication.IComplete | IAutoBePreliminaryGetAnalysisFiles | IAutoBePreliminaryGetPrismaSchemas)",
value: input.request
})].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => ["getAnalysisFiles" === input.type || _report(_exceptionable, {
path: _path + ".type",
expected: "\"getAnalysisFiles\"",
value: input.type
}), (Array.isArray(input.fileNames) || _report(_exceptionable, {
path: _path + ".fileNames",
expected: "(Array<string> & MinItems<1>)",
value: input.fileNames
})) && ((1 <= input.fileNames.length || _report(_exceptionable, {
path: _path + ".fileNames",
expected: "Array<> & MinItems<1>",
value: input.fileNames
})) && input.fileNames.map((elem, _index4) => "string" === typeof elem || _report(_exceptionable, {
path: _path + ".fileNames[" + _index4 + "]",
expected: "string",
value: elem
})).every(flag => flag)) || _report(_exceptionable, {
path: _path + ".fileNames",
expected: "(Array<string> & MinItems<1>)",
value: input.fileNames
})].every(flag => flag); const _vo2 = (input, _path, _exceptionable = true) => ["getPrismaSchemas" === input.type || _report(_exceptionable, {
path: _path + ".type",
expected: "\"getPrismaSchemas\"",
value: input.type
}), (Array.isArray(input.schemaNames) || _report(_exceptionable, {
path: _path + ".schemaNames",
expected: "(Array<string> & MinItems<1>)",
value: input.schemaNames
})) && ((1 <= input.schemaNames.length || _report(_exceptionable, {
path: _path + ".schemaNames",
expected: "Array<> & MinItems<1>",
value: input.schemaNames
})) && input.schemaNames.map((elem, _index5) => "string" === typeof elem || _report(_exceptionable, {
path: _path + ".schemaNames[" + _index5 + "]",
expected: "string",
value: elem
})).every(flag => flag)) || _report(_exceptionable, {
path: _path + ".schemaNames",
expected: "(Array<string> & MinItems<1>)",
value: input.schemaNames
})].every(flag => flag); const _vo3 = (input, _path, _exceptionable = true) => ["complete" === input.type || _report(_exceptionable, {
path: _path + ".type",
expected: "\"complete\"",
value: input.type
}), "string" === typeof input.review || _report(_exceptionable, {
path: _path + ".review",
expected: "string",
value: input.review
}), (Array.isArray(input.endpoints) || _report(_exceptionable, {
path: _path + ".endpoints",
expected: "Array<AutoBeOpenApi.IEndpoint>",
value: input.endpoints
})) && input.endpoints.map((elem, _index6) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
path: _path + ".endpoints[" + _index6 + "]",
expected: "AutoBeOpenApi.IEndpoint",
value: elem
})) && _vo4(elem, _path + ".endpoints[" + _index6 + "]", true && _exceptionable) || _report(_exceptionable, {
path: _path + ".endpoints[" + _index6 + "]",
expected: "AutoBeOpenApi.IEndpoint",
value: elem
})).every(flag => flag) || _report(_exceptionable, {
path: _path + ".endpoints",
expected: "Array<AutoBeOpenApi.IEndpoint>",
value: input.endpoints
})].every(flag => flag); const _vo4 = (input, _path, _exceptionable = true) => ["string" === typeof input.path && (RegExp("^\\/[a-zA-Z0-9\\/_{}.-]*$").test(input.path) || _report(_exceptionable, {
path: _path + ".path",
expected: "string & Pattern<\"^\\\\/[a-zA-Z0-9\\\\/_{}.-]*$\">",
value: input.path
})) || _report(_exceptionable, {
path: _path + ".path",
expected: "(string & Pattern<\"^\\\\/[a-zA-Z0-9\\\\/_{}.-]*$\">)",
value: input.path
}), "get" === input.method || "post" === input.method || "put" === input.method || "delete" === input.method || "patch" === input.method || _report(_exceptionable, {
path: _path + ".method",
expected: "(\"delete\" | \"get\" | \"patch\" | \"post\" | \"put\")",
value: input.method
})].every(flag => flag); const _vu0 = (input, _path, _exceptionable = true) => (() => {
if ("getAnalysisFiles" === input.type)
return _vo1(input, _path, true && _exceptionable);
else if ("getPrismaSchemas" === input.type)
return _vo2(input, _path, true && _exceptionable);
else if ("complete" === input.type)
return _vo3(inp