@zonastery/bursar 0.0.2 → 1.0.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 (493) hide show
  1. package/README.md +85 -344
  2. package/dist/billing/auto-recharge-port.d.ts +27 -0
  3. package/dist/billing/auto-recharge-port.d.ts.map +1 -0
  4. package/dist/billing/auto-recharge-port.js +2 -0
  5. package/dist/billing/auto-recharge-port.js.map +1 -0
  6. package/dist/billing/auto-recharge-service.d.ts +43 -0
  7. package/dist/billing/auto-recharge-service.d.ts.map +1 -0
  8. package/dist/billing/auto-recharge-service.js +218 -0
  9. package/dist/billing/auto-recharge-service.js.map +1 -0
  10. package/dist/billing/billing-service.d.ts +71 -0
  11. package/dist/billing/billing-service.d.ts.map +1 -0
  12. package/dist/billing/billing-service.js +172 -0
  13. package/dist/billing/billing-service.js.map +1 -0
  14. package/dist/billing/billing-store.d.ts +45 -13
  15. package/dist/billing/billing-store.d.ts.map +1 -1
  16. package/dist/billing/billing-store.js.map +1 -1
  17. package/dist/billing/contracts.d.ts +149 -0
  18. package/dist/billing/contracts.d.ts.map +1 -0
  19. package/dist/billing/contracts.js +2 -0
  20. package/dist/billing/contracts.js.map +1 -0
  21. package/dist/billing/event-handlers.d.ts +57 -0
  22. package/dist/billing/event-handlers.d.ts.map +1 -0
  23. package/dist/billing/event-handlers.js +667 -0
  24. package/dist/billing/event-handlers.js.map +1 -0
  25. package/dist/billing/event-processor.d.ts +19 -0
  26. package/dist/billing/event-processor.d.ts.map +1 -0
  27. package/dist/billing/event-processor.js +105 -0
  28. package/dist/billing/event-processor.js.map +1 -0
  29. package/dist/billing/financial-event-handlers.d.ts +26 -0
  30. package/dist/billing/financial-event-handlers.d.ts.map +1 -0
  31. package/dist/billing/financial-event-handlers.js +241 -0
  32. package/dist/billing/financial-event-handlers.js.map +1 -0
  33. package/dist/billing/index.d.ts +8 -5
  34. package/dist/billing/index.d.ts.map +1 -1
  35. package/dist/billing/index.js +4 -4
  36. package/dist/billing/index.js.map +1 -1
  37. package/dist/billing/management.d.ts +59 -0
  38. package/dist/billing/management.d.ts.map +1 -0
  39. package/dist/billing/management.js +113 -0
  40. package/dist/billing/management.js.map +1 -0
  41. package/dist/billing/policy-window.d.ts +24 -0
  42. package/dist/billing/policy-window.d.ts.map +1 -0
  43. package/dist/billing/policy-window.js +88 -0
  44. package/dist/billing/policy-window.js.map +1 -0
  45. package/dist/billing/postgres/repositories/auto-recharge.d.ts +32 -0
  46. package/dist/billing/postgres/repositories/auto-recharge.d.ts.map +1 -0
  47. package/dist/billing/postgres/repositories/auto-recharge.js +178 -0
  48. package/dist/billing/postgres/repositories/auto-recharge.js.map +1 -0
  49. package/dist/billing/postgres/repositories/customer.d.ts +12 -0
  50. package/dist/billing/postgres/repositories/customer.d.ts.map +1 -0
  51. package/dist/billing/postgres/repositories/customer.js +33 -0
  52. package/dist/billing/postgres/repositories/customer.js.map +1 -0
  53. package/dist/billing/postgres/repositories/dispute.d.ts +7 -0
  54. package/dist/billing/postgres/repositories/dispute.d.ts.map +1 -0
  55. package/dist/billing/postgres/repositories/dispute.js +18 -0
  56. package/dist/billing/postgres/repositories/dispute.js.map +1 -0
  57. package/dist/billing/postgres/repositories/event.d.ts +21 -0
  58. package/dist/billing/postgres/repositories/event.d.ts.map +1 -0
  59. package/dist/billing/postgres/repositories/event.js +47 -0
  60. package/dist/billing/postgres/repositories/event.js.map +1 -0
  61. package/dist/billing/postgres/repositories/invoice.d.ts +9 -0
  62. package/dist/billing/postgres/repositories/invoice.d.ts.map +1 -0
  63. package/dist/billing/postgres/repositories/invoice.js +36 -0
  64. package/dist/billing/postgres/repositories/invoice.js.map +1 -0
  65. package/dist/billing/postgres/repositories/offer.d.ts +26 -0
  66. package/dist/billing/postgres/repositories/offer.d.ts.map +1 -0
  67. package/dist/billing/postgres/repositories/offer.js +73 -0
  68. package/dist/billing/postgres/repositories/offer.js.map +1 -0
  69. package/dist/billing/postgres/repositories/payment.d.ts +32 -0
  70. package/dist/billing/postgres/repositories/payment.d.ts.map +1 -0
  71. package/dist/billing/postgres/repositories/payment.js +78 -0
  72. package/dist/billing/postgres/repositories/payment.js.map +1 -0
  73. package/dist/billing/postgres/repositories/preferences.d.ts +15 -0
  74. package/dist/billing/postgres/repositories/preferences.d.ts.map +1 -0
  75. package/dist/billing/postgres/repositories/preferences.js +23 -0
  76. package/dist/billing/postgres/repositories/preferences.js.map +1 -0
  77. package/dist/billing/postgres/repositories/refund.d.ts +7 -0
  78. package/dist/billing/postgres/repositories/refund.d.ts.map +1 -0
  79. package/dist/billing/postgres/repositories/refund.js +32 -0
  80. package/dist/billing/postgres/repositories/refund.js.map +1 -0
  81. package/dist/billing/postgres/repositories/subscription.d.ts +46 -0
  82. package/dist/billing/postgres/repositories/subscription.d.ts.map +1 -0
  83. package/dist/billing/postgres/repositories/subscription.js +187 -0
  84. package/dist/billing/postgres/repositories/subscription.js.map +1 -0
  85. package/dist/billing/postgres/repositories/topup.d.ts +27 -0
  86. package/dist/billing/postgres/repositories/topup.d.ts.map +1 -0
  87. package/dist/billing/postgres/repositories/topup.js +51 -0
  88. package/dist/billing/postgres/repositories/topup.js.map +1 -0
  89. package/dist/billing/postgres/store.d.ts +87 -0
  90. package/dist/billing/postgres/store.d.ts.map +1 -0
  91. package/dist/billing/postgres/store.js +527 -0
  92. package/dist/billing/postgres/store.js.map +1 -0
  93. package/dist/billing/service-types.d.ts +37 -0
  94. package/dist/billing/service-types.d.ts.map +1 -0
  95. package/dist/billing/service-types.js +2 -0
  96. package/dist/billing/service-types.js.map +1 -0
  97. package/dist/billing/types/auto-recharge.d.ts +56 -0
  98. package/dist/billing/types/auto-recharge.d.ts.map +1 -0
  99. package/dist/billing/types/auto-recharge.js +2 -0
  100. package/dist/billing/types/auto-recharge.js.map +1 -0
  101. package/dist/billing/types/catalog.d.ts +47 -0
  102. package/dist/billing/types/catalog.d.ts.map +1 -0
  103. package/dist/billing/types/catalog.js +2 -0
  104. package/dist/billing/types/catalog.js.map +1 -0
  105. package/dist/billing/types/common.d.ts +16 -0
  106. package/dist/billing/types/common.d.ts.map +1 -0
  107. package/dist/billing/types/common.js +2 -0
  108. package/dist/billing/types/common.js.map +1 -0
  109. package/dist/billing/types/documents.d.ts +39 -0
  110. package/dist/billing/types/documents.d.ts.map +1 -0
  111. package/dist/billing/types/documents.js +2 -0
  112. package/dist/billing/types/documents.js.map +1 -0
  113. package/dist/billing/types/events.d.ts +75 -0
  114. package/dist/billing/types/events.d.ts.map +1 -0
  115. package/dist/billing/types/events.js +38 -0
  116. package/dist/billing/types/events.js.map +1 -0
  117. package/dist/billing/types/index.d.ts +8 -0
  118. package/dist/billing/types/index.d.ts.map +1 -0
  119. package/dist/billing/types/index.js +8 -0
  120. package/dist/billing/types/index.js.map +1 -0
  121. package/dist/billing/types/preferences.d.ts +13 -0
  122. package/dist/billing/types/preferences.d.ts.map +1 -0
  123. package/dist/billing/types/preferences.js +2 -0
  124. package/dist/billing/types/preferences.js.map +1 -0
  125. package/dist/billing/types/subscriptions.d.ts +97 -0
  126. package/dist/billing/types/subscriptions.d.ts.map +1 -0
  127. package/dist/billing/types/subscriptions.js +12 -0
  128. package/dist/billing/types/subscriptions.js.map +1 -0
  129. package/dist/breakdown.d.ts +3 -1
  130. package/dist/breakdown.d.ts.map +1 -1
  131. package/dist/breakdown.js +4 -1
  132. package/dist/breakdown.js.map +1 -1
  133. package/dist/browser.d.ts +8 -0
  134. package/dist/browser.d.ts.map +1 -0
  135. package/dist/browser.js +7 -0
  136. package/dist/browser.js.map +1 -0
  137. package/dist/bursar.d.ts +80 -0
  138. package/dist/bursar.d.ts.map +1 -0
  139. package/dist/bursar.js +129 -0
  140. package/dist/bursar.js.map +1 -0
  141. package/dist/catalog.d.ts +61 -0
  142. package/dist/catalog.d.ts.map +1 -0
  143. package/dist/catalog.js +95 -0
  144. package/dist/catalog.js.map +1 -0
  145. package/dist/commerce/errors.d.ts +69 -0
  146. package/dist/commerce/errors.d.ts.map +1 -0
  147. package/dist/commerce/errors.js +107 -0
  148. package/dist/commerce/errors.js.map +1 -0
  149. package/dist/commerce/index.d.ts +6 -0
  150. package/dist/commerce/index.d.ts.map +1 -0
  151. package/dist/commerce/index.js +6 -0
  152. package/dist/commerce/index.js.map +1 -0
  153. package/dist/commerce/plan-change.d.ts +10 -0
  154. package/dist/commerce/plan-change.d.ts.map +1 -0
  155. package/dist/commerce/plan-change.js +42 -0
  156. package/dist/commerce/plan-change.js.map +1 -0
  157. package/dist/commerce/provider-registry.d.ts +18 -0
  158. package/dist/commerce/provider-registry.d.ts.map +1 -0
  159. package/dist/commerce/provider-registry.js +70 -0
  160. package/dist/commerce/provider-registry.js.map +1 -0
  161. package/dist/commerce/service.d.ts +73 -0
  162. package/dist/commerce/service.d.ts.map +1 -0
  163. package/dist/commerce/service.js +981 -0
  164. package/dist/commerce/service.js.map +1 -0
  165. package/dist/commerce/types.d.ts +217 -0
  166. package/dist/commerce/types.d.ts.map +1 -0
  167. package/dist/commerce/types.js.map +1 -0
  168. package/dist/config/parse-access.d.ts +6 -0
  169. package/dist/config/parse-access.d.ts.map +1 -0
  170. package/dist/config/parse-access.js +72 -0
  171. package/dist/config/parse-access.js.map +1 -0
  172. package/dist/config/parse-commerce.d.ts +3 -0
  173. package/dist/config/parse-commerce.d.ts.map +1 -0
  174. package/dist/config/parse-commerce.js +236 -0
  175. package/dist/config/parse-commerce.js.map +1 -0
  176. package/dist/config/parse-credits.d.ts +3 -0
  177. package/dist/config/parse-credits.d.ts.map +1 -0
  178. package/dist/config/parse-credits.js +99 -0
  179. package/dist/config/parse-credits.js.map +1 -0
  180. package/dist/config/parse-plans.d.ts +5 -0
  181. package/dist/config/parse-plans.d.ts.map +1 -0
  182. package/dist/config/parse-plans.js +126 -0
  183. package/dist/config/parse-plans.js.map +1 -0
  184. package/dist/config/parse-pricing.d.ts +4 -0
  185. package/dist/config/parse-pricing.d.ts.map +1 -0
  186. package/dist/config/parse-pricing.js +252 -0
  187. package/dist/config/parse-pricing.js.map +1 -0
  188. package/dist/config/parse-utils.d.ts +18 -0
  189. package/dist/config/parse-utils.d.ts.map +1 -0
  190. package/dist/config/parse-utils.js +118 -0
  191. package/dist/config/parse-utils.js.map +1 -0
  192. package/dist/config/types.d.ts +327 -0
  193. package/dist/config/types.d.ts.map +1 -0
  194. package/dist/config/types.js +2 -0
  195. package/dist/config/types.js.map +1 -0
  196. package/dist/config.d.ts +6 -23
  197. package/dist/config.d.ts.map +1 -1
  198. package/dist/config.js +86 -385
  199. package/dist/config.js.map +1 -1
  200. package/dist/{stores → credits}/events.d.ts +6 -6
  201. package/dist/credits/events.d.ts.map +1 -0
  202. package/dist/{stores → credits}/events.js +5 -5
  203. package/dist/credits/events.js.map +1 -0
  204. package/dist/credits/lease-workflow.d.ts +90 -0
  205. package/dist/credits/lease-workflow.d.ts.map +1 -0
  206. package/dist/credits/lease-workflow.js +378 -0
  207. package/dist/credits/lease-workflow.js.map +1 -0
  208. package/dist/credits/low-balance-monitor.d.ts +26 -0
  209. package/dist/credits/low-balance-monitor.d.ts.map +1 -0
  210. package/dist/credits/low-balance-monitor.js +110 -0
  211. package/dist/credits/low-balance-monitor.js.map +1 -0
  212. package/dist/credits/postgres/repositories/analytics.d.ts +77 -0
  213. package/dist/credits/postgres/repositories/analytics.d.ts.map +1 -0
  214. package/dist/credits/postgres/repositories/analytics.js +151 -0
  215. package/dist/credits/postgres/repositories/analytics.js.map +1 -0
  216. package/dist/credits/postgres/repositories/balance.d.ts +66 -0
  217. package/dist/credits/postgres/repositories/balance.d.ts.map +1 -0
  218. package/dist/credits/postgres/repositories/balance.js +139 -0
  219. package/dist/credits/postgres/repositories/balance.js.map +1 -0
  220. package/dist/credits/postgres/repositories/bucket.d.ts +25 -0
  221. package/dist/credits/postgres/repositories/bucket.d.ts.map +1 -0
  222. package/dist/credits/postgres/repositories/bucket.js +52 -0
  223. package/dist/credits/postgres/repositories/bucket.js.map +1 -0
  224. package/dist/credits/postgres/repositories/deduction.d.ts +55 -0
  225. package/dist/credits/postgres/repositories/deduction.d.ts.map +1 -0
  226. package/dist/credits/postgres/repositories/deduction.js +130 -0
  227. package/dist/credits/postgres/repositories/deduction.js.map +1 -0
  228. package/dist/credits/postgres/repositories/lease.d.ts +69 -0
  229. package/dist/credits/postgres/repositories/lease.d.ts.map +1 -0
  230. package/dist/credits/postgres/repositories/lease.js +148 -0
  231. package/dist/credits/postgres/repositories/lease.js.map +1 -0
  232. package/dist/credits/postgres/repositories/plan.d.ts +105 -0
  233. package/dist/credits/postgres/repositories/plan.d.ts.map +1 -0
  234. package/dist/credits/postgres/repositories/plan.js +182 -0
  235. package/dist/credits/postgres/repositories/plan.js.map +1 -0
  236. package/dist/credits/postgres/repositories/pricing.d.ts +28 -0
  237. package/dist/credits/postgres/repositories/pricing.d.ts.map +1 -0
  238. package/dist/credits/postgres/repositories/pricing.js +70 -0
  239. package/dist/credits/postgres/repositories/pricing.js.map +1 -0
  240. package/dist/credits/postgres/repositories/team.d.ts +63 -0
  241. package/dist/credits/postgres/repositories/team.d.ts.map +1 -0
  242. package/dist/credits/postgres/repositories/team.js +120 -0
  243. package/dist/credits/postgres/repositories/team.js.map +1 -0
  244. package/dist/credits/postgres/store.d.ts +84 -0
  245. package/dist/credits/postgres/store.d.ts.map +1 -0
  246. package/dist/credits/postgres/store.js +765 -0
  247. package/dist/credits/postgres/store.js.map +1 -0
  248. package/dist/credits/postgres/value-mappers.d.ts +17 -0
  249. package/dist/credits/postgres/value-mappers.d.ts.map +1 -0
  250. package/dist/credits/postgres/value-mappers.js +98 -0
  251. package/dist/credits/postgres/value-mappers.js.map +1 -0
  252. package/dist/credits/pricing-runtime.d.ts +34 -0
  253. package/dist/credits/pricing-runtime.d.ts.map +1 -0
  254. package/dist/credits/pricing-runtime.js +141 -0
  255. package/dist/credits/pricing-runtime.js.map +1 -0
  256. package/dist/credits/queries.d.ts +33 -0
  257. package/dist/credits/queries.d.ts.map +1 -0
  258. package/dist/credits/queries.js +71 -0
  259. package/dist/credits/queries.js.map +1 -0
  260. package/dist/credits/service-errors.d.ts +4 -0
  261. package/dist/credits/service-errors.d.ts.map +1 -0
  262. package/dist/credits/service-errors.js +57 -0
  263. package/dist/credits/service-errors.js.map +1 -0
  264. package/dist/credits/service-types.d.ts +122 -0
  265. package/dist/credits/service-types.d.ts.map +1 -0
  266. package/dist/credits/service-types.js +2 -0
  267. package/dist/credits/service-types.js.map +1 -0
  268. package/dist/credits/service.d.ts +207 -0
  269. package/dist/credits/service.d.ts.map +1 -0
  270. package/dist/credits/service.js +594 -0
  271. package/dist/credits/service.js.map +1 -0
  272. package/dist/credits/store.d.ts +167 -0
  273. package/dist/credits/store.d.ts.map +1 -0
  274. package/dist/{stores/credit-store.js → credits/store.js} +23 -43
  275. package/dist/credits/store.js.map +1 -0
  276. package/dist/credits/types/account.d.ts +82 -0
  277. package/dist/credits/types/account.d.ts.map +1 -0
  278. package/dist/credits/types/account.js +2 -0
  279. package/dist/credits/types/account.js.map +1 -0
  280. package/dist/credits/types/admission.d.ts +39 -0
  281. package/dist/credits/types/admission.d.ts.map +1 -0
  282. package/dist/credits/types/admission.js +2 -0
  283. package/dist/credits/types/admission.js.map +1 -0
  284. package/dist/credits/types/analytics.d.ts +52 -0
  285. package/dist/credits/types/analytics.d.ts.map +1 -0
  286. package/dist/credits/types/analytics.js +2 -0
  287. package/dist/credits/types/analytics.js.map +1 -0
  288. package/dist/credits/types/catalog.d.ts +69 -0
  289. package/dist/credits/types/catalog.d.ts.map +1 -0
  290. package/dist/credits/types/catalog.js +2 -0
  291. package/dist/credits/types/catalog.js.map +1 -0
  292. package/dist/credits/types/grants.d.ts +24 -0
  293. package/dist/credits/types/grants.d.ts.map +1 -0
  294. package/dist/credits/types/grants.js +2 -0
  295. package/dist/credits/types/grants.js.map +1 -0
  296. package/dist/credits/types/index.d.ts +9 -0
  297. package/dist/credits/types/index.d.ts.map +1 -0
  298. package/dist/credits/types/index.js +2 -0
  299. package/dist/credits/types/index.js.map +1 -0
  300. package/dist/credits/types/ledger.d.ts +77 -0
  301. package/dist/credits/types/ledger.d.ts.map +1 -0
  302. package/dist/credits/types/ledger.js +2 -0
  303. package/dist/credits/types/ledger.js.map +1 -0
  304. package/dist/credits/types/quotas.d.ts +40 -0
  305. package/dist/credits/types/quotas.d.ts.map +1 -0
  306. package/dist/credits/types/quotas.js +2 -0
  307. package/dist/credits/types/quotas.js.map +1 -0
  308. package/dist/credits/types/teams.d.ts +44 -0
  309. package/dist/credits/types/teams.d.ts.map +1 -0
  310. package/dist/credits/types/teams.js +2 -0
  311. package/dist/credits/types/teams.js.map +1 -0
  312. package/dist/engine.d.ts +18 -39
  313. package/dist/engine.d.ts.map +1 -1
  314. package/dist/engine.js +169 -145
  315. package/dist/engine.js.map +1 -1
  316. package/dist/errors.d.ts +84 -25
  317. package/dist/errors.d.ts.map +1 -1
  318. package/dist/errors.js +117 -24
  319. package/dist/errors.js.map +1 -1
  320. package/dist/expr/ast.d.ts +46 -0
  321. package/dist/expr/ast.d.ts.map +1 -0
  322. package/dist/expr/ast.js +18 -0
  323. package/dist/expr/ast.js.map +1 -0
  324. package/dist/expr/evaluator.d.ts +4 -0
  325. package/dist/expr/evaluator.d.ts.map +1 -0
  326. package/dist/expr/evaluator.js +144 -0
  327. package/dist/expr/evaluator.js.map +1 -0
  328. package/dist/expr/language.d.ts +5 -0
  329. package/dist/expr/language.d.ts.map +1 -0
  330. package/dist/expr/language.js +73 -0
  331. package/dist/expr/language.js.map +1 -0
  332. package/dist/expr/parser.d.ts +24 -0
  333. package/dist/expr/parser.d.ts.map +1 -0
  334. package/dist/expr/parser.js +175 -0
  335. package/dist/expr/parser.js.map +1 -0
  336. package/dist/expr/tokenizer.d.ts +7 -0
  337. package/dist/expr/tokenizer.d.ts.map +1 -0
  338. package/dist/expr/tokenizer.js +85 -0
  339. package/dist/expr/tokenizer.js.map +1 -0
  340. package/dist/expr.d.ts +7 -58
  341. package/dist/expr.d.ts.map +1 -1
  342. package/dist/expr.js +41 -640
  343. package/dist/expr.js.map +1 -1
  344. package/dist/generated/pricing-config.schema.json +2764 -0
  345. package/dist/generated/pricing-config.types.d.ts +674 -0
  346. package/dist/generated/pricing-config.types.d.ts.map +1 -0
  347. package/dist/generated/pricing-config.types.js +8 -0
  348. package/dist/generated/pricing-config.types.js.map +1 -0
  349. package/dist/index.d.ts +21 -17
  350. package/dist/index.d.ts.map +1 -1
  351. package/dist/index.js +12 -10
  352. package/dist/index.js.map +1 -1
  353. package/dist/load-pricing-file.d.ts.map +1 -1
  354. package/dist/load-pricing-file.js.map +1 -1
  355. package/dist/metrics.d.ts +6 -16
  356. package/dist/metrics.d.ts.map +1 -1
  357. package/dist/node.d.ts +9 -2
  358. package/dist/node.d.ts.map +1 -1
  359. package/dist/node.js +6 -2
  360. package/dist/node.js.map +1 -1
  361. package/dist/providers/_shared.d.ts +9 -0
  362. package/dist/providers/_shared.d.ts.map +1 -0
  363. package/dist/providers/_shared.js +25 -0
  364. package/dist/providers/_shared.js.map +1 -0
  365. package/dist/providers/dodo/client-contract.d.ts +106 -0
  366. package/dist/providers/dodo/client-contract.d.ts.map +1 -0
  367. package/dist/providers/dodo/client-contract.js +2 -0
  368. package/dist/providers/dodo/client-contract.js.map +1 -0
  369. package/dist/providers/dodo/event-mapper.d.ts +5 -3
  370. package/dist/providers/dodo/event-mapper.d.ts.map +1 -1
  371. package/dist/providers/dodo/event-mapper.js +213 -38
  372. package/dist/providers/dodo/event-mapper.js.map +1 -1
  373. package/dist/providers/dodo/index.d.ts +1 -0
  374. package/dist/providers/dodo/index.d.ts.map +1 -1
  375. package/dist/providers/dodo/index.js.map +1 -1
  376. package/dist/providers/dodo/provider.d.ts +24 -14
  377. package/dist/providers/dodo/provider.d.ts.map +1 -1
  378. package/dist/providers/dodo/provider.js +249 -31
  379. package/dist/providers/dodo/provider.js.map +1 -1
  380. package/dist/providers/index.d.ts +3 -1
  381. package/dist/providers/index.d.ts.map +1 -1
  382. package/dist/providers/index.js +1 -0
  383. package/dist/providers/index.js.map +1 -1
  384. package/dist/providers/mock/provider.d.ts +14 -10
  385. package/dist/providers/mock/provider.d.ts.map +1 -1
  386. package/dist/providers/mock/provider.js +78 -10
  387. package/dist/providers/mock/provider.js.map +1 -1
  388. package/dist/providers/stripe/event-mapper.d.ts +3 -3
  389. package/dist/providers/stripe/event-mapper.d.ts.map +1 -1
  390. package/dist/providers/stripe/event-mapper.js +139 -30
  391. package/dist/providers/stripe/event-mapper.js.map +1 -1
  392. package/dist/providers/stripe/provider.d.ts +21 -12
  393. package/dist/providers/stripe/provider.d.ts.map +1 -1
  394. package/dist/providers/stripe/provider.js +175 -17
  395. package/dist/providers/stripe/provider.js.map +1 -1
  396. package/dist/providers/types.d.ts +128 -32
  397. package/dist/providers/types.d.ts.map +1 -1
  398. package/dist/providers/types.js +17 -1
  399. package/dist/providers/types.js.map +1 -1
  400. package/dist/retry.d.ts +13 -0
  401. package/dist/retry.d.ts.map +1 -0
  402. package/dist/retry.js +28 -0
  403. package/dist/retry.js.map +1 -0
  404. package/dist/shared/logger.d.ts +10 -0
  405. package/dist/shared/logger.d.ts.map +1 -0
  406. package/dist/shared/logger.js +15 -0
  407. package/dist/shared/logger.js.map +1 -0
  408. package/dist/shared/postgres-client.d.ts +51 -0
  409. package/dist/shared/postgres-client.d.ts.map +1 -0
  410. package/dist/shared/postgres-client.js +101 -0
  411. package/dist/shared/postgres-client.js.map +1 -0
  412. package/dist/shared/postgres-types.d.ts +7 -0
  413. package/dist/shared/postgres-types.d.ts.map +1 -0
  414. package/dist/shared/postgres-types.js +2 -0
  415. package/dist/shared/postgres-types.js.map +1 -0
  416. package/dist/shared/postgres-validation.d.ts +8 -0
  417. package/dist/shared/postgres-validation.d.ts.map +1 -0
  418. package/dist/shared/postgres-validation.js +40 -0
  419. package/dist/shared/postgres-validation.js.map +1 -0
  420. package/dist/storage/adapters/clickhouse.d.ts +61 -0
  421. package/dist/storage/adapters/clickhouse.d.ts.map +1 -0
  422. package/dist/storage/adapters/clickhouse.js +329 -0
  423. package/dist/storage/adapters/clickhouse.js.map +1 -0
  424. package/dist/storage/adapters/s3.d.ts +35 -0
  425. package/dist/storage/adapters/s3.d.ts.map +1 -0
  426. package/dist/storage/adapters/s3.js +100 -0
  427. package/dist/storage/adapters/s3.js.map +1 -0
  428. package/dist/storage/outbox-worker.d.ts +40 -0
  429. package/dist/storage/outbox-worker.d.ts.map +1 -0
  430. package/dist/storage/outbox-worker.js +132 -0
  431. package/dist/storage/outbox-worker.js.map +1 -0
  432. package/dist/storage/ports.d.ts +77 -0
  433. package/dist/storage/ports.d.ts.map +1 -0
  434. package/dist/storage/ports.js +2 -0
  435. package/dist/storage/ports.js.map +1 -0
  436. package/dist/storage/postgres-repository.d.ts +14 -0
  437. package/dist/storage/postgres-repository.d.ts.map +1 -0
  438. package/dist/storage/postgres-repository.js +130 -0
  439. package/dist/storage/postgres-repository.js.map +1 -0
  440. package/dist/storage/runtime.d.ts +67 -0
  441. package/dist/storage/runtime.d.ts.map +1 -0
  442. package/dist/storage/runtime.js +313 -0
  443. package/dist/storage/runtime.js.map +1 -0
  444. package/package.json +36 -20
  445. package/dist/allowance.d.ts +0 -48
  446. package/dist/allowance.d.ts.map +0 -1
  447. package/dist/allowance.js +0 -140
  448. package/dist/allowance.js.map +0 -1
  449. package/dist/billing/billing-manager.d.ts +0 -66
  450. package/dist/billing/billing-manager.d.ts.map +0 -1
  451. package/dist/billing/billing-manager.js +0 -560
  452. package/dist/billing/billing-manager.js.map +0 -1
  453. package/dist/billing/billing-types.d.ts +0 -203
  454. package/dist/billing/billing-types.d.ts.map +0 -1
  455. package/dist/billing/billing-types.js +0 -6
  456. package/dist/billing/billing-types.js.map +0 -1
  457. package/dist/billing/memory-billing-store.d.ts +0 -37
  458. package/dist/billing/memory-billing-store.d.ts.map +0 -1
  459. package/dist/billing/memory-billing-store.js +0 -197
  460. package/dist/billing/memory-billing-store.js.map +0 -1
  461. package/dist/billing/postgres-billing-store.d.ts +0 -35
  462. package/dist/billing/postgres-billing-store.d.ts.map +0 -1
  463. package/dist/billing/postgres-billing-store.js +0 -274
  464. package/dist/billing/postgres-billing-store.js.map +0 -1
  465. package/dist/billing/supabase-billing-store.d.ts +0 -29
  466. package/dist/billing/supabase-billing-store.d.ts.map +0 -1
  467. package/dist/billing/supabase-billing-store.js +0 -250
  468. package/dist/billing/supabase-billing-store.js.map +0 -1
  469. package/dist/manager.d.ts +0 -444
  470. package/dist/manager.d.ts.map +0 -1
  471. package/dist/manager.js +0 -1153
  472. package/dist/manager.js.map +0 -1
  473. package/dist/stores/credit-store.d.ts +0 -198
  474. package/dist/stores/credit-store.d.ts.map +0 -1
  475. package/dist/stores/credit-store.js.map +0 -1
  476. package/dist/stores/events.d.ts.map +0 -1
  477. package/dist/stores/events.js.map +0 -1
  478. package/dist/stores/memory-store.d.ts +0 -187
  479. package/dist/stores/memory-store.d.ts.map +0 -1
  480. package/dist/stores/memory-store.js +0 -1890
  481. package/dist/stores/memory-store.js.map +0 -1
  482. package/dist/stores/postgres-store.d.ts +0 -100
  483. package/dist/stores/postgres-store.d.ts.map +0 -1
  484. package/dist/stores/postgres-store.js +0 -891
  485. package/dist/stores/postgres-store.js.map +0 -1
  486. package/dist/stores/supabase-store.d.ts +0 -87
  487. package/dist/stores/supabase-store.d.ts.map +0 -1
  488. package/dist/stores/supabase-store.js +0 -948
  489. package/dist/stores/supabase-store.js.map +0 -1
  490. package/dist/types.d.ts +0 -463
  491. package/dist/types.d.ts.map +0 -1
  492. package/dist/types.js.map +0 -1
  493. /package/dist/{types.js → commerce/types.js} +0 -0
