@webex/webex-core 3.13.0-next.2 → 3.13.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/README.md +1 -1
- package/dist/config.js +1 -1
- package/dist/config.js.map +1 -1
- package/dist/lib/batcher.js +1 -1
- package/dist/lib/credentials/credentials.js +1 -1
- package/dist/lib/credentials/token.js +1 -1
- package/dist/lib/services/services.js +1 -1
- package/dist/lib/services-v2/services-v2.js +1 -1
- package/dist/plugins/logger.js +1 -1
- package/dist/webex-core.js +2 -2
- package/package.json +13 -13
- package/src/config.js +1 -1
- package/test/fixtures/activation-email.ts +1 -1
- package/test/integration/spec/credentials/credentials.js +3 -1
- package/test/integration/spec/credentials/token.js +8 -0
- package/test/integration/spec/services/service-catalog.js +5 -0
- package/test/unit/spec/interceptors/auth.js +1 -1
- package/test/unit/spec/services/services.js +9 -9
- package/test/unit/spec/services-v2/services-v2.ts +13 -13
package/README.md
CHANGED
|
@@ -92,7 +92,7 @@ const webex = new WebexCore({
|
|
|
92
92
|
|
|
93
93
|
The default configuration includes the following service urls:
|
|
94
94
|
|
|
95
|
-
- `U2C_SERVICE_URL` [U2C] - `https://u2c.
|
|
95
|
+
- `U2C_SERVICE_URL` [U2C] - `https://u2c.svc.webex.com/u2c/api/v1`
|
|
96
96
|
- `HYDRA_SERVICE_URL` [Hydra] - `https://webexapis.com/v1`
|
|
97
97
|
- `SQDISCOVERY_SERVICE_URL` [SQDISCOVERY] - `https://ds.ciscospark.com/v1/region`
|
|
98
98
|
|
package/dist/config.js
CHANGED
|
@@ -83,7 +83,7 @@ var _default = exports.default = {
|
|
|
83
83
|
*
|
|
84
84
|
* @type {string}
|
|
85
85
|
*/
|
|
86
|
-
u2c: process.env.U2C_SERVICE_URL || 'https://u2c.
|
|
86
|
+
u2c: process.env.U2C_SERVICE_URL || 'https://u2c.svc.webex.com/u2c/api/v1'
|
|
87
87
|
},
|
|
88
88
|
/**
|
|
89
89
|
* When true, considers all urls in `allowedDomains` as safe for auth tokens
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_storage","require","_credentialsConfig","_interopRequireDefault","_default","exports","default","maxAppLevelRedirects","maxLocusRedirects","maxAuthenticationReplays","maxReconnectAttempts","onBeforeLogout","trackingIdPrefix","trackingIdSuffix","AlternateLogger","undefined","credentials","CredentialsConfig","environment","fedramp","process","env","ENABLE_FEDRAMP","services","useUserOnboardingServiceForActivations","useCatalogOverride","skipPreauthCatalogOnUnauthenticated","catalogInitTimeout","discovery","hydra","HYDRA_SERVICE_URL","sqdiscovery","SQDISCOVERY_SERVICE_URL","u2c","U2C_SERVICE_URL","validateDomains","validateCatalogUrls","servicesNotNeedValidation","allowedDomains","device","preDiscoveryServices","hydraServiceUrl","metrics","type","calling","cacheU2C","payloadTransformer","skipRepeatedInboundTransforms","predicates","transforms","storage","boundedAdapter","MemoryStoreAdapter","unboundedAdapter"],"sources":["config.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n/* eslint camelcase: [0] */\n\nimport {MemoryStoreAdapter} from './lib/storage';\nimport CredentialsConfig from './credentials-config';\n\nexport default {\n maxAppLevelRedirects: 10,\n maxLocusRedirects: 5,\n maxAuthenticationReplays: 1,\n maxReconnectAttempts: 1,\n onBeforeLogout: [],\n trackingIdPrefix: 'webex-js-sdk',\n trackingIdSuffix: '',\n AlternateLogger: undefined,\n credentials: new CredentialsConfig(),\n /**\n * Explicitly selects the Webex environment. When omitted, the environment is inferred from the\n * U2C discovery URL.\n *\n * @type {'integration'|'production'|undefined}\n */\n environment: undefined,\n fedramp: process.env.ENABLE_FEDRAMP || false,\n services: {\n /**\n * When true, uses the user-onboarding service for user activation.\n * When false (default), uses the license service.\n *\n * @type {boolean}\n */\n useUserOnboardingServiceForActivations: false,\n\n /**\n * When true, requests the U2C catalog override.\n *\n * @type {boolean}\n */\n useCatalogOverride: false,\n\n /**\n * When true, skips fetching the preauth catalog during initialization\n * while the user is unauthenticated (no existing token). The catalog is\n * expected to be collected manually later instead. When false (default),\n * the preauth catalog is collected automatically during init.\n *\n * @type {boolean}\n */\n skipPreauthCatalogOnUnauthenticated: false,\n\n /**\n * Maximum time (in milliseconds) to wait for the initial service catalog\n * collection when `waitForCatalogInit` is enabled, before letting\n * `services.ready` (and therefore `webex.ready`) fire anyway. Prevents a\n * hung catalog request from leaving the app on a permanent spinner.\n *\n * @type {number}\n */\n catalogInitTimeout: 15000,\n\n /**\n * A list of services that are available prior to catalog collection.\n *\n * @type {Object}\n */\n discovery: {\n /**\n * The hydra discovery url.\n *\n * @type {string}\n */\n hydra: process.env.HYDRA_SERVICE_URL || 'https://api.ciscospark.com/v1',\n\n /**\n * load balanced region info url\n */\n sqdiscovery: process.env.SQDISCOVERY_SERVICE_URL || 'https://ds.ciscospark.com/v1/region',\n\n /**\n * The u2c discovery url\n *\n * @type {string}\n */\n u2c: process.env.U2C_SERVICE_URL || 'https://u2c.
|
|
1
|
+
{"version":3,"names":["_storage","require","_credentialsConfig","_interopRequireDefault","_default","exports","default","maxAppLevelRedirects","maxLocusRedirects","maxAuthenticationReplays","maxReconnectAttempts","onBeforeLogout","trackingIdPrefix","trackingIdSuffix","AlternateLogger","undefined","credentials","CredentialsConfig","environment","fedramp","process","env","ENABLE_FEDRAMP","services","useUserOnboardingServiceForActivations","useCatalogOverride","skipPreauthCatalogOnUnauthenticated","catalogInitTimeout","discovery","hydra","HYDRA_SERVICE_URL","sqdiscovery","SQDISCOVERY_SERVICE_URL","u2c","U2C_SERVICE_URL","validateDomains","validateCatalogUrls","servicesNotNeedValidation","allowedDomains","device","preDiscoveryServices","hydraServiceUrl","metrics","type","calling","cacheU2C","payloadTransformer","skipRepeatedInboundTransforms","predicates","transforms","storage","boundedAdapter","MemoryStoreAdapter","unboundedAdapter"],"sources":["config.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n/* eslint camelcase: [0] */\n\nimport {MemoryStoreAdapter} from './lib/storage';\nimport CredentialsConfig from './credentials-config';\n\nexport default {\n maxAppLevelRedirects: 10,\n maxLocusRedirects: 5,\n maxAuthenticationReplays: 1,\n maxReconnectAttempts: 1,\n onBeforeLogout: [],\n trackingIdPrefix: 'webex-js-sdk',\n trackingIdSuffix: '',\n AlternateLogger: undefined,\n credentials: new CredentialsConfig(),\n /**\n * Explicitly selects the Webex environment. When omitted, the environment is inferred from the\n * U2C discovery URL.\n *\n * @type {'integration'|'production'|undefined}\n */\n environment: undefined,\n fedramp: process.env.ENABLE_FEDRAMP || false,\n services: {\n /**\n * When true, uses the user-onboarding service for user activation.\n * When false (default), uses the license service.\n *\n * @type {boolean}\n */\n useUserOnboardingServiceForActivations: false,\n\n /**\n * When true, requests the U2C catalog override.\n *\n * @type {boolean}\n */\n useCatalogOverride: false,\n\n /**\n * When true, skips fetching the preauth catalog during initialization\n * while the user is unauthenticated (no existing token). The catalog is\n * expected to be collected manually later instead. When false (default),\n * the preauth catalog is collected automatically during init.\n *\n * @type {boolean}\n */\n skipPreauthCatalogOnUnauthenticated: false,\n\n /**\n * Maximum time (in milliseconds) to wait for the initial service catalog\n * collection when `waitForCatalogInit` is enabled, before letting\n * `services.ready` (and therefore `webex.ready`) fire anyway. Prevents a\n * hung catalog request from leaving the app on a permanent spinner.\n *\n * @type {number}\n */\n catalogInitTimeout: 15000,\n\n /**\n * A list of services that are available prior to catalog collection.\n *\n * @type {Object}\n */\n discovery: {\n /**\n * The hydra discovery url.\n *\n * @type {string}\n */\n hydra: process.env.HYDRA_SERVICE_URL || 'https://api.ciscospark.com/v1',\n\n /**\n * load balanced region info url\n */\n sqdiscovery: process.env.SQDISCOVERY_SERVICE_URL || 'https://ds.ciscospark.com/v1/region',\n\n /**\n * The u2c discovery url\n *\n * @type {string}\n */\n u2c: process.env.U2C_SERVICE_URL || 'https://u2c.svc.webex.com/u2c/api/v1',\n },\n\n /**\n * When true, considers all urls in `allowedDomains` as safe for auth tokens\n *\n * @type {boolean}\n */\n validateDomains: true,\n\n /**\n * When true, enables the CatalogUrlInterceptor which validates that all\n * outbound request URLs are in the service catalog or allowed domains.\n * This prevents SSRF attacks where attacker-controlled URLs could be\n * sent to the SDK.\n *\n * @type {boolean}\n */\n validateCatalogUrls: false,\n\n /**\n * services that don't need auth validation\n */\n\n servicesNotNeedValidation: ['webex-appapi-service'],\n\n /**\n * Contains a list of allowed domain host addresses.\n *\n * @type {Array<string>}\n */\n allowedDomains: [],\n },\n device: {\n preDiscoveryServices: {\n hydra: process.env.HYDRA_SERVICE_URL || 'https://api.ciscospark.com/v1',\n hydraServiceUrl: process.env.HYDRA_SERVICE_URL || 'https://api.ciscospark.com/v1',\n },\n validateDomains: true,\n },\n metrics: {\n type: ['behavioral', 'operational'],\n },\n calling: {\n /**\n * Controls whether U2C service catalogs should be cached and warmed from cache.\n * When false, the services layer will skip reading and writing the U2C cache.\n */\n cacheU2C: false,\n },\n payloadTransformer: {\n /**\n * When true, inbound payload transforms run at most once for the same successful response object.\n * This supports request flows that pass a response through more than one interceptor pipeline.\n */\n skipRepeatedInboundTransforms: false,\n predicates: [],\n transforms: [],\n },\n storage: {\n boundedAdapter: MemoryStoreAdapter,\n unboundedAdapter: MemoryStoreAdapter,\n },\n};\n"],"mappings":";;;;;;;;AAMA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAPA;AACA;AACA;AAEA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAKe;EACbC,oBAAoB,EAAE,EAAE;EACxBC,iBAAiB,EAAE,CAAC;EACpBC,wBAAwB,EAAE,CAAC;EAC3BC,oBAAoB,EAAE,CAAC;EACvBC,cAAc,EAAE,EAAE;EAClBC,gBAAgB,EAAE,cAAc;EAChCC,gBAAgB,EAAE,EAAE;EACpBC,eAAe,EAAEC,SAAS;EAC1BC,WAAW,EAAE,IAAIC,0BAAiB,CAAC,CAAC;EACpC;AACF;AACA;AACA;AACA;AACA;EACEC,WAAW,EAAEH,SAAS;EACtBI,OAAO,EAAEC,OAAO,CAACC,GAAG,CAACC,cAAc,IAAI,KAAK;EAC5CC,QAAQ,EAAE;IACR;AACJ;AACA;AACA;AACA;AACA;IACIC,sCAAsC,EAAE,KAAK;IAE7C;AACJ;AACA;AACA;AACA;IACIC,kBAAkB,EAAE,KAAK;IAEzB;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;IACIC,mCAAmC,EAAE,KAAK;IAE1C;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;IACIC,kBAAkB,EAAE,KAAK;IAEzB;AACJ;AACA;AACA;AACA;IACIC,SAAS,EAAE;MACT;AACN;AACA;AACA;AACA;MACMC,KAAK,EAAET,OAAO,CAACC,GAAG,CAACS,iBAAiB,IAAI,+BAA+B;MAEvE;AACN;AACA;MACMC,WAAW,EAAEX,OAAO,CAACC,GAAG,CAACW,uBAAuB,IAAI,qCAAqC;MAEzF;AACN;AACA;AACA;AACA;MACMC,GAAG,EAAEb,OAAO,CAACC,GAAG,CAACa,eAAe,IAAI;IACtC,CAAC;IAED;AACJ;AACA;AACA;AACA;IACIC,eAAe,EAAE,IAAI;IAErB;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;IACIC,mBAAmB,EAAE,KAAK;IAE1B;AACJ;AACA;;IAEIC,yBAAyB,EAAE,CAAC,sBAAsB,CAAC;IAEnD;AACJ;AACA;AACA;AACA;IACIC,cAAc,EAAE;EAClB,CAAC;EACDC,MAAM,EAAE;IACNC,oBAAoB,EAAE;MACpBX,KAAK,EAAET,OAAO,CAACC,GAAG,CAACS,iBAAiB,IAAI,+BAA+B;MACvEW,eAAe,EAAErB,OAAO,CAACC,GAAG,CAACS,iBAAiB,IAAI;IACpD,CAAC;IACDK,eAAe,EAAE;EACnB,CAAC;EACDO,OAAO,EAAE;IACPC,IAAI,EAAE,CAAC,YAAY,EAAE,aAAa;EACpC,CAAC;EACDC,OAAO,EAAE;IACP;AACJ;AACA;AACA;IACIC,QAAQ,EAAE;EACZ,CAAC;EACDC,kBAAkB,EAAE;IAClB;AACJ;AACA;AACA;IACIC,6BAA6B,EAAE,KAAK;IACpCC,UAAU,EAAE,EAAE;IACdC,UAAU,EAAE;EACd,CAAC;EACDC,OAAO,EAAE;IACPC,cAAc,EAAEC,2BAAkB;IAClCC,gBAAgB,EAAED;EACpB;AACF,CAAC","ignoreList":[]}
|
package/dist/lib/batcher.js
CHANGED
|
@@ -302,7 +302,7 @@ var Batcher = _webexPlugin.default.extend({
|
|
|
302
302
|
fingerprintResponse: function fingerprintResponse(item) {
|
|
303
303
|
throw new Error('fingerprintResponse() must be implemented');
|
|
304
304
|
},
|
|
305
|
-
version: "3.13.0-next.
|
|
305
|
+
version: "3.13.0-next.4"
|
|
306
306
|
});
|
|
307
307
|
var _default2 = exports.default = Batcher;
|
|
308
308
|
//# sourceMappingURL=batcher.js.map
|
|
@@ -655,7 +655,7 @@ var Credentials = _webexPlugin.default.extend((_dec = (0, _common.oneFlight)({
|
|
|
655
655
|
this.refresh();
|
|
656
656
|
}
|
|
657
657
|
},
|
|
658
|
-
version: "3.13.0-next.
|
|
658
|
+
version: "3.13.0-next.4"
|
|
659
659
|
}, (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));
|
|
660
660
|
var _default = exports.default = Credentials;
|
|
661
661
|
//# 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.13.0-next.
|
|
535
|
+
version: "3.13.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
|
|
@@ -1647,7 +1647,7 @@ var Services = _webexPlugin.default.extend({
|
|
|
1647
1647
|
}, _callee6);
|
|
1648
1648
|
})));
|
|
1649
1649
|
},
|
|
1650
|
-
version: "3.13.0-next.
|
|
1650
|
+
version: "3.13.0-next.4"
|
|
1651
1651
|
});
|
|
1652
1652
|
/* eslint-enable no-underscore-dangle */
|
|
1653
1653
|
var _default = exports.default = Services;
|
|
@@ -1586,7 +1586,7 @@ var Services = _webexPlugin.default.extend({
|
|
|
1586
1586
|
}, _callee5);
|
|
1587
1587
|
})));
|
|
1588
1588
|
},
|
|
1589
|
-
version: "3.13.0-next.
|
|
1589
|
+
version: "3.13.0-next.4"
|
|
1590
1590
|
});
|
|
1591
1591
|
/* eslint-enable no-underscore-dangle */
|
|
1592
1592
|
var _default = exports.default = Services;
|
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.13.0-next.
|
|
60
|
+
version: "3.13.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
|
@@ -98,7 +98,7 @@ var MAX_FILE_SIZE_IN_MB = 2048;
|
|
|
98
98
|
* @class
|
|
99
99
|
*/
|
|
100
100
|
var WebexCore = _ampersandState.default.extend((_obj = {
|
|
101
|
-
version: "3.13.0-next.
|
|
101
|
+
version: "3.13.0-next.4",
|
|
102
102
|
children: {
|
|
103
103
|
internal: _webexInternalCore.default
|
|
104
104
|
},
|
|
@@ -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.13.0-next.
|
|
645
|
+
WebexCore.version = "3.13.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
|
@@ -33,16 +33,16 @@
|
|
|
33
33
|
"@sinonjs/fake-timers": "^6.0.1",
|
|
34
34
|
"@webex/babel-config-legacy": "0.0.0",
|
|
35
35
|
"@webex/eslint-config-legacy": "0.0.0",
|
|
36
|
-
"@webex/internal-plugin-device": "3.13.0-next.
|
|
36
|
+
"@webex/internal-plugin-device": "3.13.0-next.4",
|
|
37
37
|
"@webex/jest-config-legacy": "0.0.0",
|
|
38
38
|
"@webex/legacy-tools": "0.0.0",
|
|
39
|
-
"@webex/plugin-logger": "3.13.0-next.
|
|
40
|
-
"@webex/test-helper-chai": "3.
|
|
41
|
-
"@webex/test-helper-make-local-url": "3.
|
|
42
|
-
"@webex/test-helper-mocha": "3.
|
|
43
|
-
"@webex/test-helper-mock-webex": "3.
|
|
44
|
-
"@webex/test-helper-refresh-callback": "3.
|
|
45
|
-
"@webex/test-helper-test-users": "3.
|
|
39
|
+
"@webex/plugin-logger": "3.13.0-next.4",
|
|
40
|
+
"@webex/test-helper-chai": "3.13.0-next.1",
|
|
41
|
+
"@webex/test-helper-make-local-url": "3.13.0-next.1",
|
|
42
|
+
"@webex/test-helper-mocha": "3.13.0-next.1",
|
|
43
|
+
"@webex/test-helper-mock-webex": "3.13.0-next.1",
|
|
44
|
+
"@webex/test-helper-refresh-callback": "3.13.0-next.1",
|
|
45
|
+
"@webex/test-helper-test-users": "3.13.0-next.1",
|
|
46
46
|
"chai": "^4.3.4",
|
|
47
47
|
"chai-as-promised": "^7.1.1",
|
|
48
48
|
"eslint": "^8.24.0",
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
"sinon": "^9.2.4"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@webex/common": "3.
|
|
54
|
-
"@webex/common-timers": "3.
|
|
55
|
-
"@webex/http-core": "3.
|
|
56
|
-
"@webex/storage-adapter-spec": "3.
|
|
53
|
+
"@webex/common": "3.13.0-next.1",
|
|
54
|
+
"@webex/common-timers": "3.13.0-next.1",
|
|
55
|
+
"@webex/http-core": "3.13.0-next.1",
|
|
56
|
+
"@webex/storage-adapter-spec": "3.13.0-next.1",
|
|
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.13.0-next.
|
|
76
|
+
"version": "3.13.0-next.4"
|
|
77
77
|
}
|
package/src/config.js
CHANGED
|
@@ -16,7 +16,7 @@ import uuid from 'uuid';
|
|
|
16
16
|
* @returns {string} e.g. `Collabctg+webex-js-sdk-1a2b3c4d5e6f7a8b9c0d@gmail.com`
|
|
17
17
|
*/
|
|
18
18
|
export function createActivationEmail(): string {
|
|
19
|
-
return `
|
|
19
|
+
return `collabctg+webex-js-sdk-${uuid.v4().replace(/-/g, '').slice(0, 20)}@gmail.com`;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export default createActivationEmail;
|
|
@@ -110,7 +110,9 @@ describe('webex-core', () => {
|
|
|
110
110
|
});
|
|
111
111
|
});
|
|
112
112
|
|
|
113
|
-
|
|
113
|
+
// FIXME: this test can never pass (both branches assert(false)) and, in browsers,
|
|
114
|
+
// refresh() now resolves without a refreshCallback, so the expectation needs revisiting.
|
|
115
|
+
browserOnly(it.skip)('throws without a refresh callback', async () => {
|
|
114
116
|
const webex = new WebexCore({
|
|
115
117
|
credentials: user.token,
|
|
116
118
|
});
|
|
@@ -7,6 +7,7 @@ import {assert} from '@webex/test-helper-chai';
|
|
|
7
7
|
import testUsers from '@webex/test-helper-test-users';
|
|
8
8
|
import WebexCore, {filterScope} from '@webex/webex-core';
|
|
9
9
|
import refreshCallback from '@webex/test-helper-refresh-callback';
|
|
10
|
+
import sinon from 'sinon';
|
|
10
11
|
|
|
11
12
|
/* eslint camelcase: [0] */
|
|
12
13
|
|
|
@@ -89,6 +90,13 @@ describe('webex-core', () => {
|
|
|
89
90
|
describe('#revoke()', () => {
|
|
90
91
|
it('revokes the token', () => {
|
|
91
92
|
webex = new WebexCore({credentials: user.token});
|
|
93
|
+
// Once revoked, every metrics POST fails to downscope the token and submits a
|
|
94
|
+
// JS_SDK_CREDENTIALS_DOWNSCOPE_FAILED metric, which is itself POSTed, looping forever
|
|
95
|
+
// and keeping the node process alive after the suite finishes. The metrics plugin is
|
|
96
|
+
// only registered when another spec file (e.g. via internal-plugin-device) imports it.
|
|
97
|
+
if (webex.internal.metrics) {
|
|
98
|
+
sinon.stub(webex.internal.metrics, 'submitClientMetrics');
|
|
99
|
+
}
|
|
92
100
|
|
|
93
101
|
return webex.credentials.supertoken.revoke().then(() => {
|
|
94
102
|
assert.isUndefined(webex.credentials.supertoken.access_token);
|
|
@@ -26,6 +26,11 @@ describe('webex-core', () => {
|
|
|
26
26
|
setTimeout(() => {
|
|
27
27
|
webexUser = user;
|
|
28
28
|
webex = new WebexCore({credentials: user.token});
|
|
29
|
+
// Tests below replace the postauth catalog with fixtures that lack `metrics`.
|
|
30
|
+
// Any client metric from this instance then fails waitForService('metrics'),
|
|
31
|
+
// which submits JS_SDK_SERVICE_NOT_FOUND, which is POSTed in turn - forever,
|
|
32
|
+
// keeping the node process alive after the suite finishes.
|
|
33
|
+
sinon.stub(webex.internal.metrics, 'submitClientMetrics');
|
|
29
34
|
services = webex.internal.services;
|
|
30
35
|
catalog = services._getCatalog();
|
|
31
36
|
resolve();
|
|
@@ -239,7 +239,7 @@ describe('webex-core', () => {
|
|
|
239
239
|
beforeEach(() => {
|
|
240
240
|
services = {
|
|
241
241
|
hydra: 'https://hydra-a.wbx.com',
|
|
242
|
-
u2c: 'https://u2c.
|
|
242
|
+
u2c: 'https://u2c.svc.webex.com/u2c/api/v1',
|
|
243
243
|
example: 'https://service.example.com',
|
|
244
244
|
};
|
|
245
245
|
|
|
@@ -1366,7 +1366,7 @@ describe('webex-core', () => {
|
|
|
1366
1366
|
environment: 'integration',
|
|
1367
1367
|
services: {
|
|
1368
1368
|
discovery: {
|
|
1369
|
-
u2c: 'https://u2c.
|
|
1369
|
+
u2c: 'https://u2c.svc.webex.com/u2c/api/v1',
|
|
1370
1370
|
},
|
|
1371
1371
|
},
|
|
1372
1372
|
};
|
|
@@ -1402,7 +1402,7 @@ describe('webex-core', () => {
|
|
|
1402
1402
|
services.webex.config = {
|
|
1403
1403
|
services: {
|
|
1404
1404
|
discovery: {
|
|
1405
|
-
u2c: 'https://u2c.
|
|
1405
|
+
u2c: 'https://u2c.svc.webex.com/u2c/api/v1',
|
|
1406
1406
|
},
|
|
1407
1407
|
},
|
|
1408
1408
|
};
|
|
@@ -1627,7 +1627,7 @@ describe('webex-core', () => {
|
|
|
1627
1627
|
// arrange config for env fingerprint
|
|
1628
1628
|
services.webex.config = services.webex.config || {};
|
|
1629
1629
|
services.webex.config.services = services.webex.config.services || {discovery: {}};
|
|
1630
|
-
services.webex.config.services.discovery.u2c = 'https://u2c.
|
|
1630
|
+
services.webex.config.services.discovery.u2c = 'https://u2c.svc.webex.com/u2c/api/v1';
|
|
1631
1631
|
services.webex.config.fedramp = false;
|
|
1632
1632
|
|
|
1633
1633
|
// write cache with meta
|
|
@@ -1643,7 +1643,7 @@ describe('webex-core', () => {
|
|
|
1643
1643
|
assert.equal(parsed.orgId, undefined, 'orgId not set without credentials');
|
|
1644
1644
|
assert.deepEqual(parsed.env, {
|
|
1645
1645
|
fedramp: false,
|
|
1646
|
-
u2cDiscoveryUrl: 'https://u2c.
|
|
1646
|
+
u2cDiscoveryUrl: 'https://u2c.svc.webex.com/u2c/api/v1',
|
|
1647
1647
|
});
|
|
1648
1648
|
assert.isObject(parsed.preauth);
|
|
1649
1649
|
assert.deepEqual(parsed.preauth.meta, {
|
|
@@ -1662,14 +1662,14 @@ describe('webex-core', () => {
|
|
|
1662
1662
|
// set current env to match cached env
|
|
1663
1663
|
services.webex.config = services.webex.config || {};
|
|
1664
1664
|
services.webex.config.services = services.webex.config.services || {discovery: {}};
|
|
1665
|
-
services.webex.config.services.discovery.u2c = 'https://u2c.
|
|
1665
|
+
services.webex.config.services.discovery.u2c = 'https://u2c.svc.webex.com/u2c/api/v1';
|
|
1666
1666
|
services.webex.config.fedramp = false;
|
|
1667
1667
|
// cache with matching orgId selection
|
|
1668
1668
|
window.localStorage.setItem(
|
|
1669
1669
|
CATALOG_CACHE_KEY_V1,
|
|
1670
1670
|
JSON.stringify({
|
|
1671
1671
|
cachedAt: Date.now(),
|
|
1672
|
-
env: {fedramp: false, u2cDiscoveryUrl: 'https://u2c.
|
|
1672
|
+
env: {fedramp: false, u2cDiscoveryUrl: 'https://u2c.svc.webex.com/u2c/api/v1'},
|
|
1673
1673
|
preauth: {
|
|
1674
1674
|
hostMap: {serviceLinks: {}, hostCatalog: {}},
|
|
1675
1675
|
meta: {selectionType: 'orgId', selectionValue: 'urn:EXAMPLE:org'},
|
|
@@ -1694,7 +1694,7 @@ describe('webex-core', () => {
|
|
|
1694
1694
|
CATALOG_CACHE_KEY_V1,
|
|
1695
1695
|
JSON.stringify({
|
|
1696
1696
|
cachedAt: Date.now(),
|
|
1697
|
-
env: {fedramp: false, u2cDiscoveryUrl: 'https://u2c.
|
|
1697
|
+
env: {fedramp: false, u2cDiscoveryUrl: 'https://u2c.svc.webex.com/u2c/api/v1'},
|
|
1698
1698
|
preauth: {
|
|
1699
1699
|
hostMap: {serviceLinks: {}, hostCatalog: {}},
|
|
1700
1700
|
meta: {selectionType: 'mode', selectionValue: 'DEFAULT_BY_PROXIMITY'},
|
|
@@ -1723,7 +1723,7 @@ describe('webex-core', () => {
|
|
|
1723
1723
|
CATALOG_CACHE_KEY_V1,
|
|
1724
1724
|
JSON.stringify({
|
|
1725
1725
|
cachedAt: Date.now(),
|
|
1726
|
-
env: {fedramp: false, u2cDiscoveryUrl: 'https://u2c.
|
|
1726
|
+
env: {fedramp: false, u2cDiscoveryUrl: 'https://u2c.svc.webex.com/u2c/api/v1'},
|
|
1727
1727
|
preauth: {
|
|
1728
1728
|
hostMap: {serviceLinks: {}, hostCatalog: {}},
|
|
1729
1729
|
meta: {selectionType: 'orgId', selectionValue: 'urn:DIFF:org'},
|
|
@@ -1753,7 +1753,7 @@ describe('webex-core', () => {
|
|
|
1753
1753
|
// current env
|
|
1754
1754
|
services.webex.config = services.webex.config || {};
|
|
1755
1755
|
services.webex.config.services = services.webex.config.services || {discovery: {}};
|
|
1756
|
-
services.webex.config.services.discovery.u2c = 'https://u2c.
|
|
1756
|
+
services.webex.config.services.discovery.u2c = 'https://u2c.svc.webex.com/u2c/api/v1';
|
|
1757
1757
|
services.webex.config.fedramp = false;
|
|
1758
1758
|
|
|
1759
1759
|
const warmed = await services._loadCatalogFromCache();
|
|
@@ -39,7 +39,7 @@ describe('webex-core', () => {
|
|
|
39
39
|
'https://u2c.gov.ciscospark.com/u2c/api/v1',
|
|
40
40
|
'https://u2c.svc.webexgov.us/u2c/api/v1',
|
|
41
41
|
'https://u2c.example.com/u2c/api/v1',
|
|
42
|
-
'https://u2c.
|
|
42
|
+
'https://u2c.svc.webex.com/u2c/api/v1',
|
|
43
43
|
])('preserves the existing FedRAMP U2C discovery URL %s', (u2c) => {
|
|
44
44
|
const discovery = {
|
|
45
45
|
hydra: 'https://hydra.example.com/v1',
|
|
@@ -83,7 +83,7 @@ describe('webex-core', () => {
|
|
|
83
83
|
it('leaves commercial discovery configuration unchanged', () => {
|
|
84
84
|
const discovery = {
|
|
85
85
|
hydra: 'https://api.ciscospark.com/v1',
|
|
86
|
-
u2c: 'https://u2c.
|
|
86
|
+
u2c: 'https://u2c.svc.webex.com/u2c/api/v1',
|
|
87
87
|
sqdiscovery: 'https://ds.ciscospark.com/v1/region',
|
|
88
88
|
};
|
|
89
89
|
webex.config = {
|
|
@@ -1383,7 +1383,7 @@ describe('webex-core', () => {
|
|
|
1383
1383
|
environment: 'integration',
|
|
1384
1384
|
services: {
|
|
1385
1385
|
discovery: {
|
|
1386
|
-
u2c: 'https://u2c.
|
|
1386
|
+
u2c: 'https://u2c.svc.webex.com/u2c/api/v1',
|
|
1387
1387
|
},
|
|
1388
1388
|
},
|
|
1389
1389
|
};
|
|
@@ -1419,7 +1419,7 @@ describe('webex-core', () => {
|
|
|
1419
1419
|
services.webex.config = {
|
|
1420
1420
|
services: {
|
|
1421
1421
|
discovery: {
|
|
1422
|
-
u2c: 'https://u2c.
|
|
1422
|
+
u2c: 'https://u2c.svc.webex.com/u2c/api/v1',
|
|
1423
1423
|
},
|
|
1424
1424
|
},
|
|
1425
1425
|
};
|
|
@@ -1484,7 +1484,7 @@ describe('webex-core', () => {
|
|
|
1484
1484
|
services.webex.config = services.webex.config || {};
|
|
1485
1485
|
services.webex.config.services = services.webex.config.services || {discovery: {}};
|
|
1486
1486
|
services.webex.config.services.discovery.u2c =
|
|
1487
|
-
services.webex.config.services.discovery.u2c || 'https://u2c.
|
|
1487
|
+
services.webex.config.services.discovery.u2c || 'https://u2c.svc.webex.com/u2c/api/v1';
|
|
1488
1488
|
services.webex.config.fedramp =
|
|
1489
1489
|
typeof services.webex.config.fedramp === 'boolean'
|
|
1490
1490
|
? services.webex.config.fedramp
|
|
@@ -1506,7 +1506,7 @@ describe('webex-core', () => {
|
|
|
1506
1506
|
|
|
1507
1507
|
it('stores selection metadata and env on cache write for preauth', async () => {
|
|
1508
1508
|
// Arrange env
|
|
1509
|
-
services.webex.config.services.discovery.u2c = 'https://u2c.
|
|
1509
|
+
services.webex.config.services.discovery.u2c = 'https://u2c.svc.webex.com/u2c/api/v1';
|
|
1510
1510
|
services.webex.config.fedramp = false;
|
|
1511
1511
|
|
|
1512
1512
|
// Act
|
|
@@ -1522,7 +1522,7 @@ describe('webex-core', () => {
|
|
|
1522
1522
|
const parsed = JSON.parse(raw as string);
|
|
1523
1523
|
assert.deepEqual(parsed.env, {
|
|
1524
1524
|
fedramp: false,
|
|
1525
|
-
u2cDiscoveryUrl: 'https://u2c.
|
|
1525
|
+
u2cDiscoveryUrl: 'https://u2c.svc.webex.com/u2c/api/v1',
|
|
1526
1526
|
});
|
|
1527
1527
|
assert.isObject(parsed.preauth);
|
|
1528
1528
|
assert.deepEqual(parsed.preauth.meta, {
|
|
@@ -1533,7 +1533,7 @@ describe('webex-core', () => {
|
|
|
1533
1533
|
|
|
1534
1534
|
it('warms preauth from cache when selection meta matches intended orgId', async () => {
|
|
1535
1535
|
// Arrange current env and credentials
|
|
1536
|
-
services.webex.config.services.discovery.u2c = 'https://u2c.
|
|
1536
|
+
services.webex.config.services.discovery.u2c = 'https://u2c.svc.webex.com/u2c/api/v1';
|
|
1537
1537
|
services.webex.config.fedramp = false;
|
|
1538
1538
|
services.webex.credentials = {
|
|
1539
1539
|
canAuthorize: true,
|
|
@@ -1544,7 +1544,7 @@ describe('webex-core', () => {
|
|
|
1544
1544
|
CATALOG_CACHE_KEY_V2,
|
|
1545
1545
|
JSON.stringify({
|
|
1546
1546
|
cachedAt: Date.now(),
|
|
1547
|
-
env: {fedramp: false, u2cDiscoveryUrl: 'https://u2c.
|
|
1547
|
+
env: {fedramp: false, u2cDiscoveryUrl: 'https://u2c.svc.webex.com/u2c/api/v1'},
|
|
1548
1548
|
preauth: {
|
|
1549
1549
|
hostMap: {services: [], timestamp: '1'},
|
|
1550
1550
|
meta: {selectionType: 'orgId', selectionValue: 'urn:EXAMPLE:org'},
|
|
@@ -1568,13 +1568,13 @@ describe('webex-core', () => {
|
|
|
1568
1568
|
|
|
1569
1569
|
it('does not warm preauth when selection meta is proximity mode', async () => {
|
|
1570
1570
|
// Arrange env
|
|
1571
|
-
services.webex.config.services.discovery.u2c = 'https://u2c.
|
|
1571
|
+
services.webex.config.services.discovery.u2c = 'https://u2c.svc.webex.com/u2c/api/v1';
|
|
1572
1572
|
services.webex.config.fedramp = false;
|
|
1573
1573
|
window.localStorage.setItem(
|
|
1574
1574
|
CATALOG_CACHE_KEY_V2,
|
|
1575
1575
|
JSON.stringify({
|
|
1576
1576
|
cachedAt: Date.now(),
|
|
1577
|
-
env: {fedramp: false, u2cDiscoveryUrl: 'https://u2c.
|
|
1577
|
+
env: {fedramp: false, u2cDiscoveryUrl: 'https://u2c.svc.webex.com/u2c/api/v1'},
|
|
1578
1578
|
preauth: {
|
|
1579
1579
|
hostMap: {services: [], timestamp: '1'},
|
|
1580
1580
|
meta: {selectionType: 'mode', selectionValue: 'DEFAULT_BY_PROXIMITY'},
|
|
@@ -1597,7 +1597,7 @@ describe('webex-core', () => {
|
|
|
1597
1597
|
|
|
1598
1598
|
it('does not warm preauth when selection meta mismatches intended selection', async () => {
|
|
1599
1599
|
// Arrange env and credentials
|
|
1600
|
-
services.webex.config.services.discovery.u2c = 'https://u2c.
|
|
1600
|
+
services.webex.config.services.discovery.u2c = 'https://u2c.svc.webex.com/u2c/api/v1';
|
|
1601
1601
|
services.webex.config.fedramp = false;
|
|
1602
1602
|
services.webex.credentials = {
|
|
1603
1603
|
canAuthorize: true,
|
|
@@ -1607,7 +1607,7 @@ describe('webex-core', () => {
|
|
|
1607
1607
|
CATALOG_CACHE_KEY_V2,
|
|
1608
1608
|
JSON.stringify({
|
|
1609
1609
|
cachedAt: Date.now(),
|
|
1610
|
-
env: {fedramp: false, u2cDiscoveryUrl: 'https://u2c.
|
|
1610
|
+
env: {fedramp: false, u2cDiscoveryUrl: 'https://u2c.svc.webex.com/u2c/api/v1'},
|
|
1611
1611
|
preauth: {
|
|
1612
1612
|
hostMap: {services: [], timestamp: '1'},
|
|
1613
1613
|
meta: {selectionType: 'orgId', selectionValue: 'urn:DIFF:org'},
|