UNPKG

@integromat/proto

Version:
79 lines 2.95 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.IMTRPC = void 0; var events_1 = require("events"); /** * Base class for RPC. * * @property {Object} common Collection of common parameters. Read only. * @property {Object} environment Collection of environment parameters. Read only. * @property {Object} parameters Collection of config parameters. Read only. */ var IMTRPC = /** @class */ (function (_super) { __extends(IMTRPC, _super); function IMTRPC() { var _this = _super.call(this) || this; _this.common = null; _this.parameters = null; _this.environment = null; _this.internal = null; return _this; } /** * Initializes the RPC. Function that overrides should always call super. * * @callback done Callback to call when RPC is initialized. * @param {Error} err Error on error, otherwise null. */ IMTRPC.prototype.initialize = function (done) { if ('function' === typeof done) done(); }; /** * Finalizes the RPC. Function that overrides should always call super. * * @callback done Callback to call when RPC is finalized. * @param {Error} err Error on error, otherwise null. */ IMTRPC.prototype.finalize = function (done) { if ('function' === typeof done) done(); }; /** * Executes the RPC. * * @callback done Callback to call when RPC is done. * @param {Error} err Error on error, otherwise null. * @param {Object} response RPC response. */ IMTRPC.prototype.execute = function (done) { void done; throw new Error("Must override a superclass method 'execute'."); }; /** * Print debug message to Scenario info log. Debug messages are only visible to system administrators. * * @param {...*} message Message to be printed to Scenario info log. */ IMTRPC.prototype.debug = function () { throw new Error("Must override a superclass method 'debug'."); }; return IMTRPC; }(events_1.EventEmitter)); exports.IMTRPC = IMTRPC; //# sourceMappingURL=rpc.js.map