package/dist/manager.d.ts DELETED
@@ -1,444 +0,0 @@
1
- import Decimal from "decimal.js";
2
- import type { PricingEngine } from "./engine.js";
3
- import type { AddCreditsResult, AggregateStats, AllowanceResult, AvailableResult, BalanceResult, BillingMode, CanAffordResult, CheckFeatureResult, CreditMetadata, DailySpendRow, DeductionResult, FeatureLimitResult, GetUserPlanResult, LeaseResult, PricingConfigData, RefundResult, ReleaseResult, SetupResult, SpendByModelRow, SpendByUserRow, SweepResult, TeamDeductionResult, TierBalancesResult, TopUserRow, UserTransactionRow } from "./types.js";
4
- import type { ListTransactionsOptions, ListUsageEventsOptions, PaginatedTransactions } from "./types.js";
5
- import type { CreditStore } from "./stores/credit-store.js";
6
- import type { CreditEvent, CreditEventEmitter } from "./stores/events.js";
7
- import type { UsageMetrics } from "./metrics.js";
8
- /** A financial-safety constructor preset (interface plan §2). */
9
- export type PolicyPreset = "strict_prepaid" | "overdraft";
10
- /** A cost input: either usage metrics (priced via the engine) or a raw amount. */
11
- type MetricsOrAmount = UsageMetrics | Decimal | number;
12
- /**
13
- * Multi-level ``credits.low_balance`` configuration (WS7 — collapses the
14
- * former ``lowBalanceThreshold`` / ``lowBalanceThresholds`` / ``onLowBalance``
15
- * trio into one option). Each threshold is edge-triggered once per descent and
16
- * re-arms after a top-up (interface plan §6). When ``lowBalance`` is omitted
17
- * entirely, the manager falls back to ``[minBalance * LOW_BALANCE_MULTIPLIER]``,
18
- * resolved lazily against the loaded engine.
19
- */
20
- export interface LowBalanceConfig {
21
- thresholds?: (Decimal | number)[] | null;
22
- onTrigger?: ((event: CreditEvent) => void | Promise<void>) | null;
23
- }
24
- /** Optional behavioural knobs for the manager. */
25
- export interface CreditManagerOptions {
26
- /**
27
- * Financial-safety preset for planless users (interface plan §2). Defaults to
28
- * ``"strict_prepaid"``. Per-plan / per-call policy layers on top of this.
29
- */
30
- policy?: PolicyPreset;
31
- /** Negative balance floor for the ``overdraft`` preset (interface plan §1). */
32
- overdraftFloor?: Decimal | number | null;
33
- /** Default ``maxConcurrent`` lease bound applied by the preset. */
34
- maxConcurrent?: number | null;
35
- /**
36
- * ``credits.low_balance`` thresholds and handler (interface plan §6). When
37
- * omitted, the manager uses ``[engine.minBalance * 2]`` (documented default,
38
- * M18), resolved lazily. The event is **edge-triggered**: each configured
39
- * level fires only on the deduction that crosses it from above, never
40
- * repeatedly while already below it, and re-arms on top-up.
41
- */
42
- lowBalance?: LowBalanceConfig | null;
43
- /** Default lease TTL (seconds) for ``reserve``/``runBilled`` (default 600). */
44
- defaultTtlSeconds?: number;
45
- /**
46
- * Enable lazy-on-read credit expiry (default ``false``, unchanged behaviour).
47
- *
48
- * Allowance windows and lease TTLs are already lazy-on-read (checked via
49
- * `expiresAt`/window filters at read time); credit expiry otherwise requires
50
- * an explicit ``sweepExpiredCredits`` call (e.g. from a cron job). When
51
- * ``true``, the manager transparently sweeps a user's own expired credits
52
- * (scoped to that user — never a global sweep) before ``getBalance``,
53
- * ``getCreditTiers``, ``deduct``, ``deductFixed``, ``deductTeam``,
54
- * ``reserve``, and ``settle`` so a caller never needs to run a cron job.
55
- */
56
- lazyExpiry?: boolean;
57
- }
58
- /** Options for {@link CreditManager.reserve}. */
59
- export interface ReserveOptions {
60
- operationType?: string;
61
- billingMode?: BillingMode | null;
62
- requiredFeature?: string | null;
63
- ttl?: number | null;
64
- metadata?: CreditMetadata | null;
65
- /** Named feature to enforce/tag a per-feature invocation-count limit for (independent of `requiredFeature`). */
66
- feature?: string | null;
67
- }
68
- /** Options for {@link CreditManager.settle}. */
69
- export interface SettleOptions {
70
- idempotencyKey?: string | null;
71
- metadata?: CreditMetadata | null;
72
- /**
73
- * The same feature name supplied to `reserve` — re-supplied at settle time
74
- * for accurate per-feature invocation-count accounting, exactly like `model`
75
- * is re-supplied at settle for per-model spend-cap accuracy.
76
- */
77
- feature?: string | null;
78
- }
79
- /** Options for {@link CreditManager.canAfford}. */
80
- export interface CanAffordOptions {
81
- requiredFeature?: string | null;
82
- billingMode?: BillingMode | null;
83
- operationType?: string;
84
- }
85
- /** Options for {@link CreditManager.grantSubscriptionCycle}. */
86
- export interface GrantSubscriptionCycleOptions {
87
- /** Target credit tier for the granted cycle. Defaults to ``"subscription"``. */
88
- tier?: string;
89
- /** Explicit expiry for the granted cycle. Mutually exclusive with ``ttlDays``. */
90
- expiresAt?: Date;
91
- /** TTL in days from now for the granted cycle. Mutually exclusive with ``expiresAt``. */
92
- ttlDays?: number;
93
- /**
94
- * Expire any remaining balance in ``tier`` before granting the new cycle
95
- * (default ``true``) — the usual "use it or lose it" subscription semantics.
96
- * When ``false``, the new cycle's credits are added on top of any leftover
97
- * balance.
98
- */
99
- replacePrior?: boolean;
100
- /** Optional plan to assign after granting (e.g. resolved from a webhook's price/plan id). */
101
- planKey?: string;
102
- /**
103
- * Replay-safe idempotency key — safe to call again with the same key on
104
- * webhook redelivery (e.g. Stripe's at-least-once delivery guarantee).
105
- */
106
- idempotencyKey?: string;
107
- metadata?: CreditMetadata | null;
108
- }
109
- /** Options for {@link CreditManager.runBilled}. */
110
- export interface RunBilledOptions<T> {
111
- estimate: MetricsOrAmount;
112
- doWork: () => Promise<{
113
- result: T;
114
- actual: MetricsOrAmount;
115
- }>;
116
- operationType?: string;
117
- billingMode?: BillingMode | null;
118
- requiredFeature?: string | null;
119
- idempotencyKey?: string | null;
120
- ttl?: number | null;
121
- /** Named feature to enforce/tag a per-feature invocation-count limit for (independent of `requiredFeature`). */
122
- feature?: string | null;
123
- }
124
- /**
125
- * Orchestrates credit operations.
126
- *
127
- * The deduction path is a single atomic, idempotency-keyed store call
128
- * (``deductWithAllowance``) that consumes free allowance, enforces spend caps,
129
- * applies the balance floor and debits the net amount in one transaction
130
- * (contract §2). The manager is a thin layer that calculates the cost, maps
131
- * the store's typed ``error`` codes to exceptions, and emits lifecycle events
132
- * **only after** the operation has succeeded (contract §6).
133
- *
134
- * Optionally accepts a ``CreditEventEmitter`` to emit lifecycle events
135
- * (deducted, deduct_failed, added, refunded, refund_failed, expired,
136
- * cap_reached, cap_warning, low_balance).
137
- */
138
- export declare class CreditManager {
139
- private store;
140
- private engine;
141
- private emitter;
142
- private policy;
143
- private overdraftFloor;
144
- private defaultMaxConcurrent;
145
- private defaultTtl;
146
- private lowBalanceThresholds;
147
- private onLowBalance;
148
- private lazyExpiry;
149
- private lbBelow;
150
- constructor(store: CreditStore, engine?: PricingEngine | null, emitter?: CreditEventEmitter | null, options?: CreditManagerOptions | null);
151
- /** Emit a credit lifecycle event. No-op if no emitter is configured. */
152
- private emit;
153
- /** The configured min-balance floor as a `Decimal` (defaults to 0). */
154
- private minBalanceDecimal;
155
- /**
156
- * Resolve the single `low_balance` threshold used by the ``deduct`` fast path:
157
- * the lowest configured level when ``lowBalance.thresholds`` is set, otherwise
158
- * ``minBalance * LOW_BALANCE_MULTIPLIER`` (documented default).
159
- */
160
- private resolveLowBalanceThreshold;
161
- /** Run bundled SQL migrations through the store. */
162
- setup(): Promise<SetupResult>;
163
- /** Load pricing from a PricingConfigData or raw dict and sync it. */
164
- publishPricingFromDict(data: PricingConfigData | Record<string, unknown>): Promise<void>;
165
- /** Load the active pricing config from the store. */
166
- loadPricingFromStore(): Promise<void>;
167
- /**
168
- * Publish new pricing and update the engine in one call.
169
- *
170
- * H10: the store write is now **awaited** (was a fire-and-forget `void`), so
171
- * a persistence failure surfaces to the caller instead of becoming an
172
- * unhandled promise rejection.
173
- */
174
- publishPricing(config: PricingConfigData, label?: string | null): Promise<void>;
175
- /** The current PricingEngine, or null if not loaded. */
176
- get pricingEngine(): PricingEngine | null;
177
- /** Fetch a user's current plan (including feature entitlements). */
178
- getUserPlan(userId: string): Promise<GetUserPlanResult>;
179
- /**
180
- * Set a user's subscription plan and emit ``credits.plan_changed``.
181
- *
182
- * The store call is awaited so a persistence failure surfaces to the caller.
183
- * The event is emitted only after the store write succeeds (contract §6).
184
- */
185
- setUserPlan(userId: string, planKey: string, planAssignedAt?: Date | null): Promise<void>;
186
- /**
187
- * Unset a user's subscription plan. Clears `plan_id` and `plan_assigned_at`
188
- * so the allowance period is effectively paused. Call {@link setUserPlan} to
189
- * re-assign and re-anchor the allowance window.
190
- */
191
- unsetUserPlan(userId: string): Promise<void>;
192
- /**
193
- * Check whether a user's plan has a specific feature entitlement.
194
- *
195
- * Passthrough to the store, which distinguishes *presence* from *truthiness*
196
- * (numeric `0` / `""` count as present; only `null`/`undefined`/`false`/absent
197
- * read as missing — contract §5 / M6).
198
- */
199
- checkFeature(userId: string, feature: string): Promise<CheckFeatureResult>;
200
- /**
201
- * Advisory, non-locking read of a per-feature invocation-count limit (UI only).
202
- *
203
- * Resolves the `FeatureLimit` (if any) from the user's plan and the
204
- * calendar-aligned window, then delegates counting to the store. Returns
205
- * `limited: false` (zeroed fields, `action: null`) when no `FeatureLimit`
206
- * is configured for `feature` on the user's plan — never used for
207
- * admission control; that is exclusively the atomic check-and-increment
208
- * inside `deduct`/`reserve`.
209
- */
210
- checkFeatureLimit(userId: string, feature: string): Promise<FeatureLimitResult>;
211
- /**
212
- * Sweep a single user's own expired credits when ``options.lazyExpiry`` is
213
- * enabled — no-op otherwise. Mirrors the fact that allowance windows and
214
- * lease TTLs are already lazy-on-read; this closes the same gap for the
215
- * stored aggregate expiry balance without requiring a cron job.
216
- */
217
- private maybeLazyExpire;
218
- /** Get a user's current credit balance. */
219
- getBalance(userId: string): Promise<BalanceResult>;
220
- /** Revoke all un-revoked credits of a given type for a user. */
221
- revokeCreditsByTxType(userId: string, txType: string): Promise<Record<string, unknown>>;
222
- /** Fetch a single credit transaction by ID. Returns null when not found. */
223
- getTransaction(userId: string, transactionId: string): Promise<UserTransactionRow | null>;
224
- /** Add credits to a user's account. */
225
- addCredits(userId: string, amount: Decimal | number, options?: {
226
- type?: string;
227
- metadata?: CreditMetadata | null;
228
- expiresAt?: Date | null;
229
- /** Target credit tier (credit tiers); omitted resolves to the config's default tier. */
230
- tier?: string | null;
231
- /** Replay-safe idempotency key (parity with `deduct`/`settle`/`refund`). */
232
- idempotencyKey?: string | null;
233
- }): Promise<AddCreditsResult>;
234
- /**
235
- * Deduct a raw credit amount from a user's account.
236
- *
237
- * Uses the store's `addCredits` with `type='adjustment'` and a negated
238
- * amount — the existing validation path for negative/zero adjustments.
239
- * Use this for refund clawbacks and other administrative deductions that
240
- * bypass the usage-based `deduct()` flow.
241
- */
242
- deductCredits(userId: string, amount: Decimal | number, options?: {
243
- txType?: string;
244
- tier?: string | null;
245
- metadata?: CreditMetadata | null;
246
- }): Promise<AddCreditsResult>;
247
- /**
248
- * Grant one billing-cycle's worth of credits — idempotent-safe for a
249
- * payment-provider webhook handler (Stripe, etc. — bursar stays
250
- * provider-agnostic) to call even on webhook redelivery.
251
- *
252
- * 1. At most one of ``expiresAt``/``ttlDays`` may be given (throws
253
- * ``ConfigError`` otherwise).
254
- * 2. When ``ttlDays`` is given, ``expiresAt = now + ttlDays`` days.
255
- * 3. When ``replacePrior`` (default ``true``), any remaining balance in
256
- * ``tier`` is expired immediately via a direct ``store.addCredits``
257
- * negative adjustment — naturally idempotent (a replay finds the tier
258
- * already at zero and skips the call).
259
- * 4. The new cycle is granted via a direct ``store.addCredits`` call
260
- * (bypassing {@link addCredits} so only ``credits.cycle_renewed`` fires,
261
- * not a duplicate ``credits.added``), threading ``idempotencyKey`` so a
262
- * redelivered webhook replays the prior grant instead of double-crediting.
263
- * 5. When ``planKey`` is given, assigns it via {@link setUserPlan}.
264
- * 6. Emits ``credits.cycle_renewed`` and returns the grant result.
265
- */
266
- grantSubscriptionCycle(userId: string, amount: Decimal | number, options?: GrantSubscriptionCycleOptions): Promise<AddCreditsResult>;
267
- /** The default {@link OperationPolicy} from the constructor preset (§2). */
268
- private presetPolicy;
269
- /**
270
- * Resolve the effective policy: explicit arg → per-op → plan → preset (§1).
271
- *
272
- * A planless user (``planId`` is null) always gets the constructor preset, never
273
- * silently unlimited (resolves M1). A user *with* a plan gets the plan default,
274
- * then any ``perOperation`` override, then the explicit per-call ``billingMode``.
275
- */
276
- private resolvePolicy;
277
- /** Admission floor for a policy: ``overdraftFloor`` (≤0) or ``minBalance`` (≥0). */
278
- private resolveFloor;
279
- /**
280
- * Resolve the free-allowance period start for a user (WS9c).
281
- *
282
- * Fast path: a ``calendar_month`` plan (the default, and the vast majority of
283
- * users) needs no computation — returns ``null`` and the store falls back to
284
- * its own calendar-month window, exactly matching pre-WS9 behaviour. Only
285
- * ``rolling_30d``/``anniversary`` plans pay the cost of resolving a window,
286
- * anchored at the plan's ``planAssignedAt``.
287
- */
288
- private resolveAllowancePeriodStart;
289
- /**
290
- * Resolve the `FeatureLimit` (if any) configured for `feature` on the
291
- * user's plan, plus the calendar-aligned `[start, end)` window it applies
292
- * to (via {@link resolveCalendarWindow}).
293
- *
294
- * Returns `{ limit: null, periodStart: null, periodEnd: null }` when
295
- * `feature` is omitted or no limit is configured for it — the store then
296
- * skips enforcement entirely (mirrors `resolveAllowancePeriodStart`).
297
- */
298
- private resolveFeatureLimit;
299
- /**
300
- * Compute the credit cost and model from metrics, or pass a raw amount through.
301
- *
302
- * For {@link UsageMetrics} the cost is ``engine.calculate(...).total`` (exact
303
- * `Decimal`, no truncation); a raw amount is used as-is with no model.
304
- */
305
- private costOf;
306
- /** Map a store business code to the coherent typed exception (M2). */
307
- private raiseLeaseError;
308
- /**
309
- * Atomically acquire a lease — the only admission control (D4).
310
- *
311
- * Resolves the effective policy, enforces ``requiredFeature``, sizes the hold
312
- * from ``metricsOrAmount`` (worst-case in strict, estimate in overdraft — the
313
- * caller chooses what to pass), and calls the store's atomic ``createLease``. On
314
- * any business failure throws the coherent typed exception; on success emits
315
- * ``credits.reserved`` and returns the {@link LeaseResult}.
316
- */
317
- reserve(userId: string, metricsOrAmount: MetricsOrAmount, options?: ReserveOptions): Promise<LeaseResult>;
318
- /**
319
- * Charge the ACTUAL cost against a lease and finalize it (D5).
320
- *
321
- * De-clamped: bills the full actual cost even if it exceeds the lease hold
322
- * (overdraft). Never blocks on floor/cap at settle — a cap breach surfaces as a
323
- * non-blocking ``credits.cap_warning``/``credits.cap_reached`` signal. Emits
324
- * ``credits.deducted``, then multi-level ``credits.low_balance`` and a
325
- * ``credits.overdraft`` signal if the balance went negative.
326
- */
327
- settle(userId: string, leaseId: string, metricsOrAmount: MetricsOrAmount, options?: SettleOptions): Promise<DeductionResult>;
328
- /** Release a lease without charging (work failed/aborted) — idempotent (H1). */
329
- release(userId: string, leaseId: string): Promise<ReleaseResult>;
330
- /** Extend a lease's TTL for long batch/agentic jobs (B4). */
331
- renew(userId: string, leaseId: string, ttl?: number | null): Promise<LeaseResult>;
332
- /**
333
- * Advisory affordability check — UI only, non-locking, may be stale (D4/H3).
334
- *
335
- * Never use this as an admission gate; only ``reserve`` is authoritative.
336
- */
337
- canAfford(userId: string, metricsOrAmount: MetricsOrAmount, options?: CanAffordOptions): Promise<CanAffordResult>;
338
- /** Advisory ``available = balance − Σ active holds`` read (UI only, D4/H3). */
339
- getAvailable(userId: string): Promise<AvailableResult>;
340
- /** Get a user's per-tier credit balances (credit tiers). Thin pass-through, no event emission. */
341
- getCreditTiers(userId: string): Promise<TierBalancesResult>;
342
- /**
343
- * Get remaining free allowance for the current billing period.
344
- *
345
- * Convenience wrapper that routes through the manager so callers never need
346
- * to reach past it into the raw store. Returns a zero-allowance result for
347
- * planless users (no exception).
348
- *
349
- * For ``rolling_30d``/``anniversary`` plans (WS9), resolves and threads
350
- * ``periodStart`` so the reported window matches the one actually used by
351
- * ``deduct``/``settle``/``reserve`` — a ``calendar_month`` plan (the default)
352
- * takes the fast path unchanged.
353
- */
354
- checkAllowance(userId: string): Promise<AllowanceResult>;
355
- /**
356
- * One-call shortcut wiring reserve → doWork → settle (interface plan §4).
357
- *
358
- * ``doWork`` runs the operation and returns ``{ result, actual }`` where
359
- * ``actual`` is the real usage metrics (or amount) to settle. On any exception
360
- * from ``doWork`` the lease is released and the error re-raised. For long jobs
361
- * ``doWork`` may call {@link renew}. A crash between reserve and settle is
362
- * covered by the lease TTL (and the store's reaper).
363
- */
364
- runBilled<T>(userId: string, options: RunBilledOptions<T>): Promise<{
365
- result: T;
366
- deduction: DeductionResult;
367
- }>;
368
- /** Emit overdraft + multi-level low_balance after a balance-decreasing op. */
369
- private postChargeSignals;
370
- /** Edge-triggered low_balance: multi-level if configured, else single (§6). */
371
- private emitLowBalance;
372
- /** Emit ``credits.low_balance`` and invoke the non-blocking ``onLowBalance``. */
373
- private fireLowBalance;
374
- /**
375
- * Full deduction flow as one atomic store call (contract §2).
376
- *
377
- * 1. ``breakdown = engine.calculate(metrics)``; ``cost = breakdown.total``
378
- * (exact `Decimal`, **no truncation**).
379
- * 2. If ``cost <= 0`` short-circuit with a zero-amount result.
380
- * 3. Otherwise ``store.deductWithAllowance`` consumes allowance, enforces caps,
381
- * applies the balance floor and debits — idempotency-keyed end-to-end.
382
- *
383
- * On a store ``error`` a ``credits.deduct_failed`` event is emitted and a
384
- * typed exception is thrown (``insufficient_credits`` → InsufficientCreditsError,
385
- * ``cap_reached`` → CapReachedError). No success event is emitted on error.
386
- */
387
- deduct(userId: string, metrics: UsageMetrics, idempotencyKey?: string | null, metadata?: CreditMetadata | null,
388
- /** Named feature to enforce/tag a per-feature invocation-count limit for. */
389
- feature?: string | null): Promise<DeductionResult>;
390
- /**
391
- * Refund a previous credit deduction.
392
- *
393
- * H3: the store's ``error`` is checked **before** emitting. A successful refund
394
- * emits ``credits.refunded``; a failed/duplicate/over-refund emits
395
- * ``credits.refund_failed`` and throws a typed ``RefundError`` (no success
396
- * event is ever emitted for a failed refund).
397
- */
398
- refundCredits(transactionId: string, amount?: Decimal | number, reason?: string, metadata?: CreditMetadata | null): Promise<RefundResult>;
399
- /**
400
- * Deduct from a team's shared balance pool.
401
- *
402
- * Calculates the cost via the pricing engine (exact `Decimal`, no truncation),
403
- * then debits the team balance. Threads an optional ``idempotencyKey`` through
404
- * to the store so retried team charges are not double-counted (H12).
405
- */
406
- deductTeam(teamId: string, userId: string, metrics: UsageMetrics, idempotencyKey?: string | null, metadata?: CreditMetadata | null): Promise<TeamDeductionResult>;
407
- /**
408
- * Shortcut for fixed-cost batch jobs.
409
- *
410
- * L1: an unknown/typo'd ``jobName`` is rejected (throws) instead of silently
411
- * charging 0 credits — ``engine.getFixedCost(jobName) === null`` means the job
412
- * is not configured.
413
- */
414
- deductFixed(userId: string, jobName: string, idempotencyKey?: string | null, metadata?: CreditMetadata | null, feature?: string | null): Promise<DeductionResult>;
415
- /**
416
- * Sweep expired credits — global when ``userId`` is omitted, scoped to a
417
- * single user when given (used by ``maybeLazyExpire``). Shared by the public
418
- * ``sweepExpiredCredits`` (always global) and the lazy-on-read trigger.
419
- */
420
- private runSweep;
421
- /**
422
- * Sweep expired credits from all users' balances.
423
- *
424
- * When ``dryRun`` is true, reports what would be expired without modifying
425
- * any balances. Unaffected by ``options.lazyExpiry`` — this always runs a
426
- * global sweep; lazy expiry only scopes *automatic* per-user sweeps.
427
- */
428
- sweepExpiredCredits(dryRun?: boolean): Promise<SweepResult>;
429
- /** Aggregate statistics across all users in a time window. */
430
- aggregateStats(start: Date, end: Date): Promise<AggregateStats>;
431
- /** Aggregate spend by user in a time window. */
432
- spendByUser(start: Date, end: Date): Promise<SpendByUserRow[]>;
433
- /** Aggregate spend by model in a time window. */
434
- spendByModel(start: Date, end: Date): Promise<SpendByModelRow[]>;
435
- /** List all user credit transactions with pagination. */
436
- listUserTransactions(userId: string, options?: ListTransactionsOptions): Promise<PaginatedTransactions>;
437
- listUsageEvents(userId: string, options?: ListUsageEventsOptions): Promise<PaginatedTransactions>;
438
- /** Top users by spend in a time window with limit. */
439
- topUsers(limit: number, start: Date, end: Date): Promise<TopUserRow[]>;
440
- /** Daily spend aggregation in a time window. */
441
- dailySpend(start: Date, end: Date): Promise<DailySpendRow[]>;
442
- }
443
- export {};
444
- //# sourceMappingURL=manager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../src/manager.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,YAAY,CAAC;AAajC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,KAAK,EACV,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,eAAe,EACf,aAAa,EACb,WAAW,EACX,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,eAAe,EAGf,kBAAkB,EAClB,iBAAiB,EACjB,WAAW,EAEX,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,WA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