@webex/webex-core 3.8.1 → 3.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/README.md +87 -27
  2. package/dist/index.js +9 -33
  3. package/dist/index.js.map +1 -1
  4. package/dist/lib/batcher.js +1 -1
  5. package/dist/lib/constants.js +10 -1
  6. package/dist/lib/constants.js.map +1 -1
  7. package/dist/lib/credentials/credentials.js +1 -1
  8. package/dist/lib/credentials/token.js +1 -1
  9. package/dist/lib/{services-v2/interceptors → interceptors}/server-error.js +1 -1
  10. package/dist/lib/interceptors/server-error.js.map +1 -0
  11. package/dist/lib/services/index.js +2 -29
  12. package/dist/lib/services/index.js.map +1 -1
  13. package/dist/lib/services/service-host.js +1 -1
  14. package/dist/lib/services/service-host.js.map +1 -1
  15. package/dist/lib/services/service-registry.js +1 -1
  16. package/dist/lib/services/service-registry.js.map +1 -1
  17. package/dist/lib/services/service-state.js +1 -1
  18. package/dist/lib/services/service-state.js.map +1 -1
  19. package/dist/lib/services/services.js +3 -3
  20. package/dist/lib/services/services.js.map +1 -1
  21. package/dist/lib/services-v2/index.js +0 -29
  22. package/dist/lib/services-v2/index.js.map +1 -1
  23. package/dist/lib/services-v2/metrics.js.map +1 -1
  24. package/dist/lib/services-v2/service-catalog.js +11 -10
  25. package/dist/lib/services-v2/service-catalog.js.map +1 -1
  26. package/dist/lib/services-v2/services-v2.js +56 -67
  27. package/dist/lib/services-v2/services-v2.js.map +1 -1
  28. package/dist/lib/services-v2/types.js.map +1 -1
  29. package/dist/plugins/logger.js +1 -1
  30. package/dist/webex-core.js +3 -3
  31. package/dist/webex-core.js.map +1 -1
  32. package/package.json +13 -13
  33. package/src/index.js +5 -14
  34. package/src/lib/constants.js +29 -1
  35. package/src/lib/{services/interceptors → interceptors}/server-error.js +1 -1
  36. package/src/lib/services/index.js +2 -7
  37. package/src/lib/services/service-host.js +1 -1
  38. package/src/lib/services/service-registry.js +1 -1
  39. package/src/lib/services/service-state.js +1 -1
  40. package/src/lib/services/services.js +2 -2
  41. package/src/lib/services-v2/index.ts +0 -16
  42. package/src/lib/services-v2/service-catalog.ts +20 -19
  43. package/src/lib/services-v2/{services-v2.js → services-v2.ts} +116 -94
  44. package/src/lib/services-v2/types.ts +62 -2
  45. package/src/webex-core.js +1 -1
  46. package/test/fixtures/host-catalog-v2.ts +30 -122
  47. package/test/integration/spec/services/services.js +11 -0
  48. package/test/integration/spec/services-v2/service-catalog.js +664 -0
  49. package/test/integration/spec/services-v2/services-v2.js +1061 -0
  50. package/test/unit/spec/services-v2/service-detail.ts +1 -1
  51. package/test/unit/spec/services-v2/services-v2.ts +390 -436
  52. package/dist/lib/services/constants.js +0 -17
  53. package/dist/lib/services/constants.js.map +0 -1
  54. package/dist/lib/services/interceptors/hostmap.js +0 -64
  55. package/dist/lib/services/interceptors/hostmap.js.map +0 -1
  56. package/dist/lib/services/interceptors/server-error.js +0 -77
  57. package/dist/lib/services/interceptors/server-error.js.map +0 -1
  58. package/dist/lib/services/interceptors/service.js +0 -137
  59. package/dist/lib/services/interceptors/service.js.map +0 -1
  60. package/dist/lib/services-v2/constants.js +0 -17
  61. package/dist/lib/services-v2/constants.js.map +0 -1
  62. package/dist/lib/services-v2/interceptors/server-error.js.map +0 -1
  63. package/dist/lib/services-v2/service-host.js +0 -300
  64. package/dist/lib/services-v2/service-host.js.map +0 -1
  65. package/dist/lib/services-v2/service-registry.js +0 -534
  66. package/dist/lib/services-v2/service-registry.js.map +0 -1
  67. package/dist/lib/services-v2/service-state.js +0 -97
  68. package/dist/lib/services-v2/service-state.js.map +0 -1
  69. package/dist/lib/services-v2/service-url.js +0 -119
  70. package/dist/lib/services-v2/service-url.js.map +0 -1
  71. package/src/lib/services/constants.js +0 -21
  72. package/src/lib/services/interceptors/hostmap.js +0 -36
  73. package/src/lib/services/interceptors/service.js +0 -101
  74. package/src/lib/services-v2/constants.ts +0 -21
  75. package/src/lib/services-v2/interceptors/server-error.js +0 -48
  76. /package/dist/lib/{services-v2/interceptors → interceptors}/hostmap.js +0 -0
  77. /package/dist/lib/{services-v2/interceptors → interceptors}/hostmap.js.map +0 -0
  78. /package/dist/lib/{services-v2/interceptors → interceptors}/service.js +0 -0
  79. /package/dist/lib/{services-v2/interceptors → interceptors}/service.js.map +0 -0
  80. /package/dist/lib/{services/metrics.js → metrics.js} +0 -0
  81. /package/dist/lib/{services/metrics.js.map → metrics.js.map} +0 -0
  82. /package/src/lib/{services-v2/interceptors → interceptors}/hostmap.js +0 -0
  83. /package/src/lib/{services-v2/interceptors → interceptors}/service.js +0 -0
  84. /package/src/lib/{services-v2/metrics.js → metrics.js} +0 -0
  85. /package/src/lib/{services/metrics.js → services-v2/metrics.ts} +0 -0
