@pithy-sh/payments 0.1.4 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (280) hide show
  1. package/dist/admin/coverage.d.ts +2 -0
  2. package/dist/admin/coverage.js +2 -0
  3. package/dist/admin/read.d.ts +2 -0
  4. package/dist/admin/read.js +2 -0
  5. package/dist/audit/actions.d.ts +2 -0
  6. package/dist/audit/actions.js +2 -0
  7. package/dist/capability.d.ts +2 -0
  8. package/dist/capability.d.ts.map +1 -1
  9. package/dist/capability.js +14 -0
  10. package/dist/client/api.d.ts +2 -0
  11. package/dist/client/api.js +2 -0
  12. package/dist/client/checkout.d.ts +2 -0
  13. package/dist/client/checkout.js +2 -0
  14. package/dist/client/fixtures/price-preview-de.js +2 -0
  15. package/dist/client/fixtures/price-preview-gb.js +2 -0
  16. package/dist/client/fixtures/price-preview-jp-yen.js +2 -0
  17. package/dist/client/fixtures/price-preview-us-country-only.js +2 -0
  18. package/dist/client/fixtures/price-preview-us-new-york.js +2 -0
  19. package/dist/client/fixtures/pricePreview.d.ts +2 -0
  20. package/dist/client/fixtures/pricePreview.js +2 -0
  21. package/dist/client/hooks.d.ts +2 -0
  22. package/dist/client/hooks.js +2 -0
  23. package/dist/client/paddle.d.ts +2 -0
  24. package/dist/client/paddle.js +2 -0
  25. package/dist/client/paddleCache.d.ts +2 -0
  26. package/dist/client/paddleCache.js +2 -0
  27. package/dist/client/paddlePrices.d.ts +2 -0
  28. package/dist/client/paddlePrices.js +2 -0
  29. package/dist/client/paddlePricesTag.d.ts +2 -0
  30. package/dist/client/paddlePricesTag.js +2 -0
  31. package/dist/client/projection.d.ts +2 -0
  32. package/dist/client/projection.js +2 -0
  33. package/dist/client/test-utils/cacheStore.d.ts +2 -0
  34. package/dist/client/test-utils/cacheStore.js +2 -0
  35. package/dist/client/wholeUnits.d.ts +2 -0
  36. package/dist/client/wholeUnits.js +2 -0
  37. package/dist/config/config.d.ts +2 -0
  38. package/dist/config/config.js +2 -0
  39. package/dist/data/discount.d.ts +2 -0
  40. package/dist/data/discount.js +2 -0
  41. package/dist/data/entitlement.d.ts +2 -0
  42. package/dist/data/entitlement.js +2 -0
  43. package/dist/data/money.d.ts +2 -0
  44. package/dist/data/money.js +2 -0
  45. package/dist/data/pause.d.ts +2 -0
  46. package/dist/data/pause.js +2 -0
  47. package/dist/data/providerAccount.d.ts +2 -0
  48. package/dist/data/providerAccount.js +2 -0
  49. package/dist/data/purchase.d.ts +2 -0
  50. package/dist/data/purchase.js +2 -0
  51. package/dist/data/rail.d.ts +2 -0
  52. package/dist/data/rail.js +2 -0
  53. package/dist/data/reconcileRun.d.ts +2 -0
  54. package/dist/data/reconcileRun.js +2 -0
  55. package/dist/data/renderMoney.d.ts +2 -0
  56. package/dist/data/renderMoney.js +2 -0
  57. package/dist/data/status.d.ts +2 -0
  58. package/dist/data/status.js +2 -0
  59. package/dist/data/subject.d.ts +2 -0
  60. package/dist/data/subject.js +2 -0
  61. package/dist/data/subscription.d.ts +2 -0
  62. package/dist/data/subscription.js +2 -0
  63. package/dist/data/syncCursor.d.ts +2 -0
  64. package/dist/data/syncCursor.js +2 -0
  65. package/dist/data/tables.d.ts +2 -0
  66. package/dist/data/tables.js +2 -0
  67. package/dist/data/webhookEvent.d.ts +2 -0
  68. package/dist/data/webhookEvent.js +2 -0
  69. package/dist/entitlement/manual.d.ts +2 -0
  70. package/dist/entitlement/manual.js +2 -0
  71. package/dist/entitlement/resolver.d.ts +2 -0
  72. package/dist/entitlement/resolver.js +2 -0
  73. package/dist/entitlement/subjectSeam.d.ts +2 -0
  74. package/dist/entitlement/subjectSeam.js +2 -0
  75. package/dist/entitlement/unimplementedSubject.d.ts +25 -0
  76. package/dist/entitlement/unimplementedSubject.d.ts.map +1 -0
  77. package/dist/entitlement/unimplementedSubject.js +78 -0
  78. package/dist/error/errors.d.ts +2 -0
  79. package/dist/error/errors.js +2 -0
  80. package/dist/grants/apply.d.ts +2 -0
  81. package/dist/grants/apply.js +2 -0
  82. package/dist/grants/clawback.d.ts +2 -0
  83. package/dist/grants/clawback.js +2 -0
  84. package/dist/grants/ledgerSeam.d.ts +2 -0
  85. package/dist/grants/ledgerSeam.js +2 -0
  86. package/dist/http/dispatch.d.ts +2 -0
  87. package/dist/http/dispatch.js +2 -0
  88. package/dist/http/guards.d.ts +2 -0
  89. package/dist/http/guards.js +2 -0
  90. package/dist/http/manifestConfig.d.ts +2 -0
  91. package/dist/http/manifestConfig.js +2 -0
  92. package/dist/http/responses.d.ts +2 -0
  93. package/dist/http/responses.js +2 -0
  94. package/dist/http/routes.d.ts +2 -0
  95. package/dist/http/routes.js +2 -0
  96. package/dist/http/schemas.d.ts +2 -0
  97. package/dist/http/schemas.js +2 -0
  98. package/dist/http/scopes.d.ts +2 -0
  99. package/dist/http/scopes.js +2 -0
  100. package/dist/http/view.d.ts +2 -0
  101. package/dist/http/view.js +2 -0
  102. package/dist/http/webhookGuard.d.ts +2 -0
  103. package/dist/http/webhookGuard.js +2 -0
  104. package/dist/index.d.ts +3 -0
  105. package/dist/index.d.ts.map +1 -1
  106. package/dist/index.js +4 -1
  107. package/dist/migrations/0001_purchases.d.ts +2 -0
  108. package/dist/migrations/0001_purchases.js +2 -0
  109. package/dist/paddle-prices.iife.js +1 -0
  110. package/dist/pricing/location.d.ts +2 -0
  111. package/dist/pricing/location.js +2 -0
  112. package/dist/pricing/visitor.d.ts +2 -0
  113. package/dist/pricing/visitor.js +2 -0
  114. package/dist/projection/event.d.ts +2 -0
  115. package/dist/projection/event.js +2 -0
  116. package/dist/projection/orphans.d.ts +2 -0
  117. package/dist/projection/orphans.js +2 -0
  118. package/dist/projection/owner.d.ts +2 -0
  119. package/dist/projection/owner.js +2 -0
  120. package/dist/projection/resolve.d.ts +2 -0
  121. package/dist/projection/resolve.js +2 -0
  122. package/dist/projection/writer.d.ts +2 -0
  123. package/dist/projection/writer.js +2 -0
  124. package/dist/provision/resolvePaymentsConfig.d.ts +2 -0
  125. package/dist/provision/resolvePaymentsConfig.js +2 -0
  126. package/dist/rails/apple/certs.d.ts +2 -0
  127. package/dist/rails/apple/certs.js +2 -0
  128. package/dist/rails/apple/der.d.ts +2 -0
  129. package/dist/rails/apple/der.js +2 -0
  130. package/dist/rails/apple/fixtures/chain.d.ts +2 -0
  131. package/dist/rails/apple/fixtures/chain.js +2 -0
  132. package/dist/rails/apple/http.d.ts +2 -0
  133. package/dist/rails/apple/http.js +2 -0
  134. package/dist/rails/apple/jws.d.ts +2 -0
  135. package/dist/rails/apple/jws.js +2 -0
  136. package/dist/rails/apple/notification.d.ts +2 -0
  137. package/dist/rails/apple/notification.js +2 -0
  138. package/dist/rails/apple/rail.d.ts +2 -0
  139. package/dist/rails/apple/rail.js +2 -0
  140. package/dist/rails/apple/serverApi.d.ts +2 -0
  141. package/dist/rails/apple/serverApi.js +2 -0
  142. package/dist/rails/apple/verify.d.ts +2 -0
  143. package/dist/rails/apple/verify.js +2 -0
  144. package/dist/rails/apple/x509.d.ts +2 -0
  145. package/dist/rails/apple/x509.js +2 -0
  146. package/dist/rails/contract.d.ts +2 -0
  147. package/dist/rails/contract.js +2 -0
  148. package/dist/rails/google/fixtures/push.d.ts +2 -0
  149. package/dist/rails/google/fixtures/push.js +2 -0
  150. package/dist/rails/google/http.d.ts +2 -0
  151. package/dist/rails/google/http.js +2 -0
  152. package/dist/rails/google/jwt.d.ts +2 -0
  153. package/dist/rails/google/jwt.js +2 -0
  154. package/dist/rails/google/oidc.d.ts +2 -0
  155. package/dist/rails/google/oidc.js +2 -0
  156. package/dist/rails/google/playApi.d.ts +2 -0
  157. package/dist/rails/google/playApi.js +2 -0
  158. package/dist/rails/google/rail.d.ts +2 -0
  159. package/dist/rails/google/rail.js +2 -0
  160. package/dist/rails/google/rtdn.d.ts +2 -0
  161. package/dist/rails/google/rtdn.js +2 -0
  162. package/dist/rails/google/verify.d.ts +2 -0
  163. package/dist/rails/google/verify.js +2 -0
  164. package/dist/rails/lemonSqueezy/api.d.ts +2 -0
  165. package/dist/rails/lemonSqueezy/api.js +2 -0
  166. package/dist/rails/lemonSqueezy/checkout.d.ts +2 -0
  167. package/dist/rails/lemonSqueezy/checkout.js +2 -0
  168. package/dist/rails/lemonSqueezy/discounts.d.ts +2 -0
  169. package/dist/rails/lemonSqueezy/discounts.js +2 -0
  170. package/dist/rails/lemonSqueezy/fixtures/events.d.ts +2 -0
  171. package/dist/rails/lemonSqueezy/fixtures/events.js +2 -0
  172. package/dist/rails/lemonSqueezy/objects.d.ts +2 -0
  173. package/dist/rails/lemonSqueezy/objects.js +2 -0
  174. package/dist/rails/lemonSqueezy/portal.d.ts +2 -0
  175. package/dist/rails/lemonSqueezy/portal.js +2 -0
  176. package/dist/rails/lemonSqueezy/pricing.d.ts +2 -0
  177. package/dist/rails/lemonSqueezy/pricing.js +2 -0
  178. package/dist/rails/lemonSqueezy/rail.d.ts +2 -0
  179. package/dist/rails/lemonSqueezy/rail.js +2 -0
  180. package/dist/rails/lemonSqueezy/read.d.ts +2 -0
  181. package/dist/rails/lemonSqueezy/read.js +2 -0
  182. package/dist/rails/lemonSqueezy/refresh.d.ts +2 -0
  183. package/dist/rails/lemonSqueezy/refresh.js +2 -0
  184. package/dist/rails/lemonSqueezy/signature.d.ts +2 -0
  185. package/dist/rails/lemonSqueezy/signature.js +2 -0
  186. package/dist/rails/lemonSqueezy/verify.d.ts +2 -0
  187. package/dist/rails/lemonSqueezy/verify.js +2 -0
  188. package/dist/rails/lemonSqueezy/webhook.d.ts +2 -0
  189. package/dist/rails/lemonSqueezy/webhook.js +2 -0
  190. package/dist/rails/paddle/adjustments.d.ts +2 -0
  191. package/dist/rails/paddle/adjustments.js +2 -0
  192. package/dist/rails/paddle/api.d.ts +2 -0
  193. package/dist/rails/paddle/api.js +2 -0
  194. package/dist/rails/paddle/checkout.d.ts +2 -0
  195. package/dist/rails/paddle/checkout.js +2 -0
  196. package/dist/rails/paddle/discounts.d.ts +2 -0
  197. package/dist/rails/paddle/discounts.js +2 -0
  198. package/dist/rails/paddle/events.d.ts +2 -0
  199. package/dist/rails/paddle/events.js +2 -0
  200. package/dist/rails/paddle/fixtures/browserForged.d.ts +2 -0
  201. package/dist/rails/paddle/fixtures/browserForged.js +2 -0
  202. package/dist/rails/paddle/fixtures/pausedSubscription.d.ts +2 -0
  203. package/dist/rails/paddle/fixtures/pausedSubscription.js +2 -0
  204. package/dist/rails/paddle/objects.d.ts +2 -0
  205. package/dist/rails/paddle/objects.js +2 -0
  206. package/dist/rails/paddle/portal.d.ts +2 -0
  207. package/dist/rails/paddle/portal.js +2 -0
  208. package/dist/rails/paddle/rail.d.ts +2 -0
  209. package/dist/rails/paddle/rail.js +2 -0
  210. package/dist/rails/paddle/read.d.ts +2 -0
  211. package/dist/rails/paddle/read.js +2 -0
  212. package/dist/rails/paddle/recorded.d.ts +2 -0
  213. package/dist/rails/paddle/recorded.js +2 -0
  214. package/dist/rails/paddle/refresh.d.ts +2 -0
  215. package/dist/rails/paddle/refresh.js +2 -0
  216. package/dist/rails/paddle/refund.d.ts +2 -0
  217. package/dist/rails/paddle/refund.js +2 -0
  218. package/dist/rails/paddle/signature.d.ts +2 -0
  219. package/dist/rails/paddle/signature.js +2 -0
  220. package/dist/rails/paddle/subscription.d.ts +2 -0
  221. package/dist/rails/paddle/subscription.js +2 -0
  222. package/dist/rails/paddle/verify.d.ts +2 -0
  223. package/dist/rails/paddle/verify.js +2 -0
  224. package/dist/rails/paddle/webhook.d.ts +2 -0
  225. package/dist/rails/paddle/webhook.js +2 -0
  226. package/dist/rails/providers.d.ts +2 -0
  227. package/dist/rails/providers.js +2 -0
  228. package/dist/rails/stripe/api.d.ts +2 -0
  229. package/dist/rails/stripe/api.js +2 -0
  230. package/dist/rails/stripe/checkout.d.ts +2 -0
  231. package/dist/rails/stripe/checkout.js +2 -0
  232. package/dist/rails/stripe/discounts.d.ts +2 -0
  233. package/dist/rails/stripe/discounts.js +2 -0
  234. package/dist/rails/stripe/fixtures/events.d.ts +2 -0
  235. package/dist/rails/stripe/fixtures/events.js +2 -0
  236. package/dist/rails/stripe/objects.d.ts +2 -0
  237. package/dist/rails/stripe/objects.js +2 -0
  238. package/dist/rails/stripe/portal.d.ts +2 -0
  239. package/dist/rails/stripe/portal.js +2 -0
  240. package/dist/rails/stripe/pricing.d.ts +2 -0
  241. package/dist/rails/stripe/pricing.js +2 -0
  242. package/dist/rails/stripe/rail.d.ts +2 -0
  243. package/dist/rails/stripe/rail.js +2 -0
  244. package/dist/rails/stripe/refresh.d.ts +2 -0
  245. package/dist/rails/stripe/refresh.js +2 -0
  246. package/dist/rails/stripe/signature.d.ts +2 -0
  247. package/dist/rails/stripe/signature.js +2 -0
  248. package/dist/rails/stripe/verify.d.ts +2 -0
  249. package/dist/rails/stripe/verify.js +2 -0
  250. package/dist/rails/stripe/webhook.d.ts +2 -0
  251. package/dist/rails/stripe/webhook.js +2 -0
  252. package/dist/secret/registry.d.ts +2 -0
  253. package/dist/secret/registry.js +2 -0
  254. package/dist/seeds/example.d.ts +2 -0
  255. package/dist/seeds/example.js +2 -0
  256. package/dist/version.generated.d.ts +3 -1
  257. package/dist/version.generated.js +3 -1
  258. package/dist/workflows/paddleSweep.d.ts +2 -0
  259. package/dist/workflows/paddleSweep.js +2 -0
  260. package/dist/workflows/railAccess.d.ts +2 -0
  261. package/dist/workflows/railAccess.js +2 -0
  262. package/dist/workflows/reconcile.d.ts +2 -0
  263. package/dist/workflows/reconcile.js +2 -0
  264. package/dist/workflows/report.d.ts +2 -0
  265. package/dist/workflows/report.js +2 -0
  266. package/dist/workflows/retryPolicy.d.ts +2 -0
  267. package/dist/workflows/retryPolicy.js +2 -0
  268. package/dist/workflows/specs.d.ts +2 -0
  269. package/dist/workflows/specs.js +2 -0
  270. package/dist/workflows/worker.d.ts +2 -0
  271. package/dist/workflows/worker.js +2 -0
  272. package/dist/workflows/workerConfig.d.ts +2 -0
  273. package/dist/workflows/workerConfig.js +2 -0
  274. package/package.json +5 -5
  275. package/pithy.manifest.json +2 -2
  276. package/src/capability.ts +16 -0
  277. package/src/entitlement/unimplementedSubject.ts +89 -0
  278. package/src/index.ts +8 -0
  279. package/src/version.generated.ts +1 -1
  280. package/src/workflows/paddleSweep.ts +1 -1
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { PaymentsPurchase } from "../../data/purchase";
2
4
  import { SubscriptionChangeQuote, SubscriptionStanding } from "../../data/subscription";
