opennms
Version:
Client API for the OpenNMS network monitoring platform
1 lines • 17.1 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/BaseDAO.ts","dependencies":[{"path":"/data/src/dao/BaseDAO.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/IFilterProcessor.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/api/Filter.ts","mtime":1553611371624},{"path":"/data/src/api/OnmsHTTPOptions.ts","mtime":1553611371624},{"path":"/data/src/api/SearchProperty.ts","mtime":1553611371628},{"path":"/data/src/api/SearchPropertyType.ts","mtime":1553611371628},{"path":"/data/src/api/Log.ts","mtime":1553611371624},{"path":"/data/src/dao/V1FilterProcessor.ts","mtime":1553611371628},{"path":"/data/src/dao/V2FilterProcessor.ts","mtime":1553611371628},{"path":"/data/src/dao/PropertiesCache.ts","mtime":1553611371628},{"path":"/data/node_modules/moment/moment.d.ts","mtime":1553611386704},{"path":"/data/src/dao/IValueProvider.ts","mtime":1553611371628},{"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 _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 Log_1 = require(\"../api/Log\");\n/** @hidden */\n// tslint:disable-next-line\nvar moment = require('moment');\n/**\n * A base DAO useful for subclassing to create real DAOs. This differs from\n * the [[AbstractDAO]] in that it doesn't have a \"default\" interface for\n * dealing with model objects, it only provides core conveniences.\n *\n * @module BaseDAO\n */\n\nvar BaseDAO = function () {\n /**\n * Construct a DAO instance.\n *\n * @param impl - The HTTP implementation to use. It is also legal to pass any object\n * conforming to the [[IHasHTTP]] interface (like a [[Client]]).\n */\n function BaseDAO(impl) {\n _classCallCheck(this, BaseDAO);\n\n if (impl.http) {\n impl = impl.http;\n }\n this.httpImpl = impl;\n }\n /**\n * The HTTP implementation to use internally when making DAO requests.\n */\n\n\n _createClass(BaseDAO, [{\n key: \"useJson\",\n\n /**\n * Whether or not to use JSON when making ReST requests.\n */\n value: function useJson() {\n if (this.http === undefined || this.http.server === undefined || this.http.server.metadata === undefined) {\n throw new OnmsError_1.OnmsError('Server meta-data must be populated prior to making DAO calls.');\n }\n return this.http.server.metadata.useJson();\n }\n /**\n * A convenience method to make it easy for implementers to extract the count\n * (or totalCount) values from response data.\n */\n\n }, {\n key: \"getCount\",\n value: function getCount(data) {\n var count = 0;\n if (typeof data === 'number') {\n count = data;\n } else if (data.count !== undefined) {\n count = parseInt(data.count, 10);\n } else if (data.totalCount !== undefined) {\n count = parseInt(data.totalCount, 10);\n } else {\n Log_1.log.debug('data is missing count and totalCount properties', Log_1.catDao);\n }\n return count;\n }\n /**\n * Convert the given value to a date, or undefined if it cannot be converted.\n */\n\n }, {\n key: \"toDate\",\n value: function toDate(from) {\n if (from === undefined || from === null || from === '') {\n return undefined;\n }\n return moment(from);\n }\n /**\n * Convert the given value to a number, or undefined if it cannot be converted.\n */\n\n }, {\n key: \"toNumber\",\n value: function toNumber(from) {\n var ret = parseInt(from, 10);\n return isNaN(ret) ? undefined : ret;\n }\n }, {\n key: \"http\",\n get: function get() {\n return this.httpImpl;\n },\n set: function set(impl) {\n this.httpImpl = impl;\n }\n }]);\n\n return BaseDAO;\n}();\n\nexports.BaseDAO = BaseDAO;",{"version":3,"file":"/data/src/dao/BaseDAO.ts","sourceRoot":"","sources":["/data/node_modules/tslint-loader/index.js??ref--4-0!/data/src/dao/BaseDAO.ts"],"names":[],"mappings":";;;;;;;AAGA,0BAA2C;AAO3C,oBAAuC;AAOvC,AAAc;AACd,AAA2B;AAC3B,IAAM,AAAM,SAAG,AAAO,QAAC,AAAQ,AAAC,AAAC;AAOjC,AAMG,AACH;;;;;;;;;AAOE,AAKG;;;;;;AACH,qBAAY,AAA0B;;;AACpC,AAAE,AAAC,YAAE,AAAiB,KAAC,AAAI,AAAC,MAAC,AAAC;AAC5B,AAAI,mBAAI,AAAiB,KAAC,AAAI,AAAC,AACjC;AAAC;AACD,AAAI,aAAC,AAAQ,WAAG,AAAiB,AAAC,AACpC;AAAC;AAED,AAEG,AACH,AAAW,AAAI;;;;;;;;AAQf,AAEG,AACO,AAAO;;;;AACf,AAAE,AAAC,gBAAC,AAAI,KAAC,AAAI,SAAK,AAAS,aAAI,AAAI,KAAC,AAAI,KAAC,AAAM,WAAK,AAAS,aAAI,AAAI,KAAC,AAAI,KAAC,AAAM,OAAC,AAAQ,aAAK,AAAS,AAAC,WAAC,AAAC;AACzG,sBAAM,IAAI,YAAS,UAAC,AAA+D,AAAC,AAAC,AACvF;AAAC;AACD,AAAM,mBAAC,AAAI,KAAC,AAAI,KAAC,AAAM,OAAC,AAAQ,SAAC,AAAO,AAAE,AAAC,AAC7C;AAAC;AAED,AAGG,AACO,AAAQ;;;;;;;iCAAC,AAAS;AAC1B,gBAAI,AAAK,QAAG,AAAC,AAAC;AACd,AAAE,AAAC,gBAAC,AAAM,OAAC,AAAI,AAAC,SAAK,AAAQ,AAAC,UAAC,AAAC;AAC9B,AAAK,wBAAG,AAAI,AAAC,AACf;AAAC,AAAC,AAA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nimport {OnmsError} from '../api/OnmsError';\n\nimport {Filter} from '../api/Filter';\nimport {OnmsHTTPOptions} from '../api/OnmsHTTPOptions';\nimport {SearchProperty} from '../api/SearchProperty';\nimport {SearchPropertyType} from '../api/SearchPropertyType';\n\nimport {log, catDao} from '../api/Log';\n\nimport {V1FilterProcessor} from './V1FilterProcessor';\nimport {V2FilterProcessor} from './V2FilterProcessor';\n\nimport {PropertiesCache} from './PropertiesCache';\n\n/** @hidden */\n// tslint:disable-next-line\nconst moment = require('moment');\n\n/** @hidden */\n// tslint:disable-next-line\nimport {Moment} from 'moment';\nimport {IValueProvider} from './IValueProvider';\n\n/**\n * A base DAO useful for subclassing to create real DAOs. This differs from\n * the [[AbstractDAO]] in that it doesn't have a \"default\" interface for\n * dealing with model objects, it only provides core conveniences.\n *\n * @module BaseDAO\n */\nexport abstract class BaseDAO {\n /**\n * The [[IOnmsHTTP]] implementation to use internally when making DAO requests.\n * @hidden\n */\n private httpImpl: IOnmsHTTP;\n\n /**\n * Construct a DAO instance.\n *\n * @param impl - The HTTP implementation to use. It is also legal to pass any object\n * conforming to the [[IHasHTTP]] interface (like a [[Client]]).\n */\n constructor(impl: IOnmsHTTP | IHasHTTP) {\n if ((impl as IHasHTTP).http) {\n impl = (impl as IHasHTTP).http;\n }\n this.httpImpl = impl as IOnmsHTTP;\n }\n\n /**\n * The HTTP implementation to use internally when making DAO requests.\n */\n public get http() {\n return this.httpImpl;\n }\n\n public set http(impl: IOnmsHTTP) {\n this.httpImpl = impl;\n }\n\n /**\n * Whether or not to use JSON when making ReST requests.\n */\n protected useJson(): boolean {\n if (this.http === undefined || this.http.server === undefined || this.http.server.metadata === undefined) {\n throw new OnmsError('Server meta-data must be populated prior to making DAO calls.');\n }\n return this.http.server.metadata.useJson();\n }\n\n /**\n * A convenience method to make it easy for implementers to extract the count\n * (or totalCount) values from response data.\n */\n protected getCount(data: any): number {\n let count = 0;\n if (typeof(data) === 'number') {\n count = data;\n } else if (data.count !== undefined) {\n count = parseInt(data.count, 10);\n } else if (data.totalCount !== undefined) {\n count = parseInt(data.totalCount, 10);\n } else {\n log.debug('data is missing count and totalCount properties', catDao);\n }\n return count;\n }\n\n /**\n * Convert the given value to a date, or undefined if it cannot be converted.\n */\n protected toDate(from: any): Moment|undefined {\n if (from === undefined || from === null || from === '') {\n return undefined;\n }\n return moment(from);\n }\n\n /**\n * Convert the given value to a number, or undefined if it cannot be converted.\n */\n protected toNumber(from: any): number|undefined {\n const ret = parseInt(from, 10);\n return isNaN(ret) ? undefined : ret;\n }\n}\n"]}]}