@webex/webex-core 3.0.0-beta.2 → 3.0.0-beta.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config.js +1 -11
- package/dist/config.js.map +1 -1
- package/dist/credentials-config.js +44 -64
- package/dist/credentials-config.js.map +1 -1
- package/dist/index.js +0 -76
- package/dist/index.js.map +1 -1
- package/dist/interceptors/auth.js +22 -55
- package/dist/interceptors/auth.js.map +1 -1
- package/dist/interceptors/default-options.js +0 -20
- package/dist/interceptors/default-options.js.map +1 -1
- package/dist/interceptors/embargo.js +0 -21
- package/dist/interceptors/embargo.js.map +1 -1
- package/dist/interceptors/network-timing.js +2 -21
- package/dist/interceptors/network-timing.js.map +1 -1
- package/dist/interceptors/payload-transformer.js +2 -22
- package/dist/interceptors/payload-transformer.js.map +1 -1
- package/dist/interceptors/rate-limit.js +25 -57
- package/dist/interceptors/rate-limit.js.map +1 -1
- package/dist/interceptors/redirect.js +4 -33
- package/dist/interceptors/redirect.js.map +1 -1
- package/dist/interceptors/request-event.js +3 -30
- package/dist/interceptors/request-event.js.map +1 -1
- package/dist/interceptors/request-logger.js +1 -30
- package/dist/interceptors/request-logger.js.map +1 -1
- package/dist/interceptors/request-timing.js +3 -22
- package/dist/interceptors/request-timing.js.map +1 -1
- package/dist/interceptors/response-logger.js +2 -31
- package/dist/interceptors/response-logger.js.map +1 -1
- package/dist/interceptors/user-agent.js +2 -29
- package/dist/interceptors/user-agent.js.map +1 -1
- package/dist/interceptors/webex-tracking-id.js +5 -28
- package/dist/interceptors/webex-tracking-id.js.map +1 -1
- package/dist/interceptors/webex-user-agent.js +5 -38
- package/dist/interceptors/webex-user-agent.js.map +1 -1
- package/dist/lib/batcher.js +3 -51
- package/dist/lib/batcher.js.map +1 -1
- package/dist/lib/credentials/credentials.js +39 -119
- package/dist/lib/credentials/credentials.js.map +1 -1
- package/dist/lib/credentials/grant-errors.js +0 -49
- package/dist/lib/credentials/grant-errors.js.map +1 -1
- package/dist/lib/credentials/index.js +1 -13
- package/dist/lib/credentials/index.js.map +1 -1
- package/dist/lib/credentials/scope.js +1 -7
- package/dist/lib/credentials/scope.js.map +1 -1
- package/dist/lib/credentials/token-collection.js +1 -7
- package/dist/lib/credentials/token-collection.js.map +1 -1
- package/dist/lib/credentials/token.js +39 -118
- package/dist/lib/credentials/token.js.map +1 -1
- package/dist/lib/page.js +13 -26
- package/dist/lib/page.js.map +1 -1
- package/dist/lib/services/constants.js +0 -2
- package/dist/lib/services/constants.js.map +1 -1
- package/dist/lib/services/index.js +1 -28
- package/dist/lib/services/index.js.map +1 -1
- package/dist/lib/services/interceptors/server-error.js +2 -23
- package/dist/lib/services/interceptors/server-error.js.map +1 -1
- package/dist/lib/services/interceptors/service.js +12 -34
- package/dist/lib/services/interceptors/service.js.map +1 -1
- package/dist/lib/services/metrics.js +0 -2
- package/dist/lib/services/metrics.js.map +1 -1
- package/dist/lib/services/service-catalog.js +10 -90
- package/dist/lib/services/service-catalog.js.map +1 -1
- package/dist/lib/services/service-fed-ramp.js +0 -2
- package/dist/lib/services/service-fed-ramp.js.map +1 -1
- package/dist/lib/services/service-host.js +47 -62
- package/dist/lib/services/service-host.js.map +1 -1
- package/dist/lib/services/service-registry.js +78 -90
- package/dist/lib/services/service-registry.js.map +1 -1
- package/dist/lib/services/service-state.js +3 -15
- package/dist/lib/services/service-state.js.map +1 -1
- package/dist/lib/services/service-url.js +4 -25
- package/dist/lib/services/service-url.js.map +1 -1
- package/dist/lib/services/services.js +122 -238
- package/dist/lib/services/services.js.map +1 -1
- package/dist/lib/stateless-webex-plugin.js +5 -28
- package/dist/lib/stateless-webex-plugin.js.map +1 -1
- package/dist/lib/storage/decorators.js +19 -62
- package/dist/lib/storage/decorators.js.map +1 -1
- package/dist/lib/storage/errors.js +0 -23
- package/dist/lib/storage/errors.js.map +1 -1
- package/dist/lib/storage/index.js +2 -16
- package/dist/lib/storage/index.js.map +1 -1
- package/dist/lib/storage/make-webex-plugin-store.js +11 -41
- package/dist/lib/storage/make-webex-plugin-store.js.map +1 -1
- package/dist/lib/storage/make-webex-store.js +8 -30
- package/dist/lib/storage/make-webex-store.js.map +1 -1
- package/dist/lib/storage/memory-store-adapter.js +1 -19
- package/dist/lib/storage/memory-store-adapter.js.map +1 -1
- package/dist/lib/webex-core-plugin-mixin.js +9 -29
- package/dist/lib/webex-core-plugin-mixin.js.map +1 -1
- package/dist/lib/webex-http-error.js +1 -31
- package/dist/lib/webex-http-error.js.map +1 -1
- package/dist/lib/webex-internal-core-plugin-mixin.js +9 -29
- package/dist/lib/webex-internal-core-plugin-mixin.js.map +1 -1
- package/dist/lib/webex-plugin.js +6 -40
- package/dist/lib/webex-plugin.js.map +1 -1
- package/dist/plugins/logger.js +3 -17
- package/dist/plugins/logger.js.map +1 -1
- package/dist/webex-core.js +79 -203
- package/dist/webex-core.js.map +1 -1
- package/dist/webex-internal-core.js +0 -10
- package/dist/webex-internal-core.js.map +1 -1
- package/package.json +14 -14
- package/src/config.js +9 -11
- package/src/credentials-config.js +110 -72
- package/src/index.js +4 -14
- package/src/interceptors/auth.js +36 -37
- package/src/interceptors/default-options.js +0 -1
- package/src/interceptors/embargo.js +1 -1
- package/src/interceptors/payload-transformer.js +1 -2
- package/src/interceptors/rate-limit.js +8 -5
- package/src/interceptors/redirect.js +14 -8
- package/src/interceptors/request-event.js +4 -8
- package/src/interceptors/request-logger.js +8 -5
- package/src/interceptors/response-logger.js +11 -8
- package/src/interceptors/user-agent.js +1 -2
- package/src/interceptors/webex-user-agent.js +3 -9
- package/src/lib/batcher.js +70 -69
- package/src/lib/credentials/credentials.js +112 -122
- package/src/lib/credentials/grant-errors.js +6 -7
- package/src/lib/credentials/index.js +1 -4
- package/src/lib/credentials/scope.js +1 -4
- package/src/lib/credentials/token-collection.js +1 -1
- package/src/lib/credentials/token.js +86 -80
- package/src/lib/page.js +10 -11
- package/src/lib/services/constants.js +3 -13
- package/src/lib/services/index.js +2 -2
- package/src/lib/services/interceptors/server-error.js +12 -7
- package/src/lib/services/interceptors/service.js +6 -5
- package/src/lib/services/metrics.js +1 -1
- package/src/lib/services/service-catalog.js +110 -100
- package/src/lib/services/service-fed-ramp.js +1 -2
- package/src/lib/services/service-host.js +10 -17
- package/src/lib/services/service-registry.js +69 -96
- package/src/lib/services/service-state.js +4 -6
- package/src/lib/services/service-url.js +24 -23
- package/src/lib/services/services.js +260 -251
- package/src/lib/stateless-webex-plugin.js +4 -2
- package/src/lib/storage/decorators.js +68 -66
- package/src/lib/storage/index.js +4 -6
- package/src/lib/storage/make-webex-plugin-store.js +34 -21
- package/src/lib/storage/make-webex-store.js +6 -7
- package/src/lib/storage/memory-store-adapter.js +3 -3
- package/src/lib/webex-core-plugin-mixin.js +10 -7
- package/src/lib/webex-http-error.js +7 -8
- package/src/lib/webex-internal-core-plugin-mixin.js +9 -6
- package/src/lib/webex-plugin.js +41 -34
- package/src/plugins/logger.js +8 -3
- package/src/webex-core.js +185 -116
- package/src/webex-internal-core.js +15 -9
- package/test/integration/spec/credentials/credentials.js +26 -30
- package/test/integration/spec/credentials/token.js +36 -33
- package/test/integration/spec/services/service-catalog.js +177 -156
- package/test/integration/spec/services/services.js +313 -304
- package/test/integration/spec/webex-core.js +98 -86
- package/test/unit/spec/_setup.js +26 -18
- package/test/unit/spec/credentials/credentials.js +189 -154
- package/test/unit/spec/credentials/token.js +94 -76
- package/test/unit/spec/interceptors/auth.js +291 -243
- package/test/unit/spec/interceptors/default-options.js +36 -24
- package/test/unit/spec/interceptors/embargo.js +32 -27
- package/test/unit/spec/interceptors/network-timing.js +2 -2
- package/test/unit/spec/interceptors/payload-transformer.js +61 -52
- package/test/unit/spec/interceptors/rate-limit.js +104 -75
- package/test/unit/spec/interceptors/redirect.js +22 -20
- package/test/unit/spec/interceptors/request-timing.js +18 -22
- package/test/unit/spec/interceptors/user-agent.js +28 -16
- package/test/unit/spec/interceptors/webex-tracking-id.js +14 -8
- package/test/unit/spec/interceptors/webex-user-agent.js +83 -37
- package/test/unit/spec/lib/batcher.js +36 -32
- package/test/unit/spec/lib/page.js +36 -32
- package/test/unit/spec/lib/webex-plugin.js +1 -1
- package/test/unit/spec/services/interceptors/server-error.js +67 -90
- package/test/unit/spec/services/interceptors/service.js +17 -28
- package/test/unit/spec/services/service-catalog.js +19 -27
- package/test/unit/spec/services/service-host.js +29 -26
- package/test/unit/spec/services/service-registry.js +128 -170
- package/test/unit/spec/services/service-state.js +13 -22
- package/test/unit/spec/services/service-url.js +24 -43
- package/test/unit/spec/services/services.js +85 -41
- package/test/unit/spec/storage/persist.js +6 -9
- package/test/unit/spec/storage/wait-for-value.js +22 -21
- package/test/unit/spec/webex-core.js +78 -57
- package/test/unit/spec/webex-internal-core.js +56 -31
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["WebexPlugin","AmpState","extend","derived","boundedStorage","deps","fn","makeWebexPluginStore","unboundedStorage","config","cache","webex","namespace","getNamespace","toLowerCase","logger","console","parent","collection","Error","session","type","ready","default","clear","options","attributes","forEach","key","unset","_children","_collections","reset","initialize","args","prototype","_dataTypes","set","bind","on","model","trigger","inspect","depth","util","serialize","props","request","upload","when","eventName","rest","length","resolve","once","_filterSetParameters","value","attrs"],"sources":["webex-plugin.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport util from 'util';\n\nimport AmpState from 'ampersand-state';\nimport {
|
|
1
|
+
{"version":3,"names":["WebexPlugin","AmpState","extend","derived","boundedStorage","deps","fn","makeWebexPluginStore","unboundedStorage","config","cache","webex","namespace","getNamespace","toLowerCase","logger","console","parent","collection","Error","session","type","ready","default","clear","options","attributes","forEach","key","unset","_children","_collections","reset","initialize","args","prototype","_dataTypes","set","bind","on","model","trigger","inspect","depth","util","serialize","props","request","upload","when","eventName","rest","length","resolve","once","_filterSetParameters","value","attrs"],"sources":["webex-plugin.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport util from 'util';\n\nimport AmpState from 'ampersand-state';\nimport {cloneDeep, isObject, omit} from 'lodash';\n\nimport {makeWebexPluginStore} from './storage';\n\n/**\n * @class\n */\nconst WebexPlugin = AmpState.extend({\n derived: {\n boundedStorage: {\n deps: [],\n fn() {\n return makeWebexPluginStore('bounded', this);\n },\n },\n unboundedStorage: {\n deps: [],\n fn() {\n return makeWebexPluginStore('unbounded', this);\n },\n },\n config: {\n // figure out why caching config breaks the refresh integration test\n // but not the refresh automation test.\n cache: false,\n deps: ['webex', 'webex.config'],\n fn() {\n if (this.webex && this.webex.config) {\n const namespace = this.getNamespace();\n\n if (namespace) {\n return this.webex.config[namespace.toLowerCase()];\n }\n\n return this.webex.config;\n }\n\n return {};\n },\n },\n\n logger: {\n deps: ['webex', 'webex.logger'],\n fn() {\n return this.webex.logger || console;\n },\n },\n\n webex: {\n deps: ['parent'],\n fn() {\n if (!this.parent && !this.collection) {\n throw new Error(\n 'Cannot determine `this.webex` without `this.parent` or `this.collection`. Please initialize `this` via `children` or `collection` or set `this.parent` manually'\n );\n }\n\n /* eslint consistent-this: [0] */\n let parent = this;\n\n while (parent.parent || parent.collection) {\n parent = parent.parent || parent.collection;\n }\n\n return parent;\n },\n },\n },\n\n session: {\n parent: {\n type: 'any',\n },\n /**\n * Indicates this plugin is ready to be used. Defaults to true but can be\n * overridden by plugins as appropriate. Used by {@link WebexCore#read}\n * @instance\n * @memberof WebexPlugin\n * @type {boolean}\n */\n ready: {\n default: true,\n type: 'boolean',\n },\n },\n\n /**\n * Overrides AmpersandState#clear to make sure we never unset `parent` and\n * recursively visits children/collections.\n * @instance\n * @memberof WebexPlugin\n * @param {Object} options\n * @returns {WebexPlugin}\n */\n clear(options) {\n Object.keys(this.attributes).forEach((key) => {\n if (key !== 'parent') {\n this.unset(key, options);\n }\n });\n\n Object.keys(this._children).forEach((key) => {\n this[key].clear();\n });\n\n Object.keys(this._collections).forEach((key) => {\n this[key].reset();\n });\n\n return this;\n },\n\n /**\n * Initializer\n * @private\n * @param {Object} attrs\n * @param {Object} options\n * @returns {undefined}\n */\n initialize(...args) {\n Reflect.apply(AmpState.prototype.initialize, this, args);\n\n // HACK to deal with the fact that AmpersandState#dataTypes#set is a pure\n // function.\n this._dataTypes = cloneDeep(this._dataTypes);\n Object.keys(this._dataTypes).forEach((key) => {\n if (this._dataTypes[key].set) {\n this._dataTypes[key].set = this._dataTypes[key].set.bind(this);\n }\n });\n // END HACK\n\n // Propagate change:[attribute] events from children\n this.on('change', (model, options) => {\n if (this.parent) {\n this.parent.trigger(\n `change:${this.getNamespace().toLowerCase()}`,\n this.parent,\n this,\n options\n );\n }\n });\n },\n\n /**\n * @instance\n * @memberof WebexPlugin\n * @param {number} depth\n * @private\n * @returns {Object}\n */\n inspect(depth) {\n return util.inspect(\n omit(\n this.serialize({\n props: true,\n session: true,\n derived: true,\n }),\n 'boundedStorage',\n 'unboundedStorage',\n 'config',\n 'logger',\n 'webex',\n 'parent'\n ),\n {depth}\n );\n },\n\n request(...args) {\n return this.webex.request(...args);\n },\n\n upload(...args) {\n return this.webex.upload(...args);\n },\n\n when(eventName, ...rest) {\n if (rest && rest.length > 0) {\n throw new Error('#when() does not accept a callback, you must attach to its promise');\n }\n\n return new Promise((resolve) => {\n this.once(eventName, (...args) => resolve(args));\n });\n },\n\n /**\n * Helper function for dealing with both forms of {@link AmpersandState#set()}\n * @param {string} key\n * @param {mixed} value\n * @param {Object} options\n * @private\n * @returns {Array<Object, Object>}\n */\n _filterSetParameters(key, value, options) {\n let attrs;\n\n if (isObject(key) || key === null) {\n attrs = key;\n options = value;\n } else {\n attrs = {};\n attrs[key] = value;\n }\n\n options = options || {};\n\n return [attrs, options];\n },\n});\n\nexport default WebexPlugin;\n"],"mappings":";;;;;;;;;;;;;;AAIA;AAEA;AAGA;AATA;AACA;AACA;;AASA;AACA;AACA;AACA,IAAMA,WAAW,GAAGC,uBAAQ,CAACC,MAAM,CAAC;EAClCC,OAAO,EAAE;IACPC,cA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CAAIhB,IAAI;UAAJA,IAAI;QAAA;QAAA,OAAKmB,OAAO,CAACnB,IAAI,CAAC;MAAA,EAAC;IAClD,CAAC,CAAC;EACJ,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEqB,oBAAoB,gCAAC3B,GAAG,EAAE4B,KAAK,EAAE/B,OAAO,EAAE;IACxC,IAAIgC,KAAK;IAET,IAAI,wBAAS7B,GAAG,CAAC,IAAIA,GAAG,KAAK,IAAI,EAAE;MACjC6B,KAAK,GAAG7B,GAAG;MACXH,OAAO,GAAG+B,KAAK;IACjB,CAAC,MAAM;MACLC,KAAK,GAAG,CAAC,CAAC;MACVA,KAAK,CAAC7B,GAAG,CAAC,GAAG4B,KAAK;IACpB;IAEA/B,OAAO,GAAGA,OAAO,IAAI,CAAC,CAAC;IAEvB,OAAO,CAACgC,KAAK,EAAEhC,OAAO,CAAC;EACzB;AACF,CAAC,CAAC;AAAC,eAEYzB,WAAW;AAAA"}
|
package/dist/plugins/logger.js
CHANGED
|
@@ -1,22 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
4
|
-
|
|
5
4
|
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
5
|
_Object$defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
|
-
|
|
11
8
|
exports.default = void 0;
|
|
12
|
-
|
|
13
9
|
var _webexPlugin = _interopRequireDefault(require("../lib/webex-plugin"));
|
|
14
|
-
|
|
15
10
|
var _webexCore = require("../webex-core");
|
|
16
|
-
|
|
17
11
|
/*!
|
|
18
12
|
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
19
13
|
*/
|
|
14
|
+
|
|
20
15
|
var precedence = {
|
|
21
16
|
error: ['log'],
|
|
22
17
|
warn: ['error', 'log'],
|
|
@@ -24,6 +19,7 @@ var precedence = {
|
|
|
24
19
|
debug: ['info', 'log'],
|
|
25
20
|
trace: ['debug', 'info', 'log']
|
|
26
21
|
};
|
|
22
|
+
|
|
27
23
|
/**
|
|
28
24
|
* Assigns the specified console method to Logger; uses `precedence` to fallback
|
|
29
25
|
* to other console methods if the current environment doesn't provide the
|
|
@@ -31,37 +27,28 @@ var precedence = {
|
|
|
31
27
|
* @param {string} level
|
|
32
28
|
* @returns {Function}
|
|
33
29
|
*/
|
|
34
|
-
|
|
35
30
|
function wrapConsoleMethod(level) {
|
|
36
31
|
/* eslint no-console: [0] */
|
|
37
32
|
var impls = precedence[level];
|
|
38
|
-
|
|
39
33
|
if (impls) {
|
|
40
34
|
impls = impls.slice();
|
|
41
|
-
|
|
42
35
|
while (!console[level]) {
|
|
43
36
|
level = impls.pop();
|
|
44
37
|
}
|
|
45
38
|
}
|
|
46
|
-
|
|
47
39
|
return function wrappedConsoleMethod() {
|
|
48
40
|
var _console;
|
|
49
|
-
|
|
50
41
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
51
42
|
args[_key] = arguments[_key];
|
|
52
43
|
}
|
|
53
|
-
|
|
54
44
|
/* eslint no-invalid-this: [0] */
|
|
55
|
-
|
|
56
45
|
/* istanbul ignore if */
|
|
57
46
|
if (process.env.NODE_ENV === 'test' && this.webex && this.webex.internal.device && this.webex.internal.device.url) {
|
|
58
47
|
args.unshift(this.webex.internal.device.url.slice(-3));
|
|
59
48
|
}
|
|
60
|
-
|
|
61
49
|
(_console = console)[level].apply(_console, args);
|
|
62
50
|
};
|
|
63
51
|
}
|
|
64
|
-
|
|
65
52
|
var Logger = _webexPlugin.default.extend({
|
|
66
53
|
namespace: 'Logger',
|
|
67
54
|
error: wrapConsoleMethod('error'),
|
|
@@ -70,9 +57,8 @@ var Logger = _webexPlugin.default.extend({
|
|
|
70
57
|
info: wrapConsoleMethod('info'),
|
|
71
58
|
debug: wrapConsoleMethod('debug'),
|
|
72
59
|
trace: wrapConsoleMethod('trace'),
|
|
73
|
-
version: "3.0.0-beta.
|
|
60
|
+
version: "3.0.0-beta.21"
|
|
74
61
|
});
|
|
75
|
-
|
|
76
62
|
(0, _webexCore.registerPlugin)('logger', Logger);
|
|
77
63
|
var _default = Logger;
|
|
78
64
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["precedence","error","warn","info","debug","trace","wrapConsoleMethod","level","impls","slice","console","pop","wrappedConsoleMethod","args","process","env","NODE_ENV","webex","internal","device","url","unshift","Logger","WebexPlugin","extend","namespace","log","registerPlugin"],"sources":["logger.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\nimport WebexPlugin from '../lib/webex-plugin';\nimport {registerPlugin} from '../webex-core';\n\nconst precedence = {\n error: ['log'],\n warn: ['error', 'log'],\n info: ['log'],\n debug: ['info', 'log'],\n trace: ['debug', 'info', 'log']
|
|
1
|
+
{"version":3,"names":["precedence","error","warn","info","debug","trace","wrapConsoleMethod","level","impls","slice","console","pop","wrappedConsoleMethod","args","process","env","NODE_ENV","webex","internal","device","url","unshift","Logger","WebexPlugin","extend","namespace","log","registerPlugin"],"sources":["logger.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\nimport WebexPlugin from '../lib/webex-plugin';\nimport {registerPlugin} from '../webex-core';\n\nconst precedence = {\n error: ['log'],\n warn: ['error', 'log'],\n info: ['log'],\n debug: ['info', 'log'],\n trace: ['debug', 'info', 'log'],\n};\n\n/**\n * Assigns the specified console method to Logger; uses `precedence` to fallback\n * to other console methods if the current environment doesn't provide the\n * specified level.\n * @param {string} level\n * @returns {Function}\n */\nfunction wrapConsoleMethod(level) {\n /* eslint no-console: [0] */\n let impls = precedence[level];\n\n if (impls) {\n impls = impls.slice();\n while (!console[level]) {\n level = impls.pop();\n }\n }\n\n return function wrappedConsoleMethod(...args) {\n /* eslint no-invalid-this: [0] */\n /* istanbul ignore if */\n if (\n process.env.NODE_ENV === 'test' &&\n this.webex &&\n this.webex.internal.device &&\n this.webex.internal.device.url\n ) {\n args.unshift(this.webex.internal.device.url.slice(-3));\n }\n console[level](...args);\n };\n}\n\nconst Logger = WebexPlugin.extend({\n namespace: 'Logger',\n error: wrapConsoleMethod('error'),\n warn: wrapConsoleMethod('warn'),\n log: wrapConsoleMethod('log'),\n info: wrapConsoleMethod('info'),\n debug: wrapConsoleMethod('debug'),\n trace: wrapConsoleMethod('trace'),\n});\n\nregisterPlugin('logger', Logger);\n\nexport default Logger;\n"],"mappings":";;;;;;;;AAGA;AACA;AAJA;AACA;AACA;;AAIA,IAAMA,UAAU,GAAG;EACjBC,KAAK,EAAE,CAAC,KAAK,CAAC;EACdC,IAAI,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC;EACtBC,IAAI,EAAE,CAAC,KAAK,CAAC;EACbC,KAAK,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC;EACtBC,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK;AAChC,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,iBAAiB,CAACC,KAAK,EAAE;EAChC;EACA,IAAIC,KAAK,GAAGR,UAAU,CAACO,KAAK,CAAC;EAE7B,IAAIC,KAAK,EAAE;IACTA,KAAK,GAAGA,KAAK,CAACC,KAAK,EAAE;IACrB,OAAO,CAACC,OAAO,CAACH,KAAK,CAAC,EAAE;MACtBA,KAAK,GAAGC,KAAK,CAACG,GAAG,EAAE;IACrB;EACF;EAEA,OAAO,SAASC,oBAAoB,GAAU;IAAA;IAAA,kCAANC,IAAI;MAAJA,IAAI;IAAA;IAC1C;IACA;IACA,IACEC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,MAAM,IAC/B,IAAI,CAACC,KAAK,IACV,IAAI,CAACA,KAAK,CAACC,QAAQ,CAACC,MAAM,IAC1B,IAAI,CAACF,KAAK,CAACC,Q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