@fantastic.dev/better-stripe 0.58.0 → 0.60.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 (294) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +3 -1
  3. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +888 -62
  4. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts.map +1 -1
  5. package/dist/client/connect/payoutExecutionTestHelpers.d.ts +428 -15
  6. package/dist/client/connect/payoutExecutionTestHelpers.d.ts.map +1 -1
  7. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +856 -30
  8. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts.map +1 -1
  9. package/dist/client/connect/payoutSyncTestHelpers.d.ts +444 -31
  10. package/dist/client/connect/payoutSyncTestHelpers.d.ts.map +1 -1
  11. package/dist/client/index.d.ts +4 -0
  12. package/dist/client/index.d.ts.map +1 -1
  13. package/dist/client/paymentSource/resolver.d.ts +12 -1
  14. package/dist/client/paymentSource/resolver.d.ts.map +1 -1
  15. package/dist/client/paymentSource/resolver.fixtures.d.ts +220 -0
  16. package/dist/client/paymentSource/resolver.fixtures.d.ts.map +1 -0
  17. package/dist/client/paymentSource/resolver.fixtures.js +189 -0
  18. package/dist/client/paymentSource/resolver.fixtures.js.map +1 -0
  19. package/dist/client/paymentSource/resolver.js +28 -3
  20. package/dist/client/paymentSource/resolver.js.map +1 -1
  21. package/dist/client/settlement/execution.d.ts +25 -0
  22. package/dist/client/settlement/execution.d.ts.map +1 -1
  23. package/dist/client/settlement/execution.js +2 -0
  24. package/dist/client/settlement/execution.js.map +1 -1
  25. package/dist/client/usage/allowanceClient.d.ts +1 -1
  26. package/dist/client/usage/catalogPrices.d.ts +1 -1
  27. package/dist/client/usage/catalogPrices.d.ts.map +1 -1
  28. package/dist/client/usage/catalogPrices.js +4 -4
  29. package/dist/client/usage/catalogPrices.js.map +1 -1
  30. package/dist/client/usage/client.d.ts +2 -2
  31. package/dist/client/usage/client.d.ts.map +1 -1
  32. package/dist/client/usage/client.js +2 -2
  33. package/dist/client/usage/client.js.map +1 -1
  34. package/dist/client/usage/correctionClient.d.ts +33 -0
  35. package/dist/client/usage/correctionClient.d.ts.map +1 -0
  36. package/dist/client/usage/correctionClient.js +27 -0
  37. package/dist/client/usage/correctionClient.js.map +1 -0
  38. package/dist/client/usage/correctionEligibility.d.ts +4 -0
  39. package/dist/client/usage/correctionEligibility.d.ts.map +1 -0
  40. package/dist/client/usage/correctionEligibility.js +7 -0
  41. package/dist/client/usage/correctionEligibility.js.map +1 -0
  42. package/dist/client/usage/correctionInvoice.d.ts +9 -0
  43. package/dist/client/usage/correctionInvoice.d.ts.map +1 -0
  44. package/dist/client/usage/correctionInvoice.js +218 -0
  45. package/dist/client/usage/correctionInvoice.js.map +1 -0
  46. package/dist/client/usage/correctionInvoiceProof.d.ts +29 -0
  47. package/dist/client/usage/correctionInvoiceProof.d.ts.map +1 -0
  48. package/dist/client/usage/correctionInvoiceProof.js +41 -0
  49. package/dist/client/usage/correctionInvoiceProof.js.map +1 -0
  50. package/dist/client/usage/correctionProofs.d.ts +36 -0
  51. package/dist/client/usage/correctionProofs.d.ts.map +1 -0
  52. package/dist/client/usage/correctionProofs.js +41 -0
  53. package/dist/client/usage/correctionProofs.js.map +1 -0
  54. package/dist/client/usage/correctionProvider.d.ts +6 -0
  55. package/dist/client/usage/correctionProvider.d.ts.map +1 -0
  56. package/dist/client/usage/correctionProvider.js +243 -0
  57. package/dist/client/usage/correctionProvider.js.map +1 -0
  58. package/dist/client/usage/correctionRead.d.ts +27 -0
  59. package/dist/client/usage/correctionRead.d.ts.map +1 -0
  60. package/dist/client/usage/correctionRead.js +36 -0
  61. package/dist/client/usage/correctionRead.js.map +1 -0
  62. package/dist/client/usage/correctionTerms.d.ts +64 -0
  63. package/dist/client/usage/correctionTerms.d.ts.map +1 -0
  64. package/dist/client/usage/correctionTerms.js +65 -0
  65. package/dist/client/usage/correctionTerms.js.map +1 -0
  66. package/dist/client/usage/correctionTransport.fixtures.d.ts +37 -0
  67. package/dist/client/usage/correctionTransport.fixtures.d.ts.map +1 -0
  68. package/dist/client/usage/correctionTransport.fixtures.js +322 -0
  69. package/dist/client/usage/correctionTransport.fixtures.js.map +1 -0
  70. package/dist/client/usage/creditClient.d.ts +1 -1
  71. package/dist/client/usage/creditRevenue.d.ts +22 -0
  72. package/dist/client/usage/creditRevenue.d.ts.map +1 -0
  73. package/dist/client/usage/creditRevenue.js +118 -0
  74. package/dist/client/usage/creditRevenue.js.map +1 -0
  75. package/dist/client/usage/creditSettlement.d.ts +29 -0
  76. package/dist/client/usage/creditSettlement.d.ts.map +1 -0
  77. package/dist/client/usage/creditSettlement.fixtures.d.ts +215 -0
  78. package/dist/client/usage/creditSettlement.fixtures.d.ts.map +1 -0
  79. package/dist/client/usage/creditSettlement.fixtures.js +59 -0
  80. package/dist/client/usage/creditSettlement.fixtures.js.map +1 -0
  81. package/dist/client/usage/creditSettlement.js +70 -0
  82. package/dist/client/usage/creditSettlement.js.map +1 -0
  83. package/dist/client/usage/creditTransport.fixtures.d.ts +7 -1
  84. package/dist/client/usage/creditTransport.fixtures.d.ts.map +1 -1
  85. package/dist/client/usage/creditTransport.fixtures.js +25 -4
  86. package/dist/client/usage/creditTransport.fixtures.js.map +1 -1
  87. package/dist/client/usage/index.d.ts +6 -0
  88. package/dist/client/usage/index.d.ts.map +1 -1
  89. package/dist/client/usage/invoiceSale.d.ts +22 -0
  90. package/dist/client/usage/invoiceSale.d.ts.map +1 -0
  91. package/dist/client/usage/invoiceSale.fixtures.d.ts +285 -0
  92. package/dist/client/usage/invoiceSale.fixtures.d.ts.map +1 -0
  93. package/dist/client/usage/invoiceSale.fixtures.js +104 -0
  94. package/dist/client/usage/invoiceSale.fixtures.js.map +1 -0
  95. package/dist/client/usage/invoiceSale.js +117 -0
  96. package/dist/client/usage/invoiceSale.js.map +1 -0
  97. package/dist/client/usage/observationClient.d.ts +20 -0
  98. package/dist/client/usage/observationClient.d.ts.map +1 -1
  99. package/dist/client/usage/observationClient.js +20 -6
  100. package/dist/client/usage/observationClient.js.map +1 -1
  101. package/dist/client/usage/records.d.ts +1 -1
  102. package/dist/client/usage/records.d.ts.map +1 -1
  103. package/dist/client/usage/records.js.map +1 -1
  104. package/dist/client/usage/settlement.d.ts +32 -0
  105. package/dist/client/usage/settlement.d.ts.map +1 -0
  106. package/dist/client/usage/settlement.js +60 -0
  107. package/dist/client/usage/settlement.js.map +1 -0
  108. package/dist/client/usage/settlementClient.d.ts +51 -0
  109. package/dist/client/usage/settlementClient.d.ts.map +1 -0
  110. package/dist/client/usage/settlementClient.js +35 -0
  111. package/dist/client/usage/settlementClient.js.map +1 -0
  112. package/dist/client/usage/summary.d.ts +3 -0
  113. package/dist/client/usage/summary.d.ts.map +1 -1
  114. package/dist/client/usage/summary.js +9 -4
  115. package/dist/client/usage/summary.js.map +1 -1
  116. package/dist/client/usageExports.d.ts +2 -0
  117. package/dist/client/usageExports.d.ts.map +1 -1
  118. package/dist/component/_generated/api.d.ts +12 -0
  119. package/dist/component/_generated/api.d.ts.map +1 -1
  120. package/dist/component/_generated/api.js.map +1 -1
  121. package/dist/component/_generated/component.d.ts +380 -14
  122. package/dist/component/_generated/component.d.ts.map +1 -1
  123. package/dist/component/accountClosure/mutations.d.ts.map +1 -1
  124. package/dist/component/accountClosure/mutations.js +13 -0
  125. package/dist/component/accountClosure/mutations.js.map +1 -1
  126. package/dist/component/balanceFunding/internal/actions.d.ts +11 -11
  127. package/dist/component/balanceFunding/stateHandlers.d.ts +8 -8
  128. package/dist/component/earnings/triggers.d.ts +368 -32
  129. package/dist/component/earnings/triggers.d.ts.map +1 -1
  130. package/dist/component/financialObservations/settlementHelpers.d.ts.map +1 -1
  131. package/dist/component/financialObservations/settlementHelpers.js +2 -0
  132. package/dist/component/financialObservations/settlementHelpers.js.map +1 -1
  133. package/dist/component/recoveryWorkflow/helpers.d.ts +25 -0
  134. package/dist/component/recoveryWorkflow/helpers.d.ts.map +1 -1
  135. package/dist/component/recoveryWorkflow/mutations.d.ts +25 -0
  136. package/dist/component/recoveryWorkflow/mutations.d.ts.map +1 -1
  137. package/dist/component/recoveryWorkflow/queries.d.ts +50 -0
  138. package/dist/component/recoveryWorkflow/queries.d.ts.map +1 -1
  139. package/dist/component/recoveryWorkflow/schema.d.ts +566 -10
  140. package/dist/component/recoveryWorkflow/schema.d.ts.map +1 -1
  141. package/dist/component/schema.d.ts +428 -15
  142. package/dist/component/schema.js +4 -0
  143. package/dist/component/schema.js.map +1 -1
  144. package/dist/component/settlement/mutations.d.ts +50 -0
  145. package/dist/component/settlement/mutations.d.ts.map +1 -1
  146. package/dist/component/settlement/mutations.js +8 -1
  147. package/dist/component/settlement/mutations.js.map +1 -1
  148. package/dist/component/settlement/queries.d.ts +25 -0
  149. package/dist/component/settlement/queries.d.ts.map +1 -1
  150. package/dist/component/settlement/schema.d.ts +128 -1
  151. package/dist/component/settlement/schema.d.ts.map +1 -1
  152. package/dist/component/settlement/schema.js +22 -0
  153. package/dist/component/settlement/schema.js.map +1 -1
  154. package/dist/component/usage/queries.d.ts +2 -2
  155. package/dist/component/usage/schema.d.ts +18 -13
  156. package/dist/component/usage/schema.d.ts.map +1 -1
  157. package/dist/component/usage/schema.js +2 -1
  158. package/dist/component/usage/schema.js.map +1 -1
  159. package/dist/component/usageAllowance/queries.d.ts +1 -1
  160. package/dist/component/usageAllowance/queries.d.ts.map +1 -1
  161. package/dist/component/usageAllowance/queries.js +10 -1
  162. package/dist/component/usageAllowance/queries.js.map +1 -1
  163. package/dist/component/usageAllowance/schema.d.ts +5 -5
  164. package/dist/component/usageAllowance/schema.d.ts.map +1 -1
  165. package/dist/component/usageAllowance/schema.js +1 -1
  166. package/dist/component/usageAllowance/schema.js.map +1 -1
  167. package/dist/component/usageCorrections/accounting.d.ts +5 -0
  168. package/dist/component/usageCorrections/accounting.d.ts.map +1 -0
  169. package/dist/component/usageCorrections/accounting.js +55 -0
  170. package/dist/component/usageCorrections/accounting.js.map +1 -0
  171. package/dist/component/usageCorrections/cancellation.d.ts +6 -0
  172. package/dist/component/usageCorrections/cancellation.d.ts.map +1 -0
  173. package/dist/component/usageCorrections/cancellation.js +29 -0
  174. package/dist/component/usageCorrections/cancellation.js.map +1 -0
  175. package/dist/component/usageCorrections/helpers.d.ts +60 -0
  176. package/dist/component/usageCorrections/helpers.d.ts.map +1 -0
  177. package/dist/component/usageCorrections/helpers.js +52 -0
  178. package/dist/component/usageCorrections/helpers.js.map +1 -0
  179. package/dist/component/usageCorrections/invoice.d.ts +38 -0
  180. package/dist/component/usageCorrections/invoice.d.ts.map +1 -0
  181. package/dist/component/usageCorrections/invoice.js +82 -0
  182. package/dist/component/usageCorrections/invoice.js.map +1 -0
  183. package/dist/component/usageCorrections/mutations.d.ts +121 -0
  184. package/dist/component/usageCorrections/mutations.d.ts.map +1 -0
  185. package/dist/component/usageCorrections/mutations.js +256 -0
  186. package/dist/component/usageCorrections/mutations.js.map +1 -0
  187. package/dist/component/usageCorrections/queries.d.ts +115 -0
  188. package/dist/component/usageCorrections/queries.d.ts.map +1 -0
  189. package/dist/component/usageCorrections/queries.js +84 -0
  190. package/dist/component/usageCorrections/queries.js.map +1 -0
  191. package/dist/component/usageCorrections/schema.d.ts +248 -0
  192. package/dist/component/usageCorrections/schema.d.ts.map +1 -0
  193. package/dist/component/usageCorrections/schema.js +74 -0
  194. package/dist/component/usageCorrections/schema.js.map +1 -0
  195. package/dist/component/usageCredits/queries.d.ts +1 -1
  196. package/dist/component/usageCredits/queries.d.ts.map +1 -1
  197. package/dist/component/usageCredits/queries.js +6 -0
  198. package/dist/component/usageCredits/queries.js.map +1 -1
  199. package/dist/component/usageCredits/schema.d.ts +5 -5
  200. package/dist/component/usageCredits/schema.d.ts.map +1 -1
  201. package/dist/component/usageCredits/schema.js +1 -1
  202. package/dist/component/usageCredits/schema.js.map +1 -1
  203. package/dist/component/usageDelivery/fields.d.ts +2 -2
  204. package/dist/component/usageDelivery/fields.d.ts.map +1 -1
  205. package/dist/component/usageDelivery/fields.js +1 -1
  206. package/dist/component/usageDelivery/fields.js.map +1 -1
  207. package/dist/component/usageDelivery/helpers.d.ts +7 -6
  208. package/dist/component/usageDelivery/helpers.d.ts.map +1 -1
  209. package/dist/component/usageDelivery/mutations.d.ts +6 -6
  210. package/dist/component/usageDelivery/mutations.d.ts.map +1 -1
  211. package/dist/component/usageDelivery/mutations.js +9 -1
  212. package/dist/component/usageDelivery/mutations.js.map +1 -1
  213. package/dist/component/usageDelivery/queries.d.ts +8 -6
  214. package/dist/component/usageDelivery/queries.d.ts.map +1 -1
  215. package/dist/component/usageDelivery/schema.d.ts +4 -4
  216. package/dist/component/usageDelivery/steps.d.ts +2 -2
  217. package/dist/component/usageDelivery/steps.js +1 -1
  218. package/dist/component/usageDelivery/steps.js.map +1 -1
  219. package/dist/component/usageObservations/queries.d.ts.map +1 -1
  220. package/dist/component/usageObservations/queries.js +4 -2
  221. package/dist/component/usageObservations/queries.js.map +1 -1
  222. package/dist/component/usageSubscriptions/retirement.d.ts.map +1 -1
  223. package/dist/component/usageSubscriptions/retirement.js +24 -2
  224. package/dist/component/usageSubscriptions/retirement.js.map +1 -1
  225. package/docs/README.md +4 -0
  226. package/docs/settlement.md +4 -0
  227. package/docs/usage-corrections.md +249 -0
  228. package/docs/usage-limits.md +1 -1
  229. package/docs/usage-settlement.md +162 -0
  230. package/package.json +3 -1
  231. package/src/client/index.ts +9 -0
  232. package/src/client/paymentSource/resolver.fixtures.ts +216 -0
  233. package/src/client/paymentSource/resolver.test.ts +11 -207
  234. package/src/client/paymentSource/resolver.ts +54 -2
  235. package/src/client/settlement/execution.ts +24 -0
  236. package/src/client/usage/catalogPrices.ts +4 -2
  237. package/src/client/usage/client.ts +2 -2
  238. package/src/client/usage/correctionClient.test.ts +153 -0
  239. package/src/client/usage/correctionClient.ts +62 -0
  240. package/src/client/usage/correctionCredits.test.ts +156 -0
  241. package/src/client/usage/correctionEligibility.ts +14 -0
  242. package/src/client/usage/correctionInvoice.test.ts +127 -0
  243. package/src/client/usage/correctionInvoice.ts +269 -0
  244. package/src/client/usage/correctionInvoiceProof.ts +40 -0
  245. package/src/client/usage/correctionProofs.ts +40 -0
  246. package/src/client/usage/correctionProvider.ts +326 -0
  247. package/src/client/usage/correctionRead.ts +73 -0
  248. package/src/client/usage/correctionRecovery.test.ts +113 -0
  249. package/src/client/usage/correctionTerms.ts +98 -0
  250. package/src/client/usage/correctionTransport.fixtures.ts +372 -0
  251. package/src/client/usage/creditRevenue.test.ts +105 -0
  252. package/src/client/usage/creditRevenue.ts +163 -0
  253. package/src/client/usage/creditSettlement.fixtures.ts +70 -0
  254. package/src/client/usage/creditSettlement.test.ts +66 -0
  255. package/src/client/usage/creditSettlement.ts +94 -0
  256. package/src/client/usage/creditSettlementRecovery.test.ts +173 -0
  257. package/src/client/usage/creditTransport.fixtures.ts +29 -4
  258. package/src/client/usage/index.ts +20 -0
  259. package/src/client/usage/invoiceSale.fixtures.ts +103 -0
  260. package/src/client/usage/invoiceSale.test.ts +184 -0
  261. package/src/client/usage/invoiceSale.ts +155 -0
  262. package/src/client/usage/observationClient.ts +20 -6
  263. package/src/client/usage/records.ts +7 -1
  264. package/src/client/usage/settlement.test.ts +179 -0
  265. package/src/client/usage/settlement.ts +81 -0
  266. package/src/client/usage/settlementClient.ts +84 -0
  267. package/src/client/usage/summary.ts +12 -4
  268. package/src/client/usageExports.ts +11 -0
  269. package/src/component/_generated/api.ts +12 -0
  270. package/src/component/_generated/component.ts +440 -2
  271. package/src/component/accountClosure/mutations.ts +17 -0
  272. package/src/component/financialObservations/settlementHelpers.ts +2 -0
  273. package/src/component/schema.ts +8 -0
  274. package/src/component/settlement/mutations.ts +10 -1
  275. package/src/component/settlement/schema.ts +26 -0
  276. package/src/component/settlement/settlement-claims.test.ts +54 -0
  277. package/src/component/usage/schema.ts +2 -0
  278. package/src/component/usageAllowance/queries.ts +8 -1
  279. package/src/component/usageAllowance/schema.ts +1 -0
  280. package/src/component/usageCorrections/accounting.ts +79 -0
  281. package/src/component/usageCorrections/cancellation.ts +32 -0
  282. package/src/component/usageCorrections/corrections.test.ts +389 -0
  283. package/src/component/usageCorrections/helpers.ts +57 -0
  284. package/src/component/usageCorrections/invoice.ts +103 -0
  285. package/src/component/usageCorrections/mutations.ts +278 -0
  286. package/src/component/usageCorrections/queries.ts +94 -0
  287. package/src/component/usageCorrections/schema.ts +90 -0
  288. package/src/component/usageCredits/queries.ts +4 -0
  289. package/src/component/usageCredits/schema.ts +1 -0
  290. package/src/component/usageDelivery/fields.ts +1 -0
  291. package/src/component/usageDelivery/mutations.ts +8 -3
  292. package/src/component/usageDelivery/steps.ts +1 -1
  293. package/src/component/usageObservations/queries.ts +5 -2
  294. package/src/component/usageSubscriptions/retirement.ts +31 -2
