@pithy-sh/payments 0.1.1 → 0.1.3

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 (402) hide show
  1. package/dist/admin/coverage.d.ts +35 -0
  2. package/dist/admin/coverage.d.ts.map +1 -0
  3. package/dist/admin/coverage.js +56 -0
  4. package/dist/admin/read.d.ts +222 -0
  5. package/dist/admin/read.d.ts.map +1 -0
  6. package/dist/admin/read.js +159 -0
  7. package/dist/audit/actions.d.ts +211 -0
  8. package/dist/audit/actions.d.ts.map +1 -0
  9. package/dist/audit/actions.js +211 -0
  10. package/dist/capability.d.ts +72 -0
  11. package/dist/capability.d.ts.map +1 -0
  12. package/dist/capability.js +228 -0
  13. package/dist/client/api.d.ts +435 -0
  14. package/dist/client/api.d.ts.map +1 -0
  15. package/dist/client/api.js +415 -0
  16. package/dist/client/checkout.d.ts +144 -0
  17. package/dist/client/checkout.d.ts.map +1 -0
  18. package/dist/client/checkout.js +173 -0
  19. package/dist/client/fixtures/price-preview-de.js +89 -0
  20. package/dist/client/fixtures/price-preview-gb.js +89 -0
  21. package/dist/client/fixtures/price-preview-jp-yen.js +89 -0
  22. package/dist/client/fixtures/price-preview-us-country-only.js +89 -0
  23. package/dist/client/fixtures/price-preview-us-new-york.js +89 -0
  24. package/dist/client/fixtures/pricePreview.d.ts +54 -0
  25. package/dist/client/fixtures/pricePreview.d.ts.map +1 -0
  26. package/dist/client/fixtures/pricePreview.js +61 -0
  27. package/dist/client/hooks.d.ts +235 -0
  28. package/dist/client/hooks.d.ts.map +1 -0
  29. package/dist/client/hooks.js +428 -0
  30. package/dist/client/paddle.d.ts +433 -0
  31. package/dist/client/paddle.d.ts.map +1 -0
  32. package/dist/client/paddle.js +391 -0
  33. package/dist/client/paddleCache.d.ts +123 -0
  34. package/dist/client/paddleCache.d.ts.map +1 -0
  35. package/dist/client/paddleCache.js +159 -0
  36. package/dist/client/paddlePrices.d.ts +94 -0
  37. package/dist/client/paddlePrices.d.ts.map +1 -0
  38. package/dist/client/paddlePrices.js +55 -0
  39. package/dist/client/paddlePricesTag.d.ts +127 -0
  40. package/dist/client/paddlePricesTag.d.ts.map +1 -0
  41. package/dist/client/paddlePricesTag.js +207 -0
  42. package/dist/client/projection.d.ts +128 -0
  43. package/dist/client/projection.d.ts.map +1 -0
  44. package/dist/client/projection.js +0 -0
  45. package/dist/client/test-utils/cacheStore.d.ts +18 -0
  46. package/dist/client/test-utils/cacheStore.d.ts.map +1 -0
  47. package/dist/client/test-utils/cacheStore.js +42 -0
  48. package/dist/client/wholeUnits.d.ts +18 -0
  49. package/dist/client/wholeUnits.d.ts.map +1 -0
  50. package/dist/client/wholeUnits.js +120 -0
  51. package/dist/config/config.d.ts +238 -0
  52. package/dist/config/config.d.ts.map +1 -0
  53. package/dist/config/config.js +249 -0
  54. package/dist/data/discount.d.ts +127 -0
  55. package/dist/data/discount.d.ts.map +1 -0
  56. package/dist/data/discount.js +91 -0
  57. package/dist/data/entitlement.d.ts +43 -0
  58. package/dist/data/entitlement.d.ts.map +1 -0
  59. package/dist/data/entitlement.js +43 -0
  60. package/dist/data/money.d.ts +15 -0
  61. package/dist/data/money.d.ts.map +1 -0
  62. package/dist/data/money.js +76 -0
  63. package/dist/data/pause.d.ts +133 -0
  64. package/dist/data/pause.d.ts.map +1 -0
  65. package/dist/data/pause.js +63 -0
  66. package/dist/data/providerAccount.d.ts +40 -0
  67. package/dist/data/providerAccount.d.ts.map +1 -0
  68. package/dist/data/providerAccount.js +34 -0
  69. package/dist/data/purchase.d.ts +107 -0
  70. package/dist/data/purchase.d.ts.map +1 -0
  71. package/dist/data/purchase.js +77 -0
  72. package/dist/data/rail.d.ts +74 -0
  73. package/dist/data/rail.d.ts.map +1 -0
  74. package/dist/data/rail.js +74 -0
  75. package/dist/data/reconcileRun.d.ts +120 -0
  76. package/dist/data/reconcileRun.d.ts.map +1 -0
  77. package/dist/data/reconcileRun.js +120 -0
  78. package/dist/data/renderMoney.d.ts +85 -0
  79. package/dist/data/renderMoney.d.ts.map +1 -0
  80. package/dist/data/renderMoney.js +146 -0
  81. package/dist/data/status.d.ts +58 -0
  82. package/dist/data/status.d.ts.map +1 -0
  83. package/dist/data/status.js +68 -0
  84. package/dist/data/subject.d.ts +111 -0
  85. package/dist/data/subject.d.ts.map +1 -0
  86. package/dist/data/subject.js +125 -0
  87. package/dist/data/subscription.d.ts +624 -0
  88. package/dist/data/subscription.d.ts.map +1 -0
  89. package/dist/data/subscription.js +497 -0
  90. package/dist/data/syncCursor.d.ts +33 -0
  91. package/dist/data/syncCursor.d.ts.map +1 -0
  92. package/dist/data/syncCursor.js +29 -0
  93. package/dist/data/tables.d.ts +37 -0
  94. package/dist/data/tables.d.ts.map +1 -0
  95. package/dist/data/tables.js +44 -0
  96. package/dist/data/webhookEvent.d.ts +134 -0
  97. package/dist/data/webhookEvent.d.ts.map +1 -0
  98. package/dist/data/webhookEvent.js +128 -0
  99. package/dist/entitlement/manual.d.ts +101 -0
  100. package/dist/entitlement/manual.d.ts.map +1 -0
  101. package/dist/entitlement/manual.js +84 -0
  102. package/dist/entitlement/resolver.d.ts +60 -0
  103. package/dist/entitlement/resolver.d.ts.map +1 -0
  104. package/dist/entitlement/resolver.js +101 -0
  105. package/dist/entitlement/subjectSeam.d.ts +102 -0
  106. package/dist/entitlement/subjectSeam.d.ts.map +1 -0
  107. package/dist/entitlement/subjectSeam.js +85 -0
  108. package/dist/error/errors.d.ts +247 -0
  109. package/dist/error/errors.d.ts.map +1 -0
  110. package/dist/error/errors.js +326 -0
  111. package/dist/grants/apply.d.ts +74 -0
  112. package/dist/grants/apply.d.ts.map +1 -0
  113. package/dist/grants/apply.js +148 -0
  114. package/dist/grants/clawback.d.ts +43 -0
  115. package/dist/grants/clawback.d.ts.map +1 -0
  116. package/dist/grants/clawback.js +71 -0
  117. package/dist/grants/ledgerSeam.d.ts +89 -0
  118. package/dist/grants/ledgerSeam.d.ts.map +1 -0
  119. package/dist/grants/ledgerSeam.js +66 -0
  120. package/dist/http/dispatch.d.ts +35 -0
  121. package/dist/http/dispatch.d.ts.map +1 -0
  122. package/dist/http/dispatch.js +40 -0
  123. package/dist/http/guards.d.ts +43 -0
  124. package/dist/http/guards.d.ts.map +1 -0
  125. package/dist/http/guards.js +52 -0
  126. package/dist/http/manifestConfig.d.ts +38 -0
  127. package/dist/http/manifestConfig.d.ts.map +1 -0
  128. package/dist/http/manifestConfig.js +49 -0
  129. package/dist/http/responses.d.ts +1455 -0
  130. package/dist/http/responses.d.ts.map +1 -0
  131. package/dist/http/responses.js +728 -0
  132. package/dist/http/routes.d.ts +315 -0
  133. package/dist/http/routes.d.ts.map +1 -0
  134. package/dist/http/routes.js +1966 -0
  135. package/dist/http/schemas.d.ts +404 -0
  136. package/dist/http/schemas.d.ts.map +1 -0
  137. package/dist/http/schemas.js +359 -0
  138. package/dist/http/scopes.d.ts +160 -0
  139. package/dist/http/scopes.d.ts.map +1 -0
  140. package/dist/http/scopes.js +240 -0
  141. package/dist/http/view.d.ts +96 -0
  142. package/dist/http/view.d.ts.map +1 -0
  143. package/dist/http/view.js +170 -0
  144. package/dist/http/webhookGuard.d.ts +109 -0
  145. package/dist/http/webhookGuard.d.ts.map +1 -0
  146. package/dist/http/webhookGuard.js +206 -0
  147. package/dist/index.d.ts +64 -0
  148. package/dist/index.d.ts.map +1 -0
  149. package/dist/index.js +43 -0
  150. package/dist/migrations/0001_purchases.d.ts +35 -0
  151. package/dist/migrations/0001_purchases.d.ts.map +1 -0
  152. package/dist/migrations/0001_purchases.js +80 -0
  153. package/dist/pricing/location.d.ts +138 -0
  154. package/dist/pricing/location.d.ts.map +1 -0
  155. package/dist/pricing/location.js +81 -0
  156. package/dist/pricing/visitor.d.ts +56 -0
  157. package/dist/pricing/visitor.d.ts.map +1 -0
  158. package/dist/pricing/visitor.js +35 -0
  159. package/dist/projection/event.d.ts +66 -0
  160. package/dist/projection/event.d.ts.map +1 -0
  161. package/dist/projection/event.js +45 -0
  162. package/dist/projection/orphans.d.ts +114 -0
  163. package/dist/projection/orphans.d.ts.map +1 -0
  164. package/dist/projection/orphans.js +162 -0
  165. package/dist/projection/owner.d.ts +121 -0
  166. package/dist/projection/owner.d.ts.map +1 -0
  167. package/dist/projection/owner.js +114 -0
  168. package/dist/projection/resolve.d.ts +30 -0
  169. package/dist/projection/resolve.d.ts.map +1 -0
  170. package/dist/projection/resolve.js +42 -0
  171. package/dist/projection/writer.d.ts +103 -0
  172. package/dist/projection/writer.d.ts.map +1 -0
  173. package/dist/projection/writer.js +280 -0
  174. package/dist/provision/resolvePaymentsConfig.d.ts +48 -0
  175. package/dist/provision/resolvePaymentsConfig.d.ts.map +1 -0
  176. package/dist/provision/resolvePaymentsConfig.js +41 -0
  177. package/dist/rails/apple/certs.d.ts +7 -0
  178. package/dist/rails/apple/certs.d.ts.map +1 -0
  179. package/dist/rails/apple/certs.js +8 -0
  180. package/dist/rails/apple/der.d.ts +107 -0
  181. package/dist/rails/apple/der.d.ts.map +1 -0
  182. package/dist/rails/apple/der.js +217 -0
  183. package/dist/rails/apple/fixtures/chain.d.ts +117 -0
  184. package/dist/rails/apple/fixtures/chain.d.ts.map +1 -0
  185. package/dist/rails/apple/fixtures/chain.js +289 -0
  186. package/dist/rails/apple/http.d.ts +74 -0
  187. package/dist/rails/apple/http.d.ts.map +1 -0
  188. package/dist/rails/apple/http.js +32 -0
  189. package/dist/rails/apple/jws.d.ts +17 -0
  190. package/dist/rails/apple/jws.d.ts.map +1 -0
  191. package/dist/rails/apple/jws.js +75 -0
  192. package/dist/rails/apple/notification.d.ts +116 -0
  193. package/dist/rails/apple/notification.d.ts.map +1 -0
  194. package/dist/rails/apple/notification.js +199 -0
  195. package/dist/rails/apple/rail.d.ts +25 -0
  196. package/dist/rails/apple/rail.d.ts.map +1 -0
  197. package/dist/rails/apple/rail.js +68 -0
  198. package/dist/rails/apple/serverApi.d.ts +120 -0
  199. package/dist/rails/apple/serverApi.d.ts.map +1 -0
  200. package/dist/rails/apple/serverApi.js +244 -0
  201. package/dist/rails/apple/verify.d.ts +36 -0
  202. package/dist/rails/apple/verify.d.ts.map +1 -0
  203. package/dist/rails/apple/verify.js +46 -0
  204. package/dist/rails/apple/x509.d.ts +85 -0
  205. package/dist/rails/apple/x509.d.ts.map +1 -0
  206. package/dist/rails/apple/x509.js +273 -0
  207. package/dist/rails/contract.d.ts +871 -0
  208. package/dist/rails/contract.d.ts.map +1 -0
  209. package/dist/rails/contract.js +60 -0
  210. package/dist/rails/google/fixtures/push.d.ts +71 -0
  211. package/dist/rails/google/fixtures/push.d.ts.map +1 -0
  212. package/dist/rails/google/fixtures/push.js +107 -0
  213. package/dist/rails/google/http.d.ts +77 -0
  214. package/dist/rails/google/http.d.ts.map +1 -0
  215. package/dist/rails/google/http.js +39 -0
  216. package/dist/rails/google/jwt.d.ts +53 -0
  217. package/dist/rails/google/jwt.d.ts.map +1 -0
  218. package/dist/rails/google/jwt.js +94 -0
  219. package/dist/rails/google/oidc.d.ts +112 -0
  220. package/dist/rails/google/oidc.d.ts.map +1 -0
  221. package/dist/rails/google/oidc.js +179 -0
  222. package/dist/rails/google/playApi.d.ts +188 -0
  223. package/dist/rails/google/playApi.d.ts.map +1 -0
  224. package/dist/rails/google/playApi.js +350 -0
  225. package/dist/rails/google/rail.d.ts +57 -0
  226. package/dist/rails/google/rail.d.ts.map +1 -0
  227. package/dist/rails/google/rail.js +70 -0
  228. package/dist/rails/google/rtdn.d.ts +105 -0
  229. package/dist/rails/google/rtdn.d.ts.map +1 -0
  230. package/dist/rails/google/rtdn.js +179 -0
  231. package/dist/rails/google/verify.d.ts +20 -0
  232. package/dist/rails/google/verify.d.ts.map +1 -0
  233. package/dist/rails/google/verify.js +76 -0
  234. package/dist/rails/lemonSqueezy/api.d.ts +92 -0
  235. package/dist/rails/lemonSqueezy/api.d.ts.map +1 -0
  236. package/dist/rails/lemonSqueezy/api.js +121 -0
  237. package/dist/rails/lemonSqueezy/checkout.d.ts +52 -0
  238. package/dist/rails/lemonSqueezy/checkout.d.ts.map +1 -0
  239. package/dist/rails/lemonSqueezy/checkout.js +84 -0
  240. package/dist/rails/lemonSqueezy/discounts.d.ts +50 -0
  241. package/dist/rails/lemonSqueezy/discounts.d.ts.map +1 -0
  242. package/dist/rails/lemonSqueezy/discounts.js +75 -0
  243. package/dist/rails/lemonSqueezy/fixtures/events.d.ts +56 -0
  244. package/dist/rails/lemonSqueezy/fixtures/events.d.ts.map +1 -0
  245. package/dist/rails/lemonSqueezy/fixtures/events.js +144 -0
  246. package/dist/rails/lemonSqueezy/objects.d.ts +229 -0
  247. package/dist/rails/lemonSqueezy/objects.d.ts.map +1 -0
  248. package/dist/rails/lemonSqueezy/objects.js +379 -0
  249. package/dist/rails/lemonSqueezy/portal.d.ts +35 -0
  250. package/dist/rails/lemonSqueezy/portal.d.ts.map +1 -0
  251. package/dist/rails/lemonSqueezy/portal.js +18 -0
  252. package/dist/rails/lemonSqueezy/pricing.d.ts +25 -0
  253. package/dist/rails/lemonSqueezy/pricing.d.ts.map +1 -0
  254. package/dist/rails/lemonSqueezy/pricing.js +54 -0
  255. package/dist/rails/lemonSqueezy/rail.d.ts +41 -0
  256. package/dist/rails/lemonSqueezy/rail.d.ts.map +1 -0
  257. package/dist/rails/lemonSqueezy/rail.js +67 -0
  258. package/dist/rails/lemonSqueezy/read.d.ts +28 -0
  259. package/dist/rails/lemonSqueezy/read.d.ts.map +1 -0
  260. package/dist/rails/lemonSqueezy/read.js +37 -0
  261. package/dist/rails/lemonSqueezy/refresh.d.ts +42 -0
  262. package/dist/rails/lemonSqueezy/refresh.d.ts.map +1 -0
  263. package/dist/rails/lemonSqueezy/refresh.js +40 -0
  264. package/dist/rails/lemonSqueezy/signature.d.ts +56 -0
  265. package/dist/rails/lemonSqueezy/signature.d.ts.map +1 -0
  266. package/dist/rails/lemonSqueezy/signature.js +92 -0
  267. package/dist/rails/lemonSqueezy/verify.d.ts +33 -0
  268. package/dist/rails/lemonSqueezy/verify.d.ts.map +1 -0
  269. package/dist/rails/lemonSqueezy/verify.js +41 -0
  270. package/dist/rails/lemonSqueezy/webhook.d.ts +53 -0
  271. package/dist/rails/lemonSqueezy/webhook.d.ts.map +1 -0
  272. package/dist/rails/lemonSqueezy/webhook.js +179 -0
  273. package/dist/rails/paddle/adjustments.d.ts +60 -0
  274. package/dist/rails/paddle/adjustments.d.ts.map +1 -0
  275. package/dist/rails/paddle/adjustments.js +66 -0
  276. package/dist/rails/paddle/api.d.ts +138 -0
  277. package/dist/rails/paddle/api.d.ts.map +1 -0
  278. package/dist/rails/paddle/api.js +152 -0
  279. package/dist/rails/paddle/checkout.d.ts +69 -0
  280. package/dist/rails/paddle/checkout.d.ts.map +1 -0
  281. package/dist/rails/paddle/checkout.js +100 -0
  282. package/dist/rails/paddle/discounts.d.ts +67 -0
  283. package/dist/rails/paddle/discounts.d.ts.map +1 -0
  284. package/dist/rails/paddle/discounts.js +73 -0
  285. package/dist/rails/paddle/events.d.ts +140 -0
  286. package/dist/rails/paddle/events.d.ts.map +1 -0
  287. package/dist/rails/paddle/events.js +183 -0
  288. package/dist/rails/paddle/fixtures/browserForged.d.ts +42 -0
  289. package/dist/rails/paddle/fixtures/browserForged.d.ts.map +1 -0
  290. package/dist/rails/paddle/fixtures/browserForged.js +52 -0
  291. package/dist/rails/paddle/fixtures/pausedSubscription.d.ts +78 -0
  292. package/dist/rails/paddle/fixtures/pausedSubscription.d.ts.map +1 -0
  293. package/dist/rails/paddle/fixtures/pausedSubscription.js +76 -0
  294. package/dist/rails/paddle/objects.d.ts +519 -0
  295. package/dist/rails/paddle/objects.d.ts.map +1 -0
  296. package/dist/rails/paddle/objects.js +588 -0
  297. package/dist/rails/paddle/portal.d.ts +45 -0
  298. package/dist/rails/paddle/portal.d.ts.map +1 -0
  299. package/dist/rails/paddle/portal.js +42 -0
  300. package/dist/rails/paddle/rail.d.ts +55 -0
  301. package/dist/rails/paddle/rail.d.ts.map +1 -0
  302. package/dist/rails/paddle/rail.js +117 -0
  303. package/dist/rails/paddle/read.d.ts +53 -0
  304. package/dist/rails/paddle/read.d.ts.map +1 -0
  305. package/dist/rails/paddle/read.js +66 -0
  306. package/dist/rails/paddle/recorded.d.ts +49 -0
  307. package/dist/rails/paddle/recorded.d.ts.map +1 -0
  308. package/dist/rails/paddle/recorded.js +79 -0
  309. package/dist/rails/paddle/refresh.d.ts +54 -0
  310. package/dist/rails/paddle/refresh.d.ts.map +1 -0
  311. package/dist/rails/paddle/refresh.js +94 -0
  312. package/dist/rails/paddle/refund.d.ts +82 -0
  313. package/dist/rails/paddle/refund.d.ts.map +1 -0
  314. package/dist/rails/paddle/refund.js +175 -0
  315. package/dist/rails/paddle/signature.d.ts +83 -0
  316. package/dist/rails/paddle/signature.d.ts.map +1 -0
  317. package/dist/rails/paddle/signature.js +163 -0
  318. package/dist/rails/paddle/subscription.d.ts +137 -0
  319. package/dist/rails/paddle/subscription.d.ts.map +1 -0
  320. package/dist/rails/paddle/subscription.js +538 -0
  321. package/dist/rails/paddle/verify.d.ts +46 -0
  322. package/dist/rails/paddle/verify.d.ts.map +1 -0
  323. package/dist/rails/paddle/verify.js +43 -0
  324. package/dist/rails/paddle/webhook.d.ts +98 -0
  325. package/dist/rails/paddle/webhook.d.ts.map +1 -0
  326. package/dist/rails/paddle/webhook.js +181 -0
  327. package/dist/rails/providers.d.ts +73 -0
  328. package/dist/rails/providers.d.ts.map +1 -0
  329. package/dist/rails/providers.js +62 -0
  330. package/dist/rails/stripe/api.d.ts +118 -0
  331. package/dist/rails/stripe/api.d.ts.map +1 -0
  332. package/dist/rails/stripe/api.js +153 -0
  333. package/dist/rails/stripe/checkout.d.ts +60 -0
  334. package/dist/rails/stripe/checkout.d.ts.map +1 -0
  335. package/dist/rails/stripe/checkout.js +86 -0
  336. package/dist/rails/stripe/discounts.d.ts +50 -0
  337. package/dist/rails/stripe/discounts.d.ts.map +1 -0
  338. package/dist/rails/stripe/discounts.js +87 -0
  339. package/dist/rails/stripe/fixtures/events.d.ts +64 -0
  340. package/dist/rails/stripe/fixtures/events.d.ts.map +1 -0
  341. package/dist/rails/stripe/fixtures/events.js +67 -0
  342. package/dist/rails/stripe/objects.d.ts +237 -0
  343. package/dist/rails/stripe/objects.d.ts.map +1 -0
  344. package/dist/rails/stripe/objects.js +389 -0
  345. package/dist/rails/stripe/portal.d.ts +29 -0
  346. package/dist/rails/stripe/portal.d.ts.map +1 -0
  347. package/dist/rails/stripe/portal.js +41 -0
  348. package/dist/rails/stripe/pricing.d.ts +25 -0
  349. package/dist/rails/stripe/pricing.d.ts.map +1 -0
  350. package/dist/rails/stripe/pricing.js +68 -0
  351. package/dist/rails/stripe/rail.d.ts +28 -0
  352. package/dist/rails/stripe/rail.d.ts.map +1 -0
  353. package/dist/rails/stripe/rail.js +81 -0
  354. package/dist/rails/stripe/refresh.d.ts +33 -0
  355. package/dist/rails/stripe/refresh.d.ts.map +1 -0
  356. package/dist/rails/stripe/refresh.js +21 -0
  357. package/dist/rails/stripe/signature.d.ts +71 -0
  358. package/dist/rails/stripe/signature.d.ts.map +1 -0
  359. package/dist/rails/stripe/signature.js +92 -0
  360. package/dist/rails/stripe/verify.d.ts +15 -0
  361. package/dist/rails/stripe/verify.d.ts.map +1 -0
  362. package/dist/rails/stripe/verify.js +63 -0
  363. package/dist/rails/stripe/webhook.d.ts +26 -0
  364. package/dist/rails/stripe/webhook.d.ts.map +1 -0
  365. package/dist/rails/stripe/webhook.js +31 -0
  366. package/dist/secret/registry.d.ts +192 -0
  367. package/dist/secret/registry.d.ts.map +1 -0
  368. package/dist/secret/registry.js +154 -0
  369. package/dist/seeds/example.d.ts +3 -0
  370. package/dist/seeds/example.d.ts.map +1 -0
  371. package/dist/seeds/example.js +171 -0
  372. package/dist/version.generated.d.ts +5 -0
  373. package/dist/version.generated.d.ts.map +1 -0
  374. package/dist/version.generated.js +7 -0
  375. package/dist/workflows/paddleSweep.d.ts +175 -0
  376. package/dist/workflows/paddleSweep.d.ts.map +1 -0
  377. package/dist/workflows/paddleSweep.js +433 -0
  378. package/dist/workflows/railAccess.d.ts +48 -0
  379. package/dist/workflows/railAccess.d.ts.map +1 -0
  380. package/dist/workflows/railAccess.js +36 -0
  381. package/dist/workflows/reconcile.d.ts +161 -0
  382. package/dist/workflows/reconcile.d.ts.map +1 -0
  383. package/dist/workflows/reconcile.js +352 -0
  384. package/dist/workflows/report.d.ts +28 -0
  385. package/dist/workflows/report.d.ts.map +1 -0
  386. package/dist/workflows/report.js +54 -0
  387. package/dist/workflows/retryPolicy.d.ts +29 -0
  388. package/dist/workflows/retryPolicy.d.ts.map +1 -0
  389. package/dist/workflows/retryPolicy.js +37 -0
  390. package/dist/workflows/specs.d.ts +102 -0
  391. package/dist/workflows/specs.d.ts.map +1 -0
  392. package/dist/workflows/specs.js +84 -0
  393. package/dist/workflows/worker.d.ts +62 -0
  394. package/dist/workflows/worker.d.ts.map +1 -0
  395. package/dist/workflows/worker.js +92 -0
  396. package/dist/workflows/workerConfig.d.ts +46 -0
  397. package/dist/workflows/workerConfig.d.ts.map +1 -0
  398. package/dist/workflows/workerConfig.js +38 -0
  399. package/package.json +22 -13
  400. package/pithy.manifest.json +19 -13
  401. package/src/version.generated.ts +1 -1
  402. package/src/client/paddlePrices.iife.ts +0 -43