3
5
  import type { PaymentsPaddleCredentials } from "../../secret/registry";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { PaymentsProviderUnavailableError, PaymentsSubscriptionChangeRefusedError } from "../../error/errors.js";
2
4
  import { SubscriptionChangeQuote, SubscriptionStanding } from "../../data/subscription.js";
3
5
  import { paddleHttpFetch, paddleJson } from "./api.js";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { PaymentsPaddleCredentials } from "../../secret/registry";
2
4
  import type { VerifiedPurchase } from "../contract";
3
5
  import type { PaddleEnvironment, PaddleHttpFetch } from "./api";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { PaymentsInvalidReceiptError, PaymentsVerificationFailedError } from "../../error/errors.js";
2
4
  import { PADDLE_CUSTOM_ACCOUNT, accountReferenceOf, transactionEvent } from "./objects.js";
3
5
  import { readTransaction } from "./read.js";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { PaymentsPaddleCredentials } from "../../secret/registry";
2
4
  import type { VerifiedNotification, WebhookDelivery } from "../contract";
3
5
  import type { PaddleEnvironment } from "./api";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { PaymentsRailNotConfiguredError, PaymentsVerificationFailedError } from "../../error/errors.js";
2
4
  import { PaddleAdjustment, PaddleEvent, PaddleSubscription, PaddleTransaction, accountReferenceOf, at, fencedOut, subscriptionEvent, transactionEvent } from "./objects.js";
