@supabase/functions-js 2.110.7 → 2.110.8-canary.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main/FunctionsClient.d.ts.map +1 -1
- package/dist/main/FunctionsClient.js +17 -4
- package/dist/main/FunctionsClient.js.map +1 -1
- package/dist/main/version.d.ts +1 -1
- package/dist/main/version.d.ts.map +1 -1
- package/dist/main/version.js +1 -1
- package/dist/main/version.js.map +1 -1
- package/dist/module/FunctionsClient.d.ts.map +1 -1
- package/dist/module/FunctionsClient.js +17 -4
- package/dist/module/FunctionsClient.js.map +1 -1
- package/dist/module/version.d.ts +1 -1
- package/dist/module/version.d.ts.map +1 -1
- package/dist/module/version.js +1 -1
- package/dist/module/version.js.map +1 -1
- package/dist/tsconfig.module.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/FunctionsClient.ts +16 -3
- package/src/version.ts +1 -1
package/package.json
CHANGED
package/src/FunctionsClient.ts
CHANGED
|
@@ -207,6 +207,7 @@ export class FunctionsClient {
|
|
|
207
207
|
): Promise<FunctionsResponse<T>> {
|
|
208
208
|
let timeoutId: ReturnType<typeof setTimeout> | undefined
|
|
209
209
|
let timeoutController: AbortController | undefined
|
|
210
|
+
let onAbort: (() => void) | undefined
|
|
210
211
|
|
|
211
212
|
try {
|
|
212
213
|
const { headers, method, body: functionArgs, signal, timeout } = options
|
|
@@ -271,8 +272,10 @@ export class FunctionsClient {
|
|
|
271
272
|
// If user provided their own signal, we need to respect both
|
|
272
273
|
if (signal) {
|
|
273
274
|
effectiveSignal = timeoutController.signal
|
|
274
|
-
// If the user's signal is aborted, abort our timeout controller too
|
|
275
|
-
|
|
275
|
+
// If the user's signal is aborted, abort our timeout controller too.
|
|
276
|
+
// Store the listener so we can clean it up in finally.
|
|
277
|
+
onAbort = () => timeoutController!.abort()
|
|
278
|
+
signal.addEventListener('abort', onAbort)
|
|
276
279
|
} else {
|
|
277
280
|
effectiveSignal = timeoutController.signal
|
|
278
281
|
}
|
|
@@ -300,7 +303,12 @@ export class FunctionsClient {
|
|
|
300
303
|
throw new FunctionsHttpError(response)
|
|
301
304
|
}
|
|
302
305
|
|
|
303
|
-
|
|
306
|
+
// HTTP media types are case-insensitive (RFC 9110), so normalize before
|
|
307
|
+
// matching — otherwise an "Application/JSON" response falls through to text.
|
|
308
|
+
let responseType = (response.headers.get('Content-Type') ?? 'text/plain')
|
|
309
|
+
.split(';')[0]
|
|
310
|
+
.trim()
|
|
311
|
+
.toLowerCase()
|
|
304
312
|
let data: any
|
|
305
313
|
if (responseType === 'application/json') {
|
|
306
314
|
data = await response.json()
|
|
@@ -333,6 +341,11 @@ export class FunctionsClient {
|
|
|
333
341
|
if (timeoutId) {
|
|
334
342
|
clearTimeout(timeoutId)
|
|
335
343
|
}
|
|
344
|
+
// Remove the cross-signal listener to prevent memory leaks when the caller
|
|
345
|
+
// reuses the same AbortSignal across multiple invocations.
|
|
346
|
+
if (onAbort) {
|
|
347
|
+
options.signal?.removeEventListener('abort', onAbort)
|
|
348
|
+
}
|
|
336
349
|
}
|
|
337
350
|
}
|
|
338
351
|
}
|
package/src/version.ts
CHANGED
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
// - Debugging and support (identifying which version is running)
|
|
5
5
|
// - Telemetry and logging (version reporting in errors/analytics)
|
|
6
6
|
// - Ensuring build artifacts match the published package version
|
|
7
|
-
export const version = '2.110.
|
|
7
|
+
export const version = '2.110.8-canary.1'
|