Skip to content

Commit b8c5d16

Browse files
committed
Merge branch 'main' into update-for-getcallreport
2 parents ec52893 + b305ce3 commit b8c5d16

25 files changed

+13703
-5378
lines changed

CHANGELOG.md

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,80 @@
11
# Changelog
22

3-
## [0.4.24](https://github.com/GetStream/stream-node/compare/v0.4.23...v0.4.24) (2025-05-06)
3+
## [0.5.0](https://github.com/GetStream/stream-node/compare/v0.4.26...v0.5.0) (2025-07-17)
4+
5+
### ⚠ BREAKING CHANGES
46

7+
- add support for feeds v3 API ([#118](https://github.com/GetStream/stream-node/issues/118))
58

69
### Features
710

8-
* empty commit to trigger release ([c0890a8](https://github.com/GetStream/stream-node/commit/c0890a8d8b7adc96d4d81717220159321e924480))
11+
- add support for feeds v3 API ([#118](https://github.com/GetStream/stream-node/issues/118)) ([aa43a6b](https://github.com/GetStream/stream-node/commit/aa43a6b2666c81bff23ee0113c91f61568e5ccc2))
912

10-
## [0.4.23](https://github.com/GetStream/stream-node/compare/v0.4.22...v0.4.23) (2025-04-30)
13+
## [0.4.26](https://github.com/GetStream/stream-node/compare/v0.4.25...v0.4.26) (2025-07-16)
14+
15+
### Features
1116

17+
- Update to API spec 186.1.0 ([#120](https://github.com/GetStream/stream-node/issues/120)) ([e1d1f88](https://github.com/GetStream/stream-node/commit/e1d1f88d823f71d6386a1791e285bdbee2cbfb54))
18+
19+
## [0.4.25](https://github.com/GetStream/stream-node/compare/v0.4.24...v0.4.25) (2025-06-24)
1220

1321
### Features
1422

15-
* update to v171.1.7 ([#107](https://github.com/GetStream/stream-node/issues/107)) ([dd442f0](https://github.com/GetStream/stream-node/commit/dd442f0e6b9acc465781cb748e5c5a03dd51624c))
23+
- Update to API spec v179.7.0 ([#113](https://github.com/GetStream/stream-node/issues/113)) ([898ee9e](https://github.com/GetStream/stream-node/commit/898ee9e692b85075e60147835ff43de3f1179587))
1624

17-
## [0.4.22](https://github.com/GetStream/stream-node/compare/v0.4.21...v0.4.22) (2025-04-09)
25+
## [0.4.24](https://github.com/GetStream/stream-node/compare/v0.4.23...v0.4.24) (2025-05-06)
26+
27+
### Features
28+
29+
- empty commit to trigger release ([c0890a8](https://github.com/GetStream/stream-node/commit/c0890a8d8b7adc96d4d81717220159321e924480))
1830

31+
## [0.4.23](https://github.com/GetStream/stream-node/compare/v0.4.22...v0.4.23) (2025-04-30)
32+
33+
### Features
34+
35+
- update to v171.1.7 ([#107](https://github.com/GetStream/stream-node/issues/107)) ([dd442f0](https://github.com/GetStream/stream-node/commit/dd442f0e6b9acc465781cb748e5c5a03dd51624c))
36+
37+
## [0.4.22](https://github.com/GetStream/stream-node/compare/v0.4.21...v0.4.22) (2025-04-09)
1938

2039
### Bug Fixes
2140

22-
* handle missing optional dependency in declarations ([#103](https://github.com/GetStream/stream-node/issues/103)) ([eb271c5](https://github.com/GetStream/stream-node/commit/eb271c5f3bfb6002d341323af25beabd15516ef2))
41+
- handle missing optional dependency in declarations ([#103](https://github.com/GetStream/stream-node/issues/103)) ([eb271c5](https://github.com/GetStream/stream-node/commit/eb271c5f3bfb6002d341323af25beabd15516ef2))
2342

2443
## [0.4.21](https://github.com/GetStream/stream-node/compare/v0.4.20...v0.4.21) (2025-04-08)
2544

26-
2745
### Bug Fixes
2846

29-
* remove undici dependency ([#101](https://github.com/GetStream/stream-node/issues/101)) ([c943be1](https://github.com/GetStream/stream-node/commit/c943be1b2871b2b010dd4b29d690c46ecacda23b))
47+
- remove undici dependency ([#101](https://github.com/GetStream/stream-node/issues/101)) ([c943be1](https://github.com/GetStream/stream-node/commit/c943be1b2871b2b010dd4b29d690c46ecacda23b))
3048

3149
## [0.4.20](https://github.com/GetStream/stream-node/compare/v0.4.19...v0.4.20) (2025-04-07)
3250

33-
3451
### Features
3552

36-
* set max connections to 100, allow integrators to configure Fetch API ([#98](https://github.com/GetStream/stream-node/issues/98)) ([b044b59](https://github.com/GetStream/stream-node/commit/b044b599867a69b33b3aa9d989d1c1e3277dc92f))
53+
- set max connections to 100, allow integrators to configure Fetch API ([#98](https://github.com/GetStream/stream-node/issues/98)) ([b044b59](https://github.com/GetStream/stream-node/commit/b044b599867a69b33b3aa9d989d1c1e3277dc92f))
3754

3855
## [0.4.19](https://github.com/GetStream/stream-node/compare/v0.4.18...v0.4.19) (2025-03-17)
3956

40-
4157
### Features
4258

43-
* update to API spec v163.0.0 ([#96](https://github.com/GetStream/stream-node/issues/96)) ([dcdfea8](https://github.com/GetStream/stream-node/commit/dcdfea8cfbf83b0ef3426426909c844424f682ab))
59+
- update to API spec v163.0.0 ([#96](https://github.com/GetStream/stream-node/issues/96)) ([dcdfea8](https://github.com/GetStream/stream-node/commit/dcdfea8cfbf83b0ef3426426909c844424f682ab))
4460

4561
## [0.4.18](https://github.com/GetStream/stream-node/compare/v0.4.17...v0.4.18) (2025-03-10)
4662

47-
4863
### Bug Fixes
4964

50-
* support realtime AI model overrides ([#94](https://github.com/GetStream/stream-node/issues/94)) ([1071f75](https://github.com/GetStream/stream-node/commit/1071f75aaf7ffb029f8c3c4c06465e81abf341d6))
65+
- support realtime AI model overrides ([#94](https://github.com/GetStream/stream-node/issues/94)) ([1071f75](https://github.com/GetStream/stream-node/commit/1071f75aaf7ffb029f8c3c4c06465e81abf341d6))
5166

5267
## [0.4.17](https://github.com/GetStream/stream-node/compare/v0.4.16...v0.4.17) (2025-03-06)
5368

54-
5569
### Bug Fixes
5670

57-
* use an exact version of @stream-io/openai-realtime-api ([#92](https://github.com/GetStream/stream-node/issues/92)) ([d6f0419](https://github.com/GetStream/stream-node/commit/d6f0419f924bfdadbb44d2b12b44a664bb4b39a6))
71+
- use an exact version of @stream-io/openai-realtime-api ([#92](https://github.com/GetStream/stream-node/issues/92)) ([d6f0419](https://github.com/GetStream/stream-node/commit/d6f0419f924bfdadbb44d2b12b44a664bb4b39a6))
5872

5973
## [0.4.16](https://github.com/GetStream/stream-node/compare/v0.4.15...v0.4.16) (2025-02-25)
6074

61-
6275
### Bug Fixes
6376

64-
* update changelog ([#89](https://github.com/GetStream/stream-node/issues/89)) ([1b46c91](https://github.com/GetStream/stream-node/commit/1b46c919ccc5a98414ca441b833020743217e95d))
77+
- update changelog ([#89](https://github.com/GetStream/stream-node/issues/89)) ([1b46c91](https://github.com/GetStream/stream-node/commit/1b46c919ccc5a98414ca441b833020743217e95d))
6578

6679
## [0.4.15](https://github.com/GetStream/stream-node/compare/v0.4.14...v0.4.15) (2025-02-25)
6780

__tests__/assets/test-file.pdf

15.4 KB
Binary file not shown.

__tests__/devices-push.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ describe('devices and push', () => {
6262
expect(response.push_providers).toBeDefined();
6363
});
6464

65-
it('test push provider', async () => {
65+
// Stream error code 4: CheckPush failed with error: "User has no enabled devices associated"
66+
it.skip('test push provider', async () => {
6667
const response = await client.checkPush({ user_id: user.id });
6768

6869
expect(response).toBeDefined();

__tests__/file-uploads.test.ts

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import { beforeAll, describe, it, expect } from 'vitest';
2+
import { createTestClient } from './create-test-client';
3+
import { StreamClient } from '../src/StreamClient';
4+
import fs from 'fs';
5+
import path from 'path';
6+
import { File } from 'buffer';
7+
8+
// Don't want to upload files and image every time we run the tests
9+
describe.skip('global file uploads', () => {
10+
let client: StreamClient;
11+
const user = {
12+
id: 'stream-node-test-user',
13+
role: 'admin',
14+
};
15+
16+
beforeAll(async () => {
17+
client = createTestClient();
18+
await client.upsertUsers([user]);
19+
});
20+
21+
it('upload and delete file', async () => {
22+
// Read the test PDF file from assets
23+
const filePath = path.join(__dirname, 'assets', 'test-file.pdf');
24+
const fileBuffer = fs.readFileSync(filePath);
25+
26+
const response = await client.uploadFile({
27+
file: new File([fileBuffer], 'test-file.pdf'),
28+
user: { id: user.id },
29+
});
30+
31+
expect(response).toBeDefined();
32+
expect(response.file).toBeDefined();
33+
expect(response.duration).toBeDefined();
34+
35+
const deleteResponse = await client.deleteFile({
36+
url: response.file,
37+
});
38+
39+
expect(deleteResponse).toBeDefined();
40+
});
41+
42+
it('upload image', async () => {
43+
// Read the test PDF file from assets
44+
const filePath = path.join(__dirname, 'assets', 'test-image.jpg');
45+
const fileBuffer = fs.readFileSync(filePath);
46+
47+
const uploadSizes = [
48+
{
49+
width: 100,
50+
height: 100,
51+
resize: 'scale',
52+
crop: 'center',
53+
},
54+
];
55+
56+
// Upload the file
57+
const response = await client.uploadImage({
58+
file: new File([fileBuffer], 'test-image.jpg'),
59+
user: { id: user.id },
60+
upload_sizes: uploadSizes,
61+
});
62+
63+
expect(response.upload_sizes?.length).toBe(1);
64+
expect(response.upload_sizes?.[0]).toMatchObject(uploadSizes[0]);
65+
const deleteResponse = await client.deleteImage({
66+
url: response.file,
67+
});
68+
69+
expect(deleteResponse).toBeDefined();
70+
});
71+
});

generate-openapi.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ CHAT_DIR="../chat"
66

77
rm -rf $OUTPUT_DIR
88

9-
( cd $CHAT_DIR ; make openapi ; go run ./cmd/chat-manager openapi generate-client --language ts --spec ./releases/v2/serverside-api.yaml --output $OUTPUT_DIR )
9+
( cd $CHAT_DIR ; make openapi ; go run ./cmd/chat-manager openapi generate-client --language ts --spec ./releases/v2/feeds-serverside-api.yaml --output $OUTPUT_DIR )
1010

1111
yarn lint:gen

index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
export * from './src/gen/models';
21
export * from './src/StreamClient';
32
export * from './src/StreamCall';
43
export * from './src/StreamChatClient';
54
export * from './src/StreamChannel';
65
export * from './src/StreamVideoClient';
6+
export * from './src/gen/models';
7+
export * from './src/StreamFeedsClient';
8+
export * from './src/StreamFeed';

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@stream-io/node-sdk",
3-
"version": "0.4.24",
3+
"version": "0.5.0",
44
"description": "",
55
"exports": {
66
".": {

src/BaseApi.ts renamed to src/ApiClient.ts

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,24 @@ import { ApiConfig, RequestMetadata, StreamError } from './types';
33
import { APIError } from './gen/models';
44
import { getRateLimitFromResponseHeader } from './utils/rate-limit';
55

6-
export class BaseApi {
6+
export class ApiClient {
77
private readonly dispatcher?: RequestInit['dispatcher'];
88

9-
constructor(protected readonly apiConfig: ApiConfig) {
9+
constructor(public readonly apiConfig: ApiConfig) {
1010
this.dispatcher = this.apiConfig.agent;
1111
}
1212

13-
protected sendRequest = async <T>(
13+
/**
14+
*
15+
* @internal
16+
*/
17+
sendRequest = async <T>(
1418
method: string,
1519
url: string,
1620
pathParams?: Record<string, string>,
1721
queryParams?: Record<string, any>,
1822
body?: any,
23+
requestContentType?: string,
1924
) => {
2025
queryParams = queryParams ?? {};
2126
queryParams.api_key = this.apiConfig.apiKey;
@@ -28,22 +33,36 @@ export class BaseApi {
2833

2934
url += `?${encodedParams}`;
3035
const clientRequestId = uuidv4();
31-
const headers = {
36+
const headers: Record<string, string> = {
3237
Authorization: this.apiConfig.token,
3338
'stream-auth-type': 'jwt',
34-
'Content-Type': 'application/json',
3539
'X-Stream-Client': 'stream-node-' + process.env.PKG_VERSION,
3640
'Accept-Encoding': 'gzip',
3741
'x-client-request-id': clientRequestId,
3842
};
3943

44+
// https://stackoverflow.com/questions/39280438/fetch-missing-boundary-in-multipart-form-data-post
45+
if (requestContentType !== 'multipart/form-data') {
46+
headers['Content-Type'] = requestContentType ?? 'application/json';
47+
}
48+
4049
const signal = AbortSignal.timeout(this.apiConfig.timeout);
4150

51+
const encodedBody =
52+
requestContentType === 'multipart/form-data'
53+
? new FormData()
54+
: JSON.stringify(body);
55+
if (requestContentType === 'multipart/form-data') {
56+
Object.keys(body).forEach((key) => {
57+
(encodedBody as FormData).append(key, body[key]);
58+
});
59+
}
60+
4261
try {
4362
const response = await fetch(`${this.apiConfig.baseUrl}${url}`, {
4463
signal,
4564
method,
46-
body: JSON.stringify(body),
65+
body: encodedBody,
4766
headers,
4867
dispatcher: this.dispatcher,
4968
});

src/StreamCall.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { QueryCallMembersRequest } from './gen/models';
1+
import { GetOrCreateCallRequest, QueryCallMembersRequest } from './gen/models';
22
import { CallApi } from './gen/video/CallApi';
33
import { OmitTypeId } from './types';
44

@@ -7,7 +7,7 @@ export class StreamCall extends CallApi {
77
return `${this.type}:${this.id}`;
88
}
99

10-
create = this.getOrCreate;
10+
create = (request?: GetOrCreateCallRequest) => this.getOrCreate(request);
1111

1212
queryMembers = (request?: OmitTypeId<QueryCallMembersRequest>) => {
1313
return this.videoApi.queryCallMembers({

0 commit comments

Comments
 (0)