UNPKG

@autobe/agent

Version:

AI backend server code generator

51 lines 2.6 kB
"use strict"; 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.orchestrateInterfaceEndpoint = void 0; const utils_1 = require("@autobe/utils"); const tstl_1 = require("tstl"); const typia_1 = __importDefault(require("typia")); const orchestrateInterfaceActionEndpoint_1 = require("./orchestrateInterfaceActionEndpoint"); const orchestrateInterfaceBaseEndpoint_1 = require("./orchestrateInterfaceBaseEndpoint"); const orchestrateInterfaceEndpoint = (ctx, props) => __awaiter(void 0, void 0, void 0, function* () { const writeProgress = { completed: 0, total: props.groups.length * ENDPOINT_STEPS, }; // BASE ENDPOINTS const baseEndpoints = yield (0, orchestrateInterfaceBaseEndpoint_1.orchestrateInterfaceBaseEndpoint)(ctx, { instruction: props.instruction, authorizeOperations: props.authorizeOperations, groups: props.groups, progress: writeProgress, }); // ACTION ENDPOINTS const actionEndpoints = yield (0, orchestrateInterfaceActionEndpoint_1.orchestrateInterfaceActionEndpoint)(ctx, { instruction: props.instruction, authorizeOperations: props.authorizeOperations, groups: props.groups, baseEndpoints: baseEndpoints, progress: writeProgress, }); // UNIQUE FILTERING return new tstl_1.HashMap([...baseEndpoints, ...actionEndpoints].map((design) => new tstl_1.Pair(design.endpoint, design)), utils_1.AutoBeOpenApiEndpointComparator.hashCode, utils_1.AutoBeOpenApiEndpointComparator.equals) .toJSON() .map((it) => it.second); }); exports.orchestrateInterfaceEndpoint = orchestrateInterfaceEndpoint; const ENDPOINT_STEPS = [ "base", "action" ].length; //# sourceMappingURL=orchestrateInterfaceEndpoint.js.map