@@ -1,4 +1,112 @@
1
1
  declare const _default: import("convex/server").SchemaDefinition<{
2
+ usageCorrectionClaims: import("convex/server").TableDefinition<import("convex/values").VObject<{
3
+ key: string;
4
+ operationKey: string;
5
+ proofJson: string;
6
+ }, {
7
+ key: import("convex/values").VString<string, "required">;
8
+ operationKey: import("convex/values").VString<string, "required">;
9
+ proofJson: import("convex/values").VString<string, "required">;
10
+ }, "required", "key" | "operationKey" | "proofJson">, {
11
+ by_key: ["key", "_creationTime"];
12
+ }, {}, {}>;
13
+ usageCorrections: import("convex/server").TableDefinition<import("convex/values").VObject<{
14
+ adjustmentJson?: string | undefined;
15
+ attempt: number;
16
+ attemptedAt?: number | undefined;
17
+ cashConsequence: "none" | "operator_resolution_required" | "verified_external_adjustment";
18
+ correctionId: string;
19
+ creditNoteId?: string | undefined;
20
+ customerAccount?: string | undefined;
21
+ eventId: import("convex/values").GenericId<"usageEvents">;
22
+ firstAttemptAt: number;
23
+ historyCount: number;
24
+ inputJson: string;
25
+ invoiceId?: string | undefined;
26
+ key: string;
27
+ leaseUntil?: number | undefined;
28
+ nativeAdjustmentId?: string | undefined;
29
+ nativeCreditNoteStatus?: "issued" | "void" | undefined;
30
+ nativeStatus?: "complete" | "pending" | undefined;
31
+ observedAt?: number | undefined;
32
+ quantity: string;
33
+ reason: string;
34
+ recordJson: string;
35
+ refundId?: string | undefined;
36
+ resolution?: "event_cancellation" | "invoice_credit" | undefined;
37
+ restoredQuantity: string;
38
+ scaledQuantity: string;
39
+ scopeKey: string;
40
+ state: "confirmed" | "held" | "invoice_adjustment_required" | "provider_accepted" | "requested" | "unsupported";
41
+ stripeAccountId?: string | undefined;
42
+ subscriptionJson: string;
43
+ }, {
44
+ stripeAccountId: import("convex/values").VString<string | undefined, "optional">;
45
+ customerAccount: import("convex/values").VString<string | undefined, "optional">;
46
+ observedAt: import("convex/values").VFloat64<number | undefined, "optional">;
47
+ nativeCreditNoteStatus: import("convex/values").VUnion<"issued" | "void" | undefined, [import("convex/values").VLiteral<"issued", "required">, import("convex/values").VLiteral<"void", "required">], "optional", never>;
48
+ resolution: import("convex/values").VUnion<"event_cancellation" | "invoice_credit" | undefined, [import("convex/values").VLiteral<"event_cancellation", "required">, import("convex/values").VLiteral<"invoice_credit", "required">], "optional", never>;
49
+ adjustmentJson: import("convex/values").VString<string | undefined, "optional">;
50
+ key: import("convex/values").VString<string, "required">;
51
+ scopeKey: import("convex/values").VString<string, "required">;
52
+ eventId: import("convex/values").VId<import("convex/values").GenericId<"usageEvents">, "required">;
53
+ correctionId: import("convex/values").VString<string, "required">;
54
+ inputJson: import("convex/values").VString<string, "required">;
55
+ recordJson: import("convex/values").VString<string, "required">;
56
+ subscriptionJson: import("convex/values").VString<string, "required">;
57
+ quantity: import("convex/values").VString<string, "required">;
58
+ scaledQuantity: import("convex/values").VString<string, "required">;
59
+ state: import("convex/values").VUnion<"confirmed" | "held" | "invoice_adjustment_required" | "provider_accepted" | "requested" | "unsupported", [import("convex/values").VLiteral<"requested", "required">, import("convex/values").VLiteral<"provider_accepted", "required">, import("convex/values").VLiteral<"confirmed", "required">, import("convex/values").VLiteral<"held", "required">, import("convex/values").VLiteral<"unsupported", "required">, import("convex/values").VLiteral<"invoice_adjustment_required", "required">], "required", never>;
60
+ reason: import("convex/values").VString<string, "required">;
61
+ firstAttemptAt: import("convex/values").VFloat64<number, "required">;
62
+ attemptedAt: import("convex/values").VFloat64<number | undefined, "optional">;
63
+ leaseUntil: import("convex/values").VFloat64<number | undefined, "optional">;
64
+ attempt: import("convex/values").VFloat64<number, "required">;
65
+ nativeAdjustmentId: import("convex/values").VString<string | undefined, "optional">;
66
+ nativeStatus: import("convex/values").VUnion<"complete" | "pending" | undefined, [import("convex/values").VLiteral<"pending", "required">, import("convex/values").VLiteral<"complete", "required">], "optional", never>;
67
+ invoiceId: import("convex/values").VString<string | undefined, "optional">;
68
+ creditNoteId: import("convex/values").VString<string | undefined, "optional">;
69
+ refundId: import("convex/values").VString<string | undefined, "optional">;
70
+ cashConsequence: import("convex/values").VUnion<"none" | "operator_resolution_required" | "verified_external_adjustment", [import("convex/values").VLiteral<"none", "required">, import("convex/values").VLiteral<"operator_resolution_required", "required">, import("convex/values").VLiteral<"verified_external_adjustment", "required">], "required", never>;
71
+ restoredQuantity: import("convex/values").VString<string, "required">;
72
+ historyCount: import("convex/values").VFloat64<number, "required">;
73
+ }, "required", "adjustmentJson" | "attempt" | "attemptedAt" | "cashConsequence" | "correctionId" | "creditNoteId" | "customerAccount" | "eventId" | "firstAttemptAt" | "historyCount" | "inputJson" | "invoiceId" | "key" | "leaseUntil" | "nativeAdjustmentId" | "nativeCreditNoteStatus" | "nativeStatus" | "observedAt" | "quantity" | "reason" | "recordJson" | "refundId" | "resolution" | "restoredQuantity" | "scaledQuantity" | "scopeKey" | "state" | "stripeAccountId" | "subscriptionJson">, {
74
+ by_event: ["eventId", "_creationTime"];
75
+ by_key: ["key", "_creationTime"];
76
+ by_payer_state: ["customerAccount", "state", "_creationTime"];
77
+ by_realm_state: ["stripeAccountId", "state", "_creationTime"];
78
+ by_scope: ["scopeKey", "_creationTime"];
79
+ by_scope_state: ["scopeKey", "state", "_creationTime"];
80
+ }, {}, {}>;
81
+ usageCorrectionHistory: import("convex/server").TableDefinition<import("convex/values").VObject<{
82
+ at: number;
83
+ eventId: import("convex/values").GenericId<"usageEvents">;
84
+ evidenceJson: string;
85
+ key: string;
86
+ occurredAt?: number | undefined;
87
+ reason: string;
88
+ recordJson: string;
89
+ scopeKey: string;
90
+ sequence: number;
91
+ state: "confirmed" | "held" | "invoice_adjustment_required" | "provider_accepted" | "requested" | "unsupported";
92
+ subscriptionJson: string;
93
+ }, {
94
+ key: import("convex/values").VString<string, "required">;
95
+ scopeKey: import("convex/values").VString<string, "required">;
96
+ eventId: import("convex/values").VId<import("convex/values").GenericId<"usageEvents">, "required">;
97
+ sequence: import("convex/values").VFloat64<number, "required">;
98
+ state: import("convex/values").VUnion<"confirmed" | "held" | "invoice_adjustment_required" | "provider_accepted" | "requested" | "unsupported", [import("convex/values").VLiteral<"requested", "required">, import("convex/values").VLiteral<"provider_accepted", "required">, import("convex/values").VLiteral<"confirmed", "required">, import("convex/values").VLiteral<"held", "required">, import("convex/values").VLiteral<"unsupported", "required">, import("convex/values").VLiteral<"invoice_adjustment_required", "required">], "required", never>;
99
+ reason: import("convex/values").VString<string, "required">;
100
+ recordJson: import("convex/values").VString<string, "required">;
101
+ subscriptionJson: import("convex/values").VString<string, "required">;
102
+ evidenceJson: import("convex/values").VString<string, "required">;
103
+ occurredAt: import("convex/values").VFloat64<number | undefined, "optional">;
104
+ at: import("convex/values").VFloat64<number, "required">;
105
+ }, "required", "at" | "eventId" | "evidenceJson" | "key" | "occurredAt" | "reason" | "recordJson" | "scopeKey" | "sequence" | "state" | "subscriptionJson">, {
106
+ by_event: ["eventId", "_creationTime"];
107
+ by_scope_occurrence: ["scopeKey", "occurredAt", "_creationTime"];
108
+ by_scope_time: ["scopeKey", "at", "_creationTime"];
109
+ }, {}, {}>;
2
110
  usageAllowancePolicies: import("convex/server").TableDefinition<import("convex/values").VObject<{
3
111
  bindingJson: string;
4
112
  consumed: string;
@@ -32,10 +140,10 @@ declare const _default: import("convex/server").SchemaDefinition<{
32
140
  at: number;
33
141
  evidenceJson: string;
34
142
  key: string;
35
- kind: "commit" | "policy" | "release" | "reservation";
143
+ kind: "commit" | "correction" | "policy" | "release" | "reservation";
36
144
  }, {
37
145
  key: import("convex/values").VString<string, "required">;
38
- kind: import("convex/values").VUnion<"commit" | "policy" | "release" | "reservation", [import("convex/values").VLiteral<"policy", "required">, import("convex/values").VLiteral<"reservation", "required">, import("convex/values").VLiteral<"commit", "required">, import("convex/values").VLiteral<"release", "required">], "required", never>;
146
+ kind: import("convex/values").VUnion<"commit" | "correction" | "policy" | "release" | "reservation", [import("convex/values").VLiteral<"policy", "required">, import("convex/values").VLiteral<"reservation", "required">, import("convex/values").VLiteral<"commit", "required">, import("convex/values").VLiteral<"release", "required">, import("convex/values").VLiteral<"correction", "required">], "required", never>;
39
147
  evidenceJson: import("convex/values").VString<string, "required">;
40
148
  at: import("convex/values").VFloat64<number, "required">;
41
149
  }, "required", "at" | "evidenceJson" | "key" | "kind">, {
@@ -242,6 +350,7 @@ declare const _default: import("convex/server").SchemaDefinition<{
242
350
  }, {}, {}>;
243
351
  usageOutbox: import("convex/server").TableDefinition<import("convex/values").VObject<{
244
352
  attempts: number;
353
+ correctionKey?: string | undefined;
245
354
  definitionVersion?: 1 | undefined;
246
355
  dispatch?: string | undefined;
247
356
  eventId: import("convex/values").GenericId<"usageEvents">;
@@ -252,13 +361,13 @@ declare const _default: import("convex/server").SchemaDefinition<{
252
361
  nextAttemptAt: number;
253
362
  provider?: string | undefined;
254
363
  providerIdentifier: string;
255
- reason?: "administrative_hold" | "billing_period_closed" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined;
364
+ reason?: "administrative_hold" | "billing_period_closed" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | "usage_canceled" | undefined;
256
365
  receipt?: {
257
366
  created: number;
258
367
  identifier: string;
259
368
  } | undefined;
260
369
  scopeKey: string;
261
- state: "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
370
+ state: "canceled" | "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
262
371
  workflowId?: string | undefined;
263
372
  }, {
264
373
  historySequence: import("convex/values").VFloat64<number | undefined, "optional">;
@@ -268,7 +377,7 @@ declare const _default: import("convex/server").SchemaDefinition<{
268
377
  firstSendAt: import("convex/values").VFloat64<number | undefined, "optional">;
269
378
  leaseUntil: import("convex/values").VFloat64<number | undefined, "optional">;
270
379
  held: import("convex/values").VBoolean<boolean | undefined, "optional">;
271
- reason: import("convex/values").VUnion<"administrative_hold" | "billing_period_closed" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined, [import("convex/values").VLiteral<"billing_period_closed", "required">, import("convex/values").VLiteral<"rate_limited", "required">, import("convex/values").VLiteral<"provider_unavailable", "required">, import("convex/values").VLiteral<"provider_outcome_unknown", "required">, import("convex/values").VLiteral<"provider_rejected", "required">, import("convex/values").VLiteral<"retry_exhausted", "required">, import("convex/values").VLiteral<"delivery_window_expired", "required">, import("convex/values").VLiteral<"scope_busy", "required">, import("convex/values").VLiteral<"administrative_hold", "required">], "optional", never>;
380
+ reason: import("convex/values").VUnion<"administrative_hold" | "billing_period_closed" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | "usage_canceled" | undefined, [import("convex/values").VLiteral<"usage_canceled", "required">, import("convex/values").VLiteral<"billing_period_closed", "required">, import("convex/values").VLiteral<"rate_limited", "required">, import("convex/values").VLiteral<"provider_unavailable", "required">, import("convex/values").VLiteral<"provider_outcome_unknown", "required">, import("convex/values").VLiteral<"provider_rejected", "required">, import("convex/values").VLiteral<"retry_exhausted", "required">, import("convex/values").VLiteral<"delivery_window_expired", "required">, import("convex/values").VLiteral<"scope_busy", "required">, import("convex/values").VLiteral<"administrative_hold", "required">], "optional", never>;
272
381
  receipt: import("convex/values").VObject<{
273
382
  created: number;
274
383
  identifier: string;
@@ -276,14 +385,15 @@ declare const _default: import("convex/server").SchemaDefinition<{
276
385
  identifier: import("convex/values").VString<string, "required">;
277
386
  created: import("convex/values").VFloat64<number, "required">;
278
387
  }, "optional", "created" | "identifier">;
388
+ correctionKey: import("convex/values").VString<string | undefined, "optional">;
279
389
  eventId: import("convex/values").VId<import("convex/values").GenericId<"usageEvents">, "required">;
280
390
  scopeKey: import("convex/values").VString<string, "required">;
281
- state: import("convex/values").VUnion<"held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown", [import("convex/values").VLiteral<"queued", "required">, import("convex/values").VLiteral<"sending", "required">, import("convex/values").VLiteral<"provider_accepted", "required">, import("convex/values").VLiteral<"rejected", "required">, import("convex/values").VLiteral<"unknown", "required">, import("convex/values").VLiteral<"held", "required">], "required", never>;
391
+ state: import("convex/values").VUnion<"canceled" | "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown", [import("convex/values").VLiteral<"queued", "required">, import("convex/values").VLiteral<"canceled", "required">, import("convex/values").VLiteral<"sending", "required">, import("convex/values").VLiteral<"provider_accepted", "required">, import("convex/values").VLiteral<"rejected", "required">, import("convex/values").VLiteral<"unknown", "required">, import("convex/values").VLiteral<"held", "required">], "required", never>;
282
392
  attempts: import("convex/values").VFloat64<number, "required">;
283
393
  nextAttemptAt: import("convex/values").VFloat64<number, "required">;
284
394
  providerIdentifier: import("convex/values").VString<string, "required">;
285
395
  dispatch: import("convex/values").VString<string | undefined, "optional">;
286
- }, "required", "attempts" | "definitionVersion" | "dispatch" | "eventId" | "firstSendAt" | "held" | "historySequence" | "leaseUntil" | "nextAttemptAt" | "provider" | "providerIdentifier" | "reason" | "receipt" | "receipt.created" | "receipt.identifier" | "scopeKey" | "state" | "workflowId">, {
396
+ }, "required", "attempts" | "correctionKey" | "definitionVersion" | "dispatch" | "eventId" | "firstSendAt" | "held" | "historySequence" | "leaseUntil" | "nextAttemptAt" | "provider" | "providerIdentifier" | "reason" | "receipt" | "receipt.created" | "receipt.identifier" | "scopeKey" | "state" | "workflowId">, {
287
397
  by_event: ["eventId", "_creationTime"];
288
398
  by_provider_identifier: ["providerIdentifier", "_creationTime"];
289
399
  by_scope_state: ["scopeKey", "state", "_creationTime"];
@@ -439,13 +549,13 @@ declare const _default: import("convex/server").SchemaDefinition<{
439
549
  at: number;
440
550
  evidenceJson: string;
441
551
  fingerprint: string;
442
- kind: "closure" | "commit" | "grant" | "observation" | "payment" | "purchase" | "recovery" | "release" | "reservation";
552
+ kind: "closure" | "commit" | "correction" | "grant" | "observation" | "payment" | "purchase" | "recovery" | "release" | "reservation";
443
553
  purchaseKey?: string | undefined;
444
554
  sourceKey: string;
445
555
  }, {
446
556
  accountKey: import("convex/values").VString<string, "required">;
447
557
  purchaseKey: import("convex/values").VString<string | undefined, "optional">;
448
- kind: import("convex/values").VUnion<"closure" | "commit" | "grant" | "observation" | "payment" | "purchase" | "recovery" | "release" | "reservation", [import("convex/values").VLiteral<"purchase", "required">, import("convex/values").VLiteral<"payment", "required">, import("convex/values").VLiteral<"grant", "required">, import("convex/values").VLiteral<"reservation", "required">, import("convex/values").VLiteral<"commit", "required">, import("convex/values").VLiteral<"release", "required">, import("convex/values").VLiteral<"observation", "required">, import("convex/values").VLiteral<"recovery", "required">, import("convex/values").VLiteral<"closure", "required">], "required", never>;
558
+ kind: import("convex/values").VUnion<"closure" | "commit" | "correction" | "grant" | "observation" | "payment" | "purchase" | "recovery" | "release" | "reservation", [import("convex/values").VLiteral<"purchase", "required">, import("convex/values").VLiteral<"payment", "required">, import("convex/values").VLiteral<"grant", "required">, import("convex/values").VLiteral<"reservation", "required">, import("convex/values").VLiteral<"commit", "required">, import("convex/values").VLiteral<"release", "required">, import("convex/values").VLiteral<"observation", "required">, import("convex/values").VLiteral<"recovery", "required">, import("convex/values").VLiteral<"closure", "required">, import("convex/values").VLiteral<"correction", "required">], "required", never>;
449
559
  sourceKey: import("convex/values").VString<string, "required">;
450
560
  fingerprint: import("convex/values").VString<string, "required">;
451
561
  evidenceJson: import("convex/values").VString<string, "required">;
@@ -994,6 +1104,15 @@ declare const _default: import("convex/server").SchemaDefinition<{
994
1104
  activePhase?: "execute" | "reconcile" | undefined;
995
1105
  allocation?: {
996
1106
  adjustmentAmount?: number | undefined;
1107
+ creditSource?: {
1108
+ creditGrantId: string;
1109
+ customerAccount: string;
1110
+ livemode: boolean;
1111
+ purchaseId: string;
1112
+ stripeAccountId: string;
1113
+ stripePriceId: string;
1114
+ stripeProductId: string;
1115
+ } | undefined;
997
1116
  currency: string;
998
1117
  gross: number;
999
1118
  paymentId?: string | undefined;
@@ -1007,6 +1126,22 @@ declare const _default: import("convex/server").SchemaDefinition<{
1007
1126
  destinationAccountId: string;
1008
1127
  role: "affiliate" | "other" | "store";
1009
1128
  }[];
1129
+ usageSource?: {
1130
+ customerAccount: string;
1131
+ invoicePaymentId: string;
1132
+ livemode: boolean;
1133
+ meterId: string;
1134
+ model: "included_overage" | "pay_as_you_go";
1135
+ period: {
1136
+ end: number;
1137
+ start: number;
1138
+ };
1139
+ stripeAccountId: string;
1140
+ stripePriceId: string;
1141
+ stripeProductId: string;
1142
+ subscriptionId: string;
1143
+ subscriptionItemId: string;
1144
+ } | undefined;
1010
1145
  } | undefined;
1011
1146
  cancelRequested: boolean;
1012
1147
  completion?: string | undefined;
@@ -1041,6 +1176,15 @@ declare const _default: import("convex/server").SchemaDefinition<{
1041
1176
  retryDelayMs: import("convex/values").VFloat64<number, "required">;
1042
1177
  allocation: import("convex/values").VObject<{
1043
1178
  adjustmentAmount?: number | undefined;
1179
+ creditSource?: {
1180
+ creditGrantId: string;
1181
+ customerAccount: string;
1182
+ livemode: boolean;
1183
+ purchaseId: string;
1184
+ stripeAccountId: string;
1185
+ stripePriceId: string;
1186
+ stripeProductId: string;
1187
+ } | undefined;
1044
1188
  currency: string;
1045
1189
  gross: number;
1046
1190
  paymentId?: string | undefined;
@@ -1054,10 +1198,77 @@ declare const _default: import("convex/server").SchemaDefinition<{
1054
1198
  destinationAccountId: string;
1055
1199
  role: "affiliate" | "other" | "store";
1056
1200
  }[];
1201
+ usageSource?: {
1202
+ customerAccount: string;
1203
+ invoicePaymentId: string;
1204
+ livemode: boolean;
1205
+ meterId: string;
1206
+ model: "included_overage" | "pay_as_you_go";
1207
+ period: {
1208
+ end: number;
1209
+ start: number;
1210
+ };
1211
+ stripeAccountId: string;
1212
+ stripePriceId: string;
1213
+ stripeProductId: string;
1214
+ subscriptionId: string;
1215
+ subscriptionItemId: string;
1216
+ } | undefined;
1057
1217
  } | undefined, {
1058
1218
  sourceChargeId: import("convex/values").VString<string, "required">;
1059
1219
  paymentIntentId: import("convex/values").VString<string | undefined, "optional">;
1060
1220
  sourceInvoiceId: import("convex/values").VString<string | undefined, "optional">;
1221
+ usageSource: import("convex/values").VObject<{
1222
+ customerAccount: string;
1223
+ invoicePaymentId: string;
1224
+ livemode: boolean;
1225
+ meterId: string;
1226
+ model: "included_overage" | "pay_as_you_go";
1227
+ period: {
1228
+ end: number;
1229
+ start: number;
1230
+ };
1231
+ stripeAccountId: string;
1232
+ stripePriceId: string;
1233
+ stripeProductId: string;
1234
+ subscriptionId: string;
1235
+ subscriptionItemId: string;
1236
+ } | undefined, {
1237
+ stripeAccountId: import("convex/values").VString<string, "required">;
1238
+ customerAccount: import("convex/values").VString<string, "required">;
1239
+ livemode: import("convex/values").VBoolean<boolean, "required">;
1240
+ meterId: import("convex/values").VString<string, "required">;
1241
+ stripePriceId: import("convex/values").VString<string, "required">;
1242
+ stripeProductId: import("convex/values").VString<string, "required">;
1243
+ subscriptionId: import("convex/values").VString<string, "required">;
1244
+ subscriptionItemId: import("convex/values").VString<string, "required">;
1245
+ invoicePaymentId: import("convex/values").VString<string, "required">;
1246
+ period: import("convex/values").VObject<{
1247
+ end: number;
1248
+ start: number;
1249
+ }, {
1250
+ start: import("convex/values").VFloat64<number, "required">;
1251
+ end: import("convex/values").VFloat64<number, "required">;
1252
+ }, "required", "end" | "start">;
1253
+ model: import("convex/values").VUnion<"included_overage" | "pay_as_you_go", [import("convex/values").VLiteral<"pay_as_you_go", "required">, import("convex/values").VLiteral<"included_overage", "required">], "required", never>;
1254
+ }, "optional", "customerAccount" | "invoicePaymentId" | "livemode" | "meterId" | "model" | "period" | "period.end" | "period.start" | "stripeAccountId" | "stripePriceId" | "stripeProductId" | "subscriptionId" | "subscriptionItemId">;
1255
+ creditSource: import("convex/values").VObject<{
1256
+ creditGrantId: string;
1257
+ customerAccount: string;
1258
+ livemode: boolean;
1259
+ purchaseId: string;
1260
+ stripeAccountId: string;
1261
+ stripePriceId: string;
1262
+ stripeProductId: string;
1263
+ } | undefined, {
1264
+ stripeAccountId: import("convex/values").VString<string, "required">;
1265
+ customerAccount: import("convex/values").VString<string, "required">;
1266
+ livemode: import("convex/values").VBoolean<boolean, "required">;
1267
+ purchaseId: import("convex/values").VString<string, "required">;
1268
+ creditGrantId: import("convex/values").VString<string, "required">;
1269
+ stripePriceId: import("convex/values").VString<string, "required">;
1270
+ stripeProductId: import("convex/values").VString<string, "required">;
1271
+ }, "optional", "creditGrantId" | "customerAccount" | "livemode" | "purchaseId" | "stripeAccountId" | "stripePriceId" | "stripeProductId">;
1061
1272
  gross: import("convex/values").VFloat64<number, "required">;
1062
1273
  currency: import("convex/values").VString<string, "required">;
1063
1274
  processingFee: import("convex/values").VFloat64<number, "required">;
@@ -1077,7 +1288,7 @@ declare const _default: import("convex/server").SchemaDefinition<{
1077
1288
  role: import("convex/values").VUnion<"affiliate" | "other" | "store", [import("convex/values").VLiteral<"store", "required">, import("convex/values").VLiteral<"affiliate", "required">, import("convex/values").VLiteral<"other", "required">], "required", never>;
1078
1289
  amount: import("convex/values").VFloat64<number, "required">;
1079
1290
  }, "required", "amount" | "destinationAccountId" | "role">, "required">;
1080
- }, "optional", "adjustmentAmount" | "currency" | "gross" | "paymentId" | "paymentIntentId" | "platformNet" | "processingFee" | "sourceChargeId" | "sourceInvoiceId" | "transfers">;
1291
+ }, "optional", "adjustmentAmount" | "creditSource" | "creditSource.creditGrantId" | "creditSource.customerAccount" | "creditSource.livemode" | "creditSource.purchaseId" | "creditSource.stripeAccountId" | "creditSource.stripePriceId" | "creditSource.stripeProductId" | "currency" | "gross" | "paymentId" | "paymentIntentId" | "platformNet" | "processingFee" | "sourceChargeId" | "sourceInvoiceId" | "transfers" | "usageSource" | "usageSource.customerAccount" | "usageSource.invoicePaymentId" | "usageSource.livemode" | "usageSource.meterId" | "usageSource.model" | "usageSource.period" | "usageSource.period.end" | "usageSource.period.start" | "usageSource.stripeAccountId" | "usageSource.stripePriceId" | "usageSource.stripeProductId" | "usageSource.subscriptionId" | "usageSource.subscriptionItemId">;
1081
1292
  version: import("convex/values").VFloat64<number, "required">;
1082
1293
  sourceKind: import("convex/values").VUnion<"invoice" | "settlement", [import("convex/values").VLiteral<"settlement", "required">, import("convex/values").VLiteral<"invoice", "required">], "required", never>;
1083
1294
  sourceId: import("convex/values").VString<string, "required">;
@@ -1088,7 +1299,7 @@ declare const _default: import("convex/server").SchemaDefinition<{
1088
1299
  activePhase: import("convex/values").VUnion<"execute" | "reconcile" | undefined, [import("convex/values").VLiteral<"execute", "required">, import("convex/values").VLiteral<"reconcile", "required">], "optional", never>;
1089
1300
  resumeQueued: import("convex/values").VBoolean<boolean, "required">;
1090
1301
  outcome: import("convex/values").VUnion<"collect" | "release" | undefined, [import("convex/values").VLiteral<"collect", "required">, import("convex/values").VLiteral<"release", "required">], "optional", never>;
1091
- }, "required", "accountId" | "activePhase" | "allocation" | "allocation.adjustmentAmount" | "allocation.currency" | "allocation.gross" | "allocation.paymentId" | "allocation.paymentIntentId" | "allocation.platformNet" | "allocation.processingFee" | "allocation.sourceChargeId" | "allocation.sourceInvoiceId" | "allocation.transfers" | "cancelRequested" | "completion" | "currency" | "definitionVersion" | "groupKey" | "maxAttempts" | "outcome" | "provider" | "providerApiVersion" | "providerStarted" | "releaseUncollectible" | "resumeQueued" | "retryDelayMs" | "scopeKey" | "sourceId" | "sourceKind" | "status" | "version" | "workflowId">, {
1302
+ }, "required", "accountId" | "activePhase" | "allocation" | "allocation.adjustmentAmount" | "allocation.creditSource" | "allocation.creditSource.creditGrantId" | "allocation.creditSource.customerAccount" | "allocation.creditSource.livemode" | "allocation.creditSource.purchaseId" | "allocation.creditSource.stripeAccountId" | "allocation.creditSource.stripePriceId" | "allocation.creditSource.stripeProductId" | "allocation.currency" | "allocation.gross" | "allocation.paymentId" | "allocation.paymentIntentId" | "allocation.platformNet" | "allocation.processingFee" | "allocation.sourceChargeId" | "allocation.sourceInvoiceId" | "allocation.transfers" | "allocation.usageSource" | "allocation.usageSource.customerAccount" | "allocation.usageSource.invoicePaymentId" | "allocation.usageSource.livemode" | "allocation.usageSource.meterId" | "allocation.usageSource.model" | "allocation.usageSource.period" | "allocation.usageSource.period.end" | "allocation.usageSource.period.start" | "allocation.usageSource.stripeAccountId" | "allocation.usageSource.stripePriceId" | "allocation.usageSource.stripeProductId" | "allocation.usageSource.subscriptionId" | "allocation.usageSource.subscriptionItemId" | "cancelRequested" | "completion" | "currency" | "definitionVersion" | "groupKey" | "maxAttempts" | "outcome" | "provider" | "providerApiVersion" | "providerStarted" | "releaseUncollectible" | "resumeQueued" | "retryDelayMs" | "scopeKey" | "sourceId" | "sourceKind" | "status" | "version" | "workflowId">, {
1092
1303
  by_group: ["groupKey", "_creationTime"];
1093
1304
  by_source: ["sourceKind", "sourceId", "_creationTime"];
1094
1305
  }, {}, {}>;
@@ -1097,6 +1308,15 @@ declare const _default: import("convex/server").SchemaDefinition<{
1097
1308
  accountId: string;
1098
1309
  allocation?: {
1099
1310
  adjustmentAmount?: number | undefined;
1311
+ creditSource?: {
1312
+ creditGrantId: string;
1313
+ customerAccount: string;
1314
+ livemode: boolean;
1315
+ purchaseId: string;
1316
+ stripeAccountId: string;
1317
+ stripePriceId: string;
1318
+ stripeProductId: string;
1319
+ } | undefined;
1100
1320
  currency: string;
1101
1321
  gross: number;
1102
1322
  paymentId?: string | undefined;
@@ -1110,6 +1330,22 @@ declare const _default: import("convex/server").SchemaDefinition<{
1110
1330
  destinationAccountId: string;
1111
1331
  role: "affiliate" | "other" | "store";
1112
1332
  }[];
1333
+ usageSource?: {
1334
+ customerAccount: string;
1335
+ invoicePaymentId: string;
1336
+ livemode: boolean;
1337
+ meterId: string;
1338
+ model: "included_overage" | "pay_as_you_go";
1339
+ period: {
1340
+ end: number;
1341
+ start: number;
1342
+ };
1343
+ stripeAccountId: string;
1344
+ stripePriceId: string;
1345
+ stripeProductId: string;
1346
+ subscriptionId: string;
1347
+ subscriptionItemId: string;
1348
+ } | undefined;
1113
1349
  } | undefined;
1114
1350
  completion?: string | undefined;
1115
1351
  currency: string;
@@ -1130,6 +1366,15 @@ declare const _default: import("convex/server").SchemaDefinition<{
1130
1366
  accountId: string;
1131
1367
  allocation?: {
1132
1368
  adjustmentAmount?: number | undefined;
1369
+ creditSource?: {
1370
+ creditGrantId: string;
1371
+ customerAccount: string;
1372
+ livemode: boolean;
1373
+ purchaseId: string;
1374
+ stripeAccountId: string;
1375
+ stripePriceId: string;
1376
+ stripeProductId: string;
1377
+ } | undefined;
1133
1378
  currency: string;
1134
1379
  gross: number;
1135
1380
  paymentId?: string | undefined;
@@ -1143,6 +1388,22 @@ declare const _default: import("convex/server").SchemaDefinition<{
1143
1388
  destinationAccountId: string;
1144
1389
  role: "affiliate" | "other" | "store";
1145
1390
  }[];
1391
+ usageSource?: {
1392
+ customerAccount: string;
1393
+ invoicePaymentId: string;
1394
+ livemode: boolean;
1395
+ meterId: string;
1396
+ model: "included_overage" | "pay_as_you_go";
1397
+ period: {
1398
+ end: number;
1399
+ start: number;
1400
+ };
1401
+ stripeAccountId: string;
1402
+ stripePriceId: string;
1403
+ stripeProductId: string;
1404
+ subscriptionId: string;
1405
+ subscriptionItemId: string;
1406
+ } | undefined;
1146
1407
  } | undefined;
1147
1408
  completion?: string | undefined;
1148
1409
  currency: string;
@@ -1168,6 +1429,15 @@ declare const _default: import("convex/server").SchemaDefinition<{
1168
1429
  retryDelayMs: import("convex/values").VFloat64<number, "required">;
1169
1430
  allocation: import("convex/values").VObject<{
1170
1431
  adjustmentAmount?: number | undefined;
1432
+ creditSource?: {
1433
+ creditGrantId: string;
1434
+ customerAccount: string;
1435
+ livemode: boolean;
1436
+ purchaseId: string;
1437
+ stripeAccountId: string;
1438
+ stripePriceId: string;
1439
+ stripeProductId: string;
1440
+ } | undefined;
1171
1441
  currency: string;
1172
1442
  gross: number;
1173
1443
  paymentId?: string | undefined;
@@ -1181,10 +1451,77 @@ declare const _default: import("convex/server").SchemaDefinition<{
1181
1451
  destinationAccountId: string;
1182
1452
  role: "affiliate" | "other" | "store";
1183
1453
  }[];
1454
+ usageSource?: {
1455
+ customerAccount: string;
1456
+ invoicePaymentId: string;
1457
+ livemode: boolean;
1458
+ meterId: string;
1459
+ model: "included_overage" | "pay_as_you_go";
1460
+ period: {
1461
+ end: number;
1462
+ start: number;
1463
+ };
1464
+ stripeAccountId: string;
1465
+ stripePriceId: string;
1466
+ stripeProductId: string;
1467
+ subscriptionId: string;
1468
+ subscriptionItemId: string;
1469
+ } | undefined;
1184
1470
  } | undefined, {
1185
1471
  sourceChargeId: import("convex/values").VString<string, "required">;
1186
1472
  paymentIntentId: import("convex/values").VString<string | undefined, "optional">;
1187
1473
  sourceInvoiceId: import("convex/values").VString<string | undefined, "optional">;
1474
+ usageSource: import("convex/values").VObject<{
1475
+ customerAccount: string;
1476
+ invoicePaymentId: string;
1477
+ livemode: boolean;
1478
+ meterId: string;
1479
+ model: "included_overage" | "pay_as_you_go";
1480
+ period: {
1481
+ end: number;
1482
+ start: number;
1483
+ };
1484
+ stripeAccountId: string;
1485
+ stripePriceId: string;
1486
+ stripeProductId: string;
1487
+ subscriptionId: string;
1488
+ subscriptionItemId: string;
1489
+ } | undefined, {
1490
+ stripeAccountId: import("convex/values").VString<string, "required">;
1491
+ customerAccount: import("convex/values").VString<string, "required">;
1492
+ livemode: import("convex/values").VBoolean<boolean, "required">;
1493
+ meterId: import("convex/values").VString<string, "required">;
1494
+ stripePriceId: import("convex/values").VString<string, "required">;
1495
+ stripeProductId: import("convex/values").VString<string, "required">;
1496
+ subscriptionId: import("convex/values").VString<string, "required">;
1497
+ subscriptionItemId: import("convex/values").VString<string, "required">;
1498
+ invoicePaymentId: import("convex/values").VString<string, "required">;
1499
+ period: import("convex/values").VObject<{
1500
+ end: number;
1501
+ start: number;
1502
+ }, {
1503
+ start: import("convex/values").VFloat64<number, "required">;
1504
+ end: import("convex/values").VFloat64<number, "required">;
1505
+ }, "required", "end" | "start">;
1506
+ model: import("convex/values").VUnion<"included_overage" | "pay_as_you_go", [import("convex/values").VLiteral<"pay_as_you_go", "required">, import("convex/values").VLiteral<"included_overage", "required">], "required", never>;
1507
+ }, "optional", "customerAccount" | "invoicePaymentId" | "livemode" | "meterId" | "model" | "period" | "period.end" | "period.start" | "stripeAccountId" | "stripePriceId" | "stripeProductId" | "subscriptionId" | "subscriptionItemId">;
1508
+ creditSource: import("convex/values").VObject<{
1509
+ creditGrantId: string;
1510
+ customerAccount: string;
1511
+ livemode: boolean;
1512
+ purchaseId: string;
1513
+ stripeAccountId: string;
1514
+ stripePriceId: string;
1515
+ stripeProductId: string;
1516
+ } | undefined, {
1517
+ stripeAccountId: import("convex/values").VString<string, "required">;
1518
+ customerAccount: import("convex/values").VString<string, "required">;
1519
+ livemode: import("convex/values").VBoolean<boolean, "required">;
1520
+ purchaseId: import("convex/values").VString<string, "required">;
1521
+ creditGrantId: import("convex/values").VString<string, "required">;
1522
+ stripePriceId: import("convex/values").VString<string, "required">;
1523
+ stripeProductId: import("convex/values").VString<string, "required">;
1524
+ }, "optional", "creditGrantId" | "customerAccount" | "livemode" | "purchaseId" | "stripeAccountId" | "stripePriceId" | "stripeProductId">;
1188
1525
  gross: import("convex/values").VFloat64<number, "required">;
1189
1526
  currency: import("convex/values").VString<string, "required">;
1190
1527
  processingFee: import("convex/values").VFloat64<number, "required">;
@@ -1204,10 +1541,10 @@ declare const _default: import("convex/server").SchemaDefinition<{
1204
1541
  role: import("convex/values").VUnion<"affiliate" | "other" | "store", [import("convex/values").VLiteral<"store", "required">, import("convex/values").VLiteral<"affiliate", "required">, import("convex/values").VLiteral<"other", "required">], "required", never>;
1205
1542
  amount: import("convex/values").VFloat64<number, "required">;
1206
1543
  }, "required", "amount" | "destinationAccountId" | "role">, "required">;
1207
- }, "optional", "adjustmentAmount" | "currency" | "gross" | "paymentId" | "paymentIntentId" | "platformNet" | "processingFee" | "sourceChargeId" | "sourceInvoiceId" | "transfers">;
1208
- }, "required", "accountId" | "allocation" | "allocation.adjustmentAmount" | "allocation.currency" | "allocation.gross" | "allocation.paymentId" | "allocation.paymentIntentId" | "allocation.platformNet" | "allocation.processingFee" | "allocation.sourceChargeId" | "allocation.sourceInvoiceId" | "allocation.transfers" | "completion" | "currency" | "definitionVersion" | "groupKey" | "maxAttempts" | "provider" | "providerApiVersion" | "releaseUncollectible" | "retryDelayMs" | "scopeKey">;
1544
+ }, "optional", "adjustmentAmount" | "creditSource" | "creditSource.creditGrantId" | "creditSource.customerAccount" | "creditSource.livemode" | "creditSource.purchaseId" | "creditSource.stripeAccountId" | "creditSource.stripePriceId" | "creditSource.stripeProductId" | "currency" | "gross" | "paymentId" | "paymentIntentId" | "platformNet" | "processingFee" | "sourceChargeId" | "sourceInvoiceId" | "transfers" | "usageSource" | "usageSource.customerAccount" | "usageSource.invoicePaymentId" | "usageSource.livemode" | "usageSource.meterId" | "usageSource.model" | "usageSource.period" | "usageSource.period.end" | "usageSource.period.start" | "usageSource.stripeAccountId" | "usageSource.stripePriceId" | "usageSource.stripeProductId" | "usageSource.subscriptionId" | "usageSource.subscriptionItemId">;
1545
+ }, "required", "accountId" | "allocation" | "allocation.adjustmentAmount" | "allocation.creditSource" | "allocation.creditSource.creditGrantId" | "allocation.creditSource.customerAccount" | "allocation.creditSource.livemode" | "allocation.creditSource.purchaseId" | "allocation.creditSource.stripeAccountId" | "allocation.creditSource.stripePriceId" | "allocation.creditSource.stripeProductId" | "allocation.currency" | "allocation.gross" | "allocation.paymentId" | "allocation.paymentIntentId" | "allocation.platformNet" | "allocation.processingFee" | "allocation.sourceChargeId" | "allocation.sourceInvoiceId" | "allocation.transfers" | "allocation.usageSource" | "allocation.usageSource.customerAccount" | "allocation.usageSource.invoicePaymentId" | "allocation.usageSource.livemode" | "allocation.usageSource.meterId" | "allocation.usageSource.model" | "allocation.usageSource.period" | "allocation.usageSource.period.end" | "allocation.usageSource.period.start" | "allocation.usageSource.stripeAccountId" | "allocation.usageSource.stripePriceId" | "allocation.usageSource.stripeProductId" | "allocation.usageSource.subscriptionId" | "allocation.usageSource.subscriptionItemId" | "completion" | "currency" | "definitionVersion" | "groupKey" | "maxAttempts" | "provider" | "providerApiVersion" | "releaseUncollectible" | "retryDelayMs" | "scopeKey">;
1209
1546
  operationId: import("convex/values").VId<import("convex/values").GenericId<"recoveryWorkflowOperations">, "required">;
1210
- }, "required", "binding" | "binding.accountId" | "binding.allocation" | "binding.allocation.adjustmentAmount" | "binding.allocation.currency" | "binding.allocation.gross" | "binding.allocation.paymentId" | "binding.allocation.paymentIntentId" | "binding.allocation.platformNet" | "binding.allocation.processingFee" | "binding.allocation.sourceChargeId" | "binding.allocation.sourceInvoiceId" | "binding.allocation.transfers" | "binding.completion" | "binding.currency" | "binding.definitionVersion" | "binding.groupKey" | "binding.maxAttempts" | "binding.provider" | "binding.providerApiVersion" | "binding.releaseUncollectible" | "binding.retryDelayMs" | "binding.scopeKey" | "operationId" | "requestKey">, {
1547
+ }, "required", "binding" | "binding.accountId" | "binding.allocation" | "binding.allocation.adjustmentAmount" | "binding.allocation.creditSource" | "binding.allocation.creditSource.creditGrantId" | "binding.allocation.creditSource.customerAccount" | "binding.allocation.creditSource.livemode" | "binding.allocation.creditSource.purchaseId" | "binding.allocation.creditSource.stripeAccountId" | "binding.allocation.creditSource.stripePriceId" | "binding.allocation.creditSource.stripeProductId" | "binding.allocation.currency" | "binding.allocation.gross" | "binding.allocation.paymentId" | "binding.allocation.paymentIntentId" | "binding.allocation.platformNet" | "binding.allocation.processingFee" | "binding.allocation.sourceChargeId" | "binding.allocation.sourceInvoiceId" | "binding.allocation.transfers" | "binding.allocation.usageSource" | "binding.allocation.usageSource.customerAccount" | "binding.allocation.usageSource.invoicePaymentId" | "binding.allocation.usageSource.livemode" | "binding.allocation.usageSource.meterId" | "binding.allocation.usageSource.model" | "binding.allocation.usageSource.period" | "binding.allocation.usageSource.period.end" | "binding.allocation.usageSource.period.start" | "binding.allocation.usageSource.stripeAccountId" | "binding.allocation.usageSource.stripePriceId" | "binding.allocation.usageSource.stripeProductId" | "binding.allocation.usageSource.subscriptionId" | "binding.allocation.usageSource.subscriptionItemId" | "binding.completion" | "binding.currency" | "binding.definitionVersion" | "binding.groupKey" | "binding.maxAttempts" | "binding.provider" | "binding.providerApiVersion" | "binding.releaseUncollectible" | "binding.retryDelayMs" | "binding.scopeKey" | "operationId" | "requestKey">, {
1211
1548
  by_key: ["requestKey", "_creationTime"];
1212
1549
  }, {}, {}>;
1213
1550
  balanceFundingPreparations: import("convex/server").TableDefinition<import("convex/values").VObject<{
@@ -3005,6 +3342,15 @@ declare const _default: import("convex/server").SchemaDefinition<{
3005
3342
  }, {}, {}>;
3006
3343
  settlementAllocations: import("convex/server").TableDefinition<import("convex/values").VObject<{
3007
3344
  adjustmentAmount?: number | undefined;
3345
+ creditSource?: {
3346
+ creditGrantId: string;
3347
+ customerAccount: string;
3348
+ livemode: boolean;
3349
+ purchaseId: string;
3350
+ stripeAccountId: string;
3351
+ stripePriceId: string;
3352
+ stripeProductId: string;
3353
+ } | undefined;
3008
3354
  currency: string;
3009
3355
  gross: number;
3010
3356
  paymentId?: string | undefined;
@@ -3018,10 +3364,77 @@ declare const _default: import("convex/server").SchemaDefinition<{
3018
3364
  destinationAccountId: string;
3019
3365
  role: "affiliate" | "other" | "store";
3020
3366
  }[];
3367
+ usageSource?: {
3368
+ customerAccount: string;
3369
+ invoicePaymentId: string;
3370
+ livemode: boolean;
3371
+ meterId: string;
3372
+ model: "included_overage" | "pay_as_you_go";
3373
+ period: {
3374
+ end: number;
3375
+ start: number;
3376
+ };
3377
+ stripeAccountId: string;
3378
+ stripePriceId: string;
3379
+ stripeProductId: string;
3380
+ subscriptionId: string;
3381
+ subscriptionItemId: string;
3382
+ } | undefined;
3021
3383
  }, {
3022
3384
  sourceChargeId: import("convex/values").VString<string, "required">;
3023
3385
  paymentIntentId: import("convex/values").VString<string | undefined, "optional">;
3024
3386
  sourceInvoiceId: import("convex/values").VString<string | undefined, "optional">;
3387
+ usageSource: import("convex/values").VObject<{
3388
+ customerAccount: string;
3389
+ invoicePaymentId: string;
3390
+ livemode: boolean;
3391
+ meterId: string;
3392
+ model: "included_overage" | "pay_as_you_go";
3393
+ period: {
3394
+ end: number;
3395
+ start: number;
3396
+ };
3397
+ stripeAccountId: string;
3398
+ stripePriceId: string;
3399
+ stripeProductId: string;
3400
+ subscriptionId: string;
3401
+ subscriptionItemId: string;
3402
+ } | undefined, {
3403
+ stripeAccountId: import("convex/values").VString<string, "required">;
3404
+ customerAccount: import("convex/values").VString<string, "required">;
3405
+ livemode: import("convex/values").VBoolean<boolean, "required">;
3406
+ meterId: import("convex/values").VString<string, "required">;
3407
+ stripePriceId: import("convex/values").VString<string, "required">;
3408
+ stripeProductId: import("convex/values").VString<string, "required">;
3409
+ subscriptionId: import("convex/values").VString<string, "required">;
3410
+ subscriptionItemId: import("convex/values").VString<string, "required">;
3411
+ invoicePaymentId: import("convex/values").VString<string, "required">;
3412
+ period: import("convex/values").VObject<{
3413
+ end: number;
3414
+ start: number;
3415
+ }, {
3416
+ start: import("convex/values").VFloat64<number, "required">;
3417
+ end: import("convex/values").VFloat64<number, "required">;
3418
+ }, "required", "end" | "start">;
3419
+ model: import("convex/values").VUnion<"included_overage" | "pay_as_you_go", [import("convex/values").VLiteral<"pay_as_you_go", "required">, import("convex/values").VLiteral<"included_overage", "required">], "required", never>;
3420
+ }, "optional", "customerAccount" | "invoicePaymentId" | "livemode" | "meterId" | "model" | "period" | "period.end" | "period.start" | "stripeAccountId" | "stripePriceId" | "stripeProductId" | "subscriptionId" | "subscriptionItemId">;
3421
+ creditSource: import("convex/values").VObject<{
3422
+ creditGrantId: string;
3423
+ customerAccount: string;
3424
+ livemode: boolean;
3425
+ purchaseId: string;
3426
+ stripeAccountId: string;
3427
+ stripePriceId: string;
3428
+ stripeProductId: string;
3429
+ } | undefined, {
3430
+ stripeAccountId: import("convex/values").VString<string, "required">;
3431
+ customerAccount: import("convex/values").VString<string, "required">;
3432
+ livemode: import("convex/values").VBoolean<boolean, "required">;
3433
+ purchaseId: import("convex/values").VString<string, "required">;
3434
+ creditGrantId: import("convex/values").VString<string, "required">;
3435
+ stripePriceId: import("convex/values").VString<string, "required">;
3436
+ stripeProductId: import("convex/values").VString<string, "required">;
3437
+ }, "optional", "creditGrantId" | "customerAccount" | "livemode" | "purchaseId" | "stripeAccountId" | "stripePriceId" | "stripeProductId">;
3025
3438
  gross: import("convex/values").VFloat64<number, "required">;
3026
3439
  currency: import("convex/values").VString<string, "required">;
3027
3440
  processingFee: import("convex/values").VFloat64<number, "required">;
@@ -3041,7 +3454,7 @@ declare const _default: import("convex/server").SchemaDefinition<{
3041
3454
  role: import("convex/values").VUnion<"affiliate" | "other" | "store", [import("convex/values").VLiteral<"store", "required">, import("convex/values").VLiteral<"affiliate", "required">, import("convex/values").VLiteral<"other", "required">], "required", never>;
3042
3455
  amount: import("convex/values").VFloat64<number, "required">;
3043
3456
  }, "required", "amount" | "destinationAccountId" | "role">, "required">;
3044
- }, "required", "adjustmentAmount" | "currency" | "gross" | "paymentId" | "paymentIntentId" | "platformNet" | "processingFee" | "sourceChargeId" | "sourceInvoiceId" | "transfers">, {
3457
+ }, "required", "adjustmentAmount" | "creditSource" | "creditSource.creditGrantId" | "creditSource.customerAccount" | "creditSource.livemode" | "creditSource.purchaseId" | "creditSource.stripeAccountId" | "creditSource.stripePriceId" | "creditSource.stripeProductId" | "currency" | "gross" | "paymentId" | "paymentIntentId" | "platformNet" | "processingFee" | "sourceChargeId" | "sourceInvoiceId" | "transfers" | "usageSource" | "usageSource.customerAccount" | "usageSource.invoicePaymentId" | "usageSource.livemode" | "usageSource.meterId" | "usageSource.model" | "usageSource.period" | "usageSource.period.end" | "usageSource.period.start" | "usageSource.stripeAccountId" | "usageSource.stripePriceId" | "usageSource.stripeProductId" | "usageSource.subscriptionId" | "usageSource.subscriptionItemId">, {
3045
3458
  by_source_charge: ["sourceChargeId", "_creationTime"];
3046
3459
  }, {}, {}>;
3047
3460
  commissionTerms: import("convex/server").TableDefinition<import("convex/values").VObject<{