@strimz/shared-types 0.17.0 → 0.19.0

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.
Files changed (44) hide show
  1. package/dist/analytics.d.cts +141 -141
  2. package/dist/analytics.d.ts +141 -141
  3. package/dist/api-keys.d.cts +14 -14
  4. package/dist/api-keys.d.ts +14 -14
  5. package/dist/compliance.d.cts +8 -8
  6. package/dist/compliance.d.ts +8 -8
  7. package/dist/customers.d.cts +7 -7
  8. package/dist/customers.d.ts +7 -7
  9. package/dist/events.cjs +4 -0
  10. package/dist/events.cjs.map +1 -1
  11. package/dist/events.d.cts +1681 -1486
  12. package/dist/events.d.ts +1681 -1486
  13. package/dist/events.js +4 -1
  14. package/dist/events.js.map +1 -1
  15. package/dist/index.cjs +7 -1
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.cts +16 -16
  18. package/dist/index.d.ts +16 -16
  19. package/dist/index.js +7 -2
  20. package/dist/index.js.map +1 -1
  21. package/dist/invoices.d.cts +12 -12
  22. package/dist/invoices.d.ts +12 -12
  23. package/dist/merchants.d.cts +26 -26
  24. package/dist/merchants.d.ts +26 -26
  25. package/dist/payment-sessions.d.cts +16 -16
  26. package/dist/payment-sessions.d.ts +16 -16
  27. package/dist/refunds.d.cts +36 -36
  28. package/dist/refunds.d.ts +36 -36
  29. package/dist/storefronts.d.cts +13 -13
  30. package/dist/storefronts.d.ts +13 -13
  31. package/dist/subscriptions.d.cts +32 -32
  32. package/dist/subscriptions.d.ts +32 -32
  33. package/dist/transactions.d.cts +10 -10
  34. package/dist/transactions.d.ts +10 -10
  35. package/dist/webhooks.cjs +1 -0
  36. package/dist/webhooks.cjs.map +1 -1
  37. package/dist/webhooks.d.cts +46 -46
  38. package/dist/webhooks.d.ts +46 -46
  39. package/dist/webhooks.js +1 -0
  40. package/dist/webhooks.js.map +1 -1
  41. package/package.json +2 -2
  42. package/src/events.ts +4 -0
  43. package/src/notifications.ts +2 -0
  44. package/src/webhooks.ts +1 -0
@@ -12,7 +12,7 @@ import { z } from 'zod';
12
12
  * Every webhook event name in the system. Listed inline so Zod can
13
13
  * produce a concrete string union.
14
14
  */
15
- declare const webhookEventNameSchema: z.ZodEnum<["payment.created", "payment.completed", "payment.failed", "subscription.created", "subscription.charged", "subscription.charge_failed", "subscription.recovery_attempt", "subscription.cancelled", "subscription.lapsed", "subscription.reactivated", "refund.created", "refund.completed", "invoice.created", "invoice.paid", "invoice.overdue", "agent.job_proposed", "agent.job_completed", "agent.job_disputed", "compliance.wallet_flagged", "compliance.wallet_blocked"]>;
15
+ declare const webhookEventNameSchema: z.ZodEnum<["payment.created", "payment.completed", "payment.failed", "subscription.created", "subscription.charged", "subscription.charge_failed", "subscription.recovery_attempt", "subscription.cancelled", "subscription.lapsed", "subscription.reactivated", "refund.created", "refund.completed", "refund.failed", "invoice.created", "invoice.paid", "invoice.overdue", "agent.job_proposed", "agent.job_completed", "agent.job_disputed", "compliance.wallet_flagged", "compliance.wallet_blocked"]>;
16
16
  type WebhookEventName = z.infer<typeof webhookEventNameSchema>;
17
17
  declare const webhookEndpointStatusSchema: z.ZodEnum<["active", "disabled"]>;
18
18
  type WebhookEndpointStatus = z.infer<typeof webhookEndpointStatusSchema>;
@@ -22,52 +22,52 @@ declare const webhookEndpointSchema: z.ZodObject<{
22
22
  mode: z.ZodEnum<["test", "live"]>;
23
23
  url: z.ZodEffects<z.ZodString, string, string>;
24
24
  description: z.ZodNullable<z.ZodString>;
25
- events: z.ZodArray<z.ZodEnum<["payment.created", "payment.completed", "payment.failed", "subscription.created", "subscription.charged", "subscription.charge_failed", "subscription.recovery_attempt", "subscription.cancelled", "subscription.lapsed", "subscription.reactivated", "refund.created", "refund.completed", "invoice.created", "invoice.paid", "invoice.overdue", "agent.job_proposed", "agent.job_completed", "agent.job_disputed", "compliance.wallet_flagged", "compliance.wallet_blocked"]>, "atleastone">;
25
+ events: z.ZodArray<z.ZodEnum<["payment.created", "payment.completed", "payment.failed", "subscription.created", "subscription.charged", "subscription.charge_failed", "subscription.recovery_attempt", "subscription.cancelled", "subscription.lapsed", "subscription.reactivated", "refund.created", "refund.completed", "refund.failed", "invoice.created", "invoice.paid", "invoice.overdue", "agent.job_proposed", "agent.job_completed", "agent.job_disputed", "compliance.wallet_flagged", "compliance.wallet_blocked"]>, "atleastone">;
26
26
  status: z.ZodEnum<["active", "disabled"]>;
27
27
  signingSecretPrefix: z.ZodString;
28
28
  lastDeliveredAt: z.ZodNullable<z.ZodString>;
29
29
  createdAt: z.ZodString;
30
30
  updatedAt: z.ZodString;
31
31
  }, "strip", z.ZodTypeAny, {
32
- status: "disabled" | "active";
33
- id: string;
32
+ status: "active" | "disabled";
33
+ mode: "test" | "live";
34
34
  merchantId: string;
35
- createdAt: string;
36
35
  description: string | null;
36
+ id: string;
37
+ createdAt: string;
37
38
  updatedAt: string;
38
- mode: "test" | "live";
39
39
  url: string;
40
- events: ["payment.created" | "payment.completed" | "payment.failed" | "subscription.created" | "subscription.charged" | "subscription.charge_failed" | "subscription.recovery_attempt" | "subscription.cancelled" | "subscription.lapsed" | "subscription.reactivated" | "refund.created" | "refund.completed" | "invoice.created" | "invoice.paid" | "invoice.overdue" | "agent.job_proposed" | "agent.job_completed" | "agent.job_disputed" | "compliance.wallet_flagged" | "compliance.wallet_blocked", ...("payment.created" | "payment.completed" | "payment.failed" | "subscription.created" | "subscription.charged" | "subscription.charge_failed" | "subscription.recovery_attempt" | "subscription.cancelled" | "subscription.lapsed" | "subscription.reactivated" | "refund.created" | "refund.completed" | "invoice.created" | "invoice.paid" | "invoice.overdue" | "agent.job_proposed" | "agent.job_completed" | "agent.job_disputed" | "compliance.wallet_flagged" | "compliance.wallet_blocked")[]];
40
+ events: ["payment.created" | "payment.completed" | "payment.failed" | "subscription.created" | "subscription.charged" | "subscription.charge_failed" | "subscription.recovery_attempt" | "subscription.cancelled" | "subscription.lapsed" | "subscription.reactivated" | "refund.created" | "refund.completed" | "refund.failed" | "invoice.created" | "invoice.paid" | "invoice.overdue" | "agent.job_proposed" | "agent.job_completed" | "agent.job_disputed" | "compliance.wallet_flagged" | "compliance.wallet_blocked", ...("payment.created" | "payment.completed" | "payment.failed" | "subscription.created" | "subscription.charged" | "subscription.charge_failed" | "subscription.recovery_attempt" | "subscription.cancelled" | "subscription.lapsed" | "subscription.reactivated" | "refund.created" | "refund.completed" | "refund.failed" | "invoice.created" | "invoice.paid" | "invoice.overdue" | "agent.job_proposed" | "agent.job_completed" | "agent.job_disputed" | "compliance.wallet_flagged" | "compliance.wallet_blocked")[]];
41
41
  signingSecretPrefix: string;
42
42
  lastDeliveredAt: string | null;
43
43
  }, {
44
- status: "disabled" | "active";
45
- id: string;
44
+ status: "active" | "disabled";
45
+ mode: "test" | "live";
46
46
  merchantId: string;
47
- createdAt: string;
48
47
  description: string | null;
48
+ id: string;
49
+ createdAt: string;
49
50
  updatedAt: string;
50
- mode: "test" | "live";
51
51
  url: string;
52
- events: ["payment.created" | "payment.completed" | "payment.failed" | "subscription.created" | "subscription.charged" | "subscription.charge_failed" | "subscription.recovery_attempt" | "subscription.cancelled" | "subscription.lapsed" | "subscription.reactivated" | "refund.created" | "refund.completed" | "invoice.created" | "invoice.paid" | "invoice.overdue" | "agent.job_proposed" | "agent.job_completed" | "agent.job_disputed" | "compliance.wallet_flagged" | "compliance.wallet_blocked", ...("payment.created" | "payment.completed" | "payment.failed" | "subscription.created" | "subscription.charged" | "subscription.charge_failed" | "subscription.recovery_attempt" | "subscription.cancelled" | "subscription.lapsed" | "subscription.reactivated" | "refund.created" | "refund.completed" | "invoice.created" | "invoice.paid" | "invoice.overdue" | "agent.job_proposed" | "agent.job_completed" | "agent.job_disputed" | "compliance.wallet_flagged" | "compliance.wallet_blocked")[]];
52
+ events: ["payment.created" | "payment.completed" | "payment.failed" | "subscription.created" | "subscription.charged" | "subscription.charge_failed" | "subscription.recovery_attempt" | "subscription.cancelled" | "subscription.lapsed" | "subscription.reactivated" | "refund.created" | "refund.completed" | "refund.failed" | "invoice.created" | "invoice.paid" | "invoice.overdue" | "agent.job_proposed" | "agent.job_completed" | "agent.job_disputed" | "compliance.wallet_flagged" | "compliance.wallet_blocked", ...("payment.created" | "payment.completed" | "payment.failed" | "subscription.created" | "subscription.charged" | "subscription.charge_failed" | "subscription.recovery_attempt" | "subscription.cancelled" | "subscription.lapsed" | "subscription.reactivated" | "refund.created" | "refund.completed" | "refund.failed" | "invoice.created" | "invoice.paid" | "invoice.overdue" | "agent.job_proposed" | "agent.job_completed" | "agent.job_disputed" | "compliance.wallet_flagged" | "compliance.wallet_blocked")[]];
53
53
  signingSecretPrefix: string;
54
54
  lastDeliveredAt: string | null;
55
55
  }>;
