@peable.to/contracts 0.4.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (322) hide show
  1. package/dist/cjs/common/address.js +81 -0
  2. package/dist/cjs/common/envelopes.js +101 -0
  3. package/dist/cjs/common/objects.js +85 -0
  4. package/dist/cjs/common/params.js +211 -0
  5. package/dist/cjs/common/primitives.js +39 -0
  6. package/dist/cjs/contributions.js +22 -0
  7. package/dist/cjs/index.js +40 -137
  8. package/dist/cjs/openapi/document.js +297 -0
  9. package/dist/cjs/openapi/index.js +7 -0
  10. package/dist/cjs/openapi/webhooks.js +17 -0
  11. package/dist/cjs/resources/billingEngine/billingPortal.js +237 -0
  12. package/dist/cjs/resources/billingEngine/creditNotes.js +189 -0
  13. package/dist/cjs/resources/billingEngine/customerBalanceTransactions.js +90 -0
  14. package/dist/cjs/resources/billingEngine/index.js +43 -0
  15. package/dist/cjs/resources/billingEngine/invoiceItems.js +155 -0
  16. package/dist/cjs/resources/billingEngine/invoices.js +509 -0
  17. package/dist/cjs/resources/billingEngine/params.js +43 -0
  18. package/dist/cjs/resources/billingEngine/public.js +326 -0
  19. package/dist/cjs/resources/billingEngine/subscriptions.js +476 -0
  20. package/dist/cjs/resources/catalog/billing.js +755 -0
  21. package/dist/cjs/resources/catalog/billingSettings.js +131 -0
  22. package/dist/cjs/resources/catalog/coupons.js +222 -0
  23. package/dist/cjs/resources/catalog/entitlements.js +257 -0
  24. package/dist/cjs/resources/catalog/index.js +58 -0
  25. package/dist/cjs/resources/catalog/meters.js +279 -0
  26. package/dist/cjs/resources/catalog/prices.js +423 -0
  27. package/dist/cjs/resources/catalog/products.js +228 -0
  28. package/dist/cjs/resources/catalog/promotionCodes.js +174 -0
  29. package/dist/cjs/resources/catalog/shared.js +75 -0
  30. package/dist/cjs/resources/catalog/testClocks.js +127 -0
  31. package/dist/cjs/resources/checkout/checkoutSessions.js +582 -0
  32. package/dist/cjs/resources/checkout/contributions.js +172 -0
  33. package/dist/cjs/resources/checkout/files.js +133 -0
  34. package/dist/cjs/resources/checkout/index.js +57 -0
  35. package/dist/cjs/resources/checkout/merchants.js +290 -0
  36. package/dist/cjs/resources/checkout/paymentLinks.js +330 -0
  37. package/dist/cjs/resources/checkout/paymentMethodConfigurations.js +262 -0
  38. package/dist/cjs/resources/checkout/shared.js +368 -0
  39. package/dist/cjs/resources/connect/account.js +332 -0
  40. package/dist/cjs/resources/connect/applicationFees.js +113 -0
  41. package/dist/cjs/resources/connect/balance.js +212 -0
  42. package/dist/cjs/resources/connect/connectedAccounts.js +260 -0
  43. package/dist/cjs/resources/connect/index.js +51 -0
  44. package/dist/cjs/resources/connect/onboarding.js +82 -0
  45. package/dist/cjs/resources/connect/payouts.js +196 -0
  46. package/dist/cjs/resources/connect/reporting.js +235 -0
  47. package/dist/cjs/resources/connect/requestLogs.js +110 -0
  48. package/dist/cjs/resources/connect/transfers.js +227 -0
  49. package/dist/cjs/resources/core/customers.js +194 -0
  50. package/dist/cjs/resources/core/index.js +23 -0
  51. package/dist/cjs/resources/core/paymentMethods.js +134 -0
  52. package/dist/cjs/resources/events/events.js +357 -0
  53. package/dist/cjs/resources/events/index.js +29 -0
  54. package/dist/cjs/resources/events/webhookDeliveries.js +93 -0
  55. package/dist/cjs/resources/events/webhookEndpoints.js +215 -0
  56. package/dist/cjs/resources/payments/charges.js +157 -0
  57. package/dist/cjs/resources/payments/disputes.js +204 -0
  58. package/dist/cjs/resources/payments/index.js +41 -0
  59. package/dist/cjs/resources/payments/paymentIntents.js +529 -0
  60. package/dist/cjs/resources/payments/refunds.js +245 -0
  61. package/dist/cjs/resources/payments/setupIntents.js +158 -0
  62. package/dist/cjs/resources/payments/social.js +182 -0
  63. package/dist/cjs/resources/payments/testHelpers.js +39 -0
  64. package/dist/cjs/resources/tax/assessments.js +217 -0
  65. package/dist/cjs/resources/tax/businessProfile.js +99 -0
  66. package/dist/cjs/resources/tax/calculations.js +176 -0
  67. package/dist/cjs/resources/tax/capabilities.js +42 -0
  68. package/dist/cjs/resources/tax/codes.js +37 -0
  69. package/dist/cjs/resources/tax/complianceActions.js +56 -0
  70. package/dist/cjs/resources/tax/deadlines.js +59 -0
  71. package/dist/cjs/resources/tax/documents.js +128 -0
  72. package/dist/cjs/resources/tax/index.js +80 -0
  73. package/dist/cjs/resources/tax/locationEvidence.js +131 -0
  74. package/dist/cjs/resources/tax/operatingLocations.js +98 -0
  75. package/dist/cjs/resources/tax/products.js +67 -0
  76. package/dist/cjs/resources/tax/registrationDeclarations.js +124 -0
  77. package/dist/cjs/resources/tax/registrations.js +82 -0
  78. package/dist/cjs/resources/tax/reports.js +92 -0
  79. package/dist/cjs/resources/tax/reviewItems.js +116 -0
  80. package/dist/cjs/resources/tax/ruleSet.js +68 -0
  81. package/dist/cjs/resources/tax/salesDestinations.js +94 -0
  82. package/dist/cjs/resources/tax/settings.js +104 -0
  83. package/dist/cjs/resources/tax/shared.js +62 -0
  84. package/dist/cjs/resources/tax/transactions.js +102 -0
  85. package/dist/cjs/route.js +22 -0
  86. package/dist/cjs/routes.js +31 -0
  87. package/dist/cjs/vocabulary/billingPortal.js +15 -0
  88. package/dist/cjs/vocabulary/catalog.js +110 -0
  89. package/dist/cjs/vocabulary/checkout.js +53 -0
  90. package/dist/cjs/vocabulary/connect.js +95 -0
  91. package/dist/cjs/vocabulary/dashboard.js +68 -0
  92. package/dist/cjs/vocabulary/errors.js +175 -0
  93. package/dist/cjs/vocabulary/events.js +176 -0
  94. package/dist/cjs/vocabulary/files.js +44 -0
  95. package/dist/cjs/vocabulary/identity.js +12 -0
  96. package/dist/cjs/vocabulary/index.js +39 -0
  97. package/dist/cjs/vocabulary/invoices.js +52 -0
  98. package/dist/cjs/vocabulary/lists.js +22 -0
  99. package/dist/cjs/vocabulary/merchants.js +23 -0
  100. package/dist/cjs/vocabulary/money.js +104 -0
  101. package/dist/cjs/vocabulary/paymentMethodConfigurations.js +36 -0
  102. package/dist/cjs/vocabulary/payments.js +195 -0
  103. package/dist/cjs/vocabulary/reporting.js +27 -0
  104. package/dist/cjs/vocabulary/subscriptions.js +60 -0
  105. package/dist/cjs/vocabulary/tax.js +237 -0
  106. package/dist/cjs/vocabulary/version.js +12 -0
  107. package/dist/esm/common/address.js +76 -0
  108. package/dist/esm/common/envelopes.js +95 -0
  109. package/dist/esm/common/objects.js +74 -0
  110. package/dist/esm/common/params.js +203 -0
  111. package/dist/esm/common/primitives.js +35 -0
  112. package/dist/esm/contributions.js +5 -0
  113. package/dist/esm/index.js +26 -134
  114. package/dist/esm/openapi/document.js +294 -0
  115. package/dist/esm/openapi/index.js +2 -0
  116. package/dist/esm/openapi/webhooks.js +14 -0
  117. package/dist/esm/resources/billingEngine/billingPortal.js +234 -0
  118. package/dist/esm/resources/billingEngine/creditNotes.js +186 -0
  119. package/dist/esm/resources/billingEngine/customerBalanceTransactions.js +87 -0
  120. package/dist/esm/resources/billingEngine/index.js +26 -0
  121. package/dist/esm/resources/billingEngine/invoiceItems.js +152 -0
  122. package/dist/esm/resources/billingEngine/invoices.js +506 -0
  123. package/dist/esm/resources/billingEngine/params.js +39 -0
  124. package/dist/esm/resources/billingEngine/public.js +323 -0
  125. package/dist/esm/resources/billingEngine/subscriptions.js +473 -0
  126. package/dist/esm/resources/catalog/billing.js +752 -0
  127. package/dist/esm/resources/catalog/billingSettings.js +128 -0
  128. package/dist/esm/resources/catalog/coupons.js +219 -0
  129. package/dist/esm/resources/catalog/entitlements.js +254 -0
  130. package/dist/esm/resources/catalog/index.js +38 -0
  131. package/dist/esm/resources/catalog/meters.js +276 -0
  132. package/dist/esm/resources/catalog/prices.js +419 -0
  133. package/dist/esm/resources/catalog/products.js +225 -0
  134. package/dist/esm/resources/catalog/promotionCodes.js +171 -0
  135. package/dist/esm/resources/catalog/shared.js +67 -0
  136. package/dist/esm/resources/catalog/testClocks.js +124 -0
  137. package/dist/esm/resources/checkout/checkoutSessions.js +579 -0
  138. package/dist/esm/resources/checkout/contributions.js +167 -0
  139. package/dist/esm/resources/checkout/files.js +130 -0
  140. package/dist/esm/resources/checkout/index.js +25 -0
  141. package/dist/esm/resources/checkout/merchants.js +287 -0
  142. package/dist/esm/resources/checkout/paymentLinks.js +327 -0
  143. package/dist/esm/resources/checkout/paymentMethodConfigurations.js +259 -0
  144. package/dist/esm/resources/checkout/shared.js +363 -0
  145. package/dist/esm/resources/connect/account.js +329 -0
  146. package/dist/esm/resources/connect/applicationFees.js +110 -0
  147. package/dist/esm/resources/connect/balance.js +209 -0
  148. package/dist/esm/resources/connect/connectedAccounts.js +257 -0
  149. package/dist/esm/resources/connect/index.js +34 -0
  150. package/dist/esm/resources/connect/onboarding.js +79 -0
  151. package/dist/esm/resources/connect/payouts.js +193 -0
  152. package/dist/esm/resources/connect/reporting.js +232 -0
  153. package/dist/esm/resources/connect/requestLogs.js +107 -0
  154. package/dist/esm/resources/connect/transfers.js +224 -0
  155. package/dist/esm/resources/core/customers.js +191 -0
  156. package/dist/esm/resources/core/index.js +6 -0
  157. package/dist/esm/resources/core/paymentMethods.js +131 -0
  158. package/dist/esm/resources/events/events.js +353 -0
  159. package/dist/esm/resources/events/index.js +12 -0
  160. package/dist/esm/resources/events/webhookDeliveries.js +90 -0
  161. package/dist/esm/resources/events/webhookEndpoints.js +212 -0
  162. package/dist/esm/resources/payments/charges.js +154 -0
  163. package/dist/esm/resources/payments/disputes.js +201 -0
  164. package/dist/esm/resources/payments/index.js +24 -0
  165. package/dist/esm/resources/payments/paymentIntents.js +526 -0
  166. package/dist/esm/resources/payments/refunds.js +242 -0
  167. package/dist/esm/resources/payments/setupIntents.js +155 -0
  168. package/dist/esm/resources/payments/social.js +179 -0
  169. package/dist/esm/resources/payments/testHelpers.js +36 -0
  170. package/dist/esm/resources/tax/assessments.js +214 -0
  171. package/dist/esm/resources/tax/businessProfile.js +96 -0
  172. package/dist/esm/resources/tax/calculations.js +173 -0
  173. package/dist/esm/resources/tax/capabilities.js +39 -0
  174. package/dist/esm/resources/tax/codes.js +34 -0
  175. package/dist/esm/resources/tax/complianceActions.js +53 -0
  176. package/dist/esm/resources/tax/deadlines.js +56 -0
  177. package/dist/esm/resources/tax/documents.js +125 -0
  178. package/dist/esm/resources/tax/index.js +63 -0
  179. package/dist/esm/resources/tax/locationEvidence.js +128 -0
  180. package/dist/esm/resources/tax/operatingLocations.js +95 -0
  181. package/dist/esm/resources/tax/products.js +64 -0
  182. package/dist/esm/resources/tax/registrationDeclarations.js +121 -0
  183. package/dist/esm/resources/tax/registrations.js +79 -0
  184. package/dist/esm/resources/tax/reports.js +89 -0
  185. package/dist/esm/resources/tax/reviewItems.js +113 -0
  186. package/dist/esm/resources/tax/ruleSet.js +65 -0
  187. package/dist/esm/resources/tax/salesDestinations.js +91 -0
  188. package/dist/esm/resources/tax/settings.js +101 -0
  189. package/dist/esm/resources/tax/shared.js +58 -0
  190. package/dist/esm/resources/tax/transactions.js +99 -0
  191. package/dist/esm/route.js +16 -0
  192. package/dist/esm/routes.js +27 -0
  193. package/dist/esm/vocabulary/billingPortal.js +12 -0
  194. package/dist/esm/vocabulary/catalog.js +106 -0
  195. package/dist/esm/vocabulary/checkout.js +50 -0
  196. package/dist/esm/vocabulary/connect.js +92 -0
  197. package/dist/esm/vocabulary/dashboard.js +64 -0
  198. package/dist/esm/vocabulary/errors.js +170 -0
  199. package/dist/esm/vocabulary/events.js +173 -0
  200. package/dist/esm/vocabulary/files.js +41 -0
  201. package/dist/esm/vocabulary/identity.js +9 -0
  202. package/dist/esm/vocabulary/index.js +23 -0
  203. package/dist/esm/vocabulary/invoices.js +49 -0
  204. package/dist/esm/vocabulary/lists.js +19 -0
  205. package/dist/esm/vocabulary/merchants.js +20 -0
  206. package/dist/esm/vocabulary/money.js +98 -0
  207. package/dist/esm/vocabulary/paymentMethodConfigurations.js +33 -0
  208. package/dist/esm/vocabulary/payments.js +192 -0
  209. package/dist/esm/vocabulary/reporting.js +24 -0
  210. package/dist/esm/vocabulary/subscriptions.js +57 -0
  211. package/dist/esm/vocabulary/tax.js +233 -0
  212. package/dist/esm/vocabulary/version.js +9 -0
  213. package/dist/types/common/address.d.ts +62 -0
  214. package/dist/types/common/envelopes.d.ts +88 -0
  215. package/dist/types/common/objects.d.ts +107 -0
  216. package/dist/types/common/params.d.ts +156 -0
  217. package/dist/types/common/primitives.d.ts +56 -0
  218. package/dist/types/contributions.d.ts +1 -0
  219. package/dist/types/index.d.ts +16 -171
  220. package/dist/types/openapi/document.d.ts +16 -0
  221. package/dist/types/openapi/index.d.ts +2 -0
  222. package/dist/types/openapi/webhooks.d.ts +15 -0
  223. package/dist/types/resources/billingEngine/billingPortal.d.ts +742 -0
  224. package/dist/types/resources/billingEngine/creditNotes.d.ts +655 -0
  225. package/dist/types/resources/billingEngine/customerBalanceTransactions.d.ts +282 -0
  226. package/dist/types/resources/billingEngine/index.d.ts +6071 -0
  227. package/dist/types/resources/billingEngine/invoiceItems.d.ts +502 -0
  228. package/dist/types/resources/billingEngine/invoices.d.ts +2547 -0
  229. package/dist/types/resources/billingEngine/params.d.ts +51 -0
  230. package/dist/types/resources/billingEngine/public.d.ts +1860 -0
  231. package/dist/types/resources/billingEngine/subscriptions.d.ts +1519 -0
  232. package/dist/types/resources/catalog/billing.d.ts +1723 -0
  233. package/dist/types/resources/catalog/billingSettings.d.ts +160 -0
  234. package/dist/types/resources/catalog/coupons.d.ts +403 -0
  235. package/dist/types/resources/catalog/entitlements.d.ts +422 -0
  236. package/dist/types/resources/catalog/index.d.ts +3155 -0
  237. package/dist/types/resources/catalog/meters.d.ts +474 -0
  238. package/dist/types/resources/catalog/prices.d.ts +1091 -0
  239. package/dist/types/resources/catalog/products.d.ts +430 -0
  240. package/dist/types/resources/catalog/promotionCodes.d.ts +369 -0
  241. package/dist/types/resources/catalog/shared.d.ts +34 -0
  242. package/dist/types/resources/catalog/testClocks.d.ts +220 -0
  243. package/dist/types/resources/checkout/checkoutSessions.d.ts +3207 -0
  244. package/dist/types/resources/checkout/contributions.d.ts +375 -0
  245. package/dist/types/resources/checkout/files.d.ts +280 -0
  246. package/dist/types/resources/checkout/index.d.ts +5678 -0
  247. package/dist/types/resources/checkout/merchants.d.ts +395 -0
  248. package/dist/types/resources/checkout/paymentLinks.d.ts +1728 -0
  249. package/dist/types/resources/checkout/paymentMethodConfigurations.d.ts +2104 -0
  250. package/dist/types/resources/checkout/shared.d.ts +419 -0
  251. package/dist/types/resources/connect/account.d.ts +483 -0
  252. package/dist/types/resources/connect/applicationFees.d.ts +198 -0
  253. package/dist/types/resources/connect/balance.d.ts +399 -0
  254. package/dist/types/resources/connect/connectedAccounts.d.ts +494 -0
  255. package/dist/types/resources/connect/index.d.ts +2094 -0
  256. package/dist/types/resources/connect/onboarding.d.ts +95 -0
  257. package/dist/types/resources/connect/payouts.d.ts +527 -0
  258. package/dist/types/resources/connect/reporting.d.ts +506 -0
  259. package/dist/types/resources/connect/requestLogs.d.ts +236 -0
  260. package/dist/types/resources/connect/transfers.d.ts +436 -0
  261. package/dist/types/resources/core/customers.d.ts +619 -0
  262. package/dist/types/resources/core/index.d.ts +679 -0
  263. package/dist/types/resources/core/paymentMethods.d.ts +336 -0
  264. package/dist/types/resources/events/events.d.ts +731 -0
  265. package/dist/types/resources/events/index.d.ts +1727 -0
  266. package/dist/types/resources/events/webhookDeliveries.d.ts +436 -0
  267. package/dist/types/resources/events/webhookEndpoints.d.ts +1502 -0
  268. package/dist/types/resources/payments/charges.d.ts +390 -0
  269. package/dist/types/resources/payments/disputes.d.ts +822 -0
  270. package/dist/types/resources/payments/index.d.ts +3517 -0
  271. package/dist/types/resources/payments/paymentIntents.d.ts +2080 -0
  272. package/dist/types/resources/payments/refunds.d.ts +684 -0
  273. package/dist/types/resources/payments/setupIntents.d.ts +391 -0
  274. package/dist/types/resources/payments/social.d.ts +266 -0
  275. package/dist/types/resources/payments/testHelpers.d.ts +178 -0
  276. package/dist/types/resources/tax/assessments.d.ts +787 -0
  277. package/dist/types/resources/tax/businessProfile.d.ts +134 -0
  278. package/dist/types/resources/tax/calculations.d.ts +261 -0
  279. package/dist/types/resources/tax/capabilities.d.ts +81 -0
  280. package/dist/types/resources/tax/codes.d.ts +29 -0
  281. package/dist/types/resources/tax/complianceActions.d.ts +97 -0
  282. package/dist/types/resources/tax/deadlines.d.ts +133 -0
  283. package/dist/types/resources/tax/documents.d.ts +257 -0
  284. package/dist/types/resources/tax/index.d.ts +1946 -0
  285. package/dist/types/resources/tax/locationEvidence.d.ts +246 -0
  286. package/dist/types/resources/tax/operatingLocations.d.ts +170 -0
  287. package/dist/types/resources/tax/products.d.ts +68 -0
  288. package/dist/types/resources/tax/registrationDeclarations.d.ts +270 -0
  289. package/dist/types/resources/tax/registrations.d.ts +103 -0
  290. package/dist/types/resources/tax/reports.d.ts +129 -0
  291. package/dist/types/resources/tax/reviewItems.d.ts +226 -0
  292. package/dist/types/resources/tax/ruleSet.d.ts +219 -0
  293. package/dist/types/resources/tax/salesDestinations.d.ts +158 -0
  294. package/dist/types/resources/tax/settings.d.ts +122 -0
  295. package/dist/types/resources/tax/shared.d.ts +43 -0
  296. package/dist/types/resources/tax/transactions.d.ts +404 -0
  297. package/dist/types/route.d.ts +86 -0
  298. package/dist/types/routes.d.ts +23 -0
  299. package/dist/types/vocabulary/billingPortal.d.ts +15 -0
  300. package/dist/types/vocabulary/catalog.d.ts +97 -0
  301. package/dist/types/vocabulary/checkout.d.ts +49 -0
  302. package/dist/types/vocabulary/connect.d.ts +62 -0
  303. package/dist/types/vocabulary/dashboard.d.ts +44 -0
  304. package/dist/types/vocabulary/errors.d.ts +146 -0
  305. package/dist/types/vocabulary/events.d.ts +171 -0
  306. package/dist/types/vocabulary/files.d.ts +30 -0
  307. package/dist/types/vocabulary/identity.d.ts +9 -0
  308. package/dist/types/vocabulary/index.d.ts +19 -0
  309. package/dist/types/vocabulary/invoices.d.ts +39 -0
  310. package/dist/types/vocabulary/lists.d.ts +9 -0
  311. package/dist/types/vocabulary/merchants.d.ts +9 -0
  312. package/dist/types/vocabulary/money.d.ts +59 -0
  313. package/dist/types/vocabulary/paymentMethodConfigurations.d.ts +22 -0
  314. package/dist/types/vocabulary/payments.d.ts +117 -0
  315. package/dist/types/vocabulary/reporting.d.ts +18 -0
  316. package/dist/types/vocabulary/subscriptions.d.ts +45 -0
  317. package/dist/types/vocabulary/tax.d.ts +163 -0
  318. package/dist/types/vocabulary/version.d.ts +10 -0
  319. package/package.json +51 -11
  320. package/dist/cjs/openapi.js +0 -165
  321. package/dist/esm/openapi.js +0 -161
  322. package/dist/types/openapi.d.ts +0 -148
