@strimz/shared-types 0.5.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.
Files changed (73) hide show
  1. package/README.md +7 -4
  2. package/dist/agents.cjs.map +1 -1
  3. package/dist/agents.d.cts +5 -3
  4. package/dist/agents.d.ts +5 -3
  5. package/dist/agents.js.map +1 -1
  6. package/dist/api-keys.cjs +5 -1
  7. package/dist/api-keys.cjs.map +1 -1
  8. package/dist/api-keys.d.cts +17 -15
  9. package/dist/api-keys.d.ts +17 -15
  10. package/dist/api-keys.js +5 -1
  11. package/dist/api-keys.js.map +1 -1
  12. package/dist/common.cjs.map +1 -1
  13. package/dist/common.d.cts +3 -2
  14. package/dist/common.d.ts +3 -2
  15. package/dist/common.js.map +1 -1
  16. package/dist/compliance.cjs.map +1 -1
  17. package/dist/compliance.js.map +1 -1
  18. package/dist/customers.cjs.map +1 -1
  19. package/dist/customers.d.cts +3 -2
  20. package/dist/customers.d.ts +3 -2
  21. package/dist/customers.js.map +1 -1
  22. package/dist/events.cjs.map +1 -1
  23. package/dist/events.js.map +1 -1
  24. package/dist/index.cjs +5 -1
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.d.cts +16 -14
  27. package/dist/index.d.ts +16 -14
  28. package/dist/index.js +5 -1
  29. package/dist/index.js.map +1 -1
  30. package/dist/invoices.cjs.map +1 -1
  31. package/dist/invoices.d.cts +3 -2
  32. package/dist/invoices.d.ts +3 -2
  33. package/dist/invoices.js.map +1 -1
  34. package/dist/merchants.cjs.map +1 -1
  35. package/dist/merchants.d.cts +13 -7
  36. package/dist/merchants.d.ts +13 -7
  37. package/dist/merchants.js.map +1 -1
  38. package/dist/payment-sessions.cjs.map +1 -1
  39. package/dist/payment-sessions.d.cts +5 -3
  40. package/dist/payment-sessions.d.ts +5 -3
  41. package/dist/payment-sessions.js.map +1 -1
  42. package/dist/refunds.cjs.map +1 -1
  43. package/dist/refunds.d.cts +5 -3
  44. package/dist/refunds.d.ts +5 -3
  45. package/dist/refunds.js.map +1 -1
  46. package/dist/storefronts.cjs.map +1 -1
  47. package/dist/storefronts.d.cts +7 -4
  48. package/dist/storefronts.d.ts +7 -4
  49. package/dist/storefronts.js.map +1 -1
  50. package/dist/subscriptions.cjs.map +1 -1
  51. package/dist/subscriptions.d.cts +7 -4
  52. package/dist/subscriptions.d.ts +7 -4
  53. package/dist/subscriptions.js.map +1 -1
  54. package/dist/transactions.cjs.map +1 -1
  55. package/dist/transactions.js.map +1 -1
  56. package/dist/webhooks.cjs.map +1 -1
  57. package/dist/webhooks.d.cts +5 -3
  58. package/dist/webhooks.d.ts +5 -3
  59. package/dist/webhooks.js.map +1 -1
  60. package/package.json +1 -1
  61. package/src/agents.ts +4 -2
  62. package/src/api-keys.ts +8 -2
  63. package/src/common.ts +2 -1
  64. package/src/contact.ts +2 -1
  65. package/src/customers.ts +2 -1
  66. package/src/invoices.ts +2 -1
  67. package/src/merchants.ts +12 -6
  68. package/src/notifications.ts +2 -1
  69. package/src/payment-sessions.ts +4 -2
  70. package/src/refunds.ts +4 -2
  71. package/src/storefronts.ts +6 -3
  72. package/src/subscriptions.ts +6 -3
  73. package/src/webhooks.ts +4 -2
