@supabase/functions-js 2.72.1-canary.9 → 2.80.1-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/README.md +2 -2
- package/dist/main/FunctionsClient.d.ts +1 -1
- package/dist/main/FunctionsClient.d.ts.map +1 -1
- package/dist/main/FunctionsClient.js +8 -1
- package/dist/main/FunctionsClient.js.map +1 -1
- package/dist/main/types.d.ts +4 -0
- package/dist/main/types.d.ts.map +1 -1
- package/dist/main/version.d.ts +1 -1
- package/dist/main/version.js +1 -1
- package/dist/module/FunctionsClient.d.ts +1 -1
- package/dist/module/FunctionsClient.d.ts.map +1 -1
- package/dist/module/FunctionsClient.js +9 -2
- package/dist/module/FunctionsClient.js.map +1 -1
- package/dist/module/types.d.ts +4 -0
- package/dist/module/types.d.ts.map +1 -1
- package/dist/module/version.d.ts +1 -1
- package/dist/module/version.js +1 -1
- package/package.json +5 -5
- package/src/FunctionsClient.ts +10 -3
- package/src/edge-runtime.d.ts +189 -53
- package/src/types.ts +4 -0
- package/src/version.ts +1 -1
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ const { data, error } = await functions.invoke('hello-world', {
|
|
|
37
37
|
|
|
38
38
|
## Development
|
|
39
39
|
|
|
40
|
-
This package is part of the [Supabase JavaScript monorepo](https://github.com/supabase/
|
|
40
|
+
This package is part of the [Supabase JavaScript monorepo](https://github.com/supabase/js-client-libs). To work on this package:
|
|
41
41
|
|
|
42
42
|
### Building
|
|
43
43
|
|
|
@@ -98,6 +98,6 @@ npx nx test:ci functions-js
|
|
|
98
98
|
|
|
99
99
|
### Contributing
|
|
100
100
|
|
|
101
|
-
We welcome contributions! Please see our [Contributing Guide](../../../CONTRIBUTING.md) for details on how to get started.
|
|
101
|
+
We welcome contributions! Please see our [Contributing Guide](../../../docs/CONTRIBUTING.md) for details on how to get started.
|
|
102
102
|
|
|
103
103
|
For major changes or if you're unsure about something, please open an issue first to discuss your proposed changes.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Fetch,
|
|
1
|
+
import { Fetch, FunctionInvokeOptions, FunctionRegion, FunctionsResponse } from './types';
|
|
2
2
|
export declare class FunctionsClient {
|
|
3
3
|
protected url: string;
|
|
4
4
|
protected headers: Record<string, string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FunctionsClient.d.ts","sourceRoot":"","sources":["../../src/FunctionsClient.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,
|
|
1
|
+
{"version":3,"file":"FunctionsClient.d.ts","sourceRoot":"","sources":["../../src/FunctionsClient.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,EACL,qBAAqB,EACrB,cAAc,EAId,iBAAiB,EAClB,MAAM,SAAS,CAAA;AAEhB,qBAAa,eAAe;IAC1B,SAAS,CAAC,GAAG,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACzC,SAAS,CAAC,MAAM,EAAE,cAAc,CAAA;IAChC,SAAS,CAAC,KAAK,EAAE,KAAK,CAAA;gBAGpB,GAAG,EAAE,MAAM,EACX,EACE,OAAY,EACZ,WAAW,EACX,MAA2B,GAC5B,GAAE;QACD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;QAChC,WAAW,CAAC,EAAE,KAAK,CAAA;QACnB,MAAM,CAAC,EAAE,cAAc,CAAA;KACnB;IAQR;;;OAGG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM;IAIrB;;;;OAIG;IACG,MAAM,CAAC,CAAC,GAAG,GAAG,EAClB,YAAY,EAAE,MAAM,EACpB,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;CAiGjC"}
|
|
@@ -35,7 +35,7 @@ class FunctionsClient {
|
|
|
35
35
|
return __awaiter(this, arguments, void 0, function* (functionName, options = {}) {
|
|
36
36
|
var _a;
|
|
37
37
|
try {
|
|
38
|
-
const { headers, method, body: functionArgs } = options;
|
|
38
|
+
const { headers, method, body: functionArgs, signal } = options;
|
|
39
39
|
let _headers = {};
|
|
40
40
|
let { region } = options;
|
|
41
41
|
if (!region) {
|
|
@@ -81,7 +81,11 @@ class FunctionsClient {
|
|
|
81
81
|
// 3. default Content-Type header
|
|
82
82
|
headers: Object.assign(Object.assign(Object.assign({}, _headers), this.headers), headers),
|
|
83
83
|
body,
|
|
84
|
+
signal,
|
|
84
85
|
}).catch((fetchError) => {
|
|
86
|
+
if (fetchError.name === 'AbortError') {
|
|
87
|
+
throw fetchError;
|
|
88
|
+
}
|
|
85
89
|
throw new types_1.FunctionsFetchError(fetchError);
|
|
86
90
|
});
|
|
87
91
|
const isRelayError = response.headers.get('x-relay-error');
|
|
@@ -112,6 +116,9 @@ class FunctionsClient {
|
|
|
112
116
|
return { data, error: null, response };
|
|
113
117
|
}
|
|
114
118
|
catch (error) {
|
|
119
|
+
if (error instanceof Error && error.name === 'AbortError') {
|
|
120
|
+
return { data: null, error: new types_1.FunctionsFetchError(error) };
|
|
121
|
+
}
|
|
115
122
|
return {
|
|
116
123
|
data: null,
|
|
117
124
|
error,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FunctionsClient.js","sourceRoot":"","sources":["../../src/FunctionsClient.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAuC;AACvC,mCAQgB;AAEhB,MAAa,eAAe;IAM1B,YACE,GAAW,EACX,EACE,OAAO,GAAG,EAAE,EACZ,WAAW,EACX,MAAM,GAAG,sBAAc,CAAC,GAAG,MAKzB,EAAE;QAEN,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,KAAK,GAAG,IAAA,qBAAY,EAAC,WAAW,CAAC,CAAA;IACxC,CAAC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AC;qBAAM,IAAI,YAAY,KAAK,mBAAmB,EAAE,CAAC;oBAChD,IAAI,GAAG,QAAQ,CAAA;gBACjB,CAAC;qBAAM,IAAI,YAAY,KAAK,qBAAqB,EAAE,CAAC;oBAClD,IAAI,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,CAAA;gBAClC,CAAC;qBAAM,CAAC;oBACN,kBAAkB;oBAClB,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;gBAC9B,CAAC;gBAED,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAA;YACxC,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;oBAC1D,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,2BAAmB,CAAC,KAAK,CAAC,EAAE,CAAA;gBAC9D,CAAC;gBACD,OAAO;oBACL,IAAI,EAAE,IAAI;oBACV,KAAK;oBACL,QAAQ,EACN,KAAK,YAAY,0BAAkB,IAAI,KAAK,YAAY,2BAAmB;wBACzE,CAAC,CAAC,KAAK,CAAC,OAAO;wBACf,CAAC,CAAC,SAAS;iBAChB,CAAA;YACH,CAAC;QACH,CAAC;KAAA;CACF;AAzID,0CAyIC"}
|
package/dist/main/types.d.ts
CHANGED
|
@@ -62,5 +62,9 @@ export type FunctionInvokeOptions = {
|
|
|
62
62
|
* The body of the request.
|
|
63
63
|
*/
|
|
64
64
|
body?: File | Blob | ArrayBuffer | FormData | ReadableStream<Uint8Array> | Record<string, any> | string;
|
|
65
|
+
/**
|
|
66
|
+
* The AbortSignal to use for the request.
|
|
67
|
+
* */
|
|
68
|
+
signal?: AbortSignal;
|
|
65
69
|
};
|
|
66
70
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/main/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
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AY,mBAAmB;IAC/B,YAAY,mBAAmB;IAC/B,QAAQ,eAAe;IACvB,YAAY,mBAAmB;IAC/B,YAAY,mBAAmB;IAC/B,UAAU,iBAAiB;IAC3B,UAAU,iBAAiB;IAC3B,OAAO,cAAc;IACrB,OAAO,cAAc;IACrB,OAAO,cAAc;IACrB,OAAO,cAAc;IACrB,OAAO,cAAc;IACrB,OAAO,cAAc;IACrB,OAAO,cAAc;CACtB;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC;;OAEG;IACH,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;IACnC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAA;IACpD;;OAEG;IACH,MAAM,CAAC,EAAE,cAAc,CAAA;IACvB;;OAEG;IACH,IAAI,CAAC,EACD,IAAI,GACJ,IAAI,GACJ,WAAW,GACX,QAAQ,GACR,cAAc,CAAC,UAAU,CAAC,GAC1B,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACnB,MAAM,CAAA;IACV;;SAEK;IACL,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB,CAAA"}
|
package/dist/main/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "2.
|
|
1
|
+
export declare const version = "2.80.1-canary.1";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/main/version.js
CHANGED
|
@@ -7,5 +7,5 @@ exports.version = void 0;
|
|
|
7
7
|
// - Debugging and support (identifying which version is running)
|
|
8
8
|
// - Telemetry and logging (version reporting in errors/analytics)
|
|
9
9
|
// - Ensuring build artifacts match the published package version
|
|
10
|
-
exports.version = '2.
|
|
10
|
+
exports.version = '2.80.1-canary.1';
|
|
11
11
|
//# sourceMappingURL=version.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Fetch,
|
|
1
|
+
import { Fetch, FunctionInvokeOptions, FunctionRegion, FunctionsResponse } from './types';
|
|
2
2
|
export declare class FunctionsClient {
|
|
3
3
|
protected url: string;
|
|
4
4
|
protected headers: Record<string, string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FunctionsClient.d.ts","sourceRoot":"","sources":["../../src/FunctionsClient.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,
|
|
1
|
+
{"version":3,"file":"FunctionsClient.d.ts","sourceRoot":"","sources":["../../src/FunctionsClient.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,EACL,qBAAqB,EACrB,cAAc,EAId,iBAAiB,EAClB,MAAM,SAAS,CAAA;AAEhB,qBAAa,eAAe;IAC1B,SAAS,CAAC,GAAG,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACzC,SAAS,CAAC,MAAM,EAAE,cAAc,CAAA;IAChC,SAAS,CAAC,KAAK,EAAE,KAAK,CAAA;gBAGpB,GAAG,EAAE,MAAM,EACX,EACE,OAAY,EACZ,WAAW,EACX,MAA2B,GAC5B,GAAE;QACD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;QAChC,WAAW,CAAC,EAAE,KAAK,CAAA;QACnB,MAAM,CAAC,EAAE,cAAc,CAAA;KACnB;IAQR;;;OAGG;IACH,OAAO,CAAC,KAAK,EAAE,MAAM;IAIrB;;;;OAIG;IACG,MAAM,CAAC,CAAC,GAAG,GAAG,EAClB,YAAY,EAAE,MAAM,EACpB,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;CAiGjC"}
|
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { resolveFetch } from './helper';
|
|
11
|
-
import { FunctionsFetchError, FunctionsHttpError, FunctionsRelayError,
|
|
11
|
+
import { FunctionRegion, FunctionsFetchError, FunctionsHttpError, FunctionsRelayError, } from './types';
|
|
12
12
|
export class FunctionsClient {
|
|
13
13
|
constructor(url, { headers = {}, customFetch, region = FunctionRegion.Any, } = {}) {
|
|
14
14
|
this.url = url;
|
|
@@ -32,7 +32,7 @@ export class FunctionsClient {
|
|
|
32
32
|
return __awaiter(this, arguments, void 0, function* (functionName, options = {}) {
|
|
33
33
|
var _a;
|
|
34
34
|
try {
|
|
35
|
-
const { headers, method, body: functionArgs } = options;
|
|
35
|
+
const { headers, method, body: functionArgs, signal } = options;
|
|
36
36
|
let _headers = {};
|
|
37
37
|
let { region } = options;
|
|
38
38
|
if (!region) {
|
|
@@ -78,7 +78,11 @@ export class FunctionsClient {
|
|
|
78
78
|
// 3. default Content-Type header
|
|
79
79
|
headers: Object.assign(Object.assign(Object.assign({}, _headers), this.headers), headers),
|
|
80
80
|
body,
|
|
81
|
+
signal,
|
|
81
82
|
}).catch((fetchError) => {
|
|
83
|
+
if (fetchError.name === 'AbortError') {
|
|
84
|
+
throw fetchError;
|
|
85
|
+
}
|
|
82
86
|
throw new FunctionsFetchError(fetchError);
|
|
83
87
|
});
|
|
84
88
|
const isRelayError = response.headers.get('x-relay-error');
|
|
@@ -109,6 +113,9 @@ export class FunctionsClient {
|
|
|
109
113
|
return { data, error: null, response };
|
|
110
114
|
}
|
|
111
115
|
catch (error) {
|
|
116
|
+
if (error instanceof Error && error.name === 'AbortError') {
|
|
117
|
+
return { data: null, error: new FunctionsFetchError(error) };
|
|
118
|
+
}
|
|
112
119
|
return {
|
|
113
120
|
data: null,
|
|
114
121
|
error,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FunctionsClient.js","sourceRoot":"","sources":["../../src/FunctionsClient.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,
|
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C,QAAQ,EAAE,CAAA;gBAClC,CAAC;qBAAM,CAAC;oBACN,kBAAkB;oBAClB,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;gBAC9B,CAAC;gBAED,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAA;YACxC,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;oBAC1D,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,mBAAmB,CAAC,KAAK,CAAC,EAAE,CAAA;gBAC9D,CAAC;gBACD,OAAO;oBACL,IAAI,EAAE,IAAI;oBACV,KAAK;oBACL,QAAQ,EACN,KAAK,YAAY,kBAAkB,IAAI,KAAK,YAAY,mBAAmB;wBACzE,CAAC,CAAC,KAAK,CAAC,OAAO;wBACf,CAAC,CAAC,SAAS;iBAChB,CAAA;YACH,CAAC;QACH,CAAC;KAAA;CACF"}
|
package/dist/module/types.d.ts
CHANGED
|
@@ -62,5 +62,9 @@ export type FunctionInvokeOptions = {
|
|
|
62
62
|
* The body of the request.
|
|
63
63
|
*/
|
|
64
64
|
body?: File | Blob | ArrayBuffer | FormData | ReadableStream<Uint8Array> | Record<string, any> | string;
|
|
65
|
+
/**
|
|
66
|
+
* The AbortSignal to use for the request.
|
|
67
|
+
* */
|
|
68
|
+
signal?: AbortSignal;
|
|
65
69
|
};
|
|
66
70
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAA;AAEhC;;GAEG;AACH,MAAM,WAAW,wBAAwB,CAAC,CAAC;IACzC,IAAI,EAAE,CAAC,CAAA;IACP,KAAK,EAAE,IAAI,CAA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,OAAO,cAAc;IACrB,OAAO,cAAc;IACrB,OAAO,cAAc;CACtB;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC;;OAEG;IACH,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;IACnC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAA;IACpD;;OAEG;IACH,MAAM,CAAC,EAAE,cAAc,CAAA;IACvB;;OAEG;IACH,IAAI,CAAC,EACD,IAAI,GACJ,IAAI,GACJ,WAAW,GACX,QAAQ,GACR,cAAc,CAAC,UAAU,CAAC,GAC1B,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACnB,MAAM,CAAA;IACV;;SAEK;IACL,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB,CAAA"}
|
package/dist/module/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "2.
|
|
1
|
+
export declare const version = "2.80.1-canary.1";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/module/version.js
CHANGED
|
@@ -4,5 +4,5 @@
|
|
|
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.
|
|
7
|
+
export const version = '2.80.1-canary.1';
|
|
8
8
|
//# sourceMappingURL=version.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supabase/functions-js",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.80.1-canary.1",
|
|
4
4
|
"description": "JS Client library to interact with Supabase Functions.",
|
|
5
5
|
"main": "dist/main/index.js",
|
|
6
6
|
"module": "dist/module/index.js",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"scripts": {
|
|
10
10
|
"clean": "rimraf dist docs/v2",
|
|
11
11
|
"format": "prettier --write \"{src,test}/**/*.ts\"",
|
|
12
|
-
"build": "npm run clean && npm run
|
|
12
|
+
"build": "npm run clean && npm run build:main && npm run build:module",
|
|
13
13
|
"build:main": "tsc -p tsconfig.json",
|
|
14
14
|
"build:module": "tsc -p tsconfig.module.json",
|
|
15
15
|
"docs": "typedoc src/index.ts --out docs/v2",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
"repository": {
|
|
21
21
|
"type": "git",
|
|
22
|
-
"url": "https://github.com/supabase/
|
|
22
|
+
"url": "https://github.com/supabase/js-client-libs.git",
|
|
23
23
|
"directory": "packages/core/functions-js"
|
|
24
24
|
},
|
|
25
25
|
"keywords": [
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
],
|
|
34
34
|
"license": "MIT",
|
|
35
35
|
"bugs": {
|
|
36
|
-
"url": "https://github.com/supabase/
|
|
36
|
+
"url": "https://github.com/supabase/js-client-libs/issues"
|
|
37
37
|
},
|
|
38
|
-
"homepage": "https://github.com/supabase/
|
|
38
|
+
"homepage": "https://github.com/supabase/js-client-libs/tree/main/packages/core/functions-js",
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@supabase/node-fetch": "2.6.15"
|
|
41
41
|
},
|
package/src/FunctionsClient.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { resolveFetch } from './helper'
|
|
2
2
|
import {
|
|
3
3
|
Fetch,
|
|
4
|
+
FunctionInvokeOptions,
|
|
5
|
+
FunctionRegion,
|
|
4
6
|
FunctionsFetchError,
|
|
5
7
|
FunctionsHttpError,
|
|
6
8
|
FunctionsRelayError,
|
|
7
9
|
FunctionsResponse,
|
|
8
|
-
FunctionInvokeOptions,
|
|
9
|
-
FunctionRegion,
|
|
10
10
|
} from './types'
|
|
11
11
|
|
|
12
12
|
export class FunctionsClient {
|
|
@@ -51,7 +51,7 @@ export class FunctionsClient {
|
|
|
51
51
|
options: FunctionInvokeOptions = {}
|
|
52
52
|
): Promise<FunctionsResponse<T>> {
|
|
53
53
|
try {
|
|
54
|
-
const { headers, method, body: functionArgs } = options
|
|
54
|
+
const { headers, method, body: functionArgs, signal } = options
|
|
55
55
|
let _headers: Record<string, string> = {}
|
|
56
56
|
let { region } = options
|
|
57
57
|
if (!region) {
|
|
@@ -99,7 +99,11 @@ export class FunctionsClient {
|
|
|
99
99
|
// 3. default Content-Type header
|
|
100
100
|
headers: { ..._headers, ...this.headers, ...headers },
|
|
101
101
|
body,
|
|
102
|
+
signal,
|
|
102
103
|
}).catch((fetchError) => {
|
|
104
|
+
if (fetchError.name === 'AbortError') {
|
|
105
|
+
throw fetchError
|
|
106
|
+
}
|
|
103
107
|
throw new FunctionsFetchError(fetchError)
|
|
104
108
|
})
|
|
105
109
|
|
|
@@ -129,6 +133,9 @@ export class FunctionsClient {
|
|
|
129
133
|
|
|
130
134
|
return { data, error: null, response }
|
|
131
135
|
} catch (error) {
|
|
136
|
+
if (error instanceof Error && error.name === 'AbortError') {
|
|
137
|
+
return { data: null, error: new FunctionsFetchError(error) }
|
|
138
|
+
}
|
|
132
139
|
return {
|
|
133
140
|
data: null,
|
|
134
141
|
error,
|
package/src/edge-runtime.d.ts
CHANGED
|
@@ -1,62 +1,198 @@
|
|
|
1
|
-
declare
|
|
2
|
-
export interface ModelOptions {
|
|
3
|
-
/**
|
|
4
|
-
* Pool embeddings by taking their mean. Applies only for `gte-small` model
|
|
5
|
-
*/
|
|
6
|
-
mean_pool?: boolean
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Normalize the embeddings result. Applies only for `gte-small` model
|
|
10
|
-
*/
|
|
11
|
-
normalize?: boolean
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Stream response from model. Applies only for LLMs like `mistral` (default: false)
|
|
15
|
-
*/
|
|
16
|
-
stream?: boolean
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Automatically abort the request to the model after specified time (in seconds). Applies only for LLMs like `mistral` (default: 60)
|
|
20
|
-
*/
|
|
21
|
-
timeout?: number
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Mode for the inference API host. (default: 'ollama')
|
|
25
|
-
*/
|
|
26
|
-
mode?: 'ollama' | 'openaicompatible'
|
|
27
|
-
signal?: AbortSignal
|
|
28
|
-
}
|
|
1
|
+
declare type BeforeunloadReason = 'cpu' | 'memory' | 'wall_clock' | 'early_drop' | 'termination'
|
|
29
2
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
| string
|
|
42
|
-
| Omit<import('openai').OpenAI.Chat.ChatCompletionCreateParams, 'model' | 'stream'>,
|
|
43
|
-
modelOptions?: ModelOptions
|
|
44
|
-
): unknown
|
|
45
|
-
}
|
|
3
|
+
declare interface WindowEventMap {
|
|
4
|
+
load: Event
|
|
5
|
+
unload: Event
|
|
6
|
+
beforeunload: CustomEvent<BeforeunloadReason>
|
|
7
|
+
drain: Event
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// TODO(Nyannyacha): These two type defs will be provided later.
|
|
11
|
+
|
|
12
|
+
// deno-lint-ignore no-explicit-any
|
|
13
|
+
type S3FsConfig = any
|
|
46
14
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
15
|
+
// deno-lint-ignore no-explicit-any
|
|
16
|
+
type TmpFsConfig = any
|
|
17
|
+
|
|
18
|
+
type OtelPropagators = 'TraceContext' | 'Baggage'
|
|
19
|
+
type OtelConsoleConfig = 'Ignore' | 'Capture' | 'Replace'
|
|
20
|
+
type OtelConfig = {
|
|
21
|
+
tracing_enabled?: boolean
|
|
22
|
+
metrics_enabled?: boolean
|
|
23
|
+
console?: OtelConsoleConfig
|
|
24
|
+
propagators?: OtelPropagators[]
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface UserWorkerFetchOptions {
|
|
28
|
+
signal?: AbortSignal
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface PermissionsOptions {
|
|
32
|
+
allow_all?: boolean | null
|
|
33
|
+
allow_env?: string[] | null
|
|
34
|
+
deny_env?: string[] | null
|
|
35
|
+
allow_net?: string[] | null
|
|
36
|
+
deny_net?: string[] | null
|
|
37
|
+
allow_ffi?: string[] | null
|
|
38
|
+
deny_ffi?: string[] | null
|
|
39
|
+
allow_read?: string[] | null
|
|
40
|
+
deny_read?: string[] | null
|
|
41
|
+
allow_run?: string[] | null
|
|
42
|
+
deny_run?: string[] | null
|
|
43
|
+
allow_sys?: string[] | null
|
|
44
|
+
deny_sys?: string[] | null
|
|
45
|
+
allow_write?: string[] | null
|
|
46
|
+
deny_write?: string[] | null
|
|
47
|
+
allow_import?: string[] | null
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface UserWorkerCreateContext {
|
|
51
|
+
sourceMap?: boolean | null
|
|
52
|
+
importMapPath?: string | null
|
|
53
|
+
shouldBootstrapMockFnThrowError?: boolean | null
|
|
54
|
+
suppressEszipMigrationWarning?: boolean | null
|
|
55
|
+
useReadSyncFileAPI?: boolean | null
|
|
56
|
+
supervisor?: {
|
|
57
|
+
requestAbsentTimeoutMs?: number | null
|
|
58
|
+
}
|
|
59
|
+
otel?: {
|
|
60
|
+
[attribute: string]: string
|
|
52
61
|
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
interface UserWorkerCreateOptions {
|
|
65
|
+
servicePath?: string | null
|
|
66
|
+
envVars?: string[][] | [string, string][] | null
|
|
67
|
+
noModuleCache?: boolean | null
|
|
68
|
+
|
|
69
|
+
forceCreate?: boolean | null
|
|
70
|
+
allowRemoteModules?: boolean | null
|
|
71
|
+
customModuleRoot?: string | null
|
|
72
|
+
permissions?: PermissionsOptions | null
|
|
73
|
+
|
|
74
|
+
maybeEszip?: Uint8Array | null
|
|
75
|
+
maybeEntrypoint?: string | null
|
|
76
|
+
maybeModuleCode?: string | null
|
|
77
|
+
|
|
78
|
+
memoryLimitMb?: number | null
|
|
79
|
+
lowMemoryMultiplier?: number | null
|
|
80
|
+
workerTimeoutMs?: number | null
|
|
81
|
+
cpuTimeSoftLimitMs?: number | null
|
|
82
|
+
cpuTimeHardLimitMs?: number | null
|
|
83
|
+
staticPatterns?: string[] | null
|
|
84
|
+
|
|
85
|
+
s3FsConfig?: S3FsConfig | null
|
|
86
|
+
tmpFsConfig?: TmpFsConfig | null
|
|
87
|
+
otelConfig?: OtelConfig | null
|
|
88
|
+
|
|
89
|
+
context?: UserWorkerCreateContext | null
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
interface HeapStatistics {
|
|
93
|
+
totalHeapSize: number
|
|
94
|
+
totalHeapSizeExecutable: number
|
|
95
|
+
totalPhysicalSize: number
|
|
96
|
+
totalAvailableSize: number
|
|
97
|
+
totalGlobalHandlesSize: number
|
|
98
|
+
usedGlobalHandlesSize: number
|
|
99
|
+
usedHeapSize: number
|
|
100
|
+
mallocedMemory: number
|
|
101
|
+
externalMemory: number
|
|
102
|
+
peakMallocedMemory: number
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
interface RuntimeMetrics {
|
|
106
|
+
mainWorkerHeapStats: HeapStatistics
|
|
107
|
+
eventWorkerHeapStats?: HeapStatistics
|
|
108
|
+
}
|
|
53
109
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
110
|
+
interface MemInfo {
|
|
111
|
+
total: number
|
|
112
|
+
free: number
|
|
113
|
+
available: number
|
|
114
|
+
buffers: number
|
|
115
|
+
cached: number
|
|
116
|
+
swapTotal: number
|
|
117
|
+
swapFree: number
|
|
58
118
|
}
|
|
59
119
|
|
|
60
120
|
declare namespace EdgeRuntime {
|
|
121
|
+
export namespace ai {
|
|
122
|
+
function tryCleanupUnusedSession(): Promise<number>
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
class UserWorker {
|
|
126
|
+
constructor(key: string)
|
|
127
|
+
|
|
128
|
+
fetch(request: Request, options?: UserWorkerFetchOptions): Promise<Response>
|
|
129
|
+
|
|
130
|
+
static create(opts: UserWorkerCreateOptions): Promise<UserWorker>
|
|
131
|
+
static tryCleanupIdleWorkers(timeoutMs: number): Promise<number>
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export function scheduleTermination(): void
|
|
61
135
|
export function waitUntil<T>(promise: Promise<T>): Promise<T>
|
|
136
|
+
export function getRuntimeMetrics(): Promise<RuntimeMetrics>
|
|
137
|
+
export function applySupabaseTag(src: Request, dest: Request): void
|
|
138
|
+
export function systemMemoryInfo(): MemInfo
|
|
139
|
+
export function raiseSegfault(): void
|
|
140
|
+
|
|
141
|
+
export { UserWorker as userWorkers }
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
declare namespace Supabase {
|
|
145
|
+
export namespace ai {
|
|
146
|
+
interface ModelOptions {
|
|
147
|
+
/**
|
|
148
|
+
* Pool embeddings by taking their mean. Applies only for `gte-small` model
|
|
149
|
+
*/
|
|
150
|
+
mean_pool?: boolean
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Normalize the embeddings result. Applies only for `gte-small` model
|
|
154
|
+
*/
|
|
155
|
+
normalize?: boolean
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Stream response from model. Applies only for LLMs like `mistral` (default: false)
|
|
159
|
+
*/
|
|
160
|
+
stream?: boolean
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Automatically abort the request to the model after specified time (in seconds). Applies only for LLMs like `mistral` (default: 60)
|
|
164
|
+
*/
|
|
165
|
+
timeout?: number
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Mode for the inference API host. (default: 'ollama')
|
|
169
|
+
*/
|
|
170
|
+
mode?: 'ollama' | 'openaicompatible'
|
|
171
|
+
signal?: AbortSignal
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export class Session {
|
|
175
|
+
/**
|
|
176
|
+
* Create a new model session using given model
|
|
177
|
+
*/
|
|
178
|
+
constructor(model: string)
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Execute the given prompt in model session
|
|
182
|
+
*/
|
|
183
|
+
run(
|
|
184
|
+
prompt:
|
|
185
|
+
| string
|
|
186
|
+
| Omit<import('openai').OpenAI.Chat.ChatCompletionCreateParams, 'model' | 'stream'>,
|
|
187
|
+
modelOptions?: ModelOptions
|
|
188
|
+
): unknown
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
declare namespace Deno {
|
|
194
|
+
export namespace errors {
|
|
195
|
+
class WorkerRequestCancelled extends Error {}
|
|
196
|
+
class WorkerAlreadyRetired extends Error {}
|
|
197
|
+
}
|
|
62
198
|
}
|
package/src/types.ts
CHANGED
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.
|
|
7
|
+
export const version = '2.80.1-canary.1'
|