recime-bot-runtime
Version:
This runtime is intended to run inside a micro-service container with platform specific integration and module interpreter.
26 lines (25 loc) • 842 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var run_1 = require("./run");
var Script = /** @class */ (function () {
function Script(bot) {
this.bot = bot;
}
Script.prototype.execute = function (options) {
var _this = this;
return new Promise(function (resolve, reject) {
var runnable = new run_1.Runnable(_this.bot, options);
var timer = setTimeout(function () {
reject("Request timeout!");
}, (30 * 1000));
runnable.run(options.data).then(function (data) {
clearTimeout(timer);
resolve(Array.isArray(data || []) ? data : [data]);
}, function (err) {
reject(err);
});
});
};
return Script;
}());
exports.Script = Script;