@strimz/shared-types 0.1.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/LICENSE +21 -0
- package/README.md +69 -0
- package/dist/agents.cjs +148 -0
- package/dist/agents.cjs.map +1 -0
- package/dist/agents.d.cts +317 -0
- package/dist/agents.d.ts +317 -0
- package/dist/agents.js +137 -0
- package/dist/agents.js.map +1 -0
- package/dist/api-keys.cjs +91 -0
- package/dist/api-keys.cjs.map +1 -0
- package/dist/api-keys.d.cts +155 -0
- package/dist/api-keys.d.ts +155 -0
- package/dist/api-keys.js +84 -0
- package/dist/api-keys.js.map +1 -0
- package/dist/common.cjs +56 -0
- package/dist/common.cjs.map +1 -0
- package/dist/common.d.cts +82 -0
- package/dist/common.d.ts +82 -0
- package/dist/common.js +37 -0
- package/dist/common.js.map +1 -0
- package/dist/compliance.cjs +61 -0
- package/dist/compliance.cjs.map +1 -0
- package/dist/compliance.d.cts +59 -0
- package/dist/compliance.d.ts +59 -0
- package/dist/compliance.js +56 -0
- package/dist/compliance.js.map +1 -0
- package/dist/customers.cjs +56 -0
- package/dist/customers.cjs.map +1 -0
- package/dist/customers.d.cts +64 -0
- package/dist/customers.d.ts +64 -0
- package/dist/customers.js +53 -0
- package/dist/customers.js.map +1 -0
- package/dist/events.cjs +675 -0
- package/dist/events.cjs.map +1 -0
- package/dist/events.d.cts +7907 -0
- package/dist/events.d.ts +7907 -0
- package/dist/events.js +650 -0
- package/dist/events.js.map +1 -0
- package/dist/index.cjs +976 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +113 -0
- package/dist/index.d.ts +113 -0
- package/dist/index.js +858 -0
- package/dist/index.js.map +1 -0
- package/dist/invoices.cjs +72 -0
- package/dist/invoices.cjs.map +1 -0
- package/dist/invoices.d.cts +159 -0
- package/dist/invoices.d.ts +159 -0
- package/dist/invoices.js +67 -0
- package/dist/invoices.js.map +1 -0
- package/dist/merchants.cjs +104 -0
- package/dist/merchants.cjs.map +1 -0
- package/dist/merchants.d.cts +259 -0
- package/dist/merchants.d.ts +259 -0
- package/dist/merchants.js +93 -0
- package/dist/merchants.js.map +1 -0
- package/dist/payment-sessions.cjs +125 -0
- package/dist/payment-sessions.cjs.map +1 -0
- package/dist/payment-sessions.d.cts +180 -0
- package/dist/payment-sessions.d.ts +180 -0
- package/dist/payment-sessions.js +120 -0
- package/dist/payment-sessions.js.map +1 -0
- package/dist/refunds.cjs +81 -0
- package/dist/refunds.cjs.map +1 -0
- package/dist/refunds.d.cts +91 -0
- package/dist/refunds.d.ts +91 -0
- package/dist/refunds.js +75 -0
- package/dist/refunds.js.map +1 -0
- package/dist/storefronts.cjs +223 -0
- package/dist/storefronts.cjs.map +1 -0
- package/dist/storefronts.d.cts +177 -0
- package/dist/storefronts.d.ts +177 -0
- package/dist/storefronts.js +216 -0
- package/dist/storefronts.js.map +1 -0
- package/dist/subscriptions.cjs +175 -0
- package/dist/subscriptions.cjs.map +1 -0
- package/dist/subscriptions.d.cts +290 -0
- package/dist/subscriptions.d.ts +290 -0
- package/dist/subscriptions.js +163 -0
- package/dist/subscriptions.js.map +1 -0
- package/dist/transactions.cjs +67 -0
- package/dist/transactions.cjs.map +1 -0
- package/dist/transactions.d.cts +78 -0
- package/dist/transactions.d.ts +78 -0
- package/dist/transactions.js +63 -0
- package/dist/transactions.js.map +1 -0
- package/dist/webhooks.cjs +116 -0
- package/dist/webhooks.cjs.map +1 -0
- package/dist/webhooks.d.cts +201 -0
- package/dist/webhooks.d.ts +201 -0
- package/dist/webhooks.js +107 -0
- package/dist/webhooks.js.map +1 -0
- package/package.json +134 -0
- package/src/agents.ts +149 -0
- package/src/api-keys.ts +78 -0
- package/src/common.ts +113 -0
- package/src/compliance.ts +40 -0
- package/src/customers.ts +40 -0
- package/src/events.ts +176 -0
- package/src/index.ts +23 -0
- package/src/invoices.ts +53 -0
- package/src/merchants.ts +104 -0
- package/src/payment-sessions.ts +131 -0
- package/src/refunds.ts +68 -0
- package/src/storefronts.ts +89 -0
- package/src/subscriptions.ts +180 -0
- package/src/tokens.ts +60 -0
- package/src/transactions.ts +52 -0
- package/src/webhooks.ts +109 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,976 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var zod = require('zod');
|
|
4
|
+
|
|
5
|
+
// src/common.ts
|
|
6
|
+
var idSchema = zod.z.string().min(1).max(64).regex(/^[a-zA-Z0-9_-]+$/, "id must be URL-safe");
|
|
7
|
+
var evmAddressSchema = zod.z.string().regex(/^0x[a-fA-F0-9]{40}$/, "must be a 0x-prefixed 40-character hex EVM address").transform((v) => v.toLowerCase());
|
|
8
|
+
var evmTxHashSchema = zod.z.string().regex(/^0x[a-fA-F0-9]{64}$/, "must be a 0x-prefixed 64-character hex EVM transaction hash");
|
|
9
|
+
var emailSchema = zod.z.string().email().trim().toLowerCase().max(320);
|
|
10
|
+
var httpsUrlSchema = zod.z.string().url().refine((v) => v.startsWith("https://"), {
|
|
11
|
+
message: "must be an https:// URL"
|
|
12
|
+
});
|
|
13
|
+
var httpUrlSchema = zod.z.string().url();
|
|
14
|
+
var tokenAmountSchema = zod.z.string().regex(/^[0-9]+$/, "must be a non-negative integer string (base-10)").refine((v) => BigInt(v) >= 0n, "must be >= 0");
|
|
15
|
+
var uintSchema = zod.z.number().int().min(0).max(Number.MAX_SAFE_INTEGER);
|
|
16
|
+
var isoTimestampSchema = zod.z.string().datetime({ offset: true, message: "must be an ISO-8601 timestamp" });
|
|
17
|
+
var countryCodeSchema = zod.z.string().length(2).regex(/^[A-Z]{2}$/, "must be an ISO-3166 alpha-2 country code");
|
|
18
|
+
var paginationInputSchema = zod.z.object({
|
|
19
|
+
limit: zod.z.number().int().min(1).max(100).default(25),
|
|
20
|
+
cursor: zod.z.string().min(1).max(200).nullish()
|
|
21
|
+
});
|
|
22
|
+
var makePaginatedSchema = (item) => zod.z.object({
|
|
23
|
+
data: zod.z.array(item),
|
|
24
|
+
nextCursor: zod.z.string().nullable(),
|
|
25
|
+
hasMore: zod.z.boolean()
|
|
26
|
+
});
|
|
27
|
+
var metadataSchema = zod.z.record(
|
|
28
|
+
zod.z.string().min(1).max(40),
|
|
29
|
+
zod.z.union([zod.z.string().max(500), zod.z.number(), zod.z.boolean(), zod.z.null()])
|
|
30
|
+
).refine((m) => Object.keys(m).length <= 50, "at most 50 metadata keys").default({});
|
|
31
|
+
var modeSchema = zod.z.enum(["test", "live"]);
|
|
32
|
+
var paymentCurrencySchema = zod.z.enum(["USDC", "EURC"]);
|
|
33
|
+
var tokenSymbolSchema = zod.z.enum(["USDC", "EURC", "USYC"]);
|
|
34
|
+
var merchantTierSchema = zod.z.enum(["free", "growth", "business", "enterprise"]);
|
|
35
|
+
var arcEnvironmentSchema = zod.z.enum(["testnet", "mainnet"]);
|
|
36
|
+
var merchantStatusSchema = zod.z.enum(["active", "suspended", "closed"]);
|
|
37
|
+
var merchantRoleSchema = zod.z.enum(["owner", "admin", "developer", "read_only"]);
|
|
38
|
+
var merchantSchema = zod.z.object({
|
|
39
|
+
id: idSchema,
|
|
40
|
+
onchainMerchantId: zod.z.number().int().nonnegative().nullable(),
|
|
41
|
+
businessName: zod.z.string().min(2).max(120),
|
|
42
|
+
email: emailSchema,
|
|
43
|
+
tier: merchantTierSchema,
|
|
44
|
+
status: merchantStatusSchema,
|
|
45
|
+
payoutAddress: evmAddressSchema.nullable(),
|
|
46
|
+
defaultCurrency: zod.z.enum(["USDC", "EURC"]),
|
|
47
|
+
countryCode: zod.z.string().length(2).nullable(),
|
|
48
|
+
websiteUrl: zod.z.string().url().nullable(),
|
|
49
|
+
logoUrl: zod.z.string().url().nullable(),
|
|
50
|
+
whitelabelEnabled: zod.z.boolean(),
|
|
51
|
+
metadata: metadataSchema,
|
|
52
|
+
createdAt: isoTimestampSchema,
|
|
53
|
+
updatedAt: isoTimestampSchema
|
|
54
|
+
});
|
|
55
|
+
var createMerchantInputSchema = zod.z.object({
|
|
56
|
+
businessName: zod.z.string().min(2).max(120),
|
|
57
|
+
email: emailSchema,
|
|
58
|
+
password: zod.z.string().min(12).max(128),
|
|
59
|
+
countryCode: zod.z.string().length(2).optional(),
|
|
60
|
+
websiteUrl: zod.z.string().url().optional()
|
|
61
|
+
});
|
|
62
|
+
var updateMerchantInputSchema = zod.z.object({
|
|
63
|
+
businessName: zod.z.string().min(2).max(120),
|
|
64
|
+
payoutAddress: evmAddressSchema,
|
|
65
|
+
defaultCurrency: zod.z.enum(["USDC", "EURC"]),
|
|
66
|
+
websiteUrl: zod.z.string().url().nullable(),
|
|
67
|
+
logoUrl: zod.z.string().url().nullable(),
|
|
68
|
+
countryCode: zod.z.string().length(2).nullable(),
|
|
69
|
+
metadata: metadataSchema
|
|
70
|
+
}).partial();
|
|
71
|
+
var changeTierInputSchema = zod.z.object({
|
|
72
|
+
tier: merchantTierSchema
|
|
73
|
+
});
|
|
74
|
+
var merchantMemberSchema = zod.z.object({
|
|
75
|
+
id: idSchema,
|
|
76
|
+
merchantId: idSchema,
|
|
77
|
+
email: emailSchema,
|
|
78
|
+
role: merchantRoleSchema,
|
|
79
|
+
invitedAt: isoTimestampSchema,
|
|
80
|
+
acceptedAt: isoTimestampSchema.nullable()
|
|
81
|
+
});
|
|
82
|
+
var inviteMemberInputSchema = zod.z.object({
|
|
83
|
+
email: emailSchema,
|
|
84
|
+
role: merchantRoleSchema
|
|
85
|
+
});
|
|
86
|
+
var loginInputSchema = zod.z.object({
|
|
87
|
+
email: emailSchema,
|
|
88
|
+
password: zod.z.string().min(1).max(128)
|
|
89
|
+
});
|
|
90
|
+
var loginOutputSchema = zod.z.object({
|
|
91
|
+
accessToken: zod.z.string(),
|
|
92
|
+
refreshToken: zod.z.string(),
|
|
93
|
+
merchant: merchantSchema
|
|
94
|
+
});
|
|
95
|
+
var apiKeyKindSchema = zod.z.enum(["secret", "publishable"]);
|
|
96
|
+
var apiKeyScopeSchema = zod.z.enum([
|
|
97
|
+
"sessions_read",
|
|
98
|
+
"sessions_write",
|
|
99
|
+
"subscriptions_read",
|
|
100
|
+
"subscriptions_write",
|
|
101
|
+
"refunds_read",
|
|
102
|
+
"refunds_write",
|
|
103
|
+
"transactions_read",
|
|
104
|
+
"webhooks_read",
|
|
105
|
+
"webhooks_write",
|
|
106
|
+
"invoices_read",
|
|
107
|
+
"invoices_write",
|
|
108
|
+
"storefronts_read",
|
|
109
|
+
"storefronts_write",
|
|
110
|
+
"agents_read",
|
|
111
|
+
"agents_write",
|
|
112
|
+
// Meta-tx relayer — submitting payer-signed EIP-3009 / EIP-2612
|
|
113
|
+
// authorizations on the merchant's behalf. Granted to keys used by
|
|
114
|
+
// hosted checkout and merchants embedding the SDK.
|
|
115
|
+
"relay_read",
|
|
116
|
+
"relay_write"
|
|
117
|
+
]);
|
|
118
|
+
var apiKeySchema = zod.z.object({
|
|
119
|
+
id: idSchema,
|
|
120
|
+
merchantId: idSchema,
|
|
121
|
+
name: zod.z.string().min(1).max(60),
|
|
122
|
+
kind: apiKeyKindSchema,
|
|
123
|
+
mode: modeSchema,
|
|
124
|
+
prefix: zod.z.string().min(8).max(24),
|
|
125
|
+
lastFour: zod.z.string().length(4),
|
|
126
|
+
scopes: zod.z.array(apiKeyScopeSchema).nonempty(),
|
|
127
|
+
createdAt: isoTimestampSchema,
|
|
128
|
+
lastUsedAt: isoTimestampSchema.nullable(),
|
|
129
|
+
revokedAt: isoTimestampSchema.nullable()
|
|
130
|
+
});
|
|
131
|
+
var createApiKeyInputSchema = zod.z.object({
|
|
132
|
+
name: zod.z.string().min(1).max(60),
|
|
133
|
+
kind: apiKeyKindSchema,
|
|
134
|
+
mode: modeSchema,
|
|
135
|
+
scopes: zod.z.array(apiKeyScopeSchema).nonempty()
|
|
136
|
+
});
|
|
137
|
+
var createApiKeyOutputSchema = zod.z.object({
|
|
138
|
+
apiKey: apiKeySchema,
|
|
139
|
+
/** Full plaintext key — shown exactly once. */
|
|
140
|
+
secret: zod.z.string()
|
|
141
|
+
});
|
|
142
|
+
var rotateApiKeyInputSchema = zod.z.object({
|
|
143
|
+
id: idSchema
|
|
144
|
+
});
|
|
145
|
+
var customerSchema = zod.z.object({
|
|
146
|
+
id: idSchema,
|
|
147
|
+
merchantId: idSchema,
|
|
148
|
+
walletAddress: evmAddressSchema,
|
|
149
|
+
email: emailSchema.nullable(),
|
|
150
|
+
/** Merchant-provided external identifier (e.g. their own user id). */
|
|
151
|
+
externalRef: zod.z.string().min(1).max(120).nullable(),
|
|
152
|
+
displayName: zod.z.string().min(1).max(120).nullable(),
|
|
153
|
+
metadata: metadataSchema,
|
|
154
|
+
firstSeenAt: isoTimestampSchema,
|
|
155
|
+
lastSeenAt: isoTimestampSchema
|
|
156
|
+
});
|
|
157
|
+
var upsertCustomerInputSchema = zod.z.object({
|
|
158
|
+
walletAddress: evmAddressSchema,
|
|
159
|
+
email: emailSchema.optional(),
|
|
160
|
+
externalRef: zod.z.string().min(1).max(120).optional(),
|
|
161
|
+
displayName: zod.z.string().min(1).max(120).optional(),
|
|
162
|
+
metadata: metadataSchema.optional()
|
|
163
|
+
});
|
|
164
|
+
var paymentSessionStatusSchema = zod.z.enum([
|
|
165
|
+
"created",
|
|
166
|
+
"awaiting_payment",
|
|
167
|
+
"submitted",
|
|
168
|
+
"confirmed",
|
|
169
|
+
"failed",
|
|
170
|
+
"expired",
|
|
171
|
+
"cancelled"
|
|
172
|
+
]);
|
|
173
|
+
var paymentSessionSchema = zod.z.object({
|
|
174
|
+
id: idSchema,
|
|
175
|
+
merchantId: idSchema,
|
|
176
|
+
/**
|
|
177
|
+
* On-chain StrimzRegistry merchant id (uint96) as a decimal string.
|
|
178
|
+
* Set when the merchant has been registered on-chain; null when the
|
|
179
|
+
* merchant exists in our DB but the registry transaction hasn't
|
|
180
|
+
* been broadcast yet. Hosted checkout uses this to populate the
|
|
181
|
+
* meta-tx calldata; if null, the checkout refuses to accept
|
|
182
|
+
* payments.
|
|
183
|
+
*/
|
|
184
|
+
chainMerchantId: zod.z.string().regex(/^[0-9]+$/u, "must be a non-negative decimal integer string").nullable(),
|
|
185
|
+
/**
|
|
186
|
+
* ERC-20 token contract address resolved from `currency` on the
|
|
187
|
+
* active chain (Arc Testnet / Mainnet). Used as the `verifyingContract`
|
|
188
|
+
* in the EIP-712 domain for both EIP-3009 and EIP-2612 signing.
|
|
189
|
+
* Null on the (vanishingly unlikely) path where the API has no
|
|
190
|
+
* configured address for the session's currency.
|
|
191
|
+
*/
|
|
192
|
+
tokenAddress: evmAddressSchema.nullable(),
|
|
193
|
+
customerId: idSchema.nullable(),
|
|
194
|
+
status: paymentSessionStatusSchema,
|
|
195
|
+
amount: tokenAmountSchema,
|
|
196
|
+
currency: paymentCurrencySchema,
|
|
197
|
+
feeAmount: tokenAmountSchema,
|
|
198
|
+
netAmount: tokenAmountSchema,
|
|
199
|
+
description: zod.z.string().max(500).nullable(),
|
|
200
|
+
payerWalletAddress: evmAddressSchema.nullable(),
|
|
201
|
+
payerEmail: zod.z.string().email().nullable(),
|
|
202
|
+
successUrl: zod.z.string().url().nullable(),
|
|
203
|
+
cancelUrl: zod.z.string().url().nullable(),
|
|
204
|
+
sourceChain: zod.z.enum(["arc", "ethereum", "base", "polygon", "arbitrum", "optimism", "avalanche", "solana"]).nullable(),
|
|
205
|
+
bridgeTxHash: evmTxHashSchema.nullable(),
|
|
206
|
+
onchainTxHash: evmTxHashSchema.nullable(),
|
|
207
|
+
checkoutUrl: zod.z.string().url(),
|
|
208
|
+
metadata: metadataSchema,
|
|
209
|
+
expiresAt: isoTimestampSchema,
|
|
210
|
+
createdAt: isoTimestampSchema,
|
|
211
|
+
updatedAt: isoTimestampSchema
|
|
212
|
+
});
|
|
213
|
+
var createPaymentSessionInputSchema = zod.z.object({
|
|
214
|
+
amount: tokenAmountSchema,
|
|
215
|
+
currency: paymentCurrencySchema,
|
|
216
|
+
description: zod.z.string().max(500).optional(),
|
|
217
|
+
customer: zod.z.object({
|
|
218
|
+
walletAddress: evmAddressSchema.optional(),
|
|
219
|
+
email: zod.z.string().email().optional(),
|
|
220
|
+
externalRef: zod.z.string().max(120).optional()
|
|
221
|
+
}).optional(),
|
|
222
|
+
successUrl: zod.z.string().url().optional(),
|
|
223
|
+
cancelUrl: zod.z.string().url().optional(),
|
|
224
|
+
/** Minutes until the session expires. Default 30, max 60*24 (one day). */
|
|
225
|
+
expiresInMinutes: zod.z.number().int().min(1).max(60 * 24).default(30),
|
|
226
|
+
/**
|
|
227
|
+
* Allowed source chains a payer can bridge USDC from via CCTP. Omit to
|
|
228
|
+
* accept every CCTP-supported chain.
|
|
229
|
+
*/
|
|
230
|
+
supportedSourceChains: zod.z.array(
|
|
231
|
+
zod.z.enum(["arc", "ethereum", "base", "polygon", "arbitrum", "optimism", "avalanche", "solana"])
|
|
232
|
+
).optional(),
|
|
233
|
+
metadata: metadataSchema.optional()
|
|
234
|
+
});
|
|
235
|
+
var submitPaymentSessionInputSchema = zod.z.object({
|
|
236
|
+
sourceChain: zod.z.enum([
|
|
237
|
+
"arc",
|
|
238
|
+
"ethereum",
|
|
239
|
+
"base",
|
|
240
|
+
"polygon",
|
|
241
|
+
"arbitrum",
|
|
242
|
+
"optimism",
|
|
243
|
+
"avalanche",
|
|
244
|
+
"solana"
|
|
245
|
+
]),
|
|
246
|
+
onchainTxHash: evmTxHashSchema,
|
|
247
|
+
bridgeTxHash: evmTxHashSchema.optional(),
|
|
248
|
+
payerWalletAddress: evmAddressSchema
|
|
249
|
+
});
|
|
250
|
+
var transactionKindSchema = zod.z.enum([
|
|
251
|
+
"one_shot",
|
|
252
|
+
"subscription_charge",
|
|
253
|
+
"refund",
|
|
254
|
+
"invoice_payment",
|
|
255
|
+
"storefront_purchase"
|
|
256
|
+
]);
|
|
257
|
+
var transactionStatusSchema = zod.z.enum(["pending", "confirmed", "failed"]);
|
|
258
|
+
var transactionSchema = zod.z.object({
|
|
259
|
+
id: idSchema,
|
|
260
|
+
merchantId: idSchema,
|
|
261
|
+
kind: transactionKindSchema,
|
|
262
|
+
status: transactionStatusSchema,
|
|
263
|
+
sessionId: idSchema.nullable(),
|
|
264
|
+
subscriptionId: idSchema.nullable(),
|
|
265
|
+
subscriptionChargeId: idSchema.nullable(),
|
|
266
|
+
refundId: idSchema.nullable(),
|
|
267
|
+
customerId: idSchema.nullable(),
|
|
268
|
+
amount: tokenAmountSchema,
|
|
269
|
+
feeAmount: tokenAmountSchema,
|
|
270
|
+
netAmount: tokenAmountSchema,
|
|
271
|
+
currency: paymentCurrencySchema,
|
|
272
|
+
payerAddress: evmAddressSchema,
|
|
273
|
+
merchantAddress: evmAddressSchema,
|
|
274
|
+
onchainTxHash: evmTxHashSchema,
|
|
275
|
+
blockNumber: zod.z.number().int().nonnegative(),
|
|
276
|
+
blockTimestamp: isoTimestampSchema,
|
|
277
|
+
createdAt: isoTimestampSchema
|
|
278
|
+
});
|
|
279
|
+
var subscriptionIntervalSchema = zod.z.enum([
|
|
280
|
+
"daily",
|
|
281
|
+
"weekly",
|
|
282
|
+
"monthly",
|
|
283
|
+
"quarterly",
|
|
284
|
+
"yearly"
|
|
285
|
+
]);
|
|
286
|
+
var subscriptionPlanStatusSchema = zod.z.enum(["active", "archived"]);
|
|
287
|
+
var subscriptionPlanSchema = zod.z.object({
|
|
288
|
+
id: idSchema,
|
|
289
|
+
merchantId: idSchema,
|
|
290
|
+
/**
|
|
291
|
+
* On-chain StrimzRegistry merchant id (uint96) as a decimal string.
|
|
292
|
+
* See `paymentSessionSchema.chainMerchantId`. Null when the merchant
|
|
293
|
+
* hasn't been registered on-chain yet — the hosted enrolment page
|
|
294
|
+
* refuses to take signatures in that state.
|
|
295
|
+
*/
|
|
296
|
+
chainMerchantId: zod.z.string().regex(/^[0-9]+$/u, "must be a non-negative decimal integer string").nullable(),
|
|
297
|
+
/**
|
|
298
|
+
* ERC-20 token contract address resolved from `currency` — the
|
|
299
|
+
* EIP-2612 `verifyingContract` the wallet signs over.
|
|
300
|
+
*/
|
|
301
|
+
tokenAddress: evmAddressSchema.nullable(),
|
|
302
|
+
/**
|
|
303
|
+
* Charge cadence in seconds, derived from `interval` + `intervalCount`
|
|
304
|
+
* so the meta-tx layer can pass a uint32 to StrimzSubscriptions
|
|
305
|
+
* without re-deriving the conversion on the client.
|
|
306
|
+
*/
|
|
307
|
+
intervalSeconds: zod.z.number().int().positive(),
|
|
308
|
+
name: zod.z.string().min(1).max(120),
|
|
309
|
+
description: zod.z.string().max(500).nullable(),
|
|
310
|
+
amount: tokenAmountSchema,
|
|
311
|
+
currency: paymentCurrencySchema,
|
|
312
|
+
interval: subscriptionIntervalSchema,
|
|
313
|
+
intervalCount: zod.z.number().int().min(1).max(365),
|
|
314
|
+
trialPeriodDays: zod.z.number().int().min(0).max(365).nullable(),
|
|
315
|
+
status: subscriptionPlanStatusSchema,
|
|
316
|
+
metadata: metadataSchema,
|
|
317
|
+
createdAt: isoTimestampSchema,
|
|
318
|
+
updatedAt: isoTimestampSchema
|
|
319
|
+
});
|
|
320
|
+
var createSubscriptionPlanInputSchema = zod.z.object({
|
|
321
|
+
name: zod.z.string().min(1).max(120),
|
|
322
|
+
description: zod.z.string().max(500).optional(),
|
|
323
|
+
amount: tokenAmountSchema,
|
|
324
|
+
currency: paymentCurrencySchema,
|
|
325
|
+
interval: subscriptionIntervalSchema,
|
|
326
|
+
intervalCount: zod.z.number().int().min(1).max(365).default(1),
|
|
327
|
+
trialPeriodDays: zod.z.number().int().min(0).max(365).optional(),
|
|
328
|
+
metadata: metadataSchema.optional()
|
|
329
|
+
});
|
|
330
|
+
var subscriptionStatusSchema = zod.z.enum([
|
|
331
|
+
"trialing",
|
|
332
|
+
"active",
|
|
333
|
+
"at_risk",
|
|
334
|
+
"paused",
|
|
335
|
+
"cancelled",
|
|
336
|
+
"lapsed"
|
|
337
|
+
]);
|
|
338
|
+
var subscriptionSchema = zod.z.object({
|
|
339
|
+
id: idSchema,
|
|
340
|
+
onchainSubscriptionId: zod.z.number().int().nonnegative().nullable(),
|
|
341
|
+
merchantId: idSchema,
|
|
342
|
+
customerId: idSchema,
|
|
343
|
+
planId: idSchema,
|
|
344
|
+
status: subscriptionStatusSchema,
|
|
345
|
+
payerAddress: evmAddressSchema,
|
|
346
|
+
currency: paymentCurrencySchema,
|
|
347
|
+
amount: tokenAmountSchema,
|
|
348
|
+
interval: subscriptionIntervalSchema,
|
|
349
|
+
intervalCount: zod.z.number().int().min(1),
|
|
350
|
+
trialEndsAt: isoTimestampSchema.nullable(),
|
|
351
|
+
currentPeriodStartAt: isoTimestampSchema,
|
|
352
|
+
currentPeriodEndAt: isoTimestampSchema,
|
|
353
|
+
nextChargeAt: isoTimestampSchema.nullable(),
|
|
354
|
+
gracePeriodHours: zod.z.number().int().min(0).max(72),
|
|
355
|
+
cancelledAt: isoTimestampSchema.nullable(),
|
|
356
|
+
metadata: metadataSchema,
|
|
357
|
+
createdAt: isoTimestampSchema,
|
|
358
|
+
updatedAt: isoTimestampSchema
|
|
359
|
+
});
|
|
360
|
+
var createSubscriptionInputSchema = zod.z.object({
|
|
361
|
+
planId: idSchema,
|
|
362
|
+
customer: zod.z.object({
|
|
363
|
+
walletAddress: evmAddressSchema,
|
|
364
|
+
email: zod.z.string().email().optional(),
|
|
365
|
+
externalRef: zod.z.string().max(120).optional()
|
|
366
|
+
}),
|
|
367
|
+
gracePeriodHours: zod.z.union([zod.z.literal(24), zod.z.literal(48), zod.z.literal(72)]).default(48),
|
|
368
|
+
metadata: metadataSchema.optional()
|
|
369
|
+
});
|
|
370
|
+
var cancelSubscriptionInputSchema = zod.z.object({
|
|
371
|
+
id: idSchema,
|
|
372
|
+
reason: zod.z.string().max(500).optional()
|
|
373
|
+
});
|
|
374
|
+
var subscriptionChargeOutcomeSchema = zod.z.enum([
|
|
375
|
+
"charged",
|
|
376
|
+
"insufficient_funds",
|
|
377
|
+
"revoked_approval",
|
|
378
|
+
"cancelled",
|
|
379
|
+
"skipped"
|
|
380
|
+
]);
|
|
381
|
+
var subscriptionChargeStatusSchema = zod.z.enum([
|
|
382
|
+
"pending",
|
|
383
|
+
"in_flight",
|
|
384
|
+
"succeeded",
|
|
385
|
+
"failed",
|
|
386
|
+
"retrying",
|
|
387
|
+
"abandoned"
|
|
388
|
+
]);
|
|
389
|
+
var subscriptionChargeSchema = zod.z.object({
|
|
390
|
+
id: idSchema,
|
|
391
|
+
subscriptionId: idSchema,
|
|
392
|
+
merchantId: idSchema,
|
|
393
|
+
chargeAttemptId: zod.z.string().length(66, "must be a 32-byte 0x-prefixed hex string"),
|
|
394
|
+
periodStartAt: isoTimestampSchema,
|
|
395
|
+
periodEndAt: isoTimestampSchema,
|
|
396
|
+
amount: tokenAmountSchema,
|
|
397
|
+
currency: paymentCurrencySchema,
|
|
398
|
+
status: subscriptionChargeStatusSchema,
|
|
399
|
+
outcome: subscriptionChargeOutcomeSchema.nullable(),
|
|
400
|
+
attemptNumber: zod.z.number().int().min(1),
|
|
401
|
+
scheduledAt: isoTimestampSchema,
|
|
402
|
+
executedAt: isoTimestampSchema.nullable(),
|
|
403
|
+
onchainTxHash: evmTxHashSchema.nullable(),
|
|
404
|
+
failureReason: zod.z.string().max(500).nullable(),
|
|
405
|
+
createdAt: isoTimestampSchema,
|
|
406
|
+
updatedAt: isoTimestampSchema
|
|
407
|
+
});
|
|
408
|
+
var refundReasonSchema = zod.z.enum([
|
|
409
|
+
"customer_request",
|
|
410
|
+
"product_issue",
|
|
411
|
+
"duplicate_charge",
|
|
412
|
+
"fraudulent",
|
|
413
|
+
"other"
|
|
414
|
+
]);
|
|
415
|
+
var refundStatusSchema = zod.z.enum([
|
|
416
|
+
"pending",
|
|
417
|
+
"awaiting_signature",
|
|
418
|
+
"submitted",
|
|
419
|
+
"completed",
|
|
420
|
+
"failed",
|
|
421
|
+
"cancelled"
|
|
422
|
+
]);
|
|
423
|
+
var refundSchema = zod.z.object({
|
|
424
|
+
id: idSchema,
|
|
425
|
+
merchantId: idSchema,
|
|
426
|
+
transactionId: idSchema,
|
|
427
|
+
amount: tokenAmountSchema,
|
|
428
|
+
currency: paymentCurrencySchema,
|
|
429
|
+
reason: refundReasonSchema,
|
|
430
|
+
note: zod.z.string().max(500).nullable(),
|
|
431
|
+
status: refundStatusSchema,
|
|
432
|
+
payerAddress: evmAddressSchema,
|
|
433
|
+
refundTxHash: evmTxHashSchema.nullable(),
|
|
434
|
+
failureReason: zod.z.string().max(500).nullable(),
|
|
435
|
+
initiatedBy: idSchema,
|
|
436
|
+
createdAt: isoTimestampSchema,
|
|
437
|
+
completedAt: isoTimestampSchema.nullable()
|
|
438
|
+
});
|
|
439
|
+
var createRefundInputSchema = zod.z.object({
|
|
440
|
+
transactionId: idSchema,
|
|
441
|
+
amount: tokenAmountSchema,
|
|
442
|
+
reason: refundReasonSchema,
|
|
443
|
+
note: zod.z.string().max(500).optional()
|
|
444
|
+
});
|
|
445
|
+
var submitRefundSignatureInputSchema = zod.z.object({
|
|
446
|
+
id: idSchema,
|
|
447
|
+
refundTxHash: evmTxHashSchema
|
|
448
|
+
});
|
|
449
|
+
var webhookEventNameSchema = zod.z.enum([
|
|
450
|
+
"payment.created",
|
|
451
|
+
"payment.completed",
|
|
452
|
+
"payment.failed",
|
|
453
|
+
"subscription.created",
|
|
454
|
+
"subscription.charged",
|
|
455
|
+
"subscription.charge_failed",
|
|
456
|
+
"subscription.recovery_attempt",
|
|
457
|
+
"subscription.recovery_outcome",
|
|
458
|
+
"subscription.cancelled",
|
|
459
|
+
"subscription.lapsed",
|
|
460
|
+
"refund.created",
|
|
461
|
+
"refund.completed",
|
|
462
|
+
"refund.failed",
|
|
463
|
+
"invoice.created",
|
|
464
|
+
"invoice.paid",
|
|
465
|
+
"invoice.overdue",
|
|
466
|
+
"agent.action_executed",
|
|
467
|
+
"agent.job_proposed",
|
|
468
|
+
"agent.job_completed",
|
|
469
|
+
"agent.job_disputed",
|
|
470
|
+
"compliance.wallet_flagged",
|
|
471
|
+
"compliance.wallet_blocked"
|
|
472
|
+
]);
|
|
473
|
+
var webhookEndpointStatusSchema = zod.z.enum(["active", "disabled"]);
|
|
474
|
+
var webhookEndpointSchema = zod.z.object({
|
|
475
|
+
id: idSchema,
|
|
476
|
+
merchantId: idSchema,
|
|
477
|
+
mode: modeSchema,
|
|
478
|
+
url: httpsUrlSchema,
|
|
479
|
+
description: zod.z.string().max(200).nullable(),
|
|
480
|
+
events: zod.z.array(webhookEventNameSchema).nonempty(),
|
|
481
|
+
status: webhookEndpointStatusSchema,
|
|
482
|
+
signingSecretPrefix: zod.z.string().min(4).max(12),
|
|
483
|
+
lastDeliveredAt: isoTimestampSchema.nullable(),
|
|
484
|
+
createdAt: isoTimestampSchema,
|
|
485
|
+
updatedAt: isoTimestampSchema
|
|
486
|
+
});
|
|
487
|
+
var createWebhookEndpointInputSchema = zod.z.object({
|
|
488
|
+
url: httpsUrlSchema,
|
|
489
|
+
events: zod.z.array(webhookEventNameSchema).nonempty(),
|
|
490
|
+
description: zod.z.string().max(200).optional(),
|
|
491
|
+
mode: modeSchema
|
|
492
|
+
});
|
|
493
|
+
var createWebhookEndpointOutputSchema = zod.z.object({
|
|
494
|
+
endpoint: webhookEndpointSchema,
|
|
495
|
+
/** Full signing secret — shown exactly once. */
|
|
496
|
+
signingSecret: zod.z.string()
|
|
497
|
+
});
|
|
498
|
+
var webhookDeliveryStatusSchema = zod.z.enum([
|
|
499
|
+
"pending",
|
|
500
|
+
"delivered",
|
|
501
|
+
"retrying",
|
|
502
|
+
"permanently_failed"
|
|
503
|
+
]);
|
|
504
|
+
var webhookDeliverySchema = zod.z.object({
|
|
505
|
+
id: idSchema,
|
|
506
|
+
merchantId: idSchema,
|
|
507
|
+
endpointId: idSchema,
|
|
508
|
+
eventId: idSchema,
|
|
509
|
+
eventName: webhookEventNameSchema,
|
|
510
|
+
status: webhookDeliveryStatusSchema,
|
|
511
|
+
attempt: zod.z.number().int().min(1).max(6),
|
|
512
|
+
responseCode: zod.z.number().int().min(100).max(599).nullable(),
|
|
513
|
+
responseMs: zod.z.number().int().min(0).nullable(),
|
|
514
|
+
lastError: zod.z.string().max(1e3).nullable(),
|
|
515
|
+
nextAttemptAt: isoTimestampSchema.nullable(),
|
|
516
|
+
deliveredAt: isoTimestampSchema.nullable(),
|
|
517
|
+
createdAt: isoTimestampSchema
|
|
518
|
+
});
|
|
519
|
+
var replayDeliveryInputSchema = zod.z.object({
|
|
520
|
+
id: idSchema
|
|
521
|
+
});
|
|
522
|
+
var complianceProviderSchema = zod.z.enum(["trm", "elliptic", "disabled"]);
|
|
523
|
+
var complianceStatusSchema = zod.z.enum(["clear", "flagged", "blocked", "error"]);
|
|
524
|
+
var complianceScreeningContextSchema = zod.z.enum([
|
|
525
|
+
"merchant_onboarding",
|
|
526
|
+
"payer_checkout",
|
|
527
|
+
"subscriber_signup",
|
|
528
|
+
"refund_recipient"
|
|
529
|
+
]);
|
|
530
|
+
var complianceLogSchema = zod.z.object({
|
|
531
|
+
id: idSchema,
|
|
532
|
+
walletAddress: evmAddressSchema,
|
|
533
|
+
provider: complianceProviderSchema,
|
|
534
|
+
status: complianceStatusSchema,
|
|
535
|
+
riskScore: zod.z.number().min(0).max(100).nullable(),
|
|
536
|
+
flags: zod.z.array(zod.z.string().max(120)).default([]),
|
|
537
|
+
context: complianceScreeningContextSchema,
|
|
538
|
+
merchantId: idSchema.nullable(),
|
|
539
|
+
sessionId: idSchema.nullable(),
|
|
540
|
+
subscriptionId: idSchema.nullable(),
|
|
541
|
+
providerRequestId: zod.z.string().max(200).nullable(),
|
|
542
|
+
createdAt: isoTimestampSchema
|
|
543
|
+
});
|
|
544
|
+
var agentIdentitySchema = zod.z.object({
|
|
545
|
+
id: idSchema,
|
|
546
|
+
/** ERC-8004 on-chain identity address. */
|
|
547
|
+
onchainAddress: evmAddressSchema,
|
|
548
|
+
/** Public key or agent credential digest, as emitted by ERC-8004. */
|
|
549
|
+
credentialDigest: zod.z.string().regex(/^0x[a-fA-F0-9]+$/),
|
|
550
|
+
name: zod.z.string().min(1).max(120),
|
|
551
|
+
version: zod.z.string().min(1).max(40),
|
|
552
|
+
reputationScore: zod.z.number().min(0).max(100).nullable(),
|
|
553
|
+
registeredAt: isoTimestampSchema
|
|
554
|
+
});
|
|
555
|
+
var agentCapabilitySchema = zod.z.enum([
|
|
556
|
+
"identity",
|
|
557
|
+
"recovery",
|
|
558
|
+
"routing",
|
|
559
|
+
"cashflow",
|
|
560
|
+
"commerce",
|
|
561
|
+
"pricing_intelligence"
|
|
562
|
+
]);
|
|
563
|
+
var agentMerchantConfigSchema = zod.z.object({
|
|
564
|
+
merchantId: idSchema,
|
|
565
|
+
enabledCapabilities: zod.z.array(agentCapabilitySchema).default([]),
|
|
566
|
+
recovery: zod.z.object({
|
|
567
|
+
gracePeriodHours: zod.z.union([zod.z.literal(24), zod.z.literal(48), zod.z.literal(72)]).default(48),
|
|
568
|
+
strategy: zod.z.enum(["once", "twice", "until_grace_ends"]).default("twice"),
|
|
569
|
+
notificationTemplate: zod.z.string().max(2e3).nullable()
|
|
570
|
+
}),
|
|
571
|
+
cashflow: zod.z.object({
|
|
572
|
+
digestEnabled: zod.z.boolean().default(false),
|
|
573
|
+
anomalySensitivity: zod.z.enum(["low", "medium", "high"]).default("medium"),
|
|
574
|
+
autoConvertToYield: zod.z.boolean().default(false),
|
|
575
|
+
minimumLiquidReserveCents: zod.z.number().int().nonnegative().default(1e5)
|
|
576
|
+
}),
|
|
577
|
+
commerce: zod.z.object({
|
|
578
|
+
requireHumanApprovalAboveUsdCents: zod.z.number().int().nonnegative().default(1e5),
|
|
579
|
+
approvedVendors: zod.z.array(evmAddressSchema).default([]),
|
|
580
|
+
monthlySpendCapUsdCents: zod.z.number().int().nonnegative().nullable()
|
|
581
|
+
}),
|
|
582
|
+
updatedAt: isoTimestampSchema
|
|
583
|
+
});
|
|
584
|
+
var updateAgentConfigInputSchema = agentMerchantConfigSchema.omit({ merchantId: true, updatedAt: true }).partial();
|
|
585
|
+
var agentActionTypeSchema = zod.z.enum([
|
|
586
|
+
"recovery_notification_sent",
|
|
587
|
+
"recovery_retry_scheduled",
|
|
588
|
+
"recovery_retry_executed",
|
|
589
|
+
"recovery_abandoned",
|
|
590
|
+
"routing_bridge_initiated",
|
|
591
|
+
"routing_payment_completed",
|
|
592
|
+
"cashflow_digest_sent",
|
|
593
|
+
"cashflow_anomaly_flagged",
|
|
594
|
+
"cashflow_yield_converted",
|
|
595
|
+
"commerce_job_created",
|
|
596
|
+
"commerce_job_approved",
|
|
597
|
+
"commerce_job_completed",
|
|
598
|
+
"commerce_job_disputed"
|
|
599
|
+
]);
|
|
600
|
+
var agentActionOutcomeSchema = zod.z.enum(["success", "failure", "pending", "skipped"]);
|
|
601
|
+
var agentActivityLogSchema = zod.z.object({
|
|
602
|
+
id: idSchema,
|
|
603
|
+
merchantId: idSchema,
|
|
604
|
+
capability: agentCapabilitySchema,
|
|
605
|
+
actionType: agentActionTypeSchema,
|
|
606
|
+
outcome: agentActionOutcomeSchema,
|
|
607
|
+
subscriptionId: idSchema.nullable(),
|
|
608
|
+
transactionId: idSchema.nullable(),
|
|
609
|
+
jobId: idSchema.nullable(),
|
|
610
|
+
metadata: metadataSchema,
|
|
611
|
+
createdAt: isoTimestampSchema
|
|
612
|
+
});
|
|
613
|
+
var agentJobStatusSchema = zod.z.enum([
|
|
614
|
+
"proposed",
|
|
615
|
+
"accepted",
|
|
616
|
+
"in_progress",
|
|
617
|
+
"delivered",
|
|
618
|
+
"approved",
|
|
619
|
+
"completed",
|
|
620
|
+
"disputed",
|
|
621
|
+
"cancelled"
|
|
622
|
+
]);
|
|
623
|
+
var agentJobSchema = zod.z.object({
|
|
624
|
+
id: idSchema,
|
|
625
|
+
merchantId: idSchema,
|
|
626
|
+
/** On-chain job id from StrimzAgentEscrow. */
|
|
627
|
+
onchainJobId: zod.z.number().int().nonnegative().nullable(),
|
|
628
|
+
vendorAddress: evmAddressSchema,
|
|
629
|
+
description: zod.z.string().min(1).max(2e3),
|
|
630
|
+
amount: tokenAmountSchema,
|
|
631
|
+
currency: zod.z.enum(["USDC", "EURC"]),
|
|
632
|
+
status: agentJobStatusSchema,
|
|
633
|
+
assessorAddress: evmAddressSchema,
|
|
634
|
+
deliverableHash: zod.z.string().regex(/^0x[a-fA-F0-9]+$/).nullable(),
|
|
635
|
+
escrowTxHash: evmTxHashSchema.nullable(),
|
|
636
|
+
releaseTxHash: evmTxHashSchema.nullable(),
|
|
637
|
+
createdAt: isoTimestampSchema,
|
|
638
|
+
completedAt: isoTimestampSchema.nullable()
|
|
639
|
+
});
|
|
640
|
+
var createAgentJobInputSchema = zod.z.object({
|
|
641
|
+
vendorAddress: evmAddressSchema,
|
|
642
|
+
description: zod.z.string().min(1).max(2e3),
|
|
643
|
+
amount: tokenAmountSchema,
|
|
644
|
+
currency: zod.z.enum(["USDC", "EURC"]),
|
|
645
|
+
assessorAddress: evmAddressSchema.optional()
|
|
646
|
+
});
|
|
647
|
+
var storefrontStatusSchema = zod.z.enum(["draft", "published", "archived"]);
|
|
648
|
+
var storefrontSchema = zod.z.object({
|
|
649
|
+
id: idSchema,
|
|
650
|
+
merchantId: idSchema,
|
|
651
|
+
slug: zod.z.string().min(3).max(40).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, "slug must be lowercase alphanumeric with hyphens"),
|
|
652
|
+
name: zod.z.string().min(2).max(120),
|
|
653
|
+
description: zod.z.string().max(2e3).nullable(),
|
|
654
|
+
logoUrl: httpsUrlSchema.nullable(),
|
|
655
|
+
coverImageUrl: httpsUrlSchema.nullable(),
|
|
656
|
+
accentColor: zod.z.string().regex(/^#[0-9a-fA-F]{6}$/).nullable(),
|
|
657
|
+
socialLinks: zod.z.array(httpsUrlSchema).max(10).default([]),
|
|
658
|
+
status: storefrontStatusSchema,
|
|
659
|
+
createdAt: isoTimestampSchema,
|
|
660
|
+
updatedAt: isoTimestampSchema
|
|
661
|
+
});
|
|
662
|
+
var createStorefrontInputSchema = storefrontSchema.pick({
|
|
663
|
+
slug: true,
|
|
664
|
+
name: true,
|
|
665
|
+
description: true,
|
|
666
|
+
logoUrl: true,
|
|
667
|
+
coverImageUrl: true,
|
|
668
|
+
accentColor: true,
|
|
669
|
+
socialLinks: true
|
|
670
|
+
});
|
|
671
|
+
var storefrontProductTypeSchema = zod.z.enum(["one_time", "subscription"]);
|
|
672
|
+
var storefrontProductSchema = zod.z.object({
|
|
673
|
+
id: idSchema,
|
|
674
|
+
storefrontId: idSchema,
|
|
675
|
+
name: zod.z.string().min(1).max(120),
|
|
676
|
+
description: zod.z.string().max(2e3).nullable(),
|
|
677
|
+
imageUrl: httpsUrlSchema.nullable(),
|
|
678
|
+
price: tokenAmountSchema,
|
|
679
|
+
currency: paymentCurrencySchema,
|
|
680
|
+
type: storefrontProductTypeSchema,
|
|
681
|
+
interval: subscriptionIntervalSchema.nullable(),
|
|
682
|
+
intervalCount: zod.z.number().int().min(1).max(365).nullable(),
|
|
683
|
+
/** null = unlimited stock. */
|
|
684
|
+
stock: zod.z.number().int().min(0).nullable(),
|
|
685
|
+
planId: idSchema.nullable(),
|
|
686
|
+
isActive: zod.z.boolean(),
|
|
687
|
+
sortOrder: zod.z.number().int().nonnegative().default(0),
|
|
688
|
+
createdAt: isoTimestampSchema,
|
|
689
|
+
updatedAt: isoTimestampSchema
|
|
690
|
+
});
|
|
691
|
+
var createStorefrontProductInputSchema = storefrontProductSchema.omit({
|
|
692
|
+
id: true,
|
|
693
|
+
storefrontId: true,
|
|
694
|
+
planId: true,
|
|
695
|
+
createdAt: true,
|
|
696
|
+
updatedAt: true
|
|
697
|
+
}).extend({
|
|
698
|
+
imageUrl: httpsUrlSchema.optional()
|
|
699
|
+
});
|
|
700
|
+
var invoiceStatusSchema = zod.z.enum(["draft", "sent", "paid", "overdue", "void"]);
|
|
701
|
+
var invoiceLineItemSchema = zod.z.object({
|
|
702
|
+
description: zod.z.string().min(1).max(500),
|
|
703
|
+
quantity: zod.z.number().int().min(1).max(1e4),
|
|
704
|
+
unitAmount: tokenAmountSchema
|
|
705
|
+
});
|
|
706
|
+
var invoiceSchema = zod.z.object({
|
|
707
|
+
id: idSchema,
|
|
708
|
+
merchantId: idSchema,
|
|
709
|
+
number: zod.z.string().min(1).max(40),
|
|
710
|
+
customerName: zod.z.string().min(1).max(200).nullable(),
|
|
711
|
+
customerEmail: emailSchema.nullable(),
|
|
712
|
+
lineItems: zod.z.array(invoiceLineItemSchema).nonempty(),
|
|
713
|
+
subtotal: tokenAmountSchema,
|
|
714
|
+
total: tokenAmountSchema,
|
|
715
|
+
currency: paymentCurrencySchema,
|
|
716
|
+
status: invoiceStatusSchema,
|
|
717
|
+
note: zod.z.string().max(2e3).nullable(),
|
|
718
|
+
sessionId: idSchema.nullable(),
|
|
719
|
+
dueAt: isoTimestampSchema,
|
|
720
|
+
paidAt: isoTimestampSchema.nullable(),
|
|
721
|
+
sentAt: isoTimestampSchema.nullable(),
|
|
722
|
+
createdAt: isoTimestampSchema,
|
|
723
|
+
updatedAt: isoTimestampSchema
|
|
724
|
+
});
|
|
725
|
+
var createInvoiceInputSchema = zod.z.object({
|
|
726
|
+
customerName: zod.z.string().min(1).max(200).optional(),
|
|
727
|
+
customerEmail: emailSchema.optional(),
|
|
728
|
+
lineItems: zod.z.array(invoiceLineItemSchema).nonempty(),
|
|
729
|
+
currency: paymentCurrencySchema,
|
|
730
|
+
note: zod.z.string().max(2e3).optional(),
|
|
731
|
+
dueInDays: zod.z.number().int().min(1).max(90).default(7)
|
|
732
|
+
});
|
|
733
|
+
var envelope = (name, data) => zod.z.object({
|
|
734
|
+
id: idSchema,
|
|
735
|
+
type: zod.z.literal(name),
|
|
736
|
+
apiVersion: zod.z.string().regex(/^\d{4}-\d{2}-\d{2}$/),
|
|
737
|
+
mode: modeSchema,
|
|
738
|
+
createdAt: isoTimestampSchema,
|
|
739
|
+
data
|
|
740
|
+
});
|
|
741
|
+
var paymentCreatedEventSchema = envelope("payment.created", paymentSessionSchema);
|
|
742
|
+
var paymentCompletedEventSchema = envelope(
|
|
743
|
+
"payment.completed",
|
|
744
|
+
zod.z.object({ session: paymentSessionSchema, transaction: transactionSchema })
|
|
745
|
+
);
|
|
746
|
+
var paymentFailedEventSchema = envelope(
|
|
747
|
+
"payment.failed",
|
|
748
|
+
zod.z.object({ session: paymentSessionSchema, reason: zod.z.string() })
|
|
749
|
+
);
|
|
750
|
+
var subscriptionCreatedEventSchema = envelope("subscription.created", subscriptionSchema);
|
|
751
|
+
var subscriptionChargedEventSchema = envelope(
|
|
752
|
+
"subscription.charged",
|
|
753
|
+
zod.z.object({
|
|
754
|
+
subscription: subscriptionSchema,
|
|
755
|
+
charge: subscriptionChargeSchema,
|
|
756
|
+
transaction: transactionSchema
|
|
757
|
+
})
|
|
758
|
+
);
|
|
759
|
+
var subscriptionChargeFailedEventSchema = envelope(
|
|
760
|
+
"subscription.charge_failed",
|
|
761
|
+
zod.z.object({ subscription: subscriptionSchema, charge: subscriptionChargeSchema })
|
|
762
|
+
);
|
|
763
|
+
var subscriptionRecoveryAttemptEventSchema = envelope(
|
|
764
|
+
"subscription.recovery_attempt",
|
|
765
|
+
zod.z.object({ subscription: subscriptionSchema, attemptNumber: zod.z.number().int().min(1) })
|
|
766
|
+
);
|
|
767
|
+
var subscriptionRecoveryOutcomeEventSchema = envelope(
|
|
768
|
+
"subscription.recovery_outcome",
|
|
769
|
+
zod.z.object({
|
|
770
|
+
subscription: subscriptionSchema,
|
|
771
|
+
outcome: zod.z.enum(["recovered", "churned"])
|
|
772
|
+
})
|
|
773
|
+
);
|
|
774
|
+
var subscriptionCancelledEventSchema = envelope(
|
|
775
|
+
"subscription.cancelled",
|
|
776
|
+
subscriptionSchema
|
|
777
|
+
);
|
|
778
|
+
var subscriptionLapsedEventSchema = envelope("subscription.lapsed", subscriptionSchema);
|
|
779
|
+
var refundCreatedEventSchema = envelope("refund.created", refundSchema);
|
|
780
|
+
var refundCompletedEventSchema = envelope(
|
|
781
|
+
"refund.completed",
|
|
782
|
+
zod.z.object({ refund: refundSchema, transaction: transactionSchema })
|
|
783
|
+
);
|
|
784
|
+
var refundFailedEventSchema = envelope(
|
|
785
|
+
"refund.failed",
|
|
786
|
+
zod.z.object({ refund: refundSchema, reason: zod.z.string() })
|
|
787
|
+
);
|
|
788
|
+
var invoiceCreatedEventSchema = envelope("invoice.created", invoiceSchema);
|
|
789
|
+
var invoicePaidEventSchema = envelope(
|
|
790
|
+
"invoice.paid",
|
|
791
|
+
zod.z.object({ invoice: invoiceSchema, transaction: transactionSchema })
|
|
792
|
+
);
|
|
793
|
+
var invoiceOverdueEventSchema = envelope("invoice.overdue", invoiceSchema);
|
|
794
|
+
var agentActionExecutedEventSchema = envelope(
|
|
795
|
+
"agent.action_executed",
|
|
796
|
+
agentActivityLogSchema
|
|
797
|
+
);
|
|
798
|
+
var agentJobProposedEventSchema = envelope("agent.job_proposed", agentJobSchema);
|
|
799
|
+
var agentJobCompletedEventSchema = envelope("agent.job_completed", agentJobSchema);
|
|
800
|
+
var agentJobDisputedEventSchema = envelope("agent.job_disputed", agentJobSchema);
|
|
801
|
+
var complianceWalletFlaggedEventSchema = envelope(
|
|
802
|
+
"compliance.wallet_flagged",
|
|
803
|
+
complianceLogSchema
|
|
804
|
+
);
|
|
805
|
+
var complianceWalletBlockedEventSchema = envelope(
|
|
806
|
+
"compliance.wallet_blocked",
|
|
807
|
+
complianceLogSchema
|
|
808
|
+
);
|
|
809
|
+
var webhookEventSchema = zod.z.discriminatedUnion("type", [
|
|
810
|
+
paymentCreatedEventSchema,
|
|
811
|
+
paymentCompletedEventSchema,
|
|
812
|
+
paymentFailedEventSchema,
|
|
813
|
+
subscriptionCreatedEventSchema,
|
|
814
|
+
subscriptionChargedEventSchema,
|
|
815
|
+
subscriptionChargeFailedEventSchema,
|
|
816
|
+
subscriptionRecoveryAttemptEventSchema,
|
|
817
|
+
subscriptionRecoveryOutcomeEventSchema,
|
|
818
|
+
subscriptionCancelledEventSchema,
|
|
819
|
+
subscriptionLapsedEventSchema,
|
|
820
|
+
refundCreatedEventSchema,
|
|
821
|
+
refundCompletedEventSchema,
|
|
822
|
+
refundFailedEventSchema,
|
|
823
|
+
invoiceCreatedEventSchema,
|
|
824
|
+
invoicePaidEventSchema,
|
|
825
|
+
invoiceOverdueEventSchema,
|
|
826
|
+
agentActionExecutedEventSchema,
|
|
827
|
+
agentJobProposedEventSchema,
|
|
828
|
+
agentJobCompletedEventSchema,
|
|
829
|
+
agentJobDisputedEventSchema,
|
|
830
|
+
complianceWalletFlaggedEventSchema,
|
|
831
|
+
complianceWalletBlockedEventSchema
|
|
832
|
+
]);
|
|
833
|
+
var addressSchema = zod.z.string().regex(/^0x[0-9a-fA-F]{40}$/u, "must be a 0x-prefixed 20-byte address");
|
|
834
|
+
var tokenCapabilitiesSchema = zod.z.object({
|
|
835
|
+
permit2612: zod.z.boolean(),
|
|
836
|
+
transferAuth3009: zod.z.boolean()
|
|
837
|
+
});
|
|
838
|
+
var tokenMetadataSchema = zod.z.object({
|
|
839
|
+
address: addressSchema,
|
|
840
|
+
name: zod.z.string(),
|
|
841
|
+
symbol: zod.z.string(),
|
|
842
|
+
/**
|
|
843
|
+
* EIP-712 domain version. Read from ERC-5267 `eip712Domain()` when
|
|
844
|
+
* available; otherwise defaults to "1". Used by typed-data builders
|
|
845
|
+
* — domain mismatch produces a different digest and the contract's
|
|
846
|
+
* ecrecover would recover a different address.
|
|
847
|
+
*/
|
|
848
|
+
version: zod.z.string(),
|
|
849
|
+
decimals: zod.z.number().int().min(0).max(255),
|
|
850
|
+
capabilities: tokenCapabilitiesSchema
|
|
851
|
+
});
|
|
852
|
+
var tokenPermitNonceSchema = zod.z.object({
|
|
853
|
+
token: addressSchema,
|
|
854
|
+
owner: addressSchema,
|
|
855
|
+
nonce: zod.z.string().regex(/^[0-9]+$/u, "must be a decimal integer string")
|
|
856
|
+
});
|
|
857
|
+
|
|
858
|
+
exports.agentActionExecutedEventSchema = agentActionExecutedEventSchema;
|
|
859
|
+
exports.agentActionOutcomeSchema = agentActionOutcomeSchema;
|
|
860
|
+
exports.agentActionTypeSchema = agentActionTypeSchema;
|
|
861
|
+
exports.agentActivityLogSchema = agentActivityLogSchema;
|
|
862
|
+
exports.agentCapabilitySchema = agentCapabilitySchema;
|
|
863
|
+
exports.agentIdentitySchema = agentIdentitySchema;
|
|
864
|
+
exports.agentJobCompletedEventSchema = agentJobCompletedEventSchema;
|
|
865
|
+
exports.agentJobDisputedEventSchema = agentJobDisputedEventSchema;
|
|
866
|
+
exports.agentJobProposedEventSchema = agentJobProposedEventSchema;
|
|
867
|
+
exports.agentJobSchema = agentJobSchema;
|
|
868
|
+
exports.agentJobStatusSchema = agentJobStatusSchema;
|
|
869
|
+
exports.agentMerchantConfigSchema = agentMerchantConfigSchema;
|
|
870
|
+
exports.apiKeyKindSchema = apiKeyKindSchema;
|
|
871
|
+
exports.apiKeySchema = apiKeySchema;
|
|
872
|
+
exports.apiKeyScopeSchema = apiKeyScopeSchema;
|
|
873
|
+
exports.arcEnvironmentSchema = arcEnvironmentSchema;
|
|
874
|
+
exports.cancelSubscriptionInputSchema = cancelSubscriptionInputSchema;
|
|
875
|
+
exports.changeTierInputSchema = changeTierInputSchema;
|
|
876
|
+
exports.complianceLogSchema = complianceLogSchema;
|
|
877
|
+
exports.complianceProviderSchema = complianceProviderSchema;
|
|
878
|
+
exports.complianceScreeningContextSchema = complianceScreeningContextSchema;
|
|
879
|
+
exports.complianceStatusSchema = complianceStatusSchema;
|
|
880
|
+
exports.complianceWalletBlockedEventSchema = complianceWalletBlockedEventSchema;
|
|
881
|
+
exports.complianceWalletFlaggedEventSchema = complianceWalletFlaggedEventSchema;
|
|
882
|
+
exports.countryCodeSchema = countryCodeSchema;
|
|
883
|
+
exports.createAgentJobInputSchema = createAgentJobInputSchema;
|
|
884
|
+
exports.createApiKeyInputSchema = createApiKeyInputSchema;
|
|
885
|
+
exports.createApiKeyOutputSchema = createApiKeyOutputSchema;
|
|
886
|
+
exports.createInvoiceInputSchema = createInvoiceInputSchema;
|
|
887
|
+
exports.createMerchantInputSchema = createMerchantInputSchema;
|
|
888
|
+
exports.createPaymentSessionInputSchema = createPaymentSessionInputSchema;
|
|
889
|
+
exports.createRefundInputSchema = createRefundInputSchema;
|
|
890
|
+
exports.createStorefrontInputSchema = createStorefrontInputSchema;
|
|
891
|
+
exports.createStorefrontProductInputSchema = createStorefrontProductInputSchema;
|
|
892
|
+
exports.createSubscriptionInputSchema = createSubscriptionInputSchema;
|
|
893
|
+
exports.createSubscriptionPlanInputSchema = createSubscriptionPlanInputSchema;
|
|
894
|
+
exports.createWebhookEndpointInputSchema = createWebhookEndpointInputSchema;
|
|
895
|
+
exports.createWebhookEndpointOutputSchema = createWebhookEndpointOutputSchema;
|
|
896
|
+
exports.customerSchema = customerSchema;
|
|
897
|
+
exports.emailSchema = emailSchema;
|
|
898
|
+
exports.evmAddressSchema = evmAddressSchema;
|
|
899
|
+
exports.evmTxHashSchema = evmTxHashSchema;
|
|
900
|
+
exports.httpUrlSchema = httpUrlSchema;
|
|
901
|
+
exports.httpsUrlSchema = httpsUrlSchema;
|
|
902
|
+
exports.idSchema = idSchema;
|
|
903
|
+
exports.inviteMemberInputSchema = inviteMemberInputSchema;
|
|
904
|
+
exports.invoiceCreatedEventSchema = invoiceCreatedEventSchema;
|
|
905
|
+
exports.invoiceLineItemSchema = invoiceLineItemSchema;
|
|
906
|
+
exports.invoiceOverdueEventSchema = invoiceOverdueEventSchema;
|
|
907
|
+
exports.invoicePaidEventSchema = invoicePaidEventSchema;
|
|
908
|
+
exports.invoiceSchema = invoiceSchema;
|
|
909
|
+
exports.invoiceStatusSchema = invoiceStatusSchema;
|
|
910
|
+
exports.isoTimestampSchema = isoTimestampSchema;
|
|
911
|
+
exports.loginInputSchema = loginInputSchema;
|
|
912
|
+
exports.loginOutputSchema = loginOutputSchema;
|
|
913
|
+
exports.makePaginatedSchema = makePaginatedSchema;
|
|
914
|
+
exports.merchantMemberSchema = merchantMemberSchema;
|
|
915
|
+
exports.merchantRoleSchema = merchantRoleSchema;
|
|
916
|
+
exports.merchantSchema = merchantSchema;
|
|
917
|
+
exports.merchantStatusSchema = merchantStatusSchema;
|
|
918
|
+
exports.merchantTierSchema = merchantTierSchema;
|
|
919
|
+
exports.metadataSchema = metadataSchema;
|
|
920
|
+
exports.modeSchema = modeSchema;
|
|
921
|
+
exports.paginationInputSchema = paginationInputSchema;
|
|
922
|
+
exports.paymentCompletedEventSchema = paymentCompletedEventSchema;
|
|
923
|
+
exports.paymentCreatedEventSchema = paymentCreatedEventSchema;
|
|
924
|
+
exports.paymentCurrencySchema = paymentCurrencySchema;
|
|
925
|
+
exports.paymentFailedEventSchema = paymentFailedEventSchema;
|
|
926
|
+
exports.paymentSessionSchema = paymentSessionSchema;
|
|
927
|
+
exports.paymentSessionStatusSchema = paymentSessionStatusSchema;
|
|
928
|
+
exports.refundCompletedEventSchema = refundCompletedEventSchema;
|
|
929
|
+
exports.refundCreatedEventSchema = refundCreatedEventSchema;
|
|
930
|
+
exports.refundFailedEventSchema = refundFailedEventSchema;
|
|
931
|
+
exports.refundReasonSchema = refundReasonSchema;
|
|
932
|
+
exports.refundSchema = refundSchema;
|
|
933
|
+
exports.refundStatusSchema = refundStatusSchema;
|
|
934
|
+
exports.replayDeliveryInputSchema = replayDeliveryInputSchema;
|
|
935
|
+
exports.rotateApiKeyInputSchema = rotateApiKeyInputSchema;
|
|
936
|
+
exports.storefrontProductSchema = storefrontProductSchema;
|
|
937
|
+
exports.storefrontProductTypeSchema = storefrontProductTypeSchema;
|
|
938
|
+
exports.storefrontSchema = storefrontSchema;
|
|
939
|
+
exports.storefrontStatusSchema = storefrontStatusSchema;
|
|
940
|
+
exports.submitPaymentSessionInputSchema = submitPaymentSessionInputSchema;
|
|
941
|
+
exports.submitRefundSignatureInputSchema = submitRefundSignatureInputSchema;
|
|
942
|
+
exports.subscriptionCancelledEventSchema = subscriptionCancelledEventSchema;
|
|
943
|
+
exports.subscriptionChargeFailedEventSchema = subscriptionChargeFailedEventSchema;
|
|
944
|
+
exports.subscriptionChargeOutcomeSchema = subscriptionChargeOutcomeSchema;
|
|
945
|
+
exports.subscriptionChargeSchema = subscriptionChargeSchema;
|
|
946
|
+
exports.subscriptionChargeStatusSchema = subscriptionChargeStatusSchema;
|
|
947
|
+
exports.subscriptionChargedEventSchema = subscriptionChargedEventSchema;
|
|
948
|
+
exports.subscriptionCreatedEventSchema = subscriptionCreatedEventSchema;
|
|
949
|
+
exports.subscriptionIntervalSchema = subscriptionIntervalSchema;
|
|
950
|
+
exports.subscriptionLapsedEventSchema = subscriptionLapsedEventSchema;
|
|
951
|
+
exports.subscriptionPlanSchema = subscriptionPlanSchema;
|
|
952
|
+
exports.subscriptionPlanStatusSchema = subscriptionPlanStatusSchema;
|
|
953
|
+
exports.subscriptionRecoveryAttemptEventSchema = subscriptionRecoveryAttemptEventSchema;
|
|
954
|
+
exports.subscriptionRecoveryOutcomeEventSchema = subscriptionRecoveryOutcomeEventSchema;
|
|
955
|
+
exports.subscriptionSchema = subscriptionSchema;
|
|
956
|
+
exports.subscriptionStatusSchema = subscriptionStatusSchema;
|
|
957
|
+
exports.tokenAmountSchema = tokenAmountSchema;
|
|
958
|
+
exports.tokenCapabilitiesSchema = tokenCapabilitiesSchema;
|
|
959
|
+
exports.tokenMetadataSchema = tokenMetadataSchema;
|
|
960
|
+
exports.tokenPermitNonceSchema = tokenPermitNonceSchema;
|
|
961
|
+
exports.tokenSymbolSchema = tokenSymbolSchema;
|
|
962
|
+
exports.transactionKindSchema = transactionKindSchema;
|
|
963
|
+
exports.transactionSchema = transactionSchema;
|
|
964
|
+
exports.transactionStatusSchema = transactionStatusSchema;
|
|
965
|
+
exports.uintSchema = uintSchema;
|
|
966
|
+
exports.updateAgentConfigInputSchema = updateAgentConfigInputSchema;
|
|
967
|
+
exports.updateMerchantInputSchema = updateMerchantInputSchema;
|
|
968
|
+
exports.upsertCustomerInputSchema = upsertCustomerInputSchema;
|
|
969
|
+
exports.webhookDeliverySchema = webhookDeliverySchema;
|
|
970
|
+
exports.webhookDeliveryStatusSchema = webhookDeliveryStatusSchema;
|
|
971
|
+
exports.webhookEndpointSchema = webhookEndpointSchema;
|
|
972
|
+
exports.webhookEndpointStatusSchema = webhookEndpointStatusSchema;
|
|
973
|
+
exports.webhookEventNameSchema = webhookEventNameSchema;
|
|
974
|
+
exports.webhookEventSchema = webhookEventSchema;
|
|
975
|
+
//# sourceMappingURL=index.cjs.map
|
|
976
|
+
//# sourceMappingURL=index.cjs.map
|