@supabase/functions-js 2.4.6 → 2.58.1-canary.0
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 +91 -11
- package/dist/main/FunctionsClient.d.ts +1 -1
- package/dist/main/FunctionsClient.d.ts.map +1 -1
- package/dist/main/FunctionsClient.js +11 -4
- package/dist/main/FunctionsClient.js.map +1 -1
- package/dist/main/helper.d.ts.map +1 -1
- package/dist/main/helper.js +18 -8
- package/dist/main/helper.js.map +1 -1
- package/dist/main/types.d.ts +7 -3
- package/dist/main/types.d.ts.map +1 -1
- package/dist/main/types.js +1 -1
- package/dist/main/types.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 +7 -1
- package/dist/main/version.js.map +1 -1
- package/dist/module/FunctionsClient.d.ts +1 -1
- package/dist/module/FunctionsClient.d.ts.map +1 -1
- package/dist/module/FunctionsClient.js +12 -5
- package/dist/module/FunctionsClient.js.map +1 -1
- package/dist/module/helper.d.ts.map +1 -1
- package/dist/module/helper.js.map +1 -1
- package/dist/module/types.d.ts +7 -3
- package/dist/module/types.d.ts.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 +7 -1
- package/dist/module/version.js.map +1 -1
- package/package.json +11 -22
- package/src/FunctionsClient.ts +10 -3
- package/src/edge-runtime.d.ts +189 -53
- package/src/types.ts +4 -0
- package/src/version.ts +7 -1
- package/LICENSE +0 -21
package/README.md
CHANGED
|
@@ -1,23 +1,103 @@
|
|
|
1
1
|
# `functions-js`
|
|
2
2
|
|
|
3
|
-
[](https://coveralls.io/github/supabase/functions-js?branch=main) [](https://pkg.pr.new/~/supabase/functions-js)
|
|
4
|
-
|
|
5
|
-
|
|
6
3
|
JS Client library to interact with Supabase Functions.
|
|
7
4
|
|
|
8
5
|
## Docs
|
|
9
6
|
|
|
10
|
-
<https://supabase.com/docs/reference/javascript/functions-invoke>
|
|
7
|
+
- **API Reference**: <https://supabase.com/docs/reference/javascript/functions-invoke>
|
|
8
|
+
- **Functions Guide**: <https://supabase.com/docs/guides/functions>
|
|
9
|
+
|
|
10
|
+
## Quick Start
|
|
11
|
+
|
|
12
|
+
### Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @supabase/functions-js
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Usage
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
import { FunctionsClient } from '@supabase/functions-js'
|
|
22
|
+
|
|
23
|
+
const functionsUrl = 'https://<project_ref>.supabase.co/functions/v1'
|
|
24
|
+
const anonKey = '<anon_key>'
|
|
25
|
+
|
|
26
|
+
const functions = new FunctionsClient(functionsUrl, {
|
|
27
|
+
headers: {
|
|
28
|
+
Authorization: `Bearer ${anonKey}`,
|
|
29
|
+
},
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
// Invoke a function
|
|
33
|
+
const { data, error } = await functions.invoke('hello-world', {
|
|
34
|
+
body: { name: 'Functions' },
|
|
35
|
+
})
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Development
|
|
39
|
+
|
|
40
|
+
This package is part of the [Supabase JavaScript monorepo](https://github.com/supabase/supabase-js). To work on this package:
|
|
41
|
+
|
|
42
|
+
### Building
|
|
11
43
|
|
|
12
|
-
|
|
44
|
+
```bash
|
|
45
|
+
# Complete build (from monorepo root)
|
|
46
|
+
npx nx build functions-js
|
|
13
47
|
|
|
14
|
-
|
|
48
|
+
# Build with watch mode for development
|
|
49
|
+
npx nx build functions-js --watch
|
|
15
50
|
|
|
16
|
-
|
|
51
|
+
# Individual build targets
|
|
52
|
+
npx nx build:main functions-js # CommonJS build (dist/main/)
|
|
53
|
+
npx nx build:module functions-js # ES Modules build (dist/module/)
|
|
17
54
|
|
|
18
|
-
|
|
55
|
+
# Other useful commands
|
|
56
|
+
npx nx clean functions-js # Clean build artifacts
|
|
57
|
+
npx nx format functions-js # Format code with Prettier
|
|
58
|
+
npx nx typecheck functions-js # TypeScript type checking
|
|
59
|
+
npx nx docs functions-js # Generate documentation
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
#### Build Outputs
|
|
63
|
+
|
|
64
|
+
- **CommonJS (`dist/main/`)** - For Node.js environments
|
|
65
|
+
- **ES Modules (`dist/module/`)** - For modern bundlers (Webpack, Vite, Rollup)
|
|
66
|
+
- **TypeScript definitions (`dist/module/index.d.ts`)** - Type definitions for TypeScript projects
|
|
67
|
+
|
|
68
|
+
### Testing
|
|
69
|
+
|
|
70
|
+
**Docker Required** for relay tests. The functions-js tests use testcontainers to spin up a Deno relay server for testing Edge Function invocations.
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
# Run all tests (from monorepo root)
|
|
74
|
+
npx nx test functions-js
|
|
75
|
+
|
|
76
|
+
# Run tests with coverage report
|
|
77
|
+
npx nx test functions-js --coverage
|
|
78
|
+
|
|
79
|
+
# Run tests in watch mode during development
|
|
80
|
+
npx nx test functions-js --watch
|
|
19
81
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
npm run test
|
|
82
|
+
# CI test command (runs with coverage)
|
|
83
|
+
npx nx test:ci functions-js
|
|
23
84
|
```
|
|
85
|
+
|
|
86
|
+
#### Test Requirements
|
|
87
|
+
|
|
88
|
+
- **Node.js 20+** - Required for testcontainers
|
|
89
|
+
- **Docker** - Must be installed and running for relay tests
|
|
90
|
+
- No Supabase instance needed - Tests use mocked services and testcontainers
|
|
91
|
+
|
|
92
|
+
#### What Gets Tested
|
|
93
|
+
|
|
94
|
+
- **Function invocation** - Testing the `invoke()` method with various options
|
|
95
|
+
- **Relay functionality** - Using a containerized Deno relay to test real Edge Function scenarios
|
|
96
|
+
- **Error handling** - Ensuring proper error responses and retries
|
|
97
|
+
- **Request/response models** - Validating headers, body, and response formats
|
|
98
|
+
|
|
99
|
+
### Contributing
|
|
100
|
+
|
|
101
|
+
We welcome contributions! Please see our [Contributing Guide](../../../docs/CONTRIBUTING.md) for details on how to get started.
|
|
102
|
+
|
|
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"}
|
|
@@ -31,11 +31,11 @@ class FunctionsClient {
|
|
|
31
31
|
* @param functionName - The name of the Function to invoke.
|
|
32
32
|
* @param options - Options for invoking the Function.
|
|
33
33
|
*/
|
|
34
|
-
invoke(
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
invoke(functionName_1) {
|
|
35
|
+
return __awaiter(this, arguments, void 0, function* (functionName, options = {}) {
|
|
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,EAC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AC9B,CAAC;qBAAM,IAAI,YAAY,KAAK,0BAA0B,EAAE,CAAC;oBACvD,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;gBAC9B,CAAC;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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../../src/helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAE/B,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../../src/helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAE/B,eAAO,MAAM,YAAY,GAAI,cAAc,KAAK,KAAG,KAWlD,CAAA"}
|
package/dist/main/helper.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.resolveFetch = void 0;
|
|
27
37
|
const resolveFetch = (customFetch) => {
|
|
@@ -30,7 +40,7 @@ const resolveFetch = (customFetch) => {
|
|
|
30
40
|
_fetch = customFetch;
|
|
31
41
|
}
|
|
32
42
|
else if (typeof fetch === 'undefined') {
|
|
33
|
-
_fetch = (...args) => Promise.resolve().then(
|
|
43
|
+
_fetch = (...args) => Promise.resolve(`${'@supabase/node-fetch'}`).then(s => __importStar(require(s))).then(({ default: fetch }) => fetch(...args));
|
|
34
44
|
}
|
|
35
45
|
else {
|
|
36
46
|
_fetch = fetch;
|
package/dist/main/helper.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../src/helper.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../src/helper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEO,MAAM,YAAY,GAAG,CAAC,WAAmB,EAAS,EAAE;IACzD,IAAI,MAAa,CAAA;IACjB,IAAI,WAAW,EAAE,CAAC;QAChB,MAAM,GAAG,WAAW,CAAA;IACtB,CAAC;SAAM,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE,CAAC;QACxC,MAAM,GAAG,CAAC,GAAG,IAAI,EAAE,EAAE,CACnB,mBAAO,sBAA6B,wCAAE,IAAI,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC,CAAA;IACtF,CAAC;SAAM,CAAC;QACN,MAAM,GAAG,KAAK,CAAA;IAChB,CAAC;IACD,OAAO,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAA;AACrC,CAAC,CAAA;AAXY,QAAA,YAAY,gBAWxB"}
|
package/dist/main/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type Fetch = typeof fetch;
|
|
2
2
|
/**
|
|
3
3
|
* Response format
|
|
4
4
|
*/
|
|
@@ -12,7 +12,7 @@ export interface FunctionsResponseFailure {
|
|
|
12
12
|
error: any;
|
|
13
13
|
response?: Response;
|
|
14
14
|
}
|
|
15
|
-
export
|
|
15
|
+
export type FunctionsResponse<T> = FunctionsResponseSuccess<T> | FunctionsResponseFailure;
|
|
16
16
|
export declare class FunctionsError extends Error {
|
|
17
17
|
context: any;
|
|
18
18
|
constructor(message: string, name?: string, context?: any);
|
|
@@ -43,7 +43,7 @@ export declare enum FunctionRegion {
|
|
|
43
43
|
UsWest1 = "us-west-1",
|
|
44
44
|
UsWest2 = "us-west-2"
|
|
45
45
|
}
|
|
46
|
-
export
|
|
46
|
+
export type FunctionInvokeOptions = {
|
|
47
47
|
/**
|
|
48
48
|
* Object representing the headers to send with the request.
|
|
49
49
|
*/
|
|
@@ -62,5 +62,9 @@ export declare 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
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,
|
|
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,CAAA;IACX,QAAQ,CAAC,EAAE,QAAQ,CAAA;CACpB;AACD,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,IAAI,CAAA;IACV,KAAK,EAAE,GAAG,CAAA;IACV,QAAQ,CAAC,EAAE,QAAQ,CAAA;CACpB;AACD,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI,wBAAwB,CAAC,CAAC,CAAC,GAAG,wBAAwB,CAAA;AAEzF,qBAAa,cAAe,SAAQ,KAAK;IACvC,OAAO,EAAE,GA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West1"] = "us-west-1";
|
|
47
47
|
FunctionRegion["UsWest2"] = "us-west-2";
|
|
48
|
-
})(FunctionRegion
|
|
48
|
+
})(FunctionRegion || (exports.FunctionRegion = FunctionRegion = {}));
|
|
49
49
|
//# sourceMappingURL=types.js.map
|
package/dist/main/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;AAiBA,MAAa,cAAe,SAAQ,KAAK;IAEvC,YAAY,OAAe,EAAE,IAAI,GAAG,gBAAgB,EAAE,OAAa;QACjE,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;CACF;AAPD,wCAOC;AAED,MAAa,mBAAoB,SAAQ,cAAc;IACrD,YAAY,OAAY;QACtB,KAAK,CAAC,+CAA+C,EAAE,qBAAqB,EAAE,OAAO,CAAC,CAAA;IACxF,CAAC;CACF;AAJD,kDAIC;AAED,MAAa,mBAAoB,SAAQ,cAAc;IACrD,YAAY,OAAY;QACtB,KAAK,CAAC,wCAAwC,EAAE,qBAAqB,EAAE,OAAO,CAAC,CAAA;IACjF,CAAC;CACF;AAJD,kDAIC;AAED,MAAa,kBAAmB,SAAQ,cAAc;IACpD,YAAY,OAAY;QACtB,KAAK,CAAC,8CAA8C,EAAE,oBAAoB,EAAE,OAAO,CAAC,CAAA;IACtF,CAAC;CACF;AAJD,gDAIC;AACD,4CAA4C;AAC5C,IAAY,cAgBX;AAhBD,WAAY,cAAc;IACxB,6BAAW,CAAA;IACX,iDAA+B,CAAA;IAC/B,iDAA+B,CAAA;IAC/B,yCAAuB,CAAA;IACvB,iDAA+B,CAAA;IAC/B,iDAA+B,CAAA;IAC/B,6CAA2B,CAAA;IAC3B,6CAA2B,CAAA;IAC3B,uCAAqB,CAAA;IACrB,uCAAqB,CAAA;IACrB,uCA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AACvB,CAAC,EAhBW,cAAc,8BAAd,cAAc,QAgBzB"}
|
package/dist/main/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "2.
|
|
1
|
+
export declare const version = "2.58.1-canary.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,OAAO,oBAAoB,CAAA"}
|
package/dist/main/version.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.version = void 0;
|
|
4
|
-
|
|
4
|
+
// Generated automatically during releases by scripts/update-version-files.ts
|
|
5
|
+
// This file provides runtime access to the package version for:
|
|
6
|
+
// - HTTP request headers (e.g., X-Client-Info header for API requests)
|
|
7
|
+
// - Debugging and support (identifying which version is running)
|
|
8
|
+
// - Telemetry and logging (version reporting in errors/analytics)
|
|
9
|
+
// - Ensuring build artifacts match the published package version
|
|
10
|
+
exports.version = '2.58.1-canary.0';
|
|
5
11
|
//# sourceMappingURL=version.js.map
|
package/dist/main/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;AAAA,6EAA6E;AAC7E,gEAAgE;AAChE,uEAAuE;AACvE,iEAAiE;AACjE,kEAAkE;AAClE,iEAAiE;AACpD,QAAA,OAAO,GAAG,iBAAiB,CAAA"}
|
|
@@ -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;
|
|
@@ -28,11 +28,11 @@ export class FunctionsClient {
|
|
|
28
28
|
* @param functionName - The name of the Function to invoke.
|
|
29
29
|
* @param options - Options for invoking the Function.
|
|
30
30
|
*/
|
|
31
|
-
invoke(
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
invoke(functionName_1) {
|
|
32
|
+
return __awaiter(this, arguments, void 0, function* (functionName, options = {}) {
|
|
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,
|
|
1
|
+
{"version":3,"file":"FunctionsClient.js","sourceRoot":"","sources":["../../src/FunctionsClient.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,EAGL,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,GAEpB,MAAM,SAAS,CAAA;AAEhB,MAAM,OAAO,eAAe;IAM1B,YACE,GAAW,EACX,EACE,OAAO,GAAG,EAAE,EACZ,WAAW,EACX,MAAM,GAAG,cAAc,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,YAAY,CAAC,WAAW,CAAC,CAAA;IACxC,CAAC;IAED;;;OAGG;IACH,OAAO,CAAC,KAAa;QACnB,IAAI,CAAC,OAAO,CAAC,aAAa,GAAG,UAAU,KAAK,EAAE,CAAA;IAChD,CAAC;IAED;;;;OAIG;IACG,MAAM;6DACV,YAAoB,EACpB,UAAiC,EAAE;;YAEnC,IAAI,CAAC;gBACH,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,OAAO,CAAA;gBAC/D,IAAI,QAAQ,GAA2B,EAAE,CAAA;gBACzC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAA;gBACxB,IAAI,CAAC,MAAM,EAAE,CAAC;oBACZ,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;gBACtB,CAAC;gBACD,8CAA8C;gBAC9C,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,I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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,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../../src/helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAE/B,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../../src/helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAE/B,eAAO,MAAM,YAAY,GAAI,cAAc,KAAK,KAAG,KAWlD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../src/helper.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,WAAmB,EAAS,EAAE;IACzD,IAAI,MAAa,CAAA;IACjB,IAAI,WAAW,EAAE;
|
|
1
|
+
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../src/helper.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,WAAmB,EAAS,EAAE;IACzD,IAAI,MAAa,CAAA;IACjB,IAAI,WAAW,EAAE,CAAC;QAChB,MAAM,GAAG,WAAW,CAAA;IACtB,CAAC;SAAM,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE,CAAC;QACxC,MAAM,GAAG,CAAC,GAAG,IAAI,EAAE,EAAE,CACnB,MAAM,CAAC,sBAA6B,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC,CAAA;IACtF,CAAC;SAAM,CAAC;QACN,MAAM,GAAG,KAAK,CAAA;IAChB,CAAC;IACD,OAAO,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAA;AACrC,CAAC,CAAA"}
|
package/dist/module/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type Fetch = typeof fetch;
|
|
2
2
|
/**
|
|
3
3
|
* Response format
|
|
4
4
|
*/
|
|
@@ -12,7 +12,7 @@ export interface FunctionsResponseFailure {
|
|
|
12
12
|
error: any;
|
|
13
13
|
response?: Response;
|
|
14
14
|
}
|
|
15
|
-
export
|
|
15
|
+
export type FunctionsResponse<T> = FunctionsResponseSuccess<T> | FunctionsResponseFailure;
|
|
16
16
|
export declare class FunctionsError extends Error {
|
|
17
17
|
context: any;
|
|
18
18
|
constructor(message: string, name?: string, context?: any);
|
|
@@ -43,7 +43,7 @@ export declare enum FunctionRegion {
|
|
|
43
43
|
UsWest1 = "us-west-1",
|
|
44
44
|
UsWest2 = "us-west-2"
|
|
45
45
|
}
|
|
46
|
-
export
|
|
46
|
+
export type FunctionInvokeOptions = {
|
|
47
47
|
/**
|
|
48
48
|
* Object representing the headers to send with the request.
|
|
49
49
|
*/
|
|
@@ -62,5 +62,9 @@ export declare 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,
|
|
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,CAAA;IACX,QAAQ,CAAC,EAAE,QAAQ,CAAA;CACpB;AACD,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,IAAI,CAAA;IACV,KAAK,EAAE,GAAG,CAAA;IACV,QAAQ,CAAC,EAAE,QAAQ,CAAA;CACpB;AACD,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI,wBAAwB,CAAC,CAAC,CAAC,GAAG,wBAAwB,CAAA;AAEzF,qBAAa,cAAe,SAAQ,KAAK;IACvC,OAAO,EAAE,GAAG,CAAA;gBACA,OAAO,EAAE,MAAM,EAAE,IAAI,SAAmB,EAAE,OAAO,CAAC,EAAE,GAAG;CAKpE;AAED,qBAAa,mBAAoB,SAAQ,cAAc;gBACzC,OAAO,EAAE,GAAG;CAGzB;AAED,qBAAa,mBAAoB,SAAQ,cAAc;gBACzC,OAAO,EAAE,GAAG;CAGzB;AAED,qBAAa,kBAAmB,SAAQ,cAAc;gBACxC,OAAO,EAAE,GAAG;CAGzB;AAED,oBAAY,cAAc;IACxB,GAAG,QAAQ;IACX,YAAY,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/module/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "2.
|
|
1
|
+
export declare const version = "2.58.1-canary.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,OAAO,oBAAoB,CAAA"}
|
package/dist/module/version.js
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
// Generated automatically during releases by scripts/update-version-files.ts
|
|
2
|
+
// This file provides runtime access to the package version for:
|
|
3
|
+
// - HTTP request headers (e.g., X-Client-Info header for API requests)
|
|
4
|
+
// - Debugging and support (identifying which version is running)
|
|
5
|
+
// - Telemetry and logging (version reporting in errors/analytics)
|
|
6
|
+
// - Ensuring build artifacts match the published package version
|
|
7
|
+
export const version = '2.58.1-canary.0';
|
|
2
8
|
//# sourceMappingURL=version.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,iBAAiB,CAAA"}
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,gEAAgE;AAChE,uEAAuE;AACvE,iEAAiE;AACjE,kEAAkE;AAClE,iEAAiE;AACjE,MAAM,CAAC,MAAM,OAAO,GAAG,iBAAiB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supabase/functions-js",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.58.1-canary.0",
|
|
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,17 +9,18 @@
|
|
|
9
9
|
"scripts": {
|
|
10
10
|
"clean": "rimraf dist docs/v2",
|
|
11
11
|
"format": "prettier --write \"{src,test}/**/*.ts\"",
|
|
12
|
-
"build": "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",
|
|
16
16
|
"docs:json": "typedoc --json docs/v2/spec.json --excludeExternals src/index.ts",
|
|
17
17
|
"test": "jest",
|
|
18
|
-
"test:
|
|
18
|
+
"test:ci": "jest --coverage"
|
|
19
19
|
},
|
|
20
20
|
"repository": {
|
|
21
21
|
"type": "git",
|
|
22
|
-
"url": "
|
|
22
|
+
"url": "https://github.com/supabase/supabase-js.git",
|
|
23
|
+
"directory": "packages/core/functions-js"
|
|
23
24
|
},
|
|
24
25
|
"keywords": [
|
|
25
26
|
"functions",
|
|
@@ -32,32 +33,20 @@
|
|
|
32
33
|
],
|
|
33
34
|
"license": "MIT",
|
|
34
35
|
"bugs": {
|
|
35
|
-
"url": "https://github.com/supabase/
|
|
36
|
+
"url": "https://github.com/supabase/supabase-js/issues"
|
|
36
37
|
},
|
|
37
|
-
"homepage": "https://github.com/supabase/functions-js
|
|
38
|
+
"homepage": "https://github.com/supabase/supabase-js/tree/main/packages/core/functions-js",
|
|
38
39
|
"dependencies": {
|
|
39
|
-
"@supabase/node-fetch": "
|
|
40
|
+
"@supabase/node-fetch": "2.6.15"
|
|
40
41
|
},
|
|
41
42
|
"devDependencies": {
|
|
42
43
|
"@sebbo2002/semantic-release-jsr": "^1.0.0",
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"@types/node": "^18.7.0",
|
|
46
|
-
"genversion": "^3.0.2",
|
|
47
|
-
"jest": "^28.1.0",
|
|
48
|
-
"jsonwebtoken": "^9.0.0",
|
|
44
|
+
"bs-logger": "^0.2.6",
|
|
45
|
+
"jest": "^29.7.0",
|
|
49
46
|
"nanoid": "^3.3.1",
|
|
50
|
-
"npm-run-all": "^4.1.5",
|
|
51
47
|
"openai": "^4.52.5",
|
|
52
|
-
"prettier": "^2.6.0",
|
|
53
|
-
"rimraf": "^3.0.2",
|
|
54
|
-
"semantic-release-plugin-update-version-in-files": "^1.1.0",
|
|
55
48
|
"testcontainers": "^8.5.1",
|
|
56
|
-
"ts-jest": "^
|
|
57
|
-
"ts-node": "^10.9.0",
|
|
58
|
-
"ts-test-decorators": "^0.0.6",
|
|
59
|
-
"typedoc": "^0.23.28",
|
|
60
|
-
"typescript": "^4.6.2"
|
|
49
|
+
"ts-jest": "^29.4.2"
|
|
61
50
|
},
|
|
62
51
|
"publishConfig": {
|
|
63
52
|
"access": "public"
|
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
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
// Generated automatically during releases by scripts/update-version-files.ts
|
|
2
|
+
// This file provides runtime access to the package version for:
|
|
3
|
+
// - HTTP request headers (e.g., X-Client-Info header for API requests)
|
|
4
|
+
// - Debugging and support (identifying which version is running)
|
|
5
|
+
// - Telemetry and logging (version reporting in errors/analytics)
|
|
6
|
+
// - Ensuring build artifacts match the published package version
|
|
7
|
+
export const version = '2.58.1-canary.0'
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2020 Supabase
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|