@keystrokehq/cli 0.0.91 → 0.0.93
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.
|
@@ -33,11 +33,20 @@ import workflow from "../workflows/signup-pipeline";
|
|
|
33
33
|
export default defineWebhookSource({
|
|
34
34
|
key: "signup",
|
|
35
35
|
endpoint: "signup",
|
|
36
|
-
request: z.object({
|
|
37
|
-
|
|
36
|
+
request: z.object({
|
|
37
|
+
name: z.string().trim().min(1),
|
|
38
|
+
email: z.string().email(),
|
|
39
|
+
company: z.string().trim().min(1),
|
|
40
|
+
}),
|
|
38
41
|
}).attach({ workflow });
|
|
39
42
|
```
|
|
40
43
|
|
|
44
|
+
Use optional Zod `filter` for extra constraints beyond `request`:
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
filter: z.object({ type: z.literal("invoice.paid") }),
|
|
48
|
+
```
|
|
49
|
+
|
|
41
50
|
### Shared endpoint (e.g. Stripe)
|
|
42
51
|
|
|
43
52
|
Multiple trigger files can use the same `endpoint` — one URL `POST /triggers/{endpoint}`, each with its own `key`, `request`, `filter`, and `transform`. Unmatched payloads return `{ ok: true, skipped: true }`.
|
|
@@ -47,8 +56,8 @@ Multiple trigger files can use the same `endpoint` — one URL `POST /triggers/{
|
|
|
47
56
|
export default defineWebhookSource({
|
|
48
57
|
key: "stripe-invoice-paid",
|
|
49
58
|
endpoint: "stripe",
|
|
50
|
-
request: z.object({ type: z.
|
|
51
|
-
filter: (
|
|
59
|
+
request: z.object({ type: z.string(), data: z.object({ id: z.string() }) }),
|
|
60
|
+
filter: z.object({ type: z.literal("invoice.paid") }),
|
|
52
61
|
}).attach({ workflow: invoicePaidWorkflow, transform: (p) => ({ invoiceId: p.data.id }) });
|
|
53
62
|
|
|
54
63
|
// src/triggers/stripe-subscription-deleted.ts — same endpoint, different key/schema/filter
|