@zonastery/bursar 0.0.2 → 1.0.1

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 (505) hide show
  1. package/README.md +118 -333
  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 +684 -0
  24. package/dist/billing/event-handlers.js.map +1 -0
  25. package/dist/billing/event-processor.d.ts +20 -0
  26. package/dist/billing/event-processor.d.ts.map +1 -0
  27. package/dist/billing/event-processor.js +131 -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 +9 -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 +180 -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 +45 -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 +89 -0
  90. package/dist/billing/postgres/store.d.ts.map +1 -0
  91. package/dist/billing/postgres/store.js +542 -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 +84 -0
  138. package/dist/bursar.d.ts.map +1 -0
  139. package/dist/bursar.js +137 -0
  140. package/dist/bursar.js.map +1 -0
  141. package/dist/catalog.d.ts +62 -0
  142. package/dist/catalog.d.ts.map +1 -0
  143. package/dist/catalog.js +96 -0
  144. package/dist/catalog.js.map +1 -0
  145. package/dist/commerce/errors.d.ts +68 -0
  146. package/dist/commerce/errors.d.ts.map +1 -0
  147. package/dist/commerce/errors.js +105 -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 +1016 -0
  164. package/dist/commerce/service.js.map +1 -0
  165. package/dist/commerce/types.d.ts +225 -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 +142 -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 +340 -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 +12 -23
  197. package/dist/config.d.ts.map +1 -1
  198. package/dist/config.js +141 -377
  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 +81 -0
  213. package/dist/credits/postgres/repositories/analytics.d.ts.map +1 -0
  214. package/dist/credits/postgres/repositories/analytics.js +153 -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 +64 -0
  225. package/dist/credits/postgres/repositories/deduction.d.ts.map +1 -0
  226. package/dist/credits/postgres/repositories/deduction.js +154 -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 +110 -0
  233. package/dist/credits/postgres/repositories/plan.d.ts.map +1 -0
  234. package/dist/credits/postgres/repositories/plan.js +194 -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 +76 -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 +89 -0
  245. package/dist/credits/postgres/store.d.ts.map +1 -0
  246. package/dist/credits/postgres/store.js +838 -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 +102 -0
  251. package/dist/credits/postgres/value-mappers.js.map +1 -0
  252. package/dist/credits/pricing-runtime.d.ts +35 -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 +220 -0
  269. package/dist/credits/service.d.ts.map +1 -0
  270. package/dist/credits/service.js +640 -0
  271. package/dist/credits/service.js.map +1 -0
  272. package/dist/credits/store.d.ts +172 -0
  273. package/dist/credits/store.d.ts.map +1 -0
  274. package/dist/{stores/credit-store.js → credits/store.js} +27 -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 +71 -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 +87 -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 +133 -25
  317. package/dist/errors.d.ts.map +1 -1
  318. package/dist/errors.js +173 -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 +2792 -0
  345. package/dist/generated/pricing-config.types.d.ts +685 -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 +23 -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 +8 -4
  355. package/dist/load-pricing-file.js.map +1 -1
  356. package/dist/metrics.d.ts +6 -16
  357. package/dist/metrics.d.ts.map +1 -1
  358. package/dist/metrics.js.map +1 -1
  359. package/dist/node.d.ts +9 -2
  360. package/dist/node.d.ts.map +1 -1
  361. package/dist/node.js +6 -2
  362. package/dist/node.js.map +1 -1
  363. package/dist/providers/_shared.d.ts +9 -0
  364. package/dist/providers/_shared.d.ts.map +1 -0
  365. package/dist/providers/_shared.js +52 -0
  366. package/dist/providers/_shared.js.map +1 -0
  367. package/dist/providers/dodo/client-contract.d.ts +106 -0
  368. package/dist/providers/dodo/client-contract.d.ts.map +1 -0
  369. package/dist/providers/dodo/client-contract.js +2 -0
  370. package/dist/providers/dodo/client-contract.js.map +1 -0
  371. package/dist/providers/dodo/event-mapper.d.ts +5 -3
  372. package/dist/providers/dodo/event-mapper.d.ts.map +1 -1
  373. package/dist/providers/dodo/event-mapper.js +213 -38
  374. package/dist/providers/dodo/event-mapper.js.map +1 -1
  375. package/dist/providers/dodo/index.d.ts +1 -0
  376. package/dist/providers/dodo/index.d.ts.map +1 -1
  377. package/dist/providers/dodo/index.js.map +1 -1
  378. package/dist/providers/dodo/provider.d.ts +24 -14
  379. package/dist/providers/dodo/provider.d.ts.map +1 -1
  380. package/dist/providers/dodo/provider.js +249 -31
  381. package/dist/providers/dodo/provider.js.map +1 -1
  382. package/dist/providers/index.d.ts +3 -1
  383. package/dist/providers/index.d.ts.map +1 -1
  384. package/dist/providers/index.js +1 -0
  385. package/dist/providers/index.js.map +1 -1
  386. package/dist/providers/mock/index.js.map +1 -1
  387. package/dist/providers/mock/provider.d.ts +14 -10
  388. package/dist/providers/mock/provider.d.ts.map +1 -1
  389. package/dist/providers/mock/provider.js +78 -10
  390. package/dist/providers/mock/provider.js.map +1 -1
  391. package/dist/providers/stripe/event-mapper.d.ts +3 -3
  392. package/dist/providers/stripe/event-mapper.d.ts.map +1 -1
  393. package/dist/providers/stripe/event-mapper.js +139 -30
  394. package/dist/providers/stripe/event-mapper.js.map +1 -1
  395. package/dist/providers/stripe/index.js.map +1 -1
  396. package/dist/providers/stripe/provider.d.ts +21 -12
  397. package/dist/providers/stripe/provider.d.ts.map +1 -1
  398. package/dist/providers/stripe/provider.js +175 -17
  399. package/dist/providers/stripe/provider.js.map +1 -1
  400. package/dist/providers/types.d.ts +128 -32
  401. package/dist/providers/types.d.ts.map +1 -1
  402. package/dist/providers/types.js +17 -1
  403. package/dist/providers/types.js.map +1 -1
  404. package/dist/retry.d.ts +35 -0
  405. package/dist/retry.d.ts.map +1 -0
  406. package/dist/retry.js +70 -0
  407. package/dist/retry.js.map +1 -0
  408. package/dist/shared/diagnostics.d.ts +7 -0
  409. package/dist/shared/diagnostics.d.ts.map +1 -0
  410. package/dist/shared/diagnostics.js +18 -0
  411. package/dist/shared/diagnostics.js.map +1 -0
  412. package/dist/shared/logger.d.ts +10 -0
  413. package/dist/shared/logger.d.ts.map +1 -0
  414. package/dist/shared/logger.js +15 -0
  415. package/dist/shared/logger.js.map +1 -0
  416. package/dist/shared/postgres-client.d.ts +84 -0
  417. package/dist/shared/postgres-client.d.ts.map +1 -0
  418. package/dist/shared/postgres-client.js +337 -0
  419. package/dist/shared/postgres-client.js.map +1 -0
  420. package/dist/shared/postgres-errors.d.ts +11 -0
  421. package/dist/shared/postgres-errors.d.ts.map +1 -0
  422. package/dist/shared/postgres-errors.js +105 -0
  423. package/dist/shared/postgres-errors.js.map +1 -0
  424. package/dist/shared/postgres-types.d.ts +7 -0
  425. package/dist/shared/postgres-types.d.ts.map +1 -0
  426. package/dist/shared/postgres-types.js +2 -0
  427. package/dist/shared/postgres-types.js.map +1 -0
  428. package/dist/shared/postgres-validation.d.ts +8 -0
  429. package/dist/shared/postgres-validation.d.ts.map +1 -0
  430. package/dist/shared/postgres-validation.js +40 -0
  431. package/dist/shared/postgres-validation.js.map +1 -0
  432. package/dist/storage/adapters/clickhouse.d.ts +61 -0
  433. package/dist/storage/adapters/clickhouse.d.ts.map +1 -0
  434. package/dist/storage/adapters/clickhouse.js +347 -0
  435. package/dist/storage/adapters/clickhouse.js.map +1 -0
  436. package/dist/storage/adapters/s3.d.ts +35 -0
  437. package/dist/storage/adapters/s3.d.ts.map +1 -0
  438. package/dist/storage/adapters/s3.js +100 -0
  439. package/dist/storage/adapters/s3.js.map +1 -0
  440. package/dist/storage/outbox-worker.d.ts +41 -0
  441. package/dist/storage/outbox-worker.d.ts.map +1 -0
  442. package/dist/storage/outbox-worker.js +146 -0
  443. package/dist/storage/outbox-worker.js.map +1 -0
  444. package/dist/storage/ports.d.ts +78 -0
  445. package/dist/storage/ports.d.ts.map +1 -0
  446. package/dist/storage/ports.js +2 -0
  447. package/dist/storage/ports.js.map +1 -0
  448. package/dist/storage/postgres-repository.d.ts +14 -0
  449. package/dist/storage/postgres-repository.d.ts.map +1 -0
  450. package/dist/storage/postgres-repository.js +140 -0
  451. package/dist/storage/postgres-repository.js.map +1 -0
  452. package/dist/storage/runtime.d.ts +77 -0
  453. package/dist/storage/runtime.d.ts.map +1 -0
  454. package/dist/storage/runtime.js +369 -0
  455. package/dist/storage/runtime.js.map +1 -0
  456. package/package.json +43 -21
  457. package/dist/allowance.d.ts +0 -48
  458. package/dist/allowance.d.ts.map +0 -1
  459. package/dist/allowance.js +0 -140
  460. package/dist/allowance.js.map +0 -1
  461. package/dist/billing/billing-manager.d.ts +0 -66
  462. package/dist/billing/billing-manager.d.ts.map +0 -1
  463. package/dist/billing/billing-manager.js +0 -560
  464. package/dist/billing/billing-manager.js.map +0 -1
  465. package/dist/billing/billing-types.d.ts +0 -203
  466. package/dist/billing/billing-types.d.ts.map +0 -1
  467. package/dist/billing/billing-types.js +0 -6
  468. package/dist/billing/billing-types.js.map +0 -1
  469. package/dist/billing/memory-billing-store.d.ts +0 -37
  470. package/dist/billing/memory-billing-store.d.ts.map +0 -1
  471. package/dist/billing/memory-billing-store.js +0 -197
  472. package/dist/billing/memory-billing-store.js.map +0 -1
  473. package/dist/billing/postgres-billing-store.d.ts +0 -35
  474. package/dist/billing/postgres-billing-store.d.ts.map +0 -1
  475. package/dist/billing/postgres-billing-store.js +0 -274
  476. package/dist/billing/postgres-billing-store.js.map +0 -1
  477. package/dist/billing/supabase-billing-store.d.ts +0 -29
  478. package/dist/billing/supabase-billing-store.d.ts.map +0 -1
  479. package/dist/billing/supabase-billing-store.js +0 -250
  480. package/dist/billing/supabase-billing-store.js.map +0 -1
  481. package/dist/manager.d.ts +0 -444
  482. package/dist/manager.d.ts.map +0 -1
  483. package/dist/manager.js +0 -1153
  484. package/dist/manager.js.map +0 -1
  485. package/dist/stores/credit-store.d.ts +0 -198
  486. package/dist/stores/credit-store.d.ts.map +0 -1
  487. package/dist/stores/credit-store.js.map +0 -1
  488. package/dist/stores/events.d.ts.map +0 -1
  489. package/dist/stores/events.js.map +0 -1
  490. package/dist/stores/memory-store.d.ts +0 -187
  491. package/dist/stores/memory-store.d.ts.map +0 -1
  492. package/dist/stores/memory-store.js +0 -1890
  493. package/dist/stores/memory-store.js.map +0 -1
  494. package/dist/stores/postgres-store.d.ts +0 -100
  495. package/dist/stores/postgres-store.d.ts.map +0 -1
  496. package/dist/stores/postgres-store.js +0 -891
  497. package/dist/stores/postgres-store.js.map +0 -1
  498. package/dist/stores/supabase-store.d.ts +0 -87
  499. package/dist/stores/supabase-store.d.ts.map +0 -1
  500. package/dist/stores/supabase-store.js +0 -948
  501. package/dist/stores/supabase-store.js.map +0 -1
  502. package/dist/types.d.ts +0 -463
  503. package/dist/types.d.ts.map +0 -1
  504. package/dist/types.js.map +0 -1
  505. /package/dist/{types.js → commerce/types.js} +0 -0
