@webex/webex-core 3.8.1 → 3.9.0-next.2

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 (89) hide show
  1. package/README.md +87 -27
  2. package/dist/index.js +16 -33
  3. package/dist/index.js.map +1 -1
  4. package/dist/{lib/services/interceptors/hostmap.js → interceptors/proxy.js} +58 -25
  5. package/dist/interceptors/proxy.js.map +1 -0
  6. package/dist/lib/batcher.js +1 -1
  7. package/dist/lib/constants.js +10 -1
  8. package/dist/lib/constants.js.map +1 -1
  9. package/dist/lib/credentials/credentials.js +1 -1
  10. package/dist/lib/credentials/token.js +1 -1
  11. package/dist/lib/{services-v2/interceptors → interceptors}/server-error.js +1 -1
  12. package/dist/lib/interceptors/server-error.js.map +1 -0
  13. package/dist/lib/services/index.js +2 -29
  14. package/dist/lib/services/index.js.map +1 -1
  15. package/dist/lib/services/service-host.js +1 -1
  16. package/dist/lib/services/service-host.js.map +1 -1
  17. package/dist/lib/services/service-registry.js +1 -1
  18. package/dist/lib/services/service-registry.js.map +1 -1
  19. package/dist/lib/services/service-state.js +1 -1
  20. package/dist/lib/services/service-state.js.map +1 -1
  21. package/dist/lib/services/services.js +3 -3
  22. package/dist/lib/services/services.js.map +1 -1
  23. package/dist/lib/services-v2/index.js +0 -29
  24. package/dist/lib/services-v2/index.js.map +1 -1
  25. package/dist/lib/services-v2/metrics.js.map +1 -1
  26. package/dist/lib/services-v2/service-catalog.js +11 -10
  27. package/dist/lib/services-v2/service-catalog.js.map +1 -1
  28. package/dist/lib/services-v2/services-v2.js +56 -67
  29. package/dist/lib/services-v2/services-v2.js.map +1 -1
  30. package/dist/lib/services-v2/types.js.map +1 -1
  31. package/dist/plugins/logger.js +1 -1
  32. package/dist/webex-core.js +52 -60
  33. package/dist/webex-core.js.map +1 -1
  34. package/package.json +13 -13
  35. package/src/index.js +6 -14
  36. package/src/interceptors/proxy.js +70 -0
  37. package/src/lib/constants.js +29 -1
  38. package/src/lib/{services/interceptors → interceptors}/server-error.js +1 -1
  39. package/src/lib/services/index.js +2 -7
  40. package/src/lib/services/service-host.js +1 -1
  41. package/src/lib/services/service-registry.js +1 -1
  42. package/src/lib/services/service-state.js +1 -1
  43. package/src/lib/services/services.js +2 -2
  44. package/src/lib/services-v2/index.ts +0 -16
  45. package/src/lib/services-v2/service-catalog.ts +20 -19
  46. package/src/lib/services-v2/{services-v2.js → services-v2.ts} +116 -94
  47. package/src/lib/services-v2/types.ts +62 -2
  48. package/src/webex-core.js +11 -3
  49. package/test/fixtures/host-catalog-v2.ts +30 -122
  50. package/test/integration/spec/services/services.js +11 -0
  51. package/test/integration/spec/services-v2/service-catalog.js +664 -0
  52. package/test/integration/spec/services-v2/services-v2.js +1061 -0
  53. package/test/unit/spec/interceptors/proxy.js +73 -0
  54. package/test/unit/spec/services-v2/service-detail.ts +1 -1
  55. package/test/unit/spec/services-v2/services-v2.ts +390 -436
  56. package/test/unit/spec/webex-core.js +62 -2
  57. package/dist/lib/services/constants.js +0 -17
  58. package/dist/lib/services/constants.js.map +0 -1
  59. package/dist/lib/services/interceptors/hostmap.js.map +0 -1
  60. package/dist/lib/services/interceptors/server-error.js +0 -77
  61. package/dist/lib/services/interceptors/server-error.js.map +0 -1
  62. package/dist/lib/services/interceptors/service.js +0 -137
  63. package/dist/lib/services/interceptors/service.js.map +0 -1
  64. package/dist/lib/services-v2/constants.js +0 -17
  65. package/dist/lib/services-v2/constants.js.map +0 -1
  66. package/dist/lib/services-v2/interceptors/server-error.js.map +0 -1
  67. package/dist/lib/services-v2/service-host.js +0 -300
  68. package/dist/lib/services-v2/service-host.js.map +0 -1
  69. package/dist/lib/services-v2/service-registry.js +0 -534
  70. package/dist/lib/services-v2/service-registry.js.map +0 -1
  71. package/dist/lib/services-v2/service-state.js +0 -97
  72. package/dist/lib/services-v2/service-state.js.map +0 -1
  73. package/dist/lib/services-v2/service-url.js +0 -119
  74. package/dist/lib/services-v2/service-url.js.map +0 -1
  75. package/src/lib/services/constants.js +0 -21
  76. package/src/lib/services/interceptors/hostmap.js +0 -36
  77. package/src/lib/services/interceptors/service.js +0 -101
  78. package/src/lib/services-v2/constants.ts +0 -21
  79. package/src/lib/services-v2/interceptors/server-error.js +0 -48
  80. /package/dist/lib/{services-v2/interceptors → interceptors}/hostmap.js +0 -0
  81. /package/dist/lib/{services-v2/interceptors → interceptors}/hostmap.js.map +0 -0
  82. /package/dist/lib/{services-v2/interceptors → interceptors}/service.js +0 -0
  83. /package/dist/lib/{services-v2/interceptors → interceptors}/service.js.map +0 -0
  84. /package/dist/lib/{services/metrics.js → metrics.js} +0 -0
  85. /package/dist/lib/{services/metrics.js.map → metrics.js.map} +0 -0
  86. /package/src/lib/{services-v2/interceptors → interceptors}/hostmap.js +0 -0
  87. /package/src/lib/{services-v2/interceptors → interceptors}/service.js +0 -0
  88. /package/src/lib/{services-v2/metrics.js → metrics.js} +0 -0
  89. /package/src/lib/{services/metrics.js → services-v2/metrics.ts} +0 -0