56
56
  type WebhookEndpoint = z.infer<typeof webhookEndpointSchema>;
57
57
  declare const createWebhookEndpointInputSchema: z.ZodObject<{
58
58
  url: z.ZodEffects<z.ZodString, string, string>;
59
- events: z.ZodArray<z.ZodEnum<["payment.created", "payment.completed", "payment.failed", "subscription.created", "subscription.charged", "subscription.charge_failed", "subscription.recovery_attempt", "subscription.cancelled", "subscription.lapsed", "subscription.reactivated", "refund.created", "refund.completed", "invoice.created", "invoice.paid", "invoice.overdue", "agent.job_proposed", "agent.job_completed", "agent.job_disputed", "compliance.wallet_flagged", "compliance.wallet_blocked"]>, "atleastone">;
59
+ events: z.ZodArray<z.ZodEnum<["payment.created", "payment.completed", "payment.failed", "subscription.created", "subscription.charged", "subscription.charge_failed", "subscription.recovery_attempt", "subscription.cancelled", "subscription.lapsed", "subscription.reactivated", "refund.created", "refund.completed", "refund.failed", "invoice.created", "invoice.paid", "invoice.overdue", "agent.job_proposed", "agent.job_completed", "agent.job_disputed", "compliance.wallet_flagged", "compliance.wallet_blocked"]>, "atleastone">;
60
60
  description: z.ZodOptional<z.ZodString>;
61
61
  mode: z.ZodEnum<["test", "live"]>;
62
62
  }, "strip", z.ZodTypeAny, {
63
63
  mode: "test" | "live";
64
64
  url: string;
65
- events: ["payment.created" | "payment.completed" | "payment.failed" | "subscription.created" | "subscription.charged" | "subscription.charge_failed" | "subscription.recovery_attempt" | "subscription.cancelled" | "subscription.lapsed" | "subscription.reactivated" | "refund.created" | "refund.completed" | "invoice.created" | "invoice.paid" | "invoice.overdue" | "agent.job_proposed" | "agent.job_completed" | "agent.job_disputed" | "compliance.wallet_flagged" | "compliance.wallet_blocked", ...("payment.created" | "payment.completed" | "payment.failed" | "subscription.created" | "subscription.charged" | "subscription.charge_failed" | "subscription.recovery_attempt" | "subscription.cancelled" | "subscription.lapsed" | "subscription.reactivated" | "refund.created" | "refund.completed" | "invoice.created" | "invoice.paid" | "invoice.overdue" | "agent.job_proposed" | "agent.job_completed" | "agent.job_disputed" | "compliance.wallet_flagged" | "compliance.wallet_blocked")[]];
65
+ events: ["payment.created" | "payment.completed" | "payment.failed" | "subscription.created" | "subscription.charged" | "subscription.charge_failed" | "subscription.recovery_attempt" | "subscription.cancelled" | "subscription.lapsed" | "subscription.reactivated" | "refund.created" | "refund.completed" | "refund.failed" | "invoice.created" | "invoice.paid" | "invoice.overdue" | "agent.job_proposed" | "agent.job_completed" | "agent.job_disputed" | "compliance.wallet_flagged" | "compliance.wallet_blocked", ...("payment.created" | "payment.completed" | "payment.failed" | "subscription.created" | "subscription.charged" | "subscription.charge_failed" | "subscription.recovery_attempt" | "subscription.cancelled" | "subscription.lapsed" | "subscription.reactivated" | "refund.created" | "refund.completed" | "refund.failed" | "invoice.created" | "invoice.paid" | "invoice.overdue" | "agent.job_proposed" | "agent.job_completed" | "agent.job_disputed" | "compliance.wallet_flagged" | "compliance.wallet_blocked")[]];
66
66
  description?: string | undefined;
67
67
  }, {
68
68
  mode: "test" | "live";
69
69
  url: string;
70
- events: ["payment.created" | "payment.completed" | "payment.failed" | "subscription.created" | "subscription.charged" | "subscription.charge_failed" | "subscription.recovery_attempt" | "subscription.cancelled" | "subscription.lapsed" | "subscription.reactivated" | "refund.created" | "refund.completed" | "invoice.created" | "invoice.paid" | "invoice.overdue" | "agent.job_proposed" | "agent.job_completed" | "agent.job_disputed" | "compliance.wallet_flagged" | "compliance.wallet_blocked", ...("payment.created" | "payment.completed" | "payment.failed" | "subscription.created" | "subscription.charged" | "subscription.charge_failed" | "subscription.recovery_attempt" | "subscription.cancelled" | "subscription.lapsed" | "subscription.reactivated" | "refund.created" | "refund.completed" | "invoice.created" | "invoice.paid" | "invoice.overdue" | "agent.job_proposed" | "agent.job_completed" | "agent.job_disputed" | "compliance.wallet_flagged" | "compliance.wallet_blocked")[]];
70
+ events: ["payment.created" | "payment.completed" | "payment.failed" | "subscription.created" | "subscription.charged" | "subscription.charge_failed" | "subscription.recovery_attempt" | "subscription.cancelled" | "subscription.lapsed" | "subscription.reactivated" | "refund.created" | "refund.completed" | "refund.failed" | "invoice.created" | "invoice.paid" | "invoice.overdue" | "agent.job_proposed" | "agent.job_completed" | "agent.job_disputed" | "compliance.wallet_flagged" | "compliance.wallet_blocked", ...("payment.created" | "payment.completed" | "payment.failed" | "subscription.created" | "subscription.charged" | "subscription.charge_failed" | "subscription.recovery_attempt" | "subscription.cancelled" | "subscription.lapsed" | "subscription.reactivated" | "refund.created" | "refund.completed" | "refund.failed" | "invoice.created" | "invoice.paid" | "invoice.overdue" | "agent.job_proposed" | "agent.job_completed" | "agent.job_disputed" | "compliance.wallet_flagged" | "compliance.wallet_blocked")[]];
71
71
  description?: string | undefined;
72
72
  }>;
