@supabase/functions-js 2.71.2-canary.6 → 2.72.1-canary.2
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 -8
- 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/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 +2 -3
- package/src/version.ts +7 -1
package/README.md
CHANGED
|
@@ -4,17 +4,100 @@ JS Client library to interact with Supabase Functions.
|
|
|
4
4
|
|
|
5
5
|
## Docs
|
|
6
6
|
|
|
7
|
-
<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>
|
|
8
9
|
|
|
9
|
-
##
|
|
10
|
+
## Quick Start
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
### Installation
|
|
12
13
|
|
|
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-libs). To work on this package:
|
|
41
|
+
|
|
42
|
+
### Building
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# Complete build (from monorepo root)
|
|
46
|
+
npx nx build functions-js
|
|
47
|
+
|
|
48
|
+
# Build with watch mode for development
|
|
49
|
+
npx nx build functions-js --watch
|
|
50
|
+
|
|
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/)
|
|
54
|
+
|
|
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
|
|
14
78
|
|
|
15
|
-
|
|
79
|
+
# Run tests in watch mode during development
|
|
80
|
+
npx nx test functions-js --watch
|
|
16
81
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
npm run test
|
|
82
|
+
# CI test command (runs with coverage)
|
|
83
|
+
npx nx test:ci functions-js
|
|
20
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](../../../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.
|
package/dist/main/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "
|
|
1
|
+
export declare const version = "2.72.1-canary.2";
|
|
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.js
|
|
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.72.1-canary.2';
|
|
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"}
|
package/dist/module/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "
|
|
1
|
+
export declare const version = "2.72.1-canary.2";
|
|
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.js
|
|
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.72.1-canary.2';
|
|
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.72.1-canary.2",
|
|
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",
|
|
@@ -15,8 +15,7 @@
|
|
|
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:ci": "jest --coverage"
|
|
19
|
-
"test:coverage": "jest --coverage"
|
|
18
|
+
"test:ci": "jest --coverage"
|
|
20
19
|
},
|
|
21
20
|
"repository": {
|
|
22
21
|
"type": "git",
|
package/src/version.ts
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
// Generated automatically during releases by scripts/update-version-files.js
|
|
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.72.1-canary.2'
|