Skip to content

Commit 92ee54d

Browse files
release: 3.7.1 (#597)
* chore(client): restructure abort controller binding * fix(client): avoid removing abort listener too early * chore(internal): fix pagination internals not accepting option promises * release: 3.7.1 --------- Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
1 parent 302e3ea commit 92ee54d

File tree

5 files changed

+32
-7
lines changed

5 files changed

+32
-7
lines changed

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "3.7.0"
2+
".": "3.7.1"
33
}

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# Changelog
22

3+
## 3.7.1 (2026-02-06)
4+
5+
Full Changelog: [v3.7.0...v3.7.1](https://github.com/val-town/sdk/compare/v3.7.0...v3.7.1)
6+
7+
### Bug Fixes
8+
9+
* **client:** avoid removing abort listener too early ([6640c2a](https://github.com/val-town/sdk/commit/6640c2ae8aaf33e7460cb864784fb9fc3ca97e9a))
10+
11+
12+
### Chores
13+
14+
* **client:** restructure abort controller binding ([1253b9e](https://github.com/val-town/sdk/commit/1253b9e64ec4832f7fb36150830f9014071cf53b))
15+
* **internal:** fix pagination internals not accepting option promises ([99f9d33](https://github.com/val-town/sdk/commit/99f9d33f716bd24fbf0c8a3995029f19fabf5054))
16+
317
## 3.7.0 (2026-02-03)
418

519
Full Changelog: [v3.6.3...v3.7.0](https://github.com/val-town/sdk/compare/v3.6.3...v3.7.0)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@valtown/sdk",
3-
"version": "3.7.0",
3+
"version": "3.7.1",
44
"description": "The official TypeScript library for the Val Town API",
55
"author": "Val Town <support@val.town>",
66
"types": "dist/index.d.ts",

src/client.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -494,17 +494,22 @@ export class ValTown {
494494
getAPIList<Item, PageClass extends Pagination.AbstractPage<Item> = Pagination.AbstractPage<Item>>(
495495
path: string,
496496
Page: new (...args: any[]) => PageClass,
497-
opts?: RequestOptions,
497+
opts?: PromiseOrValue<RequestOptions>,
498498
): Pagination.PagePromise<PageClass, Item> {
499-
return this.requestAPIList(Page, { method: 'get', path, ...opts });
499+
return this.requestAPIList(
500+
Page,
501+
opts && 'then' in opts ?
502+
opts.then((opts) => ({ method: 'get', path, ...opts }))
503+
: { method: 'get', path, ...opts },
504+
);
500505
}
501506

502507
requestAPIList<
503508
Item = unknown,
504509
PageClass extends Pagination.AbstractPage<Item> = Pagination.AbstractPage<Item>,
505510
>(
506511
Page: new (...args: ConstructorParameters<typeof Pagination.AbstractPage>) => PageClass,
507-
options: FinalRequestOptions,
512+
options: PromiseOrValue<FinalRequestOptions>,
508513
): Pagination.PagePromise<PageClass, Item> {
509514
const request = this.makeRequest(options, null, undefined);
510515
return new Pagination.PagePromise<PageClass, Item>(this as any as ValTown, request, Page);
@@ -517,7 +522,7 @@ export class ValTown {
517522
controller: AbortController,
518523
): Promise<Response> {
519524
const { signal, method, ...options } = init || {};
520-
const abort = controller.abort.bind(controller);
525+
const abort = this._makeAbort(controller);
521526
if (signal) signal.addEventListener('abort', abort, { once: true });
522527

523528
const timeout = setTimeout(abort, ms);
@@ -687,6 +692,12 @@ export class ValTown {
687692
return headers.values;
688693
}
689694

695+
private _makeAbort(controller: AbortController) {
696+
// note: we can't just inline this method inside `fetchWithTimeout()` because then the closure
697+
// would capture all request options, and cause a memory leak.
698+
return () => controller.abort();
699+
}
700+
690701
private buildBody({ options: { body, headers: rawHeaders } }: { options: FinalRequestOptions }): {
691702
bodyHeaders: HeadersLike;
692703
body: BodyInit | undefined;

src/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const VERSION = '3.7.0'; // x-release-please-version
1+
export const VERSION = '3.7.1'; // x-release-please-version

0 commit comments

Comments
 (0)