73
73
  type CreateWebhookEndpointInput = z.input<typeof createWebhookEndpointInputSchema>;
@@ -79,34 +79,34 @@ declare const createWebhookEndpointOutputSchema: z.ZodObject<{
79
79
  mode: z.ZodEnum<["test", "live"]>;
80
80
  url: z.ZodEffects<z.ZodString, string, string>;
81
81
  description: z.ZodNullable<z.ZodString>;
82
- events: z.ZodArray<z.ZodEnum<["payment.created", "payment.completed", "payment.failed", "subscription.created", "subscription.charged", "subscription.charge_failed", "subscription.recovery_attempt", "subscription.cancelled", "subscription.lapsed", "subscription.reactivated", "refund.created", "refund.completed", "invoice.created", "invoice.paid", "invoice.overdue", "agent.job_proposed", "agent.job_completed", "agent.job_disputed", "compliance.wallet_flagged", "compliance.wallet_blocked"]>, "atleastone">;
82
+ events: z.ZodArray<z.ZodEnum<["payment.created", "payment.completed", "payment.failed", "subscription.created", "subscription.charged", "subscription.charge_failed", "subscription.recovery_attempt", "subscription.cancelled", "subscription.lapsed", "subscription.reactivated", "refund.created", "refund.completed", "refund.failed", "invoice.created", "invoice.paid", "invoice.overdue", "agent.job_proposed", "agent.job_completed", "agent.job_disputed", "compliance.wallet_flagged", "compliance.wallet_blocked"]>, "atleastone">;
83
83
  status: z.ZodEnum<["active", "disabled"]>;
84
84
  signingSecretPrefix: z.ZodString;
85
85
  lastDeliveredAt: z.ZodNullable<z.ZodString>;
86
86
  createdAt: z.ZodString;
87
87
  updatedAt: z.ZodString;
88
88
  }, "strip", z.ZodTypeAny, {
89
- status: "disabled" | "active";
90
- id: string;
89
+ status: "active" | "disabled";
90
+ mode: "test" | "live";
91
91
  merchantId: string;
92
- createdAt: string;
93
92
  description: string | null;
93
+ id: string;
94
+ createdAt: string;
94
95
  updatedAt: string;
95
- mode: "test" | "live";
96
96
  url: string;
97
- events: ["payment.created" | "payment.completed" | "payment.failed" | "subscription.created" | "subscription.charged" | "subscription.charge_failed" | "subscription.recovery_attempt" | "subscription.cancelled" | "subscription.lapsed" | "subscription.reactivated" | "refund.created" | "refund.completed" | "invoice.created" | "invoice.paid" | "invoice.overdue" | "agent.job_proposed" | "agent.job_completed" | "agent.job_disputed" | "compliance.wallet_flagged" | "compliance.wallet_blocked", ...("payment.created" | "payment.completed" | "payment.failed" | "subscription.created" | "subscription.charged" | "subscription.charge_failed" | "subscription.recovery_attempt" | "subscription.cancelled" | "subscription.lapsed" | "subscription.reactivated" | "refund.created" | "refund.completed" | "invoice.created" | "invoice.paid" | "invoice.overdue" | "agent.job_proposed" | "agent.job_completed" | "agent.job_disputed" | "compliance.wallet_flagged" | "compliance.wallet_blocked")[]];
97
+ events: ["payment.created" | "payment.completed" | "payment.failed" | "subscription.created" | "subscription.charged" | "subscription.charge_failed" | "subscription.recovery_attempt" | "subscription.cancelled" | "subscription.lapsed" | "subscription.reactivated" | "refund.created" | "refund.completed" | "refund.failed" | "invoice.created" | "invoice.paid" | "invoice.overdue" | "agent.job_proposed" | "agent.job_completed" | "agent.job_disputed" | "compliance.wallet_flagged" | "compliance.wallet_blocked", ...("payment.created" | "payment.completed" | "payment.failed" | "subscription.created" | "subscription.charged" | "subscription.charge_failed" | "subscription.recovery_attempt" | "subscription.cancelled" | "subscription.lapsed" | "subscription.reactivated" | "refund.created" | "refund.completed" | "refund.failed" | "invoice.created" | "invoice.paid" | "invoice.overdue" | "agent.job_proposed" | "agent.job_completed" | "agent.job_disputed" | "compliance.wallet_flagged" | "compliance.wallet_blocked")[]];
98
98
  signingSecretPrefix: string;
99
99
  lastDeliveredAt: string | null;
100
100
  }, {
101
- status: "disabled" | "active";
102
- id: string;
101
+ status: "active" | "disabled";
102
+ mode: "test" | "live";
103
103
  merchantId: string;
104
- createdAt: string;
105
104
  description: string | null;
105
+ id: string;
106
+ createdAt: string;
106
107
  updatedAt: string;
107
- mode: "test" | "live";
108
108
  url: string;
109
- events: ["payment.created" | "payment.completed" | "payment.failed" | "subscription.created" | "subscription.charged" | "subscription.charge_failed" | "subscription.recovery_attempt" | "subscription.cancelled" | "subscription.lapsed" | "subscription.reactivated" | "refund.created" | "refund.completed" | "invoice.created" | "invoice.paid" | "invoice.overdue" | "agent.job_proposed" | "agent.job_completed" | "agent.job_disputed" | "compliance.wallet_flagged" | "compliance.wallet_blocked", ...("payment.created" | "payment.completed" | "payment.failed" | "subscription.created" | "subscription.charged" | "subscription.charge_failed" | "subscription.recovery_attempt" | "subscription.cancelled" | "subscription.lapsed" | "subscription.reactivated" | "refund.created" | "refund.completed" | "invoice.created" | "invoice.paid" | "invoice.overdue" | "agent.job_proposed" | "agent.job_completed" | "agent.job_disputed" | "compliance.wallet_flagged" | "compliance.wallet_blocked")[]];
109
+ events: ["payment.created" | "payment.completed" | "payment.failed" | "subscription.created" | "subscription.charged" | "subscription.charge_failed" | "subscription.recovery_attempt" | "subscription.cancelled" | "subscription.lapsed" | "subscription.reactivated" | "refund.created" | "refund.completed" | "refund.failed" | "invoice.created" | "invoice.paid" | "invoice.overdue" | "agent.job_proposed" | "agent.job_completed" | "agent.job_disputed" | "compliance.wallet_flagged" | "compliance.wallet_blocked", ...("payment.created" | "payment.completed" | "payment.failed" | "subscription.created" | "subscription.charged" | "subscription.charge_failed" | "subscription.recovery_attempt" | "subscription.cancelled" | "subscription.lapsed" | "subscription.reactivated" | "refund.created" | "refund.completed" | "refund.failed" | "invoice.created" | "invoice.paid" | "invoice.overdue" | "agent.job_proposed" | "agent.job_completed" | "agent.job_disputed" | "compliance.wallet_flagged" | "compliance.wallet_blocked")[]];
110
110
  signingSecretPrefix: string;
111
111
  lastDeliveredAt: string | null;
112
112
  }>;
