@webex/webex-core 3.3.1-next.1 → 3.3.1-next.2
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/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 +55 -48
- package/dist/lib/services/services.js.map +1 -1
- package/dist/plugins/logger.js +1 -1
- package/dist/webex-core.js +2 -2
- package/package.json +13 -13
- package/src/lib/services/services.js +59 -46
- package/test/integration/spec/services/services.js +9 -5
- package/test/unit/spec/services/services.js +190 -10
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.3.1-next.
|
|
289
|
+
version: "3.3.1-next.2"
|
|
290
290
|
});
|
|
291
291
|
var _default2 = exports.default = Batcher;
|
|
292
292
|
//# sourceMappingURL=batcher.js.map
|
|
@@ -558,7 +558,7 @@ var Credentials = _webexPlugin.default.extend((_dec = (0, _common.oneFlight)({
|
|
|
558
558
|
this.refresh();
|
|
559
559
|
}
|
|
560
560
|
},
|
|
561
|
-
version: "3.3.1-next.
|
|
561
|
+
version: "3.3.1-next.2"
|
|
562
562
|
}, ((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)));
|
|
563
563
|
var _default = exports.default = Credentials;
|
|
564
564
|
//# 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.3.1-next.
|
|
535
|
+
version: "3.3.1-next.2"
|
|
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
|
|
@@ -11,13 +11,11 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
11
11
|
value: true
|
|
12
12
|
});
|
|
13
13
|
exports.default = exports.DEFAULT_CLUSTER_SERVICE = exports.DEFAULT_CLUSTER = void 0;
|
|
14
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/toConsumableArray"));
|
|
15
14
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/slicedToArray"));
|
|
16
15
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
|
|
17
16
|
var _weakMap = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/weak-map"));
|
|
18
17
|
var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
|
|
19
18
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
20
|
-
var _url = _interopRequireDefault(require("url"));
|
|
21
19
|
var _sha = _interopRequireDefault(require("crypto-js/sha256"));
|
|
22
20
|
var _lodash = require("lodash");
|
|
23
21
|
var _webexPlugin = _interopRequireDefault(require("../webex-plugin"));
|
|
@@ -677,55 +675,64 @@ var Services = _webexPlugin.default.extend({
|
|
|
677
675
|
*/
|
|
678
676
|
_formatReceivedHostmap: function _formatReceivedHostmap(serviceHostmap) {
|
|
679
677
|
this._updateHostCatalog(serviceHostmap.hostCatalog);
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
var
|
|
688
|
-
var
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
defaultUrl: defaultUrl,
|
|
695
|
-
defaultHost: _url.default.parse(defaultUrl).hostname,
|
|
696
|
-
hosts: []
|
|
697
|
-
};
|
|
698
|
-
accumulator.push(serviceItem);
|
|
678
|
+
var extractId = function extractId(entry) {
|
|
679
|
+
return entry.id.split(':')[3];
|
|
680
|
+
};
|
|
681
|
+
var formattedHostmap = [];
|
|
682
|
+
|
|
683
|
+
// for each of the services in the serviceLinks, find the matching host in the catalog
|
|
684
|
+
(0, _keys.default)(serviceHostmap.serviceLinks).forEach(function (serviceName) {
|
|
685
|
+
var _formattedHost$hosts;
|
|
686
|
+
var serviceUrl = serviceHostmap.serviceLinks[serviceName];
|
|
687
|
+
var host;
|
|
688
|
+
try {
|
|
689
|
+
host = new URL(serviceUrl).host;
|
|
690
|
+
} catch (e) {
|
|
691
|
+
return;
|
|
699
692
|
}
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
}].concat((0, _toConsumableArray2.default)(serviceHostmap.hostCatalog[key].map(function (host) {
|
|
709
|
-
return _objectSpread(_objectSpread({}, host), {}, {
|
|
710
|
-
homeCluster: serviceItem.defaultHost === key
|
|
711
|
-
});
|
|
712
|
-
}))));
|
|
713
|
-
return accumulator;
|
|
714
|
-
}, []);
|
|
693
|
+
var matchingCatalogEntry = serviceHostmap.hostCatalog[host];
|
|
694
|
+
var formattedHost = {
|
|
695
|
+
name: serviceName,
|
|
696
|
+
defaultUrl: serviceUrl,
|
|
697
|
+
defaultHost: host,
|
|
698
|
+
hosts: []
|
|
699
|
+
};
|
|
700
|
+
formattedHostmap.push(formattedHost);
|
|
715
701
|
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
return
|
|
702
|
+
// If the catalog does not have any hosts we will be unable to find the service ID
|
|
703
|
+
// so can't search for other hosts
|
|
704
|
+
if (!matchingCatalogEntry || !matchingCatalogEntry[0]) {
|
|
705
|
+
return;
|
|
706
|
+
}
|
|
707
|
+
var serviceId = extractId(matchingCatalogEntry[0]);
|
|
708
|
+
(0, _lodash.forEach)(matchingCatalogEntry, function (entry) {
|
|
709
|
+
// The ids for all hosts within a hostCatalog entry should be the same
|
|
710
|
+
// but for safety, only add host entries that have the same id as the first one
|
|
711
|
+
if (extractId(entry) === serviceId) {
|
|
712
|
+
formattedHost.hosts.push(_objectSpread(_objectSpread({}, entry), {}, {
|
|
713
|
+
homeCluster: true
|
|
714
|
+
}));
|
|
715
|
+
}
|
|
720
716
|
});
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
717
|
+
var otherHosts = [];
|
|
718
|
+
|
|
719
|
+
// find the services in the host catalog that have the same id
|
|
720
|
+
// and add them to the otherHosts
|
|
721
|
+
(0, _lodash.forEach)(serviceHostmap.hostCatalog, function (entry) {
|
|
722
|
+
// exclude the matching catalog entry as we have already added that
|
|
723
|
+
if (entry === matchingCatalogEntry) {
|
|
724
|
+
return;
|
|
725
|
+
}
|
|
726
|
+
(0, _lodash.forEach)(entry, function (entryHost) {
|
|
727
|
+
// only add hosts that have the correct id
|
|
728
|
+
if (extractId(entryHost) === serviceId) {
|
|
729
|
+
otherHosts.push(_objectSpread(_objectSpread({}, entryHost), {}, {
|
|
730
|
+
homeCluster: false
|
|
731
|
+
}));
|
|
732
|
+
}
|
|
727
733
|
});
|
|
728
|
-
}
|
|
734
|
+
});
|
|
735
|
+
(_formattedHost$hosts = formattedHost.hosts).push.apply(_formattedHost$hosts, otherHosts);
|
|
729
736
|
});
|
|
730
737
|
|
|
731
738
|
// update all the service urls in the host catalog
|
|
@@ -1027,7 +1034,7 @@ var Services = _webexPlugin.default.extend({
|
|
|
1027
1034
|
}
|
|
1028
1035
|
});
|
|
1029
1036
|
},
|
|
1030
|
-
version: "3.3.1-next.
|
|
1037
|
+
version: "3.3.1-next.2"
|
|
1031
1038
|
});
|
|
1032
1039
|
/* eslint-enable no-underscore-dangle */
|
|
1033
1040
|
var _default = exports.default = Services;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_url","_interopRequireDefault","require","_sha","_lodash","_webexPlugin","_metrics","_serviceCatalog","_serviceRegistry","_serviceState","_serviceFedRamp","_constants","ownKeys","e","r","t","_Object$keys2","_Object$getOwnPropertySymbols","o","filter","_Object$getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","Object","forEach","_defineProperty2","default","_Object$getOwnPropertyDescriptors","_Object$defineProperties","_Object$defineProperty","trailingSlashes","DEFAULT_CLUSTER","exports","DEFAULT_CLUSTER_SERVICE","CLUSTER_SERVICE","process","env","WEBEX_CONVERSATION_CLUSTER_SERVICE","DEFAULT_CLUSTER_IDENTIFIER","WEBEX_CONVERSATION_DEFAULT_CLUSTER","concat","Services","WebexPlugin","extend","namespace","registries","_weakMap","states","props","validateDomains","initFailed","_catalogs","_serviceUrls","_hostCatalog","getRegistry","get","webex","getState","_getCatalog","name","priorityHost","serviceGroup","catalog","hasService","serviceName","hasAllowedDomains","getAllowedDomains","list","markFailedUrl","url","noPriorityHosts","_updateServiceUrls","serviceUrls","_updateHostCatalog","hostCatalog","updateServices","_this","_ref","undefined","from","query","token","forceRefresh","formattedQuery","status","collecting","waitForCatalog","queryKey","_keys","includes","_promise","reject","Error","email","emailhash","sha256","toLowerCase","toString","_fetchNewServiceHostmap","then","serviceHostMap","updateServiceUrls","updateCredentialsConfig","catch","error","validateUser","_ref2","_this2","_ref2$reqId","reqId","_ref2$forceRefresh","_ref2$activationOptio","activationOptions","preloginUserId","logger","info","canAuthorize","credentials","getUserToken","sendUserActivation","userObj","activated","exists","details","user","_this$webex$credentia","config","client_id","client_secret","collectPreauthCatalog","idbrokerService","getClientToken","uri","scope","tokenObj","collectSigninCatalog","rto","all","_ref3","_ref4","_slicedToArray2","response","statusCode","responseText","body","message","getMeetingPreferences","_this3","request","method","service","resource","res","err","fetchClientRegionInfo","_this4","addAuthHeader","headers","timeout","_ref5","_this5","countryCode","timezone","clientRegionInfo","accept","authorization","timeZone","shouldRefreshAccessToken","_ref6","mode","_ref7","_this$list","idbroker","identity","_this$webex$config$cr","authorizationString","authorizeUrl","replace","setConfig","supertoken","access_token","postauth","ready","preauth","initServiceCatalogs","waitForService","_ref8","_this6","_ref8$timeout","services","fetchFromServiceUrl","servicesNotNeedValidation","find","resolve","priorityUrl","priorityUrlObj","getServiceFromUrl","isReady","internal","metrics","submitClientMetrics","METRICS","JS_SDK_SERVICE_NOT_FOUND","fields","service_name","groupsToCheck","checkCatalog","catalogGroup","scopedPriorityUrl","scopedPrioriryUrlObj","map","group","_formatReceivedHostmap","serviceHostmap","formattedHostmap","reduce","accumulator","key","_serviceItem$hosts","id","split","defaultUrl","serviceLinks","serviceItem","item","defaultHost","Url","parse","hostname","hosts","host","ttl","priority","homeCluster","_toConsumableArray2","getClusterId","findClusterId","getServiceFromClusterId","params","findServiceFromClusterId","getServiceUrlFromClusterId","_ref9","_ref9$cluster","cluster","clusterId","_ref10","findServiceUrlFromUrl","isServiceUrl","isAllowedDomainUrl","findAllowedDomain","convertUrlToPriorityHostUrl","data","_this7","_ref11","qs","format","timestamp","Date","getTime","requestObject","newMetrics","callDiagnosticLatencies","measureLatency","_ref12","initConfig","_this$webex$config","fedramp","discovery","fedRampServices","formattedDiscoveryServices","override","formattedOverrideServices","allowedDomains","union","COMMERCIAL_ALLOWED_DOMAINS","setAllowedDomains","_this8","getOrgId","orgId","warn","initialize","_this9","ServiceCatalog","registry","ServiceRegistry","state","ServiceState","set","listenToOnce","version","_default"],"sources":["services.js"],"sourcesContent":["import Url from 'url';\n\nimport sha256 from 'crypto-js/sha256';\n\nimport {union} from 'lodash';\nimport WebexPlugin from '../webex-plugin';\n\nimport METRICS from './metrics';\nimport ServiceCatalog from './service-catalog';\nimport ServiceRegistry from './service-registry';\nimport ServiceState from './service-state';\nimport fedRampServices from './service-fed-ramp';\nimport {COMMERCIAL_ALLOWED_DOMAINS} from './constants';\n\nconst trailingSlashes = /(?:^\\/)|(?:\\/$)/;\n\n// The default cluster when one is not provided (usually as 'US' from hydra)\nexport const DEFAULT_CLUSTER = 'urn:TEAM:us-east-2_a';\n// The default service name for convo (currently identityLookup due to some weird CSB issue)\nexport const DEFAULT_CLUSTER_SERVICE = 'identityLookup';\n\nconst CLUSTER_SERVICE = process.env.WEBEX_CONVERSATION_CLUSTER_SERVICE || DEFAULT_CLUSTER_SERVICE;\nconst DEFAULT_CLUSTER_IDENTIFIER =\n process.env.WEBEX_CONVERSATION_DEFAULT_CLUSTER || `${DEFAULT_CLUSTER}:${CLUSTER_SERVICE}`;\n\n/* eslint-disable no-underscore-dangle */\n/**\n * @class\n */\nconst Services = WebexPlugin.extend({\n namespace: 'Services',\n\n /**\n * The {@link WeakMap} of {@link ServiceRegistry} class instances that are\n * keyed with WebexCore instances.\n *\n * @instance\n * @type {WeakMap<WebexCore, ServiceRegistry>}\n * @private\n * @memberof Services\n */\n registries: new WeakMap(),\n\n /**\n * The {@link WeakMap} of {@link ServiceState} class instances that are\n * keyed with WebexCore instances.\n *\n * @instance\n * @type {WeakMap<WebexCore, ServiceState>}\n * @private\n * @memberof Services\n */\n states: new WeakMap(),\n\n props: {\n validateDomains: ['boolean', false, true],\n initFailed: ['boolean', false, false],\n },\n\n _catalogs: new WeakMap(),\n\n _serviceUrls: null,\n\n _hostCatalog: null,\n\n /**\n * Get the registry associated with this webex instance.\n *\n * @private\n * @memberof Services\n * @returns {ServiceRegistry} - The associated {@link ServiceRegistry}.\n */\n getRegistry() {\n return this.registries.get(this.webex);\n },\n\n /**\n * Get the state associated with this webex instance.\n *\n * @private\n * @memberof Services\n * @returns {ServiceState} - The associated {@link ServiceState}.\n */\n getState() {\n return this.states.get(this.webex);\n },\n\n /**\n * @private\n * Get the current catalog based on the assocaited\n * webex instance.\n * @returns {ServiceCatalog}\n */\n _getCatalog() {\n return this._catalogs.get(this.webex);\n },\n\n /**\n * Get a service url from the current services list by name\n * from the associated instance catalog.\n * @param {string} name\n * @param {boolean} [priorityHost]\n * @param {string} [serviceGroup]\n * @returns {string|undefined}\n */\n get(name, priorityHost, serviceGroup) {\n const catalog = this._getCatalog();\n\n return catalog.get(name, priorityHost, serviceGroup);\n },\n\n /**\n * Determine if the catalog contains a specific service\n *\n * @param {string} serviceName - The service name to validate.\n * @returns {boolean} - True if the service exists.\n */\n hasService(serviceName) {\n return !!this.get(serviceName);\n },\n\n /**\n * Determine if a whilelist exists in the service catalog.\n *\n * @returns {boolean} - True if a allowed domains list exists.\n */\n hasAllowedDomains() {\n const catalog = this._getCatalog();\n\n return catalog.getAllowedDomains().length > 0;\n },\n\n /**\n * Generate a service catalog as an object from\n * the associated instance catalog.\n * @param {boolean} [priorityHost] - use highest priority host if set to `true`\n * @param {string} [serviceGroup]\n * @returns {Record<string, string>}\n */\n list(priorityHost, serviceGroup) {\n const catalog = this._getCatalog();\n\n return catalog.list(priorityHost, serviceGroup);\n },\n\n /**\n * Mark a priority host service url as failed.\n * This will mark the host associated with the\n * `ServiceUrl` to be removed from the its\n * respective host array, and then return the next\n * viable host from the `ServiceUrls` host array,\n * or the `ServiceUrls` default url if no other priority\n * hosts are available, or if `noPriorityHosts` is set to\n * `true`.\n * @param {string} url\n * @param {boolean} noPriorityHosts\n * @returns {string}\n */\n markFailedUrl(url, noPriorityHosts) {\n const catalog = this._getCatalog();\n\n return catalog.markFailedUrl(url, noPriorityHosts);\n },\n\n /**\n * saves all the services from the pre and post catalog service\n * @param {Object} serviceUrls\n * @returns {void}\n */\n _updateServiceUrls(serviceUrls) {\n this._serviceUrls = {...this._serviceUrls, ...serviceUrls};\n },\n\n /**\n * saves the hostCatalog object\n * @param {Object} hostCatalog\n * @returns {void}\n */\n _updateHostCatalog(hostCatalog) {\n this._hostCatalog = {...this._hostCatalog, ...hostCatalog};\n },\n\n /**\n * Update a list of `serviceUrls` to the most current\n * catalog via the defined `discoveryUrl` then returns the current\n * list of services.\n * @param {object} [param]\n * @param {string} [param.from] - This accepts `limited` or `signin`\n * @param {object} [param.query] - This accepts `email`, `orgId` or `userId` key values\n * @param {string} [param.query.email] - must be a standard-format email\n * @param {string} [param.query.orgId] - must be an organization id\n * @param {string} [param.query.userId] - must be a user id\n * @param {string} [param.token] - used for signin catalog\n * @returns {Promise<object>}\n */\n updateServices({from, query, token, forceRefresh} = {}) {\n const catalog = this._getCatalog();\n let formattedQuery;\n let serviceGroup;\n\n // map catalog name to service group name.\n switch (from) {\n case 'limited':\n serviceGroup = 'preauth';\n break;\n case 'signin':\n serviceGroup = 'signin';\n break;\n default:\n serviceGroup = 'postauth';\n break;\n }\n\n // confirm catalog update for group is not in progress.\n if (catalog.status[serviceGroup].collecting) {\n return this.waitForCatalog(serviceGroup);\n }\n\n catalog.status[serviceGroup].collecting = true;\n\n if (serviceGroup === 'preauth') {\n const queryKey = query && Object.keys(query)[0];\n\n if (!['email', 'emailhash', 'userId', 'orgId', 'mode'].includes(queryKey)) {\n return Promise.reject(\n new Error('a query param of email, emailhash, userId, orgId, or mode is required')\n );\n }\n }\n // encode email when query key is email\n if (serviceGroup === 'preauth' || serviceGroup === 'signin') {\n const queryKey = Object.keys(query)[0];\n\n formattedQuery = {};\n\n if (queryKey === 'email' && query.email) {\n formattedQuery.emailhash = sha256(query.email.toLowerCase()).toString();\n } else {\n formattedQuery[queryKey] = query[queryKey];\n }\n }\n\n return this._fetchNewServiceHostmap({\n from,\n token,\n query: formattedQuery,\n forceRefresh,\n })\n .then((serviceHostMap) => {\n catalog.updateServiceUrls(serviceGroup, serviceHostMap);\n this.updateCredentialsConfig();\n catalog.status[serviceGroup].collecting = false;\n })\n .catch((error) => {\n catalog.status[serviceGroup].collecting = false;\n\n return Promise.reject(error);\n });\n },\n\n /**\n * User validation parameter transfer object for {@link validateUser}.\n * @param {object} ValidateUserPTO\n * @property {string} ValidateUserPTO.email - The email of the user.\n * @property {string} [ValidateUserPTO.reqId] - The activation requester.\n * @property {object} [ValidateUserPTO.activationOptions] - Extra options to pass when sending the activation\n * @property {object} [ValidateUserPTO.preloginUserId] - The prelogin user id to set when sending the activation.\n */\n\n /**\n * User validation return transfer object for {@link validateUser}.\n * @param {object} ValidateUserRTO\n * @property {boolean} ValidateUserRTO.activated - If the user is activated.\n * @property {boolean} ValidateUserRTO.exists - If the user exists.\n * @property {string} ValidateUserRTO.details - A descriptive status message.\n * @property {object} ValidateUserRTO.user - **License** service user object.\n */\n\n /**\n * Validate if a user is activated and update the service catalogs as needed\n * based on the user's activation status.\n *\n * @param {ValidateUserPTO} - The parameter transfer object.\n * @returns {ValidateUserRTO} - The return transfer object.\n */\n validateUser({\n email,\n reqId = 'WEBCLIENT',\n forceRefresh = false,\n activationOptions = {},\n preloginUserId,\n }) {\n this.logger.info('services: validating a user');\n\n // Validate that an email parameter key was provided.\n if (!email) {\n return Promise.reject(new Error('`email` is required'));\n }\n\n // Destructure the credentials object.\n const {canAuthorize} = this.webex.credentials;\n\n // Validate that the user is already authorized.\n if (canAuthorize) {\n return this.updateServices({forceRefresh})\n .then(() => this.webex.credentials.getUserToken())\n .then((token) =>\n this.sendUserActivation({\n email,\n reqId,\n token: token.toString(),\n activationOptions,\n preloginUserId,\n })\n )\n .then((userObj) => ({\n activated: true,\n exists: true,\n details: 'user is authorized via a user token',\n user: userObj,\n }));\n }\n\n // Destructure the client authorization details.\n /* eslint-disable camelcase */\n const {client_id, client_secret} = this.webex.credentials.config;\n\n // Validate that client authentication details exist.\n if (!client_id || !client_secret) {\n return Promise.reject(new Error('client authentication details are not available'));\n }\n /* eslint-enable camelcase */\n\n // Declare a class-memeber-scoped token for usage within the promise chain.\n let token;\n\n // Begin client authentication user validation.\n return (\n this.collectPreauthCatalog({email})\n .then(() => {\n // Retrieve the service url from the updated catalog. This is required\n // since `WebexCore` is usually not fully initialized at the time this\n // request completes.\n const idbrokerService = this.get('idbroker', true);\n\n // Collect the client auth token.\n return this.webex.credentials.getClientToken({\n uri: `${idbrokerService}idb/oauth2/v1/access_token`,\n scope: 'webexsquare:admin webexsquare:get_conversation Identity:SCIM',\n });\n })\n .then((tokenObj) => {\n // Generate the token string.\n token = tokenObj.toString();\n\n // Collect the signin catalog using the client auth information.\n return this.collectSigninCatalog({email, token, forceRefresh});\n })\n // Validate if collecting the signin catalog failed and populate the RTO\n // with the appropriate content.\n .catch((error) => ({\n exists: error.name !== 'NotFound',\n activated: false,\n details:\n error.name !== 'NotFound'\n ? 'user exists but is not activated'\n : 'user does not exist and is not activated',\n }))\n // Validate if the previous promise resolved with an RTO and populate the\n // new RTO accordingly.\n .then((rto) =>\n Promise.all([\n rto || {\n activated: true,\n exists: true,\n details: 'user exists and is activated',\n },\n this.sendUserActivation({\n email,\n reqId,\n token,\n activationOptions,\n preloginUserId,\n }),\n ])\n )\n .then(([rto, user]) => ({...rto, user}))\n .catch((error) => {\n const response = {\n statusCode: error.statusCode,\n responseText: error.body && error.body.message,\n body: error.body,\n };\n\n return Promise.reject(response);\n })\n );\n },\n\n /**\n * Get user meeting preferences (preferred webex site).\n *\n * @returns {object} - User Information including user preferrences .\n */\n getMeetingPreferences() {\n return this.request({\n method: 'GET',\n service: 'hydra',\n resource: 'meetingPreferences',\n })\n .then((res) => {\n this.logger.info('services: received user region info');\n\n return res.body;\n })\n .catch((err) => {\n this.logger.info('services: was not able to fetch user login information', err);\n // resolve successfully even if request failed\n });\n },\n\n /**\n * Fetches client region info such as countryCode and timezone.\n *\n * @returns {object} - The region info object.\n */\n fetchClientRegionInfo() {\n return this.request({\n uri: 'https://ds.ciscospark.com/v1/region',\n addAuthHeader: false,\n headers: {\n 'spark-user-agent': null,\n },\n timeout: 5000,\n })\n .then((res) => {\n this.logger.info('services: received user region info');\n\n return res.body;\n })\n .catch((err) => {\n this.logger.info('services: was not able to get user region info', err);\n // resolve successfully even if request failed\n });\n },\n\n /**\n * User activation parameter transfer object for {@link sendUserActivation}.\n * @typedef {object} SendUserActivationPTO\n * @property {string} SendUserActivationPTO.email - The email of the user.\n * @property {string} SendUserActivationPTO.reqId - The activation requester.\n * @property {string} SendUserActivationPTO.token - The client auth token.\n * @property {object} SendUserActivationPTO.activationOptions - Extra options to pass when sending the activation.\n * @property {object} SendUserActivationPTO.preloginUserId - The prelogin user id to set when sending the activation.\n */\n\n /**\n * Send a request to activate a user using a client token.\n *\n * @param {SendUserActivationPTO} - The Parameter transfer object.\n * @returns {LicenseDTO} - The DTO returned from the **License** service.\n */\n sendUserActivation({email, reqId, token, activationOptions, preloginUserId}) {\n this.logger.info('services: sending user activation request');\n let countryCode;\n let timezone;\n\n // try to fetch client region info first\n return (\n this.fetchClientRegionInfo()\n .then((clientRegionInfo) => {\n if (clientRegionInfo) {\n ({countryCode, timezone} = clientRegionInfo);\n }\n\n // Send the user activation request to the **License** service.\n return this.request({\n service: 'license',\n resource: 'users/activations',\n method: 'POST',\n headers: {\n accept: 'application/json',\n authorization: token,\n 'x-prelogin-userid': preloginUserId,\n },\n body: {\n email,\n reqId,\n countryCode,\n timeZone: timezone,\n ...activationOptions,\n },\n shouldRefreshAccessToken: false,\n });\n })\n // On success, return the **License** user object.\n .then(({body}) => body)\n // On failure, reject with error from **License**.\n .catch((error) => Promise.reject(error))\n );\n },\n\n /**\n * simplified method to update the preauth catalog via email\n *\n * @param {object} query\n * @param {string} query.email - A standard format email.\n * @param {string} query.orgId - The user's OrgId.\n * @param {boolean} forceRefresh - Boolean to bypass u2c cache control header\n * @returns {Promise<void>}\n */\n collectPreauthCatalog(query, forceRefresh = false) {\n if (!query) {\n return this.updateServices({\n from: 'limited',\n query: {mode: 'DEFAULT_BY_PROXIMITY'},\n forceRefresh,\n });\n }\n\n return this.updateServices({from: 'limited', query, forceRefresh});\n },\n\n /**\n * simplified method to update the signin catalog via email and token\n * @param {object} param\n * @param {string} param.email - must be a standard-format email\n * @param {string} param.token - must be a client token\n * @returns {Promise<void>}\n */\n collectSigninCatalog({email, token, forceRefresh} = {}) {\n if (!email) {\n return Promise.reject(new Error('`email` is required'));\n }\n if (!token) {\n return Promise.reject(new Error('`token` is required'));\n }\n\n return this.updateServices({\n from: 'signin',\n query: {email},\n token,\n forceRefresh,\n });\n },\n\n /**\n * Updates credentials config to utilize u2c catalog\n * urls.\n * @returns {void}\n */\n updateCredentialsConfig() {\n const {idbroker, identity} = this.list(true);\n\n if (idbroker && identity) {\n const {authorizationString, authorizeUrl} = this.webex.config.credentials;\n\n // This must be set outside of the setConfig method used to assign the\n // idbroker and identity url values.\n this.webex.config.credentials.authorizeUrl = authorizationString\n ? authorizeUrl\n : `${idbroker.replace(trailingSlashes, '')}/idb/oauth2/v1/authorize`;\n\n this.webex.setConfig({\n credentials: {\n idbroker: {\n url: idbroker.replace(trailingSlashes, ''), // remove trailing slash\n },\n identity: {\n url: identity.replace(trailingSlashes, ''), // remove trailing slash\n },\n },\n });\n }\n },\n\n /**\n * Wait until the service catalog is available,\n * or reject afte ra timeout of 60 seconds.\n * @param {string} serviceGroup\n * @param {number} [timeout] - in seconds\n * @returns {Promise<void>}\n */\n waitForCatalog(serviceGroup, timeout) {\n const catalog = this._getCatalog();\n const {supertoken} = this.webex.credentials;\n\n if (\n serviceGroup === 'postauth' &&\n supertoken &&\n supertoken.access_token &&\n !catalog.status.postauth.collecting &&\n !catalog.status.postauth.ready\n ) {\n if (!catalog.status.preauth.ready) {\n return this.initServiceCatalogs();\n }\n\n return this.updateServices();\n }\n\n return catalog.waitForCatalog(serviceGroup, timeout);\n },\n\n /**\n * Service waiting parameter transfer object for {@link waitForService}.\n *\n * @typedef {object} WaitForServicePTO\n * @property {string} [WaitForServicePTO.name] - The service name.\n * @property {string} [WaitForServicePTO.url] - The service url.\n * @property {string} [WaitForServicePTO.timeout] - wait duration in seconds.\n */\n\n /**\n * Wait until the service has been ammended to any service catalog. This\n * method prioritizes the service name over the service url when searching.\n *\n * @param {WaitForServicePTO} - The parameter transfer object.\n * @returns {Promise<string>} - Resolves to the priority host of a service.\n */\n waitForService({name, timeout = 5, url}) {\n const {services} = this.webex.config;\n\n // Save memory by grabbing the catalog after there isn't a priortyURL\n const catalog = this._getCatalog();\n\n const fetchFromServiceUrl = services.servicesNotNeedValidation.find(\n (service) => service === name\n );\n\n if (fetchFromServiceUrl) {\n return Promise.resolve(this._serviceUrls[name]);\n }\n\n const priorityUrl = this.get(name, true);\n const priorityUrlObj = this.getServiceFromUrl(url);\n\n if (priorityUrl || priorityUrlObj) {\n return Promise.resolve(priorityUrl || priorityUrlObj.priorityUrl);\n }\n\n if (catalog.isReady) {\n if (url) {\n return Promise.resolve(url);\n }\n\n this.webex.internal.metrics.submitClientMetrics(METRICS.JS_SDK_SERVICE_NOT_FOUND, {\n fields: {service_name: name},\n });\n\n return Promise.reject(\n new Error(`services: service '${name}' was not found in any of the catalogs`)\n );\n }\n\n return new Promise((resolve, reject) => {\n const groupsToCheck = ['preauth', 'signin', 'postauth'];\n const checkCatalog = (catalogGroup) =>\n catalog\n .waitForCatalog(catalogGroup, timeout)\n .then(() => {\n const scopedPriorityUrl = this.get(name, true);\n const scopedPrioriryUrlObj = this.getServiceFromUrl(url);\n\n if (scopedPriorityUrl || scopedPrioriryUrlObj) {\n resolve(scopedPriorityUrl || scopedPrioriryUrlObj.priorityUrl);\n }\n })\n .catch(() => undefined);\n\n Promise.all(groupsToCheck.map((group) => checkCatalog(group))).then(() => {\n this.webex.internal.metrics.submitClientMetrics(METRICS.JS_SDK_SERVICE_NOT_FOUND, {\n fields: {service_name: name},\n });\n reject(new Error(`services: service '${name}' was not found after waiting`));\n });\n });\n },\n\n /**\n * @private\n * Organize a received hostmap from a service\n * catalog endpoint.\n * @param {object} serviceHostmap\n * @returns {object}\n */\n _formatReceivedHostmap(serviceHostmap) {\n this._updateHostCatalog(serviceHostmap.hostCatalog);\n // map the host catalog items to a formatted hostmap\n const formattedHostmap = Object.keys(serviceHostmap.hostCatalog).reduce((accumulator, key) => {\n if (serviceHostmap.hostCatalog[key].length === 0) {\n return accumulator;\n }\n\n const serviceName = serviceHostmap.hostCatalog[key][0].id.split(':')[3];\n const defaultUrl = serviceHostmap.serviceLinks[serviceName];\n\n let serviceItem = accumulator.find((item) => item.name === serviceName);\n\n if (!serviceItem) {\n serviceItem = {\n name: serviceName,\n defaultUrl,\n defaultHost: Url.parse(defaultUrl).hostname,\n hosts: [],\n };\n\n accumulator.push(serviceItem);\n }\n\n serviceItem.hosts.push(\n // map the default key as a low priority default for cluster matching\n {\n host: key,\n ttl: -1,\n priority: 10,\n id: serviceHostmap.hostCatalog[key][0].id,\n homeCluster: serviceItem.defaultHost === key,\n },\n // map the rest of the hosts in their proper locations\n ...serviceHostmap.hostCatalog[key].map((host) => ({\n ...host,\n homeCluster: serviceItem.defaultHost === key,\n }))\n );\n\n return accumulator;\n }, []);\n\n // append service links that do not exist in the host catalog\n Object.keys(serviceHostmap.serviceLinks).forEach((key) => {\n const service = formattedHostmap.find((item) => item.name === key);\n\n if (!service) {\n formattedHostmap.push({\n name: key,\n defaultUrl: serviceHostmap.serviceLinks[key],\n defaultHost: Url.parse(serviceHostmap.serviceLinks[key]).hostname,\n hosts: [],\n });\n }\n });\n\n // update all the service urls in the host catalog\n\n this._updateServiceUrls(serviceHostmap.serviceLinks);\n this._updateHostCatalog(serviceHostmap.hostCatalog);\n\n return formattedHostmap;\n },\n\n /**\n * Get the clusterId associated with a URL string.\n * @param {string} url\n * @returns {string} - Cluster ID of url provided\n */\n getClusterId(url) {\n const catalog = this._getCatalog();\n\n return catalog.findClusterId(url);\n },\n\n /**\n * Get a service value from a provided clusterId. This method will\n * return an object containing both the name and url of a found service.\n * @param {object} params\n * @param {string} params.clusterId - clusterId of found service\n * @param {boolean} [params.priorityHost] - returns priority host url if true\n * @param {string} [params.serviceGroup] - specify service group\n * @returns {object} service\n * @returns {string} service.name\n * @returns {string} service.url\n */\n getServiceFromClusterId(params) {\n const catalog = this._getCatalog();\n\n return catalog.findServiceFromClusterId(params);\n },\n\n /**\n * @param {String} cluster the cluster containing the id\n * @param {UUID} [id] the id of the conversation.\n * If empty, just return the base URL.\n * @returns {String} url of the service\n */\n getServiceUrlFromClusterId({cluster = 'us'} = {}) {\n let clusterId = cluster === 'us' ? DEFAULT_CLUSTER_IDENTIFIER : cluster;\n\n // Determine if cluster has service name (non-US clusters from hydra do not)\n if (clusterId.split(':').length < 4) {\n // Add Service to cluster identifier\n clusterId = `${cluster}:${CLUSTER_SERVICE}`;\n }\n\n const {url} = this.getServiceFromClusterId({clusterId}) || {};\n\n if (!url) {\n throw Error(`Could not find service for cluster [${cluster}]`);\n }\n\n return url;\n },\n\n /**\n * Get a service object from a service url if the service url exists in the\n * catalog.\n *\n * @param {string} url - The url to be validated.\n * @returns {object} - Service object.\n * @returns {object.name} - The name of the service found.\n * @returns {object.priorityUrl} - The priority url of the found service.\n * @returns {object.defaultUrl} - The default url of the found service.\n */\n getServiceFromUrl(url = '') {\n const service = this._getCatalog().findServiceUrlFromUrl(url);\n\n if (!service) {\n return undefined;\n }\n\n return {\n name: service.name,\n priorityUrl: service.get(true),\n defaultUrl: service.get(),\n };\n },\n\n /**\n * Verify that a provided url exists in the service\n * catalog.\n * @param {string} url\n * @returns {boolean} - true if exists, false otherwise\n */\n isServiceUrl(url) {\n const catalog = this._getCatalog();\n\n return !!catalog.findServiceUrlFromUrl(url);\n },\n\n /**\n * Determine if a provided url is in the catalog's allowed domains.\n *\n * @param {string} url - The url to match allowed domains against.\n * @returns {boolean} - True if the url provided is allowed.\n */\n isAllowedDomainUrl(url) {\n const catalog = this._getCatalog();\n\n return !!catalog.findAllowedDomain(url);\n },\n\n /**\n * Converts the host portion of the url from default host\n * to a priority host\n *\n * @param {string} url a service url that contains a default host\n * @returns {string} a service url that contains the top priority host.\n * @throws if url isn't a service url\n */\n convertUrlToPriorityHostUrl(url = '') {\n const data = this.getServiceFromUrl(url);\n\n if (!data) {\n throw Error(`No service associated with url: [${url}]`);\n }\n\n return url.replace(data.defaultUrl, data.priorityUrl);\n },\n\n /**\n * @private\n * Simplified method wrapper for sending a request to get\n * an updated service hostmap.\n * @param {object} [param]\n * @param {string} [param.from] - This accepts `limited` or `signin`\n * @param {object} [param.query] - This accepts `email`, `orgId` or `userId` key values\n * @param {string} [param.query.email] - must be a standard-format email\n * @param {string} [param.query.orgId] - must be an organization id\n * @param {string} [param.query.userId] - must be a user id\n * @param {string} [param.token] - used for signin catalog\n * @returns {Promise<object>}\n */\n _fetchNewServiceHostmap({from, query, token, forceRefresh} = {}) {\n const service = 'u2c';\n const resource = from ? `/${from}/catalog` : '/catalog';\n const qs = {...query, format: 'hostmap'};\n\n if (forceRefresh) {\n qs.timestamp = new Date().getTime();\n }\n\n const requestObject = {\n method: 'GET',\n service,\n resource,\n qs,\n };\n\n if (token) {\n requestObject.headers = {authorization: token};\n }\n\n return this.webex.internal.newMetrics.callDiagnosticLatencies\n .measureLatency(() => this.request(requestObject), 'internal.get.u2c.time')\n .then(({body}) => this._formatReceivedHostmap(body));\n },\n\n /**\n * Initialize the discovery services and the whitelisted services.\n *\n * @returns {void}\n */\n initConfig() {\n // Get the catalog and destructure the services config.\n const catalog = this._getCatalog();\n const {services, fedramp} = this.webex.config;\n\n // Validate that the services configuration exists.\n if (services) {\n if (fedramp) {\n services.discovery = fedRampServices;\n }\n // Check for discovery services.\n if (services.discovery) {\n // Format the discovery configuration into an injectable array.\n const formattedDiscoveryServices = Object.keys(services.discovery).map((key) => ({\n name: key,\n defaultUrl: services.discovery[key],\n }));\n\n // Inject formatted discovery services into services catalog.\n catalog.updateServiceUrls('discovery', formattedDiscoveryServices);\n }\n\n if (services.override) {\n // Format the override configuration into an injectable array.\n const formattedOverrideServices = Object.keys(services.override).map((key) => ({\n name: key,\n defaultUrl: services.override[key],\n }));\n\n // Inject formatted override services into services catalog.\n catalog.updateServiceUrls('override', formattedOverrideServices);\n }\n\n // if not fedramp, append on the commercialAllowedDomains\n if (!fedramp) {\n services.allowedDomains = union(services.allowedDomains, COMMERCIAL_ALLOWED_DOMAINS);\n }\n\n // Check for allowed host domains.\n if (services.allowedDomains) {\n // Store the allowed domains as a property of the catalog.\n catalog.setAllowedDomains(services.allowedDomains);\n }\n\n // Set `validateDomains` property to match configuration\n this.validateDomains = services.validateDomains;\n }\n },\n\n /**\n * Make the initial requests to collect the root catalogs.\n *\n * @returns {Promise<void, Error>} - Errors if the token is unavailable.\n */\n initServiceCatalogs() {\n this.logger.info('services: initializing initial service catalogs');\n\n // Destructure the credentials plugin.\n const {credentials} = this.webex;\n\n // Init a promise chain. Must be done as a Promise.resolve() to allow\n // credentials#getOrgId() to properly throw.\n return (\n Promise.resolve()\n // Get the user's OrgId.\n .then(() => credentials.getOrgId())\n // Begin collecting the preauth/limited catalog.\n .then((orgId) => this.collectPreauthCatalog({orgId}))\n .then(() => {\n // Validate if the token is authorized.\n if (credentials.canAuthorize) {\n // Attempt to collect the postauth catalog.\n return this.updateServices().catch(() =>\n this.logger.warn('services: cannot retrieve postauth catalog')\n );\n }\n\n // Return a resolved promise for consistent return value.\n return Promise.resolve();\n })\n );\n },\n\n /**\n * Initializer\n *\n * @instance\n * @memberof Services\n * @returns {Services}\n */\n initialize() {\n const catalog = new ServiceCatalog();\n const registry = new ServiceRegistry();\n const state = new ServiceState();\n\n this._catalogs.set(this.webex, catalog);\n this.registries.set(this.webex, registry);\n this.states.set(this.webex, state);\n\n // Listen for configuration changes once.\n this.listenToOnce(this.webex, 'change:config', () => {\n this.initConfig();\n });\n\n // wait for webex instance to be ready before attempting\n // to update the service catalogs\n this.listenToOnce(this.webex, 'ready', () => {\n const {supertoken} = this.webex.credentials;\n // Validate if the supertoken exists.\n if (supertoken && supertoken.access_token) {\n this.initServiceCatalogs()\n .then(() => {\n catalog.isReady = true;\n })\n .catch((error) => {\n this.initFailed = true;\n this.logger.error(\n `services: failed to init initial services when credentials available, ${error?.message}`\n );\n });\n } else {\n const {email} = this.webex.config;\n\n this.collectPreauthCatalog(email ? {email} : undefined).catch((error) => {\n this.initFailed = true;\n this.logger.error(\n `services: failed to init initial services when no credentials available, ${error?.message}`\n );\n });\n }\n });\n },\n});\n/* eslint-enable no-underscore-dangle */\n\nexport default Services;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAAA,IAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,IAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAEA,IAAAI,QAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,eAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,gBAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,aAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,eAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,UAAA,GAAAT,OAAA;AAAuD,SAAAU,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,aAAA,CAAAH,CAAA,OAAAI,6BAAA,QAAAC,CAAA,GAAAD,6BAAA,CAAAJ,CAAA,GAAAC,CAAA,KAAAI,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAL,CAAA,WAAAM,gCAAA,CAAAP,CAAA,EAAAC,CAAA,EAAAO,UAAA,OAAAN,CAAA,CAAAO,IAAA,CAAAC,KAAA,CAAAR,CAAA,EAA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AK,CAAC,GAAGf,SAAS,CAAC,CAACyB,KAAK,CAAC,UAACC,KAAK,EAAK;UACvEiL,MAAI,CAACvO,UAAU,GAAG,IAAI;UACtBuO,MAAI,CAACvK,MAAM,CAACV,KAAK,6EAAAhE,MAAA,CAC6DgE,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEyC,OAAO,CAC5F,CAAC;QACH,CAAC,CAAC;MACJ;IACF,CAAC,CAAC;EACJ,CAAC;EAAAgJ,OAAA;AACH,CAAC,CAAC;AACF;AAAA,IAAAC,QAAA,GAAAlQ,OAAA,CAAAN,OAAA,GAEee,QAAQ"}
|
|
1
|
+
{"version":3,"names":["_sha","_interopRequireDefault","require","_lodash","_webexPlugin","_metrics","_serviceCatalog","_serviceRegistry","_serviceState","_serviceFedRamp","_constants","ownKeys","e","r","t","_Object$keys2","_Object$getOwnPropertySymbols","o","filter","_Object$getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","Object","forEach","_defineProperty2","default","_Object$getOwnPropertyDescriptors","_Object$defineProperties","_Object$defineProperty","trailingSlashes","DEFAULT_CLUSTER","exports","DEFAULT_CLUSTER_SERVICE","CLUSTER_SERVICE","process","env","WEBEX_CONVERSATION_CLUSTER_SERVICE","DEFAULT_CLUSTER_IDENTIFIER","WEBEX_CONVERSATION_DEFAULT_CLUSTER","concat","Services","WebexPlugin","extend","namespace","registries","_weakMap","states","props","validateDomains","initFailed","_catalogs","_serviceUrls","_hostCatalog","getRegistry","get","webex","getState","_getCatalog","name","priorityHost","serviceGroup","catalog","hasService","serviceName","hasAllowedDomains","getAllowedDomains","list","markFailedUrl","url","noPriorityHosts","_updateServiceUrls","serviceUrls","_updateHostCatalog","hostCatalog","updateServices","_this","_ref","undefined","from","query","token","forceRefresh","formattedQuery","status","collecting","waitForCatalog","queryKey","_keys","includes","_promise","reject","Error","email","emailhash","sha256","toLowerCase","toString","_fetchNewServiceHostmap","then","serviceHostMap","updateServiceUrls","updateCredentialsConfig","catch","error","validateUser","_ref2","_this2","_ref2$reqId","reqId","_ref2$forceRefresh","_ref2$activationOptio","activationOptions","preloginUserId","logger","info","canAuthorize","credentials","getUserToken","sendUserActivation","userObj","activated","exists","details","user","_this$webex$credentia","config","client_id","client_secret","collectPreauthCatalog","idbrokerService","getClientToken","uri","scope","tokenObj","collectSigninCatalog","rto","all","_ref3","_ref4","_slicedToArray2","response","statusCode","responseText","body","message","getMeetingPreferences","_this3","request","method","service","resource","res","err","fetchClientRegionInfo","_this4","addAuthHeader","headers","timeout","_ref5","_this5","countryCode","timezone","clientRegionInfo","accept","authorization","timeZone","shouldRefreshAccessToken","_ref6","mode","_ref7","_this$list","idbroker","identity","_this$webex$config$cr","authorizationString","authorizeUrl","replace","setConfig","supertoken","access_token","postauth","ready","preauth","initServiceCatalogs","waitForService","_ref8","_this6","_ref8$timeout","services","fetchFromServiceUrl","servicesNotNeedValidation","find","resolve","priorityUrl","priorityUrlObj","getServiceFromUrl","isReady","internal","metrics","submitClientMetrics","METRICS","JS_SDK_SERVICE_NOT_FOUND","fields","service_name","groupsToCheck","checkCatalog","catalogGroup","scopedPriorityUrl","scopedPrioriryUrlObj","map","group","_formatReceivedHostmap","serviceHostmap","extractId","entry","id","split","formattedHostmap","serviceLinks","_formattedHost$hosts","serviceUrl","host","URL","matchingCatalogEntry","formattedHost","defaultUrl","defaultHost","hosts","serviceId","homeCluster","otherHosts","entryHost","getClusterId","findClusterId","getServiceFromClusterId","params","findServiceFromClusterId","getServiceUrlFromClusterId","_ref9","_ref9$cluster","cluster","clusterId","_ref10","findServiceUrlFromUrl","isServiceUrl","isAllowedDomainUrl","findAllowedDomain","convertUrlToPriorityHostUrl","data","_this7","_ref11","qs","format","timestamp","Date","getTime","requestObject","newMetrics","callDiagnosticLatencies","measureLatency","_ref12","initConfig","_this$webex$config","fedramp","discovery","fedRampServices","formattedDiscoveryServices","key","override","formattedOverrideServices","allowedDomains","union","COMMERCIAL_ALLOWED_DOMAINS","setAllowedDomains","_this8","getOrgId","orgId","warn","initialize","_this9","ServiceCatalog","registry","ServiceRegistry","state","ServiceState","set","listenToOnce","version","_default"],"sources":["services.js"],"sourcesContent":["import sha256 from 'crypto-js/sha256';\n\nimport {union, forEach} from 'lodash';\nimport WebexPlugin from '../webex-plugin';\n\nimport METRICS from './metrics';\nimport ServiceCatalog from './service-catalog';\nimport ServiceRegistry from './service-registry';\nimport ServiceState from './service-state';\nimport fedRampServices from './service-fed-ramp';\nimport {COMMERCIAL_ALLOWED_DOMAINS} from './constants';\n\nconst trailingSlashes = /(?:^\\/)|(?:\\/$)/;\n\n// The default cluster when one is not provided (usually as 'US' from hydra)\nexport const DEFAULT_CLUSTER = 'urn:TEAM:us-east-2_a';\n// The default service name for convo (currently identityLookup due to some weird CSB issue)\nexport const DEFAULT_CLUSTER_SERVICE = 'identityLookup';\n\nconst CLUSTER_SERVICE = process.env.WEBEX_CONVERSATION_CLUSTER_SERVICE || DEFAULT_CLUSTER_SERVICE;\nconst DEFAULT_CLUSTER_IDENTIFIER =\n process.env.WEBEX_CONVERSATION_DEFAULT_CLUSTER || `${DEFAULT_CLUSTER}:${CLUSTER_SERVICE}`;\n\n/* eslint-disable no-underscore-dangle */\n/**\n * @class\n */\nconst Services = WebexPlugin.extend({\n namespace: 'Services',\n\n /**\n * The {@link WeakMap} of {@link ServiceRegistry} class instances that are\n * keyed with WebexCore instances.\n *\n * @instance\n * @type {WeakMap<WebexCore, ServiceRegistry>}\n * @private\n * @memberof Services\n */\n registries: new WeakMap(),\n\n /**\n * The {@link WeakMap} of {@link ServiceState} class instances that are\n * keyed with WebexCore instances.\n *\n * @instance\n * @type {WeakMap<WebexCore, ServiceState>}\n * @private\n * @memberof Services\n */\n states: new WeakMap(),\n\n props: {\n validateDomains: ['boolean', false, true],\n initFailed: ['boolean', false, false],\n },\n\n _catalogs: new WeakMap(),\n\n _serviceUrls: null,\n\n _hostCatalog: null,\n\n /**\n * Get the registry associated with this webex instance.\n *\n * @private\n * @memberof Services\n * @returns {ServiceRegistry} - The associated {@link ServiceRegistry}.\n */\n getRegistry() {\n return this.registries.get(this.webex);\n },\n\n /**\n * Get the state associated with this webex instance.\n *\n * @private\n * @memberof Services\n * @returns {ServiceState} - The associated {@link ServiceState}.\n */\n getState() {\n return this.states.get(this.webex);\n },\n\n /**\n * @private\n * Get the current catalog based on the assocaited\n * webex instance.\n * @returns {ServiceCatalog}\n */\n _getCatalog() {\n return this._catalogs.get(this.webex);\n },\n\n /**\n * Get a service url from the current services list by name\n * from the associated instance catalog.\n * @param {string} name\n * @param {boolean} [priorityHost]\n * @param {string} [serviceGroup]\n * @returns {string|undefined}\n */\n get(name, priorityHost, serviceGroup) {\n const catalog = this._getCatalog();\n\n return catalog.get(name, priorityHost, serviceGroup);\n },\n\n /**\n * Determine if the catalog contains a specific service\n *\n * @param {string} serviceName - The service name to validate.\n * @returns {boolean} - True if the service exists.\n */\n hasService(serviceName) {\n return !!this.get(serviceName);\n },\n\n /**\n * Determine if a whilelist exists in the service catalog.\n *\n * @returns {boolean} - True if a allowed domains list exists.\n */\n hasAllowedDomains() {\n const catalog = this._getCatalog();\n\n return catalog.getAllowedDomains().length > 0;\n },\n\n /**\n * Generate a service catalog as an object from\n * the associated instance catalog.\n * @param {boolean} [priorityHost] - use highest priority host if set to `true`\n * @param {string} [serviceGroup]\n * @returns {Record<string, string>}\n */\n list(priorityHost, serviceGroup) {\n const catalog = this._getCatalog();\n\n return catalog.list(priorityHost, serviceGroup);\n },\n\n /**\n * Mark a priority host service url as failed.\n * This will mark the host associated with the\n * `ServiceUrl` to be removed from the its\n * respective host array, and then return the next\n * viable host from the `ServiceUrls` host array,\n * or the `ServiceUrls` default url if no other priority\n * hosts are available, or if `noPriorityHosts` is set to\n * `true`.\n * @param {string} url\n * @param {boolean} noPriorityHosts\n * @returns {string}\n */\n markFailedUrl(url, noPriorityHosts) {\n const catalog = this._getCatalog();\n\n return catalog.markFailedUrl(url, noPriorityHosts);\n },\n\n /**\n * saves all the services from the pre and post catalog service\n * @param {Object} serviceUrls\n * @returns {void}\n */\n _updateServiceUrls(serviceUrls) {\n this._serviceUrls = {...this._serviceUrls, ...serviceUrls};\n },\n\n /**\n * saves the hostCatalog object\n * @param {Object} hostCatalog\n * @returns {void}\n */\n _updateHostCatalog(hostCatalog) {\n this._hostCatalog = {...this._hostCatalog, ...hostCatalog};\n },\n\n /**\n * Update a list of `serviceUrls` to the most current\n * catalog via the defined `discoveryUrl` then returns the current\n * list of services.\n * @param {object} [param]\n * @param {string} [param.from] - This accepts `limited` or `signin`\n * @param {object} [param.query] - This accepts `email`, `orgId` or `userId` key values\n * @param {string} [param.query.email] - must be a standard-format email\n * @param {string} [param.query.orgId] - must be an organization id\n * @param {string} [param.query.userId] - must be a user id\n * @param {string} [param.token] - used for signin catalog\n * @returns {Promise<object>}\n */\n updateServices({from, query, token, forceRefresh} = {}) {\n const catalog = this._getCatalog();\n let formattedQuery;\n let serviceGroup;\n\n // map catalog name to service group name.\n switch (from) {\n case 'limited':\n serviceGroup = 'preauth';\n break;\n case 'signin':\n serviceGroup = 'signin';\n break;\n default:\n serviceGroup = 'postauth';\n break;\n }\n\n // confirm catalog update for group is not in progress.\n if (catalog.status[serviceGroup].collecting) {\n return this.waitForCatalog(serviceGroup);\n }\n\n catalog.status[serviceGroup].collecting = true;\n\n if (serviceGroup === 'preauth') {\n const queryKey = query && Object.keys(query)[0];\n\n if (!['email', 'emailhash', 'userId', 'orgId', 'mode'].includes(queryKey)) {\n return Promise.reject(\n new Error('a query param of email, emailhash, userId, orgId, or mode is required')\n );\n }\n }\n // encode email when query key is email\n if (serviceGroup === 'preauth' || serviceGroup === 'signin') {\n const queryKey = Object.keys(query)[0];\n\n formattedQuery = {};\n\n if (queryKey === 'email' && query.email) {\n formattedQuery.emailhash = sha256(query.email.toLowerCase()).toString();\n } else {\n formattedQuery[queryKey] = query[queryKey];\n }\n }\n\n return this._fetchNewServiceHostmap({\n from,\n token,\n query: formattedQuery,\n forceRefresh,\n })\n .then((serviceHostMap) => {\n catalog.updateServiceUrls(serviceGroup, serviceHostMap);\n this.updateCredentialsConfig();\n catalog.status[serviceGroup].collecting = false;\n })\n .catch((error) => {\n catalog.status[serviceGroup].collecting = false;\n\n return Promise.reject(error);\n });\n },\n\n /**\n * User validation parameter transfer object for {@link validateUser}.\n * @param {object} ValidateUserPTO\n * @property {string} ValidateUserPTO.email - The email of the user.\n * @property {string} [ValidateUserPTO.reqId] - The activation requester.\n * @property {object} [ValidateUserPTO.activationOptions] - Extra options to pass when sending the activation\n * @property {object} [ValidateUserPTO.preloginUserId] - The prelogin user id to set when sending the activation.\n */\n\n /**\n * User validation return transfer object for {@link validateUser}.\n * @param {object} ValidateUserRTO\n * @property {boolean} ValidateUserRTO.activated - If the user is activated.\n * @property {boolean} ValidateUserRTO.exists - If the user exists.\n * @property {string} ValidateUserRTO.details - A descriptive status message.\n * @property {object} ValidateUserRTO.user - **License** service user object.\n */\n\n /**\n * Validate if a user is activated and update the service catalogs as needed\n * based on the user's activation status.\n *\n * @param {ValidateUserPTO} - The parameter transfer object.\n * @returns {ValidateUserRTO} - The return transfer object.\n */\n validateUser({\n email,\n reqId = 'WEBCLIENT',\n forceRefresh = false,\n activationOptions = {},\n preloginUserId,\n }) {\n this.logger.info('services: validating a user');\n\n // Validate that an email parameter key was provided.\n if (!email) {\n return Promise.reject(new Error('`email` is required'));\n }\n\n // Destructure the credentials object.\n const {canAuthorize} = this.webex.credentials;\n\n // Validate that the user is already authorized.\n if (canAuthorize) {\n return this.updateServices({forceRefresh})\n .then(() => this.webex.credentials.getUserToken())\n .then((token) =>\n this.sendUserActivation({\n email,\n reqId,\n token: token.toString(),\n activationOptions,\n preloginUserId,\n })\n )\n .then((userObj) => ({\n activated: true,\n exists: true,\n details: 'user is authorized via a user token',\n user: userObj,\n }));\n }\n\n // Destructure the client authorization details.\n /* eslint-disable camelcase */\n const {client_id, client_secret} = this.webex.credentials.config;\n\n // Validate that client authentication details exist.\n if (!client_id || !client_secret) {\n return Promise.reject(new Error('client authentication details are not available'));\n }\n /* eslint-enable camelcase */\n\n // Declare a class-memeber-scoped token for usage within the promise chain.\n let token;\n\n // Begin client authentication user validation.\n return (\n this.collectPreauthCatalog({email})\n .then(() => {\n // Retrieve the service url from the updated catalog. This is required\n // since `WebexCore` is usually not fully initialized at the time this\n // request completes.\n const idbrokerService = this.get('idbroker', true);\n\n // Collect the client auth token.\n return this.webex.credentials.getClientToken({\n uri: `${idbrokerService}idb/oauth2/v1/access_token`,\n scope: 'webexsquare:admin webexsquare:get_conversation Identity:SCIM',\n });\n })\n .then((tokenObj) => {\n // Generate the token string.\n token = tokenObj.toString();\n\n // Collect the signin catalog using the client auth information.\n return this.collectSigninCatalog({email, token, forceRefresh});\n })\n // Validate if collecting the signin catalog failed and populate the RTO\n // with the appropriate content.\n .catch((error) => ({\n exists: error.name !== 'NotFound',\n activated: false,\n details:\n error.name !== 'NotFound'\n ? 'user exists but is not activated'\n : 'user does not exist and is not activated',\n }))\n // Validate if the previous promise resolved with an RTO and populate the\n // new RTO accordingly.\n .then((rto) =>\n Promise.all([\n rto || {\n activated: true,\n exists: true,\n details: 'user exists and is activated',\n },\n this.sendUserActivation({\n email,\n reqId,\n token,\n activationOptions,\n preloginUserId,\n }),\n ])\n )\n .then(([rto, user]) => ({...rto, user}))\n .catch((error) => {\n const response = {\n statusCode: error.statusCode,\n responseText: error.body && error.body.message,\n body: error.body,\n };\n\n return Promise.reject(response);\n })\n );\n },\n\n /**\n * Get user meeting preferences (preferred webex site).\n *\n * @returns {object} - User Information including user preferrences .\n */\n getMeetingPreferences() {\n return this.request({\n method: 'GET',\n service: 'hydra',\n resource: 'meetingPreferences',\n })\n .then((res) => {\n this.logger.info('services: received user region info');\n\n return res.body;\n })\n .catch((err) => {\n this.logger.info('services: was not able to fetch user login information', err);\n // resolve successfully even if request failed\n });\n },\n\n /**\n * Fetches client region info such as countryCode and timezone.\n *\n * @returns {object} - The region info object.\n */\n fetchClientRegionInfo() {\n return this.request({\n uri: 'https://ds.ciscospark.com/v1/region',\n addAuthHeader: false,\n headers: {\n 'spark-user-agent': null,\n },\n timeout: 5000,\n })\n .then((res) => {\n this.logger.info('services: received user region info');\n\n return res.body;\n })\n .catch((err) => {\n this.logger.info('services: was not able to get user region info', err);\n // resolve successfully even if request failed\n });\n },\n\n /**\n * User activation parameter transfer object for {@link sendUserActivation}.\n * @typedef {object} SendUserActivationPTO\n * @property {string} SendUserActivationPTO.email - The email of the user.\n * @property {string} SendUserActivationPTO.reqId - The activation requester.\n * @property {string} SendUserActivationPTO.token - The client auth token.\n * @property {object} SendUserActivationPTO.activationOptions - Extra options to pass when sending the activation.\n * @property {object} SendUserActivationPTO.preloginUserId - The prelogin user id to set when sending the activation.\n */\n\n /**\n * Send a request to activate a user using a client token.\n *\n * @param {SendUserActivationPTO} - The Parameter transfer object.\n * @returns {LicenseDTO} - The DTO returned from the **License** service.\n */\n sendUserActivation({email, reqId, token, activationOptions, preloginUserId}) {\n this.logger.info('services: sending user activation request');\n let countryCode;\n let timezone;\n\n // try to fetch client region info first\n return (\n this.fetchClientRegionInfo()\n .then((clientRegionInfo) => {\n if (clientRegionInfo) {\n ({countryCode, timezone} = clientRegionInfo);\n }\n\n // Send the user activation request to the **License** service.\n return this.request({\n service: 'license',\n resource: 'users/activations',\n method: 'POST',\n headers: {\n accept: 'application/json',\n authorization: token,\n 'x-prelogin-userid': preloginUserId,\n },\n body: {\n email,\n reqId,\n countryCode,\n timeZone: timezone,\n ...activationOptions,\n },\n shouldRefreshAccessToken: false,\n });\n })\n // On success, return the **License** user object.\n .then(({body}) => body)\n // On failure, reject with error from **License**.\n .catch((error) => Promise.reject(error))\n );\n },\n\n /**\n * simplified method to update the preauth catalog via email\n *\n * @param {object} query\n * @param {string} query.email - A standard format email.\n * @param {string} query.orgId - The user's OrgId.\n * @param {boolean} forceRefresh - Boolean to bypass u2c cache control header\n * @returns {Promise<void>}\n */\n collectPreauthCatalog(query, forceRefresh = false) {\n if (!query) {\n return this.updateServices({\n from: 'limited',\n query: {mode: 'DEFAULT_BY_PROXIMITY'},\n forceRefresh,\n });\n }\n\n return this.updateServices({from: 'limited', query, forceRefresh});\n },\n\n /**\n * simplified method to update the signin catalog via email and token\n * @param {object} param\n * @param {string} param.email - must be a standard-format email\n * @param {string} param.token - must be a client token\n * @returns {Promise<void>}\n */\n collectSigninCatalog({email, token, forceRefresh} = {}) {\n if (!email) {\n return Promise.reject(new Error('`email` is required'));\n }\n if (!token) {\n return Promise.reject(new Error('`token` is required'));\n }\n\n return this.updateServices({\n from: 'signin',\n query: {email},\n token,\n forceRefresh,\n });\n },\n\n /**\n * Updates credentials config to utilize u2c catalog\n * urls.\n * @returns {void}\n */\n updateCredentialsConfig() {\n const {idbroker, identity} = this.list(true);\n\n if (idbroker && identity) {\n const {authorizationString, authorizeUrl} = this.webex.config.credentials;\n\n // This must be set outside of the setConfig method used to assign the\n // idbroker and identity url values.\n this.webex.config.credentials.authorizeUrl = authorizationString\n ? authorizeUrl\n : `${idbroker.replace(trailingSlashes, '')}/idb/oauth2/v1/authorize`;\n\n this.webex.setConfig({\n credentials: {\n idbroker: {\n url: idbroker.replace(trailingSlashes, ''), // remove trailing slash\n },\n identity: {\n url: identity.replace(trailingSlashes, ''), // remove trailing slash\n },\n },\n });\n }\n },\n\n /**\n * Wait until the service catalog is available,\n * or reject afte ra timeout of 60 seconds.\n * @param {string} serviceGroup\n * @param {number} [timeout] - in seconds\n * @returns {Promise<void>}\n */\n waitForCatalog(serviceGroup, timeout) {\n const catalog = this._getCatalog();\n const {supertoken} = this.webex.credentials;\n\n if (\n serviceGroup === 'postauth' &&\n supertoken &&\n supertoken.access_token &&\n !catalog.status.postauth.collecting &&\n !catalog.status.postauth.ready\n ) {\n if (!catalog.status.preauth.ready) {\n return this.initServiceCatalogs();\n }\n\n return this.updateServices();\n }\n\n return catalog.waitForCatalog(serviceGroup, timeout);\n },\n\n /**\n * Service waiting parameter transfer object for {@link waitForService}.\n *\n * @typedef {object} WaitForServicePTO\n * @property {string} [WaitForServicePTO.name] - The service name.\n * @property {string} [WaitForServicePTO.url] - The service url.\n * @property {string} [WaitForServicePTO.timeout] - wait duration in seconds.\n */\n\n /**\n * Wait until the service has been ammended to any service catalog. This\n * method prioritizes the service name over the service url when searching.\n *\n * @param {WaitForServicePTO} - The parameter transfer object.\n * @returns {Promise<string>} - Resolves to the priority host of a service.\n */\n waitForService({name, timeout = 5, url}) {\n const {services} = this.webex.config;\n\n // Save memory by grabbing the catalog after there isn't a priortyURL\n const catalog = this._getCatalog();\n\n const fetchFromServiceUrl = services.servicesNotNeedValidation.find(\n (service) => service === name\n );\n\n if (fetchFromServiceUrl) {\n return Promise.resolve(this._serviceUrls[name]);\n }\n\n const priorityUrl = this.get(name, true);\n const priorityUrlObj = this.getServiceFromUrl(url);\n\n if (priorityUrl || priorityUrlObj) {\n return Promise.resolve(priorityUrl || priorityUrlObj.priorityUrl);\n }\n\n if (catalog.isReady) {\n if (url) {\n return Promise.resolve(url);\n }\n\n this.webex.internal.metrics.submitClientMetrics(METRICS.JS_SDK_SERVICE_NOT_FOUND, {\n fields: {service_name: name},\n });\n\n return Promise.reject(\n new Error(`services: service '${name}' was not found in any of the catalogs`)\n );\n }\n\n return new Promise((resolve, reject) => {\n const groupsToCheck = ['preauth', 'signin', 'postauth'];\n const checkCatalog = (catalogGroup) =>\n catalog\n .waitForCatalog(catalogGroup, timeout)\n .then(() => {\n const scopedPriorityUrl = this.get(name, true);\n const scopedPrioriryUrlObj = this.getServiceFromUrl(url);\n\n if (scopedPriorityUrl || scopedPrioriryUrlObj) {\n resolve(scopedPriorityUrl || scopedPrioriryUrlObj.priorityUrl);\n }\n })\n .catch(() => undefined);\n\n Promise.all(groupsToCheck.map((group) => checkCatalog(group))).then(() => {\n this.webex.internal.metrics.submitClientMetrics(METRICS.JS_SDK_SERVICE_NOT_FOUND, {\n fields: {service_name: name},\n });\n reject(new Error(`services: service '${name}' was not found after waiting`));\n });\n });\n },\n\n /**\n * @private\n * Organize a received hostmap from a service\n * catalog endpoint.\n * @param {object} serviceHostmap\n * @returns {object}\n */\n _formatReceivedHostmap(serviceHostmap) {\n this._updateHostCatalog(serviceHostmap.hostCatalog);\n\n const extractId = (entry) => entry.id.split(':')[3];\n\n const formattedHostmap = [];\n\n // for each of the services in the serviceLinks, find the matching host in the catalog\n Object.keys(serviceHostmap.serviceLinks).forEach((serviceName) => {\n const serviceUrl = serviceHostmap.serviceLinks[serviceName];\n\n let host;\n try {\n host = new URL(serviceUrl).host;\n } catch (e) {\n return;\n }\n\n const matchingCatalogEntry = serviceHostmap.hostCatalog[host];\n\n const formattedHost = {\n name: serviceName,\n defaultUrl: serviceUrl,\n defaultHost: host,\n hosts: [],\n };\n\n formattedHostmap.push(formattedHost);\n\n // If the catalog does not have any hosts we will be unable to find the service ID\n // so can't search for other hosts\n if (!matchingCatalogEntry || !matchingCatalogEntry[0]) {\n return;\n }\n\n const serviceId = extractId(matchingCatalogEntry[0]);\n\n forEach(matchingCatalogEntry, (entry) => {\n // The ids for all hosts within a hostCatalog entry should be the same\n // but for safety, only add host entries that have the same id as the first one\n if (extractId(entry) === serviceId) {\n formattedHost.hosts.push({\n ...entry,\n homeCluster: true,\n });\n }\n });\n\n const otherHosts = [];\n\n // find the services in the host catalog that have the same id\n // and add them to the otherHosts\n forEach(serviceHostmap.hostCatalog, (entry) => {\n // exclude the matching catalog entry as we have already added that\n if (entry === matchingCatalogEntry) {\n return;\n }\n\n forEach(entry, (entryHost) => {\n // only add hosts that have the correct id\n if (extractId(entryHost) === serviceId) {\n otherHosts.push({\n ...entryHost,\n homeCluster: false,\n });\n }\n });\n });\n\n formattedHost.hosts.push(...otherHosts);\n });\n\n // update all the service urls in the host catalog\n\n this._updateServiceUrls(serviceHostmap.serviceLinks);\n this._updateHostCatalog(serviceHostmap.hostCatalog);\n\n return formattedHostmap;\n },\n\n /**\n * Get the clusterId associated with a URL string.\n * @param {string} url\n * @returns {string} - Cluster ID of url provided\n */\n getClusterId(url) {\n const catalog = this._getCatalog();\n\n return catalog.findClusterId(url);\n },\n\n /**\n * Get a service value from a provided clusterId. This method will\n * return an object containing both the name and url of a found service.\n * @param {object} params\n * @param {string} params.clusterId - clusterId of found service\n * @param {boolean} [params.priorityHost] - returns priority host url if true\n * @param {string} [params.serviceGroup] - specify service group\n * @returns {object} service\n * @returns {string} service.name\n * @returns {string} service.url\n */\n getServiceFromClusterId(params) {\n const catalog = this._getCatalog();\n\n return catalog.findServiceFromClusterId(params);\n },\n\n /**\n * @param {String} cluster the cluster containing the id\n * @param {UUID} [id] the id of the conversation.\n * If empty, just return the base URL.\n * @returns {String} url of the service\n */\n getServiceUrlFromClusterId({cluster = 'us'} = {}) {\n let clusterId = cluster === 'us' ? DEFAULT_CLUSTER_IDENTIFIER : cluster;\n\n // Determine if cluster has service name (non-US clusters from hydra do not)\n if (clusterId.split(':').length < 4) {\n // Add Service to cluster identifier\n clusterId = `${cluster}:${CLUSTER_SERVICE}`;\n }\n\n const {url} = this.getServiceFromClusterId({clusterId}) || {};\n\n if (!url) {\n throw Error(`Could not find service for cluster [${cluster}]`);\n }\n\n return url;\n },\n\n /**\n * Get a service object from a service url if the service url exists in the\n * catalog.\n *\n * @param {string} url - The url to be validated.\n * @returns {object} - Service object.\n * @returns {object.name} - The name of the service found.\n * @returns {object.priorityUrl} - The priority url of the found service.\n * @returns {object.defaultUrl} - The default url of the found service.\n */\n getServiceFromUrl(url = '') {\n const service = this._getCatalog().findServiceUrlFromUrl(url);\n\n if (!service) {\n return undefined;\n }\n\n return {\n name: service.name,\n priorityUrl: service.get(true),\n defaultUrl: service.get(),\n };\n },\n\n /**\n * Verify that a provided url exists in the service\n * catalog.\n * @param {string} url\n * @returns {boolean} - true if exists, false otherwise\n */\n isServiceUrl(url) {\n const catalog = this._getCatalog();\n\n return !!catalog.findServiceUrlFromUrl(url);\n },\n\n /**\n * Determine if a provided url is in the catalog's allowed domains.\n *\n * @param {string} url - The url to match allowed domains against.\n * @returns {boolean} - True if the url provided is allowed.\n */\n isAllowedDomainUrl(url) {\n const catalog = this._getCatalog();\n\n return !!catalog.findAllowedDomain(url);\n },\n\n /**\n * Converts the host portion of the url from default host\n * to a priority host\n *\n * @param {string} url a service url that contains a default host\n * @returns {string} a service url that contains the top priority host.\n * @throws if url isn't a service url\n */\n convertUrlToPriorityHostUrl(url = '') {\n const data = this.getServiceFromUrl(url);\n\n if (!data) {\n throw Error(`No service associated with url: [${url}]`);\n }\n\n return url.replace(data.defaultUrl, data.priorityUrl);\n },\n\n /**\n * @private\n * Simplified method wrapper for sending a request to get\n * an updated service hostmap.\n * @param {object} [param]\n * @param {string} [param.from] - This accepts `limited` or `signin`\n * @param {object} [param.query] - This accepts `email`, `orgId` or `userId` key values\n * @param {string} [param.query.email] - must be a standard-format email\n * @param {string} [param.query.orgId] - must be an organization id\n * @param {string} [param.query.userId] - must be a user id\n * @param {string} [param.token] - used for signin catalog\n * @returns {Promise<object>}\n */\n _fetchNewServiceHostmap({from, query, token, forceRefresh} = {}) {\n const service = 'u2c';\n const resource = from ? `/${from}/catalog` : '/catalog';\n const qs = {...query, format: 'hostmap'};\n\n if (forceRefresh) {\n qs.timestamp = new Date().getTime();\n }\n\n const requestObject = {\n method: 'GET',\n service,\n resource,\n qs,\n };\n\n if (token) {\n requestObject.headers = {authorization: token};\n }\n\n return this.webex.internal.newMetrics.callDiagnosticLatencies\n .measureLatency(() => this.request(requestObject), 'internal.get.u2c.time')\n .then(({body}) => this._formatReceivedHostmap(body));\n },\n\n /**\n * Initialize the discovery services and the whitelisted services.\n *\n * @returns {void}\n */\n initConfig() {\n // Get the catalog and destructure the services config.\n const catalog = this._getCatalog();\n const {services, fedramp} = this.webex.config;\n\n // Validate that the services configuration exists.\n if (services) {\n if (fedramp) {\n services.discovery = fedRampServices;\n }\n // Check for discovery services.\n if (services.discovery) {\n // Format the discovery configuration into an injectable array.\n const formattedDiscoveryServices = Object.keys(services.discovery).map((key) => ({\n name: key,\n defaultUrl: services.discovery[key],\n }));\n\n // Inject formatted discovery services into services catalog.\n catalog.updateServiceUrls('discovery', formattedDiscoveryServices);\n }\n\n if (services.override) {\n // Format the override configuration into an injectable array.\n const formattedOverrideServices = Object.keys(services.override).map((key) => ({\n name: key,\n defaultUrl: services.override[key],\n }));\n\n // Inject formatted override services into services catalog.\n catalog.updateServiceUrls('override', formattedOverrideServices);\n }\n\n // if not fedramp, append on the commercialAllowedDomains\n if (!fedramp) {\n services.allowedDomains = union(services.allowedDomains, COMMERCIAL_ALLOWED_DOMAINS);\n }\n\n // Check for allowed host domains.\n if (services.allowedDomains) {\n // Store the allowed domains as a property of the catalog.\n catalog.setAllowedDomains(services.allowedDomains);\n }\n\n // Set `validateDomains` property to match configuration\n this.validateDomains = services.validateDomains;\n }\n },\n\n /**\n * Make the initial requests to collect the root catalogs.\n *\n * @returns {Promise<void, Error>} - Errors if the token is unavailable.\n */\n initServiceCatalogs() {\n this.logger.info('services: initializing initial service catalogs');\n\n // Destructure the credentials plugin.\n const {credentials} = this.webex;\n\n // Init a promise chain. Must be done as a Promise.resolve() to allow\n // credentials#getOrgId() to properly throw.\n return (\n Promise.resolve()\n // Get the user's OrgId.\n .then(() => credentials.getOrgId())\n // Begin collecting the preauth/limited catalog.\n .then((orgId) => this.collectPreauthCatalog({orgId}))\n .then(() => {\n // Validate if the token is authorized.\n if (credentials.canAuthorize) {\n // Attempt to collect the postauth catalog.\n return this.updateServices().catch(() =>\n this.logger.warn('services: cannot retrieve postauth catalog')\n );\n }\n\n // Return a resolved promise for consistent return value.\n return Promise.resolve();\n })\n );\n },\n\n /**\n * Initializer\n *\n * @instance\n * @memberof Services\n * @returns {Services}\n */\n initialize() {\n const catalog = new ServiceCatalog();\n const registry = new ServiceRegistry();\n const state = new ServiceState();\n\n this._catalogs.set(this.webex, catalog);\n this.registries.set(this.webex, registry);\n this.states.set(this.webex, state);\n\n // Listen for configuration changes once.\n this.listenToOnce(this.webex, 'change:config', () => {\n this.initConfig();\n });\n\n // wait for webex instance to be ready before attempting\n // to update the service catalogs\n this.listenToOnce(this.webex, 'ready', () => {\n const {supertoken} = this.webex.credentials;\n // Validate if the supertoken exists.\n if (supertoken && supertoken.access_token) {\n this.initServiceCatalogs()\n .then(() => {\n catalog.isReady = true;\n })\n .catch((error) => {\n this.initFailed = true;\n this.logger.error(\n `services: failed to init initial services when credentials available, ${error?.message}`\n );\n });\n } else {\n const {email} = this.webex.config;\n\n this.collectPreauthCatalog(email ? {email} : undefined).catch((error) => {\n this.initFailed = true;\n this.logger.error(\n `services: failed to init initial services when no credentials available, ${error?.message}`\n );\n });\n }\n });\n },\n});\n/* eslint-enable no-underscore-dangle */\n\nexport default Services;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,IAAAA,IAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAH,sBAAA,CAAAC,OAAA;AAEA,IAAAG,QAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,eAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,gBAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,aAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,eAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,UAAA,GAAAR,OAAA;AAAuD,SAAAS,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,aAAA,CAAAH,CAAA,OAAAI,6BAAA,QAAAC,CAAA,GAAAD,6BAAA,CAAAJ,CAAA,GAAAC,CAAA,KAAAI,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAL,CAAA,WAAAM,gCAAA,CAAAP,CAAA,EAAAC,CAAA,EAAAO,UAAA,OAAAN,CAAA,CAAAO,IAAA,CAAAC,KAAA,CAAAR,CAAA,EAAAG,CAAA,YAAAH,CAAA;AAAA,SAAAS,cAAAX,CAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAW,SAAA,CAAAC,MAAA,EA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/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: "3.3.1-next.
|
|
60
|
+
version: "3.3.1-next.2"
|
|
61
61
|
});
|
|
62
62
|
(0, _webexCore.registerPlugin)('logger', Logger);
|
|
63
63
|
var _default = exports.default = Logger;
|
package/dist/webex-core.js
CHANGED
|
@@ -94,7 +94,7 @@ var MAX_FILE_SIZE_IN_MB = 2048;
|
|
|
94
94
|
* @class
|
|
95
95
|
*/
|
|
96
96
|
var WebexCore = _ampersandState.default.extend((_obj = {
|
|
97
|
-
version: "3.3.1-next.
|
|
97
|
+
version: "3.3.1-next.2",
|
|
98
98
|
children: {
|
|
99
99
|
internal: _webexInternalCore.default
|
|
100
100
|
},
|
|
@@ -636,7 +636,7 @@ var WebexCore = _ampersandState.default.extend((_obj = {
|
|
|
636
636
|
});
|
|
637
637
|
}
|
|
638
638
|
}, ((0, _applyDecoratedDescriptor2.default)(_obj, "_uploadPhaseUpload", [_common.retry], (0, _getOwnPropertyDescriptor.default)(_obj, "_uploadPhaseUpload"), _obj)), _obj));
|
|
639
|
-
WebexCore.version = "3.3.1-next.
|
|
639
|
+
WebexCore.version = "3.3.1-next.2";
|
|
640
640
|
(0, _webexInternalCorePluginMixin.default)(_webexInternalCore.default, _config.default, interceptors);
|
|
641
641
|
(0, _webexCorePluginMixin.default)(WebexCore, _config.default, interceptors);
|
|
642
642
|
var _default = exports.default = WebexCore;
|
package/package.json
CHANGED
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
"@webex/eslint-config-legacy": "0.0.0",
|
|
36
36
|
"@webex/jest-config-legacy": "0.0.0",
|
|
37
37
|
"@webex/legacy-tools": "0.0.0",
|
|
38
|
-
"@webex/test-helper-chai": "3.3.1-next.
|
|
39
|
-
"@webex/test-helper-make-local-url": "3.3.1-next.
|
|
40
|
-
"@webex/test-helper-mocha": "3.3.1-next.
|
|
41
|
-
"@webex/test-helper-mock-webex": "3.3.1-next.
|
|
42
|
-
"@webex/test-helper-refresh-callback": "3.3.1-next.
|
|
43
|
-
"@webex/test-helper-test-users": "3.3.1-next.
|
|
38
|
+
"@webex/test-helper-chai": "3.3.1-next.2",
|
|
39
|
+
"@webex/test-helper-make-local-url": "3.3.1-next.2",
|
|
40
|
+
"@webex/test-helper-mocha": "3.3.1-next.2",
|
|
41
|
+
"@webex/test-helper-mock-webex": "3.3.1-next.2",
|
|
42
|
+
"@webex/test-helper-refresh-callback": "3.3.1-next.2",
|
|
43
|
+
"@webex/test-helper-test-users": "3.3.1-next.2",
|
|
44
44
|
"chai": "^4.3.4",
|
|
45
45
|
"chai-as-promised": "^7.1.1",
|
|
46
46
|
"eslint": "^8.24.0",
|
|
@@ -48,12 +48,12 @@
|
|
|
48
48
|
"sinon": "^9.2.4"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@webex/common": "3.3.1-next.
|
|
52
|
-
"@webex/common-timers": "3.3.1-next.
|
|
53
|
-
"@webex/http-core": "3.3.1-next.
|
|
54
|
-
"@webex/internal-plugin-device": "3.3.1-next.
|
|
55
|
-
"@webex/plugin-logger": "3.3.1-next.
|
|
56
|
-
"@webex/storage-adapter-spec": "3.3.1-next.
|
|
51
|
+
"@webex/common": "3.3.1-next.2",
|
|
52
|
+
"@webex/common-timers": "3.3.1-next.2",
|
|
53
|
+
"@webex/http-core": "3.3.1-next.2",
|
|
54
|
+
"@webex/internal-plugin-device": "3.3.1-next.2",
|
|
55
|
+
"@webex/plugin-logger": "3.3.1-next.2",
|
|
56
|
+
"@webex/storage-adapter-spec": "3.3.1-next.2",
|
|
57
57
|
"ampersand-collection": "^2.0.2",
|
|
58
58
|
"ampersand-events": "^2.0.2",
|
|
59
59
|
"ampersand-state": "^5.0.3",
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"test:style": "eslint ./src/**/*.*",
|
|
74
74
|
"test:unit": "webex-legacy-tools test --unit --runner jest"
|
|
75
75
|
},
|
|
76
|
-
"version": "3.3.1-next.
|
|
76
|
+
"version": "3.3.1-next.2"
|
|
77
77
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import Url from 'url';
|
|
2
|
-
|
|
3
1
|
import sha256 from 'crypto-js/sha256';
|
|
4
2
|
|
|
5
|
-
import {union} from 'lodash';
|
|
3
|
+
import {union, forEach} from 'lodash';
|
|
6
4
|
import WebexPlugin from '../webex-plugin';
|
|
7
5
|
|
|
8
6
|
import METRICS from './metrics';
|
|
@@ -686,59 +684,74 @@ const Services = WebexPlugin.extend({
|
|
|
686
684
|
*/
|
|
687
685
|
_formatReceivedHostmap(serviceHostmap) {
|
|
688
686
|
this._updateHostCatalog(serviceHostmap.hostCatalog);
|
|
689
|
-
// map the host catalog items to a formatted hostmap
|
|
690
|
-
const formattedHostmap = Object.keys(serviceHostmap.hostCatalog).reduce((accumulator, key) => {
|
|
691
|
-
if (serviceHostmap.hostCatalog[key].length === 0) {
|
|
692
|
-
return accumulator;
|
|
693
|
-
}
|
|
694
687
|
|
|
695
|
-
|
|
696
|
-
const defaultUrl = serviceHostmap.serviceLinks[serviceName];
|
|
688
|
+
const extractId = (entry) => entry.id.split(':')[3];
|
|
697
689
|
|
|
698
|
-
|
|
690
|
+
const formattedHostmap = [];
|
|
699
691
|
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
defaultUrl,
|
|
704
|
-
defaultHost: Url.parse(defaultUrl).hostname,
|
|
705
|
-
hosts: [],
|
|
706
|
-
};
|
|
692
|
+
// for each of the services in the serviceLinks, find the matching host in the catalog
|
|
693
|
+
Object.keys(serviceHostmap.serviceLinks).forEach((serviceName) => {
|
|
694
|
+
const serviceUrl = serviceHostmap.serviceLinks[serviceName];
|
|
707
695
|
|
|
708
|
-
|
|
696
|
+
let host;
|
|
697
|
+
try {
|
|
698
|
+
host = new URL(serviceUrl).host;
|
|
699
|
+
} catch (e) {
|
|
700
|
+
return;
|
|
709
701
|
}
|
|
710
702
|
|
|
711
|
-
|
|
712
|
-
// map the default key as a low priority default for cluster matching
|
|
713
|
-
{
|
|
714
|
-
host: key,
|
|
715
|
-
ttl: -1,
|
|
716
|
-
priority: 10,
|
|
717
|
-
id: serviceHostmap.hostCatalog[key][0].id,
|
|
718
|
-
homeCluster: serviceItem.defaultHost === key,
|
|
719
|
-
},
|
|
720
|
-
// map the rest of the hosts in their proper locations
|
|
721
|
-
...serviceHostmap.hostCatalog[key].map((host) => ({
|
|
722
|
-
...host,
|
|
723
|
-
homeCluster: serviceItem.defaultHost === key,
|
|
724
|
-
}))
|
|
725
|
-
);
|
|
703
|
+
const matchingCatalogEntry = serviceHostmap.hostCatalog[host];
|
|
726
704
|
|
|
727
|
-
|
|
728
|
-
|
|
705
|
+
const formattedHost = {
|
|
706
|
+
name: serviceName,
|
|
707
|
+
defaultUrl: serviceUrl,
|
|
708
|
+
defaultHost: host,
|
|
709
|
+
hosts: [],
|
|
710
|
+
};
|
|
729
711
|
|
|
730
|
-
|
|
731
|
-
Object.keys(serviceHostmap.serviceLinks).forEach((key) => {
|
|
732
|
-
const service = formattedHostmap.find((item) => item.name === key);
|
|
712
|
+
formattedHostmap.push(formattedHost);
|
|
733
713
|
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
defaultHost: Url.parse(serviceHostmap.serviceLinks[key]).hostname,
|
|
739
|
-
hosts: [],
|
|
740
|
-
});
|
|
714
|
+
// If the catalog does not have any hosts we will be unable to find the service ID
|
|
715
|
+
// so can't search for other hosts
|
|
716
|
+
if (!matchingCatalogEntry || !matchingCatalogEntry[0]) {
|
|
717
|
+
return;
|
|
741
718
|
}
|
|
719
|
+
|
|
720
|
+
const serviceId = extractId(matchingCatalogEntry[0]);
|
|
721
|
+
|
|
722
|
+
forEach(matchingCatalogEntry, (entry) => {
|
|
723
|
+
// The ids for all hosts within a hostCatalog entry should be the same
|
|
724
|
+
// but for safety, only add host entries that have the same id as the first one
|
|
725
|
+
if (extractId(entry) === serviceId) {
|
|
726
|
+
formattedHost.hosts.push({
|
|
727
|
+
...entry,
|
|
728
|
+
homeCluster: true,
|
|
729
|
+
});
|
|
730
|
+
}
|
|
731
|
+
});
|
|
732
|
+
|
|
733
|
+
const otherHosts = [];
|
|
734
|
+
|
|
735
|
+
// find the services in the host catalog that have the same id
|
|
736
|
+
// and add them to the otherHosts
|
|
737
|
+
forEach(serviceHostmap.hostCatalog, (entry) => {
|
|
738
|
+
// exclude the matching catalog entry as we have already added that
|
|
739
|
+
if (entry === matchingCatalogEntry) {
|
|
740
|
+
return;
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
forEach(entry, (entryHost) => {
|
|
744
|
+
// only add hosts that have the correct id
|
|
745
|
+
if (extractId(entryHost) === serviceId) {
|
|
746
|
+
otherHosts.push({
|
|
747
|
+
...entryHost,
|
|
748
|
+
homeCluster: false,
|
|
749
|
+
});
|
|
750
|
+
}
|
|
751
|
+
});
|
|
752
|
+
});
|
|
753
|
+
|
|
754
|
+
formattedHost.hosts.push(...otherHosts);
|
|
742
755
|
});
|
|
743
756
|
|
|
744
757
|
// update all the service urls in the host catalog
|
|
@@ -37,11 +37,15 @@ describe('webex-core', () => {
|
|
|
37
37
|
orgId: process.env.EU_PRIMARY_ORG_ID,
|
|
38
38
|
},
|
|
39
39
|
}),
|
|
40
|
-
]).then(([[user], [userEU]]) =>
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
]).then(([[user], [userEU]]) =>
|
|
41
|
+
new Promise((resolve) => {
|
|
42
|
+
setTimeout(() => {
|
|
43
|
+
webexUser = user;
|
|
44
|
+
webexUserEU = userEU;
|
|
45
|
+
resolve();
|
|
46
|
+
}, 1000)
|
|
47
|
+
})
|
|
48
|
+
));
|
|
45
49
|
|
|
46
50
|
beforeEach('create webex instance', () => {
|
|
47
51
|
webex = new WebexCore({credentials: {supertoken: webexUser.token}});
|
|
@@ -301,6 +301,9 @@ describe('webex-core', () => {
|
|
|
301
301
|
'example-b': 'https://example-b.com/api/v1',
|
|
302
302
|
'example-c': 'https://example-c.com/api/v1',
|
|
303
303
|
'example-d': 'https://example-d.com/api/v1',
|
|
304
|
+
'example-e': 'https://example-e.com/api/v1',
|
|
305
|
+
'example-f': 'https://example-f.com/api/v1',
|
|
306
|
+
'example-g': 'https://example-g.com/api/v1',
|
|
304
307
|
},
|
|
305
308
|
hostCatalog: {
|
|
306
309
|
'example-a.com': [
|
|
@@ -383,6 +386,48 @@ describe('webex-core', () => {
|
|
|
383
386
|
id: '0:0:0:example-d-x',
|
|
384
387
|
},
|
|
385
388
|
],
|
|
389
|
+
'example-e.com': [
|
|
390
|
+
{
|
|
391
|
+
host: 'example-e-1.com',
|
|
392
|
+
ttl: -1,
|
|
393
|
+
priority: 5,
|
|
394
|
+
id: '0:0:0:different-e',
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
host: 'example-e-2.com',
|
|
398
|
+
ttl: -1,
|
|
399
|
+
priority: 3,
|
|
400
|
+
id: '0:0:0:different-e',
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
host: 'example-e-3.com',
|
|
404
|
+
ttl: -1,
|
|
405
|
+
priority: 1,
|
|
406
|
+
id: '0:0:0:different-e',
|
|
407
|
+
},
|
|
408
|
+
],
|
|
409
|
+
'example-e-1.com': [
|
|
410
|
+
{
|
|
411
|
+
host: 'example-e-4.com',
|
|
412
|
+
ttl: -1,
|
|
413
|
+
priority: 5,
|
|
414
|
+
id: '0:0:0:different-e',
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
host: 'example-e-5.com',
|
|
418
|
+
ttl: -1,
|
|
419
|
+
priority: 3,
|
|
420
|
+
id: '0:0:0:different-e',
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
host: 'example-e-3.com',
|
|
424
|
+
ttl: -1,
|
|
425
|
+
priority: 1,
|
|
426
|
+
id: '0:0:0:different-e-x',
|
|
427
|
+
},
|
|
428
|
+
],
|
|
429
|
+
'example-f.com': [
|
|
430
|
+
],
|
|
386
431
|
},
|
|
387
432
|
format: 'hostmap',
|
|
388
433
|
};
|
|
@@ -440,16 +485,6 @@ describe('webex-core', () => {
|
|
|
440
485
|
});
|
|
441
486
|
});
|
|
442
487
|
|
|
443
|
-
it('creates a formmated host map containing all received host map host entries', () => {
|
|
444
|
-
formattedHM = services._formatReceivedHostmap(serviceHostmap);
|
|
445
|
-
|
|
446
|
-
formattedHM.forEach((service) => {
|
|
447
|
-
const foundHosts = serviceHostmap.hostCatalog[service.defaultHost];
|
|
448
|
-
|
|
449
|
-
assert.isDefined(foundHosts);
|
|
450
|
-
});
|
|
451
|
-
});
|
|
452
|
-
|
|
453
488
|
it('creates an array with matching names', () => {
|
|
454
489
|
formattedHM = services._formatReceivedHostmap(serviceHostmap);
|
|
455
490
|
|
|
@@ -459,6 +494,151 @@ describe('webex-core', () => {
|
|
|
459
494
|
);
|
|
460
495
|
});
|
|
461
496
|
|
|
497
|
+
it('creates the expected formatted host map', () => {
|
|
498
|
+
formattedHM = services._formatReceivedHostmap(serviceHostmap);
|
|
499
|
+
|
|
500
|
+
assert.deepEqual(formattedHM, [
|
|
501
|
+
{
|
|
502
|
+
defaultHost: 'example-a.com',
|
|
503
|
+
defaultUrl: 'https://example-a.com/api/v1',
|
|
504
|
+
hosts: [
|
|
505
|
+
{
|
|
506
|
+
homeCluster: true,
|
|
507
|
+
host: 'example-a-1.com',
|
|
508
|
+
id: '0:0:0:example-a',
|
|
509
|
+
priority: 5,
|
|
510
|
+
ttl: -1,
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
homeCluster: true,
|
|
514
|
+
host: 'example-a-2.com',
|
|
515
|
+
id: '0:0:0:example-a',
|
|
516
|
+
priority: 3,
|
|
517
|
+
ttl: -1,
|
|
518
|
+
},
|
|
519
|
+
],
|
|
520
|
+
name: 'example-a',
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
defaultHost: 'example-b.com',
|
|
524
|
+
defaultUrl: 'https://example-b.com/api/v1',
|
|
525
|
+
hosts: [
|
|
526
|
+
{
|
|
527
|
+
homeCluster: true,
|
|
528
|
+
host: 'example-b-1.com',
|
|
529
|
+
id: '0:0:0:example-b',
|
|
530
|
+
priority: 5,
|
|
531
|
+
ttl: -1,
|
|
532
|
+
},
|
|
533
|
+
{
|
|
534
|
+
homeCluster: true,
|
|
535
|
+
host: 'example-b-2.com',
|
|
536
|
+
id: '0:0:0:example-b',
|
|
537
|
+
priority: 3,
|
|
538
|
+
ttl: -1,
|
|
539
|
+
},
|
|
540
|
+
],
|
|
541
|
+
name: 'example-b',
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
defaultHost: 'example-c.com',
|
|
545
|
+
defaultUrl: 'https://example-c.com/api/v1',
|
|
546
|
+
hosts: [
|
|
547
|
+
{
|
|
548
|
+
homeCluster: true,
|
|
549
|
+
host: 'example-c-1.com',
|
|
550
|
+
id: '0:0:0:example-c',
|
|
551
|
+
priority: 5,
|
|
552
|
+
ttl: -1,
|
|
553
|
+
},
|
|
554
|
+
{
|
|
555
|
+
homeCluster: true,
|
|
556
|
+
host: 'example-c-2.com',
|
|
557
|
+
id: '0:0:0:example-c',
|
|
558
|
+
priority: 3,
|
|
559
|
+
ttl: -1,
|
|
560
|
+
},
|
|
561
|
+
],
|
|
562
|
+
name: 'example-c',
|
|
563
|
+
},
|
|
564
|
+
{
|
|
565
|
+
defaultHost: 'example-d.com',
|
|
566
|
+
defaultUrl: 'https://example-d.com/api/v1',
|
|
567
|
+
hosts: [
|
|
568
|
+
{
|
|
569
|
+
homeCluster: true,
|
|
570
|
+
host: 'example-c-1.com',
|
|
571
|
+
id: '0:0:0:example-d',
|
|
572
|
+
priority: 5,
|
|
573
|
+
ttl: -1,
|
|
574
|
+
},
|
|
575
|
+
{
|
|
576
|
+
homeCluster: true,
|
|
577
|
+
host: 'example-c-2.com',
|
|
578
|
+
id: '0:0:0:example-d',
|
|
579
|
+
priority: 3,
|
|
580
|
+
ttl: -1,
|
|
581
|
+
},
|
|
582
|
+
],
|
|
583
|
+
name: 'example-d',
|
|
584
|
+
},
|
|
585
|
+
{
|
|
586
|
+
defaultHost: 'example-e.com',
|
|
587
|
+
defaultUrl: 'https://example-e.com/api/v1',
|
|
588
|
+
hosts: [
|
|
589
|
+
{
|
|
590
|
+
homeCluster: true,
|
|
591
|
+
host: 'example-e-1.com',
|
|
592
|
+
id: '0:0:0:different-e',
|
|
593
|
+
priority: 5,
|
|
594
|
+
ttl: -1,
|
|
595
|
+
},
|
|
596
|
+
{
|
|
597
|
+
homeCluster: true,
|
|
598
|
+
host: 'example-e-2.com',
|
|
599
|
+
id: '0:0:0:different-e',
|
|
600
|
+
priority: 3,
|
|
601
|
+
ttl: -1,
|
|
602
|
+
},
|
|
603
|
+
{
|
|
604
|
+
homeCluster: true,
|
|
605
|
+
host: 'example-e-3.com',
|
|
606
|
+
id: '0:0:0:different-e',
|
|
607
|
+
priority: 1,
|
|
608
|
+
ttl: -1,
|
|
609
|
+
},
|
|
610
|
+
{
|
|
611
|
+
homeCluster: false,
|
|
612
|
+
host: 'example-e-4.com',
|
|
613
|
+
id: '0:0:0:different-e',
|
|
614
|
+
priority: 5,
|
|
615
|
+
ttl: -1,
|
|
616
|
+
},
|
|
617
|
+
{
|
|
618
|
+
homeCluster: false,
|
|
619
|
+
host: 'example-e-5.com',
|
|
620
|
+
id: '0:0:0:different-e',
|
|
621
|
+
priority: 3,
|
|
622
|
+
ttl: -1,
|
|
623
|
+
},
|
|
624
|
+
],
|
|
625
|
+
name: 'example-e',
|
|
626
|
+
},
|
|
627
|
+
{
|
|
628
|
+
defaultHost: 'example-f.com',
|
|
629
|
+
defaultUrl: 'https://example-f.com/api/v1',
|
|
630
|
+
hosts: [],
|
|
631
|
+
name: 'example-f',
|
|
632
|
+
},
|
|
633
|
+
{
|
|
634
|
+
defaultHost: 'example-g.com',
|
|
635
|
+
defaultUrl: 'https://example-g.com/api/v1',
|
|
636
|
+
hosts: [],
|
|
637
|
+
name: 'example-g',
|
|
638
|
+
}
|
|
639
|
+
]);
|
|
640
|
+
});
|
|
641
|
+
|
|
462
642
|
it('has hostCatalog updated', () => {
|
|
463
643
|
services._formatReceivedHostmap(serviceHostmap);
|
|
464
644
|
|