@strimz/shared-types 0.1.0 → 0.2.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 (97) hide show
  1. package/README.md +66 -36
  2. package/dist/agents.cjs.map +1 -1
  3. package/dist/agents.d.cts +1 -1
  4. package/dist/agents.d.ts +1 -1
  5. package/dist/agents.js.map +1 -1
  6. package/dist/api-keys.cjs +8 -3
  7. package/dist/api-keys.cjs.map +1 -1
  8. package/dist/api-keys.d.cts +15 -16
  9. package/dist/api-keys.d.ts +15 -16
  10. package/dist/api-keys.js +8 -3
  11. package/dist/api-keys.js.map +1 -1
  12. package/dist/common.cjs.map +1 -1
  13. package/dist/common.d.cts +2 -2
  14. package/dist/common.d.ts +2 -2
  15. package/dist/common.js.map +1 -1
  16. package/dist/compliance.cjs.map +1 -1
  17. package/dist/compliance.d.cts +1 -1
  18. package/dist/compliance.d.ts +1 -1
  19. package/dist/compliance.js.map +1 -1
  20. package/dist/customers.cjs.map +1 -1
  21. package/dist/customers.d.cts +1 -1
  22. package/dist/customers.d.ts +1 -1
  23. package/dist/customers.js.map +1 -1
  24. package/dist/events.cjs +24 -6
  25. package/dist/events.cjs.map +1 -1
  26. package/dist/events.d.cts +12 -12
  27. package/dist/events.d.ts +12 -12
  28. package/dist/events.js +24 -6
  29. package/dist/events.js.map +1 -1
  30. package/dist/index.cjs +188 -11
  31. package/dist/index.cjs.map +1 -1
  32. package/dist/index.d.cts +302 -17
  33. package/dist/index.d.ts +302 -17
  34. package/dist/index.js +167 -12
  35. package/dist/index.js.map +1 -1
  36. package/dist/invoices.cjs.map +1 -1
  37. package/dist/invoices.d.cts +1 -1
  38. package/dist/invoices.d.ts +1 -1
  39. package/dist/invoices.js.map +1 -1
  40. package/dist/merchants.cjs +59 -1
  41. package/dist/merchants.cjs.map +1 -1
  42. package/dist/merchants.d.cts +171 -1
  43. package/dist/merchants.d.ts +171 -1
  44. package/dist/merchants.js +55 -2
  45. package/dist/merchants.js.map +1 -1
  46. package/dist/payment-sessions.cjs +6 -2
  47. package/dist/payment-sessions.cjs.map +1 -1
  48. package/dist/payment-sessions.d.cts +20 -4
  49. package/dist/payment-sessions.d.ts +20 -4
  50. package/dist/payment-sessions.js +6 -3
  51. package/dist/payment-sessions.js.map +1 -1
  52. package/dist/refunds.cjs +12 -0
  53. package/dist/refunds.cjs.map +1 -1
  54. package/dist/refunds.d.cts +135 -2
  55. package/dist/refunds.d.ts +135 -2
  56. package/dist/refunds.js +11 -1
  57. package/dist/refunds.js.map +1 -1
  58. package/dist/storefronts.cjs +16 -2
  59. package/dist/storefronts.cjs.map +1 -1
  60. package/dist/storefronts.d.cts +38 -2
  61. package/dist/storefronts.d.ts +38 -2
  62. package/dist/storefronts.js +15 -3
  63. package/dist/storefronts.js.map +1 -1
  64. package/dist/subscriptions.cjs +2 -2
  65. package/dist/subscriptions.cjs.map +1 -1
  66. package/dist/subscriptions.d.cts +3 -3
  67. package/dist/subscriptions.d.ts +3 -3
  68. package/dist/subscriptions.js +2 -2
  69. package/dist/subscriptions.js.map +1 -1
  70. package/dist/transactions.cjs.map +1 -1
  71. package/dist/transactions.d.cts +2 -2
  72. package/dist/transactions.d.ts +2 -2
  73. package/dist/transactions.js.map +1 -1
  74. package/dist/webhooks.cjs +7 -1
  75. package/dist/webhooks.cjs.map +1 -1
  76. package/dist/webhooks.d.cts +63 -4
  77. package/dist/webhooks.d.ts +63 -4
  78. package/dist/webhooks.js +7 -2
  79. package/dist/webhooks.js.map +1 -1
  80. package/package.json +2 -2
  81. package/src/agents.ts +1 -1
  82. package/src/api-keys.ts +9 -5
  83. package/src/common.ts +2 -2
  84. package/src/compliance.ts +1 -1
  85. package/src/contact.ts +26 -0
  86. package/src/customers.ts +1 -1
  87. package/src/index.ts +2 -0
  88. package/src/invoices.ts +1 -1
  89. package/src/merchants.ts +84 -0
  90. package/src/notifications.ts +88 -0
  91. package/src/payment-sessions.ts +25 -3
  92. package/src/refunds.ts +20 -1
  93. package/src/storefronts.ts +25 -1
  94. package/src/subscriptions.ts +3 -3
  95. package/src/tokens.ts +7 -7
  96. package/src/transactions.ts +2 -2
  97. package/src/webhooks.ts +15 -3
