UNPKG

@autobe/agent

Version:

AI backend server code generator

53 lines 3.28 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()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.orchestrateRealizeOperationCorrectCasting = void 0; const orchestrateRealizeCorrectCasting_1 = require("./correct/orchestrateRealizeCorrectCasting"); const AutoBeRealizeOperationProgrammer_1 = require("./programmers/AutoBeRealizeOperationProgrammer"); const orchestrateRealizeOperationCorrectCasting = (ctx, props) => __awaiter(void 0, void 0, void 0, function* () { const document = ctx.state().interface.document; return yield (0, orchestrateRealizeCorrectCasting_1.orchestrateRealizeCorrectCasting)(ctx, { programmer: { template: (func) => AutoBeRealizeOperationProgrammer_1.AutoBeRealizeOperationProgrammer.writeTemplate({ authorizations: props.authorizations, schemas: document.components.schemas, operation: document.operations.find((o) => o.method === func.endpoint.method && o.path === func.endpoint.path), collectors: props.collectors, transformers: props.transformers, }), replaceImportStatements: (next) => __awaiter(void 0, void 0, void 0, function* () { var _a; const scenario = AutoBeRealizeOperationProgrammer_1.AutoBeRealizeOperationProgrammer.getScenario({ authorizations: props.authorizations, operation: document.operations.find((o) => o.method === next.function.endpoint.method && o.path === next.function.endpoint.path), }); return yield AutoBeRealizeOperationProgrammer_1.AutoBeRealizeOperationProgrammer.replaceImportStatements(ctx, { operation: scenario.operation, schemas: document.components.schemas, code: next.code, payload: (_a = scenario.decoratorEvent) === null || _a === void 0 ? void 0 : _a.payload.name, }); }), additional: () => AutoBeRealizeOperationProgrammer_1.AutoBeRealizeOperationProgrammer.getAdditional({ authorizations: props.authorizations, collectors: props.collectors, transformers: props.transformers, }), location: "src/providers", }, functions: props.functions, progress: props.progress, }); }); exports.orchestrateRealizeOperationCorrectCasting = orchestrateRealizeOperationCorrectCasting; //# sourceMappingURL=orchestrateRealizeOperationCorrectCasting.js.map