@fonderie/webhooks 1.1.1 → 1.1.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.
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
-- fonderie_webhook_endpoints
|
|
2
|
+
CREATE TABLE IF NOT EXISTS fonderie_webhook_endpoints (
|
|
3
|
+
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
4
|
+
workspace_id UUID NOT NULL,
|
|
5
|
+
url TEXT NOT NULL,
|
|
6
|
+
secret TEXT NOT NULL,
|
|
7
|
+
events TEXT[] NOT NULL DEFAULT '{}',
|
|
8
|
+
enabled BOOLEAN NOT NULL DEFAULT true,
|
|
9
|
+
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
CREATE INDEX IF NOT EXISTS idx_fwhe_workspace
|
|
13
|
+
ON fonderie_webhook_endpoints (workspace_id)
|
|
14
|
+
WHERE enabled = true;
|
|
15
|
+
|
|
16
|
+
-- fonderie_webhook_deliveries
|
|
17
|
+
CREATE TABLE IF NOT EXISTS fonderie_webhook_deliveries (
|
|
18
|
+
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
19
|
+
endpoint_id UUID NOT NULL REFERENCES fonderie_webhook_endpoints(id) ON DELETE CASCADE,
|
|
20
|
+
event_id TEXT NOT NULL,
|
|
21
|
+
event_type TEXT NOT NULL,
|
|
22
|
+
payload JSONB NOT NULL,
|
|
23
|
+
status TEXT NOT NULL DEFAULT 'pending',
|
|
24
|
+
attempts INT NOT NULL DEFAULT 0,
|
|
25
|
+
response_status INT,
|
|
26
|
+
response_body TEXT,
|
|
27
|
+
next_attempt_at TIMESTAMPTZ,
|
|
28
|
+
delivered_at TIMESTAMPTZ,
|
|
29
|
+
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
CREATE INDEX IF NOT EXISTS idx_fwhd_endpoint
|
|
33
|
+
ON fonderie_webhook_deliveries (endpoint_id, created_at DESC);
|
|
34
|
+
|
|
35
|
+
CREATE INDEX IF NOT EXISTS idx_fwhd_retry
|
|
36
|
+
ON fonderie_webhook_deliveries (next_attempt_at)
|
|
37
|
+
WHERE status = 'failed' AND next_attempt_at IS NOT NULL;
|
package/package.json
CHANGED