package/README.md CHANGED
@@ -1,39 +1,28 @@
1
1
  # @strimz/shared-types
2
2
 
3
- Zod schemas and inferred TypeScript types for every entity, API input, and webhook event in the Strimz platform. The schema is the source of truth; types are inferred via `z.infer<>` so wire format and compile-time shape never diverge.
3
+ > Zod schemas and inferred TypeScript types for every Strimz entity, API input, and webhook event.
4
4
 
5
- ## Who uses what
5
+ [![npm version](https://img.shields.io/npm/v/@strimz/shared-types.svg?color=02C76A)](https://www.npmjs.com/package/@strimz/shared-types)
6
+ [![npm downloads](https://img.shields.io/npm/dm/@strimz/shared-types.svg)](https://www.npmjs.com/package/@strimz/shared-types)
7
+ [![bundle size](https://img.shields.io/bundlephobia/minzip/@strimz/shared-types.svg?label=size)](https://bundlephobia.com/package/@strimz/shared-types)
8
+ [![types](https://img.shields.io/npm/types/@strimz/shared-types.svg)](https://www.npmjs.com/package/@strimz/shared-types)
9
+ [![License: MIT](https://img.shields.io/badge/License-MIT-02C76A.svg)](./LICENSE)
6
10
 
7
- | Consumer | Why |
8
- | ------------------- | ---------------------------------------------------------------------- |
9
- | `apps/api` | Runtime validation of every request body, query string, and path param |
10
- | `apps/scheduler` | Validation of queued job payloads |
11
- | `apps/web` | React Hook Form resolvers, typed API client responses |
12
- | `@strimz/sdk` | Typed request builders and typed response objects |
13
- | `@strimz/sdk-react` | Typed props for `<StrimzPayButton />` and hooks |
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
14
+ internally, but you can use the schemas and types directly if you
15
+ prefer to validate the wire format in your own code.
14
16
 
15
- ## Module map
17
+ ## Install
16
18
 
17
- | Subpath | Contains |
18
- | ------------------- | ------------------------------------------------------------------------------------------------------- |
19
- | `/common` | Primitives: ids, EVM address, tx hash, email, URL, money, pagination, metadata, mode, tier, environment |
20
- | `/merchants` | Merchant entity, login, member invites, tier changes |
21
- | `/api-keys` | Secret/publishable keys, scopes, rotation |
22
- | `/customers` | Payer identity |
23
- | `/payment-sessions` | One-shot session entity + state machine + `createPaymentSessionInputSchema` |
24
- | `/transactions` | Confirmed on-chain payment records |
25
- | `/subscriptions` | Plans, active subscriptions, per-period charges (with `chargeAttemptId`) |
26
- | `/refunds` | Merchant-initiated refund entity + signature flow |
27
- | `/webhooks` | Endpoints, deliveries, replay |
28
- | `/compliance` | Sanctions screening log |
29
- | `/agents` | Identity, merchant config, activity log, ERC-8183 jobs |
30
- | `/storefronts` | Storefront + product |
31
- | `/invoices` | Invoice + line items |
32
- | `/events` | Discriminated `StrimzWebhookEvent` union covering every webhook payload shape |
33
-
34
- The package root re-exports every subpath.
19
+ ```sh
20
+ pnpm add @strimz/shared-types
21
+ # npm install @strimz/shared-types
22
+ # yarn add @strimz/shared-types
23
+ ```
35
24
 
36
- ## Usage
25
+ ## Quick start
37
26
 
38
27
  ```ts
39
28
  import {
@@ -44,8 +33,9 @@ import {
44
33
  const parsed: CreatePaymentSessionInput = createPaymentSessionInputSchema.parse(req.body)
45
34
  ```
46
35
 
36
+ ## Exhaustive webhook handling
37
+
47
38
  ```ts
48
- // In a webhook handler. Exhaustive over every event kind.
49
39
  import { webhookEventSchema, type StrimzWebhookEvent } from '@strimz/shared-types/events'
50
40
 
51
41
  function handle(event: StrimzWebhookEvent) {
@@ -56,14 +46,54 @@ function handle(event: StrimzWebhookEvent) {
56
46
  case 'subscription.charge_failed':
57
47
  // event.data is typed as { subscription, charge }
58
48
  break
59
- // TypeScript enforces exhaustiveness
49
+ // TypeScript enforces exhaustiveness over the discriminated union.
60
50
  }
61
51
  }
62
52
  ```
63
53
 
64
- ## Boundaries
54
+ ## Modules
55
+
56
+ Every group is also available as a subpath import for tree-shaking.
57
+
58
+ | Subpath | Contains |
59
+ | ------------------- | ------------------------------------------------------------------------------------------------------- |
60
+ | `/common` | Primitives: ids, EVM address, tx hash, email, URL, money, pagination, metadata, mode, tier, environment |
61
+ | `/merchants` | Merchant entity, login, member invites, tier changes |
62
+ | `/api-keys` | Secret and publishable keys, scopes, rotation |
63
+ | `/customers` | Payer identity |
64
+ | `/payment-sessions` | One-shot session entity, state machine, `createPaymentSessionInputSchema` |
65
+ | `/transactions` | Confirmed on-chain payment records |
66
+ | `/subscriptions` | Plans, active subscriptions, per-period charges (with `chargeAttemptId`) |
67
+ | `/refunds` | Merchant-initiated refund entity + signature flow |
68
+ | `/webhooks` | Endpoints, deliveries, replay |
69
+ | `/compliance` | Sanctions screening log |
70
+ | `/agents` | Identity, merchant config, activity log, ERC-8183 jobs |
71
+ | `/storefronts` | Storefront + product |
72
+ | `/invoices` | Invoice + line items |
73
+ | `/events` | Discriminated `StrimzWebhookEvent` union covering every webhook payload shape |
74
+
75
+ The package root re-exports every subpath.
76
+
77
+ ## Runtime support
78
+
79
+ Pure TypeScript with `zod` as the only runtime dependency. Works in
80
+ Node 22+, every modern browser, Vercel Edge, Cloudflare Workers,
81
+ Deno, and Bun.
82
+
83
+ ## Design notes
84
+
85
+ - **Schemas describe wire format.** No business logic, no persistence, no side effects.
86
+ - **Amounts are decimal strings of the token's smallest unit** (USDC has 6 decimals, so `"1000000"` is 1 USDC). This preserves precision beyond `Number.MAX_SAFE_INTEGER`.
87
+ - **EVM addresses are normalised to lowercase on parse.** Transaction hashes are preserved verbatim.
88
+ - **Optional vs nullable is a real distinction.** Fields marked `.optional()` accept omission. Fields marked `.nullable()` accept explicit `null`. The two are not interchangeable on the wire.
89
+
90
+ ## Links
91
+
92
+ - [Documentation](https://strimz.finance/docs)
93
+ - [Repository](https://github.com/StrimzLab/Strimz/tree/main/packages/shared-types)
94
+ - [Changelog](./CHANGELOG.md)
95
+ - [Issues](https://github.com/StrimzLab/Strimz/issues)
96
+
97
+ ## License
65
98
 
66
- - Schemas describe wire format. They do not contain business logic, persistence, or side effects.
67
- - Amounts are carried as decimal strings of the token's smallest unit (USDC has 6 decimals, so `"1000000"` is 1 USDC). This preserves precision beyond `Number.MAX_SAFE_INTEGER`.
68
- - EVM addresses are normalised to lowercase on parse. Transaction hashes are preserved verbatim.
69
- - Optional fields are marked `.optional()` (omission OK) and nullable fields are `.nullable()` (explicit `null` OK). These are different and not interchangeable.
99
+ [MIT](./LICENSE) © Strimz
@@ -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;AAGtBA,KAAA,CAAE,MAAA,EAAO,C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AAO,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 — mirrors `@strimz/shared-config`. */\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 — mirrors `@strimz/shared-config`. */\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\nexport const agentJobStatusSchema = z.enum([\n 'proposed',\n 'accepted',\n 'in_progress',\n 'delivered',\n 'approved',\n 'completed',\n 'disputed',\n 'cancelled',\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,CA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,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\nexport const agentJobStatusSchema = z.enum([\n 'proposed',\n 'accepted',\n 'in_progress',\n 'delivered',\n 'approved',\n 'completed',\n 'disputed',\n 'cancelled',\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"]}
package/dist/agents.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
2
 
3
3
  /**
4
- * AI AutoPay Agent — identity, configuration, activity log, and ERC-8183 jobs.
4
+ * AI AutoPay Agent. Identity, configuration, activity log, and ERC-8183 jobs.
5
5
  */
6
6
 
7
7
  declare const agentIdentitySchema: z.ZodObject<{
package/dist/agents.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
2
 
3
3
  /**
4
- * AI AutoPay Agent — identity, configuration, activity log, and ERC-8183 jobs.
4
+ * AI AutoPay Agent. Identity, configuration, activity log, and ERC-8183 jobs.
5
5
  */
6
6
 
7
7
  declare const agentIdentitySchema: z.ZodObject<{
@@ -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,CA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AAS;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 — mirrors `@strimz/shared-config`. */\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 — mirrors `@strimz/shared-config`. */\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\nexport const agentJobStatusSchema = z.enum([\n 'proposed',\n 'accepted',\n 'in_progress',\n 'delivered',\n 'approved',\n 'completed',\n 'disputed',\n 'cancelled',\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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","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\nexport const agentJobStatusSchema = z.enum([\n 'proposed',\n 'accepted',\n 'in_progress',\n 'delivered',\n 'approved',\n 'completed',\n 'disputed',\n 'cancelled',\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"]}
package/dist/api-keys.cjs CHANGED
@@ -47,11 +47,16 @@ var apiKeyScopeSchema = zod.z.enum([
47
47
  "storefronts_write",
48
48
  "agents_read",
49
49
  "agents_write",
50
- // Meta-tx relayer — submitting payer-signed EIP-3009 / EIP-2612
50
+ // Meta-tx relayer. Submitting payer-signed EIP-3009 / EIP-2612
51
51
  // authorizations on the merchant's behalf. Granted to keys used by
52
52
  // hosted checkout and merchants embedding the SDK.
53
53
  "relay_read",
54
- "relay_write"
54
+ "relay_write",
55
+ // Self-service key management from an API key holder. Rarely used
56
+ // day-to-day; needed for partner onboarding flows that mint scoped
57
+ // keys per sub-tenant.
58
+ "api_keys_read",
59
+ "api_keys_write"
55
60
  ]);
56
61
  var apiKeySchema = zod.z.object({
57
62
  id: idSchema,
@@ -74,7 +79,7 @@ var createApiKeyInputSchema = zod.z.object({
74
79
  });
75
80
  var createApiKeyOutputSchema = zod.z.object({
76
81
  apiKey: apiKeySchema,
77
- /** Full plaintext key — shown exactly once. */
82
+ /** Full plaintext key. Shown exactly once. */
78
83
  secret: zod.z.string()
79
84
  });
80
85
  var rotateApiKeyInputSchema = zod.z.object({
@@ -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,CACj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ACF,CAAC;AAGM,IAAM,YAAA,GAAeA,MAAE,MAAA,CAAO;AAAA,EACnC,EAAA,EAAI,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;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 — mirrors `@strimz/shared-config`. */\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 — mirrors `@strimz/shared-config`. */\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 to match the Prisma `ApiKeyScope` enum (Prisma\n * does not allow `:` in enum values). The DB and the wire format use the\n * 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])\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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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"]}
@@ -10,11 +10,10 @@ import { z } from 'zod';
10
10
  declare const apiKeyKindSchema: z.ZodEnum<["secret", "publishable"]>;
11
11
  type ApiKeyKind = z.infer<typeof apiKeyKindSchema>;
12
12
  /**
13
- * Underscore-separated to match the Prisma `ApiKeyScope` enum (Prisma
14
- * does not allow `:` in enum values). The DB and the wire format use the
15
- * same form so there is no boundary translation.
13
+ * Underscore-separated. The wire format and any database representation
14
+ * use the same form so there is no boundary translation.
16
15
  */
17
- 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"]>;
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"]>;
18
17
  type ApiKeyScope = z.infer<typeof apiKeyScopeSchema>;
19
18
  declare const apiKeySchema: z.ZodObject<{
20
19
  id: z.ZodString;
@@ -24,7 +23,7 @@ declare const apiKeySchema: z.ZodObject<{
24
23
  mode: z.ZodEnum<["test", "live"]>;
25
24
  prefix: z.ZodString;
26
25
  lastFour: z.ZodString;
27
- 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"]>, "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"]>, "atleastone">;
28
27
  createdAt: z.ZodString;
29
28
  lastUsedAt: z.ZodNullable<z.ZodString>;
30
29
  revokedAt: z.ZodNullable<z.ZodString>;
@@ -36,7 +35,7 @@ declare const apiKeySchema: z.ZodObject<{
36
35
  mode: "test" | "live";
37
36
  prefix: string;
38
37
  lastFour: string;
39
- 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", ...("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")[]];
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")[]];
40
39
  createdAt: string;
41
40
  lastUsedAt: string | null;
42
41
  revokedAt: string | null;
@@ -48,7 +47,7 @@ declare const apiKeySchema: z.ZodObject<{
48
47
  mode: "test" | "live";
49
48
  prefix: string;
50
49
  lastFour: string;
51
- 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", ...("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")[]];
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")[]];
52
51
  createdAt: string;
53
52
  lastUsedAt: string | null;
54
53
  revokedAt: string | null;
@@ -58,17 +57,17 @@ declare const createApiKeyInputSchema: z.ZodObject<{
58
57
  name: z.ZodString;
59
58
  kind: z.ZodEnum<["secret", "publishable"]>;
60
59
  mode: z.ZodEnum<["test", "live"]>;
61
- 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"]>, "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"]>, "atleastone">;
62
61
  }, "strip", z.ZodTypeAny, {
63
62
  name: string;
64
63
  kind: "secret" | "publishable";
65
64
  mode: "test" | "live";
66
- 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", ...("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")[]];
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")[]];
67
66
  }, {
68
67
  name: string;
69
68
  kind: "secret" | "publishable";
70
69
  mode: "test" | "live";
71
- 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", ...("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")[]];
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")[]];
72
71
  }>;
73
72
  type CreateApiKeyInput = z.infer<typeof createApiKeyInputSchema>;
74
73
  declare const createApiKeyOutputSchema: z.ZodObject<{
@@ -80,7 +79,7 @@ declare const createApiKeyOutputSchema: z.ZodObject<{
80
79
  mode: z.ZodEnum<["test", "live"]>;
81
80
  prefix: z.ZodString;
82
81
  lastFour: z.ZodString;
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"]>, "atleastone">;
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">;
84
83
  createdAt: z.ZodString;
85
84
  lastUsedAt: z.ZodNullable<z.ZodString>;
86
85
  revokedAt: z.ZodNullable<z.ZodString>;
@@ -92,7 +91,7 @@ declare const createApiKeyOutputSchema: z.ZodObject<{
92
91
  mode: "test" | "live";
93
92
  prefix: string;
94
93
  lastFour: string;
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", ...("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")[]];
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")[]];
96
95
  createdAt: string;
97
96
  lastUsedAt: string | null;
98
97
  revokedAt: string | null;
@@ -104,12 +103,12 @@ declare const createApiKeyOutputSchema: z.ZodObject<{
104
103
  mode: "test" | "live";
105
104
  prefix: string;
106
105
  lastFour: string;
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", ...("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")[]];
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")[]];
108
107
  createdAt: string;
109
108
  lastUsedAt: string | null;
110
109
  revokedAt: string | null;
111
110
  }>;
112
- /** Full plaintext key — shown exactly once. */
111
+ /** Full plaintext key. Shown exactly once. */
113
112
  secret: z.ZodString;
114
113
  }, "strip", z.ZodTypeAny, {
115
114
  secret: string;
@@ -121,7 +120,7 @@ declare const createApiKeyOutputSchema: z.ZodObject<{
121
120
  mode: "test" | "live";
122
121
  prefix: string;
123
122
  lastFour: string;
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", ...("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")[]];
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")[]];
125
124
  createdAt: string;
126
125
  lastUsedAt: string | null;
127
126
  revokedAt: string | null;
@@ -136,7 +135,7 @@ declare const createApiKeyOutputSchema: z.ZodObject<{
136
135
  mode: "test" | "live";
137
136
  prefix: string;
138
137
  lastFour: string;
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", ...("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")[]];
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")[]];
140
139
  createdAt: string;
141
140
  lastUsedAt: string | null;
142
141
  revokedAt: string | null;