@strimz/shared-types 0.13.1 → 0.14.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.
- package/dist/analytics.d.cts +136 -136
- package/dist/analytics.d.ts +136 -136
- package/dist/api-keys.d.cts +20 -20
- package/dist/api-keys.d.ts +20 -20
- package/dist/compliance.d.cts +4 -4
- package/dist/compliance.d.ts +4 -4
- package/dist/customers.d.cts +6 -6
- package/dist/customers.d.ts +6 -6
- package/dist/events.cjs +1 -25
- package/dist/events.cjs.map +1 -1
- package/dist/events.d.cts +1343 -2149
- package/dist/events.d.ts +1343 -2149
- package/dist/events.js +2 -23
- package/dist/events.js.map +1 -1
- package/dist/index.cjs +0 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -15
- package/dist/index.d.ts +15 -15
- package/dist/index.js +1 -22
- package/dist/index.js.map +1 -1
- package/dist/invoices.d.cts +10 -10
- package/dist/invoices.d.ts +10 -10
- package/dist/merchants.d.cts +20 -20
- package/dist/merchants.d.ts +20 -20
- package/dist/payment-sessions.d.cts +16 -16
- package/dist/payment-sessions.d.ts +16 -16
- package/dist/refunds.d.cts +36 -36
- package/dist/refunds.d.ts +36 -36
- package/dist/storefronts.d.cts +27 -27
- package/dist/storefronts.d.ts +27 -27
- package/dist/subscriptions.d.cts +30 -30
- package/dist/subscriptions.d.ts +30 -30
- package/dist/transactions.d.cts +12 -12
- package/dist/transactions.d.ts +12 -12
- package/dist/webhooks.cjs +0 -3
- package/dist/webhooks.cjs.map +1 -1
- package/dist/webhooks.d.cts +40 -40
- package/dist/webhooks.d.ts +40 -40
- package/dist/webhooks.js +0 -3
- package/dist/webhooks.js.map +1 -1
- package/package.json +2 -2
- package/src/events.ts +1 -24
- package/src/webhooks.ts +0 -3
package/dist/subscriptions.d.cts
CHANGED
|
@@ -48,34 +48,34 @@ declare const subscriptionPlanSchema: z.ZodObject<{
|
|
|
48
48
|
updatedAt: z.ZodString;
|
|
49
49
|
}, "strip", z.ZodTypeAny, {
|
|
50
50
|
status: "active" | "archived";
|
|
51
|
-
|
|
51
|
+
amount: string;
|
|
52
|
+
currency: "USDC" | "EURC";
|
|
52
53
|
merchantId: string;
|
|
53
|
-
name: string;
|
|
54
|
-
createdAt: string;
|
|
55
54
|
description: string | null;
|
|
56
|
-
|
|
55
|
+
id: string;
|
|
56
|
+
createdAt: string;
|
|
57
57
|
updatedAt: string;
|
|
58
58
|
chainMerchantId: string | null;
|
|
59
59
|
tokenAddress: string | null;
|
|
60
|
-
amount: string;
|
|
61
60
|
metadata: Record<string, string | number | boolean | null>;
|
|
62
61
|
intervalSeconds: number;
|
|
62
|
+
name: string;
|
|
63
63
|
interval: "daily" | "weekly" | "monthly" | "quarterly" | "yearly";
|
|
64
64
|
intervalCount: number;
|
|
65
65
|
trialPeriodDays: number | null;
|
|
66
66
|
}, {
|
|
67
67
|
status: "active" | "archived";
|
|
68
|
-
|
|
68
|
+
amount: string;
|
|
69
|
+
currency: "USDC" | "EURC";
|
|
69
70
|
merchantId: string;
|
|
70
|
-
name: string;
|
|
71
|
-
createdAt: string;
|
|
72
71
|
description: string | null;
|
|
73
|
-
|
|
72
|
+
id: string;
|
|
73
|
+
createdAt: string;
|
|
74
74
|
updatedAt: string;
|
|
75
75
|
chainMerchantId: string | null;
|
|
76
76
|
tokenAddress: string | null;
|
|
77
|
-
amount: string;
|
|
78
77
|
intervalSeconds: number;
|
|
78
|
+
name: string;
|
|
79
79
|
interval: "daily" | "weekly" | "monthly" | "quarterly" | "yearly";
|
|
80
80
|
intervalCount: number;
|
|
81
81
|
trialPeriodDays: number | null;
|
|
@@ -92,18 +92,18 @@ declare const createSubscriptionPlanInputSchema: z.ZodObject<{
|
|
|
92
92
|
trialPeriodDays: z.ZodOptional<z.ZodNumber>;
|
|
93
93
|
metadata: z.ZodOptional<z.ZodDefault<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>, Record<string, string | number | boolean | null>, Record<string, string | number | boolean | null>>>>;
|
|
94
94
|
}, "strip", z.ZodTypeAny, {
|
|
95
|
-
name: string;
|
|
96
|
-
currency: "USDC" | "EURC";
|
|
97
95
|
amount: string;
|
|
96
|
+
currency: "USDC" | "EURC";
|
|
97
|
+
name: string;
|
|
98
98
|
interval: "daily" | "weekly" | "monthly" | "quarterly" | "yearly";
|
|
99
99
|
intervalCount: number;
|
|
100
100
|
description?: string | undefined;
|
|
101
101
|
metadata?: Record<string, string | number | boolean | null> | undefined;
|
|
102
102
|
trialPeriodDays?: number | undefined;
|
|
103
103
|
}, {
|
|
104
|
-
name: string;
|
|
105
|
-
currency: "USDC" | "EURC";
|
|
106
104
|
amount: string;
|
|
105
|
+
currency: "USDC" | "EURC";
|
|
106
|
+
name: string;
|
|
107
107
|
interval: "daily" | "weekly" | "monthly" | "quarterly" | "yearly";
|
|
108
108
|
description?: string | undefined;
|
|
109
109
|
metadata?: Record<string, string | number | boolean | null> | undefined;
|
|
@@ -136,14 +136,14 @@ declare const subscriptionSchema: z.ZodObject<{
|
|
|
136
136
|
createdAt: z.ZodString;
|
|
137
137
|
updatedAt: z.ZodString;
|
|
138
138
|
}, "strip", z.ZodTypeAny, {
|
|
139
|
-
status: "cancelled" | "
|
|
140
|
-
|
|
139
|
+
status: "cancelled" | "trialing" | "active" | "at_risk" | "paused" | "lapsed";
|
|
140
|
+
amount: string;
|
|
141
|
+
currency: "USDC" | "EURC";
|
|
142
|
+
customerId: string;
|
|
141
143
|
merchantId: string;
|
|
144
|
+
id: string;
|
|
142
145
|
createdAt: string;
|
|
143
|
-
currency: "USDC" | "EURC";
|
|
144
146
|
updatedAt: string;
|
|
145
|
-
customerId: string;
|
|
146
|
-
amount: string;
|
|
147
147
|
metadata: Record<string, string | number | boolean | null>;
|
|
148
148
|
payerAddress: string;
|
|
149
149
|
interval: "daily" | "weekly" | "monthly" | "quarterly" | "yearly";
|
|
@@ -157,14 +157,14 @@ declare const subscriptionSchema: z.ZodObject<{
|
|
|
157
157
|
gracePeriodHours: number;
|
|
158
158
|
cancelledAt: string | null;
|
|
159
159
|
}, {
|
|
160
|
-
status: "cancelled" | "
|
|
161
|
-
|
|
160
|
+
status: "cancelled" | "trialing" | "active" | "at_risk" | "paused" | "lapsed";
|
|
161
|
+
amount: string;
|
|
162
|
+
currency: "USDC" | "EURC";
|
|
163
|
+
customerId: string;
|
|
162
164
|
merchantId: string;
|
|
165
|
+
id: string;
|
|
163
166
|
createdAt: string;
|
|
164
|
-
currency: "USDC" | "EURC";
|
|
165
167
|
updatedAt: string;
|
|
166
|
-
customerId: string;
|
|
167
|
-
amount: string;
|
|
168
168
|
payerAddress: string;
|
|
169
169
|
interval: "daily" | "weekly" | "monthly" | "quarterly" | "yearly";
|
|
170
170
|
intervalCount: number;
|
|
@@ -241,12 +241,12 @@ declare const subscriptionChargeSchema: z.ZodObject<{
|
|
|
241
241
|
updatedAt: z.ZodString;
|
|
242
242
|
}, "strip", z.ZodTypeAny, {
|
|
243
243
|
status: "failed" | "pending" | "in_flight" | "succeeded" | "retrying" | "abandoned";
|
|
244
|
-
|
|
244
|
+
amount: string;
|
|
245
|
+
currency: "USDC" | "EURC";
|
|
245
246
|
merchantId: string;
|
|
247
|
+
id: string;
|
|
246
248
|
createdAt: string;
|
|
247
|
-
currency: "USDC" | "EURC";
|
|
248
249
|
updatedAt: string;
|
|
249
|
-
amount: string;
|
|
250
250
|
onchainTxHash: string | null;
|
|
251
251
|
failureReason: string | null;
|
|
252
252
|
subscriptionId: string;
|
|
@@ -259,12 +259,12 @@ declare const subscriptionChargeSchema: z.ZodObject<{
|
|
|
259
259
|
executedAt: string | null;
|
|
260
260
|
}, {
|
|
261
261
|
status: "failed" | "pending" | "in_flight" | "succeeded" | "retrying" | "abandoned";
|
|
262
|
-
|
|
262
|
+
amount: string;
|
|
263
|
+
currency: "USDC" | "EURC";
|
|
263
264
|
merchantId: string;
|
|
265
|
+
id: string;
|
|
264
266
|
createdAt: string;
|
|
265
|
-
currency: "USDC" | "EURC";
|
|
266
267
|
updatedAt: string;
|
|
267
|
-
amount: string;
|
|
268
268
|
onchainTxHash: string | null;
|
|
269
269
|
failureReason: string | null;
|
|
270
270
|
subscriptionId: string;
|
package/dist/subscriptions.d.ts
CHANGED
|
@@ -48,34 +48,34 @@ declare const subscriptionPlanSchema: z.ZodObject<{
|
|
|
48
48
|
updatedAt: z.ZodString;
|
|
49
49
|
}, "strip", z.ZodTypeAny, {
|
|
50
50
|
status: "active" | "archived";
|
|
51
|
-
|
|
51
|
+
amount: string;
|
|
52
|
+
currency: "USDC" | "EURC";
|
|
52
53
|
merchantId: string;
|
|
53
|
-
name: string;
|
|
54
|
-
createdAt: string;
|
|
55
54
|
description: string | null;
|
|
56
|
-
|
|
55
|
+
id: string;
|
|
56
|
+
createdAt: string;
|
|
57
57
|
updatedAt: string;
|
|
58
58
|
chainMerchantId: string | null;
|
|
59
59
|
tokenAddress: string | null;
|
|
60
|
-
amount: string;
|
|
61
60
|
metadata: Record<string, string | number | boolean | null>;
|
|
62
61
|
intervalSeconds: number;
|
|
62
|
+
name: string;
|
|
63
63
|
interval: "daily" | "weekly" | "monthly" | "quarterly" | "yearly";
|
|
64
64
|
intervalCount: number;
|
|
65
65
|
trialPeriodDays: number | null;
|
|
66
66
|
}, {
|
|
67
67
|
status: "active" | "archived";
|
|
68
|
-
|
|
68
|
+
amount: string;
|
|
69
|
+
currency: "USDC" | "EURC";
|
|
69
70
|
merchantId: string;
|
|
70
|
-
name: string;
|
|
71
|
-
createdAt: string;
|
|
72
71
|
description: string | null;
|
|
73
|
-
|
|
72
|
+
id: string;
|
|
73
|
+
createdAt: string;
|
|
74
74
|
updatedAt: string;
|
|
75
75
|
chainMerchantId: string | null;
|
|
76
76
|
tokenAddress: string | null;
|
|
77
|
-
amount: string;
|
|
78
77
|
intervalSeconds: number;
|
|
78
|
+
name: string;
|
|
79
79
|
interval: "daily" | "weekly" | "monthly" | "quarterly" | "yearly";
|
|
80
80
|
intervalCount: number;
|
|
81
81
|
trialPeriodDays: number | null;
|
|
@@ -92,18 +92,18 @@ declare const createSubscriptionPlanInputSchema: z.ZodObject<{
|
|
|
92
92
|
trialPeriodDays: z.ZodOptional<z.ZodNumber>;
|
|
93
93
|
metadata: z.ZodOptional<z.ZodDefault<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>, Record<string, string | number | boolean | null>, Record<string, string | number | boolean | null>>>>;
|
|
94
94
|
}, "strip", z.ZodTypeAny, {
|
|
95
|
-
name: string;
|
|
96
|
-
currency: "USDC" | "EURC";
|
|
97
95
|
amount: string;
|
|
96
|
+
currency: "USDC" | "EURC";
|
|
97
|
+
name: string;
|
|
98
98
|
interval: "daily" | "weekly" | "monthly" | "quarterly" | "yearly";
|
|
99
99
|
intervalCount: number;
|
|
100
100
|
description?: string | undefined;
|
|
101
101
|
metadata?: Record<string, string | number | boolean | null> | undefined;
|
|
102
102
|
trialPeriodDays?: number | undefined;
|
|
103
103
|
}, {
|
|
104
|
-
name: string;
|
|
105
|
-
currency: "USDC" | "EURC";
|
|
106
104
|
amount: string;
|
|
105
|
+
currency: "USDC" | "EURC";
|
|
106
|
+
name: string;
|
|
107
107
|
interval: "daily" | "weekly" | "monthly" | "quarterly" | "yearly";
|
|
108
108
|
description?: string | undefined;
|
|
109
109
|
metadata?: Record<string, string | number | boolean | null> | undefined;
|
|
@@ -136,14 +136,14 @@ declare const subscriptionSchema: z.ZodObject<{
|
|
|
136
136
|
createdAt: z.ZodString;
|
|
137
137
|
updatedAt: z.ZodString;
|
|
138
138
|
}, "strip", z.ZodTypeAny, {
|
|
139
|
-
status: "cancelled" | "
|
|
140
|
-
|
|
139
|
+
status: "cancelled" | "trialing" | "active" | "at_risk" | "paused" | "lapsed";
|
|
140
|
+
amount: string;
|
|
141
|
+
currency: "USDC" | "EURC";
|
|
142
|
+
customerId: string;
|
|
141
143
|
merchantId: string;
|
|
144
|
+
id: string;
|
|
142
145
|
createdAt: string;
|
|
143
|
-
currency: "USDC" | "EURC";
|
|
144
146
|
updatedAt: string;
|
|
145
|
-
customerId: string;
|
|
146
|
-
amount: string;
|
|
147
147
|
metadata: Record<string, string | number | boolean | null>;
|
|
148
148
|
payerAddress: string;
|
|
149
149
|
interval: "daily" | "weekly" | "monthly" | "quarterly" | "yearly";
|
|
@@ -157,14 +157,14 @@ declare const subscriptionSchema: z.ZodObject<{
|
|
|
157
157
|
gracePeriodHours: number;
|
|
158
158
|
cancelledAt: string | null;
|
|
159
159
|
}, {
|
|
160
|
-
status: "cancelled" | "
|
|
161
|
-
|
|
160
|
+
status: "cancelled" | "trialing" | "active" | "at_risk" | "paused" | "lapsed";
|
|
161
|
+
amount: string;
|
|
162
|
+
currency: "USDC" | "EURC";
|
|
163
|
+
customerId: string;
|
|
162
164
|
merchantId: string;
|
|
165
|
+
id: string;
|
|
163
166
|
createdAt: string;
|
|
164
|
-
currency: "USDC" | "EURC";
|
|
165
167
|
updatedAt: string;
|
|
166
|
-
customerId: string;
|
|
167
|
-
amount: string;
|
|
168
168
|
payerAddress: string;
|
|
169
169
|
interval: "daily" | "weekly" | "monthly" | "quarterly" | "yearly";
|
|
170
170
|
intervalCount: number;
|
|
@@ -241,12 +241,12 @@ declare const subscriptionChargeSchema: z.ZodObject<{
|
|
|
241
241
|
updatedAt: z.ZodString;
|
|
242
242
|
}, "strip", z.ZodTypeAny, {
|
|
243
243
|
status: "failed" | "pending" | "in_flight" | "succeeded" | "retrying" | "abandoned";
|
|
244
|
-
|
|
244
|
+
amount: string;
|
|
245
|
+
currency: "USDC" | "EURC";
|
|
245
246
|
merchantId: string;
|
|
247
|
+
id: string;
|
|
246
248
|
createdAt: string;
|
|
247
|
-
currency: "USDC" | "EURC";
|
|
248
249
|
updatedAt: string;
|
|
249
|
-
amount: string;
|
|
250
250
|
onchainTxHash: string | null;
|
|
251
251
|
failureReason: string | null;
|
|
252
252
|
subscriptionId: string;
|
|
@@ -259,12 +259,12 @@ declare const subscriptionChargeSchema: z.ZodObject<{
|
|
|
259
259
|
executedAt: string | null;
|
|
260
260
|
}, {
|
|
261
261
|
status: "failed" | "pending" | "in_flight" | "succeeded" | "retrying" | "abandoned";
|
|
262
|
-
|
|
262
|
+
amount: string;
|
|
263
|
+
currency: "USDC" | "EURC";
|
|
263
264
|
merchantId: string;
|
|
265
|
+
id: string;
|
|
264
266
|
createdAt: string;
|
|
265
|
-
currency: "USDC" | "EURC";
|
|
266
267
|
updatedAt: string;
|
|
267
|
-
amount: string;
|
|
268
268
|
onchainTxHash: string | null;
|
|
269
269
|
failureReason: string | null;
|
|
270
270
|
subscriptionId: string;
|
package/dist/transactions.d.cts
CHANGED
|
@@ -34,19 +34,19 @@ declare const transactionSchema: z.ZodObject<{
|
|
|
34
34
|
createdAt: z.ZodString;
|
|
35
35
|
}, "strip", z.ZodTypeAny, {
|
|
36
36
|
status: "confirmed" | "failed" | "pending";
|
|
37
|
-
|
|
38
|
-
merchantId: string;
|
|
39
|
-
kind: "refund" | "one_shot" | "subscription_charge" | "invoice_payment" | "storefront_purchase";
|
|
40
|
-
createdAt: string;
|
|
37
|
+
amount: string;
|
|
41
38
|
currency: "USDC" | "EURC";
|
|
42
|
-
sessionId: string | null;
|
|
43
39
|
customerId: string | null;
|
|
44
|
-
|
|
40
|
+
merchantId: string;
|
|
41
|
+
id: string;
|
|
42
|
+
sessionId: string | null;
|
|
43
|
+
createdAt: string;
|
|
45
44
|
feeAmount: string;
|
|
46
45
|
netAmount: string;
|
|
47
46
|
onchainTxHash: string;
|
|
48
47
|
payerAddress: string;
|
|
49
48
|
subscriptionId: string | null;
|
|
49
|
+
kind: "refund" | "one_shot" | "subscription_charge" | "invoice_payment" | "storefront_purchase";
|
|
50
50
|
subscriptionChargeId: string | null;
|
|
51
51
|
refundId: string | null;
|
|
52
52
|
merchantAddress: string;
|
|
@@ -54,19 +54,19 @@ declare const transactionSchema: z.ZodObject<{
|
|
|
54
54
|
blockTimestamp: string;
|
|
55
55
|
}, {
|
|
56
56
|
status: "confirmed" | "failed" | "pending";
|
|
57
|
-
|
|
58
|
-
merchantId: string;
|
|
59
|
-
kind: "refund" | "one_shot" | "subscription_charge" | "invoice_payment" | "storefront_purchase";
|
|
60
|
-
createdAt: string;
|
|
57
|
+
amount: string;
|
|
61
58
|
currency: "USDC" | "EURC";
|
|
62
|
-
sessionId: string | null;
|
|
63
59
|
customerId: string | null;
|
|
64
|
-
|
|
60
|
+
merchantId: string;
|
|
61
|
+
id: string;
|
|
62
|
+
sessionId: string | null;
|
|
63
|
+
createdAt: string;
|
|
65
64
|
feeAmount: string;
|
|
66
65
|
netAmount: string;
|
|
67
66
|
onchainTxHash: string;
|
|
68
67
|
payerAddress: string;
|
|
69
68
|
subscriptionId: string | null;
|
|
69
|
+
kind: "refund" | "one_shot" | "subscription_charge" | "invoice_payment" | "storefront_purchase";
|
|
70
70
|
subscriptionChargeId: string | null;
|
|
71
71
|
refundId: string | null;
|
|
72
72
|
merchantAddress: string;
|
package/dist/transactions.d.ts
CHANGED
|
@@ -34,19 +34,19 @@ declare const transactionSchema: z.ZodObject<{
|
|
|
34
34
|
createdAt: z.ZodString;
|
|
35
35
|
}, "strip", z.ZodTypeAny, {
|
|
36
36
|
status: "confirmed" | "failed" | "pending";
|
|
37
|
-
|
|
38
|
-
merchantId: string;
|
|
39
|
-
kind: "refund" | "one_shot" | "subscription_charge" | "invoice_payment" | "storefront_purchase";
|
|
40
|
-
createdAt: string;
|
|
37
|
+
amount: string;
|
|
41
38
|
currency: "USDC" | "EURC";
|
|
42
|
-
sessionId: string | null;
|
|
43
39
|
customerId: string | null;
|
|
44
|
-
|
|
40
|
+
merchantId: string;
|
|
41
|
+
id: string;
|
|
42
|
+
sessionId: string | null;
|
|
43
|
+
createdAt: string;
|
|
45
44
|
feeAmount: string;
|
|
46
45
|
netAmount: string;
|
|
47
46
|
onchainTxHash: string;
|
|
48
47
|
payerAddress: string;
|
|
49
48
|
subscriptionId: string | null;
|
|
49
|
+
kind: "refund" | "one_shot" | "subscription_charge" | "invoice_payment" | "storefront_purchase";
|
|
50
50
|
subscriptionChargeId: string | null;
|
|
51
51
|
refundId: string | null;
|
|
52
52
|
merchantAddress: string;
|
|
@@ -54,19 +54,19 @@ declare const transactionSchema: z.ZodObject<{
|
|
|
54
54
|
blockTimestamp: string;
|
|
55
55
|
}, {
|
|
56
56
|
status: "confirmed" | "failed" | "pending";
|
|
57
|
-
|
|
58
|
-
merchantId: string;
|
|
59
|
-
kind: "refund" | "one_shot" | "subscription_charge" | "invoice_payment" | "storefront_purchase";
|
|
60
|
-
createdAt: string;
|
|
57
|
+
amount: string;
|
|
61
58
|
currency: "USDC" | "EURC";
|
|
62
|
-
sessionId: string | null;
|
|
63
59
|
customerId: string | null;
|
|
64
|
-
|
|
60
|
+
merchantId: string;
|
|
61
|
+
id: string;
|
|
62
|
+
sessionId: string | null;
|
|
63
|
+
createdAt: string;
|
|
65
64
|
feeAmount: string;
|
|
66
65
|
netAmount: string;
|
|
67
66
|
onchainTxHash: string;
|
|
68
67
|
payerAddress: string;
|
|
69
68
|
subscriptionId: string | null;
|
|
69
|
+
kind: "refund" | "one_shot" | "subscription_charge" | "invoice_payment" | "storefront_purchase";
|
|
70
70
|
subscriptionChargeId: string | null;
|
|
71
71
|
refundId: string | null;
|
|
72
72
|
merchantAddress: string;
|
package/dist/webhooks.cjs
CHANGED
|
@@ -38,16 +38,13 @@ var webhookEventNameSchema = zod.z.enum([
|
|
|
38
38
|
"subscription.charged",
|
|
39
39
|
"subscription.charge_failed",
|
|
40
40
|
"subscription.recovery_attempt",
|
|
41
|
-
"subscription.recovery_outcome",
|
|
42
41
|
"subscription.cancelled",
|
|
43
42
|
"subscription.lapsed",
|
|
44
43
|
"refund.created",
|
|
45
44
|
"refund.completed",
|
|
46
|
-
"refund.failed",
|
|
47
45
|
"invoice.created",
|
|
48
46
|
"invoice.paid",
|
|
49
47
|
"invoice.overdue",
|
|
50
|
-
"agent.action_executed",
|
|
51
48
|
"agent.job_proposed",
|
|
52
49
|
"agent.job_completed",
|
|
53
50
|
"agent.job_disputed",
|
package/dist/webhooks.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/common.ts","../src/webhooks.ts"],"names":["z"],"mappings":";;;;;AAQO,IAAM,QAAA,GAAWA,KAAA,CACrB,MAAA,EAAO,CACP,GAAA,CAAI,CAAC,CAAA,CACL,GAAA,CAAI,EAAE,CAAA,CACN,KAAA,CAAM,kBAAA,EAAoB,qBAAqB,CAAA;AAGlBA,KAAA,CAC7B,MAAA,EAAO,CACP,KAAA,CAAM,qBAAA,EAAuB,oDAAoD,CAAA,CACjF,SAAA,CAAU,CAAC,CAAA,KAAM,CAAA,CAAE,aAAa;AAGJA,KAAA,CAC5B,MAAA,EAAO,CACP,KAAA,CAAM,uBAAuB,6DAA6D;AAGlEA,KAAA,CAAE,MAAA,EAAO,CAAE,KAAA,EAAM,CAAE,IAAA,EAAK,CAAE,WAAA,EAAY,CAAE,GAAA,CAAI,GAAG;AAGnE,IAAM,cAAA,GAAiBA,KAAA,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;AAG0BA,KAAA,CAAE,MAAA,EAAO,CAAE,GAAA;AAOPA,KAAA,CAC9B,MAAA,EAAO,CACP,KAAA,CAAM,YAAY,iDAAiD;AAG5CA,KAAA,CAAE,MAAA,EAAO,CAAE,GAAA,EAAI,CAAE,GAAA,CAAI,CAAC,CAAA,CAAE,GAAA,CAAI,MAAA,CAAO,gBAAgB;AAGtE,IAAM,kBAAA,GAAqBA,KAAA,CAC/B,MAAA,EAAO,CACP,QAAA,CAAS,EAAE,MAAA,EAAQ,IAAA,EAAM,OAAA,EAAS,+BAAA,EAAiC,CAAA;AAGrCA,MAC9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AA,EAAcA,KAAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,EAClC,cAAA,EAAgBA,MAAE,MAAA,CAAOA,KAAAA,CAAE,QAAO,EAAGA,KAAAA,CAAE,SAAS;AAClD,CAAC;AAGM,IAAM,yBAAA,GAA4BA,MAAE,MAAA,CAAO;AAAA,EAChD,EAAA,EAAI;AACN,CAAC","file":"webhooks.cjs","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.recovery_outcome',\n 'subscription.cancelled',\n 'subscription.lapsed',\n 'refund.created',\n 'refund.completed',\n 'refund.failed',\n 'invoice.created',\n 'invoice.paid',\n 'invoice.overdue',\n 'agent.action_executed',\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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AA,CAAO;AAAA,EAChD,EAAA,EAAI;AACN,CAAC","file":"webhooks.cjs","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 '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"]}
|