3
5
  import { RESTORING_ACTIONS, REVOKING_ACTIONS, tallyAdjustments } from "./adjustments.js";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { PaymentsConfig } from "../config/config";
2
4
  import type { PaymentsRail } from "../data/rail";
3
5
  import { type PaymentsProviderCredentials } from "../secret/registry";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { productForProviderSku, railEnabled } from "../config/config.js";
2
4
  import { PaymentsRailNotConfiguredError } from "../error/errors.js";
3
5
  import { railCredentials } from "../secret/registry.js";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  /**
2
4
  * The one door out to Stripe, and the mapping from how it answered to what that means.
3
5
  *
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { PaymentsProviderUnavailableError, PaymentsRailNotConfiguredError } from "../../error/errors.js";
2
4
  import { z } from "zod";
3
5
  //#region src/rails/stripe/api.ts
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { PaymentsStripeCredentials } from "../../secret/registry";
2
4
  import type { CheckoutHandoff, CheckoutSessionInput } from "../contract";
3
5
  import { type StripeHttpFetch } from "./api";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { encodeSubjectReference } from "../../data/subject.js";
2
4
  import { PaymentsDiscountInvalidError, PaymentsProviderUnavailableError } from "../../error/errors.js";
3
5
  import { stripeHttpFetch, stripeJson } from "./api.js";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { CreatedDiscount, DiscountTerms } from "../../data/discount";
2
4
  import type { PaymentsStripeCredentials } from "../../secret/registry";
3
5
  import type { ListedDiscount } from "../contract";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { PaymentsDiscountInvalidError, PaymentsProviderUnavailableError } from "../../error/errors.js";
2
4
  import { stripeHttpFetch, stripeJson } from "./api.js";
3
5
  import { z } from "zod";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { StripeHttpFetch, StripeHttpRequest } from "../api";
2
4
  /**
3
5
  * Test material for Stripe's rail: a known signing secret, a real HMAC over real bytes, and a transport that
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  //#region src/rails/stripe/fixtures/events.ts
2
4
  /**
3
5
  * Test material for Stripe's rail: a known signing secret, a real HMAC over real bytes, and a transport that
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { z } from "zod";
2
4
  import { type PurchaseStatus } from "../../data/status";
3
5
  import type { NotificationNote, UnboundProviderEvent } from "../contract";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { ACCESS_GRANTING_STATUSES } from "../../data/status.js";
2
4
  import { PaymentsVerificationFailedError } from "../../error/errors.js";
3
5
  import { minorUnitDigits, minorUnitsFromScaled } from "../../data/money.js";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { PortalHandoff, PortalSessionInput } from "../contract";
2
4
  import { type StripeCheckoutOptions } from "./checkout";
3
5
  /**
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { stripeHttpFetch, stripeJson } from "./api.js";
2
4
  import { hostedSession } from "./checkout.js";
3
5
  //#region src/rails/stripe/portal.ts
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { SubscriptionPricing } from "../../data/discount";
2
4
  import type { PaymentsPurchase } from "../../data/purchase";
3
5
  import type { PaymentsStripeCredentials } from "../../secret/registry";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { stripeHttpFetch, stripeJson } from "./api.js";
2
4
  import { z } from "zod";
3
5
  //#region src/rails/stripe/pricing.ts
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { PaymentsStripeCredentials } from "../../secret/registry";
2
4
  import type { CheckoutRail, DiscountRail, PaymentsRailProvider, PricingRail } from "../contract";
3
5
  import type { StripeHttpFetch } from "./api";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { StripeEvent, mapStripeEvent } from "./objects.js";
2
4
  import { createStripeCheckoutSession } from "./checkout.js";
3
5
  import { createStripeDiscount, listStripeDiscounts } from "./discounts.js";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { PaymentsPurchase } from "../../data/purchase";
2
4
  import type { PaymentsStripeCredentials } from "../../secret/registry";
3
5
  import type { UnboundProviderEvent } from "../contract";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { PaymentsVerificationFailedError } from "../../error/errors.js";
2
4
  import { stripeHttpFetch, stripeJson } from "./api.js";
3
5
  import { StripeSubscription, mapStripeSubscription } from "./objects.js";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { type SignedWebhookHeader } from "@pithy-sh/core/src/http/signedWebhook";
2
4
  /**
3
5
  * Stripe's authenticity proof: an HMAC over the exact received bytes, dated, in one header.
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { PaymentsVerificationFailedError } from "../../error/errors.js";
2
4
  import { checkSignedWebhook, parseSignedWebhookHeader } from "@pithy-sh/core/src/http/signedWebhook";
3
5
  //#region src/rails/stripe/signature.ts
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { PaymentsStripeCredentials } from "../../secret/registry";
2
4
  import { type VerifiedPurchase } from "../contract";
3
5
  import { type StripeHttpFetch } from "./api";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { PaymentsInvalidReceiptError, PaymentsVerificationFailedError } from "../../error/errors.js";
2
4
  import { noteText } from "../contract.js";
3
5
  import { stripeHttpFetch, stripeJson } from "./api.js";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { PaymentsStripeCredentials } from "../../secret/registry";
2
4
  import type { VerifiedNotification, WebhookDelivery } from "../contract";
3
5
  /**
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { PaymentsVerificationFailedError } from "../../error/errors.js";
2
4
  import { StripeEvent, mapStripeEvent } from "./objects.js";
3
5
  import { STRIPE_SIGNATURE_HEADER, verifyStripeSignature } from "./signature.js";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { z } from "zod";
2
4
  import type { PaymentsRail } from "../data/rail";
3
5
  /**
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { PaymentsRailNotConfiguredError } from "../error/errors.js";
2
4
  import { z } from "zod";
3
5
  import { defineSecretRegistry } from "@pithy-sh/secrets/src/registry";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { type SeedSet } from "@pithy-sh/core/src/seed/seed";
2
4
  export declare const paymentsExampleSeed: SeedSet;
3
5
  //# sourceMappingURL=example.d.ts.map
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { PaymentsEntitlement } from "../data/entitlement.js";
2
4
  import { PaymentsPurchase } from "../data/purchase.js";
3
5
  import { PAYMENTS_ENTITLEMENTS_TABLE, PAYMENTS_PURCHASES_TABLE } from "../data/tables.js";
@@ -1,5 +1,7 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  /** This package's npm name — the join key against a release feed. */
2
4
  export declare const PACKAGE_NAME = "@pithy-sh/payments";