@@ -114,30 +114,30 @@ declare const createWebhookEndpointOutputSchema: z.ZodObject<{
114
114
  signingSecret: z.ZodString;
115
115
  }, "strip", z.ZodTypeAny, {
116
116
  endpoint: {
117
- status: "disabled" | "active";
118
- id: string;
117
+ status: "active" | "disabled";
118
+ mode: "test" | "live";
119
119
  merchantId: string;
120
- createdAt: string;
121
120
  description: string | null;
121
+ id: string;
122
+ createdAt: string;
122
123
  updatedAt: string;
123
- mode: "test" | "live";
124
124
  url: string;
125
- events: ["payment.created" | "payment.completed" | "payment.failed" | "subscription.created" | "subscription.charged" | "subscription.charge_failed" | "subscription.recovery_attempt" | "subscription.cancelled" | "subscription.lapsed" | "subscription.reactivated" | "refund.created" | "refund.completed" | "invoice.created" | "invoice.paid" | "invoice.overdue" | "agent.job_proposed" | "agent.job_completed" | "agent.job_disputed" | "compliance.wallet_flagged" | "compliance.wallet_blocked", ...("payment.created" | "payment.completed" | "payment.failed" | "subscription.created" | "subscription.charged" | "subscription.charge_failed" | "subscription.recovery_attempt" | "subscription.cancelled" | "subscription.lapsed" | "subscription.reactivated" | "refund.created" | "refund.completed" | "invoice.created" | "invoice.paid" | "invoice.overdue" | "agent.job_proposed" | "agent.job_completed" | "agent.job_disputed" | "compliance.wallet_flagged" | "compliance.wallet_blocked")[]];
125
+ events: ["payment.created" | "payment.completed" | "payment.failed" | "subscription.created" | "subscription.charged" | "subscription.charge_failed" | "subscription.recovery_attempt" | "subscription.cancelled" | "subscription.lapsed" | "subscription.reactivated" | "refund.created" | "refund.completed" | "refund.failed" | "invoice.created" | "invoice.paid" | "invoice.overdue" | "agent.job_proposed" | "agent.job_completed" | "agent.job_disputed" | "compliance.wallet_flagged" | "compliance.wallet_blocked", ...("payment.created" | "payment.completed" | "payment.failed" | "subscription.created" | "subscription.charged" | "subscription.charge_failed" | "subscription.recovery_attempt" | "subscription.cancelled" | "subscription.lapsed" | "subscription.reactivated" | "refund.created" | "refund.completed" | "refund.failed" | "invoice.created" | "invoice.paid" | "invoice.overdue" | "agent.job_proposed" | "agent.job_completed" | "agent.job_disputed" | "compliance.wallet_flagged" | "compliance.wallet_blocked")[]];
126
126
  signingSecretPrefix: string;
127
127
  lastDeliveredAt: string | null;
128
128
  };
129
129
  signingSecret: string;
130
130
  }, {
131
131
  endpoint: {
132
- status: "disabled" | "active";
133
- id: string;
132
+ status: "active" | "disabled";
133
+ mode: "test" | "live";
134
134
  merchantId: string;
135
- createdAt: string;
136
135
  description: string | null;
136
+ id: string;
137
+ createdAt: string;
137
138
  updatedAt: string;
138
- mode: "test" | "live";
139
139
  url: string;
140
- events: ["payment.created" | "payment.completed" | "payment.failed" | "subscription.created" | "subscription.charged" | "subscription.charge_failed" | "subscription.recovery_attempt" | "subscription.cancelled" | "subscription.lapsed" | "subscription.reactivated" | "refund.created" | "refund.completed" | "invoice.created" | "invoice.paid" | "invoice.overdue" | "agent.job_proposed" | "agent.job_completed" | "agent.job_disputed" | "compliance.wallet_flagged" | "compliance.wallet_blocked", ...("payment.created" | "payment.completed" | "payment.failed" | "subscription.created" | "subscription.charged" | "subscription.charge_failed" | "subscription.recovery_attempt" | "subscription.cancelled" | "subscription.lapsed" | "subscription.reactivated" | "refund.created" | "refund.completed" | "invoice.created" | "invoice.paid" | "invoice.overdue" | "agent.job_proposed" | "agent.job_completed" | "agent.job_disputed" | "compliance.wallet_flagged" | "compliance.wallet_blocked")[]];
140
+ events: ["payment.created" | "payment.completed" | "payment.failed" | "subscription.created" | "subscription.charged" | "subscription.charge_failed" | "subscription.recovery_attempt" | "subscription.cancelled" | "subscription.lapsed" | "subscription.reactivated" | "refund.created" | "refund.completed" | "refund.failed" | "invoice.created" | "invoice.paid" | "invoice.overdue" | "agent.job_proposed" | "agent.job_completed" | "agent.job_disputed" | "compliance.wallet_flagged" | "compliance.wallet_blocked", ...("payment.created" | "payment.completed" | "payment.failed" | "subscription.created" | "subscription.charged" | "subscription.charge_failed" | "subscription.recovery_attempt" | "subscription.cancelled" | "subscription.lapsed" | "subscription.reactivated" | "refund.created" | "refund.completed" | "refund.failed" | "invoice.created" | "invoice.paid" | "invoice.overdue" | "agent.job_proposed" | "agent.job_completed" | "agent.job_disputed" | "compliance.wallet_flagged" | "compliance.wallet_blocked")[]];
141
141
  signingSecretPrefix: string;
142
142
  lastDeliveredAt: string | null;
143
143
  };
@@ -151,7 +151,7 @@ declare const webhookDeliverySchema: z.ZodObject<{
151
151
  merchantId: z.ZodString;
152
152
  endpointId: z.ZodString;
153
153
  eventId: z.ZodString;
154
- eventName: z.ZodEnum<["payment.created", "payment.completed", "payment.failed", "subscription.created", "subscription.charged", "subscription.charge_failed", "subscription.recovery_attempt", "subscription.cancelled", "subscription.lapsed", "subscription.reactivated", "refund.created", "refund.completed", "invoice.created", "invoice.paid", "invoice.overdue", "agent.job_proposed", "agent.job_completed", "agent.job_disputed", "compliance.wallet_flagged", "compliance.wallet_blocked"]>;
154
+ eventName: z.ZodEnum<["payment.created", "payment.completed", "payment.failed", "subscription.created", "subscription.charged", "subscription.charge_failed", "subscription.recovery_attempt", "subscription.cancelled", "subscription.lapsed", "subscription.reactivated", "refund.created", "refund.completed", "refund.failed", "invoice.created", "invoice.paid", "invoice.overdue", "agent.job_proposed", "agent.job_completed", "agent.job_disputed", "compliance.wallet_flagged", "compliance.wallet_blocked"]>;
155
155
  status: z.ZodEnum<["pending", "delivered", "retrying", "permanently_failed"]>;
156
156
  attempt: z.ZodNumber;
157
157
  responseCode: z.ZodNullable<z.ZodNumber>;
@@ -162,12 +162,12 @@ declare const webhookDeliverySchema: z.ZodObject<{
162
162
  createdAt: z.ZodString;
163
163
  }, "strip", z.ZodTypeAny, {
164
164
  status: "pending" | "retrying" | "delivered" | "permanently_failed";
165
- id: string;
166
165
  merchantId: string;
166
+ id: string;
167
167
  createdAt: string;
168
168
  endpointId: string;
169
169
  eventId: string;
170
- eventName: "payment.created" | "payment.completed" | "payment.failed" | "subscription.created" | "subscription.charged" | "subscription.charge_failed" | "subscription.recovery_attempt" | "subscription.cancelled" | "subscription.lapsed" | "subscription.reactivated" | "refund.created" | "refund.completed" | "invoice.created" | "invoice.paid" | "invoice.overdue" | "agent.job_proposed" | "agent.job_completed" | "agent.job_disputed" | "compliance.wallet_flagged" | "compliance.wallet_blocked";
170
+ eventName: "payment.created" | "payment.completed" | "payment.failed" | "subscription.created" | "subscription.charged" | "subscription.charge_failed" | "subscription.recovery_attempt" | "subscription.cancelled" | "subscription.lapsed" | "subscription.reactivated" | "refund.created" | "refund.completed" | "refund.failed" | "invoice.created" | "invoice.paid" | "invoice.overdue" | "agent.job_proposed" | "agent.job_completed" | "agent.job_disputed" | "compliance.wallet_flagged" | "compliance.wallet_blocked";
171
171
  attempt: number;
172
172
  responseCode: number | null;
173
173
  responseMs: number | null;
@@ -176,12 +176,12 @@ declare const webhookDeliverySchema: z.ZodObject<{
176
176
  deliveredAt: string | null;
177
177
  }, {
178
178
  status: "pending" | "retrying" | "delivered" | "permanently_failed";
179
- id: string;
180
179
  merchantId: string;
180
+ id: string;
181
181
  createdAt: string;
182
182
  endpointId: string;
183
183
  eventId: string;
184
- eventName: "payment.created" | "payment.completed" | "payment.failed" | "subscription.created" | "subscription.charged" | "subscription.charge_failed" | "subscription.recovery_attempt" | "subscription.cancelled" | "subscription.lapsed" | "subscription.reactivated" | "refund.created" | "refund.completed" | "invoice.created" | "invoice.paid" | "invoice.overdue" | "agent.job_proposed" | "agent.job_completed" | "agent.job_disputed" | "compliance.wallet_flagged" | "compliance.wallet_blocked";
184
+ eventName: "payment.created" | "payment.completed" | "payment.failed" | "subscription.created" | "subscription.charged" | "subscription.charge_failed" | "subscription.recovery_attempt" | "subscription.cancelled" | "subscription.lapsed" | "subscription.reactivated" | "refund.created" | "refund.completed" | "refund.failed" | "invoice.created" | "invoice.paid" | "invoice.overdue" | "agent.job_proposed" | "agent.job_completed" | "agent.job_disputed" | "compliance.wallet_flagged" | "compliance.wallet_blocked";
185
185
  attempt: number;
186
186
  responseCode: number | null;
187
187
  responseMs: number | null;
@@ -200,7 +200,7 @@ declare const webhookDeliveryDetailSchema: z.ZodObject<{
200
200
  merchantId: z.ZodString;
201
201
  endpointId: z.ZodString;
202
202
  eventId: z.ZodString;
203
- eventName: z.ZodEnum<["payment.created", "payment.completed", "payment.failed", "subscription.created", "subscription.charged", "subscription.charge_failed", "subscription.recovery_attempt", "subscription.cancelled", "subscription.lapsed", "subscription.reactivated", "refund.created", "refund.completed", "invoice.created", "invoice.paid", "invoice.overdue", "agent.job_proposed", "agent.job_completed", "agent.job_disputed", "compliance.wallet_flagged", "compliance.wallet_blocked"]>;
203
+ eventName: z.ZodEnum<["payment.created", "payment.completed", "payment.failed", "subscription.created", "subscription.charged", "subscription.charge_failed", "subscription.recovery_attempt", "subscription.cancelled", "subscription.lapsed", "subscription.reactivated", "refund.created", "refund.completed", "refund.failed", "invoice.created", "invoice.paid", "invoice.overdue", "agent.job_proposed", "agent.job_completed", "agent.job_disputed", "compliance.wallet_flagged", "compliance.wallet_blocked"]>;
204
204
  status: z.ZodEnum<["pending", "delivered", "retrying", "permanently_failed"]>;
205
205
  attempt: z.ZodNumber;
206
206
  responseCode: z.ZodNullable<z.ZodNumber>;
@@ -215,12 +215,12 @@ declare const webhookDeliveryDetailSchema: z.ZodObject<{
215
215
  requestPayload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
216
216
  }, "strip", z.ZodTypeAny, {
217
217
  status: "pending" | "retrying" | "delivered" | "permanently_failed";
218
- id: string;
219
218
  merchantId: string;
219
+ id: string;
220
220
  createdAt: string;
221
221
  endpointId: string;
222
222
  eventId: string;
223
- eventName: "payment.created" | "payment.completed" | "payment.failed" | "subscription.created" | "subscription.charged" | "subscription.charge_failed" | "subscription.recovery_attempt" | "subscription.cancelled" | "subscription.lapsed" | "subscription.reactivated" | "refund.created" | "refund.completed" | "invoice.created" | "invoice.paid" | "invoice.overdue" | "agent.job_proposed" | "agent.job_completed" | "agent.job_disputed" | "compliance.wallet_flagged" | "compliance.wallet_blocked";
223
+ eventName: "payment.created" | "payment.completed" | "payment.failed" | "subscription.created" | "subscription.charged" | "subscription.charge_failed" | "subscription.recovery_attempt" | "subscription.cancelled" | "subscription.lapsed" | "subscription.reactivated" | "refund.created" | "refund.completed" | "refund.failed" | "invoice.created" | "invoice.paid" | "invoice.overdue" | "agent.job_proposed" | "agent.job_completed" | "agent.job_disputed" | "compliance.wallet_flagged" | "compliance.wallet_blocked";
224
224
  attempt: number;
225
225
  responseCode: number | null;
226
226
  responseMs: number | null;
@@ -232,12 +232,12 @@ declare const webhookDeliveryDetailSchema: z.ZodObject<{
232
232
  requestPayload: Record<string, unknown>;
233
233
  }, {
234
234
  status: "pending" | "retrying" | "delivered" | "permanently_failed";
235
- id: string;
236
235
  merchantId: string;
236
+ id: string;
237
237
  createdAt: string;
238
238
  endpointId: string;
239
239
  eventId: string;
240
- eventName: "payment.created" | "payment.completed" | "payment.failed" | "subscription.created" | "subscription.charged" | "subscription.charge_failed" | "subscription.recovery_attempt" | "subscription.cancelled" | "subscription.lapsed" | "subscription.reactivated" | "refund.created" | "refund.completed" | "invoice.created" | "invoice.paid" | "invoice.overdue" | "agent.job_proposed" | "agent.job_completed" | "agent.job_disputed" | "compliance.wallet_flagged" | "compliance.wallet_blocked";
240
+ eventName: "payment.created" | "payment.completed" | "payment.failed" | "subscription.created" | "subscription.charged" | "subscription.charge_failed" | "subscription.recovery_attempt" | "subscription.cancelled" | "subscription.lapsed" | "subscription.reactivated" | "refund.created" | "refund.completed" | "refund.failed" | "invoice.created" | "invoice.paid" | "invoice.overdue" | "agent.job_proposed" | "agent.job_completed" | "agent.job_disputed" | "compliance.wallet_flagged" | "compliance.wallet_blocked";
241
241
  attempt: number;
242
242
  responseCode: number | null;
243
243
  responseMs: number | null;
package/dist/webhooks.js CHANGED
@@ -41,6 +41,7 @@ var webhookEventNameSchema = z.enum([
41
41
  "subscription.reactivated",
42
42
  "refund.created",
43
43
  "refund.completed",
44
+ "refund.failed",
44
45
  "invoice.created",
45
46
  "invoice.paid",
46
47
  "invoice.overdue",
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/common.ts","../src/webhooks.ts"],"names":["z"],"mappings":";;;AAQO,IAAM,QAAA,GAAW,CAAA,CACrB,MAAA,EAAO,CACP,GAAA,CAAI,CAAC,CAAA,CACL,GAAA,CAAI,EAAE,CAAA,CACN,KAAA,CAAM,kBAAA,EAAoB,qBAAqB,CAAA;AAGlB,CAAA,CAC7B,MAAA,EAAO,CACP,KAAA,CAAM,qBAAA,EAAuB,oDAAoD,CAAA,CACjF,SAAA,CAAU,CAAC,CAAA,KAAM,CAAA,CAAE,aAAa;AAGJ,CAAA,CAC5B,MAAA,EAAO,CACP,KAAA,CAAM,uBAAuB,6DAA6D;AAGlE,CAAA,CAAE,MAAA,EAAO,CAAE,KAAA,EAAM,CAAE,IAAA,EAAK,CAAE,WAAA,EAAY,CAAE,GAAA,CAAI,GAAG;AAGnE,IAAM,cAAA,GAAiB,CAAA,CAC3B,MAAA,EAAO,CACP,GAAA,EAAI,CACJ,MAAA,CAAO,CAAC,CAAA,KAAM,CAAA,CAAE,UAAA,CAAW,UAAU,CAAA,EAAG;AAAA,EACvC,OA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AAI,CAAC,CAAA,CAAE,QAAA,EAAS;AAAA,EAC7C,WAAWA,CAAAA,CAAE,MAAA,GAAS,GAAA,CAAI,GAAI,EAAE,QAAA,EAAS;AAAA,EACzC,aAAA,EAAe,mBAAmB,QAAA,EAAS;AAAA,EAC3C,WAAA,EAAa,mBAAmB,QAAA,EAAS;AAAA,EACzC,SAAA,EAAW;AACb,CAAC;AAQM,IAAM,2BAAA,GAA8B,sBAAsB,MAAA,CAAO;AAAA,EACtE,UAAA,EAAYA,EAAE,MAAA,EAAO;AAAA,EACrB,YAAA,EAAcA,CAAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,EAClC,cAAA,EAAgBA,EAAE,MAAA,CAAOA,CAAAA,CAAE,QAAO,EAAGA,CAAAA,CAAE,SAAS;AAClD,CAAC;AAGM,IAAM,yBAAA,GAA4BA,EAAE,MAAA,CAAO;AAAA,EAChD,EAAA,EAAI;AACN,CAAC","file":"webhooks.js","sourcesContent":["/**\n * Primitive schemas shared across every entity.\n * Every higher-level schema builds on these so validation is consistent.\n */\n\nimport { z } from 'zod'\n\n/** CUID2 or UUID-style opaque identifier. */\nexport const idSchema = z\n .string()\n .min(1)\n .max(64)\n .regex(/^[a-zA-Z0-9_-]+$/, 'id must be URL-safe')\n\n/** EVM address. Hex-encoded, 0x-prefixed, 20 bytes. Normalised to lowercase. */\nexport const evmAddressSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{40}$/, 'must be a 0x-prefixed 40-character hex EVM address')\n .transform((v) => v.toLowerCase())\n\n/** EVM transaction hash. 32-byte hex. */\nexport const evmTxHashSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{64}$/, 'must be a 0x-prefixed 64-character hex EVM transaction hash')\n\n/** Email address, trimmed and lower-cased. */\nexport const emailSchema = z.string().email().trim().toLowerCase().max(320)\n\n/** HTTPS URL. No http:// allowed outside dev. */\nexport const httpsUrlSchema = z\n .string()\n .url()\n .refine((v) => v.startsWith('https://'), {\n message: 'must be an https:// URL',\n })\n\n/** URL permitting http and https (dev + prod). */\nexport const httpUrlSchema = z.string().url()\n\n/**\n * Amount expressed in the token's smallest unit, serialised as a string to\n * preserve precision beyond `Number.MAX_SAFE_INTEGER`. For USDC (6 decimals),\n * 1 USDC is the string \"1000000\".\n */\nexport const tokenAmountSchema = z\n .string()\n .regex(/^[0-9]+$/, 'must be a non-negative integer string (base-10)')\n\n/** Unsigned integer up to 2^53 - 1; validated and returned as number. */\nexport const uintSchema = z.number().int().min(0).max(Number.MAX_SAFE_INTEGER)\n\n/** ISO-8601 timestamp string (`.toISOString()`-compatible). */\nexport const isoTimestampSchema = z\n .string()\n .datetime({ offset: true, message: 'must be an ISO-8601 timestamp' })\n\n/** Two-letter ISO-3166 country code. */\nexport const countryCodeSchema = z\n .string()\n .length(2)\n .regex(/^[A-Z]{2}$/, 'must be an ISO-3166 alpha-2 country code')\n\n/** Pagination inputs used by every list endpoint. */\nexport const paginationInputSchema = z.object({\n limit: z.number().int().min(1).max(100).default(25),\n cursor: z.string().min(1).max(200).nullish(),\n})\nexport type PaginationInput = z.input<typeof paginationInputSchema>\nexport type PaginationParsed = z.output<typeof paginationInputSchema>\n\n/** Pagination envelope used by every list response. */\nexport const makePaginatedSchema = <T extends z.ZodTypeAny>(item: T) =>\n z.object({\n data: z.array(item),\n nextCursor: z.string().nullable(),\n hasMore: z.boolean(),\n })\n\n/** Free-form metadata bag the API round-trips for merchants. */\nexport const metadataSchema = z\n .record(\n z.string().min(1).max(40),\n z.union([z.string().max(500), z.number(), z.boolean(), z.null()]),\n )\n .refine((m) => Object.keys(m).length <= 50, 'at most 50 metadata keys')\n .default({})\n\n/** Environment mode carried on every mode-scoped resource. */\nexport const modeSchema = z.enum(['test', 'live'])\nexport type Mode = z.infer<typeof modeSchema>\n\n/** Payment token enum. */\nexport const paymentCurrencySchema = z.enum(['USDC', 'EURC'])\nexport type PaymentCurrency = z.infer<typeof paymentCurrencySchema>\n\n/** Every display-level currency (payment + treasury). */\nexport const tokenSymbolSchema = z.enum(['USDC', 'EURC', 'USYC'])\nexport type TokenSymbol = z.infer<typeof tokenSymbolSchema>\n\n/** Merchant tier enum. */\nexport const merchantTierSchema = z.enum(['free', 'starter', 'growth', 'enterprise'])\nexport type MerchantTier = z.infer<typeof merchantTierSchema>\n\n/** Arc environment enum. */\nexport const arcEnvironmentSchema = z.enum(['testnet', 'mainnet'])\nexport type ArcEnvironment = z.infer<typeof arcEnvironmentSchema>\n\nexport type Id = z.infer<typeof idSchema>\nexport type EvmAddress = z.infer<typeof evmAddressSchema>\nexport type EvmTxHash = z.infer<typeof evmTxHashSchema>\nexport type TokenAmount = z.infer<typeof tokenAmountSchema>\nexport type IsoTimestamp = z.infer<typeof isoTimestampSchema>\nexport type Metadata = z.infer<typeof metadataSchema>\n","/**\n * Webhook endpoints and deliveries.\n *\n * Endpoint = the URL the merchant registered.\n * Event = the thing that happened.\n * Delivery = one attempt to POST a specific event to a specific endpoint.\n */\n\nimport { z } from 'zod'\nimport { httpsUrlSchema, idSchema, isoTimestampSchema, modeSchema } from './common.js'\n\n// ---------- Event name ----------\n\n/**\n * Every webhook event name in the system. Listed inline so Zod can\n * produce a concrete string union.\n */\nexport const webhookEventNameSchema = z.enum([\n 'payment.created',\n 'payment.completed',\n 'payment.failed',\n 'subscription.created',\n 'subscription.charged',\n 'subscription.charge_failed',\n 'subscription.recovery_attempt',\n 'subscription.cancelled',\n 'subscription.lapsed',\n 'subscription.reactivated',\n 'refund.created',\n 'refund.completed',\n 'invoice.created',\n 'invoice.paid',\n 'invoice.overdue',\n 'agent.job_proposed',\n 'agent.job_completed',\n 'agent.job_disputed',\n 'compliance.wallet_flagged',\n 'compliance.wallet_blocked',\n])\nexport type WebhookEventName = z.infer<typeof webhookEventNameSchema>\n\n// ---------- Endpoints ----------\n\nexport const webhookEndpointStatusSchema = z.enum(['active', 'disabled'])\nexport type WebhookEndpointStatus = z.infer<typeof webhookEndpointStatusSchema>\n\nexport const webhookEndpointSchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n mode: modeSchema,\n url: httpsUrlSchema,\n description: z.string().max(200).nullable(),\n events: z.array(webhookEventNameSchema).nonempty(),\n status: webhookEndpointStatusSchema,\n signingSecretPrefix: z.string().min(4).max(12),\n lastDeliveredAt: isoTimestampSchema.nullable(),\n createdAt: isoTimestampSchema,\n updatedAt: isoTimestampSchema,\n})\nexport type WebhookEndpoint = z.infer<typeof webhookEndpointSchema>\n\nexport const createWebhookEndpointInputSchema = z.object({\n url: httpsUrlSchema,\n events: z.array(webhookEventNameSchema).nonempty(),\n description: z.string().max(200).optional(),\n mode: modeSchema,\n})\nexport type CreateWebhookEndpointInput = z.input<typeof createWebhookEndpointInputSchema>\nexport type CreateWebhookEndpointParsed = z.output<typeof createWebhookEndpointInputSchema>\n\nexport const createWebhookEndpointOutputSchema = z.object({\n endpoint: webhookEndpointSchema,\n /** Full signing secret. Shown exactly once. */\n signingSecret: z.string(),\n})\nexport type CreateWebhookEndpointOutput = z.infer<typeof createWebhookEndpointOutputSchema>\n\n// ---------- Deliveries ----------\n\nexport const webhookDeliveryStatusSchema = z.enum([\n 'pending',\n 'delivered',\n 'retrying',\n 'permanently_failed',\n])\nexport type WebhookDeliveryStatus = z.infer<typeof webhookDeliveryStatusSchema>\n\nexport const webhookDeliverySchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n endpointId: idSchema,\n eventId: idSchema,\n eventName: webhookEventNameSchema,\n status: webhookDeliveryStatusSchema,\n attempt: z.number().int().min(1).max(6),\n responseCode: z.number().int().min(100).max(599).nullable(),\n responseMs: z.number().int().min(0).nullable(),\n lastError: z.string().max(1000).nullable(),\n nextAttemptAt: isoTimestampSchema.nullable(),\n deliveredAt: isoTimestampSchema.nullable(),\n createdAt: isoTimestampSchema,\n})\nexport type WebhookDelivery = z.infer<typeof webhookDeliverySchema>\n\n/**\n * Detail projection returned by GET /v1/webhook-deliveries/:id.\n * Carries the payload envelope, response body, and the deliveryId\n * header the receiver saw. Kept separate so list responses stay slim.\n */\nexport const webhookDeliveryDetailSchema = webhookDeliverySchema.extend({\n deliveryId: z.string(),\n responseBody: z.string().nullable(),\n requestPayload: z.record(z.string(), z.unknown()),\n})\nexport type WebhookDeliveryDetail = z.infer<typeof webhookDeliveryDetailSchema>\n\nexport const replayDeliveryInputSchema = z.object({\n id: idSchema,\n})\nexport type ReplayDeliveryInput = z.input<typeof replayDeliveryInputSchema>\nexport type ReplayDeliveryParsed = z.output<typeof replayDeliveryInputSchema>\n"]}
1
+ {"version":3,"sources":["../src/common.ts","../src/webhooks.ts"],"names":["z"],"mappings":";;;AAQO,IAAM,QAAA,GAAW,CAAA,CACrB,MAAA,EAAO,CACP,GAAA,CAAI,CAAC,CAAA,CACL,GAAA,CAAI,EAAE,CAAA,CACN,KAAA,CAAM,kBAAA,EAAoB,qBAAqB,CAAA;AAGlB,CAAA,CAC7B,MAAA,EAAO,CACP,KAAA,CAAM,qBAAA,EAAuB,oDAAoD,CAAA,CACjF,SAAA,CAAU,CAAC,CAAA,KAAM,CAAA,CAAE,aAAa;AAGJ,CAAA,CAC5B,MAAA,EAAO,CACP,KAAA,CAAM,uBAAuB,6DAA6D;AAGlE,CAAA,CAAE,MAAA,EAAO,CAAE,KAAA,EAAM,CAAE,IAAA,EAAK,CAAE,WAAA,EAAY,CAAE,GAAA,CAAI,GAAG;AAGnE,IAAM,cAAA,GAAiB,CAAA,CAC3B,MAAA,EAAO,CACP,GAAA,EAAI,CACJ,MAAA,CAAO,CAAC,CAAA,KAAM,CAAA,CAAE,UAAA,CAAW,UAAU,CAAA,EAAG;AAAA,EACvC,OAAA,EAAS;AACX,CAAC,CAAA;AAG0B,CAAA,CAAE,MAAA,EAAO,CAAE,GAAA;AAOP,CAAA,CAC9B,MAAA,EAAO,CACP,KAAA,CAAM,YAAY,iDAAiD;AAG5C,CAAA,CAAE,MAAA,EAAO,CAAE,GAAA,EAAI,CAAE,GAAA,CAAI,CAAC,CAAA,CAAE,GAAA,CAAI,MAAA,CAAO,g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AAW;AACb,CAAC;AAQM,IAAM,2BAAA,GAA8B,sBAAsB,MAAA,CAAO;AAAA,EACtE,UAAA,EAAYA,EAAE,MAAA,EAAO;AAAA,EACrB,YAAA,EAAcA,CAAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,EAClC,cAAA,EAAgBA,EAAE,MAAA,CAAOA,CAAAA,CAAE,QAAO,EAAGA,CAAAA,CAAE,SAAS;AAClD,CAAC;AAGM,IAAM,yBAAA,GAA4BA,EAAE,MAAA,CAAO;AAAA,EAChD,EAAA,EAAI;AACN,CAAC","file":"webhooks.js","sourcesContent":["/**\n * Primitive schemas shared across every entity.\n * Every higher-level schema builds on these so validation is consistent.\n */\n\nimport { z } from 'zod'\n\n/** CUID2 or UUID-style opaque identifier. */\nexport const idSchema = z\n .string()\n .min(1)\n .max(64)\n .regex(/^[a-zA-Z0-9_-]+$/, 'id must be URL-safe')\n\n/** EVM address. Hex-encoded, 0x-prefixed, 20 bytes. Normalised to lowercase. */\nexport const evmAddressSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{40}$/, 'must be a 0x-prefixed 40-character hex EVM address')\n .transform((v) => v.toLowerCase())\n\n/** EVM transaction hash. 32-byte hex. */\nexport const evmTxHashSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{64}$/, 'must be a 0x-prefixed 64-character hex EVM transaction hash')\n\n/** Email address, trimmed and lower-cased. */\nexport const emailSchema = z.string().email().trim().toLowerCase().max(320)\n\n/** HTTPS URL. No http:// allowed outside dev. */\nexport const httpsUrlSchema = z\n .string()\n .url()\n .refine((v) => v.startsWith('https://'), {\n message: 'must be an https:// URL',\n })\n\n/** URL permitting http and https (dev + prod). */\nexport const httpUrlSchema = z.string().url()\n\n/**\n * Amount expressed in the token's smallest unit, serialised as a string to\n * preserve precision beyond `Number.MAX_SAFE_INTEGER`. For USDC (6 decimals),\n * 1 USDC is the string \"1000000\".\n */\nexport const tokenAmountSchema = z\n .string()\n .regex(/^[0-9]+$/, 'must be a non-negative integer string (base-10)')\n\n/** Unsigned integer up to 2^53 - 1; validated and returned as number. */\nexport const uintSchema = z.number().int().min(0).max(Number.MAX_SAFE_INTEGER)\n\n/** ISO-8601 timestamp string (`.toISOString()`-compatible). */\nexport const isoTimestampSchema = z\n .string()\n .datetime({ offset: true, message: 'must be an ISO-8601 timestamp' })\n\n/** Two-letter ISO-3166 country code. */\nexport const countryCodeSchema = z\n .string()\n .length(2)\n .regex(/^[A-Z]{2}$/, 'must be an ISO-3166 alpha-2 country code')\n\n/** Pagination inputs used by every list endpoint. */\nexport const paginationInputSchema = z.object({\n limit: z.number().int().min(1).max(100).default(25),\n cursor: z.string().min(1).max(200).nullish(),\n})\nexport type PaginationInput = z.input<typeof paginationInputSchema>\nexport type PaginationParsed = z.output<typeof paginationInputSchema>\n\n/** Pagination envelope used by every list response. */\nexport const makePaginatedSchema = <T extends z.ZodTypeAny>(item: T) =>\n z.object({\n data: z.array(item),\n nextCursor: z.string().nullable(),\n hasMore: z.boolean(),\n })\n\n/** Free-form metadata bag the API round-trips for merchants. */\nexport const metadataSchema = z\n .record(\n z.string().min(1).max(40),\n z.union([z.string().max(500), z.number(), z.boolean(), z.null()]),\n )\n .refine((m) => Object.keys(m).length <= 50, 'at most 50 metadata keys')\n .default({})\n\n/** Environment mode carried on every mode-scoped resource. */\nexport const modeSchema = z.enum(['test', 'live'])\nexport type Mode = z.infer<typeof modeSchema>\n\n/** Payment token enum. */\nexport const paymentCurrencySchema = z.enum(['USDC', 'EURC'])\nexport type PaymentCurrency = z.infer<typeof paymentCurrencySchema>\n\n/** Every display-level currency (payment + treasury). */\nexport const tokenSymbolSchema = z.enum(['USDC', 'EURC', 'USYC'])\nexport type TokenSymbol = z.infer<typeof tokenSymbolSchema>\n\n/** Merchant tier enum. */\nexport const merchantTierSchema = z.enum(['free', 'starter', 'growth', 'enterprise'])\nexport type MerchantTier = z.infer<typeof merchantTierSchema>\n\n/** Arc environment enum. */\nexport const arcEnvironmentSchema = z.enum(['testnet', 'mainnet'])\nexport type ArcEnvironment = z.infer<typeof arcEnvironmentSchema>\n\nexport type Id = z.infer<typeof idSchema>\nexport type EvmAddress = z.infer<typeof evmAddressSchema>\nexport type EvmTxHash = z.infer<typeof evmTxHashSchema>\nexport type TokenAmount = z.infer<typeof tokenAmountSchema>\nexport type IsoTimestamp = z.infer<typeof isoTimestampSchema>\nexport type Metadata = z.infer<typeof metadataSchema>\n","/**\n * Webhook endpoints and deliveries.\n *\n * Endpoint = the URL the merchant registered.\n * Event = the thing that happened.\n * Delivery = one attempt to POST a specific event to a specific endpoint.\n */\n\nimport { z } from 'zod'\nimport { httpsUrlSchema, idSchema, isoTimestampSchema, modeSchema } from './common.js'\n\n// ---------- Event name ----------\n\n/**\n * Every webhook event name in the system. Listed inline so Zod can\n * produce a concrete string union.\n */\nexport const webhookEventNameSchema = z.enum([\n 'payment.created',\n 'payment.completed',\n 'payment.failed',\n 'subscription.created',\n 'subscription.charged',\n 'subscription.charge_failed',\n 'subscription.recovery_attempt',\n 'subscription.cancelled',\n 'subscription.lapsed',\n 'subscription.reactivated',\n 'refund.created',\n 'refund.completed',\n 'refund.failed',\n 'invoice.created',\n 'invoice.paid',\n 'invoice.overdue',\n 'agent.job_proposed',\n 'agent.job_completed',\n 'agent.job_disputed',\n 'compliance.wallet_flagged',\n 'compliance.wallet_blocked',\n])\nexport type WebhookEventName = z.infer<typeof webhookEventNameSchema>\n\n// ---------- Endpoints ----------\n\nexport const webhookEndpointStatusSchema = z.enum(['active', 'disabled'])\nexport type WebhookEndpointStatus = z.infer<typeof webhookEndpointStatusSchema>\n\nexport const webhookEndpointSchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n mode: modeSchema,\n url: httpsUrlSchema,\n description: z.string().max(200).nullable(),\n events: z.array(webhookEventNameSchema).nonempty(),\n status: webhookEndpointStatusSchema,\n signingSecretPrefix: z.string().min(4).max(12),\n lastDeliveredAt: isoTimestampSchema.nullable(),\n createdAt: isoTimestampSchema,\n updatedAt: isoTimestampSchema,\n})\nexport type WebhookEndpoint = z.infer<typeof webhookEndpointSchema>\n\nexport const createWebhookEndpointInputSchema = z.object({\n url: httpsUrlSchema,\n events: z.array(webhookEventNameSchema).nonempty(),\n description: z.string().max(200).optional(),\n mode: modeSchema,\n})\nexport type CreateWebhookEndpointInput = z.input<typeof createWebhookEndpointInputSchema>\nexport type CreateWebhookEndpointParsed = z.output<typeof createWebhookEndpointInputSchema>\n\nexport const createWebhookEndpointOutputSchema = z.object({\n endpoint: webhookEndpointSchema,\n /** Full signing secret. Shown exactly once. */\n signingSecret: z.string(),\n})\nexport type CreateWebhookEndpointOutput = z.infer<typeof createWebhookEndpointOutputSchema>\n\n// ---------- Deliveries ----------\n\nexport const webhookDeliveryStatusSchema = z.enum([\n 'pending',\n 'delivered',\n 'retrying',\n 'permanently_failed',\n])\nexport type WebhookDeliveryStatus = z.infer<typeof webhookDeliveryStatusSchema>\n\nexport const webhookDeliverySchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n endpointId: idSchema,\n eventId: idSchema,\n eventName: webhookEventNameSchema,\n status: webhookDeliveryStatusSchema,\n attempt: z.number().int().min(1).max(6),\n responseCode: z.number().int().min(100).max(599).nullable(),\n responseMs: z.number().int().min(0).nullable(),\n lastError: z.string().max(1000).nullable(),\n nextAttemptAt: isoTimestampSchema.nullable(),\n deliveredAt: isoTimestampSchema.nullable(),\n createdAt: isoTimestampSchema,\n})\nexport type WebhookDelivery = z.infer<typeof webhookDeliverySchema>\n\n/**\n * Detail projection returned by GET /v1/webhook-deliveries/:id.\n * Carries the payload envelope, response body, and the deliveryId\n * header the receiver saw. Kept separate so list responses stay slim.\n */\nexport const webhookDeliveryDetailSchema = webhookDeliverySchema.extend({\n deliveryId: z.string(),\n responseBody: z.string().nullable(),\n requestPayload: z.record(z.string(), z.unknown()),\n})\nexport type WebhookDeliveryDetail = z.infer<typeof webhookDeliveryDetailSchema>\n\nexport const replayDeliveryInputSchema = z.object({\n id: idSchema,\n})\nexport type ReplayDeliveryInput = z.input<typeof replayDeliveryInputSchema>\nexport type ReplayDeliveryParsed = z.output<typeof replayDeliveryInputSchema>\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strimz/shared-types",
3
- "version": "0.17.0",
3
+ "version": "0.19.0",
4
4
  "description": "Zod schemas and inferred TypeScript types for every Strimz platform entity, API input, and webhook event.",
5
5
  "license": "MIT",
6
6
  "author": "Strimz <hello@strimz.finance>",
@@ -118,7 +118,7 @@
118
118
  ],
119
119
  "dependencies": {
120
120
  "zod": "^3.24.1",
121
- "@strimz/shared-config": "0.9.1"
121
+ "@strimz/shared-config": "0.10.0"
122
122
  },
123
123
  "devDependencies": {
124
124
  "eslint": "^9.18.0",
package/src/events.ts CHANGED
@@ -80,6 +80,8 @@ export const refundCompletedEventSchema = envelope(
80
80
  'refund.completed',
81
81
  z.object({ refund: refundSchema, transaction: transactionSchema }),
82
82
  )
83
+ /** The refund's transfer reverted, paid the wrong thing, or can never be mined. */
84
+ export const refundFailedEventSchema = envelope('refund.failed', refundSchema)
83
85
 
84
86
  // ---------- Invoice ----------
85
87
 
@@ -122,6 +124,7 @@ export const webhookEventSchema = z.discriminatedUnion('type', [
122
124
  subscriptionReactivatedEventSchema,
123
125
  refundCreatedEventSchema,
124
126
  refundCompletedEventSchema,
127
+ refundFailedEventSchema,
125
128
  invoiceCreatedEventSchema,
126
129
  invoicePaidEventSchema,
127
130
  invoiceOverdueEventSchema,
@@ -148,6 +151,7 @@ export type SubscriptionLapsedEvent = z.infer<typeof subscriptionLapsedEventSche
148
151
  export type SubscriptionReactivatedEvent = z.infer<typeof subscriptionReactivatedEventSchema>
149
152
  export type RefundCreatedEvent = z.infer<typeof refundCreatedEventSchema>
150
153
  export type RefundCompletedEvent = z.infer<typeof refundCompletedEventSchema>
154
+ export type RefundFailedEvent = z.infer<typeof refundFailedEventSchema>
151
155
  export type InvoiceCreatedEvent = z.infer<typeof invoiceCreatedEventSchema>
152
156
  export type InvoicePaidEvent = z.infer<typeof invoicePaidEventSchema>
153
157
  export type InvoiceOverdueEvent = z.infer<typeof invoiceOverdueEventSchema>
@@ -17,6 +17,8 @@ export const notificationKindSchema = z.enum([
17
17
  'refund_processed',
18
18
  /** Message an admin broadcast to this merchant (or all merchants). */
19
19
  'admin_broadcast',
20
+ /** A subscriber's token approval covers fewer than two more charges. */
21
+ 'allowance_low',
20
22
  ])
21
23
  export type NotificationKind = z.infer<typeof notificationKindSchema>
22
24
 
package/src/webhooks.ts CHANGED
@@ -28,6 +28,7 @@ export const webhookEventNameSchema = z.enum([
28
28
  'subscription.reactivated',
29
29
  'refund.created',
30
30
  'refund.completed',
31
+ 'refund.failed',
31
32
  'invoice.created',
32
33
  'invoice.paid',
33
34
  'invoice.overdue',