@@ -0,0 +1,68 @@
1
+ import { z } from "zod";
2
+ //#region src/data/status.ts
3
+ /**
4
+ * The normalized purchase status set. Each rail's events map into these nine, so nothing downstream of
5
+ * a rail module ever sees `DID_RENEW`, `SUBSCRIPTION_ON_HOLD`, or `invoice.payment_failed`.
6
+ *
7
+ * The set is deliberately about *state*, not about the event that produced it: a projection is keyed on a
8
+ * transaction, and a transaction has one current state however many notifications described it.
9
+ *
10
+ * ## Two endings, and the difference between them is the money
11
+ *
12
+ * **`expired` is a period we were paid for, ended.** A subscription that ran its course, a Stripe
13
+ * subscription Stripe closed, an Apple period past its `expiresDate`. It grants no access — the period is
14
+ * over — but it **credits**, because the invoice behind it cleared.
15
+ *
16
+ * **`never_paid` is a purchase that terminated before any money moved.** A delayed-payment checkout whose
17
+ * bank debit bounced, a Stripe subscription abandoned at `incomplete_expired`, a Play deferred purchase
18
+ * canceled before payment. It grants nothing and credits nothing, and no clawback ever follows one, because
19
+ * there is no payment to reverse. Leaning on `expired` for these is how a coin pack gets handed out for money
20
+ * that never arrived — see `UNPAID_STATUSES` in `grants/apply.ts`. Apple maps nothing here: StoreKit issues
21
+ * no transaction until the money moves.
22
+ */
23
+ const PurchaseStatus = z.enum([
24
+ "active",
25
+ "in_grace",
26
+ "on_hold",
27
+ "canceled",
28
+ "expired",
29
+ "never_paid",
30
+ "refunded",
31
+ "revoked",
32
+ "paused"
33
+ ]).describe("The normalized purchase status. `active` is paid and current; `in_grace` is a failed renewal still inside the retry window; `on_hold` is a failed renewal past it; `canceled` is auto-renew turned off with the paid period still running; `expired` is a period we were paid for that has lapsed; `never_paid` terminated before any money cleared, so it credits nothing; `refunded` and `revoked` were taken back; `paused` is a subscription the user suspended.");
34
+ /**
35
+ * The statuses a purchase can grant access from — the candidate set the projection's SQL filters on
36
+ * before the expiry check. `in_grace`'s membership is then narrowed per project by
37
+ * {@link statusGrantsAccess}, so this set and that predicate must stay in step; a test asserts both.
38
+ *
39
+ * **`canceled` still grants**, and it is the member most often got wrong. A user who turns off
40
+ * auto-renew has not lost access — they have declined the *next* period. The period they paid for runs
41
+ * to its end, and `expiresAt` is what ends it.
42
+ */
43
+ const ACCESS_GRANTING_STATUSES = /* @__PURE__ */ new Set([
44
+ "active",
45
+ "in_grace",
46
+ "canceled"
47
+ ]);
48
+ /**
49
+ * Whether a purchase in this status grants its entitlements, given the project's grace policy. The
50
+ * expiry check is separate and applied alongside it — a status says whether the purchase is still
51
+ * standing, `expiresAt` says whether the period it paid for is over.
52
+ *
53
+ * `in_grace` granting access is the point of grace: a failed card should not lock a paying subscriber
54
+ * out mid-period. It is a described config flag rather than hardcoded policy because an app that sells
55
+ * something expensive may reasonably decide otherwise. `on_hold` never grants — by then the retry window
56
+ * is exhausted and the renewal has genuinely failed. `never_paid` never grants either, and never can: it
57
+ * says no money ever moved.
58
+ */
59
+ function statusGrantsAccess(status, graceGrantsAccess) {
60
+ if (status === "in_grace") return graceGrantsAccess;
61
+ return ACCESS_GRANTING_STATUSES.has(status);
62
+ }
63
+ /** The statuses that grant access under this project's grace policy — what the projection's SQL filters on. */
64
+ function grantingStatuses(graceGrantsAccess) {
65
+ return [...ACCESS_GRANTING_STATUSES].filter((status) => statusGrantsAccess(status, graceGrantsAccess));
66
+ }
67
+ //#endregion
68
+ export { ACCESS_GRANTING_STATUSES, PurchaseStatus, grantingStatuses, statusGrantsAccess };
@@ -0,0 +1,111 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Who holds a purchase and the entitlements it grants — a **subject**, which is not always a person.
4
+ *
5
+ * A consumer app sells to people: one buyer, one holder, and a user id is the whole answer. A business
6
+ * selling to businesses has a different fact to record — the organization signs, the organization is
7
+ * invoiced, and everybody in it holds what it bought. Modeling that on a user-keyed table means either
8
+ * fanning a plan out across members (which drifts the moment somebody joins or leaves) or keying it to
9
+ * the owner (which makes the plan theirs, transferable with ownership, and invisible to the colleague
10
+ * their employer is paying for).
11
+ *
12
+ * So the holder is a **pair**: {@link PaymentsSubjectType} and an id. Both halves travel together
13
+ * everywhere — in a row, in a comparison, in a provider reference — because either half alone is
14
+ * ambiguous. Nothing in the kit keeps an organization id from equalling some user's id, so a comparison
15
+ * that read only the id would let one hold the other's subscription.
16
+ *
17
+ * **Which kind a project uses is decided once, in config** (`PaymentsConfig.billingSubject`), not per
18
+ * call. A codebase that could grant to a user on one route and an organization on the next is one where
19
+ * the two eventually disagree about who is entitled, and the disagreement surfaces as somebody being
20
+ * refused something they paid for.
21
+ *
22
+ * **The capability never learns what an organization is.** It has no members table, no roles, and no
23
+ * business acquiring either — memberships belong to the adopter. Under organization billing the
24
+ * capability asks *which subject is this caller acting for* and the adopter answers from its own
25
+ * session. Unanswered is unentitled, which is the direction every gate in the kit already fails.
26
+ */
27
+ /**
28
+ * The kinds of thing that can hold a purchase.
29
+ *
30
+ * **An enum rather than a free string**, because a free string is a column that ends up holding `org`,
31
+ * `organization` and `Organization` in three adopters, and every gate comparing it is then comparing
32
+ * spellings rather than facts.
33
+ *
34
+ * **Spelled with a `z`, deliberately.** The only realistic way an adopter has organizations at all is
35
+ * Better Auth's `organization()` plugin, which `@pithy-sh/auth` composes verbatim: it ships the
36
+ * `organization`, `member` and `invitation` tables and writes `active_organization_id` onto the session.
37
+ * An adopter wiring the subject seam reads `session.activeOrganizationId` and writes the value below on
38
+ * the next line, so the two must match. This is a stored token in a column and a UNIQUE index — it
39
+ * cannot be respelled later — and it is the one place in this repository where the American spelling is
40
+ * correct: it is an identifier inherited from a dependency, not prose.
41
+ */
42
+ export declare const PaymentsSubjectType: z.ZodEnum<{
43
+ organization: "organization";
44
+ user: "user";
45
+ }>;
46
+ export type PaymentsSubjectType = z.infer<typeof PaymentsSubjectType>;
47
+ /**
48
+ * The longest a subject id may be.
49
+ *
50
+ * **Derived from the narrowest provider field a reference is written into, not chosen.** A subject
51
+ * crosses to a store as {@link encodeSubjectReference}'s output, and Stripe's `client_reference_id` caps
52
+ * at 200 characters. A provider that silently truncates a longer value would hand back a string that
53
+ * decodes to a *different* id, attributing the purchase to whoever holds it — so the cap is enforced
54
+ * here, at the schema, where it fails on the way out instead of on the way back.
55
+ *
56
+ * 200 less `organization:` (13) leaves 187; 180 is that with room for a longer type member than either
57
+ * of today's, and it is far past any id the kit or Better Auth mints (both are UUIDs).
58
+ */
59
+ export declare const MAX_SUBJECT_ID_LENGTH = 180;
60
+ /**
61
+ * A subject: the pair, as every row carries it and every function takes it.
62
+ *
63
+ * **Passed as this object rather than two positional strings**, deliberately. Two adjacent `string`
64
+ * parameters are two parameters a call site can transpose, and transposing them typechecks. The object
65
+ * makes the halves nameable and inseparable, which is what keeps the invariant — a subject is read from
66
+ * and written to one row atomically, and no code path pairs a type from config with an id from a row.
67
+ */
68
+ export declare const PaymentsSubject: z.ZodObject<{
69
+ subjectType: z.ZodEnum<{
70
+ organization: "organization";
71
+ user: "user";
72
+ }>;
73
+ subjectId: z.ZodString;
74
+ }, z.core.$strip>;
75
+ export type PaymentsSubject = z.infer<typeof PaymentsSubject>;
76
+ /**
77
+ * Whether two subjects are the same holder — **both halves, always**.
78
+ *
79
+ * `undefined` is never equal to anything, including another `undefined`. An unresolved owner compared
80
+ * equal to an unresolved owner is how a webhook nobody could attribute would pass an ownership check,
81
+ * and that check is the only thing standing between one customer's renewal and another's account.
82
+ */
83
+ export declare function sameSubject(a: PaymentsSubject | undefined, b: PaymentsSubject | undefined): boolean;
84
+ /**
85
+ * A subject as one string, for the single-field slots a store gives us — Apple's `appAccountToken`,
86
+ * Google's `obfuscatedAccountId`, Stripe's `client_reference_id`, Paddle's and Lemon Squeezy's custom
87
+ * data.
88
+ *
89
+ * **One encoding, in one function, with one decoder.** These values leave our control and come back
90
+ * through a webhook, so the format is a wire contract with five providers at once. A second encoding
91
+ * anywhere means a purchase stamped by one code path and read by another resolves to nobody — or, worse,
92
+ * to somebody.
93
+ *
94
+ * The type half leads so the string sorts and greps by kind, and so a value that is *not* this encoding
95
+ * is recognizable at a glance in a provider's dashboard.
96
+ */
97
+ export declare function encodeSubjectReference(subject: PaymentsSubject): string;
98
+ /**
99
+ * The inverse, and **strict**: anything that is not exactly this encoding is `undefined`, never a guess.
100
+ *
101
+ * The input is a value a client put in a purchase and a store handed back, so it may be anything at all.
102
+ * The dangerous shape is a bare id — the format every pre-subject client sent — which a lenient decoder
103
+ * would read as a user, attributing a stranger's purchase to whoever holds that id. So a reference with
104
+ * no separator does not decode, an unknown type half does not decode, and an empty half does not decode.
105
+ * Every caller treats `undefined` as *orphaned*: the event is recorded and replayable, and nothing is
106
+ * granted.
107
+ *
108
+ * Splits on the **first** separator only, so an adopter whose organization ids contain colons round-trips.
109
+ */
110
+ export declare function decodeSubjectReference(reference: string): PaymentsSubject | undefined;
111
+ //# sourceMappingURL=subject.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subject.d.ts","sourceRoot":"","sources":["../../src/data/subject.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,mBAAmB;;;EAI7B,CAAC;AACJ,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEtE;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAiBzC;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe;;;;;;iBAK+E,CAAC;AAC5G,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,eAAe,GAAG,SAAS,EAAE,CAAC,EAAE,eAAe,GAAG,SAAS,GAAG,OAAO,CAGnG;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,CAEvE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAQrF"}
@@ -0,0 +1,125 @@
1
+ import { z } from "zod";
2
+ //#region src/data/subject.ts
3
+ /**
4
+ * Who holds a purchase and the entitlements it grants — a **subject**, which is not always a person.
5
+ *
6
+ * A consumer app sells to people: one buyer, one holder, and a user id is the whole answer. A business
7
+ * selling to businesses has a different fact to record — the organization signs, the organization is
8
+ * invoiced, and everybody in it holds what it bought. Modeling that on a user-keyed table means either
9
+ * fanning a plan out across members (which drifts the moment somebody joins or leaves) or keying it to
10
+ * the owner (which makes the plan theirs, transferable with ownership, and invisible to the colleague
11
+ * their employer is paying for).
12
+ *
13
+ * So the holder is a **pair**: {@link PaymentsSubjectType} and an id. Both halves travel together
14
+ * everywhere — in a row, in a comparison, in a provider reference — because either half alone is
15
+ * ambiguous. Nothing in the kit keeps an organization id from equalling some user's id, so a comparison
16
+ * that read only the id would let one hold the other's subscription.
17
+ *
18
+ * **Which kind a project uses is decided once, in config** (`PaymentsConfig.billingSubject`), not per
19
+ * call. A codebase that could grant to a user on one route and an organization on the next is one where
20
+ * the two eventually disagree about who is entitled, and the disagreement surfaces as somebody being
21
+ * refused something they paid for.
22
+ *
23
+ * **The capability never learns what an organization is.** It has no members table, no roles, and no
24
+ * business acquiring either — memberships belong to the adopter. Under organization billing the
25
+ * capability asks *which subject is this caller acting for* and the adopter answers from its own
26
+ * session. Unanswered is unentitled, which is the direction every gate in the kit already fails.
27
+ */
28
+ /**
29
+ * The kinds of thing that can hold a purchase.
30
+ *
31
+ * **An enum rather than a free string**, because a free string is a column that ends up holding `org`,
32
+ * `organization` and `Organization` in three adopters, and every gate comparing it is then comparing
33
+ * spellings rather than facts.
34
+ *
35
+ * **Spelled with a `z`, deliberately.** The only realistic way an adopter has organizations at all is
36
+ * Better Auth's `organization()` plugin, which `@pithy-sh/auth` composes verbatim: it ships the
37
+ * `organization`, `member` and `invitation` tables and writes `active_organization_id` onto the session.
38
+ * An adopter wiring the subject seam reads `session.activeOrganizationId` and writes the value below on
39
+ * the next line, so the two must match. This is a stored token in a column and a UNIQUE index — it
40
+ * cannot be respelled later — and it is the one place in this repository where the American spelling is
41
+ * correct: it is an identifier inherited from a dependency, not prose.
42
+ */
43
+ const PaymentsSubjectType = z.enum(["user", "organization"]).describe("What kind of thing holds a purchase — one person, or one organization. Spelled to match Better Auth's `organization()` plugin, whose session column an adopter reads to answer the subject seam.");
44
+ /**
45
+ * The longest a subject id may be.
46
+ *
47
+ * **Derived from the narrowest provider field a reference is written into, not chosen.** A subject
48
+ * crosses to a store as {@link encodeSubjectReference}'s output, and Stripe's `client_reference_id` caps
49
+ * at 200 characters. A provider that silently truncates a longer value would hand back a string that
50
+ * decodes to a *different* id, attributing the purchase to whoever holds it — so the cap is enforced
51
+ * here, at the schema, where it fails on the way out instead of on the way back.
52
+ *
53
+ * 200 less `organization:` (13) leaves 187; 180 is that with room for a longer type member than either
54
+ * of today's, and it is far past any id the kit or Better Auth mints (both are UUIDs).
55
+ */
56
+ const MAX_SUBJECT_ID_LENGTH = 180;
57
+ /** How a subject's two halves are joined in a single string. See {@link encodeSubjectReference}. */
58
+ const SUBJECT_REFERENCE_SEPARATOR = ":";
59
+ /**
60
+ * The id half of a subject — opaque to this package. It is a Pithy user id under `user`, and whatever
61
+ * the adopter's own membership model calls an organization under `organization`.
62
+ */
63
+ const SubjectId = z.string().min(1).max(180).describe("The subject's own id — a Pithy user id, or the adopter's organization id. Opaque here: payments never resolves it to anything.");
64
+ /**
65
+ * A subject: the pair, as every row carries it and every function takes it.
66
+ *
67
+ * **Passed as this object rather than two positional strings**, deliberately. Two adjacent `string`
68
+ * parameters are two parameters a call site can transpose, and transposing them typechecks. The object
69
+ * makes the halves nameable and inseparable, which is what keeps the invariant — a subject is read from
70
+ * and written to one row atomically, and no code path pairs a type from config with an id from a row.
71
+ */
72
+ const PaymentsSubject = z.object({
73
+ subjectType: PaymentsSubjectType.describe("Whether `subjectId` names a user or an organization."),
74
+ subjectId: SubjectId
75
+ }).describe("Who holds a purchase and the entitlements it grants — a user or an organization, and its id.");
76
+ /**
77
+ * Whether two subjects are the same holder — **both halves, always**.
78
+ *
79
+ * `undefined` is never equal to anything, including another `undefined`. An unresolved owner compared
80
+ * equal to an unresolved owner is how a webhook nobody could attribute would pass an ownership check,
81
+ * and that check is the only thing standing between one customer's renewal and another's account.
82
+ */
83
+ function sameSubject(a, b) {
84
+ if (a === void 0 || b === void 0) return false;
85
+ return a.subjectType === b.subjectType && a.subjectId === b.subjectId;
86
+ }
87
+ /**
88
+ * A subject as one string, for the single-field slots a store gives us — Apple's `appAccountToken`,
89
+ * Google's `obfuscatedAccountId`, Stripe's `client_reference_id`, Paddle's and Lemon Squeezy's custom
90
+ * data.
91
+ *
92
+ * **One encoding, in one function, with one decoder.** These values leave our control and come back
93
+ * through a webhook, so the format is a wire contract with five providers at once. A second encoding
94
+ * anywhere means a purchase stamped by one code path and read by another resolves to nobody — or, worse,
95
+ * to somebody.
96
+ *
97
+ * The type half leads so the string sorts and greps by kind, and so a value that is *not* this encoding
98
+ * is recognizable at a glance in a provider's dashboard.
99
+ */
100
+ function encodeSubjectReference(subject) {
101
+ return `${subject.subjectType}${SUBJECT_REFERENCE_SEPARATOR}${subject.subjectId}`;
102
+ }
103
+ /**
104
+ * The inverse, and **strict**: anything that is not exactly this encoding is `undefined`, never a guess.
105
+ *
106
+ * The input is a value a client put in a purchase and a store handed back, so it may be anything at all.
107
+ * The dangerous shape is a bare id — the format every pre-subject client sent — which a lenient decoder
108
+ * would read as a user, attributing a stranger's purchase to whoever holds that id. So a reference with
109
+ * no separator does not decode, an unknown type half does not decode, and an empty half does not decode.
110
+ * Every caller treats `undefined` as *orphaned*: the event is recorded and replayable, and nothing is
111
+ * granted.
112
+ *
113
+ * Splits on the **first** separator only, so an adopter whose organization ids contain colons round-trips.
114
+ */
115
+ function decodeSubjectReference(reference) {
116
+ const at = reference.indexOf(SUBJECT_REFERENCE_SEPARATOR);
117
+ if (at <= 0) return void 0;
118
+ const parsed = PaymentsSubject.safeParse({
119
+ subjectType: reference.slice(0, at),
120
+ subjectId: reference.slice(at + 1)
121
+ });
122
+ return parsed.success ? parsed.data : void 0;
123
+ }
124
+ //#endregion
125
+ export { MAX_SUBJECT_ID_LENGTH, PaymentsSubject, PaymentsSubjectType, decodeSubjectReference, encodeSubjectReference, sameSubject };