package/README.md CHANGED
@@ -9,8 +9,11 @@
9
9
  [![License: MIT](https://img.shields.io/badge/License-MIT-02C76A.svg)](./LICENSE)
10
10
 
11
11
  The Zod schema is the source of truth. TypeScript types are inferred
12
- through `z.infer<>`, so the wire format and the compile-time shape
13
- can never drift apart. The Strimz SDK consumes this package
12
+ from it, so the wire format and the compile-time shape can never
13
+ drift apart. Each request schema `xInputSchema` has two types:
14
+ `XInput` (`z.input<>`) is the body a caller sends, where a field with
15
+ a default is optional; `XParsed` (`z.output<>`) is the value after
16
+ `xInputSchema.parse`, with every default filled in. The Strimz SDK consumes this package
14
17
  internally, but you can use the schemas and types directly if you
15
18
  prefer to validate the wire format in your own code.
16
19
 
@@ -27,10 +30,10 @@ pnpm add @strimz/shared-types
27
30
  ```ts
28
31
  import {
29
32
  createPaymentSessionInputSchema,
30
- type CreatePaymentSessionInput,
33
+ type CreatePaymentSessionParsed,
31
34
  } from '@strimz/shared-types'
32
35
 
33
- const parsed: CreatePaymentSessionInput = createPaymentSessionInputSchema.parse(req.body)
36
+ const parsed: CreatePaymentSessionParsed = createPaymentSessionInputSchema.parse(req.body)
34
37
  ```
35
38
 
36
39
  ## Exhaustive webhook handling
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/common.ts","../src/agents.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;AAG3C,IAAM,gBAAA,GAAmBA,KAAA,CAC7B,MAAA,EAAO,CACP,KAAA,CAAM,qBAAA,EAAuB,oDAAoD,CAAA,CACjF,SAAA,CAAU,CAAC,CAAA,KAAM,CAAA,CAAE,aAAa,CAAA;AAG5B,IAAM,kBAAkBA,KAAA,CAC5B,MAAA,EAAO,CACP,KAAA,CAAM,uBAAuB,6DAA6D,CAAA;AAGlEA,KAAA,CAAE,MAAA,EAAO,CAAE,KAAA,EAAM,CAAE,IAAA,EAAK,CAAE,WAAA,EAAY,CAAE,GAAA,CAAI,GAAG;AAG5CA,KAAA,CAC3B,MAAA,EAAO,CACP,GAAA,EAAI,CACJ,MAAA,CAAO,CAAC,CAAA,KAAM,CAAA,CAAE,UAAA,CAAW,UAAU,CAAA,EAAG;AAAA,EACvC,OAAA,EAAS;AACX,CAAC;AAG0BA,KAAA,CAAE,MAAA,EAAO,CAAE,GAAA;AAOjC,IAAM,iBAAA,GAAoBA,KAAA,CAC9B,MAAA,EAAO,CACP,MAAM,UAAA,EAAY,iDAAiD,CAAA,CACnE,MAAA,CAAO,CAAC,CAAA,KAAM,MAAA,CAAO,CAAC,CAAA,IAAK,IAAI,cAAc,CAAA;AA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QAAA,EAAS;AAAA,EACtD,aAAA,EAAe,gBAAA;AAAA,EACf,WAAA,EAAaA,MAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA,CAAE,IAAI,GAAI,CAAA;AAAA,EACvC,MAAA,EAAQ,iBAAA;AAAA,EACR,UAAUA,KAAAA,CAAE,IAAA,CAAK,CAAC,MAAA,EAAQ,MAAM,CAAC,CAAA;AAAA,EACjC,MAAA,EAAQ,oBAAA;AAAA,EACR,eAAA,EAAiB,gBAAA;AAAA,EACjB,iBAAiBA,KAAAA,CACd,MAAA,GACA,KAAA,CAAM,kBAAkB,EACxB,QAAA,EAAS;AAAA,EACZ,YAAA,EAAc,gBAAgB,QAAA,EAAS;AAAA,EACvC,aAAA,EAAe,gBAAgB,QAAA,EAAS;AAAA,EACxC,SAAA,EAAW,kBAAA;AAAA,EACX,WAAA,EAAa,mBAAmB,QAAA;AAClC,CAAC;AAGM,IAAM,yBAAA,GAA4BA,MAAE,MAAA,CAAO;AAAA,EAChD,aAAA,EAAe,gBAAA;AAAA,EACf,WAAA,EAAaA,MAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA,CAAE,IAAI,GAAI,CAAA;AAAA,EACvC,MAAA,EAAQ,iBAAA;AAAA,EACR,UAAUA,KAAAA,CAAE,IAAA,CAAK,CAAC,MAAA,EAAQ,MAAM,CAAC,CAAA;AAAA,EACjC,eAAA,EAAiB,iBAAiB,QAAA;AACpC,CAAC","file":"agents.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 * AI AutoPay Agent. Identity, configuration, activity log, and ERC-8183 jobs.\n */\n\nimport { z } from 'zod'\nimport {\n evmAddressSchema,\n evmTxHashSchema,\n idSchema,\n isoTimestampSchema,\n metadataSchema,\n tokenAmountSchema,\n} from './common.js'\n\n// ---------- Identity ----------\n\nexport const agentIdentitySchema = z.object({\n id: idSchema,\n /** ERC-8004 on-chain identity address. */\n onchainAddress: evmAddressSchema,\n /** Public key or agent credential digest, as emitted by ERC-8004. */\n credentialDigest: z.string().regex(/^0x[a-fA-F0-9]+$/),\n name: z.string().min(1).max(120),\n version: z.string().min(1).max(40),\n reputationScore: z.number().min(0).max(100).nullable(),\n registeredAt: isoTimestampSchema,\n})\nexport type AgentIdentity = z.infer<typeof agentIdentitySchema>\n\n// ---------- Merchant config ----------\n\nexport const agentCapabilitySchema = z.enum([\n 'identity',\n 'recovery',\n 'routing',\n 'cashflow',\n 'commerce',\n 'pricing_intelligence',\n])\nexport type AgentCapability = z.infer<typeof agentCapabilitySchema>\n\nexport const agentMerchantConfigSchema = z.object({\n merchantId: idSchema,\n enabledCapabilities: z.array(agentCapabilitySchema).default([]),\n recovery: z.object({\n gracePeriodHours: z.union([z.literal(24), z.literal(48), z.literal(72)]).default(48),\n strategy: z.enum(['once', 'twice', 'until_grace_ends']).default('twice'),\n notificationTemplate: z.string().max(2000).nullable(),\n }),\n cashflow: z.object({\n digestEnabled: z.boolean().default(false),\n anomalySensitivity: z.enum(['low', 'medium', 'high']).default('medium'),\n autoConvertToYield: z.boolean().default(false),\n minimumLiquidReserveCents: z.number().int().nonnegative().default(100_000),\n }),\n commerce: z.object({\n requireHumanApprovalAboveUsdCents: z.number().int().nonnegative().default(100_000),\n approvedVendors: z.array(evmAddressSchema).default([]),\n monthlySpendCapUsdCents: z.number().int().nonnegative().nullable(),\n }),\n updatedAt: isoTimestampSchema,\n})\nexport type AgentMerchantConfig = z.infer<typeof agentMerchantConfigSchema>\n\nexport const updateAgentConfigInputSchema = agentMerchantConfigSchema\n .omit({ merchantId: true, updatedAt: true })\n .partial()\nexport type UpdateAgentConfigInput = z.infer<typeof updateAgentConfigInputSchema>\n\n// ---------- Activity log ----------\n\nexport const agentActionTypeSchema = z.enum([\n 'recovery_notification_sent',\n 'recovery_retry_scheduled',\n 'recovery_retry_executed',\n 'recovery_abandoned',\n 'routing_bridge_initiated',\n 'routing_payment_completed',\n 'cashflow_digest_sent',\n 'cashflow_anomaly_flagged',\n 'cashflow_yield_converted',\n 'commerce_job_created',\n 'commerce_job_approved',\n 'commerce_job_completed',\n 'commerce_job_disputed',\n])\nexport type AgentActionType = z.infer<typeof agentActionTypeSchema>\n\nexport const agentActionOutcomeSchema = z.enum(['success', 'failure', 'pending', 'skipped'])\nexport type AgentActionOutcome = z.infer<typeof agentActionOutcomeSchema>\n\nexport const agentActivityLogSchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n capability: agentCapabilitySchema,\n actionType: agentActionTypeSchema,\n outcome: agentActionOutcomeSchema,\n subscriptionId: idSchema.nullable(),\n transactionId: idSchema.nullable(),\n jobId: idSchema.nullable(),\n metadata: metadataSchema,\n createdAt: isoTimestampSchema,\n})\nexport type AgentActivityLog = z.infer<typeof agentActivityLogSchema>\n\n// ---------- ERC-8183 jobs ----------\n\n// Mirrors the DB `AgentJobStatus` enum, not the contract's JobStatus.\n// `accepted` is off-chain only (merchant approved, queued for on-chain\n// creation); `resolved` and `reclaimed` are the escrow's terminal exits\n// from a dispute and from a timeout reclaim respectively.\nexport const agentJobStatusSchema = z.enum([\n 'proposed',\n 'accepted',\n 'funded',\n 'in_progress',\n 'delivered',\n 'approved',\n 'completed',\n 'disputed',\n 'cancelled',\n 'resolved',\n 'reclaimed',\n])\nexport type AgentJobStatus = z.infer<typeof agentJobStatusSchema>\n\nexport const agentJobSchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n /** On-chain job id from StrimzAgentEscrow. */\n onchainJobId: z.number().int().nonnegative().nullable(),\n vendorAddress: evmAddressSchema,\n description: z.string().min(1).max(2000),\n amount: tokenAmountSchema,\n currency: z.enum(['USDC', 'EURC']),\n status: agentJobStatusSchema,\n assessorAddress: evmAddressSchema,\n deliverableHash: z\n .string()\n .regex(/^0x[a-fA-F0-9]+$/)\n .nullable(),\n escrowTxHash: evmTxHashSchema.nullable(),\n releaseTxHash: evmTxHashSchema.nullable(),\n createdAt: isoTimestampSchema,\n completedAt: isoTimestampSchema.nullable(),\n})\nexport type AgentJob = z.infer<typeof agentJobSchema>\n\nexport const createAgentJobInputSchema = z.object({\n vendorAddress: evmAddressSchema,\n description: z.string().min(1).max(2000),\n amount: tokenAmountSchema,\n currency: z.enum(['USDC', 'EURC']),\n assessorAddress: evmAddressSchema.optional(),\n})\nexport type CreateAgentJobInput = z.infer<typeof createAgentJobInputSchema>\n"]}
1
+ {"version":3,"sources":["../src/common.ts","../src/agents.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;AAG3C,IAAM,gBAAA,GAAmBA,KAAA,CAC7B,MAAA,EAAO,CACP,KAAA,CAAM,qBAAA,EAAuB,oDAAoD,CAAA,CACjF,SAAA,CAAU,CAAC,CAAA,KAAM,CAAA,CAAE,aAAa,CAAA;AAG5B,IAAM,kBAAkBA,KAAA,CAC5B,MAAA,EAAO,CACP,KAAA,CAAM,uBAAuB,6DAA6D,CAAA;AAGlEA,KAAA,CAAE,MAAA,EAAO,CAAE,KAAA,EAAM,CAAE,IAAA,EAAK,CAAE,WAAA,EAAY,CAAE,GAAA,CAAI,GAAG;AAG5CA,KAAA,CAC3B,MAAA,EAAO,CACP,GAAA,EAAI,CACJ,MAAA,CAAO,CAAC,CAAA,KAAM,CAAA,CAAE,UAAA,CAAW,UAAU,CAAA,EAAG;AAAA,EACvC,OAAA,EAAS;AACX,CAAC;AAG0BA,KAAA,CAAE,MAAA,EAAO,CAAE,GAAA;AAOjC,IAAM,iBAAA,GAAoBA,KAAA,CAC9B,MAAA,EAAO,CACP,MAAM,UAAA,EAAY,iDAAiD,CAAA,CACnE,MAAA,CAAO,CAAC,CAAA,KAAM,MAAA,CAAO,CAAC,CAAA,IAAK,IAAI,cAAc,CAAA;AAGtBA,KAAA,CAAE,MAAA,EAAO,CAAE,GAAA,EAAI,CAAE,GAAA,CAAI,CAAC,CAAA,CAAE,GAAA,CAAI,MAAA,CAAO,gBAAgB;AAGtE,IAAM,kBAAA,GAAqBA,KAAA,CAC/B,MAAA,EAAO,CACP,QAAA,CAAS,EAAE,MAAA,EAAQ,IAAA,E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,MAAA,EAAQ,MAAM,CAAC,CAAA;AAAA,EACjC,MAAA,EAAQ,oBAAA;AAAA,EACR,eAAA,EAAiB,gBAAA;AAAA,EACjB,iBAAiBA,KAAAA,CACd,MAAA,GACA,KAAA,CAAM,kBAAkB,EACxB,QAAA,EAAS;AAAA,EACZ,YAAA,EAAc,gBAAgB,QAAA,EAAS;AAAA,EACvC,aAAA,EAAe,gBAAgB,QAAA,EAAS;AAAA,EACxC,SAAA,EAAW,kBAAA;AAAA,EACX,WAAA,EAAa,mBAAmB,QAAA;AAClC,CAAC;AAGM,IAAM,yBAAA,GAA4BA,MAAE,MAAA,CAAO;AAAA,EAChD,aAAA,EAAe,gBAAA;AAAA,EACf,WAAA,EAAaA,MAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA,CAAE,IAAI,GAAI,CAAA;AAAA,EACvC,MAAA,EAAQ,iBAAA;AAAA,EACR,UAAUA,KAAAA,CAAE,IAAA,CAAK,CAAC,MAAA,EAAQ,MAAM,CAAC,CAAA;AAAA,EACjC,eAAA,EAAiB,iBAAiB,QAAA;AACpC,CAAC","file":"agents.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 * AI AutoPay Agent. Identity, configuration, activity log, and ERC-8183 jobs.\n */\n\nimport { z } from 'zod'\nimport {\n evmAddressSchema,\n evmTxHashSchema,\n idSchema,\n isoTimestampSchema,\n metadataSchema,\n tokenAmountSchema,\n} from './common.js'\n\n// ---------- Identity ----------\n\nexport const agentIdentitySchema = z.object({\n id: idSchema,\n /** ERC-8004 on-chain identity address. */\n onchainAddress: evmAddressSchema,\n /** Public key or agent credential digest, as emitted by ERC-8004. */\n credentialDigest: z.string().regex(/^0x[a-fA-F0-9]+$/),\n name: z.string().min(1).max(120),\n version: z.string().min(1).max(40),\n reputationScore: z.number().min(0).max(100).nullable(),\n registeredAt: isoTimestampSchema,\n})\nexport type AgentIdentity = z.infer<typeof agentIdentitySchema>\n\n// ---------- Merchant config ----------\n\nexport const agentCapabilitySchema = z.enum([\n 'identity',\n 'recovery',\n 'routing',\n 'cashflow',\n 'commerce',\n 'pricing_intelligence',\n])\nexport type AgentCapability = z.infer<typeof agentCapabilitySchema>\n\nexport const agentMerchantConfigSchema = z.object({\n merchantId: idSchema,\n enabledCapabilities: z.array(agentCapabilitySchema).default([]),\n recovery: z.object({\n gracePeriodHours: z.union([z.literal(24), z.literal(48), z.literal(72)]).default(48),\n strategy: z.enum(['once', 'twice', 'until_grace_ends']).default('twice'),\n notificationTemplate: z.string().max(2000).nullable(),\n }),\n cashflow: z.object({\n digestEnabled: z.boolean().default(false),\n anomalySensitivity: z.enum(['low', 'medium', 'high']).default('medium'),\n autoConvertToYield: z.boolean().default(false),\n minimumLiquidReserveCents: z.number().int().nonnegative().default(100_000),\n }),\n commerce: z.object({\n requireHumanApprovalAboveUsdCents: z.number().int().nonnegative().default(100_000),\n approvedVendors: z.array(evmAddressSchema).default([]),\n monthlySpendCapUsdCents: z.number().int().nonnegative().nullable(),\n }),\n updatedAt: isoTimestampSchema,\n})\nexport type AgentMerchantConfig = z.infer<typeof agentMerchantConfigSchema>\n\nexport const updateAgentConfigInputSchema = agentMerchantConfigSchema\n .omit({ merchantId: true, updatedAt: true })\n .partial()\nexport type UpdateAgentConfigInput = z.input<typeof updateAgentConfigInputSchema>\nexport type UpdateAgentConfigParsed = z.output<typeof updateAgentConfigInputSchema>\n\n// ---------- Activity log ----------\n\nexport const agentActionTypeSchema = z.enum([\n 'recovery_notification_sent',\n 'recovery_retry_scheduled',\n 'recovery_retry_executed',\n 'recovery_abandoned',\n 'routing_bridge_initiated',\n 'routing_payment_completed',\n 'cashflow_digest_sent',\n 'cashflow_anomaly_flagged',\n 'cashflow_yield_converted',\n 'commerce_job_created',\n 'commerce_job_approved',\n 'commerce_job_completed',\n 'commerce_job_disputed',\n])\nexport type AgentActionType = z.infer<typeof agentActionTypeSchema>\n\nexport const agentActionOutcomeSchema = z.enum(['success', 'failure', 'pending', 'skipped'])\nexport type AgentActionOutcome = z.infer<typeof agentActionOutcomeSchema>\n\nexport const agentActivityLogSchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n capability: agentCapabilitySchema,\n actionType: agentActionTypeSchema,\n outcome: agentActionOutcomeSchema,\n subscriptionId: idSchema.nullable(),\n transactionId: idSchema.nullable(),\n jobId: idSchema.nullable(),\n metadata: metadataSchema,\n createdAt: isoTimestampSchema,\n})\nexport type AgentActivityLog = z.infer<typeof agentActivityLogSchema>\n\n// ---------- ERC-8183 jobs ----------\n\n// Mirrors the DB `AgentJobStatus` enum, not the contract's JobStatus.\n// `accepted` is off-chain only (merchant approved, queued for on-chain\n// creation); `resolved` and `reclaimed` are the escrow's terminal exits\n// from a dispute and from a timeout reclaim respectively.\nexport const agentJobStatusSchema = z.enum([\n 'proposed',\n 'accepted',\n 'funded',\n 'in_progress',\n 'delivered',\n 'approved',\n 'completed',\n 'disputed',\n 'cancelled',\n 'resolved',\n 'reclaimed',\n])\nexport type AgentJobStatus = z.infer<typeof agentJobStatusSchema>\n\nexport const agentJobSchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n /** On-chain job id from StrimzAgentEscrow. */\n onchainJobId: z.number().int().nonnegative().nullable(),\n vendorAddress: evmAddressSchema,\n description: z.string().min(1).max(2000),\n amount: tokenAmountSchema,\n currency: z.enum(['USDC', 'EURC']),\n status: agentJobStatusSchema,\n assessorAddress: evmAddressSchema,\n deliverableHash: z\n .string()\n .regex(/^0x[a-fA-F0-9]+$/)\n .nullable(),\n escrowTxHash: evmTxHashSchema.nullable(),\n releaseTxHash: evmTxHashSchema.nullable(),\n createdAt: isoTimestampSchema,\n completedAt: isoTimestampSchema.nullable(),\n})\nexport type AgentJob = z.infer<typeof agentJobSchema>\n\nexport const createAgentJobInputSchema = z.object({\n vendorAddress: evmAddressSchema,\n description: z.string().min(1).max(2000),\n amount: tokenAmountSchema,\n currency: z.enum(['USDC', 'EURC']),\n assessorAddress: evmAddressSchema.optional(),\n})\nexport type CreateAgentJobInput = z.input<typeof createAgentJobInputSchema>\nexport type CreateAgentJobParsed = z.output<typeof createAgentJobInputSchema>\n"]}
package/dist/agents.d.cts CHANGED
@@ -203,7 +203,8 @@ declare const updateAgentConfigInputSchema: z.ZodObject<{
203
203
  } | undefined;
204
204
  enabledCapabilities?: ("identity" | "recovery" | "routing" | "cashflow" | "commerce" | "pricing_intelligence")[] | undefined;
205
205
  }>;
206
- type UpdateAgentConfigInput = z.infer<typeof updateAgentConfigInputSchema>;
206
+ type UpdateAgentConfigInput = z.input<typeof updateAgentConfigInputSchema>;
207
+ type UpdateAgentConfigParsed = z.output<typeof updateAgentConfigInputSchema>;
207
208
  declare const agentActionTypeSchema: z.ZodEnum<["recovery_notification_sent", "recovery_retry_scheduled", "recovery_retry_executed", "recovery_abandoned", "routing_bridge_initiated", "routing_payment_completed", "cashflow_digest_sent", "cashflow_anomaly_flagged", "cashflow_yield_converted", "commerce_job_created", "commerce_job_approved", "commerce_job_completed", "commerce_job_disputed"]>;
208
209
  type AgentActionType = z.infer<typeof agentActionTypeSchema>;
209
210
  declare const agentActionOutcomeSchema: z.ZodEnum<["success", "failure", "pending", "skipped"]>;
@@ -312,6 +313,7 @@ declare const createAgentJobInputSchema: z.ZodObject<{
312
313
  currency: "USDC" | "EURC";
313
314
  assessorAddress?: string | undefined;
314
315
  }>;
315
- type CreateAgentJobInput = z.infer<typeof createAgentJobInputSchema>;
316
+ type CreateAgentJobInput = z.input<typeof createAgentJobInputSchema>;
317
+ type CreateAgentJobParsed = z.output<typeof createAgentJobInputSchema>;
316
318
 
317
- export { type AgentActionOutcome, type AgentActionType, type AgentActivityLog, type AgentCapability, type AgentIdentity, type AgentJob, type AgentJobStatus, type AgentMerchantConfig, type CreateAgentJobInput, type UpdateAgentConfigInput, agentActionOutcomeSchema, agentActionTypeSchema, agentActivityLogSchema, agentCapabilitySchema, agentIdentitySchema, agentJobSchema, agentJobStatusSchema, agentMerchantConfigSchema, createAgentJobInputSchema, updateAgentConfigInputSchema };
319
+ export { type AgentActionOutcome, type AgentActionType, type AgentActivityLog, type AgentCapability, type AgentIdentity, type AgentJob, type AgentJobStatus, type AgentMerchantConfig, type CreateAgentJobInput, type CreateAgentJobParsed, type UpdateAgentConfigInput, type UpdateAgentConfigParsed, agentActionOutcomeSchema, agentActionTypeSchema, agentActivityLogSchema, agentCapabilitySchema, agentIdentitySchema, agentJobSchema, agentJobStatusSchema, agentMerchantConfigSchema, createAgentJobInputSchema, updateAgentConfigInputSchema };
package/dist/agents.d.ts CHANGED
@@ -203,7 +203,8 @@ declare const updateAgentConfigInputSchema: z.ZodObject<{
203
203
  } | undefined;
204
204
  enabledCapabilities?: ("identity" | "recovery" | "routing" | "cashflow" | "commerce" | "pricing_intelligence")[] | undefined;
205
205
  }>;
