@webex/webex-core
Advanced tools
Comparing version 3.3.1-next.3 to 3.3.1-next.4
@@ -289,5 +289,5 @@ "use strict"; | ||
}, | ||
version: "3.3.1-next.3" | ||
version: "3.3.1-next.4" | ||
}); | ||
var _default2 = exports.default = Batcher; | ||
//# sourceMappingURL=batcher.js.map |
@@ -561,5 +561,5 @@ "use strict"; | ||
}, | ||
version: "3.3.1-next.3" | ||
version: "3.3.1-next.4" | ||
}, ((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))); | ||
var _default = exports.default = Credentials; | ||
//# sourceMappingURL=credentials.js.map |
@@ -535,5 +535,5 @@ "use strict"; | ||
}, | ||
version: "3.3.1-next.3" | ||
version: "3.3.1-next.4" | ||
}, ((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))); | ||
var _default = exports.default = Token; | ||
//# sourceMappingURL=token.js.map |
@@ -256,12 +256,27 @@ "use strict"; | ||
findServiceUrlFromUrl: function findServiceUrlFromUrl(url) { | ||
var incomingUrlObj = _url.default.parse(url); | ||
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)); | ||
return serviceUrls.find(function (serviceUrl) { | ||
if (incomingUrlObj.hostname === _url.default.parse(serviceUrl.defaultUrl).hostname) { | ||
// Check to see if the URL we are checking starts with the default URL | ||
if (url.startsWith(serviceUrl.defaultUrl)) { | ||
return true; | ||
} | ||
if (serviceUrl.hosts.find(function (host) { | ||
return host.host === incomingUrlObj.hostname; | ||
})) { | ||
return true; | ||
// If not, we check to see if the alternate URLs match | ||
// These are made by swapping the host of the default URL | ||
// with that of an alternate host | ||
var _iterator4 = _createForOfIteratorHelper(serviceUrl.hosts), | ||
_step4; | ||
try { | ||
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) { | ||
var host = _step4.value; | ||
var alternateUrl = new URL(serviceUrl.defaultUrl); | ||
alternateUrl.host = host.host; | ||
if (url.startsWith(alternateUrl.toString())) { | ||
return true; | ||
} | ||
} | ||
} catch (err) { | ||
_iterator4.e(err); | ||
} finally { | ||
_iterator4.f(); | ||
} | ||
@@ -268,0 +283,0 @@ return false; |
@@ -1037,3 +1037,3 @@ "use strict"; | ||
}, | ||
version: "3.3.1-next.3" | ||
version: "3.3.1-next.4" | ||
}); | ||
@@ -1040,0 +1040,0 @@ /* eslint-enable no-underscore-dangle */ |
@@ -60,3 +60,3 @@ "use strict"; | ||
trace: wrapConsoleMethod('trace'), | ||
version: "3.3.1-next.3" | ||
version: "3.3.1-next.4" | ||
}); | ||
@@ -63,0 +63,0 @@ (0, _webexCore.registerPlugin)('logger', Logger); |
@@ -97,3 +97,3 @@ "use strict"; | ||
var WebexCore = _ampersandState.default.extend((_obj = { | ||
version: "3.3.1-next.3", | ||
version: "3.3.1-next.4", | ||
children: { | ||
@@ -640,3 +640,3 @@ internal: _webexInternalCore.default | ||
}, ((0, _applyDecoratedDescriptor2.default)(_obj, "_uploadPhaseUpload", [_common.retry], (0, _getOwnPropertyDescriptor.default)(_obj, "_uploadPhaseUpload"), _obj)), _obj)); | ||
WebexCore.version = "3.3.1-next.3"; | ||
WebexCore.version = "3.3.1-next.4"; | ||
(0, _webexInternalCorePluginMixin.default)(_webexInternalCore.default, _config.default, interceptors); | ||
@@ -643,0 +643,0 @@ (0, _webexCorePluginMixin.default)(WebexCore, _config.default, interceptors); |
@@ -38,8 +38,8 @@ { | ||
"@webex/legacy-tools": "0.0.0", | ||
"@webex/test-helper-chai": "3.3.1-next.3", | ||
"@webex/test-helper-make-local-url": "3.3.1-next.3", | ||
"@webex/test-helper-mocha": "3.3.1-next.3", | ||
"@webex/test-helper-mock-webex": "3.3.1-next.3", | ||
"@webex/test-helper-refresh-callback": "3.3.1-next.3", | ||
"@webex/test-helper-test-users": "3.3.1-next.3", | ||
"@webex/test-helper-chai": "3.3.1-next.4", | ||
"@webex/test-helper-make-local-url": "3.3.1-next.4", | ||
"@webex/test-helper-mocha": "3.3.1-next.4", | ||
"@webex/test-helper-mock-webex": "3.3.1-next.4", | ||
"@webex/test-helper-refresh-callback": "3.3.1-next.4", | ||
"@webex/test-helper-test-users": "3.3.1-next.4", | ||
"chai": "^4.3.4", | ||
@@ -52,8 +52,8 @@ "chai-as-promised": "^7.1.1", | ||
"dependencies": { | ||
"@webex/common": "3.3.1-next.3", | ||
"@webex/common-timers": "3.3.1-next.3", | ||
"@webex/http-core": "3.3.1-next.3", | ||
"@webex/internal-plugin-device": "3.3.1-next.3", | ||
"@webex/plugin-logger": "3.3.1-next.3", | ||
"@webex/storage-adapter-spec": "3.3.1-next.3", | ||
"@webex/common": "3.3.1-next.4", | ||
"@webex/common-timers": "3.3.1-next.4", | ||
"@webex/http-core": "3.3.1-next.4", | ||
"@webex/internal-plugin-device": "3.3.1-next.4", | ||
"@webex/plugin-logger": "3.3.1-next.4", | ||
"@webex/storage-adapter-spec": "3.3.1-next.4", | ||
"ampersand-collection": "^2.0.2", | ||
@@ -78,3 +78,3 @@ "ampersand-events": "^2.0.2", | ||
}, | ||
"version": "3.3.1-next.3" | ||
"version": "3.3.1-next.4" | ||
} |
@@ -240,3 +240,2 @@ import Url from 'url'; | ||
findServiceUrlFromUrl(url) { | ||
const incomingUrlObj = Url.parse(url); | ||
const serviceUrls = [ | ||
@@ -251,8 +250,17 @@ ...this.serviceGroups.discovery, | ||
return serviceUrls.find((serviceUrl) => { | ||
if (incomingUrlObj.hostname === Url.parse(serviceUrl.defaultUrl).hostname) { | ||
// Check to see if the URL we are checking starts with the default URL | ||
if (url.startsWith(serviceUrl.defaultUrl)) { | ||
return true; | ||
} | ||
if (serviceUrl.hosts.find((host) => host.host === incomingUrlObj.hostname)) { | ||
return true; | ||
// If not, we check to see if the alternate URLs match | ||
// These are made by swapping the host of the default URL | ||
// with that of an alternate host | ||
for (const host of serviceUrl.hosts) { | ||
const alternateUrl = new URL(serviceUrl.defaultUrl); | ||
alternateUrl.host = host.host; | ||
if (url.startsWith(alternateUrl.toString())) { | ||
return true; | ||
} | ||
} | ||
@@ -259,0 +267,0 @@ |
@@ -16,3 +16,3 @@ /*! | ||
beforeAll(() => { | ||
beforeEach(() => { | ||
webex = new MockWebex(); | ||
@@ -205,4 +205,54 @@ services = new Services(undefined, {parent: webex}); | ||
}); | ||
describe('findServiceUrlFromUrl()', () => { | ||
const otherService = { | ||
defaultUrl: 'https://example.com/differentresource', | ||
hosts: [{host: 'example1.com'}, {host: 'example2.com'}], | ||
}; | ||
it.each([ | ||
'discovery', | ||
'preauth', | ||
'signin', | ||
'postauth', | ||
'override' | ||
])('matches a default url correctly', (serviceGroup) => { | ||
const url = 'https://example.com/resource/id'; | ||
const exampleService = { | ||
defaultUrl: 'https://example.com/resource', | ||
hosts: [{host: 'example1.com'}, {host: 'example2.com'}], | ||
}; | ||
catalog.serviceGroups[serviceGroup].push(otherService, exampleService); | ||
const service = catalog.findServiceUrlFromUrl(url); | ||
assert.equal(service, exampleService); | ||
}); | ||
it.each([ | ||
'discovery', | ||
'preauth', | ||
'signin', | ||
'postauth', | ||
'override' | ||
])('matches an alternate host url', (serviceGroup) => { | ||
const url = 'https://example2.com/resource/id'; | ||
const exampleService = { | ||
defaultUrl: 'https://example.com/resource', | ||
hosts: [{host: 'example1.com'}, {host: 'example2.com'}], | ||
}; | ||
catalog.serviceGroups[serviceGroup].push(otherService, exampleService); | ||
const service = catalog.findServiceUrlFromUrl(url); | ||
assert.equal(service, exampleService); | ||
}); | ||
}); | ||
}); | ||
}); | ||
/* eslint-enable no-underscore-dangle */ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1379394
24228
+ Added@webex/common@3.3.1-next.4(transitive)
+ Added@webex/common-timers@3.3.1-next.4(transitive)
+ Added@webex/http-core@3.3.1-next.4(transitive)
+ Added@webex/internal-plugin-device@3.3.1-next.4(transitive)
+ Added@webex/internal-plugin-metrics@3.3.1-next.4(transitive)
+ Added@webex/plugin-logger@3.3.1-next.4(transitive)
+ Added@webex/storage-adapter-spec@3.3.1-next.4(transitive)
+ Added@webex/test-helper-chai@3.3.1-next.4(transitive)
+ Added@webex/test-helper-file@3.3.1-next.4(transitive)
+ Added@webex/test-helper-make-local-url@3.3.1-next.4(transitive)
+ Added@webex/test-helper-mocha@3.3.1-next.4(transitive)
+ Added@webex/test-helper-mock-webex@3.3.1-next.4(transitive)
+ Added@webex/test-helper-retry@3.3.1-next.4(transitive)
+ Added@webex/test-helper-test-users@3.3.1-next.4(transitive)
+ Added@webex/test-users@3.3.1-next.4(transitive)
- Removed@webex/common@3.3.1-next.3(transitive)
- Removed@webex/common-timers@3.3.1-next.3(transitive)
- Removed@webex/http-core@3.3.1-next.3(transitive)
- Removed@webex/internal-plugin-device@3.3.1-next.3(transitive)
- Removed@webex/internal-plugin-metrics@3.3.1-next.3(transitive)
- Removed@webex/plugin-logger@3.3.1-next.3(transitive)
- Removed@webex/storage-adapter-spec@3.3.1-next.3(transitive)
- Removed@webex/test-helper-chai@3.3.1-next.3(transitive)
- Removed@webex/test-helper-file@3.3.1-next.3(transitive)
- Removed@webex/test-helper-make-local-url@3.3.1-next.3(transitive)
- Removed@webex/test-helper-mocha@3.3.1-next.3(transitive)
- Removed@webex/test-helper-mock-webex@3.3.1-next.3(transitive)
- Removed@webex/test-helper-retry@3.3.1-next.3(transitive)
- Removed@webex/test-helper-test-users@3.3.1-next.3(transitive)
- Removed@webex/test-users@3.3.1-next.3(transitive)
Updated@webex/common@3.3.1-next.4