UNPKG

opennms

Version:

Client API for the OpenNMS network monitoring platform

1 lines 14.6 kB
{"remainingRequest":"/data/node_modules/babel-loader/lib/index.js!/data/node_modules/ts-loader/index.js!/data/src/api/OnmsHTTPOptions.ts","dependencies":[{"path":"/data/src/api/OnmsHTTPOptions.ts","mtime":1553611371624},{"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/OnmsAuthConfig.ts","mtime":1553611371624},{"path":"/data/src/api/OnmsServer.ts","mtime":1553611371624},{"path":"/data/src/internal/IHash.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}],"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 DEFAULT_TIMEOUT = 10000;\nvar TIMEOUT_PROP = Symbol.for('timeout');\nvar AUTH_PROP = Symbol.for('auth');\n/**\n * Options to be used when making HTTP ReST calls.\n * @module OnmsHTTPOptions\n */\n\nvar OnmsHTTPOptions = function () {\n /**\n * Construct a new OnmsHTTPOptions object.\n * @constructor\n */\n function OnmsHTTPOptions(timeout, auth, server) {\n _classCallCheck(this, OnmsHTTPOptions);\n\n /** HTTP headers to be passed to the request. */\n this.headers = {};\n /** HTTP parameters to be passed on the URL. */\n this.parameters = {};\n if (timeout !== undefined) {\n this.timeout = timeout;\n }\n if (auth !== undefined) {\n this.auth = auth;\n }\n if (server !== undefined) {\n this.server = server;\n }\n }\n /** How long to wait for ReST calls to time out. */\n\n\n _createClass(OnmsHTTPOptions, [{\n key: \"withParameter\",\n\n /**\n * Add a URL parameter. Returns the OnmsHTTPOptions object so it can be chained.\n * @param key - the parameter's key\n * @param value - the parameter's value\n */\n value: function withParameter(key, value) {\n if (value !== undefined) {\n this.parameters[key] = '' + value;\n }\n return this;\n }\n }, {\n key: \"toJSON\",\n value: function toJSON() {\n var ret = Object.assign({}, this);\n if (this[TIMEOUT_PROP]) {\n ret.timeout = this.timeout;\n }\n if (this[AUTH_PROP]) {\n ret.auth = this.auth;\n }\n return ret;\n }\n }, {\n key: \"timeout\",\n get: function get() {\n if (this[TIMEOUT_PROP]) {\n return this[TIMEOUT_PROP];\n }\n return DEFAULT_TIMEOUT;\n },\n set: function set(t) {\n this[TIMEOUT_PROP] = t;\n }\n /** The authentication config that should be used when no auth is associated with the [[OnmsServer]]. */\n\n }, {\n key: \"auth\",\n get: function get() {\n if (this[AUTH_PROP]) {\n return this[AUTH_PROP];\n }\n return {};\n },\n set: function set(a) {\n this[AUTH_PROP] = a;\n }\n }]);\n\n return OnmsHTTPOptions;\n}();\n\nexports.OnmsHTTPOptions = OnmsHTTPOptions;",{"version":3,"file":"/data/src/api/OnmsHTTPOptions.ts","sourceRoot":"","sources":["/data/src/api/OnmsHTTPOptions.ts"],"names":[],"mappings":";;;;;;;AAIA,IAAM,AAAe,kBAAG,AAAK,AAAC;AAE9B,IAAM,AAAY,eAAG,AAAM,OAAC,AAAG,IAAC,AAAS,AAAC,AAAC;AAC3C,IAAM,AAAS,YAAG,AAAM,OAAC,AAAG,IAAC,AAAM,AAAC,AAAC;AAErC,AAGG,AACH;;;;;;AAyCE,AAGG;;;;AACH,6BAAY,AAAgB,SAAE,AAAqB,MAAE,AAAmB;;;AAjBxE,AAAgD;AACzC,aAAO,UAAG,AAAmB,AAAC;AAErC,AAA+C;AACxC,aAAU,aAAG,AAAmB,AAAC;AActC,AAAE,AAAC,YAAC,AAAO,YAAK,AAAS,AAAC,WAAC,AAAC;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G,AAAC,AAAC,AACzB;AAAC;AAED,AAAwG,AACxG,AAAW,AAAI;;;;;AACb,AAAE,AAAC,gBAAC,AAAI,KAAC,AAAS,AAAC,AAAC,YAAC,AAAC;AACpB,AAAM,uBAAC,AAAI,KAAC,AAAS,AAAC,AAAC,AACzB;AAAC;AACD,AAAM,mBAAC,AAAoB,AAAC,AAC9B;AAAC,AAED,AAAW,AAAI;0BAAC,AAAiB;AAC/B,AAAI,iBAAC,AAAS,AAAC,aAAG,AAAC,AAAC,AACtB;AAAC;;;;;;AAvBH,0BA+EC","sourcesContent":["import {OnmsAuthConfig} from './OnmsAuthConfig';\nimport {OnmsServer} from './OnmsServer';\nimport {IHash} from '../internal/IHash';\n\nconst DEFAULT_TIMEOUT = 10000;\n\nconst TIMEOUT_PROP = Symbol.for('timeout');\nconst AUTH_PROP = Symbol.for('auth');\n\n/**\n * Options to be used when making HTTP ReST calls.\n * @module OnmsHTTPOptions\n */\nexport class OnmsHTTPOptions {\n /** How long to wait for ReST calls to time out. */\n public get timeout(): number {\n if (this[TIMEOUT_PROP]) {\n return this[TIMEOUT_PROP];\n }\n return DEFAULT_TIMEOUT;\n }\n\n public set timeout(t: number) {\n this[TIMEOUT_PROP] = t;\n }\n\n /** The authentication config that should be used when no auth is associated with the [[OnmsServer]]. */\n public get auth(): OnmsAuthConfig {\n if (this[AUTH_PROP]) {\n return this[AUTH_PROP];\n }\n return {} as OnmsAuthConfig;\n }\n\n public set auth(a: OnmsAuthConfig) {\n this[AUTH_PROP] = a;\n }\n\n /** The server to use if no server is set on the HTTP implementation. */\n public server: OnmsServer;\n\n /** HTTP headers to be passed to the request. */\n public headers = {} as IHash<string>;\n\n /** HTTP parameters to be passed on the URL. */\n public parameters = {} as IHash<string>;\n\n /** HTTP data to be passed when POSTing */\n public data: any;\n\n private [TIMEOUT_PROP]: number;\n\n private [AUTH_PROP]: OnmsAuthConfig;\n\n /**\n * Construct a new OnmsHTTPOptions object.\n * @constructor\n */\n constructor(timeout?: number, auth?: OnmsAuthConfig, server?: OnmsServer) {\n if (timeout !== undefined) {\n this.timeout = timeout;\n }\n if (auth !== undefined) {\n this.auth = auth;\n }\n if (server !== undefined) {\n this.server = server;\n }\n }\n\n /**\n * Add a URL parameter. Returns the OnmsHTTPOptions object so it can be chained.\n * @param key - the parameter's key\n * @param value - the parameter's value\n */\n public withParameter(key: string, value?: any): OnmsHTTPOptions {\n if (value !== undefined) {\n this.parameters[key] = '' + value;\n }\n return this;\n }\n\n public toJSON(): object {\n const ret = Object.assign({}, this);\n if (this[TIMEOUT_PROP]) {\n ret.timeout = this.timeout;\n }\n if (this[AUTH_PROP]) {\n ret.auth = this.auth;\n }\n return ret;\n }\n}\n"]}]}