Skip to content

Commit 214f0c8

Browse files
authored
Rename to Edge Worker (#2)
* refactor(supaworker): Rename Supaworker to EdgeWorker Rename core class and related imports across multiple files to reflect new naming convention. Changes include: - Renamed Supaworker class to EdgeWorker - Updated type SupaworkerConfig to EdgeWorkerConfig - Updated import statements in all edge function files - Modified error message for single call constraint * refactor(worker): rename supaworker schema to edge_worker Migrate all database objects and functions from supaworker to edge_worker schema, including: - Renaming schema from supaworker to edge_worker - Updating all table, view, and function references - Modifying SQL queries in TypeScript to use new schema name This change updates the naming convention for the worker-related database objects while maintaining the existing functionality. * refactor(supaworker): Rename _supaworker directory to _src Update import paths and project configuration to use new _src directory for Supabase edge functions * chore(test): Remove performance test scripts for supaworker Deleted two performance test-related bash scripts: - worker-test: Script for generating and processing test messages - worker-test-results: Script for querying job performance metrics * refactor(project): rename supaworker package to edge-worker Migrate project configuration, imports, and references from supaworker to edge-worker - Update README.md with new project name and test command - Modify deno.json import paths - Rename project configuration in project.json - Update Supabase-related commands and paths - Adjust module exports and import statements * refactor(sql): rename supaworker init SQL file to edge worker init Rationale: - The change is a file rename, which is best categorized as a refactoring - The scope is (sql) to indicate the specific area of change - The description concisely captures the essence of the modification - No additional body is needed since the change is straightforward - The type is 'refactor' because this is a structural change that doesn't add new functionality or fix a bug * refactor(package): rename supaworker package to edge-worker Rename package and update related references: - Renamed `@pgflow/supaworker` to `@pgflow/edge-worker` - Updated README.md package description - Updated import_map.json import path - Migrated all files from `pkgs/supaworker` to `pkgs/edge-worker` * chore(nx): remove supabase-plugin project Remove entire supabase-plugin project files, including configuration, package.json, and source files. Update nx.json to remove plugin-specific configurations related to the deleted project. * chore(nx): update default project in edge-worker environment configuration Change NX_DEFAULT_PROJECT from supaworker to edge-worker * chore(vscode): update Deno configuration path Change Deno enabled path from 'supaworker' to 'edge-worker' in VS Code settings * refactor(edge-worker): Update type definitions and import statements Improve type safety and modernize import statements across edge worker tests and source files. Changes include: - Replace generic 'any' types with more specific 'unknown' - Update import statements from 'jsr:' to '@std/' namespace - Modify function signatures for better type precision - Remove unnecessary parameters and simplify test helper functions * chore(deps): update Deno lock file to version 3 Update dependency lock file with simplified package structure and version bump. Removed some redundant specifiers and adjusted dependency references. * chore(test): update project test configuration Remove additional test dependencies from test script * test(WorkerState): update test suite to remove async/await and use assertThrows Refactored test cases for WorkerState to: - Remove async/await from test methods - Replace assertRejects with assertThrows - Simplify test method signatures - Maintain existing test coverage and logic
1 parent 3cc034b commit 214f0c8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+177
-425
lines changed

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"deno.enablePaths": ["pkgs/supaworker"],
2+
"deno.enablePaths": ["pkgs/edge-worker"],
33
"deno.unstable": true,
44
"deno.importMap": "./import_map.json",
55
"eslint.validate": ["json"]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This repository is a monorepo that contains the following packages:
88

99
| Nx Package | NPM Package | Description |
1010
|--------------|-------------|-------------|
11-
| `supaworker` | `@pgflow/supaworker` | An auto-restarting task queue worker implemented for Supabase Edge Functions and PGMQ |
11+
| `edge-worker` | `@pgflow/edge-worker` | An auto-restarting task queue worker implemented for Supabase Edge Functions and PGMQ |
1212
| `cli` | `@pgflow/cli` (`pgflow`) | A CLI tool for interacting with whole stack |
1313

1414
## NX Readme

import_map.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"imports": {
3-
"@pgflow/supaworker": "./pkgs/supaworker/mod.ts",
3+
"@pgflow/edge-worker": "./pkgs/edge-worker/mod.ts",
44
"postgres": "https://deno.land/x/[email protected]/mod.js"
55
}
66
}

