genesys-cloud-streaming-client 14.1.1-develop.14 → 14.1.1-develop.15

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 (37) hide show
  1. package/dist/cjs/client.d.ts +0 -1
  2. package/dist/cjs/client.js +21 -42
  3. package/dist/cjs/http-client.js +1 -1
  4. package/dist/cjs/reconnector.d.ts +1 -1
  5. package/dist/cjs/reconnector.js +7 -19
  6. package/dist/cjs/utils.d.ts +8 -1
  7. package/dist/cjs/utils.js +45 -4
  8. package/dist/deploy-info.json +2 -2
  9. package/dist/es/client.d.ts +0 -1
  10. package/dist/es/client.js +20 -43
  11. package/dist/es/http-client.js +1 -1
  12. package/dist/es/index.bundle.js +231 -311
  13. package/dist/es/reconnector.d.ts +1 -1
  14. package/dist/es/reconnector.js +13 -23
  15. package/dist/es/utils.d.ts +8 -1
  16. package/dist/es/utils.js +44 -1
  17. package/dist/npm/CHANGELOG.md +3 -0
  18. package/dist/npm/client.d.ts +0 -1
  19. package/dist/npm/client.js +21 -42
  20. package/dist/npm/http-client.js +1 -1
  21. package/dist/npm/reconnector.d.ts +1 -1
  22. package/dist/npm/reconnector.js +7 -19
  23. package/dist/npm/utils.d.ts +8 -1
  24. package/dist/npm/utils.js +45 -4
  25. package/dist/streaming-client.browser.ie.js +4 -4
  26. package/dist/streaming-client.browser.js +4 -4
  27. package/dist/v14/streaming-client.browser.ie.js +4 -4
  28. package/dist/v14/streaming-client.browser.js +4 -4
  29. package/dist/v14.1.1/streaming-client.browser.ie.js +4 -4
  30. package/dist/v14.1.1/streaming-client.browser.js +4 -4
  31. package/package.json +1 -1
  32. package/dist/cjs/types/retry-utils.d.ts +0 -54
  33. package/dist/cjs/types/retry-utils.js +0 -94
  34. package/dist/es/types/retry-utils.d.ts +0 -54
  35. package/dist/es/types/retry-utils.js +0 -91
  36. package/dist/npm/types/retry-utils.d.ts +0 -54
  37. package/dist/npm/types/retry-utils.js +0 -94
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "genesys-cloud-streaming-client",
3
- "version": "14.1.1-develop.14",
3
+ "version": "14.1.1-develop.15",
4
4
  "description": "client for the Genesys Cloud Streaming APIs (websocket/xmpp interface)",
5
5
  "repository": "https:github.com/purecloudlabs/genesys-cloud-streaming-client",
6
6
  "license": "MIT",