206
- type UpdateAgentConfigInput = z.infer<typeof updateAgentConfigInputSchema>;
206
+ type UpdateAgentConfigInput = z.input<typeof updateAgentConfigInputSchema>;
207
+ type UpdateAgentConfigParsed = z.output<typeof updateAgentConfigInputSchema>;
207
208
  declare const agentActionTypeSchema: z.ZodEnum<["recovery_notification_sent", "recovery_retry_scheduled", "recovery_retry_executed", "recovery_abandoned", "routing_bridge_initiated", "routing_payment_completed", "cashflow_digest_sent", "cashflow_anomaly_flagged", "cashflow_yield_converted", "commerce_job_created", "commerce_job_approved", "commerce_job_completed", "commerce_job_disputed"]>;
208
209
  type AgentActionType = z.infer<typeof agentActionTypeSchema>;
209
210
  declare const agentActionOutcomeSchema: z.ZodEnum<["success", "failure", "pending", "skipped"]>;
@@ -312,6 +313,7 @@ declare const createAgentJobInputSchema: z.ZodObject<{
312
313
  currency: "USDC" | "EURC";
313
314
  assessorAddress?: string | undefined;
314
315
  }>;
315
- type CreateAgentJobInput = z.infer<typeof createAgentJobInputSchema>;
316
+ type CreateAgentJobInput = z.input<typeof createAgentJobInputSchema>;
317
+ type CreateAgentJobParsed = z.output<typeof createAgentJobInputSchema>;
316
318
 
