@happyvertical/smrt-subscriptions 0.51.28 → 0.51.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/AGENTS.md CHANGED
@@ -89,7 +89,10 @@ that reverted to DECIMAL passes every SQLite suite.
89
89
  cross-tenant read in evaluation is the bounded `wholesale`-basis sum.
90
90
  - `balance` policies take their limit from `CreditGrant`s; `limitAmount` must
91
91
  be 0, and currency and period are fixed once saved (the ledger is scoped to
92
- them). Auto top-up is a host hook only — no payment provider calls.
92
+ them). Auto top-up is a host hook only — no payment provider calls. The
93
+ evaluator re-reads credit after the hook returns (grant or not) and hands
94
+ it `currentShortfall()`, so a hook that charges asynchronously can see a
95
+ concurrent top-up (smrt-commerce's `autoTopUpHook()`, #3139).
93
96
 
94
97
  ## Notes
95
98
 
package/README.md CHANGED
@@ -110,7 +110,11 @@ Parentage and the billing owner come from `smrt-tenancy`'s
110
110
  and idempotent per `source`/`sourceId`. Pass `autoTopUp` to
111
111
  `SpendingPolicyEvaluator.create()` to be called when a charge would exhaust a
112
112
  balance; return a grant once the host has secured the funds. The evaluator
113
- never calls a payment provider.
113
+ never calls a payment provider. Before charging, a hook can call the
114
+ request's `currentShortfall()` to recompute the shortfall against the
115
+ current balance (another evaluation may have topped it up meanwhile); the
116
+ evaluator re-reads the balance after the hook returns either way.
117
+ smrt-commerce's `BillingRuntime.autoTopUpHook()` charges a saved card.
114
118
 
115
119
  ```ts
116
120
  import { BillingRelationshipService } from '@happyvertical/smrt-tenancy';