@webex/webex-core 3.8.0-next.2 → 3.8.0-next.4
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/service-catalog.js +23 -68
- package/dist/lib/services/service-catalog.js.map +1 -1
- package/dist/lib/services/services.js +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/service-catalog.js +14 -54
- package/test/unit/spec/services/service-catalog.js +30 -90
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.8.0-next.
|
|
289
|
+
version: "3.8.0-next.4"
|
|
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.8.0-next.
|
|
561
|
+
version: "3.8.0-next.4"
|
|
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.8.0-next.
|
|
535
|
+
version: "3.8.0-next.4"
|
|
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
|
|
@@ -254,78 +254,33 @@ var ServiceCatalog = _ampersandState.default.extend({
|
|
|
254
254
|
*/
|
|
255
255
|
findServiceUrlFromUrl: function findServiceUrlFromUrl(url) {
|
|
256
256
|
var serviceUrls = [].concat((0, _toConsumableArray2.default)(this.serviceGroups.discovery), (0, _toConsumableArray2.default)(this.serviceGroups.preauth), (0, _toConsumableArray2.default)(this.serviceGroups.signin), (0, _toConsumableArray2.default)(this.serviceGroups.postauth), (0, _toConsumableArray2.default)(this.serviceGroups.override));
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
return false;
|
|
263
|
-
}
|
|
264
|
-
var exactMatch = null;
|
|
265
|
-
var anyMatch = null;
|
|
266
|
-
var _iterator4 = _createForOfIteratorHelper(serviceUrls),
|
|
267
|
-
_step4;
|
|
268
|
-
try {
|
|
269
|
-
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
270
|
-
var serviceUrl = _step4.value;
|
|
271
|
-
var defaultServiceUrl = void 0;
|
|
272
|
-
try {
|
|
273
|
-
defaultServiceUrl = new URL(serviceUrl.defaultUrl);
|
|
274
|
-
} catch (error) {
|
|
275
|
-
// If URL parsing fails for the default URL, skip this service URL
|
|
276
|
-
|
|
277
|
-
// eslint-disable-next-line no-continue
|
|
278
|
-
continue;
|
|
279
|
-
}
|
|
280
|
-
var defaultHostname = defaultServiceUrl.hostname;
|
|
281
|
-
|
|
282
|
-
// Check if the hostname matches the default URL's hostname
|
|
283
|
-
if (inputUrl.hostname === defaultHostname) {
|
|
284
|
-
if (inputUrl.protocol === defaultServiceUrl.protocol) {
|
|
285
|
-
exactMatch = serviceUrl;
|
|
286
|
-
break;
|
|
287
|
-
} else {
|
|
288
|
-
anyMatch = serviceUrl;
|
|
289
|
-
}
|
|
290
|
-
}
|
|
257
|
+
return serviceUrls.find(function (serviceUrl) {
|
|
258
|
+
// Check to see if the URL we are checking starts with the default URL
|
|
259
|
+
if (url.startsWith(serviceUrl.defaultUrl)) {
|
|
260
|
+
return true;
|
|
261
|
+
}
|
|
291
262
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
break;
|
|
305
|
-
} else {
|
|
306
|
-
anyMatch = serviceUrl;
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
} catch (error) {
|
|
310
|
-
// If URL parsing fails for the alternate URL, skip this host
|
|
311
|
-
// Just let the loop proceed to the next iteration
|
|
312
|
-
}
|
|
263
|
+
// If not, we check to see if the alternate URLs match
|
|
264
|
+
// These are made by swapping the host of the default URL
|
|
265
|
+
// with that of an alternate host
|
|
266
|
+
var _iterator4 = _createForOfIteratorHelper(serviceUrl.hosts),
|
|
267
|
+
_step4;
|
|
268
|
+
try {
|
|
269
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
270
|
+
var host = _step4.value;
|
|
271
|
+
var alternateUrl = new URL(serviceUrl.defaultUrl);
|
|
272
|
+
alternateUrl.host = host.host;
|
|
273
|
+
if (url.startsWith(alternateUrl.toString())) {
|
|
274
|
+
return true;
|
|
313
275
|
}
|
|
314
|
-
} catch (err) {
|
|
315
|
-
_iterator5.e(err);
|
|
316
|
-
} finally {
|
|
317
|
-
_iterator5.f();
|
|
318
|
-
}
|
|
319
|
-
if (exactMatch) {
|
|
320
|
-
break;
|
|
321
276
|
}
|
|
277
|
+
} catch (err) {
|
|
278
|
+
_iterator4.e(err);
|
|
279
|
+
} finally {
|
|
280
|
+
_iterator4.f();
|
|
322
281
|
}
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
} finally {
|
|
326
|
-
_iterator4.f();
|
|
327
|
-
}
|
|
328
|
-
return exactMatch || anyMatch || false;
|
|
282
|
+
return false;
|
|
283
|
+
});
|
|
329
284
|
},
|
|
330
285
|
/**
|
|
331
286
|
* Finds an allowed domain that matches a specific url.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_url","_interopRequireDefault","require","_ampersandState","_lodash","_serviceUrl","ownKeys","e","r","t","_Object$keys3","_Object$getOwnPropertySymbols","o","filter","_Object$getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","Object","forEach","_defineProperty2","default","_Object$getOwnPropertyDescriptors","_Object$defineProperties","_Object$defineProperty","_createForOfIteratorHelper","allowArrayLike","it","_Symbol","_Symbol$iterator","_Array$isArray","_unsupportedIterableToArray","i","F","s","n","done","value","_e","f","TypeError","normalCompletion","didErr","err","call","step","next","_e2","return","minLen","_arrayLikeToArray","prototype","toString","slice","constructor","name","_Array$from","test","arr","len","arr2","Array","ServiceCatalog","AmpState","extend","namespace","props","serviceGroups","discovery","override","preauth","postauth","signin","status","ready","collecting","isReady","allowedDomains","_getUrl","serviceGroup","serviceUrls","concat","_toConsumableArray2","find","serviceUrl","_listServiceUrls","_loadServiceUrls","services","_this","existingService","service","_unloadServiceUrls","_this2","splice","indexOf","clean","findClusterId","url","incomingUrlObj","Url","parse","serviceUrlObj","_i","_Object$keys","_keys","key","_iterator","_step","defaultUrl","_iterator2","hosts","_step2","host","hostname","id","_iterator3","_step3","homeCluster","undefined","findServiceFromClusterId","_ref","clusterId","_ref$priorityHost","priorityHost","identifiedServiceUrl","get","findServiceUrlFromUrl","inputUrl","URL","error","exactMatch","anyMatch","_iterator4","_step4","defaultServiceUrl","defaultHostname","protocol","_iterator5","_step5","alternateUrl","findAllowedDomain","urlObj","allowedDomain","includes","getAllowedDomains","list","output","markFailedUrl","noPriorityHosts","_this3","failHost","setAllowedDomains","addAllowedDomains","newAllowedDomains","union","updateServiceUrls","serviceHostmap","_this4","currentServiceUrls","unusedUrls","every","item","serviceObj","ServiceUrl","trigger","waitForCatalog","timeout","_this5","_promise","resolve","reject","validatedTimeout","timeoutTimer","setTimeout","Error","once","clearTimeout","_default","exports"],"sources":["service-catalog.js"],"sourcesContent":["import Url from 'url';\n\nimport AmpState from 'ampersand-state';\n\nimport {union} from 'lodash';\nimport ServiceUrl from './service-url';\n\n/* eslint-disable no-underscore-dangle */\n/**\n * @class\n */\nconst ServiceCatalog = AmpState.extend({\n namespace: 'ServiceCatalog',\n\n props: {\n serviceGroups: [\n 'object',\n true,\n () => ({\n discovery: [],\n override: [],\n preauth: [],\n postauth: [],\n signin: [],\n }),\n ],\n status: [\n 'object',\n true,\n () => ({\n discovery: {\n ready: false,\n collecting: false,\n },\n override: {\n ready: false,\n collecting: false,\n },\n preauth: {\n ready: false,\n collecting: false,\n },\n postauth: {\n ready: false,\n collecting: false,\n },\n signin: {\n ready: false,\n collecting: false,\n },\n }),\n ],\n isReady: ['boolean', false, false],\n allowedDomains: ['array', false, () => []],\n },\n\n /**\n * @private\n * Search the service url array to locate a `ServiceUrl`\n * class object based on its name.\n * @param {string} name\n * @param {string} [serviceGroup]\n * @returns {ServiceUrl}\n */\n _getUrl(name, serviceGroup) {\n const serviceUrls =\n typeof serviceGroup === 'string'\n ? this.serviceGroups[serviceGroup] || []\n : [\n ...this.serviceGroups.override,\n ...this.serviceGroups.postauth,\n ...this.serviceGroups.signin,\n ...this.serviceGroups.preauth,\n ...this.serviceGroups.discovery,\n ];\n\n return serviceUrls.find((serviceUrl) => serviceUrl.name === name);\n },\n\n /**\n * @private\n * Generate an array of `ServiceUrl`s that is organized from highest auth\n * level to lowest auth level.\n * @returns {Array<ServiceUrl>} - array of `ServiceUrl`s\n */\n _listServiceUrls() {\n return [\n ...this.serviceGroups.override,\n ...this.serviceGroups.postauth,\n ...this.serviceGroups.signin,\n ...this.serviceGroups.preauth,\n ...this.serviceGroups.discovery,\n ];\n },\n\n /**\n * @private\n * Safely load one or more `ServiceUrl`s into this `Services` instance.\n * @param {string} serviceGroup\n * @param {Array<ServiceUrl>} services\n * @returns {Services}\n */\n _loadServiceUrls(serviceGroup, services) {\n // declare namespaces outside of loop\n let existingService;\n\n services.forEach((service) => {\n existingService = this._getUrl(service.name, serviceGroup);\n\n if (!existingService) {\n this.serviceGroups[serviceGroup].push(service);\n }\n });\n\n return this;\n },\n\n /**\n * @private\n * Safely unload one or more `ServiceUrl`s into this `Services` instance\n * @param {string} serviceGroup\n * @param {Array<ServiceUrl>} services\n * @returns {Services}\n */\n _unloadServiceUrls(serviceGroup, services) {\n // declare namespaces outside of loop\n let existingService;\n\n services.forEach((service) => {\n existingService = this._getUrl(service.name, serviceGroup);\n\n if (existingService) {\n this.serviceGroups[serviceGroup].splice(\n this.serviceGroups[serviceGroup].indexOf(existingService),\n 1\n );\n }\n });\n\n return this;\n },\n\n /**\n * Clear all collected catalog data and reset catalog status.\n *\n * @returns {void}\n */\n clean() {\n this.serviceGroups.preauth.length = 0;\n this.serviceGroups.signin.length = 0;\n this.serviceGroups.postauth.length = 0;\n this.status.preauth = {ready: false};\n this.status.signin = {ready: false};\n this.status.postauth = {ready: false};\n },\n\n /**\n * Search over all service groups to find a cluster id based\n * on a given url.\n * @param {string} url - Must be parsable by `Url`\n * @returns {string} - ClusterId of a given url\n */\n findClusterId(url) {\n const incomingUrlObj = Url.parse(url);\n let serviceUrlObj;\n\n for (const key of Object.keys(this.serviceGroups)) {\n for (const service of this.serviceGroups[key]) {\n serviceUrlObj = Url.parse(service.defaultUrl);\n\n for (const host of service.hosts) {\n if (incomingUrlObj.hostname === host.host && host.id) {\n return host.id;\n }\n }\n\n if (serviceUrlObj.hostname === incomingUrlObj.hostname && service.hosts.length > 0) {\n // no exact match, so try to grab the first home cluster\n for (const host of service.hosts) {\n if (host.homeCluster) {\n return host.id;\n }\n }\n\n // no match found still, so return the first entry\n return service.hosts[0].id;\n }\n }\n }\n\n return undefined;\n },\n\n /**\n * Search over all service groups and return a service value from a provided\n * clusterId. Currently, this method will return either a service name, or a\n * service url depending on the `value` parameter. If the `value` parameter\n * is set to `name`, it will return a service name to be utilized within the\n * Services plugin methods.\n * @param {object} params\n * @param {string} params.clusterId - clusterId of found service\n * @param {boolean} [params.priorityHost = true] - 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 findServiceFromClusterId({clusterId, priorityHost = true, serviceGroup} = {}) {\n const serviceUrls =\n typeof serviceGroup === 'string'\n ? this.serviceGroups[serviceGroup] || []\n : [\n ...this.serviceGroups.override,\n ...this.serviceGroups.postauth,\n ...this.serviceGroups.signin,\n ...this.serviceGroups.preauth,\n ...this.serviceGroups.discovery,\n ];\n\n const identifiedServiceUrl = serviceUrls.find((serviceUrl) =>\n serviceUrl.hosts.find((host) => host.id === clusterId)\n );\n\n if (identifiedServiceUrl) {\n return {\n name: identifiedServiceUrl.name,\n url: identifiedServiceUrl.get(priorityHost, clusterId),\n };\n }\n\n return undefined;\n },\n\n /**\n * Find a service based on the provided url.\n * @param {string} url - Must be parsable by `Url`\n * @returns {serviceUrl} - ServiceUrl assocated with provided url\n */\n findServiceUrlFromUrl(url) {\n const serviceUrls = [\n ...this.serviceGroups.discovery,\n ...this.serviceGroups.preauth,\n ...this.serviceGroups.signin,\n ...this.serviceGroups.postauth,\n ...this.serviceGroups.override,\n ];\n\n let inputUrl;\n try {\n inputUrl = new URL(url);\n } catch (error) {\n // If URL parsing fails, return false\n return false;\n }\n\n let exactMatch = null;\n let anyMatch = null;\n\n for (const serviceUrl of serviceUrls) {\n let defaultServiceUrl;\n try {\n defaultServiceUrl = new URL(serviceUrl.defaultUrl);\n } catch (error) {\n // If URL parsing fails for the default URL, skip this service URL\n\n // eslint-disable-next-line no-continue\n continue;\n }\n\n const defaultHostname = defaultServiceUrl.hostname;\n\n // Check if the hostname matches the default URL's hostname\n if (inputUrl.hostname === defaultHostname) {\n if (inputUrl.protocol === defaultServiceUrl.protocol) {\n exactMatch = serviceUrl;\n break;\n } else {\n anyMatch = serviceUrl;\n }\n }\n\n // Check alternate hostnames\n for (const host of serviceUrl.hosts) {\n try {\n const alternateUrl = new URL(serviceUrl.defaultUrl);\n alternateUrl.hostname = host.host;\n\n if (inputUrl.hostname === alternateUrl.hostname) {\n if (inputUrl.protocol === alternateUrl.protocol) {\n exactMatch = serviceUrl;\n break;\n } else {\n anyMatch = serviceUrl;\n }\n }\n } catch (error) {\n // If URL parsing fails for the alternate URL, skip this host\n // Just let the loop proceed to the next iteration\n }\n }\n\n if (exactMatch) {\n break;\n }\n }\n\n return exactMatch || anyMatch || false;\n },\n\n /**\n * Finds an allowed domain that matches a specific url.\n *\n * @param {string} url - The url to match the allowed domains against.\n * @returns {string} - The matching allowed domain.\n */\n findAllowedDomain(url) {\n const urlObj = Url.parse(url);\n\n if (!urlObj.host) {\n return undefined;\n }\n\n return this.allowedDomains.find((allowedDomain) => urlObj.host.includes(allowedDomain));\n },\n\n /**\n * Get a service url from the current services list by name.\n * @param {string} name\n * @param {boolean} priorityHost\n * @param {string} serviceGroup\n * @returns {string}\n */\n get(name, priorityHost, serviceGroup) {\n const serviceUrl = this._getUrl(name, serviceGroup);\n\n return serviceUrl ? serviceUrl.get(priorityHost) : undefined;\n },\n\n /**\n * Get the current allowed domains list.\n *\n * @returns {Array<string>} - the current allowed domains list.\n */\n getAllowedDomains() {\n return [...this.allowedDomains];\n },\n\n /**\n * Creates an object where the keys are the service names\n * and the values are the service urls.\n * @param {boolean} priorityHost - use the highest priority if set to `true`\n * @param {string} [serviceGroup]\n * @returns {Record<string, string>}\n */\n list(priorityHost, serviceGroup) {\n const output = {};\n\n const serviceUrls =\n typeof serviceGroup === 'string'\n ? this.serviceGroups[serviceGroup] || []\n : [\n ...this.serviceGroups.discovery,\n ...this.serviceGroups.preauth,\n ...this.serviceGroups.signin,\n ...this.serviceGroups.postauth,\n ...this.serviceGroups.override,\n ];\n\n if (serviceUrls) {\n serviceUrls.forEach((serviceUrl) => {\n output[serviceUrl.name] = serviceUrl.get(priorityHost);\n });\n }\n\n return output;\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 serviceUrl = this._getUrl(\n Object.keys(this.list()).find((key) => this._getUrl(key).failHost(url))\n );\n\n if (!serviceUrl) {\n return undefined;\n }\n\n return noPriorityHosts ? serviceUrl.get(false) : serviceUrl.get(true);\n },\n\n /**\n * Set the allowed domains for the catalog.\n *\n * @param {Array<string>} allowedDomains - allowed domains to be assigned.\n * @returns {void}\n */\n setAllowedDomains(allowedDomains) {\n this.allowedDomains = [...allowedDomains];\n },\n\n /**\n *\n * @param {Array<string>} newAllowedDomains - new allowed domains to add to existing set of allowed domains\n * @returns {void}\n */\n addAllowedDomains(newAllowedDomains) {\n this.allowedDomains = union(this.allowedDomains, newAllowedDomains);\n },\n\n /**\n * Update the current list of `ServiceUrl`s against a provided\n * service hostmap.\n * @emits ServiceCatalog#preauthorized\n * @emits ServiceCatalog#postauthorized\n * @param {string} serviceGroup\n * @param {object} serviceHostmap\n * @returns {Services}\n */\n updateServiceUrls(serviceGroup, serviceHostmap) {\n const currentServiceUrls = this.serviceGroups[serviceGroup];\n\n const unusedUrls = currentServiceUrls.filter((serviceUrl) =>\n serviceHostmap.every((item) => item.name !== serviceUrl.name)\n );\n\n this._unloadServiceUrls(serviceGroup, unusedUrls);\n\n serviceHostmap.forEach((serviceObj) => {\n const service = this._getUrl(serviceObj.name, serviceGroup);\n\n if (service) {\n service.defaultUrl = serviceObj.defaultUrl;\n service.hosts = serviceObj.hosts || [];\n } else {\n this._loadServiceUrls(serviceGroup, [\n new ServiceUrl({\n ...serviceObj,\n }),\n ]);\n }\n });\n\n this.status[serviceGroup].ready = true;\n this.trigger(serviceGroup);\n\n return this;\n },\n\n /**\n * Wait until the service catalog is available,\n * or reject after a timeout of 60 seconds.\n * @param {string} serviceGroup\n * @param {number} [timeout] - in seconds\n * @returns {Promise<void>}\n */\n waitForCatalog(serviceGroup, timeout) {\n return new Promise((resolve, reject) => {\n if (this.status[serviceGroup].ready) {\n resolve();\n }\n\n const validatedTimeout = typeof timeout === 'number' && timeout >= 0 ? timeout : 60;\n\n const timeoutTimer = setTimeout(\n () =>\n reject(\n new Error(\n `services: timeout occured while waiting for '${serviceGroup}' catalog to populate`\n )\n ),\n validatedTimeout * 1000\n );\n\n this.once(serviceGroup, () => {\n clearTimeout(timeoutTimer);\n resolve();\n });\n });\n },\n});\n/* eslint-enable no-underscore-dangle */\n\nexport default ServiceCatalog;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,IAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,eAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAAuC,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"version":3,"names":["_url","_interopRequireDefault","require","_ampersandState","_lodash","_serviceUrl","ownKeys","e","r","t","_Object$keys3","_Object$getOwnPropertySymbols","o","filter","_Object$getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","Object","forEach","_defineProperty2","default","_Object$getOwnPropertyDescriptors","_Object$defineProperties","_Object$defineProperty","_createForOfIteratorHelper","allowArrayLike","it","_Symbol","_Symbol$iterator","_Array$isArray","_unsupportedIterableToArray","i","F","s","n","done","value","_e","f","TypeError","normalCompletion","didErr","err","call","step","next","_e2","return","minLen","_arrayLikeToArray","prototype","toString","slice","constructor","name","_Array$from","test","arr","len","arr2","Array","ServiceCatalog","AmpState","extend","namespace","props","serviceGroups","discovery","override","preauth","postauth","signin","status","ready","collecting","isReady","allowedDomains","_getUrl","serviceGroup","serviceUrls","concat","_toConsumableArray2","find","serviceUrl","_listServiceUrls","_loadServiceUrls","services","_this","existingService","service","_unloadServiceUrls","_this2","splice","indexOf","clean","findClusterId","url","incomingUrlObj","Url","parse","serviceUrlObj","_i","_Object$keys","_keys","key","_iterator","_step","defaultUrl","_iterator2","hosts","_step2","host","hostname","id","_iterator3","_step3","homeCluster","undefined","findServiceFromClusterId","_ref","clusterId","_ref$priorityHost","priorityHost","identifiedServiceUrl","get","findServiceUrlFromUrl","startsWith","_iterator4","_step4","alternateUrl","URL","findAllowedDomain","urlObj","allowedDomain","includes","getAllowedDomains","list","output","markFailedUrl","noPriorityHosts","_this3","failHost","setAllowedDomains","addAllowedDomains","newAllowedDomains","union","updateServiceUrls","serviceHostmap","_this4","currentServiceUrls","unusedUrls","every","item","serviceObj","ServiceUrl","trigger","waitForCatalog","timeout","_this5","_promise","resolve","reject","validatedTimeout","timeoutTimer","setTimeout","Error","once","clearTimeout","_default","exports"],"sources":["service-catalog.js"],"sourcesContent":["import Url from 'url';\n\nimport AmpState from 'ampersand-state';\n\nimport {union} from 'lodash';\nimport ServiceUrl from './service-url';\n\n/* eslint-disable no-underscore-dangle */\n/**\n * @class\n */\nconst ServiceCatalog = AmpState.extend({\n namespace: 'ServiceCatalog',\n\n props: {\n serviceGroups: [\n 'object',\n true,\n () => ({\n discovery: [],\n override: [],\n preauth: [],\n postauth: [],\n signin: [],\n }),\n ],\n status: [\n 'object',\n true,\n () => ({\n discovery: {\n ready: false,\n collecting: false,\n },\n override: {\n ready: false,\n collecting: false,\n },\n preauth: {\n ready: false,\n collecting: false,\n },\n postauth: {\n ready: false,\n collecting: false,\n },\n signin: {\n ready: false,\n collecting: false,\n },\n }),\n ],\n isReady: ['boolean', false, false],\n allowedDomains: ['array', false, () => []],\n },\n\n /**\n * @private\n * Search the service url array to locate a `ServiceUrl`\n * class object based on its name.\n * @param {string} name\n * @param {string} [serviceGroup]\n * @returns {ServiceUrl}\n */\n _getUrl(name, serviceGroup) {\n const serviceUrls =\n typeof serviceGroup === 'string'\n ? this.serviceGroups[serviceGroup] || []\n : [\n ...this.serviceGroups.override,\n ...this.serviceGroups.postauth,\n ...this.serviceGroups.signin,\n ...this.serviceGroups.preauth,\n ...this.serviceGroups.discovery,\n ];\n\n return serviceUrls.find((serviceUrl) => serviceUrl.name === name);\n },\n\n /**\n * @private\n * Generate an array of `ServiceUrl`s that is organized from highest auth\n * level to lowest auth level.\n * @returns {Array<ServiceUrl>} - array of `ServiceUrl`s\n */\n _listServiceUrls() {\n return [\n ...this.serviceGroups.override,\n ...this.serviceGroups.postauth,\n ...this.serviceGroups.signin,\n ...this.serviceGroups.preauth,\n ...this.serviceGroups.discovery,\n ];\n },\n\n /**\n * @private\n * Safely load one or more `ServiceUrl`s into this `Services` instance.\n * @param {string} serviceGroup\n * @param {Array<ServiceUrl>} services\n * @returns {Services}\n */\n _loadServiceUrls(serviceGroup, services) {\n // declare namespaces outside of loop\n let existingService;\n\n services.forEach((service) => {\n existingService = this._getUrl(service.name, serviceGroup);\n\n if (!existingService) {\n this.serviceGroups[serviceGroup].push(service);\n }\n });\n\n return this;\n },\n\n /**\n * @private\n * Safely unload one or more `ServiceUrl`s into this `Services` instance\n * @param {string} serviceGroup\n * @param {Array<ServiceUrl>} services\n * @returns {Services}\n */\n _unloadServiceUrls(serviceGroup, services) {\n // declare namespaces outside of loop\n let existingService;\n\n services.forEach((service) => {\n existingService = this._getUrl(service.name, serviceGroup);\n\n if (existingService) {\n this.serviceGroups[serviceGroup].splice(\n this.serviceGroups[serviceGroup].indexOf(existingService),\n 1\n );\n }\n });\n\n return this;\n },\n\n /**\n * Clear all collected catalog data and reset catalog status.\n *\n * @returns {void}\n */\n clean() {\n this.serviceGroups.preauth.length = 0;\n this.serviceGroups.signin.length = 0;\n this.serviceGroups.postauth.length = 0;\n this.status.preauth = {ready: false};\n this.status.signin = {ready: false};\n this.status.postauth = {ready: false};\n },\n\n /**\n * Search over all service groups to find a cluster id based\n * on a given url.\n * @param {string} url - Must be parsable by `Url`\n * @returns {string} - ClusterId of a given url\n */\n findClusterId(url) {\n const incomingUrlObj = Url.parse(url);\n let serviceUrlObj;\n\n for (const key of Object.keys(this.serviceGroups)) {\n for (const service of this.serviceGroups[key]) {\n serviceUrlObj = Url.parse(service.defaultUrl);\n\n for (const host of service.hosts) {\n if (incomingUrlObj.hostname === host.host && host.id) {\n return host.id;\n }\n }\n\n if (serviceUrlObj.hostname === incomingUrlObj.hostname && service.hosts.length > 0) {\n // no exact match, so try to grab the first home cluster\n for (const host of service.hosts) {\n if (host.homeCluster) {\n return host.id;\n }\n }\n\n // no match found still, so return the first entry\n return service.hosts[0].id;\n }\n }\n }\n\n return undefined;\n },\n\n /**\n * Search over all service groups and return a service value from a provided\n * clusterId. Currently, this method will return either a service name, or a\n * service url depending on the `value` parameter. If the `value` parameter\n * is set to `name`, it will return a service name to be utilized within the\n * Services plugin methods.\n * @param {object} params\n * @param {string} params.clusterId - clusterId of found service\n * @param {boolean} [params.priorityHost = true] - 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 findServiceFromClusterId({clusterId, priorityHost = true, serviceGroup} = {}) {\n const serviceUrls =\n typeof serviceGroup === 'string'\n ? this.serviceGroups[serviceGroup] || []\n : [\n ...this.serviceGroups.override,\n ...this.serviceGroups.postauth,\n ...this.serviceGroups.signin,\n ...this.serviceGroups.preauth,\n ...this.serviceGroups.discovery,\n ];\n\n const identifiedServiceUrl = serviceUrls.find((serviceUrl) =>\n serviceUrl.hosts.find((host) => host.id === clusterId)\n );\n\n if (identifiedServiceUrl) {\n return {\n name: identifiedServiceUrl.name,\n url: identifiedServiceUrl.get(priorityHost, clusterId),\n };\n }\n\n return undefined;\n },\n\n /**\n * Find a service based on the provided url.\n * @param {string} url - Must be parsable by `Url`\n * @returns {serviceUrl} - ServiceUrl assocated with provided url\n */\n findServiceUrlFromUrl(url) {\n const serviceUrls = [\n ...this.serviceGroups.discovery,\n ...this.serviceGroups.preauth,\n ...this.serviceGroups.signin,\n ...this.serviceGroups.postauth,\n ...this.serviceGroups.override,\n ];\n\n return serviceUrls.find((serviceUrl) => {\n // Check to see if the URL we are checking starts with the default URL\n if (url.startsWith(serviceUrl.defaultUrl)) {\n return true;\n }\n\n // If not, we check to see if the alternate URLs match\n // These are made by swapping the host of the default URL\n // with that of an alternate host\n for (const host of serviceUrl.hosts) {\n const alternateUrl = new URL(serviceUrl.defaultUrl);\n alternateUrl.host = host.host;\n\n if (url.startsWith(alternateUrl.toString())) {\n return true;\n }\n }\n\n return false;\n });\n },\n\n /**\n * Finds an allowed domain that matches a specific url.\n *\n * @param {string} url - The url to match the allowed domains against.\n * @returns {string} - The matching allowed domain.\n */\n findAllowedDomain(url) {\n const urlObj = Url.parse(url);\n\n if (!urlObj.host) {\n return undefined;\n }\n\n return this.allowedDomains.find((allowedDomain) => urlObj.host.includes(allowedDomain));\n },\n\n /**\n * Get a service url from the current services list by name.\n * @param {string} name\n * @param {boolean} priorityHost\n * @param {string} serviceGroup\n * @returns {string}\n */\n get(name, priorityHost, serviceGroup) {\n const serviceUrl = this._getUrl(name, serviceGroup);\n\n return serviceUrl ? serviceUrl.get(priorityHost) : undefined;\n },\n\n /**\n * Get the current allowed domains list.\n *\n * @returns {Array<string>} - the current allowed domains list.\n */\n getAllowedDomains() {\n return [...this.allowedDomains];\n },\n\n /**\n * Creates an object where the keys are the service names\n * and the values are the service urls.\n * @param {boolean} priorityHost - use the highest priority if set to `true`\n * @param {string} [serviceGroup]\n * @returns {Record<string, string>}\n */\n list(priorityHost, serviceGroup) {\n const output = {};\n\n const serviceUrls =\n typeof serviceGroup === 'string'\n ? this.serviceGroups[serviceGroup] || []\n : [\n ...this.serviceGroups.discovery,\n ...this.serviceGroups.preauth,\n ...this.serviceGroups.signin,\n ...this.serviceGroups.postauth,\n ...this.serviceGroups.override,\n ];\n\n if (serviceUrls) {\n serviceUrls.forEach((serviceUrl) => {\n output[serviceUrl.name] = serviceUrl.get(priorityHost);\n });\n }\n\n return output;\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 serviceUrl = this._getUrl(\n Object.keys(this.list()).find((key) => this._getUrl(key).failHost(url))\n );\n\n if (!serviceUrl) {\n return undefined;\n }\n\n return noPriorityHosts ? serviceUrl.get(false) : serviceUrl.get(true);\n },\n\n /**\n * Set the allowed domains for the catalog.\n *\n * @param {Array<string>} allowedDomains - allowed domains to be assigned.\n * @returns {void}\n */\n setAllowedDomains(allowedDomains) {\n this.allowedDomains = [...allowedDomains];\n },\n\n /**\n *\n * @param {Array<string>} newAllowedDomains - new allowed domains to add to existing set of allowed domains\n * @returns {void}\n */\n addAllowedDomains(newAllowedDomains) {\n this.allowedDomains = union(this.allowedDomains, newAllowedDomains);\n },\n\n /**\n * Update the current list of `ServiceUrl`s against a provided\n * service hostmap.\n * @emits ServiceCatalog#preauthorized\n * @emits ServiceCatalog#postauthorized\n * @param {string} serviceGroup\n * @param {object} serviceHostmap\n * @returns {Services}\n */\n updateServiceUrls(serviceGroup, serviceHostmap) {\n const currentServiceUrls = this.serviceGroups[serviceGroup];\n\n const unusedUrls = currentServiceUrls.filter((serviceUrl) =>\n serviceHostmap.every((item) => item.name !== serviceUrl.name)\n );\n\n this._unloadServiceUrls(serviceGroup, unusedUrls);\n\n serviceHostmap.forEach((serviceObj) => {\n const service = this._getUrl(serviceObj.name, serviceGroup);\n\n if (service) {\n service.defaultUrl = serviceObj.defaultUrl;\n service.hosts = serviceObj.hosts || [];\n } else {\n this._loadServiceUrls(serviceGroup, [\n new ServiceUrl({\n ...serviceObj,\n }),\n ]);\n }\n });\n\n this.status[serviceGroup].ready = true;\n this.trigger(serviceGroup);\n\n return this;\n },\n\n /**\n * Wait until the service catalog is available,\n * or reject after a timeout of 60 seconds.\n * @param {string} serviceGroup\n * @param {number} [timeout] - in seconds\n * @returns {Promise<void>}\n */\n waitForCatalog(serviceGroup, timeout) {\n return new Promise((resolve, reject) => {\n if (this.status[serviceGroup].ready) {\n resolve();\n }\n\n const validatedTimeout = typeof timeout === 'number' && timeout >= 0 ? timeout : 60;\n\n const timeoutTimer = setTimeout(\n () =>\n reject(\n new Error(\n `services: timeout occured while waiting for '${serviceGroup}' catalog to populate`\n )\n ),\n validatedTimeout * 1000\n );\n\n this.once(serviceGroup, () => {\n clearTimeout(timeoutTimer);\n resolve();\n });\n });\n },\n});\n/* eslint-enable no-underscore-dangle */\n\nexport default ServiceCatalog;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,IAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,eAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAAuC,SAAAI,QA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O,CAAC,CAAC;MACX,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ;AACF,CAAC,CAAC;AACF;AAAA,IAAAQ,QAAA,GAAAC,OAAA,CAAArJ,OAAA,GAEeyC,cAAc"}
|
package/dist/plugins/logger.js
CHANGED
|
@@ -57,7 +57,7 @@ var Logger = _webexPlugin.default.extend({
|
|
|
57
57
|
info: wrapConsoleMethod('info'),
|
|
58
58
|
debug: wrapConsoleMethod('debug'),
|
|
59
59
|
trace: wrapConsoleMethod('trace'),
|
|
60
|
-
version: "3.8.0-next.
|
|
60
|
+
version: "3.8.0-next.4"
|
|
61
61
|
});
|
|
62
62
|
(0, _webexCore.registerPlugin)('logger', Logger);
|
|
63
63
|
var _default = exports.default = Logger;
|
package/dist/webex-core.js
CHANGED
|
@@ -96,7 +96,7 @@ var MAX_FILE_SIZE_IN_MB = 2048;
|
|
|
96
96
|
* @class
|
|
97
97
|
*/
|
|
98
98
|
var WebexCore = _ampersandState.default.extend((_obj = {
|
|
99
|
-
version: "3.8.0-next.
|
|
99
|
+
version: "3.8.0-next.4",
|
|
100
100
|
children: {
|
|
101
101
|
internal: _webexInternalCore.default
|
|
102
102
|
},
|
|
@@ -642,7 +642,7 @@ var WebexCore = _ampersandState.default.extend((_obj = {
|
|
|
642
642
|
});
|
|
643
643
|
}
|
|
644
644
|
}, ((0, _applyDecoratedDescriptor2.default)(_obj, "_uploadPhaseUpload", [_common.retry], (0, _getOwnPropertyDescriptor.default)(_obj, "_uploadPhaseUpload"), _obj)), _obj));
|
|
645
|
-
WebexCore.version = "3.8.0-next.
|
|
645
|
+
WebexCore.version = "3.8.0-next.4";
|
|
646
646
|
(0, _webexInternalCorePluginMixin.default)(_webexInternalCore.default, _config.default, interceptors);
|
|
647
647
|
(0, _webexCorePluginMixin.default)(WebexCore, _config.default, interceptors);
|
|
648
648
|
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.8.0-next.
|
|
39
|
-
"@webex/test-helper-make-local-url": "3.8.0-next.
|
|
40
|
-
"@webex/test-helper-mocha": "3.8.0-next.
|
|
41
|
-
"@webex/test-helper-mock-webex": "3.8.0-next.
|
|
42
|
-
"@webex/test-helper-refresh-callback": "3.8.0-next.
|
|
43
|
-
"@webex/test-helper-test-users": "3.8.0-next.
|
|
38
|
+
"@webex/test-helper-chai": "3.8.0-next.4",
|
|
39
|
+
"@webex/test-helper-make-local-url": "3.8.0-next.4",
|
|
40
|
+
"@webex/test-helper-mocha": "3.8.0-next.4",
|
|
41
|
+
"@webex/test-helper-mock-webex": "3.8.0-next.4",
|
|
42
|
+
"@webex/test-helper-refresh-callback": "3.8.0-next.4",
|
|
43
|
+
"@webex/test-helper-test-users": "3.8.0-next.4",
|
|
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.8.0-next.
|
|
52
|
-
"@webex/common-timers": "3.8.0-next.
|
|
53
|
-
"@webex/http-core": "3.8.0-next.
|
|
54
|
-
"@webex/internal-plugin-device": "3.8.0-next.
|
|
55
|
-
"@webex/plugin-logger": "3.8.0-next.
|
|
56
|
-
"@webex/storage-adapter-spec": "3.8.0-next.
|
|
51
|
+
"@webex/common": "3.8.0-next.4",
|
|
52
|
+
"@webex/common-timers": "3.8.0-next.4",
|
|
53
|
+
"@webex/http-core": "3.8.0-next.4",
|
|
54
|
+
"@webex/internal-plugin-device": "3.8.0-next.4",
|
|
55
|
+
"@webex/plugin-logger": "3.8.0-next.4",
|
|
56
|
+
"@webex/storage-adapter-spec": "3.8.0-next.4",
|
|
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.8.0-next.
|
|
76
|
+
"version": "3.8.0-next.4"
|
|
77
77
|
}
|
|
@@ -245,66 +245,26 @@ const ServiceCatalog = AmpState.extend({
|
|
|
245
245
|
...this.serviceGroups.override,
|
|
246
246
|
];
|
|
247
247
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
// If URL parsing fails, return false
|
|
253
|
-
return false;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
let exactMatch = null;
|
|
257
|
-
let anyMatch = null;
|
|
258
|
-
|
|
259
|
-
for (const serviceUrl of serviceUrls) {
|
|
260
|
-
let defaultServiceUrl;
|
|
261
|
-
try {
|
|
262
|
-
defaultServiceUrl = new URL(serviceUrl.defaultUrl);
|
|
263
|
-
} catch (error) {
|
|
264
|
-
// If URL parsing fails for the default URL, skip this service URL
|
|
265
|
-
|
|
266
|
-
// eslint-disable-next-line no-continue
|
|
267
|
-
continue;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
const defaultHostname = defaultServiceUrl.hostname;
|
|
271
|
-
|
|
272
|
-
// Check if the hostname matches the default URL's hostname
|
|
273
|
-
if (inputUrl.hostname === defaultHostname) {
|
|
274
|
-
if (inputUrl.protocol === defaultServiceUrl.protocol) {
|
|
275
|
-
exactMatch = serviceUrl;
|
|
276
|
-
break;
|
|
277
|
-
} else {
|
|
278
|
-
anyMatch = serviceUrl;
|
|
279
|
-
}
|
|
248
|
+
return serviceUrls.find((serviceUrl) => {
|
|
249
|
+
// Check to see if the URL we are checking starts with the default URL
|
|
250
|
+
if (url.startsWith(serviceUrl.defaultUrl)) {
|
|
251
|
+
return true;
|
|
280
252
|
}
|
|
281
253
|
|
|
282
|
-
//
|
|
254
|
+
// If not, we check to see if the alternate URLs match
|
|
255
|
+
// These are made by swapping the host of the default URL
|
|
256
|
+
// with that of an alternate host
|
|
283
257
|
for (const host of serviceUrl.hosts) {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
alternateUrl.hostname = host.host;
|
|
287
|
-
|
|
288
|
-
if (inputUrl.hostname === alternateUrl.hostname) {
|
|
289
|
-
if (inputUrl.protocol === alternateUrl.protocol) {
|
|
290
|
-
exactMatch = serviceUrl;
|
|
291
|
-
break;
|
|
292
|
-
} else {
|
|
293
|
-
anyMatch = serviceUrl;
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
} catch (error) {
|
|
297
|
-
// If URL parsing fails for the alternate URL, skip this host
|
|
298
|
-
// Just let the loop proceed to the next iteration
|
|
299
|
-
}
|
|
300
|
-
}
|
|
258
|
+
const alternateUrl = new URL(serviceUrl.defaultUrl);
|
|
259
|
+
alternateUrl.host = host.host;
|
|
301
260
|
|
|
302
|
-
|
|
303
|
-
|
|
261
|
+
if (url.startsWith(alternateUrl.toString())) {
|
|
262
|
+
return true;
|
|
263
|
+
}
|
|
304
264
|
}
|
|
305
|
-
}
|
|
306
265
|
|
|
307
|
-
|
|
266
|
+
return false;
|
|
267
|
+
});
|
|
308
268
|
},
|
|
309
269
|
|
|
310
270
|
/**
|
|
@@ -208,108 +208,48 @@ describe('webex-core', () => {
|
|
|
208
208
|
hosts: [{host: 'example1.com'}, {host: 'example2.com'}],
|
|
209
209
|
};
|
|
210
210
|
|
|
211
|
-
it(
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
211
|
+
it.each([
|
|
212
|
+
'discovery',
|
|
213
|
+
'preauth',
|
|
214
|
+
'signin',
|
|
215
|
+
'postauth',
|
|
216
|
+
'override'
|
|
217
|
+
])('matches a default url correctly', (serviceGroup) => {
|
|
218
|
+
const url = 'https://example.com/resource/id';
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
const exampleService = {
|
|
222
|
+
defaultUrl: 'https://example.com/resource',
|
|
223
|
+
hosts: [{host: 'example1.com'}, {host: 'example2.com'}],
|
|
223
224
|
};
|
|
224
225
|
|
|
225
|
-
|
|
226
|
-
assert.deepEqual(result, {defaultUrl: 'https://signin.example.com', hosts: []});
|
|
227
|
-
});
|
|
226
|
+
catalog.serviceGroups[serviceGroup].push(otherService, exampleService);
|
|
228
227
|
|
|
229
|
-
|
|
230
|
-
catalog.serviceGroups = {
|
|
231
|
-
discovery: [{defaultUrl: 'https://discovery.example.com', hosts: []}],
|
|
232
|
-
preauth: [{defaultUrl: 'https://preauth.example.com', hosts: []}],
|
|
233
|
-
signin: [{defaultUrl: 'https://signin.example.com', hosts: []}],
|
|
234
|
-
postauth: [{defaultUrl: 'https://postauth.example.com', hosts: []}],
|
|
235
|
-
override: [{defaultUrl: 'https://override.example.com', hosts: []}],
|
|
236
|
-
};
|
|
228
|
+
const service = catalog.findServiceUrlFromUrl(url);
|
|
237
229
|
|
|
238
|
-
|
|
239
|
-
assert.isFalse(result);
|
|
230
|
+
assert.equal(service, exampleService);
|
|
240
231
|
});
|
|
241
232
|
|
|
242
|
-
it(
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
233
|
+
it.each([
|
|
234
|
+
'discovery',
|
|
235
|
+
'preauth',
|
|
236
|
+
'signin',
|
|
237
|
+
'postauth',
|
|
238
|
+
'override'
|
|
239
|
+
])('matches an alternate host url', (serviceGroup) => {
|
|
240
|
+
const url = 'https://example2.com/resource/id';
|
|
250
241
|
|
|
251
|
-
const
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
it('should skip service URLs with invalid default URLs', () => {
|
|
256
|
-
catalog.serviceGroups = {
|
|
257
|
-
discovery: [{defaultUrl: 'invalid-url', hosts: []}],
|
|
258
|
-
preauth: [{defaultUrl: 'https://preauth.example.com', hosts: []}],
|
|
259
|
-
signin: [{defaultUrl: 'https://signin.example.com', hosts: []}],
|
|
260
|
-
postauth: [{defaultUrl: 'https://postauth.example.com', hosts: []}],
|
|
261
|
-
override: [{defaultUrl: 'https://override.example.com', hosts: []}],
|
|
242
|
+
const exampleService = {
|
|
243
|
+
defaultUrl: 'https://example.com/resource',
|
|
244
|
+
hosts: [{host: 'example1.com'}, {host: 'example2.com'}],
|
|
262
245
|
};
|
|
263
246
|
|
|
264
|
-
|
|
265
|
-
assert.deepEqual(result, {defaultUrl: 'https://signin.example.com', hosts: []});
|
|
266
|
-
});
|
|
267
|
-
|
|
268
|
-
it('should skip alternate hostnames with invalid URLs', () => {
|
|
269
|
-
catalog.serviceGroups = {
|
|
270
|
-
discovery: [{defaultUrl: 'https://discovery.example.com', hosts: [{host: 'invalid-url'}]}],
|
|
271
|
-
preauth: [{defaultUrl: 'https://preauth.example.com', hosts: []}],
|
|
272
|
-
signin: [{defaultUrl: 'https://signin.example.com', hosts: []}],
|
|
273
|
-
postauth: [{defaultUrl: 'https://postauth.example.com', hosts: []}],
|
|
274
|
-
override: [{defaultUrl: 'https://override.example.com', hosts: []}],
|
|
275
|
-
};
|
|
276
|
-
|
|
277
|
-
const result = catalog.findServiceUrlFromUrl('https://signin.example.com/resource');
|
|
278
|
-
assert.deepEqual(result, {defaultUrl: 'https://signin.example.com', hosts: []});
|
|
279
|
-
});
|
|
280
|
-
|
|
281
|
-
it('should return the service URL object if found with a different protocol', () => {
|
|
282
|
-
catalog.serviceGroups = {
|
|
283
|
-
discovery: [{defaultUrl: 'https://discovery.example.com', hosts: []}],
|
|
284
|
-
preauth: [{defaultUrl: 'https://preauth.example.com', hosts: []}],
|
|
285
|
-
signin: [{defaultUrl: 'https://signin.example.com', hosts: []}],
|
|
286
|
-
postauth: [{defaultUrl: 'https://postauth.example.com', hosts: []}],
|
|
287
|
-
override: [{defaultUrl: 'https://override.example.com', hosts: []}],
|
|
288
|
-
};
|
|
289
|
-
|
|
290
|
-
const result = catalog.findServiceUrlFromUrl('wss://signin.example.com/resource');
|
|
291
|
-
assert.deepEqual(result, {defaultUrl: 'https://signin.example.com', hosts: []});
|
|
292
|
-
});
|
|
293
|
-
|
|
294
|
-
it('should return the exact protocol service URL object if both protocols are present', () => {
|
|
295
|
-
catalog.serviceGroups = {
|
|
296
|
-
discovery: [{defaultUrl: 'https://discovery.example.com', hosts: []}],
|
|
297
|
-
preauth: [{defaultUrl: 'https://preauth.example.com', hosts: []}],
|
|
298
|
-
signin: [
|
|
299
|
-
{defaultUrl: 'https://signin.example.com', hosts: []},
|
|
300
|
-
{defaultUrl: 'wss://signin.example.com', hosts: []},
|
|
301
|
-
],
|
|
302
|
-
postauth: [{defaultUrl: 'https://postauth.example.com', hosts: []}],
|
|
303
|
-
override: [{defaultUrl: 'https://override.example.com', hosts: []}],
|
|
304
|
-
};
|
|
247
|
+
catalog.serviceGroups[serviceGroup].push(otherService, exampleService);
|
|
305
248
|
|
|
306
|
-
const
|
|
307
|
-
const resultWss = catalog.findServiceUrlFromUrl('wss://signin.example.com/resource');
|
|
249
|
+
const service = catalog.findServiceUrlFromUrl(url);
|
|
308
250
|
|
|
309
|
-
assert.
|
|
310
|
-
assert.deepEqual(resultWss, {defaultUrl: 'wss://signin.example.com', hosts: []});
|
|
251
|
+
assert.equal(service, exampleService);
|
|
311
252
|
});
|
|
312
|
-
|
|
313
253
|
});
|
|
314
254
|
});
|
|
315
255
|
});
|