@webex/webex-core 3.8.1 → 3.9.0-multipleLLM.1

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.
Files changed (89) hide show
  1. package/README.md +87 -27
  2. package/dist/index.js +16 -33
  3. package/dist/index.js.map +1 -1
  4. package/dist/{lib/services/interceptors/hostmap.js → interceptors/proxy.js} +58 -25
  5. package/dist/interceptors/proxy.js.map +1 -0
  6. package/dist/lib/batcher.js +1 -1
  7. package/dist/lib/constants.js +10 -1
  8. package/dist/lib/constants.js.map +1 -1
  9. package/dist/lib/credentials/credentials.js +1 -1
  10. package/dist/lib/credentials/token.js +1 -1
  11. package/dist/lib/{services-v2/interceptors → interceptors}/server-error.js +1 -1
  12. package/dist/lib/interceptors/server-error.js.map +1 -0
  13. package/dist/lib/services/index.js +2 -29
  14. package/dist/lib/services/index.js.map +1 -1
  15. package/dist/lib/services/service-host.js +1 -1
  16. package/dist/lib/services/service-host.js.map +1 -1
  17. package/dist/lib/services/service-registry.js +1 -1
  18. package/dist/lib/services/service-registry.js.map +1 -1
  19. package/dist/lib/services/service-state.js +1 -1
  20. package/dist/lib/services/service-state.js.map +1 -1
  21. package/dist/lib/services/services.js +3 -3
  22. package/dist/lib/services/services.js.map +1 -1
  23. package/dist/lib/services-v2/index.js +0 -29
  24. package/dist/lib/services-v2/index.js.map +1 -1
  25. package/dist/lib/services-v2/metrics.js.map +1 -1
  26. package/dist/lib/services-v2/service-catalog.js +11 -10
  27. package/dist/lib/services-v2/service-catalog.js.map +1 -1
  28. package/dist/lib/services-v2/services-v2.js +56 -67
  29. package/dist/lib/services-v2/services-v2.js.map +1 -1
  30. package/dist/lib/services-v2/types.js.map +1 -1
  31. package/dist/plugins/logger.js +1 -1
  32. package/dist/webex-core.js +53 -60
  33. package/dist/webex-core.js.map +1 -1
  34. package/package.json +13 -13
  35. package/src/index.js +6 -14
  36. package/src/interceptors/proxy.js +70 -0
  37. package/src/lib/constants.js +29 -1
  38. package/src/lib/{services/interceptors → interceptors}/server-error.js +1 -1
  39. package/src/lib/services/index.js +2 -7
  40. package/src/lib/services/service-host.js +1 -1
  41. package/src/lib/services/service-registry.js +1 -1
  42. package/src/lib/services/service-state.js +1 -1
  43. package/src/lib/services/services.js +2 -2
  44. package/src/lib/services-v2/index.ts +0 -16
  45. package/src/lib/services-v2/service-catalog.ts +20 -19
  46. package/src/lib/services-v2/{services-v2.js → services-v2.ts} +116 -94
  47. package/src/lib/services-v2/types.ts +62 -2
  48. package/src/webex-core.js +12 -3
  49. package/test/fixtures/host-catalog-v2.ts +30 -122
  50. package/test/integration/spec/services/services.js +11 -0
  51. package/test/integration/spec/services-v2/service-catalog.js +664 -0
  52. package/test/integration/spec/services-v2/services-v2.js +1061 -0
  53. package/test/unit/spec/interceptors/proxy.js +73 -0
  54. package/test/unit/spec/services-v2/service-detail.ts +1 -1
  55. package/test/unit/spec/services-v2/services-v2.ts +390 -436
  56. package/test/unit/spec/webex-core.js +62 -2
  57. package/dist/lib/services/constants.js +0 -17
  58. package/dist/lib/services/constants.js.map +0 -1
  59. package/dist/lib/services/interceptors/hostmap.js.map +0 -1
  60. package/dist/lib/services/interceptors/server-error.js +0 -77
  61. package/dist/lib/services/interceptors/server-error.js.map +0 -1
  62. package/dist/lib/services/interceptors/service.js +0 -137
  63. package/dist/lib/services/interceptors/service.js.map +0 -1
  64. package/dist/lib/services-v2/constants.js +0 -17
  65. package/dist/lib/services-v2/constants.js.map +0 -1
  66. package/dist/lib/services-v2/interceptors/server-error.js.map +0 -1
  67. package/dist/lib/services-v2/service-host.js +0 -300
  68. package/dist/lib/services-v2/service-host.js.map +0 -1
  69. package/dist/lib/services-v2/service-registry.js +0 -534
  70. package/dist/lib/services-v2/service-registry.js.map +0 -1
  71. package/dist/lib/services-v2/service-state.js +0 -97
  72. package/dist/lib/services-v2/service-state.js.map +0 -1
  73. package/dist/lib/services-v2/service-url.js +0 -119
  74. package/dist/lib/services-v2/service-url.js.map +0 -1
  75. package/src/lib/services/constants.js +0 -21
  76. package/src/lib/services/interceptors/hostmap.js +0 -36
  77. package/src/lib/services/interceptors/service.js +0 -101
  78. package/src/lib/services-v2/constants.ts +0 -21
  79. package/src/lib/services-v2/interceptors/server-error.js +0 -48
  80. /package/dist/lib/{services-v2/interceptors → interceptors}/hostmap.js +0 -0
  81. /package/dist/lib/{services-v2/interceptors → interceptors}/hostmap.js.map +0 -0
  82. /package/dist/lib/{services-v2/interceptors → interceptors}/service.js +0 -0
  83. /package/dist/lib/{services-v2/interceptors → interceptors}/service.js.map +0 -0
  84. /package/dist/lib/{services/metrics.js → metrics.js} +0 -0
  85. /package/dist/lib/{services/metrics.js.map → metrics.js.map} +0 -0
  86. /package/src/lib/{services-v2/interceptors → interceptors}/hostmap.js +0 -0
  87. /package/src/lib/{services-v2/interceptors → interceptors}/service.js +0 -0
  88. /package/src/lib/{services-v2/metrics.js → metrics.js} +0 -0
  89. /package/src/lib/{services/metrics.js → services-v2/metrics.ts} +0 -0
