@webex/webex-core 3.11.0-webex-services-ready.1 → 3.12.0-llmrefactor.1
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/README.md +5 -2
- package/dist/config.js +15 -0
- package/dist/config.js.map +1 -1
- package/dist/credentials-config.js +12 -0
- package/dist/credentials-config.js.map +1 -1
- package/dist/interceptors/redirect.js +1 -1
- package/dist/interceptors/redirect.js.map +1 -1
- package/dist/lib/batcher.js +23 -7
- package/dist/lib/batcher.js.map +1 -1
- package/dist/lib/credentials/credentials.js +48 -4
- package/dist/lib/credentials/credentials.js.map +1 -1
- package/dist/lib/credentials/token.js +1 -1
- package/dist/lib/domains.js +90 -0
- package/dist/lib/domains.js.map +1 -0
- package/dist/lib/services/service-catalog.js +6 -10
- package/dist/lib/services/service-catalog.js.map +1 -1
- package/dist/lib/services/services.js +208 -51
- package/dist/lib/services/services.js.map +1 -1
- package/dist/lib/services-v2/service-catalog.js +6 -12
- package/dist/lib/services-v2/service-catalog.js.map +1 -1
- package/dist/lib/services-v2/services-v2.js +207 -46
- package/dist/lib/services-v2/services-v2.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 +17 -0
- package/src/credentials-config.js +13 -0
- package/src/interceptors/redirect.js +4 -1
- package/src/lib/batcher.js +25 -10
- package/src/lib/credentials/credentials.js +50 -3
- package/src/lib/domains.ts +94 -0
- package/src/lib/services/service-catalog.js +6 -10
- package/src/lib/services/services.js +174 -37
- package/src/lib/services-v2/service-catalog.ts +6 -11
- package/src/lib/services-v2/services-v2.ts +173 -33
- package/test/fixtures/activation-email.ts +22 -0
- package/test/integration/spec/services/service-catalog.js +7 -6
- package/test/integration/spec/services/services.js +49 -24
- package/test/integration/spec/services-v2/services-v2.js +49 -24
- package/test/unit/spec/credentials/credentials.js +133 -2
- package/test/unit/spec/interceptors/auth.js +56 -0
- package/test/unit/spec/lib/batcher.js +56 -0
- package/test/unit/spec/services/service-catalog.js +93 -11
- package/test/unit/spec/services/services.js +458 -322
- package/test/unit/spec/services-v2/service-catalog.ts +93 -11
- package/test/unit/spec/services-v2/services-v2.ts +403 -214
- package/test/unit/spec/webex-core.js +0 -2
- package/test/unit/spec/webex-internal-core.js +0 -2
|
@@ -101,7 +101,24 @@ describe('webex-core', () => {
|
|
|
101
101
|
const domains = [];
|
|
102
102
|
|
|
103
103
|
beforeEach(() => {
|
|
104
|
-
|
|
104
|
+
// Shaped like a real catalog rather than a tidy list: the commercial
|
|
105
|
+
// domains the sdk ships with, a multi-part suffix, sites added at
|
|
106
|
+
// runtime from meeting preferences, an entry that overlaps another,
|
|
107
|
+
// and an unset entry, which callers can add and which must match
|
|
108
|
+
// nothing.
|
|
109
|
+
domains.push(
|
|
110
|
+
'wbx2.com',
|
|
111
|
+
'ciscospark.com',
|
|
112
|
+
'webex.com',
|
|
113
|
+
'webexapis.com',
|
|
114
|
+
'broadcloud.com.au',
|
|
115
|
+
'webexgov.us',
|
|
116
|
+
'example-a.com',
|
|
117
|
+
'example-b.com',
|
|
118
|
+
'example-c.com',
|
|
119
|
+
'go.example-a.com',
|
|
120
|
+
''
|
|
121
|
+
);
|
|
105
122
|
|
|
106
123
|
catalog.setAllowedDomains(domains);
|
|
107
124
|
});
|
|
@@ -110,10 +127,60 @@ describe('webex-core', () => {
|
|
|
110
127
|
domains.length = 0;
|
|
111
128
|
});
|
|
112
129
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
130
|
+
[
|
|
131
|
+
// real service hosts resolve to the entry that covers them
|
|
132
|
+
['https://u2c-a.wbx2.com/u2c/api/v1/limited/catalog', 'wbx2.com'],
|
|
133
|
+
['https://conv-a.wbx2.com/conversation/api/v1/conversations', 'wbx2.com'],
|
|
134
|
+
['https://foobar.ciscospark.com/resource/id', 'ciscospark.com'],
|
|
135
|
+
['https://idbroker.webex.com/idb/token', 'webex.com'],
|
|
136
|
+
['https://webexapis.com/v1/people/me', 'webexapis.com'],
|
|
137
|
+
// an entry is not required to be a bare registrable domain
|
|
138
|
+
['https://foo.broadcloud.com.au/resource/id', 'broadcloud.com.au'],
|
|
139
|
+
['https://a.b.webexgov.us/resource/id', 'webexgov.us'],
|
|
140
|
+
// the domain itself and its subdomains match
|
|
141
|
+
['https://example-a.com/resource/id', 'example-a.com'],
|
|
142
|
+
['https://sub.example-b.com/resource/id', 'example-b.com'],
|
|
143
|
+
['https://deep.sub.example-c.com/resource/id', 'example-c.com'],
|
|
144
|
+
// overlapping entries resolve to the first covering entry in the list
|
|
145
|
+
['https://go.example-a.com/resource/id', 'example-a.com'],
|
|
146
|
+
// an explicit port must not defeat the match
|
|
147
|
+
['https://example-a.com:8443/resource/id', 'example-a.com'],
|
|
148
|
+
['https://u2c-a.wbx2.com:8000/resource/id', 'wbx2.com'],
|
|
149
|
+
// hostname comparison is case insensitive
|
|
150
|
+
['https://U2C-A.WBX2.COM/resource/id', 'wbx2.com'],
|
|
151
|
+
// a trailing dot is the same name
|
|
152
|
+
['https://u2c-a.wbx2.com./resource/id', 'wbx2.com'],
|
|
153
|
+
// a sibling registrable domain must not match
|
|
154
|
+
['https://notwebex.com/resource/id', undefined],
|
|
155
|
+
['https://mywebexgov.us/resource/id', undefined],
|
|
156
|
+
['https://webex.company/resource/id', undefined],
|
|
157
|
+
['https://webex.com-unrelated.example/resource/id', undefined],
|
|
158
|
+
['https://example-a.community/resource/id', undefined],
|
|
159
|
+
// a partial label must not match, even against a multi-part entry
|
|
160
|
+
['https://broadcloud.com/resource/id', undefined],
|
|
161
|
+
// the domain matches only as a suffix, on a label boundary
|
|
162
|
+
['https://webex.com.unrelated.example/resource/id', undefined],
|
|
163
|
+
['https://unrelated.example/webex.com/resource/id', undefined],
|
|
164
|
+
['https://unrelated.example/?next=https://webex.com', undefined],
|
|
165
|
+
// userinfo is not the host
|
|
166
|
+
['https://webex.com@unrelated.example/resource/id', undefined],
|
|
167
|
+
// an encoded or unusual separator is not a label boundary, and the url
|
|
168
|
+
// parsers used by the transports do not agree on where these end the
|
|
169
|
+
// host, so they must not resolve to an allowed domain
|
|
170
|
+
['https://webex.com%2eunrelated.example/resource/id', undefined],
|
|
171
|
+
['https://webex.com%2Eunrelated.example/resource/id', undefined],
|
|
172
|
+
['https://unrelated.example%2ewebex.com/resource/id', undefined],
|
|
173
|
+
['https://unrelated.example%2Ewebex.com/resource/id', undefined],
|
|
174
|
+
['https://unrelated.example;.webex.com/resource/id', undefined],
|
|
175
|
+
// an empty allowed domain entry matches nothing
|
|
176
|
+
['https://unrelated.example/resource/id', undefined],
|
|
177
|
+
// unparseable urls
|
|
178
|
+
['', undefined],
|
|
179
|
+
['not a url', undefined],
|
|
180
|
+
].forEach(([url, expected]) => {
|
|
181
|
+
it(`returns ${expected} for ${url || '<empty>'}`, () => {
|
|
182
|
+
assert.equal(catalog.findAllowedDomain(url), expected);
|
|
183
|
+
});
|
|
117
184
|
});
|
|
118
185
|
});
|
|
119
186
|
|
|
@@ -121,7 +188,7 @@ describe('webex-core', () => {
|
|
|
121
188
|
const domains = [];
|
|
122
189
|
|
|
123
190
|
beforeEach(() => {
|
|
124
|
-
domains.push('example-a', 'example-b', 'example-c');
|
|
191
|
+
domains.push('example-a.com', 'example-b.com', 'example-c.com');
|
|
125
192
|
|
|
126
193
|
catalog.setAllowedDomains(domains);
|
|
127
194
|
});
|
|
@@ -160,7 +227,7 @@ describe('webex-core', () => {
|
|
|
160
227
|
const domains = [];
|
|
161
228
|
|
|
162
229
|
beforeEach(() => {
|
|
163
|
-
domains.push('example-a', 'example-b', 'example-c');
|
|
230
|
+
domains.push('example-a.com', 'example-b.com', 'example-c.com');
|
|
164
231
|
|
|
165
232
|
catalog.setAllowedDomains(domains);
|
|
166
233
|
});
|
|
@@ -170,19 +237,31 @@ describe('webex-core', () => {
|
|
|
170
237
|
});
|
|
171
238
|
|
|
172
239
|
it('sets the allowed domain entries to new values', () => {
|
|
173
|
-
const newValues = ['example-d', 'example-e', 'example-f'];
|
|
240
|
+
const newValues = ['example-d.com', 'example-e.com', 'example-f.com'];
|
|
174
241
|
|
|
175
242
|
catalog.setAllowedDomains(newValues);
|
|
176
243
|
|
|
177
244
|
assert.notDeepInclude(domains, newValues);
|
|
178
245
|
});
|
|
246
|
+
|
|
247
|
+
it('canonicalizes entries and discards those that are not usable', () => {
|
|
248
|
+
catalog.setAllowedDomains([
|
|
249
|
+
'Example-D.COM',
|
|
250
|
+
'example-d.com',
|
|
251
|
+
'example-e.com.',
|
|
252
|
+
'',
|
|
253
|
+
undefined,
|
|
254
|
+
]);
|
|
255
|
+
|
|
256
|
+
assert.deepEqual(catalog.getAllowedDomains(), ['example-d.com', 'example-e.com']);
|
|
257
|
+
});
|
|
179
258
|
});
|
|
180
259
|
|
|
181
260
|
describe('#addAllowedDomains()', () => {
|
|
182
261
|
const domains = [];
|
|
183
262
|
|
|
184
263
|
beforeEach(() => {
|
|
185
|
-
domains.push('example-a', 'example-b', 'example-c');
|
|
264
|
+
domains.push('example-a.com', 'example-b.com', 'example-c.com');
|
|
186
265
|
|
|
187
266
|
catalog.setAllowedDomains(domains);
|
|
188
267
|
});
|
|
@@ -192,13 +271,16 @@ describe('webex-core', () => {
|
|
|
192
271
|
});
|
|
193
272
|
|
|
194
273
|
it('merge the allowed domain entries with new values', () => {
|
|
195
|
-
const newValues = ['example-c', 'example-e', 'example-f'];
|
|
274
|
+
const newValues = ['example-c.com', 'example-e.com', 'example-f.com'];
|
|
196
275
|
|
|
197
276
|
catalog.addAllowedDomains(newValues);
|
|
198
277
|
|
|
199
278
|
const list = catalog.getAllowedDomains();
|
|
200
279
|
|
|
201
|
-
assert.match(
|
|
280
|
+
assert.match(
|
|
281
|
+
['example-a.com', 'example-b.com', 'example-c.com', 'example-e.com', 'example-f.com'],
|
|
282
|
+
list
|
|
283
|
+
);
|
|
202
284
|
});
|
|
203
285
|
});
|
|
204
286
|
|