@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.
Files changed (184) hide show
  1. package/dist/config.js +1 -11
  2. package/dist/config.js.map +1 -1
  3. package/dist/credentials-config.js +44 -64
  4. package/dist/credentials-config.js.map +1 -1
  5. package/dist/index.js +0 -76
  6. package/dist/index.js.map +1 -1
  7. package/dist/interceptors/auth.js +22 -55
  8. package/dist/interceptors/auth.js.map +1 -1
  9. package/dist/interceptors/default-options.js +0 -20
  10. package/dist/interceptors/default-options.js.map +1 -1
  11. package/dist/interceptors/embargo.js +0 -21
  12. package/dist/interceptors/embargo.js.map +1 -1
  13. package/dist/interceptors/network-timing.js +2 -21
  14. package/dist/interceptors/network-timing.js.map +1 -1
  15. package/dist/interceptors/payload-transformer.js +2 -22
  16. package/dist/interceptors/payload-transformer.js.map +1 -1
  17. package/dist/interceptors/rate-limit.js +25 -57
  18. package/dist/interceptors/rate-limit.js.map +1 -1
  19. package/dist/interceptors/redirect.js +4 -33
  20. package/dist/interceptors/redirect.js.map +1 -1
  21. package/dist/interceptors/request-event.js +3 -30
  22. package/dist/interceptors/request-event.js.map +1 -1
  23. package/dist/interceptors/request-logger.js +1 -30
  24. package/dist/interceptors/request-logger.js.map +1 -1
  25. package/dist/interceptors/request-timing.js +3 -22
  26. package/dist/interceptors/request-timing.js.map +1 -1
  27. package/dist/interceptors/response-logger.js +2 -31
  28. package/dist/interceptors/response-logger.js.map +1 -1
  29. package/dist/interceptors/user-agent.js +2 -29
  30. package/dist/interceptors/user-agent.js.map +1 -1
  31. package/dist/interceptors/webex-tracking-id.js +5 -28
  32. package/dist/interceptors/webex-tracking-id.js.map +1 -1
  33. package/dist/interceptors/webex-user-agent.js +5 -38
  34. package/dist/interceptors/webex-user-agent.js.map +1 -1
  35. package/dist/lib/batcher.js +3 -51
  36. package/dist/lib/batcher.js.map +1 -1
  37. package/dist/lib/credentials/credentials.js +39 -119
  38. package/dist/lib/credentials/credentials.js.map +1 -1
  39. package/dist/lib/credentials/grant-errors.js +0 -49
  40. package/dist/lib/credentials/grant-errors.js.map +1 -1
  41. package/dist/lib/credentials/index.js +1 -13
  42. package/dist/lib/credentials/index.js.map +1 -1
  43. package/dist/lib/credentials/scope.js +1 -7
  44. package/dist/lib/credentials/scope.js.map +1 -1
  45. package/dist/lib/credentials/token-collection.js +1 -7
  46. package/dist/lib/credentials/token-collection.js.map +1 -1
  47. package/dist/lib/credentials/token.js +39 -118
  48. package/dist/lib/credentials/token.js.map +1 -1
  49. package/dist/lib/page.js +13 -26
  50. package/dist/lib/page.js.map +1 -1
  51. package/dist/lib/services/constants.js +0 -2
  52. package/dist/lib/services/constants.js.map +1 -1
  53. package/dist/lib/services/index.js +1 -28
  54. package/dist/lib/services/index.js.map +1 -1
  55. package/dist/lib/services/interceptors/server-error.js +2 -23
  56. package/dist/lib/services/interceptors/server-error.js.map +1 -1
  57. package/dist/lib/services/interceptors/service.js +12 -34
  58. package/dist/lib/services/interceptors/service.js.map +1 -1
  59. package/dist/lib/services/metrics.js +0 -2
  60. package/dist/lib/services/metrics.js.map +1 -1
  61. package/dist/lib/services/service-catalog.js +10 -90
  62. package/dist/lib/services/service-catalog.js.map +1 -1
  63. package/dist/lib/services/service-fed-ramp.js +0 -2
  64. package/dist/lib/services/service-fed-ramp.js.map +1 -1
  65. package/dist/lib/services/service-host.js +47 -62
  66. package/dist/lib/services/service-host.js.map +1 -1
  67. package/dist/lib/services/service-registry.js +78 -90
  68. package/dist/lib/services/service-registry.js.map +1 -1
  69. package/dist/lib/services/service-state.js +3 -15
  70. package/dist/lib/services/service-state.js.map +1 -1
  71. package/dist/lib/services/service-url.js +4 -25
  72. package/dist/lib/services/service-url.js.map +1 -1
  73. package/dist/lib/services/services.js +122 -238
  74. package/dist/lib/services/services.js.map +1 -1
  75. package/dist/lib/stateless-webex-plugin.js +5 -28
  76. package/dist/lib/stateless-webex-plugin.js.map +1 -1
  77. package/dist/lib/storage/decorators.js +19 -62
  78. package/dist/lib/storage/decorators.js.map +1 -1
  79. package/dist/lib/storage/errors.js +0 -23
  80. package/dist/lib/storage/errors.js.map +1 -1
  81. package/dist/lib/storage/index.js +2 -16
  82. package/dist/lib/storage/index.js.map +1 -1
  83. package/dist/lib/storage/make-webex-plugin-store.js +11 -41
  84. package/dist/lib/storage/make-webex-plugin-store.js.map +1 -1
  85. package/dist/lib/storage/make-webex-store.js +8 -30
  86. package/dist/lib/storage/make-webex-store.js.map +1 -1
  87. package/dist/lib/storage/memory-store-adapter.js +1 -19
  88. package/dist/lib/storage/memory-store-adapter.js.map +1 -1
  89. package/dist/lib/webex-core-plugin-mixin.js +9 -29
  90. package/dist/lib/webex-core-plugin-mixin.js.map +1 -1
  91. package/dist/lib/webex-http-error.js +1 -31
  92. package/dist/lib/webex-http-error.js.map +1 -1
  93. package/dist/lib/webex-internal-core-plugin-mixin.js +9 -29
  94. package/dist/lib/webex-internal-core-plugin-mixin.js.map +1 -1
  95. package/dist/lib/webex-plugin.js +6 -40
  96. package/dist/lib/webex-plugin.js.map +1 -1
  97. package/dist/plugins/logger.js +3 -17
  98. package/dist/plugins/logger.js.map +1 -1
  99. package/dist/webex-core.js +79 -203
  100. package/dist/webex-core.js.map +1 -1
  101. package/dist/webex-internal-core.js +0 -10
  102. package/dist/webex-internal-core.js.map +1 -1
  103. package/package.json +14 -14
  104. package/src/config.js +9 -11
  105. package/src/credentials-config.js +110 -72
  106. package/src/index.js +4 -14
  107. package/src/interceptors/auth.js +36 -37
  108. package/src/interceptors/default-options.js +0 -1
  109. package/src/interceptors/embargo.js +1 -1
  110. package/src/interceptors/payload-transformer.js +1 -2
  111. package/src/interceptors/rate-limit.js +8 -5
  112. package/src/interceptors/redirect.js +14 -8
  113. package/src/interceptors/request-event.js +4 -8
  114. package/src/interceptors/request-logger.js +8 -5
  115. package/src/interceptors/response-logger.js +11 -8
  116. package/src/interceptors/user-agent.js +1 -2
  117. package/src/interceptors/webex-user-agent.js +3 -9
  118. package/src/lib/batcher.js +70 -69
  119. package/src/lib/credentials/credentials.js +112 -122
  120. package/src/lib/credentials/grant-errors.js +6 -7
  121. package/src/lib/credentials/index.js +1 -4
  122. package/src/lib/credentials/scope.js +1 -4
  123. package/src/lib/credentials/token-collection.js +1 -1
  124. package/src/lib/credentials/token.js +86 -80
  125. package/src/lib/page.js +10 -11
  126. package/src/lib/services/constants.js +3 -13
  127. package/src/lib/services/index.js +2 -2
  128. package/src/lib/services/interceptors/server-error.js +12 -7
  129. package/src/lib/services/interceptors/service.js +6 -5
  130. package/src/lib/services/metrics.js +1 -1
  131. package/src/lib/services/service-catalog.js +110 -100
  132. package/src/lib/services/service-fed-ramp.js +1 -2
  133. package/src/lib/services/service-host.js +10 -17
  134. package/src/lib/services/service-registry.js +69 -96
  135. package/src/lib/services/service-state.js +4 -6
  136. package/src/lib/services/service-url.js +24 -23
  137. package/src/lib/services/services.js +260 -251
  138. package/src/lib/stateless-webex-plugin.js +4 -2
  139. package/src/lib/storage/decorators.js +68 -66
  140. package/src/lib/storage/index.js +4 -6
  141. package/src/lib/storage/make-webex-plugin-store.js +34 -21
  142. package/src/lib/storage/make-webex-store.js +6 -7
  143. package/src/lib/storage/memory-store-adapter.js +3 -3
  144. package/src/lib/webex-core-plugin-mixin.js +10 -7
  145. package/src/lib/webex-http-error.js +7 -8
  146. package/src/lib/webex-internal-core-plugin-mixin.js +9 -6
  147. package/src/lib/webex-plugin.js +41 -34
  148. package/src/plugins/logger.js +8 -3
  149. package/src/webex-core.js +185 -116
  150. package/src/webex-internal-core.js +15 -9
  151. package/test/integration/spec/credentials/credentials.js +26 -30
  152. package/test/integration/spec/credentials/token.js +36 -33
  153. package/test/integration/spec/services/service-catalog.js +177 -156
  154. package/test/integration/spec/services/services.js +313 -304
  155. package/test/integration/spec/webex-core.js +98 -86
  156. package/test/unit/spec/_setup.js +26 -18
  157. package/test/unit/spec/credentials/credentials.js +189 -154
  158. package/test/unit/spec/credentials/token.js +94 -76
  159. package/test/unit/spec/interceptors/auth.js +291 -243
  160. package/test/unit/spec/interceptors/default-options.js +36 -24
  161. package/test/unit/spec/interceptors/embargo.js +32 -27
  162. package/test/unit/spec/interceptors/network-timing.js +2 -2
  163. package/test/unit/spec/interceptors/payload-transformer.js +61 -52
  164. package/test/unit/spec/interceptors/rate-limit.js +104 -75
  165. package/test/unit/spec/interceptors/redirect.js +22 -20
  166. package/test/unit/spec/interceptors/request-timing.js +18 -22
  167. package/test/unit/spec/interceptors/user-agent.js +28 -16
  168. package/test/unit/spec/interceptors/webex-tracking-id.js +14 -8
  169. package/test/unit/spec/interceptors/webex-user-agent.js +83 -37
  170. package/test/unit/spec/lib/batcher.js +36 -32
  171. package/test/unit/spec/lib/page.js +36 -32
  172. package/test/unit/spec/lib/webex-plugin.js +1 -1
  173. package/test/unit/spec/services/interceptors/server-error.js +67 -90
  174. package/test/unit/spec/services/interceptors/service.js +17 -28
  175. package/test/unit/spec/services/service-catalog.js +19 -27
  176. package/test/unit/spec/services/service-host.js +29 -26
  177. package/test/unit/spec/services/service-registry.js +128 -170
  178. package/test/unit/spec/services/service-state.js +13 -22
  179. package/test/unit/spec/services/service-url.js +24 -43
  180. package/test/unit/spec/services/services.js +85 -41
  181. package/test/unit/spec/storage/persist.js +6 -9
  182. package/test/unit/spec/storage/wait-for-value.js +22 -21
  183. package/test/unit/spec/webex-core.js +78 -57
  184. package/test/unit/spec/webex-internal-core.js +56 -31
