UNPKG

@autobe/agent

Version:

AI backend server code generator

40 lines (37 loc) 1.9 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.transformInterfaceEndpointAuthorizationSection = void 0; const utils_1 = require("@autobe/utils"); const transformInterfaceEndpointAuthorizationSection = (operations) => { if (operations.length === 0) return ""; const table = [ "| Actor | Endpoint | Authorization Type | Request Body | Response Body |", "|-------|----------|--------------------|--------------|---------------|", ...operations .filter((op) => op.authorizationActor !== null && op.requestBody !== null && op.responseBody !== null) .map((op) => { var _a, _b, _c, _d, _e, _f; return [ (_a = op.authorizationActor) !== null && _a !== void 0 ? _a : "", `${op.method.toUpperCase()} ${op.path}`, (_b = op.authorizationType) !== null && _b !== void 0 ? _b : "", (_d = (_c = op.requestBody) === null || _c === void 0 ? void 0 : _c.typeName) !== null && _d !== void 0 ? _d : "", (_f = (_e = op.responseBody) === null || _e === void 0 ? void 0 : _e.typeName) !== null && _f !== void 0 ? _f : "", ].join(" | "); }), ].join("\n"); return utils_1.StringUtil.trim ` ## Already Generated Authorization Operations (DO NOT DUPLICATE) The following authorization operations have already been generated by the Authorization Agent. Do NOT create any endpoints that duplicate these operations. All authentication-related operations are handled exclusively by the Authorization Agent. This is not your responsibility. ${table} `; }; exports.transformInterfaceEndpointAuthorizationSection = transformInterfaceEndpointAuthorizationSection; //# sourceMappingURL=transformInterfaceEndpointAuthorizationSection.js.map