From d1957d97c10f459b0ba8131e1c187cecf19ae17e Mon Sep 17 00:00:00 2001 From: Amin Mahboubi Date: Fri, 15 May 2020 13:45:46 +0200 Subject: [PATCH] bump uuid to v8 (#323) --- package.json | 2 +- rollup.config.js | 2 +- src/client.js | 2 +- test/channel_permissions.js | 2 +- test/channels.js | 2 +- test/connection.js | 2 +- test/delete_channel.js | 2 +- test/gdpr.js | 2 +- test/invites.js | 2 +- test/moderation.js | 2 +- test/multitenant.js | 2 +- test/notifications.js | 2 +- test/presence.js | 2 +- test/query_users.js | 2 +- test/reactions.js | 2 +- test/serverside.js | 2 +- test/test.js | 2 +- test/threads.js | 2 +- test/webhook.js | 2 +- test/x-setup.js | 2 +- .../response-generators/channel-search.js | 6 ++-- .../response-generators/channel-type.js | 2 +- .../response-generators/channel.js | 2 +- .../response-generators/client.js | 2 +- .../response-generators/event.js | 10 +++--- .../response-generators/message.js | 2 +- .../response-generators/moderation.js | 2 +- .../response-generators/reaction.js | 10 +++--- .../response-generators/update-users.js | 32 +++++++++---------- yarn.lock | 5 +++ 30 files changed, 59 insertions(+), 54 deletions(-) diff --git a/package.json b/package.json index d3165ffcc..9c4835ce9 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "isomorphic-ws": "^4.0.1", "jsonwebtoken": "^8.3.0", "seamless-immutable": "^7.1.4", - "uuid": "^3.3.2", + "uuid": "^8.0.0", "ws": "^6.1.3" }, "devDependencies": { diff --git a/rollup.config.js b/rollup.config.js index 570eea913..8aa718527 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -22,7 +22,7 @@ const externalPackages = [ 'isomorphic-ws', 'lodash', 'seamless-immutable', - 'uuid/v4', + 'uuid', 'base64-js', '@babel/runtime/regenerator', '@babel/runtime/helpers/asyncToGenerator', diff --git a/src/client.js b/src/client.js index 75408874d..75c64b528 100644 --- a/src/client.js +++ b/src/client.js @@ -2,7 +2,7 @@ /* global process */ import axios from 'axios'; -import uuidv4 from 'uuid/v4'; +import { v4 as uuidv4 } from 'uuid'; import { Channel } from './channel'; import { ClientState } from './client_state'; import { StableWSConnection } from './connection'; diff --git a/test/channel_permissions.js b/test/channel_permissions.js index b21bf1e47..4c607478a 100644 --- a/test/channel_permissions.js +++ b/test/channel_permissions.js @@ -1,5 +1,5 @@ import { getTestClient } from './utils'; -import uuidv4 from 'uuid/v4'; +import { v4 as uuidv4 } from 'uuid'; import fs from 'fs'; class Context { diff --git a/test/channels.js b/test/channels.js index 9bc85e9c5..5fb25ad16 100644 --- a/test/channels.js +++ b/test/channels.js @@ -1,4 +1,4 @@ -import uuidv4 from 'uuid/v4'; +import { v4 as uuidv4 } from 'uuid'; import { createUsers, diff --git a/test/connection.js b/test/connection.js index 32eaa9ec5..5fb792f31 100644 --- a/test/connection.js +++ b/test/connection.js @@ -1,7 +1,7 @@ import { StableWSConnection } from '../src/connection'; import { sleep } from '../src/utils'; import { getTestClientForUser, getTestClient, createUserToken } from './utils'; -import uuidv4 from 'uuid/v4'; +import { v4 as uuidv4 } from 'uuid'; import chai from 'chai'; const expect = chai.expect; diff --git a/test/delete_channel.js b/test/delete_channel.js index a8fa07d13..170085d0d 100644 --- a/test/delete_channel.js +++ b/test/delete_channel.js @@ -1,4 +1,4 @@ -import uuidv4 from 'uuid/v4'; +import { v4 as uuidv4 } from 'uuid'; import { getTestClientForUser, createUsers, getServerTestClient } from './utils'; import chai from 'chai'; import chaiAsPromised from 'chai-as-promised'; diff --git a/test/gdpr.js b/test/gdpr.js index c95e26155..db143973b 100644 --- a/test/gdpr.js +++ b/test/gdpr.js @@ -16,7 +16,7 @@ import { sleep, expectHTTPErrorCode, } from './utils'; -import uuidv4 from 'uuid/v4'; +import { v4 as uuidv4 } from 'uuid'; const expect = chai.expect; diff --git a/test/invites.js b/test/invites.js index 1c701e8aa..832776825 100644 --- a/test/invites.js +++ b/test/invites.js @@ -8,7 +8,7 @@ import { getTestClient, getTestClientForUser, } from './utils'; -import uuidv4 from 'uuid/v4'; +import { v4 as uuidv4 } from 'uuid'; const expect = chai.expect; diff --git a/test/moderation.js b/test/moderation.js index 75b6c7248..fedc25b45 100644 --- a/test/moderation.js +++ b/test/moderation.js @@ -1,4 +1,4 @@ -import uuidv4 from 'uuid/v4'; +import { v4 as uuidv4 } from 'uuid'; import { getTestClientForUser, createUsers, diff --git a/test/multitenant.js b/test/multitenant.js index 136fcde0b..ffc6cf548 100644 --- a/test/multitenant.js +++ b/test/multitenant.js @@ -1,5 +1,5 @@ import { getTestClient, createUserToken, getTestClientForUser } from './utils'; -import uuidv4 from 'uuid/v4'; +import { v4 as uuidv4 } from 'uuid'; import chai from 'chai'; import chaiAsPromised from 'chai-as-promised'; import { BuiltinPermissions } from '../src'; diff --git a/test/notifications.js b/test/notifications.js index 58b85203f..d53628089 100644 --- a/test/notifications.js +++ b/test/notifications.js @@ -7,7 +7,7 @@ import { sleep, createUsers, } from './utils'; -import uuidv4 from 'uuid/v4'; +import { v4 as uuidv4 } from 'uuid'; describe('Notifications - members not watching', function() { const serverSideClient = getTestClient(true); diff --git a/test/presence.js b/test/presence.js index b7434f620..cc3ad5623 100644 --- a/test/presence.js +++ b/test/presence.js @@ -16,7 +16,7 @@ import { getServerTestClient, newEventPromise, } from './utils'; -import uuidv4 from 'uuid/v4'; +import { v4 as uuidv4 } from 'uuid'; const expect = chai.expect; diff --git a/test/query_users.js b/test/query_users.js index ee24e965d..c47bb208c 100644 --- a/test/query_users.js +++ b/test/query_users.js @@ -15,7 +15,7 @@ import { runAndLogPromise, sleep, } from './utils'; -import uuidv4 from 'uuid/v4'; +import { v4 as uuidv4 } from 'uuid'; const expect = chai.expect; diff --git a/test/reactions.js b/test/reactions.js index a1fd4cd43..e01350e8f 100644 --- a/test/reactions.js +++ b/test/reactions.js @@ -3,7 +3,7 @@ import chai from 'chai'; import chaiAsPromised from 'chai-as-promised'; import { expectHTTPErrorCode, getTestClient, getTestClientForUser } from './utils'; -import uuidv4 from 'uuid/v4'; +import { v4 as uuidv4 } from 'uuid'; const expect = chai.expect; diff --git a/test/serverside.js b/test/serverside.js index e9fb0c9cd..2405c3977 100644 --- a/test/serverside.js +++ b/test/serverside.js @@ -14,7 +14,7 @@ import { DenyAll, Permission, } from '../src/permissions'; -import uuidv4 from 'uuid/v4'; +import { v4 as uuidv4 } from 'uuid'; import chai from 'chai'; import fs from 'fs'; import chaiLike from 'chai-like'; diff --git a/test/test.js b/test/test.js index 9bd9d4ac9..65ba91809 100644 --- a/test/test.js +++ b/test/test.js @@ -18,7 +18,7 @@ import { createUsers, sleep, } from './utils'; -import uuidv4 from 'uuid/v4'; +import { v4 as uuidv4 } from 'uuid'; const expect = chai.expect; chai.use(assertArrays); diff --git a/test/threads.js b/test/threads.js index d47079c54..f512a9041 100644 --- a/test/threads.js +++ b/test/threads.js @@ -14,7 +14,7 @@ import { sleep, runAndLogPromise, } from './utils'; -import uuidv4 from 'uuid/v4'; +import { v4 as uuidv4 } from 'uuid'; const expect = chai.expect; diff --git a/test/webhook.js b/test/webhook.js index a27308cec..095079bc8 100644 --- a/test/webhook.js +++ b/test/webhook.js @@ -1,7 +1,7 @@ import chai from 'chai'; import http from 'http'; import { getTestClient, getTestClientForUser, sleep } from './utils'; -import uuidv4 from 'uuid/v4'; +import { v4 as uuidv4 } from 'uuid'; const expect = chai.expect; diff --git a/test/x-setup.js b/test/x-setup.js index 62db05003..3478d08ea 100644 --- a/test/x-setup.js +++ b/test/x-setup.js @@ -1,6 +1,6 @@ import { Permission, AnyResource, AnyRole, Allow } from '../src'; import { getTestClient } from './utils'; -import uuidv4 from 'uuid/v4'; +import { v4 as uuidv4 } from 'uuid'; async function setupEverythingDisabledChannel(serverAuthClient) { try { diff --git a/types/stream-chat/api-response-tests/response-generators/channel-search.js b/types/stream-chat/api-response-tests/response-generators/channel-search.js index 9738a38cf..f98e8e519 100644 --- a/types/stream-chat/api-response-tests/response-generators/channel-search.js +++ b/types/stream-chat/api-response-tests/response-generators/channel-search.js @@ -1,11 +1,11 @@ -const uuid4 = require('uuid/v4'); +const { v4: uuidv4 } = require('uuid'); const utils = require('../utils'); -const johnID = `john-${uuid4()}`; +const johnID = `john-${uuidv4()}`; async function channelSearch() { const authClient = await utils.getTestClientForUser(johnID, {}); - const channel = authClient.channel('messaging', `poppins-${uuid4()}`, { + const channel = authClient.channel('messaging', `poppins-${uuidv4()}`, { members: [johnID], }); await channel.create(); diff --git a/types/stream-chat/api-response-tests/response-generators/channel-type.js b/types/stream-chat/api-response-tests/response-generators/channel-type.js index bba8a6f16..c713ac81e 100644 --- a/types/stream-chat/api-response-tests/response-generators/channel-type.js +++ b/types/stream-chat/api-response-tests/response-generators/channel-type.js @@ -1,4 +1,4 @@ -const uuidv4 = require('uuid/v4'); +const { v4: uuidv4 } = require('uuid'); const utils = require('../utils'); async function createChannelType() { diff --git a/types/stream-chat/api-response-tests/response-generators/channel.js b/types/stream-chat/api-response-tests/response-generators/channel.js index f2e123640..c3299efe7 100644 --- a/types/stream-chat/api-response-tests/response-generators/channel.js +++ b/types/stream-chat/api-response-tests/response-generators/channel.js @@ -1,4 +1,4 @@ -const uuidv4 = require('uuid/v4'); +const { v4: uuidv4 } = require('uuid'); const utils = require('../utils'); const johnID = `john-${uuidv4()}`; diff --git a/types/stream-chat/api-response-tests/response-generators/client.js b/types/stream-chat/api-response-tests/response-generators/client.js index 9f82410d5..c21d7166e 100644 --- a/types/stream-chat/api-response-tests/response-generators/client.js +++ b/types/stream-chat/api-response-tests/response-generators/client.js @@ -1,4 +1,4 @@ -const uuidv4 = require('uuid/v4'); +const { v4: uuidv4 } = require('uuid'); const utils = require('../utils'); async function setUser() { diff --git a/types/stream-chat/api-response-tests/response-generators/event.js b/types/stream-chat/api-response-tests/response-generators/event.js index 1f061d7dc..911e6f805 100644 --- a/types/stream-chat/api-response-tests/response-generators/event.js +++ b/types/stream-chat/api-response-tests/response-generators/event.js @@ -1,11 +1,11 @@ -const uuid4 = require('uuid/v4'); +const { v4: uuidv4 } = require('uuid'); const utils = require('../utils'); -const johnID = `john-${uuid4()}`; +const johnID = `john-${uuidv4()}`; async function sendMessageReadEvent() { const authClient = await utils.getTestClientForUser(johnID, {}); - const channel = authClient.channel('messaging', `poppins-${uuid4()}`); + const channel = authClient.channel('messaging', `poppins-${uuidv4()}`); await channel.watch(); const event = { type: 'message.read', @@ -16,7 +16,7 @@ async function sendMessageReadEvent() { async function keystroke() { const authClient = await utils.getTestClientForUser(johnID, {}); - const channel = authClient.channel('messaging', `poppins-${uuid4()}`); + const channel = authClient.channel('messaging', `poppins-${uuidv4()}`); await channel.watch(); return await channel.keystroke(); @@ -24,7 +24,7 @@ async function keystroke() { async function stopTyping() { const authClient = await utils.getTestClientForUser(johnID, {}); - const channel = authClient.channel('messaging', `poppins-${uuid4()}`); + const channel = authClient.channel('messaging', `poppins-${uuidv4()}`); await channel.watch(); return await channel.stopTyping(); diff --git a/types/stream-chat/api-response-tests/response-generators/message.js b/types/stream-chat/api-response-tests/response-generators/message.js index 07fcc48ed..8284af7ee 100644 --- a/types/stream-chat/api-response-tests/response-generators/message.js +++ b/types/stream-chat/api-response-tests/response-generators/message.js @@ -1,4 +1,4 @@ -const uuidv4 = require('uuid/v4'); +const { v4: uuidv4 } = require('uuid'); const utils = require('../utils'); const johnID = `john-${uuidv4()}`; diff --git a/types/stream-chat/api-response-tests/response-generators/moderation.js b/types/stream-chat/api-response-tests/response-generators/moderation.js index cd1639e5e..e84ca40aa 100644 --- a/types/stream-chat/api-response-tests/response-generators/moderation.js +++ b/types/stream-chat/api-response-tests/response-generators/moderation.js @@ -1,4 +1,4 @@ -const uuidv4 = require('uuid/v4'); +const { v4: uuidv4 } = require('uuid'); const utils = require('../utils'); async function banUsers() { diff --git a/types/stream-chat/api-response-tests/response-generators/reaction.js b/types/stream-chat/api-response-tests/response-generators/reaction.js index dec859bfb..2cd3321b4 100644 --- a/types/stream-chat/api-response-tests/response-generators/reaction.js +++ b/types/stream-chat/api-response-tests/response-generators/reaction.js @@ -1,11 +1,11 @@ -const uuid4 = require('uuid/v4'); +const { v4: uuidv4 } = require('uuid'); const utils = require('../utils'); -const johnID = `john-${uuid4()}`; +const johnID = `john-${uuidv4()}`; async function sendReaction() { const authClient = await utils.getTestClientForUser(johnID, {}); - const channel = authClient.channel('messaging', `poppins-${uuid4()}`); + const channel = authClient.channel('messaging', `poppins-${uuidv4()}`); await channel.watch(); const { message } = await channel.sendMessage({ text: `Test message` }); @@ -14,7 +14,7 @@ async function sendReaction() { async function deleteReaction() { const authClient = await utils.getTestClientForUser(johnID, {}); - const channel = authClient.channel('messaging', `poppins-${uuid4()}`); + const channel = authClient.channel('messaging', `poppins-${uuidv4()}`); await channel.watch(); const { message } = await channel.sendMessage({ text: `Test message` }); @@ -25,7 +25,7 @@ async function deleteReaction() { async function getReactions() { const authClient = await utils.getTestClientForUser(johnID, {}); - const channel = authClient.channel('messaging', `poppins-${uuid4()}`); + const channel = authClient.channel('messaging', `poppins-${uuidv4()}`); await channel.watch(); const text = 'testing reactions list'; const data = await channel.sendMessage({ text }); diff --git a/types/stream-chat/api-response-tests/response-generators/update-users.js b/types/stream-chat/api-response-tests/response-generators/update-users.js index 0cdd663b5..9bd7d4889 100644 --- a/types/stream-chat/api-response-tests/response-generators/update-users.js +++ b/types/stream-chat/api-response-tests/response-generators/update-users.js @@ -1,12 +1,12 @@ -const uuid4 = require('uuid/v4'); +const { v4: uuidv4 } = require('uuid'); const utils = require('../utils'); async function updateUsers() { const client = utils.getServerTestClient(); - const userID = uuid4(); - const userID2 = uuid4(); - const userID3 = uuid4(); - const unique = uuid4(); + const userID = uuidv4(); + const userID2 = uuidv4(); + const userID3 = uuidv4(); + const unique = uuidv4(); return await client.updateUsers([ { @@ -29,8 +29,8 @@ async function updateUsers() { async function partialUpdateUser() { const client = utils.getServerTestClient(); - const userID = uuid4(); - const unique = uuid4(); + const userID = uuidv4(); + const unique = uuidv4(); await client.updateUsers([ { @@ -53,10 +53,10 @@ async function partialUpdateUser() { async function partialUpdateUsers() { const client = utils.getServerTestClient(); - const userID = uuid4(); - const userID2 = uuid4(); - const userID3 = uuid4(); - const unique = uuid4(); + const userID = uuidv4(); + const userID2 = uuidv4(); + const userID3 = uuidv4(); + const unique = uuidv4(); await client.updateUsers([ { @@ -110,7 +110,7 @@ async function partialUpdateUsers() { async function deactivateUser() { const client = utils.getServerTestClient(); - const userID = uuid4(); + const userID = uuidv4(); await client.upsertUser({ id: userID, name: 'Vishal', @@ -121,7 +121,7 @@ async function deactivateUser() { async function reactivateUser() { const client = utils.getServerTestClient(); - const userID = uuid4(); + const userID = uuidv4(); await client.upsertUser({ id: userID, name: 'Vishal', @@ -134,7 +134,7 @@ async function reactivateUser() { async function deleteUser() { const client = utils.getServerTestClient(); - const userID = uuid4(); + const userID = uuidv4(); await client.upsertUser({ id: userID, name: 'Vishal', @@ -145,13 +145,13 @@ async function deleteUser() { async function exportUser() { const client = utils.getServerTestClient(); - const userID = uuid4(); + const userID = uuidv4(); await client.upsertUser({ id: userID, name: 'Vishal', }); - const id = uuid4(); + const id = uuidv4(); const channel = client.channel('messaging', id, { created_by_id: userID }); await channel.create(); const { message } = await channel.sendMessage({ diff --git a/yarn.lock b/yarn.lock index 5052b40cf..71db9b56a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6046,6 +6046,11 @@ uuid@^3.1.0, uuid@^3.3.2: resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.3.tgz#4568f0216e78760ee1dbf3a4d2cf53e224112866" integrity sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ== +uuid@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.0.0.tgz#bc6ccf91b5ff0ac07bbcdbf1c7c4e150db4dbb6c" + integrity sha512-jOXGuXZAWdsTH7eZLtyXMqUb9EcWMGZNbL9YcGBJl4MH4nrxHmZJhEHvyLFrkxo+28uLb/NYRcStH48fnD0Vzw== + v8flags@^3.1.1: version "3.1.3" resolved "https://registry.yarnpkg.com/v8flags/-/v8flags-3.1.3.tgz#fc9dc23521ca20c5433f81cc4eb9b3033bb105d8"