Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions __tests__/agent.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { v4 as uuidv4 } from 'uuid';
import { randomUUID } from 'crypto';
import { vi, describe, expect, it } from 'vitest';
import { createTestClient } from './create-test-client.js';
import { StreamClient } from '../src/StreamClient.js';
Expand All @@ -8,7 +8,7 @@ const enableDebugLogging = false;

async function createTestStreamAndRealtimeClients() {
const streamClient = createTestClient();
const call = streamClient.video.call('default', `call${uuidv4()}`);
const call = streamClient.video.call('default', `call${randomUUID()}`);

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

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

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

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

await expect(
streamClient.video.connectOpenAi({
Expand Down
4 changes: 2 additions & 2 deletions __tests__/block-lists.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { beforeAll, describe, expect, it } from 'vitest';
import { v4 as uuidv4 } from 'uuid';
import { randomUUID } from 'crypto';
import { createTestClient } from './create-test-client';
import { StreamClient } from '../src/StreamClient';
import { CreateBlockListRequest } from '../src/gen/models';
Expand All @@ -11,7 +11,7 @@ describe('block lists CRUD API', () => {
beforeAll(() => {
client = createTestClient();
blockList = {
name: 'streamnodetest-F1' + uuidv4(),
name: 'streamnodetest-F1' + randomUUID(),
words: ['Ricciardo should retire'],
};
});
Expand Down
4 changes: 2 additions & 2 deletions __tests__/call-members.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { beforeAll, describe, expect, it } from 'vitest';
import { v4 as uuidv4 } from 'uuid';
import { randomUUID } from 'crypto';
import { createTestClient } from './create-test-client';
import { StreamCall } from '../src/StreamCall';
import { StreamClient } from '../src/StreamClient';
import { OwnCapability } from '../src/gen/models';

describe('call members API', () => {
let client: StreamClient;
const callId = `call${uuidv4()}`;
const callId = `call${randomUUID()}`;
let call: StreamCall;

beforeAll(async () => {
Expand Down
4 changes: 2 additions & 2 deletions __tests__/call-types.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { beforeAll, describe, expect, it } from 'vitest';
import { v4 as uuidv4 } from 'uuid';
import { randomUUID } from 'crypto';
import { createTestClient } from './create-test-client';
import { StreamClient } from '../src/StreamClient';
import { OwnCapability } from '../src/gen/models';

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

beforeAll(() => {
client = createTestClient();
Expand Down
6 changes: 3 additions & 3 deletions __tests__/call.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { beforeAll, describe, expect, it } from 'vitest';
import { v4 as uuidv4 } from 'uuid';
import { randomUUID } from 'crypto';
import { createTestClient } from './create-test-client';
import { StreamCall } from '../src/StreamCall';
import { StreamClient } from '../src/StreamClient';

describe('call API', () => {
let client: StreamClient;
const callId = `call${uuidv4()}`;
const callId = `call${randomUUID()}`;
let call: StreamCall;

beforeAll(async () => {
Expand Down Expand Up @@ -207,7 +207,7 @@ describe('call API', () => {
});

it('generate SRT credentials', async () => {
const call = client.video.call('default', `call${uuidv4()}`);
const call = client.video.call('default', `call${randomUUID()}`);
await call.getOrCreate({
data: {
created_by_id: 'john',
Expand Down
4 changes: 2 additions & 2 deletions __tests__/channel-types.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { beforeAll, describe, expect, it } from 'vitest';
import { v4 as uuidv4 } from 'uuid';
import { randomUUID } from 'crypto';
import { createTestClient } from './create-test-client';
import { StreamClient } from '../src/StreamClient';

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

beforeAll(() => {
client = createTestClient();
Expand Down
4 changes: 2 additions & 2 deletions __tests__/channel.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { beforeAll, describe, expect, it } from 'vitest';
import { v4 as uuidv4 } from 'uuid';
import { randomUUID } from 'crypto';
import { createTestClient } from './create-test-client';
import { StreamClient } from '../src/StreamClient';
import { StreamChannel } from '../src/StreamChannel';

describe('channel API', () => {
let client: StreamClient;
const channelId = 'streamnodetest' + uuidv4();
const channelId = 'streamnodetest' + randomUUID();
let channel: StreamChannel;
const user = {
id: 'stream-node-test-user',
Expand Down
4 changes: 2 additions & 2 deletions __tests__/command.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { beforeAll, describe, expect, it } from 'vitest';
import { v4 as uuidv4 } from 'uuid';
import { randomUUID } from 'crypto';
import { createTestClient } from './create-test-client';
import { StreamClient } from '../src/StreamClient';

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

beforeAll(() => {
client = createTestClient();
Expand Down
10 changes: 5 additions & 5 deletions __tests__/date-transform.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { beforeAll, describe, expect, it } from 'vitest';
import { v4 as uuidv4 } from 'uuid';
import { randomUUID } from 'crypto';
import { createTestClient } from './create-test-client';
import { StreamClient } from '../src/StreamClient';
import { UserRequest } from '../src/gen/models';
Expand All @@ -21,7 +21,7 @@ describe('Date conversion', () => {
});

it('call + members', async () => {
const id = uuidv4();
const id = randomUUID();
const call = client.video.call('default', id);
const startsAt = new Date();
const response = await call.create({
Expand Down Expand Up @@ -62,7 +62,7 @@ describe('Date conversion', () => {
});

it('channel + members', async () => {
const id = uuidv4();
const id = randomUUID();
const channel = client.chat.channel('messaging', id);
const response = await channel.getOrCreate({
data: {
Expand Down Expand Up @@ -104,8 +104,8 @@ describe('Date conversion', () => {

it('users', async () => {
const newUser: UserRequest = {
id: uuidv4(),
name: 'streamnodetest' + uuidv4(),
id: randomUUID(),
name: 'streamnodetest' + randomUUID(),
custom: {
created_at: new Date(),
},
Expand Down
4 changes: 2 additions & 2 deletions __tests__/devices-push.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { beforeAll, describe, expect, it } from 'vitest';
import { v4 as uuidv4 } from 'uuid';
import { randomUUID } from 'crypto';
import { createTestClient } from './create-test-client';
import { StreamClient } from '../src/StreamClient';
import { CreateDeviceRequest, PushProvider } from '../src/gen/models';
Expand All @@ -11,7 +11,7 @@ describe('devices and push', () => {
role: 'admin',
};
const device: CreateDeviceRequest = {
id: uuidv4(),
id: randomUUID(),
push_provider: 'firebase',
push_provider_name: 'firebase',
user_id: user.id,
Expand Down
10 changes: 5 additions & 5 deletions __tests__/external-storage.test.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { afterAll, beforeAll, describe, expect, it } from 'vitest';
import { v4 as uuidv4 } from 'uuid';
import { randomUUID } from 'crypto';
import { createTestClient } from './create-test-client';
import { StreamClient } from '../src/StreamClient';

describe('external storage CRUD API', () => {
let client: StreamClient;
const storageName = `streamnodetest${uuidv4()}`;
const s3name = `streamnodetest-${uuidv4()}`;
const gcsName = `streamnodetest-${uuidv4()}`;
const azureName = `streamnodetest-${uuidv4()}`;
const storageName = `streamnodetest${randomUUID()}`;
const s3name = `streamnodetest-${randomUUID()}`;
const gcsName = `streamnodetest-${randomUUID()}`;
const azureName = `streamnodetest-${randomUUID()}`;

beforeAll(() => {
client = createTestClient();
Expand Down
4 changes: 2 additions & 2 deletions __tests__/messages.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { afterAll, beforeAll, describe, expect, it } from 'vitest';
import { createTestClient } from './create-test-client';
import { StreamChannel } from '../src/StreamChannel';
import { StreamClient } from '../src/StreamClient';
import { v4 as uuidv4 } from 'uuid';
import { randomUUID } from 'crypto';

describe('messages API', () => {
let client: StreamClient;
const channelId = 'streamnodetest' + uuidv4();
const channelId = 'streamnodetest' + randomUUID();
let channel: StreamChannel;
const user = {
id: 'stream-node-test-user',
Expand Down
4 changes: 2 additions & 2 deletions __tests__/permissions-app-settings.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { beforeAll, describe, expect, it } from 'vitest';
import { v4 as uuidv4 } from 'uuid';
import { randomUUID } from 'crypto';
import { createTestClient } from './create-test-client';
import { StreamClient } from '../src/StreamClient';
import { CreateRoleRequest, OwnCapability } from '../src/gen/models';
Expand All @@ -10,7 +10,7 @@ describe('permissions and app settings API', () => {

beforeAll(() => {
role = {
name: 'streamnodetest' + uuidv4(),
name: 'streamnodetest' + randomUUID(),
};
client = createTestClient();
});
Expand Down
4 changes: 2 additions & 2 deletions __tests__/ring-call.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { beforeAll, describe, expect, it } from 'vitest';
import { createTestClient } from './create-test-client';
import { StreamCall } from '../src/StreamCall';
import { StreamClient } from '../src/StreamClient';
import { v4 as uuidv4 } from 'uuid';
import { randomUUID } from 'crypto';

describe('ring call API', () => {
let client: StreamClient;
const callId = `call${uuidv4()}`;
const callId = `call${randomUUID()}`;
let call: StreamCall;

beforeAll(async () => {
Expand Down
6 changes: 3 additions & 3 deletions __tests__/teams.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { beforeAll, describe, expect, it } from 'vitest';
import { v4 as uuidv4 } from 'uuid';
import { randomUUID } from 'crypto';
import { createTestClient } from './create-test-client';
import { StreamClient } from '../src/StreamClient';
import { StreamCall } from '../src/StreamCall';
Expand All @@ -8,7 +8,7 @@ import { UserRequest } from '../src/gen/models';
// Skipping to avoid issues when tests run in parallel
describe.skip('teams', () => {
let client: StreamClient;
const userId = 'streamnodetest' + uuidv4();
const userId = 'streamnodetest' + randomUUID();
const newUser: UserRequest = {
id: userId,
role: 'user',
Expand All @@ -23,7 +23,7 @@ describe.skip('teams', () => {
id: 'stream-node-test-user',
role: 'admin',
};
const callId = `call${uuidv4()}`;
const callId = `call${randomUUID()}`;
let call: StreamCall;

beforeAll(async () => {
Expand Down
6 changes: 3 additions & 3 deletions __tests__/user-compat.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { beforeAll, describe, expect, it } from 'vitest';
import { v4 as uuidv4 } from 'uuid';
import { randomUUID } from 'crypto';
import { createTestClient } from './create-test-client';
import { StreamClient } from '../src/StreamClient';

describe('user-video compatibility API', () => {
let client: StreamClient;
const user = {
id: uuidv4(),
id: randomUUID(),
role: 'admin',
name: 'Test User for user API compatibily',
custom: {
Expand All @@ -20,7 +20,7 @@ describe('user-video compatibility API', () => {
});

it('create call', async () => {
const call = client.video.call('default', uuidv4());
const call = client.video.call('default', randomUUID());
const response = await call.create({ data: { created_by: user } });

// Backend returns: {custom: { custom: { note: 'compatibilty test' } }}
Expand Down
6 changes: 3 additions & 3 deletions __tests__/users.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { beforeAll, describe, expect, it } from 'vitest';
import { v4 as uuidv4 } from 'uuid';
import { randomUUID } from 'crypto';
import { createTestClient } from './create-test-client';
import { StreamClient } from '../src/StreamClient';
import { UserRequest } from '../src/gen/models';

describe('user API', () => {
let client: StreamClient;
const userId = 'streamnodetest' + uuidv4();
const userId = 'streamnodetest' + randomUUID();
const newUser: UserRequest = {
id: userId,
role: 'user',
Expand Down Expand Up @@ -77,7 +77,7 @@ describe('user API', () => {

it('create guest', async () => {
const guest: UserRequest = {
id: uuidv4(),
id: randomUUID(),
name: 'Guest 3',
image: ': )',
custom: {
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@
"dependencies": {
"@types/jsonwebtoken": "^9.0.10",
"@types/node": "^18.3.0",
"jsonwebtoken": "^9.0.3",
"uuid": "^13.0.0"
"jsonwebtoken": "^9.0.3"
},
"peerDependencies": {
"@stream-io/openai-realtime-api": "~0.1.3 || ~0.2.0 || ~0.3.0 || ~0.4.0"
Expand Down
4 changes: 2 additions & 2 deletions src/ApiClient.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { v4 as uuidv4 } from 'uuid';
import { randomUUID } from 'crypto';
import { ApiConfig, RequestMetadata, StreamError } from './types';
import { APIError } from './gen/models';
import { getRateLimitFromResponseHeader } from './utils/rate-limit';
Expand Down Expand Up @@ -32,7 +32,7 @@ export class ApiClient {
}

url += `?${encodedParams}`;
const clientRequestId = uuidv4();
const clientRequestId = randomUUID();
const headers: Record<string, string> = {
Authorization: this.apiConfig.token,
'stream-auth-type': 'jwt',
Expand Down
5 changes: 0 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2903,11 +2903,6 @@ uri-js@^4.2.2:
dependencies:
punycode "^2.1.0"

uuid@^13.0.0:
version "13.0.0"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-13.0.0.tgz#263dc341b19b4d755eb8fe36b78d95a6b65707e8"
integrity sha512-XQegIaBTVUjSHliKqcnFqYypAd4S+WCYt5NIeRs6w/UAry7z8Y9j5ZwRRL4kzq9U3sD6v+85er9FvkEaBpji2w==

vite-node@3.1.4:
version "3.1.4"
resolved "https://registry.yarnpkg.com/vite-node/-/vite-node-3.1.4.tgz#13f10b2cb155197a971cb2761664ec952c6cae18"
Expand Down
Loading