File tree Expand file tree Collapse file tree 6 files changed +17
-20
lines changed
Expand file tree Collapse file tree 6 files changed +17
-20
lines changed Original file line number Diff line number Diff line change 6565 "prettier" : " ^3.1.0" ,
6666 "rollup" : " ^3.29.3" ,
6767 "typescript" : " ^5.2.2" ,
68+ "undici" : " ^5.29.0" ,
6869 "vite" : " ^4.4.9" ,
6970 "vitest" : " ^1.0.0-beta.5" ,
7071 "vitest-mock-extended" : " ^1.2.1"
7172 },
7273 "dependencies" : {
7374 "@types/jsonwebtoken" : " ^9.0.3" ,
74- "@types/node" : " ^20.11.24 " ,
75+ "@types/node" : " ^18.3.0 " ,
7576 "jsonwebtoken" : " ^9.0.2" ,
76- "undici" : " ^5.29.0" ,
7777 "uuid" : " ^9.0.1"
7878 },
7979 "peerDependencies" : {
80- "@stream-io/openai-realtime-api" : " ~0.1.3"
80+ "@stream-io/openai-realtime-api" : " ~0.1.3" ,
81+ "undici" : " >=5.29.0"
8182 },
8283 "peerDependenciesMeta" : {
8384 "@stream-io/openai-realtime-api" : {
Original file line number Diff line number Diff line change @@ -2,10 +2,9 @@ import { v4 as uuidv4 } from 'uuid';
22import { ApiConfig , RequestMetadata , StreamError } from './types' ;
33import { APIError } from './gen/models' ;
44import { getRateLimitFromResponseHeader } from './utils/rate-limit' ;
5- import { Agent } from 'undici' ;
65
76export class BaseApi {
8- private readonly dispatcher : Agent ;
7+ private readonly dispatcher : RequestInit [ 'dispatcher' ] ;
98
109 constructor ( protected readonly apiConfig : ApiConfig ) {
1110 this . dispatcher = this . apiConfig . agent ;
@@ -46,7 +45,6 @@ export class BaseApi {
4645 method,
4746 body : JSON . stringify ( body ) ,
4847 headers,
49- /** @ts -expect-error we get types from DOM here, but we should use node types */
5048 dispatcher : this . dispatcher ,
5149 } ) ;
5250
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ export interface StreamClientOptions {
1414 /** The max number of clients to create. `null` if no limit. Default is 100. Has no effect if `agent` is provided. */
1515 maxConnections ?: number | null ;
1616 /** The [HTTP Agent](https://undici.nodejs.org/#/docs/api/Agent.md) to use. */
17- agent ?: Agent ;
17+ agent ?: RequestInit [ 'dispatcher' ] ;
1818}
1919
2020export class StreamClient extends CommonApi {
Original file line number Diff line number Diff line change 1- import { Agent } from 'undici' ;
2-
31export type OmitTypeId < T > = Omit < T , 'type' | 'id' | 'connection_id' > ;
42
53export interface ApiConfig {
@@ -8,7 +6,7 @@ export interface ApiConfig {
86 baseUrl : string ;
97 /** The timeout for requests in milliseconds. The default is 3000. */
108 timeout : number ;
11- agent : Agent ;
9+ agent : RequestInit [ 'dispatcher' ] ;
1210}
1311
1412export interface RequestMetadata {
Original file line number Diff line number Diff line change 33 "outDir" : " ./dist" ,
44 "module" : " ES2020" ,
55 "target" : " ES2020" ,
6- "lib" : [" esnext" , " dom " ],
6+ "lib" : [" esnext" ],
77 "noEmitOnError" : true ,
88 "noImplicitAny" : true ,
99 "declaration" : true ,
Original file line number Diff line number Diff line change 528528 resolved "https://registry.npmjs.org/@types/node/-/node-20.7.1.tgz"
529529 integrity sha512-LT+OIXpp2kj4E2S/p91BMe+VgGX2+lfO+XTpfXhh+bCk2LkQtHZSub8ewFBMGP5ClysPjTDFa4sMI8Q3n4T0wg==
530530
531- " @types/node@^20.11.24 " :
532- version "20.17.30 "
533- resolved "https://registry.yarnpkg.com/@types/node/-/node-20.17.30 .tgz#1d93f656d3b869dbef7b796568ac457606ba58d0 "
534- integrity sha512-7zf4YyHA+jvBNfVrk2Gtvs6x7E8V+YDW05bNfG2XkWDJfYRXrTiP/DsB2zSYTaHX0bGIujTBQdMVAhb+j7mwpg ==
531+ " @types/node@^18.3.0 " :
532+ version "18.19.86 "
533+ resolved "https://registry.yarnpkg.com/@types/node/-/node-18.19.86 .tgz#a7e1785289c343155578b9d84a0e3e924deb948b "
534+ integrity sha512-fifKayi175wLyKyc5qUfyENhQ1dCNI1UNjp653d8kuYcPQN5JhX3dGuP/XmvPTg/xRBn1VTLpbmi+H/Mr7tLfQ ==
535535 dependencies :
536- undici-types "~6.19.2 "
536+ undici-types "~5.26.4 "
537537
538538" @types/semver@^7.5.0 " :
539539 version "7.5.6"
@@ -3316,10 +3316,10 @@ unbox-primitive@^1.0.2:
33163316 has-symbols "^1.0.3"
33173317 which-boxed-primitive "^1.0.2"
33183318
3319- undici-types@~6.19.2 :
3320- version "6.19.8 "
3321- resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.8 .tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02 "
3322- integrity sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw ==
3319+ undici-types@~5.26.4 :
3320+ version "5.26.5 "
3321+ resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5 .tgz#bcd539893d00b56e964fd2657a4866b221a65617 "
3322+ integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA ==
33233323
33243324undici@^5.29.0 :
33253325 version "5.29.0"
You can’t perform that action at this time.
0 commit comments