@webex/webex-core 3.10.0 → 3.11.0
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 +14 -0
- package/dist/config.js.map +1 -1
- package/dist/credentials-config.js.map +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/interceptors/auth.js +6 -8
- package/dist/interceptors/auth.js.map +1 -1
- package/dist/interceptors/default-options.js +6 -8
- package/dist/interceptors/default-options.js.map +1 -1
- package/dist/interceptors/embargo.js +6 -8
- package/dist/interceptors/embargo.js.map +1 -1
- package/dist/interceptors/network-timing.js +6 -8
- package/dist/interceptors/network-timing.js.map +1 -1
- package/dist/interceptors/payload-transformer.js +6 -8
- package/dist/interceptors/payload-transformer.js.map +1 -1
- package/dist/interceptors/proxy.js +7 -10
- package/dist/interceptors/proxy.js.map +1 -1
- package/dist/interceptors/rate-limit.js +7 -10
- package/dist/interceptors/rate-limit.js.map +1 -1
- package/dist/interceptors/redirect.js +9 -8
- package/dist/interceptors/redirect.js.map +1 -1
- package/dist/interceptors/request-event.js +6 -8
- package/dist/interceptors/request-event.js.map +1 -1
- package/dist/interceptors/request-logger.js +6 -8
- package/dist/interceptors/request-logger.js.map +1 -1
- package/dist/interceptors/request-timing.js +6 -8
- package/dist/interceptors/request-timing.js.map +1 -1
- package/dist/interceptors/response-logger.js +6 -8
- package/dist/interceptors/response-logger.js.map +1 -1
- package/dist/interceptors/user-agent.js +8 -11
- package/dist/interceptors/user-agent.js.map +1 -1
- package/dist/interceptors/webex-tracking-id.js +6 -8
- package/dist/interceptors/webex-tracking-id.js.map +1 -1
- package/dist/interceptors/webex-user-agent.js +7 -10
- package/dist/interceptors/webex-user-agent.js.map +1 -1
- package/dist/lib/batcher.js +1 -1
- package/dist/lib/batcher.js.map +1 -1
- package/dist/lib/constants.js.map +1 -1
- package/dist/lib/credentials/credentials.js +4 -6
- package/dist/lib/credentials/credentials.js.map +1 -1
- package/dist/lib/credentials/grant-errors.js +18 -26
- package/dist/lib/credentials/grant-errors.js.map +1 -1
- package/dist/lib/credentials/index.js.map +1 -1
- package/dist/lib/credentials/scope.js.map +1 -1
- package/dist/lib/credentials/token-collection.js.map +1 -1
- package/dist/lib/credentials/token.js +5 -5
- package/dist/lib/credentials/token.js.map +1 -1
- package/dist/lib/interceptors/hostmap.js +6 -8
- package/dist/lib/interceptors/hostmap.js.map +1 -1
- package/dist/lib/interceptors/server-error.js +6 -8
- package/dist/lib/interceptors/server-error.js.map +1 -1
- package/dist/lib/interceptors/service.js +6 -8
- package/dist/lib/interceptors/service.js.map +1 -1
- package/dist/lib/metrics.js.map +1 -1
- package/dist/lib/page.js +5 -6
- package/dist/lib/page.js.map +1 -1
- package/dist/lib/services/index.js.map +1 -1
- package/dist/lib/services/service-catalog.js +3 -3
- package/dist/lib/services/service-catalog.js.map +1 -1
- package/dist/lib/services/service-fed-ramp.js.map +1 -1
- package/dist/lib/services/service-host.js +1 -2
- package/dist/lib/services/service-host.js.map +1 -1
- package/dist/lib/services/service-registry.js +1 -2
- package/dist/lib/services/service-registry.js.map +1 -1
- package/dist/lib/services/service-state.js +1 -2
- package/dist/lib/services/service-state.js.map +1 -1
- package/dist/lib/services/service-url.js +11 -1
- package/dist/lib/services/service-url.js.map +1 -1
- package/dist/lib/services/services.js +485 -127
- package/dist/lib/services/services.js.map +1 -1
- package/dist/lib/services-v2/index.js.map +1 -1
- package/dist/lib/services-v2/metrics.js.map +1 -1
- package/dist/lib/services-v2/service-catalog.js +7 -7
- package/dist/lib/services-v2/service-catalog.js.map +1 -1
- package/dist/lib/services-v2/service-detail.js.map +1 -1
- package/dist/lib/services-v2/service-fed-ramp.js.map +1 -1
- package/dist/lib/services-v2/services-v2.js +379 -51
- package/dist/lib/services-v2/services-v2.js.map +1 -1
- package/dist/lib/services-v2/types.js.map +1 -1
- package/dist/lib/stateless-webex-plugin.js +3 -4
- package/dist/lib/stateless-webex-plugin.js.map +1 -1
- package/dist/lib/storage/decorators.js.map +1 -1
- package/dist/lib/storage/errors.js +7 -9
- package/dist/lib/storage/errors.js.map +1 -1
- package/dist/lib/storage/index.js.map +1 -1
- package/dist/lib/storage/make-webex-plugin-store.js +14 -5
- package/dist/lib/storage/make-webex-plugin-store.js.map +1 -1
- package/dist/lib/storage/make-webex-store.js +13 -5
- package/dist/lib/storage/make-webex-store.js.map +1 -1
- package/dist/lib/storage/memory-store-adapter.js.map +1 -1
- package/dist/lib/webex-core-plugin-mixin.js.map +1 -1
- package/dist/lib/webex-http-error.js +8 -11
- package/dist/lib/webex-http-error.js.map +1 -1
- package/dist/lib/webex-internal-core-plugin-mixin.js.map +1 -1
- package/dist/lib/webex-plugin.js.map +1 -1
- package/dist/plugins/logger.js +1 -1
- package/dist/plugins/logger.js.map +1 -1
- package/dist/webex-core.js +11 -11
- package/dist/webex-core.js.map +1 -1
- package/dist/webex-internal-core.js.map +1 -1
- package/package.json +13 -13
- package/src/config.js +15 -0
- package/src/interceptors/redirect.js +4 -0
- package/src/lib/services/service-url.js +9 -1
- package/src/lib/services/services.js +315 -7
- package/src/lib/services-v2/index.ts +0 -1
- package/src/lib/services-v2/service-catalog.ts +4 -4
- package/src/lib/services-v2/services-v2.ts +307 -7
- package/src/lib/services-v2/types.ts +13 -0
- package/test/fixtures/host-catalog-v2.ts +1 -1
- package/test/integration/spec/services/service-catalog.js +10 -4
- package/test/integration/spec/services/services.js +65 -9
- package/test/integration/spec/services-v2/service-catalog.js +2 -2
- package/test/integration/spec/services-v2/services-v2.js +56 -6
- package/test/unit/spec/interceptors/redirect.js +98 -0
- package/test/unit/spec/services/service-url.js +110 -0
- package/test/unit/spec/services/services.js +411 -2
- package/test/unit/spec/services-v2/services-v2.ts +316 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_decorators","require","_makeWebexStore","_interopRequireDefault","_makeWebexPluginStore","_memoryStoreAdapter","_errors"],"sources":["index.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nexport {persist, waitForValue} from './decorators';\nexport {default as makeWebexStore} from './make-webex-store';\nexport {default as makeWebexPluginStore} from './make-webex-plugin-store';\n\nexport {default as MemoryStoreAdapter} from './memory-store-adapter';\nexport {StorageError, NotFoundError} from './errors';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,qBAAA,GAAAD,sBAAA,CAAAF,OAAA;AAEA,IAAAI,mBAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA"}
|
|
1
|
+
{"version":3,"names":["_decorators","require","_makeWebexStore","_interopRequireDefault","_makeWebexPluginStore","_memoryStoreAdapter","_errors"],"sources":["index.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nexport {persist, waitForValue} from './decorators';\nexport {default as makeWebexStore} from './make-webex-store';\nexport {default as makeWebexPluginStore} from './make-webex-plugin-store';\n\nexport {default as MemoryStoreAdapter} from './memory-store-adapter';\nexport {StorageError, NotFoundError} from './errors';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,qBAAA,GAAAD,sBAAA,CAAAF,OAAA;AAEA,IAAAI,mBAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA","ignoreList":[]}
|
|
@@ -73,7 +73,7 @@ function makeWebexPluginStorage(type, context) {
|
|
|
73
73
|
keyFactory: function keyFactory(key) {
|
|
74
74
|
return "initValue-".concat(key);
|
|
75
75
|
}
|
|
76
|
-
}),
|
|
76
|
+
}), _class = /*#__PURE__*/function () {
|
|
77
77
|
/**
|
|
78
78
|
* @param {Object} attrs
|
|
79
79
|
* @param {Object} options
|
|
@@ -88,7 +88,7 @@ function makeWebexPluginStorage(type, context) {
|
|
|
88
88
|
* Clears an entire namespace
|
|
89
89
|
* @returns {Promise}
|
|
90
90
|
*/
|
|
91
|
-
(0, _createClass2.default)(WebexPluginStorage, [{
|
|
91
|
+
return (0, _createClass2.default)(WebexPluginStorage, [{
|
|
92
92
|
key: "clear",
|
|
93
93
|
value: function clear() {
|
|
94
94
|
return context.webex["".concat(type, "Storage")].del(context.getNamespace());
|
|
@@ -163,7 +163,17 @@ function makeWebexPluginStorage(type, context) {
|
|
|
163
163
|
}
|
|
164
164
|
}, {
|
|
165
165
|
key: "initValue",
|
|
166
|
-
value: function
|
|
166
|
+
value: function
|
|
167
|
+
/**
|
|
168
|
+
* Attempts to load the specified key from the store and set it on the parent
|
|
169
|
+
* object.
|
|
170
|
+
* @param {string} key
|
|
171
|
+
* @returns {Promise} Resolves (but not with the retrieved value) when
|
|
172
|
+
* the value retrieval complete
|
|
173
|
+
*/
|
|
174
|
+
// suppress doc warning because decorators confuse eslint
|
|
175
|
+
// eslint-disable-next-line require-jsdoc
|
|
176
|
+
initValue(key) {
|
|
167
177
|
var defer = new _common.Defer();
|
|
168
178
|
defers.get(this).set(key, defer);
|
|
169
179
|
|
|
@@ -195,8 +205,7 @@ function makeWebexPluginStorage(type, context) {
|
|
|
195
205
|
return defer.promise;
|
|
196
206
|
}
|
|
197
207
|
}]);
|
|
198
|
-
|
|
199
|
-
}(), ((0, _applyDecoratedDescriptor2.default)(_class.prototype, "initValue", [_dec], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "initValue"), _class.prototype)), _class));
|
|
208
|
+
}(), (0, _applyDecoratedDescriptor2.default)(_class.prototype, "initValue", [_dec], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "initValue"), _class.prototype), _class);
|
|
200
209
|
return new WebexPluginStorage();
|
|
201
210
|
}
|
|
202
211
|
//# sourceMappingURL=make-webex-plugin-store.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_common","require","_lodash","_errors","defers","_weakMap","default","serialize","value","isObject","serialized","_keys","forEach","key","val","isArray","length","undefined","map","k","empty","reduce","acc","makeWebexPluginStorage","type","context","_dec","_class","WebexPluginStorage","oneFlight","keyFactory","concat","_classCallCheck2","set","_map","_createClass2","clear","webex","del","getNamespace","_context$webex","_len","arguments","args","Array","_key","apply","get","defer","Defer","then","res","resolve","put","waitFor","logger","debug","promise","initValue","parent","result","catch","reason","NotFoundError","process","env","NODE_ENV","toString","includes","warn","reject","_applyDecoratedDescriptor2","prototype","_getOwnPropertyDescriptor"],"sources":["make-webex-plugin-store.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {Defer, oneFlight} from '@webex/common';\nimport {isArray, isObject, result} from 'lodash';\n\nimport {NotFoundError} from './errors';\n\nconst defers = new WeakMap();\n\n/**\n * Walks an object before writing it to the store and omits empty arrays\n * @private\n * @param {Object} value\n * @returns {Object}\n */\nfunction serialize(value) {\n if (!isObject(value)) {\n return value;\n }\n\n const serialized = value.serialize ? value.serialize() : value;\n\n Object.keys(serialized).forEach((key) => {\n const val = serialized[key];\n\n if (isArray(val)) {\n if (val.length === 0) {\n serialized[key] = undefined;\n } else {\n serialized[key] = val.map(serialize);\n }\n } else if (isObject(val)) {\n Object.keys(val).forEach((k) => {\n val[k] = serialize(val[k]);\n });\n }\n });\n\n const empty = Object.keys(serialized).reduce((acc, key) => acc && !serialized[key], true);\n\n if (empty) {\n return undefined;\n }\n\n return serialized;\n}\n\n/**\n * [makeWebexPluginStorage description]\n * @param {[type]} type\n * @param {[type]} context\n * @private\n * @returns {[type]}\n */\nexport default function makeWebexPluginStorage(type, context) {\n /**\n * Interface between WebexPlugin and Webex#boundeStorage or\n * Webex#unboundedStorage\n */\n class WebexPluginStorage {\n /**\n * @param {Object} attrs\n * @param {Object} options\n * @returns {WebexPluginStorage}\n */\n constructor() {\n defers.set(this, new Map());\n }\n\n /**\n * Clears an entire namespace\n * @returns {Promise}\n */\n clear() {\n return context.webex[`${type}Storage`].del(context.getNamespace());\n }\n\n /**\n * Deletes the specified key from the store\n * @param {string} key\n * @returns {[type]}\n */\n del(...args) {\n return context.webex[`${type}Storage`].del(context.getNamespace(), ...args);\n }\n\n /**\n * Retrieves the value specified by key from the store. Rejects with\n * NotFoundError if no value can be found\n * @param {string} key\n * @returns {Promise}\n */\n get(key) {\n let defer = defers.get(this).get(key);\n\n if (!defer) {\n defer = new Defer();\n defers.get(this).set(key, defer);\n }\n\n return context.webex[`${type}Storage`].get(context.getNamespace(), key).then((res) => {\n defer.resolve();\n\n return res;\n });\n }\n\n /**\n * Writes a value to the store\n * @param {string} key\n * @param {any} value\n * @returns {Promise}\n */\n put(key, value) {\n return context.webex[`${type}Storage`].put(context.getNamespace(), key, serialize(value));\n }\n\n /**\n * Returns a Promise that won't resolve until the value specified by key has\n * been attempted to be loaded from the store. This allows us to lazily\n * prevent certain method from executing until the specified keys have been\n * retrieved from the store.\n * @param {string} key\n * @returns {Promise}\n */\n waitFor(key) {\n context.logger.debug(\n `plugin-storage(${context.getNamespace()}): waiting to init key \\`${key}\\``\n );\n const defer = defers.get(this).get(key);\n\n if (defer) {\n context.logger.debug(\n `plugin-storage(${context.getNamespace()}): already inited \\`${key}\\``\n );\n\n return defer.promise;\n }\n\n context.logger.debug(`plugin-storage(${context.getNamespace()}): initing \\`${key}\\``);\n\n return this.initValue(key);\n }\n\n @oneFlight({keyFactory: (key) => `initValue-${key}`})\n /**\n * Attempts to load the specified key from the store and set it on the parent\n * object.\n * @param {string} key\n * @returns {Promise} Resolves (but not with the retrieved value) when\n * the value retrieval complete\n */\n // suppress doc warning because decorators confuse eslint\n // eslint-disable-next-line require-jsdoc\n initValue(key) {\n const defer = new Defer();\n\n defers.get(this).set(key, defer);\n\n // Intentionally bypasses this.get so we don't resolve the promise until\n // after the parent value is set.\n context.webex[`${type}Storage`]\n .get(context.getNamespace(), key)\n .then((value) => {\n context.logger.debug(\n `plugin-storage(${context.getNamespace()}): got \\`${key}\\` for first time`\n );\n if (key === '@') {\n context.parent.set(value);\n } else if (result(context[key], 'isState')) {\n context[key].set(value);\n } else {\n context.set(key, value);\n }\n context.logger.debug(\n `plugin-storage(${context.getNamespace()}): set \\`${key}\\` for first time`\n );\n defer.resolve();\n context.logger.debug(`plugin-storage(${context.getNamespace()}): inited \\`${key}\\``);\n })\n .catch((reason) => {\n // The next conditional is a bit of an unfortunate solution to deal\n // with circular dependencies in unit tests. It should not effect\n // integration tests or production code.\n if (\n reason instanceof NotFoundError ||\n (process.env.NODE_ENV !== 'production' &&\n reason.toString().includes('MockNotFoundError'))\n ) {\n context.logger.debug(\n `plugin-storage(${context.getNamespace()}): no data for \\`${key}\\`, continuing`\n );\n\n return defer.resolve();\n }\n context.logger.warn(\n `plugin-storage(${context.getNamespace()}): failed to init \\`${key}\\``,\n reason\n );\n\n return defer.reject(reason);\n });\n\n return defer.promise;\n }\n }\n\n return new WebexPluginStorage();\n}\n"],"mappings":";;;;;;;;;;;;;;;AAIA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AAPA;AACA;AACA;;AAOA,IAAMG,MAAM,GAAG,IAAAC,QAAA,CAAAC,OAAA,CAAY,CAAC;;AAE5B;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,SAASA,CAACC,KAAK,EAAE;EACxB,IAAI,CAAC,IAAAC,gBAAQ,EAACD,KAAK,CAAC,EAAE;IACpB,OAAOA,KAAK;EACd;EAEA,IAAME,UAAU,GAAGF,KAAK,CAACD,SAAS,GAAGC,KAAK,CAACD,SAAS,CAAC,CAAC,GAAGC,KAAK;EAE9D,IAAAG,KAAA,CAAAL,OAAA,EAAYI,UAAU,CAAC,CAACE,OAAO,CAAC,UAACC,GAAG,EAAK;IACv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AAC;QACtF,CAAC,CAAC,CACDgD,KAAK,CAAC,UAACC,MAAM,EAAK;UACjB;UACA;UACA;UACA,IACEA,MAAM,YAAYC,qBAAa,IAC9BC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,IACpCJ,MAAM,CAACK,QAAQ,CAAC,CAAC,CAACC,QAAQ,CAAC,mBAAmB,CAAE,EAClD;YACA3C,OAAO,CAAC8B,MAAM,CAACC,KAAK,mBAAAzB,MAAA,CACAN,OAAO,CAACc,YAAY,CAAC,CAAC,sBAAAR,MAAA,CAAoBlB,GAAG,kBACjE,CAAC;YAED,OAAOmC,KAAK,CAACI,OAAO,CAAC,CAAC;UACxB;UACA3B,OAAO,CAAC8B,MAAM,CAACc,IAAI,mBAAAtC,MAAA,CACCN,OAAO,CAACc,YAAY,CAAC,CAAC,yBAAAR,MAAA,CAAuBlB,GAAG,QAClEiD,MACF,CAAC;UAED,OAAOd,KAAK,CAACsB,MAAM,CAACR,MAAM,CAAC;QAC7B,CAAC,CAAC;QAEJ,OAAOd,KAAK,CAACS,OAAO;MACtB;IAAC;IAAA,OAAA7B,kBAAA;EAAA,UAAA2C,0BAAA,CAAAjE,OAAA,EAAAqB,MAAA,CAAA6C,SAAA,gBAAA9C,IAAA,OAAA+C,yBAAA,CAAAnE,OAAA,EAAAqB,MAAA,CAAA6C,SAAA,gBAAA7C,MAAA,CAAA6C,SAAA,IAAA7C,MAAA;EAGH,OAAO,IAAIC,kBAAkB,CAAC,CAAC;AACjC"}
|
|
1
|
+
{"version":3,"names":["_common","require","_lodash","_errors","defers","_weakMap","default","serialize","value","isObject","serialized","_keys","forEach","key","val","isArray","length","undefined","map","k","empty","reduce","acc","makeWebexPluginStorage","type","context","_dec","_class","WebexPluginStorage","oneFlight","keyFactory","concat","_classCallCheck2","set","_map","_createClass2","clear","webex","del","getNamespace","_context$webex","_len","arguments","args","Array","_key","apply","get","defer","Defer","then","res","resolve","put","waitFor","logger","debug","promise","initValue","parent","result","catch","reason","NotFoundError","process","env","NODE_ENV","toString","includes","warn","reject","_applyDecoratedDescriptor2","prototype","_getOwnPropertyDescriptor"],"sources":["make-webex-plugin-store.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {Defer, oneFlight} from '@webex/common';\nimport {isArray, isObject, result} from 'lodash';\n\nimport {NotFoundError} from './errors';\n\nconst defers = new WeakMap();\n\n/**\n * Walks an object before writing it to the store and omits empty arrays\n * @private\n * @param {Object} value\n * @returns {Object}\n */\nfunction serialize(value) {\n if (!isObject(value)) {\n return value;\n }\n\n const serialized = value.serialize ? value.serialize() : value;\n\n Object.keys(serialized).forEach((key) => {\n const val = serialized[key];\n\n if (isArray(val)) {\n if (val.length === 0) {\n serialized[key] = undefined;\n } else {\n serialized[key] = val.map(serialize);\n }\n } else if (isObject(val)) {\n Object.keys(val).forEach((k) => {\n val[k] = serialize(val[k]);\n });\n }\n });\n\n const empty = Object.keys(serialized).reduce((acc, key) => acc && !serialized[key], true);\n\n if (empty) {\n return undefined;\n }\n\n return serialized;\n}\n\n/**\n * [makeWebexPluginStorage description]\n * @param {[type]} type\n * @param {[type]} context\n * @private\n * @returns {[type]}\n */\nexport default function makeWebexPluginStorage(type, context) {\n /**\n * Interface between WebexPlugin and Webex#boundeStorage or\n * Webex#unboundedStorage\n */\n class WebexPluginStorage {\n /**\n * @param {Object} attrs\n * @param {Object} options\n * @returns {WebexPluginStorage}\n */\n constructor() {\n defers.set(this, new Map());\n }\n\n /**\n * Clears an entire namespace\n * @returns {Promise}\n */\n clear() {\n return context.webex[`${type}Storage`].del(context.getNamespace());\n }\n\n /**\n * Deletes the specified key from the store\n * @param {string} key\n * @returns {[type]}\n */\n del(...args) {\n return context.webex[`${type}Storage`].del(context.getNamespace(), ...args);\n }\n\n /**\n * Retrieves the value specified by key from the store. Rejects with\n * NotFoundError if no value can be found\n * @param {string} key\n * @returns {Promise}\n */\n get(key) {\n let defer = defers.get(this).get(key);\n\n if (!defer) {\n defer = new Defer();\n defers.get(this).set(key, defer);\n }\n\n return context.webex[`${type}Storage`].get(context.getNamespace(), key).then((res) => {\n defer.resolve();\n\n return res;\n });\n }\n\n /**\n * Writes a value to the store\n * @param {string} key\n * @param {any} value\n * @returns {Promise}\n */\n put(key, value) {\n return context.webex[`${type}Storage`].put(context.getNamespace(), key, serialize(value));\n }\n\n /**\n * Returns a Promise that won't resolve until the value specified by key has\n * been attempted to be loaded from the store. This allows us to lazily\n * prevent certain method from executing until the specified keys have been\n * retrieved from the store.\n * @param {string} key\n * @returns {Promise}\n */\n waitFor(key) {\n context.logger.debug(\n `plugin-storage(${context.getNamespace()}): waiting to init key \\`${key}\\``\n );\n const defer = defers.get(this).get(key);\n\n if (defer) {\n context.logger.debug(\n `plugin-storage(${context.getNamespace()}): already inited \\`${key}\\``\n );\n\n return defer.promise;\n }\n\n context.logger.debug(`plugin-storage(${context.getNamespace()}): initing \\`${key}\\``);\n\n return this.initValue(key);\n }\n\n @oneFlight({keyFactory: (key) => `initValue-${key}`})\n /**\n * Attempts to load the specified key from the store and set it on the parent\n * object.\n * @param {string} key\n * @returns {Promise} Resolves (but not with the retrieved value) when\n * the value retrieval complete\n */\n // suppress doc warning because decorators confuse eslint\n // eslint-disable-next-line require-jsdoc\n initValue(key) {\n const defer = new Defer();\n\n defers.get(this).set(key, defer);\n\n // Intentionally bypasses this.get so we don't resolve the promise until\n // after the parent value is set.\n context.webex[`${type}Storage`]\n .get(context.getNamespace(), key)\n .then((value) => {\n context.logger.debug(\n `plugin-storage(${context.getNamespace()}): got \\`${key}\\` for first time`\n );\n if (key === '@') {\n context.parent.set(value);\n } else if (result(context[key], 'isState')) {\n context[key].set(value);\n } else {\n context.set(key, value);\n }\n context.logger.debug(\n `plugin-storage(${context.getNamespace()}): set \\`${key}\\` for first time`\n );\n defer.resolve();\n context.logger.debug(`plugin-storage(${context.getNamespace()}): inited \\`${key}\\``);\n })\n .catch((reason) => {\n // The next conditional is a bit of an unfortunate solution to deal\n // with circular dependencies in unit tests. It should not effect\n // integration tests or production code.\n if (\n reason instanceof NotFoundError ||\n (process.env.NODE_ENV !== 'production' &&\n reason.toString().includes('MockNotFoundError'))\n ) {\n context.logger.debug(\n `plugin-storage(${context.getNamespace()}): no data for \\`${key}\\`, continuing`\n );\n\n return defer.resolve();\n }\n context.logger.warn(\n `plugin-storage(${context.getNamespace()}): failed to init \\`${key}\\``,\n reason\n );\n\n return defer.reject(reason);\n });\n\n return defer.promise;\n }\n }\n\n return new WebexPluginStorage();\n}\n"],"mappings":";;;;;;;;;;;;;;;AAIA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AAPA;AACA;AACA;;AAOA,IAAMG,MAAM,GAAG,IAAAC,QAAA,CAAAC,OAAA,CAAY,CAAC;;AAE5B;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,SAASA,CAACC,KAAK,EAAE;EACxB,IAAI,CAAC,IAAAC,gBAAQ,EAACD,KAAK,CAAC,EAAE;IACpB,OAAOA,KAAK;EACd;EAEA,IAAME,UAAU,GAAGF,KAAK,CAACD,SAAS,GAAGC,KAAK,CAACD,SAAS,CAAC,CAAC,GAAGC,KAAK;EAE9D,IAAAG,KAAA,CAAAL,OAAA,EAAYI,UAAU,CAAC,CAACE,OAAO,CAAC,UAACC,GAAG,EAAK;IACvC,IAAMC,GAAG,GAAGJ,UAAU,CAACG,GAAG,CAAC;IAE3B,IAAI,IAAAE,eAAO,EAACD,GAAG,CAAC,EAAE;MAChB,IAAIA,GAAG,CAACE,MAAM,KAAK,CAAC,EAAE;QACpBN,UAAU,CAACG,GAAG,CAAC,GAAGI,SAAS;MAC7B,CAAC,MAAM;QACLP,UAAU,CAACG,GAAG,CAAC,GAAGC,GAAG,CAACI,GAAG,CAACX,SAAS,CAAC;MACtC;IACF,CAAC,MAAM,IAAI,IAAAE,gBAAQ,EAACK,GAAG,CAAC,EAAE;MACxB,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,KAAK,mBAAAzB,MAAA,CACAN,OAAO,CAACc,YAAY,CAAC,CAAC,sBAAAR,MAAA,CAAoBlB,GAAG,kBACjE,CAAC;YAED,OAAOmC,KAAK,CAACI,OAAO,CAAC,CAAC;UACxB;UACA3B,OAAO,CAAC8B,MAAM,CAACc,IAAI,mBAAAtC,MAAA,CACCN,OAAO,CAACc,YAAY,CAAC,CAAC,yBAAAR,MAAA,CAAuBlB,GAAG,QAClEiD,MACF,CAAC;UAED,OAAOd,KAAK,CAACsB,MAAM,CAACR,MAAM,CAAC;QAC7B,CAAC,CAAC;QAEJ,OAAOd,KAAK,CAACS,OAAO;MACtB;IAAC;EAAA,SAAAc,0BAAA,CAAAjE,OAAA,EAAAqB,MAAA,CAAA6C,SAAA,gBAAA9C,IAAA,OAAA+C,yBAAA,CAAAnE,OAAA,EAAAqB,MAAA,CAAA6C,SAAA,gBAAA7C,MAAA,CAAA6C,SAAA,GAAA7C,MAAA;EAGH,OAAO,IAAIC,kBAAkB,CAAC,CAAC;AACjC","ignoreList":[]}
|
|
@@ -38,7 +38,7 @@ function makeWebexStore(type, webex) {
|
|
|
38
38
|
keyFactory: function keyFactory(namespace) {
|
|
39
39
|
return namespace;
|
|
40
40
|
}
|
|
41
|
-
}),
|
|
41
|
+
}), _class = /*#__PURE__*/function () {
|
|
42
42
|
/**
|
|
43
43
|
* @param {Object} attrs
|
|
44
44
|
* @param {Object} options
|
|
@@ -54,7 +54,7 @@ function makeWebexStore(type, webex) {
|
|
|
54
54
|
* Provides easy access to the storage adapter identified in config.
|
|
55
55
|
* @returns {Object}
|
|
56
56
|
*/
|
|
57
|
-
(0, _createClass2.default)(WebexStore, [{
|
|
57
|
+
return (0, _createClass2.default)(WebexStore, [{
|
|
58
58
|
key: "adapter",
|
|
59
59
|
get: function get() {
|
|
60
60
|
return webex.config.storage["".concat(type, "Adapter")];
|
|
@@ -137,7 +137,16 @@ function makeWebexStore(type, webex) {
|
|
|
137
137
|
}
|
|
138
138
|
}, {
|
|
139
139
|
key: "_getBinding",
|
|
140
|
-
value: function
|
|
140
|
+
value: function
|
|
141
|
+
/**
|
|
142
|
+
* Creates an interface bound to the specified namespace
|
|
143
|
+
* @param {string} namespace
|
|
144
|
+
* @private
|
|
145
|
+
* @returns {Promise}
|
|
146
|
+
*/
|
|
147
|
+
// suppress doc warning because decorators confuse eslint
|
|
148
|
+
// eslint-disable-next-line require-jsdoc
|
|
149
|
+
_getBinding(namespace) {
|
|
141
150
|
var _this = this;
|
|
142
151
|
return new _promise.default(function (resolve) {
|
|
143
152
|
webex.logger.debug("storage: getting binding for `".concat(namespace, "`"));
|
|
@@ -156,8 +165,7 @@ function makeWebexStore(type, webex) {
|
|
|
156
165
|
});
|
|
157
166
|
}
|
|
158
167
|
}]);
|
|
159
|
-
|
|
160
|
-
}(), ((0, _applyDecoratedDescriptor2.default)(_class.prototype, "_getBinding", [_dec], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "_getBinding"), _class.prototype)), _class));
|
|
168
|
+
}(), (0, _applyDecoratedDescriptor2.default)(_class.prototype, "_getBinding", [_dec], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "_getBinding"), _class.prototype), _class);
|
|
161
169
|
(0, _assign.default)(WebexStore.prototype, _ampersandEvents.default);
|
|
162
170
|
return new WebexStore();
|
|
163
171
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_ampersandEvents","_interopRequireDefault","require","_common","bindings","_weakMap","default","makeWebexStore","type","webex","_dec","_class","WebexStore","oneFlight","keyFactory","namespace","_classCallCheck2","logger","debug","concat","set","_map","_createClass2","key","get","config","storage","value","clear","promises","forEach","binding","push","_promise","all","del","_getBinding","then","put","serialize","_this","resolve","adapter","bind","_binding","_applyDecoratedDescriptor2","prototype","_getOwnPropertyDescriptor","_assign","Events"],"sources":["make-webex-store.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport Events from 'ampersand-events';\nimport {oneFlight} from '@webex/common';\n\nconst bindings = new WeakMap();\n\n/**\n * Makes a WebexStore for the specified type bound to the specified webex instance\n * @param {string} type\n * @param {ProxyWebex} webex\n * @private\n * @returns {WebexStore}\n */\nexport default function makeWebexStore(type, webex) {\n /**\n * Lazy Key-Value Store Interface\n */\n class WebexStore {\n /**\n * @param {Object} attrs\n * @param {Object} options\n * @returns {Store}\n */\n constructor() {\n webex.logger.debug(`webex-store: constructing ${type}Storage`);\n bindings.set(this, new Map());\n }\n\n /**\n * Provides easy access to the storage adapter identified in config.\n * @returns {Object}\n */\n get adapter() {\n return webex.config.storage[`${type}Adapter`];\n }\n\n /**\n * @returns {WeakMap}\n */\n get bindings() {\n return bindings.get(this);\n }\n\n /**\n * Clears the store\n * @returns {Promise}\n */\n clear() {\n const promises = [];\n\n this.bindings.forEach((binding) => {\n promises.push(binding.clear());\n });\n\n return Promise.all(promises);\n }\n\n /**\n * Deletes the specified key from the store\n * @param {string} namespace\n * @param {string} key\n * @returns {[type]}\n */\n del(namespace, key) {\n webex.logger.debug(`webex-store: removing ${namespace}:${key}`);\n\n return this._getBinding(namespace).then((binding) => binding.del(key));\n }\n\n /**\n * Retrieves the value specified by key from the store. Rejects with\n * NotFoundError if no value can be found\n * @param {string} namespace\n * @param {string} key\n * @returns {Promise}\n */\n get(namespace, key) {\n webex.logger.debug(`webex-store: retrieving ${namespace}:${key}`);\n\n return this._getBinding(namespace).then((binding) => binding.get(key));\n }\n\n /**\n * Writes a value to the store. Deletes the specified key from the store\n * if passed `undefined`\n * @param {string} namespace\n * @param {string} key\n * @param {any} value\n * @returns {Promise} Resolves with value (to simplify write-through caching)\n */\n put(namespace, key, value) {\n if (typeof value === 'undefined') {\n return this.del(namespace, key);\n }\n webex.logger.debug(`webex-store: setting ${namespace}:${key}`);\n\n return this._getBinding(namespace)\n .then((binding) => binding.put(key, value.serialize ? value.serialize() : value))\n .then(() => value);\n }\n\n @oneFlight({keyFactory: (namespace) => namespace})\n /**\n * Creates an interface bound to the specified namespace\n * @param {string} namespace\n * @private\n * @returns {Promise}\n */\n // suppress doc warning because decorators confuse eslint\n // eslint-disable-next-line require-jsdoc\n _getBinding(namespace) {\n return new Promise((resolve) => {\n webex.logger.debug(`storage: getting binding for \\`${namespace}\\``);\n const binding = this.bindings.get(namespace);\n\n if (binding) {\n webex.logger.debug(`storage: found binding for \\`${namespace}\\``);\n\n return resolve(binding);\n }\n\n return resolve(\n this.adapter.bind(namespace, {logger: webex.logger}).then((_binding) => {\n webex.logger.debug(`storage: made binding for \\`${namespace}\\``);\n this.bindings.set(namespace, _binding);\n\n return _binding;\n })\n );\n });\n }\n }\n\n Object.assign(WebexStore.prototype, Events);\n\n return new WebexStore();\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAIA,IAAAA,gBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AALA;AACA;AACA;;AAKA,IAAME,QAAQ,GAAG,IAAAC,QAAA,CAAAC,OAAA,CAAY,CAAC;;AAE9B;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,cAAcA,CAACC,IAAI,EAAEC,KAAK,EAAE;EAAA,IAAAC,IAAA,EAAAC,MAAA;EAClD;AACF;AACA;EAFE,IAGMC,UAAU,IAAAF,IAAA,GAoFb,IAAAG,iBAAS,EAAC;IAACC,UAAU,EAAE,
|
|
1
|
+
{"version":3,"names":["_ampersandEvents","_interopRequireDefault","require","_common","bindings","_weakMap","default","makeWebexStore","type","webex","_dec","_class","WebexStore","oneFlight","keyFactory","namespace","_classCallCheck2","logger","debug","concat","set","_map","_createClass2","key","get","config","storage","value","clear","promises","forEach","binding","push","_promise","all","del","_getBinding","then","put","serialize","_this","resolve","adapter","bind","_binding","_applyDecoratedDescriptor2","prototype","_getOwnPropertyDescriptor","_assign","Events"],"sources":["make-webex-store.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport Events from 'ampersand-events';\nimport {oneFlight} from '@webex/common';\n\nconst bindings = new WeakMap();\n\n/**\n * Makes a WebexStore for the specified type bound to the specified webex instance\n * @param {string} type\n * @param {ProxyWebex} webex\n * @private\n * @returns {WebexStore}\n */\nexport default function makeWebexStore(type, webex) {\n /**\n * Lazy Key-Value Store Interface\n */\n class WebexStore {\n /**\n * @param {Object} attrs\n * @param {Object} options\n * @returns {Store}\n */\n constructor() {\n webex.logger.debug(`webex-store: constructing ${type}Storage`);\n bindings.set(this, new Map());\n }\n\n /**\n * Provides easy access to the storage adapter identified in config.\n * @returns {Object}\n */\n get adapter() {\n return webex.config.storage[`${type}Adapter`];\n }\n\n /**\n * @returns {WeakMap}\n */\n get bindings() {\n return bindings.get(this);\n }\n\n /**\n * Clears the store\n * @returns {Promise}\n */\n clear() {\n const promises = [];\n\n this.bindings.forEach((binding) => {\n promises.push(binding.clear());\n });\n\n return Promise.all(promises);\n }\n\n /**\n * Deletes the specified key from the store\n * @param {string} namespace\n * @param {string} key\n * @returns {[type]}\n */\n del(namespace, key) {\n webex.logger.debug(`webex-store: removing ${namespace}:${key}`);\n\n return this._getBinding(namespace).then((binding) => binding.del(key));\n }\n\n /**\n * Retrieves the value specified by key from the store. Rejects with\n * NotFoundError if no value can be found\n * @param {string} namespace\n * @param {string} key\n * @returns {Promise}\n */\n get(namespace, key) {\n webex.logger.debug(`webex-store: retrieving ${namespace}:${key}`);\n\n return this._getBinding(namespace).then((binding) => binding.get(key));\n }\n\n /**\n * Writes a value to the store. Deletes the specified key from the store\n * if passed `undefined`\n * @param {string} namespace\n * @param {string} key\n * @param {any} value\n * @returns {Promise} Resolves with value (to simplify write-through caching)\n */\n put(namespace, key, value) {\n if (typeof value === 'undefined') {\n return this.del(namespace, key);\n }\n webex.logger.debug(`webex-store: setting ${namespace}:${key}`);\n\n return this._getBinding(namespace)\n .then((binding) => binding.put(key, value.serialize ? value.serialize() : value))\n .then(() => value);\n }\n\n @oneFlight({keyFactory: (namespace) => namespace})\n /**\n * Creates an interface bound to the specified namespace\n * @param {string} namespace\n * @private\n * @returns {Promise}\n */\n // suppress doc warning because decorators confuse eslint\n // eslint-disable-next-line require-jsdoc\n _getBinding(namespace) {\n return new Promise((resolve) => {\n webex.logger.debug(`storage: getting binding for \\`${namespace}\\``);\n const binding = this.bindings.get(namespace);\n\n if (binding) {\n webex.logger.debug(`storage: found binding for \\`${namespace}\\``);\n\n return resolve(binding);\n }\n\n return resolve(\n this.adapter.bind(namespace, {logger: webex.logger}).then((_binding) => {\n webex.logger.debug(`storage: made binding for \\`${namespace}\\``);\n this.bindings.set(namespace, _binding);\n\n return _binding;\n })\n );\n });\n }\n }\n\n Object.assign(WebexStore.prototype, Events);\n\n return new WebexStore();\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAIA,IAAAA,gBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AALA;AACA;AACA;;AAKA,IAAME,QAAQ,GAAG,IAAAC,QAAA,CAAAC,OAAA,CAAY,CAAC;;AAE9B;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,cAAcA,CAACC,IAAI,EAAEC,KAAK,EAAE;EAAA,IAAAC,IAAA,EAAAC,MAAA;EAClD;AACF;AACA;EAFE,IAGMC,UAAU,IAAAF,IAAA,GAoFb,IAAAG,iBAAS,EAAC;IAACC,UAAU,EAAE,SAAZA,UAAUA,CAAGC,SAAS;MAAA,OAAKA,SAAS;IAAA;EAAA,CAAC,CAAC,EAAAJ,MAAA;IAnFlD;AACJ;AACA;AACA;AACA;IACI,SAAAC,WAAA,EAAc;MAAA,IAAAI,gBAAA,CAAAV,OAAA,QAAAM,UAAA;MACZH,KAAK,CAACQ,MAAM,CAACC,KAAK,8BAAAC,MAAA,CAA8BX,IAAI,YAAS,CAAC;MAC9DJ,QAAQ,CAACgB,GAAG,CAAC,IAAI,EAAE,IAAAC,IAAA,CAAAf,OAAA,CAAQ,CAAC,CAAC;IAC/B;;IAEA;AACJ;AACA;AACA;IAHI,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M,CAACC,KAAK,gCAAAC,MAAA,CAAiCJ,SAAS,MAAI,CAAC;YAEjE,OAAO0B,OAAO,CAACV,OAAO,CAAC;UACzB;UAEA,OAAOU,OAAO,CACZD,KAAI,CAACE,OAAO,CAACC,IAAI,CAAC5B,SAAS,EAAE;YAACE,MAAM,EAAER,KAAK,CAACQ;UAAM,CAAC,CAAC,CAACoB,IAAI,CAAC,UAACO,QAAQ,EAAK;YACtEnC,KAAK,CAACQ,MAAM,CAACC,KAAK,+BAAAC,MAAA,CAAgCJ,SAAS,MAAI,CAAC;YAChEyB,KAAI,CAACpC,QAAQ,CAACgB,GAAG,CAACL,SAAS,EAAE6B,QAAQ,CAAC;YAEtC,OAAOA,QAAQ;UACjB,CAAC,CACH,CAAC;QACH,CAAC,CAAC;MACJ;IAAC;EAAA,SAAAC,0BAAA,CAAAvC,OAAA,EAAAK,MAAA,CAAAmC,SAAA,kBAAApC,IAAA,OAAAqC,yBAAA,CAAAzC,OAAA,EAAAK,MAAA,CAAAmC,SAAA,kBAAAnC,MAAA,CAAAmC,SAAA,GAAAnC,MAAA;EAGH,IAAAqC,OAAA,CAAA1C,OAAA,EAAcM,UAAU,CAACkC,SAAS,EAAEG,wBAAM,CAAC;EAE3C,OAAO,IAAIrC,UAAU,CAAC,CAAC;AACzB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_errors","require","_bind","namespace","options","arguments","length","undefined","_promise","default","reject","Error","logger","_options","map","_map","data","_keys","forEach","key","set","debug","resolve","clear","del","concat","delete","get","res","NotFoundError","put","value","_default","exports","bind","preload"],"sources":["memory-store-adapter.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {NotFoundError} from './errors';\n\n/**\n * Binds a namespace\n * @param {string} namespace\n * @param {Object} options\n * @param {Object} options.data\n * @private\n * @returns {Promise<Object>}\n */\nfunction _bind(namespace, options = {}) {\n options = options || {};\n if (!namespace) {\n return Promise.reject(new Error('`namespace` is required'));\n }\n\n if (!options.logger) {\n return Promise.reject(new Error('`options.logger` is required'));\n }\n\n const {logger} = options;\n\n const map = new Map([['@', {}]]);\n\n if (options.data) {\n Object.keys(options.data).forEach((key) => {\n map.set(key, options.data[key]);\n });\n }\n\n logger.debug('memory-store-adapter: returning binding');\n\n return Promise.resolve({\n clear() {\n logger.debug('memory-store-adapter: clearing the binding');\n\n return Promise.resolve(map.clear());\n },\n del(key) {\n logger.debug(`memory-store-adapter: deleting \\`${key}\\``);\n\n return Promise.resolve(map.delete(key));\n },\n get(key) {\n logger.debug(`memory-store-adapter: reading \\`${key}\\``);\n const res = map.get(key);\n\n if (typeof res === 'undefined') {\n return Promise.reject(new NotFoundError());\n }\n\n return Promise.resolve(res);\n },\n put(key, value) {\n logger.debug(`memory-store-adapter: writing \\`${key}\\``);\n\n return Promise.resolve(map.set(key, value));\n },\n });\n}\n\nexport default {\n bind: _bind,\n preload(data) {\n return {\n bind(namespace, options = {}) {\n if (data[namespace]) {\n options.data = data[namespace];\n }\n\n return _bind(namespace, options);\n },\n };\n },\n};\n"],"mappings":";;;;;;;;;;;AAIA,IAAAA,OAAA,GAAAC,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,KAAKA,CAACC,SAAS,EAAgB;EAAA,IAAdC,OAAO,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EACpCD,OAAO,GAAGA,OAAO,IAAI,CAAC,CAAC;EACvB,IAAI,CAACD,SAAS,EAAE;IACd,OAAOK,QAAA,CAAAC,OAAA,CAAQC,MAAM,CAAC,IAAIC,KAAK,CAAC,yBAAyB,CAAC,CAAC;EAC7D;EAEA,IAAI,CAACP,OAAO,CAACQ,MAAM,EAAE;IACnB,OAAOJ,QAAA,CAAAC,OAAA,CAAQC,MAAM,CAAC,IAAIC,KAAK,CAAC,8BAA8B,CAAC,CAAC;EAClE;EAEA,IAAAE,QAAA,GAAiBT,OAAO;IAAjBQ,MAAM,GAAAC,QAAA,CAAND,MAAM;EAEb,IAAME,GAAG,GAAG,IAAAC,IAAA,CAAAN,OAAA,CAAQ,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;EAEhC,IAAIL,OAAO,CAACY,IAAI,EAAE;IAChB,IAAAC,KAAA,CAAAR,OAAA,EAAYL,OAAO,CAACY,IAAI,CAAC,CAACE,OAAO,CAAC,UAACC,GAAG,EAAK;MACzCL,GAAG,CAACM,GAAG,CAACD,GAAG,EAAEf,OAAO,CAACY,IAAI,CAACG,GAAG,CAAC,CAAC;IACjC,CAAC,CAAC;EACJ;EAEAP,MAAM,CAACS,KAAK,CAAC,yCAAyC,CAAC;EAEvD,OAAOb,QAAA,CAAAC,OAAA,CAAQa,OAAO,CAAC;IACrBC,KAAK,
|
|
1
|
+
{"version":3,"names":["_errors","require","_bind","namespace","options","arguments","length","undefined","_promise","default","reject","Error","logger","_options","map","_map","data","_keys","forEach","key","set","debug","resolve","clear","del","concat","delete","get","res","NotFoundError","put","value","_default","exports","bind","preload"],"sources":["memory-store-adapter.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {NotFoundError} from './errors';\n\n/**\n * Binds a namespace\n * @param {string} namespace\n * @param {Object} options\n * @param {Object} options.data\n * @private\n * @returns {Promise<Object>}\n */\nfunction _bind(namespace, options = {}) {\n options = options || {};\n if (!namespace) {\n return Promise.reject(new Error('`namespace` is required'));\n }\n\n if (!options.logger) {\n return Promise.reject(new Error('`options.logger` is required'));\n }\n\n const {logger} = options;\n\n const map = new Map([['@', {}]]);\n\n if (options.data) {\n Object.keys(options.data).forEach((key) => {\n map.set(key, options.data[key]);\n });\n }\n\n logger.debug('memory-store-adapter: returning binding');\n\n return Promise.resolve({\n clear() {\n logger.debug('memory-store-adapter: clearing the binding');\n\n return Promise.resolve(map.clear());\n },\n del(key) {\n logger.debug(`memory-store-adapter: deleting \\`${key}\\``);\n\n return Promise.resolve(map.delete(key));\n },\n get(key) {\n logger.debug(`memory-store-adapter: reading \\`${key}\\``);\n const res = map.get(key);\n\n if (typeof res === 'undefined') {\n return Promise.reject(new NotFoundError());\n }\n\n return Promise.resolve(res);\n },\n put(key, value) {\n logger.debug(`memory-store-adapter: writing \\`${key}\\``);\n\n return Promise.resolve(map.set(key, value));\n },\n });\n}\n\nexport default {\n bind: _bind,\n preload(data) {\n return {\n bind(namespace, options = {}) {\n if (data[namespace]) {\n options.data = data[namespace];\n }\n\n return _bind(namespace, options);\n },\n };\n },\n};\n"],"mappings":";;;;;;;;;;;AAIA,IAAAA,OAAA,GAAAC,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,KAAKA,CAACC,SAAS,EAAgB;EAAA,IAAdC,OAAO,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EACpCD,OAAO,GAAGA,OAAO,IAAI,CAAC,CAAC;EACvB,IAAI,CAACD,SAAS,EAAE;IACd,OAAOK,QAAA,CAAAC,OAAA,CAAQC,MAAM,CAAC,IAAIC,KAAK,CAAC,yBAAyB,CAAC,CAAC;EAC7D;EAEA,IAAI,CAACP,OAAO,CAACQ,MAAM,EAAE;IACnB,OAAOJ,QAAA,CAAAC,OAAA,CAAQC,MAAM,CAAC,IAAIC,KAAK,CAAC,8BAA8B,CAAC,CAAC;EAClE;EAEA,IAAAE,QAAA,GAAiBT,OAAO;IAAjBQ,MAAM,GAAAC,QAAA,CAAND,MAAM;EAEb,IAAME,GAAG,GAAG,IAAAC,IAAA,CAAAN,OAAA,CAAQ,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;EAEhC,IAAIL,OAAO,CAACY,IAAI,EAAE;IAChB,IAAAC,KAAA,CAAAR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AQa,OAAO,CAACR,GAAG,CAACM,GAAG,CAACD,GAAG,EAAEY,KAAK,CAAC,CAAC;IAC7C;EACF,CAAC,CAAC;AACJ;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAxB,OAAA,GAEc;EACbyB,IAAI,EAAEhC,KAAK;EACXiC,OAAO,WAAPA,OAAOA,CAACnB,IAAI,EAAE;IACZ,OAAO;MACLkB,IAAI,WAAJA,IAAIA,CAAC/B,SAAS,EAAgB;QAAA,IAAdC,OAAO,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;QAC1B,IAAIW,IAAI,CAACb,SAAS,CAAC,EAAE;UACnBC,OAAO,CAACY,IAAI,GAAGA,IAAI,CAACb,SAAS,CAAC;QAChC;QAEA,OAAOD,KAAK,CAACC,SAAS,EAAEC,OAAO,CAAC;MAClC;IACF,CAAC;EACH;AACF,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_lodash","require","mixinWebexCorePlugins","State","config","interceptors","registerPlugin","name","constructor","options","arguments","length","undefined","prototype","_children","replace","proxies","forEach","key","createDerivedProperty","deps","concat","fn","_keys","default","merge","has","payloadTransformer","predicates","get","transforms","onBeforeLogout","isArray","push","plugin","_definition","ready","_State$prototype$_der","_derived","depList","def","modelProto","definition","isFunction","cache","dep","_deps","union","_defineProperty","_getDerivedProperty","set","TypeError"],"sources":["webex-core-plugin-mixin.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {get, has, isArray, isFunction, merge, union} from 'lodash';\n\n/**\n * Mixes a plugin system into an AmpState object (specifically, into WebexCore)\n * @param {AmpState} State\n * @param {Object} config\n * @param {Object} interceptors\n * @returns {AmpState}\n */\nexport default function mixinWebexCorePlugins(State, config, interceptors) {\n // eslint-disable-next-line complexity\n State.registerPlugin = function registerPlugin(name, constructor, options = {}) {\n if (State.prototype._children[name] && !options.replace) {\n return;\n }\n\n State.prototype._children[name] = constructor;\n\n if (options.proxies) {\n options.proxies.forEach((key) => {\n createDerivedProperty(State.prototype, key, {\n deps: [`${name}.${key}`],\n fn() {\n return this[name][key];\n },\n });\n });\n }\n\n if (options.interceptors) {\n Object.keys(options.interceptors).forEach((key) => {\n interceptors[key] = options.interceptors[key];\n });\n }\n\n if (options.config) {\n merge(config, options.config);\n }\n\n if (has(options, 'payloadTransformer.predicates')) {\n config.payloadTransformer.predicates = config.payloadTransformer.predicates.concat(\n get(options, 'payloadTransformer.predicates')\n );\n }\n\n if (has(options, 'payloadTransformer.transforms')) {\n config.payloadTransformer.transforms = config.payloadTransformer.transforms.concat(\n get(options, 'payloadTransformer.transforms')\n );\n }\n\n if (options.onBeforeLogout) {\n config.onBeforeLogout = config.onBeforeLogout || [];\n const onBeforeLogout = isArray(options.onBeforeLogout)\n ? options.onBeforeLogout\n : [options.onBeforeLogout];\n\n onBeforeLogout.forEach((fn) =>\n config.onBeforeLogout.push({\n plugin: name,\n fn,\n })\n );\n }\n\n // Only mess with the plugin's derived properties if it's an amp-state plugin\n if (constructor.prototype._definition && constructor.prototype._definition.ready) {\n const {fn, depList} = State.prototype._derived.ready;\n const def = {\n deps: depList.concat(`${name}.ready`),\n fn,\n };\n\n createDerivedProperty(State.prototype, 'ready', def);\n }\n };\n\n return State;\n}\n\n/**\n * Extracted from ampersand-state\n * @param {Object} modelProto\n * @param {string} name\n * @param {Object} definition\n * @private\n * @returns {undefined}\n */\nfunction createDerivedProperty(modelProto, name, definition) {\n const def = (modelProto._derived[name] = {\n fn: isFunction(definition) ? definition : definition.fn,\n cache: definition.cache !== false,\n depList: definition.deps || [],\n });\n\n // add to our shared dependency list\n def.depList.forEach((dep) => {\n modelProto._deps[dep] = union(modelProto._deps[dep] || [], [name]);\n });\n\n // defined a top-level getter for derived names\n Reflect.defineProperty(modelProto, name, {\n get() {\n return this._getDerivedProperty(name);\n },\n set() {\n throw new TypeError(`\\`${name}\\` is a derived property, it can't be set directly.`);\n },\n });\n}\n"],"mappings":";;;;;;;;;;AAIA,IAAAA,OAAA,GAAAC,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,qBAAqBA,CAACC,KAAK,EAAEC,MAAM,EAAEC,YAAY,EAAE;EACzE;EACAF,KAAK,CAACG,cAAc,GAAG,SAASA,cAAcA,CAACC,IAAI,EAAEC,WAAW,EAAgB;IAAA,IAAdC,OAAO,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;IAC5E,IAAIP,KAAK,CAACU,SAAS,CAACC,SAAS,CAACP,IAAI,CAAC,IAAI,CAACE,OAAO,CAACM,OAAO,EAAE;MACvD;IACF;IAEAZ,KAAK,CAACU,SAAS,CAACC,SAAS,CAACP,IAAI,CAAC,GAAGC,WAAW;IAE7C,IAAIC,OAAO,CAACO,OAAO,EAAE;MACnBP,OAAO,CAACO,OAAO,CAACC,OAAO,CAAC,UAACC,GAAG,EAAK;QAC/BC,qBAAqB,CAAChB,KAAK,CAACU,SAAS,EAAEK,GAAG,EAAE;UAC1CE,IAAI,EAAE,IAAAC,MAAA,CAAId,IAAI,OAAAc,MAAA,CAAIH,GAAG,EAAG;UACxBI,EAAE,
|
|
1
|
+
{"version":3,"names":["_lodash","require","mixinWebexCorePlugins","State","config","interceptors","registerPlugin","name","constructor","options","arguments","length","undefined","prototype","_children","replace","proxies","forEach","key","createDerivedProperty","deps","concat","fn","_keys","default","merge","has","payloadTransformer","predicates","get","transforms","onBeforeLogout","isArray","push","plugin","_definition","ready","_State$prototype$_der","_derived","depList","def","modelProto","definition","isFunction","cache","dep","_deps","union","_defineProperty","_getDerivedProperty","set","TypeError"],"sources":["webex-core-plugin-mixin.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {get, has, isArray, isFunction, merge, union} from 'lodash';\n\n/**\n * Mixes a plugin system into an AmpState object (specifically, into WebexCore)\n * @param {AmpState} State\n * @param {Object} config\n * @param {Object} interceptors\n * @returns {AmpState}\n */\nexport default function mixinWebexCorePlugins(State, config, interceptors) {\n // eslint-disable-next-line complexity\n State.registerPlugin = function registerPlugin(name, constructor, options = {}) {\n if (State.prototype._children[name] && !options.replace) {\n return;\n }\n\n State.prototype._children[name] = constructor;\n\n if (options.proxies) {\n options.proxies.forEach((key) => {\n createDerivedProperty(State.prototype, key, {\n deps: [`${name}.${key}`],\n fn() {\n return this[name][key];\n },\n });\n });\n }\n\n if (options.interceptors) {\n Object.keys(options.interceptors).forEach((key) => {\n interceptors[key] = options.interceptors[key];\n });\n }\n\n if (options.config) {\n merge(config, options.config);\n }\n\n if (has(options, 'payloadTransformer.predicates')) {\n config.payloadTransformer.predicates = config.payloadTransformer.predicates.concat(\n get(options, 'payloadTransformer.predicates')\n );\n }\n\n if (has(options, 'payloadTransformer.transforms')) {\n config.payloadTransformer.transforms = config.payloadTransformer.transforms.concat(\n get(options, 'payloadTransformer.transforms')\n );\n }\n\n if (options.onBeforeLogout) {\n config.onBeforeLogout = config.onBeforeLogout || [];\n const onBeforeLogout = isArray(options.onBeforeLogout)\n ? options.onBeforeLogout\n : [options.onBeforeLogout];\n\n onBeforeLogout.forEach((fn) =>\n config.onBeforeLogout.push({\n plugin: name,\n fn,\n })\n );\n }\n\n // Only mess with the plugin's derived properties if it's an amp-state plugin\n if (constructor.prototype._definition && constructor.prototype._definition.ready) {\n const {fn, depList} = State.prototype._derived.ready;\n const def = {\n deps: depList.concat(`${name}.ready`),\n fn,\n };\n\n createDerivedProperty(State.prototype, 'ready', def);\n }\n };\n\n return State;\n}\n\n/**\n * Extracted from ampersand-state\n * @param {Object} modelProto\n * @param {string} name\n * @param {Object} definition\n * @private\n * @returns {undefined}\n */\nfunction createDerivedProperty(modelProto, name, definition) {\n const def = (modelProto._derived[name] = {\n fn: isFunction(definition) ? definition : definition.fn,\n cache: definition.cache !== false,\n depList: definition.deps || [],\n });\n\n // add to our shared dependency list\n def.depList.forEach((dep) => {\n modelProto._deps[dep] = union(modelProto._deps[dep] || [], [name]);\n });\n\n // defined a top-level getter for derived names\n Reflect.defineProperty(modelProto, name, {\n get() {\n return this._getDerivedProperty(name);\n },\n set() {\n throw new TypeError(`\\`${name}\\` is a derived property, it can't be set directly.`);\n },\n });\n}\n"],"mappings":";;;;;;;;;;AAIA,IAAAA,OAAA,GAAAC,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,qBAAqBA,CAACC,KAAK,EAAEC,MAAM,EAAEC,YAAY,EAAE;EACzE;EACAF,KAAK,CAACG,cAAc,GAAG,SAASA,cAAcA,CAACC,IAAI,EAAEC,WAAW,EAAgB;IAAA,IAAdC,OAAO,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;IAC5E,IAAIP,KAAK,CAACU,SAAS,CAACC,SAAS,CAACP,IAAI,CAAC,IAAI,CAACE,OAAO,CAACM,OAAO,EAAE;MACvD;IACF;IAEAZ,KAAK,CAACU,SAAS,CAACC,SAAS,CAACP,IAAI,CAAC,GAAGC,WAAW;IAE7C,IAAIC,OAAO,CAACO,OAAO,EAAE;MACnBP,OAAO,CAACO,OAAO,CAACC,OAAO,CAAC,UAACC,GAAG,EAAK;QAC/BC,qBAAqB,CAAChB,KAAK,CAACU,SAAS,EAAEK,GAAG,EAAE;UAC1CE,IAAI,EAAE,IAAAC,MAAA,CAAId,IAAI,OAAAc,MAAA,CAAIH,GAAG,EAAG;UACxBI,EAAE,WAAFA,EAAEA,CAAA,EAAG;YACH,OAAO,IAAI,CAACf,IAAI,CAAC,CAACW,GAAG,CAAC;UACxB;QACF,CAAC,CAAC;MACJ,CAAC,CAAC;IACJ;IAEA,IAAIT,OAAO,CAACJ,YAAY,EAAE;MACxB,IAAAkB,KAAA,CAAAC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B,CAAC1C,IAAI,CAAC;IACvC,CAAC;IACD2C,GAAG,WAAHA,GAAGA,CAAA,EAAG;MACJ,MAAM,IAAIC,SAAS,KAAA9B,MAAA,CAAMd,IAAI,uDAAqD,CAAC;IACrF;EACF,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -11,25 +11,24 @@ var _apply = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/refl
|
|
|
11
11
|
var _defineProperty = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/reflect/define-property"));
|
|
12
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
|
|
13
13
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
|
|
14
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/inherits"));
|
|
15
14
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/possibleConstructorReturn"));
|
|
16
15
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/getPrototypeOf"));
|
|
16
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/inherits"));
|
|
17
17
|
var _httpCore = require("@webex/http-core");
|
|
18
|
-
function
|
|
19
|
-
function _isNativeReflectConstruct() {
|
|
18
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? _Reflect$construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
19
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /*!
|
|
20
20
|
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
21
21
|
*/
|
|
22
22
|
/**
|
|
23
23
|
* Webex-specific http error class
|
|
24
24
|
*/
|
|
25
25
|
var WebexHttpError = exports.default = /*#__PURE__*/function (_HttpError) {
|
|
26
|
-
(0, _inherits2.default)(WebexHttpError, _HttpError);
|
|
27
|
-
var _super = _createSuper(WebexHttpError);
|
|
28
26
|
function WebexHttpError() {
|
|
29
27
|
(0, _classCallCheck2.default)(this, WebexHttpError);
|
|
30
|
-
return
|
|
28
|
+
return _callSuper(this, WebexHttpError, arguments);
|
|
31
29
|
}
|
|
32
|
-
(0,
|
|
30
|
+
(0, _inherits2.default)(WebexHttpError, _HttpError);
|
|
31
|
+
return (0, _createClass2.default)(WebexHttpError, [{
|
|
33
32
|
key: "parse",
|
|
34
33
|
value:
|
|
35
34
|
/**
|
|
@@ -74,7 +73,6 @@ var WebexHttpError = exports.default = /*#__PURE__*/function (_HttpError) {
|
|
|
74
73
|
return message;
|
|
75
74
|
}
|
|
76
75
|
}]);
|
|
77
|
-
return WebexHttpError;
|
|
78
76
|
}(_httpCore.HttpError);
|
|
79
77
|
_httpCore.HttpError.makeSubTypes(WebexHttpError);
|
|
80
78
|
|
|
@@ -82,12 +80,11 @@ _httpCore.HttpError.makeSubTypes(WebexHttpError);
|
|
|
82
80
|
* TooManyRequests
|
|
83
81
|
*/
|
|
84
82
|
var TooManyRequests = /*#__PURE__*/function (_HttpError$BadRequest) {
|
|
85
|
-
(0, _inherits2.default)(TooManyRequests, _HttpError$BadRequest);
|
|
86
|
-
var _super2 = _createSuper(TooManyRequests);
|
|
87
83
|
function TooManyRequests() {
|
|
88
84
|
(0, _classCallCheck2.default)(this, TooManyRequests);
|
|
89
|
-
return
|
|
85
|
+
return _callSuper(this, TooManyRequests, arguments);
|
|
90
86
|
}
|
|
87
|
+
(0, _inherits2.default)(TooManyRequests, _HttpError$BadRequest);
|
|
91
88
|
return (0, _createClass2.default)(TooManyRequests);
|
|
92
89
|
}(_httpCore.HttpError.BadRequest);
|
|
93
90
|
_httpCore.HttpError[429] = TooManyRequests;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_httpCore","require","
|
|
1
|
+
{"version":3,"names":["_httpCore","require","_callSuper","t","o","e","_getPrototypeOf2","default","_possibleConstructorReturn2","_isNativeReflectConstruct","_Reflect$construct","constructor","apply","Boolean","prototype","valueOf","call","WebexHttpError","exports","_HttpError","_classCallCheck2","arguments","_inherits2","_createClass2","key","value","parse","res","message","_apply","HttpError","_defineProperty","enumerable","options","body","errorCode","concat","url","method","uri","service","toUpperCase","resource","headers","trackingid","writeable","retryAfter","makeSubTypes","TooManyRequests","_HttpError$BadRequest","BadRequest"],"sources":["webex-http-error.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {HttpError} from '@webex/http-core';\n\n/**\n * Webex-specific http error class\n */\nexport default class WebexHttpError extends HttpError {\n /**\n * Very similar to {@link HttpError#parse()}, but additionally adds some\n * useful headers to the message string\n * @param {HttpResponse} res\n * @returns {string}\n */\n parse(res) {\n let message = Reflect.apply(HttpError.prototype.parse, this, [res]);\n\n Reflect.defineProperty(this, 'options', {\n enumerable: false,\n value: res.options,\n });\n\n Reflect.defineProperty(this, 'body', {\n enumerable: false,\n value: res.body,\n });\n\n if (this.body && this.body.errorCode) {\n message += `\\nerrorCode : ${this.body.errorCode}`;\n }\n\n if (this.options.url) {\n message += `\\n${this.options.method} ${this.options.url}`;\n } else if (this.options.uri) {\n message += `\\n${this.options.method} ${this.options.uri}`;\n } else {\n message += `\\n${this.options.method} ${this.options.service.toUpperCase()}/${\n this.options.resource\n }`;\n }\n message += `\\nWEBEX_TRACKING_ID: ${this.options.headers.trackingid}`;\n if (this.options.headers && this.options.headers['x-trans-id']) {\n message += `\\nX-Trans-Id: ${this.options.headers['x-trans-id']}`;\n }\n if (this.headers['retry-after']) {\n Reflect.defineProperty(this, 'retryAfter', {\n enumerable: true,\n value: this.headers['retry-after'],\n writeable: false,\n });\n\n message += `\\nRETRY-AFTER: ${this.retryAfter}`;\n }\n message += '\\n';\n\n return message;\n }\n}\n\nHttpError.makeSubTypes(WebexHttpError);\n\n/**\n * TooManyRequests\n */\nclass TooManyRequests extends HttpError.BadRequest {}\n\nHttpError[429] = TooManyRequests;\nHttpError.TooManyRequests = TooManyRequests;\n"],"mappings":";;;;;;;;;;;;;;;;AAIA,IAAAA,SAAA,GAAAC,OAAA;AAA2C,SAAAC,WAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,WAAAD,CAAA,OAAAE,gBAAA,CAAAC,OAAA,EAAAH,CAAA,OAAAI,2BAAA,CAAAD,OAAA,EAAAJ,CAAA,EAAAM,yBAAA,KAAAC,kBAAA,CAAAN,CAAA,EAAAC,CAAA,YAAAC,gBAAA,CAAAC,OAAA,EAAAJ,CAAA,EAAAQ,WAAA,IAAAP,CAAA,CAAAQ,KAAA,CAAAT,CAAA,EAAAE,CAAA;AAAA,SAAAI,0BAAA,cAAAN,CAAA,IAAAU,OAAA,CAAAC,SAAA,CAAAC,OAAA,CAAAC,IAAA,CAAAN,kBAAA,CAAAG,OAAA,iCAAAV,CAAA,aAAAM,yBAAA,YAAAA,0BAAA,aAAAN,CAAA,UAJ3C;AACA;AACA;AAIA;AACA;AACA;AAFA,IAGqBc,cAAc,GAAAC,OAAA,CAAAX,OAAA,0BAAAY,UAAA;EAAA,SAAAF,eAAA;IAAA,IAAAG,gBAAA,CAAAb,OAAA,QAAAU,cAAA;IAAA,OAAAf,UAAA,OAAAe,cAAA,EAAAI,SAAA;EAAA;EAAA,IAAAC,UAAA,CAAAf,OAAA,EAAAU,cAAA,EAAAE,UAAA;EAAA,WAAAI,aAAA,CAAAhB,OAAA,EAAAU,cAAA;IAAAO,GAAA;IAAAC,KAAA;IACjC;AACF;AACA;AACA;AACA;AACA;IACE,SAAAC,KAAKA,CAACC,GAAG,EAAE;MACT,IAAIC,OAAO,GAAG,IAAAC,MAAA,CAAAtB,OAAA,EAAcuB,mBAAS,CAAChB,SAAS,CAACY,KAAK,EAAE,IAAI,EAAE,CAACC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AA,CAAqB,IAAI,CAACH,OAAO,CAACU,OAAO,CAAC,YAAY,CAAC,CAAE;MAClE;MACA,IAAI,IAAI,CAACA,OAAO,CAAC,aAAa,CAAC,EAAE;QAC/B,IAAAZ,eAAA,CAAAxB,OAAA,EAAuB,IAAI,EAAE,YAAY,EAAE;UACzCyB,UAAU,EAAE,IAAI;UAChBP,KAAK,EAAE,IAAI,CAACkB,OAAO,CAAC,aAAa,CAAC;UAClCE,SAAS,EAAE;QACb,CAAC,CAAC;QAEFjB,OAAO,sBAAAQ,MAAA,CAAsB,IAAI,CAACU,UAAU,CAAE;MAChD;MACAlB,OAAO,IAAI,IAAI;MAEf,OAAOA,OAAO;IAChB;EAAC;AAAA,EAjDyCE,mBAAS;AAoDrDA,mBAAS,CAACiB,YAAY,CAAC9B,cAAc,CAAC;;AAEtC;AACA;AACA;AAFA,IAGM+B,eAAe,0BAAAC,qBAAA;EAAA,SAAAD,gBAAA;IAAA,IAAA5B,gBAAA,CAAAb,OAAA,QAAAyC,eAAA;IAAA,OAAA9C,UAAA,OAAA8C,eAAA,EAAA3B,SAAA;EAAA;EAAA,IAAAC,UAAA,CAAAf,OAAA,EAAAyC,eAAA,EAAAC,qBAAA;EAAA,WAAA1B,aAAA,CAAAhB,OAAA,EAAAyC,eAAA;AAAA,EAASlB,mBAAS,CAACoB,UAAU;AAElDpB,mBAAS,CAAC,GAAG,CAAC,GAAGkB,eAAe;AAChClB,mBAAS,CAACkB,eAAe,GAAGA,eAAe","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_lodash","require","mixinWebexInternalCorePlugins","State","config","interceptors","registerPlugin","name","constructor","options","arguments","length","undefined","prototype","_children","replace","proxies","Error","_keys","default","forEach","key","merge","has","payloadTransformer","predicates","concat","get","transforms","onBeforeLogout","isArray","fn","push","plugin","_definition","ready","_State$prototype$_der","_derived","depList","def","deps","createDerivedProperty","modelProto","definition","isFunction","cache","dep","_deps","union","_defineProperty","_getDerivedProperty","set","TypeError"],"sources":["webex-internal-core-plugin-mixin.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {get, has, isArray, isFunction, merge, union} from 'lodash';\n\n/**\n * Mixes a plugin system into an AmpState object (specifically, into WebexCore)\n * @param {AmpState} State\n * @param {Object} config\n * @param {Object} interceptors\n * @returns {AmpState}\n */\nexport default function mixinWebexInternalCorePlugins(State, config, interceptors) {\n // eslint-disable-next-line complexity\n State.registerPlugin = function registerPlugin(name, constructor, options = {}) {\n if (State.prototype._children[name] && !options.replace) {\n return;\n }\n\n State.prototype._children[name] = constructor;\n\n if (options.proxies) {\n throw new Error('Proxies are not currently supported for private plugins');\n }\n\n if (options.interceptors) {\n Object.keys(options.interceptors).forEach((key) => {\n interceptors[key] = options.interceptors[key];\n });\n }\n\n if (options.config) {\n merge(config, options.config);\n }\n\n if (has(options, 'payloadTransformer.predicates')) {\n config.payloadTransformer.predicates = config.payloadTransformer.predicates.concat(\n get(options, 'payloadTransformer.predicates')\n );\n }\n\n if (has(options, 'payloadTransformer.transforms')) {\n config.payloadTransformer.transforms = config.payloadTransformer.transforms.concat(\n get(options, 'payloadTransformer.transforms')\n );\n }\n\n if (options.onBeforeLogout) {\n config.onBeforeLogout = config.onBeforeLogout || [];\n const onBeforeLogout = isArray(options.onBeforeLogout)\n ? options.onBeforeLogout\n : [options.onBeforeLogout];\n\n onBeforeLogout.forEach((fn) =>\n config.onBeforeLogout.push({\n plugin: name,\n fn,\n })\n );\n }\n\n // Only mess with the plugin's derived properties if it's an amp-state plugin\n if (constructor.prototype._definition && constructor.prototype._definition.ready) {\n const {fn, depList} = State.prototype._derived.ready;\n const def = {\n deps: depList.concat(`${name}.ready`),\n fn,\n };\n\n createDerivedProperty(State.prototype, 'ready', def);\n }\n };\n\n return State;\n}\n\n/**\n * Extracted from ampersand-state\n * @param {Object} modelProto\n * @param {string} name\n * @param {Object} definition\n * @private\n * @returns {undefined}\n */\nfunction createDerivedProperty(modelProto, name, definition) {\n const def = (modelProto._derived[name] = {\n fn: isFunction(definition) ? definition : definition.fn,\n cache: definition.cache !== false,\n depList: definition.deps || [],\n });\n\n // add to our shared dependency list\n def.depList.forEach((dep) => {\n modelProto._deps[dep] = union(modelProto._deps[dep] || [], [name]);\n });\n\n // defined a top-level getter for derived names\n Reflect.defineProperty(modelProto, name, {\n get() {\n return this._getDerivedProperty(name);\n },\n set() {\n throw new TypeError(`\\`${name}\\` is a derived property, it can't be set directly.`);\n },\n });\n}\n"],"mappings":";;;;;;;;;;AAIA,IAAAA,OAAA,GAAAC,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,6BAA6BA,CAACC,KAAK,EAAEC,MAAM,EAAEC,YAAY,EAAE;EACjF;EACAF,KAAK,CAACG,cAAc,GAAG,SAASA,cAAcA,CAACC,IAAI,EAAEC,WAAW,EAAgB;IAAA,IAAdC,OAAO,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;IAC5E,IAAIP,KAAK,CAACU,SAAS,CAACC,SAAS,CAACP,IAAI,CAAC,IAAI,CAACE,OAAO,CAACM,OAAO,EAAE;MACvD;IACF;IAEAZ,KAAK,CAACU,SAAS,CAACC,SAAS,CAACP,IAAI,CAAC,GAAGC,WAAW;IAE7C,IAAIC,OAAO,CAACO,OAAO,EAAE;MACnB,MAAM,IAAIC,KAAK,CAAC,yDAAyD,CAAC;IAC5E;IAEA,IAAIR,OAAO,CAACJ,YAAY,EAAE;MACxB,IAAAa,KAAA,CAAAC,OAAA,EAAYV,OAAO,CAACJ,YAAY,CAAC,CAACe,OAAO,CAAC,UAACC,GAAG,EAAK;QACjDhB,YAAY,CAACgB,GAAG,CAAC,GAAGZ,OAAO,CAACJ,YAAY,CAACgB,GAAG,CAAC;MAC/C,CAAC,CAAC;IACJ;IAEA,IAAIZ,OAAO,CAACL,MAAM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AAMC,GAAG,GAAG;QACVC,IAAI,EAAEF,OAAO,CAACZ,MAAM,IAAAA,MAAA,CAAInB,IAAI,WAAQ,CAAC;QACrCwB,EAAE,EAAFA;MACF,CAAC;MAEDU,qBAAqB,CAACtC,KAAK,CAACU,SAAS,EAAE,OAAO,EAAE0B,GAAG,CAAC;IACtD;EACF,CAAC;EAED,OAAOpC,KAAK;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASsC,qBAAqBA,CAACC,UAAU,EAAEnC,IAAI,EAAEoC,UAAU,EAAE;EAC3D,IAAMJ,GAAG,GAAIG,UAAU,CAACL,QAAQ,CAAC9B,IAAI,CAAC,GAAG;IACvCwB,EAAE,EAAE,IAAAa,kBAAU,EAACD,UAAU,CAAC,GAAGA,UAAU,GAAGA,UAAU,CAACZ,EAAE;IACvDc,KAAK,EAAEF,UAAU,CAACE,KAAK,KAAK,KAAK;IACjCP,OAAO,EAAEK,UAAU,CAACH,IAAI,IAAI;EAC9B,CAAE;;EAEF;EACAD,GAAG,CAACD,OAAO,CAAClB,OAAO,CAAC,UAAC0B,GAAG,EAAK;IAC3BJ,UAAU,CAACK,KAAK,CAACD,GAAG,CAAC,GAAG,IAAAE,aAAK,EAACN,UAAU,CAACK,KAAK,CAACD,GAAG,CAAC,IAAI,EAAE,EAAE,CAACvC,IAAI,CAAC,CAAC;EACpE,CAAC,CAAC;;EAEF;EACA,IAAA0C,eAAA,CAAA9B,OAAA,EAAuBuB,UAAU,EAAEnC,IAAI,EAAE;IACvCoB,GAAG,
|
|
1
|
+
{"version":3,"names":["_lodash","require","mixinWebexInternalCorePlugins","State","config","interceptors","registerPlugin","name","constructor","options","arguments","length","undefined","prototype","_children","replace","proxies","Error","_keys","default","forEach","key","merge","has","payloadTransformer","predicates","concat","get","transforms","onBeforeLogout","isArray","fn","push","plugin","_definition","ready","_State$prototype$_der","_derived","depList","def","deps","createDerivedProperty","modelProto","definition","isFunction","cache","dep","_deps","union","_defineProperty","_getDerivedProperty","set","TypeError"],"sources":["webex-internal-core-plugin-mixin.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {get, has, isArray, isFunction, merge, union} from 'lodash';\n\n/**\n * Mixes a plugin system into an AmpState object (specifically, into WebexCore)\n * @param {AmpState} State\n * @param {Object} config\n * @param {Object} interceptors\n * @returns {AmpState}\n */\nexport default function mixinWebexInternalCorePlugins(State, config, interceptors) {\n // eslint-disable-next-line complexity\n State.registerPlugin = function registerPlugin(name, constructor, options = {}) {\n if (State.prototype._children[name] && !options.replace) {\n return;\n }\n\n State.prototype._children[name] = constructor;\n\n if (options.proxies) {\n throw new Error('Proxies are not currently supported for private plugins');\n }\n\n if (options.interceptors) {\n Object.keys(options.interceptors).forEach((key) => {\n interceptors[key] = options.interceptors[key];\n });\n }\n\n if (options.config) {\n merge(config, options.config);\n }\n\n if (has(options, 'payloadTransformer.predicates')) {\n config.payloadTransformer.predicates = config.payloadTransformer.predicates.concat(\n get(options, 'payloadTransformer.predicates')\n );\n }\n\n if (has(options, 'payloadTransformer.transforms')) {\n config.payloadTransformer.transforms = config.payloadTransformer.transforms.concat(\n get(options, 'payloadTransformer.transforms')\n );\n }\n\n if (options.onBeforeLogout) {\n config.onBeforeLogout = config.onBeforeLogout || [];\n const onBeforeLogout = isArray(options.onBeforeLogout)\n ? options.onBeforeLogout\n : [options.onBeforeLogout];\n\n onBeforeLogout.forEach((fn) =>\n config.onBeforeLogout.push({\n plugin: name,\n fn,\n })\n );\n }\n\n // Only mess with the plugin's derived properties if it's an amp-state plugin\n if (constructor.prototype._definition && constructor.prototype._definition.ready) {\n const {fn, depList} = State.prototype._derived.ready;\n const def = {\n deps: depList.concat(`${name}.ready`),\n fn,\n };\n\n createDerivedProperty(State.prototype, 'ready', def);\n }\n };\n\n return State;\n}\n\n/**\n * Extracted from ampersand-state\n * @param {Object} modelProto\n * @param {string} name\n * @param {Object} definition\n * @private\n * @returns {undefined}\n */\nfunction createDerivedProperty(modelProto, name, definition) {\n const def = (modelProto._derived[name] = {\n fn: isFunction(definition) ? definition : definition.fn,\n cache: definition.cache !== false,\n depList: definition.deps || [],\n });\n\n // add to our shared dependency list\n def.depList.forEach((dep) => {\n modelProto._deps[dep] = union(modelProto._deps[dep] || [], [name]);\n });\n\n // defined a top-level getter for derived names\n Reflect.defineProperty(modelProto, name, {\n get() {\n return this._getDerivedProperty(name);\n },\n set() {\n throw new TypeError(`\\`${name}\\` is a derived property, it can't be set directly.`);\n },\n });\n}\n"],"mappings":";;;;;;;;;;AAIA,IAAAA,OAAA,GAAAC,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,6BAA6BA,CAACC,KAAK,EAAEC,MAAM,EAAEC,YAAY,EAAE;EACjF;EACAF,KAAK,CAACG,cAAc,GAAG,SAASA,cAAcA,CAACC,IAAI,EAAEC,WAAW,EAAgB;IAAA,IAAdC,OAAO,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;IAC5E,IAAIP,KAAK,CAACU,SAAS,CAACC,SAAS,CAACP,IAAI,CAAC,IAAI,CAACE,OAAO,CAACM,OAAO,EAAE;MACvD;IACF;IAEAZ,KAAK,CAACU,SAAS,CAACC,SAAS,CAACP,IAAI,CAAC,GAAGC,WAAW;IAE7C,IAAIC,OAAO,CAACO,OAAO,EAAE;MACnB,MAAM,IAAIC,KAAK,CAAC,yDAAyD,CAAC;IAC5E;IAEA,IAAIR,OAAO,CAACJ,YAAY,EAAE;MACxB,IAAAa,KAAA,CAAAC,OAAA,EAAYV,OAAO,CAACJ,YAAY,CAAC,CAACe,OAAO,CAAC,UAACC,GAAG,EAAK;QACjDhB,YAAY,CAACgB,GAAG,CAAC,GAAGZ,OAAO,CAACJ,YAAY,CAACgB,GAAG,CAAC;MAC/C,CAAC,CAAC;IACJ;IAEA,IAAIZ,OAAO,CAACL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
1
|
-
{"version":3,"names":["_util","_interopRequireDefault","require","_ampersandState","_lodash","_storage","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","_this","_keys","attributes","forEach","key","unset","_children","_collections","reset","initialize","_this2","_len","arguments","length","args","Array","_key","_apply","prototype","_dataTypes","cloneDeep","set","bind","on","model","trigger","concat","inspect","depth","util","omit","serialize","props","request","_this$webex","apply","upload","_this$webex2","when","eventName","_this3","_len2","rest","_key2","_promise","resolve","once","_len3","_key3","_filterSetParameters","value","attrs","isObject","_default","exports"],"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,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,eAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAEA,IAAAG,QAAA,GAAAH,OAAA;AATA;AACA;AACA;;AASA;AACA;AACA;AACA,IAAMI,WAAW,GAAGC,uBAAQ,CAACC,MAAM,CAAC;EAClCC,OAAO,EAAE;IACPC,cAAc,EAAE;MACdC,IAAI,EAAE,EAAE;MACRC,EAAE,WAAAA,GAAA,EAAG;QACH,OAAO,IAAAC,6BAAoB,EAAC,SAAS,EAAE,IAAI,CAAC;MAC9C;IACF,CAAC;IACDC,gBAAgB,EAAE;MAChBH,IAAI,EAAE,EAAE;MACRC,EAAE,WAAAA,GAAA,EAAG;QACH,OAAO,IAAAC,6BAAoB,EAAC,WAAW,EAAE,IAAI,CAAC;MAChD;IACF,CAAC;IACDE,MAAM,EAAE;MACN;MACA;MACAC,KAAK,EAAE,KAAK;MACZL,IAAI,EAAE,CAAC,OAAO,EAAE,cAAc,CAAC;MAC/BC,EAAE,WAAAA,GAAA,EAAG;QACH,IAAI,IAAI,CAACK,KAAK,IAAI,IAAI,CAACA,KAAK,CAACF,MAAM,EAAE;UACnC,IAAMG,SAAS,GAAG,IAAI,CAACC,YAAY,CAAC,CAAC;UAErC,IAAID,SAAS,EAAE;YACb,OAAO,IAAI,CAACD,KAAK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CAAAC,KAAA,QAAA/B,SAAA,CAAA+B,KAAA;IAAA;IACrB,IAAID,IAAI,IAAIA,IAAI,CAAC7B,MAAM,GAAG,CAAC,EAAE;MAC3B,MAAM,IAAIpB,KAAK,CAAC,oEAAoE,CAAC;IACvF;IAEA,OAAO,IAAAmD,QAAA,CAAA/C,OAAA,CAAY,UAACgD,OAAO,EAAK;MAC9BL,MAAI,CAACM,IAAI,CAACP,SAAS,EAAE;QAAA,SAAAQ,KAAA,GAAAnC,SAAA,CAAAC,MAAA,EAAIC,IAAI,OAAAC,KAAA,CAAAgC,KAAA,GAAAC,KAAA,MAAAA,KAAA,GAAAD,KAAA,EAAAC,KAAA;UAAJlC,IAAI,CAAAkC,KAAA,IAAApC,SAAA,CAAAoC,KAAA;QAAA;QAAA,OAAKH,OAAO,CAAC/B,IAAI,CAAC;MAAA,EAAC;IAClD,CAAC,CAAC;EACJ,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEmC,oBAAoB,WAAAA,qBAAC7C,GAAG,EAAE8C,KAAK,EAAEnD,OAAO,EAAE;IACxC,IAAIoD,KAAK;IAET,IAAI,IAAAC,gBAAQ,EAAChD,GAAG,CAAC,IAAIA,GAAG,KAAK,IAAI,EAAE;MACjC+C,KAAK,GAAG/C,GAAG;MACXL,OAAO,GAAGmD,KAAK;IACjB,CAAC,MAAM;MACLC,KAAK,GAAG,CAAC,CAAC;MACVA,KAAK,CAAC/C,GAAG,CAAC,GAAG8C,KAAK;IACpB;IAEAnD,OAAO,GAAGA,OAAO,IAAI,CAAC,CAAC;IAEvB,OAAO,CAACoD,KAAK,EAAEpD,OAAO,CAAC;EACzB;AACF,CAAC,CAAC;AAAC,IAAAsD,QAAA,GAAAC,OAAA,CAAAzD,OAAA,GAEYvB,WAAW"}
|
|
1
|
+
{"version":3,"names":["_util","_interopRequireDefault","require","_ampersandState","_lodash","_storage","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","_this","_keys","attributes","forEach","key","unset","_children","_collections","reset","initialize","_this2","_len","arguments","length","args","Array","_key","_apply","prototype","_dataTypes","cloneDeep","set","bind","on","model","trigger","concat","inspect","depth","util","omit","serialize","props","request","_this$webex","apply","upload","_this$webex2","when","eventName","_this3","_len2","rest","_key2","_promise","resolve","once","_len3","_key3","_filterSetParameters","value","attrs","isObject","_default","exports"],"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,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,eAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAEA,IAAAG,QAAA,GAAAH,OAAA;AATA;AACA;AACA;;AASA;AACA;AACA;AACA,IAAMI,WAAW,GAAGC,uBAAQ,CAACC,MAAM,CAAC;EAClCC,OAAO,EAAE;IACPC,cAAc,EAAE;MACdC,IAAI,EAAE,EAAE;MACRC,EAAE,WAAFA,EAAEA,CAAA,EAAG;QACH,OAAO,IAAAC,6BAAoB,EAAC,SAAS,EAAE,IAAI,CAAC;MAC9C;IACF,CAAC;IACDC,gBAAgB,EAAE;MAChBH,IAAI,EAAE,EAAE;MACRC,EAAE,WAAFA,EAAEA,CAAA,EAAG;QACH,OAAO,IAAAC,6BAAoB,EAAC,WAAW,EAAE,IAAI,CAAC;MAChD;IACF,CAAC;IACDE,MAAM,EAAE;MACN;MACA;MACAC,KAAK,EAAE,KAAK;MACZL,IAAI,EAAE,CAAC,OAAO,EAAE,cAAc,CAAC;MAC/BC,EAAE,WAAFA,EAAEA,CAAA,EAAG;QACH,IAAI,IAAI,CAACK,KAAK,IAAI,IAAI,CAACA,KAAK,CAACF,MAAM,EAAE;UACnC,IAAMG,SAAS,GAAG,IAAI,CAACC,YAAY,CAAC,CAAC;UAErC,IAAID,SAAS,EAAE;YACb,OAAO,IAAI,CAACD,KAAK,CAACF,MAAM,CAACG,SAAS,CAACE,WAAW,CAAC,CAAC,CAAC;UACnD;UAEA,OAAO,IAAI,CAACH,KAAK,CAACF,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IAAA;IACrB,IAAID,IAAI,IAAIA,IAAI,CAAC7B,MAAM,GAAG,CAAC,EAAE;MAC3B,MAAM,IAAIpB,KAAK,CAAC,oEAAoE,CAAC;IACvF;IAEA,OAAO,IAAAmD,QAAA,CAAA/C,OAAA,CAAY,UAACgD,OAAO,EAAK;MAC9BL,MAAI,CAACM,IAAI,CAACP,SAAS,EAAE;QAAA,SAAAQ,KAAA,GAAAnC,SAAA,CAAAC,MAAA,EAAIC,IAAI,OAAAC,KAAA,CAAAgC,KAAA,GAAAC,KAAA,MAAAA,KAAA,GAAAD,KAAA,EAAAC,KAAA;UAAJlC,IAAI,CAAAkC,KAAA,IAAApC,SAAA,CAAAoC,KAAA;QAAA;QAAA,OAAKH,OAAO,CAAC/B,IAAI,CAAC;MAAA,EAAC;IAClD,CAAC,CAAC;EACJ,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEmC,oBAAoB,WAApBA,oBAAoBA,CAAC7C,GAAG,EAAE8C,KAAK,EAAEnD,OAAO,EAAE;IACxC,IAAIoD,KAAK;IAET,IAAI,IAAAC,gBAAQ,EAAChD,GAAG,CAAC,IAAIA,GAAG,KAAK,IAAI,EAAE;MACjC+C,KAAK,GAAG/C,GAAG;MACXL,OAAO,GAAGmD,KAAK;IACjB,CAAC,MAAM;MACLC,KAAK,GAAG,CAAC,CAAC;MACVA,KAAK,CAAC/C,GAAG,CAAC,GAAG8C,KAAK;IACpB;IAEAnD,OAAO,GAAGA,OAAO,IAAI,CAAC,CAAC;IAEvB,OAAO,CAACoD,KAAK,EAAEpD,OAAO,CAAC;EACzB;AACF,CAAC,CAAC;AAAC,IAAAsD,QAAA,GAAAC,OAAA,CAAAzD,OAAA,GAEYvB,WAAW","ignoreList":[]}
|
package/dist/plugins/logger.js
CHANGED
|
@@ -57,7 +57,7 @@ var Logger = _webexPlugin.default.extend({
|
|
|
57
57
|
info: wrapConsoleMethod('info'),
|
|
58
58
|
debug: wrapConsoleMethod('debug'),
|
|
59
59
|
trace: wrapConsoleMethod('trace'),
|
|
60
|
-
version: "
|
|
60
|
+
version: "0.0.0"
|
|
61
61
|
});
|
|
62
62
|
(0, _webexCore.registerPlugin)('logger', Logger);
|
|
63
63
|
var _default = exports.default = Logger;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_webexPlugin","_interopRequireDefault","require","_webexCore","precedence","error","warn","info","debug","trace","wrapConsoleMethod","level","impls","slice","console","pop","wrappedConsoleMethod","_console","_len","arguments","length","args","Array","_key","process","env","NODE_ENV","webex","internal","device","url","unshift","apply","Logger","WebexPlugin","extend","namespace","log","version","registerPlugin","_default","exports","default"],"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',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AAQ,CAACC,MAAM,CAACC,GAAG,CAACjB,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACxD;IACA,CAAAI,QAAA,GAAAH,OAAO,EAACH,KAAK,CAAC,CAAAqB,KAAA,CAAAf,QAAA,EAAII,IAAI,CAAC;EACzB,CAAC;AACH;AAEA,IAAMY,MAAM,GAAGC,oBAAW,CAACC,MAAM,CAAC;EAChCC,SAAS,EAAE,QAAQ;EACnB/B,KAAK,EAAEK,iBAAiB,CAAC,OAAO,CAAC;EACjCJ,IAAI,EAAEI,iBAAiB,CAAC,MAAM,CAAC;EAC/B2B,GAAG,EAAE3B,iBAAiB,CAAC,KAAK,CAAC;EAC7BH,IAAI,EAAEG,iBAAiB,CAAC,MAAM,CAAC;EAC/BF,KAAK,EAAEE,iBAAiB,CAAC,OAAO,CAAC;EACjCD,KAAK,EAAEC,iBAAiB,CAAC,OAAO,CAAC;EAAA4B,OAAA;AACnC,CAAC,CAAC;AAEF,IAAAC,yBAAc,EAAC,QAAQ,EAAEN,MAAM,CAAC;AAAC,IAAAO,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAElBT,MAAM"}
|
|
1
|
+
{"version":3,"names":["_webexPlugin","_interopRequireDefault","require","_webexCore","precedence","error","warn","info","debug","trace","wrapConsoleMethod","level","impls","slice","console","pop","wrappedConsoleMethod","_console","_len","arguments","length","args","Array","_key","process","env","NODE_ENV","webex","internal","device","url","unshift","apply","Logger","WebexPlugin","extend","namespace","log","version","registerPlugin","_default","exports","default"],"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,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIA,IAAME,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,iBAAiBA,CAACC,KAAK,EAAE;EAChC;EACA,IAAIC,KAAK,GAAGR,UAAU,CAACO,KAAK,CAAC;EAE7B,IAAIC,KAAK,EAAE;IACTA,KAAK,GAAGA,KAAK,CAACC,KAAK,CAAC,CAAC;IACrB,OAAO,CAACC,OAAO,CAACH,KAAK,CAAC,EAAE;MACtBA,KAAK,GAAGC,KAAK,CAACG,GAAG,CAAC,CAAC;IACrB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","ignoreList":[]}
|
package/dist/webex-core.js
CHANGED
|
@@ -96,7 +96,7 @@ var MAX_FILE_SIZE_IN_MB = 2048;
|
|
|
96
96
|
* @class
|
|
97
97
|
*/
|
|
98
98
|
var WebexCore = _ampersandState.default.extend((_obj = {
|
|
99
|
-
version: "
|
|
99
|
+
version: "0.0.0",
|
|
100
100
|
children: {
|
|
101
101
|
internal: _webexInternalCore.default
|
|
102
102
|
},
|
|
@@ -314,7 +314,7 @@ var WebexCore = _ampersandState.default.extend((_obj = {
|
|
|
314
314
|
// `this.listenToOnce(parent, 'change:config', () => {});` to act on config
|
|
315
315
|
// during initialization
|
|
316
316
|
this.trigger('change:config');
|
|
317
|
-
var
|
|
317
|
+
var _onLoaded = function onLoaded() {
|
|
318
318
|
if (_this4.loaded) {
|
|
319
319
|
/**
|
|
320
320
|
* Fires when all data has been loaded from the storage layer
|
|
@@ -323,15 +323,15 @@ var WebexCore = _ampersandState.default.extend((_obj = {
|
|
|
323
323
|
* @memberof WebexCore
|
|
324
324
|
*/
|
|
325
325
|
_this4.trigger('loaded');
|
|
326
|
-
_this4.stopListening(_this4, 'change:loaded',
|
|
326
|
+
_this4.stopListening(_this4, 'change:loaded', _onLoaded);
|
|
327
327
|
}
|
|
328
328
|
};
|
|
329
329
|
|
|
330
330
|
// This needs to run on nextTick or we'll never be able to wire up listeners
|
|
331
331
|
process.nextTick(function () {
|
|
332
|
-
_this4.listenToAndRun(_this4, 'change:loaded',
|
|
332
|
+
_this4.listenToAndRun(_this4, 'change:loaded', _onLoaded);
|
|
333
333
|
});
|
|
334
|
-
var
|
|
334
|
+
var _onReady = function onReady() {
|
|
335
335
|
if (_this4.ready) {
|
|
336
336
|
/**
|
|
337
337
|
* Fires when all plugins have fully initialized
|
|
@@ -340,13 +340,13 @@ var WebexCore = _ampersandState.default.extend((_obj = {
|
|
|
340
340
|
* @memberof WebexCore
|
|
341
341
|
*/
|
|
342
342
|
_this4.trigger('ready');
|
|
343
|
-
_this4.stopListening(_this4, 'change:ready',
|
|
343
|
+
_this4.stopListening(_this4, 'change:ready', _onReady);
|
|
344
344
|
}
|
|
345
345
|
};
|
|
346
346
|
|
|
347
347
|
// This needs to run on nextTick or we'll never be able to wire up listeners
|
|
348
348
|
process.nextTick(function () {
|
|
349
|
-
_this4.listenToAndRun(_this4, 'change:ready',
|
|
349
|
+
_this4.listenToAndRun(_this4, 'change:ready', _onReady);
|
|
350
350
|
});
|
|
351
351
|
|
|
352
352
|
// Make nested events propagate in a consistent manner
|
|
@@ -626,15 +626,15 @@ var WebexCore = _ampersandState.default.extend((_obj = {
|
|
|
626
626
|
return promise;
|
|
627
627
|
},
|
|
628
628
|
_uploadPhaseFinalize: function _uploadPhaseFinalize(options) {
|
|
629
|
-
var
|
|
629
|
+
var _this0 = this;
|
|
630
630
|
this.logger.debug('client: finalizing upload session');
|
|
631
631
|
return this.request(options.phases.finalize).then(function (res) {
|
|
632
|
-
|
|
632
|
+
_this0.logger.debug('client: finalized upload session');
|
|
633
633
|
return res;
|
|
634
634
|
});
|
|
635
635
|
}
|
|
636
|
-
}, (
|
|
637
|
-
WebexCore.version = "
|
|
636
|
+
}, (0, _applyDecoratedDescriptor2.default)(_obj, "_uploadPhaseUpload", [_common.retry], (0, _getOwnPropertyDescriptor.default)(_obj, "_uploadPhaseUpload"), _obj), _obj));
|
|
637
|
+
WebexCore.version = "0.0.0";
|
|
638
638
|
(0, _webexInternalCorePluginMixin.default)(_webexInternalCore.default, _config.default, interceptors);
|
|
639
639
|
(0, _webexCorePluginMixin.default)(WebexCore, _config.default, interceptors);
|
|
640
640
|
var _default = exports.default = WebexCore;
|