@@ -0,0 +1,24 @@
1
+ // Reporting and request-log vocabulary: the report types Peable produces, a
2
+ // run's lifecycle, and the methods and status classes a request log is
3
+ // filtered by. Zod-free, like every vocabulary module.
4
+ /**
5
+ * Every report Peable produces, by Stripe's versioned id: the trailing `.1` is
6
+ * the column layout's version, so a layout can change under a new id without
7
+ * changing a report a merchant already parses. The layouts themselves are
8
+ * `REPORT_TYPE_LAYOUTS` in `@peable.to/shared-types/reporting`.
9
+ */
10
+ export const REPORT_TYPE_IDS = [
11
+ 'payments.itemized.1',
12
+ 'balance.summary.1',
13
+ 'balance_transactions.itemized.1',
14
+ 'payouts.itemized.1',
15
+ 'refunds.itemized.1',
16
+ 'disputes.itemized.1',
17
+ ];
18
+ export const REPORT_RUN_STATUSES = ['pending', 'succeeded', 'failed'];
19
+ /** The HTTP methods a request log records. */
20
+ export const REQUEST_LOG_METHODS = ['GET', 'POST', 'DELETE', 'PATCH', 'PUT'];
21
+ /** A request-log `status` filter's class form (`4xx` is 400–499). */
22
+ export const REQUEST_LOG_STATUS_CLASSES = ['2xx', '3xx', '4xx', '5xx'];
23
+ /** How long a request log is kept (and served). */
24
+ export const REQUEST_LOG_RETENTION_DAYS = 30;
@@ -0,0 +1,57 @@
1
+ // Subscriptions (ADR 0018 §1) — the closed value sets their schemas are built
2
+ // from. Zod-free: `@peable.to/shared-types` re-exports them at runtime.
3
+ /**
4
+ * Where a subscription stands — Stripe's eight.
5
+ *
6
+ * - `incomplete` — the first invoice is not paid yet; expires to
7
+ * `incomplete_expired` when nobody pays it in time.
8
+ * - `incomplete_expired` — terminal: the first invoice was never paid.
9
+ * - `trialing` — in a trial; nothing is charged until it ends.
10
+ * - `active` — in good standing.
11
+ * - `past_due` — a renewal invoice failed; dunning is retrying it.
12
+ * - `unpaid` — dunning gave up and the merchant's final action
13
+ * is `unpaid`: invoices are still created, access
14
+ * should be withdrawn.
15
+ * - `canceled` — terminal.
16
+ * - `paused` — a trial ended with no payment method and the
17
+ * trial's end behaviour was `pause`; resumed with
18
+ * `POST /v1/subscriptions/:id/resume`.
19
+ */
20
+ export const SUBSCRIPTION_STATUSES = [
21
+ 'incomplete',
22
+ 'incomplete_expired',
23
+ 'trialing',
24
+ 'active',
25
+ 'past_due',
26
+ 'unpaid',
27
+ 'canceled',
28
+ 'paused',
29
+ ];
30
+ /** `status=` on a subscription list: a status, `all` (including canceled), or `ended`. */
31
+ export const SUBSCRIPTION_LIST_STATUSES = [...SUBSCRIPTION_STATUSES, 'all', 'ended'];
32
+ /** How the subscription's invoices are collected. FairCoin is always `send_invoice`. */
33
+ export const COLLECTION_METHODS = ['charge_automatically', 'send_invoice'];
34
+ /** How a change mid-period is billed. */
35
+ export const PRORATION_BEHAVIORS = ['create_prorations', 'none', 'always_invoice'];
36
+ /** The proration behaviours a subscription CREATE accepts: there is nothing to invoice at once yet. */
37
+ export const CREATE_PRORATION_BEHAVIORS = [
38
+ 'create_prorations',
39
+ 'none',
40
+ ];
41
+ /** What a create does when the first invoice cannot be paid at once. */
42
+ export const PAYMENT_BEHAVIORS = [
43
+ 'allow_incomplete',
44
+ 'default_incomplete',
45
+ 'error_if_incomplete',
46
+ ];
47
+ /** What happens to the invoices of a subscription whose collection is paused. */
48
+ export const PAUSE_COLLECTION_BEHAVIORS = ['keep_as_draft', 'mark_uncollectible', 'void'];
49
+ /** What a trial ending with no payment method does (`trial_settings.end_behavior`). */
50
+ export const TRIAL_END_BEHAVIORS = ['cancel', 'create_invoice', 'pause'];
51
+ /** Why a subscription was cancelled. */
52
+ export const SUBSCRIPTION_CANCELLATION_REASONS = [
53
+ 'cancellation_requested',
54
+ 'payment_failed',
55
+ ];
56
+ /** `billing_cycle_anchor` on a resume: a new period now (the default), or the anchor kept. */
57
+ export const RESUME_BILLING_CYCLE_ANCHORS = ['now', 'unchanged'];
@@ -0,0 +1,233 @@
1
+ // Peable Tax vocabulary (ADR 0011, ADR 0020): the closed value sets the tax
2
+ // contracts are built from, and the database mirrors as CHECKs. Zod-free, so
3
+ // Orbit and the shared types read them at runtime without constructing a schema.
4
+ // ── Collection (ADR 0011) ────────────────────────────────────────────────────
5
+ /**
6
+ * How a registration lets the seller collect. `standard`/`simplified` cover one
7
+ * country; the EU One-Stop-Shop schemes cover every EU member state from one
8
+ * identification state; the US is per state; Canadian PST/QST is per province.
9
+ */
10
+ export const TAX_REGISTRATION_SCHEMES = [
11
+ 'standard',
12
+ 'simplified',
13
+ 'eu_oss_union',
14
+ 'eu_oss_non_union',
15
+ 'us_state_sales_tax',
16
+ 'ca_provincial',
17
+ ];
18
+ /**
19
+ * Location evidence a jurisdiction accepts. There is deliberately no language,
20
+ * currency, locale or timezone: none of them is evidence of where a customer
21
+ * lives, and Peable cannot be told otherwise.
22
+ */
23
+ export const TAX_LOCATION_EVIDENCE_TYPES = [
24
+ 'billing_address',
25
+ 'ip_address',
26
+ 'payment_method_country',
27
+ 'bank_country',
28
+ 'sim_country',
29
+ 'landline_country',
30
+ ];
31
+ /** Whether a line's amount includes its tax (`inclusive`) or tax is added on top. */
32
+ export const TAX_BEHAVIORS = ['inclusive', 'exclusive'];
33
+ /** `active` once the owner approved; any edit returns the settings to `draft`. */
34
+ export const TAX_SETTINGS_STATUSES = ['draft', 'active'];
35
+ /**
36
+ * Which provider account calculates for a merchant. `platform`: Peable's own
37
+ * provider account, available only to official Oxy applications, whose seller
38
+ * is the platform's legal entity. `none`: no provider; sales in a registered
39
+ * jurisdiction cannot be calculated and fail closed.
40
+ */
41
+ export const TAX_CALCULATION_ACCOUNTS = ['platform', 'none'];
42
+ /** `pending_approval` until the owner approves; `scheduled` before `active_from`. */
43
+ export const TAX_REGISTRATION_STATUSES = [
44
+ 'pending_approval',
45
+ 'scheduled',
46
+ 'active',
47
+ 'expired',
48
+ ];
49
+ /** Only `sufficient` evidence can be calculated against. */
50
+ export const TAX_EVIDENCE_STATUSES = ['sufficient', 'insufficient', 'conflicting'];
51
+ /**
52
+ * Why a calculation's tax is what it is: `collect` (a registration covers the
53
+ * customer and the provider calculated), `not_registered` (no registration
54
+ * covers them: zero tax, recorded as such), `nontaxable` (every line used the
55
+ * nontaxable code).
56
+ */
57
+ export const TAX_COLLECTIONS = ['collect', 'not_registered', 'nontaxable'];
58
+ /** A sale, or a refund (or credit note) of one. */
59
+ export const TAX_TRANSACTION_TYPES = ['transaction', 'reversal'];
60
+ /**
61
+ * The product tax codes Peable accepts, starting with digital services and
62
+ * SaaS — what every Oxy application sells. Ids are Stripe Tax's tax codes, so a
63
+ * code means the same thing to Peable and to the provider calculating it.
64
+ * Adding a category is adding a row here; classifying a product is the seller's
65
+ * decision.
66
+ */
67
+ export const TAX_CODES = Object.freeze([
68
+ {
69
+ id: 'txcd_00000000',
70
+ name: 'Nontaxable',
71
+ description: 'A product that is not subject to tax anywhere. No tax is calculated.',
72
+ },
73
+ {
74
+ id: 'txcd_10000000',
75
+ name: 'General - Electronically Supplied Services',
76
+ description: 'A service delivered electronically over the internet with minimal human involvement.',
77
+ },
78
+ {
79
+ id: 'txcd_10103000',
80
+ name: 'Software as a service (SaaS) - personal use',
81
+ description: 'Hosted software accessed online, sold to consumers for personal use.',
82
+ },
83
+ {
84
+ id: 'txcd_10103001',
85
+ name: 'Software as a service (SaaS) - business use',
86
+ description: 'Hosted software accessed online, sold to businesses for business use.',
87
+ },
88
+ {
89
+ id: 'txcd_10202000',
90
+ name: 'Downloadable Software - personal use',
91
+ description: 'Software downloaded to the customer’s device, for personal use.',
92
+ },
93
+ {
94
+ id: 'txcd_10202003',
95
+ name: 'Downloadable Software - business use',
96
+ description: 'Software downloaded to the customer’s device, for business use.',
97
+ },
98
+ {
99
+ id: 'txcd_10701100',
100
+ name: 'Website Hosting',
101
+ description: 'Hosting of a website or web application on the seller’s servers.',
102
+ },
103
+ ]);
104
+ /** The code of a product that is taxed nowhere. */
105
+ export const NONTAXABLE_TAX_CODE = 'txcd_00000000';
106
+ /** The code a merchant's settings start with: electronically supplied services. */
107
+ export const DEFAULT_TAX_CODE = 'txcd_10000000';
108
+ const KNOWN_TAX_CODES = new Set(TAX_CODES.map((code) => code.id));
109
+ /** Whether `id` is one of {@link TAX_CODES}. */
110
+ export function isKnownTaxCode(id) {
111
+ return KNOWN_TAX_CODES.has(id);
112
+ }
113
+ // ── Business compliance (ADR 0020) ───────────────────────────────────────────
114
+ /** `unknown` is an answer, not a gap: the owner says they do not know yet. */
115
+ export const TAX_LEGAL_ENTITY_TYPES = [
116
+ 'corporation',
117
+ 'limited_liability_company',
118
+ 'partnership',
119
+ 'sole_proprietorship',
120
+ 'nonprofit',
121
+ 'public_body',
122
+ 'other',
123
+ 'unknown',
124
+ ];
125
+ export const TAX_CUSTOMER_TYPES = ['consumers', 'businesses', 'both', 'unknown'];
126
+ export const TAX_SUPPLY_TYPES = [
127
+ 'digital_services',
128
+ 'software_as_a_service',
129
+ 'physical_goods',
130
+ 'professional_services',
131
+ 'other',
132
+ ];
133
+ /**
134
+ * Where the business ACTUALLY operates. `head_office` and `fixed_establishment`
135
+ * are the owner's statement of establishment (the EU rule reads them); any
136
+ * location in a US state is physical presence there.
137
+ */
138
+ export const TAX_OPERATING_LOCATION_KINDS = [
139
+ 'head_office',
140
+ 'fixed_establishment',
141
+ 'office',
142
+ 'warehouse',
143
+ 'employees',
144
+ 'inventory',
145
+ 'other',
146
+ ];
147
+ /**
148
+ * Where the business stands with a tax authority, IN ITS OWN WORDS.
149
+ *
150
+ * - `unknown` — the owner does not know; an assessment escalates it.
151
+ * - `not_registered` — the owner says there is no registration.
152
+ * - `application_pending` — an application was made outside Peable and the
153
+ * authority has not answered: an ambiguous outcome, never treated as
154
+ * registered.
155
+ * - `registered` — the owner says the authority registered the business, from
156
+ * `effective_from`.
157
+ * - `rejected` — the authority refused the application.
158
+ * - `ended` — the registration ended at `effective_to`.
159
+ */
160
+ export const TAX_REGISTRATION_DECLARATION_STATUSES = [
161
+ 'unknown',
162
+ 'not_registered',
163
+ 'application_pending',
164
+ 'registered',
165
+ 'rejected',
166
+ 'ended',
167
+ ];
168
+ export const TAX_FILING_FREQUENCIES = ['monthly', 'quarterly', 'annual', 'unknown'];
169
+ export const TAX_DOCUMENT_KINDS = [
170
+ 'registration_certificate',
171
+ 'authority_correspondence',
172
+ 'incorporation_record',
173
+ 'filing_confirmation',
174
+ 'payment_receipt',
175
+ 'other',
176
+ ];
177
+ /** `provided`: an available document is attached; `unavailable`: only removed ones are. */
178
+ export const TAX_DOCUMENT_CHECKLIST_STATUSES = ['provided', 'missing', 'unavailable'];
179
+ /** The tax a jurisdiction rule is about. */
180
+ export const TAX_TYPES = ['vat', 'sales_tax'];
181
+ /** The window a rule's threshold is measured over. */
182
+ export const TAX_THRESHOLD_PERIODS = [
183
+ 'current_or_previous_calendar_year',
184
+ 'preceding_twelve_calendar_months',
185
+ ];
186
+ /** Whether a tax professional has signed a rule off. */
187
+ export const TAX_RULE_REVIEW_STATUSES = ['unreviewed', 'reviewed'];
188
+ /**
189
+ * What an assessment found for one jurisdiction.
190
+ *
191
+ * - `registration_declared` — the owner declares a registration in force.
192
+ * - `likely_required` — the rule indicates an obligation; a person decides.
193
+ * - `approaching_threshold` — at or above 80% of the threshold.
194
+ * - `not_indicated` — nothing in the recorded facts indicates one.
195
+ * - `uncertain` — the facts are missing or contradictory; escalated.
196
+ * - `unsupported` — sales exist where no supported rule applies.
197
+ */
198
+ export const TAX_OBLIGATION_OUTCOMES = [
199
+ 'registration_declared',
200
+ 'likely_required',
201
+ 'approaching_threshold',
202
+ 'not_indicated',
203
+ 'uncertain',
204
+ 'unsupported',
205
+ ];
206
+ export const TAX_REVIEW_ITEM_STATUSES = ['open', 'resolved', 'dismissed'];
207
+ export const TAX_REVIEW_SEVERITIES = ['action_required', 'review'];
208
+ /** What the owner decided. None of them activates collection. */
209
+ export const TAX_REVIEW_DECISIONS = [
210
+ 'will_register',
211
+ 'registered_outside_peable',
212
+ 'not_required',
213
+ 'accepted_risk',
214
+ 'facts_corrected',
215
+ 'dismissed',
216
+ ];
217
+ /** Who recorded a compliance change: the owner, a service credential, or Peable itself. */
218
+ export const TAX_ACTOR_TYPES = ['user', 'service', 'system'];
219
+ export const TAX_DEADLINE_KINDS = ['return', 'payment', 'registration'];
220
+ export const TAX_DEADLINE_STATUSES = ['upcoming', 'due_soon', 'passed'];
221
+ export const TAX_COMPLIANCE_CAPABILITY_STATUSES = [
222
+ 'available',
223
+ 'limited',
224
+ 'not_available',
225
+ 'out_of_scope',
226
+ ];
227
+ /** VAT/sales tax, corporate income tax and annual company filings are different obligations. */
228
+ export const TAX_COMPLIANCE_CAPABILITY_CATEGORIES = [
229
+ 'vat_sales_tax',
230
+ 'corporate_income_tax',
231
+ 'annual_company_filings',
232
+ 'workflow',
233
+ ];
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The date of the one wire (ADR 0014 D2): echoed as `Peable-Version` on every
3
+ * response, the `api_version` every event is stored under, and the only value
4
+ * a caller may send in `Peable-Version`. One constant, so the header, the
5
+ * stored events and the SDK's `apiVersion` cannot name two different wires.
6
+ */
7
+ export const PEABLE_API_VERSION = '2026-11-03';
8
+ /** Every wire date the gateway serves. Dated versions side by side are a later decision (ADR 0014 D2). */
9
+ export const PEABLE_API_VERSIONS = [PEABLE_API_VERSION];
@@ -0,0 +1,62 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Stripe's address and shipping shapes — as returned (every field present,
4
+ * `null` when not given) and as a request carries them (every field optional).
5
+ * Shared by every object that holds one: intents, customers, payment methods,
6
+ * checkout sessions.
7
+ */
8
+ export declare const addressSchema: z.ZodObject<{
9
+ line1: z.ZodNullable<z.ZodString>;
10
+ line2: z.ZodNullable<z.ZodString>;
11
+ city: z.ZodNullable<z.ZodString>;
12
+ state: z.ZodNullable<z.ZodString>;
13
+ postal_code: z.ZodNullable<z.ZodString>;
14
+ country: z.ZodNullable<z.ZodString>;
15
+ }, z.core.$strict>;
16
+ export type Address = z.output<typeof addressSchema>;
17
+ export declare const shippingSchema: z.ZodObject<{
18
+ name: z.ZodString;
19
+ phone: z.ZodNullable<z.ZodString>;
20
+ address: z.ZodObject<{
21
+ line1: z.ZodNullable<z.ZodString>;
22
+ line2: z.ZodNullable<z.ZodString>;
23
+ city: z.ZodNullable<z.ZodString>;
24
+ state: z.ZodNullable<z.ZodString>;
25
+ postal_code: z.ZodNullable<z.ZodString>;
26
+ country: z.ZodNullable<z.ZodString>;
27
+ }, z.core.$strict>;
28
+ carrier: z.ZodNullable<z.ZodString>;
29
+ tracking_number: z.ZodNullable<z.ZodString>;
30
+ }, z.core.$strict>;
31
+ export type Shipping = z.output<typeof shippingSchema>;
32
+ /** An address as a request carries it: every field optional. */
33
+ export declare const addressParams: z.ZodObject<{
34
+ line1: z.ZodOptional<z.ZodString>;
35
+ line2: z.ZodOptional<z.ZodString>;
36
+ city: z.ZodOptional<z.ZodString>;
37
+ state: z.ZodOptional<z.ZodString>;
38
+ postal_code: z.ZodOptional<z.ZodString>;
39
+ country: z.ZodOptional<z.ZodString>;
40
+ }, z.core.$strict>;
41
+ export type AddressParams = z.input<typeof addressParams>;
42
+ /** Shipping as a request carries it: only `name` and `address` are required. */
43
+ export declare const shippingParams: z.ZodObject<{
44
+ name: z.ZodString;
45
+ phone: z.ZodOptional<z.ZodString>;
46
+ address: z.ZodObject<{
47
+ line1: z.ZodOptional<z.ZodString>;
48
+ line2: z.ZodOptional<z.ZodString>;
49
+ city: z.ZodOptional<z.ZodString>;
50
+ state: z.ZodOptional<z.ZodString>;
51
+ postal_code: z.ZodOptional<z.ZodString>;
52
+ country: z.ZodOptional<z.ZodString>;
53
+ }, z.core.$strict>;
54
+ carrier: z.ZodOptional<z.ZodString>;
55
+ tracking_number: z.ZodOptional<z.ZodString>;
56
+ }, z.core.$strict>;
57
+ export type ShippingParams = z.input<typeof shippingParams>;
58
+ export declare const emailParam: z.ZodEmail;
59
+ /** A request address in the stored (and wire) shape: every field present. */
60
+ export declare function toAddress(input: z.output<typeof addressParams>): Address;
61
+ /** Request shipping in the stored (and wire) shape. */
62
+ export declare function toShipping(input: z.output<typeof shippingParams>): Shipping;
@@ -0,0 +1,88 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * The envelopes every resource shares (ADR 0014 D1): the list, the search
4
+ * result, the deleted tombstone and the error.
5
+ */
6
+ /**
7
+ * One page of a list, newest first. `url` is the path that was listed, so a
8
+ * page carries enough to fetch the next one without the caller remembering
9
+ * where it came from.
10
+ */
11
+ export declare function listOf<T extends z.ZodType>(item: T): z.ZodObject<{
12
+ object: z.ZodLiteral<"list">;
13
+ data: z.ZodArray<T>;
14
+ has_more: z.ZodBoolean;
15
+ url: z.ZodString;
16
+ }, z.core.$strict>;
17
+ /**
18
+ * One page of a search. Pages FORWARD only, by an opaque `next_page` token
19
+ * passed back as `page`, bound to the query it came from.
20
+ */
21
+ export declare function searchResultOf<T extends z.ZodType>(item: T): z.ZodObject<{
22
+ object: z.ZodLiteral<"search_result">;
23
+ data: z.ZodArray<T>;
24
+ has_more: z.ZodBoolean;
25
+ next_page: z.ZodNullable<z.ZodString>;
26
+ url: z.ZodString;
27
+ total_count: z.ZodOptional<z.ZodNumber>;
28
+ }, z.core.$strict>;
29
+ /** A deleted object, as its `DELETE` answers: `{id, object, deleted: true}`. */
30
+ export declare function deletedOf<T extends string>(object: T): z.ZodObject<{
31
+ id: z.ZodString;
32
+ object: z.ZodLiteral<T>;
33
+ deleted: z.ZodLiteral<true>;
34
+ }, z.core.$strict>;
35
+ /** The error object inside every non-2xx answer. */
36
+ export declare const apiErrorSchema: z.ZodObject<{
37
+ type: z.ZodEnum<{
38
+ api_error: "api_error";
39
+ authentication_error: "authentication_error";
40
+ card_error: "card_error";
41
+ idempotency_error: "idempotency_error";
42
+ invalid_request_error: "invalid_request_error";
43
+ permission_error: "permission_error";
44
+ rate_limit_error: "rate_limit_error";
45
+ }>;
46
+ code: z.ZodOptional<z.ZodString>;
47
+ decline_code: z.ZodOptional<z.ZodString>;
48
+ param: z.ZodOptional<z.ZodString>;
49
+ message: z.ZodString;
50
+ doc_url: z.ZodOptional<z.ZodURL>;
51
+ request_id: z.ZodNullable<z.ZodString>;
52
+ payment_intent: z.ZodOptional<z.ZodLazy<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
53
+ invoice: z.ZodOptional<z.ZodLazy<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
54
+ refresh_url: z.ZodOptional<z.ZodURL>;
55
+ }, z.core.$strict>;
56
+ /** `{ error: {...} }` — every non-2xx answer. */
57
+ export declare const errorEnvelopeSchema: z.ZodObject<{
58
+ error: z.ZodObject<{
59
+ type: z.ZodEnum<{
60
+ api_error: "api_error";
61
+ authentication_error: "authentication_error";
62
+ card_error: "card_error";
63
+ idempotency_error: "idempotency_error";
64
+ invalid_request_error: "invalid_request_error";
65
+ permission_error: "permission_error";
66
+ rate_limit_error: "rate_limit_error";
67
+ }>;
68
+ code: z.ZodOptional<z.ZodString>;
69
+ decline_code: z.ZodOptional<z.ZodString>;
70
+ param: z.ZodOptional<z.ZodString>;
71
+ message: z.ZodString;
72
+ doc_url: z.ZodOptional<z.ZodURL>;
73
+ request_id: z.ZodNullable<z.ZodString>;
74
+ payment_intent: z.ZodOptional<z.ZodLazy<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
75
+ invoice: z.ZodOptional<z.ZodLazy<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>>;
76
+ refresh_url: z.ZodOptional<z.ZodURL>;
77
+ }, z.core.$strict>;
78
+ }, z.core.$strict>;
79
+ export type ApiError = z.output<typeof apiErrorSchema>;
80
+ export type ErrorEnvelope = z.output<typeof errorEnvelopeSchema>;
81
+ /** One page of a list of `T` — the type of every `listOf(…)` answer. */
82
+ export type List<T> = Omit<z.output<ReturnType<typeof listOf<z.ZodNever>>>, 'data'> & {
83
+ data: T[];
84
+ };
85
+ /** One page of a search over `T` — the type of every `searchResultOf(…)` answer. */
86
+ export type SearchResult<T> = Omit<z.output<ReturnType<typeof searchResultOf<z.ZodNever>>>, 'data'> & {
87
+ data: T[];
88
+ };
@@ -0,0 +1,107 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * The object registry: every named wire object (`Customer`, `PaymentIntent`, …)
4
+ * is defined ONCE, here in `packages/contracts`, and registered under its
5
+ * OpenAPI component name and its `object` value.
6
+ *
7
+ * Three things read it:
8
+ *
9
+ * - `expandable(type)` — a reference that `expand[]` can replace with the
10
+ * object it names validates against the registered schema;
11
+ * - the OpenAPI generator — every registered object is a
12
+ * `#/components/schemas/<Name>` and every reference to it is a `$ref`;
13
+ * - {@link Expand} — the TypeScript half, which turns a reference's marker
14
+ * into the object type, so `Customer['invoice_settings']['default_payment_method']`
15
+ * is `string | PaymentMethod | null` without the schemas referencing each
16
+ * other at the type level (which TypeScript cannot infer, and which the
17
+ * declaration emitter would elide to `any`).
18
+ */
19
+ /** OpenAPI-facing metadata a schema can carry. */
20
+ export interface ContractMeta {
21
+ /** The component name: `#/components/schemas/<id>`. */
22
+ id?: string;
23
+ title?: string;
24
+ description?: string;
25
+ /** Example values, rendered in the reference and the OpenAPI document. */
26
+ examples?: readonly unknown[];
27
+ deprecated?: boolean;
28
+ /** On an expandable reference: the `object` type `expand[]` replaces it with. */
29
+ 'x-peable-expandable'?: string;
30
+ /** Replaces the generated JSON Schema of this node (a query integer's wire spelling). */
31
+ jsonSchema?: Record<string, unknown>;
32
+ }
33
+ /** The one registry every contract schema's metadata lives in. */
34
+ export declare const contractRegistry: z.core.$ZodRegistry<ContractMeta, z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
35
+ declare const refBrand: unique symbol;
36
+ /**
37
+ * The TYPE of an expandable reference before {@link Expand} resolves it. Never
38
+ * a runtime value: at runtime the reference is an id string or the object.
39
+ */
40
+ export interface Ref<K extends string> {
41
+ readonly [refBrand]: K;
42
+ }
43
+ /**
44
+ * `object` value → wire type, for every object a reference can expand into.
45
+ *
46
+ * Each resource module adds its own entries by declaration merging:
47
+ *
48
+ * ```ts
49
+ * declare module '../common/objects' {
50
+ * interface ObjectMap { customer: Customer }
51
+ * }
52
+ * ```
53
+ *
54
+ * so a resource is registered by the same file that defines it.
55
+ */
56
+ export interface ObjectMap {
57
+ }
58
+ /** Every object type a reference can name. */
59
+ export type ObjectType = keyof ObjectMap;
60
+ /**
61
+ * A schema's output with every {@link Ref} replaced by the object it names —
62
+ * the wire type. Homomorphic, so optional and readonly modifiers survive.
63
+ */
64
+ export type Expand<T> = T extends Ref<infer K> ? K extends keyof ObjectMap ? ObjectMap[K] : never : T extends readonly (infer U)[] ? Expand<U>[] : T extends object ? {
65
+ [P in keyof T]: Expand<T[P]>;
66
+ } : T;
67
+ /** The wire type a schema describes (its output, references resolved). */
68
+ export type Wire<S extends z.ZodType> = Expand<z.output<S>>;
69
+ /** The parameters a request schema accepts as sent on the wire (its input). */
70
+ export type Params<S extends z.ZodType> = z.input<S>;
71
+ /**
72
+ * Register a wire object: its `object` value (the key references use) and its
73
+ * component name. Returns the schema so a definition reads as one expression.
74
+ */
75
+ export declare function defineObject<T extends z.ZodType>(type: string, id: string, schema: T, meta?: Omit<ContractMeta, 'id'>): T;
76
+ /**
77
+ * Register a named schema that is not an expandable object — a tombstone, a
78
+ * shared sub-object, a polymorphic payload — as `#/components/schemas/<id>`.
79
+ */
80
+ export declare function defineComponent<T extends z.ZodType>(id: string, schema: T, meta?: Omit<ContractMeta, 'id'>): T;
81
+ /** The registered schema of `type`, or `undefined`. */
82
+ export declare function objectSchema(type: string): z.ZodType | undefined;
83
+ /**
84
+ * The registered schema of `type`. Resolved lazily (a reference is declared
85
+ * before the module defining its target has loaded), and loud when nothing
86
+ * registers it: a reference to an unknown object is a contract bug.
87
+ */
88
+ export declare function resolveObject(type: string): z.ZodType;
89
+ /** Every registered object type, in registration order. */
90
+ export declare function objectTypes(): string[];
91
+ /**
92
+ * A reference `expand[]` can replace: the id (`cus_…`) or, expanded, the
93
+ * object. The naming rule (`lib/expand.ts` in the backend): an expandable
94
+ * reference is spelled WITHOUT `_id`, and a field without `_id` that is not
95
+ * expandable is a bug.
96
+ */
97
+ export declare function expandable<K extends string>(type: K, description?: string): z.ZodType<string | Ref<K>, string | Ref<K>>;
98
+ /**
99
+ * A field that always carries the FULL object `type` names (never an id): a
100
+ * subscription item's `price`, a payer view's `payment_intent`, a report run's
101
+ * result `file`. Validated against the registered schema and typed through
102
+ * {@link Ref}, so {@link Expand} resolves it to that object's wire type.
103
+ */
104
+ export declare function embedded<K extends string>(type: K, description?: string): z.ZodType<Ref<K>, Ref<K>>;
105
+ /** Attach OpenAPI metadata to a schema without changing its type. */
106
+ export declare function describe<T extends z.ZodType>(schema: T, meta: ContractMeta): T;
107
+ export {};