@@ -1,534 +0,0 @@
1
- "use strict";
2
-
3
- var _Object$keys2 = require("@babel/runtime-corejs2/core-js/object/keys");
4
- var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs2/core-js/object/get-own-property-symbols");
5
- var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptor");
6
- var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptors");
7
- var _Object$defineProperties = require("@babel/runtime-corejs2/core-js/object/define-properties");
8
- var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
9
- var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
10
- _Object$defineProperty(exports, "__esModule", {
11
- value: true
12
- });
13
- exports.default = void 0;
14
- var _isArray = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/array/is-array"));
15
- var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
16
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/toConsumableArray"));
17
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
18
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
19
- var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
20
- var _constants = require("./constants");
21
- var _serviceHost = _interopRequireDefault(require("./service-host"));
22
- function ownKeys(e, r) { var t = _Object$keys2(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
23
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
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
- */
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
- */
49
- /**
50
- * @class
51
- * @classdesc - Manages a collection of {@link ServiceHost} class objects.
52
- */
53
- var ServiceRegistry = exports.default = /*#__PURE__*/function () {
54
- /**
55
- * Generate a new {@link ServiceHost}.
56
- *
57
- * @public
58
- * @constructor
59
- * @memberof ServiceHost
60
- */
61
- function ServiceRegistry() {
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
70
- */
71
- this.hosts = [];
72
- }
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>}
81
- */
82
- (0, _createClass2.default)(ServiceRegistry, [{
83
- key: "map",
84
- get: function get() {
85
- // Get a list of active, local, and priority-mapped hosts.
86
- return this.find({
87
- active: true,
88
- local: true,
89
- priority: true
90
- }).reduce(function (map, host) {
91
- // Generate a new object to assign the existing map.
92
- var hostReference = {};
93
-
94
- // Assign the key:value pair for the service and url.
95
- hostReference[host.service] = host.url;
96
-
97
- // Assign the reference to the map and return.
98
- return _objectSpread(_objectSpread({}, map), hostReference);
99
- }, {});
100
- }
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.
111
- */
112
- }, {
113
- key: "clear",
114
- value: function clear(filter) {
115
- // Collect a list of hosts to remove based on the provided filter.
116
- var removing = this.find(filter);
117
-
118
- // Remove the hosts from the array.
119
- this.hosts = this.hosts.filter(function (host) {
120
- return !removing.includes(host);
121
- });
122
-
123
- // Return the removed hosts.
124
- return removing;
125
- }
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.
136
- */
137
- }, {
138
- key: "failed",
139
- value: function failed(filter) {
140
- // Collect a list of hosts to mark as failed based on the provided filter.
141
- var failing = this.find(filter);
142
-
143
- // Mark the hosts from the array as failed.
144
- failing.forEach(function (host) {
145
- host.setStatus({
146
- failed: true
147
- });
148
- });
149
-
150
- // Return the marked hosts.
151
- return failing;
152
- }
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.
161
- */
162
- }, {
163
- key: "filterActive",
164
- value: function filterActive(active) {
165
- // Filter the host array if the active requirement is true.
166
- return typeof active === 'boolean' ? this.hosts.filter(function (host) {
167
- return host.active === active;
168
- }) : (0, _toConsumableArray2.default)(this.hosts);
169
- }
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.
179
- */
180
- }, {
181
- key: "filterCatalog",
182
- value: function filterCatalog() {
183
- var catalog = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
184
- // Generate a catalog names array based on the provided catalog param.
185
- var catalogs = ((0, _isArray.default)(catalog) ? catalog : [catalog]).map(function (catalogId) {
186
- return ServiceRegistry.mapCatalogName({
187
- id: catalogId,
188
- type: _constants.SERVICE_CATALOGS_ENUM_TYPES.STRING
189
- }) || catalogId;
190
- });
191
-
192
- // Filter the host array against the catalog names array.
193
- return catalogs.length > 0 ? this.hosts.filter(function (host) {
194
- return catalogs.includes(host.catalog);
195
- }) : (0, _toConsumableArray2.default)(this.hosts);
196
- }
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.
206
- */
207
- }, {
208
- key: "filterCluster",
209
- value: function filterCluster() {
210
- var cluster = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
211
- // Generate an array of clusters regardless of parameter type.
212
- var clusters = (0, _isArray.default)(cluster) ? cluster : [cluster];
213
-
214
- // Filter the host array against the provided clusters.
215
- return clusters.length > 0 ? this.hosts.filter(function (host) {
216
- return clusters.includes(host.id);
217
- }) : (0, _toConsumableArray2.default)(this.hosts);
218
- }
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.
228
- */
229
- }, {
230
- key: "filterLocal",
231
- value: function filterLocal(local) {
232
- return typeof local === 'boolean' ? this.hosts.filter(function (host) {
233
- return host.local === local;
234
- }) : (0, _toConsumableArray2.default)(this.hosts);
235
- }
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.
245
- */
246
- }, {
247
- key: "filterPriority",
248
- value: function filterPriority(priority) {
249
- return priority ? this.hosts.reduce(function (filteredHosts, currentHost) {
250
- // Validate that the current host is not active.
251
- if (!currentHost.active) {
252
- return filteredHosts;
253
- }
254
-
255
- // Determine if the filtered hosts array contains a host from the same
256
- // host group.
257
- var foundHost = filteredHosts.find(function (host) {
258
- return host.hostGroup === currentHost.hostGroup;
259
- });
260
-
261
- // Validate if a host was found.
262
- if (!foundHost) {
263
- filteredHosts.push(currentHost);
264
- return filteredHosts;
265
- }
266
-
267
- // Map the found host's catalog to its priority value.
268
- var foundHostCatalogPriority = ServiceRegistry.mapCatalogName({
269
- id: foundHost.catalog,
270
- type: _constants.SERVICE_CATALOGS_ENUM_TYPES.NUMBER
271
- });
272
-
273
- // Map the current host's catalog to its priority value.
274
- var currentHostCatalogPriority = ServiceRegistry.mapCatalogName({
275
- id: currentHost.catalog,
276
- type: _constants.SERVICE_CATALOGS_ENUM_TYPES.NUMBER
277
- });
278
-
279
- // Validate if the found host has a lower priority than the current
280
- // host.
281
- if (foundHostCatalogPriority < currentHostCatalogPriority || foundHost.priority < currentHost.priority) {
282
- filteredHosts.splice(filteredHosts.indexOf(foundHost, 1));
283
- filteredHosts.push(currentHost);
284
- }
285
- return filteredHosts;
286
- }, []) : (0, _toConsumableArray2.default)(this.hosts);
287
- }
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.
297
- */
298
- }, {
299
- key: "filterService",
300
- value: function filterService() {
301
- var service = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
302
- // Generate an array of services regardless of parameter type.
303
- var services = (0, _isArray.default)(service) ? service : [service];
304
-
305
- // Filter the host array against the provided services.
306
- return services.length > 0 ? this.hosts.filter(function (host) {
307
- return services.includes(host.service);
308
- }) : (0, _toConsumableArray2.default)(this.hosts);
309
- }
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.
319
- */
320
- }, {
321
- key: "filterUrl",
322
- value: function filterUrl() {
323
- var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
324
- // Generate an array of URLs regardless of the parameter type.
325
- var urls = (0, _isArray.default)(url) ? url : [url];
326
-
327
- // Filter the host array against the provided URLs.
328
- return urls.length > 0 ? this.hosts.filter(function (host) {
329
- return urls.includes(host.url);
330
- }) : (0, _toConsumableArray2.default)(this.hosts);
331
- }
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.
341
- */
342
- }, {
343
- key: "find",
344
- value: function find() {
345
- var _this = this;
346
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
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;
354
- return this.hosts.filter(function (host) {
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);
356
- });
357
- }
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}
368
- */
369
- }, {
370
- key: "load",
371
- value: function load() {
372
- var _this$hosts;
373
- var hosts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
374
- // Validate that the provided hosts are eligible to be loaded.
375
- var validHosts = hosts.filter(function (host) {
376
- return !!ServiceRegistry.mapCatalogName({
377
- id: host.catalog,
378
- type: _constants.SERVICE_CATALOGS_ENUM_TYPES.STRING
379
- });
380
- });
381
-
382
- // Load the eligible hosts.
383
- (_this$hosts = this.hosts).push.apply(_this$hosts, (0, _toConsumableArray2.default)(validHosts.map(function (loadableHost) {
384
- return new _serviceHost.default(loadableHost);
385
- })));
386
- return this;
387
- }
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.
398
- */
399
- }, {
400
- key: "replaced",
401
- value: function replaced(filter) {
402
- // Collect a list of hosts to mark as replaced based on the provided filter.
403
- var replacing = this.find(filter);
404
-
405
- // Mark the hosts from the array as replaced.
406
- replacing.forEach(function (host) {
407
- host.setStatus({
408
- replaced: true
409
- });
410
- });
411
-
412
- // Return the marked hosts.
413
- return replacing;
414
- }
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.
425
- */
426
- }, {
427
- key: "reset",
428
- value: function reset(filter) {
429
- // Collect a list of hosts to mark as replaced based on the provided filter.
430
- var resetting = this.find(filter);
431
-
432
- // Mark the hosts from the array as replaced.
433
- resetting.forEach(function (host) {
434
- host.setStatus({
435
- failed: false
436
- });
437
- });
438
-
439
- // Return the marked hosts.
440
- return resetting;
441
- }
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.
454
- */
455
- }], [{
456
- key: "mapCatalogName",
457
- value: function mapCatalogName(_ref2) {
458
- var id = _ref2.id,
459
- type = _ref2.type;
460
- // Validate that the id is a number.
461
- if (typeof id === 'number') {
462
- // Validate that the desired type is a number.
463
- if (type === _constants.SERVICE_CATALOGS_ENUM_TYPES.NUMBER) {
464
- return _constants.SERVICE_CATALOGS[id] !== undefined ? id : undefined;
465
- }
466
-
467
- // Validate that the desired type is a string.
468
- if (type === _constants.SERVICE_CATALOGS_ENUM_TYPES.STRING) {
469
- return _constants.SERVICE_CATALOGS[id];
470
- }
471
- }
472
-
473
- // Validate that the id is a string.
474
- if (typeof id === 'string') {
475
- // Validate that the desired type is a string.
476
- if (type === _constants.SERVICE_CATALOGS_ENUM_TYPES.STRING) {
477
- return _constants.SERVICE_CATALOGS.includes(id) ? id : undefined;
478
- }
479
-
480
- // Validate that the desired type is a number.
481
- if (type === _constants.SERVICE_CATALOGS_ENUM_TYPES.NUMBER) {
482
- return _constants.SERVICE_CATALOGS.includes(id) ? _constants.SERVICE_CATALOGS.indexOf(id) : undefined;
483
- }
484
- }
485
- return undefined;
486
- }
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>}
498
- */
499
- }, {
500
- key: "mapRemoteCatalog",
501
- value: function mapRemoteCatalog(_ref3) {
502
- var catalog = _ref3.catalog,
503
- hostCatalog = _ref3.hostCatalog,
504
- serviceLinks = _ref3.serviceLinks;
505
- // Collect the service catalog name if needed.
506
- var catalogIndex = ServiceRegistry.mapCatalogName({
507
- id: catalog,
508
- type: _constants.SERVICE_CATALOGS_ENUM_TYPES.STRING
509
- });
510
-
511
- // Validate that the target catalog exists.
512
- if (!_constants.SERVICE_CATALOGS.includes(catalogIndex)) {
513
- throw new Error("service-catalogs: '".concat(catalog, "' is not a valid catalog"));
514
- }
515
-
516
- // Map the remote catalog to a mountable host array.
517
- return (0, _keys.default)(hostCatalog).reduce(function (output, key) {
518
- output.push.apply(output, (0, _toConsumableArray2.default)(hostCatalog[key].map(function (host) {
519
- return {
520
- catalog: catalogIndex,
521
- defaultUri: serviceLinks[host.id.split(':')[3]],
522
- hostGroup: key,
523
- id: host.id,
524
- priority: host.priority,
525
- uri: host.host
526
- };
527
- })));
528
- return output;
529
- }, []);
530
- }
531
- }]);
532
- return ServiceRegistry;
533
- }();
534
- //# sourceMappingURL=service-registry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_constants","require","_serviceHost","_interopRequireDefault","ownKeys","e","r","t","_Object$keys2","_Object$getOwnPropertySymbols","o","filter","_Object$getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","Object","forEach","_defineProperty2","default","_Object$getOwnPropertyDescriptors","_Object$defineProperties","_Object$defineProperty","ServiceRegistry","exports","_classCallCheck2","hosts","_createClass2","key","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"],"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,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,aAAA,CAAAH,CAAA,OAAAI,6BAAA,QAAAC,CAAA,GAAAD,6BAAA,CAAAJ,CAAA,GAAAC,CAAA,KAAAI,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAL,CAAA,WAAAM,gCAAA,CAAAP,CAAA,EAAAC,CAAA,EAAAO,UAAA,OAAAN,CAAA,CAAAO,IAAA,CAAAC,KAAA,CAAAR,CAAA,EAAAG,CAAA,YAAAH,CAAA;AAAA,SAAAS,cAAAX,CAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAW,SAAA,CAAAC,MAAA,EAAAZ,CAAA,UAAAC,CAAA,WAAAU,SAAA,CAAAX,CAAA,IAAAW,SAAA,CAAAX,CAAA,QAAAA,CAAA,OAAAF,OAAA,CAAAe,MAAA,CAAAZ,CAAA,OAAAa,OAAA,WAAAd,CAAA,QAAAe,gBAAA,CAAAC,OAAA,EAAAjB,CAAA,EAAAC,CAAA,EAAAC,CAAA,CAAAD,CAAA,SAAAiB,iCAAA,GAAAC,wBAAA,CAAAnB,CAAA,EAAAkB,iCAAA,CAAAhB,CAAA,KAAAH,OAAA,CAAAe,MAAA,CAAAZ,CAAA,GAAAa,OAAA,WAAAd,CAAA,IAAAmB,sBAAA,CAAApB,CAAA,EAAAC,CAAA,EAAAM,gCAAA,CAAAL,CAAA,EAAAD,CAAA,iBAAAD,CAAA;AAEzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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