genesys-cloud-streaming-client 13.4.2-branch.develop.3 → 13.5.0-develop.6

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.
@@ -1,5 +1,5 @@
1
1
  import { Agent } from 'stanza';
2
- import { ILogger } from 'genesys-cloud-client-logger';
2
+ import { Logger } from 'genesys-cloud-client-logger';
3
3
  import './polyfills';
4
4
  import { Notifications, NotificationsAPI } from './notifications';
5
5
  import { WebrtcExtension, WebrtcExtensionAPI } from './webrtc';
@@ -14,7 +14,7 @@ export declare class Client {
14
14
  connecting: boolean;
15
15
  autoReconnect: boolean;
16
16
  reconnectOnNoLongerSubscribed: boolean;
17
- logger: ILogger;
17
+ logger: Logger;
18
18
  leakyReconnectTimer: any;
19
19
  hardReconnectCount: number;
20
20
  reconnectLeakTime: number;
@@ -37,6 +37,7 @@ export declare class Client {
37
37
  disconnect(): Promise<void>;
38
38
  reconnect(): Promise<void>;
39
39
  connect(): Promise<void>;
40
+ setAccessToken(token: string): void;
40
41
  static extend(namespace: any, extension: StreamingClientExtension | ((client: Client) => void)): void;
41
42
  static get version(): string;
42
43
  }
@@ -307,6 +307,10 @@ class Client {
307
307
  return Promise.reject(err);
308
308
  });
309
309
  }
310
+ setAccessToken(token) {
311
+ this.config.authToken = token;
312
+ this.logger.setAccessToken(token);
313
+ }
310
314
  static extend(namespace, extension) {
311
315
  if (extensions[namespace]) {
312
316
  throw new Error(`Cannot register already existing namespace ${namespace}`);
@@ -314,7 +318,7 @@ class Client {
314
318
  extensions[namespace] = extension;
315
319
  }
316
320
  static get version() {
317
- return '13.4.2';
321
+ return '13.5.0';
318
322
  }
319
323
  }
320
324
  exports.Client = Client;
@@ -183,6 +183,11 @@ class Notifications {
183
183
  if (handlerIndex > -1) {
184
184
  handlers.splice(handlerIndex, 1);
185
185
  }
186
+ /* if we have removed all our individual handlers, we don't need the topic anymore
187
+ (note: we aren't removing any bulkSubs if they exist for this topic) */
188
+ if (!handlers.length) {
189
+ delete this.subscriptions[t];
190
+ }
186
191
  });
187
192
  }
