Skip to content

Commit eecbd6b

Browse files
authored
fix: remove uuid as a dependency (#318)
Removes uuid as a dependency to use built-in node API
1 parent 30fb008 commit eecbd6b

20 files changed

Lines changed: 49 additions & 55 deletions

‎__tests__/agent.test.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { v4 as uuidv4 } from 'uuid';
1+
import { randomUUID } from 'crypto';
22
import { vi, describe, expect, it } from 'vitest';
33
import { createTestClient } from './create-test-client.js';
44
import { StreamClient } from '../src/StreamClient.js';
@@ -8,7 +8,7 @@ const enableDebugLogging = false;
88

99
async function createTestStreamAndRealtimeClients() {
1010
const streamClient = createTestClient();
11-
const call = streamClient.video.call('default', `call${uuidv4()}`);
11+
const call = streamClient.video.call('default', `call${randomUUID()}`);
1212

1313
const realtimeClient = await streamClient.video.connectOpenAi({
1414
call,
@@ -37,7 +37,7 @@ describe.skip('AI agent integration', () => {
3737

3838
it('should throw on invalid OpenAI credentials', async () => {
3939
const streamClient = createTestClient();
40-
const call = streamClient.video.call('default', `call${uuidv4()}`);
40+
const call = streamClient.video.call('default', `call${randomUUID()}`);
4141

4242
await expect(
4343
streamClient.video.connectOpenAi({
@@ -51,7 +51,7 @@ describe.skip('AI agent integration', () => {
5151

5252
it('should throw on invalid Stream credentials', async () => {
5353
const streamClient = new StreamClient('', 'secret');
54-
const call = streamClient.video.call('default', `call${uuidv4()}`);
54+
const call = streamClient.video.call('default', `call${randomUUID()}`);
5555

5656
await expect(
5757
streamClient.video.connectOpenAi({

‎__tests__/block-lists.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { beforeAll, describe, expect, it } from 'vitest';
2-
import { v4 as uuidv4 } from 'uuid';
2+
import { randomUUID } from 'crypto';
33
import { createTestClient } from './create-test-client';
44
import { StreamClient } from '../src/StreamClient';
55
import { CreateBlockListRequest } from '../src/gen/models';
@@ -11,7 +11,7 @@ describe('block lists CRUD API', () => {
1111
beforeAll(() => {
1212
client = createTestClient();
1313
blockList = {
14-
name: 'streamnodetest-F1' + uuidv4(),
14+
name: 'streamnodetest-F1' + randomUUID(),
1515
words: ['Ricciardo should retire'],
1616
};
1717
});

‎__tests__/call-members.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { beforeAll, describe, expect, it } from 'vitest';
2-
import { v4 as uuidv4 } from 'uuid';
2+
import { randomUUID } from 'crypto';
33
import { createTestClient } from './create-test-client';
44
import { StreamCall } from '../src/StreamCall';
55
import { StreamClient } from '../src/StreamClient';
66
import { OwnCapability } from '../src/gen/models';
77

88
describe('call members API', () => {
99
let client: StreamClient;
10-
const callId = `call${uuidv4()}`;
10+
const callId = `call${randomUUID()}`;
1111
let call: StreamCall;
1212

1313
beforeAll(async () => {

‎__tests__/call-types.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { beforeAll, describe, expect, it } from 'vitest';
2-
import { v4 as uuidv4 } from 'uuid';
2+
import { randomUUID } from 'crypto';
33
import { createTestClient } from './create-test-client';
44
import { StreamClient } from '../src/StreamClient';
55
import { OwnCapability } from '../src/gen/models';
66

77
describe('call types CRUD API', () => {
88
let client: StreamClient;
9-
const callTypeName = `streamnodetest${uuidv4()}`;
9+
const callTypeName = `streamnodetest${randomUUID()}`;
1010

1111
beforeAll(() => {
1212
client = createTestClient();

‎__tests__/call.test.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { beforeAll, describe, expect, it } from 'vitest';
2-
import { v4 as uuidv4 } from 'uuid';
2+
import { randomUUID } from 'crypto';
33
import { createTestClient } from './create-test-client';
44
import { StreamCall } from '../src/StreamCall';
55
import { StreamClient } from '../src/StreamClient';
66

77
describe('call API', () => {
88
let client: StreamClient;
9-
const callId = `call${uuidv4()}`;
9+
const callId = `call${randomUUID()}`;
1010
let call: StreamCall;
1111

1212
beforeAll(async () => {
@@ -207,7 +207,7 @@ describe('call API', () => {
207207
});
208208

209209
it('generate SRT credentials', async () => {
210-
const call = client.video.call('default', `call${uuidv4()}`);
210+
const call = client.video.call('default', `call${randomUUID()}`);
211211
await call.getOrCreate({
212212
data: {
213213
created_by_id: 'john',

‎__tests__/channel-types.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { beforeAll, describe, expect, it } from 'vitest';
2-
import { v4 as uuidv4 } from 'uuid';
2+
import { randomUUID } from 'crypto';
33
import { createTestClient } from './create-test-client';
44
import { StreamClient } from '../src/StreamClient';
55

66
describe('channel types CRUD API', () => {
77
let client: StreamClient;
8-
const channelType = 'streamnodetest' + uuidv4();
8+
const channelType = 'streamnodetest' + randomUUID();
99

1010
beforeAll(() => {
1111
client = createTestClient();

‎__tests__/channel.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { beforeAll, describe, expect, it } from 'vitest';
2-
import { v4 as uuidv4 } from 'uuid';
2+
import { randomUUID } from 'crypto';
33
import { createTestClient } from './create-test-client';
44
import { StreamClient } from '../src/StreamClient';
55
import { StreamChannel } from '../src/StreamChannel';
66

77
describe('channel API', () => {
88
let client: StreamClient;
9-
const channelId = 'streamnodetest' + uuidv4();
9+
const channelId = 'streamnodetest' + randomUUID();
1010
let channel: StreamChannel;
1111
const user = {
1212
id: 'stream-node-test-user',

‎__tests__/command.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { beforeAll, describe, expect, it } from 'vitest';
2-
import { v4 as uuidv4 } from 'uuid';
2+
import { randomUUID } from 'crypto';
33
import { createTestClient } from './create-test-client';
44
import { StreamClient } from '../src/StreamClient';
55

66
describe('commands CRUD API', () => {
77
let client: StreamClient;
8-
const commandName = 'stream-node-test-command' + uuidv4();
8+
const commandName = 'stream-node-test-command' + randomUUID();
99

1010
beforeAll(() => {
1111
client = createTestClient();

‎__tests__/date-transform.test.ts‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { beforeAll, describe, expect, it } from 'vitest';
2-
import { v4 as uuidv4 } from 'uuid';
2+
import { randomUUID } from 'crypto';
33
import { createTestClient } from './create-test-client';
44
import { StreamClient } from '../src/StreamClient';
55
import { UserRequest } from '../src/gen/models';
@@ -21,7 +21,7 @@ describe('Date conversion', () => {
2121
});
2222

2323
it('call + members', async () => {
24-
const id = uuidv4();
24+
const id = randomUUID();
2525
const call = client.video.call('default', id);
2626
const startsAt = new Date();
2727
const response = await call.create({
@@ -62,7 +62,7 @@ describe('Date conversion', () => {
6262
});
6363

6464
it('channel + members', async () => {
65-
const id = uuidv4();
65+
const id = randomUUID();
6666
const channel = client.chat.channel('messaging', id);
6767
const response = await channel.getOrCreate({
6868
data: {
@@ -104,8 +104,8 @@ describe('Date conversion', () => {
104104

105105
it('users', async () => {
106106
const newUser: UserRequest = {
107-
id: uuidv4(),
108-
name: 'streamnodetest' + uuidv4(),
107+
id: randomUUID(),
108+
name: 'streamnodetest' + randomUUID(),
109109
custom: {
110110
created_at: new Date(),
111111
},

‎__tests__/devices-push.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { beforeAll, describe, expect, it } from 'vitest';
2-
import { v4 as uuidv4 } from 'uuid';
2+
import { randomUUID } from 'crypto';
33
import { createTestClient } from './create-test-client';
44
import { StreamClient } from '../src/StreamClient';
55
import { CreateDeviceRequest, PushProvider } from '../src/gen/models';
@@ -11,7 +11,7 @@ describe('devices and push', () => {
1111
role: 'admin',
1212
};
1313
const device: CreateDeviceRequest = {
14-
id: uuidv4(),
14+
id: randomUUID(),
1515
push_provider: 'firebase',
1616
push_provider_name: 'firebase',
1717
user_id: user.id,

0 commit comments

Comments
 (0)