genesys-cloud-streaming-client 19.4.1-develop.11 → 19.4.1-develop.12
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/cjs/notifications.js +25 -15
- package/dist/deploy-info.json +2 -2
- package/dist/es/index.bundle.js +279 -250
- package/dist/es/notifications.js +25 -15
- package/dist/manifest.json +2 -2
- package/dist/npm/CHANGELOG.md +4 -4
- package/dist/npm/notifications.js +25 -15
- package/dist/streaming-client.browser.js +1 -1
- package/dist/v19/streaming-client.browser.js +1 -1
- package/dist/v19.4.1/streaming-client.browser.js +1 -1
- package/package.json +2 -2
package/dist/es/notifications.js
CHANGED
|
@@ -346,6 +346,7 @@ export class Notifications {
|
|
|
346
346
|
return this.xmppUnsubscribe(topic);
|
|
347
347
|
}
|
|
348
348
|
bulkSubscribe(topics, options = { replace: false, force: false }, priorities = {}) {
|
|
349
|
+
var _a;
|
|
349
350
|
return __awaiter(this, void 0, void 0, function* () {
|
|
350
351
|
this.setTopicPriorities(priorities);
|
|
351
352
|
let toSubscribe = mergeAndDedup(topics, []);
|
|
@@ -362,29 +363,38 @@ export class Notifications {
|
|
|
362
363
|
if (response && response.data && 'entities' in response.data && Array.isArray(response.data.entities)) {
|
|
363
364
|
topicResponseEntities = response.data.entities;
|
|
364
365
|
}
|
|
365
|
-
const
|
|
366
|
+
const result = {};
|
|
366
367
|
for (const topicEntity of topicResponseEntities) {
|
|
367
|
-
|
|
368
|
+
const { id, state, rejectionReason } = topicEntity;
|
|
369
|
+
result[id] = { topic: id, state, rejectionReason };
|
|
370
|
+
// If response entity is a combined topic ID like "a.b?c&d" include individualized topic IDs
|
|
371
|
+
// as keys in the map. This could either point to the same result as the combined topic ID
|
|
372
|
+
// or to a specific result for that individual topic if backend provides a specific result.
|
|
373
|
+
// Example: caller asked to subscribe "a.b?c&d" but user lacks permission for topic "a.b.d"
|
|
374
|
+
// In this case, API response will include "a.b?c&d" as success along with "a.b.d" as failure.
|
|
375
|
+
if (id.includes('?')) {
|
|
376
|
+
for (const individualTopic of splitIntoIndividualTopics(id)) {
|
|
377
|
+
const hasIndividualTopicResult = result.hasOwnProperty(individualTopic);
|
|
378
|
+
// Only use the combined topic result for this individual topic ID if there isn't already
|
|
379
|
+
// a result for the individual topic itself. Exact topic result takes precedence.
|
|
380
|
+
if (!hasIndividualTopicResult) {
|
|
381
|
+
result[individualTopic] = result[id];
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}
|
|
368
385
|
}
|
|
369
|
-
const result = {};
|
|
370
386
|
if (options.replace) {
|
|
371
387
|
this.bulkSubscriptions = {};
|
|
372
388
|
}
|
|
373
389
|
topics.forEach(topic => {
|
|
374
390
|
this.bulkSubscriptions[topic] = true;
|
|
375
|
-
if (this.enablePartialBulkResubscribe) {
|
|
376
|
-
if (topic in topicResponsesById) {
|
|
377
|
-
const { state, rejectionReason } = topicResponsesById[topic];
|
|
378
|
-
result[topic] = { topic, state, rejectionReason };
|
|
379
|
-
}
|
|
380
|
-
else {
|
|
381
|
-
result[topic] = { topic, state: 'Unknown' };
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
else {
|
|
385
|
-
result[topic] = { topic, state: 'Permitted' };
|
|
386
|
-
}
|
|
387
391
|
});
|
|
392
|
+
// Add a fallback result for any topic in the toSubscribe list that isn't already in result.
|
|
393
|
+
// With partial bulk resubscribe enabled missing result means "Unknown" state but when not
|
|
394
|
+
// enabled the fallback is "Permitted" for backward compatibility (success response means OK).
|
|
395
|
+
for (const topic of toSubscribe) {
|
|
396
|
+
(_a = result[topic]) !== null && _a !== void 0 ? _a : (result[topic] = { topic, state: this.enablePartialBulkResubscribe ? 'Unknown' : 'Permitted' });
|
|
397
|
+
}
|
|
388
398
|
return result;
|
|
389
399
|
});
|
|
390
400
|
}
|
package/dist/manifest.json
CHANGED
package/dist/npm/CHANGELOG.md
CHANGED
|
@@ -5,18 +5,18 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
7
|
# [Unreleased](https://github.com/purecloudlabs/genesys-cloud-streaming-client/compare/v19.4.0...HEAD)
|
|
8
|
+
### Changed
|
|
9
|
+
* [STREAM-941](https://inindca.atlassian.net/browse/STREAM-941) - Fix an issue where notifications.subscribe() with `enablePartialBulkResubscribe` would not resolve/reject based on API result when the requested topic was internally combined with others, e.g. "topic.a" and "topic.b" individually subscribed and bulk resubscribe combines them as "topic?a&b"
|
|
10
|
+
* [STREAM-950](https://inindca.atlassian.net/browse/STREAM-950) - Update genesys-cloud-client-logger to pick up change moving from `unload` to `visibilitychange`.
|
|
8
11
|
|
|
9
12
|
# [v19.4.0](https://github.com/purecloudlabs/genesys-cloud-streaming-client/compare/v19.3.1...v19.4.0)
|
|
10
13
|
### Added
|
|
11
14
|
* [STREAM-865](https://inindca.atlassian.net/browse/STREAM-865) - Generate a test report in JUnit.xml format.
|
|
12
15
|
* [STREAM-892](https://inindca.atlassian.net/browse/STREAM-892) - Add `enablePartialBulkResubscribe` client option to make notifications bulk subscription changes succeed or fail each topic independently rather than a single failed topic causing the whole bulk operation to fail.
|
|
13
16
|
|
|
14
|
-
### Changed
|
|
15
|
-
* [STREAM-865](https://inindca.atlassian.net/browse/STREAM-865) - Remove the SDP payload from SDP answer logs.
|
|
16
|
-
|
|
17
|
-
# [Unreleased](https://github.com/purecloudlabs/genesys-cloud-streaming-client/compare/19.3.1...HEAD)
|
|
18
17
|
### Changed
|
|
19
18
|
* [STREAM-643](https://inindca.atlassian.net/browse/STREAM-643) - Bumped webpack dependency to 5.94.0
|
|
19
|
+
* [STREAM-865](https://inindca.atlassian.net/browse/STREAM-865) - Remove the SDP payload from SDP answer logs.
|
|
20
20
|
|
|
21
21
|
# [v19.3.1](https://github.com/purecloudlabs/genesys-cloud-streaming-client/compare/v19.3.0...v19.3.1)
|
|
22
22
|
* [STREAM-801](https://inindca.atlassian.net/browse/STREAM-801) - Update genesys-cloud-client-logger and axios to address Snyk vulnerability.
|
|
@@ -345,6 +345,7 @@ class Notifications {
|
|
|
345
345
|
return this.xmppUnsubscribe(topic);
|
|
346
346
|
}
|
|
347
347
|
async bulkSubscribe(topics, options = { replace: false, force: false }, priorities = {}) {
|
|
348
|
+
var _a;
|
|
348
349
|
this.setTopicPriorities(priorities);
|
|
349
350
|
let toSubscribe = mergeAndDedup(topics, []);
|
|
350
351
|
if (options.replace && !options.force) {
|
|
@@ -360,29 +361,38 @@ class Notifications {
|
|
|
360
361
|
if (response && response.data && 'entities' in response.data && Array.isArray(response.data.entities)) {
|
|
361
362
|
topicResponseEntities = response.data.entities;
|
|
362
363
|
}
|
|
363
|
-
const
|
|
364
|
+
const result = {};
|
|
364
365
|
for (const topicEntity of topicResponseEntities) {
|
|
365
|
-
|
|
366
|
+
const { id, state, rejectionReason } = topicEntity;
|
|
367
|
+
result[id] = { topic: id, state, rejectionReason };
|
|
368
|
+
// If response entity is a combined topic ID like "a.b?c&d" include individualized topic IDs
|
|
369
|
+
// as keys in the map. This could either point to the same result as the combined topic ID
|
|
370
|
+
// or to a specific result for that individual topic if backend provides a specific result.
|
|
371
|
+
// Example: caller asked to subscribe "a.b?c&d" but user lacks permission for topic "a.b.d"
|
|
372
|
+
// In this case, API response will include "a.b?c&d" as success along with "a.b.d" as failure.
|
|
373
|
+
if (id.includes('?')) {
|
|
374
|
+
for (const individualTopic of (0, utils_1.splitIntoIndividualTopics)(id)) {
|
|
375
|
+
const hasIndividualTopicResult = result.hasOwnProperty(individualTopic);
|
|
376
|
+
// Only use the combined topic result for this individual topic ID if there isn't already
|
|
377
|
+
// a result for the individual topic itself. Exact topic result takes precedence.
|
|
378
|
+
if (!hasIndividualTopicResult) {
|
|
379
|
+
result[individualTopic] = result[id];
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
}
|
|
366
383
|
}
|
|
367
|
-
const result = {};
|
|
368
384
|
if (options.replace) {
|
|
369
385
|
this.bulkSubscriptions = {};
|
|
370
386
|
}
|
|
371
387
|
topics.forEach(topic => {
|
|
372
388
|
this.bulkSubscriptions[topic] = true;
|
|
373
|
-
if (this.enablePartialBulkResubscribe) {
|
|
374
|
-
if (topic in topicResponsesById) {
|
|
375
|
-
const { state, rejectionReason } = topicResponsesById[topic];
|
|
376
|
-
result[topic] = { topic, state, rejectionReason };
|
|
377
|
-
}
|
|
378
|
-
else {
|
|
379
|
-
result[topic] = { topic, state: 'Unknown' };
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
else {
|
|
383
|
-
result[topic] = { topic, state: 'Permitted' };
|
|
384
|
-
}
|
|
385
389
|
});
|
|
390
|
+
// Add a fallback result for any topic in the toSubscribe list that isn't already in result.
|
|
391
|
+
// With partial bulk resubscribe enabled missing result means "Unknown" state but when not
|
|
392
|
+
// enabled the fallback is "Permitted" for backward compatibility (success response means OK).
|
|
393
|
+
for (const topic of toSubscribe) {
|
|
394
|
+
(_a = result[topic]) !== null && _a !== void 0 ? _a : (result[topic] = { topic, state: this.enablePartialBulkResubscribe ? 'Unknown' : 'Permitted' });
|
|
395
|
+
}
|
|
386
396
|
return result;
|
|
387
397
|
}
|
|
388
398
|
get expose() {
|