genesys-cloud-streaming-client 14.1.2 → 14.2.0-develop.19
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/client.d.ts +5 -1
- package/dist/cjs/client.js +25 -3
- package/dist/cjs/utils.d.ts +1 -0
- package/dist/cjs/utils.js +7 -1
- package/dist/deploy-info.json +5 -5
- package/dist/es/client.d.ts +5 -1
- package/dist/es/client.js +28 -4
- package/dist/es/index.bundle.js +31 -3
- package/dist/es/utils.d.ts +1 -0
- package/dist/es/utils.js +5 -0
- package/dist/npm/CHANGELOG.md +2 -0
- package/dist/npm/client.d.ts +5 -1
- package/dist/npm/client.js +25 -3
- package/dist/npm/utils.d.ts +1 -0
- package/dist/npm/utils.js +7 -1
- package/dist/streaming-client.browser.ie.js +4 -4
- package/dist/streaming-client.browser.js +4 -4
- package/dist/v14/streaming-client.browser.ie.js +4 -4
- package/dist/v14/streaming-client.browser.js +4 -4
- package/dist/v14.2.0/streaming-client.browser.ie.js +11 -0
- package/dist/v14.2.0/streaming-client.browser.js +40 -0
- package/package.json +115 -113
- package/dist/v14.1.2/streaming-client.browser.ie.js +0 -11
- package/dist/v14.1.2/streaming-client.browser.js +0 -40
package/dist/cjs/client.d.ts
CHANGED
|
@@ -39,7 +39,11 @@ export declare class Client {
|
|
|
39
39
|
off(eventName: any, ...args: any[]): this;
|
|
40
40
|
disconnect(): Promise<void>;
|
|
41
41
|
reconnect(): Promise<void>;
|
|
42
|
-
connect(
|
|
42
|
+
connect(connectOpts?: {
|
|
43
|
+
keepTryingOnFailure: boolean;
|
|
44
|
+
retryDelay: number;
|
|
45
|
+
}): any;
|
|
46
|
+
_tryToConnect(): Promise<void>;
|
|
43
47
|
stopServerLogging(): void;
|
|
44
48
|
startServerLogging(): void;
|
|
45
49
|
setAccessToken(token: string): void;
|
package/dist/cjs/client.js
CHANGED
|
@@ -11,6 +11,7 @@ const reconnector_1 = require("./reconnector");
|
|
|
11
11
|
const ping_1 = require("./ping");
|
|
12
12
|
const utils_1 = require("./utils");
|
|
13
13
|
const http_client_1 = require("./http-client");
|
|
14
|
+
const axios_1 = require("axios");
|
|
14
15
|
let extensions = {
|
|
15
16
|
ping: ping_1.Ping,
|
|
16
17
|
reconnector: reconnector_1.Reconnector,
|
|
@@ -270,9 +271,30 @@ class Client {
|
|
|
270
271
|
this._stanzaio.disconnect();
|
|
271
272
|
}, 10 * 1000, 'reconnecting streaming service');
|
|
272
273
|
}
|
|
273
|
-
connect() {
|
|
274
|
+
async connect(connectOpts = { keepTryingOnFailure: false, retryDelay: 5000 }) {
|
|
275
|
+
var _a;
|
|
276
|
+
try {
|
|
277
|
+
this.logger.info('streamingClient.connect was called');
|
|
278
|
+
await this._tryToConnect();
|
|
279
|
+
}
|
|
280
|
+
catch (e) {
|
|
281
|
+
let retriable = true;
|
|
282
|
+
// if we get an error we *know* we cant retry, like a 401, don't retry
|
|
283
|
+
if (e instanceof axios_1.AxiosError && [401, 403].includes(((_a = e.response) === null || _a === void 0 ? void 0 : _a.status) || 0)) {
|
|
284
|
+
retriable = false;
|
|
285
|
+
}
|
|
286
|
+
if (connectOpts.keepTryingOnFailure && this.autoReconnect) {
|
|
287
|
+
if (retriable) {
|
|
288
|
+
await utils_1.wait(connectOpts.retryDelay);
|
|
289
|
+
return this.connect(connectOpts);
|
|
290
|
+
}
|
|
291
|
+
this.logger.error('Streaming client received and error that it can\'t recover from and will not attempt to reconnect', { error: e });
|
|
292
|
+
}
|
|
293
|
+
throw e;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
_tryToConnect() {
|
|
274
297
|
this.startServerLogging();
|
|
275
|
-
this.logger.info('streamingClient.connect was called');
|
|
276
298
|
this.connecting = true;
|
|
277
299
|
if (this.config.jwt) {
|
|
278
300
|
return utils_1.timeoutPromise(resolve => {
|
|
@@ -348,7 +370,7 @@ class Client {
|
|
|
348
370
|
return Client.version;
|
|
349
371
|
}
|
|
350
372
|
static get version() {
|
|
351
|
-
return '14.
|
|
373
|
+
return '14.2.0';
|
|
352
374
|
}
|
|
353
375
|
}
|
|
354
376
|
exports.Client = Client;
|
package/dist/cjs/utils.d.ts
CHANGED
|
@@ -14,3 +14,4 @@ export declare type RetryPromise<T = any> = {
|
|
|
14
14
|
export declare function retryPromise<T = any>(promiseFn: () => Promise<T>, retryFn: (error?: Error | any) => boolean, retryInterval?: number, logger?: any): RetryPromise<T>;
|
|
15
15
|
export declare const parseJwt: (token: string) => any;
|
|
16
16
|
export declare function calculatePayloadSize(trace: any): number;
|
|
17
|
+
export declare function wait(delayMs: number): Promise<unknown>;
|
package/dist/cjs/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.calculatePayloadSize = exports.parseJwt = exports.retryPromise = exports.isVideoJid = exports.isSoftphoneJid = exports.isScreenRecordingJid = exports.isAcdJid = exports.splitIntoIndividualTopics = exports.timeoutPromise = void 0;
|
|
3
|
+
exports.wait = exports.calculatePayloadSize = exports.parseJwt = exports.retryPromise = exports.isVideoJid = exports.isSoftphoneJid = exports.isScreenRecordingJid = exports.isAcdJid = exports.splitIntoIndividualTopics = exports.timeoutPromise = void 0;
|
|
4
4
|
const uuid_1 = require("uuid");
|
|
5
5
|
function timeoutPromise(fn, timeoutMs, msg, details) {
|
|
6
6
|
return new Promise(function (resolve, reject) {
|
|
@@ -115,6 +115,12 @@ function calculatePayloadSize(trace) {
|
|
|
115
115
|
return str.length + (m ? m.length : 0);
|
|
116
116
|
}
|
|
117
117
|
exports.calculatePayloadSize = calculatePayloadSize;
|
|
118
|
+
function wait(delayMs) {
|
|
119
|
+
return new Promise(resolve => {
|
|
120
|
+
setTimeout(resolve, delayMs);
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
exports.wait = wait;
|
|
118
124
|
// unsed, but handy. no test coverage until used
|
|
119
125
|
// function mergeOptions (destination, provided) {
|
|
120
126
|
// for (var key in provided) {
|
package/dist/deploy-info.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "developercenter-cdn/streaming-client",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.2.0",
|
|
4
4
|
"ecosystem": "pc",
|
|
5
5
|
"team": "Genesys Client Media (WebRTC)",
|
|
6
6
|
"indexFiles": [
|
|
7
7
|
{
|
|
8
|
-
"file": "/v14.
|
|
8
|
+
"file": "/v14.2.0/streaming-client.browser.ie.js"
|
|
9
9
|
},
|
|
10
10
|
{
|
|
11
|
-
"file": "/v14.
|
|
11
|
+
"file": "/v14.2.0/streaming-client.browser.js"
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
"file": "/v14/streaming-client.browser.ie.js"
|
|
@@ -17,6 +17,6 @@
|
|
|
17
17
|
"file": "/v14/streaming-client.browser.js"
|
|
18
18
|
}
|
|
19
19
|
],
|
|
20
|
-
"build": "
|
|
21
|
-
"buildDate": "2022-07-
|
|
20
|
+
"build": "19",
|
|
21
|
+
"buildDate": "2022-07-20T17:26:31.716260Z"
|
|
22
22
|
}
|
package/dist/es/client.d.ts
CHANGED
|
@@ -39,7 +39,11 @@ export declare class Client {
|
|
|
39
39
|
off(eventName: any, ...args: any[]): this;
|
|
40
40
|
disconnect(): Promise<void>;
|
|
41
41
|
reconnect(): Promise<void>;
|
|
42
|
-
connect(
|
|
42
|
+
connect(connectOpts?: {
|
|
43
|
+
keepTryingOnFailure: boolean;
|
|
44
|
+
retryDelay: number;
|
|
45
|
+
}): any;
|
|
46
|
+
_tryToConnect(): Promise<void>;
|
|
43
47
|
stopServerLogging(): void;
|
|
44
48
|
startServerLogging(): void;
|
|
45
49
|
setAccessToken(token: string): void;
|
package/dist/es/client.js
CHANGED
|
@@ -8,8 +8,9 @@ import { Notifications } from './notifications';
|
|
|
8
8
|
import { WebrtcExtension } from './webrtc';
|
|
9
9
|
import { Reconnector } from './reconnector';
|
|
10
10
|
import { Ping } from './ping';
|
|
11
|
-
import { parseJwt, timeoutPromise } from './utils';
|
|
11
|
+
import { parseJwt, timeoutPromise, wait } from './utils';
|
|
12
12
|
import { HttpClient } from './http-client';
|
|
13
|
+
import { AxiosError } from 'axios';
|
|
13
14
|
let extensions = {
|
|
14
15
|
ping: Ping,
|
|
15
16
|
reconnector: Reconnector,
|
|
@@ -269,9 +270,32 @@ export class Client {
|
|
|
269
270
|
this._stanzaio.disconnect();
|
|
270
271
|
}, 10 * 1000, 'reconnecting streaming service');
|
|
271
272
|
}
|
|
272
|
-
connect() {
|
|
273
|
+
connect(connectOpts = { keepTryingOnFailure: false, retryDelay: 5000 }) {
|
|
274
|
+
var _a;
|
|
275
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
276
|
+
try {
|
|
277
|
+
this.logger.info('streamingClient.connect was called');
|
|
278
|
+
yield this._tryToConnect();
|
|
279
|
+
}
|
|
280
|
+
catch (e) {
|
|
281
|
+
let retriable = true;
|
|
282
|
+
// if we get an error we *know* we cant retry, like a 401, don't retry
|
|
283
|
+
if (e instanceof AxiosError && [401, 403].includes(((_a = e.response) === null || _a === void 0 ? void 0 : _a.status) || 0)) {
|
|
284
|
+
retriable = false;
|
|
285
|
+
}
|
|
286
|
+
if (connectOpts.keepTryingOnFailure && this.autoReconnect) {
|
|
287
|
+
if (retriable) {
|
|
288
|
+
yield wait(connectOpts.retryDelay);
|
|
289
|
+
return this.connect(connectOpts);
|
|
290
|
+
}
|
|
291
|
+
this.logger.error('Streaming client received and error that it can\'t recover from and will not attempt to reconnect', { error: e });
|
|
292
|
+
}
|
|
293
|
+
throw e;
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
_tryToConnect() {
|
|
273
298
|
this.startServerLogging();
|
|
274
|
-
this.logger.info('streamingClient.connect was called');
|
|
275
299
|
this.connecting = true;
|
|
276
300
|
if (this.config.jwt) {
|
|
277
301
|
return timeoutPromise(resolve => {
|
|
@@ -347,6 +371,6 @@ export class Client {
|
|
|
347
371
|
return Client.version;
|
|
348
372
|
}
|
|
349
373
|
static get version() {
|
|
350
|
-
return '14.
|
|
374
|
+
return '14.2.0';
|
|
351
375
|
}
|
|
352
376
|
}
|
package/dist/es/index.bundle.js
CHANGED
|
@@ -31689,6 +31689,11 @@ function calculatePayloadSize(trace) {
|
|
|
31689
31689
|
const m = encodeURIComponent(str).match(/%[89ABab]/g);
|
|
31690
31690
|
return str.length + (m ? m.length : 0);
|
|
31691
31691
|
}
|
|
31692
|
+
function wait(delayMs) {
|
|
31693
|
+
return new Promise(resolve => {
|
|
31694
|
+
setTimeout(resolve, delayMs);
|
|
31695
|
+
});
|
|
31696
|
+
}
|
|
31692
31697
|
// unsed, but handy. no test coverage until used
|
|
31693
31698
|
// function mergeOptions (destination, provided) {
|
|
31694
31699
|
// for (var key in provided) {
|
|
@@ -43400,9 +43405,32 @@ class Client {
|
|
|
43400
43405
|
this._stanzaio.disconnect();
|
|
43401
43406
|
}, 10 * 1000, 'reconnecting streaming service');
|
|
43402
43407
|
}
|
|
43403
|
-
connect() {
|
|
43408
|
+
connect(connectOpts = { keepTryingOnFailure: false, retryDelay: 5000 }) {
|
|
43409
|
+
var _a;
|
|
43410
|
+
return __awaiter$5(this, void 0, void 0, function* () {
|
|
43411
|
+
try {
|
|
43412
|
+
this.logger.info('streamingClient.connect was called');
|
|
43413
|
+
yield this._tryToConnect();
|
|
43414
|
+
}
|
|
43415
|
+
catch (e) {
|
|
43416
|
+
let retriable = true;
|
|
43417
|
+
// if we get an error we *know* we cant retry, like a 401, don't retry
|
|
43418
|
+
if (e instanceof axios.AxiosError && [401, 403].includes(((_a = e.response) === null || _a === void 0 ? void 0 : _a.status) || 0)) {
|
|
43419
|
+
retriable = false;
|
|
43420
|
+
}
|
|
43421
|
+
if (connectOpts.keepTryingOnFailure && this.autoReconnect) {
|
|
43422
|
+
if (retriable) {
|
|
43423
|
+
yield wait(connectOpts.retryDelay);
|
|
43424
|
+
return this.connect(connectOpts);
|
|
43425
|
+
}
|
|
43426
|
+
this.logger.error('Streaming client received and error that it can\'t recover from and will not attempt to reconnect', { error: e });
|
|
43427
|
+
}
|
|
43428
|
+
throw e;
|
|
43429
|
+
}
|
|
43430
|
+
});
|
|
43431
|
+
}
|
|
43432
|
+
_tryToConnect() {
|
|
43404
43433
|
this.startServerLogging();
|
|
43405
|
-
this.logger.info('streamingClient.connect was called');
|
|
43406
43434
|
this.connecting = true;
|
|
43407
43435
|
if (this.config.jwt) {
|
|
43408
43436
|
return timeoutPromise$1(resolve => {
|
|
@@ -43478,7 +43506,7 @@ class Client {
|
|
|
43478
43506
|
return Client.version;
|
|
43479
43507
|
}
|
|
43480
43508
|
static get version() {
|
|
43481
|
-
return '14.
|
|
43509
|
+
return '14.2.0';
|
|
43482
43510
|
}
|
|
43483
43511
|
}
|
|
43484
43512
|
|
package/dist/es/utils.d.ts
CHANGED
|
@@ -14,3 +14,4 @@ export declare type RetryPromise<T = any> = {
|
|
|
14
14
|
export declare function retryPromise<T = any>(promiseFn: () => Promise<T>, retryFn: (error?: Error | any) => boolean, retryInterval?: number, logger?: any): RetryPromise<T>;
|
|
15
15
|
export declare const parseJwt: (token: string) => any;
|
|
16
16
|
export declare function calculatePayloadSize(trace: any): number;
|
|
17
|
+
export declare function wait(delayMs: number): Promise<unknown>;
|
package/dist/es/utils.js
CHANGED
|
@@ -104,6 +104,11 @@ export function calculatePayloadSize(trace) {
|
|
|
104
104
|
const m = encodeURIComponent(str).match(/%[89ABab]/g);
|
|
105
105
|
return str.length + (m ? m.length : 0);
|
|
106
106
|
}
|
|
107
|
+
export function wait(delayMs) {
|
|
108
|
+
return new Promise(resolve => {
|
|
109
|
+
setTimeout(resolve, delayMs);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
107
112
|
// unsed, but handy. no test coverage until used
|
|
108
113
|
// function mergeOptions (destination, provided) {
|
|
109
114
|
// for (var key in provided) {
|
package/dist/npm/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,8 @@ 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/v14.1.2...HEAD)
|
|
7
|
+
### Added
|
|
8
|
+
* [PCM-1944](https://inindca.atlassian.net/browse/PCM-1944) – Added reconnect options to the `streamingClient.connect` so it will continue to try to connect at a given interval. This is separate from the reconnection logic in the case where the client connected but disconnected unexpectedly.
|
|
7
9
|
|
|
8
10
|
# [v14.1.2](https://github.com/purecloudlabs/genesys-cloud-streaming-client/compare/v14.1.1...v14.1.2)
|
|
9
11
|
### Fixed
|
package/dist/npm/client.d.ts
CHANGED
|
@@ -39,7 +39,11 @@ export declare class Client {
|
|
|
39
39
|
off(eventName: any, ...args: any[]): this;
|
|
40
40
|
disconnect(): Promise<void>;
|
|
41
41
|
reconnect(): Promise<void>;
|
|
42
|
-
connect(
|
|
42
|
+
connect(connectOpts?: {
|
|
43
|
+
keepTryingOnFailure: boolean;
|
|
44
|
+
retryDelay: number;
|
|
45
|
+
}): any;
|
|
46
|
+
_tryToConnect(): Promise<void>;
|
|
43
47
|
stopServerLogging(): void;
|
|
44
48
|
startServerLogging(): void;
|
|
45
49
|
setAccessToken(token: string): void;
|
package/dist/npm/client.js
CHANGED
|
@@ -11,6 +11,7 @@ const reconnector_1 = require("./reconnector");
|
|
|
11
11
|
const ping_1 = require("./ping");
|
|
12
12
|
const utils_1 = require("./utils");
|
|
13
13
|
const http_client_1 = require("./http-client");
|
|
14
|
+
const axios_1 = require("axios");
|
|
14
15
|
let extensions = {
|
|
15
16
|
ping: ping_1.Ping,
|
|
16
17
|
reconnector: reconnector_1.Reconnector,
|
|
@@ -270,9 +271,30 @@ class Client {
|
|
|
270
271
|
this._stanzaio.disconnect();
|
|
271
272
|
}, 10 * 1000, 'reconnecting streaming service');
|
|
272
273
|
}
|
|
273
|
-
connect() {
|
|
274
|
+
async connect(connectOpts = { keepTryingOnFailure: false, retryDelay: 5000 }) {
|
|
275
|
+
var _a;
|
|
276
|
+
try {
|
|
277
|
+
this.logger.info('streamingClient.connect was called');
|
|
278
|
+
await this._tryToConnect();
|
|
279
|
+
}
|
|
280
|
+
catch (e) {
|
|
281
|
+
let retriable = true;
|
|
282
|
+
// if we get an error we *know* we cant retry, like a 401, don't retry
|
|
283
|
+
if (e instanceof axios_1.AxiosError && [401, 403].includes(((_a = e.response) === null || _a === void 0 ? void 0 : _a.status) || 0)) {
|
|
284
|
+
retriable = false;
|
|
285
|
+
}
|
|
286
|
+
if (connectOpts.keepTryingOnFailure && this.autoReconnect) {
|
|
287
|
+
if (retriable) {
|
|
288
|
+
await utils_1.wait(connectOpts.retryDelay);
|
|
289
|
+
return this.connect(connectOpts);
|
|
290
|
+
}
|
|
291
|
+
this.logger.error('Streaming client received and error that it can\'t recover from and will not attempt to reconnect', { error: e });
|
|
292
|
+
}
|
|
293
|
+
throw e;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
_tryToConnect() {
|
|
274
297
|
this.startServerLogging();
|
|
275
|
-
this.logger.info('streamingClient.connect was called');
|
|
276
298
|
this.connecting = true;
|
|
277
299
|
if (this.config.jwt) {
|
|
278
300
|
return utils_1.timeoutPromise(resolve => {
|
|
@@ -348,7 +370,7 @@ class Client {
|
|
|
348
370
|
return Client.version;
|
|
349
371
|
}
|
|
350
372
|
static get version() {
|
|
351
|
-
return '14.
|
|
373
|
+
return '14.2.0';
|
|
352
374
|
}
|
|
353
375
|
}
|
|
354
376
|
exports.Client = Client;
|
package/dist/npm/utils.d.ts
CHANGED
|
@@ -14,3 +14,4 @@ export declare type RetryPromise<T = any> = {
|
|
|
14
14
|
export declare function retryPromise<T = any>(promiseFn: () => Promise<T>, retryFn: (error?: Error | any) => boolean, retryInterval?: number, logger?: any): RetryPromise<T>;
|
|
15
15
|
export declare const parseJwt: (token: string) => any;
|
|
16
16
|
export declare function calculatePayloadSize(trace: any): number;
|
|
17
|
+
export declare function wait(delayMs: number): Promise<unknown>;
|
package/dist/npm/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.calculatePayloadSize = exports.parseJwt = exports.retryPromise = exports.isVideoJid = exports.isSoftphoneJid = exports.isScreenRecordingJid = exports.isAcdJid = exports.splitIntoIndividualTopics = exports.timeoutPromise = void 0;
|
|
3
|
+
exports.wait = exports.calculatePayloadSize = exports.parseJwt = exports.retryPromise = exports.isVideoJid = exports.isSoftphoneJid = exports.isScreenRecordingJid = exports.isAcdJid = exports.splitIntoIndividualTopics = exports.timeoutPromise = void 0;
|
|
4
4
|
const uuid_1 = require("uuid");
|
|
5
5
|
function timeoutPromise(fn, timeoutMs, msg, details) {
|
|
6
6
|
return new Promise(function (resolve, reject) {
|
|
@@ -115,6 +115,12 @@ function calculatePayloadSize(trace) {
|
|
|
115
115
|
return str.length + (m ? m.length : 0);
|
|
116
116
|
}
|
|
117
117
|
exports.calculatePayloadSize = calculatePayloadSize;
|
|
118
|
+
function wait(delayMs) {
|
|
119
|
+
return new Promise(resolve => {
|
|
120
|
+
setTimeout(resolve, delayMs);
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
exports.wait = wait;
|
|
118
124
|
// unsed, but handy. no test coverage until used
|
|
119
125
|
// function mergeOptions (destination, provided) {
|
|
120
126
|
// for (var key in provided) {
|