3
5
  /** This package's version, stamped from its own package.json at generation time. */
4
- export declare const PACKAGE_VERSION = "0.1.4";
6
+ export declare const PACKAGE_VERSION = "0.2.0";
5
7
  //# sourceMappingURL=version.generated.d.ts.map
@@ -1,7 +1,9 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  //#region src/version.generated.ts
2
4
  /** This package's npm name — the join key against a release feed. */
3
5
  const PACKAGE_NAME = "@pithy-sh/payments";
4
6
  /** This package's version, stamped from its own package.json at generation time. */
5
- const PACKAGE_VERSION = "0.1.4";
7
+ const PACKAGE_VERSION = "0.2.0";
6
8
  //#endregion
7
9
  export { PACKAGE_NAME, PACKAGE_VERSION };
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { D1Database } from "@cloudflare/workers-types";
2
4
  import type { PaymentsConfig } from "../config/config";
3
5
  import type { PurchaseEnvironment } from "../data/purchase";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { decodeSubjectReference } from "../data/subject.js";
2
4
  import { railEnabled } from "../config/config.js";
3
5
  import { PADDLE_EVENTS_CURSOR, PaymentsSyncCursor } from "../data/syncCursor.js";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { PaymentsConfig } from "../config/config";
2
4
  import type { PaymentsRail } from "../data/rail";
