@strimz/shared-types 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -4
- package/dist/agents.cjs.map +1 -1
- package/dist/agents.d.cts +7 -5
- package/dist/agents.d.ts +7 -5
- package/dist/agents.js.map +1 -1
- package/dist/api-keys.cjs.map +1 -1
- package/dist/api-keys.d.cts +11 -9
- package/dist/api-keys.d.ts +11 -9
- package/dist/api-keys.js.map +1 -1
- package/dist/common.cjs.map +1 -1
- package/dist/common.d.cts +3 -2
- package/dist/common.d.ts +3 -2
- package/dist/common.js.map +1 -1
- package/dist/compliance.cjs.map +1 -1
- package/dist/compliance.d.cts +4 -4
- package/dist/compliance.d.ts +4 -4
- package/dist/compliance.js.map +1 -1
- package/dist/customers.cjs.map +1 -1
- package/dist/customers.d.cts +5 -4
- package/dist/customers.d.ts +5 -4
- package/dist/customers.js.map +1 -1
- package/dist/events.cjs.map +1 -1
- package/dist/events.d.cts +276 -276
- package/dist/events.d.ts +276 -276
- package/dist/events.js.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -20
- package/dist/index.d.ts +22 -20
- package/dist/index.js.map +1 -1
- package/dist/invoices.cjs.map +1 -1
- package/dist/invoices.d.cts +5 -4
- package/dist/invoices.d.ts +5 -4
- package/dist/invoices.js.map +1 -1
- package/dist/merchants.cjs.map +1 -1
- package/dist/merchants.d.cts +19 -13
- package/dist/merchants.d.ts +19 -13
- package/dist/merchants.js.map +1 -1
- package/dist/payment-sessions.cjs.map +1 -1
- package/dist/payment-sessions.d.cts +5 -3
- package/dist/payment-sessions.d.ts +5 -3
- package/dist/payment-sessions.js.map +1 -1
- package/dist/refunds.cjs.map +1 -1
- package/dist/refunds.d.cts +5 -3
- package/dist/refunds.d.ts +5 -3
- package/dist/refunds.js.map +1 -1
- package/dist/storefronts.cjs.map +1 -1
- package/dist/storefronts.d.cts +11 -8
- package/dist/storefronts.d.ts +11 -8
- package/dist/storefronts.js.map +1 -1
- package/dist/subscriptions.cjs.map +1 -1
- package/dist/subscriptions.d.cts +11 -8
- package/dist/subscriptions.d.ts +11 -8
- package/dist/subscriptions.js.map +1 -1
- package/dist/transactions.cjs.map +1 -1
- package/dist/transactions.d.cts +4 -4
- package/dist/transactions.d.ts +4 -4
- package/dist/transactions.js.map +1 -1
- package/dist/webhooks.cjs.map +1 -1
- package/dist/webhooks.d.cts +11 -9
- package/dist/webhooks.d.ts +11 -9
- package/dist/webhooks.js.map +1 -1
- package/package.json +1 -1
- package/src/agents.ts +4 -2
- package/src/api-keys.ts +4 -2
- package/src/common.ts +2 -1
- package/src/contact.ts +2 -1
- package/src/customers.ts +2 -1
- package/src/invoices.ts +2 -1
- package/src/merchants.ts +12 -6
- package/src/notifications.ts +2 -1
- package/src/payment-sessions.ts +4 -2
- package/src/refunds.ts +4 -2
- package/src/storefronts.ts +6 -3
- package/src/subscriptions.ts +6 -3
- package/src/webhooks.ts +4 -2
package/README.md
CHANGED
|
@@ -9,8 +9,11 @@
|
|
|
9
9
|
[](./LICENSE)
|
|
10
10
|
|
|
11
11
|
The Zod schema is the source of truth. TypeScript types are inferred
|
|
12
|
-
|
|
13
|
-
|
|
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
|
|
33
|
+
type CreatePaymentSessionParsed,
|
|
31
34
|
} from '@strimz/shared-types'
|
|
32
35
|
|
|
33
|
-
const parsed:
|
|
36
|
+
const parsed: CreatePaymentSessionParsed = createPaymentSessionInputSchema.parse(req.body)
|
|
34
37
|
```
|
|
35
38
|
|
|
36
39
|
## Exhaustive webhook handling
|
package/dist/agents.cjs.map
CHANGED
|
@@ -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,CAAE,GAAA,EAAI,CAAE,GAAA,CAAI,CAAC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E,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
|
+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;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.
|
|
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"]>;
|
|
@@ -262,8 +263,8 @@ declare const agentJobSchema: z.ZodObject<{
|
|
|
262
263
|
createdAt: z.ZodString;
|
|
263
264
|
completedAt: z.ZodNullable<z.ZodString>;
|
|
264
265
|
}, "strip", z.ZodTypeAny, {
|
|
265
|
-
status: "proposed" | "accepted" | "funded" | "in_progress" | "delivered" | "approved" | "completed" | "disputed" | "cancelled" | "resolved" | "reclaimed";
|
|
266
266
|
id: string;
|
|
267
|
+
status: "proposed" | "accepted" | "funded" | "in_progress" | "delivered" | "approved" | "completed" | "disputed" | "cancelled" | "resolved" | "reclaimed";
|
|
267
268
|
merchantId: string;
|
|
268
269
|
createdAt: string;
|
|
269
270
|
onchainJobId: number | null;
|
|
@@ -277,8 +278,8 @@ declare const agentJobSchema: z.ZodObject<{
|
|
|
277
278
|
releaseTxHash: string | null;
|
|
278
279
|
completedAt: string | null;
|
|
279
280
|
}, {
|
|
280
|
-
status: "proposed" | "accepted" | "funded" | "in_progress" | "delivered" | "approved" | "completed" | "disputed" | "cancelled" | "resolved" | "reclaimed";
|
|
281
281
|
id: string;
|
|
282
|
+
status: "proposed" | "accepted" | "funded" | "in_progress" | "delivered" | "approved" | "completed" | "disputed" | "cancelled" | "resolved" | "reclaimed";
|
|
282
283
|
merchantId: string;
|
|
283
284
|
createdAt: string;
|
|
284
285
|
onchainJobId: number | null;
|
|
@@ -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.
|
|
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.
|
|
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"]>;
|
|
@@ -262,8 +263,8 @@ declare const agentJobSchema: z.ZodObject<{
|
|
|
262
263
|
createdAt: z.ZodString;
|
|
263
264
|
completedAt: z.ZodNullable<z.ZodString>;
|
|
264
265
|
}, "strip", z.ZodTypeAny, {
|
|
265
|
-
status: "proposed" | "accepted" | "funded" | "in_progress" | "delivered" | "approved" | "completed" | "disputed" | "cancelled" | "resolved" | "reclaimed";
|
|
266
266
|
id: string;
|
|
267
|
+
status: "proposed" | "accepted" | "funded" | "in_progress" | "delivered" | "approved" | "completed" | "disputed" | "cancelled" | "resolved" | "reclaimed";
|
|
267
268
|
merchantId: string;
|
|
268
269
|
createdAt: string;
|
|
269
270
|
onchainJobId: number | null;
|
|
@@ -277,8 +278,8 @@ declare const agentJobSchema: z.ZodObject<{
|
|
|
277
278
|
releaseTxHash: string | null;
|
|
278
279
|
completedAt: string | null;
|
|
279
280
|
}, {
|
|
280
|
-
status: "proposed" | "accepted" | "funded" | "in_progress" | "delivered" | "approved" | "completed" | "disputed" | "cancelled" | "resolved" | "reclaimed";
|
|
281
281
|
id: string;
|
|
282
|
+
status: "proposed" | "accepted" | "funded" | "in_progress" | "delivered" | "approved" | "completed" | "disputed" | "cancelled" | "resolved" | "reclaimed";
|
|
282
283
|
merchantId: string;
|
|
283
284
|
createdAt: string;
|
|
284
285
|
onchainJobId: number | null;
|
|
@@ -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.
|
|
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.js.map
CHANGED
|
@@ -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,gB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A,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,C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A,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.map
CHANGED
|
@@ -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;AAG5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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. */\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.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","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AAA,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"]}
|
package/dist/api-keys.d.cts
CHANGED
|
@@ -30,25 +30,25 @@ declare const apiKeySchema: z.ZodObject<{
|
|
|
30
30
|
}, "strip", z.ZodTypeAny, {
|
|
31
31
|
id: string;
|
|
32
32
|
merchantId: string;
|
|
33
|
-
createdAt: string;
|
|
34
33
|
name: string;
|
|
35
34
|
kind: "secret" | "publishable";
|
|
36
35
|
mode: "test" | "live";
|
|
37
36
|
prefix: string;
|
|
38
37
|
lastFour: string;
|
|
39
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
|
+
createdAt: string;
|
|
40
40
|
lastUsedAt: string | null;
|
|
41
41
|
revokedAt: string | null;
|
|
42
42
|
}, {
|
|
43
43
|
id: string;
|
|
44
44
|
merchantId: string;
|
|
45
|
-
createdAt: string;
|
|
46
45
|
name: string;
|
|
47
46
|
kind: "secret" | "publishable";
|
|
48
47
|
mode: "test" | "live";
|
|
49
48
|
prefix: string;
|
|
50
49
|
lastFour: string;
|
|
51
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
|
+
createdAt: string;
|
|
52
52
|
lastUsedAt: string | null;
|
|
53
53
|
revokedAt: string | null;
|
|
54
54
|
}>;
|
|
@@ -69,7 +69,8 @@ declare const createApiKeyInputSchema: z.ZodObject<{
|
|
|
69
69
|
mode: "test" | "live";
|
|
70
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.
|
|
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;
|
|
@@ -86,25 +87,25 @@ declare const createApiKeyOutputSchema: z.ZodObject<{
|
|
|
86
87
|
}, "strip", z.ZodTypeAny, {
|
|
87
88
|
id: string;
|
|
88
89
|
merchantId: string;
|
|
89
|
-
createdAt: string;
|
|
90
90
|
name: string;
|
|
91
91
|
kind: "secret" | "publishable";
|
|
92
92
|
mode: "test" | "live";
|
|
93
93
|
prefix: string;
|
|
94
94
|
lastFour: string;
|
|
95
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")[]];
|
|
96
|
+
createdAt: string;
|
|
96
97
|
lastUsedAt: string | null;
|
|
97
98
|
revokedAt: string | null;
|
|
98
99
|
}, {
|
|
99
100
|
id: string;
|
|
100
101
|
merchantId: string;
|
|
101
|
-
createdAt: string;
|
|
102
102
|
name: string;
|
|
103
103
|
kind: "secret" | "publishable";
|
|
104
104
|
mode: "test" | "live";
|
|
105
105
|
prefix: string;
|
|
106
106
|
lastFour: string;
|
|
107
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")[]];
|
|
108
|
+
createdAt: string;
|
|
108
109
|
lastUsedAt: string | null;
|
|
109
110
|
revokedAt: string | null;
|
|
110
111
|
}>;
|
|
@@ -115,13 +116,13 @@ declare const createApiKeyOutputSchema: z.ZodObject<{
|
|
|
115
116
|
apiKey: {
|
|
116
117
|
id: string;
|
|
117
118
|
merchantId: string;
|
|
118
|
-
createdAt: string;
|
|
119
119
|
name: string;
|
|
120
120
|
kind: "secret" | "publishable";
|
|
121
121
|
mode: "test" | "live";
|
|
122
122
|
prefix: string;
|
|
123
123
|
lastFour: string;
|
|
124
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")[]];
|
|
125
|
+
createdAt: string;
|
|
125
126
|
lastUsedAt: string | null;
|
|
126
127
|
revokedAt: string | null;
|
|
127
128
|
};
|
|
@@ -130,13 +131,13 @@ declare const createApiKeyOutputSchema: z.ZodObject<{
|
|
|
130
131
|
apiKey: {
|
|
131
132
|
id: string;
|
|
132
133
|
merchantId: string;
|
|
133
|
-
createdAt: string;
|
|
134
134
|
name: string;
|
|
135
135
|
kind: "secret" | "publishable";
|
|
136
136
|
mode: "test" | "live";
|
|
137
137
|
prefix: string;
|
|
138
138
|
lastFour: string;
|
|
139
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")[]];
|
|
140
|
+
createdAt: string;
|
|
140
141
|
lastUsedAt: string | null;
|
|
141
142
|
revokedAt: string | null;
|
|
142
143
|
};
|
|
@@ -149,6 +150,7 @@ declare const rotateApiKeyInputSchema: z.ZodObject<{
|
|
|
149
150
|
}, {
|
|
150
151
|
id: string;
|
|
151
152
|
}>;
|
|
152
|
-
type RotateApiKeyInput = z.
|
|
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 };
|
package/dist/api-keys.d.ts
CHANGED
|
@@ -30,25 +30,25 @@ declare const apiKeySchema: z.ZodObject<{
|
|
|
30
30
|
}, "strip", z.ZodTypeAny, {
|
|
31
31
|
id: string;
|
|
32
32
|
merchantId: string;
|
|
33
|
-
createdAt: string;
|
|
34
33
|
name: string;
|
|
35
34
|
kind: "secret" | "publishable";
|
|
36
35
|
mode: "test" | "live";
|
|
37
36
|
prefix: string;
|
|
38
37
|
lastFour: string;
|
|
39
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
|
+
createdAt: string;
|
|
40
40
|
lastUsedAt: string | null;
|
|
41
41
|
revokedAt: string | null;
|
|
42
42
|
}, {
|
|
43
43
|
id: string;
|
|
44
44
|
merchantId: string;
|
|
45
|
-
createdAt: string;
|
|
46
45
|
name: string;
|
|
47
46
|
kind: "secret" | "publishable";
|
|
48
47
|
mode: "test" | "live";
|
|
49
48
|
prefix: string;
|
|
50
49
|
lastFour: string;
|
|
51
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
|
+
createdAt: string;
|
|
52
52
|
lastUsedAt: string | null;
|
|
53
53
|
revokedAt: string | null;
|
|
54
54
|
}>;
|
|
@@ -69,7 +69,8 @@ declare const createApiKeyInputSchema: z.ZodObject<{
|
|
|
69
69
|
mode: "test" | "live";
|
|
70
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.
|
|
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;
|
|
@@ -86,25 +87,25 @@ declare const createApiKeyOutputSchema: z.ZodObject<{
|
|
|
86
87
|
}, "strip", z.ZodTypeAny, {
|
|
87
88
|
id: string;
|
|
88
89
|
merchantId: string;
|
|
89
|
-
createdAt: string;
|
|
90
90
|
name: string;
|
|
91
91
|
kind: "secret" | "publishable";
|
|
92
92
|
mode: "test" | "live";
|
|
93
93
|
prefix: string;
|
|
94
94
|
lastFour: string;
|
|
95
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")[]];
|
|
96
|
+
createdAt: string;
|
|
96
97
|
lastUsedAt: string | null;
|
|
97
98
|
revokedAt: string | null;
|
|
98
99
|
}, {
|
|
99
100
|
id: string;
|
|
100
101
|
merchantId: string;
|
|
101
|
-
createdAt: string;
|
|
102
102
|
name: string;
|
|
103
103
|
kind: "secret" | "publishable";
|
|
104
104
|
mode: "test" | "live";
|
|
105
105
|
prefix: string;
|
|
106
106
|
lastFour: string;
|
|
107
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")[]];
|
|
108
|
+
createdAt: string;
|
|
108
109
|
lastUsedAt: string | null;
|
|
109
110
|
revokedAt: string | null;
|
|
110
111
|
}>;
|
|
@@ -115,13 +116,13 @@ declare const createApiKeyOutputSchema: z.ZodObject<{
|
|
|
115
116
|
apiKey: {
|
|
116
117
|
id: string;
|
|
117
118
|
merchantId: string;
|
|
118
|
-
createdAt: string;
|
|
119
119
|
name: string;
|
|
120
120
|
kind: "secret" | "publishable";
|
|
121
121
|
mode: "test" | "live";
|
|
122
122
|
prefix: string;
|
|
123
123
|
lastFour: string;
|
|
124
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")[]];
|
|
125
|
+
createdAt: string;
|
|
125
126
|
lastUsedAt: string | null;
|
|
126
127
|
revokedAt: string | null;
|
|
127
128
|
};
|
|
@@ -130,13 +131,13 @@ declare const createApiKeyOutputSchema: z.ZodObject<{
|
|
|
130
131
|
apiKey: {
|
|
131
132
|
id: string;
|
|
132
133
|
merchantId: string;
|
|
133
|
-
createdAt: string;
|
|
134
134
|
name: string;
|
|
135
135
|
kind: "secret" | "publishable";
|
|
136
136
|
mode: "test" | "live";
|
|
137
137
|
prefix: string;
|
|
138
138
|
lastFour: string;
|
|
139
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")[]];
|
|
140
|
+
createdAt: string;
|
|
140
141
|
lastUsedAt: string | null;
|
|
141
142
|
revokedAt: string | null;
|
|
142
143
|
};
|
|
@@ -149,6 +150,7 @@ declare const rotateApiKeyInputSchema: z.ZodObject<{
|
|
|
149
150
|
}, {
|
|
150
151
|
id: string;
|
|
151
152
|
}>;
|
|
152
|
-
type RotateApiKeyInput = z.
|
|
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 };
|