Skip to content

Commit 40e6a50

Browse files
malek10xdevbaderdean
authored andcommitted
feat: add fetch-mining-source edge function
- Add central edge function for mining source fetching with auto token refresh - Fix refresh_token preservation bug (?? instead of ||) - Add AGENTS.md instructions for creating edge functions via CLI - Recreate function using proper supabase CLI command
1 parent 389861b commit 40e6a50

File tree

4 files changed

+45
-0
lines changed

4 files changed

+45
-0
lines changed

AGENTS.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,34 @@ npm run build # Compile TypeScript
8484
npm run dev:supabase-functions # Serve functions locally
8585
```
8686

87+
#### Creating New Edge Functions
88+
89+
**Always use the Supabase CLI to create new edge functions:**
90+
91+
```bash
92+
# Create new edge function (auto-generates proper structure)
93+
npx supabase functions new <function-name>
94+
```
95+
96+
**Why?** The CLI:
97+
98+
- Creates proper directory structure
99+
- Sets up deno.json with correct permissions
100+
- Ensures function is registered with Supabase
101+
102+
**Example workflow:**
103+
104+
```bash
105+
# 1. Create the function scaffold
106+
npx supabase functions new my-new-function
107+
108+
# 2. Implement your code in the generated index.ts
109+
# (copy your implementation into the created file)
110+
111+
# 3. Test locally
112+
npm run dev:supabase-functions
113+
```
114+
87115
## Code Style Guidelines
88116

89117
### TypeScript Configuration

supabase/config.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,3 +337,14 @@ entrypoint = "./functions/delete-mining-source/index.ts"
337337
# Specifies static files to be bundled with the function. Supports glob patterns.
338338
# For example, if you want to serve static HTML pages in your function:
339339
# static_files = [ "./functions/delete-mining-source/*.html" ]
340+
341+
[functions.fetch-mining-source]
342+
enabled = true
343+
verify_jwt = true
344+
import_map = "./functions/fetch-mining-source/deno.json"
345+
# Uncomment to specify a custom file path to the entrypoint.
346+
# Supported file extensions are: .ts, .js, .mjs, .jsx, .tsx
347+
entrypoint = "./functions/fetch-mining-source/index.ts"
348+
# Specifies static files to be bundled with the function. Supports glob patterns.
349+
# For example, if you want to serve static HTML pages in your function:
350+
# static_files = [ "./functions/fetch-mining-source/*.html" ]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Configuration for private npm package dependencies
2+
# For more information on using private registries with Edge Functions, see:
3+
# https://supabase.com/docs/guides/functions/import-maps#importing-from-private-registries
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"imports": {}
3+
}

0 commit comments

Comments
 (0)