@webex/webex-core 3.8.1-web-workers-keepalive.1 → 3.9.0
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/index.js +9 -33
- package/dist/index.js.map +1 -1
- package/dist/lib/batcher.js +1 -1
- package/dist/lib/constants.js +10 -1
- package/dist/lib/constants.js.map +1 -1
- package/dist/lib/credentials/credentials.js +1 -1
- package/dist/lib/credentials/token.js +1 -1
- package/dist/lib/{services-v2/interceptors → interceptors}/server-error.js +1 -1
- package/dist/lib/interceptors/server-error.js.map +1 -0
- package/dist/lib/services/index.js +2 -29
- package/dist/lib/services/index.js.map +1 -1
- package/dist/lib/services/service-host.js +1 -1
- package/dist/lib/services/service-host.js.map +1 -1
- package/dist/lib/services/service-registry.js +1 -1
- package/dist/lib/services/service-registry.js.map +1 -1
- package/dist/lib/services/service-state.js +1 -1
- package/dist/lib/services/service-state.js.map +1 -1
- package/dist/lib/services/services.js +3 -3
- package/dist/lib/services/services.js.map +1 -1
- package/dist/lib/services-v2/index.js +0 -29
- package/dist/lib/services-v2/index.js.map +1 -1
- package/dist/lib/services-v2/service-catalog.js.map +1 -1
- package/dist/lib/services-v2/services-v2.js +10 -10
- package/dist/lib/services-v2/services-v2.js.map +1 -1
- package/dist/lib/services-v2/types.js.map +1 -1
- package/dist/plugins/logger.js +1 -1
- package/dist/webex-core.js +3 -3
- package/dist/webex-core.js.map +1 -1
- package/package.json +13 -13
- package/src/index.js +5 -14
- package/src/lib/constants.js +29 -1
- package/src/lib/{services/interceptors → interceptors}/server-error.js +1 -1
- package/src/lib/services/index.js +2 -7
- package/src/lib/services/service-host.js +1 -1
- package/src/lib/services/service-registry.js +1 -1
- package/src/lib/services/service-state.js +1 -1
- package/src/lib/services/services.js +2 -2
- package/src/lib/services-v2/index.ts +0 -16
- package/src/lib/services-v2/service-catalog.ts +1 -1
- package/src/lib/services-v2/services-v2.ts +12 -16
- package/src/lib/services-v2/types.ts +1 -1
- package/src/webex-core.js +1 -2
- package/test/fixtures/host-catalog-v2.ts +30 -122
- package/test/integration/spec/services-v2/service-catalog.js +2 -5
- package/test/integration/spec/services-v2/services-v2.js +24 -10
- package/test/unit/spec/services-v2/service-detail.ts +1 -1
- package/test/unit/spec/services-v2/services-v2.ts +1 -1
- package/dist/lib/services/constants.js +0 -17
- package/dist/lib/services/constants.js.map +0 -1
- package/dist/lib/services/interceptors/hostmap.js +0 -64
- package/dist/lib/services/interceptors/hostmap.js.map +0 -1
- package/dist/lib/services/interceptors/server-error.js +0 -77
- package/dist/lib/services/interceptors/server-error.js.map +0 -1
- package/dist/lib/services/interceptors/service.js +0 -137
- package/dist/lib/services/interceptors/service.js.map +0 -1
- package/dist/lib/services-v2/constants.js +0 -17
- package/dist/lib/services-v2/constants.js.map +0 -1
- package/dist/lib/services-v2/interceptors/server-error.js.map +0 -1
- package/src/lib/services/constants.js +0 -21
- package/src/lib/services/interceptors/hostmap.js +0 -36
- package/src/lib/services/interceptors/service.js +0 -101
- package/src/lib/services-v2/constants.ts +0 -21
- package/src/lib/services-v2/interceptors/server-error.js +0 -48
- /package/dist/lib/{services-v2/interceptors → interceptors}/hostmap.js +0 -0
- /package/dist/lib/{services-v2/interceptors → interceptors}/hostmap.js.map +0 -0
- /package/dist/lib/{services-v2/interceptors → interceptors}/service.js +0 -0
- /package/dist/lib/{services-v2/interceptors → interceptors}/service.js.map +0 -0
- /package/dist/lib/{services/metrics.js → metrics.js} +0 -0
- /package/dist/lib/{services/metrics.js.map → metrics.js.map} +0 -0
- /package/src/lib/{services-v2/interceptors → interceptors}/hostmap.js +0 -0
- /package/src/lib/{services-v2/interceptors → interceptors}/service.js +0 -0
- /package/src/lib/{services/metrics.js → metrics.js} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_httpCore","require","_webexHttpError","_interopRequireDefault","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf2","default","result","NewTarget","constructor","_Reflect$construct","arguments","apply","_possibleConstructorReturn2","Reflect","sham","Proxy","Boolean","prototype","valueOf","call","e","ServerErrorInterceptor","exports","_Interceptor","_inherits2","_super","_classCallCheck2","_createClass2","key","value","onResponseError","options","reason","WebexHttpError","InternalServerError","BadGateway","ServiceUnavailable","uri","feature","webex","internal","device","features","developer","get","metrics","submitClientMetrics","fields","success","tags","action","error","message","url","_promise","resolve","services","markFailedUrl","then","reject","create","Interceptor"],"sources":["server-error.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {Interceptor} from '@webex/http-core';\nimport WebexHttpError from '../../webex-http-error';\n/**\n * Changes server url when it fails\n */\nexport default class ServerErrorInterceptor extends Interceptor {\n /**\n * @returns {HAMessagingInterceptor}\n */\n static create() {\n // eslint-disable-next-line no-invalid-this\n return new ServerErrorInterceptor({webex: this});\n }\n\n /**\n * @see Interceptor#onResponseError\n * @param {Object} options\n * @param {Object} reason\n * @returns {Object}\n */\n onResponseError(options, reason) {\n if (\n (reason instanceof WebexHttpError.InternalServerError ||\n reason instanceof WebexHttpError.BadGateway ||\n reason instanceof WebexHttpError.ServiceUnavailable) &&\n options.uri\n ) {\n const feature = this.webex.internal.device.features.developer.get('web-high-availability');\n\n if (feature && feature.value) {\n this.webex.internal.metrics.submitClientMetrics('web-ha', {\n fields: {success: false},\n tags: {action: 'failed', error: reason.message, url: options.uri},\n });\n\n return Promise.resolve(this.webex.internal.services.markFailedUrl(options.uri)).then(() =>\n Promise.reject(reason)\n );\n }\n }\n\n return Promise.reject(reason);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAIA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAoD,SAAAG,aAAAC,OAAA,QAAAC,yBAAA,GAAAC,yBAAA,oBAAAC,qBAAA,QAAAC,KAAA,OAAAC,gBAAA,CAAAC,OAAA,EAAAN,OAAA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O,IAAIA,OAAO,CAACT,KAAK,EAAE;UAC5B,IAAI,CAACU,KAAK,CAACC,QAAQ,CAACK,OAAO,CAACC,mBAAmB,CAAC,QAAQ,EAAE;YACxDC,MAAM,EAAE;cAACC,OAAO,EAAE;YAAK,CAAC;YACxBC,IAAI,EAAE;cAACC,MAAM,EAAE,QAAQ;cAAEC,KAAK,EAAEnB,MAAM,CAACoB,OAAO;cAAEC,GAAG,EAAEtB,OAAO,CAACM;YAAG;UAClE,CAAC,CAAC;UAEF,OAAOiB,QAAA,CAAAjD,OAAA,CAAQkD,OAAO,CAAC,IAAI,CAAChB,KAAK,CAACC,QAAQ,CAACgB,QAAQ,CAACC,aAAa,CAAC1B,OAAO,CAACM,GAAG,CAAC,CAAC,CAACqB,IAAI,CAAC;YAAA,OACnFJ,QAAA,CAAAjD,OAAA,CAAQsD,MAAM,CAAC3B,MAAM,CAAC;UAAA,CACxB,CAAC;QACH;MACF;MAEA,OAAOsB,QAAA,CAAAjD,OAAA,CAAQsD,MAAM,CAAC3B,MAAM,CAAC;IAC/B;EAAC;IAAAJ,GAAA;IAAAC,KAAA;IApCD;AACF;AACA;IACE,SAAA+B,OAAA,EAAgB;MACd;MACA,OAAO,IAAIvC,sBAAsB,CAAC;QAACkB,KAAK,EAAE;MAAI,CAAC,CAAC;IAClD;EAAC;EAAA,OAAAlB,sBAAA;AAAA,EAPiDwC,qBAAW"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const NAMESPACE = 'services';
|
|
2
|
-
const SERVICE_CATALOGS = ['discovery', 'limited', 'signin', 'postauth', 'custom'];
|
|
3
|
-
|
|
4
|
-
const SERVICE_CATALOGS_ENUM_TYPES = {
|
|
5
|
-
STRING: 'SERVICE_CATALOGS_ENUM_TYPES_STRING',
|
|
6
|
-
NUMBER: 'SERVICE_CATALOGS_ENUM_TYPES_NUMBER',
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
// The default allowed domains that SDK can make requests to outside of service catalog
|
|
10
|
-
const COMMERCIAL_ALLOWED_DOMAINS = [
|
|
11
|
-
'wbx2.com',
|
|
12
|
-
'ciscospark.com',
|
|
13
|
-
'webex.com',
|
|
14
|
-
'webexapis.com',
|
|
15
|
-
'broadcloudpbx.com',
|
|
16
|
-
'broadcloud.eu',
|
|
17
|
-
'broadcloud.com.au',
|
|
18
|
-
'broadcloudpbx.net',
|
|
19
|
-
];
|
|
20
|
-
|
|
21
|
-
export {SERVICE_CATALOGS_ENUM_TYPES, NAMESPACE, SERVICE_CATALOGS, COMMERCIAL_ALLOWED_DOMAINS};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2015-2024 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import {Interceptor} from '@webex/http-core';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* This interceptor replaces the host in the request uri with the host from the hostmap
|
|
9
|
-
* It will attempt to do this for every request, but not all URIs will be in the hostmap
|
|
10
|
-
* URIs with hosts that are not in the hostmap will be left unchanged
|
|
11
|
-
*/
|
|
12
|
-
export default class HostMapInterceptor extends Interceptor {
|
|
13
|
-
/**
|
|
14
|
-
* @returns {HostMapInterceptor}
|
|
15
|
-
*/
|
|
16
|
-
static create() {
|
|
17
|
-
return new HostMapInterceptor({webex: this});
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* @see Interceptor#onRequest
|
|
22
|
-
* @param {Object} options
|
|
23
|
-
* @returns {Object}
|
|
24
|
-
*/
|
|
25
|
-
onRequest(options) {
|
|
26
|
-
if (options.uri) {
|
|
27
|
-
try {
|
|
28
|
-
options.uri = this.webex.internal.services.replaceHostFromHostmap(options.uri);
|
|
29
|
-
} catch (error) {
|
|
30
|
-
/* empty */
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return options;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import {Interceptor} from '@webex/http-core';
|
|
6
|
-
|
|
7
|
-
const trailingSlashes = /(?:^\/)|(?:\/$)/;
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @class
|
|
11
|
-
*/
|
|
12
|
-
export default class ServiceInterceptor extends Interceptor {
|
|
13
|
-
/**
|
|
14
|
-
* @returns {ServiceInterceptor}
|
|
15
|
-
*/
|
|
16
|
-
static create() {
|
|
17
|
-
/* eslint no-invalid-this: [0] */
|
|
18
|
-
return new ServiceInterceptor({webex: this});
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/* eslint-disable no-param-reassign */
|
|
22
|
-
/**
|
|
23
|
-
* @see Interceptor#onRequest
|
|
24
|
-
* @param {Object} options - The request PTO.
|
|
25
|
-
* @returns {Object} - The mutated request PTO.
|
|
26
|
-
*/
|
|
27
|
-
onRequest(options) {
|
|
28
|
-
// Validate that the PTO includes a uri property.
|
|
29
|
-
if (options.uri) {
|
|
30
|
-
return options;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// Normalize and validate the PTO.
|
|
34
|
-
this.normalizeOptions(options);
|
|
35
|
-
this.validateOptions(options);
|
|
36
|
-
|
|
37
|
-
// Destructure commonly referenced namespaces.
|
|
38
|
-
const {services} = this.webex.internal;
|
|
39
|
-
const {service, resource, waitForServiceTimeout} = options;
|
|
40
|
-
|
|
41
|
-
// Attempt to collect the service url.
|
|
42
|
-
return services
|
|
43
|
-
.waitForService({name: service, timeout: waitForServiceTimeout})
|
|
44
|
-
.then((serviceUrl) => {
|
|
45
|
-
// Generate the combined service url and resource.
|
|
46
|
-
options.uri = this.generateUri(serviceUrl, resource);
|
|
47
|
-
|
|
48
|
-
return options;
|
|
49
|
-
})
|
|
50
|
-
.catch(() =>
|
|
51
|
-
Promise.reject(new Error(`service-interceptor: '${service}' is not a known service`))
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/* eslint-disable class-methods-use-this */
|
|
56
|
-
/**
|
|
57
|
-
* Generate a usable request uri string from a service url and a resouce.
|
|
58
|
-
*
|
|
59
|
-
* @param {string} serviceUrl - The service url.
|
|
60
|
-
* @param {string} [resource] - The resouce to be appended to the service url.
|
|
61
|
-
* @returns {string} - The combined service url and resource.
|
|
62
|
-
*/
|
|
63
|
-
generateUri(serviceUrl, resource = '') {
|
|
64
|
-
const formattedService = serviceUrl.replace(trailingSlashes, '');
|
|
65
|
-
const formattedResource = resource.replace(trailingSlashes, '');
|
|
66
|
-
|
|
67
|
-
return `${formattedService}/${formattedResource}`;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Normalizes request options relative to service identification.
|
|
72
|
-
*
|
|
73
|
-
* @param {Object} options - The request PTO.
|
|
74
|
-
* @returns {Object} - The mutated request PTO.
|
|
75
|
-
*/
|
|
76
|
-
normalizeOptions(options) {
|
|
77
|
-
// Validate if the api property is used.
|
|
78
|
-
if (options.api) {
|
|
79
|
-
// Assign the service property the value of the api property if necessary.
|
|
80
|
-
options.service = options.service || options.api;
|
|
81
|
-
delete options.api;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Validates that the appropriate options for this interceptor are present.
|
|
87
|
-
*
|
|
88
|
-
* @param {Object} options - The request PTO.
|
|
89
|
-
* @returns {Object} - The mutated request PTO.
|
|
90
|
-
*/
|
|
91
|
-
validateOptions(options) {
|
|
92
|
-
if (!options.resource) {
|
|
93
|
-
throw new Error('a `resource` parameter is required');
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
if (!options.service) {
|
|
97
|
-
throw new Error("a valid 'service' parameter is required");
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
/* eslint-enable class-methods-use-this, no-param-reassign */
|
|
101
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const NAMESPACE = 'services';
|
|
2
|
-
const SERVICE_CATALOGS = ['discovery', 'limited', 'signin', 'postauth', 'custom'];
|
|
3
|
-
|
|
4
|
-
const SERVICE_CATALOGS_ENUM_TYPES = {
|
|
5
|
-
STRING: 'SERVICE_CATALOGS_ENUM_TYPES_STRING',
|
|
6
|
-
NUMBER: 'SERVICE_CATALOGS_ENUM_TYPES_NUMBER',
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
// The default allowed domains that SDK can make requests to outside of service catalog
|
|
10
|
-
const COMMERCIAL_ALLOWED_DOMAINS = [
|
|
11
|
-
'wbx2.com',
|
|
12
|
-
'ciscospark.com',
|
|
13
|
-
'webex.com',
|
|
14
|
-
'webexapis.com',
|
|
15
|
-
'broadcloudpbx.com',
|
|
16
|
-
'broadcloud.eu',
|
|
17
|
-
'broadcloud.com.au',
|
|
18
|
-
'broadcloudpbx.net',
|
|
19
|
-
];
|
|
20
|
-
|
|
21
|
-
export {SERVICE_CATALOGS_ENUM_TYPES, NAMESPACE, SERVICE_CATALOGS, COMMERCIAL_ALLOWED_DOMAINS};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import {Interceptor} from '@webex/http-core';
|
|
6
|
-
import WebexHttpError from '../../webex-http-error';
|
|
7
|
-
/**
|
|
8
|
-
* Changes server url when it fails
|
|
9
|
-
*/
|
|
10
|
-
export default class ServerErrorInterceptor extends Interceptor {
|
|
11
|
-
/**
|
|
12
|
-
* @returns {HAMessagingInterceptor}
|
|
13
|
-
*/
|
|
14
|
-
static create() {
|
|
15
|
-
// eslint-disable-next-line no-invalid-this
|
|
16
|
-
return new ServerErrorInterceptor({webex: this});
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* @see Interceptor#onResponseError
|
|
21
|
-
* @param {Object} options
|
|
22
|
-
* @param {Object} reason
|
|
23
|
-
* @returns {Object}
|
|
24
|
-
*/
|
|
25
|
-
onResponseError(options, reason) {
|
|
26
|
-
if (
|
|
27
|
-
(reason instanceof WebexHttpError.InternalServerError ||
|
|
28
|
-
reason instanceof WebexHttpError.BadGateway ||
|
|
29
|
-
reason instanceof WebexHttpError.ServiceUnavailable) &&
|
|
30
|
-
options.uri
|
|
31
|
-
) {
|
|
32
|
-
const feature = this.webex.internal.device.features.developer.get('web-high-availability');
|
|
33
|
-
|
|
34
|
-
if (feature && feature.value) {
|
|
35
|
-
this.webex.internal.metrics.submitClientMetrics('web-ha', {
|
|
36
|
-
fields: {success: false},
|
|
37
|
-
tags: {action: 'failed', error: reason.message, url: options.uri},
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
return Promise.resolve(this.webex.internal.services.markFailedUrl(options.uri)).then(() =>
|
|
41
|
-
Promise.reject(reason)
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return Promise.reject(reason);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|