@@ -2,6 +2,7 @@
2
2
  * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
3
3
  */
4
4
 
5
+ import {EventEmitter} from 'events';
5
6
  import {assert} from '@webex/test-helper-chai';
6
7
  import sinon from 'sinon';
7
8
  import WebexCore, {
@@ -13,6 +14,7 @@ import WebexCore, {
13
14
  } from '@webex/webex-core';
14
15
  import {set} from 'lodash';
15
16
  import {version} from '@webex/webex-core/package';
17
+ import {proxyEvents} from '@webex/common/src/events';
16
18
  // TODO: fix circular dependency core->metrics->core https://jira-eng-gpk2.cisco.com/jira/browse/SPARK-515520
17
19
  require('@webex/internal-plugin-metrics');
18
20
 
@@ -177,11 +179,11 @@ describe('Webex', () => {
177
179
 
178
180
  describe('initializes with interceptors', () => {
179
181
  [
180
- // 4 pre, 4 post, 9 remaining default = 17
182
+ // 4 pre, 4 post, 10 remaining default = 18
181
183
  [
182
184
  'defaults to existing interceptors if undefined',
183
185
  undefined,
184
- 17,
186
+ 18,
185
187
  [
186
188
  'RequestTimingInterceptor',
187
189
  'RequestEventInterceptor',
@@ -189,6 +191,7 @@ describe('Webex', () => {
189
191
  'RateLimitInterceptor',
190
192
  'ServiceInterceptor',
191
193
  'UserAgentInterceptor',
194
+ 'ProxyInterceptor',
192
195
  'WebexUserAgentInterceptor',
193
196
  'AuthInterceptor',
194
197
  'PayloadTransformerInterceptor',
@@ -263,6 +266,63 @@ describe('Webex', () => {
263
266
  });
264
267
  });
265
268
 
269
+ describe('#upload()', () => {
270
+ it('rejects when no object is specified', () => {
271
+ return webex.upload().catch((err) => {
272
+ assert.equal(err.message, '`options.file` is required');
273
+ });
274
+ });
275
+
276
+ it('rejects when no file is specified', () => {
277
+ return webex.upload({}).catch((err) => {
278
+ assert.equal(err.message, '`options.file` is required');
279
+ });
280
+ });
281
+
282
+ it('passes through progress events to caller', () => {
283
+ const uploadEventEmitter = new EventEmitter();
284
+
285
+ webex._uploadPhaseInitialize = sinon.stub().callsFake(() => {
286
+ return Promise.resolve();
287
+ });
288
+ webex._uploadPhaseUpload = sinon.stub().callsFake(() => {
289
+ const promise = Promise.resolve();
290
+
291
+ proxyEvents(uploadEventEmitter, promise);
292
+
293
+ return promise;
294
+ });
295
+ webex._uploadPhaseFinalize = sinon.stub().callsFake(() => {
296
+ return Promise.resolve({
297
+ body: {
298
+ url: 'https://example.com/download',
299
+ },
300
+ headers: {
301
+ 'Content-Type': 'image/png',
302
+ },
303
+ });
304
+ });
305
+
306
+ const uploader = webex.upload({file: {}});
307
+
308
+ assert.isFunction(uploader.on);
309
+
310
+ return uploader.then((res) => {
311
+ const progressStub = sinon.stub();
312
+ uploader.on('progress', progressStub);
313
+
314
+ uploadEventEmitter.emit('progress', {percent: 25});
315
+
316
+ assert.isTrue(progressStub.calledOnce);
317
+ assert.isTrue(webex._uploadPhaseInitialize.calledOnce);
318
+ assert.isTrue(webex._uploadPhaseUpload.calledOnce);
319
+ assert.isTrue(webex._uploadPhaseFinalize.calledOnce);
320
+ assert.equal(res.url, 'https://example.com/download');
321
+ assert.equal(res['Content-Type'], 'image/png');
322
+ });
323
+ });
324
+ });
325
+
266
326
  it('emits the `loaded` event when the storage layer has loaded all data', () => {
267
327
  // I'd love to do this with mock webex, or at least, a mock plugin, but I
268
328
  // couldn't get it to work. We do get better coverage this way, but it means
@@ -1,17 +0,0 @@
1
- "use strict";
2
-
3
- var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
4
- _Object$defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.SERVICE_CATALOGS_ENUM_TYPES = exports.SERVICE_CATALOGS = exports.NAMESPACE = exports.COMMERCIAL_ALLOWED_DOMAINS = void 0;
8
- var NAMESPACE = exports.NAMESPACE = 'services';
9
- var SERVICE_CATALOGS = exports.SERVICE_CATALOGS = ['discovery', 'limited', 'signin', 'postauth', 'custom'];
10
- var SERVICE_CATALOGS_ENUM_TYPES = exports.SERVICE_CATALOGS_ENUM_TYPES = {
11
- STRING: 'SERVICE_CATALOGS_ENUM_TYPES_STRING',
12
- NUMBER: 'SERVICE_CATALOGS_ENUM_TYPES_NUMBER'
13
- };
14
-
15
- // The default allowed domains that SDK can make requests to outside of service catalog
16
- var COMMERCIAL_ALLOWED_DOMAINS = exports.COMMERCIAL_ALLOWED_DOMAINS = ['wbx2.com', 'ciscospark.com', 'webex.com', 'webexapis.com', 'broadcloudpbx.com', 'broadcloud.eu', 'broadcloud.com.au', 'broadcloudpbx.net'];
17
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["NAMESPACE","exports","SERVICE_CATALOGS","SERVICE_CATALOGS_ENUM_TYPES","STRING","NUMBER","COMMERCIAL_ALLOWED_DOMAINS"],"sources":["constants.js"],"sourcesContent":["const NAMESPACE = 'services';\nconst SERVICE_CATALOGS = ['discovery', 'limited', 'signin', 'postauth', 'custom'];\n\nconst SERVICE_CATALOGS_ENUM_TYPES = {\n STRING: 'SERVICE_CATALOGS_ENUM_TYPES_STRING',\n NUMBER: 'SERVICE_CATALOGS_ENUM_TYPES_NUMBER',\n};\n\n// The default allowed domains that SDK can make requests to outside of service catalog\nconst COMMERCIAL_ALLOWED_DOMAINS = [\n 'wbx2.com',\n 'ciscospark.com',\n 'webex.com',\n 'webexapis.com',\n 'broadcloudpbx.com',\n 'broadcloud.eu',\n 'broadcloud.com.au',\n 'broadcloudpbx.net',\n];\n\nexport {SERVICE_CATALOGS_ENUM_TYPES, NAMESPACE, SERVICE_CATALOGS, COMMERCIAL_ALLOWED_DOMAINS};\n"],"mappings":";;;;;;;AAAA,IAAMA,SAAS,GAAAC,OAAA,CAAAD,SAAA,GAAG,UAAU;AAC5B,IAAME,gBAAgB,GAAAD,OAAA,CAAAC,gBAAA,GAAG,CAAC,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,CAAC;AAEjF,IAAMC,2BAA2B,GAAAF,OAAA,CAAAE,2BAAA,GAAG;EAClCC,MAAM,EAAE,oCAAoC;EAC5CC,MAAM,EAAE;AACV,CAAC;;AAED;AACA,IAAMC,0BAA0B,GAAAL,OAAA,CAAAK,0BAAA,GAAG,CACjC,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,mBAAmB,EACnB,mBAAmB,CACpB"}
@@ -1 +0,0 @@
1
- {"version":3,"names":["_httpCore","require","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf2","default","result","NewTarget","constructor","_Reflect$construct","arguments","apply","_possibleConstructorReturn2","Reflect","sham","Proxy","Boolean","prototype","valueOf","call","e","HostMapInterceptor","exports","_Interceptor","_inherits2","_super","_classCallCheck2","_createClass2","key","value","onRequest","options","uri","webex","internal","services","replaceHostFromHostmap","error","create","Interceptor"],"sources":["hostmap.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2024 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {Interceptor} from '@webex/http-core';\n\n/**\n * This interceptor replaces the host in the request uri with the host from the hostmap\n * It will attempt to do this for every request, but not all URIs will be in the hostmap\n * URIs with hosts that are not in the hostmap will be left unchanged\n */\nexport default class HostMapInterceptor extends Interceptor {\n /**\n * @returns {HostMapInterceptor}\n */\n static create() {\n return new HostMapInterceptor({webex: this});\n }\n\n /**\n * @see Interceptor#onRequest\n * @param {Object} options\n * @returns {Object}\n */\n onRequest(options) {\n if (options.uri) {\n try {\n options.uri = this.webex.internal.services.replaceHostFromHostmap(options.uri);\n } catch (error) {\n /* empty */\n }\n }\n\n return options;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAIA,IAAAA,SAAA,GAAAC,OAAA;AAA6C,SAAAC,aAAAC,OAAA,QAAAC,yBAAA,GAAAC,yBAAA,oBAAAC,qBAAA,QAAAC,KAAA,OAAAC,gBAAA,CAAAC,OAAA,EAAAN,OAAA,GAAAO,MAAA,MAAAN,yBAAA,QAAAO,SAAA,OAAAH,gBAAA,CAAAC,OAAA,QAAAG,WAAA,EAAAF,MAAA,GAAAG,kBAAA,CAAAN,KAAA,EAAAO,SAAA,EAAAH,SAAA,YAAAD,MAAA,GAAAH,KAAA,CAAAQ,KAAA,OAAAD,SAAA,gBAAAE,2BAAA,CAAAP,OAAA,QAAAC,MAAA;AAAA,SAAAL,0BAAA,eAAAY,OAAA,qBAAAJ,kBAAA,oBAAAA,kBAAA,CAAAK,IAAA,2BAAAC,KAAA,oCAAAC,OAAA,CAAAC,SAAA,CAAAC,OAAA,CAAAC,IAAA,CAAAV,kBAAA,CAAAO,OAAA,8CAAAI,CAAA,sBAJ7C;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AAJA,IAKqBC,kBAAkB,GAAAC,OAAA,CAAAjB,OAAA,0BAAAkB,YAAA;EAAA,IAAAC,UAAA,CAAAnB,OAAA,EAAAgB,kBAAA,EAAAE,YAAA;EAAA,IAAAE,MAAA,GAAA3B,YAAA,CAAAuB,kBAAA;EAAA,SAAAA,mBAAA;IAAA,IAAAK,gBAAA,CAAArB,OAAA,QAAAgB,kBAAA;IAAA,OAAAI,MAAA,CAAAd,KAAA,OAAAD,SAAA;EAAA;EAAA,IAAAiB,aAAA,CAAAtB,OAAA,EAAAgB,kBAAA;IAAAO,GAAA;IAAAC,KAAA;IAQrC;AACF;AACA;AACA;AACA;IACE,SAAAC,UAAUC,OAAO,EAAE;MACjB,IAAIA,OAAO,CAACC,GAAG,EAAE;QACf,IAAI;UACFD,OAAO,CAACC,GAAG,GAAG,IAAI,CAACC,KAAK,CAACC,QAAQ,CAACC,QAAQ,CAACC,sBAAsB,CAACL,OAAO,CAACC,GAAG,CAAC;QAChF,CAAC,CAAC,OAAOK,KAAK,EAAE;UACd;QAAA;MAEJ;MAEA,OAAON,OAAO;IAChB;EAAC;IAAAH,GAAA;IAAAC,KAAA;IAtBD;AACF;AACA;IACE,SAAAS,OAAA,EAAgB;MACd,OAAO,IAAIjB,kBAAkB,CAAC;QAACY,KAAK,EAAE;MAAI,CAAC,CAAC;IAC9C;EAAC;EAAA,OAAAZ,kBAAA;AAAA,EAN6CkB,qBAAW"}
@@ -1,77 +0,0 @@
1
- "use strict";
2
-
3
- var _Reflect$construct = require("@babel/runtime-corejs2/core-js/reflect/construct");
4
- var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
5
- var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
6
- _Object$defineProperty(exports, "__esModule", {
7
- value: true
8
- });
9
- exports.default = void 0;
10
- var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
11
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
12
- var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
13
- var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/inherits"));
14
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/possibleConstructorReturn"));
15
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/getPrototypeOf"));
16
- var _httpCore = require("@webex/http-core");
17
- var _webexHttpError = _interopRequireDefault(require("../../webex-http-error"));
18
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
19
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /*!
20
- * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
21
- */
22
- /**
23
- * Changes server url when it fails
24
- */
25
- var ServerErrorInterceptor = exports.default = /*#__PURE__*/function (_Interceptor) {
26
- (0, _inherits2.default)(ServerErrorInterceptor, _Interceptor);
27
- var _super = _createSuper(ServerErrorInterceptor);
28
- function ServerErrorInterceptor() {
29
- (0, _classCallCheck2.default)(this, ServerErrorInterceptor);
30
- return _super.apply(this, arguments);
31
- }
32
- (0, _createClass2.default)(ServerErrorInterceptor, [{
33
- key: "onResponseError",
34
- value:
35
- /**
36
- * @see Interceptor#onResponseError
37
- * @param {Object} options
38
- * @param {Object} reason
39
- * @returns {Object}
40
- */
41
- function onResponseError(options, reason) {
42
- if ((reason instanceof _webexHttpError.default.InternalServerError || reason instanceof _webexHttpError.default.BadGateway || reason instanceof _webexHttpError.default.ServiceUnavailable) && options.uri) {
43
- var feature = this.webex.internal.device.features.developer.get('web-high-availability');
44
- if (feature && feature.value) {
45
- this.webex.internal.metrics.submitClientMetrics('web-ha', {
46
- fields: {
47
- success: false
48
- },
49
- tags: {
50
- action: 'failed',
51
- error: reason.message,
52
- url: options.uri
53
- }
54
- });
55
- return _promise.default.resolve(this.webex.internal.services.markFailedUrl(options.uri)).then(function () {
56
- return _promise.default.reject(reason);
57
- });
58
- }
59
- }
60
- return _promise.default.reject(reason);
61
- }
62
- }], [{
63
- key: "create",
64
- value:
65
- /**
66
- * @returns {HAMessagingInterceptor}
67
- */
68
- function create() {
69
- // eslint-disable-next-line no-invalid-this
70
- return new ServerErrorInterceptor({
71
- webex: this
72
- });
73
- }
74
- }]);
75
- return ServerErrorInterceptor;
76
- }(_httpCore.Interceptor);
77
- //# sourceMappingURL=server-error.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_httpCore","require","_webexHttpError","_interopRequireDefault","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf2","default","result","NewTarget","constructor","_Reflect$construct","arguments","apply","_possibleConstructorReturn2","Reflect","sham","Proxy","Boolean","prototype","valueOf","call","e","ServerErrorInterceptor","exports","_Interceptor","_inherits2","_super","_classCallCheck2","_createClass2","key","value","onResponseError","options","reason","WebexHttpError","InternalServerError","BadGateway","ServiceUnavailable","uri","feature","webex","internal","device","features","developer","get","metrics","submitClientMetrics","fields","success","tags","action","error","message","url","_promise","resolve","services","markFailedUrl","then","reject","create","Interceptor"],"sources":["server-error.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {Interceptor} from '@webex/http-core';\nimport WebexHttpError from '../../webex-http-error';\n/**\n * Changes server url when it fails\n */\nexport default class ServerErrorInterceptor extends Interceptor {\n /**\n * @returns {HAMessagingInterceptor}\n */\n static create() {\n // eslint-disable-next-line no-invalid-this\n return new ServerErrorInterceptor({webex: this});\n }\n\n /**\n * @see Interceptor#onResponseError\n * @param {Object} options\n * @param {Object} reason\n * @returns {Object}\n */\n onResponseError(options, reason) {\n if (\n (reason instanceof WebexHttpError.InternalServerError ||\n reason instanceof WebexHttpError.BadGateway ||\n reason instanceof WebexHttpError.ServiceUnavailable) &&\n options.uri\n ) {\n const feature = this.webex.internal.device.features.developer.get('web-high-availability');\n\n if (feature && feature.value) {\n this.webex.internal.metrics.submitClientMetrics('web-ha', {\n fields: {success: false},\n tags: {action: 'failed', error: reason.message, url: options.uri},\n });\n\n return Promise.resolve(this.webex.internal.services.markFailedUrl(options.uri)).then(() =>\n Promise.reject(reason)\n );\n }\n }\n\n return Promise.reject(reason);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAIA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAoD,SAAAG,aAAAC,OAAA,QAAAC,yBAAA,GAAAC,yBAAA,oBAAAC,qBAAA,QAAAC,KAAA,OAAAC,gBAAA,CAAAC,OAAA,EAAAN,OAAA,GAAAO,MAAA,MAAAN,yBAAA,QAAAO,SAAA,OAAAH,gBAAA,CAAAC,OAAA,QAAAG,WAAA,EAAAF,MAAA,GAAAG,kBAAA,CAAAN,KAAA,EAAAO,SAAA,EAAAH,SAAA,YAAAD,MAAA,GAAAH,KAAA,CAAAQ,KAAA,OAAAD,SAAA,gBAAAE,2BAAA,CAAAP,OAAA,QAAAC,MAAA;AAAA,SAAAL,0BAAA,eAAAY,OAAA,qBAAAJ,kBAAA,oBAAAA,kBAAA,CAAAK,IAAA,2BAAAC,KAAA,oCAAAC,OAAA,CAAAC,SAAA,CAAAC,OAAA,CAAAC,IAAA,CAAAV,kBAAA,CAAAO,OAAA,8CAAAI,CAAA,sBALpD;AACA;AACA;AAIA;AACA;AACA;AAFA,IAGqBC,sBAAsB,GAAAC,OAAA,CAAAjB,OAAA,0BAAAkB,YAAA;EAAA,IAAAC,UAAA,CAAAnB,OAAA,EAAAgB,sBAAA,EAAAE,YAAA;EAAA,IAAAE,MAAA,GAAA3B,YAAA,CAAAuB,sBAAA;EAAA,SAAAA,uBAAA;IAAA,IAAAK,gBAAA,CAAArB,OAAA,QAAAgB,sBAAA;IAAA,O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,EAAgB;MACd;MACA,OAAO,IAAIvC,sBAAsB,CAAC;QAACkB,KAAK,EAAE;MAAI,CAAC,CAAC;IAClD;EAAC;EAAA,OAAAlB,sBAAA;AAAA,EAPiDwC,qBAAW"}
@@ -1,137 +0,0 @@
1
- "use strict";
2
-
3
- var _Reflect$construct = require("@babel/runtime-corejs2/core-js/reflect/construct");
4
- var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
5
- var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
6
- _Object$defineProperty(exports, "__esModule", {
7
- value: true
8
- });
9
- exports.default = void 0;
10
- var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
11
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
12
- var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
13
- var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/inherits"));
14
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/possibleConstructorReturn"));
15
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/getPrototypeOf"));
16
- var _httpCore = require("@webex/http-core");
17
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
18
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /*!
19
- * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
20
- */
21
- var trailingSlashes = /(?:^\/)|(?:\/$)/;
22
-
23
- /**
24
- * @class
25
- */
26
- var ServiceInterceptor = exports.default = /*#__PURE__*/function (_Interceptor) {
27
- (0, _inherits2.default)(ServiceInterceptor, _Interceptor);
28
- var _super = _createSuper(ServiceInterceptor);
29
- function ServiceInterceptor() {
30
- (0, _classCallCheck2.default)(this, ServiceInterceptor);
31
- return _super.apply(this, arguments);
32
- }
33
- (0, _createClass2.default)(ServiceInterceptor, [{
34
- key: "onRequest",
35
- value: /* eslint-disable no-param-reassign */
36
- /**
37
- * @see Interceptor#onRequest
38
- * @param {Object} options - The request PTO.
39
- * @returns {Object} - The mutated request PTO.
40
- */
41
- function onRequest(options) {
42
- var _this = this;
43
- // Validate that the PTO includes a uri property.
44
- if (options.uri) {
45
- return options;
46
- }
47
-
48
- // Normalize and validate the PTO.
49
- this.normalizeOptions(options);
50
- this.validateOptions(options);
51
-
52
- // Destructure commonly referenced namespaces.
53
- var services = this.webex.internal.services;
54
- var service = options.service,
55
- resource = options.resource,
56
- waitForServiceTimeout = options.waitForServiceTimeout;
57
-
58
- // Attempt to collect the service url.
59
- return services.waitForService({
60
- name: service,
61
- timeout: waitForServiceTimeout
62
- }).then(function (serviceUrl) {
63
- // Generate the combined service url and resource.
64
- options.uri = _this.generateUri(serviceUrl, resource);
65
- return options;
66
- }).catch(function () {
67
- return _promise.default.reject(new Error("service-interceptor: '".concat(service, "' is not a known service")));
68
- });
69
- }
70
-
71
- /* eslint-disable class-methods-use-this */
72
- /**
73
- * Generate a usable request uri string from a service url and a resouce.
74
- *
75
- * @param {string} serviceUrl - The service url.
76
- * @param {string} [resource] - The resouce to be appended to the service url.
77
- * @returns {string} - The combined service url and resource.
78
- */
79
- }, {
80
- key: "generateUri",
81
- value: function generateUri(serviceUrl) {
82
- var resource = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
83
- var formattedService = serviceUrl.replace(trailingSlashes, '');
84
- var formattedResource = resource.replace(trailingSlashes, '');
85
- return "".concat(formattedService, "/").concat(formattedResource);
86
- }
87
-
88
- /**
89
- * Normalizes request options relative to service identification.
90
- *
91
- * @param {Object} options - The request PTO.
92
- * @returns {Object} - The mutated request PTO.
93
- */
94
- }, {
95
- key: "normalizeOptions",
96
- value: function normalizeOptions(options) {
97
- // Validate if the api property is used.
98
- if (options.api) {
99
- // Assign the service property the value of the api property if necessary.
100
- options.service = options.service || options.api;
101
- delete options.api;
102
- }
103
- }
104
-
105
- /**
106
- * Validates that the appropriate options for this interceptor are present.
107
- *
108
- * @param {Object} options - The request PTO.
109
- * @returns {Object} - The mutated request PTO.
110
- */
111
- }, {
112
- key: "validateOptions",
113
- value: function validateOptions(options) {
114
- if (!options.resource) {
115
- throw new Error('a `resource` parameter is required');
116
- }
117
- if (!options.service) {
118
- throw new Error("a valid 'service' parameter is required");
119
- }
120
- }
121
- /* eslint-enable class-methods-use-this, no-param-reassign */
122
- }], [{
123
- key: "create",
124
- value:
125
- /**
126
- * @returns {ServiceInterceptor}
127
- */
128
- function create() {
129
- /* eslint no-invalid-this: [0] */
130
- return new ServiceInterceptor({
131
- webex: this
132
- });
133
- }
134
- }]);
135
- return ServiceInterceptor;
136
- }(_httpCore.Interceptor);
137
- //# sourceMappingURL=service.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_httpCore","require","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf2","default","result","NewTarget","constructor","_Reflect$construct","arguments","apply","_possibleConstructorReturn2","Reflect","sham","Proxy","Boolean","prototype","valueOf","call","e","trailingSlashes","ServiceInterceptor","exports","_Interceptor","_inherits2","_super","_classCallCheck2","_createClass2","key","value","onRequest","options","_this","uri","normalizeOptions","validateOptions","services","webex","internal","service","resource","waitForServiceTimeout","waitForService","name","timeout","then","serviceUrl","generateUri","catch","_promise","reject","Error","concat","length","undefined","formattedService","replace","formattedResource","api","create","Interceptor"],"sources":["service.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {Interceptor} from '@webex/http-core';\n\nconst trailingSlashes = /(?:^\\/)|(?:\\/$)/;\n\n/**\n * @class\n */\nexport default class ServiceInterceptor extends Interceptor {\n /**\n * @returns {ServiceInterceptor}\n */\n static create() {\n /* eslint no-invalid-this: [0] */\n return new ServiceInterceptor({webex: this});\n }\n\n /* eslint-disable no-param-reassign */\n /**\n * @see Interceptor#onRequest\n * @param {Object} options - The request PTO.\n * @returns {Object} - The mutated request PTO.\n */\n onRequest(options) {\n // Validate that the PTO includes a uri property.\n if (options.uri) {\n return options;\n }\n\n // Normalize and validate the PTO.\n this.normalizeOptions(options);\n this.validateOptions(options);\n\n // Destructure commonly referenced namespaces.\n const {services} = this.webex.internal;\n const {service, resource, waitForServiceTimeout} = options;\n\n // Attempt to collect the service url.\n return services\n .waitForService({name: service, timeout: waitForServiceTimeout})\n .then((serviceUrl) => {\n // Generate the combined service url and resource.\n options.uri = this.generateUri(serviceUrl, resource);\n\n return options;\n })\n .catch(() =>\n Promise.reject(new Error(`service-interceptor: '${service}' is not a known service`))\n );\n }\n\n /* eslint-disable class-methods-use-this */\n /**\n * Generate a usable request uri string from a service url and a resouce.\n *\n * @param {string} serviceUrl - The service url.\n * @param {string} [resource] - The resouce to be appended to the service url.\n * @returns {string} - The combined service url and resource.\n */\n generateUri(serviceUrl, resource = '') {\n const formattedService = serviceUrl.replace(trailingSlashes, '');\n const formattedResource = resource.replace(trailingSlashes, '');\n\n return `${formattedService}/${formattedResource}`;\n }\n\n /**\n * Normalizes request options relative to service identification.\n *\n * @param {Object} options - The request PTO.\n * @returns {Object} - The mutated request PTO.\n */\n normalizeOptions(options) {\n // Validate if the api property is used.\n if (options.api) {\n // Assign the service property the value of the api property if necessary.\n options.service = options.service || options.api;\n delete options.api;\n }\n }\n\n /**\n * Validates that the appropriate options for this interceptor are present.\n *\n * @param {Object} options - The request PTO.\n * @returns {Object} - The mutated request PTO.\n */\n validateOptions(options) {\n if (!options.resource) {\n throw new Error('a `resource` parameter is required');\n }\n\n if (!options.service) {\n throw new Error(\"a valid 'service' parameter is required\");\n }\n }\n /* eslint-enable class-methods-use-this, no-param-reassign */\n}\n"],"mappings":";;;;;;;;;;;;;;;AAIA,IAAAA,SAAA,GAAAC,OAAA;AAA6C,SAAAC,aAAAC,OAAA,QAAAC,yBAAA,GAAAC,yBAAA,oBAAAC,qBAAA,QAAAC,KAAA,OAAAC,gBAAA,CAAAC,OAAA,EAAAN,OAAA,GAAAO,MAAA,MAAAN,yBAAA,QAAAO,SAAA,OAAAH,gBAAA,CAAAC,OAAA,QAAAG,WAAA,EAAAF,MAAA,GAAAG,kBAAA,CAAAN,KAAA,EAAAO,SAAA,EAAAH,SAAA,YAAAD,MAAA,GAAAH,KAAA,CAAAQ,KAAA,OAAAD,SAAA,gBAAAE,2BAAA,CAAAP,OAAA,QAAAC,MAAA;AAAA,SAAAL,0BAAA,eAAAY,OAAA,qBAAAJ,kBAAA,oBAAAA,kBAAA,CAAAK,IAAA,2BAAAC,KAAA,oCAAAC,OAAA,CAAAC,SAAA,CAAAC,OAAA,CAAAC,IAAA,CAAAV,kBAAA,CAAAO,OAAA,8CAAAI,CAAA,sBAJ7C;AACA;AACA;AAIA,IAAMC,eAAe,GAAG,iBAAiB;;AAEzC;AACA;AACA;AAFA,IAGqBC,kBAAkB,GAAAC,OAAA,CAAAlB,OAAA,0BAAAmB,YAAA;EAAA,IAAAC,UAAA,CAAApB,OAAA,EAAAiB,kBAAA,EAAAE,YAAA;EAAA,IAAAE,MAAA,GAAA5B,YAAA,CAAAwB,kBAAA;EAAA,SAAAA,mBAAA;IAAA,IAAAK,gBAAA,CAAAtB,OAAA,QAAAiB,kBAAA;IAAA,OAAAI,MAAA,CAAAf,KAAA,OAAAD,SAAA;EAAA;EAAA,IAAAkB,aAAA,CAAAvB,OAAA,EAAAiB,kBAAA;IAAAO,GAAA;IAAAC,KAAA,EASrC;IACA;AACF;AACA;AACA;AACA;IACE,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AC;MAE/D,UAAAgC,MAAA,CAAUG,gBAAgB,OAAAH,MAAA,CAAIK,iBAAiB;IACjD;;IAEA;AACF;AACA;AACA;AACA;AACA;EALE;IAAA7B,GAAA;IAAAC,KAAA,EAMA,SAAAK,iBAAiBH,OAAO,EAAE;MACxB;MACA,IAAIA,OAAO,CAAC2B,GAAG,EAAE;QACf;QACA3B,OAAO,CAACQ,OAAO,GAAGR,OAAO,CAACQ,OAAO,IAAIR,OAAO,CAAC2B,GAAG;QAChD,OAAO3B,OAAO,CAAC2B,GAAG;MACpB;IACF;;IAEA;AACF;AACA;AACA;AACA;AACA;EALE;IAAA9B,GAAA;IAAAC,KAAA,EAMA,SAAAM,gBAAgBJ,OAAO,EAAE;MACvB,IAAI,CAACA,OAAO,CAACS,QAAQ,EAAE;QACrB,MAAM,IAAIW,KAAK,CAAC,oCAAoC,CAAC;MACvD;MAEA,IAAI,CAACpB,OAAO,CAACQ,OAAO,EAAE;QACpB,MAAM,IAAIY,KAAK,CAAC,yCAAyC,CAAC;MAC5D;IACF;IACA;EAAA;IAAAvB,GAAA;IAAAC,KAAA;IAvFA;AACF;AACA;IACE,SAAA8B,OAAA,EAAgB;MACd;MACA,OAAO,IAAItC,kBAAkB,CAAC;QAACgB,KAAK,EAAE;MAAI,CAAC,CAAC;IAC9C;EAAC;EAAA,OAAAhB,kBAAA;AAAA,EAP6CuC,qBAAW"}
@@ -1,17 +0,0 @@
1
- "use strict";
2
-
3
- var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
4
- _Object$defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.SERVICE_CATALOGS_ENUM_TYPES = exports.SERVICE_CATALOGS = exports.NAMESPACE = exports.COMMERCIAL_ALLOWED_DOMAINS = void 0;
8
- var NAMESPACE = exports.NAMESPACE = 'services';
9
- var SERVICE_CATALOGS = exports.SERVICE_CATALOGS = ['discovery', 'limited', 'signin', 'postauth', 'custom'];
10
- var SERVICE_CATALOGS_ENUM_TYPES = exports.SERVICE_CATALOGS_ENUM_TYPES = {
11
- STRING: 'SERVICE_CATALOGS_ENUM_TYPES_STRING',
12
- NUMBER: 'SERVICE_CATALOGS_ENUM_TYPES_NUMBER'
13
- };
14
-
15
- // The default allowed domains that SDK can make requests to outside of service catalog
16
- var COMMERCIAL_ALLOWED_DOMAINS = exports.COMMERCIAL_ALLOWED_DOMAINS = ['wbx2.com', 'ciscospark.com', 'webex.com', 'webexapis.com', 'broadcloudpbx.com', 'broadcloud.eu', 'broadcloud.com.au', 'broadcloudpbx.net'];
17
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["NAMESPACE","exports","SERVICE_CATALOGS","SERVICE_CATALOGS_ENUM_TYPES","STRING","NUMBER","COMMERCIAL_ALLOWED_DOMAINS"],"sources":["constants.ts"],"sourcesContent":["const NAMESPACE = 'services';\nconst SERVICE_CATALOGS = ['discovery', 'limited', 'signin', 'postauth', 'custom'];\n\nconst SERVICE_CATALOGS_ENUM_TYPES = {\n STRING: 'SERVICE_CATALOGS_ENUM_TYPES_STRING',\n NUMBER: 'SERVICE_CATALOGS_ENUM_TYPES_NUMBER',\n};\n\n// The default allowed domains that SDK can make requests to outside of service catalog\nconst COMMERCIAL_ALLOWED_DOMAINS = [\n 'wbx2.com',\n 'ciscospark.com',\n 'webex.com',\n 'webexapis.com',\n 'broadcloudpbx.com',\n 'broadcloud.eu',\n 'broadcloud.com.au',\n 'broadcloudpbx.net',\n];\n\nexport {SERVICE_CATALOGS_ENUM_TYPES, NAMESPACE, SERVICE_CATALOGS, COMMERCIAL_ALLOWED_DOMAINS};\n"],"mappings":";;;;;;;AAAA,IAAMA,SAAS,GAAAC,OAAA,CAAAD,SAAA,GAAG,UAAU;AAC5B,IAAME,gBAAgB,GAAAD,OAAA,CAAAC,gBAAA,GAAG,CAAC,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,CAAC;AAEjF,IAAMC,2BAA2B,GAAAF,OAAA,CAAAE,2BAAA,GAAG;EAClCC,MAAM,EAAE,oCAAoC;EAC5CC,MAAM,EAAE;AACV,CAAC;;AAED;AACA,IAAMC,0BAA0B,GAAAL,OAAA,CAAAK,0BAAA,GAAG,CACjC,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,mBAAmB,EACnB,mBAAmB,CACpB"}
@@ -1 +0,0 @@
1
- {"version":3,"names":["_httpCore","require","_webexHttpError","_interopRequireDefault","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf2","default","result","NewTarget","constructor","_Reflect$construct","arguments","apply","_possibleConstructorReturn2","Reflect","sham","Proxy","Boolean","prototype","valueOf","call","e","ServerErrorInterceptor","exports","_Interceptor","_inherits2","_super","_classCallCheck2","_createClass2","key","value","onResponseError","options","reason","WebexHttpError","InternalServerError","BadGateway","ServiceUnavailable","uri","feature","webex","internal","device","features","developer","get","metrics","submitClientMetrics","fields","success","tags","action","error","message","url","_promise","resolve","services","markFailedUrl","then","reject","create","Interceptor"],"sources":["server-error.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {Interceptor} from '@webex/http-core';\nimport WebexHttpError from '../../webex-http-error';\n/**\n * Changes server url when it fails\n */\nexport default class ServerErrorInterceptor extends Interceptor {\n /**\n * @returns {HAMessagingInterceptor}\n */\n static create() {\n // eslint-disable-next-line no-invalid-this\n return new ServerErrorInterceptor({webex: this});\n }\n\n /**\n * @see Interceptor#onResponseError\n * @param {Object} options\n * @param {Object} reason\n * @returns {Object}\n */\n onResponseError(options, reason) {\n if (\n (reason instanceof WebexHttpError.InternalServerError ||\n reason instanceof WebexHttpError.BadGateway ||\n reason instanceof WebexHttpError.ServiceUnavailable) &&\n options.uri\n ) {\n const feature = this.webex.internal.device.features.developer.get('web-high-availability');\n\n if (feature && feature.value) {\n this.webex.internal.metrics.submitClientMetrics('web-ha', {\n fields: {success: false},\n tags: {action: 'failed', error: reason.message, url: options.uri},\n });\n\n return Promise.resolve(this.webex.internal.services.markFailedUrl(options.uri)).then(() =>\n Promise.reject(reason)\n );\n }\n }\n\n return Promise.reject(reason);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAIA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAoD,SAAAG,aAAAC,OAAA,QAAAC,yBAAA,GAAAC,yBAAA,oBAAAC,qBAAA,QAAAC,KAAA,OAAAC,gBAAA,CAAAC,OAAA,EAAAN,OAAA,GAAAO,MAAA,MAAAN,yBAAA,QAAAO,SAAA,OAAAH,gBAAA,CAAAC,OAAA,QAAAG,WAAA,EAAAF,MAAA,GAAAG,kBAAA,CAAAN,KAAA,EAAAO,SAAA,EAAAH,SAAA,YAAAD,MAAA,GAAAH,KAAA,CAAAQ,KAAA,OAAAD,SAAA,gBAAAE,2BAAA,CAAAP,OAAA,QAAAC,MAAA;AAAA,SAAAL,0BAAA,eAAAY,OAAA,qBAAAJ,kBAAA,oBAAAA,kBAAA,CAAAK,IAAA,2BAAAC,KAAA,oCAAAC,OAAA,CAAAC,SAAA,CAAAC,OAAA,CAAAC,IAAA,CAAAV,kBAAA,CAAAO,OAAA,8CAAAI,CAAA,sBALpD;AACA;AACA;AAIA;AACA;AACA;AAFA,IAGqBC,sBAAsB,GAAAC,OAAA,CAAAjB,OAAA,0BAAAkB,YAAA;EAAA,IAAAC,UAAA,CAAAnB,OAAA,EAAAgB,sBAAA,EAAAE,YAAA;EAAA,IAAAE,MAAA,GAAA3B,YAAA,CAAAuB,sBAAA;EAAA,SAAAA,uBAAA;IAAA,IAAAK,gBAAA,CAAArB,OAAA,QAAAgB,sBAAA;IAAA,OAAAI,MAAA,CAAAd,KAAA,OAAAD,SAAA;EAAA;EAAA,IAAAiB,aAAA,CAAAtB,OAAA,EAAAgB,sBAAA;IAAAO,GAAA;IA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