package/src/webex-core.js CHANGED
@@ -26,12 +26,13 @@ import RequestTimingInterceptor from './interceptors/request-timing';
26
26
  import ResponseLoggerInterceptor from './interceptors/response-logger';
27
27
  import WebexHttpError from './lib/webex-http-error';
28
28
  import UserAgentInterceptor from './interceptors/user-agent';
29
+ import ProxyInterceptor from './interceptors/proxy';
29
30
  import WebexTrackingIdInterceptor from './interceptors/webex-tracking-id';
30
31
  import WebexUserAgentInterceptor from './interceptors/webex-user-agent';
31
32
  import RateLimitInterceptor from './interceptors/rate-limit';
32
33
  import EmbargoInterceptor from './interceptors/embargo';
33
34
  import DefaultOptionsInterceptor from './interceptors/default-options';
34
- import HostMapInterceptor from './lib/services/interceptors/hostmap';
35
+ import HostMapInterceptor from './lib/interceptors/hostmap';
35
36
  import config from './config';
36
37
  import {makeWebexStore} from './lib/storage';
37
38
  import mixinWebexCorePlugins from './lib/webex-core-plugin-mixin';
@@ -58,6 +59,7 @@ const interceptors = {
58
59
  RequestTimingInterceptor: RequestTimingInterceptor.create,
59
60
  ServiceInterceptor: undefined,
60
61
  UserAgentInterceptor: UserAgentInterceptor.create,
62
+ ProxyInterceptor: ProxyInterceptor.create,
61
63
  WebexUserAgentInterceptor: WebexUserAgentInterceptor.create,
62
64
  AuthInterceptor: AuthInterceptor.create,
63
65
  KmsDryErrorInterceptor: undefined,
@@ -578,8 +580,14 @@ const WebexCore = AmpState.extend({
578
580
  return Promise.resolve();
579
581
  },
580
582
 
581
- async upload(options) {
582
- if (!options.file) {
583
+ /**
584
+ * Uploads a file provided in `file` property
585
+ *
586
+ * @param {Object} options
587
+ * @returns {Promise}
588
+ */
589
+ upload(options) {
590
+ if (!options || !options.file) {
583
591
  return Promise.reject(new Error('`options.file` is required'));
584
592
  }
585
593
 
@@ -1,125 +1,3 @@
1
- export const serviceHostmapV2 = {
2
- activeServices: {
3
- conversation: 'urn:TEAM:us-east-2_a:conversation',
4
- idbroker: 'urn:TEAM:us-east-2_a:idbroker',
5
- locus: 'urn:TEAM:us-east-2_a:locus',
6
- mercury: 'urn:TEAM:us-east-2_a:mercury',
7
- },
8
- services: [
9
- {
10
- id: 'urn:TEAM:us-east-2_a:conversation',
11
- serviceName: 'conversation',
12
- serviceUrls: [
13
- {
14
- baseUrl: 'https://prod-achm-message.svc.webex.com/conversation/api/v1',
15
- priority: 1,
16
- },
17
- {
18
- baseUrl: 'https://conv-a.wbx2.com/conversation/api/v1',
19
- priority: 2,
20
- },
21
- ],
22
- },
23
- {
24
- id: 'urn:TEAM:me-central-1_d:conversation',
25
- serviceName: 'conversation',
26
- serviceUrls: [
27
- {
28
- baseUrl: 'https://prod-adxb-message.svc.webex.com/conversation/api/v1',
29
- priority: 1,
30
- },
31
- {
32
- baseUrl: 'https://conv-d.wbx2.com/conversation/api/v1',
33
- priority: 2,
34
- },
35
- ],
36
- },
37
- {
38
- id: 'urn:TEAM:us-east-2_a:idbroker',
39
- serviceName: 'idbroker',
40
- serviceUrls: [
41
- {
42
- baseUrl: 'https://prod-adxb-message.svc.webex.com/idbroker/api/v1',
43
- priority: 1,
44
- },
45
- {
46
- baseUrl: 'https://idbroker.webex.com/idb/api/v1',
47
- priority: 2,
48
- },
49
- ],
50
- },
51
- {
52
- id: 'urn:TEAM:me-central-1_d:idbroker',
53
- serviceName: 'idbroker',
54
- serviceUrls: [
55
- {
56
- baseUrl: 'https://prod-adxb-message.svc.webex.com/idbroker/api/v1',
57
- priority: 1,
58
- },
59
- {
60
- baseUrl: 'https://conv-d.wbx2.com/idbroker/api/v1',
61
- priority: 2,
62
- },
63
- ],
64
- },
65
- {
66
- id: 'urn:TEAM:us-east-2_a:locus',
67
- serviceName: 'locus',
68
- serviceUrls: [
69
- {
70
- baseUrl: 'https://prod-adxb-message.svc.webex.com/locus/api/v1',
71
- priority: 1,
72
- },
73
- {
74
- baseUrl: 'https://locus-a.wbx2.com/locus/api/v1',
75
- priority: 2,
76
- },
77
- ],
78
- },
79
- {
80
- id: 'urn:TEAM:me-central-1_d:locus',
81
- serviceName: 'locus',
82
- serviceUrls: [
83
- {
84
- baseUrl: 'https://prod-adxb-message.svc.webex.com/locus/api/v1',
85
- priority: 1,
86
- },
87
- {
88
- baseUrl: 'https://conv-d.wbx2.com/locus/api/v1',
89
- priority: 2,
90
- },
91
- ],
92
- },
93
- {
94
- id: 'urn:TEAM:us-east-2_a:mercury',
95
- serviceName: 'mercury',
96
- serviceUrls: [
97
- {
98
- baseUrl: 'https://mercury-a.wbx2.com/mercury/api/v1',
99
- priority: 1,
100
- },
101
- ],
102
- },
103
- {
104
- id: 'urn:TEAM:me-central-1_d:mercury',
105
- serviceName: 'mercury',
106
- serviceUrls: [
107
- {
108
- baseUrl: 'https://prod-adxb-message.svc.webex.com/mercury/api/v1',
109
- priority: 1,
110
- },
111
- {
112
- baseUrl: 'https://conv-d.wbx2.com/mercury/api/v1',
113
- priority: 2,
114
- },
115
- ],
116
- },
117
- ],
118
- orgId: '3e0e410f-f83f-4ee4-ac32-12692e99355c',
119
- timestamp: '1745533341',
120
- format: 'U2Cv2',
121
- };
122
-
123
1
  export const formattedServiceHostmapEntryConv = {
124
2
  id: 'urn:TEAM:us-east-2_a:conversation',
125
3
  serviceName: 'conversation',
@@ -137,6 +15,23 @@ export const formattedServiceHostmapEntryConv = {
137
15
  ],
138
16
  };
139
17
 
18
+ export const formattedServiceHostmapEntryTest = {
19
+ id: 'urn:TEAM:us-east-2_a:test',
20
+ serviceName: 'test',
21
+ serviceUrls: [
22
+ {
23
+ baseUrl: 'wss://int-first-test.svc.webex.com/test-connection-partition0/api/v1',
24
+ host: 'int-first-test.svc.webex.com',
25
+ priority: 1,
26
+ },
27
+ {
28
+ baseUrl: 'wss://test-connection-partition0-intb.ciscospark.com/v1',
29
+ host: 'test-connection-partition0-intb.ciscospark.com',
30
+ priority: 2,
31
+ },
32
+ ],
33
+ };
34
+
140
35
  export const formattedServiceHostmapV2 = [
141
36
  formattedServiceHostmapEntryConv,
142
37
  {
@@ -247,3 +142,16 @@ export const formattedServiceHostmapV2 = [
247
142
  ],
248
143
  },
249
144
  ];
145
+
146
+ export const serviceHostmapV2 = {
147
+ activeServices: {
148
+ conversation: 'urn:TEAM:us-east-2_a:conversation',
149
+ idbroker: 'urn:TEAM:us-east-2_a:idbroker',
150
+ locus: 'urn:TEAM:us-east-2_a:locus',
151
+ mercury: 'urn:TEAM:us-east-2_a:mercury',
152
+ },
153
+ services: formattedServiceHostmapV2,
154
+ orgId: '3e0e410f-f83f-4ee4-ac32-12692e99355c',
155
+ timestamp: '1745533341',
156
+ format: 'U2Cv2',
157
+ };
@@ -10,6 +10,10 @@ import WebexCore, {
10
10
  ServiceCatalog,
11
11
  ServiceRegistry,
12
12
  ServiceState,
13
+ Services,
14
+ ServiceInterceptor,
15
+ ServerErrorInterceptor,
16
+ registerInternalPlugin,
13
17
  ServiceUrl,
14
18
  serviceConstants,
15
19
  } from '@webex/webex-core';
@@ -50,6 +54,13 @@ describe('webex-core', () => {
50
54
  );
51
55
 
52
56
  beforeEach('create webex instance', () => {
57
+ registerInternalPlugin('services', Services, {
58
+ interceptors: {
59
+ ServiceInterceptor: ServiceInterceptor.create,
60
+ ServerErrorInterceptor: ServerErrorInterceptor.create,
61
+ },
62
+ replace: true,
63
+ });
53
64
  webex = new WebexCore({credentials: {supertoken: webexUser.token}});
54
65
  webexEU = new WebexCore({credentials: {supertoken: webexUserEU.token}});
55
66
  services = webex.internal.services;