3
5
  import type { PaymentsRailProvider } from "../rails/contract";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { railCredentials } from "../secret/registry.js";
2
4
  import { mintAppleApiToken } from "../rails/apple/serverApi.js";
3
5
  import { mintPlayAccessToken } from "../rails/google/playApi.js";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { D1Database } from "@cloudflare/workers-types";
2
4
  import { type AuditEmit } from "@pithy-sh/core/src/audit/recorder";
3
5
  import type { PaymentsConfig } from "../config/config";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { PaymentsPurchase } from "../data/purchase.js";
2
4
  import { recordReconcileRun } from "../data/reconcileRun.js";
3
5
  import { PAYMENTS_PURCHASES_TABLE, paymentsDatabase } from "../data/tables.js";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { AuditEmit } from "@pithy-sh/core/src/audit/recorder";
2
4
  import type { Logger } from "@pithy-sh/core/src/logger/logger";
3
5
  import type { ReconcileReport } from "./reconcile";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  //#region src/workflows/report.ts
2
4
  /**
3
5
  * What a reconcile pass says about itself: its tally, and each repair it had to make.
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { WorkflowRetryPolicy } from "@pithy-sh/core/src/workflow/faults";
2
4
  /**
3
5
  * **What the reconciliation pass retries, and what it refuses to.**
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  //#region src/workflows/retryPolicy.ts
2
4
  /**
3
5
  * **What the reconciliation pass retries, and what it refuses to.**
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { WorkflowRegistry } from "@pithy-sh/core/src/workflow/spec";
2
4
  import { z } from "zod";
3
5
  /**
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { PaymentsRail } from "../data/rail.js";
2
4
  import { PaymentsSubject } from "../data/subject.js";
3
5
  import { z } from "zod";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { WorkflowEntrypoint, type WorkflowEvent, type WorkflowStep } from "cloudflare:workers";
2
4
  import { type ReconcileReport } from "./reconcile";
3
5
  import { PaymentsReconcileParams } from "./specs";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { PAYMENTS_PROVIDER_SECRET, paymentsSecretsRegistry, railCredentials } from "../secret/registry.js";
2
4
  import { PaymentsReconcileParams } from "./specs.js";
3
5
  import { triggerPaymentsReconcile } from "../http/dispatch.js";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import type { D1Database } from "@cloudflare/workers-types";
2
4
  import type { SecretsStoreEnv } from "@pithy-sh/secrets/src/env/bindings";
3
5
  import { PaymentsConfig } from "../config/config";
@@ -1,3 +1,5 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
1
3
  import { PaymentsConfig } from "../config/config.js";
2
4
  import { InternalError, fromZodError, messageOf } from "@pithy-sh/core/src/error/pithyError";
3
5
  //#region src/workflows/workerConfig.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pithy-sh/payments",
3
- "version": "0.1.4",
3
+ "version": "0.2.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -28,7 +28,7 @@
28
28
  "!src/client/paddlePrices.iife.ts"
29
29
  ],
30
30
  "scripts": {
31
- "build": "tsdown && tsc -p tsconfig.build.json && bun scripts/buildPaddlePrices.ts",
31
+ "build": "tsdown && tsc -p tsconfig.build.json && bun ../../tooling/build/src/stampDeclarations.ts && bun scripts/buildPaddlePrices.ts",
32
32
  "typecheck": "tsc -p tsconfig.json && tsc -p tsconfig.client.json",
33
33
  "test": "vitest run",
34
34
  "test:node": "vitest run --project=node",
@@ -37,7 +37,7 @@
37
37
  "reset": "bun run clean && rm -rf node_modules"
38
38
  },
39
39
  "peerDependencies": {
40
- "@pithy-sh/ledger": "^0.1.3",
40
+ "@pithy-sh/ledger": "^0.1.5",
41
41
  "hono": "^4.13.2",
42
42
  "kysely": "^0.29.0",
43
43
  "react": "^19.0.0",
@@ -55,8 +55,8 @@
55
55
  "@cloudflare/workers-types": "^5.20260729.1",
56
56
  "@hono/zod-validator": "^0.9.0",
57
57
  "@paddle/paddle-js": "^1.6.4",
58
- "@pithy-sh/core": "^0.1.4",
59
- "@pithy-sh/secrets": "^0.1.3"
58
+ "@pithy-sh/core": "^0.2.0",
59
+ "@pithy-sh/secrets": "^0.1.5"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@cloudflare/vitest-plugin": "^1.0.0",
@@ -56,8 +56,8 @@
56
56
  "key": "billingSubject",
57
57
  "choices": ["user", "organization"],
58
58
  "describe": "Who holds a subscription in this project. user \u2014 one person buys, one person is entitled. organization \u2014 a company buys, and everybody in it is entitled. It keys the entitlement column and its UNIQUE index, so changing it once anybody has subscribed is a migration, not an edit.",
59
- "choicesNeedingCode": {
60
- "organization": "It needs a `resolveSubject` seam saying which organization a caller is acting for, and `pithy add` writes JSON, not functions. Add payments with --set billingSubject=user, then in this Worker's pithy.config.ts change it to \"organization\" and pass `resolveSubject` \u2014 see @pithy-sh/payments' README."
59
+ "choicesNeedingSeam": {
60
+ "organization": "paymentsSubject"
61
61
  }
62
62
  },
63
63
  {
package/src/capability.ts CHANGED
@@ -17,6 +17,7 @@ import { PaymentsConfig, type PaymentsConfigInput } from "./config/config";
17
17
  import { paymentsTables } from "./data/tables";
18
18
  import { installEntitlementResolver } from "./entitlement/resolver";
19
19
  import type { PaymentsSubjectResolver, PaymentsSubjectSeam } from "./entitlement/subjectSeam";
20
+ import { requireImplementedSubject } from "./entitlement/unimplementedSubject";
20
21
  import { paymentsManifestConfig } from "./http/manifestConfig";
21
22
  import { registerPaymentsRoutes } from "./http/routes";
22
23
  import { paymentsAdminRoutes } from "./http/scopes";
@@ -156,6 +157,16 @@ function checkLedgerGrants({ capabilities }: CapabilityComposeContext, config: P
156
157
  * request that ever works, so there is nothing to lose by refusing to boot, and a Worker that boots into
157
158
  * that state is one whose first symptom is a support ticket from a paying company.
158
159
  */