188
193
  removeTopicPriority(topic) {
@@ -211,17 +216,20 @@ class Notifications {
211
216
  return activeTopics;
212
217
  }
213
218
  resubscribe() {
214
- let topicsToResubscribe = mergeAndDedup(Object.keys(this.bulkSubscriptions), this.getActiveIndividualTopics());
215
- if (topicsToResubscribe.length === 0) {
219
+ const bulkSubs = Object.keys(this.bulkSubscriptions);
220
+ /* if we don't have bulk or individual subs, we don't need to resubscribe */
221
+ const noTopics = bulkSubs.length + this.getActiveIndividualTopics().length === 0;
222
+ if (noTopics) {
216
223
  return Promise.resolve();
217
224
  }
218
- return this.bulkSubscribe(topicsToResubscribe, { replace: true });
225
+ /* only pass in bulk subs with the replace flag – bulkSubscribe() will handle merging our individual topics (see PCM-1846) */
226
+ return this.bulkSubscribe(bulkSubs, { replace: true });
219
227
  }
220
228
  subscriptionsKeepAlive() {
221
229
  const topic = 'streaming-subscriptions-expiring';
222
230
  if (this.topicHandlers(topic).length === 0) {
223
231
  this.createSubscription(topic, () => {
224
- this.client.logger.info(`${topic} - Triggering resubscribe.`);
232
+ this.client.logger.info(`${topic} - Triggering resubscribe.`, { channelId: this.client.config.channelId });
225
233
  this.resubscribe().catch((err) => {
226
234
  const msg = 'Error resubscribing to topics';
227
235
  this.client.logger.error(msg, err);
@@ -397,14 +397,14 @@ class WebrtcExtension extends events_1.EventEmitter {
397
397
  const reject1 = {
398
398
  to: JID_1.toBare(this.jid),
399
399
  reject: {
400
- id: sessionId
400
+ sessionId
401
401
  }
402
402
  };
403
403
  const firstMessage = this.client._stanzaio.send('message', reject1); // send as Message
404
404
  const reject2 = {
405
405
  to: session.fromJid,
406
406
  reject: {
407
- id: sessionId
407
+ sessionId
408
408
  }
409
409
  };
410
410
  const secondMessage = this.client._stanzaio.send('message', reject2); // send as Message
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "developercenter-cdn/streaming-client",
3
+ "version": "develop",
4
+ "ecosystem": "pc",
5
+ "team": "Genesys Client Media (WebRTC)",
6
+ "indexFiles": [
7
+ {
8
+ "file": "/v13.5.0/streaming-client.browser.ie.js"
9
+ },
10
+ {
11
+ "file": "/v13.5.0/streaming-client.browser.js"
12
+ },
13
+ {
14
+ "file": "/v13/streaming-client.browser.ie.js"
15
+ },
16
+ {
17
+ "file": "/v13/streaming-client.browser.js"
18
+ }
19
+ ],
20
+ "build": "6",
21
+ "buildDate": "2022-05-28T00:07:49.984882Z"
22
+ }
@@ -1,5 +1,5 @@
1
1
  import { Agent } from 'stanza';
2
- import { ILogger } from 'genesys-cloud-client-logger';
2
+ import { Logger } from 'genesys-cloud-client-logger';
3
3
  import './polyfills';
4
4
  import { Notifications, NotificationsAPI } from './notifications';
5
5
  import { WebrtcExtension, WebrtcExtensionAPI } from './webrtc';
@@ -14,7 +14,7 @@ export declare class Client {
14
14
  connecting: boolean;
15
15
  autoReconnect: boolean;
16
16
  reconnectOnNoLongerSubscribed: boolean;
17
- logger: ILogger;
17
+ logger: Logger;
18
18
  leakyReconnectTimer: any;
19
19
  hardReconnectCount: number;
20
20
  reconnectLeakTime: number;
@@ -37,6 +37,7 @@ export declare class Client {
37
37
  disconnect(): Promise<void>;
38
38
  reconnect(): Promise<void>;
39
39
  connect(): Promise<void>;
40
+ setAccessToken(token: string): void;
40
41
  static extend(namespace: any, extension: StreamingClientExtension | ((client: Client) => void)): void;
41
42
  static get version(): string;
42
43
  }
package/dist/es/client.js CHANGED
@@ -306,6 +306,10 @@ export class Client {
306
306
  return Promise.reject(err);
307
307
  });
308
308
  }
309
+ setAccessToken(token) {
310
+ this.config.authToken = token;
311
+ this.logger.setAccessToken(token);
312
+ }
309
313
  static extend(namespace, extension) {
310
314
  if (extensions[namespace]) {
311
315
  throw new Error(`Cannot register already existing namespace ${namespace}`);
@@ -313,6 +317,6 @@ export class Client {
313
317
  extensions[namespace] = extension;
314
318
  }
315
319
  static get version() {
316
- return '13.4.2';
320
+ return '13.5.0';
317
321
  }
318
322
  }
@@ -32076,6 +32076,11 @@ class Notifications {
32076
32076
  if (handlerIndex > -1) {
32077
32077
  handlers.splice(handlerIndex, 1);
32078
32078
  }
32079
+ /* if we have removed all our individual handlers, we don't need the topic anymore
32080
+ (note: we aren't removing any bulkSubs if they exist for this topic) */
32081
+ if (!handlers.length) {
32082
+ delete this.subscriptions[t];
32083
+ }
32079
32084
  });
32080
32085
  }
32081
32086
  removeTopicPriority(topic) {
@@ -32104,17 +32109,20 @@ class Notifications {
32104
32109
  return activeTopics;
32105
32110
  }
32106
32111
  resubscribe() {
32107
- let topicsToResubscribe = mergeAndDedup(Object.keys(this.bulkSubscriptions), this.getActiveIndividualTopics());
32108
- if (topicsToResubscribe.length === 0) {
32112
+ const bulkSubs = Object.keys(this.bulkSubscriptions);
32113
+ /* if we don't have bulk or individual subs, we don't need to resubscribe */
32114
+ const noTopics = bulkSubs.length + this.getActiveIndividualTopics().length === 0;
32115
+ if (noTopics) {
32109
32116
  return Promise.resolve();
32110
32117
  }
32111
- return this.bulkSubscribe(topicsToResubscribe, { replace: true });
32118
+ /* only pass in bulk subs with the replace flag – bulkSubscribe() will handle merging our individual topics (see PCM-1846) */
32119
+ return this.bulkSubscribe(bulkSubs, { replace: true });
32112
32120
  }
32113
32121
  subscriptionsKeepAlive() {
32114
32122
  const topic = 'streaming-subscriptions-expiring';
32115
32123
  if (this.topicHandlers(topic).length === 0) {
32116
32124
  this.createSubscription(topic, () => {
32117
- this.client.logger.info(`${topic} - Triggering resubscribe.`);
32125
+ this.client.logger.info(`${topic} - Triggering resubscribe.`, { channelId: this.client.config.channelId });
32118
32126
  this.resubscribe().catch((err) => {
32119
32127
  const msg = 'Error resubscribing to topics';
32120
32128
  this.client.logger.error(msg, err);
@@ -42166,14 +42174,14 @@ class WebrtcExtension extends EventEmitter {
42166
42174
  const reject1 = {
42167
42175
  to: toBare_1(this.jid),
42168
42176
  reject: {
42169
- id: sessionId
42177
+ sessionId
42170
42178
  }
42171
42179
  };
42172
42180
  const firstMessage = this.client._stanzaio.send('message', reject1); // send as Message
42173
42181
  const reject2 = {
42174
42182
  to: session.fromJid,
42175
42183
  reject: {
42176
- id: sessionId
42184
+ sessionId
42177
42185
  }
42178
42186
  };
42179
42187
  const secondMessage = this.client._stanzaio.send('message', reject2); // send as Message
@@ -45831,6 +45839,10 @@ class Client {
45831
45839
  return Promise.reject(err);
45832
45840
  });
45833
45841
  }
45842
+ setAccessToken(token) {
45843
+ this.config.authToken = token;
45844
+ this.logger.setAccessToken(token);
45845
+ }
45834
45846
  static extend(namespace, extension) {
45835
45847
  if (extensions[namespace]) {
45836
45848
  throw new Error(`Cannot register already existing namespace ${namespace}`);
@@ -45838,7 +45850,7 @@ class Client {
45838
45850
  extensions[namespace] = extension;
45839
45851
  }
45840
45852
  static get version() {
45841
- return '13.4.2';
45853
+ return '13.5.0';
45842
45854
  }
45843
45855
  }
45844
45856
 
@@ -183,6 +183,11 @@ export class Notifications {
183
183
  if (handlerIndex > -1) {
184
184
  handlers.splice(handlerIndex, 1);
185
185
  }
186
+ /* if we have removed all our individual handlers, we don't need the topic anymore
187
+ (note: we aren't removing any bulkSubs if they exist for this topic) */
188
+ if (!handlers.length) {
189
+ delete this.subscriptions[t];
190
+ }
186
191
  });
187
192
  }
188
193
  removeTopicPriority(topic) {
@@ -211,17 +216,20 @@ export class Notifications {
211
216
  return activeTopics;
212
217
  }
213
218
  resubscribe() {
214
- let topicsToResubscribe = mergeAndDedup(Object.keys(this.bulkSubscriptions), this.getActiveIndividualTopics());
215
- if (topicsToResubscribe.length === 0) {
219
+ const bulkSubs = Object.keys(this.bulkSubscriptions);
220
+ /* if we don't have bulk or individual subs, we don't need to resubscribe */
221
+ const noTopics = bulkSubs.length + this.getActiveIndividualTopics().length === 0;
222
+ if (noTopics) {
216
223
  return Promise.resolve();
217
224
  }
218
- return this.bulkSubscribe(topicsToResubscribe, { replace: true });
225
+ /* only pass in bulk subs with the replace flag – bulkSubscribe() will handle merging our individual topics (see PCM-1846) */
226
+ return this.bulkSubscribe(bulkSubs, { replace: true });
219
227
  }
220
228
  subscriptionsKeepAlive() {
221
229
  const topic = 'streaming-subscriptions-expiring';
222
230
  if (this.topicHandlers(topic).length === 0) {
223
231
  this.createSubscription(topic, () => {
224
- this.client.logger.info(`${topic} - Triggering resubscribe.`);
232
+ this.client.logger.info(`${topic} - Triggering resubscribe.`, { channelId: this.client.config.channelId });
225
233
  this.resubscribe().catch((err) => {
226
234
  const msg = 'Error resubscribing to topics';
227
235
  this.client.logger.error(msg, err);
package/dist/es/webrtc.js CHANGED
@@ -398,14 +398,14 @@ export class WebrtcExtension extends EventEmitter {
398
398
  const reject1 = {
399
399
  to: toBare(this.jid),
400
400
  reject: {
401
- id: sessionId
401
+ sessionId
402
402
  }
403
403
  };
404
404
  const firstMessage = this.client._stanzaio.send('message', reject1); // send as Message
405
405
  const reject2 = {
406
406
  to: session.fromJid,
407
407
  reject: {
408
- id: sessionId
408
+ sessionId
409
409
  }
410
410
  };
411
411
  const secondMessage = this.client._stanzaio.send('message', reject2); // send as Message
@@ -4,8 +4,19 @@ All notable changes to this project will be documented in this file.
4
4
  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
  # [Unreleased](https://github.com/purecloudlabs/genesys-cloud-streaming-client/compare/v13.4.1...HEAD)
7
+
8
+ ### Added
9
+ * [PCM-1837](https://inindca.atlassian.net/browse/PCM-1837) – add `setAccessToken(token)` function
10
+
11
+ ### Changed
12
+ * [PCM-1842](https://inindca.atlassian.net/browse/PCM-1842) – migrate to the new pipeline. Also versioning cdn urls with major and exact versions. For example:
13
+ * `/v13.5.0/streaming-client.browser.js` (exact version)
14
+ * `/v13/streaming-client.browser.js` (locked to latest for a specific major version)
15
+ * [PCM-1842](https://inindca.atlassian.net/browse/PCM-1842)/[PCM-1560](https://inindca.atlassian.net/browse/PCM-1560) – Upgrade to new pipeline
16
+
7
17
  ### Fixed
8
18
  * Addressed snyk and npm audit issues
19
+ * [PCM-1862](https://inindca.atlassian.net/browse/PCM-1862) - remove individual topics from the tracked lists (subscriptions) after their last handlers have been removed. Fixed `_notifications.resubscribe()` to not treat individual topics as bulk topics
9
20
 
10
21
  # [v13.4.1](https://github.com/purecloudlabs/genesys-cloud-streaming-client/compare/v13.4.0...v13.4.1)
11
22
  ### Added
@@ -1,5 +1,5 @@
1
1
  import { Agent } from 'stanza';
2
- import { ILogger } from 'genesys-cloud-client-logger';
2
+ import { Logger } from 'genesys-cloud-client-logger';
3
3
  import './polyfills';
4
4
  import { Notifications, NotificationsAPI } from './notifications';
5
5
  import { WebrtcExtension, WebrtcExtensionAPI } from './webrtc';
@@ -14,7 +14,7 @@ export declare class Client {
14
14
  connecting: boolean;
15
15
  autoReconnect: boolean;
16
16
  reconnectOnNoLongerSubscribed: boolean;
17
- logger: ILogger;
17
+ logger: Logger;
18
18
  leakyReconnectTimer: any;
19
19
  hardReconnectCount: number;
20
20
  reconnectLeakTime: number;
@@ -37,6 +37,7 @@ export declare class Client {
37
37
  disconnect(): Promise<void>;
38
38
  reconnect(): Promise<void>;
39
39
  connect(): Promise<void>;
40
+ setAccessToken(token: string): void;
40
41
  static extend(namespace: any, extension: StreamingClientExtension | ((client: Client) => void)): void;
41
42
  static get version(): string;
42
43
  }
@@ -307,6 +307,10 @@ class Client {
307
307
  return Promise.reject(err);
308
308
  });
309
309
  }
310
+ setAccessToken(token) {
311
+ this.config.authToken = token;
312
+ this.logger.setAccessToken(token);
313
+ }
310
314
  static extend(namespace, extension) {
311
315
  if (extensions[namespace]) {
312
316
  throw new Error(`Cannot register already existing namespace ${namespace}`);
@@ -314,7 +318,7 @@ class Client {
314
318
  extensions[namespace] = extension;
315
319
  }
316
320
  static get version() {
317
- return '13.4.2';
321
+ return '13.5.0';
318
322
  }
319
323
  }
320
324
  exports.Client = Client;
@@ -183,6 +183,11 @@ class Notifications {
183
183
  if (handlerIndex > -1) {
184
184
  handlers.splice(handlerIndex, 1);
185
185
  }
186
+ /* if we have removed all our individual handlers, we don't need the topic anymore
187
+ (note: we aren't removing any bulkSubs if they exist for this topic) */
188
+ if (!handlers.length) {
189
+ delete this.subscriptions[t];
190
+ }
186
191
  });
187
192
  }
188
193
  removeTopicPriority(topic) {
@@ -211,17 +216,20 @@ class Notifications {
211
216
  return activeTopics;
212
217
  }
213
218
  resubscribe() {
214
- let topicsToResubscribe = mergeAndDedup(Object.keys(this.bulkSubscriptions), this.getActiveIndividualTopics());
215
- if (topicsToResubscribe.length === 0) {
219
+ const bulkSubs = Object.keys(this.bulkSubscriptions);
220
+ /* if we don't have bulk or individual subs, we don't need to resubscribe */
221
+ const noTopics = bulkSubs.length + this.getActiveIndividualTopics().length === 0;
222
+ if (noTopics) {
216
223
  return Promise.resolve();
217
224
  }
218
- return this.bulkSubscribe(topicsToResubscribe, { replace: true });
225
+ /* only pass in bulk subs with the replace flag – bulkSubscribe() will handle merging our individual topics (see PCM-1846) */
226
+ return this.bulkSubscribe(bulkSubs, { replace: true });
219
227
  }
220
228
  subscriptionsKeepAlive() {
221
229
  const topic = 'streaming-subscriptions-expiring';
222
230
  if (this.topicHandlers(topic).length === 0) {
223
231
  this.createSubscription(topic, () => {
224
- this.client.logger.info(`${topic} - Triggering resubscribe.`);
232
+ this.client.logger.info(`${topic} - Triggering resubscribe.`, { channelId: this.client.config.channelId });
225
233
  this.resubscribe().catch((err) => {
226
234
  const msg = 'Error resubscribing to topics';
227
235
  this.client.logger.error(msg, err);
@@ -397,14 +397,14 @@ class WebrtcExtension extends events_1.EventEmitter {
397
397
  const reject1 = {
398
398
  to: JID_1.toBare(this.jid),
399
399
  reject: {
400
- id: sessionId
400
+ sessionId
401
401
  }
402
402
  };
403
403
  const firstMessage = this.client._stanzaio.send('message', reject1); // send as Message
404
404
  const reject2 = {
405
405
  to: session.fromJid,
406
406
  reject: {
407
- id: sessionId
407
+ sessionId
408
408
  }
409
409
  };
410
410
  const secondMessage = this.client._stanzaio.send('message', reject2); // send as Message