@webex/webex-core 3.11.0-webex-services-ready.1 → 3.12.0-next.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.
- package/dist/interceptors/redirect.js +1 -1
- package/dist/interceptors/redirect.js.map +1 -1
- package/dist/lib/batcher.js +1 -1
- package/dist/lib/credentials/credentials.js +1 -1
- package/dist/lib/credentials/token.js +1 -1
- package/dist/lib/services/services.js +28 -39
- package/dist/lib/services/services.js.map +1 -1
- package/dist/lib/services-v2/services-v2.js +23 -35
- package/dist/lib/services-v2/services-v2.js.map +1 -1
- package/dist/plugins/logger.js +1 -1
- package/dist/webex-core.js +2 -2
- package/dist/webex-core.js.map +1 -1
- package/package.json +13 -13
- package/src/interceptors/redirect.js +4 -1
- package/src/lib/services/services.js +32 -48
- package/src/lib/services-v2/services-v2.ts +27 -44
- package/test/integration/spec/services/service-catalog.js +7 -6
- package/test/integration/spec/services/services.js +6 -17
- package/test/integration/spec/services-v2/services-v2.js +6 -17
- package/test/unit/spec/services/services.js +173 -342
- package/test/unit/spec/services-v2/services-v2.ts +114 -236
- package/test/unit/spec/webex-core.js +0 -2
- package/test/unit/spec/webex-internal-core.js +0 -2
|
@@ -107,7 +107,7 @@ var RedirectInterceptor = exports.default = /*#__PURE__*/function (_Interceptor)
|
|
|
107
107
|
options.uri = _newUrl[0]; // params are already present in the qs
|
|
108
108
|
} else {
|
|
109
109
|
// for GET requests
|
|
110
|
-
options.uri = options.uri.replace(/(
|
|
110
|
+
options.uri = options.uri.replace(/(https:\/\/)[^/]+/, "$1".concat(response.body.data.siteFullUrl));
|
|
111
111
|
}
|
|
112
112
|
if (options.resource === 'preJoin' && options.service === 'webex-appapi-service') {
|
|
113
113
|
options.headers.authorization = false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_lodash","require","_httpCore","_callSuper","t","o","e","_getPrototypeOf2","default","_possibleConstructorReturn2","_isNativeReflectConstruct","_Reflect$construct","constructor","apply","Boolean","prototype","valueOf","call","requestHeaderName","responseHeaderName","LOCUS_REDIRECT_ERROR","APPAPI_REDIRECT_ERROR","RedirectInterceptor","exports","_Interceptor","_classCallCheck2","arguments","_inherits2","_createClass2","key","value","onRequest","options","uri","includes","webex","config","credentials","samlUrl","tokenUrl","authorizeUrl","headers","_deleteProperty","$redirectCount","onResponse","response","clone","maxAppLevelRedirects","_promise","reject","Error","request","body","errorCode","location","logger","warn","qs","newUrl","split","maxLocusRedirects","code","data","siteFullUrl","replace","resource","service","authorization","create","Interceptor"],"sources":["redirect.js"],"sourcesContent":["/* eslint-disable prefer-destructuring */\n\n/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {clone} from 'lodash';\nimport {Interceptor} from '@webex/http-core';\n\nconst requestHeaderName = 'cisco-no-http-redirect';\nconst responseHeaderName = 'cisco-location';\nconst LOCUS_REDIRECT_ERROR = 2000002;\nconst APPAPI_REDIRECT_ERROR = 404100;\n\n/**\n * @class\n */\nexport default class RedirectInterceptor extends Interceptor {\n /**\n * @returns {RedirectInterceptor}\n */\n static create() {\n return new RedirectInterceptor({webex: this});\n }\n\n /**\n * @see Interceptor#onRequest\n * @param {Object} options\n * @returns {Object}\n */\n onRequest(options) {\n if (options && options.uri && typeof options.uri === 'string') {\n if (\n options.uri.includes('https://idbroker') ||\n options.uri.includes(this.webex.config.credentials.samlUrl) ||\n options.uri.includes(this.webex.config.credentials.tokenUrl) ||\n options.uri.includes(this.webex.config.credentials.authorizeUrl)\n ) {\n return options;\n }\n }\n\n // If cisco-no-http-redirect is already set, don't overwrite it\n if (requestHeaderName in options.headers) {\n // If cisco-no-http-redirect is set to null, false, or undefined, delete\n // it to prevent a CORS preflight.\n if (!options.headers[requestHeaderName]) {\n Reflect.deleteProperty(options.headers, requestHeaderName);\n }\n\n return options;\n }\n options.headers[requestHeaderName] = true;\n options.$redirectCount = options.$redirectCount || 0;\n\n return options;\n }\n\n /**\n * @see Interceptor#onResponse\n * @param {Object} options\n * @param {HttpResponse} response\n * @returns {Object}\n */\n onResponse(options, response) {\n /* eslint-disable no-else-return */\n if (response.headers && response.headers[responseHeaderName]) {\n options = clone(options);\n options.uri = response.headers[responseHeaderName];\n options.$redirectCount += 1;\n if (options.$redirectCount > this.webex.config.maxAppLevelRedirects) {\n return Promise.reject(new Error('Maximum redirects exceeded'));\n }\n\n return this.webex.request(options);\n } else if (\n response.headers &&\n response.body &&\n response.body.errorCode === LOCUS_REDIRECT_ERROR &&\n response.body.location\n ) {\n options = clone(options);\n\n this.webex.logger.warn('redirect: url redirects needed from', options.uri);\n if (response.options && response.options.qs) {\n // for POST requests\n const newUrl = response.body.location.split('?');\n\n options.uri = newUrl[0]; // params are already present in the qs\n } else {\n // for GET requests\n options.uri = response.body.location;\n }\n\n this.webex.logger.warn('redirect: url redirects needed to', options.uri);\n options.$redirectCount += 1;\n if (options.$redirectCount > this.webex.config.maxLocusRedirects) {\n return Promise.reject(new Error('Maximum redirects exceeded'));\n }\n\n return this.webex.request(options);\n } else if (\n response.headers &&\n response.body &&\n response.body.code === APPAPI_REDIRECT_ERROR &&\n response.body.data &&\n response.body.data.siteFullUrl\n ) {\n options = clone(options);\n\n this.webex.logger.warn('redirect: url redirects needed from', options.uri);\n if (response.options && response.options.qs) {\n // for POST requests\n const newUrl = response.body.data.siteFullUrl.split('?');\n\n options.uri = newUrl[0]; // params are already present in the qs\n } else {\n // for GET requests\n options.uri = options.uri.replace(/(?<=https:\\/\\/)[^/]+/, response.body.data.siteFullUrl);\n }\n\n if (options.resource === 'preJoin' && options.service === 'webex-appapi-service') {\n options.headers.authorization = false;\n }\n\n this.webex.logger.warn('redirect: url redirects needed to', options.uri);\n options.$redirectCount += 1;\n if (options.$redirectCount > this.webex.config.maxLocusRedirects) {\n return Promise.reject(new Error('Maximum redirects exceeded'));\n }\n\n return this.webex.request(options);\n }\n /* eslint-enable no-else-return */\n\n return response;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAM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IC,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAChE;QAEA,OAAO,IAAI,CAACf,KAAK,CAACgB,OAAO,CAACnB,OAAO,CAAC;MACpC;MACA;;MAEA,OAAOa,QAAQ;IACjB;EAAC;IAAAhB,GAAA;IAAAC,KAAA;IAtHD;AACF;AACA;IACE,SAAOsC,MAAMA,CAAA,EAAG;MACd,OAAO,IAAI9C,mBAAmB,CAAC;QAACa,KAAK,EAAE;MAAI,CAAC,CAAC;IAC/C;EAAC;AAAA,EAN8CkC,qBAAW","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_lodash","require","_httpCore","_callSuper","t","o","e","_getPrototypeOf2","default","_possibleConstructorReturn2","_isNativeReflectConstruct","_Reflect$construct","constructor","apply","Boolean","prototype","valueOf","call","requestHeaderName","responseHeaderName","LOCUS_REDIRECT_ERROR","APPAPI_REDIRECT_ERROR","RedirectInterceptor","exports","_Interceptor","_classCallCheck2","arguments","_inherits2","_createClass2","key","value","onRequest","options","uri","includes","webex","config","credentials","samlUrl","tokenUrl","authorizeUrl","headers","_deleteProperty","$redirectCount","onResponse","response","clone","maxAppLevelRedirects","_promise","reject","Error","request","body","errorCode","location","logger","warn","qs","newUrl","split","maxLocusRedirects","code","data","siteFullUrl","replace","concat","resource","service","authorization","create","Interceptor"],"sources":["redirect.js"],"sourcesContent":["/* eslint-disable prefer-destructuring */\n\n/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {clone} from 'lodash';\nimport {Interceptor} from '@webex/http-core';\n\nconst requestHeaderName = 'cisco-no-http-redirect';\nconst responseHeaderName = 'cisco-location';\nconst LOCUS_REDIRECT_ERROR = 2000002;\nconst APPAPI_REDIRECT_ERROR = 404100;\n\n/**\n * @class\n */\nexport default class RedirectInterceptor extends Interceptor {\n /**\n * @returns {RedirectInterceptor}\n */\n static create() {\n return new RedirectInterceptor({webex: this});\n }\n\n /**\n * @see Interceptor#onRequest\n * @param {Object} options\n * @returns {Object}\n */\n onRequest(options) {\n if (options && options.uri && typeof options.uri === 'string') {\n if (\n options.uri.includes('https://idbroker') ||\n options.uri.includes(this.webex.config.credentials.samlUrl) ||\n options.uri.includes(this.webex.config.credentials.tokenUrl) ||\n options.uri.includes(this.webex.config.credentials.authorizeUrl)\n ) {\n return options;\n }\n }\n\n // If cisco-no-http-redirect is already set, don't overwrite it\n if (requestHeaderName in options.headers) {\n // If cisco-no-http-redirect is set to null, false, or undefined, delete\n // it to prevent a CORS preflight.\n if (!options.headers[requestHeaderName]) {\n Reflect.deleteProperty(options.headers, requestHeaderName);\n }\n\n return options;\n }\n options.headers[requestHeaderName] = true;\n options.$redirectCount = options.$redirectCount || 0;\n\n return options;\n }\n\n /**\n * @see Interceptor#onResponse\n * @param {Object} options\n * @param {HttpResponse} response\n * @returns {Object}\n */\n onResponse(options, response) {\n /* eslint-disable no-else-return */\n if (response.headers && response.headers[responseHeaderName]) {\n options = clone(options);\n options.uri = response.headers[responseHeaderName];\n options.$redirectCount += 1;\n if (options.$redirectCount > this.webex.config.maxAppLevelRedirects) {\n return Promise.reject(new Error('Maximum redirects exceeded'));\n }\n\n return this.webex.request(options);\n } else if (\n response.headers &&\n response.body &&\n response.body.errorCode === LOCUS_REDIRECT_ERROR &&\n response.body.location\n ) {\n options = clone(options);\n\n this.webex.logger.warn('redirect: url redirects needed from', options.uri);\n if (response.options && response.options.qs) {\n // for POST requests\n const newUrl = response.body.location.split('?');\n\n options.uri = newUrl[0]; // params are already present in the qs\n } else {\n // for GET requests\n options.uri = response.body.location;\n }\n\n this.webex.logger.warn('redirect: url redirects needed to', options.uri);\n options.$redirectCount += 1;\n if (options.$redirectCount > this.webex.config.maxLocusRedirects) {\n return Promise.reject(new Error('Maximum redirects exceeded'));\n }\n\n return this.webex.request(options);\n } else if (\n response.headers &&\n response.body &&\n response.body.code === APPAPI_REDIRECT_ERROR &&\n response.body.data &&\n response.body.data.siteFullUrl\n ) {\n options = clone(options);\n\n this.webex.logger.warn('redirect: url redirects needed from', options.uri);\n if (response.options && response.options.qs) {\n // for POST requests\n const newUrl = response.body.data.siteFullUrl.split('?');\n\n options.uri = newUrl[0]; // params are already present in the qs\n } else {\n // for GET requests\n options.uri = options.uri.replace(\n /(https:\\/\\/)[^/]+/,\n `$1${response.body.data.siteFullUrl}`\n );\n }\n\n if (options.resource === 'preJoin' && options.service === 'webex-appapi-service') {\n options.headers.authorization = false;\n }\n\n this.webex.logger.warn('redirect: url redirects needed to', options.uri);\n options.$redirectCount += 1;\n if (options.$redirectCount > this.webex.config.maxLocusRedirects) {\n return Promise.reject(new Error('Maximum redirects exceeded'));\n }\n\n return this.webex.request(options);\n }\n /* eslint-enable no-else-return */\n\n return response;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAMA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAA6C,SAAAE,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,UAP7C,0CAEA;AACA;AACA;AAKA,IAAMc,iBAAiB,GAAG,wBAAwB;AAClD,IAAMC,kBAAkB,GAAG,gBAAgB;AAC3C,IAAMC,oBAAoB,GAAG,OAAO;AACpC,IAAMC,qBAAqB,GAAG,MAAM;;AAEpC;AACA;AACA;AAFA,IAGqBC,mBAAmB,GAAA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,CAACO,IAAI,CAACU,IAAI,CAACC,WAAW,CACrC,CAAC;QACH;QAEA,IAAI/B,OAAO,CAACkC,QAAQ,KAAK,SAAS,IAAIlC,OAAO,CAACmC,OAAO,KAAK,sBAAsB,EAAE;UAChFnC,OAAO,CAACS,OAAO,CAAC2B,aAAa,GAAG,KAAK;QACvC;QAEA,IAAI,CAACjC,KAAK,CAACoB,MAAM,CAACC,IAAI,CAAC,mCAAmC,EAAExB,OAAO,CAACC,GAAG,CAAC;QACxED,OAAO,CAACW,cAAc,IAAI,CAAC;QAC3B,IAAIX,OAAO,CAACW,cAAc,GAAG,IAAI,CAACR,KAAK,CAACC,MAAM,CAACwB,iBAAiB,EAAE;UAChE,OAAOZ,QAAA,CAAAxC,OAAA,CAAQyC,MAAM,CAAC,IAAIC,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAChE;QAEA,OAAO,IAAI,CAACf,KAAK,CAACgB,OAAO,CAACnB,OAAO,CAAC;MACpC;MACA;;MAEA,OAAOa,QAAQ;IACjB;EAAC;IAAAhB,GAAA;IAAAC,KAAA;IAzHD;AACF;AACA;IACE,SAAOuC,MAAMA,CAAA,EAAG;MACd,OAAO,IAAI/C,mBAAmB,CAAC;QAACa,KAAK,EAAE;MAAI,CAAC,CAAC;IAC/C;EAAC;AAAA,EAN8CmC,qBAAW","ignoreList":[]}
|
package/dist/lib/batcher.js
CHANGED
|
@@ -286,7 +286,7 @@ var Batcher = _webexPlugin.default.extend({
|
|
|
286
286
|
fingerprintResponse: function fingerprintResponse(item) {
|
|
287
287
|
throw new Error('fingerprintResponse() must be implemented');
|
|
288
288
|
},
|
|
289
|
-
version: "3.
|
|
289
|
+
version: "3.12.0-next.1"
|
|
290
290
|
});
|
|
291
291
|
var _default2 = exports.default = Batcher;
|
|
292
292
|
//# sourceMappingURL=batcher.js.map
|
|
@@ -556,7 +556,7 @@ var Credentials = _webexPlugin.default.extend((_dec = (0, _common.oneFlight)({
|
|
|
556
556
|
this.refresh();
|
|
557
557
|
}
|
|
558
558
|
},
|
|
559
|
-
version: "3.
|
|
559
|
+
version: "3.12.0-next.1"
|
|
560
560
|
}, (0, _applyDecoratedDescriptor2.default)(_obj, "getUserToken", [_dec, _dec2], (0, _getOwnPropertyDescriptor.default)(_obj, "getUserToken"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, "initialize", [_dec3], (0, _getOwnPropertyDescriptor.default)(_obj, "initialize"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, "invalidate", [_common.oneFlight, _dec4], (0, _getOwnPropertyDescriptor.default)(_obj, "invalidate"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, "refresh", [_common.oneFlight, _dec5, _dec6], (0, _getOwnPropertyDescriptor.default)(_obj, "refresh"), _obj), _obj));
|
|
561
561
|
var _default = exports.default = Credentials;
|
|
562
562
|
//# sourceMappingURL=credentials.js.map
|
|
@@ -532,7 +532,7 @@ var Token = _webexPlugin.default.extend((_dec = (0, _common.oneFlight)({
|
|
|
532
532
|
return res.body;
|
|
533
533
|
});
|
|
534
534
|
},
|
|
535
|
-
version: "3.
|
|
535
|
+
version: "3.12.0-next.1"
|
|
536
536
|
}, (0, _applyDecoratedDescriptor2.default)(_obj, "downscope", [_dec], (0, _getOwnPropertyDescriptor.default)(_obj, "downscope"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, "refresh", [_common.oneFlight], (0, _getOwnPropertyDescriptor.default)(_obj, "refresh"), _obj), (0, _applyDecoratedDescriptor2.default)(_obj, "revoke", [_common.oneFlight], (0, _getOwnPropertyDescriptor.default)(_obj, "revoke"), _obj), _obj));
|
|
537
537
|
var _default = exports.default = Token;
|
|
538
538
|
//# sourceMappingURL=token.js.map
|
|
@@ -31,7 +31,7 @@ var _serviceState = _interopRequireDefault(require("./service-state"));
|
|
|
31
31
|
var _serviceFedRamp = _interopRequireDefault(require("./service-fed-ramp"));
|
|
32
32
|
var _constants = require("../constants");
|
|
33
33
|
function ownKeys(e, r) { var t = _Object$keys2(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
34
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
34
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
35
35
|
var trailingSlashes = /(?:^\/)|(?:\/$)/;
|
|
36
36
|
|
|
37
37
|
// The default cluster when one is not provided (usually as 'US' from hydra)
|
|
@@ -73,19 +73,6 @@ var Services = _webexPlugin.default.extend({
|
|
|
73
73
|
validateDomains: ['boolean', false, true],
|
|
74
74
|
initFailed: ['boolean', false, false]
|
|
75
75
|
},
|
|
76
|
-
session: {
|
|
77
|
-
/**
|
|
78
|
-
* Becomes `true` once service catalog initialization has completed.
|
|
79
|
-
* Blocks `webex.ready` until services are initialized.
|
|
80
|
-
* @instance
|
|
81
|
-
* @memberof Services
|
|
82
|
-
* @type {boolean}
|
|
83
|
-
*/
|
|
84
|
-
ready: {
|
|
85
|
-
default: false,
|
|
86
|
-
type: 'boolean'
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
76
|
_catalogs: new _weakMap.default(),
|
|
90
77
|
_serviceUrls: null,
|
|
91
78
|
_hostCatalog: null,
|
|
@@ -256,6 +243,24 @@ var Services = _webexPlugin.default.extend({
|
|
|
256
243
|
var hostCatalog = this._hostCatalog || {};
|
|
257
244
|
return !!((_hostCatalog$host = hostCatalog[host]) !== null && _hostCatalog$host !== void 0 && _hostCatalog$host.length);
|
|
258
245
|
},
|
|
246
|
+
/**
|
|
247
|
+
* Checks if the current environment is an integration (INT) environment
|
|
248
|
+
* by examining the u2c discovery URL from webex config.
|
|
249
|
+
* INT environments use discovery URLs containing 'intb' (e.g., u2c-intb.ciscospark.com).
|
|
250
|
+
* @returns {boolean} True if INT environment, false otherwise
|
|
251
|
+
*/
|
|
252
|
+
isIntegrationEnvironment: function isIntegrationEnvironment() {
|
|
253
|
+
try {
|
|
254
|
+
var _this$webex, _this$webex$config, _this$webex$config$se, _this$webex$config$se2;
|
|
255
|
+
var u2cUrl = ((_this$webex = this.webex) === null || _this$webex === void 0 ? void 0 : (_this$webex$config = _this$webex.config) === null || _this$webex$config === void 0 ? void 0 : (_this$webex$config$se = _this$webex$config.services) === null || _this$webex$config$se === void 0 ? void 0 : (_this$webex$config$se2 = _this$webex$config$se.discovery) === null || _this$webex$config$se2 === void 0 ? void 0 : _this$webex$config$se2.u2c) || '';
|
|
256
|
+
var isInt = u2cUrl.includes('intb');
|
|
257
|
+
this.logger.info("services: isIntegrationEnvironment: ".concat(isInt));
|
|
258
|
+
return isInt;
|
|
259
|
+
} catch (error) {
|
|
260
|
+
this.logger.error('services: failed to determine integration environment', error);
|
|
261
|
+
return false;
|
|
262
|
+
}
|
|
263
|
+
},
|
|
259
264
|
/**
|
|
260
265
|
* Merge provided active cluster mappings into current state.
|
|
261
266
|
* @param {Record<string,string>} activeServices
|
|
@@ -1284,9 +1289,9 @@ var Services = _webexPlugin.default.extend({
|
|
|
1284
1289
|
initConfig: function initConfig() {
|
|
1285
1290
|
// Get the catalog and destructure the services config.
|
|
1286
1291
|
var catalog = this._getCatalog();
|
|
1287
|
-
var _this$webex$
|
|
1288
|
-
services = _this$webex$
|
|
1289
|
-
fedramp = _this$webex$
|
|
1292
|
+
var _this$webex$config2 = this.webex.config,
|
|
1293
|
+
services = _this$webex$config2.services,
|
|
1294
|
+
fedramp = _this$webex$config2.fedramp;
|
|
1290
1295
|
|
|
1291
1296
|
// Validate that the services configuration exists.
|
|
1292
1297
|
if (services) {
|
|
@@ -1394,10 +1399,11 @@ var Services = _webexPlugin.default.extend({
|
|
|
1394
1399
|
_this1.initConfig();
|
|
1395
1400
|
});
|
|
1396
1401
|
|
|
1397
|
-
//
|
|
1398
|
-
//
|
|
1399
|
-
//
|
|
1400
|
-
|
|
1402
|
+
// wait for webex instance to be ready before attempting
|
|
1403
|
+
// to update the service catalogs
|
|
1404
|
+
// this can cause a race condition because credentials may
|
|
1405
|
+
// not be valid when services is initialized
|
|
1406
|
+
this.listenToOnce(this.webex, 'ready', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
1401
1407
|
var cachedCatalog, supertoken, email;
|
|
1402
1408
|
return _regenerator.default.wrap(function (_context4) {
|
|
1403
1409
|
while (1) switch (_context4.prev = _context4.next) {
|
|
@@ -1420,9 +1426,6 @@ var Services = _webexPlugin.default.extend({
|
|
|
1420
1426
|
}).catch(function (error) {
|
|
1421
1427
|
_this1.initFailed = true;
|
|
1422
1428
|
_this1.logger.error("services: failed to init initial services when credentials available, ".concat(error === null || error === void 0 ? void 0 : error.message));
|
|
1423
|
-
}).finally(function () {
|
|
1424
|
-
_this1.ready = true;
|
|
1425
|
-
_this1.trigger('services:initialized');
|
|
1426
1429
|
});
|
|
1427
1430
|
} else {
|
|
1428
1431
|
email = _this1.webex.config.email;
|
|
@@ -1431,20 +1434,6 @@ var Services = _webexPlugin.default.extend({
|
|
|
1431
1434
|
} : undefined).catch(function (error) {
|
|
1432
1435
|
_this1.initFailed = true;
|
|
1433
1436
|
_this1.logger.error("services: failed to init initial services when no credentials available, ".concat(error === null || error === void 0 ? void 0 : error.message));
|
|
1434
|
-
}).finally(function () {
|
|
1435
|
-
_this1.ready = true;
|
|
1436
|
-
_this1.trigger('services:initialized');
|
|
1437
|
-
});
|
|
1438
|
-
// Listen for when credentials become available to fetch the full catalog.
|
|
1439
|
-
// This handles fresh login where 'loaded' fires before OAuth completes.
|
|
1440
|
-
_this1.listenToOnce(_this1.webex, 'change:canAuthorize', function () {
|
|
1441
|
-
if (_this1.webex.canAuthorize && !catalog.status.postauth.ready) {
|
|
1442
|
-
_this1.initServiceCatalogs().then(function () {
|
|
1443
|
-
catalog.isReady = true;
|
|
1444
|
-
}).catch(function (error) {
|
|
1445
|
-
_this1.logger.error("services: failed to init service catalogs after auth, ".concat(error === null || error === void 0 ? void 0 : error.message));
|
|
1446
|
-
});
|
|
1447
|
-
}
|
|
1448
1437
|
});
|
|
1449
1438
|
}
|
|
1450
1439
|
case 3:
|
|
@@ -1454,7 +1443,7 @@ var Services = _webexPlugin.default.extend({
|
|
|
1454
1443
|
}, _callee4);
|
|
1455
1444
|
})));
|
|
1456
1445
|
},
|
|
1457
|
-
version: "3.
|
|
1446
|
+
version: "3.12.0-next.1"
|
|
1458
1447
|
});
|
|
1459
1448
|
/* eslint-enable no-underscore-dangle */
|
|
1460
1449
|
var _default = exports.default = Services;
|