317
- export { type AgentActionOutcome, type AgentActionType, type AgentActivityLog, type AgentCapability, type AgentIdentity, type AgentJob, type AgentJobStatus, type AgentMerchantConfig, type CreateAgentJobInput, type UpdateAgentConfigInput, agentActionOutcomeSchema, agentActionTypeSchema, agentActivityLogSchema, agentCapabilitySchema, agentIdentitySchema, agentJobSchema, agentJobStatusSchema, agentMerchantConfigSchema, createAgentJobInputSchema, updateAgentConfigInputSchema };
319
+ export { type AgentActionOutcome, type AgentActionType, type AgentActivityLog, type AgentCapability, type AgentIdentity, type AgentJob, type AgentJobStatus, type AgentMerchantConfig, type CreateAgentJobInput, type CreateAgentJobParsed, type UpdateAgentConfigInput, type UpdateAgentConfigParsed, agentActionOutcomeSchema, agentActionTypeSchema, agentActivityLogSchema, agentCapabilitySchema, agentIdentitySchema, agentJobSchema, agentJobStatusSchema, agentMerchantConfigSchema, createAgentJobInputSchema, updateAgentConfigInputSchema };
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/common.ts","../src/agents.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;AAG3C,IAAM,gBAAA,GAAmB,CAAA,CAC7B,MAAA,EAAO,CACP,KAAA,CAAM,qBAAA,EAAuB,oDAAoD,CAAA,CACjF,SAAA,CAAU,CAAC,CAAA,KAAM,CAAA,CAAE,aAAa,CAAA;AAG5B,IAAM,kBAAkB,CAAA,CAC5B,MAAA,EAAO,CACP,KAAA,CAAM,uBAAuB,6DAA6D,CAAA;AAGlE,CAAA,CAAE,MAAA,EAAO,CAAE,KAAA,EAAM,CAAE,IAAA,EAAK,CAAE,WAAA,EAAY,CAAE,GAAA,CAAI,GAAG;AAG5C,CAAA,CAC3B,MAAA,EAAO,CACP,GAAA,EAAI,CACJ,MAAA,CAAO,CAAC,CAAA,KAAM,CAAA,CAAE,UAAA,CAAW,UAAU,CAAA,EAAG;AAAA,EACvC,OAAA,EAAS;AACX,CAAC;AAG0B,CAAA,CAAE,MAAA,EAAO,CAAE,GAAA;AAOjC,IAAM,iBAAA,GAAoB,CAAA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AA,EAAI,QAAA;AAAA,EACJ,UAAA,EAAY,QAAA;AAAA;AAAA,EAEZ,YAAA,EAAcA,EAAE,MAAA,EAAO,CAAE,KAAI,CAAE,WAAA,GAAc,QAAA,EAAS;AAAA,EACtD,aAAA,EAAe,gBAAA;AAAA,EACf,WAAA,EAAaA,EAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA,CAAE,IAAI,GAAI,CAAA;AAAA,EACvC,MAAA,EAAQ,iBAAA;AAAA,EACR,UAAUA,CAAAA,CAAE,IAAA,CAAK,CAAC,MAAA,EAAQ,MAAM,CAAC,CAAA;AAAA,EACjC,MAAA,EAAQ,oBAAA;AAAA,EACR,eAAA,EAAiB,gBAAA;AAAA,EACjB,iBAAiBA,CAAAA,CACd,MAAA,GACA,KAAA,CAAM,kBAAkB,EACxB,QAAA,EAAS;AAAA,EACZ,YAAA,EAAc,gBAAgB,QAAA,EAAS;AAAA,EACvC,aAAA,EAAe,gBAAgB,QAAA,EAAS;AAAA,EACxC,SAAA,EAAW,kBAAA;AAAA,EACX,WAAA,EAAa,mBAAmB,QAAA;AAClC,CAAC;AAGM,IAAM,yBAAA,GAA4BA,EAAE,MAAA,CAAO;AAAA,EAChD,aAAA,EAAe,gBAAA;AAAA,EACf,WAAA,EAAaA,EAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA,CAAE,IAAI,GAAI,CAAA;AAAA,EACvC,MAAA,EAAQ,iBAAA;AAAA,EACR,UAAUA,CAAAA,CAAE,IAAA,CAAK,CAAC,MAAA,EAAQ,MAAM,CAAC,CAAA;AAAA,EACjC,eAAA,EAAiB,iBAAiB,QAAA;AACpC,CAAC","file":"agents.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 * AI AutoPay Agent. Identity, configuration, activity log, and ERC-8183 jobs.\n */\n\nimport { z } from 'zod'\nimport {\n evmAddressSchema,\n evmTxHashSchema,\n idSchema,\n isoTimestampSchema,\n metadataSchema,\n tokenAmountSchema,\n} from './common.js'\n\n// ---------- Identity ----------\n\nexport const agentIdentitySchema = z.object({\n id: idSchema,\n /** ERC-8004 on-chain identity address. */\n onchainAddress: evmAddressSchema,\n /** Public key or agent credential digest, as emitted by ERC-8004. */\n credentialDigest: z.string().regex(/^0x[a-fA-F0-9]+$/),\n name: z.string().min(1).max(120),\n version: z.string().min(1).max(40),\n reputationScore: z.number().min(0).max(100).nullable(),\n registeredAt: isoTimestampSchema,\n})\nexport type AgentIdentity = z.infer<typeof agentIdentitySchema>\n\n// ---------- Merchant config ----------\n\nexport const agentCapabilitySchema = z.enum([\n 'identity',\n 'recovery',\n 'routing',\n 'cashflow',\n 'commerce',\n 'pricing_intelligence',\n])\nexport type AgentCapability = z.infer<typeof agentCapabilitySchema>\n\nexport const agentMerchantConfigSchema = z.object({\n merchantId: idSchema,\n enabledCapabilities: z.array(agentCapabilitySchema).default([]),\n recovery: z.object({\n gracePeriodHours: z.union([z.literal(24), z.literal(48), z.literal(72)]).default(48),\n strategy: z.enum(['once', 'twice', 'until_grace_ends']).default('twice'),\n notificationTemplate: z.string().max(2000).nullable(),\n }),\n cashflow: z.object({\n digestEnabled: z.boolean().default(false),\n anomalySensitivity: z.enum(['low', 'medium', 'high']).default('medium'),\n autoConvertToYield: z.boolean().default(false),\n minimumLiquidReserveCents: z.number().int().nonnegative().default(100_000),\n }),\n commerce: z.object({\n requireHumanApprovalAboveUsdCents: z.number().int().nonnegative().default(100_000),\n approvedVendors: z.array(evmAddressSchema).default([]),\n monthlySpendCapUsdCents: z.number().int().nonnegative().nullable(),\n }),\n updatedAt: isoTimestampSchema,\n})\nexport type AgentMerchantConfig = z.infer<typeof agentMerchantConfigSchema>\n\nexport const updateAgentConfigInputSchema = agentMerchantConfigSchema\n .omit({ merchantId: true, updatedAt: true })\n .partial()\nexport type UpdateAgentConfigInput = z.infer<typeof updateAgentConfigInputSchema>\n\n// ---------- Activity log ----------\n\nexport const agentActionTypeSchema = z.enum([\n 'recovery_notification_sent',\n 'recovery_retry_scheduled',\n 'recovery_retry_executed',\n 'recovery_abandoned',\n 'routing_bridge_initiated',\n 'routing_payment_completed',\n 'cashflow_digest_sent',\n 'cashflow_anomaly_flagged',\n 'cashflow_yield_converted',\n 'commerce_job_created',\n 'commerce_job_approved',\n 'commerce_job_completed',\n 'commerce_job_disputed',\n])\nexport type AgentActionType = z.infer<typeof agentActionTypeSchema>\n\nexport const agentActionOutcomeSchema = z.enum(['success', 'failure', 'pending', 'skipped'])\nexport type AgentActionOutcome = z.infer<typeof agentActionOutcomeSchema>\n\nexport const agentActivityLogSchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n capability: agentCapabilitySchema,\n actionType: agentActionTypeSchema,\n outcome: agentActionOutcomeSchema,\n subscriptionId: idSchema.nullable(),\n transactionId: idSchema.nullable(),\n jobId: idSchema.nullable(),\n metadata: metadataSchema,\n createdAt: isoTimestampSchema,\n})\nexport type AgentActivityLog = z.infer<typeof agentActivityLogSchema>\n\n// ---------- ERC-8183 jobs ----------\n\n// Mirrors the DB `AgentJobStatus` enum, not the contract's JobStatus.\n// `accepted` is off-chain only (merchant approved, queued for on-chain\n// creation); `resolved` and `reclaimed` are the escrow's terminal exits\n// from a dispute and from a timeout reclaim respectively.\nexport const agentJobStatusSchema = z.enum([\n 'proposed',\n 'accepted',\n 'funded',\n 'in_progress',\n 'delivered',\n 'approved',\n 'completed',\n 'disputed',\n 'cancelled',\n 'resolved',\n 'reclaimed',\n])\nexport type AgentJobStatus = z.infer<typeof agentJobStatusSchema>\n\nexport const agentJobSchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n /** On-chain job id from StrimzAgentEscrow. */\n onchainJobId: z.number().int().nonnegative().nullable(),\n vendorAddress: evmAddressSchema,\n description: z.string().min(1).max(2000),\n amount: tokenAmountSchema,\n currency: z.enum(['USDC', 'EURC']),\n status: agentJobStatusSchema,\n assessorAddress: evmAddressSchema,\n deliverableHash: z\n .string()\n .regex(/^0x[a-fA-F0-9]+$/)\n .nullable(),\n escrowTxHash: evmTxHashSchema.nullable(),\n releaseTxHash: evmTxHashSchema.nullable(),\n createdAt: isoTimestampSchema,\n completedAt: isoTimestampSchema.nullable(),\n})\nexport type AgentJob = z.infer<typeof agentJobSchema>\n\nexport const createAgentJobInputSchema = z.object({\n vendorAddress: evmAddressSchema,\n description: z.string().min(1).max(2000),\n amount: tokenAmountSchema,\n currency: z.enum(['USDC', 'EURC']),\n assessorAddress: evmAddressSchema.optional(),\n})\nexport type CreateAgentJobInput = z.infer<typeof createAgentJobInputSchema>\n"]}
1
+ {"version":3,"sources":["../src/common.ts","../src/agents.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;AAG3C,IAAM,gBAAA,GAAmB,CAAA,CAC7B,MAAA,EAAO,CACP,KAAA,CAAM,qBAAA,EAAuB,oDAAoD,CAAA,CACjF,SAAA,CAAU,CAAC,CAAA,KAAM,CAAA,CAAE,aAAa,CAAA;AAG5B,IAAM,kBAAkB,CAAA,CAC5B,MAAA,EAAO,CACP,KAAA,CAAM,uBAAuB,6DAA6D,CAAA;AAGlE,CAAA,CAAE,MAAA,EAAO,CAAE,KAAA,EAAM,CAAE,IAAA,EAAK,CAAE,WAAA,EAAY,CAAE,GAAA,CAAI,GAAG;AAG5C,CAAA,CAC3B,MAAA,EAAO,CACP,GAAA,EAAI,CACJ,MAAA,CAAO,CAAC,CAAA,KAAM,CAAA,CAAE,UAAA,CAAW,UAAU,CAAA,EAAG;AAAA,EACvC,OAAA,EAAS;AACX,CAAC;AAG0B,CAAA,CAAE,MAAA,EAAO,CAAE,GAAA;AAOjC,IAAM,iBAAA,GAAoB,CAAA,CAC9B,MAAA,EAAO,CACP,MAAM,UAAA,EAAY,iDAAiD,CAAA,CACnE,MAAA,CAAO,CAAC,CAAA,KAAM,MAAA,CAAO,CAAC,CAAA,IAAK,IAAI,cAAc,CAAA;AAGtB,CAAA,CAAE,MAAA,EAAO,CAAE,GAAA,EAAI,CAAE,GAAA,CAAI,CAAC,CAAA,CAAE,GAAA,CAAI,MAAA,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I,GAAI,CAAA;AAAA,EACvC,MAAA,EAAQ,iBAAA;AAAA,EACR,UAAUA,CAAAA,CAAE,IAAA,CAAK,CAAC,MAAA,EAAQ,MAAM,CAAC,CAAA;AAAA,EACjC,MAAA,EAAQ,oBAAA;AAAA,EACR,eAAA,EAAiB,gBAAA;AAAA,EACjB,iBAAiBA,CAAAA,CACd,MAAA,GACA,KAAA,CAAM,kBAAkB,EACxB,QAAA,EAAS;AAAA,EACZ,YAAA,EAAc,gBAAgB,QAAA,EAAS;AAAA,EACvC,aAAA,EAAe,gBAAgB,QAAA,EAAS;AAAA,EACxC,SAAA,EAAW,kBAAA;AAAA,EACX,WAAA,EAAa,mBAAmB,QAAA;AAClC,CAAC;AAGM,IAAM,yBAAA,GAA4BA,EAAE,MAAA,CAAO;AAAA,EAChD,aAAA,EAAe,gBAAA;AAAA,EACf,WAAA,EAAaA,EAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA,CAAE,IAAI,GAAI,CAAA;AAAA,EACvC,MAAA,EAAQ,iBAAA;AAAA,EACR,UAAUA,CAAAA,CAAE,IAAA,CAAK,CAAC,MAAA,EAAQ,MAAM,CAAC,CAAA;AAAA,EACjC,eAAA,EAAiB,iBAAiB,QAAA;AACpC,CAAC","file":"agents.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 * AI AutoPay Agent. Identity, configuration, activity log, and ERC-8183 jobs.\n */\n\nimport { z } from 'zod'\nimport {\n evmAddressSchema,\n evmTxHashSchema,\n idSchema,\n isoTimestampSchema,\n metadataSchema,\n tokenAmountSchema,\n} from './common.js'\n\n// ---------- Identity ----------\n\nexport const agentIdentitySchema = z.object({\n id: idSchema,\n /** ERC-8004 on-chain identity address. */\n onchainAddress: evmAddressSchema,\n /** Public key or agent credential digest, as emitted by ERC-8004. */\n credentialDigest: z.string().regex(/^0x[a-fA-F0-9]+$/),\n name: z.string().min(1).max(120),\n version: z.string().min(1).max(40),\n reputationScore: z.number().min(0).max(100).nullable(),\n registeredAt: isoTimestampSchema,\n})\nexport type AgentIdentity = z.infer<typeof agentIdentitySchema>\n\n// ---------- Merchant config ----------\n\nexport const agentCapabilitySchema = z.enum([\n 'identity',\n 'recovery',\n 'routing',\n 'cashflow',\n 'commerce',\n 'pricing_intelligence',\n])\nexport type AgentCapability = z.infer<typeof agentCapabilitySchema>\n\nexport const agentMerchantConfigSchema = z.object({\n merchantId: idSchema,\n enabledCapabilities: z.array(agentCapabilitySchema).default([]),\n recovery: z.object({\n gracePeriodHours: z.union([z.literal(24), z.literal(48), z.literal(72)]).default(48),\n strategy: z.enum(['once', 'twice', 'until_grace_ends']).default('twice'),\n notificationTemplate: z.string().max(2000).nullable(),\n }),\n cashflow: z.object({\n digestEnabled: z.boolean().default(false),\n anomalySensitivity: z.enum(['low', 'medium', 'high']).default('medium'),\n autoConvertToYield: z.boolean().default(false),\n minimumLiquidReserveCents: z.number().int().nonnegative().default(100_000),\n }),\n commerce: z.object({\n requireHumanApprovalAboveUsdCents: z.number().int().nonnegative().default(100_000),\n approvedVendors: z.array(evmAddressSchema).default([]),\n monthlySpendCapUsdCents: z.number().int().nonnegative().nullable(),\n }),\n updatedAt: isoTimestampSchema,\n})\nexport type AgentMerchantConfig = z.infer<typeof agentMerchantConfigSchema>\n\nexport const updateAgentConfigInputSchema = agentMerchantConfigSchema\n .omit({ merchantId: true, updatedAt: true })\n .partial()\nexport type UpdateAgentConfigInput = z.input<typeof updateAgentConfigInputSchema>\nexport type UpdateAgentConfigParsed = z.output<typeof updateAgentConfigInputSchema>\n\n// ---------- Activity log ----------\n\nexport const agentActionTypeSchema = z.enum([\n 'recovery_notification_sent',\n 'recovery_retry_scheduled',\n 'recovery_retry_executed',\n 'recovery_abandoned',\n 'routing_bridge_initiated',\n 'routing_payment_completed',\n 'cashflow_digest_sent',\n 'cashflow_anomaly_flagged',\n 'cashflow_yield_converted',\n 'commerce_job_created',\n 'commerce_job_approved',\n 'commerce_job_completed',\n 'commerce_job_disputed',\n])\nexport type AgentActionType = z.infer<typeof agentActionTypeSchema>\n\nexport const agentActionOutcomeSchema = z.enum(['success', 'failure', 'pending', 'skipped'])\nexport type AgentActionOutcome = z.infer<typeof agentActionOutcomeSchema>\n\nexport const agentActivityLogSchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n capability: agentCapabilitySchema,\n actionType: agentActionTypeSchema,\n outcome: agentActionOutcomeSchema,\n subscriptionId: idSchema.nullable(),\n transactionId: idSchema.nullable(),\n jobId: idSchema.nullable(),\n metadata: metadataSchema,\n createdAt: isoTimestampSchema,\n})\nexport type AgentActivityLog = z.infer<typeof agentActivityLogSchema>\n\n// ---------- ERC-8183 jobs ----------\n\n// Mirrors the DB `AgentJobStatus` enum, not the contract's JobStatus.\n// `accepted` is off-chain only (merchant approved, queued for on-chain\n// creation); `resolved` and `reclaimed` are the escrow's terminal exits\n// from a dispute and from a timeout reclaim respectively.\nexport const agentJobStatusSchema = z.enum([\n 'proposed',\n 'accepted',\n 'funded',\n 'in_progress',\n 'delivered',\n 'approved',\n 'completed',\n 'disputed',\n 'cancelled',\n 'resolved',\n 'reclaimed',\n])\nexport type AgentJobStatus = z.infer<typeof agentJobStatusSchema>\n\nexport const agentJobSchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n /** On-chain job id from StrimzAgentEscrow. */\n onchainJobId: z.number().int().nonnegative().nullable(),\n vendorAddress: evmAddressSchema,\n description: z.string().min(1).max(2000),\n amount: tokenAmountSchema,\n currency: z.enum(['USDC', 'EURC']),\n status: agentJobStatusSchema,\n assessorAddress: evmAddressSchema,\n deliverableHash: z\n .string()\n .regex(/^0x[a-fA-F0-9]+$/)\n .nullable(),\n escrowTxHash: evmTxHashSchema.nullable(),\n releaseTxHash: evmTxHashSchema.nullable(),\n createdAt: isoTimestampSchema,\n completedAt: isoTimestampSchema.nullable(),\n})\nexport type AgentJob = z.infer<typeof agentJobSchema>\n\nexport const createAgentJobInputSchema = z.object({\n vendorAddress: evmAddressSchema,\n description: z.string().min(1).max(2000),\n amount: tokenAmountSchema,\n currency: z.enum(['USDC', 'EURC']),\n assessorAddress: evmAddressSchema.optional(),\n})\nexport type CreateAgentJobInput = z.input<typeof createAgentJobInputSchema>\nexport type CreateAgentJobParsed = z.output<typeof createAgentJobInputSchema>\n"]}
package/dist/api-keys.cjs CHANGED
@@ -56,7 +56,11 @@ var apiKeyScopeSchema = zod.z.enum([
56
56
  // day-to-day; needed for partner onboarding flows that mint scoped
57
57
  // keys per sub-tenant.
58
58
  "api_keys_read",
59
- "api_keys_write"
59
+ "api_keys_write",
60
+ "merchants_read",
61
+ "customers_read",
62
+ "customers_write",
63
+ "analytics_read"
60
64
  ]);
