@webex/webex-core 3.3.0 → 3.3.1-next.10
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 -1
- package/dist/config.js.map +1 -1
- package/dist/lib/batcher.js +1 -1
- package/dist/lib/credentials/credentials.js +1 -1
- package/dist/lib/credentials/token.js +1 -1
- package/dist/lib/services/constants.js +4 -1
- package/dist/lib/services/constants.js.map +1 -1
- package/dist/lib/services/service-catalog.js +30 -6
- package/dist/lib/services/service-catalog.js.map +1 -1
- package/dist/lib/services/services.js +62 -48
- package/dist/lib/services/services.js.map +1 -1
- package/dist/plugins/logger.js +1 -1
- package/dist/webex-core.js +2 -2
- package/dist/webex-core.js.map +1 -1
- package/package.json +13 -13
- package/src/config.js +1 -10
- package/src/lib/services/constants.js +13 -1
- package/src/lib/services/service-catalog.js +22 -4
- package/src/lib/services/services.js +65 -45
- package/test/integration/spec/services/services.js +13 -6
- package/test/unit/spec/interceptors/auth.js +16 -7
- package/test/unit/spec/services/service-catalog.js +78 -16
- package/test/unit/spec/services/services.js +190 -10
|
@@ -301,6 +301,9 @@ describe('webex-core', () => {
|
|
|
301
301
|
'example-b': 'https://example-b.com/api/v1',
|
|
302
302
|
'example-c': 'https://example-c.com/api/v1',
|
|
303
303
|
'example-d': 'https://example-d.com/api/v1',
|
|
304
|
+
'example-e': 'https://example-e.com/api/v1',
|
|
305
|
+
'example-f': 'https://example-f.com/api/v1',
|
|
306
|
+
'example-g': 'https://example-g.com/api/v1',
|
|
304
307
|
},
|
|
305
308
|
hostCatalog: {
|
|
306
309
|
'example-a.com': [
|
|
@@ -383,6 +386,48 @@ describe('webex-core', () => {
|
|
|
383
386
|
id: '0:0:0:example-d-x',
|
|
384
387
|
},
|
|
385
388
|
],
|
|
389
|
+
'example-e.com': [
|
|
390
|
+
{
|
|
391
|
+
host: 'example-e-1.com',
|
|
392
|
+
ttl: -1,
|
|
393
|
+
priority: 5,
|
|
394
|
+
id: '0:0:0:different-e',
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
host: 'example-e-2.com',
|
|
398
|
+
ttl: -1,
|
|
399
|
+
priority: 3,
|
|
400
|
+
id: '0:0:0:different-e',
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
host: 'example-e-3.com',
|
|
404
|
+
ttl: -1,
|
|
405
|
+
priority: 1,
|
|
406
|
+
id: '0:0:0:different-e',
|
|
407
|
+
},
|
|
408
|
+
],
|
|
409
|
+
'example-e-1.com': [
|
|
410
|
+
{
|
|
411
|
+
host: 'example-e-4.com',
|
|
412
|
+
ttl: -1,
|
|
413
|
+
priority: 5,
|
|
414
|
+
id: '0:0:0:different-e',
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
host: 'example-e-5.com',
|
|
418
|
+
ttl: -1,
|
|
419
|
+
priority: 3,
|
|
420
|
+
id: '0:0:0:different-e',
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
host: 'example-e-3.com',
|
|
424
|
+
ttl: -1,
|
|
425
|
+
priority: 1,
|
|
426
|
+
id: '0:0:0:different-e-x',
|
|
427
|
+
},
|
|
428
|
+
],
|
|
429
|
+
'example-f.com': [
|
|
430
|
+
],
|
|
386
431
|
},
|
|
387
432
|
format: 'hostmap',
|
|
388
433
|
};
|
|
@@ -440,16 +485,6 @@ describe('webex-core', () => {
|
|
|
440
485
|
});
|
|
441
486
|
});
|
|
442
487
|
|
|
443
|
-
it('creates a formmated host map containing all received host map host entries', () => {
|
|
444
|
-
formattedHM = services._formatReceivedHostmap(serviceHostmap);
|
|
445
|
-
|
|
446
|
-
formattedHM.forEach((service) => {
|
|
447
|
-
const foundHosts = serviceHostmap.hostCatalog[service.defaultHost];
|
|
448
|
-
|
|
449
|
-
assert.isDefined(foundHosts);
|
|
450
|
-
});
|
|
451
|
-
});
|
|
452
|
-
|
|
453
488
|
it('creates an array with matching names', () => {
|
|
454
489
|
formattedHM = services._formatReceivedHostmap(serviceHostmap);
|
|
455
490
|
|
|
@@ -459,6 +494,151 @@ describe('webex-core', () => {
|
|
|
459
494
|
);
|
|
460
495
|
});
|
|
461
496
|
|
|
497
|
+
it('creates the expected formatted host map', () => {
|
|
498
|
+
formattedHM = services._formatReceivedHostmap(serviceHostmap);
|
|
499
|
+
|
|
500
|
+
assert.deepEqual(formattedHM, [
|
|
501
|
+
{
|
|
502
|
+
defaultHost: 'example-a.com',
|
|
503
|
+
defaultUrl: 'https://example-a.com/api/v1',
|
|
504
|
+
hosts: [
|
|
505
|
+
{
|
|
506
|
+
homeCluster: true,
|
|
507
|
+
host: 'example-a-1.com',
|
|
508
|
+
id: '0:0:0:example-a',
|
|
509
|
+
priority: 5,
|
|
510
|
+
ttl: -1,
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
homeCluster: true,
|
|
514
|
+
host: 'example-a-2.com',
|
|
515
|
+
id: '0:0:0:example-a',
|
|
516
|
+
priority: 3,
|
|
517
|
+
ttl: -1,
|
|
518
|
+
},
|
|
519
|
+
],
|
|
520
|
+
name: 'example-a',
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
defaultHost: 'example-b.com',
|
|
524
|
+
defaultUrl: 'https://example-b.com/api/v1',
|
|
525
|
+
hosts: [
|
|
526
|
+
{
|
|
527
|
+
homeCluster: true,
|
|
528
|
+
host: 'example-b-1.com',
|
|
529
|
+
id: '0:0:0:example-b',
|
|
530
|
+
priority: 5,
|
|
531
|
+
ttl: -1,
|
|
532
|
+
},
|
|
533
|
+
{
|
|
534
|
+
homeCluster: true,
|
|
535
|
+
host: 'example-b-2.com',
|
|
536
|
+
id: '0:0:0:example-b',
|
|
537
|
+
priority: 3,
|
|
538
|
+
ttl: -1,
|
|
539
|
+
},
|
|
540
|
+
],
|
|
541
|
+
name: 'example-b',
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
defaultHost: 'example-c.com',
|
|
545
|
+
defaultUrl: 'https://example-c.com/api/v1',
|
|
546
|
+
hosts: [
|
|
547
|
+
{
|
|
548
|
+
homeCluster: true,
|
|
549
|
+
host: 'example-c-1.com',
|
|
550
|
+
id: '0:0:0:example-c',
|
|
551
|
+
priority: 5,
|
|
552
|
+
ttl: -1,
|
|
553
|
+
},
|
|
554
|
+
{
|
|
555
|
+
homeCluster: true,
|
|
556
|
+
host: 'example-c-2.com',
|
|
557
|
+
id: '0:0:0:example-c',
|
|
558
|
+
priority: 3,
|
|
559
|
+
ttl: -1,
|
|
560
|
+
},
|
|
561
|
+
],
|
|
562
|
+
name: 'example-c',
|
|
563
|
+
},
|
|
564
|
+
{
|
|
565
|
+
defaultHost: 'example-d.com',
|
|
566
|
+
defaultUrl: 'https://example-d.com/api/v1',
|
|
567
|
+
hosts: [
|
|
568
|
+
{
|
|
569
|
+
homeCluster: true,
|
|
570
|
+
host: 'example-c-1.com',
|
|
571
|
+
id: '0:0:0:example-d',
|
|
572
|
+
priority: 5,
|
|
573
|
+
ttl: -1,
|
|
574
|
+
},
|
|
575
|
+
{
|
|
576
|
+
homeCluster: true,
|
|
577
|
+
host: 'example-c-2.com',
|
|
578
|
+
id: '0:0:0:example-d',
|
|
579
|
+
priority: 3,
|
|
580
|
+
ttl: -1,
|
|
581
|
+
},
|
|
582
|
+
],
|
|
583
|
+
name: 'example-d',
|
|
584
|
+
},
|
|
585
|
+
{
|
|
586
|
+
defaultHost: 'example-e.com',
|
|
587
|
+
defaultUrl: 'https://example-e.com/api/v1',
|
|
588
|
+
hosts: [
|
|
589
|
+
{
|
|
590
|
+
homeCluster: true,
|
|
591
|
+
host: 'example-e-1.com',
|
|
592
|
+
id: '0:0:0:different-e',
|
|
593
|
+
priority: 5,
|
|
594
|
+
ttl: -1,
|
|
595
|
+
},
|
|
596
|
+
{
|
|
597
|
+
homeCluster: true,
|
|
598
|
+
host: 'example-e-2.com',
|
|
599
|
+
id: '0:0:0:different-e',
|
|
600
|
+
priority: 3,
|
|
601
|
+
ttl: -1,
|
|
602
|
+
},
|
|
603
|
+
{
|
|
604
|
+
homeCluster: true,
|
|
605
|
+
host: 'example-e-3.com',
|
|
606
|
+
id: '0:0:0:different-e',
|
|
607
|
+
priority: 1,
|
|
608
|
+
ttl: -1,
|
|
609
|
+
},
|
|
610
|
+
{
|
|
611
|
+
homeCluster: false,
|
|
612
|
+
host: 'example-e-4.com',
|
|
613
|
+
id: '0:0:0:different-e',
|
|
614
|
+
priority: 5,
|
|
615
|
+
ttl: -1,
|
|
616
|
+
},
|
|
617
|
+
{
|
|
618
|
+
homeCluster: false,
|
|
619
|
+
host: 'example-e-5.com',
|
|
620
|
+
id: '0:0:0:different-e',
|
|
621
|
+
priority: 3,
|
|
622
|
+
ttl: -1,
|
|
623
|
+
},
|
|
624
|
+
],
|
|
625
|
+
name: 'example-e',
|
|
626
|
+
},
|
|
627
|
+
{
|
|
628
|
+
defaultHost: 'example-f.com',
|
|
629
|
+
defaultUrl: 'https://example-f.com/api/v1',
|
|
630
|
+
hosts: [],
|
|
631
|
+
name: 'example-f',
|
|
632
|
+
},
|
|
633
|
+
{
|
|
634
|
+
defaultHost: 'example-g.com',
|
|
635
|
+
defaultUrl: 'https://example-g.com/api/v1',
|
|
636
|
+
hosts: [],
|
|
637
|
+
name: 'example-g',
|
|
638
|
+
}
|
|
639
|
+
]);
|
|
640
|
+
});
|
|
641
|
+
|
|
462
642
|
it('has hostCatalog updated', () => {
|
|
463
643
|
services._formatReceivedHostmap(serviceHostmap);
|
|
464
644
|
|