@webex/webex-core 2.59.2 → 2.59.3-next.1
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/.eslintrc.js +6 -6
- package/README.md +79 -79
- package/babel.config.js +3 -3
- package/dist/config.js +24 -24
- package/dist/config.js.map +1 -1
- package/dist/credentials-config.js +56 -56
- package/dist/credentials-config.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/interceptors/auth.js +28 -28
- package/dist/interceptors/auth.js.map +1 -1
- package/dist/interceptors/default-options.js +24 -24
- package/dist/interceptors/default-options.js.map +1 -1
- package/dist/interceptors/embargo.js +9 -9
- package/dist/interceptors/embargo.js.map +1 -1
- package/dist/interceptors/network-timing.js +19 -19
- package/dist/interceptors/network-timing.js.map +1 -1
- package/dist/interceptors/payload-transformer.js +19 -19
- package/dist/interceptors/payload-transformer.js.map +1 -1
- package/dist/interceptors/rate-limit.js +40 -40
- package/dist/interceptors/rate-limit.js.map +1 -1
- package/dist/interceptors/redirect.js +13 -13
- package/dist/interceptors/redirect.js.map +1 -1
- package/dist/interceptors/request-event.js +23 -23
- package/dist/interceptors/request-event.js.map +1 -1
- package/dist/interceptors/request-logger.js +13 -13
- package/dist/interceptors/request-logger.js.map +1 -1
- package/dist/interceptors/request-timing.js +23 -23
- package/dist/interceptors/request-timing.js.map +1 -1
- package/dist/interceptors/response-logger.js +19 -19
- package/dist/interceptors/response-logger.js.map +1 -1
- package/dist/interceptors/user-agent.js +29 -29
- package/dist/interceptors/user-agent.js.map +1 -1
- package/dist/interceptors/webex-tracking-id.js +15 -15
- package/dist/interceptors/webex-tracking-id.js.map +1 -1
- package/dist/interceptors/webex-user-agent.js +13 -13
- package/dist/interceptors/webex-user-agent.js.map +1 -1
- package/dist/lib/batcher.js +83 -83
- package/dist/lib/batcher.js.map +1 -1
- package/dist/lib/credentials/credentials.js +103 -103
- package/dist/lib/credentials/credentials.js.map +1 -1
- package/dist/lib/credentials/grant-errors.js +17 -17
- package/dist/lib/credentials/grant-errors.js.map +1 -1
- package/dist/lib/credentials/index.js +2 -2
- package/dist/lib/credentials/index.js.map +1 -1
- package/dist/lib/credentials/scope.js +11 -11
- package/dist/lib/credentials/scope.js.map +1 -1
- package/dist/lib/credentials/token-collection.js +2 -2
- package/dist/lib/credentials/token-collection.js.map +1 -1
- package/dist/lib/credentials/token.js +145 -145
- package/dist/lib/credentials/token.js.map +1 -1
- package/dist/lib/page.js +49 -49
- package/dist/lib/page.js.map +1 -1
- package/dist/lib/services/constants.js.map +1 -1
- package/dist/lib/services/index.js +2 -2
- package/dist/lib/services/index.js.map +1 -1
- package/dist/lib/services/interceptors/server-error.js +9 -9
- package/dist/lib/services/interceptors/server-error.js.map +1 -1
- package/dist/lib/services/interceptors/service.js +24 -24
- package/dist/lib/services/interceptors/service.js.map +1 -1
- package/dist/lib/services/metrics.js.map +1 -1
- package/dist/lib/services/service-catalog.js +104 -104
- package/dist/lib/services/service-catalog.js.map +1 -1
- package/dist/lib/services/service-fed-ramp.js.map +1 -1
- package/dist/lib/services/service-host.js +134 -134
- package/dist/lib/services/service-host.js.map +1 -1
- package/dist/lib/services/service-registry.js +175 -175
- package/dist/lib/services/service-registry.js.map +1 -1
- package/dist/lib/services/service-state.js +38 -38
- package/dist/lib/services/service-state.js.map +1 -1
- package/dist/lib/services/service-url.js +31 -31
- package/dist/lib/services/service-url.js.map +1 -1
- package/dist/lib/services/services.js +245 -245
- package/dist/lib/services/services.js.map +1 -1
- package/dist/lib/stateless-webex-plugin.js +28 -28
- package/dist/lib/stateless-webex-plugin.js.map +1 -1
- package/dist/lib/storage/decorators.js +27 -27
- package/dist/lib/storage/decorators.js.map +1 -1
- package/dist/lib/storage/errors.js +4 -4
- package/dist/lib/storage/errors.js.map +1 -1
- package/dist/lib/storage/index.js.map +1 -1
- package/dist/lib/storage/make-webex-plugin-store.js +44 -44
- package/dist/lib/storage/make-webex-plugin-store.js.map +1 -1
- package/dist/lib/storage/make-webex-store.js +40 -40
- package/dist/lib/storage/make-webex-store.js.map +1 -1
- package/dist/lib/storage/memory-store-adapter.js +9 -9
- package/dist/lib/storage/memory-store-adapter.js.map +1 -1
- package/dist/lib/webex-core-plugin-mixin.js +13 -13
- package/dist/lib/webex-core-plugin-mixin.js.map +1 -1
- package/dist/lib/webex-http-error.js +9 -9
- package/dist/lib/webex-http-error.js.map +1 -1
- package/dist/lib/webex-internal-core-plugin-mixin.js +13 -13
- package/dist/lib/webex-internal-core-plugin-mixin.js.map +1 -1
- package/dist/lib/webex-plugin.js +36 -36
- package/dist/lib/webex-plugin.js.map +1 -1
- package/dist/plugins/logger.js +9 -9
- package/dist/plugins/logger.js.map +1 -1
- package/dist/webex-core.js +104 -104
- package/dist/webex-core.js.map +1 -1
- package/dist/webex-internal-core.js +12 -12
- package/dist/webex-internal-core.js.map +1 -1
- package/jest.config.js +3 -3
- package/package.json +20 -19
- package/process +1 -1
- package/src/config.js +90 -90
- package/src/credentials-config.js +212 -212
- package/src/index.js +62 -62
- package/src/interceptors/auth.js +186 -186
- package/src/interceptors/default-options.js +55 -55
- package/src/interceptors/embargo.js +43 -43
- package/src/interceptors/network-timing.js +54 -54
- package/src/interceptors/payload-transformer.js +55 -55
- package/src/interceptors/rate-limit.js +169 -169
- package/src/interceptors/redirect.js +106 -106
- package/src/interceptors/request-event.js +93 -93
- package/src/interceptors/request-logger.js +78 -78
- package/src/interceptors/request-timing.js +65 -65
- package/src/interceptors/response-logger.js +98 -98
- package/src/interceptors/user-agent.js +77 -77
- package/src/interceptors/webex-tracking-id.js +73 -73
- package/src/interceptors/webex-user-agent.js +79 -79
- package/src/lib/batcher.js +307 -307
- package/src/lib/credentials/credentials.js +552 -552
- package/src/lib/credentials/grant-errors.js +92 -92
- package/src/lib/credentials/index.js +16 -16
- package/src/lib/credentials/scope.js +34 -34
- package/src/lib/credentials/token-collection.js +17 -17
- package/src/lib/credentials/token.js +559 -559
- package/src/lib/page.js +159 -159
- package/src/lib/services/constants.js +9 -9
- package/src/lib/services/index.js +26 -26
- package/src/lib/services/interceptors/server-error.js +48 -48
- package/src/lib/services/interceptors/service.js +101 -101
- package/src/lib/services/metrics.js +4 -4
- package/src/lib/services/service-catalog.js +435 -435
- package/src/lib/services/service-fed-ramp.js +4 -4
- package/src/lib/services/service-host.js +267 -267
- package/src/lib/services/service-registry.js +465 -465
- package/src/lib/services/service-state.js +78 -78
- package/src/lib/services/service-url.js +124 -124
- package/src/lib/services/services.js +1018 -1018
- package/src/lib/stateless-webex-plugin.js +98 -98
- package/src/lib/storage/decorators.js +220 -220
- package/src/lib/storage/errors.js +15 -15
- package/src/lib/storage/index.js +10 -10
- package/src/lib/storage/make-webex-plugin-store.js +211 -211
- package/src/lib/storage/make-webex-store.js +140 -140
- package/src/lib/storage/memory-store-adapter.js +79 -79
- package/src/lib/webex-core-plugin-mixin.js +114 -114
- package/src/lib/webex-http-error.js +61 -61
- package/src/lib/webex-internal-core-plugin-mixin.js +107 -107
- package/src/lib/webex-plugin.js +222 -222
- package/src/plugins/logger.js +60 -60
- package/src/webex-core.js +745 -745
- package/src/webex-internal-core.js +46 -46
- package/test/integration/spec/credentials/credentials.js +139 -139
- package/test/integration/spec/credentials/token.js +102 -102
- package/test/integration/spec/services/service-catalog.js +838 -838
- package/test/integration/spec/services/services.js +1221 -1221
- package/test/integration/spec/webex-core.js +178 -178
- package/test/unit/spec/_setup.js +44 -44
- package/test/unit/spec/credentials/credentials.js +1017 -1017
- package/test/unit/spec/credentials/token.js +441 -441
- package/test/unit/spec/interceptors/auth.js +521 -521
- package/test/unit/spec/interceptors/default-options.js +84 -84
- package/test/unit/spec/interceptors/embargo.js +144 -144
- package/test/unit/spec/interceptors/network-timing.js +49 -49
- package/test/unit/spec/interceptors/payload-transformer.js +155 -155
- package/test/unit/spec/interceptors/rate-limit.js +302 -302
- package/test/unit/spec/interceptors/redirect.js +102 -102
- package/test/unit/spec/interceptors/request-timing.js +92 -92
- package/test/unit/spec/interceptors/user-agent.js +76 -76
- package/test/unit/spec/interceptors/webex-tracking-id.js +76 -76
- package/test/unit/spec/interceptors/webex-user-agent.js +159 -159
- package/test/unit/spec/lib/batcher.js +330 -330
- package/test/unit/spec/lib/page.js +148 -148
- package/test/unit/spec/lib/webex-plugin.js +48 -48
- package/test/unit/spec/services/interceptors/server-error.js +204 -204
- package/test/unit/spec/services/interceptors/service.js +188 -188
- package/test/unit/spec/services/service-catalog.js +194 -194
- package/test/unit/spec/services/service-host.js +260 -260
- package/test/unit/spec/services/service-registry.js +747 -747
- package/test/unit/spec/services/service-state.js +60 -60
- package/test/unit/spec/services/service-url.js +258 -258
- package/test/unit/spec/services/services.js +348 -348
- package/test/unit/spec/storage/persist.js +50 -50
- package/test/unit/spec/storage/storage-adapter.js +12 -12
- package/test/unit/spec/storage/wait-for-value.js +81 -81
- package/test/unit/spec/webex-core.js +253 -253
- package/test/unit/spec/webex-internal-core.js +91 -91
|
@@ -21,63 +21,63 @@ var _constants = require("./constants");
|
|
|
21
21
|
var _serviceHost = _interopRequireDefault(require("./service-host"));
|
|
22
22
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys2(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
23
23
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
24
|
-
/**
|
|
25
|
-
* The parameter transfer object for {@link ServiceRegistry#mapRemoteCatalog}.
|
|
26
|
-
* This object is shaped to match the object returned from the **U2C** service.
|
|
27
|
-
*
|
|
28
|
-
* @typedef {Record<string, string>} RSL
|
|
29
|
-
* @typedef {Record<string, Array<Record<string, number | string>>>} RHC
|
|
30
|
-
*
|
|
31
|
-
* @typedef {Object} MapRemoteCatalogPTO
|
|
32
|
-
* @property {string} MapRemoteCatalogPTO.catalog - Service catalog name.
|
|
33
|
-
* @property {RSL} MapRemoteCatalogPTO.serviceLinks - Service links.
|
|
34
|
-
* @property {RHC} MapRemoteCatalogPTO.hostCatalog - Service host catalog.
|
|
24
|
+
/**
|
|
25
|
+
* The parameter transfer object for {@link ServiceRegistry#mapRemoteCatalog}.
|
|
26
|
+
* This object is shaped to match the object returned from the **U2C** service.
|
|
27
|
+
*
|
|
28
|
+
* @typedef {Record<string, string>} RSL
|
|
29
|
+
* @typedef {Record<string, Array<Record<string, number | string>>>} RHC
|
|
30
|
+
*
|
|
31
|
+
* @typedef {Object} MapRemoteCatalogPTO
|
|
32
|
+
* @property {string} MapRemoteCatalogPTO.catalog - Service catalog name.
|
|
33
|
+
* @property {RSL} MapRemoteCatalogPTO.serviceLinks - Service links.
|
|
34
|
+
* @property {RHC} MapRemoteCatalogPTO.hostCatalog - Service host catalog.
|
|
35
35
|
*/
|
|
36
|
-
/**
|
|
37
|
-
* Service manipulation filter object for retrieving services within the
|
|
38
|
-
* {@link ServiceRegistry} class.
|
|
39
|
-
*
|
|
40
|
-
* @typedef {Object} HostFilter
|
|
41
|
-
* @property {boolean} [HostFilter.active] - Active state to filter.
|
|
42
|
-
* @property {Array<string> | string} [HostFilter.catalog] - Catalogs to filter.
|
|
43
|
-
* @property {Array<string> | string} [HostFilter.cluster] - Clusters to filter.
|
|
44
|
-
* @property {boolean} [HostFilter.local] - Filter to the user's home cluster.
|
|
45
|
-
* @property {boolean} [HostFilter.priority] - Filter for the highest priority.
|
|
46
|
-
* @property {Array<string> | string} [HostFilter.service] - Services to filter.
|
|
47
|
-
* @property {Array<string> | string} [HostFilter.url] - URL to filter.
|
|
36
|
+
/**
|
|
37
|
+
* Service manipulation filter object for retrieving services within the
|
|
38
|
+
* {@link ServiceRegistry} class.
|
|
39
|
+
*
|
|
40
|
+
* @typedef {Object} HostFilter
|
|
41
|
+
* @property {boolean} [HostFilter.active] - Active state to filter.
|
|
42
|
+
* @property {Array<string> | string} [HostFilter.catalog] - Catalogs to filter.
|
|
43
|
+
* @property {Array<string> | string} [HostFilter.cluster] - Clusters to filter.
|
|
44
|
+
* @property {boolean} [HostFilter.local] - Filter to the user's home cluster.
|
|
45
|
+
* @property {boolean} [HostFilter.priority] - Filter for the highest priority.
|
|
46
|
+
* @property {Array<string> | string} [HostFilter.service] - Services to filter.
|
|
47
|
+
* @property {Array<string> | string} [HostFilter.url] - URL to filter.
|
|
48
48
|
*/
|
|
49
|
-
/**
|
|
50
|
-
* @class
|
|
51
|
-
* @classdesc - Manages a collection of {@link ServiceHost} class objects.
|
|
49
|
+
/**
|
|
50
|
+
* @class
|
|
51
|
+
* @classdesc - Manages a collection of {@link ServiceHost} class objects.
|
|
52
52
|
*/
|
|
53
53
|
var ServiceRegistry = /*#__PURE__*/function () {
|
|
54
|
-
/**
|
|
55
|
-
* Generate a new {@link ServiceHost}.
|
|
56
|
-
*
|
|
57
|
-
* @public
|
|
58
|
-
* @constructor
|
|
59
|
-
* @memberof ServiceHost
|
|
54
|
+
/**
|
|
55
|
+
* Generate a new {@link ServiceHost}.
|
|
56
|
+
*
|
|
57
|
+
* @public
|
|
58
|
+
* @constructor
|
|
59
|
+
* @memberof ServiceHost
|
|
60
60
|
*/
|
|
61
61
|
function ServiceRegistry() {
|
|
62
62
|
(0, _classCallCheck2.default)(this, ServiceRegistry);
|
|
63
|
-
/**
|
|
64
|
-
* The collection of managed {@link ServiceHost}s.
|
|
65
|
-
*
|
|
66
|
-
* @instance
|
|
67
|
-
* @type {Array<ServiceHost>}
|
|
68
|
-
* @private
|
|
69
|
-
* @memberof ServiceRegistry
|
|
63
|
+
/**
|
|
64
|
+
* The collection of managed {@link ServiceHost}s.
|
|
65
|
+
*
|
|
66
|
+
* @instance
|
|
67
|
+
* @type {Array<ServiceHost>}
|
|
68
|
+
* @private
|
|
69
|
+
* @memberof ServiceRegistry
|
|
70
70
|
*/
|
|
71
71
|
this.hosts = [];
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
/**
|
|
75
|
-
* An active, local, and priority mapped record of the current
|
|
76
|
-
* {@link ServiceCatalog#hosts}.
|
|
77
|
-
*
|
|
78
|
-
* @public
|
|
79
|
-
* @memberof ServiceCatalog
|
|
80
|
-
* @type {Record<string, string>}
|
|
74
|
+
/**
|
|
75
|
+
* An active, local, and priority mapped record of the current
|
|
76
|
+
* {@link ServiceCatalog#hosts}.
|
|
77
|
+
*
|
|
78
|
+
* @public
|
|
79
|
+
* @memberof ServiceCatalog
|
|
80
|
+
* @type {Record<string, string>}
|
|
81
81
|
*/
|
|
82
82
|
(0, _createClass2.default)(ServiceRegistry, [{
|
|
83
83
|
key: "map",
|
|
@@ -99,15 +99,15 @@ var ServiceRegistry = /*#__PURE__*/function () {
|
|
|
99
99
|
}, {});
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
/**
|
|
103
|
-
* Removes a collection of {@link ServiceHost} class objects from the
|
|
104
|
-
* {@link ServiceRegistry#hosts} array based on the provided
|
|
105
|
-
* {@link HostFilter}.
|
|
106
|
-
*
|
|
107
|
-
* @public
|
|
108
|
-
* @memberof ServiceRegistry
|
|
109
|
-
* @param {HostFilter} filter - The inclusive filter for hosts to remove.
|
|
110
|
-
* @returns {Array<ServiceHost>} - The removed {@link ServiceHost}s.
|
|
102
|
+
/**
|
|
103
|
+
* Removes a collection of {@link ServiceHost} class objects from the
|
|
104
|
+
* {@link ServiceRegistry#hosts} array based on the provided
|
|
105
|
+
* {@link HostFilter}.
|
|
106
|
+
*
|
|
107
|
+
* @public
|
|
108
|
+
* @memberof ServiceRegistry
|
|
109
|
+
* @param {HostFilter} filter - The inclusive filter for hosts to remove.
|
|
110
|
+
* @returns {Array<ServiceHost>} - The removed {@link ServiceHost}s.
|
|
111
111
|
*/
|
|
112
112
|
}, {
|
|
113
113
|
key: "clear",
|
|
@@ -124,15 +124,15 @@ var ServiceRegistry = /*#__PURE__*/function () {
|
|
|
124
124
|
return removing;
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
/**
|
|
128
|
-
* Mark a collection of {@link ServiceHost} class objects from the
|
|
129
|
-
* {@link ServiceRegistry#hosts} array as failed based on the provided
|
|
130
|
-
* {@link HostFilter}.
|
|
131
|
-
*
|
|
132
|
-
* @public
|
|
133
|
-
* @memberof ServiceRegistry
|
|
134
|
-
* @param {HostFilter} filter - The inclusive filter for hosts to mark failed.
|
|
135
|
-
* @returns {Array<ServiceHost>} - The {@link ServiceHost}s marked failed.
|
|
127
|
+
/**
|
|
128
|
+
* Mark a collection of {@link ServiceHost} class objects from the
|
|
129
|
+
* {@link ServiceRegistry#hosts} array as failed based on the provided
|
|
130
|
+
* {@link HostFilter}.
|
|
131
|
+
*
|
|
132
|
+
* @public
|
|
133
|
+
* @memberof ServiceRegistry
|
|
134
|
+
* @param {HostFilter} filter - The inclusive filter for hosts to mark failed.
|
|
135
|
+
* @returns {Array<ServiceHost>} - The {@link ServiceHost}s marked failed.
|
|
136
136
|
*/
|
|
137
137
|
}, {
|
|
138
138
|
key: "failed",
|
|
@@ -151,13 +151,13 @@ var ServiceRegistry = /*#__PURE__*/function () {
|
|
|
151
151
|
return failing;
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
/**
|
|
155
|
-
* Filter the {@link ServiceRegistry#hosts} array against their active states.
|
|
156
|
-
*
|
|
157
|
-
* @private
|
|
158
|
-
* @memberof ServiceRegistry
|
|
159
|
-
* @param {boolean} [active] - Filter for the host state.
|
|
160
|
-
* @returns {Array<ServiceHost>} - The filtered host array.
|
|
154
|
+
/**
|
|
155
|
+
* Filter the {@link ServiceRegistry#hosts} array against their active states.
|
|
156
|
+
*
|
|
157
|
+
* @private
|
|
158
|
+
* @memberof ServiceRegistry
|
|
159
|
+
* @param {boolean} [active] - Filter for the host state.
|
|
160
|
+
* @returns {Array<ServiceHost>} - The filtered host array.
|
|
161
161
|
*/
|
|
162
162
|
}, {
|
|
163
163
|
key: "filterActive",
|
|
@@ -168,14 +168,14 @@ var ServiceRegistry = /*#__PURE__*/function () {
|
|
|
168
168
|
}) : (0, _toConsumableArray2.default)(this.hosts);
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
-
/**
|
|
172
|
-
* Filter the {@link ServiceRegistry#hosts} array against their assigned
|
|
173
|
-
* catalog values.
|
|
174
|
-
*
|
|
175
|
-
* @private
|
|
176
|
-
* @memberof ServiceRegistry
|
|
177
|
-
* @param {Array<string> | string} [catalog] - Catalogs to filter.
|
|
178
|
-
* @returns {Array<ServiceHost>} - The filtered host array.
|
|
171
|
+
/**
|
|
172
|
+
* Filter the {@link ServiceRegistry#hosts} array against their assigned
|
|
173
|
+
* catalog values.
|
|
174
|
+
*
|
|
175
|
+
* @private
|
|
176
|
+
* @memberof ServiceRegistry
|
|
177
|
+
* @param {Array<string> | string} [catalog] - Catalogs to filter.
|
|
178
|
+
* @returns {Array<ServiceHost>} - The filtered host array.
|
|
179
179
|
*/
|
|
180
180
|
}, {
|
|
181
181
|
key: "filterCatalog",
|
|
@@ -195,14 +195,14 @@ var ServiceRegistry = /*#__PURE__*/function () {
|
|
|
195
195
|
}) : (0, _toConsumableArray2.default)(this.hosts);
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
-
/**
|
|
199
|
-
* Filter the {@link ServiceRegistry#hosts} array against their assigned
|
|
200
|
-
* cluster values.
|
|
201
|
-
*
|
|
202
|
-
* @private
|
|
203
|
-
* @memberof ServiceRegistry
|
|
204
|
-
* @param {Array<string> | string} [cluster] - Clusters to filter for.
|
|
205
|
-
* @returns {Array<ServiceHost>} - The filtered host array.
|
|
198
|
+
/**
|
|
199
|
+
* Filter the {@link ServiceRegistry#hosts} array against their assigned
|
|
200
|
+
* cluster values.
|
|
201
|
+
*
|
|
202
|
+
* @private
|
|
203
|
+
* @memberof ServiceRegistry
|
|
204
|
+
* @param {Array<string> | string} [cluster] - Clusters to filter for.
|
|
205
|
+
* @returns {Array<ServiceHost>} - The filtered host array.
|
|
206
206
|
*/
|
|
207
207
|
}, {
|
|
208
208
|
key: "filterCluster",
|
|
@@ -217,14 +217,14 @@ var ServiceRegistry = /*#__PURE__*/function () {
|
|
|
217
217
|
}) : (0, _toConsumableArray2.default)(this.hosts);
|
|
218
218
|
}
|
|
219
219
|
|
|
220
|
-
/**
|
|
221
|
-
* Filter the {@link ServiceRegistry#hosts} array against their location in
|
|
222
|
-
* reference to the authenticated user.
|
|
223
|
-
*
|
|
224
|
-
* @private
|
|
225
|
-
* @memberof ServiceRegistry
|
|
226
|
-
* @param {boolean} [local] - Filter for the host location.
|
|
227
|
-
* @returns {Array<ServiceHost>} - The filtered host array.
|
|
220
|
+
/**
|
|
221
|
+
* Filter the {@link ServiceRegistry#hosts} array against their location in
|
|
222
|
+
* reference to the authenticated user.
|
|
223
|
+
*
|
|
224
|
+
* @private
|
|
225
|
+
* @memberof ServiceRegistry
|
|
226
|
+
* @param {boolean} [local] - Filter for the host location.
|
|
227
|
+
* @returns {Array<ServiceHost>} - The filtered host array.
|
|
228
228
|
*/
|
|
229
229
|
}, {
|
|
230
230
|
key: "filterLocal",
|
|
@@ -234,14 +234,14 @@ var ServiceRegistry = /*#__PURE__*/function () {
|
|
|
234
234
|
}) : (0, _toConsumableArray2.default)(this.hosts);
|
|
235
235
|
}
|
|
236
236
|
|
|
237
|
-
/**
|
|
238
|
-
* Filter the {@link ServiceRegistry#hosts} array for the highest priority
|
|
239
|
-
* hosts for each specific service.
|
|
240
|
-
*
|
|
241
|
-
* @private
|
|
242
|
-
* @memberof ServiceRegistry
|
|
243
|
-
* @param {boolean} [priority] - Filter for the highest priority
|
|
244
|
-
* @returns {Array<ServiceHost>} - The filtered host array.
|
|
237
|
+
/**
|
|
238
|
+
* Filter the {@link ServiceRegistry#hosts} array for the highest priority
|
|
239
|
+
* hosts for each specific service.
|
|
240
|
+
*
|
|
241
|
+
* @private
|
|
242
|
+
* @memberof ServiceRegistry
|
|
243
|
+
* @param {boolean} [priority] - Filter for the highest priority
|
|
244
|
+
* @returns {Array<ServiceHost>} - The filtered host array.
|
|
245
245
|
*/
|
|
246
246
|
}, {
|
|
247
247
|
key: "filterPriority",
|
|
@@ -286,14 +286,14 @@ var ServiceRegistry = /*#__PURE__*/function () {
|
|
|
286
286
|
}, []) : (0, _toConsumableArray2.default)(this.hosts);
|
|
287
287
|
}
|
|
288
288
|
|
|
289
|
-
/**
|
|
290
|
-
* Filter the {@link ServiceRegistry#hosts} array for hosts with a specified
|
|
291
|
-
* set of service names.
|
|
292
|
-
*
|
|
293
|
-
* @private
|
|
294
|
-
* @memberof ServiceRegistry
|
|
295
|
-
* @param {Array<string> | string} [service] - Services to filter.
|
|
296
|
-
* @returns {Array<ServiceHost>} - The filtered host array.
|
|
289
|
+
/**
|
|
290
|
+
* Filter the {@link ServiceRegistry#hosts} array for hosts with a specified
|
|
291
|
+
* set of service names.
|
|
292
|
+
*
|
|
293
|
+
* @private
|
|
294
|
+
* @memberof ServiceRegistry
|
|
295
|
+
* @param {Array<string> | string} [service] - Services to filter.
|
|
296
|
+
* @returns {Array<ServiceHost>} - The filtered host array.
|
|
297
297
|
*/
|
|
298
298
|
}, {
|
|
299
299
|
key: "filterService",
|
|
@@ -308,14 +308,14 @@ var ServiceRegistry = /*#__PURE__*/function () {
|
|
|
308
308
|
}) : (0, _toConsumableArray2.default)(this.hosts);
|
|
309
309
|
}
|
|
310
310
|
|
|
311
|
-
/**
|
|
312
|
-
* Filter the {@link ServiceRegistry#hosts} array for hosts with a specified
|
|
313
|
-
* set of URLs.
|
|
314
|
-
*
|
|
315
|
-
* @private
|
|
316
|
-
* @memberof ServiceRegistry
|
|
317
|
-
* @param {Array<string> | string} [url] - URL to filter.
|
|
318
|
-
* @returns {Array<ServiceHost>} - The filter host array.
|
|
311
|
+
/**
|
|
312
|
+
* Filter the {@link ServiceRegistry#hosts} array for hosts with a specified
|
|
313
|
+
* set of URLs.
|
|
314
|
+
*
|
|
315
|
+
* @private
|
|
316
|
+
* @memberof ServiceRegistry
|
|
317
|
+
* @param {Array<string> | string} [url] - URL to filter.
|
|
318
|
+
* @returns {Array<ServiceHost>} - The filter host array.
|
|
319
319
|
*/
|
|
320
320
|
}, {
|
|
321
321
|
key: "filterUrl",
|
|
@@ -330,14 +330,14 @@ var ServiceRegistry = /*#__PURE__*/function () {
|
|
|
330
330
|
}) : (0, _toConsumableArray2.default)(this.hosts);
|
|
331
331
|
}
|
|
332
332
|
|
|
333
|
-
/**
|
|
334
|
-
* Get an array of {@link ServiceHost}s based on a provided
|
|
335
|
-
* {@link HostFilter} from the {@link ServiceRegistry#hosts} array.
|
|
336
|
-
*
|
|
337
|
-
* @public
|
|
338
|
-
* @memberof ServiceRegistry
|
|
339
|
-
* @param {HostFilter} [filter] - The inclusive filter for hosts to find.
|
|
340
|
-
* @returns {Array<ServiceHost>} - The filtered hosts.
|
|
333
|
+
/**
|
|
334
|
+
* Get an array of {@link ServiceHost}s based on a provided
|
|
335
|
+
* {@link HostFilter} from the {@link ServiceRegistry#hosts} array.
|
|
336
|
+
*
|
|
337
|
+
* @public
|
|
338
|
+
* @memberof ServiceRegistry
|
|
339
|
+
* @param {HostFilter} [filter] - The inclusive filter for hosts to find.
|
|
340
|
+
* @returns {Array<ServiceHost>} - The filtered hosts.
|
|
341
341
|
*/
|
|
342
342
|
}, {
|
|
343
343
|
key: "find",
|
|
@@ -356,15 +356,15 @@ var ServiceRegistry = /*#__PURE__*/function () {
|
|
|
356
356
|
});
|
|
357
357
|
}
|
|
358
358
|
|
|
359
|
-
/**
|
|
360
|
-
* Load a formatted array of {@link ServiceHost} constructor parameter
|
|
361
|
-
* transfer objects as instances of {@link ServiceHost} class objects to the
|
|
362
|
-
* {@link ServiceRegistry#hosts} array.
|
|
363
|
-
*
|
|
364
|
-
* @public
|
|
365
|
-
* @memberof ServiceRegistry
|
|
366
|
-
* @param {Array<ServiceHost.ConstructorPTO>} hosts
|
|
367
|
-
* @returns {this}
|
|
359
|
+
/**
|
|
360
|
+
* Load a formatted array of {@link ServiceHost} constructor parameter
|
|
361
|
+
* transfer objects as instances of {@link ServiceHost} class objects to the
|
|
362
|
+
* {@link ServiceRegistry#hosts} array.
|
|
363
|
+
*
|
|
364
|
+
* @public
|
|
365
|
+
* @memberof ServiceRegistry
|
|
366
|
+
* @param {Array<ServiceHost.ConstructorPTO>} hosts
|
|
367
|
+
* @returns {this}
|
|
368
368
|
*/
|
|
369
369
|
}, {
|
|
370
370
|
key: "load",
|
|
@@ -386,15 +386,15 @@ var ServiceRegistry = /*#__PURE__*/function () {
|
|
|
386
386
|
return this;
|
|
387
387
|
}
|
|
388
388
|
|
|
389
|
-
/**
|
|
390
|
-
* Mark a collection of {@link ServiceHost} class objects from the
|
|
391
|
-
* {@link ServiceRegistry#hosts} array as replaced based on the provided
|
|
392
|
-
* {@link HostFilter}.
|
|
393
|
-
*
|
|
394
|
-
* @public
|
|
395
|
-
* @memberof ServiceRegistry
|
|
396
|
-
* @param {HostFilter} filter - The inclusive filter to mark replaced.
|
|
397
|
-
* @returns {Array<ServiceHost>} - The {@link ServiceHost}s marked replaced.
|
|
389
|
+
/**
|
|
390
|
+
* Mark a collection of {@link ServiceHost} class objects from the
|
|
391
|
+
* {@link ServiceRegistry#hosts} array as replaced based on the provided
|
|
392
|
+
* {@link HostFilter}.
|
|
393
|
+
*
|
|
394
|
+
* @public
|
|
395
|
+
* @memberof ServiceRegistry
|
|
396
|
+
* @param {HostFilter} filter - The inclusive filter to mark replaced.
|
|
397
|
+
* @returns {Array<ServiceHost>} - The {@link ServiceHost}s marked replaced.
|
|
398
398
|
*/
|
|
399
399
|
}, {
|
|
400
400
|
key: "replaced",
|
|
@@ -413,15 +413,15 @@ var ServiceRegistry = /*#__PURE__*/function () {
|
|
|
413
413
|
return replacing;
|
|
414
414
|
}
|
|
415
415
|
|
|
416
|
-
/**
|
|
417
|
-
* Reset the failed status of a collection of {@link ServiceHost} class
|
|
418
|
-
* objects from the {@link ServiceRegistry#hosts} array based on the provided
|
|
419
|
-
* {@link HostFilter}.
|
|
420
|
-
*
|
|
421
|
-
* @public
|
|
422
|
-
* @memberof ServiceRegistry
|
|
423
|
-
* @param {HostFilter} filter - The inclusive filter of hosts to reset.
|
|
424
|
-
* @returns {Array<ServiceHost>} - The {@link ServiceHost}s that reset.
|
|
416
|
+
/**
|
|
417
|
+
* Reset the failed status of a collection of {@link ServiceHost} class
|
|
418
|
+
* objects from the {@link ServiceRegistry#hosts} array based on the provided
|
|
419
|
+
* {@link HostFilter}.
|
|
420
|
+
*
|
|
421
|
+
* @public
|
|
422
|
+
* @memberof ServiceRegistry
|
|
423
|
+
* @param {HostFilter} filter - The inclusive filter of hosts to reset.
|
|
424
|
+
* @returns {Array<ServiceHost>} - The {@link ServiceHost}s that reset.
|
|
425
425
|
*/
|
|
426
426
|
}, {
|
|
427
427
|
key: "reset",
|
|
@@ -440,17 +440,17 @@ var ServiceRegistry = /*#__PURE__*/function () {
|
|
|
440
440
|
return resetting;
|
|
441
441
|
}
|
|
442
442
|
|
|
443
|
-
/**
|
|
444
|
-
* Convert a {@link SERVICE_CATALOGS} identifier or value to its associated
|
|
445
|
-
* idenfier or value.
|
|
446
|
-
*
|
|
447
|
-
* @public
|
|
448
|
-
* @static
|
|
449
|
-
* @memberof ServiceRegistry
|
|
450
|
-
* @param {Object} pto - The parameter transfer object.
|
|
451
|
-
* @property {string | number} pto.id - The identifier to convert in the enum.
|
|
452
|
-
* @property {SERVICE_CATALOGS_ENUM_TYPES} pto.type - The desired output.
|
|
453
|
-
* @returns {string|number} - The matching enum value or index.
|
|
443
|
+
/**
|
|
444
|
+
* Convert a {@link SERVICE_CATALOGS} identifier or value to its associated
|
|
445
|
+
* idenfier or value.
|
|
446
|
+
*
|
|
447
|
+
* @public
|
|
448
|
+
* @static
|
|
449
|
+
* @memberof ServiceRegistry
|
|
450
|
+
* @param {Object} pto - The parameter transfer object.
|
|
451
|
+
* @property {string | number} pto.id - The identifier to convert in the enum.
|
|
452
|
+
* @property {SERVICE_CATALOGS_ENUM_TYPES} pto.type - The desired output.
|
|
453
|
+
* @returns {string|number} - The matching enum value or index.
|
|
454
454
|
*/
|
|
455
455
|
}], [{
|
|
456
456
|
key: "mapCatalogName",
|
|
@@ -485,16 +485,16 @@ var ServiceRegistry = /*#__PURE__*/function () {
|
|
|
485
485
|
return undefined;
|
|
486
486
|
}
|
|
487
487
|
|
|
488
|
-
/**
|
|
489
|
-
* Generate a formatted array based on the object received from the **U2C**
|
|
490
|
-
* service for usage in the {@link ServiceRegistry#load} method.
|
|
491
|
-
*
|
|
492
|
-
* @public
|
|
493
|
-
* @static
|
|
494
|
-
* @memberof ServiceRegistry
|
|
495
|
-
* @param {MapRemoteCatalogPTO} pto - The parameter transfer object.
|
|
496
|
-
* @throws - If the target catalog does not exist.
|
|
497
|
-
* @returns {Array<ServiceHost#ServiceHostConstructorPTO>}
|
|
488
|
+
/**
|
|
489
|
+
* Generate a formatted array based on the object received from the **U2C**
|
|
490
|
+
* service for usage in the {@link ServiceRegistry#load} method.
|
|
491
|
+
*
|
|
492
|
+
* @public
|
|
493
|
+
* @static
|
|
494
|
+
* @memberof ServiceRegistry
|
|
495
|
+
* @param {MapRemoteCatalogPTO} pto - The parameter transfer object.
|
|
496
|
+
* @throws - If the target catalog does not exist.
|
|
497
|
+
* @returns {Array<ServiceHost#ServiceHostConstructorPTO>}
|
|
498
498
|
*/
|
|
499
499
|
}, {
|
|
500
500
|
key: "mapRemoteCatalog",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_constants","require","_serviceHost","_interopRequireDefault","ownKeys","object","enumerableOnly","keys","_Object$keys2","_Object$getOwnPropertySymbols","symbols","filter","sym","_Object$getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","Object","forEach","key","_defineProperty2","default","_Object$getOwnPropertyDescriptors","_Object$defineProperties","_Object$defineProperty","ServiceRegistry","_classCallCheck2","hosts","_createClass2","get","find","active","local","priority","reduce","map","host","hostReference","service","url","value","clear","removing","includes","failed","failing","setStatus","filterActive","_toConsumableArray2","filterCatalog","catalog","undefined","catalogs","_isArray","catalogId","mapCatalogName","id","type","SERVICE_CATALOGS_ENUM_TYPES","STRING","filterCluster","cluster","clusters","filterLocal","filterPriority","filteredHosts","currentHost","foundHost","hostGroup","foundHostCatalogPriority","NUMBER","currentHostCatalogPriority","splice","indexOf","filterService","services","filterUrl","urls","_this","_ref","load","_this$hosts","validHosts","loadableHost","ServiceHost","replaced","replacing","reset","resetting","_ref2","SERVICE_CATALOGS","mapRemoteCatalog","_ref3","hostCatalog","serviceLinks","catalogIndex","Error","concat","_keys","output","defaultUri","split","uri","exports"],"sources":["service-registry.js"],"sourcesContent":["import {SERVICE_CATALOGS, SERVICE_CATALOGS_ENUM_TYPES} from './constants';\nimport ServiceHost from './service-host';\n\n/**\n * The parameter transfer object for {@link ServiceRegistry#mapRemoteCatalog}.\n * This object is shaped to match the object returned from the **U2C** service.\n *\n * @typedef {Record<string, string>} RSL\n * @typedef {Record<string, Array<Record<string, number | string>>>} RHC\n *\n * @typedef {Object} MapRemoteCatalogPTO\n * @property {string} MapRemoteCatalogPTO.catalog - Service catalog name.\n * @property {RSL} MapRemoteCatalogPTO.serviceLinks - Service links.\n * @property {RHC} MapRemoteCatalogPTO.hostCatalog - Service host catalog.\n */\n\n/**\n * Service manipulation filter object for retrieving services within the\n * {@link ServiceRegistry} class.\n *\n * @typedef {Object} HostFilter\n * @property {boolean} [HostFilter.active] - Active state to filter.\n * @property {Array<string> | string} [HostFilter.catalog] - Catalogs to filter.\n * @property {Array<string> | string} [HostFilter.cluster] - Clusters to filter.\n * @property {boolean} [HostFilter.local] - Filter to the user's home cluster.\n * @property {boolean} [HostFilter.priority] - Filter for the highest priority.\n * @property {Array<string> | string} [HostFilter.service] - Services to filter.\n * @property {Array<string> | string} [HostFilter.url] - URL to filter.\n */\n\n/**\n * @class\n * @classdesc - Manages a collection of {@link ServiceHost} class objects.\n */\nexport default class ServiceRegistry {\n /**\n * Generate a new {@link ServiceHost}.\n *\n * @public\n * @constructor\n * @memberof ServiceHost\n */\n constructor() {\n /**\n * The collection of managed {@link ServiceHost}s.\n *\n * @instance\n * @type {Array<ServiceHost>}\n * @private\n * @memberof ServiceRegistry\n */\n this.hosts = [];\n }\n\n /**\n * An active, local, and priority mapped record of the current\n * {@link ServiceCatalog#hosts}.\n *\n * @public\n * @memberof ServiceCatalog\n * @type {Record<string, string>}\n */\n get map() {\n // Get a list of active, local, and priority-mapped hosts.\n return this.find({\n active: true,\n local: true,\n priority: true,\n }).reduce((map, host) => {\n // Generate a new object to assign the existing map.\n const hostReference = {};\n\n // Assign the key:value pair for the service and url.\n hostReference[host.service] = host.url;\n\n // Assign the reference to the map and return.\n return {...map, ...hostReference};\n }, {});\n }\n\n /**\n * Removes a collection of {@link ServiceHost} class objects from the\n * {@link ServiceRegistry#hosts} array based on the provided\n * {@link HostFilter}.\n *\n * @public\n * @memberof ServiceRegistry\n * @param {HostFilter} filter - The inclusive filter for hosts to remove.\n * @returns {Array<ServiceHost>} - The removed {@link ServiceHost}s.\n */\n clear(filter) {\n // Collect a list of hosts to remove based on the provided filter.\n const removing = this.find(filter);\n\n // Remove the hosts from the array.\n this.hosts = this.hosts.filter((host) => !removing.includes(host));\n\n // Return the removed hosts.\n return removing;\n }\n\n /**\n * Mark a collection of {@link ServiceHost} class objects from the\n * {@link ServiceRegistry#hosts} array as failed based on the provided\n * {@link HostFilter}.\n *\n * @public\n * @memberof ServiceRegistry\n * @param {HostFilter} filter - The inclusive filter for hosts to mark failed.\n * @returns {Array<ServiceHost>} - The {@link ServiceHost}s marked failed.\n */\n failed(filter) {\n // Collect a list of hosts to mark as failed based on the provided filter.\n const failing = this.find(filter);\n\n // Mark the hosts from the array as failed.\n failing.forEach((host) => {\n host.setStatus({failed: true});\n });\n\n // Return the marked hosts.\n return failing;\n }\n\n /**\n * Filter the {@link ServiceRegistry#hosts} array against their active states.\n *\n * @private\n * @memberof ServiceRegistry\n * @param {boolean} [active] - Filter for the host state.\n * @returns {Array<ServiceHost>} - The filtered host array.\n */\n filterActive(active) {\n // Filter the host array if the active requirement is true.\n return typeof active === 'boolean'\n ? this.hosts.filter((host) => host.active === active)\n : [...this.hosts];\n }\n\n /**\n * Filter the {@link ServiceRegistry#hosts} array against their assigned\n * catalog values.\n *\n * @private\n * @memberof ServiceRegistry\n * @param {Array<string> | string} [catalog] - Catalogs to filter.\n * @returns {Array<ServiceHost>} - The filtered host array.\n */\n filterCatalog(catalog = []) {\n // Generate a catalog names array based on the provided catalog param.\n const catalogs = (Array.isArray(catalog) ? catalog : [catalog]).map(\n (catalogId) =>\n ServiceRegistry.mapCatalogName({\n id: catalogId,\n type: SERVICE_CATALOGS_ENUM_TYPES.STRING,\n }) || catalogId\n );\n\n // Filter the host array against the catalog names array.\n return catalogs.length > 0\n ? this.hosts.filter((host) => catalogs.includes(host.catalog))\n : [...this.hosts];\n }\n\n /**\n * Filter the {@link ServiceRegistry#hosts} array against their assigned\n * cluster values.\n *\n * @private\n * @memberof ServiceRegistry\n * @param {Array<string> | string} [cluster] - Clusters to filter for.\n * @returns {Array<ServiceHost>} - The filtered host array.\n */\n filterCluster(cluster = []) {\n // Generate an array of clusters regardless of parameter type.\n const clusters = Array.isArray(cluster) ? cluster : [cluster];\n\n // Filter the host array against the provided clusters.\n return clusters.length > 0\n ? this.hosts.filter((host) => clusters.includes(host.id))\n : [...this.hosts];\n }\n\n /**\n * Filter the {@link ServiceRegistry#hosts} array against their location in\n * reference to the authenticated user.\n *\n * @private\n * @memberof ServiceRegistry\n * @param {boolean} [local] - Filter for the host location.\n * @returns {Array<ServiceHost>} - The filtered host array.\n */\n filterLocal(local) {\n return typeof local === 'boolean'\n ? this.hosts.filter((host) => host.local === local)\n : [...this.hosts];\n }\n\n /**\n * Filter the {@link ServiceRegistry#hosts} array for the highest priority\n * hosts for each specific service.\n *\n * @private\n * @memberof ServiceRegistry\n * @param {boolean} [priority] - Filter for the highest priority\n * @returns {Array<ServiceHost>} - The filtered host array.\n */\n filterPriority(priority) {\n return priority\n ? this.hosts.reduce((filteredHosts, currentHost) => {\n // Validate that the current host is not active.\n if (!currentHost.active) {\n return filteredHosts;\n }\n\n // Determine if the filtered hosts array contains a host from the same\n // host group.\n const foundHost = filteredHosts.find((host) => host.hostGroup === currentHost.hostGroup);\n\n // Validate if a host was found.\n if (!foundHost) {\n filteredHosts.push(currentHost);\n\n return filteredHosts;\n }\n\n // Map the found host's catalog to its priority value.\n const foundHostCatalogPriority = ServiceRegistry.mapCatalogName({\n id: foundHost.catalog,\n type: SERVICE_CATALOGS_ENUM_TYPES.NUMBER,\n });\n\n // Map the current host's catalog to its priority value.\n const currentHostCatalogPriority = ServiceRegistry.mapCatalogName({\n id: currentHost.catalog,\n type: SERVICE_CATALOGS_ENUM_TYPES.NUMBER,\n });\n\n // Validate if the found host has a lower priority than the current\n // host.\n if (\n foundHostCatalogPriority < currentHostCatalogPriority ||\n foundHost.priority < currentHost.priority\n ) {\n filteredHosts.splice(filteredHosts.indexOf(foundHost, 1));\n filteredHosts.push(currentHost);\n }\n\n return filteredHosts;\n }, [])\n : [...this.hosts];\n }\n\n /**\n * Filter the {@link ServiceRegistry#hosts} array for hosts with a specified\n * set of service names.\n *\n * @private\n * @memberof ServiceRegistry\n * @param {Array<string> | string} [service] - Services to filter.\n * @returns {Array<ServiceHost>} - The filtered host array.\n */\n filterService(service = []) {\n // Generate an array of services regardless of parameter type.\n const services = Array.isArray(service) ? service : [service];\n\n // Filter the host array against the provided services.\n return services.length > 0\n ? this.hosts.filter((host) => services.includes(host.service))\n : [...this.hosts];\n }\n\n /**\n * Filter the {@link ServiceRegistry#hosts} array for hosts with a specified\n * set of URLs.\n *\n * @private\n * @memberof ServiceRegistry\n * @param {Array<string> | string} [url] - URL to filter.\n * @returns {Array<ServiceHost>} - The filter host array.\n */\n filterUrl(url = []) {\n // Generate an array of URLs regardless of the parameter type.\n const urls = Array.isArray(url) ? url : [url];\n\n // Filter the host array against the provided URLs.\n return urls.length > 0 ? this.hosts.filter((host) => urls.includes(host.url)) : [...this.hosts];\n }\n\n /**\n * Get an array of {@link ServiceHost}s based on a provided\n * {@link HostFilter} from the {@link ServiceRegistry#hosts} array.\n *\n * @public\n * @memberof ServiceRegistry\n * @param {HostFilter} [filter] - The inclusive filter for hosts to find.\n * @returns {Array<ServiceHost>} - The filtered hosts.\n */\n find({active, catalog, cluster, local, priority, service, url} = {}) {\n return this.hosts.filter(\n (host) =>\n this.filterActive(active).includes(host) &&\n this.filterCatalog(catalog).includes(host) &&\n this.filterCluster(cluster).includes(host) &&\n this.filterLocal(local).includes(host) &&\n this.filterPriority(priority).includes(host) &&\n this.filterService(service).includes(host) &&\n this.filterUrl(url).includes(host)\n );\n }\n\n /**\n * Load a formatted array of {@link ServiceHost} constructor parameter\n * transfer objects as instances of {@link ServiceHost} class objects to the\n * {@link ServiceRegistry#hosts} array.\n *\n * @public\n * @memberof ServiceRegistry\n * @param {Array<ServiceHost.ConstructorPTO>} hosts\n * @returns {this}\n */\n load(hosts = []) {\n // Validate that the provided hosts are eligible to be loaded.\n const validHosts = hosts.filter(\n (host) =>\n !!ServiceRegistry.mapCatalogName({\n id: host.catalog,\n type: SERVICE_CATALOGS_ENUM_TYPES.STRING,\n })\n );\n\n // Load the eligible hosts.\n this.hosts.push(...validHosts.map((loadableHost) => new ServiceHost(loadableHost)));\n\n return this;\n }\n\n /**\n * Mark a collection of {@link ServiceHost} class objects from the\n * {@link ServiceRegistry#hosts} array as replaced based on the provided\n * {@link HostFilter}.\n *\n * @public\n * @memberof ServiceRegistry\n * @param {HostFilter} filter - The inclusive filter to mark replaced.\n * @returns {Array<ServiceHost>} - The {@link ServiceHost}s marked replaced.\n */\n replaced(filter) {\n // Collect a list of hosts to mark as replaced based on the provided filter.\n const replacing = this.find(filter);\n\n // Mark the hosts from the array as replaced.\n replacing.forEach((host) => {\n host.setStatus({replaced: true});\n });\n\n // Return the marked hosts.\n return replacing;\n }\n\n /**\n * Reset the failed status of a collection of {@link ServiceHost} class\n * objects from the {@link ServiceRegistry#hosts} array based on the provided\n * {@link HostFilter}.\n *\n * @public\n * @memberof ServiceRegistry\n * @param {HostFilter} filter - The inclusive filter of hosts to reset.\n * @returns {Array<ServiceHost>} - The {@link ServiceHost}s that reset.\n */\n reset(filter) {\n // Collect a list of hosts to mark as replaced based on the provided filter.\n const resetting = this.find(filter);\n\n // Mark the hosts from the array as replaced.\n resetting.forEach((host) => {\n host.setStatus({failed: false});\n });\n\n // Return the marked hosts.\n return resetting;\n }\n\n /**\n * Convert a {@link SERVICE_CATALOGS} identifier or value to its associated\n * idenfier or value.\n *\n * @public\n * @static\n * @memberof ServiceRegistry\n * @param {Object} pto - The parameter transfer object.\n * @property {string | number} pto.id - The identifier to convert in the enum.\n * @property {SERVICE_CATALOGS_ENUM_TYPES} pto.type - The desired output.\n * @returns {string|number} - The matching enum value or index.\n */\n static mapCatalogName({id, type}) {\n // Validate that the id is a number.\n if (typeof id === 'number') {\n // Validate that the desired type is a number.\n if (type === SERVICE_CATALOGS_ENUM_TYPES.NUMBER) {\n return SERVICE_CATALOGS[id] !== undefined ? id : undefined;\n }\n\n // Validate that the desired type is a string.\n if (type === SERVICE_CATALOGS_ENUM_TYPES.STRING) {\n return SERVICE_CATALOGS[id];\n }\n }\n\n // Validate that the id is a string.\n if (typeof id === 'string') {\n // Validate that the desired type is a string.\n if (type === SERVICE_CATALOGS_ENUM_TYPES.STRING) {\n return SERVICE_CATALOGS.includes(id) ? id : undefined;\n }\n\n // Validate that the desired type is a number.\n if (type === SERVICE_CATALOGS_ENUM_TYPES.NUMBER) {\n return SERVICE_CATALOGS.includes(id) ? SERVICE_CATALOGS.indexOf(id) : undefined;\n }\n }\n\n return undefined;\n }\n\n /**\n * Generate a formatted array based on the object received from the **U2C**\n * service for usage in the {@link ServiceRegistry#load} method.\n *\n * @public\n * @static\n * @memberof ServiceRegistry\n * @param {MapRemoteCatalogPTO} pto - The parameter transfer object.\n * @throws - If the target catalog does not exist.\n * @returns {Array<ServiceHost#ServiceHostConstructorPTO>}\n */\n static mapRemoteCatalog({catalog, hostCatalog, serviceLinks}) {\n // Collect the service catalog name if needed.\n const catalogIndex = ServiceRegistry.mapCatalogName({\n id: catalog,\n type: SERVICE_CATALOGS_ENUM_TYPES.STRING,\n });\n\n // Validate that the target catalog exists.\n if (!SERVICE_CATALOGS.includes(catalogIndex)) {\n throw new Error(`service-catalogs: '${catalog}' is not a valid catalog`);\n }\n\n // Map the remote catalog to a mountable host array.\n return Object.keys(hostCatalog).reduce((output, key) => {\n output.push(\n ...hostCatalog[key].map((host) => ({\n catalog: catalogIndex,\n defaultUri: serviceLinks[host.id.split(':')[3]],\n hostGroup: key,\n id: host.id,\n priority: host.priority,\n uri: host.host,\n }))\n );\n\n return output;\n }, []);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAyC,SAAAG,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,aAAA,CAAAH,MAAA,OAAAI,6BAAA,QAAAC,OAAA,GAAAD,6BAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,WAAAC,gCAAA,CAAAR,MAAA,EAAAO,GAAA,EAAAE,UAAA,OAAAP,IAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,IAAA,EAAAG,OAAA,YAAAH,IAAA;AAAA,SAAAU,cAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,WAAAF,SAAA,CAAAD,CAAA,IAAAC,SAAA,CAAAD,CAAA,QAAAA,CA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CAAC,EACJ;QAED,OAAO+D,MAAM;MACf,CAAC,EAAE,EAAE,CAAC;IACR;EAAC;EAAA,OAAA1E,eAAA;AAAA;AAAA8E,OAAA,CAAAlF,OAAA,GAAAI,eAAA"}
|
|
1
|
+
{"version":3,"names":["_constants","require","_serviceHost","_interopRequireDefault","ownKeys","object","enumerableOnly","keys","_Object$keys2","_Object$getOwnPropertySymbols","symbols","filter","sym","_Object$getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","Object","forEach","key","_defineProperty2","default","_Object$getOwnPropertyDescriptors","_Object$defineProperties","_Object$defineProperty","ServiceRegistry","_classCallCheck2","hosts","_createClass2","get","find","active","local","priority","reduce","map","host","hostReference","service","url","value","clear","removing","includes","failed","failing","setStatus","filterActive","_toConsumableArray2","filterCatalog","catalog","undefined","catalogs","_isArray","catalogId","mapCatalogName","id","type","SERVICE_CATALOGS_ENUM_TYPES","STRING","filterCluster","cluster","clusters","filterLocal","filterPriority","filteredHosts","currentHost","foundHost","hostGroup","foundHostCatalogPriority","NUMBER","currentHostCatalogPriority","splice","indexOf","filterService","services","filterUrl","urls","_this","_ref","load","_this$hosts","validHosts","loadableHost","ServiceHost","replaced","replacing","reset","resetting","_ref2","SERVICE_CATALOGS","mapRemoteCatalog","_ref3","hostCatalog","serviceLinks","catalogIndex","Error","concat","_keys","output","defaultUri","split","uri","exports"],"sources":["service-registry.js"],"sourcesContent":["import {SERVICE_CATALOGS, SERVICE_CATALOGS_ENUM_TYPES} from './constants';\r\nimport ServiceHost from './service-host';\r\n\r\n/**\r\n * The parameter transfer object for {@link ServiceRegistry#mapRemoteCatalog}.\r\n * This object is shaped to match the object returned from the **U2C** service.\r\n *\r\n * @typedef {Record<string, string>} RSL\r\n * @typedef {Record<string, Array<Record<string, number | string>>>} RHC\r\n *\r\n * @typedef {Object} MapRemoteCatalogPTO\r\n * @property {string} MapRemoteCatalogPTO.catalog - Service catalog name.\r\n * @property {RSL} MapRemoteCatalogPTO.serviceLinks - Service links.\r\n * @property {RHC} MapRemoteCatalogPTO.hostCatalog - Service host catalog.\r\n */\r\n\r\n/**\r\n * Service manipulation filter object for retrieving services within the\r\n * {@link ServiceRegistry} class.\r\n *\r\n * @typedef {Object} HostFilter\r\n * @property {boolean} [HostFilter.active] - Active state to filter.\r\n * @property {Array<string> | string} [HostFilter.catalog] - Catalogs to filter.\r\n * @property {Array<string> | string} [HostFilter.cluster] - Clusters to filter.\r\n * @property {boolean} [HostFilter.local] - Filter to the user's home cluster.\r\n * @property {boolean} [HostFilter.priority] - Filter for the highest priority.\r\n * @property {Array<string> | string} [HostFilter.service] - Services to filter.\r\n * @property {Array<string> | string} [HostFilter.url] - URL to filter.\r\n */\r\n\r\n/**\r\n * @class\r\n * @classdesc - Manages a collection of {@link ServiceHost} class objects.\r\n */\r\nexport default class ServiceRegistry {\r\n /**\r\n * Generate a new {@link ServiceHost}.\r\n *\r\n * @public\r\n * @constructor\r\n * @memberof ServiceHost\r\n */\r\n constructor() {\r\n /**\r\n * The collection of managed {@link ServiceHost}s.\r\n *\r\n * @instance\r\n * @type {Array<ServiceHost>}\r\n * @private\r\n * @memberof ServiceRegistry\r\n */\r\n this.hosts = [];\r\n }\r\n\r\n /**\r\n * An active, local, and priority mapped record of the current\r\n * {@link ServiceCatalog#hosts}.\r\n *\r\n * @public\r\n * @memberof ServiceCatalog\r\n * @type {Record<string, string>}\r\n */\r\n get map() {\r\n // Get a list of active, local, and priority-mapped hosts.\r\n return this.find({\r\n active: true,\r\n local: true,\r\n priority: true,\r\n }).reduce((map, host) => {\r\n // Generate a new object to assign the existing map.\r\n const hostReference = {};\r\n\r\n // Assign the key:value pair for the service and url.\r\n hostReference[host.service] = host.url;\r\n\r\n // Assign the reference to the map and return.\r\n return {...map, ...hostReference};\r\n }, {});\r\n }\r\n\r\n /**\r\n * Removes a collection of {@link ServiceHost} class objects from the\r\n * {@link ServiceRegistry#hosts} array based on the provided\r\n * {@link HostFilter}.\r\n *\r\n * @public\r\n * @memberof ServiceRegistry\r\n * @param {HostFilter} filter - The inclusive filter for hosts to remove.\r\n * @returns {Array<ServiceHost>} - The removed {@link ServiceHost}s.\r\n */\r\n clear(filter) {\r\n // Collect a list of hosts to remove based on the provided filter.\r\n const removing = this.find(filter);\r\n\r\n // Remove the hosts from the array.\r\n this.hosts = this.hosts.filter((host) => !removing.includes(host));\r\n\r\n // Return the removed hosts.\r\n return removing;\r\n }\r\n\r\n /**\r\n * Mark a collection of {@link ServiceHost} class objects from the\r\n * {@link ServiceRegistry#hosts} array as failed based on the provided\r\n * {@link HostFilter}.\r\n *\r\n * @public\r\n * @memberof ServiceRegistry\r\n * @param {HostFilter} filter - The inclusive filter for hosts to mark failed.\r\n * @returns {Array<ServiceHost>} - The {@link ServiceHost}s marked failed.\r\n */\r\n failed(filter) {\r\n // Collect a list of hosts to mark as failed based on the provided filter.\r\n const failing = this.find(filter);\r\n\r\n // Mark the hosts from the array as failed.\r\n failing.forEach((host) => {\r\n host.setStatus({failed: true});\r\n });\r\n\r\n // Return the marked hosts.\r\n return failing;\r\n }\r\n\r\n /**\r\n * Filter the {@link ServiceRegistry#hosts} array against their active states.\r\n *\r\n * @private\r\n * @memberof ServiceRegistry\r\n * @param {boolean} [active] - Filter for the host state.\r\n * @returns {Array<ServiceHost>} - The filtered host array.\r\n */\r\n filterActive(active) {\r\n // Filter the host array if the active requirement is true.\r\n return typeof active === 'boolean'\r\n ? this.hosts.filter((host) => host.active === active)\r\n : [...this.hosts];\r\n }\r\n\r\n /**\r\n * Filter the {@link ServiceRegistry#hosts} array against their assigned\r\n * catalog values.\r\n *\r\n * @private\r\n * @memberof ServiceRegistry\r\n * @param {Array<string> | string} [catalog] - Catalogs to filter.\r\n * @returns {Array<ServiceHost>} - The filtered host array.\r\n */\r\n filterCatalog(catalog = []) {\r\n // Generate a catalog names array based on the provided catalog param.\r\n const catalogs = (Array.isArray(catalog) ? catalog : [catalog]).map(\r\n (catalogId) =>\r\n ServiceRegistry.mapCatalogName({\r\n id: catalogId,\r\n type: SERVICE_CATALOGS_ENUM_TYPES.STRING,\r\n }) || catalogId\r\n );\r\n\r\n // Filter the host array against the catalog names array.\r\n return catalogs.length > 0\r\n ? this.hosts.filter((host) => catalogs.includes(host.catalog))\r\n : [...this.hosts];\r\n }\r\n\r\n /**\r\n * Filter the {@link ServiceRegistry#hosts} array against their assigned\r\n * cluster values.\r\n *\r\n * @private\r\n * @memberof ServiceRegistry\r\n * @param {Array<string> | string} [cluster] - Clusters to filter for.\r\n * @returns {Array<ServiceHost>} - The filtered host array.\r\n */\r\n filterCluster(cluster = []) {\r\n // Generate an array of clusters regardless of parameter type.\r\n const clusters = Array.isArray(cluster) ? cluster : [cluster];\r\n\r\n // Filter the host array against the provided clusters.\r\n return clusters.length > 0\r\n ? this.hosts.filter((host) => clusters.includes(host.id))\r\n : [...this.hosts];\r\n }\r\n\r\n /**\r\n * Filter the {@link ServiceRegistry#hosts} array against their location in\r\n * reference to the authenticated user.\r\n *\r\n * @private\r\n * @memberof ServiceRegistry\r\n * @param {boolean} [local] - Filter for the host location.\r\n * @returns {Array<ServiceHost>} - The filtered host array.\r\n */\r\n filterLocal(local) {\r\n return typeof local === 'boolean'\r\n ? this.hosts.filter((host) => host.local === local)\r\n : [...this.hosts];\r\n }\r\n\r\n /**\r\n * Filter the {@link ServiceRegistry#hosts} array for the highest priority\r\n * hosts for each specific service.\r\n *\r\n * @private\r\n * @memberof ServiceRegistry\r\n * @param {boolean} [priority] - Filter for the highest priority\r\n * @returns {Array<ServiceHost>} - The filtered host array.\r\n */\r\n filterPriority(priority) {\r\n return priority\r\n ? this.hosts.reduce((filteredHosts, currentHost) => {\r\n // Validate that the current host is not active.\r\n if (!currentHost.active) {\r\n return filteredHosts;\r\n }\r\n\r\n // Determine if the filtered hosts array contains a host from the same\r\n // host group.\r\n const foundHost = filteredHosts.find((host) => host.hostGroup === currentHost.hostGroup);\r\n\r\n // Validate if a host was found.\r\n if (!foundHost) {\r\n filteredHosts.push(currentHost);\r\n\r\n return filteredHosts;\r\n }\r\n\r\n // Map the found host's catalog to its priority value.\r\n const foundHostCatalogPriority = ServiceRegistry.mapCatalogName({\r\n id: foundHost.catalog,\r\n type: SERVICE_CATALOGS_ENUM_TYPES.NUMBER,\r\n });\r\n\r\n // Map the current host's catalog to its priority value.\r\n const currentHostCatalogPriority = ServiceRegistry.mapCatalogName({\r\n id: currentHost.catalog,\r\n type: SERVICE_CATALOGS_ENUM_TYPES.NUMBER,\r\n });\r\n\r\n // Validate if the found host has a lower priority than the current\r\n // host.\r\n if (\r\n foundHostCatalogPriority < currentHostCatalogPriority ||\r\n foundHost.priority < currentHost.priority\r\n ) {\r\n filteredHosts.splice(filteredHosts.indexOf(foundHost, 1));\r\n filteredHosts.push(currentHost);\r\n }\r\n\r\n return filteredHosts;\r\n }, [])\r\n : [...this.hosts];\r\n }\r\n\r\n /**\r\n * Filter the {@link ServiceRegistry#hosts} array for hosts with a specified\r\n * set of service names.\r\n *\r\n * @private\r\n * @memberof ServiceRegistry\r\n * @param {Array<string> | string} [service] - Services to filter.\r\n * @returns {Array<ServiceHost>} - The filtered host array.\r\n */\r\n filterService(service = []) {\r\n // Generate an array of services regardless of parameter type.\r\n const services = Array.isArray(service) ? service : [service];\r\n\r\n // Filter the host array against the provided services.\r\n return services.length > 0\r\n ? this.hosts.filter((host) => services.includes(host.service))\r\n : [...this.hosts];\r\n }\r\n\r\n /**\r\n * Filter the {@link ServiceRegistry#hosts} array for hosts with a specified\r\n * set of URLs.\r\n *\r\n * @private\r\n * @memberof ServiceRegistry\r\n * @param {Array<string> | string} [url] - URL to filter.\r\n * @returns {Array<ServiceHost>} - The filter host array.\r\n */\r\n filterUrl(url = []) {\r\n // Generate an array of URLs regardless of the parameter type.\r\n const urls = Array.isArray(url) ? url : [url];\r\n\r\n // Filter the host array against the provided URLs.\r\n return urls.length > 0 ? this.hosts.filter((host) => urls.includes(host.url)) : [...this.hosts];\r\n }\r\n\r\n /**\r\n * Get an array of {@link ServiceHost}s based on a provided\r\n * {@link HostFilter} from the {@link ServiceRegistry#hosts} array.\r\n *\r\n * @public\r\n * @memberof ServiceRegistry\r\n * @param {HostFilter} [filter] - The inclusive filter for hosts to find.\r\n * @returns {Array<ServiceHost>} - The filtered hosts.\r\n */\r\n find({active, catalog, cluster, local, priority, service, url} = {}) {\r\n return this.hosts.filter(\r\n (host) =>\r\n this.filterActive(active).includes(host) &&\r\n this.filterCatalog(catalog).includes(host) &&\r\n this.filterCluster(cluster).includes(host) &&\r\n this.filterLocal(local).includes(host) &&\r\n this.filterPriority(priority).includes(host) &&\r\n this.filterService(service).includes(host) &&\r\n this.filterUrl(url).includes(host)\r\n );\r\n }\r\n\r\n /**\r\n * Load a formatted array of {@link ServiceHost} constructor parameter\r\n * transfer objects as instances of {@link ServiceHost} class objects to the\r\n * {@link ServiceRegistry#hosts} array.\r\n *\r\n * @public\r\n * @memberof ServiceRegistry\r\n * @param {Array<ServiceHost.ConstructorPTO>} hosts\r\n * @returns {this}\r\n */\r\n load(hosts = []) {\r\n // Validate that the provided hosts are eligible to be loaded.\r\n const validHosts = hosts.filter(\r\n (host) =>\r\n !!ServiceRegistry.mapCatalogName({\r\n id: host.catalog,\r\n type: SERVICE_CATALOGS_ENUM_TYPES.STRING,\r\n })\r\n );\r\n\r\n // Load the eligible hosts.\r\n this.hosts.push(...validHosts.map((loadableHost) => new ServiceHost(loadableHost)));\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Mark a collection of {@link ServiceHost} class objects from the\r\n * {@link ServiceRegistry#hosts} array as replaced based on the provided\r\n * {@link HostFilter}.\r\n *\r\n * @public\r\n * @memberof ServiceRegistry\r\n * @param {HostFilter} filter - The inclusive filter to mark replaced.\r\n * @returns {Array<ServiceHost>} - The {@link ServiceHost}s marked replaced.\r\n */\r\n replaced(filter) {\r\n // Collect a list of hosts to mark as replaced based on the provided filter.\r\n const replacing = this.find(filter);\r\n\r\n // Mark the hosts from the array as replaced.\r\n replacing.forEach((host) => {\r\n host.setStatus({replaced: true});\r\n });\r\n\r\n // Return the marked hosts.\r\n return replacing;\r\n }\r\n\r\n /**\r\n * Reset the failed status of a collection of {@link ServiceHost} class\r\n * objects from the {@link ServiceRegistry#hosts} array based on the provided\r\n * {@link HostFilter}.\r\n *\r\n * @public\r\n * @memberof ServiceRegistry\r\n * @param {HostFilter} filter - The inclusive filter of hosts to reset.\r\n * @returns {Array<ServiceHost>} - The {@link ServiceHost}s that reset.\r\n */\r\n reset(filter) {\r\n // Collect a list of hosts to mark as replaced based on the provided filter.\r\n const resetting = this.find(filter);\r\n\r\n // Mark the hosts from the array as replaced.\r\n resetting.forEach((host) => {\r\n host.setStatus({failed: false});\r\n });\r\n\r\n // Return the marked hosts.\r\n return resetting;\r\n }\r\n\r\n /**\r\n * Convert a {@link SERVICE_CATALOGS} identifier or value to its associated\r\n * idenfier or value.\r\n *\r\n * @public\r\n * @static\r\n * @memberof ServiceRegistry\r\n * @param {Object} pto - The parameter transfer object.\r\n * @property {string | number} pto.id - The identifier to convert in the enum.\r\n * @property {SERVICE_CATALOGS_ENUM_TYPES} pto.type - The desired output.\r\n * @returns {string|number} - The matching enum value or index.\r\n */\r\n static mapCatalogName({id, type}) {\r\n // Validate that the id is a number.\r\n if (typeof id === 'number') {\r\n // Validate that the desired type is a number.\r\n if (type === SERVICE_CATALOGS_ENUM_TYPES.NUMBER) {\r\n return SERVICE_CATALOGS[id] !== undefined ? id : undefined;\r\n }\r\n\r\n // Validate that the desired type is a string.\r\n if (type === SERVICE_CATALOGS_ENUM_TYPES.STRING) {\r\n return SERVICE_CATALOGS[id];\r\n }\r\n }\r\n\r\n // Validate that the id is a string.\r\n if (typeof id === 'string') {\r\n // Validate that the desired type is a string.\r\n if (type === SERVICE_CATALOGS_ENUM_TYPES.STRING) {\r\n return SERVICE_CATALOGS.includes(id) ? id : undefined;\r\n }\r\n\r\n // Validate that the desired type is a number.\r\n if (type === SERVICE_CATALOGS_ENUM_TYPES.NUMBER) {\r\n return SERVICE_CATALOGS.includes(id) ? SERVICE_CATALOGS.indexOf(id) : undefined;\r\n }\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Generate a formatted array based on the object received from the **U2C**\r\n * service for usage in the {@link ServiceRegistry#load} method.\r\n *\r\n * @public\r\n * @static\r\n * @memberof ServiceRegistry\r\n * @param {MapRemoteCatalogPTO} pto - The parameter transfer object.\r\n * @throws - If the target catalog does not exist.\r\n * @returns {Array<ServiceHost#ServiceHostConstructorPTO>}\r\n */\r\n static mapRemoteCatalog({catalog, hostCatalog, serviceLinks}) {\r\n // Collect the service catalog name if needed.\r\n const catalogIndex = ServiceRegistry.mapCatalogName({\r\n id: catalog,\r\n type: SERVICE_CATALOGS_ENUM_TYPES.STRING,\r\n });\r\n\r\n // Validate that the target catalog exists.\r\n if (!SERVICE_CATALOGS.includes(catalogIndex)) {\r\n throw new Error(`service-catalogs: '${catalog}' is not a valid catalog`);\r\n }\r\n\r\n // Map the remote catalog to a mountable host array.\r\n return Object.keys(hostCatalog).reduce((output, key) => {\r\n output.push(\r\n ...hostCatalog[key].map((host) => ({\r\n catalog: catalogIndex,\r\n defaultUri: serviceLinks[host.id.split(':')[3]],\r\n hostGroup: key,\r\n id: host.id,\r\n priority: host.priority,\r\n uri: host.host,\r\n }))\r\n );\r\n\r\n return output;\r\n }, []);\r\n }\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAyC,SAAAG,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,aAAA,CAAAH,MAAA,OAAAI,6BAAA,QAAAC,OAAA,GAAAD,6BAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,WAAAC,gCAAA,CAAAR,MAAA,EAAAO,GAAA,EAAAE,UAAA,OAAAP,IAAA,CAAAQ,IAAA,C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