61
65
  var apiKeySchema = zod.z.object({
62
66
  id: idSchema,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/common.ts","../src/api-keys.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;AAG5CA,KAAA,CAC3B,MAAA,EAAO,CACP,GAAA,EAAI,CACJ,MAAA,CAAO,CAAC,CAAA,KAAM,CAAA,CAAE,UAAA,CAAW,UAAU,CAAA,EAAG;AAAA,EACvC,OAAA,EAAS;AACX,CAAC;AAG0BA,KAAA,CAAE,MAAA,EAAO,CAAE,GAAA;AAOPA,KAAA,CAC9B,MAAA,EAAO,CACP,MAAM,UAAA,EAAY,iDAAiD,CAAA,CACnE,MAAA,CAAO,CAAC,CAAA,KAAM,MAAA,CAAO,CAAC,CAAA,IAAK,IAAI,c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A,EAAW,kBAAA;AAAA,EACX,UAAA,EAAY,mBAAmB,QAAA,EAAS;AAAA,EACxC,SAAA,EAAW,mBAAmB,QAAA;AAChC,CAAC;AAKM,IAAM,uBAAA,GAA0BA,MAAE,MAAA,CAAO;AAAA,EAC9C,IAAA,EAAMA,MAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA,CAAE,IAAI,EAAE,CAAA;AAAA,EAC9B,IAAA,EAAM,gBAAA;AAAA,EACN,IAAA,EAAM,UAAA;AAAA,EACN,MAAA,EAAQA,KAAAA,CAAE,KAAA,CAAM,iBAAiB,EAAE,QAAA;AACrC,CAAC;AAGM,IAAM,wBAAA,GAA2BA,MAAE,MAAA,CAAO;AAAA,EAC/C,MAAA,EAAQ,YAAA;AAAA;AAAA,EAER,MAAA,EAAQA,MAAE,MAAA;AACZ,CAAC;AAGM,IAAM,uBAAA,GAA0BA,MAAE,MAAA,CAAO;AAAA,EAC9C,EAAA,EAAI;AACN,CAAC","file":"api-keys.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 * API keys.\n *\n * A merchant has independent test and live keys. The full secret is shown\n * exactly once at creation; the backend stores only a hash and a display prefix.\n */\n\nimport { z } from 'zod'\nimport { idSchema, isoTimestampSchema, modeSchema } from './common.js'\n\nexport const apiKeyKindSchema = z.enum(['secret', 'publishable'])\nexport type ApiKeyKind = z.infer<typeof apiKeyKindSchema>\n\n/**\n * Underscore-separated. The wire format and any database representation\n * use the same form so there is no boundary translation.\n */\nexport const apiKeyScopeSchema = z.enum([\n 'sessions_read',\n 'sessions_write',\n 'subscriptions_read',\n 'subscriptions_write',\n 'refunds_read',\n 'refunds_write',\n 'transactions_read',\n 'webhooks_read',\n 'webhooks_write',\n 'invoices_read',\n 'invoices_write',\n 'storefronts_read',\n 'storefronts_write',\n 'agents_read',\n 'agents_write',\n // Meta-tx relayer. Submitting payer-signed EIP-3009 / EIP-2612\n // authorizations on the merchant's behalf. Granted to keys used by\n // hosted checkout and merchants embedding the SDK.\n 'relay_read',\n 'relay_write',\n // Self-service key management from an API key holder. Rarely used\n // day-to-day; needed for partner onboarding flows that mint scoped\n // keys per sub-tenant.\n 'api_keys_read',\n 'api_keys_write',\n])\nexport type ApiKeyScope = z.infer<typeof apiKeyScopeSchema>\n\nexport const apiKeySchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n name: z.string().min(1).max(60),\n kind: apiKeyKindSchema,\n mode: modeSchema,\n prefix: z.string().min(8).max(24),\n lastFour: z.string().length(4),\n scopes: z.array(apiKeyScopeSchema).nonempty(),\n createdAt: isoTimestampSchema,\n lastUsedAt: isoTimestampSchema.nullable(),\n revokedAt: isoTimestampSchema.nullable(),\n})\nexport type ApiKey = z.infer<typeof apiKeySchema>\n\n// ---------- DTOs ----------\n\nexport const createApiKeyInputSchema = z.object({\n name: z.string().min(1).max(60),\n kind: apiKeyKindSchema,\n mode: modeSchema,\n scopes: z.array(apiKeyScopeSchema).nonempty(),\n})\nexport type CreateApiKeyInput = z.infer<typeof createApiKeyInputSchema>\n\nexport const createApiKeyOutputSchema = z.object({\n apiKey: apiKeySchema,\n /** Full plaintext key. Shown exactly once. */\n secret: z.string(),\n})\nexport type CreateApiKeyOutput = z.infer<typeof createApiKeyOutputSchema>\n\nexport const rotateApiKeyInputSchema = z.object({\n id: idSchema,\n})\nexport type RotateApiKeyInput = z.infer<typeof rotateApiKeyInputSchema>\n"]}
1
+ {"version":3,"sources":["../src/common.ts","../src/api-keys.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,EAA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,QAAA;AAAA,EACJ,UAAA,EAAY,QAAA;AAAA,EACZ,IAAA,EAAMA,MAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA,CAAE,IAAI,EAAE,CAAA;AAAA,EAC9B,IAAA,EAAM,gBAAA;AAAA,EACN,IAAA,EAAM,UAAA;AAAA,EACN,MAAA,EAAQA,MAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA,CAAE,IAAI,EAAE,CAAA;AAAA,EAChC,QAAA,EAAUA,KAAAA,CAAE,MAAA,EAAO,CAAE,OAAO,CAAC,CAAA;AAAA,EAC7B,MAAA,EAAQA,KAAAA,CAAE,KAAA,CAAM,iBAAiB,EAAE,QAAA,EAAS;AAAA,EAC5C,SAAA,EAAW,kBAAA;AAAA,EACX,UAAA,EAAY,mBAAmB,QAAA,EAAS;AAAA,EACxC,SAAA,EAAW,mBAAmB,QAAA;AAChC,CAAC;AAKM,IAAM,uBAAA,GAA0BA,MAAE,MAAA,CAAO;AAAA,EAC9C,IAAA,EAAMA,MAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA,CAAE,IAAI,EAAE,CAAA;AAAA,EAC9B,IAAA,EAAM,gBAAA;AAAA,EACN,IAAA,EAAM,UAAA;AAAA,EACN,MAAA,EAAQA,KAAAA,CAAE,KAAA,CAAM,iBAAiB,EAAE,QAAA;AACrC,CAAC;AAIM,IAAM,wBAAA,GAA2BA,MAAE,MAAA,CAAO;AAAA,EAC/C,MAAA,EAAQ,YAAA;AAAA;AAAA,EAER,MAAA,EAAQA,MAAE,MAAA;AACZ,CAAC;AAGM,IAAM,uBAAA,GAA0BA,MAAE,MAAA,CAAO;AAAA,EAC9C,EAAA,EAAI;AACN,CAAC","file":"api-keys.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 * API keys.\n *\n * A merchant has independent test and live keys. The full secret is shown\n * exactly once at creation; the backend stores only a hash and a display prefix.\n */\n\nimport { z } from 'zod'\nimport { idSchema, isoTimestampSchema, modeSchema } from './common.js'\n\nexport const apiKeyKindSchema = z.enum(['secret', 'publishable'])\nexport type ApiKeyKind = z.infer<typeof apiKeyKindSchema>\n\n/**\n * Underscore-separated. The wire format and any database representation\n * use the same form so there is no boundary translation.\n */\nexport const apiKeyScopeSchema = z.enum([\n 'sessions_read',\n 'sessions_write',\n 'subscriptions_read',\n 'subscriptions_write',\n 'refunds_read',\n 'refunds_write',\n 'transactions_read',\n 'webhooks_read',\n 'webhooks_write',\n 'invoices_read',\n 'invoices_write',\n 'storefronts_read',\n 'storefronts_write',\n 'agents_read',\n 'agents_write',\n // Meta-tx relayer. Submitting payer-signed EIP-3009 / EIP-2612\n // authorizations on the merchant's behalf. Granted to keys used by\n // hosted checkout and merchants embedding the SDK.\n 'relay_read',\n 'relay_write',\n // Self-service key management from an API key holder. Rarely used\n // day-to-day; needed for partner onboarding flows that mint scoped\n // keys per sub-tenant.\n 'api_keys_read',\n 'api_keys_write',\n 'merchants_read',\n 'customers_read',\n 'customers_write',\n 'analytics_read',\n])\nexport type ApiKeyScope = z.infer<typeof apiKeyScopeSchema>\n\nexport const apiKeySchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n name: z.string().min(1).max(60),\n kind: apiKeyKindSchema,\n mode: modeSchema,\n prefix: z.string().min(8).max(24),\n lastFour: z.string().length(4),\n scopes: z.array(apiKeyScopeSchema).nonempty(),\n createdAt: isoTimestampSchema,\n lastUsedAt: isoTimestampSchema.nullable(),\n revokedAt: isoTimestampSchema.nullable(),\n})\nexport type ApiKey = z.infer<typeof apiKeySchema>\n\n// ---------- DTOs ----------\n\nexport const createApiKeyInputSchema = z.object({\n name: z.string().min(1).max(60),\n kind: apiKeyKindSchema,\n mode: modeSchema,\n scopes: z.array(apiKeyScopeSchema).nonempty(),\n})\nexport type CreateApiKeyInput = z.input<typeof createApiKeyInputSchema>\nexport type CreateApiKeyParsed = z.output<typeof createApiKeyInputSchema>\n\nexport const createApiKeyOutputSchema = z.object({\n apiKey: apiKeySchema,\n /** Full plaintext key. Shown exactly once. */\n secret: z.string(),\n})\nexport type CreateApiKeyOutput = z.infer<typeof createApiKeyOutputSchema>\n\nexport const rotateApiKeyInputSchema = z.object({\n id: idSchema,\n})\nexport type RotateApiKeyInput = z.input<typeof rotateApiKeyInputSchema>\nexport type RotateApiKeyParsed = z.output<typeof rotateApiKeyInputSchema>\n"]}
@@ -13,7 +13,7 @@ type ApiKeyKind = z.infer<typeof apiKeyKindSchema>;
13
13
  * Underscore-separated. The wire format and any database representation
14
14
  * use the same form so there is no boundary translation.
15
15
  */
16
- declare const apiKeyScopeSchema: z.ZodEnum<["sessions_read", "sessions_write", "subscriptions_read", "subscriptions_write", "refunds_read", "refunds_write", "transactions_read", "webhooks_read", "webhooks_write", "invoices_read", "invoices_write", "storefronts_read", "storefronts_write", "agents_read", "agents_write", "relay_read", "relay_write", "api_keys_read", "api_keys_write"]>;
16
+ declare const apiKeyScopeSchema: z.ZodEnum<["sessions_read", "sessions_write", "subscriptions_read", "subscriptions_write", "refunds_read", "refunds_write", "transactions_read", "webhooks_read", "webhooks_write", "invoices_read", "invoices_write", "storefronts_read", "storefronts_write", "agents_read", "agents_write", "relay_read", "relay_write", "api_keys_read", "api_keys_write", "merchants_read", "customers_read", "customers_write", "analytics_read"]>;
17
17
  type ApiKeyScope = z.infer<typeof apiKeyScopeSchema>;
18
18
  declare const apiKeySchema: z.ZodObject<{
19
19
  id: z.ZodString;
@@ -23,7 +23,7 @@ declare const apiKeySchema: z.ZodObject<{
23
23
  mode: z.ZodEnum<["test", "live"]>;
24
24
  prefix: z.ZodString;
25
25
  lastFour: z.ZodString;
26
- scopes: z.ZodArray<z.ZodEnum<["sessions_read", "sessions_write", "subscriptions_read", "subscriptions_write", "refunds_read", "refunds_write", "transactions_read", "webhooks_read", "webhooks_write", "invoices_read", "invoices_write", "storefronts_read", "storefronts_write", "agents_read", "agents_write", "relay_read", "relay_write", "api_keys_read", "api_keys_write"]>, "atleastone">;
26
+ scopes: z.ZodArray<z.ZodEnum<["sessions_read", "sessions_write", "subscriptions_read", "subscriptions_write", "refunds_read", "refunds_write", "transactions_read", "webhooks_read", "webhooks_write", "invoices_read", "invoices_write", "storefronts_read", "storefronts_write", "agents_read", "agents_write", "relay_read", "relay_write", "api_keys_read", "api_keys_write", "merchants_read", "customers_read", "customers_write", "analytics_read"]>, "atleastone">;
27
27
  createdAt: z.ZodString;
28
28
  lastUsedAt: z.ZodNullable<z.ZodString>;
29
29
  revokedAt: z.ZodNullable<z.ZodString>;
@@ -35,7 +35,7 @@ declare const apiKeySchema: z.ZodObject<{
35
35
  mode: "test" | "live";
36
36
  prefix: string;
37
37
  lastFour: string;
38
- scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write")[]];
38
+ scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write" | "merchants_read" | "customers_read" | "customers_write" | "analytics_read", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write" | "merchants_read" | "customers_read" | "customers_write" | "analytics_read")[]];
39
39
  createdAt: string;
40
40
  lastUsedAt: string | null;
41
41
  revokedAt: string | null;
@@ -47,7 +47,7 @@ declare const apiKeySchema: z.ZodObject<{
47
47
  mode: "test" | "live";
48
48
  prefix: string;
49
49
  lastFour: string;
50
- scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write")[]];
50
+ scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write" | "merchants_read" | "customers_read" | "customers_write" | "analytics_read", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write" | "merchants_read" | "customers_read" | "customers_write" | "analytics_read")[]];
51
51
  createdAt: string;
52
52
  lastUsedAt: string | null;
53
53
  revokedAt: string | null;
@@ -57,19 +57,20 @@ declare const createApiKeyInputSchema: z.ZodObject<{
57
57
  name: z.ZodString;
58
58
  kind: z.ZodEnum<["secret", "publishable"]>;
59
59
  mode: z.ZodEnum<["test", "live"]>;
60
- scopes: z.ZodArray<z.ZodEnum<["sessions_read", "sessions_write", "subscriptions_read", "subscriptions_write", "refunds_read", "refunds_write", "transactions_read", "webhooks_read", "webhooks_write", "invoices_read", "invoices_write", "storefronts_read", "storefronts_write", "agents_read", "agents_write", "relay_read", "relay_write", "api_keys_read", "api_keys_write"]>, "atleastone">;
60
+ scopes: z.ZodArray<z.ZodEnum<["sessions_read", "sessions_write", "subscriptions_read", "subscriptions_write", "refunds_read", "refunds_write", "transactions_read", "webhooks_read", "webhooks_write", "invoices_read", "invoices_write", "storefronts_read", "storefronts_write", "agents_read", "agents_write", "relay_read", "relay_write", "api_keys_read", "api_keys_write", "merchants_read", "customers_read", "customers_write", "analytics_read"]>, "atleastone">;
61
61
  }, "strip", z.ZodTypeAny, {
62
62
  name: string;
63
63
  kind: "secret" | "publishable";
64
64
  mode: "test" | "live";
65
- scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write")[]];
65
+ scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write" | "merchants_read" | "customers_read" | "customers_write" | "analytics_read", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write" | "merchants_read" | "customers_read" | "customers_write" | "analytics_read")[]];
66
66
  }, {
67
67
  name: string;
68
68
  kind: "secret" | "publishable";
69
69
  mode: "test" | "live";
70
- scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write")[]];
70
+ scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write" | "merchants_read" | "customers_read" | "customers_write" | "analytics_read", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write" | "merchants_read" | "customers_read" | "customers_write" | "analytics_read")[]];
71
71
  }>;
