Skip to content

Commit b696654

Browse files
committed
Fix Build
1 parent b020847 commit b696654

File tree

5 files changed

+12
-11
lines changed

5 files changed

+12
-11
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
},
3636
"devDependencies": {
3737
"@sinonjs/fake-timers": "14.0.0",
38-
"@types/eventsource": "1.1.15",
3938
"@types/node": "22.10.2",
4039
"@types/sinonjs__fake-timers": "8.1.5",
4140
"@types/ws": "8.5.13",

src/adapter/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type EventSource from 'eventsource'
1+
import { EventSource } from 'eventsource'
22
import Redis from 'ioredis'
33
import { Cache } from '../cache'
44
import { AdapterConfig, BaseAdapterSettings, SettingsDefinitionMap } from '../config'

src/transports/sse.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { AxiosRequestConfig } from 'axios'
2-
import EventSource from 'eventsource'
2+
import { EventSource } from 'eventsource'
33
import { EndpointContext } from '../adapter'
44
import { calculateHttpRequestKey } from '../cache'
55
import { makeLogger, sleep } from '../util'
@@ -13,7 +13,7 @@ const logger = makeLogger('SSETransport')
1313

1414
export interface SSEConfig {
1515
url: string
16-
eventSourceInitDict?: EventSource.EventSourceInitDict
16+
headers?: Record<string, string>
1717
}
1818

1919
/**
@@ -103,7 +103,13 @@ export class SseTransport<T extends SSETransportGenerics> extends StreamingTrans
103103
logger.debug('No established connection and new subscriptions available, connecting to SSE')
104104
const sseConfig = this.config.prepareSSEConnectionConfig(subscriptions.new, context)
105105
this.providerDataStreamEstablished = Date.now()
106-
this.sseConnection = new this.EventSource(sseConfig.url, sseConfig.eventSourceInitDict)
106+
this.sseConnection = new this.EventSource(sseConfig.url, {
107+
fetch: (input, init) =>
108+
fetch(input, {
109+
...init,
110+
headers: { ...init?.headers, ...sseConfig.headers },
111+
}),
112+
})
107113

108114
const eventHandlerGenerator = (listener: (typeof this.config.eventListeners)[0]) => {
109115
return (e: MessageEvent) => {

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"noImplicitThis": true,
2121
"noPropertyAccessFromIndexSignature": true,
2222
"noUnusedLocals": true,
23-
"strict": true
23+
"strict": true,
24+
"skipLibCheck": true
2425
},
2526
"exclude": ["src/**/test/**/*"],
2627
"include": ["./src/**/*"]

yarn.lock

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -326,11 +326,6 @@
326326
resolved "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz"
327327
integrity sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==
328328

329-
330-
version "1.1.15"
331-
resolved "https://registry.npmjs.org/@types/eventsource/-/eventsource-1.1.15.tgz"
332-
integrity sha512-XQmGcbnxUNa06HR3VBVkc9+A2Vpi9ZyLJcdS5dwaQQ/4ZMWFO+5c90FnMUpbtMZwB/FChoYHwuVg8TvkECacTA==
333-
334329
"@types/hast@^3.0.4":
335330
version "3.0.4"
336331
resolved "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz"

0 commit comments

Comments
 (0)