@strimz/shared-types 0.6.0 → 0.7.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/README.md +7 -4
- package/dist/agents.cjs.map +1 -1
- package/dist/agents.d.cts +7 -5
- package/dist/agents.d.ts +7 -5
- package/dist/agents.js.map +1 -1
- package/dist/api-keys.cjs.map +1 -1
- package/dist/api-keys.d.cts +11 -9
- package/dist/api-keys.d.ts +11 -9
- package/dist/api-keys.js.map +1 -1
- package/dist/common.cjs.map +1 -1
- package/dist/common.d.cts +3 -2
- package/dist/common.d.ts +3 -2
- package/dist/common.js.map +1 -1
- package/dist/compliance.cjs.map +1 -1
- package/dist/compliance.d.cts +4 -4
- package/dist/compliance.d.ts +4 -4
- package/dist/compliance.js.map +1 -1
- package/dist/customers.cjs.map +1 -1
- package/dist/customers.d.cts +5 -4
- package/dist/customers.d.ts +5 -4
- package/dist/customers.js.map +1 -1
- package/dist/events.cjs.map +1 -1
- package/dist/events.d.cts +276 -276
- package/dist/events.d.ts +276 -276
- package/dist/events.js.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -20
- package/dist/index.d.ts +22 -20
- package/dist/index.js.map +1 -1
- package/dist/invoices.cjs.map +1 -1
- package/dist/invoices.d.cts +5 -4
- package/dist/invoices.d.ts +5 -4
- package/dist/invoices.js.map +1 -1
- package/dist/merchants.cjs.map +1 -1
- package/dist/merchants.d.cts +19 -13
- package/dist/merchants.d.ts +19 -13
- package/dist/merchants.js.map +1 -1
- package/dist/payment-sessions.cjs.map +1 -1
- package/dist/payment-sessions.d.cts +5 -3
- package/dist/payment-sessions.d.ts +5 -3
- package/dist/payment-sessions.js.map +1 -1
- package/dist/refunds.cjs.map +1 -1
- package/dist/refunds.d.cts +5 -3
- package/dist/refunds.d.ts +5 -3
- package/dist/refunds.js.map +1 -1
- package/dist/storefronts.cjs.map +1 -1
- package/dist/storefronts.d.cts +11 -8
- package/dist/storefronts.d.ts +11 -8
- package/dist/storefronts.js.map +1 -1
- package/dist/subscriptions.cjs.map +1 -1
- package/dist/subscriptions.d.cts +11 -8
- package/dist/subscriptions.d.ts +11 -8
- package/dist/subscriptions.js.map +1 -1
- package/dist/transactions.cjs.map +1 -1
- package/dist/transactions.d.cts +4 -4
- package/dist/transactions.d.ts +4 -4
- package/dist/transactions.js.map +1 -1
- package/dist/webhooks.cjs.map +1 -1
- package/dist/webhooks.d.cts +11 -9
- package/dist/webhooks.d.ts +11 -9
- package/dist/webhooks.js.map +1 -1
- package/package.json +1 -1
- package/src/agents.ts +4 -2
- package/src/api-keys.ts +4 -2
- package/src/common.ts +2 -1
- package/src/contact.ts +2 -1
- package/src/customers.ts +2 -1
- package/src/invoices.ts +2 -1
- package/src/merchants.ts +12 -6
- package/src/notifications.ts +2 -1
- package/src/payment-sessions.ts +4 -2
- package/src/refunds.ts +4 -2
- package/src/storefronts.ts +6 -3
- package/src/subscriptions.ts +6 -3
- package/src/webhooks.ts +4 -2
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,KAA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GAAA,CAAI,CAAC,CAAA,CAAE,GAAA,CAAI,CAAC,CAAA;AAAA,EACtC,YAAA,EAAcA,KAAAA,CAAE,MAAA,EAAO,CAAE,GAAA,EAAI,CAAE,GAAA,CAAI,GAAG,CAAA,CAAE,GAAA,CAAI,GAAG,CAAA,CAAE,QAAA,EAAS;AAAA,EAC1D,UAAA,EAAYA,MAAE,MAAA,EAAO,CAAE,KAAI,CAAE,GAAA,CAAI,CAAC,CAAA,CAAE,QAAA,EAAS;AAAA,EAC7C,WAAWA,KAAAA,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,MAAE,MAAA,EAAO;AAAA,EACrB,YAAA,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 .refine((v) => BigInt(v) >= 0n, 'must be >= 0')\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.infer<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', 'growth', 'business', '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.infer<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.infer<typeof replayDeliveryInputSchema>\n"]}
|
|
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,CA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AAA,CAAE,GAAA,CAAI,GAAG,CAAA,CAAE,QAAA,EAAS;AAAA,EAC1D,UAAA,EAAYA,MAAE,MAAA,EAAO,CAAE,KAAI,CAAE,GAAA,CAAI,CAAC,CAAA,CAAE,QAAA,EAAS;AAAA,EAC7C,WAAWA,KAAAA,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,MAAE,MAAA,EAAO;AAAA,EACrB,YAAA,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 .refine((v) => BigInt(v) >= 0n, 'must be >= 0')\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', 'growth', 'business', '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"]}
|
package/dist/webhooks.d.cts
CHANGED
|
@@ -32,8 +32,8 @@ declare const webhookEndpointSchema: z.ZodObject<{
|
|
|
32
32
|
status: "disabled" | "active";
|
|
33
33
|
id: string;
|
|
34
34
|
merchantId: string;
|
|
35
|
-
createdAt: string;
|
|
36
35
|
mode: "test" | "live";
|
|
36
|
+
createdAt: string;
|
|
37
37
|
description: string | null;
|
|
38
38
|
updatedAt: string;
|
|
39
39
|
url: string;
|
|
@@ -44,8 +44,8 @@ declare const webhookEndpointSchema: z.ZodObject<{
|
|
|
44
44
|
status: "disabled" | "active";
|
|
45
45
|
id: string;
|
|
46
46
|
merchantId: string;
|
|
47
|
-
createdAt: string;
|
|
48
47
|
mode: "test" | "live";
|
|
48
|
+
createdAt: string;
|
|
49
49
|
description: string | null;
|
|
50
50
|
updatedAt: string;
|
|
51
51
|
url: string;
|
|
@@ -70,7 +70,8 @@ declare const createWebhookEndpointInputSchema: z.ZodObject<{
|
|
|
70
70
|
events: ["payment.created" | "payment.completed" | "payment.failed" | "subscription.created" | "subscription.charged" | "subscription.charge_failed" | "subscription.recovery_attempt" | "subscription.recovery_outcome" | "subscription.cancelled" | "subscription.lapsed" | "refund.created" | "refund.completed" | "refund.failed" | "invoice.created" | "invoice.paid" | "invoice.overdue" | "agent.action_executed" | "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.recovery_outcome" | "subscription.cancelled" | "subscription.lapsed" | "refund.created" | "refund.completed" | "refund.failed" | "invoice.created" | "invoice.paid" | "invoice.overdue" | "agent.action_executed" | "agent.job_proposed" | "agent.job_completed" | "agent.job_disputed" | "compliance.wallet_flagged" | "compliance.wallet_blocked")[]];
|
|
71
71
|
description?: string | undefined;
|
|
72
72
|
}>;
|
|
73
|
-
type CreateWebhookEndpointInput = z.
|
|
73
|
+
type CreateWebhookEndpointInput = z.input<typeof createWebhookEndpointInputSchema>;
|
|
74
|
+
type CreateWebhookEndpointParsed = z.output<typeof createWebhookEndpointInputSchema>;
|
|
74
75
|
declare const createWebhookEndpointOutputSchema: z.ZodObject<{
|
|
75
76
|
endpoint: z.ZodObject<{
|
|
76
77
|
id: z.ZodString;
|
|
@@ -88,8 +89,8 @@ declare const createWebhookEndpointOutputSchema: z.ZodObject<{
|
|
|
88
89
|
status: "disabled" | "active";
|
|
89
90
|
id: string;
|
|
90
91
|
merchantId: string;
|
|
91
|
-
createdAt: string;
|
|
92
92
|
mode: "test" | "live";
|
|
93
|
+
createdAt: string;
|
|
93
94
|
description: string | null;
|
|
94
95
|
updatedAt: string;
|
|
95
96
|
url: string;
|
|
@@ -100,8 +101,8 @@ declare const createWebhookEndpointOutputSchema: z.ZodObject<{
|
|
|
100
101
|
status: "disabled" | "active";
|
|
101
102
|
id: string;
|
|
102
103
|
merchantId: string;
|
|
103
|
-
createdAt: string;
|
|
104
104
|
mode: "test" | "live";
|
|
105
|
+
createdAt: string;
|
|
105
106
|
description: string | null;
|
|
106
107
|
updatedAt: string;
|
|
107
108
|
url: string;
|
|
@@ -116,8 +117,8 @@ declare const createWebhookEndpointOutputSchema: z.ZodObject<{
|
|
|
116
117
|
status: "disabled" | "active";
|
|
117
118
|
id: string;
|
|
118
119
|
merchantId: string;
|
|
119
|
-
createdAt: string;
|
|
120
120
|
mode: "test" | "live";
|
|
121
|
+
createdAt: string;
|
|
121
122
|
description: string | null;
|
|
122
123
|
updatedAt: string;
|
|
123
124
|
url: string;
|
|
@@ -131,8 +132,8 @@ declare const createWebhookEndpointOutputSchema: z.ZodObject<{
|
|
|
131
132
|
status: "disabled" | "active";
|
|
132
133
|
id: string;
|
|
133
134
|
merchantId: string;
|
|
134
|
-
createdAt: string;
|
|
135
135
|
mode: "test" | "live";
|
|
136
|
+
createdAt: string;
|
|
136
137
|
description: string | null;
|
|
137
138
|
updatedAt: string;
|
|
138
139
|
url: string;
|
|
@@ -255,6 +256,7 @@ declare const replayDeliveryInputSchema: z.ZodObject<{
|
|
|
255
256
|
}, {
|
|
256
257
|
id: string;
|
|
257
258
|
}>;
|
|
258
|
-
type ReplayDeliveryInput = z.
|
|
259
|
+
type ReplayDeliveryInput = z.input<typeof replayDeliveryInputSchema>;
|
|
260
|
+
type ReplayDeliveryParsed = z.output<typeof replayDeliveryInputSchema>;
|
|
259
261
|
|
|
260
|
-
export { type CreateWebhookEndpointInput, type CreateWebhookEndpointOutput, type ReplayDeliveryInput, type WebhookDelivery, type WebhookDeliveryDetail, type WebhookDeliveryStatus, type WebhookEndpoint, type WebhookEndpointStatus, type WebhookEventName, createWebhookEndpointInputSchema, createWebhookEndpointOutputSchema, replayDeliveryInputSchema, webhookDeliveryDetailSchema, webhookDeliverySchema, webhookDeliveryStatusSchema, webhookEndpointSchema, webhookEndpointStatusSchema, webhookEventNameSchema };
|
|
262
|
+
export { type CreateWebhookEndpointInput, type CreateWebhookEndpointOutput, type CreateWebhookEndpointParsed, type ReplayDeliveryInput, type ReplayDeliveryParsed, type WebhookDelivery, type WebhookDeliveryDetail, type WebhookDeliveryStatus, type WebhookEndpoint, type WebhookEndpointStatus, type WebhookEventName, createWebhookEndpointInputSchema, createWebhookEndpointOutputSchema, replayDeliveryInputSchema, webhookDeliveryDetailSchema, webhookDeliverySchema, webhookDeliveryStatusSchema, webhookEndpointSchema, webhookEndpointStatusSchema, webhookEventNameSchema };
|
package/dist/webhooks.d.ts
CHANGED
|
@@ -32,8 +32,8 @@ declare const webhookEndpointSchema: z.ZodObject<{
|
|
|
32
32
|
status: "disabled" | "active";
|
|
33
33
|
id: string;
|
|
34
34
|
merchantId: string;
|
|
35
|
-
createdAt: string;
|
|
36
35
|
mode: "test" | "live";
|
|
36
|
+
createdAt: string;
|
|
37
37
|
description: string | null;
|
|
38
38
|
updatedAt: string;
|
|
39
39
|
url: string;
|
|
@@ -44,8 +44,8 @@ declare const webhookEndpointSchema: z.ZodObject<{
|
|
|
44
44
|
status: "disabled" | "active";
|
|
45
45
|
id: string;
|
|
46
46
|
merchantId: string;
|
|
47
|
-
createdAt: string;
|
|
48
47
|
mode: "test" | "live";
|
|
48
|
+
createdAt: string;
|
|
49
49
|
description: string | null;
|
|
50
50
|
updatedAt: string;
|
|
51
51
|
url: string;
|
|
@@ -70,7 +70,8 @@ declare const createWebhookEndpointInputSchema: z.ZodObject<{
|
|
|
70
70
|
events: ["payment.created" | "payment.completed" | "payment.failed" | "subscription.created" | "subscription.charged" | "subscription.charge_failed" | "subscription.recovery_attempt" | "subscription.recovery_outcome" | "subscription.cancelled" | "subscription.lapsed" | "refund.created" | "refund.completed" | "refund.failed" | "invoice.created" | "invoice.paid" | "invoice.overdue" | "agent.action_executed" | "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.recovery_outcome" | "subscription.cancelled" | "subscription.lapsed" | "refund.created" | "refund.completed" | "refund.failed" | "invoice.created" | "invoice.paid" | "invoice.overdue" | "agent.action_executed" | "agent.job_proposed" | "agent.job_completed" | "agent.job_disputed" | "compliance.wallet_flagged" | "compliance.wallet_blocked")[]];
|
|
71
71
|
description?: string | undefined;
|
|
72
72
|
}>;
|
|
73
|
-
type CreateWebhookEndpointInput = z.
|
|
73
|
+
type CreateWebhookEndpointInput = z.input<typeof createWebhookEndpointInputSchema>;
|
|
74
|
+
type CreateWebhookEndpointParsed = z.output<typeof createWebhookEndpointInputSchema>;
|
|
74
75
|
declare const createWebhookEndpointOutputSchema: z.ZodObject<{
|
|
75
76
|
endpoint: z.ZodObject<{
|
|
76
77
|
id: z.ZodString;
|
|
@@ -88,8 +89,8 @@ declare const createWebhookEndpointOutputSchema: z.ZodObject<{
|
|
|
88
89
|
status: "disabled" | "active";
|
|
89
90
|
id: string;
|
|
90
91
|
merchantId: string;
|
|
91
|
-
createdAt: string;
|
|
92
92
|
mode: "test" | "live";
|
|
93
|
+
createdAt: string;
|
|
93
94
|
description: string | null;
|
|
94
95
|
updatedAt: string;
|
|
95
96
|
url: string;
|
|
@@ -100,8 +101,8 @@ declare const createWebhookEndpointOutputSchema: z.ZodObject<{
|
|
|
100
101
|
status: "disabled" | "active";
|
|
101
102
|
id: string;
|
|
102
103
|
merchantId: string;
|
|
103
|
-
createdAt: string;
|
|
104
104
|
mode: "test" | "live";
|
|
105
|
+
createdAt: string;
|
|
105
106
|
description: string | null;
|
|
106
107
|
updatedAt: string;
|
|
107
108
|
url: string;
|
|
@@ -116,8 +117,8 @@ declare const createWebhookEndpointOutputSchema: z.ZodObject<{
|
|
|
116
117
|
status: "disabled" | "active";
|
|
117
118
|
id: string;
|
|
118
119
|
merchantId: string;
|
|
119
|
-
createdAt: string;
|
|
120
120
|
mode: "test" | "live";
|
|
121
|
+
createdAt: string;
|
|
121
122
|
description: string | null;
|
|
122
123
|
updatedAt: string;
|
|
123
124
|
url: string;
|
|
@@ -131,8 +132,8 @@ declare const createWebhookEndpointOutputSchema: z.ZodObject<{
|
|
|
131
132
|
status: "disabled" | "active";
|
|
132
133
|
id: string;
|
|
133
134
|
merchantId: string;
|
|
134
|
-
createdAt: string;
|
|
135
135
|
mode: "test" | "live";
|
|
136
|
+
createdAt: string;
|
|
136
137
|
description: string | null;
|
|
137
138
|
updatedAt: string;
|
|
138
139
|
url: string;
|
|
@@ -255,6 +256,7 @@ declare const replayDeliveryInputSchema: z.ZodObject<{
|
|
|
255
256
|
}, {
|
|
256
257
|
id: string;
|
|
257
258
|
}>;
|
|
258
|
-
type ReplayDeliveryInput = z.
|
|
259
|
+
type ReplayDeliveryInput = z.input<typeof replayDeliveryInputSchema>;
|
|
260
|
+
type ReplayDeliveryParsed = z.output<typeof replayDeliveryInputSchema>;
|
|
259
261
|
|
|
260
|
-
export { type CreateWebhookEndpointInput, type CreateWebhookEndpointOutput, type ReplayDeliveryInput, type WebhookDelivery, type WebhookDeliveryDetail, type WebhookDeliveryStatus, type WebhookEndpoint, type WebhookEndpointStatus, type WebhookEventName, createWebhookEndpointInputSchema, createWebhookEndpointOutputSchema, replayDeliveryInputSchema, webhookDeliveryDetailSchema, webhookDeliverySchema, webhookDeliveryStatusSchema, webhookEndpointSchema, webhookEndpointStatusSchema, webhookEventNameSchema };
|
|
262
|
+
export { type CreateWebhookEndpointInput, type CreateWebhookEndpointOutput, type CreateWebhookEndpointParsed, type ReplayDeliveryInput, type ReplayDeliveryParsed, type WebhookDelivery, type WebhookDeliveryDetail, type WebhookDeliveryStatus, type WebhookEndpoint, type WebhookEndpointStatus, type WebhookEventName, createWebhookEndpointInputSchema, createWebhookEndpointOutputSchema, replayDeliveryInputSchema, webhookDeliveryDetailSchema, webhookDeliverySchema, webhookDeliveryStatusSchema, webhookEndpointSchema, webhookEndpointStatusSchema, webhookEventNameSchema };
|
package/dist/webhooks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/common.ts","../src/webhooks.ts"],"names":["z"],"mappings":";;;AAQO,IAAM,QAAA,GAAW,CAAA,CACrB,MAAA,EAAO,C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A,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 .refine((v) => BigInt(v) >= 0n, 'must be >= 0')\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.infer<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', 'growth', 'business', '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.infer<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.infer<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,CAA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AC5C,EAAA,EAAI,QAAA;AAAA,EACJ,UAAA,EAAY,QAAA;AAAA,EACZ,UAAA,EAAY,QAAA;AAAA,EACZ,OAAA,EAAS,QAAA;AAAA,EACT,SAAA,EAAW,sBAAA;AAAA,EACX,MAAA,EAAQ,2BAAA;AAAA,EACR,OAAA,EAASA,CAAAA,CAAE,MAAA,EAAO,CAAE,GAAA,GAAM,GAAA,CAAI,CAAC,CAAA,CAAE,GAAA,CAAI,CAAC,CAAA;AAAA,EACtC,YAAA,EAAcA,CAAAA,CAAE,MAAA,EAAO,CAAE,GAAA,EAAI,CAAE,GAAA,CAAI,GAAG,CAAA,CAAE,GAAA,CAAI,GAAG,CAAA,CAAE,QAAA,EAAS;AAAA,EAC1D,UAAA,EAAYA,EAAE,MAAA,EAAO,CAAE,KAAI,CAAE,GAAA,CAAI,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 .refine((v) => BigInt(v) >= 0n, 'must be >= 0')\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', 'growth', 'business', '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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strimz/shared-types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.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>",
|
package/src/agents.ts
CHANGED
|
@@ -65,7 +65,8 @@ export type AgentMerchantConfig = z.infer<typeof agentMerchantConfigSchema>
|
|
|
65
65
|
export const updateAgentConfigInputSchema = agentMerchantConfigSchema
|
|
66
66
|
.omit({ merchantId: true, updatedAt: true })
|
|
67
67
|
.partial()
|
|
68
|
-
export type UpdateAgentConfigInput = z.
|
|
68
|
+
export type UpdateAgentConfigInput = z.input<typeof updateAgentConfigInputSchema>
|
|
69
|
+
export type UpdateAgentConfigParsed = z.output<typeof updateAgentConfigInputSchema>
|
|
69
70
|
|
|
70
71
|
// ---------- Activity log ----------
|
|
71
72
|
|
|
@@ -153,4 +154,5 @@ export const createAgentJobInputSchema = z.object({
|
|
|
153
154
|
currency: z.enum(['USDC', 'EURC']),
|
|
154
155
|
assessorAddress: evmAddressSchema.optional(),
|
|
155
156
|
})
|
|
156
|
-
export type CreateAgentJobInput = z.
|
|
157
|
+
export type CreateAgentJobInput = z.input<typeof createAgentJobInputSchema>
|
|
158
|
+
export type CreateAgentJobParsed = z.output<typeof createAgentJobInputSchema>
|
package/src/api-keys.ts
CHANGED
|
@@ -71,7 +71,8 @@ export const createApiKeyInputSchema = z.object({
|
|
|
71
71
|
mode: modeSchema,
|
|
72
72
|
scopes: z.array(apiKeyScopeSchema).nonempty(),
|
|
73
73
|
})
|
|
74
|
-
export type CreateApiKeyInput = z.
|
|
74
|
+
export type CreateApiKeyInput = z.input<typeof createApiKeyInputSchema>
|
|
75
|
+
export type CreateApiKeyParsed = z.output<typeof createApiKeyInputSchema>
|
|
75
76
|
|
|
76
77
|
export const createApiKeyOutputSchema = z.object({
|
|
77
78
|
apiKey: apiKeySchema,
|
|
@@ -83,4 +84,5 @@ export type CreateApiKeyOutput = z.infer<typeof createApiKeyOutputSchema>
|
|
|
83
84
|
export const rotateApiKeyInputSchema = z.object({
|
|
84
85
|
id: idSchema,
|
|
85
86
|
})
|
|
86
|
-
export type RotateApiKeyInput = z.
|
|
87
|
+
export type RotateApiKeyInput = z.input<typeof rotateApiKeyInputSchema>
|
|
88
|
+
export type RotateApiKeyParsed = z.output<typeof rotateApiKeyInputSchema>
|
package/src/common.ts
CHANGED
|
@@ -66,7 +66,8 @@ export const paginationInputSchema = z.object({
|
|
|
66
66
|
limit: z.number().int().min(1).max(100).default(25),
|
|
67
67
|
cursor: z.string().min(1).max(200).nullish(),
|
|
68
68
|
})
|
|
69
|
-
export type PaginationInput = z.
|
|
69
|
+
export type PaginationInput = z.input<typeof paginationInputSchema>
|
|
70
|
+
export type PaginationParsed = z.output<typeof paginationInputSchema>
|
|
70
71
|
|
|
71
72
|
/** Pagination envelope used by every list response. */
|
|
72
73
|
export const makePaginatedSchema = <T extends z.ZodTypeAny>(item: T) =>
|
package/src/contact.ts
CHANGED
|
@@ -18,7 +18,8 @@ export const contactRequestInputSchema = z.object({
|
|
|
18
18
|
topic: contactTopicSchema,
|
|
19
19
|
message: z.string().min(20).max(4000),
|
|
20
20
|
})
|
|
21
|
-
export type ContactRequestInput = z.
|
|
21
|
+
export type ContactRequestInput = z.input<typeof contactRequestInputSchema>
|
|
22
|
+
export type ContactRequestParsed = z.output<typeof contactRequestInputSchema>
|
|
22
23
|
|
|
23
24
|
export const contactRequestOutputSchema = z.object({
|
|
24
25
|
ok: z.literal(true),
|
package/src/customers.ts
CHANGED
|
@@ -37,4 +37,5 @@ export const upsertCustomerInputSchema = z.object({
|
|
|
37
37
|
displayName: z.string().min(1).max(120).optional(),
|
|
38
38
|
metadata: metadataSchema.optional(),
|
|
39
39
|
})
|
|
40
|
-
export type UpsertCustomerInput = z.
|
|
40
|
+
export type UpsertCustomerInput = z.input<typeof upsertCustomerInputSchema>
|
|
41
|
+
export type UpsertCustomerParsed = z.output<typeof upsertCustomerInputSchema>
|
package/src/invoices.ts
CHANGED
|
@@ -50,4 +50,5 @@ export const createInvoiceInputSchema = z.object({
|
|
|
50
50
|
note: z.string().max(2000).optional(),
|
|
51
51
|
dueInDays: z.number().int().min(1).max(90).default(7),
|
|
52
52
|
})
|
|
53
|
-
export type CreateInvoiceInput = z.
|
|
53
|
+
export type CreateInvoiceInput = z.input<typeof createInvoiceInputSchema>
|
|
54
|
+
export type CreateInvoiceParsed = z.output<typeof createInvoiceInputSchema>
|
package/src/merchants.ts
CHANGED
|
@@ -52,7 +52,8 @@ export const createMerchantInputSchema = z.object({
|
|
|
52
52
|
countryCode: z.string().length(2).optional(),
|
|
53
53
|
websiteUrl: z.string().url().optional(),
|
|
54
54
|
})
|
|
55
|
-
export type CreateMerchantInput = z.
|
|
55
|
+
export type CreateMerchantInput = z.input<typeof createMerchantInputSchema>
|
|
56
|
+
export type CreateMerchantParsed = z.output<typeof createMerchantInputSchema>
|
|
56
57
|
|
|
57
58
|
/**
|
|
58
59
|
* Merchant email opt-outs, persisted at `Merchant.metadata.emailPrefs`.
|
|
@@ -83,12 +84,14 @@ export const updateMerchantInputSchema = z
|
|
|
83
84
|
emailPrefs: merchantEmailPrefsSchema.partial(),
|
|
84
85
|
})
|
|
85
86
|
.partial()
|
|
86
|
-
export type UpdateMerchantInput = z.
|
|
87
|
+
export type UpdateMerchantInput = z.input<typeof updateMerchantInputSchema>
|
|
88
|
+
export type UpdateMerchantParsed = z.output<typeof updateMerchantInputSchema>
|
|
87
89
|
|
|
88
90
|
export const changeTierInputSchema = z.object({
|
|
89
91
|
tier: merchantTierSchema,
|
|
90
92
|
})
|
|
91
|
-
export type ChangeTierInput = z.
|
|
93
|
+
export type ChangeTierInput = z.input<typeof changeTierInputSchema>
|
|
94
|
+
export type ChangeTierParsed = z.output<typeof changeTierInputSchema>
|
|
92
95
|
|
|
93
96
|
/**
|
|
94
97
|
* Self-attested onboarding form the dashboard collects after a
|
|
@@ -110,7 +113,8 @@ export const onboardMerchantInputSchema = z.object({
|
|
|
110
113
|
payoutAddress: evmAddressSchema,
|
|
111
114
|
defaultCurrency: z.enum(['USDC', 'EURC']).optional(),
|
|
112
115
|
})
|
|
113
|
-
export type OnboardMerchantInput = z.
|
|
116
|
+
export type OnboardMerchantInput = z.input<typeof onboardMerchantInputSchema>
|
|
117
|
+
export type OnboardMerchantParsed = z.output<typeof onboardMerchantInputSchema>
|
|
114
118
|
|
|
115
119
|
export const merchantPublicBrandSchema = z.object({
|
|
116
120
|
id: idSchema,
|
|
@@ -170,7 +174,8 @@ export const inviteMemberInputSchema = z.object({
|
|
|
170
174
|
email: emailSchema,
|
|
171
175
|
role: merchantRoleSchema,
|
|
172
176
|
})
|
|
173
|
-
export type InviteMemberInput = z.
|
|
177
|
+
export type InviteMemberInput = z.input<typeof inviteMemberInputSchema>
|
|
178
|
+
export type InviteMemberParsed = z.output<typeof inviteMemberInputSchema>
|
|
174
179
|
|
|
175
180
|
// ---------- Auth ----------
|
|
176
181
|
|
|
@@ -178,7 +183,8 @@ export const loginInputSchema = z.object({
|
|
|
178
183
|
email: emailSchema,
|
|
179
184
|
password: z.string().min(1).max(128),
|
|
180
185
|
})
|
|
181
|
-
export type LoginInput = z.
|
|
186
|
+
export type LoginInput = z.input<typeof loginInputSchema>
|
|
187
|
+
export type LoginParsed = z.output<typeof loginInputSchema>
|
|
182
188
|
|
|
183
189
|
export const loginOutputSchema = z.object({
|
|
184
190
|
accessToken: z.string(),
|
package/src/notifications.ts
CHANGED
|
@@ -37,7 +37,8 @@ export const createBroadcastInputSchema = z
|
|
|
37
37
|
message: 'merchantId is required when audience is merchant',
|
|
38
38
|
path: ['merchantId'],
|
|
39
39
|
})
|
|
40
|
-
export type CreateBroadcastInput = z.
|
|
40
|
+
export type CreateBroadcastInput = z.input<typeof createBroadcastInputSchema>
|
|
41
|
+
export type CreateBroadcastParsed = z.output<typeof createBroadcastInputSchema>
|
|
41
42
|
|
|
42
43
|
export const broadcastSchema = z.object({
|
|
43
44
|
id: idSchema,
|
package/src/payment-sessions.ts
CHANGED
|
@@ -133,7 +133,8 @@ export const createPaymentSessionInputSchema = z.object({
|
|
|
133
133
|
.optional(),
|
|
134
134
|
metadata: metadataSchema.optional(),
|
|
135
135
|
})
|
|
136
|
-
export type CreatePaymentSessionInput = z.
|
|
136
|
+
export type CreatePaymentSessionInput = z.input<typeof createPaymentSessionInputSchema>
|
|
137
|
+
export type CreatePaymentSessionParsed = z.output<typeof createPaymentSessionInputSchema>
|
|
137
138
|
|
|
138
139
|
export const submitPaymentSessionInputSchema = z.object({
|
|
139
140
|
sourceChain: z.enum([
|
|
@@ -150,4 +151,5 @@ export const submitPaymentSessionInputSchema = z.object({
|
|
|
150
151
|
bridgeTxHash: evmTxHashSchema.optional(),
|
|
151
152
|
payerWalletAddress: evmAddressSchema,
|
|
152
153
|
})
|
|
153
|
-
export type SubmitPaymentSessionInput = z.
|
|
154
|
+
export type SubmitPaymentSessionInput = z.input<typeof submitPaymentSessionInputSchema>
|
|
155
|
+
export type SubmitPaymentSessionParsed = z.output<typeof submitPaymentSessionInputSchema>
|
package/src/refunds.ts
CHANGED
|
@@ -59,13 +59,15 @@ export const createRefundInputSchema = z.object({
|
|
|
59
59
|
reason: refundReasonSchema,
|
|
60
60
|
note: z.string().max(500).optional(),
|
|
61
61
|
})
|
|
62
|
-
export type CreateRefundInput = z.
|
|
62
|
+
export type CreateRefundInput = z.input<typeof createRefundInputSchema>
|
|
63
|
+
export type CreateRefundParsed = z.output<typeof createRefundInputSchema>
|
|
63
64
|
|
|
64
65
|
export const submitRefundSignatureInputSchema = z.object({
|
|
65
66
|
id: idSchema,
|
|
66
67
|
refundTxHash: evmTxHashSchema,
|
|
67
68
|
})
|
|
68
|
-
export type SubmitRefundSignatureInput = z.
|
|
69
|
+
export type SubmitRefundSignatureInput = z.input<typeof submitRefundSignatureInputSchema>
|
|
70
|
+
export type SubmitRefundSignatureParsed = z.output<typeof submitRefundSignatureInputSchema>
|
|
69
71
|
|
|
70
72
|
/**
|
|
71
73
|
* Response envelope for `POST /v1/refunds`. The API returns the newly
|
package/src/storefronts.ts
CHANGED
|
@@ -47,7 +47,8 @@ export const createStorefrontInputSchema = storefrontSchema.pick({
|
|
|
47
47
|
accentColor: true,
|
|
48
48
|
socialLinks: true,
|
|
49
49
|
})
|
|
50
|
-
export type CreateStorefrontInput = z.
|
|
50
|
+
export type CreateStorefrontInput = z.input<typeof createStorefrontInputSchema>
|
|
51
|
+
export type CreateStorefrontParsed = z.output<typeof createStorefrontInputSchema>
|
|
51
52
|
|
|
52
53
|
// ---------- Products ----------
|
|
53
54
|
|
|
@@ -103,7 +104,8 @@ export const createStorefrontProductInputSchema = storefrontProductSchema
|
|
|
103
104
|
})
|
|
104
105
|
}
|
|
105
106
|
})
|
|
106
|
-
export type CreateStorefrontProductInput = z.
|
|
107
|
+
export type CreateStorefrontProductInput = z.input<typeof createStorefrontProductInputSchema>
|
|
108
|
+
export type CreateStorefrontProductParsed = z.output<typeof createStorefrontProductInputSchema>
|
|
107
109
|
|
|
108
110
|
/**
|
|
109
111
|
* Payload for the public `/store/:slug/products/:id/checkout` endpoint.
|
|
@@ -116,7 +118,8 @@ export const storefrontCheckoutInputSchema = z.object({
|
|
|
116
118
|
customerEmail: z.string().email().optional(),
|
|
117
119
|
returnPath: z.string().max(200).optional(),
|
|
118
120
|
})
|
|
119
|
-
export type StorefrontCheckoutInput = z.
|
|
121
|
+
export type StorefrontCheckoutInput = z.input<typeof storefrontCheckoutInputSchema>
|
|
122
|
+
export type StorefrontCheckoutParsed = z.output<typeof storefrontCheckoutInputSchema>
|
|
120
123
|
|
|
121
124
|
/** Response shape from the public product-checkout endpoint. */
|
|
122
125
|
export const storefrontCheckoutResponseSchema = z.object({
|
package/src/subscriptions.ts
CHANGED
|
@@ -81,7 +81,8 @@ export const createSubscriptionPlanInputSchema = z.object({
|
|
|
81
81
|
trialPeriodDays: z.number().int().min(0).max(365).optional(),
|
|
82
82
|
metadata: metadataSchema.optional(),
|
|
83
83
|
})
|
|
84
|
-
export type CreateSubscriptionPlanInput = z.
|
|
84
|
+
export type CreateSubscriptionPlanInput = z.input<typeof createSubscriptionPlanInputSchema>
|
|
85
|
+
export type CreateSubscriptionPlanParsed = z.output<typeof createSubscriptionPlanInputSchema>
|
|
85
86
|
|
|
86
87
|
// ---------- Subscriptions ----------
|
|
87
88
|
|
|
@@ -143,13 +144,15 @@ export const createSubscriptionInputSchema = z.object({
|
|
|
143
144
|
gracePeriodHours: z.union([z.literal(24), z.literal(48), z.literal(72)]).default(48),
|
|
144
145
|
metadata: metadataSchema.optional(),
|
|
145
146
|
})
|
|
146
|
-
export type CreateSubscriptionInput = z.
|
|
147
|
+
export type CreateSubscriptionInput = z.input<typeof createSubscriptionInputSchema>
|
|
148
|
+
export type CreateSubscriptionParsed = z.output<typeof createSubscriptionInputSchema>
|
|
147
149
|
|
|
148
150
|
export const cancelSubscriptionInputSchema = z.object({
|
|
149
151
|
id: idSchema,
|
|
150
152
|
reason: z.string().max(500).optional(),
|
|
151
153
|
})
|
|
152
|
-
export type CancelSubscriptionInput = z.
|
|
154
|
+
export type CancelSubscriptionInput = z.input<typeof cancelSubscriptionInputSchema>
|
|
155
|
+
export type CancelSubscriptionParsed = z.output<typeof cancelSubscriptionInputSchema>
|
|
153
156
|
|
|
154
157
|
// ---------- Charges ----------
|
|
155
158
|
|
package/src/webhooks.ts
CHANGED
|
@@ -67,7 +67,8 @@ export const createWebhookEndpointInputSchema = z.object({
|
|
|
67
67
|
description: z.string().max(200).optional(),
|
|
68
68
|
mode: modeSchema,
|
|
69
69
|
})
|
|
70
|
-
export type CreateWebhookEndpointInput = z.
|
|
70
|
+
export type CreateWebhookEndpointInput = z.input<typeof createWebhookEndpointInputSchema>
|
|
71
|
+
export type CreateWebhookEndpointParsed = z.output<typeof createWebhookEndpointInputSchema>
|
|
71
72
|
|
|
72
73
|
export const createWebhookEndpointOutputSchema = z.object({
|
|
73
74
|
endpoint: webhookEndpointSchema,
|
|
@@ -118,4 +119,5 @@ export type WebhookDeliveryDetail = z.infer<typeof webhookDeliveryDetailSchema>
|
|
|
118
119
|
export const replayDeliveryInputSchema = z.object({
|
|
119
120
|
id: idSchema,
|
|
120
121
|
})
|
|
121
|
-
export type ReplayDeliveryInput = z.
|
|
122
|
+
export type ReplayDeliveryInput = z.input<typeof replayDeliveryInputSchema>
|
|
123
|
+
export type ReplayDeliveryParsed = z.output<typeof replayDeliveryInputSchema>
|