Skip to content

Commit 936d749

Browse files
chore(deps): update dependency bun to v1.2.3 (#709)
Co-authored-by: Arda TANRIKULU <[email protected]>
1 parent 3827e85 commit 936d749

File tree

6 files changed

+158
-15
lines changed

6 files changed

+158
-15
lines changed

.changeset/silver-lemons-search.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@graphql-tools/executor-http': patch
3+
---
4+
5+
Subscription cancellation fix for Bun

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"@yarnpkg/cli": "^4.5.3",
4040
"@yarnpkg/core": "^4.1.6",
4141
"@yarnpkg/plugin-pack": "^4.0.0",
42-
"bun": "^1.1.34",
42+
"bun": "1.2.3",
4343
"cross-env": "^7.0.3",
4444
"eslint": "^9.12.0",
4545
"eslint-plugin-import": "^2.31.0",

packages/executors/http/src/handleEventStreamResponse.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export function isReadableStream(value: any): value is ReadableStream {
1111

1212
export function handleEventStreamResponse(
1313
response: Response,
14+
subscriptionCtrl?: AbortController,
1415
signal?: AbortSignal,
1516
) {
1617
// node-fetch returns body as a promise so we need to resolve it
@@ -28,7 +29,12 @@ export function handleEventStreamResponse(
2829
const reader = body.getReader();
2930
reader.closed.then(stop).catch(stop); // we dont use `finally` because we want to catch errors
3031
stop
31-
.then(() => reader.releaseLock())
32+
.then(() => {
33+
subscriptionCtrl?.abort();
34+
if (body.locked) {
35+
reader.releaseLock();
36+
}
37+
})
3238
.catch((err) => {
3339
reader.cancel(err);
3440
});

packages/executors/http/src/index.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,12 +180,14 @@ export function buildHTTPExecutor(
180180

181181
let accept =
182182
'application/graphql-response+json, application/json, multipart/mixed';
183+
let subscriptionCtrl: AbortController | undefined;
183184
if (
184185
operationType === 'subscription' ||
185186
isLiveQueryOperationDefinitionNode(operationAst)
186187
) {
187188
method ||= 'GET';
188189
accept = 'text/event-stream';
190+
subscriptionCtrl = new AbortController();
189191
} else {
190192
method ||= 'POST';
191193
}
@@ -221,6 +223,9 @@ export function buildHTTPExecutor(
221223
if (options?.timeout) {
222224
signals.push(AbortSignal.timeout(options.timeout));
223225
}
226+
if (subscriptionCtrl) {
227+
signals.push(subscriptionCtrl.signal);
228+
}
224229

225230
const signal = AbortSignal.any(signals);
226231

@@ -341,7 +346,11 @@ export function buildHTTPExecutor(
341346

342347
const contentType = fetchResult.headers.get('content-type');
343348
if (contentType?.includes('text/event-stream')) {
344-
return handleEventStreamResponse(fetchResult, signal);
349+
return handleEventStreamResponse(
350+
fetchResult,
351+
subscriptionCtrl,
352+
signal,
353+
);
345354
} else if (contentType?.includes('multipart/mixed')) {
346355
return handleMultipartMixedResponse(fetchResult);
347356
}

packages/gateway/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
"@rollup/plugin-sucrase": "^5.0.2",
101101
"@tsconfig/node18": "^18.2.4",
102102
"@types/adm-zip": "^0.5.5",
103-
"@types/bun": "^1.1.13",
103+
"@types/bun": "1.2.3",
104104
"@types/ws": "^8.5.12",
105105
"@whatwg-node/fetch": "^0.10.4",
106106
"adm-zip": "^0.5.15",

yarn.lock

Lines changed: 134 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3405,7 +3405,7 @@ __metadata:
34053405
"@rollup/plugin-sucrase": "npm:^5.0.2"
34063406
"@tsconfig/node18": "npm:^18.2.4"
34073407
"@types/adm-zip": "npm:^0.5.5"
3408-
"@types/bun": "npm:^1.1.13"
3408+
"@types/bun": "npm:1.2.3"
34093409
"@types/ws": "npm:^8.5.12"
34103410
"@whatwg-node/fetch": "npm:^0.10.4"
34113411
adm-zip: "npm:^0.5.15"
@@ -6032,76 +6032,153 @@ __metadata:
60326032
languageName: node
60336033
linkType: hard
60346034

6035+
"@oven/bun-darwin-aarch64@npm:1.2.3":
6036+
version: 1.2.3
6037+
resolution: "@oven/bun-darwin-aarch64@npm:1.2.3"
6038+
conditions: os=darwin & cpu=arm64
6039+
languageName: node
6040+
linkType: hard
6041+
60356042
"@oven/bun-darwin-x64-baseline@npm:1.2.2":
60366043
version: 1.2.2
60376044
resolution: "@oven/bun-darwin-x64-baseline@npm:1.2.2"
60386045
conditions: os=darwin & cpu=x64
60396046
languageName: node
60406047
linkType: hard
60416048

6049+
"@oven/bun-darwin-x64-baseline@npm:1.2.3":
6050+
version: 1.2.3
6051+
resolution: "@oven/bun-darwin-x64-baseline@npm:1.2.3"
6052+
conditions: os=darwin & cpu=x64
6053+
languageName: node
6054+
linkType: hard
6055+
60426056
"@oven/bun-darwin-x64@npm:1.2.2":
60436057
version: 1.2.2
60446058
resolution: "@oven/bun-darwin-x64@npm:1.2.2"
60456059
conditions: os=darwin & cpu=x64
60466060
languageName: node
60476061
linkType: hard
60486062

6063+
"@oven/bun-darwin-x64@npm:1.2.3":
6064+
version: 1.2.3
6065+
resolution: "@oven/bun-darwin-x64@npm:1.2.3"
6066+
conditions: os=darwin & cpu=x64
6067+
languageName: node
6068+
linkType: hard
6069+
60496070
"@oven/bun-linux-aarch64-musl@npm:1.2.2":
60506071
version: 1.2.2
60516072
resolution: "@oven/bun-linux-aarch64-musl@npm:1.2.2"
60526073
conditions: os=linux & cpu=aarch64
60536074
languageName: node
60546075
linkType: hard
60556076

6077+
"@oven/bun-linux-aarch64-musl@npm:1.2.3":
6078+
version: 1.2.3
6079+
resolution: "@oven/bun-linux-aarch64-musl@npm:1.2.3"
6080+
conditions: os=linux & cpu=aarch64
6081+
languageName: node
6082+
linkType: hard
6083+
60566084
"@oven/bun-linux-aarch64@npm:1.2.2":
60576085
version: 1.2.2
60586086
resolution: "@oven/bun-linux-aarch64@npm:1.2.2"
60596087
conditions: os=linux & cpu=arm64
60606088
languageName: node
60616089
linkType: hard
60626090

6091+
"@oven/bun-linux-aarch64@npm:1.2.3":
6092+
version: 1.2.3
6093+
resolution: "@oven/bun-linux-aarch64@npm:1.2.3"
6094+
conditions: os=linux & cpu=arm64
6095+
languageName: node
6096+
linkType: hard
6097+
60636098
"@oven/bun-linux-x64-baseline@npm:1.2.2":
60646099
version: 1.2.2
60656100
resolution: "@oven/bun-linux-x64-baseline@npm:1.2.2"
60666101
conditions: os=linux & cpu=x64
60676102
languageName: node
60686103
linkType: hard
60696104

6105+
"@oven/bun-linux-x64-baseline@npm:1.2.3":
6106+
version: 1.2.3
6107+
resolution: "@oven/bun-linux-x64-baseline@npm:1.2.3"
6108+
conditions: os=linux & cpu=x64
6109+
languageName: node
6110+
linkType: hard
6111+
60706112
"@oven/bun-linux-x64-musl-baseline@npm:1.2.2":
60716113
version: 1.2.2
60726114
resolution: "@oven/bun-linux-x64-musl-baseline@npm:1.2.2"
60736115
conditions: os=linux & cpu=x64
60746116
languageName: node
60756117
linkType: hard
60766118

6119+
"@oven/bun-linux-x64-musl-baseline@npm:1.2.3":
6120+
version: 1.2.3
6121+
resolution: "@oven/bun-linux-x64-musl-baseline@npm:1.2.3"
6122+
conditions: os=linux & cpu=x64
6123+
languageName: node
6124+
linkType: hard
6125+
60776126
"@oven/bun-linux-x64-musl@npm:1.2.2":
60786127
version: 1.2.2
60796128
resolution: "@oven/bun-linux-x64-musl@npm:1.2.2"
60806129
conditions: os=linux & cpu=x64
60816130
languageName: node
60826131
linkType: hard
60836132

6133+
"@oven/bun-linux-x64-musl@npm:1.2.3":
6134+
version: 1.2.3
6135+
resolution: "@oven/bun-linux-x64-musl@npm:1.2.3"
6136+
conditions: os=linux & cpu=x64
6137+
languageName: node
6138+
linkType: hard
6139+
60846140
"@oven/bun-linux-x64@npm:1.2.2":
60856141
version: 1.2.2
60866142
resolution: "@oven/bun-linux-x64@npm:1.2.2"
60876143
conditions: os=linux & cpu=x64
60886144
languageName: node
60896145
linkType: hard
60906146

6147+
"@oven/bun-linux-x64@npm:1.2.3":
6148+
version: 1.2.3
6149+
resolution: "@oven/bun-linux-x64@npm:1.2.3"
6150+
conditions: os=linux & cpu=x64
6151+
languageName: node
6152+
linkType: hard
6153+
60916154
"@oven/bun-windows-x64-baseline@npm:1.2.2":
60926155
version: 1.2.2
60936156
resolution: "@oven/bun-windows-x64-baseline@npm:1.2.2"
60946157
conditions: os=win32 & cpu=x64
60956158
languageName: node
60966159
linkType: hard
60976160

6161+
"@oven/bun-windows-x64-baseline@npm:1.2.3":
6162+
version: 1.2.3
6163+
resolution: "@oven/bun-windows-x64-baseline@npm:1.2.3"
6164+
conditions: os=win32 & cpu=x64
6165+
languageName: node
6166+
linkType: hard
6167+
60986168
"@oven/bun-windows-x64@npm:1.2.2":
60996169
version: 1.2.2
61006170
resolution: "@oven/bun-windows-x64@npm:1.2.2"
61016171
conditions: os=win32 & cpu=x64
61026172
languageName: node
61036173
linkType: hard
61046174

6175+
"@oven/bun-windows-x64@npm:1.2.3":
6176+
version: 1.2.3
6177+
resolution: "@oven/bun-windows-x64@npm:1.2.3"
6178+
conditions: os=win32 & cpu=x64
6179+
languageName: node
6180+
linkType: hard
6181+
61056182
"@parcel/watcher-android-arm64@npm:2.5.1":
61066183
version: 2.5.1
61076184
resolution: "@parcel/watcher-android-arm64@npm:2.5.1"
@@ -6830,12 +6907,12 @@ __metadata:
68306907
languageName: node
68316908
linkType: hard
68326909

6833-
"@types/bun@npm:^1.1.13":
6834-
version: 1.2.2
6835-
resolution: "@types/bun@npm:1.2.2"
6910+
"@types/bun@npm:1.2.3":
6911+
version: 1.2.3
6912+
resolution: "@types/bun@npm:1.2.3"
68366913
dependencies:
6837-
bun-types: "npm:1.2.2"
6838-
checksum: 10c0/fc1281a3322c797d7165ac9157bf45d039c18232563432f8a389740793a6a7e6ec8b9f593859b77045adce76531fb80e2ea10aa28de686bb44a707badfb26fb2
6914+
bun-types: "npm:1.2.3"
6915+
checksum: 10c0/2d7fae39a206789ceafa18bf60417d2d0e88e804c492ee06f1e36a79df7fbcf8b460b947e39e12b5c62a80ebb31bff80c106fd8c7415c828ae8c0fe4df71d5ad
68396916
languageName: node
68406917
linkType: hard
68416918

@@ -8937,13 +9014,59 @@ __metadata:
89379014
languageName: node
89389015
linkType: hard
89399016

8940-
"bun-types@npm:1.2.2":
8941-
version: 1.2.2
8942-
resolution: "bun-types@npm:1.2.2"
9017+
"bun-types@npm:1.2.3":
9018+
version: 1.2.3
9019+
resolution: "bun-types@npm:1.2.3"
89439020
dependencies:
89449021
"@types/node": "npm:*"
89459022
"@types/ws": "npm:~8.5.10"
8946-
checksum: 10c0/388e9bd7bf04ee01e33785eca8953f6a839fe0609e5542af50c33d57f41f1bc82d5009508f2b9350f63ca57efd7f95949e7ea406b6f2d262cf6e3818070a23d8
9023+
checksum: 10c0/794cb55a71822f772510435dce3109b42304c4c8a74799fd1b9a66d1eaa204aa18031ccc3d1d5caa7e5a96606c09ce862c5f05c1002e680654d97ec802bfac20
9024+
languageName: node
9025+
linkType: hard
9026+
9027+
"bun@npm:1.2.3":
9028+
version: 1.2.3
9029+
resolution: "bun@npm:1.2.3"
9030+
dependencies:
9031+
"@oven/bun-darwin-aarch64": "npm:1.2.3"
9032+
"@oven/bun-darwin-x64": "npm:1.2.3"
9033+
"@oven/bun-darwin-x64-baseline": "npm:1.2.3"
9034+
"@oven/bun-linux-aarch64": "npm:1.2.3"
9035+
"@oven/bun-linux-aarch64-musl": "npm:1.2.3"
9036+
"@oven/bun-linux-x64": "npm:1.2.3"
9037+
"@oven/bun-linux-x64-baseline": "npm:1.2.3"
9038+
"@oven/bun-linux-x64-musl": "npm:1.2.3"
9039+
"@oven/bun-linux-x64-musl-baseline": "npm:1.2.3"
9040+
"@oven/bun-windows-x64": "npm:1.2.3"
9041+
"@oven/bun-windows-x64-baseline": "npm:1.2.3"
9042+
dependenciesMeta:
9043+
"@oven/bun-darwin-aarch64":
9044+
optional: true
9045+
"@oven/bun-darwin-x64":
9046+
optional: true
9047+
"@oven/bun-darwin-x64-baseline":
9048+
optional: true
9049+
"@oven/bun-linux-aarch64":
9050+
optional: true
9051+
"@oven/bun-linux-aarch64-musl":
9052+
optional: true
9053+
"@oven/bun-linux-x64":
9054+
optional: true
9055+
"@oven/bun-linux-x64-baseline":
9056+
optional: true
9057+
"@oven/bun-linux-x64-musl":
9058+
optional: true
9059+
"@oven/bun-linux-x64-musl-baseline":
9060+
optional: true
9061+
"@oven/bun-windows-x64":
9062+
optional: true
9063+
"@oven/bun-windows-x64-baseline":
9064+
optional: true
9065+
bin:
9066+
bun: bin/bun.exe
9067+
bunx: bin/bun.exe
9068+
checksum: 10c0/25c859df3f4d3351432ee2e7a1d7fe07218ba0b7fac6f44a52cf8e6bdddc40d83d8679ccdec3fd4461d1e4d90539d22bf2e5b4d142151517758ea344795779c6
9069+
conditions: (os=darwin | os=linux | os=win32) & (cpu=arm64 | cpu=x64 | cpu=aarch64)
89479070
languageName: node
89489071
linkType: hard
89499072

@@ -11622,7 +11745,7 @@ __metadata:
1162211745
"@yarnpkg/cli": "npm:^4.5.3"
1162311746
"@yarnpkg/core": "npm:^4.1.6"
1162411747
"@yarnpkg/plugin-pack": "npm:^4.0.0"
11625-
bun: "npm:^1.1.34"
11748+
bun: "npm:1.2.3"
1162611749
cross-env: "npm:^7.0.3"
1162711750
eslint: "npm:^9.12.0"
1162811751
eslint-plugin-import: "npm:^2.31.0"

0 commit comments

Comments
 (0)