@pgflow/edge-worker 0.0.0-fix-supa-version-d565b97a-20251124083521 → 0.0.0-fix-max-conn-2da7657d-20260112035120
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 +16 -6
- package/package.json +11 -3
package/README.md
CHANGED
|
@@ -63,20 +63,20 @@ import { Flow } from 'jsr:@pgflow/dsl/supabase';
|
|
|
63
63
|
|
|
64
64
|
// Define a flow using Supabase preset for Supabase resources
|
|
65
65
|
const AnalyzeWebsite = new Flow<{ url: string }>({
|
|
66
|
-
slug: '
|
|
66
|
+
slug: 'analyzeWebsite',
|
|
67
67
|
})
|
|
68
|
-
.step({ slug: 'fetch' }, async (
|
|
68
|
+
.step({ slug: 'fetch' }, async (flowInput, context) => {
|
|
69
69
|
// Access Supabase resources through context
|
|
70
|
-
const response = await fetch(
|
|
70
|
+
const response = await fetch(flowInput.url, {
|
|
71
71
|
signal: context.shutdownSignal,
|
|
72
72
|
});
|
|
73
73
|
return { html: await response.text() };
|
|
74
74
|
})
|
|
75
|
-
.step({ slug: 'save' }, async (
|
|
75
|
+
.step({ slug: 'save', dependsOn: ['fetch'] }, async (deps, context) => {
|
|
76
76
|
// Use Supabase client from context
|
|
77
77
|
const { data } = await context.supabase
|
|
78
78
|
.from('websites')
|
|
79
|
-
.insert({ url:
|
|
79
|
+
.insert({ url: context.flowInput.url, html: deps.fetch.html })
|
|
80
80
|
.select()
|
|
81
81
|
.single();
|
|
82
82
|
return data;
|
|
@@ -172,7 +172,7 @@ When defining flows that use Supabase resources, import `Flow` from the Supabase
|
|
|
172
172
|
```typescript
|
|
173
173
|
import { Flow } from 'jsr:@pgflow/dsl/supabase';
|
|
174
174
|
|
|
175
|
-
const MyFlow = new Flow<InputType>({ slug: '
|
|
175
|
+
const MyFlow = new Flow<InputType>({ slug: 'myFlow' }).step(
|
|
176
176
|
{ slug: 'process' },
|
|
177
177
|
async (input, context) => {
|
|
178
178
|
// TypeScript knows context includes all Supabase resources
|
|
@@ -208,6 +208,16 @@ To run a manual test:
|
|
|
208
208
|
1. Start Supabase: `pnpm nx supabase:start edge-worker`
|
|
209
209
|
2. Follow the instructions in the specific test's README
|
|
210
210
|
|
|
211
|
+
## Dependencies
|
|
212
|
+
|
|
213
|
+
### PostgreSQL Client
|
|
214
|
+
|
|
215
|
+
This package uses `jsr:@oscar6echo/postgres` - a JSR-compatible fork of the popular [postgres](https://github.com/porsager/postgres) package.
|
|
216
|
+
|
|
217
|
+
**Why a fork?** The official `npm:postgres` package uses CommonJS exports (`export =`) which are incompatible with JSR's ES Module requirements. The npm version also fails to parse database URLs correctly in Supabase Edge Runtime, causing `CONNECT_TIMEOUT` errors. See [porsager/postgres#839](https://github.com/porsager/postgres/issues/839) for details.
|
|
218
|
+
|
|
219
|
+
The fork is functionally identical to postgres v3.4.5, with only the export syntax changed for Deno/JSR compatibility.
|
|
220
|
+
|
|
211
221
|
## Building
|
|
212
222
|
|
|
213
223
|
Run `nx build edge-worker` to build the library.
|
package/package.json
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pgflow/edge-worker",
|
|
3
|
-
"version": "0.0.0-fix-
|
|
3
|
+
"version": "0.0.0-fix-max-conn-2da7657d-20260112035120",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/pgflow-dev/pgflow",
|
|
8
|
+
"directory": "pkgs/edge-worker"
|
|
9
|
+
},
|
|
5
10
|
"type": "module",
|
|
6
11
|
"main": "./dist/index.js",
|
|
7
12
|
"module": "./dist/index.js",
|
|
@@ -15,6 +20,10 @@
|
|
|
15
20
|
"./_internal": {
|
|
16
21
|
"types": "./dist/_internal.d.ts",
|
|
17
22
|
"import": "./dist/_internal.js"
|
|
23
|
+
},
|
|
24
|
+
"./testing": {
|
|
25
|
+
"types": "./dist/testing.d.ts",
|
|
26
|
+
"import": "./dist/testing.js"
|
|
18
27
|
}
|
|
19
28
|
},
|
|
20
29
|
"files": [
|
|
@@ -29,8 +38,7 @@
|
|
|
29
38
|
},
|
|
30
39
|
"devDependencies": {
|
|
31
40
|
"@types/deno": "^2.3.0",
|
|
32
|
-
"@types/node": "~18.16.20"
|
|
33
|
-
"supabase": "^2.50.3"
|
|
41
|
+
"@types/node": "~18.16.20"
|
|
34
42
|
},
|
|
35
43
|
"publishConfig": {
|
|
36
44
|
"access": "public"
|