@peac/schema 0.12.4 → 0.12.5

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.
@@ -524,6 +524,10 @@ function isValidExtensionKey(key) {
524
524
  }
525
525
  var COMMERCE_EXTENSION_KEY = "org.peacprotocol/commerce";
526
526
  var AMOUNT_MINOR_PATTERN = /^-?[0-9]+$/;
527
+ var AmountMinorStringSchema = z.string().min(1).max(EXTENSION_LIMITS.maxAmountMinorLength).regex(
528
+ AMOUNT_MINOR_PATTERN,
529
+ 'amount_minor must be a base-10 integer string (e.g., "1000", "-50")'
530
+ );
527
531
  var CommerceExtensionSchema = z.object({
528
532
  /** Payment rail identifier (e.g., 'stripe', 'x402', 'lightning') */
529
533
  payment_rail: z.string().min(1).max(EXTENSION_LIMITS.maxPaymentRailLength),
@@ -532,10 +536,7 @@ var CommerceExtensionSchema = z.object({
532
536
  * Base-10 integer: optional leading minus, one or more digits.
533
537
  * Decimals and empty strings are rejected.
534
538
  */
535
- amount_minor: z.string().min(1).max(EXTENSION_LIMITS.maxAmountMinorLength).regex(
536
- AMOUNT_MINOR_PATTERN,
537
- 'amount_minor must be a base-10 integer string (e.g., "1000", "-50")'
538
- ),
539
+ amount_minor: AmountMinorStringSchema,
539
540
  /** ISO 4217 currency code or asset identifier */
540
541
  currency: z.string().min(1).max(EXTENSION_LIMITS.maxCurrencyLength),
541
542
  /** Caller-assigned payment reference */