@@ -0,0 +1,2792 @@
1
+ {
2
+ "$defs": {
3
+ "AdmissionConfig": {
4
+ "additionalProperties": false,
5
+ "properties": {
6
+ "policies": {
7
+ "additionalProperties": {
8
+ "$ref": "#/$defs/AdmissionPolicy"
9
+ },
10
+ "title": "Policies",
11
+ "type": "object"
12
+ }
13
+ },
14
+ "title": "AdmissionConfig",
15
+ "type": "object"
16
+ },
17
+ "AdmissionPolicy": {
18
+ "additionalProperties": false,
19
+ "properties": {
20
+ "max_in_flight": {
21
+ "anyOf": [
22
+ {
23
+ "minimum": 1,
24
+ "type": "integer"
25
+ },
26
+ {
27
+ "type": "null"
28
+ }
29
+ ],
30
+ "default": null,
31
+ "title": "Max In Flight"
32
+ },
33
+ "operations": {
34
+ "additionalProperties": {
35
+ "$ref": "#/$defs/OperationAdmission"
36
+ },
37
+ "title": "Operations",
38
+ "type": "object"
39
+ }
40
+ },
41
+ "title": "AdmissionPolicy",
42
+ "type": "object"
43
+ },
44
+ "AfterGrantExpiry": {
45
+ "additionalProperties": false,
46
+ "properties": {
47
+ "type": {
48
+ "const": "after_grant",
49
+ "title": "Type",
50
+ "type": "string"
51
+ },
52
+ "interval": {
53
+ "$ref": "#/$defs/BillingInterval"
54
+ },
55
+ "timezone": {
56
+ "default": "UTC",
57
+ "title": "Timezone",
58
+ "type": "string"
59
+ }
60
+ },
61
+ "required": [
62
+ "type",
63
+ "interval"
64
+ ],
65
+ "title": "AfterGrantExpiry",
66
+ "type": "object"
67
+ },
68
+ "AutoRechargeGuardrails": {
69
+ "additionalProperties": false,
70
+ "properties": {
71
+ "eligible_topups": {
72
+ "items": {
73
+ "type": "string"
74
+ },
75
+ "minItems": 1,
76
+ "title": "Eligible Topups",
77
+ "type": "array"
78
+ },
79
+ "balance_below": {
80
+ "$ref": "#/$defs/DecimalRange"
81
+ },
82
+ "rearm_above": {
83
+ "description": "Balance that rearms auto-recharge; it must exceed balance_below.maximum.",
84
+ "examples": [
85
+ "10.500000"
86
+ ],
87
+ "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
88
+ "title": "Rearm Above",
89
+ "type": "string"
90
+ },
91
+ "quantity": {
92
+ "$ref": "#/$defs/IntegerRange"
93
+ },
94
+ "limits": {
95
+ "$ref": "#/$defs/AutoRechargeLimits"
96
+ }
97
+ },
98
+ "required": [
99
+ "eligible_topups",
100
+ "balance_below",
101
+ "rearm_above",
102
+ "quantity",
103
+ "limits"
104
+ ],
105
+ "title": "AutoRechargeGuardrails",
106
+ "type": "object"
107
+ },
108
+ "AutoRechargeLimits": {
109
+ "additionalProperties": false,
110
+ "properties": {
111
+ "max_purchases": {
112
+ "minimum": 1,
113
+ "title": "Max Purchases",
114
+ "type": "integer"
115
+ },
116
+ "window": {
117
+ "anyOf": [
118
+ {
119
+ "$ref": "#/$defs/CalendarWindow"
120
+ },
121
+ {
122
+ "$ref": "#/$defs/RollingWindow"
123
+ }
124
+ ],
125
+ "title": "Window"
126
+ },
127
+ "max_charge_minor": {
128
+ "minimum": 1,
129
+ "title": "Max Charge Minor",
130
+ "type": "integer"
131
+ },
132
+ "cooldown": {
133
+ "$ref": "#/$defs/Duration"
134
+ },
135
+ "max_consecutive_failures": {
136
+ "default": 3,
137
+ "minimum": 1,
138
+ "title": "Max Consecutive Failures",
139
+ "type": "integer"
140
+ },
141
+ "failure_action": {
142
+ "const": "pause",
143
+ "default": "pause",
144
+ "title": "Failure Action",
145
+ "type": "string"
146
+ }
147
+ },
148
+ "required": [
149
+ "max_purchases",
150
+ "window",
151
+ "max_charge_minor",
152
+ "cooldown"
153
+ ],
154
+ "title": "AutoRechargeLimits",
155
+ "type": "object"
156
+ },
157
+ "Availability": {
158
+ "additionalProperties": false,
159
+ "properties": {
160
+ "starts_at": {
161
+ "anyOf": [
162
+ {
163
+ "format": "date-time",
164
+ "type": "string"
165
+ },
166
+ {
167
+ "type": "null"
168
+ }
169
+ ],
170
+ "default": null,
171
+ "title": "Starts At"
172
+ },
173
+ "ends_at": {
174
+ "anyOf": [
175
+ {
176
+ "format": "date-time",
177
+ "type": "string"
178
+ },
179
+ {
180
+ "type": "null"
181
+ }
182
+ ],
183
+ "default": null,
184
+ "title": "Ends At"
185
+ },
186
+ "regions": {
187
+ "items": {
188
+ "type": "string"
189
+ },
190
+ "title": "Regions",
191
+ "type": "array"
192
+ }
193
+ },
194
+ "title": "Availability",
195
+ "type": "object"
196
+ },
197
+ "BillingInterval": {
198
+ "additionalProperties": false,
199
+ "properties": {
200
+ "unit": {
201
+ "enum": [
202
+ "day",
203
+ "week",
204
+ "month",
205
+ "year"
206
+ ],
207
+ "title": "Unit",
208
+ "type": "string"
209
+ },
210
+ "count": {
211
+ "default": 1,
212
+ "minimum": 1,
213
+ "title": "Count",
214
+ "type": "integer"
215
+ }
216
+ },
217
+ "required": [
218
+ "unit"
219
+ ],
220
+ "title": "BillingInterval",
221
+ "type": "object"
222
+ },
223
+ "BooleanFeature": {
224
+ "additionalProperties": false,
225
+ "properties": {
226
+ "type": {
227
+ "const": "boolean",
228
+ "title": "Type",
229
+ "type": "string"
230
+ },
231
+ "default": {
232
+ "type": "boolean",
233
+ "title": "Default"
234
+ }
235
+ },
236
+ "required": [
237
+ "type",
238
+ "default"
239
+ ],
240
+ "title": "BooleanFeature",
241
+ "type": "object"
242
+ },
243
+ "BucketDefinition": {
244
+ "additionalProperties": false,
245
+ "properties": {
246
+ "priority": {
247
+ "minimum": 0,
248
+ "title": "Priority",
249
+ "type": "integer"
250
+ },
251
+ "expiry": {
252
+ "discriminator": {
253
+ "mapping": {
254
+ "after_grant": "#/$defs/AfterGrantExpiry",
255
+ "end_of_window": "#/$defs/EndOfWindowExpiry",
256
+ "fixed_at": "#/$defs/FixedExpiry",
257
+ "never": "#/$defs/NeverExpiry",
258
+ "subscription_end": "#/$defs/SubscriptionEndExpiry"
259
+ },
260
+ "propertyName": "type"
261
+ },
262
+ "oneOf": [
263
+ {
264
+ "$ref": "#/$defs/NeverExpiry"
265
+ },
266
+ {
267
+ "$ref": "#/$defs/AfterGrantExpiry"
268
+ },
269
+ {
270
+ "$ref": "#/$defs/EndOfWindowExpiry"
271
+ },
272
+ {
273
+ "$ref": "#/$defs/FixedExpiry"
274
+ },
275
+ {
276
+ "$ref": "#/$defs/SubscriptionEndExpiry"
277
+ }
278
+ ],
279
+ "title": "Expiry"
280
+ }
281
+ },
282
+ "required": [
283
+ "priority"
284
+ ],
285
+ "title": "BucketDefinition",
286
+ "type": "object"
287
+ },
288
+ "CalendarWindow": {
289
+ "additionalProperties": false,
290
+ "properties": {
291
+ "type": {
292
+ "const": "calendar",
293
+ "title": "Type",
294
+ "type": "string"
295
+ },
296
+ "unit": {
297
+ "enum": [
298
+ "day",
299
+ "week",
300
+ "month",
301
+ "year"
302
+ ],
303
+ "title": "Unit",
304
+ "type": "string"
305
+ },
306
+ "count": {
307
+ "default": 1,
308
+ "minimum": 1,
309
+ "title": "Count",
310
+ "type": "integer"
311
+ },
312
+ "timezone": {
313
+ "default": "UTC",
314
+ "title": "Timezone",
315
+ "type": "string"
316
+ }
317
+ },
318
+ "required": [
319
+ "type",
320
+ "unit"
321
+ ],
322
+ "title": "CalendarWindow",
323
+ "type": "object"
324
+ },
325
+ "CatalogConfig": {
326
+ "additionalProperties": false,
327
+ "properties": {
328
+ "default_plan": {
329
+ "anyOf": [
330
+ {
331
+ "type": "string"
332
+ },
333
+ {
334
+ "type": "null"
335
+ }
336
+ ],
337
+ "default": null,
338
+ "title": "Default Plan"
339
+ }
340
+ },
341
+ "title": "CatalogConfig",
342
+ "type": "object"
343
+ },
344
+ "ChargeUnmatched": {
345
+ "additionalProperties": false,
346
+ "properties": {
347
+ "action": {
348
+ "const": "charge",
349
+ "title": "Action",
350
+ "type": "string"
351
+ },
352
+ "charge": {
353
+ "discriminator": {
354
+ "mapping": {
355
+ "expression": "#/$defs/ExpressionCharge",
356
+ "flat": "#/$defs/FlatCharge",
357
+ "graduated": "#/$defs/GraduatedCharge",
358
+ "package": "#/$defs/PackageCharge",
359
+ "per_unit": "#/$defs/PerUnitCharge",
360
+ "sum": "#/$defs/SumCharge",
361
+ "volume": "#/$defs/VolumeCharge"
362
+ },
363
+ "propertyName": "type"
364
+ },
365
+ "oneOf": [
366
+ {
367
+ "$ref": "#/$defs/FlatCharge"
368
+ },
369
+ {
370
+ "$ref": "#/$defs/PerUnitCharge"
371
+ },
372
+ {
373
+ "$ref": "#/$defs/PackageCharge"
374
+ },
375
+ {
376
+ "$ref": "#/$defs/GraduatedCharge"
377
+ },
378
+ {
379
+ "$ref": "#/$defs/VolumeCharge"
380
+ },
381
+ {
382
+ "$ref": "#/$defs/ExpressionCharge"
383
+ },
384
+ {
385
+ "$ref": "#/$defs/SumCharge"
386
+ }
387
+ ],
388
+ "title": "Charge"
389
+ }
390
+ },
391
+ "required": [
392
+ "action",
393
+ "charge"
394
+ ],
395
+ "title": "ChargeUnmatched",
396
+ "type": "object"
397
+ },
398
+ "CommerceConfig": {
399
+ "additionalProperties": false,
400
+ "properties": {
401
+ "providers": {
402
+ "additionalProperties": {
403
+ "discriminator": {
404
+ "mapping": {
405
+ "custom": "#/$defs/CustomProvider",
406
+ "dodo": "#/$defs/DodoProvider",
407
+ "stripe": "#/$defs/StripeProvider"
408
+ },
409
+ "propertyName": "type"
410
+ },
411
+ "oneOf": [
412
+ {
413
+ "$ref": "#/$defs/StripeProvider"
414
+ },
415
+ {
416
+ "$ref": "#/$defs/DodoProvider"
417
+ },
418
+ {
419
+ "$ref": "#/$defs/CustomProvider"
420
+ }
421
+ ]
422
+ },
423
+ "title": "Providers",
424
+ "type": "object"
425
+ },
426
+ "offers": {
427
+ "additionalProperties": {
428
+ "discriminator": {
429
+ "mapping": {
430
+ "subscription": "#/$defs/SubscriptionOffer",
431
+ "topup": "#/$defs/TopupOffer"
432
+ },
433
+ "propertyName": "type"
434
+ },
435
+ "oneOf": [
436
+ {
437
+ "$ref": "#/$defs/SubscriptionOffer"
438
+ },
439
+ {
440
+ "$ref": "#/$defs/TopupOffer"
441
+ }
442
+ ]
443
+ },
444
+ "title": "Offers",
445
+ "type": "object"
446
+ },
447
+ "subscription_changes": {
448
+ "anyOf": [
449
+ {
450
+ "$ref": "#/$defs/SubscriptionChanges"
451
+ },
452
+ {
453
+ "type": "null"
454
+ }
455
+ ],
456
+ "default": null
457
+ },
458
+ "auto_recharge": {
459
+ "anyOf": [
460
+ {
461
+ "$ref": "#/$defs/AutoRechargeGuardrails"
462
+ },
463
+ {
464
+ "type": "null"
465
+ }
466
+ ],
467
+ "default": null
468
+ }
469
+ },
470
+ "title": "CommerceConfig",
471
+ "type": "object"
472
+ },
473
+ "CreditAccounting": {
474
+ "additionalProperties": false,
475
+ "properties": {
476
+ "unit": {
477
+ "const": "credit",
478
+ "default": "credit",
479
+ "title": "Unit",
480
+ "type": "string"
481
+ },
482
+ "scale": {
483
+ "const": 6,
484
+ "default": 6,
485
+ "title": "Scale",
486
+ "type": "integer"
487
+ },
488
+ "rounding": {
489
+ "const": "half_up",
490
+ "default": "half_up",
491
+ "title": "Rounding",
492
+ "type": "string"
493
+ }
494
+ },
495
+ "title": "CreditAccounting",
496
+ "type": "object"
497
+ },
498
+ "CreditAllowance": {
499
+ "additionalProperties": false,
500
+ "properties": {
501
+ "amount": {
502
+ "examples": [
503
+ "10.500000"
504
+ ],
505
+ "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
506
+ "title": "Amount",
507
+ "type": "string"
508
+ },
509
+ "priority": {
510
+ "anyOf": [
511
+ {
512
+ "minimum": 0,
513
+ "type": "integer"
514
+ },
515
+ {
516
+ "type": "null"
517
+ }
518
+ ],
519
+ "default": null,
520
+ "description": "Spend priority shared with credit buckets. Lower values are used first; omitting priority preserves legacy allowance-first behavior.",
521
+ "title": "Priority"
522
+ },
523
+ "window": {
524
+ "discriminator": {
525
+ "mapping": {
526
+ "calendar": "#/$defs/CalendarWindow",
527
+ "plan_assignment": "#/$defs/PlanAssignmentWindow",
528
+ "rolling": "#/$defs/RollingWindow"
529
+ },
530
+ "propertyName": "type"
531
+ },
532
+ "oneOf": [
533
+ {
534
+ "$ref": "#/$defs/CalendarWindow"
535
+ },
536
+ {
537
+ "$ref": "#/$defs/RollingWindow"
538
+ },
539
+ {
540
+ "$ref": "#/$defs/PlanAssignmentWindow"
541
+ }
542
+ ],
543
+ "title": "Window"
544
+ }
545
+ },
546
+ "required": [
547
+ "amount",
548
+ "window"
549
+ ],
550
+ "title": "CreditAllowance",
551
+ "type": "object"
552
+ },
553
+ "CreditDisplay": {
554
+ "additionalProperties": false,
555
+ "properties": {
556
+ "currency": {
557
+ "pattern": "^[A-Z]{3}$",
558
+ "title": "Currency",
559
+ "type": "string"
560
+ },
561
+ "units_per_major": {
562
+ "examples": [
563
+ "10.500000"
564
+ ],
565
+ "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
566
+ "title": "Units Per Major",
567
+ "type": "string"
568
+ }
569
+ },
570
+ "required": [
571
+ "currency",
572
+ "units_per_major"
573
+ ],
574
+ "title": "CreditDisplay",
575
+ "type": "object"
576
+ },
577
+ "CreditLinePolicy": {
578
+ "additionalProperties": false,
579
+ "properties": {
580
+ "type": {
581
+ "const": "credit_line",
582
+ "title": "Type",
583
+ "type": "string"
584
+ },
585
+ "limit": {
586
+ "examples": [
587
+ "10.500000"
588
+ ],
589
+ "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
590
+ "title": "Limit",
591
+ "type": "string"
592
+ }
593
+ },
594
+ "required": [
595
+ "type",
596
+ "limit"
597
+ ],
598
+ "title": "CreditLinePolicy",
599
+ "type": "object"
600
+ },
601
+ "CreditsConfig": {
602
+ "additionalProperties": false,
603
+ "properties": {
604
+ "accounting": {
605
+ "$ref": "#/$defs/CreditAccounting",
606
+ "description": "Fixed v1 accounting convention. It may be omitted; canonical output includes the defaults."
607
+ },
608
+ "buckets": {
609
+ "additionalProperties": {
610
+ "$ref": "#/$defs/BucketDefinition"
611
+ },
612
+ "title": "Buckets",
613
+ "type": "object"
614
+ },
615
+ "default_bucket": {
616
+ "anyOf": [
617
+ {
618
+ "type": "string"
619
+ },
620
+ {
621
+ "type": "null"
622
+ }
623
+ ],
624
+ "default": null,
625
+ "title": "Default Bucket"
626
+ },
627
+ "policies": {
628
+ "additionalProperties": {
629
+ "discriminator": {
630
+ "mapping": {
631
+ "credit_line": "#/$defs/CreditLinePolicy",
632
+ "prepaid": "#/$defs/PrepaidCreditPolicy"
633
+ },
634
+ "propertyName": "type"
635
+ },
636
+ "oneOf": [
637
+ {
638
+ "$ref": "#/$defs/PrepaidCreditPolicy"
639
+ },
640
+ {
641
+ "$ref": "#/$defs/CreditLinePolicy"
642
+ }
643
+ ]
644
+ },
645
+ "title": "Policies",
646
+ "type": "object"
647
+ },
648
+ "grant_programs": {
649
+ "additionalProperties": {
650
+ "$ref": "#/$defs/GrantProgram"
651
+ },
652
+ "title": "Grant Programs",
653
+ "type": "object"
654
+ },
655
+ "display": {
656
+ "anyOf": [
657
+ {
658
+ "$ref": "#/$defs/CreditDisplay"
659
+ },
660
+ {
661
+ "type": "null"
662
+ }
663
+ ],
664
+ "default": null
665
+ }
666
+ },
667
+ "title": "CreditsConfig",
668
+ "type": "object"
669
+ },
670
+ "CustomObjectReference": {
671
+ "additionalProperties": false,
672
+ "properties": {
673
+ "type": {
674
+ "const": "custom_object",
675
+ "title": "Type",
676
+ "type": "string"
677
+ },
678
+ "object_kind": {
679
+ "enum": [
680
+ "subscription",
681
+ "one_time"
682
+ ],
683
+ "title": "Object Kind",
684
+ "type": "string"
685
+ },
686
+ "external_id": {
687
+ "minLength": 1,
688
+ "title": "External Id",
689
+ "type": "string"
690
+ }
691
+ },
692
+ "required": [
693
+ "type",
694
+ "object_kind",
695
+ "external_id"
696
+ ],
697
+ "title": "CustomObjectReference",
698
+ "type": "object"
699
+ },
700
+ "CustomProvider": {
701
+ "additionalProperties": false,
702
+ "properties": {
703
+ "type": {
704
+ "const": "custom",
705
+ "title": "Type",
706
+ "type": "string"
707
+ },
708
+ "adapter": {
709
+ "minLength": 1,
710
+ "title": "Adapter",
711
+ "type": "string"
712
+ }
713
+ },
714
+ "required": [
715
+ "type",
716
+ "adapter"
717
+ ],
718
+ "title": "CustomProvider",
719
+ "type": "object"
720
+ },
721
+ "CycleGrant": {
722
+ "additionalProperties": false,
723
+ "properties": {
724
+ "amount": {
725
+ "examples": [
726
+ "10.500000"
727
+ ],
728
+ "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
729
+ "title": "Amount",
730
+ "type": "string"
731
+ },
732
+ "bucket": {
733
+ "title": "Bucket",
734
+ "type": "string"
735
+ },
736
+ "renewal": {
737
+ "enum": [
738
+ "replace_previous",
739
+ "accumulate"
740
+ ],
741
+ "title": "Renewal",
742
+ "type": "string"
743
+ },
744
+ "expiry": {
745
+ "discriminator": {
746
+ "mapping": {
747
+ "after_grant": "#/$defs/AfterGrantExpiry",
748
+ "end_of_window": "#/$defs/EndOfWindowExpiry",
749
+ "fixed_at": "#/$defs/FixedExpiry",
750
+ "never": "#/$defs/NeverExpiry",
751
+ "subscription_end": "#/$defs/SubscriptionEndExpiry"
752
+ },
753
+ "propertyName": "type"
754
+ },
755
+ "oneOf": [
756
+ {
757
+ "$ref": "#/$defs/NeverExpiry"
758
+ },
759
+ {
760
+ "$ref": "#/$defs/AfterGrantExpiry"
761
+ },
762
+ {
763
+ "$ref": "#/$defs/EndOfWindowExpiry"
764
+ },
765
+ {
766
+ "$ref": "#/$defs/FixedExpiry"
767
+ },
768
+ {
769
+ "$ref": "#/$defs/SubscriptionEndExpiry"
770
+ }
771
+ ],
772
+ "title": "Expiry"
773
+ }
774
+ },
775
+ "required": [
776
+ "amount",
777
+ "bucket",
778
+ "renewal"
779
+ ],
780
+ "title": "CycleGrant",
781
+ "type": "object"
782
+ },
783
+ "DecimalRange": {
784
+ "additionalProperties": false,
785
+ "properties": {
786
+ "minimum": {
787
+ "examples": [
788
+ "10.500000"
789
+ ],
790
+ "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
791
+ "title": "Minimum",
792
+ "type": "string"
793
+ },
794
+ "maximum": {
795
+ "examples": [
796
+ "10.500000"
797
+ ],
798
+ "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
799
+ "title": "Maximum",
800
+ "type": "string"
801
+ },
802
+ "default": {
803
+ "type": "string",
804
+ "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
805
+ "examples": [
806
+ "10.500000"
807
+ ],
808
+ "title": "Default"
809
+ }
810
+ },
811
+ "required": [
812
+ "minimum",
813
+ "maximum",
814
+ "default"
815
+ ],
816
+ "title": "DecimalRange",
817
+ "type": "object"
818
+ },
819
+ "DimensionDefinition": {
820
+ "additionalProperties": false,
821
+ "properties": {
822
+ "type": {
823
+ "enum": [
824
+ "string",
825
+ "number",
826
+ "boolean"
827
+ ],
828
+ "title": "Type",
829
+ "type": "string"
830
+ },
831
+ "required": {
832
+ "default": true,
833
+ "title": "Required",
834
+ "type": "boolean"
835
+ }
836
+ },
837
+ "required": [
838
+ "type"
839
+ ],
840
+ "title": "DimensionDefinition",
841
+ "type": "object"
842
+ },
843
+ "DodoProductReference": {
844
+ "additionalProperties": false,
845
+ "properties": {
846
+ "type": {
847
+ "const": "dodo_product",
848
+ "title": "Type",
849
+ "type": "string"
850
+ },
851
+ "product_id": {
852
+ "minLength": 1,
853
+ "title": "Product Id",
854
+ "type": "string"
855
+ }
856
+ },
857
+ "required": [
858
+ "type",
859
+ "product_id"
860
+ ],
861
+ "title": "DodoProductReference",
862
+ "type": "object"
863
+ },
864
+ "DodoProvider": {
865
+ "additionalProperties": false,
866
+ "properties": {
867
+ "type": {
868
+ "const": "dodo",
869
+ "title": "Type",
870
+ "type": "string"
871
+ }
872
+ },
873
+ "required": [
874
+ "type"
875
+ ],
876
+ "title": "DodoProvider",
877
+ "type": "object"
878
+ },
879
+ "Duration": {
880
+ "additionalProperties": false,
881
+ "properties": {
882
+ "unit": {
883
+ "enum": [
884
+ "second",
885
+ "minute",
886
+ "hour",
887
+ "day",
888
+ "week"
889
+ ],
890
+ "title": "Unit",
891
+ "type": "string"
892
+ },
893
+ "count": {
894
+ "minimum": 1,
895
+ "title": "Count",
896
+ "type": "integer"
897
+ }
898
+ },
899
+ "required": [
900
+ "unit",
901
+ "count"
902
+ ],
903
+ "title": "Duration",
904
+ "type": "object"
905
+ },
906
+ "EndOfWindowExpiry": {
907
+ "additionalProperties": false,
908
+ "properties": {
909
+ "type": {
910
+ "const": "end_of_window",
911
+ "title": "Type",
912
+ "type": "string"
913
+ },
914
+ "window": {
915
+ "anyOf": [
916
+ {
917
+ "$ref": "#/$defs/CalendarWindow"
918
+ },
919
+ {
920
+ "$ref": "#/$defs/PlanAssignmentWindow"
921
+ }
922
+ ],
923
+ "title": "Window"
924
+ }
925
+ },
926
+ "required": [
927
+ "type",
928
+ "window"
929
+ ],
930
+ "title": "EndOfWindowExpiry",
931
+ "type": "object"
932
+ },
933
+ "EntitlementsConfig": {
934
+ "additionalProperties": false,
935
+ "properties": {
936
+ "features": {
937
+ "additionalProperties": {
938
+ "discriminator": {
939
+ "mapping": {
940
+ "boolean": "#/$defs/BooleanFeature",
941
+ "enum": "#/$defs/EnumFeature",
942
+ "integer": "#/$defs/IntegerFeature",
943
+ "string": "#/$defs/StringFeature"
944
+ },
945
+ "propertyName": "type"
946
+ },
947
+ "oneOf": [
948
+ {
949
+ "$ref": "#/$defs/BooleanFeature"
950
+ },
951
+ {
952
+ "$ref": "#/$defs/EnumFeature"
953
+ },
954
+ {
955
+ "$ref": "#/$defs/IntegerFeature"
956
+ },
957
+ {
958
+ "$ref": "#/$defs/StringFeature"
959
+ }
960
+ ]
961
+ },
962
+ "title": "Features",
963
+ "type": "object"
964
+ }
965
+ },
966
+ "title": "EntitlementsConfig",
967
+ "type": "object"
968
+ },
969
+ "EnumFeature": {
970
+ "additionalProperties": false,
971
+ "properties": {
972
+ "type": {
973
+ "const": "enum",
974
+ "title": "Type",
975
+ "type": "string"
976
+ },
977
+ "values": {
978
+ "items": {
979
+ "type": "string"
980
+ },
981
+ "minItems": 1,
982
+ "title": "Values",
983
+ "type": "array"
984
+ },
985
+ "default": {
986
+ "type": "string",
987
+ "title": "Default"
988
+ }
989
+ },
990
+ "required": [
991
+ "type",
992
+ "values",
993
+ "default"
994
+ ],
995
+ "title": "EnumFeature",
996
+ "type": "object"
997
+ },
998
+ "EqualMatcher": {
999
+ "additionalProperties": false,
1000
+ "properties": {
1001
+ "op": {
1002
+ "const": "eq",
1003
+ "title": "Op",
1004
+ "type": "string"
1005
+ },
1006
+ "value": {
1007
+ "anyOf": [
1008
+ {
1009
+ "type": "string"
1010
+ },
1011
+ {
1012
+ "type": "number"
1013
+ },
1014
+ {
1015
+ "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
1016
+ "type": "string"
1017
+ },
1018
+ {
1019
+ "type": "boolean"
1020
+ }
1021
+ ],
1022
+ "title": "Value"
1023
+ }
1024
+ },
1025
+ "required": [
1026
+ "op",
1027
+ "value"
1028
+ ],
1029
+ "title": "EqualMatcher",
1030
+ "type": "object"
1031
+ },
1032
+ "ExpressionCharge": {
1033
+ "additionalProperties": false,
1034
+ "properties": {
1035
+ "type": {
1036
+ "const": "expression",
1037
+ "title": "Type",
1038
+ "type": "string"
1039
+ },
1040
+ "formula": {
1041
+ "minLength": 1,
1042
+ "title": "Formula",
1043
+ "type": "string"
1044
+ }
1045
+ },
1046
+ "required": [
1047
+ "type",
1048
+ "formula"
1049
+ ],
1050
+ "title": "ExpressionCharge",
1051
+ "type": "object"
1052
+ },
1053
+ "FixedExpiry": {
1054
+ "additionalProperties": false,
1055
+ "properties": {
1056
+ "type": {
1057
+ "const": "fixed_at",
1058
+ "title": "Type",
1059
+ "type": "string"
1060
+ },
1061
+ "at": {
1062
+ "format": "date-time",
1063
+ "title": "At",
1064
+ "type": "string"
1065
+ }
1066
+ },
1067
+ "required": [
1068
+ "type",
1069
+ "at"
1070
+ ],
1071
+ "title": "FixedExpiry",
1072
+ "type": "object"
1073
+ },
1074
+ "FlatCharge": {
1075
+ "additionalProperties": false,
1076
+ "properties": {
1077
+ "type": {
1078
+ "const": "flat",
1079
+ "title": "Type",
1080
+ "type": "string"
1081
+ },
1082
+ "amount": {
1083
+ "examples": [
1084
+ "10.500000"
1085
+ ],
1086
+ "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
1087
+ "title": "Amount",
1088
+ "type": "string"
1089
+ }
1090
+ },
1091
+ "required": [
1092
+ "type",
1093
+ "amount"
1094
+ ],
1095
+ "title": "FlatCharge",
1096
+ "type": "object"
1097
+ },
1098
+ "GraduatedCharge": {
1099
+ "additionalProperties": false,
1100
+ "properties": {
1101
+ "type": {
1102
+ "const": "graduated",
1103
+ "title": "Type",
1104
+ "type": "string"
1105
+ },
1106
+ "measure": {
1107
+ "title": "Measure",
1108
+ "type": "string"
1109
+ },
1110
+ "tiers": {
1111
+ "items": {
1112
+ "$ref": "#/$defs/GraduatedTier"
1113
+ },
1114
+ "minItems": 1,
1115
+ "title": "Tiers",
1116
+ "type": "array"
1117
+ }
1118
+ },
1119
+ "required": [
1120
+ "type",
1121
+ "measure",
1122
+ "tiers"
1123
+ ],
1124
+ "title": "GraduatedCharge",
1125
+ "type": "object"
1126
+ },
1127
+ "GraduatedTier": {
1128
+ "additionalProperties": false,
1129
+ "properties": {
1130
+ "up_to": {
1131
+ "anyOf": [
1132
+ {
1133
+ "examples": [
1134
+ "10.500000"
1135
+ ],
1136
+ "gt": 0,
1137
+ "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
1138
+ "type": "string"
1139
+ },
1140
+ {
1141
+ "type": "null"
1142
+ }
1143
+ ],
1144
+ "default": null,
1145
+ "title": "Up To"
1146
+ },
1147
+ "rate": {
1148
+ "examples": [
1149
+ "10.500000"
1150
+ ],
1151
+ "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
1152
+ "title": "Rate",
1153
+ "type": "string"
1154
+ }
1155
+ },
1156
+ "required": [
1157
+ "rate"
1158
+ ],
1159
+ "title": "GraduatedTier",
1160
+ "type": "object"
1161
+ },
1162
+ "GrantAward": {
1163
+ "additionalProperties": false,
1164
+ "properties": {
1165
+ "recipient": {
1166
+ "default": "subject",
1167
+ "enum": [
1168
+ "subject",
1169
+ "referrer"
1170
+ ],
1171
+ "title": "Recipient",
1172
+ "type": "string"
1173
+ },
1174
+ "amount": {
1175
+ "examples": [
1176
+ "10.500000"
1177
+ ],
1178
+ "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
1179
+ "title": "Amount",
1180
+ "type": "string"
1181
+ },
1182
+ "bucket": {
1183
+ "title": "Bucket",
1184
+ "type": "string"
1185
+ },
1186
+ "expiry": {
1187
+ "anyOf": [
1188
+ {
1189
+ "discriminator": {
1190
+ "mapping": {
1191
+ "after_grant": "#/$defs/AfterGrantExpiry",
1192
+ "end_of_window": "#/$defs/EndOfWindowExpiry",
1193
+ "fixed_at": "#/$defs/FixedExpiry",
1194
+ "never": "#/$defs/NeverExpiry",
1195
+ "subscription_end": "#/$defs/SubscriptionEndExpiry"
1196
+ },
1197
+ "propertyName": "type"
1198
+ },
1199
+ "oneOf": [
1200
+ {
1201
+ "$ref": "#/$defs/NeverExpiry"
1202
+ },
1203
+ {
1204
+ "$ref": "#/$defs/AfterGrantExpiry"
1205
+ },
1206
+ {
1207
+ "$ref": "#/$defs/EndOfWindowExpiry"
1208
+ },
1209
+ {
1210
+ "$ref": "#/$defs/FixedExpiry"
1211
+ },
1212
+ {
1213
+ "$ref": "#/$defs/SubscriptionEndExpiry"
1214
+ }
1215
+ ]
1216
+ },
1217
+ {
1218
+ "type": "null"
1219
+ }
1220
+ ],
1221
+ "default": null,
1222
+ "title": "Expiry"
1223
+ }
1224
+ },
1225
+ "required": [
1226
+ "amount",
1227
+ "bucket"
1228
+ ],
1229
+ "title": "GrantAward",
1230
+ "type": "object"
1231
+ },
1232
+ "GrantEligibility": {
1233
+ "additionalProperties": false,
1234
+ "properties": {
1235
+ "plans": {
1236
+ "items": {
1237
+ "type": "string"
1238
+ },
1239
+ "title": "Plans",
1240
+ "type": "array"
1241
+ },
1242
+ "regions": {
1243
+ "items": {
1244
+ "type": "string"
1245
+ },
1246
+ "title": "Regions",
1247
+ "type": "array"
1248
+ }
1249
+ },
1250
+ "title": "GrantEligibility",
1251
+ "type": "object"
1252
+ },
1253
+ "GrantProgram": {
1254
+ "additionalProperties": false,
1255
+ "properties": {
1256
+ "trigger": {
1257
+ "enum": [
1258
+ "account_created",
1259
+ "referral_completed",
1260
+ "promo_code_redeemed",
1261
+ "manual"
1262
+ ],
1263
+ "title": "Trigger",
1264
+ "type": "string"
1265
+ },
1266
+ "awards": {
1267
+ "items": {
1268
+ "$ref": "#/$defs/GrantAward"
1269
+ },
1270
+ "minItems": 1,
1271
+ "title": "Awards",
1272
+ "type": "array"
1273
+ },
1274
+ "availability": {
1275
+ "anyOf": [
1276
+ {
1277
+ "$ref": "#/$defs/Availability"
1278
+ },
1279
+ {
1280
+ "type": "null"
1281
+ }
1282
+ ],
1283
+ "default": null
1284
+ },
1285
+ "eligibility": {
1286
+ "$ref": "#/$defs/GrantEligibility"
1287
+ },
1288
+ "max_awards_per_subject": {
1289
+ "default": 1,
1290
+ "minimum": 1,
1291
+ "title": "Max Awards Per Subject",
1292
+ "type": "integer"
1293
+ },
1294
+ "idempotency_scope": {
1295
+ "default": "subject",
1296
+ "enum": [
1297
+ "subject",
1298
+ "event"
1299
+ ],
1300
+ "title": "Idempotency Scope",
1301
+ "type": "string"
1302
+ }
1303
+ },
1304
+ "required": [
1305
+ "trigger",
1306
+ "awards"
1307
+ ],
1308
+ "title": "GrantProgram",
1309
+ "type": "object"
1310
+ },
1311
+ "InMatcher": {
1312
+ "additionalProperties": false,
1313
+ "properties": {
1314
+ "op": {
1315
+ "const": "in",
1316
+ "title": "Op",
1317
+ "type": "string"
1318
+ },
1319
+ "values": {
1320
+ "items": {
1321
+ "anyOf": [
1322
+ {
1323
+ "type": "string"
1324
+ },
1325
+ {
1326
+ "type": "number"
1327
+ },
1328
+ {
1329
+ "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
1330
+ "type": "string"
1331
+ },
1332
+ {
1333
+ "type": "boolean"
1334
+ }
1335
+ ]
1336
+ },
1337
+ "minItems": 1,
1338
+ "title": "Values",
1339
+ "type": "array"
1340
+ }
1341
+ },
1342
+ "required": [
1343
+ "op",
1344
+ "values"
1345
+ ],
1346
+ "title": "InMatcher",
1347
+ "type": "object"
1348
+ },
1349
+ "IntegerFeature": {
1350
+ "additionalProperties": false,
1351
+ "properties": {
1352
+ "type": {
1353
+ "const": "integer",
1354
+ "title": "Type",
1355
+ "type": "string"
1356
+ },
1357
+ "default": {
1358
+ "type": "integer",
1359
+ "title": "Default"
1360
+ },
1361
+ "minimum": {
1362
+ "anyOf": [
1363
+ {
1364
+ "type": "integer"
1365
+ },
1366
+ {
1367
+ "type": "null"
1368
+ }
1369
+ ],
1370
+ "default": null,
1371
+ "title": "Minimum"
1372
+ },
1373
+ "maximum": {
1374
+ "anyOf": [
1375
+ {
1376
+ "type": "integer"
1377
+ },
1378
+ {
1379
+ "type": "null"
1380
+ }
1381
+ ],
1382
+ "default": null,
1383
+ "title": "Maximum"
1384
+ }
1385
+ },
1386
+ "required": [
1387
+ "type",
1388
+ "default"
1389
+ ],
1390
+ "title": "IntegerFeature",
1391
+ "type": "object"
1392
+ },
1393
+ "IntegerRange": {
1394
+ "additionalProperties": false,
1395
+ "properties": {
1396
+ "minimum": {
1397
+ "minimum": 1,
1398
+ "title": "Minimum",
1399
+ "type": "integer"
1400
+ },
1401
+ "maximum": {
1402
+ "minimum": 1,
1403
+ "title": "Maximum",
1404
+ "type": "integer"
1405
+ },
1406
+ "default": {
1407
+ "type": "integer",
1408
+ "minimum": 1,
1409
+ "title": "Default"
1410
+ }
1411
+ },
1412
+ "required": [
1413
+ "minimum",
1414
+ "maximum",
1415
+ "default"
1416
+ ],
1417
+ "title": "IntegerRange",
1418
+ "type": "object"
1419
+ },
1420
+ "MeasureDefinition": {
1421
+ "additionalProperties": false,
1422
+ "properties": {
1423
+ "unit": {
1424
+ "title": "Unit",
1425
+ "type": "string"
1426
+ }
1427
+ },
1428
+ "required": [
1429
+ "unit"
1430
+ ],
1431
+ "title": "MeasureDefinition",
1432
+ "type": "object"
1433
+ },
1434
+ "NeverExpiry": {
1435
+ "additionalProperties": false,
1436
+ "properties": {
1437
+ "type": {
1438
+ "const": "never",
1439
+ "title": "Type",
1440
+ "type": "string"
1441
+ }
1442
+ },
1443
+ "required": [
1444
+ "type"
1445
+ ],
1446
+ "title": "NeverExpiry",
1447
+ "type": "object"
1448
+ },
1449
+ "NotInMatcher": {
1450
+ "additionalProperties": false,
1451
+ "properties": {
1452
+ "op": {
1453
+ "const": "not_in",
1454
+ "title": "Op",
1455
+ "type": "string"
1456
+ },
1457
+ "values": {
1458
+ "items": {
1459
+ "anyOf": [
1460
+ {
1461
+ "type": "string"
1462
+ },
1463
+ {
1464
+ "type": "number"
1465
+ },
1466
+ {
1467
+ "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
1468
+ "type": "string"
1469
+ },
1470
+ {
1471
+ "type": "boolean"
1472
+ }
1473
+ ]
1474
+ },
1475
+ "minItems": 1,
1476
+ "title": "Values",
1477
+ "type": "array"
1478
+ }
1479
+ },
1480
+ "required": [
1481
+ "op",
1482
+ "values"
1483
+ ],
1484
+ "title": "NotInMatcher",
1485
+ "type": "object"
1486
+ },
1487
+ "OfferPrice": {
1488
+ "additionalProperties": false,
1489
+ "properties": {
1490
+ "amount_minor": {
1491
+ "minimum": 0,
1492
+ "title": "Amount Minor",
1493
+ "type": "integer"
1494
+ },
1495
+ "currency": {
1496
+ "title": "Currency",
1497
+ "type": "string"
1498
+ },
1499
+ "tax_behavior": {
1500
+ "default": "unspecified",
1501
+ "enum": [
1502
+ "inclusive",
1503
+ "exclusive",
1504
+ "unspecified"
1505
+ ],
1506
+ "title": "Tax Behavior",
1507
+ "type": "string"
1508
+ }
1509
+ },
1510
+ "required": [
1511
+ "amount_minor",
1512
+ "currency"
1513
+ ],
1514
+ "title": "OfferPrice",
1515
+ "type": "object"
1516
+ },
1517
+ "OperationAdmission": {
1518
+ "additionalProperties": false,
1519
+ "properties": {
1520
+ "max_in_flight": {
1521
+ "minimum": 1,
1522
+ "title": "Max In Flight",
1523
+ "type": "integer"
1524
+ }
1525
+ },
1526
+ "required": [
1527
+ "max_in_flight"
1528
+ ],
1529
+ "title": "OperationAdmission",
1530
+ "type": "object"
1531
+ },
1532
+ "OperationDefinition": {
1533
+ "additionalProperties": false,
1534
+ "properties": {
1535
+ "measures": {
1536
+ "additionalProperties": {
1537
+ "$ref": "#/$defs/MeasureDefinition"
1538
+ },
1539
+ "title": "Measures",
1540
+ "type": "object"
1541
+ },
1542
+ "dimensions": {
1543
+ "additionalProperties": {
1544
+ "$ref": "#/$defs/DimensionDefinition"
1545
+ },
1546
+ "title": "Dimensions",
1547
+ "type": "object"
1548
+ }
1549
+ },
1550
+ "required": [
1551
+ "measures"
1552
+ ],
1553
+ "title": "OperationDefinition",
1554
+ "type": "object"
1555
+ },
1556
+ "OperationPricing": {
1557
+ "additionalProperties": false,
1558
+ "properties": {
1559
+ "rules": {
1560
+ "items": {
1561
+ "$ref": "#/$defs/PriceRule"
1562
+ },
1563
+ "title": "Rules",
1564
+ "type": "array"
1565
+ },
1566
+ "unmatched": {
1567
+ "discriminator": {
1568
+ "mapping": {
1569
+ "charge": "#/$defs/ChargeUnmatched",
1570
+ "reject": "#/$defs/RejectUnmatched"
1571
+ },
1572
+ "propertyName": "action"
1573
+ },
1574
+ "oneOf": [
1575
+ {
1576
+ "$ref": "#/$defs/RejectUnmatched"
1577
+ },
1578
+ {
1579
+ "$ref": "#/$defs/ChargeUnmatched"
1580
+ }
1581
+ ],
1582
+ "title": "Unmatched"
1583
+ }
1584
+ },
1585
+ "required": [
1586
+ "unmatched"
1587
+ ],
1588
+ "title": "OperationPricing",
1589
+ "type": "object"
1590
+ },
1591
+ "PackageCharge": {
1592
+ "additionalProperties": false,
1593
+ "properties": {
1594
+ "type": {
1595
+ "const": "package",
1596
+ "title": "Type",
1597
+ "type": "string"
1598
+ },
1599
+ "measure": {
1600
+ "title": "Measure",
1601
+ "type": "string"
1602
+ },
1603
+ "units": {
1604
+ "examples": [
1605
+ "10.500000"
1606
+ ],
1607
+ "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
1608
+ "title": "Units",
1609
+ "type": "string"
1610
+ },
1611
+ "amount": {
1612
+ "examples": [
1613
+ "10.500000"
1614
+ ],
1615
+ "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
1616
+ "title": "Amount",
1617
+ "type": "string"
1618
+ },
1619
+ "rounding": {
1620
+ "default": "ceil",
1621
+ "enum": [
1622
+ "ceil",
1623
+ "floor",
1624
+ "nearest"
1625
+ ],
1626
+ "title": "Rounding",
1627
+ "type": "string"
1628
+ }
1629
+ },
1630
+ "required": [
1631
+ "type",
1632
+ "measure",
1633
+ "units",
1634
+ "amount"
1635
+ ],
1636
+ "title": "PackageCharge",
1637
+ "type": "object"
1638
+ },
1639
+ "PerUnitCharge": {
1640
+ "additionalProperties": false,
1641
+ "properties": {
1642
+ "type": {
1643
+ "const": "per_unit",
1644
+ "title": "Type",
1645
+ "type": "string"
1646
+ },
1647
+ "measure": {
1648
+ "title": "Measure",
1649
+ "type": "string"
1650
+ },
1651
+ "rate": {
1652
+ "description": "Credits charged for each unit_size units of the selected measure.",
1653
+ "examples": [
1654
+ "10.500000"
1655
+ ],
1656
+ "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
1657
+ "title": "Rate",
1658
+ "type": "string"
1659
+ },
1660
+ "unit_size": {
1661
+ "default": "1",
1662
+ "description": "Number of measure units represented by one rate unit; use 1000000 for per-million-token rates.",
1663
+ "examples": [
1664
+ "10.500000"
1665
+ ],
1666
+ "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
1667
+ "title": "Unit Size",
1668
+ "type": "string"
1669
+ }
1670
+ },
1671
+ "required": [
1672
+ "type",
1673
+ "measure",
1674
+ "rate"
1675
+ ],
1676
+ "title": "PerUnitCharge",
1677
+ "type": "object"
1678
+ },
1679
+ "PlanAssignmentWindow": {
1680
+ "additionalProperties": false,
1681
+ "properties": {
1682
+ "type": {
1683
+ "const": "plan_assignment",
1684
+ "title": "Type",
1685
+ "type": "string"
1686
+ },
1687
+ "interval": {
1688
+ "$ref": "#/$defs/BillingInterval"
1689
+ },
1690
+ "timezone": {
1691
+ "default": "UTC",
1692
+ "title": "Timezone",
1693
+ "type": "string"
1694
+ }
1695
+ },
1696
+ "required": [
1697
+ "type",
1698
+ "interval"
1699
+ ],
1700
+ "title": "PlanAssignmentWindow",
1701
+ "type": "object"
1702
+ },
1703
+ "PlanDefinition": {
1704
+ "additionalProperties": false,
1705
+ "properties": {
1706
+ "display_name": {
1707
+ "minLength": 1,
1708
+ "title": "Display Name",
1709
+ "type": "string"
1710
+ },
1711
+ "rank": {
1712
+ "default": 0,
1713
+ "description": "Public catalog ordering. Lower ranks appear first; ties are ordered by plan key.",
1714
+ "minimum": 0,
1715
+ "title": "Rank",
1716
+ "type": "integer"
1717
+ },
1718
+ "description": {
1719
+ "anyOf": [
1720
+ {
1721
+ "type": "string"
1722
+ },
1723
+ {
1724
+ "type": "null"
1725
+ }
1726
+ ],
1727
+ "default": null,
1728
+ "title": "Description"
1729
+ },
1730
+ "rate_card": {
1731
+ "anyOf": [
1732
+ {
1733
+ "type": "string"
1734
+ },
1735
+ {
1736
+ "type": "null"
1737
+ }
1738
+ ],
1739
+ "default": null,
1740
+ "title": "Rate Card"
1741
+ },
1742
+ "allowed_operations": {
1743
+ "items": {
1744
+ "type": "string"
1745
+ },
1746
+ "title": "Allowed Operations",
1747
+ "type": "array"
1748
+ },
1749
+ "features": {
1750
+ "additionalProperties": {
1751
+ "anyOf": [
1752
+ {
1753
+ "type": "boolean"
1754
+ },
1755
+ {
1756
+ "type": "integer"
1757
+ },
1758
+ {
1759
+ "type": "string"
1760
+ }
1761
+ ]
1762
+ },
1763
+ "title": "Features",
1764
+ "type": "object"
1765
+ },
1766
+ "credit_allowance": {
1767
+ "anyOf": [
1768
+ {
1769
+ "$ref": "#/$defs/CreditAllowance"
1770
+ },
1771
+ {
1772
+ "type": "null"
1773
+ }
1774
+ ],
1775
+ "default": null
1776
+ },
1777
+ "quotas": {
1778
+ "additionalProperties": {
1779
+ "$ref": "#/$defs/QuotaDefinition"
1780
+ },
1781
+ "title": "Quotas",
1782
+ "type": "object"
1783
+ },
1784
+ "credit_policy": {
1785
+ "anyOf": [
1786
+ {
1787
+ "type": "string"
1788
+ },
1789
+ {
1790
+ "type": "null"
1791
+ }
1792
+ ],
1793
+ "default": null,
1794
+ "title": "Credit Policy"
1795
+ },
1796
+ "admission_policy": {
1797
+ "anyOf": [
1798
+ {
1799
+ "type": "string"
1800
+ },
1801
+ {
1802
+ "type": "null"
1803
+ }
1804
+ ],
1805
+ "default": null,
1806
+ "title": "Admission Policy"
1807
+ },
1808
+ "evolution": {
1809
+ "anyOf": [
1810
+ {
1811
+ "$ref": "#/$defs/PlanEvolution"
1812
+ },
1813
+ {
1814
+ "type": "null"
1815
+ }
1816
+ ],
1817
+ "default": null,
1818
+ "description": "Catalog evolution defaults. When omitted, subscription-backed plans use next_renewal and other plans use immediate; canonical output materializes the default."
1819
+ }
1820
+ },
1821
+ "required": [
1822
+ "display_name"
1823
+ ],
1824
+ "title": "PlanDefinition",
1825
+ "type": "object"
1826
+ },
1827
+ "PlanEvolution": {
1828
+ "additionalProperties": false,
1829
+ "properties": {
1830
+ "default_rollout": {
1831
+ "description": "Default adoption timing for existing assignments when a newer catalog revision changes this plan. A catalog activation may override it for one release.",
1832
+ "enum": [
1833
+ "immediate",
1834
+ "next_renewal",
1835
+ "new_assignments_only"
1836
+ ],
1837
+ "title": "Default Rollout",
1838
+ "type": "string"
1839
+ }
1840
+ },
1841
+ "required": [
1842
+ "default_rollout"
1843
+ ],
1844
+ "title": "PlanEvolution",
1845
+ "type": "object"
1846
+ },
1847
+ "PrefixMatcher": {
1848
+ "additionalProperties": false,
1849
+ "properties": {
1850
+ "op": {
1851
+ "const": "prefix",
1852
+ "title": "Op",
1853
+ "type": "string"
1854
+ },
1855
+ "value": {
1856
+ "minLength": 1,
1857
+ "title": "Value",
1858
+ "type": "string"
1859
+ }
1860
+ },
1861
+ "required": [
1862
+ "op",
1863
+ "value"
1864
+ ],
1865
+ "title": "PrefixMatcher",
1866
+ "type": "object"
1867
+ },
1868
+ "PrepaidCreditPolicy": {
1869
+ "additionalProperties": false,
1870
+ "properties": {
1871
+ "type": {
1872
+ "const": "prepaid",
1873
+ "title": "Type",
1874
+ "type": "string"
1875
+ }
1876
+ },
1877
+ "required": [
1878
+ "type"
1879
+ ],
1880
+ "title": "PrepaidCreditPolicy",
1881
+ "type": "object"
1882
+ },
1883
+ "PriceRule": {
1884
+ "additionalProperties": false,
1885
+ "properties": {
1886
+ "when": {
1887
+ "additionalProperties": {
1888
+ "discriminator": {
1889
+ "mapping": {
1890
+ "eq": "#/$defs/EqualMatcher",
1891
+ "in": "#/$defs/InMatcher",
1892
+ "not_in": "#/$defs/NotInMatcher",
1893
+ "prefix": "#/$defs/PrefixMatcher",
1894
+ "range": "#/$defs/RangeMatcher"
1895
+ },
1896
+ "propertyName": "op"
1897
+ },
1898
+ "oneOf": [
1899
+ {
1900
+ "$ref": "#/$defs/EqualMatcher"
1901
+ },
1902
+ {
1903
+ "$ref": "#/$defs/InMatcher"
1904
+ },
1905
+ {
1906
+ "$ref": "#/$defs/NotInMatcher"
1907
+ },
1908
+ {
1909
+ "$ref": "#/$defs/PrefixMatcher"
1910
+ },
1911
+ {
1912
+ "$ref": "#/$defs/RangeMatcher"
1913
+ }
1914
+ ]
1915
+ },
1916
+ "minProperties": 1,
1917
+ "title": "When",
1918
+ "type": "object"
1919
+ },
1920
+ "charge": {
1921
+ "discriminator": {
1922
+ "mapping": {
1923
+ "expression": "#/$defs/ExpressionCharge",
1924
+ "flat": "#/$defs/FlatCharge",
1925
+ "graduated": "#/$defs/GraduatedCharge",
1926
+ "package": "#/$defs/PackageCharge",
1927
+ "per_unit": "#/$defs/PerUnitCharge",
1928
+ "sum": "#/$defs/SumCharge",
1929
+ "volume": "#/$defs/VolumeCharge"
1930
+ },
1931
+ "propertyName": "type"
1932
+ },
1933
+ "oneOf": [
1934
+ {
1935
+ "$ref": "#/$defs/FlatCharge"
1936
+ },
1937
+ {
1938
+ "$ref": "#/$defs/PerUnitCharge"
1939
+ },
1940
+ {
1941
+ "$ref": "#/$defs/PackageCharge"
1942
+ },
1943
+ {
1944
+ "$ref": "#/$defs/GraduatedCharge"
1945
+ },
1946
+ {
1947
+ "$ref": "#/$defs/VolumeCharge"
1948
+ },
1949
+ {
1950
+ "$ref": "#/$defs/ExpressionCharge"
1951
+ },
1952
+ {
1953
+ "$ref": "#/$defs/SumCharge"
1954
+ }
1955
+ ],
1956
+ "title": "Charge"
1957
+ }
1958
+ },
1959
+ "required": [
1960
+ "when",
1961
+ "charge"
1962
+ ],
1963
+ "title": "PriceRule",
1964
+ "type": "object"
1965
+ },
1966
+ "PricingConfig": {
1967
+ "additionalProperties": false,
1968
+ "properties": {
1969
+ "operations": {
1970
+ "additionalProperties": {
1971
+ "$ref": "#/$defs/OperationDefinition"
1972
+ },
1973
+ "title": "Operations",
1974
+ "type": "object"
1975
+ },
1976
+ "rate_cards": {
1977
+ "additionalProperties": {
1978
+ "$ref": "#/$defs/RateCard"
1979
+ },
1980
+ "title": "Rate Cards",
1981
+ "type": "object"
1982
+ }
1983
+ },
1984
+ "required": [
1985
+ "operations",
1986
+ "rate_cards"
1987
+ ],
1988
+ "title": "PricingConfig",
1989
+ "type": "object"
1990
+ },
1991
+ "QuantityBounds": {
1992
+ "additionalProperties": false,
1993
+ "properties": {
1994
+ "minimum": {
1995
+ "default": 1,
1996
+ "minimum": 1,
1997
+ "title": "Minimum",
1998
+ "type": "integer"
1999
+ },
2000
+ "maximum": {
2001
+ "default": 1,
2002
+ "minimum": 1,
2003
+ "title": "Maximum",
2004
+ "type": "integer"
2005
+ },
2006
+ "default": {
2007
+ "type": "integer",
2008
+ "minimum": 1,
2009
+ "default": 1,
2010
+ "title": "Default"
2011
+ }
2012
+ },
2013
+ "title": "QuantityBounds",
2014
+ "type": "object"
2015
+ },
2016
+ "QuotaDefinition": {
2017
+ "additionalProperties": false,
2018
+ "properties": {
2019
+ "operation": {
2020
+ "title": "Operation",
2021
+ "type": "string"
2022
+ },
2023
+ "measure": {
2024
+ "title": "Measure",
2025
+ "type": "string"
2026
+ },
2027
+ "limit": {
2028
+ "examples": [
2029
+ "10.500000"
2030
+ ],
2031
+ "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
2032
+ "title": "Limit",
2033
+ "type": "string"
2034
+ },
2035
+ "window": {
2036
+ "discriminator": {
2037
+ "mapping": {
2038
+ "calendar": "#/$defs/CalendarWindow",
2039
+ "plan_assignment": "#/$defs/PlanAssignmentWindow",
2040
+ "rolling": "#/$defs/RollingWindow"
2041
+ },
2042
+ "propertyName": "type"
2043
+ },
2044
+ "oneOf": [
2045
+ {
2046
+ "$ref": "#/$defs/CalendarWindow"
2047
+ },
2048
+ {
2049
+ "$ref": "#/$defs/RollingWindow"
2050
+ },
2051
+ {
2052
+ "$ref": "#/$defs/PlanAssignmentWindow"
2053
+ }
2054
+ ],
2055
+ "title": "Window"
2056
+ },
2057
+ "enforcement": {
2058
+ "enum": [
2059
+ "block",
2060
+ "allow"
2061
+ ],
2062
+ "title": "Enforcement",
2063
+ "type": "string"
2064
+ },
2065
+ "emit_at_percent": {
2066
+ "items": {
2067
+ "type": "integer"
2068
+ },
2069
+ "title": "Emit At Percent",
2070
+ "type": "array"
2071
+ }
2072
+ },
2073
+ "required": [
2074
+ "operation",
2075
+ "measure",
2076
+ "limit",
2077
+ "window",
2078
+ "enforcement"
2079
+ ],
2080
+ "title": "QuotaDefinition",
2081
+ "type": "object"
2082
+ },
2083
+ "RangeMatcher": {
2084
+ "additionalProperties": false,
2085
+ "properties": {
2086
+ "op": {
2087
+ "const": "range",
2088
+ "title": "Op",
2089
+ "type": "string"
2090
+ },
2091
+ "gt": {
2092
+ "anyOf": [
2093
+ {
2094
+ "examples": [
2095
+ "10.500000"
2096
+ ],
2097
+ "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
2098
+ "type": "string"
2099
+ },
2100
+ {
2101
+ "type": "null"
2102
+ }
2103
+ ],
2104
+ "default": null,
2105
+ "title": "Gt"
2106
+ },
2107
+ "gte": {
2108
+ "anyOf": [
2109
+ {
2110
+ "examples": [
2111
+ "10.500000"
2112
+ ],
2113
+ "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
2114
+ "type": "string"
2115
+ },
2116
+ {
2117
+ "type": "null"
2118
+ }
2119
+ ],
2120
+ "default": null,
2121
+ "title": "Gte"
2122
+ },
2123
+ "lt": {
2124
+ "anyOf": [
2125
+ {
2126
+ "examples": [
2127
+ "10.500000"
2128
+ ],
2129
+ "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
2130
+ "type": "string"
2131
+ },
2132
+ {
2133
+ "type": "null"
2134
+ }
2135
+ ],
2136
+ "default": null,
2137
+ "title": "Lt"
2138
+ },
2139
+ "lte": {
2140
+ "anyOf": [
2141
+ {
2142
+ "examples": [
2143
+ "10.500000"
2144
+ ],
2145
+ "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
2146
+ "type": "string"
2147
+ },
2148
+ {
2149
+ "type": "null"
2150
+ }
2151
+ ],
2152
+ "default": null,
2153
+ "title": "Lte"
2154
+ }
2155
+ },
2156
+ "required": [
2157
+ "op"
2158
+ ],
2159
+ "title": "RangeMatcher",
2160
+ "type": "object"
2161
+ },
2162
+ "RateCard": {
2163
+ "additionalProperties": false,
2164
+ "properties": {
2165
+ "extends": {
2166
+ "anyOf": [
2167
+ {
2168
+ "type": "string"
2169
+ },
2170
+ {
2171
+ "type": "null"
2172
+ }
2173
+ ],
2174
+ "default": null,
2175
+ "title": "Extends"
2176
+ },
2177
+ "operations": {
2178
+ "additionalProperties": {
2179
+ "$ref": "#/$defs/OperationPricing"
2180
+ },
2181
+ "title": "Operations",
2182
+ "type": "object"
2183
+ }
2184
+ },
2185
+ "title": "RateCard",
2186
+ "type": "object"
2187
+ },
2188
+ "RejectUnmatched": {
2189
+ "additionalProperties": false,
2190
+ "properties": {
2191
+ "action": {
2192
+ "const": "reject",
2193
+ "title": "Action",
2194
+ "type": "string"
2195
+ }
2196
+ },
2197
+ "required": [
2198
+ "action"
2199
+ ],
2200
+ "title": "RejectUnmatched",
2201
+ "type": "object"
2202
+ },
2203
+ "RollingWindow": {
2204
+ "additionalProperties": false,
2205
+ "properties": {
2206
+ "type": {
2207
+ "const": "rolling",
2208
+ "title": "Type",
2209
+ "type": "string"
2210
+ },
2211
+ "duration": {
2212
+ "$ref": "#/$defs/Duration"
2213
+ }
2214
+ },
2215
+ "required": [
2216
+ "type",
2217
+ "duration"
2218
+ ],
2219
+ "title": "RollingWindow",
2220
+ "type": "object"
2221
+ },
2222
+ "StringFeature": {
2223
+ "additionalProperties": false,
2224
+ "properties": {
2225
+ "type": {
2226
+ "const": "string",
2227
+ "title": "Type",
2228
+ "type": "string"
2229
+ },
2230
+ "default": {
2231
+ "type": "string",
2232
+ "title": "Default"
2233
+ },
2234
+ "pattern": {
2235
+ "anyOf": [
2236
+ {
2237
+ "type": "string"
2238
+ },
2239
+ {
2240
+ "type": "null"
2241
+ }
2242
+ ],
2243
+ "default": null,
2244
+ "title": "Pattern"
2245
+ }
2246
+ },
2247
+ "required": [
2248
+ "type",
2249
+ "default"
2250
+ ],
2251
+ "title": "StringFeature",
2252
+ "type": "object"
2253
+ },
2254
+ "StripePriceReference": {
2255
+ "additionalProperties": false,
2256
+ "properties": {
2257
+ "type": {
2258
+ "const": "stripe_price",
2259
+ "title": "Type",
2260
+ "type": "string"
2261
+ },
2262
+ "price_id": {
2263
+ "minLength": 1,
2264
+ "title": "Price Id",
2265
+ "type": "string"
2266
+ }
2267
+ },
2268
+ "required": [
2269
+ "type",
2270
+ "price_id"
2271
+ ],
2272
+ "title": "StripePriceReference",
2273
+ "type": "object"
2274
+ },
2275
+ "StripeProvider": {
2276
+ "additionalProperties": false,
2277
+ "properties": {
2278
+ "type": {
2279
+ "const": "stripe",
2280
+ "title": "Type",
2281
+ "type": "string"
2282
+ }
2283
+ },
2284
+ "required": [
2285
+ "type"
2286
+ ],
2287
+ "title": "StripeProvider",
2288
+ "type": "object"
2289
+ },
2290
+ "SubscriptionChangePolicy": {
2291
+ "additionalProperties": false,
2292
+ "properties": {
2293
+ "effective": {
2294
+ "enum": [
2295
+ "immediate",
2296
+ "renewal"
2297
+ ],
2298
+ "title": "Effective",
2299
+ "type": "string"
2300
+ },
2301
+ "proration": {
2302
+ "enum": [
2303
+ "prorated",
2304
+ "none"
2305
+ ],
2306
+ "title": "Proration",
2307
+ "type": "string"
2308
+ },
2309
+ "payment_failure": {
2310
+ "default": "prevent_change",
2311
+ "enum": [
2312
+ "prevent_change",
2313
+ "apply_change"
2314
+ ],
2315
+ "title": "Payment Failure",
2316
+ "type": "string"
2317
+ }
2318
+ },
2319
+ "required": [
2320
+ "effective",
2321
+ "proration"
2322
+ ],
2323
+ "title": "SubscriptionChangePolicy",
2324
+ "type": "object"
2325
+ },
2326
+ "SubscriptionChanges": {
2327
+ "additionalProperties": false,
2328
+ "properties": {
2329
+ "upgrade": {
2330
+ "anyOf": [
2331
+ {
2332
+ "$ref": "#/$defs/SubscriptionChangePolicy"
2333
+ },
2334
+ {
2335
+ "type": "null"
2336
+ }
2337
+ ],
2338
+ "default": null
2339
+ },
2340
+ "downgrade": {
2341
+ "anyOf": [
2342
+ {
2343
+ "$ref": "#/$defs/SubscriptionChangePolicy"
2344
+ },
2345
+ {
2346
+ "type": "null"
2347
+ }
2348
+ ],
2349
+ "default": null
2350
+ },
2351
+ "lateral": {
2352
+ "anyOf": [
2353
+ {
2354
+ "$ref": "#/$defs/SubscriptionChangePolicy"
2355
+ },
2356
+ {
2357
+ "type": "null"
2358
+ }
2359
+ ],
2360
+ "default": null
2361
+ },
2362
+ "cadence_change": {
2363
+ "anyOf": [
2364
+ {
2365
+ "$ref": "#/$defs/SubscriptionChangePolicy"
2366
+ },
2367
+ {
2368
+ "type": "null"
2369
+ }
2370
+ ],
2371
+ "default": null
2372
+ }
2373
+ },
2374
+ "title": "SubscriptionChanges",
2375
+ "type": "object"
2376
+ },
2377
+ "SubscriptionEndExpiry": {
2378
+ "additionalProperties": false,
2379
+ "properties": {
2380
+ "type": {
2381
+ "const": "subscription_end",
2382
+ "title": "Type",
2383
+ "type": "string"
2384
+ }
2385
+ },
2386
+ "required": [
2387
+ "type"
2388
+ ],
2389
+ "title": "SubscriptionEndExpiry",
2390
+ "type": "object"
2391
+ },
2392
+ "SubscriptionOffer": {
2393
+ "additionalProperties": false,
2394
+ "properties": {
2395
+ "display_name": {
2396
+ "minLength": 1,
2397
+ "title": "Display Name",
2398
+ "type": "string"
2399
+ },
2400
+ "description": {
2401
+ "anyOf": [
2402
+ {
2403
+ "type": "string"
2404
+ },
2405
+ {
2406
+ "type": "null"
2407
+ }
2408
+ ],
2409
+ "default": null,
2410
+ "title": "Description"
2411
+ },
2412
+ "sort_order": {
2413
+ "default": 0,
2414
+ "title": "Sort Order",
2415
+ "type": "integer"
2416
+ },
2417
+ "availability": {
2418
+ "anyOf": [
2419
+ {
2420
+ "$ref": "#/$defs/Availability"
2421
+ },
2422
+ {
2423
+ "type": "null"
2424
+ }
2425
+ ],
2426
+ "default": null
2427
+ },
2428
+ "price": {
2429
+ "$ref": "#/$defs/OfferPrice"
2430
+ },
2431
+ "providers": {
2432
+ "additionalProperties": {
2433
+ "discriminator": {
2434
+ "mapping": {
2435
+ "custom_object": "#/$defs/CustomObjectReference",
2436
+ "dodo_product": "#/$defs/DodoProductReference",
2437
+ "stripe_price": "#/$defs/StripePriceReference"
2438
+ },
2439
+ "propertyName": "type"
2440
+ },
2441
+ "oneOf": [
2442
+ {
2443
+ "$ref": "#/$defs/StripePriceReference"
2444
+ },
2445
+ {
2446
+ "$ref": "#/$defs/DodoProductReference"
2447
+ },
2448
+ {
2449
+ "$ref": "#/$defs/CustomObjectReference"
2450
+ }
2451
+ ]
2452
+ },
2453
+ "minProperties": 1,
2454
+ "title": "Providers",
2455
+ "type": "object"
2456
+ },
2457
+ "type": {
2458
+ "const": "subscription",
2459
+ "title": "Type",
2460
+ "type": "string"
2461
+ },
2462
+ "plan": {
2463
+ "title": "Plan",
2464
+ "type": "string"
2465
+ },
2466
+ "billing_interval": {
2467
+ "$ref": "#/$defs/BillingInterval"
2468
+ },
2469
+ "trial": {
2470
+ "anyOf": [
2471
+ {
2472
+ "$ref": "#/$defs/BillingInterval"
2473
+ },
2474
+ {
2475
+ "type": "null"
2476
+ }
2477
+ ],
2478
+ "default": null
2479
+ },
2480
+ "cycle_grant": {
2481
+ "anyOf": [
2482
+ {
2483
+ "$ref": "#/$defs/CycleGrant"
2484
+ },
2485
+ {
2486
+ "type": "null"
2487
+ }
2488
+ ],
2489
+ "default": null
2490
+ }
2491
+ },
2492
+ "required": [
2493
+ "display_name",
2494
+ "price",
2495
+ "providers",
2496
+ "type",
2497
+ "plan",
2498
+ "billing_interval"
2499
+ ],
2500
+ "title": "SubscriptionOffer",
2501
+ "type": "object"
2502
+ },
2503
+ "SumCharge": {
2504
+ "additionalProperties": false,
2505
+ "properties": {
2506
+ "type": {
2507
+ "const": "sum",
2508
+ "title": "Type",
2509
+ "type": "string"
2510
+ },
2511
+ "components": {
2512
+ "items": {
2513
+ "discriminator": {
2514
+ "mapping": {
2515
+ "expression": "#/$defs/ExpressionCharge",
2516
+ "flat": "#/$defs/FlatCharge",
2517
+ "graduated": "#/$defs/GraduatedCharge",
2518
+ "package": "#/$defs/PackageCharge",
2519
+ "per_unit": "#/$defs/PerUnitCharge",
2520
+ "sum": "#/$defs/SumCharge",
2521
+ "volume": "#/$defs/VolumeCharge"
2522
+ },
2523
+ "propertyName": "type"
2524
+ },
2525
+ "oneOf": [
2526
+ {
2527
+ "$ref": "#/$defs/FlatCharge"
2528
+ },
2529
+ {
2530
+ "$ref": "#/$defs/PerUnitCharge"
2531
+ },
2532
+ {
2533
+ "$ref": "#/$defs/PackageCharge"
2534
+ },
2535
+ {
2536
+ "$ref": "#/$defs/GraduatedCharge"
2537
+ },
2538
+ {
2539
+ "$ref": "#/$defs/VolumeCharge"
2540
+ },
2541
+ {
2542
+ "$ref": "#/$defs/ExpressionCharge"
2543
+ },
2544
+ {
2545
+ "$ref": "#/$defs/SumCharge"
2546
+ }
2547
+ ]
2548
+ },
2549
+ "minItems": 1,
2550
+ "title": "Components",
2551
+ "type": "array"
2552
+ }
2553
+ },
2554
+ "required": [
2555
+ "type",
2556
+ "components"
2557
+ ],
2558
+ "title": "SumCharge",
2559
+ "type": "object"
2560
+ },
2561
+ "TopupOffer": {
2562
+ "additionalProperties": false,
2563
+ "properties": {
2564
+ "display_name": {
2565
+ "minLength": 1,
2566
+ "title": "Display Name",
2567
+ "type": "string"
2568
+ },
2569
+ "description": {
2570
+ "anyOf": [
2571
+ {
2572
+ "type": "string"
2573
+ },
2574
+ {
2575
+ "type": "null"
2576
+ }
2577
+ ],
2578
+ "default": null,
2579
+ "title": "Description"
2580
+ },
2581
+ "sort_order": {
2582
+ "default": 0,
2583
+ "title": "Sort Order",
2584
+ "type": "integer"
2585
+ },
2586
+ "availability": {
2587
+ "anyOf": [
2588
+ {
2589
+ "$ref": "#/$defs/Availability"
2590
+ },
2591
+ {
2592
+ "type": "null"
2593
+ }
2594
+ ],
2595
+ "default": null
2596
+ },
2597
+ "price": {
2598
+ "$ref": "#/$defs/OfferPrice"
2599
+ },
2600
+ "providers": {
2601
+ "additionalProperties": {
2602
+ "discriminator": {
2603
+ "mapping": {
2604
+ "custom_object": "#/$defs/CustomObjectReference",
2605
+ "dodo_product": "#/$defs/DodoProductReference",
2606
+ "stripe_price": "#/$defs/StripePriceReference"
2607
+ },
2608
+ "propertyName": "type"
2609
+ },
2610
+ "oneOf": [
2611
+ {
2612
+ "$ref": "#/$defs/StripePriceReference"
2613
+ },
2614
+ {
2615
+ "$ref": "#/$defs/DodoProductReference"
2616
+ },
2617
+ {
2618
+ "$ref": "#/$defs/CustomObjectReference"
2619
+ }
2620
+ ]
2621
+ },
2622
+ "minProperties": 1,
2623
+ "title": "Providers",
2624
+ "type": "object"
2625
+ },
2626
+ "type": {
2627
+ "const": "topup",
2628
+ "title": "Type",
2629
+ "type": "string"
2630
+ },
2631
+ "credits_per_unit": {
2632
+ "examples": [
2633
+ "10.500000"
2634
+ ],
2635
+ "pattern": "^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?$",
2636
+ "title": "Credits Per Unit",
2637
+ "type": "string"
2638
+ },
2639
+ "quantity": {
2640
+ "$ref": "#/$defs/QuantityBounds"
2641
+ },
2642
+ "bucket": {
2643
+ "title": "Bucket",
2644
+ "type": "string"
2645
+ },
2646
+ "expiry": {
2647
+ "anyOf": [
2648
+ {
2649
+ "discriminator": {
2650
+ "mapping": {
2651
+ "after_grant": "#/$defs/AfterGrantExpiry",
2652
+ "end_of_window": "#/$defs/EndOfWindowExpiry",
2653
+ "fixed_at": "#/$defs/FixedExpiry",
2654
+ "never": "#/$defs/NeverExpiry",
2655
+ "subscription_end": "#/$defs/SubscriptionEndExpiry"
2656
+ },
2657
+ "propertyName": "type"
2658
+ },
2659
+ "oneOf": [
2660
+ {
2661
+ "$ref": "#/$defs/NeverExpiry"
2662
+ },
2663
+ {
2664
+ "$ref": "#/$defs/AfterGrantExpiry"
2665
+ },
2666
+ {
2667
+ "$ref": "#/$defs/EndOfWindowExpiry"
2668
+ },
2669
+ {
2670
+ "$ref": "#/$defs/FixedExpiry"
2671
+ },
2672
+ {
2673
+ "$ref": "#/$defs/SubscriptionEndExpiry"
2674
+ }
2675
+ ]
2676
+ },
2677
+ {
2678
+ "type": "null"
2679
+ }
2680
+ ],
2681
+ "default": null,
2682
+ "title": "Expiry"
2683
+ },
2684
+ "lot_behavior": {
2685
+ "default": "separate_lots",
2686
+ "enum": [
2687
+ "separate_lots",
2688
+ "merge_and_refresh"
2689
+ ],
2690
+ "title": "Lot Behavior",
2691
+ "type": "string"
2692
+ }
2693
+ },
2694
+ "required": [
2695
+ "display_name",
2696
+ "price",
2697
+ "providers",
2698
+ "type",
2699
+ "credits_per_unit",
2700
+ "bucket"
2701
+ ],
2702
+ "title": "TopupOffer",
2703
+ "type": "object"
2704
+ },
2705
+ "VolumeCharge": {
2706
+ "additionalProperties": false,
2707
+ "properties": {
2708
+ "type": {
2709
+ "const": "volume",
2710
+ "title": "Type",
2711
+ "type": "string"
2712
+ },
2713
+ "measure": {
2714
+ "title": "Measure",
2715
+ "type": "string"
2716
+ },
2717
+ "tiers": {
2718
+ "items": {
2719
+ "$ref": "#/$defs/GraduatedTier"
2720
+ },
2721
+ "minItems": 1,
2722
+ "title": "Tiers",
2723
+ "type": "array"
2724
+ }
2725
+ },
2726
+ "required": [
2727
+ "type",
2728
+ "measure",
2729
+ "tiers"
2730
+ ],
2731
+ "title": "VolumeCharge",
2732
+ "type": "object"
2733
+ }
2734
+ },
2735
+ "additionalProperties": false,
2736
+ "properties": {
2737
+ "version": {
2738
+ "const": 1,
2739
+ "title": "Version",
2740
+ "type": "integer"
2741
+ },
2742
+ "catalog": {
2743
+ "$ref": "#/$defs/CatalogConfig",
2744
+ "description": "Catalog-wide publication settings such as the default signup plan."
2745
+ },
2746
+ "pricing": {
2747
+ "anyOf": [
2748
+ {
2749
+ "$ref": "#/$defs/PricingConfig"
2750
+ },
2751
+ {
2752
+ "type": "null"
2753
+ }
2754
+ ],
2755
+ "default": null,
2756
+ "description": "Usage operations, their measures and dimensions, and reusable rate cards."
2757
+ },
2758
+ "credits": {
2759
+ "$ref": "#/$defs/CreditsConfig",
2760
+ "description": "Credit buckets, spending policies, grants, and optional display conversion."
2761
+ },
2762
+ "entitlements": {
2763
+ "$ref": "#/$defs/EntitlementsConfig",
2764
+ "description": "Typed feature definitions referenced by plan feature values."
2765
+ },
2766
+ "admission": {
2767
+ "$ref": "#/$defs/AdmissionConfig",
2768
+ "description": "Reusable global and per-operation concurrency policies."
2769
+ },
2770
+ "plans": {
2771
+ "additionalProperties": {
2772
+ "$ref": "#/$defs/PlanDefinition"
2773
+ },
2774
+ "description": "Product plans keyed by stable snake_case identifiers.",
2775
+ "title": "Plans",
2776
+ "type": "object"
2777
+ },
2778
+ "commerce": {
2779
+ "$ref": "#/$defs/CommerceConfig",
2780
+ "description": "Payment providers, subscription and top-up offers, and purchase guardrails."
2781
+ }
2782
+ },
2783
+ "required": [
2784
+ "version",
2785
+ "credits"
2786
+ ],
2787
+ "title": "BursarConfig",
2788
+ "type": "object",
2789
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
2790
+ "$id": "https://zonastery.github.io/bursar/pricing-config.schema.json",
2791
+ "$comment": "Structural schema. Run `bursar config validate` for cross-reference and pricing semantics."
2792
+ }