UNPKG

opennms

Version:

Client API for the OpenNMS network monitoring platform

1 lines 14.9 kB
{"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/internal/Util.ts","dependencies":[{"path":"/data/src/internal/Util.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/OnmsError.ts","mtime":1553611371624},{"path":"/data/node_modules/ip-address/ip-address.js","mtime":1553611386552},{"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 _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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar OnmsError_1 = require(\"../api/OnmsError\");\nvar ip_address_1 = require(\"ip-address\");\n/** @hidden */\n// tslint:disable-next-line\nvar moment = require('moment');\n/** @hidden */\nvar dateFormat = 'YYYY-MM-DDTHH:mm:ss.SSSZZ';\n/**\n * A utility class for random stuff.\n * @module Util\n */\n\nvar Util = function () {\n function Util() {\n _classCallCheck(this, Util);\n }\n\n _createClass(Util, null, [{\n key: \"toIPAddress\",\n\n /**\n * Convert an IP address string to an [[Address4]] or [[Address6]] object.\n */\n value: function toIPAddress(addr) {\n if (addr) {\n if (addr.indexOf(':') >= 0) {\n return new ip_address_1.Address6(addr);\n } else {\n return new ip_address_1.Address4(addr);\n }\n }\n return undefined;\n }\n /**\n * Whether or not the passed object is already a date. (Either a [[Moment]] object, or\n * a JavaScript [[Date]] object.)\n */\n\n }, {\n key: \"isDateObject\",\n value: function isDateObject(date) {\n return moment.isMoment(date) || date instanceof Date;\n }\n /**\n * Create a [[Moment]] from any form of date (JavaScript [[Date]], [[Moment]], or epoch).\n * [[Moment]] dates in OpenNMS.js will always be converted internally to UTC to avoid time\n * zone issues.\n */\n\n }, {\n key: \"toMoment\",\n value: function toMoment(date) {\n if (date === undefined || date === null) {\n return undefined;\n } else if (moment.isMoment(date)) {\n return date.utc();\n } else if (typeof date === 'number' || date instanceof Date || typeof date === 'string' || date instanceof String) {\n return moment(date).utc();\n } else {\n throw new OnmsError_1.OnmsError('Unable to parse type \"' + (typeof date === \"undefined\" ? \"undefined\" : _typeof(date)) + '\" as a date.');\n }\n }\n /**\n * Create a date string from any form of date (JavaScript [[Date]], [[Moment]], or epoch).\n * Dates in OpenNMS.js will always be converted internally to UTC before stringifying to\n * avoid time zone issues.\n */\n\n }, {\n key: \"toDateString\",\n value: function toDateString(date) {\n var ret = Util.toMoment(date);\n if (ret) {\n return ret.utc().format(dateFormat);\n } else {\n return undefined;\n }\n }\n }]);\n\n return Util;\n}();\n\nexports.Util = Util;",{"version":3,"file":"/data/src/internal/Util.ts","sourceRoot":"","sources":["/data/node_modules/tslint-loader/index.js??ref--4-0!/data/src/internal/Util.ts"],"names":[],"mappings":";;;;;;;;;AAAA,0BAA2C;AAE3C,2BAA8C;AAG9C,AAAc;AACd,AAA2B;AAC3B,IAAM,AAAM,SAAG,AAAO,QAAC,AAAQ,AAAC,AAAC;AAEjC,AAAc;AACd,IAAM,AAAU,aAAG,AAA2B,AAA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sBAAM,IAAI,YAAS,UAAC,AAAwB,AAAG,AAAM,mCAAC,AAAI,AAAC,sDAAG,AAAc,AAAC,AAAC,AAChF;AAAC,AACH;AAAC;AAED,AAIG,AACI,AAAM,AAAC,AAAY;;;;;;;;qCAAC,AAAwB;AACjD,gBAAM,AAAG,MAAG,AAAI,KAAC,AAAQ,SAAC,AAAI,AAAC,AAAC;AAChC,AAAE,AAAC,gBAAC,AAAG,AAAC,KAAC,AAAC;AACR,AAAM,uBAAC,AAAG,IAAC,AAAG,AAAE,MAAC,AAAM,OAAC,AAAU,AAAC,AAAC,AACtC;AAAC,AAAC,AAAI,mBAAC,AAAC;AACN,AAAM,uBAAC,AAAS,AAAC,AACnB;AAAC,AACH;AAAC,AACF;;;;;;AAvDD,eAuDC","sourcesContent":["import {OnmsError} from '../api/OnmsError';\n\nimport {Address4, Address6} from 'ip-address';\nimport {Moment} from 'moment';\n\n/** @hidden */\n// tslint:disable-next-line\nconst moment = require('moment');\n\n/** @hidden */\nconst dateFormat = 'YYYY-MM-DDTHH:mm:ss.SSSZZ';\n\n/**\n * A utility class for random stuff.\n * @module Util\n */\nexport class Util {\n\n /**\n * Convert an IP address string to an [[Address4]] or [[Address6]] object.\n */\n public static toIPAddress(addr?: string) {\n if (addr) {\n if (addr.indexOf(':') >= 0) {\n return new Address6(addr);\n } else {\n return new Address4(addr);\n }\n }\n return undefined;\n }\n\n /**\n * Whether or not the passed object is already a date. (Either a [[Moment]] object, or\n * a JavaScript [[Date]] object.)\n */\n public static isDateObject(date: any) {\n return moment.isMoment(date) || date instanceof Date;\n }\n\n /**\n * Create a [[Moment]] from any form of date (JavaScript [[Date]], [[Moment]], or epoch).\n * [[Moment]] dates in OpenNMS.js will always be converted internally to UTC to avoid time\n * zone issues.\n */\n public static toMoment(date: Date|Moment|string|number): Moment {\n if (date === undefined || date === null) {\n return undefined;\n } else if (moment.isMoment(date)) {\n return (date as Moment).utc();\n } else if (typeof(date) === 'number' || date instanceof Date\n || typeof(date) === 'string' || date instanceof String) {\n return moment(date).utc();\n } else {\n throw new OnmsError('Unable to parse type \"' + typeof(date) + '\" as a date.');\n }\n }\n\n /**\n * Create a date string from any form of date (JavaScript [[Date]], [[Moment]], or epoch).\n * Dates in OpenNMS.js will always be converted internally to UTC before stringifying to\n * avoid time zone issues.\n */\n public static toDateString(date: Date|Moment|number) {\n const ret = Util.toMoment(date);\n if (ret) {\n return ret.utc().format(dateFormat);\n } else {\n return undefined;\n }\n }\n}\n"]}]}