72
- type CreateApiKeyInput = z.infer<typeof createApiKeyInputSchema>;
72
+ type CreateApiKeyInput = z.input<typeof createApiKeyInputSchema>;
73
+ type CreateApiKeyParsed = z.output<typeof createApiKeyInputSchema>;
73
74
  declare const createApiKeyOutputSchema: z.ZodObject<{
74
75
  apiKey: z.ZodObject<{
75
76
  id: z.ZodString;
@@ -79,7 +80,7 @@ declare const createApiKeyOutputSchema: z.ZodObject<{
79
80
  mode: z.ZodEnum<["test", "live"]>;
80
81
  prefix: z.ZodString;
81
82
  lastFour: z.ZodString;
82
- scopes: z.ZodArray<z.ZodEnum<["sessions_read", "sessions_write", "subscriptions_read", "subscriptions_write", "refunds_read", "refunds_write", "transactions_read", "webhooks_read", "webhooks_write", "invoices_read", "invoices_write", "storefronts_read", "storefronts_write", "agents_read", "agents_write", "relay_read", "relay_write", "api_keys_read", "api_keys_write"]>, "atleastone">;
83
+ scopes: z.ZodArray<z.ZodEnum<["sessions_read", "sessions_write", "subscriptions_read", "subscriptions_write", "refunds_read", "refunds_write", "transactions_read", "webhooks_read", "webhooks_write", "invoices_read", "invoices_write", "storefronts_read", "storefronts_write", "agents_read", "agents_write", "relay_read", "relay_write", "api_keys_read", "api_keys_write", "merchants_read", "customers_read", "customers_write", "analytics_read"]>, "atleastone">;
83
84
  createdAt: z.ZodString;
84
85
  lastUsedAt: z.ZodNullable<z.ZodString>;
85
86
  revokedAt: z.ZodNullable<z.ZodString>;
@@ -91,7 +92,7 @@ declare const createApiKeyOutputSchema: z.ZodObject<{
91
92
  mode: "test" | "live";
92
93
  prefix: string;
93
94
  lastFour: string;
94
- scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write")[]];
95
+ scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write" | "merchants_read" | "customers_read" | "customers_write" | "analytics_read", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write" | "merchants_read" | "customers_read" | "customers_write" | "analytics_read")[]];
95
96
  createdAt: string;
96
97
  lastUsedAt: string | null;
97
98
  revokedAt: string | null;
@@ -103,7 +104,7 @@ declare const createApiKeyOutputSchema: z.ZodObject<{
103
104
  mode: "test" | "live";
104
105
  prefix: string;
105
106
  lastFour: string;
106
- scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write")[]];
107
+ scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write" | "merchants_read" | "customers_read" | "customers_write" | "analytics_read", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write" | "merchants_read" | "customers_read" | "customers_write" | "analytics_read")[]];
107
108
  createdAt: string;
108
109
  lastUsedAt: string | null;
109
110
  revokedAt: string | null;
@@ -120,7 +121,7 @@ declare const createApiKeyOutputSchema: z.ZodObject<{
120
121
  mode: "test" | "live";
121
122
  prefix: string;
122
123
  lastFour: string;
123
- scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write")[]];
124
+ scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write" | "merchants_read" | "customers_read" | "customers_write" | "analytics_read", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write" | "merchants_read" | "customers_read" | "customers_write" | "analytics_read")[]];
124
125
  createdAt: string;
