@strimz/shared-types 0.4.0 → 0.6.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/dist/api-keys.cjs +5 -1
- package/dist/api-keys.cjs.map +1 -1
- package/dist/api-keys.d.cts +18 -18
- package/dist/api-keys.d.ts +18 -18
- package/dist/api-keys.js +5 -1
- package/dist/api-keys.js.map +1 -1
- package/dist/compliance.d.cts +4 -4
- package/dist/compliance.d.ts +4 -4
- package/dist/customers.d.cts +2 -2
- package/dist/customers.d.ts +2 -2
- package/dist/events.cjs +5 -0
- 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 +5 -0
- package/dist/events.js.map +1 -1
- package/dist/index.cjs +11 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +11 -2
- package/dist/index.js.map +1 -1
- package/dist/invoices.d.cts +2 -2
- package/dist/invoices.d.ts +2 -2
- package/dist/merchants.d.cts +6 -6
- package/dist/merchants.d.ts +6 -6
- package/dist/storefronts.cjs +5 -0
- package/dist/storefronts.cjs.map +1 -1
- package/dist/storefronts.d.cts +4 -4
- package/dist/storefronts.d.ts +4 -4
- package/dist/storefronts.js +5 -0
- package/dist/storefronts.js.map +1 -1
- package/dist/subscriptions.cjs +6 -0
- package/dist/subscriptions.cjs.map +1 -1
- package/dist/subscriptions.d.cts +19 -5
- package/dist/subscriptions.d.ts +19 -5
- package/dist/subscriptions.js +6 -1
- package/dist/subscriptions.js.map +1 -1
- package/dist/transactions.d.cts +4 -4
- package/dist/transactions.d.ts +4 -4
- package/dist/webhooks.d.cts +6 -6
- package/dist/webhooks.d.ts +6 -6
- package/package.json +1 -1
- package/src/api-keys.ts +4 -0
- package/src/subscriptions.ts +7 -0
package/dist/api-keys.cjs
CHANGED
|
@@ -56,7 +56,11 @@ var apiKeyScopeSchema = zod.z.enum([
|
|
|
56
56
|
// day-to-day; needed for partner onboarding flows that mint scoped
|
|
57
57
|
// keys per sub-tenant.
|
|
58
58
|
"api_keys_read",
|
|
59
|
-
"api_keys_write"
|
|
59
|
+
"api_keys_write",
|
|
60
|
+
"merchants_read",
|
|
61
|
+
"customers_read",
|
|
62
|
+
"customers_write",
|
|
63
|
+
"analytics_read"
|
|
60
64
|
]);
|
|
61
65
|
var apiKeySchema = zod.z.object({
|
|
62
66
|
id: idSchema,
|
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;AAG5CA,KAAA,CAC3B,MAAA,EAAO,CACP,GAAA,EAAI,CACJ,MAAA,CAAO,CAAC,CAAA,KAAM,CAAA,CAAE,UAAA,CAAW,UAAU,CAAA,EAAG;AAAA,EACvC,OAAA,EAAS;AACX,CAAC;AAG0BA,KAAA,CAAE,MAAA,EAAO,CAAE,GAAA;AAOPA,KAAA,CAC9B,MAAA,EAAO,CACP,MAAM,UAAA,EAAY,iDAAiD,CAAA,CACnE,MAAA,CAAO,CAAC,CAAA,KAAM,MAAA,CAAO,CAAC,CAAA,IAAK,IAAI,cAAc;AAG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kBAAA;AAAA,EACX,UAAA,EAAY,mBAAmB,QAAA,EAAS;AAAA,EACxC,SAAA,EAAW,mBAAmB,QAAA;AAChC,CAAC;AAKM,IAAM,uBAAA,GAA0BA,MAAE,MAAA,CAAO;AAAA,EAC9C,IAAA,EAAMA,MAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA,CAAE,IAAI,EAAE,CAAA;AAAA,EAC9B,IAAA,EAAM,gBAAA;AAAA,EACN,IAAA,EAAM,UAAA;AAAA,EACN,MAAA,EAAQA,KAAAA,CAAE,KAAA,CAAM,iBAAiB,EAAE,QAAA;AACrC,CAAC;AAGM,IAAM,wBAAA,GAA2BA,MAAE,MAAA,CAAO;AAAA,EAC/C,MAAA,EAAQ,YAAA;AAAA;AAAA,EAER,MAAA,EAAQA,MAAE,MAAA;AACZ,CAAC;AAGM,IAAM,uBAAA,GAA0BA,MAAE,MAAA,CAAO;AAAA,EAC9C,EAAA,EAAI;AACN,CAAC","file":"api-keys.cjs","sourcesContent":["/**\n * Primitive schemas shared across every entity.\n * Every higher-level schema builds on these so validation is consistent.\n */\n\nimport { z } from 'zod'\n\n/** CUID2 or UUID-style opaque identifier. */\nexport const idSchema = z\n .string()\n .min(1)\n .max(64)\n .regex(/^[a-zA-Z0-9_-]+$/, 'id must be URL-safe')\n\n/** EVM address. Hex-encoded, 0x-prefixed, 20 bytes. Normalised to lowercase. */\nexport const evmAddressSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{40}$/, 'must be a 0x-prefixed 40-character hex EVM address')\n .transform((v) => v.toLowerCase())\n\n/** EVM transaction hash. 32-byte hex. */\nexport const evmTxHashSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{64}$/, 'must be a 0x-prefixed 64-character hex EVM transaction hash')\n\n/** Email address, trimmed and lower-cased. */\nexport const emailSchema = z.string().email().trim().toLowerCase().max(320)\n\n/** HTTPS URL. No http:// allowed outside dev. */\nexport const httpsUrlSchema = z\n .string()\n .url()\n .refine((v) => v.startsWith('https://'), {\n message: 'must be an https:// URL',\n })\n\n/** URL permitting http and https (dev + prod). */\nexport const httpUrlSchema = z.string().url()\n\n/**\n * Amount expressed in the token's smallest unit, serialised as a string to\n * preserve precision beyond `Number.MAX_SAFE_INTEGER`. For USDC (6 decimals),\n * 1 USDC is the string \"1000000\".\n */\nexport const tokenAmountSchema = z\n .string()\n .regex(/^[0-9]+$/, 'must be a non-negative integer string (base-10)')\n .refine((v) => BigInt(v) >= 0n, 'must be >= 0')\n\n/** Unsigned integer up to 2^53 - 1; validated and returned as number. */\nexport const uintSchema = z.number().int().min(0).max(Number.MAX_SAFE_INTEGER)\n\n/** ISO-8601 timestamp string (`.toISOString()`-compatible). */\nexport const isoTimestampSchema = z\n .string()\n .datetime({ offset: true, message: 'must be an ISO-8601 timestamp' })\n\n/** Two-letter ISO-3166 country code. */\nexport const countryCodeSchema = z\n .string()\n .length(2)\n .regex(/^[A-Z]{2}$/, 'must be an ISO-3166 alpha-2 country code')\n\n/** Pagination inputs used by every list endpoint. */\nexport const paginationInputSchema = z.object({\n limit: z.number().int().min(1).max(100).default(25),\n cursor: z.string().min(1).max(200).nullish(),\n})\nexport type PaginationInput = z.infer<typeof paginationInputSchema>\n\n/** Pagination envelope used by every list response. */\nexport const makePaginatedSchema = <T extends z.ZodTypeAny>(item: T) =>\n z.object({\n data: z.array(item),\n nextCursor: z.string().nullable(),\n hasMore: z.boolean(),\n })\n\n/** Free-form metadata bag the API round-trips for merchants. */\nexport const metadataSchema = z\n .record(\n z.string().min(1).max(40),\n z.union([z.string().max(500), z.number(), z.boolean(), z.null()]),\n )\n .refine((m) => Object.keys(m).length <= 50, 'at most 50 metadata keys')\n .default({})\n\n/** Environment mode carried on every mode-scoped resource. */\nexport const modeSchema = z.enum(['test', 'live'])\nexport type Mode = z.infer<typeof modeSchema>\n\n/** Payment token enum. */\nexport const paymentCurrencySchema = z.enum(['USDC', 'EURC'])\nexport type PaymentCurrency = z.infer<typeof paymentCurrencySchema>\n\n/** Every display-level currency (payment + treasury). */\nexport const tokenSymbolSchema = z.enum(['USDC', 'EURC', 'USYC'])\nexport type TokenSymbol = z.infer<typeof tokenSymbolSchema>\n\n/** Merchant tier enum. */\nexport const merchantTierSchema = z.enum(['free', 'growth', 'business', 'enterprise'])\nexport type MerchantTier = z.infer<typeof merchantTierSchema>\n\n/** Arc environment enum. */\nexport const arcEnvironmentSchema = z.enum(['testnet', 'mainnet'])\nexport type ArcEnvironment = z.infer<typeof arcEnvironmentSchema>\n\nexport type Id = z.infer<typeof idSchema>\nexport type EvmAddress = z.infer<typeof evmAddressSchema>\nexport type EvmTxHash = z.infer<typeof evmTxHashSchema>\nexport type TokenAmount = z.infer<typeof tokenAmountSchema>\nexport type IsoTimestamp = z.infer<typeof isoTimestampSchema>\nexport type Metadata = z.infer<typeof metadataSchema>\n","/**\n * API keys.\n *\n * A merchant has independent test and live keys. The full secret is shown\n * exactly once at creation; the backend stores only a hash and a display prefix.\n */\n\nimport { z } from 'zod'\nimport { idSchema, isoTimestampSchema, modeSchema } from './common.js'\n\nexport const apiKeyKindSchema = z.enum(['secret', 'publishable'])\nexport type ApiKeyKind = z.infer<typeof apiKeyKindSchema>\n\n/**\n * Underscore-separated. The wire format and any database representation\n * use the same form so there is no boundary translation.\n */\nexport const apiKeyScopeSchema = z.enum([\n 'sessions_read',\n 'sessions_write',\n 'subscriptions_read',\n 'subscriptions_write',\n 'refunds_read',\n 'refunds_write',\n 'transactions_read',\n 'webhooks_read',\n 'webhooks_write',\n 'invoices_read',\n 'invoices_write',\n 'storefronts_read',\n 'storefronts_write',\n 'agents_read',\n 'agents_write',\n // Meta-tx relayer. Submitting payer-signed EIP-3009 / EIP-2612\n // authorizations on the merchant's behalf. Granted to keys used by\n // hosted checkout and merchants embedding the SDK.\n 'relay_read',\n 'relay_write',\n // Self-service key management from an API key holder. Rarely used\n // day-to-day; needed for partner onboarding flows that mint scoped\n // keys per sub-tenant.\n 'api_keys_read',\n 'api_keys_write',\n])\nexport type ApiKeyScope = z.infer<typeof apiKeyScopeSchema>\n\nexport const apiKeySchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n name: z.string().min(1).max(60),\n kind: apiKeyKindSchema,\n mode: modeSchema,\n prefix: z.string().min(8).max(24),\n lastFour: z.string().length(4),\n scopes: z.array(apiKeyScopeSchema).nonempty(),\n createdAt: isoTimestampSchema,\n lastUsedAt: isoTimestampSchema.nullable(),\n revokedAt: isoTimestampSchema.nullable(),\n})\nexport type ApiKey = z.infer<typeof apiKeySchema>\n\n// ---------- DTOs ----------\n\nexport const createApiKeyInputSchema = z.object({\n name: z.string().min(1).max(60),\n kind: apiKeyKindSchema,\n mode: modeSchema,\n scopes: z.array(apiKeyScopeSchema).nonempty(),\n})\nexport type CreateApiKeyInput = z.infer<typeof createApiKeyInputSchema>\n\nexport const createApiKeyOutputSchema = z.object({\n apiKey: apiKeySchema,\n /** Full plaintext key. Shown exactly once. */\n secret: z.string(),\n})\nexport type CreateApiKeyOutput = z.infer<typeof createApiKeyOutputSchema>\n\nexport const rotateApiKeyInputSchema = z.object({\n id: idSchema,\n})\nexport type RotateApiKeyInput = z.infer<typeof rotateApiKeyInputSchema>\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/common.ts","../src/api-keys.ts"],"names":["z"],"mappings":";;;;;AAQO,IAAM,QAAA,GAAWA,KAAA,CACrB,MAAA,EAAO,CACP,GAAA,CAAI,CAAC,CAAA,CACL,GAAA,CAAI,EAAE,CAAA,CACN,KAAA,CAAM,kBAAA,EAAoB,qBAAqB,CAAA;AAGlBA,KAAA,CAC7B,MAAA,EAAO,CACP,KAAA,CAAM,qBAAA,EAAuB,oDAAoD,CAAA,CACjF,SAAA,CAAU,CAAC,CAAA,KAAM,CAAA,CAAE,aAAa;AAGJA,KAAA,CAC5B,MAAA,EAAO,CACP,KAAA,CAAM,uBAAuB,6DAA6D;AAGlEA,KAAA,CAAE,MAAA,EAAO,CAAE,KAAA,EAAM,CAAE,IAAA,EAAK,CAAE,WAAA,EAAY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QAAA;AAAA,EACJ,UAAA,EAAY,QAAA;AAAA,EACZ,IAAA,EAAMA,MAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA,CAAE,IAAI,EAAE,CAAA;AAAA,EAC9B,IAAA,EAAM,gBAAA;AAAA,EACN,IAAA,EAAM,UAAA;AAAA,EACN,MAAA,EAAQA,MAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA,CAAE,IAAI,EAAE,CAAA;AAAA,EAChC,QAAA,EAAUA,KAAAA,CAAE,MAAA,EAAO,CAAE,OAAO,CAAC,CAAA;AAAA,EAC7B,MAAA,EAAQA,KAAAA,CAAE,KAAA,CAAM,iBAAiB,EAAE,QAAA,EAAS;AAAA,EAC5C,SAAA,EAAW,kBAAA;AAAA,EACX,UAAA,EAAY,mBAAmB,QAAA,EAAS;AAAA,EACxC,SAAA,EAAW,mBAAmB,QAAA;AAChC,CAAC;AAKM,IAAM,uBAAA,GAA0BA,MAAE,MAAA,CAAO;AAAA,EAC9C,IAAA,EAAMA,MAAE,MAAA,EAAO,CAAE,IAAI,CAAC,CAAA,CAAE,IAAI,EAAE,CAAA;AAAA,EAC9B,IAAA,EAAM,gBAAA;AAAA,EACN,IAAA,EAAM,UAAA;AAAA,EACN,MAAA,EAAQA,KAAAA,CAAE,KAAA,CAAM,iBAAiB,EAAE,QAAA;AACrC,CAAC;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"]}
|
package/dist/api-keys.d.cts
CHANGED
|
@@ -13,7 +13,7 @@ type ApiKeyKind = z.infer<typeof apiKeyKindSchema>;
|
|
|
13
13
|
* Underscore-separated. The wire format and any database representation
|
|
14
14
|
* use the same form so there is no boundary translation.
|
|
15
15
|
*/
|
|
16
|
-
declare const apiKeyScopeSchema: z.ZodEnum<["sessions_read", "sessions_write", "subscriptions_read", "subscriptions_write", "refunds_read", "refunds_write", "transactions_read", "webhooks_read", "webhooks_write", "invoices_read", "invoices_write", "storefronts_read", "storefronts_write", "agents_read", "agents_write", "relay_read", "relay_write", "api_keys_read", "api_keys_write"]>;
|
|
16
|
+
declare const apiKeyScopeSchema: z.ZodEnum<["sessions_read", "sessions_write", "subscriptions_read", "subscriptions_write", "refunds_read", "refunds_write", "transactions_read", "webhooks_read", "webhooks_write", "invoices_read", "invoices_write", "storefronts_read", "storefronts_write", "agents_read", "agents_write", "relay_read", "relay_write", "api_keys_read", "api_keys_write", "merchants_read", "customers_read", "customers_write", "analytics_read"]>;
|
|
17
17
|
type ApiKeyScope = z.infer<typeof apiKeyScopeSchema>;
|
|
18
18
|
declare const apiKeySchema: z.ZodObject<{
|
|
19
19
|
id: z.ZodString;
|
|
@@ -23,32 +23,32 @@ declare const apiKeySchema: z.ZodObject<{
|
|
|
23
23
|
mode: z.ZodEnum<["test", "live"]>;
|
|
24
24
|
prefix: z.ZodString;
|
|
25
25
|
lastFour: z.ZodString;
|
|
26
|
-
scopes: z.ZodArray<z.ZodEnum<["sessions_read", "sessions_write", "subscriptions_read", "subscriptions_write", "refunds_read", "refunds_write", "transactions_read", "webhooks_read", "webhooks_write", "invoices_read", "invoices_write", "storefronts_read", "storefronts_write", "agents_read", "agents_write", "relay_read", "relay_write", "api_keys_read", "api_keys_write"]>, "atleastone">;
|
|
26
|
+
scopes: z.ZodArray<z.ZodEnum<["sessions_read", "sessions_write", "subscriptions_read", "subscriptions_write", "refunds_read", "refunds_write", "transactions_read", "webhooks_read", "webhooks_write", "invoices_read", "invoices_write", "storefronts_read", "storefronts_write", "agents_read", "agents_write", "relay_read", "relay_write", "api_keys_read", "api_keys_write", "merchants_read", "customers_read", "customers_write", "analytics_read"]>, "atleastone">;
|
|
27
27
|
createdAt: z.ZodString;
|
|
28
28
|
lastUsedAt: z.ZodNullable<z.ZodString>;
|
|
29
29
|
revokedAt: z.ZodNullable<z.ZodString>;
|
|
30
30
|
}, "strip", z.ZodTypeAny, {
|
|
31
31
|
id: string;
|
|
32
32
|
merchantId: string;
|
|
33
|
+
createdAt: string;
|
|
33
34
|
name: string;
|
|
34
35
|
kind: "secret" | "publishable";
|
|
35
36
|
mode: "test" | "live";
|
|
36
37
|
prefix: string;
|
|
37
38
|
lastFour: string;
|
|
38
|
-
scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write")[]];
|
|
39
|
-
createdAt: 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" | "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")[]];
|
|
40
40
|
lastUsedAt: string | null;
|
|
41
41
|
revokedAt: string | null;
|
|
42
42
|
}, {
|
|
43
43
|
id: string;
|
|
44
44
|
merchantId: string;
|
|
45
|
+
createdAt: string;
|
|
45
46
|
name: string;
|
|
46
47
|
kind: "secret" | "publishable";
|
|
47
48
|
mode: "test" | "live";
|
|
48
49
|
prefix: string;
|
|
49
50
|
lastFour: string;
|
|
50
|
-
scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write")[]];
|
|
51
|
-
createdAt: 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" | "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")[]];
|
|
52
52
|
lastUsedAt: string | null;
|
|
53
53
|
revokedAt: string | null;
|
|
54
54
|
}>;
|
|
@@ -57,17 +57,17 @@ declare const createApiKeyInputSchema: z.ZodObject<{
|
|
|
57
57
|
name: z.ZodString;
|
|
58
58
|
kind: z.ZodEnum<["secret", "publishable"]>;
|
|
59
59
|
mode: z.ZodEnum<["test", "live"]>;
|
|
60
|
-
scopes: z.ZodArray<z.ZodEnum<["sessions_read", "sessions_write", "subscriptions_read", "subscriptions_write", "refunds_read", "refunds_write", "transactions_read", "webhooks_read", "webhooks_write", "invoices_read", "invoices_write", "storefronts_read", "storefronts_write", "agents_read", "agents_write", "relay_read", "relay_write", "api_keys_read", "api_keys_write"]>, "atleastone">;
|
|
60
|
+
scopes: z.ZodArray<z.ZodEnum<["sessions_read", "sessions_write", "subscriptions_read", "subscriptions_write", "refunds_read", "refunds_write", "transactions_read", "webhooks_read", "webhooks_write", "invoices_read", "invoices_write", "storefronts_read", "storefronts_write", "agents_read", "agents_write", "relay_read", "relay_write", "api_keys_read", "api_keys_write", "merchants_read", "customers_read", "customers_write", "analytics_read"]>, "atleastone">;
|
|
61
61
|
}, "strip", z.ZodTypeAny, {
|
|
62
62
|
name: string;
|
|
63
63
|
kind: "secret" | "publishable";
|
|
64
64
|
mode: "test" | "live";
|
|
65
|
-
scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write")[]];
|
|
65
|
+
scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write" | "merchants_read" | "customers_read" | "customers_write" | "analytics_read", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write" | "merchants_read" | "customers_read" | "customers_write" | "analytics_read")[]];
|
|
66
66
|
}, {
|
|
67
67
|
name: string;
|
|
68
68
|
kind: "secret" | "publishable";
|
|
69
69
|
mode: "test" | "live";
|
|
70
|
-
scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write")[]];
|
|
70
|
+
scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write" | "merchants_read" | "customers_read" | "customers_write" | "analytics_read", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write" | "merchants_read" | "customers_read" | "customers_write" | "analytics_read")[]];
|
|
71
71
|
}>;
|
|
72
72
|
type CreateApiKeyInput = z.infer<typeof createApiKeyInputSchema>;
|
|
73
73
|
declare const createApiKeyOutputSchema: z.ZodObject<{
|
|
@@ -79,32 +79,32 @@ declare const createApiKeyOutputSchema: z.ZodObject<{
|
|
|
79
79
|
mode: z.ZodEnum<["test", "live"]>;
|
|
80
80
|
prefix: z.ZodString;
|
|
81
81
|
lastFour: z.ZodString;
|
|
82
|
-
scopes: z.ZodArray<z.ZodEnum<["sessions_read", "sessions_write", "subscriptions_read", "subscriptions_write", "refunds_read", "refunds_write", "transactions_read", "webhooks_read", "webhooks_write", "invoices_read", "invoices_write", "storefronts_read", "storefronts_write", "agents_read", "agents_write", "relay_read", "relay_write", "api_keys_read", "api_keys_write"]>, "atleastone">;
|
|
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", "merchants_read", "customers_read", "customers_write", "analytics_read"]>, "atleastone">;
|
|
83
83
|
createdAt: z.ZodString;
|
|
84
84
|
lastUsedAt: z.ZodNullable<z.ZodString>;
|
|
85
85
|
revokedAt: z.ZodNullable<z.ZodString>;
|
|
86
86
|
}, "strip", z.ZodTypeAny, {
|
|
87
87
|
id: string;
|
|
88
88
|
merchantId: string;
|
|
89
|
+
createdAt: string;
|
|
89
90
|
name: string;
|
|
90
91
|
kind: "secret" | "publishable";
|
|
91
92
|
mode: "test" | "live";
|
|
92
93
|
prefix: string;
|
|
93
94
|
lastFour: string;
|
|
94
|
-
scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write")[]];
|
|
95
|
-
createdAt: 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" | "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
96
|
lastUsedAt: string | null;
|
|
97
97
|
revokedAt: string | null;
|
|
98
98
|
}, {
|
|
99
99
|
id: string;
|
|
100
100
|
merchantId: string;
|
|
101
|
+
createdAt: string;
|
|
101
102
|
name: string;
|
|
102
103
|
kind: "secret" | "publishable";
|
|
103
104
|
mode: "test" | "live";
|
|
104
105
|
prefix: string;
|
|
105
106
|
lastFour: string;
|
|
106
|
-
scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write")[]];
|
|
107
|
-
createdAt: 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" | "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
108
|
lastUsedAt: string | null;
|
|
109
109
|
revokedAt: string | null;
|
|
110
110
|
}>;
|
|
@@ -115,13 +115,13 @@ declare const createApiKeyOutputSchema: z.ZodObject<{
|
|
|
115
115
|
apiKey: {
|
|
116
116
|
id: string;
|
|
117
117
|
merchantId: string;
|
|
118
|
+
createdAt: string;
|
|
118
119
|
name: string;
|
|
119
120
|
kind: "secret" | "publishable";
|
|
120
121
|
mode: "test" | "live";
|
|
121
122
|
prefix: string;
|
|
122
123
|
lastFour: string;
|
|
123
|
-
scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write")[]];
|
|
124
|
-
createdAt: 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" | "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
125
|
lastUsedAt: string | null;
|
|
126
126
|
revokedAt: string | null;
|
|
127
127
|
};
|
|
@@ -130,13 +130,13 @@ declare const createApiKeyOutputSchema: z.ZodObject<{
|
|
|
130
130
|
apiKey: {
|
|
131
131
|
id: string;
|
|
132
132
|
merchantId: string;
|
|
133
|
+
createdAt: string;
|
|
133
134
|
name: string;
|
|
134
135
|
kind: "secret" | "publishable";
|
|
135
136
|
mode: "test" | "live";
|
|
136
137
|
prefix: string;
|
|
137
138
|
lastFour: string;
|
|
138
|
-
scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write")[]];
|
|
139
|
-
createdAt: 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" | "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
140
|
lastUsedAt: string | null;
|
|
141
141
|
revokedAt: string | null;
|
|
142
142
|
};
|
package/dist/api-keys.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ type ApiKeyKind = z.infer<typeof apiKeyKindSchema>;
|
|
|
13
13
|
* Underscore-separated. The wire format and any database representation
|
|
14
14
|
* use the same form so there is no boundary translation.
|
|
15
15
|
*/
|
|
16
|
-
declare const apiKeyScopeSchema: z.ZodEnum<["sessions_read", "sessions_write", "subscriptions_read", "subscriptions_write", "refunds_read", "refunds_write", "transactions_read", "webhooks_read", "webhooks_write", "invoices_read", "invoices_write", "storefronts_read", "storefronts_write", "agents_read", "agents_write", "relay_read", "relay_write", "api_keys_read", "api_keys_write"]>;
|
|
16
|
+
declare const apiKeyScopeSchema: z.ZodEnum<["sessions_read", "sessions_write", "subscriptions_read", "subscriptions_write", "refunds_read", "refunds_write", "transactions_read", "webhooks_read", "webhooks_write", "invoices_read", "invoices_write", "storefronts_read", "storefronts_write", "agents_read", "agents_write", "relay_read", "relay_write", "api_keys_read", "api_keys_write", "merchants_read", "customers_read", "customers_write", "analytics_read"]>;
|
|
17
17
|
type ApiKeyScope = z.infer<typeof apiKeyScopeSchema>;
|
|
18
18
|
declare const apiKeySchema: z.ZodObject<{
|
|
19
19
|
id: z.ZodString;
|
|
@@ -23,32 +23,32 @@ declare const apiKeySchema: z.ZodObject<{
|
|
|
23
23
|
mode: z.ZodEnum<["test", "live"]>;
|
|
24
24
|
prefix: z.ZodString;
|
|
25
25
|
lastFour: z.ZodString;
|
|
26
|
-
scopes: z.ZodArray<z.ZodEnum<["sessions_read", "sessions_write", "subscriptions_read", "subscriptions_write", "refunds_read", "refunds_write", "transactions_read", "webhooks_read", "webhooks_write", "invoices_read", "invoices_write", "storefronts_read", "storefronts_write", "agents_read", "agents_write", "relay_read", "relay_write", "api_keys_read", "api_keys_write"]>, "atleastone">;
|
|
26
|
+
scopes: z.ZodArray<z.ZodEnum<["sessions_read", "sessions_write", "subscriptions_read", "subscriptions_write", "refunds_read", "refunds_write", "transactions_read", "webhooks_read", "webhooks_write", "invoices_read", "invoices_write", "storefronts_read", "storefronts_write", "agents_read", "agents_write", "relay_read", "relay_write", "api_keys_read", "api_keys_write", "merchants_read", "customers_read", "customers_write", "analytics_read"]>, "atleastone">;
|
|
27
27
|
createdAt: z.ZodString;
|
|
28
28
|
lastUsedAt: z.ZodNullable<z.ZodString>;
|
|
29
29
|
revokedAt: z.ZodNullable<z.ZodString>;
|
|
30
30
|
}, "strip", z.ZodTypeAny, {
|
|
31
31
|
id: string;
|
|
32
32
|
merchantId: string;
|
|
33
|
+
createdAt: string;
|
|
33
34
|
name: string;
|
|
34
35
|
kind: "secret" | "publishable";
|
|
35
36
|
mode: "test" | "live";
|
|
36
37
|
prefix: string;
|
|
37
38
|
lastFour: string;
|
|
38
|
-
scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write")[]];
|
|
39
|
-
createdAt: 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" | "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")[]];
|
|
40
40
|
lastUsedAt: string | null;
|
|
41
41
|
revokedAt: string | null;
|
|
42
42
|
}, {
|
|
43
43
|
id: string;
|
|
44
44
|
merchantId: string;
|
|
45
|
+
createdAt: string;
|
|
45
46
|
name: string;
|
|
46
47
|
kind: "secret" | "publishable";
|
|
47
48
|
mode: "test" | "live";
|
|
48
49
|
prefix: string;
|
|
49
50
|
lastFour: string;
|
|
50
|
-
scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write")[]];
|
|
51
|
-
createdAt: 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" | "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")[]];
|
|
52
52
|
lastUsedAt: string | null;
|
|
53
53
|
revokedAt: string | null;
|
|
54
54
|
}>;
|
|
@@ -57,17 +57,17 @@ declare const createApiKeyInputSchema: z.ZodObject<{
|
|
|
57
57
|
name: z.ZodString;
|
|
58
58
|
kind: z.ZodEnum<["secret", "publishable"]>;
|
|
59
59
|
mode: z.ZodEnum<["test", "live"]>;
|
|
60
|
-
scopes: z.ZodArray<z.ZodEnum<["sessions_read", "sessions_write", "subscriptions_read", "subscriptions_write", "refunds_read", "refunds_write", "transactions_read", "webhooks_read", "webhooks_write", "invoices_read", "invoices_write", "storefronts_read", "storefronts_write", "agents_read", "agents_write", "relay_read", "relay_write", "api_keys_read", "api_keys_write"]>, "atleastone">;
|
|
60
|
+
scopes: z.ZodArray<z.ZodEnum<["sessions_read", "sessions_write", "subscriptions_read", "subscriptions_write", "refunds_read", "refunds_write", "transactions_read", "webhooks_read", "webhooks_write", "invoices_read", "invoices_write", "storefronts_read", "storefronts_write", "agents_read", "agents_write", "relay_read", "relay_write", "api_keys_read", "api_keys_write", "merchants_read", "customers_read", "customers_write", "analytics_read"]>, "atleastone">;
|
|
61
61
|
}, "strip", z.ZodTypeAny, {
|
|
62
62
|
name: string;
|
|
63
63
|
kind: "secret" | "publishable";
|
|
64
64
|
mode: "test" | "live";
|
|
65
|
-
scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write")[]];
|
|
65
|
+
scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write" | "merchants_read" | "customers_read" | "customers_write" | "analytics_read", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write" | "merchants_read" | "customers_read" | "customers_write" | "analytics_read")[]];
|
|
66
66
|
}, {
|
|
67
67
|
name: string;
|
|
68
68
|
kind: "secret" | "publishable";
|
|
69
69
|
mode: "test" | "live";
|
|
70
|
-
scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write")[]];
|
|
70
|
+
scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write" | "merchants_read" | "customers_read" | "customers_write" | "analytics_read", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write" | "merchants_read" | "customers_read" | "customers_write" | "analytics_read")[]];
|
|
71
71
|
}>;
|
|
72
72
|
type CreateApiKeyInput = z.infer<typeof createApiKeyInputSchema>;
|
|
73
73
|
declare const createApiKeyOutputSchema: z.ZodObject<{
|
|
@@ -79,32 +79,32 @@ declare const createApiKeyOutputSchema: z.ZodObject<{
|
|
|
79
79
|
mode: z.ZodEnum<["test", "live"]>;
|
|
80
80
|
prefix: z.ZodString;
|
|
81
81
|
lastFour: z.ZodString;
|
|
82
|
-
scopes: z.ZodArray<z.ZodEnum<["sessions_read", "sessions_write", "subscriptions_read", "subscriptions_write", "refunds_read", "refunds_write", "transactions_read", "webhooks_read", "webhooks_write", "invoices_read", "invoices_write", "storefronts_read", "storefronts_write", "agents_read", "agents_write", "relay_read", "relay_write", "api_keys_read", "api_keys_write"]>, "atleastone">;
|
|
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", "merchants_read", "customers_read", "customers_write", "analytics_read"]>, "atleastone">;
|
|
83
83
|
createdAt: z.ZodString;
|
|
84
84
|
lastUsedAt: z.ZodNullable<z.ZodString>;
|
|
85
85
|
revokedAt: z.ZodNullable<z.ZodString>;
|
|
86
86
|
}, "strip", z.ZodTypeAny, {
|
|
87
87
|
id: string;
|
|
88
88
|
merchantId: string;
|
|
89
|
+
createdAt: string;
|
|
89
90
|
name: string;
|
|
90
91
|
kind: "secret" | "publishable";
|
|
91
92
|
mode: "test" | "live";
|
|
92
93
|
prefix: string;
|
|
93
94
|
lastFour: string;
|
|
94
|
-
scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write")[]];
|
|
95
|
-
createdAt: 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" | "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
96
|
lastUsedAt: string | null;
|
|
97
97
|
revokedAt: string | null;
|
|
98
98
|
}, {
|
|
99
99
|
id: string;
|
|
100
100
|
merchantId: string;
|
|
101
|
+
createdAt: string;
|
|
101
102
|
name: string;
|
|
102
103
|
kind: "secret" | "publishable";
|
|
103
104
|
mode: "test" | "live";
|
|
104
105
|
prefix: string;
|
|
105
106
|
lastFour: string;
|
|
106
|
-
scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write")[]];
|
|
107
|
-
createdAt: 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" | "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
108
|
lastUsedAt: string | null;
|
|
109
109
|
revokedAt: string | null;
|
|
110
110
|
}>;
|
|
@@ -115,13 +115,13 @@ declare const createApiKeyOutputSchema: z.ZodObject<{
|
|
|
115
115
|
apiKey: {
|
|
116
116
|
id: string;
|
|
117
117
|
merchantId: string;
|
|
118
|
+
createdAt: string;
|
|
118
119
|
name: string;
|
|
119
120
|
kind: "secret" | "publishable";
|
|
120
121
|
mode: "test" | "live";
|
|
121
122
|
prefix: string;
|
|
122
123
|
lastFour: string;
|
|
123
|
-
scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write")[]];
|
|
124
|
-
createdAt: 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" | "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
125
|
lastUsedAt: string | null;
|
|
126
126
|
revokedAt: string | null;
|
|
127
127
|
};
|
|
@@ -130,13 +130,13 @@ declare const createApiKeyOutputSchema: z.ZodObject<{
|
|
|
130
130
|
apiKey: {
|
|
131
131
|
id: string;
|
|
132
132
|
merchantId: string;
|
|
133
|
+
createdAt: string;
|
|
133
134
|
name: string;
|
|
134
135
|
kind: "secret" | "publishable";
|
|
135
136
|
mode: "test" | "live";
|
|
136
137
|
prefix: string;
|
|
137
138
|
lastFour: string;
|
|
138
|
-
scopes: ["sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write", ...("sessions_read" | "sessions_write" | "subscriptions_read" | "subscriptions_write" | "refunds_read" | "refunds_write" | "transactions_read" | "webhooks_read" | "webhooks_write" | "invoices_read" | "invoices_write" | "storefronts_read" | "storefronts_write" | "agents_read" | "agents_write" | "relay_read" | "relay_write" | "api_keys_read" | "api_keys_write")[]];
|
|
139
|
-
createdAt: 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" | "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
140
|
lastUsedAt: string | null;
|
|
141
141
|
revokedAt: string | null;
|
|
142
142
|
};
|
package/dist/api-keys.js
CHANGED
|
@@ -54,7 +54,11 @@ var apiKeyScopeSchema = z.enum([
|
|
|
54
54
|
// day-to-day; needed for partner onboarding flows that mint scoped
|
|
55
55
|
// keys per sub-tenant.
|
|
56
56
|
"api_keys_read",
|
|
57
|
-
"api_keys_write"
|
|
57
|
+
"api_keys_write",
|
|
58
|
+
"merchants_read",
|
|
59
|
+
"customers_read",
|
|
60
|
+
"customers_write",
|
|
61
|
+
"analytics_read"
|
|
58
62
|
]);
|
|
59
63
|
var apiKeySchema = z.object({
|
|
60
64
|
id: idSchema,
|
package/dist/api-keys.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/common.ts","../src/api-keys.ts"],"names":["z"],"mappings":";;;AAQO,IAAM,QAAA,GAAW,CAAA,CACrB,MAAA,EAAO,CACP,GAAA,CAAI,CAAC,CAAA,CACL,GAAA,CAAI,EAAE,CAAA,CACN,KAAA,CAAM,kBAAA,EAAoB,qBAAqB,CAAA;AAGlB,CAAA,CAC7B,MAAA,EAAO,CACP,KAAA,CAAM,qBAAA,EAAuB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her-level schema builds on these so validation is consistent.\n */\n\nimport { z } from 'zod'\n\n/** CUID2 or UUID-style opaque identifier. */\nexport const idSchema = z\n .string()\n .min(1)\n .max(64)\n .regex(/^[a-zA-Z0-9_-]+$/, 'id must be URL-safe')\n\n/** EVM address. Hex-encoded, 0x-prefixed, 20 bytes. Normalised to lowercase. */\nexport const evmAddressSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{40}$/, 'must be a 0x-prefixed 40-character hex EVM address')\n .transform((v) => v.toLowerCase())\n\n/** EVM transaction hash. 32-byte hex. */\nexport const evmTxHashSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{64}$/, 'must be a 0x-prefixed 64-character hex EVM transaction hash')\n\n/** Email address, trimmed and lower-cased. */\nexport const emailSchema = z.string().email().trim().toLowerCase().max(320)\n\n/** HTTPS URL. No http:// allowed outside dev. */\nexport const httpsUrlSchema = z\n .string()\n .url()\n .refine((v) => v.startsWith('https://'), {\n message: 'must be an https:// URL',\n })\n\n/** URL permitting http and https (dev + prod). */\nexport const httpUrlSchema = z.string().url()\n\n/**\n * Amount expressed in the token's smallest unit, serialised as a string to\n * preserve precision beyond `Number.MAX_SAFE_INTEGER`. For USDC (6 decimals),\n * 1 USDC is the string \"1000000\".\n */\nexport const tokenAmountSchema = z\n .string()\n .regex(/^[0-9]+$/, 'must be a non-negative integer string (base-10)')\n .refine((v) => BigInt(v) >= 0n, 'must be >= 0')\n\n/** Unsigned integer up to 2^53 - 1; validated and returned as number. */\nexport const uintSchema = z.number().int().min(0).max(Number.MAX_SAFE_INTEGER)\n\n/** ISO-8601 timestamp string (`.toISOString()`-compatible). */\nexport const isoTimestampSchema = z\n .string()\n .datetime({ offset: true, message: 'must be an ISO-8601 timestamp' })\n\n/** Two-letter ISO-3166 country code. */\nexport const countryCodeSchema = z\n .string()\n .length(2)\n .regex(/^[A-Z]{2}$/, 'must be an ISO-3166 alpha-2 country code')\n\n/** Pagination inputs used by every list endpoint. */\nexport const paginationInputSchema = z.object({\n limit: z.number().int().min(1).max(100).default(25),\n cursor: z.string().min(1).max(200).nullish(),\n})\nexport type PaginationInput = z.infer<typeof paginationInputSchema>\n\n/** Pagination envelope used by every list response. */\nexport const makePaginatedSchema = <T extends z.ZodTypeAny>(item: T) =>\n z.object({\n data: z.array(item),\n nextCursor: z.string().nullable(),\n hasMore: z.boolean(),\n })\n\n/** Free-form metadata bag the API round-trips for merchants. */\nexport const metadataSchema = z\n .record(\n z.string().min(1).max(40),\n z.union([z.string().max(500), z.number(), z.boolean(), z.null()]),\n )\n .refine((m) => Object.keys(m).length <= 50, 'at most 50 metadata keys')\n .default({})\n\n/** Environment mode carried on every mode-scoped resource. */\nexport const modeSchema = z.enum(['test', 'live'])\nexport type Mode = z.infer<typeof modeSchema>\n\n/** Payment token enum. */\nexport const paymentCurrencySchema = z.enum(['USDC', 'EURC'])\nexport type PaymentCurrency = z.infer<typeof paymentCurrencySchema>\n\n/** Every display-level currency (payment + treasury). */\nexport const tokenSymbolSchema = z.enum(['USDC', 'EURC', 'USYC'])\nexport type TokenSymbol = z.infer<typeof tokenSymbolSchema>\n\n/** Merchant tier enum. */\nexport const merchantTierSchema = z.enum(['free', 'growth', 'business', 'enterprise'])\nexport type MerchantTier = z.infer<typeof merchantTierSchema>\n\n/** Arc environment enum. */\nexport const arcEnvironmentSchema = z.enum(['testnet', 'mainnet'])\nexport type ArcEnvironment = z.infer<typeof arcEnvironmentSchema>\n\nexport type Id = z.infer<typeof idSchema>\nexport type EvmAddress = z.infer<typeof evmAddressSchema>\nexport type EvmTxHash = z.infer<typeof evmTxHashSchema>\nexport type TokenAmount = z.infer<typeof tokenAmountSchema>\nexport type IsoTimestamp = z.infer<typeof isoTimestampSchema>\nexport type Metadata = z.infer<typeof metadataSchema>\n","/**\n * API keys.\n *\n * A merchant has independent test and live keys. The full secret is shown\n * exactly once at creation; the backend stores only a hash and a display prefix.\n */\n\nimport { z } from 'zod'\nimport { idSchema, isoTimestampSchema, modeSchema } from './common.js'\n\nexport const apiKeyKindSchema = z.enum(['secret', 'publishable'])\nexport type ApiKeyKind = z.infer<typeof apiKeyKindSchema>\n\n/**\n * Underscore-separated. The wire format and any database representation\n * use the same form so there is no boundary translation.\n */\nexport const apiKeyScopeSchema = z.enum([\n 'sessions_read',\n 'sessions_write',\n 'subscriptions_read',\n 'subscriptions_write',\n 'refunds_read',\n 'refunds_write',\n 'transactions_read',\n 'webhooks_read',\n 'webhooks_write',\n 'invoices_read',\n 'invoices_write',\n 'storefronts_read',\n 'storefronts_write',\n 'agents_read',\n 'agents_write',\n // Meta-tx relayer. Submitting payer-signed EIP-3009 / EIP-2612\n // authorizations on the merchant's behalf. Granted to keys used by\n // hosted checkout and merchants embedding the SDK.\n 'relay_read',\n 'relay_write',\n // Self-service key management from an API key holder. Rarely used\n // day-to-day; needed for partner onboarding flows that mint scoped\n // keys per sub-tenant.\n 'api_keys_read',\n 'api_keys_write',\n])\nexport type ApiKeyScope = z.infer<typeof apiKeyScopeSchema>\n\nexport const apiKeySchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n name: z.string().min(1).max(60),\n kind: apiKeyKindSchema,\n mode: modeSchema,\n prefix: z.string().min(8).max(24),\n lastFour: z.string().length(4),\n scopes: z.array(apiKeyScopeSchema).nonempty(),\n createdAt: isoTimestampSchema,\n lastUsedAt: isoTimestampSchema.nullable(),\n revokedAt: isoTimestampSchema.nullable(),\n})\nexport type ApiKey = z.infer<typeof apiKeySchema>\n\n// ---------- DTOs ----------\n\nexport const createApiKeyInputSchema = z.object({\n name: z.string().min(1).max(60),\n kind: apiKeyKindSchema,\n mode: modeSchema,\n scopes: z.array(apiKeyScopeSchema).nonempty(),\n})\nexport type CreateApiKeyInput = z.infer<typeof createApiKeyInputSchema>\n\nexport const createApiKeyOutputSchema = z.object({\n apiKey: apiKeySchema,\n /** Full plaintext key. Shown exactly once. */\n secret: z.string(),\n})\nexport type CreateApiKeyOutput = z.infer<typeof createApiKeyOutputSchema>\n\nexport const rotateApiKeyInputSchema = z.object({\n id: idSchema,\n})\nexport type RotateApiKeyInput = z.infer<typeof rotateApiKeyInputSchema>\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/common.ts","../src/api-keys.ts"],"names":["z"],"mappings":";;;AAQO,IAAM,QAAA,GAAW,CAAA,CACrB,MAAA,EAAO,CACP,GAAA,CAAI,CAAC,CAAA,CACL,GAAA,CAAI,EAAE,CAAA,CACN,KAAA,CAAM,kBAAA,EAAoB,qBAAqB,CAAA;AAGlB,CAAA,CAC7B,MAAA,EAAO,CACP,KAAA,CAAM,qBAAA,EAAuB,oDAAoD,CAAA,CACjF,SAAA,CAAU,CAAC,CAAA,KAAM,CAAA,CAAE,aAAa;AAGJ,CAAA,CAC5B,MAAA,EAAO,CACP,KAAA,CAAM,uBAAuB,6DAA6D;AAGlE,CAAA,CAAE,MAAA,EAAO,CAAE,KAAA,EAAM,CAAE,IAAA,EAAK,CAAE,WAAA,EAAY,CAAE,GAAA,CAAI,GAAG;AAG5C,CAAA,CAC3B,MAAA,EAAO,CACP,GAAA,EAAI,CACJ,MAAA,CAAO,CAAC,CAAA,KAAM,CAAA,CAAE,UAAA,CAAW,UAAU,CAAA,EAAG;AAAA,EACvC,OAAA,EAAS;AACX,CAAC;AAG0B,CAAA,CAAE,MAAA,EAAO,CAAE,GAAA;AAOP,CAAA,CAC9B,MAAA,EAAO,CACP,MAAM,UAAA,EAAY,iDAAiD,CAAA,CACnE,MAAA,CAAO,CAAC,CAAA,KAAM,MAAA,CAAO,CAAC,CAAA,IAAK,IAAI,cAAc;AAGtB,CAAA,CAAE,MAAA,EAAO,CAAE,GAAA,EAAI,CAAE,GAAA,CAAI,CAAC,CAAA,CAAE,GAAA,CAAI,MAAA,CAAO,gBAAgB;AAGtE,IAAM,kBAAA,GAAqB,CAAA,CAC/B,MAAA,EAAO,CACP,QAAA,CAAS,EAAE,MAAA,EAAQ,IAAA,EAAM,OAAA,EAAS,+BAAA,EAAiC,CAAA;AAGrC,EAC9B,MAAA,EAAO,C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IAAI,EAAE,CAAA;AAAA,EAC9B,IAAA,EAAM,gBAAA;AAAA,EACN,IAAA,EAAM,UAAA;AAAA,EACN,MAAA,EAAQA,CAAAA,CAAE,KAAA,CAAM,iBAAiB,EAAE,QAAA;AACrC,CAAC;AAGM,IAAM,wBAAA,GAA2BA,EAAE,MAAA,CAAO;AAAA,EAC/C,MAAA,EAAQ,YAAA;AAAA;AAAA,EAER,MAAA,EAAQA,EAAE,MAAA;AACZ,CAAC;AAGM,IAAM,uBAAA,GAA0BA,EAAE,MAAA,CAAO;AAAA,EAC9C,EAAA,EAAI;AACN,CAAC","file":"api-keys.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 * 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"]}
|
package/dist/compliance.d.cts
CHANGED
|
@@ -30,28 +30,28 @@ declare const complianceLogSchema: z.ZodObject<{
|
|
|
30
30
|
}, "strip", z.ZodTypeAny, {
|
|
31
31
|
status: "clear" | "flagged" | "blocked" | "error";
|
|
32
32
|
id: string;
|
|
33
|
-
merchantId: string | null;
|
|
34
|
-
createdAt: string;
|
|
35
33
|
walletAddress: string;
|
|
36
34
|
provider: "trm" | "elliptic" | "disabled";
|
|
37
35
|
riskScore: number | null;
|
|
38
36
|
flags: string[];
|
|
39
37
|
context: "merchant_onboarding" | "payer_checkout" | "subscriber_signup" | "refund_recipient";
|
|
38
|
+
merchantId: string | null;
|
|
40
39
|
sessionId: string | null;
|
|
41
40
|
subscriptionId: string | null;
|
|
42
41
|
providerRequestId: string | null;
|
|
42
|
+
createdAt: string;
|
|
43
43
|
}, {
|
|
44
44
|
status: "clear" | "flagged" | "blocked" | "error";
|
|
45
45
|
id: string;
|
|
46
|
-
merchantId: string | null;
|
|
47
|
-
createdAt: string;
|
|
48
46
|
walletAddress: string;
|
|
49
47
|
provider: "trm" | "elliptic" | "disabled";
|
|
50
48
|
riskScore: number | null;
|
|
51
49
|
context: "merchant_onboarding" | "payer_checkout" | "subscriber_signup" | "refund_recipient";
|
|
50
|
+
merchantId: string | null;
|
|
52
51
|
sessionId: string | null;
|
|
53
52
|
subscriptionId: string | null;
|
|
54
53
|
providerRequestId: string | null;
|
|
54
|
+
createdAt: string;
|
|
55
55
|
flags?: string[] | undefined;
|
|
56
56
|
}>;
|
|
57
57
|
type ComplianceLog = z.infer<typeof complianceLogSchema>;
|
package/dist/compliance.d.ts
CHANGED
|
@@ -30,28 +30,28 @@ declare const complianceLogSchema: z.ZodObject<{
|
|
|
30
30
|
}, "strip", z.ZodTypeAny, {
|
|
31
31
|
status: "clear" | "flagged" | "blocked" | "error";
|
|
32
32
|
id: string;
|
|
33
|
-
merchantId: string | null;
|
|
34
|
-
createdAt: string;
|
|
35
33
|
walletAddress: string;
|
|
36
34
|
provider: "trm" | "elliptic" | "disabled";
|
|
37
35
|
riskScore: number | null;
|
|
38
36
|
flags: string[];
|
|
39
37
|
context: "merchant_onboarding" | "payer_checkout" | "subscriber_signup" | "refund_recipient";
|
|
38
|
+
merchantId: string | null;
|
|
40
39
|
sessionId: string | null;
|
|
41
40
|
subscriptionId: string | null;
|
|
42
41
|
providerRequestId: string | null;
|
|
42
|
+
createdAt: string;
|
|
43
43
|
}, {
|
|
44
44
|
status: "clear" | "flagged" | "blocked" | "error";
|
|
45
45
|
id: string;
|
|
46
|
-
merchantId: string | null;
|
|
47
|
-
createdAt: string;
|
|
48
46
|
walletAddress: string;
|
|
49
47
|
provider: "trm" | "elliptic" | "disabled";
|
|
50
48
|
riskScore: number | null;
|
|
51
49
|
context: "merchant_onboarding" | "payer_checkout" | "subscriber_signup" | "refund_recipient";
|
|
50
|
+
merchantId: string | null;
|
|
52
51
|
sessionId: string | null;
|
|
53
52
|
subscriptionId: string | null;
|
|
54
53
|
providerRequestId: string | null;
|
|
54
|
+
createdAt: string;
|
|
55
55
|
flags?: string[] | undefined;
|
|
56
56
|
}>;
|
|
57
57
|
type ComplianceLog = z.infer<typeof complianceLogSchema>;
|
package/dist/customers.d.cts
CHANGED
|
@@ -20,8 +20,8 @@ declare const customerSchema: z.ZodObject<{
|
|
|
20
20
|
lastSeenAt: z.ZodString;
|
|
21
21
|
}, "strip", z.ZodTypeAny, {
|
|
22
22
|
id: string;
|
|
23
|
-
merchantId: string;
|
|
24
23
|
walletAddress: string;
|
|
24
|
+
merchantId: string;
|
|
25
25
|
email: string | null;
|
|
26
26
|
externalRef: string | null;
|
|
27
27
|
displayName: string | null;
|
|
@@ -30,8 +30,8 @@ declare const customerSchema: z.ZodObject<{
|
|
|
30
30
|
lastSeenAt: string;
|
|
31
31
|
}, {
|
|
32
32
|
id: string;
|
|
33
|
-
merchantId: string;
|
|
34
33
|
walletAddress: string;
|
|
34
|
+
merchantId: string;
|
|
35
35
|
email: string | null;
|
|
36
36
|
externalRef: string | null;
|
|
37
37
|
displayName: string | null;
|
package/dist/customers.d.ts
CHANGED
|
@@ -20,8 +20,8 @@ declare const customerSchema: z.ZodObject<{
|
|
|
20
20
|
lastSeenAt: z.ZodString;
|
|
21
21
|
}, "strip", z.ZodTypeAny, {
|
|
22
22
|
id: string;
|
|
23
|
-
merchantId: string;
|
|
24
23
|
walletAddress: string;
|
|
24
|
+
merchantId: string;
|
|
25
25
|
email: string | null;
|
|
26
26
|
externalRef: string | null;
|
|
27
27
|
displayName: string | null;
|
|
@@ -30,8 +30,8 @@ declare const customerSchema: z.ZodObject<{
|
|
|
30
30
|
lastSeenAt: string;
|
|
31
31
|
}, {
|
|
32
32
|
id: string;
|
|
33
|
-
merchantId: string;
|
|
34
33
|
walletAddress: string;
|
|
34
|
+
merchantId: string;
|
|
35
35
|
email: string | null;
|
|
36
36
|
externalRef: string | null;
|
|
37
37
|
displayName: string | null;
|
package/dist/events.cjs
CHANGED
|
@@ -231,6 +231,11 @@ zod.z.object({
|
|
|
231
231
|
active: zod.z.boolean(),
|
|
232
232
|
subscriptionId: idSchema.nullable()
|
|
233
233
|
});
|
|
234
|
+
zod.z.object({
|
|
235
|
+
startAt: zod.z.string().regex(/^\d+$/),
|
|
236
|
+
trialDays: zod.z.number().int().min(0),
|
|
237
|
+
trialEndsAt: isoTimestampSchema.nullable()
|
|
238
|
+
});
|
|
234
239
|
zod.z.object({
|
|
235
240
|
planId: idSchema,
|
|
236
241
|
customer: zod.z.object({
|