opennms
Version:
Client API for the OpenNMS network monitoring platform
1 lines • 55.5 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/NodeDAO.ts","dependencies":[{"path":"/data/src/dao/NodeDAO.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/dao/AbstractDAO.ts","mtime":1553611371628},{"path":"/data/src/api/Filter.ts","mtime":1553611371624},{"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/internal/Util.ts","mtime":1553611371628},{"path":"/data/src/model/OnmsCategory.ts","mtime":1553611371628},{"path":"/data/src/model/OnmsCollectType.ts","mtime":1553611371628},{"path":"/data/src/model/OnmsIpInterface.ts","mtime":1553611371628},{"path":"/data/src/model/OnmsManagedType.ts","mtime":1553611371628},{"path":"/data/src/model/OnmsMonitoredService.ts","mtime":1553611371628},{"path":"/data/src/model/OnmsNode.ts","mtime":1553611371628},{"path":"/data/src/model/OnmsNodeLabelSource.ts","mtime":1553611371628},{"path":"/data/src/model/OnmsNodeType.ts","mtime":1553611371628},{"path":"/data/src/model/OnmsPrimaryType.ts","mtime":1553611371628},{"path":"/data/src/model/OnmsServiceType.ts","mtime":1553611371628},{"path":"/data/src/model/OnmsServiceStatusType.ts","mtime":1553611371628},{"path":"/data/src/model/OnmsSnmpInterface.ts","mtime":1553611371628},{"path":"/data/src/model/OnmsSnmpStatusType.ts","mtime":1553611371628},{"path":"/data/src/model/PhysAddr.ts","mtime":1553611371628},{"path":"/data/src/api/Log.ts","mtime":1553611371624},{"path":"/data/node_modules/typescript-logging/dist/commonjs/typescript-logging.d.ts","mtime":1553611387808},{"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 AbstractDAO_1 = require(\"./AbstractDAO\");\nvar OnmsError_1 = require(\"../api/OnmsError\");\nvar Util_1 = require(\"../internal/Util\");\nvar OnmsCategory_1 = require(\"../model/OnmsCategory\");\nvar OnmsCollectType_1 = require(\"../model/OnmsCollectType\");\nvar OnmsIpInterface_1 = require(\"../model/OnmsIpInterface\");\nvar OnmsManagedType_1 = require(\"../model/OnmsManagedType\");\nvar OnmsMonitoredService_1 = require(\"../model/OnmsMonitoredService\");\nvar OnmsNode_1 = require(\"../model/OnmsNode\");\nvar OnmsNodeLabelSource_1 = require(\"../model/OnmsNodeLabelSource\");\nvar OnmsNodeType_1 = require(\"../model/OnmsNodeType\");\nvar OnmsPrimaryType_1 = require(\"../model/OnmsPrimaryType\");\nvar OnmsServiceType_1 = require(\"../model/OnmsServiceType\");\nvar OnmsServiceStatusType_1 = require(\"../model/OnmsServiceStatusType\");\nvar OnmsSnmpInterface_1 = require(\"../model/OnmsSnmpInterface\");\nvar OnmsSnmpStatusType_1 = require(\"../model/OnmsSnmpStatusType\");\nvar PhysAddr_1 = require(\"../model/PhysAddr\");\nvar Log_1 = require(\"../api/Log\");\nvar typescript_logging_1 = require(\"typescript-logging\");\n/** @hidden */\nvar cat = new typescript_logging_1.Category('nodes', Log_1.catDao);\n/**\n * Data access for [[OnmsNode]] objects.\n * @module NodeDAO\n */\n\nvar NodeDAO = function (_AbstractDAO_1$Abstra) {\n _inherits(NodeDAO, _AbstractDAO_1$Abstra);\n\n function NodeDAO(impl) {\n _classCallCheck(this, NodeDAO);\n\n return _possibleConstructorReturn(this, (NodeDAO.__proto__ || Object.getPrototypeOf(NodeDAO)).call(this, impl));\n }\n /**\n * Get an node, given the node's ID.\n *\n * @param id - The node's ID.\n * @param recurse - Optionally fetch all sub-model objects. (ipInterface, etc.)\n */\n\n\n _createClass(NodeDAO, [{\n key: \"get\",\n value: function get(id) {\n var recurse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\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\", this.getOptions().then(function (opts) {\n return _this2.http.get(_this2.pathToNodesEndpoint() + '/' + id, opts).then(function (result) {\n var node = _this2.fromData(result.data);\n if (recurse) {\n return _this2.fetch(node);\n } else {\n return node;\n }\n });\n }));\n\n case 1:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, this);\n }));\n }\n /** Search for nodes, given an optional filter. */\n\n }, {\n key: \"find\",\n value: function find(filter) {\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\", this.getOptions(filter).then(function (opts) {\n return _this3.http.get(_this3.pathToNodesEndpoint(), opts).then(function (result) {\n var data = result.data;\n if (data !== null && _this3.getCount(data) > 0 && data.node) {\n data = data.node;\n } else {\n data = [];\n }\n if (!Array.isArray(data)) {\n if (data.id) {\n data = [data];\n } else {\n throw new OnmsError_1.OnmsError('Expected an array of nodes but got \"' + (typeof data === \"undefined\" ? \"undefined\" : _typeof(data)) + '\" instead.');\n }\n }\n return data.map(function (nodeData) {\n return _this3.fromData(nodeData);\n });\n });\n }));\n\n case 1:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2, this);\n }));\n }\n /** Given a node, fetch all the sub-model objects for that node. (ipInterfaces, snmpInterfaces, etc.) */\n\n }, {\n key: \"fetch\",\n value: function fetch(node) {\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\", this.snmpInterfaces(node).then(function (si) {\n node.snmpInterfaces = si;\n si.forEach(function (iface) {\n iface.node = node;\n });\n return _this4.ipInterfaces(node).then(function (ifaces) {\n node.ipInterfaces = ifaces;\n ifaces.forEach(function (iface) {\n iface.node = node;\n });\n return Promise.all(ifaces.map(function (iface) {\n return _this4.services(node, iface).then(function (services) {\n iface.services = services;\n services.forEach(function (service) {\n service.node = node;\n service.ipInterface = iface;\n });\n });\n })).then(function () {\n return node;\n });\n });\n }));\n\n case 1:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3, this);\n }));\n }\n /** Given a node, get the IP interfaces for that node. */\n\n }, {\n key: \"ipInterfaces\",\n value: function ipInterfaces(node, filter) {\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 if (node instanceof OnmsNode_1.OnmsNode) {\n node = node.id;\n }\n return _context4.abrupt(\"return\", this.getOptions(filter).then(function (opts) {\n return _this5.http.get(_this5.pathToNodesEndpoint() + '/' + node + '/ipinterfaces', opts).then(function (result) {\n var data = result.data;\n if (_this5.getCount(data) > 0 && data.ipInterface) {\n data = data.ipInterface;\n } else {\n data = [];\n }\n if (!Array.isArray(data)) {\n if (data.nodeId) {\n data = [data];\n } else {\n throw new OnmsError_1.OnmsError('Expected an array of IP interfaces but got \"' + (typeof data === \"undefined\" ? \"undefined\" : _typeof(data)) + '\" instead.');\n }\n }\n return data.map(function (ifaceData) {\n return _this5.fromIpInterfaceData(ifaceData);\n });\n });\n }));\n\n case 2:\n case \"end\":\n return _context4.stop();\n }\n }\n }, _callee4, this);\n }));\n }\n /** Given a node, get the SNMP interfaces for that node. */\n\n }, {\n key: \"snmpInterfaces\",\n value: function snmpInterfaces(node, filter) {\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\", this.getOptions(filter).then(function (opts) {\n if (node instanceof OnmsNode_1.OnmsNode) {\n node = node.id;\n }\n return _this6.http.get(_this6.pathToNodesEndpoint() + '/' + node + '/snmpinterfaces', opts).then(function (result) {\n var data = result.data;\n if (_this6.getCount(data) > 0 && data.snmpInterface) {\n data = data.snmpInterface;\n } else {\n data = [];\n }\n if (!Array.isArray(data)) {\n if (data.ifName) {\n data = [data];\n } else {\n throw new OnmsError_1.OnmsError('Expected an array of SNMP interfaces but got \"' + (typeof data === \"undefined\" ? \"undefined\" : _typeof(data)) + '\" instead.');\n }\n }\n return data.map(function (ifaceData) {\n return _this6.fromSnmpData(ifaceData);\n });\n });\n }));\n\n case 1:\n case \"end\":\n return _context5.stop();\n }\n }\n }, _callee5, this);\n }));\n }\n /** Given a node, get the IP interfaces for that node. */\n\n }, {\n key: \"services\",\n value: function services(node, ipInterface, filter) {\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\", this.getOptions(filter).then(function (opts) {\n if (node instanceof OnmsNode_1.OnmsNode) {\n node = node.id;\n }\n if (ipInterface instanceof OnmsIpInterface_1.OnmsIpInterface && ipInterface.ipAddress) {\n ipInterface = ipInterface.ipAddress.address;\n }\n var url = _this7.pathToNodesEndpoint() + '/' + node + '/ipinterfaces/' + ipInterface + '/services';\n return _this7.http.get(url, opts).then(function (result) {\n var data = result.data;\n if (_this7.getCount(data) > 0 && data.service) {\n data = data.service;\n } else {\n data = [];\n }\n if (!Array.isArray(data)) {\n if (data.lastGood) {\n data = [data];\n } else {\n throw new OnmsError_1.OnmsError('Expected an array of services but got \"' + (typeof data === \"undefined\" ? \"undefined\" : _typeof(data)) + '\" instead.');\n }\n }\n return data.map(function (ifaceData) {\n return _this7.fromServiceData(ifaceData);\n });\n });\n }));\n\n case 1:\n case \"end\":\n return _context6.stop();\n }\n }\n }, _callee6, this);\n }));\n }\n /**\n * Create a node object from a JSON object.\n * @hidden\n */\n\n }, {\n key: \"fromData\",\n value: function fromData(data) {\n var node = new OnmsNode_1.OnmsNode();\n node.id = this.toNumber(data.id);\n node.label = data.label;\n node.location = data.location;\n node.foreignSource = data.foreignSource || undefined;\n node.foreignId = data.foreignId || undefined;\n node.sysContact = data.sysContact;\n node.sysDescription = data.sysDescription;\n node.sysLocation = data.sysLocation;\n node.sysName = data.sysName;\n node.sysObjectId = data.sysObjectId;\n if (data.labelSource) {\n node.labelSource = OnmsNodeLabelSource_1.OnmsNodeLabelSource.forId(data.labelSource);\n }\n if (data.createTime) {\n node.createTime = this.toDate(data.createTime);\n }\n if (data.lastCapsdPoll) {\n node.lastCapsdPoll = this.toDate(data.lastCapsdPoll);\n }\n if (data.type) {\n node.type = OnmsNodeType_1.OnmsNodeType.forId(data.type);\n }\n node.categories = [];\n if (data.categories) {\n node.categories = data.categories.map(function (c) {\n return OnmsCategory_1.OnmsCategory.for(c.id, c.name);\n });\n }\n for (var key in data.assetRecord) {\n if (data.assetRecord.hasOwnProperty(key) && data.assetRecord[key] !== null && data.assetRecord[key] !== undefined) {\n node.assets[key] = data.assetRecord[key];\n }\n }\n return node;\n }\n /**\n * create an IP interface object from a JSON object\n * @hidden\n */\n\n }, {\n key: \"fromIpInterfaceData\",\n value: function fromIpInterfaceData(data) {\n var iface = new OnmsIpInterface_1.OnmsIpInterface();\n iface.id = this.toNumber(data.id);\n iface.hostname = data.hostName || data.hostname;\n iface.ipAddress = Util_1.Util.toIPAddress(data.ipAddress);\n iface.isManaged = OnmsManagedType_1.OnmsManagedType.forId(data.isManaged);\n iface.lastCapsdPoll = this.toDate(data.lastCapsdPoll);\n iface.snmpPrimary = OnmsPrimaryType_1.OnmsPrimaryType.forId(data.snmpPrimary);\n if (data.snmpInterface && data.snmpInterface.id) {\n iface.snmpInterfaceId = this.toNumber(data.snmpInterface.id);\n }\n return iface;\n }\n /**\n * create an SNMP interface object from a JSON object\n * @hidden\n */\n\n }, {\n key: \"fromSnmpData\",\n value: function fromSnmpData(data) {\n var iface = new OnmsSnmpInterface_1.OnmsSnmpInterface();\n iface.id = this.toNumber(data.id);\n iface.ifIndex = this.toNumber(data.ifIndex);\n iface.ifDescr = data.ifDescr;\n iface.ifType = this.toNumber(data.ifType);\n iface.ifName = data.ifName;\n iface.ifSpeed = this.toNumber(data.ifSpeed);\n iface.ifAdminStatus = OnmsSnmpStatusType_1.OnmsSnmpStatusType.forId(this.toNumber(data.ifAdminStatus));\n iface.ifOperStatus = OnmsSnmpStatusType_1.OnmsSnmpStatusType.forId(this.toNumber(data.ifOperStatus));\n iface.ifAlias = data.ifAlias;\n iface.lastCapsdPoll = this.toDate(data.lastCapsdPoll);\n iface.collect = OnmsCollectType_1.OnmsCollectType.forId(data.collectFlag);\n iface.poll = data.poll;\n iface.lastSnmpPoll = this.toDate(data.lastSnmpPoll);\n if (data.physAddr) {\n iface.physAddr = new PhysAddr_1.PhysAddr(data.physAddr);\n }\n return iface;\n }\n /**\n * create a monitored service object from a JSON object\n * @hidden\n */\n\n }, {\n key: \"fromServiceData\",\n value: function fromServiceData(data) {\n var service = new OnmsMonitoredService_1.OnmsMonitoredService();\n service.id = this.toNumber(data.id);\n service.lastFail = this.toDate(data.lastFail);\n service.lastGood = this.toDate(data.lastGood);\n if (data.serviceType) {\n service.type = OnmsServiceType_1.OnmsServiceType.for(data.serviceType.id, data.serviceType.name);\n }\n if (data.status) {\n service.status = OnmsServiceStatusType_1.OnmsServiceStatusType.forId(data.status);\n }\n return service;\n }\n /**\n * The path to the node search properties endpoint.\n */\n\n }, {\n key: \"searchPropertyPath\",\n value: function searchPropertyPath() {\n if (this.getApiVersion() < 2) {\n throw new OnmsError_1.OnmsError('Search properties are not supported in Node ReSTv1.');\n }\n return this.pathToNodesEndpoint() + '/properties';\n }\n /**\n * Get the path to the nodes endpoint for the appropriate API version.\n * @hidden\n */\n\n }, {\n key: \"pathToNodesEndpoint\",\n value: function pathToNodesEndpoint() {\n return this.getApiVersion() === 2 ? 'api/v2/nodes' : 'rest/nodes';\n }\n }]);\n\n return NodeDAO;\n}(AbstractDAO_1.AbstractDAO);\n\nexports.NodeDAO = NodeDAO;",{"version":3,"file":"/data/src/dao/NodeDAO.ts","sourceRoot":"","sources":["/data/node_modules/tslint-loader/index.js??ref--4-0!/data/src/dao/NodeDAO.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4BAA0C;AAK1C,0BAA2C;AAE3C,qBAAsC;AAEtC,6BAAmD;AACnD,gCAAyD;AACzD,gCAAyD;AACzD,gCAAyD;AACzD,qCAAmE;AACnE,yBAA2C;AAC3C,oCAAiE;AACjE,6BAAmD;AACnD,gCAAyD;AACzD,gCAAyD;AACzD,sCAAqE;AACrE,kCAA6D;AAC7D,mCAAgF;AAChF,yBAA2C;AAE3C,oBAAuC;AACvC,mCAA4C;AAE5C,AAAc;AACd,IAAM,AAAG,MAAG,IAAI,qBAAQ,SAAC,AAAO,SAAE,MAAM,AAAC,AAAC;AAE1C,AAGG,AACH;;;;;IAAqB;;;AACnB,qBAAY,AAA0B;AACpC,AAAK;;iHAAC,AAAI,AAAC,AAAC,AACd;AAAC;AAED,AAKG,AACU,AAAG;;;;;;;;;;4BAAC,AAAU;gBAAE,AAAO,8EAAG,AAAK;;;AAC1C,AAAM;;;;;;sEAAM,AAAU,AAAE,aAAC,AAAI,KAAC,UAAC,AAAI,AAAE,AAAE;AACnC,AAAM,kDAAM,AAAI,KAAC,AAAG,IAAC,AAAI,OAAC,AAAmB,AAAE,wBAAG,AAAG,MAAG,AAAE,IAAE,AAA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AI,YAAS,UAAC,AAAqD,AAAC,AAAC,AAC7E;AAAC;AACD,AAAM,mBAAC,AAAI,KAAC,AAAmB,AAAE,wBAAG,AAAa,AAAC,AACpD;AAAC;AAED,AAGG,AACK,AAAmB;;;;;;;;AACzB,AAAM,mBAAC,AAAI,KAAC,AAAa,AAAE,oBAAK,AAAC,AAAC,AAAC,IAAC,AAAc,AAAC,AAAC,iBAAC,AAAY,AAAC,AACpE;AAAC,AACF;;;;EAvT4B,cAA6B;;AAA1D,kBAuTC","sourcesContent":["import {AbstractDAO} from './AbstractDAO';\n\nimport {Filter} from '../api/Filter';\nimport {IHasHTTP} from '../api/IHasHTTP';\nimport {IOnmsHTTP} from '../api/IOnmsHTTP';\nimport {OnmsError} from '../api/OnmsError';\n\nimport {Util} from '../internal/Util';\n\nimport {OnmsCategory} from '../model/OnmsCategory';\nimport {OnmsCollectType} from '../model/OnmsCollectType';\nimport {OnmsIpInterface} from '../model/OnmsIpInterface';\nimport {OnmsManagedType} from '../model/OnmsManagedType';\nimport {OnmsMonitoredService} from '../model/OnmsMonitoredService';\nimport {OnmsNode} from '../model/OnmsNode';\nimport {OnmsNodeLabelSource} from '../model/OnmsNodeLabelSource';\nimport {OnmsNodeType} from '../model/OnmsNodeType';\nimport {OnmsPrimaryType} from '../model/OnmsPrimaryType';\nimport {OnmsServiceType} from '../model/OnmsServiceType';\nimport {OnmsServiceStatusType} from '../model/OnmsServiceStatusType';\nimport {OnmsSnmpInterface} from '../model/OnmsSnmpInterface';\nimport {OnmsSnmpStatusType, SnmpStatusTypes} from '../model/OnmsSnmpStatusType';\nimport {PhysAddr} from '../model/PhysAddr';\n\nimport {log, catDao} from '../api/Log';\nimport {Category} from 'typescript-logging';\n\n/** @hidden */\nconst cat = new Category('nodes', catDao);\n\n/**\n * Data access for [[OnmsNode]] objects.\n * @module NodeDAO\n */\nexport class NodeDAO extends AbstractDAO<number, OnmsNode> {\n constructor(impl: IHasHTTP | IOnmsHTTP) {\n super(impl);\n }\n\n /**\n * Get an node, given the node's ID.\n *\n * @param id - The node's ID.\n * @param recurse - Optionally fetch all sub-model objects. (ipInterface, etc.)\n */\n public async get(id: number, recurse = false): Promise<OnmsNode> {\n return this.getOptions().then((opts) => {\n return this.http.get(this.pathToNodesEndpoint() + '/' + id, opts).then((result) => {\n const node = this.fromData(result.data);\n\n if (recurse) {\n return this.fetch(node);\n } else {\n return node;\n }\n });\n });\n }\n\n /** Search for nodes, given an optional filter. */\n public async find(filter?: Filter): Promise<OnmsNode[]> {\n return this.getOptions(filter).then((opts) => {\n return this.http.get(this.pathToNodesEndpoint(), opts).then((result) => {\n let data = result.data;\n\n if (data !== null && this.getCount(data) > 0 && data.node) {\n data = data.node;\n } else {\n data = [];\n }\n\n if (!Array.isArray(data)) {\n if (data.id) {\n data = [data];\n } else {\n throw new OnmsError('Expected an array of nodes but got \"' + (typeof data) + '\" instead.');\n }\n }\n return data.map((nodeData) => {\n return this.fromData(nodeData);\n });\n });\n });\n }\n\n /** Given a node, fetch all the sub-model objects for that node. (ipInterfaces, snmpInterfaces, etc.) */\n public async fetch(node: OnmsNode): Promise<OnmsNode> {\n return this.snmpInterfaces(node).then((si) => {\n node.snmpInterfaces = si;\n si.forEach((iface) => {\n iface.node = node;\n });\n return this.ipInterfaces(node).then((ifaces) => {\n node.ipInterfaces = ifaces;\n ifaces.forEach((iface) => {\n iface.node = node;\n });\n return Promise.all(ifaces.map((iface) => {\n return this.services(node, iface).then((services) => {\n iface.services = services;\n services.forEach((service) => {\n service.node = node;\n service.ipInterface = iface;\n });\n });\n })).then(() => {\n return node;\n });\n });\n });\n }\n\n /** Given a node, get the IP interfaces for that node. */\n public async ipInterfaces(node: number | OnmsNode, filter?: Filter): Promise<OnmsIpInterface[]> {\n if (node instanceof OnmsNode) {\n node = node.id;\n }\n return this.getOptions(filter).then((opts) => {\n return this.http.get(this.pathToNodesEndpoint() + '/' + node + '/ipinterfaces', opts).then((result) => {\n let data = result.data;\n\n if (this.getCount(data) > 0 && data.ipInterface) {\n data = data.ipInterface;\n } else {\n data = [];\n }\n\n if (!Array.isArray(data)) {\n if (data.nodeId) {\n data = [data];\n } else {\n throw new OnmsError('Expected an array of IP interfaces but got \"' + (typeof data) + '\" instead.');\n }\n }\n return data.map((ifaceData) => {\n return this.fromIpInterfaceData(ifaceData);\n });\n });\n });\n }\n\n /** Given a node, get the SNMP interfaces for that node. */\n public async snmpInterfaces(node: number | OnmsNode, filter?: Filter): Promise<OnmsSnmpInterface[]> {\n return this.getOptions(filter).then((opts) => {\n if (node instanceof OnmsNode) {\n node = node.id;\n }\n return this.http.get(this.pathToNodesEndpoint() + '/' + node + '/snmpinterfaces', opts).then((result) => {\n let data = result.data;\n\n if (this.getCount(data) > 0 && data.snmpInterface) {\n data = data.snmpInterface;\n } else {\n data = [];\n }\n\n if (!Array.isArray(data)) {\n if (data.ifName) {\n data = [data];\n } else {\n throw new OnmsError('Expected an array of SNMP interfaces but got \"'\n + (typeof data) + '\" instead.');\n }\n }\n return data.map((ifaceData) => {\n return this.fromSnmpData(ifaceData);\n });\n