Skip to content

Commit 1f21c09

Browse files
Release/v20.0.0 (#361)
* [STREAM-1604] - Replace UUID with native alternative (#356) * Update uuid, first pass UUID is transitive thorugh jest and jest-junit. jest-mock-axios wasnt used * Remove UUID * Add crypto to setup-browser-env * Update tests * Dont bump jest versions yet * Update CHANGELOG * Also bump client logger * remove @types/uuid * lock * Prep v19.8.1 * changelog * fix package version * update changelog * update version to 20 --------- Co-authored-by: Jon Hjelle <jon.hjelle@genesys.com>
1 parent c57f2ab commit 1f21c09

17 files changed

Lines changed: 7274 additions & 4876 deletions

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7-
# [Unreleased](https://github.com/purecloudlabs/genesys-cloud-streaming-client/compare/v19.8.0...HEAD)
7+
# [Unreleased](https://github.com/purecloudlabs/genesys-cloud-streaming-client/compare/v20.0.0...HEAD)
8+
9+
# [v20.0.0](https://github.com/purecloudlabs/genesys-cloud-streaming-client/compare/v19.8.0...v20.0.0)
10+
### Breaking Changes
11+
* [STREAM-1604](https://inindca.atlassian.net/browse/STREAM-1604) - Replace `uuid` with native `globalThis.crypto.randomUUID()`. `randomUUID()` has been widely available in browsers since 2022, so this should only affect you if you use streaming-client in an older browser. Also update `genesys-cloud-client-logger` from v4.2.18 to v5. Bump genesys-cloud-client-logger to v5.0.0.
812

913
# [v19.8.0](https://github.com/purecloudlabs/genesys-cloud-streaming-client/compare/v19.7.1...v19.8.0)
1014
### Added

jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ module.exports = {
99
'<rootDir>/test/unit/**/*.(ts|js)'
1010
],
1111
setupFiles: [
12+
'<rootDir>/test/helpers/setup-browser-env.js'
1213
],
1314
transform: {
1415
'^.+\\.jsx?$': 'babel-jest',

package-lock.json

Lines changed: 7240 additions & 4836 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "genesys-cloud-streaming-client",
3-
"version": "19.8.0",
3+
"version": "20.0.0",
44
"description": "client for the Genesys Cloud Streaming APIs (websocket/xmpp interface)",
55
"repository": "https:github.com/purecloudlabs/genesys-cloud-streaming-client",
66
"license": "MIT",
@@ -56,15 +56,14 @@
5656
"core-js": "^3.6.5",
5757
"debounce-promise": "^3.1.2",
5858
"exponential-backoff": "^3.1.1",
59-
"genesys-cloud-client-logger": "^4.2.18",
59+
"genesys-cloud-client-logger": "^5.0.0",
6060
"limiter": "^1.1.0",
6161
"lodash.throttle": "^4.1.1",
6262
"lru-cache": "^11.0.1",
6363
"stanza": "^12.20.0",
6464
"strict-event-emitter": "^0.5.0",
6565
"strict-event-emitter-types": "^2.0.0",
6666
"unorm": "^1.6.0",
67-
"uuid": "^9.0.1",
6867
"webrtc-stats-gatherer": "^9.0.10",
6968
"whatwg-fetch": "^3.0.0",
7069
"wildemitter": "^1.2.1",
@@ -89,7 +88,6 @@
8988
"@types/lodash.throttle": "^4.1.6",
9089
"@types/nock": "^11.1.0",
9190
"@types/node": "^14.6.2",
92-
"@types/uuid": "^9.0.7",
9391
"@typescript-eslint/eslint-plugin": "^6.21.0",
9492
"@typescript-eslint/parser": "^6.21.0",
9593
"atob": "^2.1.2",

src/client.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import SaslError from './types/sasl-error';
2323
import { TimeoutError } from './types/timeout-error';
2424
import { MessengerExtensionApi, MessengerExtension } from './messenger';
2525
import { SASLFailureCondition } from 'stanza/Constants';
26-
import { v4 } from 'uuid';
2726
import { ConnectionTransfer } from './connection-transfer';
2827
import UserCancelledError from './types/user-cancelled-error';
2928

@@ -756,7 +755,7 @@ export class Client extends EventEmitter {
756755
}
757756

758757
// If no jidResource is provided, generate a random one to maintain ourselves.
759-
this.jidResource = this.config.jidResource || v4();
758+
this.jidResource = this.config.jidResource || globalThis.crypto.randomUUID();
760759

761760
const channelRequestOpts: RequestApiOptions = {
762761
method: 'post',

src/connection-manager.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import Logger from 'genesys-cloud-client-logger';
1111
import { AgentConfig, createClient } from 'stanza';
1212
import { SASL } from 'stanza/protocol';
13-
import { v4 } from 'uuid';
1413
import { IClientConfig } from './types/interfaces';
1514
import { NamedAgent } from './types/named-agent';
1615
import SaslError from './types/sasl-error';
@@ -35,7 +34,7 @@ export class ConnectionManager {
3534
(stanza.sasl as any).mechanisms = (stanza.sasl as any).mechanisms.sort((a, b) => b.priority - a.priority);
3635

3736
// we are going to give the stanza instance an id for tracking and logging purposes
38-
stanza.id = v4();
37+
stanza.id = globalThis.crypto.randomUUID();
3938
const channelId = stanza.channelId = this.config.channelId;
4039

4140
let boundCheckForErrorStanza: (rawString: string) => void;

src/messenger.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { GenesysMediaMessage, StreamingClientExtension } from './types/interface
77

88
import { Emitter } from 'strict-event-emitter';
99
import { toBare } from 'stanza/JID';
10-
import { v4 } from 'uuid';
1110

1211
type MessageWithMediaMessage = {
1312
from?: string;
@@ -58,7 +57,7 @@ export class MessengerExtension extends Emitter<MessengerEvents> implements Stre
5857
* @returns Promise<messageId>
5958
*/
6059
async broadcastMessage (msg: MessageWithMediaMessage): Promise<string> {
61-
const id = v4();
60+
const id = globalThis.crypto.randomUUID();
6261
msg.id = id;
6362
msg.from = this.stanzaInstance.jid;
6463

src/types/genesys-cloud-media-session.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { JingleReason, IQ } from 'stanza/protocol';
55
import { ConnectionState, IGenesysCloudMediaSessionParams, IMediaSession, IMediaSessionParams, SessionState } from './media-session';
66
import Logger, { ILogMessageOptions } from 'genesys-cloud-client-logger';
77
import { WebrtcExtension } from '../webrtc';
8-
import { v4 } from 'uuid';
98
import { timeoutPromise } from '../utils';
109
import { SessionTypes, GenesysSessionTerminateParams, GenesysInfoActiveParams, GenesysWebrtcSdpParams, GenesysWebrtcMuteParams, GenesysWebrtcJsonRpcMessage } from './interfaces';
1110

@@ -129,7 +128,7 @@ export class GenesysCloudMediaSession {
129128
}
130129

131130
private async sendGenesysWebrtc (info: GenesysWebrtcJsonRpcMessage): Promise<any> {
132-
info.id = info.id || v4();
131+
info.id = info.id || globalThis.crypto.randomUUID();
133132
info.jsonrpc = info.jsonrpc || '2.0';
134133

135134
const iq: IQ = {

src/utils.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { v4 } from 'uuid';
21
import { TimeoutError } from './types/timeout-error';
32
import { StreamingClientErrorTypes, StreamingSubscriptionErrorDetails } from './types/interfaces';
43

@@ -160,7 +159,7 @@ export function retryPromise<T = any> (
160159
promise,
161160
cancel,
162161
complete,
163-
_id: v4(),
162+
_id: globalThis.crypto.randomUUID(),
164163
hasCompleted: () => _hasCompleted
165164
};
166165
}

src/webrtc.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { toBare } from 'stanza/JID';
44
import { LRUCache } from 'lru-cache';
55
import { JingleAction } from 'stanza/Constants';
66
import { SessionManager } from 'stanza/jingle';
7-
import { v4 } from 'uuid';
87
import { StatsEvent } from 'webrtc-stats-gatherer';
98
import throttle from 'lodash.throttle';
109
import JingleSession, { SessionOpts } from 'stanza/jingle/Session';
@@ -724,7 +723,7 @@ export class WebrtcExtension extends EventEmitter implements StreamingClientExte
724723
const session: any = {
725724
to: opts.jid,
726725
propose: {
727-
id: v4(),
726+
id: globalThis.crypto.randomUUID(),
728727
descriptions: []
729728
}
730729
};
@@ -767,7 +766,7 @@ export class WebrtcExtension extends EventEmitter implements StreamingClientExte
767766
const mediaPresence = {
768767
type: 'upgradeMedia' as any,
769768
to: opts.jid,
770-
id: v4(),
769+
id: globalThis.crypto.randomUUID(),
771770
from: this.jid,
772771
media: {
773772
conversationId: opts.conversationId,

0 commit comments

Comments
 (0)