@@ -12,37 +12,45 @@ const ServiceCatalog = AmpState.extend({
12
12
  namespace: 'ServiceCatalog',
13
13
 
14
14
  props: {
15
- serviceGroups: ['object', true, (() => ({
16
- discovery: [],
17
- override: [],
18
- preauth: [],
19
- postauth: [],
20
- signin: []
21
- }))],
22
- status: ['object', true, (() => ({
23
- discovery: {
24
- ready: false,
25
- collecting: false
26
- },
27
- override: {
28
- ready: false,
29
- collecting: false
30
- },
31
- preauth: {
32
- ready: false,
33
- collecting: false
34
- },
35
- postauth: {
36
- ready: false,
37
- collecting: false
38
- },
39
- signin: {
40
- ready: false,
41
- collecting: false
42
- }
43
- }))],
15
+ serviceGroups: [
16
+ 'object',
17
+ true,
18
+ () => ({
19
+ discovery: [],
20
+ override: [],
21
+ preauth: [],
22
+ postauth: [],
23
+ signin: [],
24
+ }),
25
+ ],
26
+ status: [
27
+ 'object',
28
+ true,
29
+ () => ({
30
+ discovery: {
31
+ ready: false,
32
+ collecting: false,
33
+ },
34
+ override: {
35
+ ready: false,
36
+ collecting: false,
37
+ },
38
+ preauth: {
39
+ ready: false,
40
+ collecting: false,
41
+ },
42
+ postauth: {
43
+ ready: false,
44
+ collecting: false,
45
+ },
46
+ signin: {
47
+ ready: false,
48
+ collecting: false,
49
+ },
50
+ }),
51
+ ],
44
52
  isReady: ['boolean', false, false],
45
- allowedDomains: ['array', false, (() => [])]
53
+ allowedDomains: ['array', false, () => []],
46
54
  },
47
55
 
48
56
  /**
@@ -54,15 +62,16 @@ const ServiceCatalog = AmpState.extend({
54
62
  * @returns {ServiceUrl}
55
63
  */
56
64
  _getUrl(name, serviceGroup) {
57
- const serviceUrls = (typeof serviceGroup === 'string') ?
58
- this.serviceGroups[serviceGroup] || [] :
59
- [
60
- ...this.serviceGroups.override,
61
- ...this.serviceGroups.postauth,
62
- ...this.serviceGroups.signin,
63
- ...this.serviceGroups.preauth,
64
- ...this.serviceGroups.discovery
65
- ];
65
+ const serviceUrls =
66
+ typeof serviceGroup === 'string'
67
+ ? this.serviceGroups[serviceGroup] || []
68
+ : [
69
+ ...this.serviceGroups.override,
70
+ ...this.serviceGroups.postauth,
71
+ ...this.serviceGroups.signin,
72
+ ...this.serviceGroups.preauth,
73
+ ...this.serviceGroups.discovery,
74
+ ];
66
75
 
67
76
  return serviceUrls.find((serviceUrl) => serviceUrl.name === name);
68
77
  },
@@ -79,7 +88,7 @@ const ServiceCatalog = AmpState.extend({
79
88
  ...this.serviceGroups.postauth,
80
89
  ...this.serviceGroups.signin,
81
90
  ...this.serviceGroups.preauth,
82
- ...this.serviceGroups.discovery
91
+ ...this.serviceGroups.discovery,
83
92
  ];
84
93
  },
85
94
 
@@ -121,7 +130,8 @@ const ServiceCatalog = AmpState.extend({
121
130
 
122
131
  if (existingService) {
123
132
  this.serviceGroups[serviceGroup].splice(
124
- this.serviceGroups[serviceGroup].indexOf(existingService), 1
133
+ this.serviceGroups[serviceGroup].indexOf(existingService),
134
+ 1
125
135
  );
126
136
  }
127
137
  });
@@ -163,8 +173,7 @@ const ServiceCatalog = AmpState.extend({
163
173
  }
164
174
  }
165
175
 
166
- if (serviceUrlObj.hostname === incomingUrlObj.hostname &&
167
- service.hosts.length > 0) {
176
+ if (serviceUrlObj.hostname === incomingUrlObj.hostname && service.hosts.length > 0) {
168
177
  // no exact match, so try to grab the first home cluster
169
178
  for (const host of service.hosts) {
170
179
  if (host.homeCluster) {
@@ -196,25 +205,25 @@ const ServiceCatalog = AmpState.extend({
196
205
  * @returns {string} service.url
197
206
  */
198
207
  findServiceFromClusterId({clusterId, priorityHost = true, serviceGroup} = {}) {
199
- const serviceUrls = (typeof serviceGroup === 'string') ?
200
- this.serviceGroups[serviceGroup] || [] : [
201
- ...this.serviceGroups.override,
202
- ...this.serviceGroups.postauth,
203
- ...this.serviceGroups.signin,
204
- ...this.serviceGroups.preauth,
205
- ...this.serviceGroups.discovery
206
- ];
207
-
208
- const identifiedServiceUrl = serviceUrls.find(
209
- (serviceUrl) => serviceUrl.hosts.find(
210
- (host) => host.id === clusterId
211
- )
208
+ const serviceUrls =
209
+ typeof serviceGroup === 'string'
210
+ ? this.serviceGroups[serviceGroup] || []
211
+ : [
212
+ ...this.serviceGroups.override,
213
+ ...this.serviceGroups.postauth,
214
+ ...this.serviceGroups.signin,
215
+ ...this.serviceGroups.preauth,
216
+ ...this.serviceGroups.discovery,
217
+ ];
218
+
219
+ const identifiedServiceUrl = serviceUrls.find((serviceUrl) =>
220
+ serviceUrl.hosts.find((host) => host.id === clusterId)
212
221
  );
213
222
 
214
223
  if (identifiedServiceUrl) {
215
224
  return {
216
225
  name: identifiedServiceUrl.name,
217
- url: identifiedServiceUrl.get(priorityHost, clusterId)
226
+ url: identifiedServiceUrl.get(priorityHost, clusterId),
218
227
  };
219
228
  }
220
229
 
@@ -233,23 +242,20 @@ const ServiceCatalog = AmpState.extend({
233
242
  ...this.serviceGroups.preauth,
234
243
  ...this.serviceGroups.signin,
235
244
  ...this.serviceGroups.postauth,
236
- ...this.serviceGroups.override
245
+ ...this.serviceGroups.override,
237
246
  ];
238
247
 
239
- return serviceUrls.find(
240
- (serviceUrl) => {
241
- if (incomingUrlObj.hostname ===
242
- Url.parse(serviceUrl.defaultUrl).hostname) {
243
- return true;
244
- }
245
-
246
- if (serviceUrl.hosts.find((host) => host.host === incomingUrlObj.hostname)) {
247
- return true;
248
- }
248
+ return serviceUrls.find((serviceUrl) => {
249
+ if (incomingUrlObj.hostname === Url.parse(serviceUrl.defaultUrl).hostname) {
250
+ return true;
251
+ }
249
252
 
250
- return false;
253
+ if (serviceUrl.hosts.find((host) => host.host === incomingUrlObj.hostname)) {
254
+ return true;
251
255
  }
252
- );
256
+
257
+ return false;
258
+ });
253
259
  },
254
260
 
255
261
  /**
@@ -265,9 +271,7 @@ const ServiceCatalog = AmpState.extend({
265
271
  return undefined;
266
272
  }
267
273
 
268
- return this.allowedDomains.find(
269
- (allowedDomain) => urlObj.host.includes(allowedDomain)
270
- );
274
+ return this.allowedDomains.find((allowedDomain) => urlObj.host.includes(allowedDomain));
271
275
  },
272
276
 
273
277
  /**
@@ -280,7 +284,7 @@ const ServiceCatalog = AmpState.extend({
280
284
  get(name, priorityHost, serviceGroup) {
281
285
  const serviceUrl = this._getUrl(name, serviceGroup);
282
286
 
283
- return (serviceUrl) ? serviceUrl.get(priorityHost) : undefined;
287
+ return serviceUrl ? serviceUrl.get(priorityHost) : undefined;
284
288
  },
285
289
 
286
290
  /**
@@ -302,15 +306,16 @@ const ServiceCatalog = AmpState.extend({
302
306
  list(priorityHost, serviceGroup) {
303
307
  const output = {};
304
308
 
305
- const serviceUrls = (typeof serviceGroup === 'string') ?
306
- this.serviceGroups[serviceGroup] || [] :
307
- [
308
- ...this.serviceGroups.discovery,
309
- ...this.serviceGroups.preauth,
310
- ...this.serviceGroups.signin,
311
- ...this.serviceGroups.postauth,
312
- ...this.serviceGroups.override
313
- ];
309
+ const serviceUrls =
310
+ typeof serviceGroup === 'string'
311
+ ? this.serviceGroups[serviceGroup] || []
312
+ : [
313
+ ...this.serviceGroups.discovery,
314
+ ...this.serviceGroups.preauth,
315
+ ...this.serviceGroups.signin,
316
+ ...this.serviceGroups.postauth,
317
+ ...this.serviceGroups.override,
318
+ ];
314
319
 
315
320
  if (serviceUrls) {
316
321
  serviceUrls.forEach((serviceUrl) => {
@@ -335,15 +340,15 @@ const ServiceCatalog = AmpState.extend({
335
340
  * @returns {string}
336
341
  */
337
342
  markFailedUrl(url, noPriorityHosts) {
338
- const serviceUrl = this._getUrl(Object.keys(this.list()).find(
339
- (key) => this._getUrl(key).failHost(url)
340
- ));
343
+ const serviceUrl = this._getUrl(
344
+ Object.keys(this.list()).find((key) => this._getUrl(key).failHost(url))
345
+ );
341
346
 
342
347
  if (!serviceUrl) {
343
348
  return undefined;
344
349
  }
345
350
 
346
- return (noPriorityHosts) ? serviceUrl.get(false) : serviceUrl.get(true);
351
+ return noPriorityHosts ? serviceUrl.get(false) : serviceUrl.get(true);
347
352
  },
348
353
 
349
354
  /**
@@ -368,10 +373,8 @@ const ServiceCatalog = AmpState.extend({
368
373
  updateServiceUrls(serviceGroup, serviceHostmap) {
369
374
  const currentServiceUrls = this.serviceGroups[serviceGroup];
370
375
 
371
- const unusedUrls = currentServiceUrls.filter(
372
- (serviceUrl) => serviceHostmap.every(
373
- (item) => item.name !== serviceUrl.name
374
- )
376
+ const unusedUrls = currentServiceUrls.filter((serviceUrl) =>
377
+ serviceHostmap.every((item) => item.name !== serviceUrl.name)
375
378
  );
376
379
 
377
380
  this._unloadServiceUrls(serviceGroup, unusedUrls);
@@ -382,11 +385,12 @@ const ServiceCatalog = AmpState.extend({
382
385
  if (service) {
383
386
  service.defaultUrl = serviceObj.defaultUrl;
384
387
  service.hosts = serviceObj.hosts || [];
385
- }
386
- else {
387
- this._loadServiceUrls(serviceGroup, [new ServiceUrl({
388
- ...serviceObj
389
- })]);
388
+ } else {
389
+ this._loadServiceUrls(serviceGroup, [
390
+ new ServiceUrl({
391
+ ...serviceObj,
392
+ }),
393
+ ]);
390
394
  }
391
395
  });
392
396
 
@@ -409,16 +413,22 @@ const ServiceCatalog = AmpState.extend({
409
413
  resolve();
410
414
  }
411
415
 
412
- const timeoutTimer = setTimeout(() => reject(
413
- new Error(`services: timeout occured while waiting for '${serviceGroup}' catalog to populate`)
414
- ), (timeout) ? timeout * 1000 : 60000);
416
+ const timeoutTimer = setTimeout(
417
+ () =>
418
+ reject(
419
+ new Error(
420
+ `services: timeout occured while waiting for '${serviceGroup}' catalog to populate`
421
+ )
422
+ ),
423
+ timeout ? timeout * 1000 : 60000
424
+ );
415
425
 
416
426
  this.once(serviceGroup, () => {
417
427
  clearTimeout(timeoutTimer);
418
428
  resolve();
419
429
  });
420
430
  });
421
- }
431
+ },
422
432
  });
423
433
  /* eslint-enable no-underscore-dangle */
424
434
 
@@ -1,5 +1,4 @@
1
-
2
1
  export default {
3
2
  hydra: 'https://api-usgov.webex.com/v1',
4
- u2c: 'https://u2c.gov.ciscospark.com/u2c/api/v1'
3
+ u2c: 'https://u2c.gov.ciscospark.com/u2c/api/v1',
5
4
  };
@@ -133,7 +133,7 @@ export default class ServiceHost {
133
133
  */
134
134
  get active() {
135
135
  // Validate that the `ServiceHost` was not marked as failed or replaced.
136
- return (!this.failed && !this.replaced);
136
+ return !this.failed && !this.replaced;
137
137
  }
138
138
 
139
139
  /**
@@ -212,9 +212,9 @@ export default class ServiceHost {
212
212
  catalog,
213
213
  defaultUri: url,
214
214
  hostGroup: Url.parse(url).host,
215
- id: (name) ? `poly-head:poly-group:poly-cluster:${name}` : undefined,
215
+ id: name ? `poly-head:poly-group:poly-cluster:${name}` : undefined,
216
216
  priority: 1,
217
- uri: Url.parse(url).host
217
+ uri: Url.parse(url).host,
218
218
  });
219
219
  }
220
220
 
@@ -228,14 +228,7 @@ export default class ServiceHost {
228
228
  * @throws - If the parameter transfer object is not valid.
229
229
  * @returns {undefined}
230
230
  */
231
- static validate({
232
- catalog,
233
- defaultUri,
234
- hostGroup,
235
- id,
236
- priority,
237
- uri
238
- }) {
231
+ static validate({catalog, defaultUri, hostGroup, id, priority, uri}) {
239
232
  // Generate error-throwing method.
240
233
  const throwError = (msg) => {
241
234
  throw new Error(`service-host: invalid constructor parameters, ${msg}`);
@@ -243,32 +236,32 @@ export default class ServiceHost {
243
236
 
244
237
  // Validate the catalog property.
245
238
  if (!SERVICE_CATALOGS.includes(catalog)) {
246
- throwError('\'catalog\' must be a string');
239
+ throwError("'catalog' must be a string");
247
240
  }
248
241
 
249
242
  // Validate the `defaultUri` property.
250
243
  if (typeof defaultUri !== 'string') {
251
- throwError('\'defaultUri\' must be a string');
244
+ throwError("'defaultUri' must be a string");
252
245
  }
253
246
 
254
247
  // Validate the `hostGroup` property.
255
248
  if (typeof hostGroup !== 'string') {
256
- throwError('\'hostGroup\' must be a string');
249
+ throwError("'hostGroup' must be a string");
257
250
  }
258
251
 
259
252
  // Validate the `id` property.
260
253
  if (typeof id !== 'string' || id.split(':').length !== 4) {
261
- throwError('\'id\' must be a string that contains 3 \':\' characters');
254
+ throwError("'id' must be a string that contains 3 ':' characters");
262
255
  }
263
256
 
264
257
  // Validate the `priority` property.
265
258
  if (typeof priority !== 'number') {
266
- throwError('\'priority\' must be a number');
259
+ throwError("'priority' must be a number");
267
260
  }
268
261
 
269
262
  // Validate the `uri` property.
270
263
  if (typeof uri !== 'string') {
271
- throwError('\'uri\' must be a string');
264
+ throwError("'uri' must be a string");
272
265
  }
273
266
  }
274
267
  }