125
126
  lastUsedAt: string | null;
126
127
  revokedAt: string | null;
@@ -135,7 +136,7 @@ declare const createApiKeyOutputSchema: z.ZodObject<{
135
136
  mode: "test" | "live";
136
137
  prefix: string;
137
138
  lastFour: string;
138
- scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write")[]];
139
+ scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write" | "merchants_read" | "customers_read" | "customers_write" | "analytics_read", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write" | "merchants_read" | "customers_read" | "customers_write" | "analytics_read")[]];
139
140
  createdAt: string;
140
141
  lastUsedAt: string | null;
141
142
  revokedAt: string | null;
@@ -149,6 +150,7 @@ declare const rotateApiKeyInputSchema: z.ZodObject<{
149
150
  }, {
150
151
  id: string;
151
152
  }>;
152
- type RotateApiKeyInput = z.infer<typeof rotateApiKeyInputSchema>;
153
+ type RotateApiKeyInput = z.input<typeof rotateApiKeyInputSchema>;
154
+ type RotateApiKeyParsed = z.output<typeof rotateApiKeyInputSchema>;
153
155
 
154
- export { type ApiKey, type ApiKeyKind, type ApiKeyScope, type CreateApiKeyInput, type CreateApiKeyOutput, type RotateApiKeyInput, apiKeyKindSchema, apiKeySchema, apiKeyScopeSchema, createApiKeyInputSchema, createApiKeyOutputSchema, rotateApiKeyInputSchema };
156
+ export { type ApiKey, type ApiKeyKind, type ApiKeyScope, type CreateApiKeyInput, type CreateApiKeyOutput, type CreateApiKeyParsed, type RotateApiKeyInput, type RotateApiKeyParsed, apiKeyKindSchema, apiKeySchema, apiKeyScopeSchema, createApiKeyInputSchema, createApiKeyOutputSchema, rotateApiKeyInputSchema };