@vettly/supabase 0.1.3 → 0.1.5
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 +34 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,37 @@
|
|
|
1
1
|
# @vettly/supabase
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Supabase Edge Functions for UGC moderation. Deno-compatible client with fetch-based transport for serverless environments.
|
|
4
|
+
|
|
5
|
+
## UGC Moderation Essentials
|
|
6
|
+
|
|
7
|
+
Apps with user-generated content need four things to stay compliant and keep users safe. This package handles all four in Supabase Edge Functions:
|
|
8
|
+
|
|
9
|
+
| Requirement | Supabase Integration |
|
|
10
|
+
|-------------|----------------------|
|
|
11
|
+
| **Content filtering** | `createModerationHandler()`, `client.check()` |
|
|
12
|
+
| **User reporting** | Fetch to REST API (`POST /v1/reports`) |
|
|
13
|
+
| **User blocking** | Fetch to REST API (`POST /v1/blocks`) |
|
|
14
|
+
| **Audit trail** | `result.decisionId` on every decision |
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
// supabase/functions/comments/index.ts
|
|
18
|
+
import { createModerationHandler } from '@vettly/supabase'
|
|
19
|
+
|
|
20
|
+
Deno.serve(createModerationHandler({
|
|
21
|
+
policyId: 'app-store',
|
|
22
|
+
onBlock: (result) => new Response(
|
|
23
|
+
JSON.stringify({ error: 'Blocked', decisionId: result.decisionId }),
|
|
24
|
+
{ status: 403, headers: { 'Content-Type': 'application/json' } }
|
|
25
|
+
)
|
|
26
|
+
}))
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Get Your API Key
|
|
30
|
+
|
|
31
|
+
1. Sign up at [vettly.dev](https://vettly.dev)
|
|
32
|
+
2. Go to Dashboard > API Keys
|
|
33
|
+
3. Create and copy your key
|
|
34
|
+
4. See [Environment Setup](#environment-setup) below for Supabase-specific configuration
|
|
4
35
|
|
|
5
36
|
## Why Edge-Native?
|
|
6
37
|
|
|
@@ -255,13 +286,13 @@ interface ModerationResult {
|
|
|
255
286
|
Create `.env.local` in your Supabase project:
|
|
256
287
|
|
|
257
288
|
```bash
|
|
258
|
-
VETTLY_API_KEY=
|
|
289
|
+
VETTLY_API_KEY=vettly_live_...
|
|
259
290
|
```
|
|
260
291
|
|
|
261
292
|
Or set in `supabase/functions/.env`:
|
|
262
293
|
|
|
263
294
|
```bash
|
|
264
|
-
VETTLY_API_KEY=
|
|
295
|
+
VETTLY_API_KEY=vettly_live_...
|
|
265
296
|
```
|
|
266
297
|
|
|
267
298
|
---
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vettly/supabase",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Supabase Edge Functions client for content moderation.
|
|
3
|
+
"version": "0.1.5",
|
|
4
|
+
"description": "Supabase Edge Functions client for content moderation. Content moderation at the edge.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
7
7
|
"module": "./dist/index.js",
|