UNPKG

recime-bot-runtime

Version:

This runtime is intended to run inside a micro-service container with platform specific integration and module interpreter.

47 lines (46 loc) 1.63 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var Responder = require("./responder").Responder; var RecimeError = /** @class */ (function (_super) { __extends(RecimeError, _super); function RecimeError(message) { return _super.call(this, message) || this; } return RecimeError; }(Error)); ; var Runnable = /** @class */ (function () { function Runnable(bot, options) { this.options = options; this.bot = bot; } Runnable.prototype.run = function (args) { var _this = this; var options = this.options; // uid options.env['UID'] = options.uid; options.env['PLATFORM'] = options.platform || "web"; Object.keys(this.bot.config).forEach(function (key) { options.env[key] = _this.bot.config[key]; }); return new Responder({ args: args, bot: this.bot, platform: options.platform || "web", homedir: process.env.HOME_DIR, processedIntents: [] }).respond(); }; return Runnable; }()); exports.Runnable = Runnable;