@webex/webex-core 3.0.0-beta.2 → 3.0.0-beta.21
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/config.js +1 -11
- package/dist/config.js.map +1 -1
- package/dist/credentials-config.js +44 -64
- package/dist/credentials-config.js.map +1 -1
- package/dist/index.js +0 -76
- package/dist/index.js.map +1 -1
- package/dist/interceptors/auth.js +22 -55
- package/dist/interceptors/auth.js.map +1 -1
- package/dist/interceptors/default-options.js +0 -20
- package/dist/interceptors/default-options.js.map +1 -1
- package/dist/interceptors/embargo.js +0 -21
- package/dist/interceptors/embargo.js.map +1 -1
- package/dist/interceptors/network-timing.js +2 -21
- package/dist/interceptors/network-timing.js.map +1 -1
- package/dist/interceptors/payload-transformer.js +2 -22
- package/dist/interceptors/payload-transformer.js.map +1 -1
- package/dist/interceptors/rate-limit.js +25 -57
- package/dist/interceptors/rate-limit.js.map +1 -1
- package/dist/interceptors/redirect.js +4 -33
- package/dist/interceptors/redirect.js.map +1 -1
- package/dist/interceptors/request-event.js +3 -30
- package/dist/interceptors/request-event.js.map +1 -1
- package/dist/interceptors/request-logger.js +1 -30
- package/dist/interceptors/request-logger.js.map +1 -1
- package/dist/interceptors/request-timing.js +3 -22
- package/dist/interceptors/request-timing.js.map +1 -1
- package/dist/interceptors/response-logger.js +2 -31
- package/dist/interceptors/response-logger.js.map +1 -1
- package/dist/interceptors/user-agent.js +2 -29
- package/dist/interceptors/user-agent.js.map +1 -1
- package/dist/interceptors/webex-tracking-id.js +5 -28
- package/dist/interceptors/webex-tracking-id.js.map +1 -1
- package/dist/interceptors/webex-user-agent.js +5 -38
- package/dist/interceptors/webex-user-agent.js.map +1 -1
- package/dist/lib/batcher.js +3 -51
- package/dist/lib/batcher.js.map +1 -1
- package/dist/lib/credentials/credentials.js +39 -119
- package/dist/lib/credentials/credentials.js.map +1 -1
- package/dist/lib/credentials/grant-errors.js +0 -49
- package/dist/lib/credentials/grant-errors.js.map +1 -1
- package/dist/lib/credentials/index.js +1 -13
- package/dist/lib/credentials/index.js.map +1 -1
- package/dist/lib/credentials/scope.js +1 -7
- package/dist/lib/credentials/scope.js.map +1 -1
- package/dist/lib/credentials/token-collection.js +1 -7
- package/dist/lib/credentials/token-collection.js.map +1 -1
- package/dist/lib/credentials/token.js +39 -118
- package/dist/lib/credentials/token.js.map +1 -1
- package/dist/lib/page.js +13 -26
- package/dist/lib/page.js.map +1 -1
- package/dist/lib/services/constants.js +0 -2
- package/dist/lib/services/constants.js.map +1 -1
- package/dist/lib/services/index.js +1 -28
- package/dist/lib/services/index.js.map +1 -1
- package/dist/lib/services/interceptors/server-error.js +2 -23
- package/dist/lib/services/interceptors/server-error.js.map +1 -1
- package/dist/lib/services/interceptors/service.js +12 -34
- package/dist/lib/services/interceptors/service.js.map +1 -1
- package/dist/lib/services/metrics.js +0 -2
- package/dist/lib/services/metrics.js.map +1 -1
- package/dist/lib/services/service-catalog.js +10 -90
- package/dist/lib/services/service-catalog.js.map +1 -1
- package/dist/lib/services/service-fed-ramp.js +0 -2
- package/dist/lib/services/service-fed-ramp.js.map +1 -1
- package/dist/lib/services/service-host.js +47 -62
- package/dist/lib/services/service-host.js.map +1 -1
- package/dist/lib/services/service-registry.js +78 -90
- package/dist/lib/services/service-registry.js.map +1 -1
- package/dist/lib/services/service-state.js +3 -15
- package/dist/lib/services/service-state.js.map +1 -1
- package/dist/lib/services/service-url.js +4 -25
- package/dist/lib/services/service-url.js.map +1 -1
- package/dist/lib/services/services.js +122 -238
- package/dist/lib/services/services.js.map +1 -1
- package/dist/lib/stateless-webex-plugin.js +5 -28
- package/dist/lib/stateless-webex-plugin.js.map +1 -1
- package/dist/lib/storage/decorators.js +19 -62
- package/dist/lib/storage/decorators.js.map +1 -1
- package/dist/lib/storage/errors.js +0 -23
- package/dist/lib/storage/errors.js.map +1 -1
- package/dist/lib/storage/index.js +2 -16
- package/dist/lib/storage/index.js.map +1 -1
- package/dist/lib/storage/make-webex-plugin-store.js +11 -41
- package/dist/lib/storage/make-webex-plugin-store.js.map +1 -1
- package/dist/lib/storage/make-webex-store.js +8 -30
- package/dist/lib/storage/make-webex-store.js.map +1 -1
- package/dist/lib/storage/memory-store-adapter.js +1 -19
- package/dist/lib/storage/memory-store-adapter.js.map +1 -1
- package/dist/lib/webex-core-plugin-mixin.js +9 -29
- package/dist/lib/webex-core-plugin-mixin.js.map +1 -1
- package/dist/lib/webex-http-error.js +1 -31
- package/dist/lib/webex-http-error.js.map +1 -1
- package/dist/lib/webex-internal-core-plugin-mixin.js +9 -29
- package/dist/lib/webex-internal-core-plugin-mixin.js.map +1 -1
- package/dist/lib/webex-plugin.js +6 -40
- package/dist/lib/webex-plugin.js.map +1 -1
- package/dist/plugins/logger.js +3 -17
- package/dist/plugins/logger.js.map +1 -1
- package/dist/webex-core.js +79 -203
- package/dist/webex-core.js.map +1 -1
- package/dist/webex-internal-core.js +0 -10
- package/dist/webex-internal-core.js.map +1 -1
- package/package.json +14 -14
- package/src/config.js +9 -11
- package/src/credentials-config.js +110 -72
- package/src/index.js +4 -14
- package/src/interceptors/auth.js +36 -37
- package/src/interceptors/default-options.js +0 -1
- package/src/interceptors/embargo.js +1 -1
- package/src/interceptors/payload-transformer.js +1 -2
- package/src/interceptors/rate-limit.js +8 -5
- package/src/interceptors/redirect.js +14 -8
- package/src/interceptors/request-event.js +4 -8
- package/src/interceptors/request-logger.js +8 -5
- package/src/interceptors/response-logger.js +11 -8
- package/src/interceptors/user-agent.js +1 -2
- package/src/interceptors/webex-user-agent.js +3 -9
- package/src/lib/batcher.js +70 -69
- package/src/lib/credentials/credentials.js +112 -122
- package/src/lib/credentials/grant-errors.js +6 -7
- package/src/lib/credentials/index.js +1 -4
- package/src/lib/credentials/scope.js +1 -4
- package/src/lib/credentials/token-collection.js +1 -1
- package/src/lib/credentials/token.js +86 -80
- package/src/lib/page.js +10 -11
- package/src/lib/services/constants.js +3 -13
- package/src/lib/services/index.js +2 -2
- package/src/lib/services/interceptors/server-error.js +12 -7
- package/src/lib/services/interceptors/service.js +6 -5
- package/src/lib/services/metrics.js +1 -1
- package/src/lib/services/service-catalog.js +110 -100
- package/src/lib/services/service-fed-ramp.js +1 -2
- package/src/lib/services/service-host.js +10 -17
- package/src/lib/services/service-registry.js +69 -96
- package/src/lib/services/service-state.js +4 -6
- package/src/lib/services/service-url.js +24 -23
- package/src/lib/services/services.js +260 -251
- package/src/lib/stateless-webex-plugin.js +4 -2
- package/src/lib/storage/decorators.js +68 -66
- package/src/lib/storage/index.js +4 -6
- package/src/lib/storage/make-webex-plugin-store.js +34 -21
- package/src/lib/storage/make-webex-store.js +6 -7
- package/src/lib/storage/memory-store-adapter.js +3 -3
- package/src/lib/webex-core-plugin-mixin.js +10 -7
- package/src/lib/webex-http-error.js +7 -8
- package/src/lib/webex-internal-core-plugin-mixin.js +9 -6
- package/src/lib/webex-plugin.js +41 -34
- package/src/plugins/logger.js +8 -3
- package/src/webex-core.js +185 -116
- package/src/webex-internal-core.js +15 -9
- package/test/integration/spec/credentials/credentials.js +26 -30
- package/test/integration/spec/credentials/token.js +36 -33
- package/test/integration/spec/services/service-catalog.js +177 -156
- package/test/integration/spec/services/services.js +313 -304
- package/test/integration/spec/webex-core.js +98 -86
- package/test/unit/spec/_setup.js +26 -18
- package/test/unit/spec/credentials/credentials.js +189 -154
- package/test/unit/spec/credentials/token.js +94 -76
- package/test/unit/spec/interceptors/auth.js +291 -243
- package/test/unit/spec/interceptors/default-options.js +36 -24
- package/test/unit/spec/interceptors/embargo.js +32 -27
- package/test/unit/spec/interceptors/network-timing.js +2 -2
- package/test/unit/spec/interceptors/payload-transformer.js +61 -52
- package/test/unit/spec/interceptors/rate-limit.js +104 -75
- package/test/unit/spec/interceptors/redirect.js +22 -20
- package/test/unit/spec/interceptors/request-timing.js +18 -22
- package/test/unit/spec/interceptors/user-agent.js +28 -16
- package/test/unit/spec/interceptors/webex-tracking-id.js +14 -8
- package/test/unit/spec/interceptors/webex-user-agent.js +83 -37
- package/test/unit/spec/lib/batcher.js +36 -32
- package/test/unit/spec/lib/page.js +36 -32
- package/test/unit/spec/lib/webex-plugin.js +1 -1
- package/test/unit/spec/services/interceptors/server-error.js +67 -90
- package/test/unit/spec/services/interceptors/service.js +17 -28
- package/test/unit/spec/services/service-catalog.js +19 -27
- package/test/unit/spec/services/service-host.js +29 -26
- package/test/unit/spec/services/service-registry.js +128 -170
- package/test/unit/spec/services/service-state.js +13 -22
- package/test/unit/spec/services/service-url.js +24 -43
- package/test/unit/spec/services/services.js +85 -41
- package/test/unit/spec/storage/persist.js +6 -9
- package/test/unit/spec/storage/wait-for-value.js +22 -21
- package/test/unit/spec/webex-core.js +78 -57
- package/test/unit/spec/webex-internal-core.js +56 -31
|
@@ -1,45 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Object$keys2 = require("@babel/runtime-corejs2/core-js/object/keys");
|
|
4
|
-
|
|
5
4
|
var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs2/core-js/object/get-own-property-symbols");
|
|
6
|
-
|
|
7
5
|
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptor");
|
|
8
|
-
|
|
9
6
|
var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptors");
|
|
10
|
-
|
|
11
7
|
var _Object$defineProperties = require("@babel/runtime-corejs2/core-js/object/define-properties");
|
|
12
|
-
|
|
13
8
|
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
14
|
-
|
|
15
9
|
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
16
|
-
|
|
17
10
|
_Object$defineProperty(exports, "__esModule", {
|
|
18
11
|
value: true
|
|
19
12
|
});
|
|
20
|
-
|
|
21
13
|
exports.default = void 0;
|
|
22
|
-
|
|
23
14
|
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/array/is-array"));
|
|
24
|
-
|
|
25
15
|
var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
|
|
26
|
-
|
|
27
16
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/toConsumableArray"));
|
|
28
|
-
|
|
29
17
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
|
|
30
|
-
|
|
31
18
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
|
|
32
|
-
|
|
33
19
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
|
|
34
|
-
|
|
35
20
|
var _constants = require("./constants");
|
|
36
|
-
|
|
37
21
|
var _serviceHost = _interopRequireDefault(require("./service-host"));
|
|
38
|
-
|
|
39
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; }
|
|
40
|
-
|
|
41
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; }
|
|
42
|
-
|
|
43
24
|
/**
|
|
44
25
|
* The parameter transfer object for {@link ServiceRegistry#mapRemoteCatalog}.
|
|
45
26
|
* This object is shaped to match the object returned from the **U2C** service.
|
|
@@ -52,7 +33,6 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
52
33
|
* @property {RSL} MapRemoteCatalogPTO.serviceLinks - Service links.
|
|
53
34
|
* @property {RHC} MapRemoteCatalogPTO.hostCatalog - Service host catalog.
|
|
54
35
|
*/
|
|
55
|
-
|
|
56
36
|
/**
|
|
57
37
|
* Service manipulation filter object for retrieving services within the
|
|
58
38
|
* {@link ServiceRegistry} class.
|
|
@@ -66,7 +46,6 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
66
46
|
* @property {Array<string> | string} [HostFilter.service] - Services to filter.
|
|
67
47
|
* @property {Array<string> | string} [HostFilter.url] - URL to filter.
|
|
68
48
|
*/
|
|
69
|
-
|
|
70
49
|
/**
|
|
71
50
|
* @class
|
|
72
51
|
* @classdesc - Manages a collection of {@link ServiceHost} class objects.
|
|
@@ -81,7 +60,6 @@ var ServiceRegistry = /*#__PURE__*/function () {
|
|
|
81
60
|
*/
|
|
82
61
|
function ServiceRegistry() {
|
|
83
62
|
(0, _classCallCheck2.default)(this, ServiceRegistry);
|
|
84
|
-
|
|
85
63
|
/**
|
|
86
64
|
* The collection of managed {@link ServiceHost}s.
|
|
87
65
|
*
|
|
@@ -92,6 +70,7 @@ var ServiceRegistry = /*#__PURE__*/function () {
|
|
|
92
70
|
*/
|
|
93
71
|
this.hosts = [];
|
|
94
72
|
}
|
|
73
|
+
|
|
95
74
|
/**
|
|
96
75
|
* An active, local, and priority mapped record of the current
|
|
97
76
|
* {@link ServiceCatalog#hosts}.
|
|
@@ -100,8 +79,6 @@ var ServiceRegistry = /*#__PURE__*/function () {
|
|
|
100
79
|
* @memberof ServiceCatalog
|
|
101
80
|
* @type {Record<string, string>}
|
|
102
81
|
*/
|
|
103
|
-
|
|
104
|
-
|
|
105
82
|
(0, _createClass2.default)(ServiceRegistry, [{
|
|
106
83
|
key: "map",
|
|
107
84
|
get: function get() {
|
|
@@ -112,13 +89,16 @@ var ServiceRegistry = /*#__PURE__*/function () {
|
|
|
112
89
|
priority: true
|
|
113
90
|
}).reduce(function (map, host) {
|
|
114
91
|
// Generate a new object to assign the existing map.
|
|
115
|
-
var hostReference = {};
|
|
92
|
+
var hostReference = {};
|
|
116
93
|
|
|
117
|
-
|
|
94
|
+
// Assign the key:value pair for the service and url.
|
|
95
|
+
hostReference[host.service] = host.url;
|
|
118
96
|
|
|
97
|
+
// Assign the reference to the map and return.
|
|
119
98
|
return _objectSpread(_objectSpread({}, map), hostReference);
|
|
120
99
|
}, {});
|
|
121
100
|
}
|
|
101
|
+
|
|
122
102
|
/**
|
|
123
103
|
* Removes a collection of {@link ServiceHost} class objects from the
|
|
124
104
|
* {@link ServiceRegistry#hosts} array based on the provided
|
|
@@ -129,19 +109,21 @@ var ServiceRegistry = /*#__PURE__*/function () {
|
|
|
129
109
|
* @param {HostFilter} filter - The inclusive filter for hosts to remove.
|
|
130
110
|
* @returns {Array<ServiceHost>} - The removed {@link ServiceHost}s.
|
|
131
111
|
*/
|
|
132
|
-
|
|
133
112
|
}, {
|
|
134
113
|
key: "clear",
|
|
135
114
|
value: function clear(filter) {
|
|
136
115
|
// Collect a list of hosts to remove based on the provided filter.
|
|
137
|
-
var removing = this.find(filter);
|
|
116
|
+
var removing = this.find(filter);
|
|
138
117
|
|
|
118
|
+
// Remove the hosts from the array.
|
|
139
119
|
this.hosts = this.hosts.filter(function (host) {
|
|
140
120
|
return !removing.includes(host);
|
|
141
|
-
});
|
|
121
|
+
});
|
|
142
122
|
|
|
123
|
+
// Return the removed hosts.
|
|
143
124
|
return removing;
|
|
144
125
|
}
|
|
126
|
+
|
|
145
127
|
/**
|
|
146
128
|
* Mark a collection of {@link ServiceHost} class objects from the
|
|
147
129
|
* {@link ServiceRegistry#hosts} array as failed based on the provided
|
|
@@ -152,21 +134,23 @@ var ServiceRegistry = /*#__PURE__*/function () {
|
|
|
152
134
|
* @param {HostFilter} filter - The inclusive filter for hosts to mark failed.
|
|
153
135
|
* @returns {Array<ServiceHost>} - The {@link ServiceHost}s marked failed.
|
|
154
136
|
*/
|
|
155
|
-
|
|
156
137
|
}, {
|
|
157
138
|
key: "failed",
|
|
158
139
|
value: function failed(filter) {
|
|
159
140
|
// Collect a list of hosts to mark as failed based on the provided filter.
|
|
160
|
-
var failing = this.find(filter);
|
|
141
|
+
var failing = this.find(filter);
|
|
161
142
|
|
|
143
|
+
// Mark the hosts from the array as failed.
|
|
162
144
|
failing.forEach(function (host) {
|
|
163
145
|
host.setStatus({
|
|
164
146
|
failed: true
|
|
165
147
|
});
|
|
166
|
-
});
|
|
148
|
+
});
|
|
167
149
|
|
|
150
|
+
// Return the marked hosts.
|
|
168
151
|
return failing;
|
|
169
152
|
}
|
|
153
|
+
|
|
170
154
|
/**
|
|
171
155
|
* Filter the {@link ServiceRegistry#hosts} array against their active states.
|
|
172
156
|
*
|
|
@@ -175,7 +159,6 @@ var ServiceRegistry = /*#__PURE__*/function () {
|
|
|
175
159
|
* @param {boolean} [active] - Filter for the host state.
|
|
176
160
|
* @returns {Array<ServiceHost>} - The filtered host array.
|
|
177
161
|
*/
|
|
178
|
-
|
|
179
162
|
}, {
|
|
180
163
|
key: "filterActive",
|
|
181
164
|
value: function filterActive(active) {
|
|
@@ -184,6 +167,7 @@ var ServiceRegistry = /*#__PURE__*/function () {
|
|
|
184
167
|
return host.active === active;
|
|
185
168
|
}) : (0, _toConsumableArray2.default)(this.hosts);
|
|
186
169
|
}
|
|
170
|
+
|
|
187
171
|
/**
|
|
188
172
|
* Filter the {@link ServiceRegistry#hosts} array against their assigned
|
|
189
173
|
* catalog values.
|
|
@@ -193,7 +177,6 @@ var ServiceRegistry = /*#__PURE__*/function () {
|
|
|
193
177
|
* @param {Array<string> | string} [catalog] - Catalogs to filter.
|
|
194
178
|
* @returns {Array<ServiceHost>} - The filtered host array.
|
|
195
179
|
*/
|
|
196
|
-
|
|
197
180
|
}, {
|
|
198
181
|
key: "filterCatalog",
|
|
199
182
|
value: function filterCatalog() {
|
|
@@ -204,12 +187,14 @@ var ServiceRegistry = /*#__PURE__*/function () {
|
|
|
204
187
|
id: catalogId,
|
|
205
188
|
type: _constants.SERVICE_CATALOGS_ENUM_TYPES.STRING
|
|
206
189
|
}) || catalogId;
|
|
207
|
-
});
|
|
190
|
+
});
|
|
208
191
|
|
|
192
|
+
// Filter the host array against the catalog names array.
|
|
209
193
|
return catalogs.length > 0 ? this.hosts.filter(function (host) {
|
|
210
194
|
return catalogs.includes(host.catalog);
|
|
211
195
|
}) : (0, _toConsumableArray2.default)(this.hosts);
|
|
212
196
|
}
|
|
197
|
+
|
|
213
198
|
/**
|
|
214
199
|
* Filter the {@link ServiceRegistry#hosts} array against their assigned
|
|
215
200
|
* cluster values.
|
|
@@ -219,18 +204,19 @@ var ServiceRegistry = /*#__PURE__*/function () {
|
|
|
219
204
|
* @param {Array<string> | string} [cluster] - Clusters to filter for.
|
|
220
205
|
* @returns {Array<ServiceHost>} - The filtered host array.
|
|
221
206
|
*/
|
|
222
|
-
|
|
223
207
|
}, {
|
|
224
208
|
key: "filterCluster",
|
|
225
209
|
value: function filterCluster() {
|
|
226
210
|
var cluster = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
227
211
|
// Generate an array of clusters regardless of parameter type.
|
|
228
|
-
var clusters = (0, _isArray.default)(cluster) ? cluster : [cluster];
|
|
212
|
+
var clusters = (0, _isArray.default)(cluster) ? cluster : [cluster];
|
|
229
213
|
|
|
214
|
+
// Filter the host array against the provided clusters.
|
|
230
215
|
return clusters.length > 0 ? this.hosts.filter(function (host) {
|
|
231
216
|
return clusters.includes(host.id);
|
|
232
217
|
}) : (0, _toConsumableArray2.default)(this.hosts);
|
|
233
218
|
}
|
|
219
|
+
|
|
234
220
|
/**
|
|
235
221
|
* Filter the {@link ServiceRegistry#hosts} array against their location in
|
|
236
222
|
* reference to the authenticated user.
|
|
@@ -240,7 +226,6 @@ var ServiceRegistry = /*#__PURE__*/function () {
|
|
|
240
226
|
* @param {boolean} [local] - Filter for the host location.
|
|
241
227
|
* @returns {Array<ServiceHost>} - The filtered host array.
|
|
242
228
|
*/
|
|
243
|
-
|
|
244
229
|
}, {
|
|
245
230
|
key: "filterLocal",
|
|
246
231
|
value: function filterLocal(local) {
|
|
@@ -248,6 +233,7 @@ var ServiceRegistry = /*#__PURE__*/function () {
|
|
|
248
233
|
return host.local === local;
|
|
249
234
|
}) : (0, _toConsumableArray2.default)(this.hosts);
|
|
250
235
|
}
|
|
236
|
+
|
|
251
237
|
/**
|
|
252
238
|
* Filter the {@link ServiceRegistry#hosts} array for the highest priority
|
|
253
239
|
* hosts for each specific service.
|
|
@@ -257,7 +243,6 @@ var ServiceRegistry = /*#__PURE__*/function () {
|
|
|
257
243
|
* @param {boolean} [priority] - Filter for the highest priority
|
|
258
244
|
* @returns {Array<ServiceHost>} - The filtered host array.
|
|
259
245
|
*/
|
|
260
|
-
|
|
261
246
|
}, {
|
|
262
247
|
key: "filterPriority",
|
|
263
248
|
value: function filterPriority(priority) {
|
|
@@ -265,39 +250,42 @@ var ServiceRegistry = /*#__PURE__*/function () {
|
|
|
265
250
|
// Validate that the current host is not active.
|
|
266
251
|
if (!currentHost.active) {
|
|
267
252
|
return filteredHosts;
|
|
268
|
-
}
|
|
269
|
-
// host group.
|
|
270
|
-
|
|
253
|
+
}
|
|
271
254
|
|
|
255
|
+
// Determine if the filtered hosts array contains a host from the same
|
|
256
|
+
// host group.
|
|
272
257
|
var foundHost = filteredHosts.find(function (host) {
|
|
273
258
|
return host.hostGroup === currentHost.hostGroup;
|
|
274
|
-
});
|
|
259
|
+
});
|
|
275
260
|
|
|
261
|
+
// Validate if a host was found.
|
|
276
262
|
if (!foundHost) {
|
|
277
263
|
filteredHosts.push(currentHost);
|
|
278
264
|
return filteredHosts;
|
|
279
|
-
}
|
|
280
|
-
|
|
265
|
+
}
|
|
281
266
|
|
|
267
|
+
// Map the found host's catalog to its priority value.
|
|
282
268
|
var foundHostCatalogPriority = ServiceRegistry.mapCatalogName({
|
|
283
269
|
id: foundHost.catalog,
|
|
284
270
|
type: _constants.SERVICE_CATALOGS_ENUM_TYPES.NUMBER
|
|
285
|
-
});
|
|
271
|
+
});
|
|
286
272
|
|
|
273
|
+
// Map the current host's catalog to its priority value.
|
|
287
274
|
var currentHostCatalogPriority = ServiceRegistry.mapCatalogName({
|
|
288
275
|
id: currentHost.catalog,
|
|
289
276
|
type: _constants.SERVICE_CATALOGS_ENUM_TYPES.NUMBER
|
|
290
|
-
});
|
|
291
|
-
// host.
|
|
277
|
+
});
|
|
292
278
|
|
|
279
|
+
// Validate if the found host has a lower priority than the current
|
|
280
|
+
// host.
|
|
293
281
|
if (foundHostCatalogPriority < currentHostCatalogPriority || foundHost.priority < currentHost.priority) {
|
|
294
282
|
filteredHosts.splice(filteredHosts.indexOf(foundHost, 1));
|
|
295
283
|
filteredHosts.push(currentHost);
|
|
296
284
|
}
|
|
297
|
-
|
|
298
285
|
return filteredHosts;
|
|
299
286
|
}, []) : (0, _toConsumableArray2.default)(this.hosts);
|
|
300
287
|
}
|
|
288
|
+
|
|
301
289
|
/**
|
|
302
290
|
* Filter the {@link ServiceRegistry#hosts} array for hosts with a specified
|
|
303
291
|
* set of service names.
|
|
@@ -307,18 +295,19 @@ var ServiceRegistry = /*#__PURE__*/function () {
|
|
|
307
295
|
* @param {Array<string> | string} [service] - Services to filter.
|
|
308
296
|
* @returns {Array<ServiceHost>} - The filtered host array.
|
|
309
297
|
*/
|
|
310
|
-
|
|
311
298
|
}, {
|
|
312
299
|
key: "filterService",
|
|
313
300
|
value: function filterService() {
|
|
314
301
|
var service = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
315
302
|
// Generate an array of services regardless of parameter type.
|
|
316
|
-
var services = (0, _isArray.default)(service) ? service : [service];
|
|
303
|
+
var services = (0, _isArray.default)(service) ? service : [service];
|
|
317
304
|
|
|
305
|
+
// Filter the host array against the provided services.
|
|
318
306
|
return services.length > 0 ? this.hosts.filter(function (host) {
|
|
319
307
|
return services.includes(host.service);
|
|
320
308
|
}) : (0, _toConsumableArray2.default)(this.hosts);
|
|
321
309
|
}
|
|
310
|
+
|
|
322
311
|
/**
|
|
323
312
|
* Filter the {@link ServiceRegistry#hosts} array for hosts with a specified
|
|
324
313
|
* set of URLs.
|
|
@@ -328,18 +317,19 @@ var ServiceRegistry = /*#__PURE__*/function () {
|
|
|
328
317
|
* @param {Array<string> | string} [url] - URL to filter.
|
|
329
318
|
* @returns {Array<ServiceHost>} - The filter host array.
|
|
330
319
|
*/
|
|
331
|
-
|
|
332
320
|
}, {
|
|
333
321
|
key: "filterUrl",
|
|
334
322
|
value: function filterUrl() {
|
|
335
323
|
var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
336
324
|
// Generate an array of URLs regardless of the parameter type.
|
|
337
|
-
var urls = (0, _isArray.default)(url) ? url : [url];
|
|
325
|
+
var urls = (0, _isArray.default)(url) ? url : [url];
|
|
338
326
|
|
|
327
|
+
// Filter the host array against the provided URLs.
|
|
339
328
|
return urls.length > 0 ? this.hosts.filter(function (host) {
|
|
340
329
|
return urls.includes(host.url);
|
|
341
330
|
}) : (0, _toConsumableArray2.default)(this.hosts);
|
|
342
331
|
}
|
|
332
|
+
|
|
343
333
|
/**
|
|
344
334
|
* Get an array of {@link ServiceHost}s based on a provided
|
|
345
335
|
* {@link HostFilter} from the {@link ServiceRegistry#hosts} array.
|
|
@@ -349,25 +339,23 @@ var ServiceRegistry = /*#__PURE__*/function () {
|
|
|
349
339
|
* @param {HostFilter} [filter] - The inclusive filter for hosts to find.
|
|
350
340
|
* @returns {Array<ServiceHost>} - The filtered hosts.
|
|
351
341
|
*/
|
|
352
|
-
|
|
353
342
|
}, {
|
|
354
343
|
key: "find",
|
|
355
344
|
value: function find() {
|
|
356
345
|
var _this = this;
|
|
357
|
-
|
|
358
346
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
347
|
+
active = _ref.active,
|
|
348
|
+
catalog = _ref.catalog,
|
|
349
|
+
cluster = _ref.cluster,
|
|
350
|
+
local = _ref.local,
|
|
351
|
+
priority = _ref.priority,
|
|
352
|
+
service = _ref.service,
|
|
353
|
+
url = _ref.url;
|
|
367
354
|
return this.hosts.filter(function (host) {
|
|
368
355
|
return _this.filterActive(active).includes(host) && _this.filterCatalog(catalog).includes(host) && _this.filterCluster(cluster).includes(host) && _this.filterLocal(local).includes(host) && _this.filterPriority(priority).includes(host) && _this.filterService(service).includes(host) && _this.filterUrl(url).includes(host);
|
|
369
356
|
});
|
|
370
357
|
}
|
|
358
|
+
|
|
371
359
|
/**
|
|
372
360
|
* Load a formatted array of {@link ServiceHost} constructor parameter
|
|
373
361
|
* transfer objects as instances of {@link ServiceHost} class objects to the
|
|
@@ -378,12 +366,10 @@ var ServiceRegistry = /*#__PURE__*/function () {
|
|
|
378
366
|
* @param {Array<ServiceHost.ConstructorPTO>} hosts
|
|
379
367
|
* @returns {this}
|
|
380
368
|
*/
|
|
381
|
-
|
|
382
369
|
}, {
|
|
383
370
|
key: "load",
|
|
384
371
|
value: function load() {
|
|
385
372
|
var _this$hosts;
|
|
386
|
-
|
|
387
373
|
var hosts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
388
374
|
// Validate that the provided hosts are eligible to be loaded.
|
|
389
375
|
var validHosts = hosts.filter(function (host) {
|
|
@@ -391,14 +377,15 @@ var ServiceRegistry = /*#__PURE__*/function () {
|
|
|
391
377
|
id: host.catalog,
|
|
392
378
|
type: _constants.SERVICE_CATALOGS_ENUM_TYPES.STRING
|
|
393
379
|
});
|
|
394
|
-
});
|
|
380
|
+
});
|
|
395
381
|
|
|
382
|
+
// Load the eligible hosts.
|
|
396
383
|
(_this$hosts = this.hosts).push.apply(_this$hosts, (0, _toConsumableArray2.default)(validHosts.map(function (loadableHost) {
|
|
397
384
|
return new _serviceHost.default(loadableHost);
|
|
398
385
|
})));
|
|
399
|
-
|
|
400
386
|
return this;
|
|
401
387
|
}
|
|
388
|
+
|
|
402
389
|
/**
|
|
403
390
|
* Mark a collection of {@link ServiceHost} class objects from the
|
|
404
391
|
* {@link ServiceRegistry#hosts} array as replaced based on the provided
|
|
@@ -409,21 +396,23 @@ var ServiceRegistry = /*#__PURE__*/function () {
|
|
|
409
396
|
* @param {HostFilter} filter - The inclusive filter to mark replaced.
|
|
410
397
|
* @returns {Array<ServiceHost>} - The {@link ServiceHost}s marked replaced.
|
|
411
398
|
*/
|
|
412
|
-
|
|
413
399
|
}, {
|
|
414
400
|
key: "replaced",
|
|
415
401
|
value: function replaced(filter) {
|
|
416
402
|
// Collect a list of hosts to mark as replaced based on the provided filter.
|
|
417
|
-
var replacing = this.find(filter);
|
|
403
|
+
var replacing = this.find(filter);
|
|
418
404
|
|
|
405
|
+
// Mark the hosts from the array as replaced.
|
|
419
406
|
replacing.forEach(function (host) {
|
|
420
407
|
host.setStatus({
|
|
421
408
|
replaced: true
|
|
422
409
|
});
|
|
423
|
-
});
|
|
410
|
+
});
|
|
424
411
|
|
|
412
|
+
// Return the marked hosts.
|
|
425
413
|
return replacing;
|
|
426
414
|
}
|
|
415
|
+
|
|
427
416
|
/**
|
|
428
417
|
* Reset the failed status of a collection of {@link ServiceHost} class
|
|
429
418
|
* objects from the {@link ServiceRegistry#hosts} array based on the provided
|
|
@@ -434,21 +423,23 @@ var ServiceRegistry = /*#__PURE__*/function () {
|
|
|
434
423
|
* @param {HostFilter} filter - The inclusive filter of hosts to reset.
|
|
435
424
|
* @returns {Array<ServiceHost>} - The {@link ServiceHost}s that reset.
|
|
436
425
|
*/
|
|
437
|
-
|
|
438
426
|
}, {
|
|
439
427
|
key: "reset",
|
|
440
428
|
value: function reset(filter) {
|
|
441
429
|
// Collect a list of hosts to mark as replaced based on the provided filter.
|
|
442
|
-
var resetting = this.find(filter);
|
|
430
|
+
var resetting = this.find(filter);
|
|
443
431
|
|
|
432
|
+
// Mark the hosts from the array as replaced.
|
|
444
433
|
resetting.forEach(function (host) {
|
|
445
434
|
host.setStatus({
|
|
446
435
|
failed: false
|
|
447
436
|
});
|
|
448
|
-
});
|
|
437
|
+
});
|
|
449
438
|
|
|
439
|
+
// Return the marked hosts.
|
|
450
440
|
return resetting;
|
|
451
441
|
}
|
|
442
|
+
|
|
452
443
|
/**
|
|
453
444
|
* Convert a {@link SERVICE_CATALOGS} identifier or value to its associated
|
|
454
445
|
* idenfier or value.
|
|
@@ -461,41 +452,39 @@ var ServiceRegistry = /*#__PURE__*/function () {
|
|
|
461
452
|
* @property {SERVICE_CATALOGS_ENUM_TYPES} pto.type - The desired output.
|
|
462
453
|
* @returns {string|number} - The matching enum value or index.
|
|
463
454
|
*/
|
|
464
|
-
|
|
465
455
|
}], [{
|
|
466
456
|
key: "mapCatalogName",
|
|
467
457
|
value: function mapCatalogName(_ref2) {
|
|
468
458
|
var id = _ref2.id,
|
|
469
|
-
|
|
470
|
-
|
|
459
|
+
type = _ref2.type;
|
|
471
460
|
// Validate that the id is a number.
|
|
472
461
|
if (typeof id === 'number') {
|
|
473
462
|
// Validate that the desired type is a number.
|
|
474
463
|
if (type === _constants.SERVICE_CATALOGS_ENUM_TYPES.NUMBER) {
|
|
475
464
|
return _constants.SERVICE_CATALOGS[id] !== undefined ? id : undefined;
|
|
476
|
-
}
|
|
477
|
-
|
|
465
|
+
}
|
|
478
466
|
|
|
467
|
+
// Validate that the desired type is a string.
|
|
479
468
|
if (type === _constants.SERVICE_CATALOGS_ENUM_TYPES.STRING) {
|
|
480
469
|
return _constants.SERVICE_CATALOGS[id];
|
|
481
470
|
}
|
|
482
|
-
}
|
|
483
|
-
|
|
471
|
+
}
|
|
484
472
|
|
|
473
|
+
// Validate that the id is a string.
|
|
485
474
|
if (typeof id === 'string') {
|
|
486
475
|
// Validate that the desired type is a string.
|
|
487
476
|
if (type === _constants.SERVICE_CATALOGS_ENUM_TYPES.STRING) {
|
|
488
477
|
return _constants.SERVICE_CATALOGS.includes(id) ? id : undefined;
|
|
489
|
-
}
|
|
490
|
-
|
|
478
|
+
}
|
|
491
479
|
|
|
480
|
+
// Validate that the desired type is a number.
|
|
492
481
|
if (type === _constants.SERVICE_CATALOGS_ENUM_TYPES.NUMBER) {
|
|
493
482
|
return _constants.SERVICE_CATALOGS.includes(id) ? _constants.SERVICE_CATALOGS.indexOf(id) : undefined;
|
|
494
483
|
}
|
|
495
484
|
}
|
|
496
|
-
|
|
497
485
|
return undefined;
|
|
498
486
|
}
|
|
487
|
+
|
|
499
488
|
/**
|
|
500
489
|
* Generate a formatted array based on the object received from the **U2C**
|
|
501
490
|
* service for usage in the {@link ServiceRegistry#load} method.
|
|
@@ -507,24 +496,24 @@ var ServiceRegistry = /*#__PURE__*/function () {
|
|
|
507
496
|
* @throws - If the target catalog does not exist.
|
|
508
497
|
* @returns {Array<ServiceHost#ServiceHostConstructorPTO>}
|
|
509
498
|
*/
|
|
510
|
-
|
|
511
499
|
}, {
|
|
512
500
|
key: "mapRemoteCatalog",
|
|
513
501
|
value: function mapRemoteCatalog(_ref3) {
|
|
514
502
|
var catalog = _ref3.catalog,
|
|
515
|
-
|
|
516
|
-
|
|
503
|
+
hostCatalog = _ref3.hostCatalog,
|
|
504
|
+
serviceLinks = _ref3.serviceLinks;
|
|
517
505
|
// Collect the service catalog name if needed.
|
|
518
506
|
var catalogIndex = ServiceRegistry.mapCatalogName({
|
|
519
507
|
id: catalog,
|
|
520
508
|
type: _constants.SERVICE_CATALOGS_ENUM_TYPES.STRING
|
|
521
|
-
});
|
|
509
|
+
});
|
|
522
510
|
|
|
511
|
+
// Validate that the target catalog exists.
|
|
523
512
|
if (!_constants.SERVICE_CATALOGS.includes(catalogIndex)) {
|
|
524
513
|
throw new Error("service-catalogs: '".concat(catalog, "' is not a valid catalog"));
|
|
525
|
-
}
|
|
526
|
-
|
|
514
|
+
}
|
|
527
515
|
|
|
516
|
+
// Map the remote catalog to a mountable host array.
|
|
528
517
|
return (0, _keys.default)(hostCatalog).reduce(function (output, key) {
|
|
529
518
|
output.push.apply(output, (0, _toConsumableArray2.default)(hostCatalog[key].map(function (host) {
|
|
530
519
|
return {
|
|
@@ -542,6 +531,5 @@ var ServiceRegistry = /*#__PURE__*/function () {
|
|
|
542
531
|
}]);
|
|
543
532
|
return ServiceRegistry;
|
|
544
533
|
}();
|
|
545
|
-
|
|
546
534
|
exports.default = ServiceRegistry;
|
|
547
535
|
//# sourceMappingURL=service-registry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ServiceRegistry","hosts","find","active","local","priority","reduce","map","host","hostReference","service","url","filter","removing","includes","failing","forEach","setStatus","failed","catalog","catalogs","catalogId","mapCatalogName","id","type","SERVICE_CATALOGS_ENUM_TYPES","STRING","length","cluster","clusters","filteredHosts","currentHost","foundHost","hostGroup","push","foundHostCatalogPriority","NUMBER","currentHostCatalogPriority","splice","indexOf","services","urls","filterActive","filterCatalog","filterCluster","filterLocal","filterPriority","filterService","filterUrl","validHosts","loadableHost","ServiceHost","replacing","replaced","resetting","SERVICE_CATALOGS","undefined","hostCatalog","serviceLinks","catalogIndex","Error","output","key","defaultUri","split","uri"],"sources":["service-registry.js"],"sourcesContent":["import {\n SERVICE_CATALOGS,\n SERVICE_CATALOGS_ENUM_TYPES\n} 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(\n (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 /**\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(\n (host) => !removing.includes(host)\n );\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(\n (host) => {\n host.setStatus({failed: true});\n }\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])\n .map((catalogId) => ServiceRegistry.mapCatalogName({\n id: catalogId,\n type: SERVICE_CATALOGS_ENUM_TYPES.STRING\n }) || catalogId);\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(\n (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(\n (host) => host.hostGroup === currentHost.hostGroup\n );\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) ?\n this.hosts.filter((host) => urls.includes(host.url)) :\n [...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({\n active,\n catalog,\n cluster,\n local,\n priority,\n service,\n url\n } = {}) {\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 /**\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((host) => !!(\n ServiceRegistry.mapCatalogName({\n id: host.catalog,\n type: SERVICE_CATALOGS_ENUM_TYPES.STRING\n })));\n\n // Load the eligible hosts.\n this.hosts.push(\n ...validHosts.map((loadableHost) => new ServiceHost(loadableHost))\n );\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(\n (host) => {\n host.setStatus({replaced: true});\n }\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(\n (host) => {\n host.setStatus({failed: false});\n }\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)) ?\n SERVICE_CATALOGS.indexOf(id) :\n 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;;AAIA;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;IACqBA,e;EACnB;AACF;AACA;AACA;AACA;AACA;AACA;EACE,2BAAc;IAAA;;IACZ;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;IACI,KAAKC,KAAL,GAAa,EAAb;EACD;EAED;AACF;AACA;AACA;AACA;AACA;AACA;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uB,CAAX;QAAA,CAArB,CADC,EAAN;QAWA,OAAOqD,MAAP;MACD,CAbM,EAaJ,EAbI,CAAP;IAcD"}
|
|
1
|
+
{"version":3,"names":["ServiceRegistry","hosts","find","active","local","priority","reduce","map","host","hostReference","service","url","filter","removing","includes","failing","forEach","setStatus","failed","catalog","catalogs","catalogId","mapCatalogName","id","type","SERVICE_CATALOGS_ENUM_TYPES","STRING","length","cluster","clusters","filteredHosts","currentHost","foundHost","hostGroup","push","foundHostCatalogPriority","NUMBER","currentHostCatalogPriority","splice","indexOf","services","urls","filterActive","filterCatalog","filterCluster","filterLocal","filterPriority","filterService","filterUrl","validHosts","loadableHost","ServiceHost","replacing","replaced","resetting","SERVICE_CATALOGS","undefined","hostCatalog","serviceLinks","catalogIndex","Error","output","key","defaultUri","split","uri"],"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;AACA;AAAyC;AAAA;AAEzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAHA,IAIqBA,eAAe;EAClC;AACF;AACA;AACA;AACA;AACA;AACA;EACE,2BAAc;IAAA;IACZ;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;IACI,IAAI,CAACC,KAAK,GAAG,EAAE;EACjB;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EAPE;IAAA;IAAA,KAQA,eAAU;MACR;MACA,OAAO,IAAI,CAACC,IAAI,CAAC;QACfC,MAAM,EAAE,IAAI;QACZC,KAAK,EAAE,IAAI;QACXC,QAAQ,EAAE;MACZ,CAAC,CAAC,CAACC,MAAM,CAAC,UAACC,GAAG,EAAEC,IAAI,EAAK;QACvB;QACA,IAAMC,aAAa,GAAG,CAAC,CA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