opennms
Version:
Client API for the OpenNMS network monitoring platform
1 lines • 49.4 kB
JSON
{"remainingRequest":"/data/node_modules/babel-loader/lib/index.js!/data/node_modules/ts-loader/index.js!/data/node_modules/tslint-loader/index.js??ref--4-0!/data/src/dao/FlowDAO.ts","dependencies":[{"path":"/data/src/dao/FlowDAO.ts","mtime":1553611371628},{"path":"/data/node_modules/typescript-logging/dist/commonjs/typescript-logging.d.ts","mtime":1553611387808},{"path":"/data/node_modules/typescript-logging/dist/commonjs/control/LogGroupControl.d.ts","mtime":1553611387932},{"path":"/data/node_modules/typescript-logging/dist/commonjs/control/CategoryServiceControl.d.ts","mtime":1553611387932},{"path":"/data/node_modules/typescript-logging/dist/commonjs/extension/MessagesToExtensionJSON.d.ts","mtime":1553611387932},{"path":"/data/node_modules/typescript-logging/dist/commonjs/extension/MessagesFromExtensionJSON.d.ts","mtime":1553611387932},{"path":"/data/node_modules/typescript-logging/dist/commonjs/extension/ExtensionMessageJSON.d.ts","mtime":1553611387932},{"path":"/data/node_modules/typescript-logging/dist/commonjs/extension/ExtensionHelper.d.ts","mtime":1553611387932},{"path":"/data/node_modules/typescript-logging/dist/commonjs/log/category/AbstractCategoryLogger.d.ts","mtime":1553611388000},{"path":"/data/node_modules/typescript-logging/dist/commonjs/log/LoggerOptions.d.ts","mtime":1553611387932},{"path":"/data/node_modules/typescript-logging/dist/commonjs/log/category/CategoryLogger.d.ts","mtime":1553611388000},{"path":"/data/node_modules/typescript-logging/dist/commonjs/log/category/CategoryService.d.ts","mtime":1553611388000},{"path":"/data/node_modules/typescript-logging/dist/commonjs/log/category/CategoryConsoleLoggerImpl.d.ts","mtime":1553611388000},{"path":"/data/node_modules/typescript-logging/dist/commonjs/log/category/CategoryDelegateLoggerImpl.d.ts","mtime":1553611388000},{"path":"/data/node_modules/typescript-logging/dist/commonjs/log/category/CategoryMessageBufferImpl.d.ts","mtime":1553611388000},{"path":"/data/node_modules/typescript-logging/dist/commonjs/log/standard/Logger.d.ts","mtime":1553611388000},{"path":"/data/node_modules/typescript-logging/dist/commonjs/log/standard/LoggerFactory.d.ts","mtime":1553611388004},{"path":"/data/node_modules/typescript-logging/dist/commonjs/log/standard/LoggerFactoryService.d.ts","mtime":1553611388004},{"path":"/data/node_modules/typescript-logging/dist/commonjs/log/standard/LoggerFactoryRuntimeSettings.d.ts","mtime":1553611388004},{"path":"/data/node_modules/typescript-logging/dist/commonjs/log/standard/AbstractLogger.d.ts","mtime":1553611388000},{"path":"/data/node_modules/typescript-logging/dist/commonjs/log/standard/ConsoleLoggerImpl.d.ts","mtime":1553611388000},{"path":"/data/node_modules/typescript-logging/dist/commonjs/log/standard/MessageBufferLoggerImpl.d.ts","mtime":1553611388004},{"path":"/data/node_modules/typescript-logging/dist/commonjs/utils/DataStructures.d.ts","mtime":1553611387936},{"path":"/data/node_modules/typescript-logging/dist/commonjs/utils/JSONHelper.d.ts","mtime":1553611387936},{"path":"/data/node_modules/typescript-logging/dist/commonjs/utils/MessageUtils.d.ts","mtime":1553611387936},{"path":"/data/node_modules/moment/moment.d.ts","mtime":1553611386704},{"path":"/data/node_modules/axios/index.d.ts","mtime":1553611386356},{"path":"/data/typings/index.d.ts","mtime":1553611371628},{"path":"/data/node_modules/@types/fs-extra/index.d.ts","mtime":1553611386380},{"path":"/data/node_modules/@types/node/index.d.ts","mtime":1553611386380},{"path":"/data/node_modules/@types/node/inspector.d.ts","mtime":1553611386380},{"path":"/data/node_modules/@types/glob/index.d.ts","mtime":1553611386380},{"path":"/data/node_modules/@types/minimatch/index.d.ts","mtime":1553611386380},{"path":"/data/node_modules/@types/glob/node_modules/@types/minimatch/index.d.ts","mtime":1553611386368},{"path":"/data/node_modules/@types/handlebars/index.d.ts","mtime":1553611386368},{"path":"/data/node_modules/@types/highlight.js/index.d.ts","mtime":1553611386368},{"path":"/data/node_modules/@types/jest/index.d.ts","mtime":1553611386368},{"path":"/data/node_modules/@types/jquery/index.d.ts","mtime":1553611386368},{"path":"/data/node_modules/@types/lodash/index.d.ts","mtime":1553611386320},{"path":"/data/node_modules/@types/lodash/common/common.d.ts","mtime":1553611386984},{"path":"/data/node_modules/@types/lodash/common/array.d.ts","mtime":1553611386984},{"path":"/data/node_modules/@types/lodash/common/collection.d.ts","mtime":1553611386984},{"path":"/data/node_modules/@types/lodash/common/date.d.ts","mtime":1553611386984},{"path":"/data/node_modules/@types/lodash/common/function.d.ts","mtime":1553611386984},{"path":"/data/node_modules/@types/lodash/common/lang.d.ts","mtime":1553611386984},{"path":"/data/node_modules/@types/lodash/common/math.d.ts","mtime":1553611386984},{"path":"/data/node_modules/@types/lodash/common/number.d.ts","mtime":1553611386984},{"path":"/data/node_modules/@types/lodash/common/object.d.ts","mtime":1553611386984},{"path":"/data/node_modules/@types/lodash/common/seq.d.ts","mtime":1553611386984},{"path":"/data/node_modules/@types/lodash/common/string.d.ts","mtime":1553611386984},{"path":"/data/node_modules/@types/lodash/common/util.d.ts","mtime":1553611386984},{"path":"/data/node_modules/@types/marked/index.d.ts","mtime":1553611386368},{"path":"/data/node_modules/@types/shelljs/index.d.ts","mtime":1553611386380},{"path":"/data/node_modules/@types/urijs/index.d.ts","mtime":1553611386380},{"path":"/data/node_modules/typescript/lib/lib.es2015.d.ts","mtime":1553611387384},{"path":"/data/node_modules/typescript/lib/lib.es2015.core.d.ts","mtime":1553611387384},{"path":"/data/node_modules/typescript/lib/lib.es2015.collection.d.ts","mtime":1553611387384},{"path":"/data/node_modules/typescript/lib/lib.es2015.generator.d.ts","mtime":1553611387384},{"path":"/data/node_modules/typescript/lib/lib.es2015.promise.d.ts","mtime":1553611387384},{"path":"/data/node_modules/typescript/lib/lib.es2015.iterable.d.ts","mtime":1553611387384},{"path":"/data/node_modules/typescript/lib/lib.es2015.symbol.d.ts","mtime":1553611387384},{"path":"/data/node_modules/typescript/lib/lib.es2015.proxy.d.ts","mtime":1553611387384},{"path":"/data/node_modules/typescript/lib/lib.es2015.reflect.d.ts","mtime":1553611387384},{"path":"/data/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","mtime":1553611387384},{"path":"/data/node_modules/typescript/lib/lib.es5.d.ts","mtime":1553611387388},{"path":"/data/node_modules/typescript/lib/lib.dom.d.ts","mtime":1553611387384},{"path":"/data/src/api/IHasHTTP.ts","mtime":1553611371624},{"path":"/data/src/api/IOnmsHTTP.ts","mtime":1553611371624},{"path":"/data/src/api/OnmsError.ts","mtime":1553611371624},{"path":"/data/src/model/OnmsFlowSeries.ts","mtime":1553611371628},{"path":"/data/src/model/OnmsFlowSeriesColumn.ts","mtime":1553611371628},{"path":"/data/src/model/OnmsFlowExporterSummary.ts","mtime":1553611371628},{"path":"/data/src/model/OnmsFlowSnmpInterface.ts","mtime":1553611371628},{"path":"/data/src/model/OnmsFlowExporter.ts","mtime":1553611371628},{"path":"/data/src/model/OnmsFlowTable.ts","mtime":1553611371628},{"path":"/data/src/api/OnmsHTTPOptions.ts","mtime":1553611371624},{"path":"/data/src/dao/BaseDAO.ts","mtime":1553611371628},{"path":"/data/node_modules/moment/moment.d.ts","mtime":1553611386704},{"path":"/data/.babelrc","mtime":1553611371556},{"path":"/data/node_modules/cache-loader/dist/cjs.js","mtime":1553611387012},{"path":"/data/node_modules/babel-loader/lib/index.js","mtime":1553611386992},{"path":"/data/node_modules/ts-loader/index.js","mtime":1553611386824},{"path":"/data/node_modules/tslint-loader/index.js","mtime":1553611386824}],"contextDependencies":[],"result":["\"use strict\";\n\nvar _regenerator = require(\"babel-runtime/regenerator\");\n\nvar _regenerator2 = _interopRequireDefault(_regenerator);\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n }\n function rejected(value) {\n try {\n step(generator[\"throw\"](value));\n } catch (e) {\n reject(e);\n }\n }\n function step(result) {\n result.done ? resolve(result.value) : new P(function (resolve) {\n resolve(result.value);\n }).then(fulfilled, rejected);\n }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar OnmsError_1 = require(\"../api/OnmsError\");\nvar OnmsFlowSeries_1 = require(\"../model/OnmsFlowSeries\");\nvar OnmsFlowSeriesColumn_1 = require(\"../model/OnmsFlowSeriesColumn\");\nvar OnmsFlowExporterSummary_1 = require(\"../model/OnmsFlowExporterSummary\");\nvar OnmsFlowSnmpInterface_1 = require(\"../model/OnmsFlowSnmpInterface\");\nvar OnmsFlowExporter_1 = require(\"../model/OnmsFlowExporter\");\nvar OnmsFlowTable_1 = require(\"../model/OnmsFlowTable\");\nvar OnmsHTTPOptions_1 = require(\"../api/OnmsHTTPOptions\");\nvar BaseDAO_1 = require(\"./BaseDAO\");\n/** @hidden */\n// tslint:disable-next-line\nvar moment = require('moment');\n/**\n * DAO for accessing flow (Netflow/IPFIX/sFlow) data.\n * @module FlowDAO\n */\n\nvar FlowDAO = function (_BaseDAO_1$BaseDAO) {\n _inherits(FlowDAO, _BaseDAO_1$BaseDAO);\n\n function FlowDAO() {\n _classCallCheck(this, FlowDAO);\n\n return _possibleConstructorReturn(this, (FlowDAO.__proto__ || Object.getPrototypeOf(FlowDAO)).apply(this, arguments));\n }\n\n _createClass(FlowDAO, [{\n key: \"getExporters\",\n\n /**\n * Get a summary of the nodes that have exported flows.\n * @param limit - maximum number of exporters to return (those with the most flows will be returned\n * if the results are truncated)\n * @param start - the start of the timespan to query (defaults to 4 hours ago)\n * @param end - the end of the timespan to query (defaults to now)\n */\n value: function getExporters(limit, start, end) {\n return __awaiter(this, void 0, void 0, /*#__PURE__*/_regenerator2.default.mark(function _callee() {\n var _this2 = this;\n\n return _regenerator2.default.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n return _context.abrupt(\"return\", FlowDAO.getOptions().then(function (opts) {\n var url = _this2.pathToFlowsEndpoint() + '/exporters';\n opts.withParameter('limit', limit).withParameter('start', start).withParameter('end', end);\n return _this2.http.get(url, opts).then(function (result) {\n if (result && result.data) {\n if (!Array.isArray(result.data)) {\n throw new OnmsError_1.OnmsError('Expected an array of flow exporter summaries but got \"' + (typeof result === \"undefined\" ? \"undefined\" : _typeof(result)) + '\" instead.');\n }\n return result.data.map(function (exporter) {\n return _this2.toFlowExporterSummary(exporter);\n });\n }\n throw new OnmsError_1.OnmsError('Unexpected response from GET ' + url + ': no result data found.');\n });\n }));\n\n case 1:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, this);\n }));\n }\n /**\n * Get detailed information about a specific node.\n * @param criteria - the node ID or foreignSource:foreignId tuple\n * @param limit - maximum number of interfaces to return (those with the most flows will be returned\n * if the results are truncated)\n * @param start - the start of the timespan to query (defaults to 4 hours ago)\n * @param end - the end of the timespan to query (defaults to now)\n */\n\n }, {\n key: \"getExporter\",\n value: function getExporter(criteria, limit, start, end) {\n return __awaiter(this, void 0, void 0, /*#__PURE__*/_regenerator2.default.mark(function _callee2() {\n var _this3 = this;\n\n return _regenerator2.default.wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n return _context2.abrupt(\"return\", FlowDAO.getOptions().then(function (opts) {\n opts.withParameter('limit', limit).withParameter('start', start).withParameter('end', end);\n return _this3.http.get(_this3.pathToFlowsEndpoint() + '/exporters/' + criteria, opts).then(function (result) {\n return _this3.toFlowExporter(result.data);\n });\n }));\n\n case 1:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2, this);\n }));\n }\n /**\n * Summarize the top N applications/protocols based on parameters.\n * @param N - how many applications to return\n * @param start - the start of the timespan to query (defaults to 4 hours ago)\n * @param end - the end of the timespan to query (defaults to now)\n * @param includeOther - include an additional \"other\" result that\n * represents everything that does not match the top N\n * @param exporterNodeCriteria - the node ID or foreignSource:foreignId tuple\n * @param ifIndex - filter for flows that came through this SNMP interface\n */\n\n }, {\n key: \"getSummaryForTopNApplications\",\n value: function getSummaryForTopNApplications(N, start, end, includeOther, exporterNodeCriteria, ifIndex) {\n return __awaiter(this, void 0, void 0, /*#__PURE__*/_regenerator2.default.mark(function _callee3() {\n var _this4 = this;\n\n return _regenerator2.default.wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n return _context3.abrupt(\"return\", FlowDAO.getOptions().then(function (opts) {\n opts.withParameter('N', N).withParameter('start', start).withParameter('end', end).withParameter('exporterNode', exporterNodeCriteria).withParameter('ifIndex', ifIndex).withParameter('includeOther', includeOther);\n return _this4.http.get(_this4.pathToFlowsEndpoint() + '/applications', opts).then(function (result) {\n return _this4.tableFromData(result.data);\n });\n }));\n\n case 1:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3, this);\n }));\n }\n /**\n * Summarize the top N conversations based on parameters.\n * @param N - how many conversations to return\n * @param start - the start of the timespan to query (defaults to 4 hours ago)\n * @param end - the end of the timespan to query (defaults to now)\n * @param exporterNodeCriteria - the node ID or foreignSource:foreignId tuple\n * @param ifIndex - filter for flows that came through this SNMP interface\n */\n\n }, {\n key: \"getSummaryForTopNConversations\",\n value: function getSummaryForTopNConversations(N, start, end, exporterNodeCriteria, ifIndex) {\n return __awaiter(this, void 0, void 0, /*#__PURE__*/_regenerator2.default.mark(function _callee4() {\n var _this5 = this;\n\n return _regenerator2.default.wrap(function _callee4$(_context4) {\n while (1) {\n switch (_context4.prev = _context4.next) {\n case 0:\n return _context4.abrupt(\"return\", FlowDAO.getOptions().then(function (opts) {\n opts.withParameter('N', N).withParameter('start', start).withParameter('end', end).withParameter('exporterNode', exporterNodeCriteria).withParameter('ifIndex', ifIndex);\n return _this5.http.get(_this5.pathToFlowsEndpoint() + '/conversations', opts).then(function (result) {\n return _this5.tableFromData(result.data);\n });\n }));\n\n case 1:\n case \"end\":\n return _context4.stop();\n }\n }\n }, _callee4, this);\n }));\n }\n /**\n * Get time series data for the top N applications/protocols based on parameters.\n * @param N - how many applications' series to return\n * @param start - the start of the timespan to query (defaults to 4 hours ago)\n * @param end - the end of the timespan to query (defaults to now)\n * @param step - the requested time interval between rows\n * @param includeOther - include an additional \"other\" result that\n * represents everything that does not match the top N\n * @param exporterNodeCriteria - the node ID or foreignSource:foreignId tuple\n * @param ifIndex - filter for flows that came through this SNMP interface\n */\n\n }, {\n key: \"getSeriesForTopNApplications\",\n value: function getSeriesForTopNApplications(N, start, end, step, includeOther, exporterNodeCriteria, ifIndex) {\n return __awaiter(this, void 0, void 0, /*#__PURE__*/_regenerator2.default.mark(function _callee5() {\n var _this6 = this;\n\n return _regenerator2.default.wrap(function _callee5$(_context5) {\n while (1) {\n switch (_context5.prev = _context5.next) {\n case 0:\n return _context5.abrupt(\"return\", FlowDAO.getOptions().then(function (opts) {\n opts.withParameter('N', N).withParameter('start', start).withParameter('end', end).withParameter('step', step).withParameter('exporterNode', exporterNodeCriteria).withParameter('ifIndex', ifIndex).withParameter('includeOther', includeOther);\n return _this6.http.get(_this6.pathToFlowsEndpoint() + '/applications/series', opts).then(function (result) {\n return _this6.seriesFromData(result.data);\n });\n }));\n\n case 1:\n case \"end\":\n return _context5.stop();\n }\n }\n }, _callee5, this);\n }));\n }\n /**\n * Get time series data for the top N conversations based on parameters.\n * @param N - how many conversations' series to return\n * @param start - the start of the timespan to query (defaults to 4 hours ago)\n * @param end - the end of the timespan to query (defaults to now)\n * @param step - the requested time interval between rows\n * @param exporterNodeCriteria - the node ID or foreignSource:foreignId tuple\n * @param ifIndex - filter for flows that came through this SNMP interface\n */\n\n }, {\n key: \"getSeriesForTopNConversations\",\n value: function getSeriesForTopNConversations(N, start, end, step, exporterNodeCriteria, ifIndex) {\n return __awaiter(this, void 0, void 0, /*#__PURE__*/_regenerator2.default.mark(function _callee6() {\n var _this7 = this;\n\n return _regenerator2.default.wrap(function _callee6$(_context6) {\n while (1) {\n switch (_context6.prev = _context6.next) {\n case 0:\n return _context6.abrupt(\"return\", FlowDAO.getOptions().then(function (opts) {\n opts.withParameter('N', N).withParameter('start', start).withParameter('end', end).withParameter('step', step).withParameter('exporterNode', exporterNodeCriteria).withParameter('ifIndex', ifIndex);\n return _this7.http.get(_this7.pathToFlowsEndpoint() + '/conversations/series', opts).then(function (result) {\n return _this7.seriesFromData(result.data);\n });\n }));\n\n case 1:\n case \"end\":\n return _context6.stop();\n }\n }\n }, _callee6, this);\n }));\n }\n /**\n * Convert flow ReST exporter summary JSON data to an [[OnmsFlowExporterSummary]] object.\n * @hidden\n */\n\n }, {\n key: \"toFlowExporterSummary\",\n value: function toFlowExporterSummary(data) {\n var summary = new OnmsFlowExporterSummary_1.OnmsFlowExporterSummary();\n summary.id = data.id;\n summary.foreignId = data.foreignId;\n summary.foreignSource = data.foreignSource;\n summary.label = data.label;\n return summary;\n }\n /**\n * Convert flow ReST exporter JSON data to an [[OnmsFlowExporter]] object.\n * @hidden\n */\n\n }, {\n key: \"toFlowExporter\",\n value: function toFlowExporter(data) {\n var _this8 = this;\n\n var exporter = new OnmsFlowExporter_1.OnmsFlowExporter();\n exporter.id = data.id;\n exporter.foreignId = data.foreignId;\n exporter.foreignSource = data.foreignSource;\n exporter.label = data.label;\n exporter.interfaces = [];\n if (data.interface) {\n exporter.interfaces = data.interface.map(function (iff) {\n return _this8.toInterface(iff);\n });\n }\n return exporter;\n }\n /**\n * Convert flow ReST interface JSON data to an [[OnmsFlowSnmpInterface]] object.\n * @hidden\n */\n\n }, {\n key: \"toInterface\",\n value: function toInterface(data) {\n var iff = new OnmsFlowSnmpInterface_1.OnmsFlowSnmpInterface();\n iff.index = data.index;\n iff.name = data.name;\n iff.description = data.descr;\n iff.resourceId = data['resource-id'];\n return iff;\n }\n /**\n * Create a series object from a JSON object.\n * @hidden\n */\n\n }, {\n key: \"tableFromData\",\n value: function tableFromData(data) {\n var table = new OnmsFlowTable_1.OnmsFlowTable();\n table.start = this.toDate(data.start);\n table.end = this.toDate(data.end);\n table.headers = data.headers;\n table.rows = data.rows;\n return table;\n }\n /**\n * Create a series object from a JSON object.\n * @hidden\n */\n\n }, {\n key: \"seriesFromData\",\n value: function seriesFromData(data) {\n var series = new OnmsFlowSeries_1.OnmsFlowSeries();\n series.start = this.toDate(data.start);\n series.end = this.toDate(data.end);\n series.columns = data.labels;\n series.timestamps = data.timestamps;\n series.values = data.values;\n var columns = data.columns;\n if (!Array.isArray(columns)) {\n columns = [columns];\n }\n series.columns = [];\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = columns[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var column = _step.value;\n\n column = new OnmsFlowSeriesColumn_1.OnmsFlowSeriesColumn(column.label, column.ingress);\n series.columns.push(column);\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n return series;\n }\n /**\n * Get the path to the flows endpoint for the appropriate API version.\n * @hidden\n */\n\n }, {\n key: \"pathToFlowsEndpoint\",\n value: function pathToFlowsEndpoint() {\n return 'rest/flows';\n }\n }], [{\n key: \"getOptions\",\n\n /**\n * Create an [[OnmsHTTPOptions]] object for DAO calls.\n */\n value: function getOptions() {\n return __awaiter(this, void 0, void 0, /*#__PURE__*/_regenerator2.default.mark(function _callee7() {\n return _regenerator2.default.wrap(function _callee7$(_context7) {\n while (1) {\n switch (_context7.prev = _context7.next) {\n case 0:\n return _context7.abrupt(\"return\", Promise.resolve(new OnmsHTTPOptions_1.OnmsHTTPOptions()).then(function (options) {\n options.headers.accept = 'application/json';\n return options;\n }));\n\n case 1:\n case \"end\":\n return _context7.stop();\n }\n }\n }, _callee7, this);\n }));\n }\n }]);\n\n return FlowDAO;\n}(BaseDAO_1.BaseDAO);\n\nexports.FlowDAO = FlowDAO;",{"version":3,"file":"/data/src/dao/FlowDAO.ts","sourceRoot":"","sources":["/data/node_modules/tslint-loader/index.js??ref--4-0!/data/src/dao/FlowDAO.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,0BAA2C;AAC3C,+BAAuD;AACvD,qCAAmE;AACnE,wCAAyE;AACzE,sCAAqE;AACrE,iCAA2D;AAC3D,8BAAqD;AACrD,gCAAuD;AAEvD,wBAAkC;AAElC,AAAc;AACd,AAA2B;AAC3B,IAAM,AAAM,SAAG,AAAO,QAAC,AAAQ,AAAC,AAAC;AAMjC,AAGG,AACH;;;;;IAAqB;;;;;;;;;;;;AAYjB,AAMG,AACU,AAA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AAO,UAAG,AAAE,AAAC;;;;;;AAEpB,AAAG,AAAC,AAAC,qCAAc,AAAO,AAAC;AAAC,AAAC,wBAApB,AAAM;;AACX,AAAM,6BAAG,IAAI,uBAAoB,qBAC7B,AAAM,OAAC,AAAK,OACZ,AAAM,OAAC,AAAO,AACjB,AAAC;AACF,AAAM,2BAAC,AAAO,QAAC,AAAI,KAAC,AAAM,AAAC,AAAC,AAChC;AAAC;;;;;;;;;;;;;;;;AAED,AAAM,mBAAC,AAAM,AAAC,AAClB;AAAC;AAED,AAGG,AACK,AAAmB;;;;;;;;AACvB,AAAM,mBAAC,AAAY,AAAC,AACxB;AAAC,AACJ;;;;AAnQG,AAEG,AACO,AAAM,AAAO,AAAU;;;;;AAC7B,AAAM;;;;0EAAS,AAAO,QAAC,IAAI,kBAAe,AAAE,AAAC,mBACxC,AAAI,KAAC,UAAC,AAAO,AAAE,AAAE;AACd,AAAO,4CAAC,AAAO,QAAC,AAAM,SAAG,AAAkB,AAAC;AAC5C,AAAM,2CAAC,AAAO,AAAC,AACnB;AAAC,AAAC,AAAC,AACX,AAAC,iCALU,AAAO;;;;;;;;;AAKjB;;;;EAVwB,UAAO;;AAApC,kBAoQC","sourcesContent":["import {IHasHTTP} from '../api/IHasHTTP';\nimport {IOnmsHTTP} from '../api/IOnmsHTTP';\nimport {OnmsError} from '../api/OnmsError';\nimport {OnmsFlowSeries} from '../model/OnmsFlowSeries';\nimport {OnmsFlowSeriesColumn} from '../model/OnmsFlowSeriesColumn';\nimport {OnmsFlowExporterSummary} from '../model/OnmsFlowExporterSummary';\nimport {OnmsFlowSnmpInterface} from '../model/OnmsFlowSnmpInterface';\nimport {OnmsFlowExporter} from '../model/OnmsFlowExporter';\nimport {OnmsFlowTable} from '../model/OnmsFlowTable';\nimport {OnmsHTTPOptions} from '../api/OnmsHTTPOptions';\n\nimport {BaseDAO} from './BaseDAO';\n\n/** @hidden */\n// tslint:disable-next-line\nconst moment = require('moment');\n\n/** @hidden */\n// tslint:disable-next-line\nimport {Moment} from 'moment';\n\n/**\n * DAO for accessing flow (Netflow/IPFIX/sFlow) data.\n * @module FlowDAO\n */\nexport class FlowDAO extends BaseDAO {\n /**\n * Create an [[OnmsHTTPOptions]] object for DAO calls.\n */\n protected static async getOptions(): Promise<OnmsHTTPOptions> {\n return Promise.resolve(new OnmsHTTPOptions())\n .then((options) => {\n options.headers.accept = 'application/json';\n return options;\n });\n }\n\n /**\n * Get a summary of the nodes that have exported flows.\n * @param limit - maximum number of exporters to return (those with the most flows will be returned\n * if the results are truncated)\n * @param start - the start of the timespan to query (defaults to 4 hours ago)\n * @param end - the end of the timespan to query (defaults to now)\n */\n public async getExporters(limit: number, start?: number, end?: number): Promise<OnmsFlowExporterSummary[]> {\n return FlowDAO.getOptions().then((opts) => {\n const url = this.pathToFlowsEndpoint() + '/exporters';\n opts.withParameter('limit', limit)\n .withParameter('start', start)\n .withParameter('end', end);\n return this.http.get(url, opts).then((result) => {\n if (result && result.data) {\n if (!Array.isArray(result.data)) {\n throw new OnmsError('Expected an array of flow exporter summaries but got \"' +\n (typeof result) + '\" instead.');\n }\n return result.data.map((exporter) => {\n return this.toFlowExporterSummary(exporter);\n });\n }\n throw new OnmsError('Unexpected response from GET ' + url + ': no result data found.');\n });\n });\n }\n\n /**\n * Get detailed information about a specific node.\n * @param criteria - the node ID or foreignSource:foreignId tuple\n * @param limit - maximum number of interfaces to return (those with the most flows will be returned\n * if the results are truncated)\n * @param start - the start of the timespan to query (defaults to 4 hours ago)\n * @param end - the end of the timespan to query (defaults to now)\n */\n public async getExporter(criteria: string, limit: number, start?: number, end?: number): Promise<OnmsFlowExporter> {\n return FlowDAO.getOptions().then((opts) => {\n opts.withParameter('limit', limit)\n .withParameter('start', start)\n .withParameter('end', end);\n return this.http.get(this.pathToFlowsEndpoint() + '/exporters/' + criteria, opts).then((result) => {\n return this.toFlowExporter(result.data);\n });\n });\n }\n\n /**\n * Summarize the top N applications/protocols based on parameters.\n * @param N - how many applications to return\n * @param start - the start of the timespan to query (defaults to 4 hours ago)\n * @param end - the end of the timespan to query (defaults to now)\n * @param includeOther - include an additional \"other\" result that\n * represents everything that does not match the top N\n * @param exporterNodeCriteria - the node ID or foreignSource:foreignId tuple\n * @param ifIndex - filter for flows that came through this SNMP interface\n */\n public async getSummaryForTopNApplications(N?: number, start?: number, end?: number,\n includeOther?: boolean,\n exporterNodeCriteria?: string,\n ifIndex?: number): Promise<OnmsFlowTable> {\n return FlowDAO.getOptions().then((opts) => {\n opts.withParameter('N', N)\n .withParameter('start', start)\n .withParameter('end', end)\n .withParameter('exporterNode', exporterNodeCriteria)\n .withParameter('ifIndex', ifIndex)\n .withParameter('includeOther', includeOther);\n return this.http.get(this.pathToFlowsEndpoint() + '/applications', opts).then((result) => {\n return this.tableFromData(result.data);\n });\n });\n }\n\n /**\n * Summarize the top N conversations based on parameters.\n * @param N - how many conversations to return\n * @param start - the start of the timespan to query (defaults to 4 hours ago)\n * @param end - the end of the timespan to query (defaults to now)\n * @param exporterNodeCriteria - the node ID or foreignSource:foreignId tuple\n * @param ifIndex - filter for flows that came through this SNMP interface\n */\n public async getSummaryForTopNConversations(N?: number, start?: number, end?: number,\n exporterNodeCriteria?: string,\n ifIndex?: number): Promise<OnmsFlowTable> {\n return FlowDAO.getOptions().then((opts) => {\n opts.withParameter('N', N)\n .withParameter('start', start)\n .withParameter('end', end)\n .withParameter('exporterNode', exporterNodeCriteria)\n .withParameter('ifIndex', ifIndex);\n return this.http.get(this.pathToFlowsEndpoint() + '/conversations', opts).then((result) => {\n return this.tableFromData(result.data);\n });\n });\n }\n\n /**\n * Get time series data for the top N applications/protocols based on parameters.\n * @param N - how many applications' series to return\n * @param start - the start of the timespan to query (defaults to 4 hours ago)\n * @param end - the end of the timespan to query (defaults to now)\n * @param step - the requested time interval between rows\n * @param includeOther - include an additional \"other\" result that\n * represents everything that does not match the top N\n * @param exporterNodeCriteria - the node ID or foreignSource:foreignId tuple\n * @param ifIndex - filter for flows that came through this SNMP interface\n */\n public async getSeriesForTopNApplications(N?: number, start?: number, end?: number,\n step?: number, includeOther?: boolean,\n exporterNodeCriteria?: string,\n ifIndex?: number): Promise<OnmsFlowSeries> {\n return FlowDAO.getOptions().then((opts) => {\n opts.withParameter('N', N)\n .withParameter('start', start)\n .withParameter('end', end)\n .withParameter('step', step)\n .withParameter('exporterNode', exporterNodeCriteria)\n .withParameter('ifIndex', ifIndex)\n .withParameter('includeOther', includeOther);\n return this.http.get(this.pathToFlowsEndpoint() + '/applications/series', opts).then((result) => {\n return this.seriesFromData(result.data);\n });\n });\n }\n\n /**\n * Get time series data for the top N conversations based on parameters.\n * @param N - how many conversations' series to return\n * @param start - the start of the timespan to query (defaults to 4 hours ago)\n * @param end - the end of the timespan to query (defaults to now)\n * @param step - the requested time interval between rows\n * @param exporterNodeCriteria - the node ID or foreignSource:foreignId tuple\n * @param ifIndex - filter for flows that came through this SNMP interface\n */\n public async getSeriesForTopNConversations(N?: number, start?: number, end?: number,\n step?: number, exporterNodeCriteria?: string,\n ifIndex?: number): Promise<OnmsFlowSeries> {\n return FlowDAO.getOptions().then((opts) => {\n opts.withParameter('N', N)\n .withParameter('start', start)\n .withParameter('end', end)\n .withParameter('step', step)\n .withParameter('exporterNode', exporterNodeCriteria)\n .withParameter('ifIndex', ifIndex);\n return this.http.get(this.pathToFlowsEndpoint() + '/conversations/series', opts).then((result) => {\n return this.seriesFromData(result.data);\n });\n });\n }\n\n /**\n * Convert flow ReST exporter summary JSON data to an [[OnmsFlowExporterSummary]] object.\n * @hidden\n */\n public toFlowExporterSummary(data: any) {\n const summary = new OnmsFlowExporterSummary();\n summary.id = data.id;\n summary.foreignId = data.foreignId;\n summary.foreignSource = data.foreignSource;\n summary.label = data.label;\n return summary;\n }\n\n /**\n * Convert flow ReST exporter JSON data to an [[OnmsFlowExporter]] object.\n * @hidden\n */\n public toFlowExporter(data: any) {\n const exporter = new OnmsFlowExporter();\n exporter.id = data.id;\n exporter.foreignId = data.foreignId;\n exporter.foreignSource = data.foreignSource;\n exporter.label = data.label;\n exporter.interfaces = [];\n if (data.interface) {\n exporter.interfaces = data.interface.map((iff) => {\n return this.toInterface(iff);\n });\n }\n return exporter;\n }\n\n /**\n * Convert flow ReST interface JSON data to an [[OnmsFlowSnmpInterface]] object.\n * @hidden\n */\n public toInterface(data: any) {\n const iff = new OnmsFlowSnmpInterface();\n iff.index = data.index;\n iff.name = data.name;\n iff.description = data.descr;\n iff.resourceId = data['resource-id'];\n return iff;\n }\n\n /**\n * Create a series object from a JSON object.\n * @hidden\n */\n public tableFromData(data: any) {\n const table = new OnmsFlowTable();\n\n table.start = this.toDate(data.start);\n table.end = this.toDate(data.end);\n table.headers = data.headers;\n table.rows = data.rows;\n\n return table;\n }\n\n /**\n * Create a series object from a JSON object.\n * @hidden\n */\n public seriesFromData(data: any) {\n const series = new OnmsFlowSeries();\n\n series.start = this.toDate(data.start);\n series.end = this.toDate(data.end);\n series.columns = data.labels;\n series.timestamps = data.timestamps;\n series.values = data.values;\n\n let columns = data.columns;\n if (!Array.isArray(columns)) {\n columns = [columns];\n }\n series.columns = [];\n\n for (let column of columns) {\n column = new OnmsFlowSeriesColumn(\n column.label,\n column.ingress,\n );\n series.columns.push(column);\n }\n\n return series;\n }\n\n /**\n * Get the path to the flows endpoint for the appropriate API version.\n * @hidden\n */\n private pathToFlowsEndpoint() {\n return 'rest/flows';\n }\n}\n"]}]}