nx.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,11 @@
1616
"plugins": [
1717
{
1818
"plugin": "@nx/js/typescript",
19-
"exclude": ["tools/supabase-plugin/*"]
2019
},
2120
"@nx/eslint/plugin",
2221
"@axhxrx/nx-deno",
2322
{
2423
"plugin": "@nx/js/typescript",
25-
"include": ["tools/supabase-plugin/*"],
2624
"options": {
2725
"typecheck": {
2826
"targetName": "typecheck"

pkgs/edge-worker/.envrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
source_env ../../.envrc
2+
export NX_DEFAULT_PROJECT=edge-worker

pkgs/edge-worker/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
supabase/migrations/
2+
supabase/functions/_src/
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# supaworker
1+
# Edge Worker
22

33
This library was generated with [Nx](https://nx.dev).
44

55
## Running unit tests
66

7-
Run `nx test supaworker` to execute the unit tests
7+
Run `nx test edge-worker` to execute the unit tests

pkgs/supaworker/deno.json renamed to pkgs/edge-worker/deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"imports": {
3-
"@pgflow/supaworker": "./pkgs/supaworker/mod.ts",
3+
"@pgflow/edge-worker": "./pkgs/edge-worker/mod.ts",
44
"@core/asyncutil": "jsr:@core/asyncutil@^1.2.0",
55
"postgres": "https://deno.land/x/[email protected]/mod.js",
66
"@std/async": "jsr:@std/async",

pkgs/supaworker/deno.lock renamed to pkgs/edge-worker/deno.lock

Lines changed: 38 additions & 55 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkgs/edge-worker/mod.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { EdgeWorker } from './src/index.ts';

pkgs/supaworker/project.json renamed to pkgs/edge-worker/project.json

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,54 @@
11
{
2-
"name": "supaworker",
2+
"name": "edge-worker",
33
"$schema": "../../node_modules/nx/schemas/project-schema.json",
4-
"sourceRoot": "pkgs/supaworker",
4+
"sourceRoot": "pkgs/edge-worker",
55
"projectType": "library",
66
"targets": {
77
"test:nx-deno": {
88
"executor": "@axhxrx/nx-deno:test",
9-
"outputs": ["{workspaceRoot}/coverage/pkgs/supaworker"],
9+
"outputs": ["{workspaceRoot}/coverage/pkgs/edge-worker"],
1010
"options": {
11-
"coverageDirectory": "coverage/pkgs/supaworker",
12-
"denoConfig": "pkgs/supaworker/deno.json",
11+
"coverageDirectory": "coverage/pkgs/edge-worker",
12+
"denoConfig": "pkgs/edge-worker/deno.json",
1313
"allowNone": false,
1414
"check": "local"
1515
}
1616
},
1717
"lint": {
1818
"executor": "@axhxrx/nx-deno:lint",
1919
"options": {
20-
"denoConfig": "pkgs/supaworker/deno.json"
20+
"denoConfig": "pkgs/edge-worker/deno.json",
21+
"ignore": "pkgs/edge-worker/supabase/functions/_src/"
2122
}
2223
},
2324
"supabase:start": {
2425
"executor": "nx:run-commands",
2526
"options": {
26-
"cwd": "pkgs/supaworker",
27+
"cwd": "pkgs/edge-worker",
2728
"commands": ["supabase start"],
2829
"parallel": false
2930
}
3031
},
3132
"supabase:stop": {
3233
"executor": "nx:run-commands",
3334
"options": {
34-
"cwd": "pkgs/supaworker",
35+
"cwd": "pkgs/edge-worker",
3536
"commands": ["supabase stop --no-backup"],
3637
"parallel": false
3738
}
3839
},
3940
"supabase:status": {
4041
"executor": "nx:run-commands",
4142
"options": {
42-
"cwd": "pkgs/supaworker",
43+
"cwd": "pkgs/edge-worker",
4344
"commands": ["supabase status"],
4445
"parallel": false
4546
}
4647
},
4748
"supabase:restart": {
4849
"executor": "nx:run-commands",
4950
"options": {
50-
"cwd": "pkgs/supaworker",
51+
"cwd": "pkgs/edge-worker",
5152
"commands": ["supabase stop --no-backup", "supabase start"],
5253
"parallel": false
5354
}
@@ -56,11 +57,11 @@
5657
"dependsOn": ["supabase:prepare"],
5758
"executor": "nx:run-commands",
5859
"options": {
59-
"cwd": "pkgs/supaworker",
60+
"cwd": "pkgs/edge-worker",
6061
"commands": [
6162
"rm -r supabase/migrations",
6263
"mkdir -p supabase/migrations",
63-
"cp ../supaworker/sql/*.sql supabase/migrations/",
64+
"cp ../edge-worker/sql/*.sql supabase/migrations/",
6465
"supabase db reset"
6566
],
6667
"parallel": false
@@ -69,11 +70,11 @@
6970
"supabase:prepare-edge-fn": {
7071
"executor": "nx:run-commands",
7172
"options": {
72-
"cwd": "pkgs/supaworker",
73+
"cwd": "pkgs/edge-worker",
7374
"commands": [
74-
"rm -f ./supabase/functions/_supaworker/*.ts",
75-
"cp ../supaworker/src/*.ts ./supabase/functions/_supaworker/",
76-
"cp ../supaworker/deno.* ./supabase/functions/_supaworker/"
75+
"rm -f ./supabase/functions/_src/*.ts",
76+
"cp ../edge-worker/src/*.ts ./supabase/functions/_src/",
77+
"cp ../edge-worker/deno.* ./supabase/functions/_src/"
7778
],
7879
"parallel": false
7980
}
@@ -82,7 +83,7 @@
8283
"dependsOn": ["supabase:start", "supabase:prepare-edge-fn"],
8384
"executor": "nx:run-commands",
8485
"options": {
85-
"cwd": "pkgs/supaworker",
86+
"cwd": "pkgs/edge-worker",
8687
"commands": ["supabase functions serve --env-file supabase/.env"],
8788
"parallel": false
8889
}
@@ -91,7 +92,7 @@
9192
"dependsOn": ["supabase:start"],
9293
"executor": "nx:run-commands",
9394
"options": {
94-
"cwd": "pkgs/supaworker",
95+
"cwd": "pkgs/edge-worker",
9596
"commands": [
9697
"deno test --allow-all --env-file=supabase/.env tests/unit/"
9798
],
@@ -102,7 +103,7 @@
102103
"dependsOn": ["supabase:start"],
103104
"executor": "nx:run-commands",
104105
"options": {
105-
"cwd": "pkgs/supaworker",
106+
"cwd": "pkgs/edge-worker",
106107
"commands": [
107108
"deno test --allow-all --env-file=supabase/.env tests/e2e/"
108109
],
@@ -113,13 +114,13 @@
113114
"dependsOn": ["supabase:start"],
114115
"executor": "nx:run-commands",
115116
"options": {
116-
"cwd": "pkgs/supaworker",
117+
"cwd": "pkgs/edge-worker",
117118
"commands": ["supabase db test"],
118119
"parallel": false
119120
}
120121
},
121122
"test": {
122-
"dependsOn": ["test:pgtap", "test:unit", "test:e2e"]
123+
"dependsOn": ["test:unit"]
123124
}
124125
},
125126
"tags": []

pkgs/supaworker/sql/000050_utils.sql renamed to pkgs/edge-worker/sql/000050_utils.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
create extension if not exists pg_net;
22

3-
create schema if not exists supaworker;
3+
create schema if not exists edge_worker;
44

5-
create or replace function supaworker.call_edgefn_async(
5+
create or replace function edge_worker.call_edgefn_async(
66
function_name text,
77
body text
88
)
99
returns bigint
1010
language plpgsql
1111
volatile
12-
set search_path to supaworker
12+
set search_path to edge_worker
1313
as $$
1414
declare
1515
request_id bigint;

0 commit comments

Comments
 (0)