@@ -1,54 +0,0 @@
1
- import WildEmitter from 'wildemitter';
2
- export interface IRetryConfig<T = any> {
3
- /**
4
- * Function to attempt until it completes or rejects based on the
5
- * criteria for retrying.
6
- */
7
- promiseFn: () => Promise<T>;
8
- /**
9
- * Retry criteria to retry the promise function on failure. Available options:
10
- * - `boolean`: if `true`, it will _always_ be retried. if `false`, it will _never_
11
- * be retried.
12
- * - `number`: max attempts to retry
13
- * - `function`: a function that accepts the error thrown and determines if it
14
- * should be retried. It will be passed the `Error` and the `attemptCount`.
15
- *
16
- * Default: `false`
17
- */
18
- retry?: boolean | number | ((error?: Error | any, attemptCount?: number) => boolean);
19
- /**
20
- * Milliseconds to wait inbetween next retry of the promise function on failure.
21
- *
22
- * Default: `15000`
23
- */
24
- retryInterval?: number;
25
- }
26
- export declare class RetryPromise<T = any> extends WildEmitter {
27
- promise: Promise<T>;
28
- _id: string;
29
- private _reject;
30
- private _resolve;
31
- private _hasCompleted;
32
- private _attemptCount;
33
- private _timeout;
34
- private _config;
35
- constructor(config: IRetryConfig);
36
- /**
37
- * @deprecated use `reject(reason)`
38
- * @param reason value to reject the promise with
39
- * @returns void
40
- */
41
- cancel(reason?: string | Error | any): void;
42
- reject(reason?: string | Error | any): void;
43
- /**
44
- * @deprecated use `resolve(reason)`
45
- * @param value to resolve the promise with
46
- * @returns void
47
- */
48
- complete(value: T | PromiseLike<T>): void;
49
- resolve(value: T | PromiseLike<T>): void;
50
- hasCompleted(): boolean;
51
- attemptCount(): number;
52
- private _tryPromiseFn;
53
- }
54
- export declare function retryPromise<T = any>(promiseFn: () => Promise<T>, retry?: boolean | number | ((error?: Error | any, attemptCount?: number) => boolean), retryInterval?: number, _logger?: any): RetryPromise<T>;
@@ -1,94 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.retryPromise = exports.RetryPromise = void 0;
4
- const tslib_1 = require("tslib");
5
- const uuid_1 = require("uuid");
6
- const wildemitter_1 = tslib_1.__importDefault(require("wildemitter"));
7
- class RetryPromise extends wildemitter_1.default {
8
- constructor(config) {
9
- super();
10
- this._id = uuid_1.v4();
11
- this._hasCompleted = false;
12
- this._attemptCount = 0;
13
- this.promise = new Promise((resolve, reject) => {
14
- this._resolve = resolve;
15
- this._reject = reject;
16
- });
17
- this._config = {
18
- promiseFn: config.promiseFn,
19
- retry: config.retry || false,
20
- retryInterval: config.retryInterval !== undefined && config.retryInterval > -1 ? config.retryInterval : 15000
21
- };
22
- /* tslint:disable:no-floating-promises */
23
- this._tryPromiseFn();
24
- }
25
- /**
26
- * @deprecated use `reject(reason)`
27
- * @param reason value to reject the promise with
28
- * @returns void
29
- */
30
- cancel(reason) {
31
- return this.reject(reason);
32
- }
33
- reject(reason) {
34
- this._reject(reason);
35
- clearTimeout(this._timeout);
36
- this._hasCompleted = true;
37
- this.emit('rejected', reason);
38
- }
39
- /**
40
- * @deprecated use `resolve(reason)`
41
- * @param value to resolve the promise with
42
- * @returns void
43
- */
44
- complete(value) {
45
- return this.resolve(value);
46
- }
47
- resolve(value) {
48
- this._resolve(value);
49
- clearTimeout(this._timeout);
50
- this._hasCompleted = true;
51
- this.emit('resolved', value);
52
- }
53
- hasCompleted() {
54
- return this._hasCompleted;
55
- }
56
- attemptCount() {
57
- return this._attemptCount;
58
- }
59
- async _tryPromiseFn() {
60
- const { retry, retryInterval } = this._config;
61
- try {
62
- this._attemptCount++;
63
- this.emit('trying', {
64
- attemptCount: this._attemptCount,
65
- promise: this.promise
66
- });
67
- const val = await this._config.promiseFn();
68
- this.resolve(val);
69
- }
70
- catch (error) {
71
- if (
72
- /* always retry */
73
- retry === true ||
74
- /* retry if under max retry attempts */
75
- typeof retry === 'number' && this._attemptCount <= retry ||
76
- /* retry if retry function returns true */
77
- typeof retry === 'function' && retry(error, this._attemptCount + 1)) {
78
- this.emit('retrying', {
79
- error,
80
- attemptCount: this._attemptCount,
81
- retryInterval
82
- });
83
- this._timeout = setTimeout(this._tryPromiseFn.bind(this), retryInterval);
84
- return;
85
- }
86
- this.reject(error);
87
- }
88
- }
89
- }
90
- exports.RetryPromise = RetryPromise;
91
- function retryPromise(promiseFn, retry, retryInterval = 15000, _logger = console) {
92
- return new RetryPromise({ promiseFn, retry, retryInterval });
93
- }
94
- exports.retryPromise = retryPromise;
@@ -1,54 +0,0 @@
1
- import WildEmitter from 'wildemitter';
2
- export interface IRetryConfig<T = any> {
3
- /**
4
- * Function to attempt until it completes or rejects based on the
5
- * criteria for retrying.
6
- */
7
- promiseFn: () => Promise<T>;
8
- /**
9
- * Retry criteria to retry the promise function on failure. Available options:
10
- * - `boolean`: if `true`, it will _always_ be retried. if `false`, it will _never_
11
- * be retried.
12
- * - `number`: max attempts to retry
13
- * - `function`: a function that accepts the error thrown and determines if it
14
- * should be retried. It will be passed the `Error` and the `attemptCount`.
15
- *
16
- * Default: `false`
17
- */
18
- retry?: boolean | number | ((error?: Error | any, attemptCount?: number) => boolean);
19
- /**
20
- * Milliseconds to wait inbetween next retry of the promise function on failure.
21
- *
22
- * Default: `15000`
23
- */
24
- retryInterval?: number;
25
- }
26
- export declare class RetryPromise<T = any> extends WildEmitter {
27
- promise: Promise<T>;
28
- _id: string;
29
- private _reject;
30
- private _resolve;
31
- private _hasCompleted;
32
- private _attemptCount;
33
- private _timeout;
34
- private _config;
35
- constructor(config: IRetryConfig);
36
- /**
37
- * @deprecated use `reject(reason)`
38
- * @param reason value to reject the promise with
39
- * @returns void
40
- */
41
- cancel(reason?: string | Error | any): void;
42
- reject(reason?: string | Error | any): void;
43
- /**
44
- * @deprecated use `resolve(reason)`
45
- * @param value to resolve the promise with
46
- * @returns void
47
- */
48
- complete(value: T | PromiseLike<T>): void;
49
- resolve(value: T | PromiseLike<T>): void;
50
- hasCompleted(): boolean;
51
- attemptCount(): number;
52
- private _tryPromiseFn;
53
- }
54
- export declare function retryPromise<T = any>(promiseFn: () => Promise<T>, retry?: boolean | number | ((error?: Error | any, attemptCount?: number) => boolean), retryInterval?: number, _logger?: any): RetryPromise<T>;
@@ -1,91 +0,0 @@
1
- import { __awaiter } from "tslib";
2
- import { v4 } from 'uuid';
3
- import WildEmitter from 'wildemitter';
4
- export class RetryPromise extends WildEmitter {
5
- constructor(config) {
6
- super();
7
- this._id = v4();
8
- this._hasCompleted = false;
9
- this._attemptCount = 0;
10
- this.promise = new Promise((resolve, reject) => {
11
- this._resolve = resolve;
12
- this._reject = reject;
13
- });
14
- this._config = {
15
- promiseFn: config.promiseFn,
16
- retry: config.retry || false,
17
- retryInterval: config.retryInterval !== undefined && config.retryInterval > -1 ? config.retryInterval : 15000
18
- };
19
- /* tslint:disable:no-floating-promises */
20
- this._tryPromiseFn();
21
- }
22
- /**
23
- * @deprecated use `reject(reason)`
24
- * @param reason value to reject the promise with
25
- * @returns void
26
- */
27
- cancel(reason) {
28
- return this.reject(reason);
29
- }
30
- reject(reason) {
31
- this._reject(reason);
32
- clearTimeout(this._timeout);
33
- this._hasCompleted = true;
34
- this.emit('rejected', reason);
35
- }
36
- /**
37
- * @deprecated use `resolve(reason)`
38
- * @param value to resolve the promise with
39
- * @returns void
40
- */
41
- complete(value) {
42
- return this.resolve(value);
43
- }
44
- resolve(value) {
45
- this._resolve(value);
46
- clearTimeout(this._timeout);
47
- this._hasCompleted = true;
48
- this.emit('resolved', value);
49
- }
50
- hasCompleted() {
51
- return this._hasCompleted;
52
- }
53
- attemptCount() {
54
- return this._attemptCount;
55
- }
56
- _tryPromiseFn() {
57
- return __awaiter(this, void 0, void 0, function* () {
58
- const { retry, retryInterval } = this._config;
59
- try {
60
- this._attemptCount++;
61
- this.emit('trying', {
62
- attemptCount: this._attemptCount,
63
- promise: this.promise
64
- });
65
- const val = yield this._config.promiseFn();
66
- this.resolve(val);
67
- }
68
- catch (error) {
69
- if (
70
- /* always retry */
71
- retry === true ||
72
- /* retry if under max retry attempts */
73
- typeof retry === 'number' && this._attemptCount <= retry ||
74
- /* retry if retry function returns true */
75
- typeof retry === 'function' && retry(error, this._attemptCount + 1)) {
76
- this.emit('retrying', {
77
- error,
78
- attemptCount: this._attemptCount,
79
- retryInterval
80
- });
81
- this._timeout = setTimeout(this._tryPromiseFn.bind(this), retryInterval);
82
- return;
83
- }
84
- this.reject(error);
85
- }
86
- });
87
- }
88
- }
89
- export function retryPromise(promiseFn, retry, retryInterval = 15000, _logger = console) {
90
- return new RetryPromise({ promiseFn, retry, retryInterval });
91
- }
@@ -1,54 +0,0 @@
1
- import WildEmitter from 'wildemitter';
2
- export interface IRetryConfig<T = any> {
3
- /**
4
- * Function to attempt until it completes or rejects based on the
5
- * criteria for retrying.
6
- */
7
- promiseFn: () => Promise<T>;
8
- /**
9
- * Retry criteria to retry the promise function on failure. Available options:
10
- * - `boolean`: if `true`, it will _always_ be retried. if `false`, it will _never_
11
- * be retried.
12
- * - `number`: max attempts to retry
13
- * - `function`: a function that accepts the error thrown and determines if it
14
- * should be retried. It will be passed the `Error` and the `attemptCount`.
15
- *
16
- * Default: `false`
17
- */
18
- retry?: boolean | number | ((error?: Error | any, attemptCount?: number) => boolean);
19
- /**
20
- * Milliseconds to wait inbetween next retry of the promise function on failure.
21
- *
22
- * Default: `15000`
23
- */
24
- retryInterval?: number;
25
- }
26
- export declare class RetryPromise<T = any> extends WildEmitter {
27
- promise: Promise<T>;
28
- _id: string;
29
- private _reject;
30
- private _resolve;
31
- private _hasCompleted;
32
- private _attemptCount;
33
- private _timeout;
34
- private _config;
35
- constructor(config: IRetryConfig);
36
- /**
37
- * @deprecated use `reject(reason)`
38
- * @param reason value to reject the promise with
39
- * @returns void
40
- */
41
- cancel(reason?: string | Error | any): void;
42
- reject(reason?: string | Error | any): void;
43
- /**
44
- * @deprecated use `resolve(reason)`
45
- * @param value to resolve the promise with
46
- * @returns void
47
- */
48
- complete(value: T | PromiseLike<T>): void;
49
- resolve(value: T | PromiseLike<T>): void;
50
- hasCompleted(): boolean;
51
- attemptCount(): number;
52
- private _tryPromiseFn;
53
- }
54
- export declare function retryPromise<T = any>(promiseFn: () => Promise<T>, retry?: boolean | number | ((error?: Error | any, attemptCount?: number) => boolean), retryInterval?: number, _logger?: any): RetryPromise<T>;
@@ -1,94 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.retryPromise = exports.RetryPromise = void 0;
4
- const tslib_1 = require("tslib");
5
- const uuid_1 = require("uuid");
6
- const wildemitter_1 = tslib_1.__importDefault(require("wildemitter"));
7
- class RetryPromise extends wildemitter_1.default {
8
- constructor(config) {
9
- super();
10
- this._id = uuid_1.v4();
11
- this._hasCompleted = false;
12
- this._attemptCount = 0;
13
- this.promise = new Promise((resolve, reject) => {
14
- this._resolve = resolve;
15
- this._reject = reject;
16
- });
17
- this._config = {
18
- promiseFn: config.promiseFn,
19
- retry: config.retry || false,
20
- retryInterval: config.retryInterval !== undefined && config.retryInterval > -1 ? config.retryInterval : 15000
21
- };
22
- /* tslint:disable:no-floating-promises */
23
- this._tryPromiseFn();
24
- }
25
- /**
26
- * @deprecated use `reject(reason)`
27
- * @param reason value to reject the promise with
28
- * @returns void
29
- */
30
- cancel(reason) {
31
- return this.reject(reason);
32
- }
33
- reject(reason) {
34
- this._reject(reason);
35
- clearTimeout(this._timeout);
36
- this._hasCompleted = true;
37
- this.emit('rejected', reason);
38
- }
39
- /**
40
- * @deprecated use `resolve(reason)`
41
- * @param value to resolve the promise with
42
- * @returns void
43
- */
44
- complete(value) {
45
- return this.resolve(value);
46
- }
47
- resolve(value) {
48
- this._resolve(value);
49
- clearTimeout(this._timeout);
50
- this._hasCompleted = true;
51
- this.emit('resolved', value);
52
- }
53
- hasCompleted() {
54
- return this._hasCompleted;
55
- }
56
- attemptCount() {
57
- return this._attemptCount;
58
- }
59
- async _tryPromiseFn() {
60
- const { retry, retryInterval } = this._config;
61
- try {
62
- this._attemptCount++;
63
- this.emit('trying', {
64
- attemptCount: this._attemptCount,
65
- promise: this.promise
66
- });
67
- const val = await this._config.promiseFn();
68
- this.resolve(val);
69
- }
70
- catch (error) {
71
- if (
72
- /* always retry */
73
- retry === true ||
74
- /* retry if under max retry attempts */
75
- typeof retry === 'number' && this._attemptCount <= retry ||
76
- /* retry if retry function returns true */
77
- typeof retry === 'function' && retry(error, this._attemptCount + 1)) {
78
- this.emit('retrying', {
79
- error,
80
- attemptCount: this._attemptCount,
81
- retryInterval
82
- });
83
- this._timeout = setTimeout(this._tryPromiseFn.bind(this), retryInterval);
84
- return;
85
- }
86
- this.reject(error);
87
- }
88
- }
89
- }
90
- exports.RetryPromise = RetryPromise;
91
- function retryPromise(promiseFn, retry, retryInterval = 15000, _logger = console) {
92
- return new RetryPromise({ promiseFn, retry, retryInterval });
93
- }
94
- exports.retryPromise = retryPromise;