160
+ /**
161
+ * **An unimplemented resolver is not an absent one, and this check is deliberately blind to the
162
+ * difference.** `pithy add payments --set billingSubject=organization` scaffolds
163
+ * `src/billing/subject.ts` exporting a placeholder branded unimplemented, and passes it here. It is a
164
+ * resolver, so this returns — which it must, because `payments()` runs every time a Worker's
165
+ * `pithy.config.ts` is evaluated and the CLI evaluates it on nearly every command. Refusing the
166
+ * placeholder here would leave the adopter with no `pithy` at all in the project the scaffold just landed
167
+ * in. `requireImplementedSubject`, on the capability's `boot` hook, is where the placeholder is refused —
168
+ * `createEntrypoint` runs it and nothing else does, so the Worker still will not serve (#500).
169
+ */
159
170
  function requireResolvableSubject(config: PaymentsConfig, resolveSubject: PaymentsSubjectResolver | undefined): void {
160
171
  if (config.billingSubject !== "organization" || resolveSubject !== undefined) return;
161
172
  throw new ValidationError({
@@ -338,6 +349,11 @@ export function payments(options: PaymentsOptions): PaymentsCapability {
338
349
  // The one thing this capability cannot check on its own: whether the ledger it credits agrees the
339
350
  // currency exists. See `checkLedgerGrants` for why the failure is otherwise invisible.
340
351
  compose: (context) => checkLedgerGrants(context, resolved),
352
+ // The other half of {@link requireResolvableSubject}, and it is at the entrypoint rather than at
353
+ // composition on purpose: `pithy add` scaffolds an unimplemented `resolveSubject`, and every `pithy`
354
+ // command evaluates this config to learn what the Worker composes. Refusing here refuses the Worker
355
+ // and leaves the toolchain that fixes it working. See `entitlement/unimplementedSubject.ts`.
356
+ boot: () => requireImplementedSubject(resolveSubject),
341
357
  // What a browser may know. See `clientProjection` for why the list is what it is.
342
358
  client: ({ environment }): PaymentsClientProjection => clientProjection(resolved, environment),
343
359
  requiredBindings,
@@ -0,0 +1,89 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
3
+
4
+ import { InternalError, ValidationError } from "@pithy-sh/core/src/error/pithyError";
5
+ import type { PaymentsSubjectResolver } from "./subjectSeam";
6
+
7
+ /**
8
+ * The placeholder `pithy add payments --set billingSubject=organization` scaffolds, and the brand that
9
+ * makes it recognizably unfinished.
10
+ *
11
+ * ## Why a placeholder is safe here and a stub never is
12
+ *
13
+ * A stub is a resolver that *answers*. Returning `undefined` composes cleanly, satisfies every check the
14
+ * capability can make, and then denies every entitlement gate and raises `payments/subject_unresolved` on
15
+ * every write — which is indistinguishable from a customer who has not paid, and whose first symptom is a
16
+ * support ticket from a paying company. That is strictly worse than refusing to write the config at all,
17
+ * and it is why `pithy add` refused `organization` outright for as long as a stub was the only thing it
18
+ * could have written (#483).
19
+ *
20
+ * This answers nothing. It is a **marked absence**: a function carrying {@link UNIMPLEMENTED_SUBJECT},
21
+ * which `payments()` reads at the Worker's entrypoint and refuses to boot on. So the two facts that used
22
+ * to be in tension both hold — the adopter states `organization`, which is what they mean, and the Worker
23
+ * still will not serve a request until somebody has written the resolver (#500).
24
+ *
25
+ * ## Why the check is at the entrypoint and not at composition
26
+ *
27
+ * `payments()` runs whenever a Worker's `pithy.config.ts` is *evaluated*, and the CLI evaluates that
28
+ * module on nearly every command — `loadWorkerConfig` is how `migrate`, `deploy`, `doctor`, `upgrade` and
29
+ * `add` itself learn what a Worker composes. A refusal at composition would therefore brick the whole CLI
30
+ * in the adopter's project the moment the scaffold landed, which is exactly the #483 regression turned
31
+ * inside out. `createEntrypoint` is the one seam the CLI never crosses: only the Worker's own
32
+ * `src/index.ts` calls it. So the composition check stays what it was — an **absent** resolver is refused,
33
+ * unchanged — and the unimplemented one is refused one seam later, where the audience is a request.
34
+ */
35
+
36
+ /**
37
+ * The brand. `Symbol.for` rather than a module-local symbol or function identity: a project that ends up
38
+ * with two copies of `@pithy-sh/payments` resolved (a transitive range that did not dedupe) would compare
39
+ * a placeholder from one copy against the marker from the other, and identity would answer no — booting a
40
+ * Worker that denies every gate, which is the one outcome this file exists to prevent. A registered symbol
41
+ * is the same symbol in both copies.
42
+ */
43
+ const UNIMPLEMENTED_SUBJECT = Symbol.for("@pithy-sh/payments/unimplemented-subject");
44
+
45
+ /**
46
+ * The scaffolded resolver: branded unimplemented, and a throw if anything ever calls it.
47
+ *
48
+ * A throw rather than `undefined`, and it is belt and braces rather than the mechanism — {@link
49
+ * requireImplementedSubject} means a deployed Worker never gets here. What it covers is every other way
50
+ * this function could be reached: a test composing the capability directly, a tool that assembles a
51
+ * backend without an entrypoint (`pithy ui` reads the composed route tree that way), an adopter who
52
+ * imported the placeholder somewhere of their own. In all of them a loud failure is the right answer and a
53
+ * quiet `undefined` is the failure mode of the stub this replaces.
54
+ */
55
+ export const unimplementedSubject: PaymentsSubjectResolver = Object.defineProperty(
56
+ async () => {
57
+ throw new InternalError({
58
+ message: "The subject resolver for this project has not been written.",
59
+ action: "Implement resolveSubject in this Worker's src/billing/subject.ts.",
60
+ detail:
61
+ 'pithy add scaffolded an unimplemented resolveSubject and it is still the one composed. Under billingSubject: "organization" only the application can say which organization a caller is acting for.',
62
+ });
63
+ },
64
+ UNIMPLEMENTED_SUBJECT,
65
+ { value: true },
66
+ ) as PaymentsSubjectResolver;
67
+
68
+ /** Whether this resolver is the scaffolded placeholder rather than something the adopter wrote. */
69
+ export function isUnimplementedSubject(resolver: PaymentsSubjectResolver | undefined): boolean {
70
+ return resolver !== undefined && (resolver as unknown as Record<symbol, unknown>)[UNIMPLEMENTED_SUBJECT] === true;
71
+ }
72
+
73
+ /**
74
+ * Refuse a Worker whose subject resolver is still the scaffolded placeholder.
75
+ *
76
+ * Called from the capability's `boot` hook, which `createEntrypoint` runs and nothing else does. The
77
+ * message is the adopter's next action and nothing else: the file is named, the question it has to answer
78
+ * is stated, and the alternative is the other billing mode.
79
+ */
80
+ export function requireImplementedSubject(resolver: PaymentsSubjectResolver | undefined): void {
81
+ if (!isUnimplementedSubject(resolver)) return;
82
+ throw new ValidationError({
83
+ message: "This project bills organizations, and its subject resolver is still the scaffolded placeholder.",
84
+ action:
85
+ 'Implement resolveSubject in this Worker\'s src/billing/subject.ts, or set `billingSubject: "user"` in pithy.config.ts.',
86
+ detail:
87
+ "pithy add wrote src/billing/subject.ts exporting an unimplemented resolveSubject, and it is unchanged. Payments has no members table and never guesses a holder, so booting on it would deny every entitlement gate and raise payments/subject_unresolved on every write, for every caller, forever.",
88
+ });
89
+ }
package/src/index.ts CHANGED
@@ -105,6 +105,14 @@ export {
105
105
  requirePaymentsSubject,
106
106
  resolvePaymentsSubject,
107
107
  } from "./entitlement/subjectSeam";
108
+ // The scaffolded placeholder, here beside the resolver type for the same reason that type is: the module
109
+ // `pithy add` writes into `apps/<worker>/src/billing/subject.ts` imports both, and a file the adopter is
110
+ // meant to edit should not reach past the package's documented entrypoint to do it.
111
+ export {
112
+ isUnimplementedSubject,
113
+ requireImplementedSubject,
114
+ unimplementedSubject,
115
+ } from "./entitlement/unimplementedSubject";
108
116
  export {
109
117
  type AppliedGrant,
110
118
  applyGrants,
@@ -13,4 +13,4 @@
13
13
  export const PACKAGE_NAME = "@pithy-sh/payments";
14
14
 
15
15
  /** This package's version, stamped from its own package.json at generation time. */
16
- export const PACKAGE_VERSION = "0.1.4";
16
+ export const PACKAGE_VERSION = "0.2.0";
@@ -289,7 +289,7 @@ async function record(
289
289
  id: stored?.id ?? row.id,
290
290
  fresh: stored === undefined || isWebhookEventOutstanding(webhookEventState(stored)),
291
291
  // The column is `NOT NULL DEFAULT 0`; the coalesce covers the row this call just inserted being read
292
- // back before the default is materialised, and a row the webhook path wrote before the column existed.
292
+ // back before the default is materialized, and a row the webhook path wrote before the column existed.
293
293
  attempts: stored?.attempts ?? 0,
294
294
  };
295
295
  }