@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
@@ -10,6 +10,114 @@ export declare const scope: {
10
10
  };
11
11
  export declare function setup(amounts?: number[]): Promise<{
12
12
  t: import("convex-test").TestConvex<import("convex/server").SchemaDefinition<{
13
+ usageCorrectionClaims: import("convex/server").TableDefinition<import("convex/values").VObject<{
14
+ key: string;
15
+ operationKey: string;
16
+ proofJson: string;
17
+ }, {
18
+ key: import("convex/values").VString<string, "required">;
19
+ operationKey: import("convex/values").VString<string, "required">;
20
+ proofJson: import("convex/values").VString<string, "required">;
21
+ }, "required", "key" | "operationKey" | "proofJson">, {
22
+ by_key: ["key", "_creationTime"];
23
+ }, {}, {}>;
24
+ usageCorrections: import("convex/server").TableDefinition<import("convex/values").VObject<{
25
+ adjustmentJson?: string | undefined;
26
+ attempt: number;
27
+ attemptedAt?: number | undefined;
28
+ cashConsequence: "none" | "operator_resolution_required" | "verified_external_adjustment";
29
+ correctionId: string;
30
+ creditNoteId?: string | undefined;
31
+ customerAccount?: string | undefined;
32
+ eventId: import("convex/values").GenericId<"usageEvents">;
33
+ firstAttemptAt: number;
34
+ historyCount: number;
35
+ inputJson: string;
36
+ invoiceId?: string | undefined;
37
+ key: string;
38
+ leaseUntil?: number | undefined;
39
+ nativeAdjustmentId?: string | undefined;
40
+ nativeCreditNoteStatus?: "issued" | "void" | undefined;
41
+ nativeStatus?: "complete" | "pending" | undefined;
42
+ observedAt?: number | undefined;
43
+ quantity: string;
44
+ reason: string;
45
+ recordJson: string;
46
+ refundId?: string | undefined;
47
+ resolution?: "event_cancellation" | "invoice_credit" | undefined;
48
+ restoredQuantity: string;
49
+ scaledQuantity: string;
50
+ scopeKey: string;
51
+ state: "confirmed" | "held" | "invoice_adjustment_required" | "provider_accepted" | "requested" | "unsupported";
52
+ stripeAccountId?: string | undefined;
53
+ subscriptionJson: string;
54
+ }, {
55
+ stripeAccountId: import("convex/values").VString<string | undefined, "optional">;
56
+ customerAccount: import("convex/values").VString<string | undefined, "optional">;
57
+ observedAt: import("convex/values").VFloat64<number | undefined, "optional">;
58
+ nativeCreditNoteStatus: import("convex/values").VUnion<"issued" | "void" | undefined, [import("convex/values").VLiteral<"issued", "required">, import("convex/values").VLiteral<"void", "required">], "optional", never>;
59
+ 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>;
60
+ adjustmentJson: import("convex/values").VString<string | undefined, "optional">;
61
+ key: import("convex/values").VString<string, "required">;
62
+ scopeKey: import("convex/values").VString<string, "required">;
63
+ eventId: import("convex/values").VId<import("convex/values").GenericId<"usageEvents">, "required">;
64
+ correctionId: import("convex/values").VString<string, "required">;
65
+ inputJson: import("convex/values").VString<string, "required">;
66
+ recordJson: import("convex/values").VString<string, "required">;
67
+ subscriptionJson: import("convex/values").VString<string, "required">;
68
+ quantity: import("convex/values").VString<string, "required">;
69
+ scaledQuantity: import("convex/values").VString<string, "required">;
70
+ 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>;
71
+ reason: import("convex/values").VString<string, "required">;
72
+ firstAttemptAt: import("convex/values").VFloat64<number, "required">;
73
+ attemptedAt: import("convex/values").VFloat64<number | undefined, "optional">;
74
+ leaseUntil: import("convex/values").VFloat64<number | undefined, "optional">;
75
+ attempt: import("convex/values").VFloat64<number, "required">;
76
+ nativeAdjustmentId: import("convex/values").VString<string | undefined, "optional">;
77
+ nativeStatus: import("convex/values").VUnion<"complete" | "pending" | undefined, [import("convex/values").VLiteral<"pending", "required">, import("convex/values").VLiteral<"complete", "required">], "optional", never>;
78
+ invoiceId: import("convex/values").VString<string | undefined, "optional">;
79
+ creditNoteId: import("convex/values").VString<string | undefined, "optional">;
80
+ refundId: import("convex/values").VString<string | undefined, "optional">;
81
+ 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>;
82
+ restoredQuantity: import("convex/values").VString<string, "required">;
83
+ historyCount: import("convex/values").VFloat64<number, "required">;
84
+ }, "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">, {
85
+ by_event: ["eventId", "_creationTime"];
86
+ by_key: ["key", "_creationTime"];
87
+ by_payer_state: ["customerAccount", "state", "_creationTime"];
88
+ by_realm_state: ["stripeAccountId", "state", "_creationTime"];
89
+ by_scope: ["scopeKey", "_creationTime"];
90
+ by_scope_state: ["scopeKey", "state", "_creationTime"];
91
+ }, {}, {}>;
92
+ usageCorrectionHistory: import("convex/server").TableDefinition<import("convex/values").VObject<{
93
+ at: number;
94
+ eventId: import("convex/values").GenericId<"usageEvents">;
95
+ evidenceJson: string;
96
+ key: string;
97
+ occurredAt?: number | undefined;
98
+ reason: string;
99
+ recordJson: string;
100
+ scopeKey: string;
101
+ sequence: number;
102
+ state: "confirmed" | "held" | "invoice_adjustment_required" | "provider_accepted" | "requested" | "unsupported";
103
+ subscriptionJson: string;
104
+ }, {
105
+ key: import("convex/values").VString<string, "required">;
106
+ scopeKey: import("convex/values").VString<string, "required">;
107
+ eventId: import("convex/values").VId<import("convex/values").GenericId<"usageEvents">, "required">;
108
+ sequence: import("convex/values").VFloat64<number, "required">;
109
+ 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>;
110
+ reason: import("convex/values").VString<string, "required">;
111
+ recordJson: import("convex/values").VString<string, "required">;
112
+ subscriptionJson: import("convex/values").VString<string, "required">;
113
+ evidenceJson: import("convex/values").VString<string, "required">;
114
+ occurredAt: import("convex/values").VFloat64<number | undefined, "optional">;
115
+ at: import("convex/values").VFloat64<number, "required">;
116
+ }, "required", "at" | "eventId" | "evidenceJson" | "key" | "occurredAt" | "reason" | "recordJson" | "scopeKey" | "sequence" | "state" | "subscriptionJson">, {
117
+ by_event: ["eventId", "_creationTime"];
118
+ by_scope_occurrence: ["scopeKey", "occurredAt", "_creationTime"];
119
+ by_scope_time: ["scopeKey", "at", "_creationTime"];
120
+ }, {}, {}>;
13
121
  usageAllowancePolicies: import("convex/server").TableDefinition<import("convex/values").VObject<{
14
122
  bindingJson: string;
15
123
  consumed: string;
@@ -43,10 +151,10 @@ export declare function setup(amounts?: number[]): Promise<{
43
151
  at: number;
44
152
  evidenceJson: string;
45
153
  key: string;
46
- kind: "commit" | "policy" | "release" | "reservation";
154
+ kind: "commit" | "correction" | "policy" | "release" | "reservation";
47
155
  }, {
48
156
  key: import("convex/values").VString<string, "required">;
49
- 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>;
157
+ 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>;
50
158
  evidenceJson: import("convex/values").VString<string, "required">;
51
159
  at: import("convex/values").VFloat64<number, "required">;
52
160
  }, "required", "at" | "evidenceJson" | "key" | "kind">, {
@@ -253,6 +361,7 @@ export declare function setup(amounts?: number[]): Promise<{
253
361
  }, {}, {}>;
254
362
  usageOutbox: import("convex/server").TableDefinition<import("convex/values").VObject<{
255
363
  attempts: number;
364
+ correctionKey?: string | undefined;
256
365
  definitionVersion?: 1 | undefined;
257
366
  dispatch?: string | undefined;
258
367
  eventId: import("convex/values").GenericId<"usageEvents">;
@@ -263,13 +372,13 @@ export declare function setup(amounts?: number[]): Promise<{
263
372
  nextAttemptAt: number;
264
373
  provider?: string | undefined;
265
374
  providerIdentifier: string;
266
- reason?: "administrative_hold" | "billing_period_closed" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined;
375
+ 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;
267
376
  receipt?: {
268
377
  created: number;
269
378
  identifier: string;
270
379
  } | undefined;
271
380
  scopeKey: string;
272
- state: "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
381
+ state: "canceled" | "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
273
382
  workflowId?: string | undefined;
274
383
  }, {
275
384
  historySequence: import("convex/values").VFloat64<number | undefined, "optional">;
@@ -279,7 +388,7 @@ export declare function setup(amounts?: number[]): Promise<{
279
388
  firstSendAt: import("convex/values").VFloat64<number | undefined, "optional">;
280
389
  leaseUntil: import("convex/values").VFloat64<number | undefined, "optional">;
281
390
  held: import("convex/values").VBoolean<boolean | undefined, "optional">;
282
- 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>;
391
+ 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>;
283
392
  receipt: import("convex/values").VObject<{
284
393
  created: number;
285
394
  identifier: string;
@@ -287,14 +396,15 @@ export declare function setup(amounts?: number[]): Promise<{
287
396
  identifier: import("convex/values").VString<string, "required">;
288
397
  created: import("convex/values").VFloat64<number, "required">;
289
398
  }, "optional", "created" | "identifier">;
399
+ correctionKey: import("convex/values").VString<string | undefined, "optional">;
290
400
  eventId: import("convex/values").VId<import("convex/values").GenericId<"usageEvents">, "required">;
291
401
  scopeKey: import("convex/values").VString<string, "required">;
292
- 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>;
402
+ 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>;
293
403
  attempts: import("convex/values").VFloat64<number, "required">;
294
404
  nextAttemptAt: import("convex/values").VFloat64<number, "required">;
295
405
  providerIdentifier: import("convex/values").VString<string, "required">;
296
406
  dispatch: import("convex/values").VString<string | undefined, "optional">;
297
- }, "required", "attempts" | "definitionVersion" | "dispatch" | "eventId" | "firstSendAt" | "held" | "historySequence" | "leaseUntil" | "nextAttemptAt" | "provider" | "providerIdentifier" | "reason" | "receipt" | "receipt.created" | "receipt.identifier" | "scopeKey" | "state" | "workflowId">, {
407
+ }, "required", "attempts" | "correctionKey" | "definitionVersion" | "dispatch" | "eventId" | "firstSendAt" | "held" | "historySequence" | "leaseUntil" | "nextAttemptAt" | "provider" | "providerIdentifier" | "reason" | "receipt" | "receipt.created" | "receipt.identifier" | "scopeKey" | "state" | "workflowId">, {
298
408
  by_event: ["eventId", "_creationTime"];
299
409
  by_provider_identifier: ["providerIdentifier", "_creationTime"];
300
410
  by_scope_state: ["scopeKey", "state", "_creationTime"];
@@ -450,13 +560,13 @@ export declare function setup(amounts?: number[]): Promise<{
450
560
  at: number;
451
561
  evidenceJson: string;
452
562
  fingerprint: string;
453
- kind: "closure" | "commit" | "grant" | "observation" | "payment" | "purchase" | "recovery" | "release" | "reservation";
563
+ kind: "closure" | "commit" | "correction" | "grant" | "observation" | "payment" | "purchase" | "recovery" | "release" | "reservation";
454
564
  purchaseKey?: string | undefined;
455
565
  sourceKey: string;
456
566
  }, {
457
567
  accountKey: import("convex/values").VString<string, "required">;
458
568
  purchaseKey: import("convex/values").VString<string | undefined, "optional">;
459
- 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>;
569
+ 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>;
460
570
  sourceKey: import("convex/values").VString<string, "required">;
461
571
  fingerprint: import("convex/values").VString<string, "required">;
462
572
  evidenceJson: import("convex/values").VString<string, "required">;
@@ -1005,6 +1115,15 @@ export declare function setup(amounts?: number[]): Promise<{
1005
1115
  activePhase?: "execute" | "reconcile" | undefined;
1006
1116
  allocation?: {
1007
1117
  adjustmentAmount?: number | undefined;
1118
+ creditSource?: {
1119
+ creditGrantId: string;
1120
+ customerAccount: string;
1121
+ livemode: boolean;
1122
+ purchaseId: string;
1123
+ stripeAccountId: string;
1124
+ stripePriceId: string;
1125
+ stripeProductId: string;
1126
+ } | undefined;
1008
1127
  currency: string;
1009
1128
  gross: number;
1010
1129
  paymentId?: string | undefined;
@@ -1018,6 +1137,22 @@ export declare function setup(amounts?: number[]): Promise<{
1018
1137
  destinationAccountId: string;
1019
1138
  role: "affiliate" | "other" | "store";
1020
1139
  }[];
1140
+ usageSource?: {
1141
+ customerAccount: string;
1142
+ invoicePaymentId: string;
1143
+ livemode: boolean;
1144
+ meterId: string;
1145
+ model: "included_overage" | "pay_as_you_go";
1146
+ period: {
1147
+ end: number;
1148
+ start: number;
1149
+ };
1150
+ stripeAccountId: string;
1151
+ stripePriceId: string;
1152
+ stripeProductId: string;
1153
+ subscriptionId: string;
1154
+ subscriptionItemId: string;
1155
+ } | undefined;
1021
1156
  } | undefined;
1022
1157
  cancelRequested: boolean;
1023
1158
  completion?: string | undefined;
@@ -1052,6 +1187,15 @@ export declare function setup(amounts?: number[]): Promise<{
1052
1187
  retryDelayMs: import("convex/values").VFloat64<number, "required">;
1053
1188
  allocation: import("convex/values").VObject<{
1054
1189
  adjustmentAmount?: number | undefined;
1190
+ creditSource?: {
1191
+ creditGrantId: string;
1192
+ customerAccount: string;
1193
+ livemode: boolean;
1194
+ purchaseId: string;
1195
+ stripeAccountId: string;
1196
+ stripePriceId: string;
1197
+ stripeProductId: string;
1198
+ } | undefined;
1055
1199
  currency: string;
1056
1200
  gross: number;
1057
1201
  paymentId?: string | undefined;
@@ -1065,10 +1209,77 @@ export declare function setup(amounts?: number[]): Promise<{
1065
1209
  destinationAccountId: string;
1066
1210
  role: "affiliate" | "other" | "store";
1067
1211
  }[];
1212
+ usageSource?: {
1213
+ customerAccount: string;
1214
+ invoicePaymentId: string;
1215
+ livemode: boolean;
1216
+ meterId: string;
1217
+ model: "included_overage" | "pay_as_you_go";
1218
+ period: {
1219
+ end: number;
1220
+ start: number;
1221
+ };
1222
+ stripeAccountId: string;
1223
+ stripePriceId: string;
1224
+ stripeProductId: string;
1225
+ subscriptionId: string;
1226
+ subscriptionItemId: string;
1227
+ } | undefined;
1068
1228
  } | undefined, {
1069
1229
  sourceChargeId: import("convex/values").VString<string, "required">;
1070
1230
  paymentIntentId: import("convex/values").VString<string | undefined, "optional">;
1071
1231
  sourceInvoiceId: import("convex/values").VString<string | undefined, "optional">;
1232
+ usageSource: import("convex/values").VObject<{
1233
+ customerAccount: string;
1234
+ invoicePaymentId: string;
1235
+ livemode: boolean;
1236
+ meterId: string;
1237
+ model: "included_overage" | "pay_as_you_go";
1238
+ period: {
1239
+ end: number;
1240
+ start: number;
1241
+ };
1242
+ stripeAccountId: string;
1243
+ stripePriceId: string;
1244
+ stripeProductId: string;
1245
+ subscriptionId: string;
1246
+ subscriptionItemId: string;
1247
+ } | undefined, {
1248
+ stripeAccountId: import("convex/values").VString<string, "required">;
1249
+ customerAccount: import("convex/values").VString<string, "required">;
1250
+ livemode: import("convex/values").VBoolean<boolean, "required">;
1251
+ meterId: import("convex/values").VString<string, "required">;
1252
+ stripePriceId: import("convex/values").VString<string, "required">;
1253
+ stripeProductId: import("convex/values").VString<string, "required">;
1254
+ subscriptionId: import("convex/values").VString<string, "required">;
1255
+ subscriptionItemId: import("convex/values").VString<string, "required">;
1256
+ invoicePaymentId: import("convex/values").VString<string, "required">;
1257
+ period: import("convex/values").VObject<{
1258
+ end: number;
1259
+ start: number;
1260
+ }, {
1261
+ start: import("convex/values").VFloat64<number, "required">;
1262
+ end: import("convex/values").VFloat64<number, "required">;
1263
+ }, "required", "end" | "start">;
1264
+ 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>;
1265
+ }, "optional", "customerAccount" | "invoicePaymentId" | "livemode" | "meterId" | "model" | "period" | "period.end" | "period.start" | "stripeAccountId" | "stripePriceId" | "stripeProductId" | "subscriptionId" | "subscriptionItemId">;
1266
+ creditSource: import("convex/values").VObject<{
1267
+ creditGrantId: string;
1268
+ customerAccount: string;
1269
+ livemode: boolean;
1270
+ purchaseId: string;
1271
+ stripeAccountId: string;
1272
+ stripePriceId: string;
1273
+ stripeProductId: string;
1274
+ } | undefined, {
1275
+ stripeAccountId: import("convex/values").VString<string, "required">;
1276
+ customerAccount: import("convex/values").VString<string, "required">;
1277
+ livemode: import("convex/values").VBoolean<boolean, "required">;
1278
+ purchaseId: import("convex/values").VString<string, "required">;
1279
+ creditGrantId: import("convex/values").VString<string, "required">;
1280
+ stripePriceId: import("convex/values").VString<string, "required">;
1281
+ stripeProductId: import("convex/values").VString<string, "required">;
1282
+ }, "optional", "creditGrantId" | "customerAccount" | "livemode" | "purchaseId" | "stripeAccountId" | "stripePriceId" | "stripeProductId">;
1072
1283
  gross: import("convex/values").VFloat64<number, "required">;
1073
1284
  currency: import("convex/values").VString<string, "required">;
1074
1285
  processingFee: import("convex/values").VFloat64<number, "required">;
@@ -1088,7 +1299,7 @@ export declare function setup(amounts?: number[]): Promise<{
1088
1299
  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>;
1089
1300
  amount: import("convex/values").VFloat64<number, "required">;
1090
1301
  }, "required", "amount" | "destinationAccountId" | "role">, "required">;
1091
- }, "optional", "adjustmentAmount" | "currency" | "gross" | "paymentId" | "paymentIntentId" | "platformNet" | "processingFee" | "sourceChargeId" | "sourceInvoiceId" | "transfers">;
1302
+ }, "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">;
1092
1303
  version: import("convex/values").VFloat64<number, "required">;
1093
1304
  sourceKind: import("convex/values").VUnion<"invoice" | "settlement", [import("convex/values").VLiteral<"settlement", "required">, import("convex/values").VLiteral<"invoice", "required">], "required", never>;
1094
1305
  sourceId: import("convex/values").VString<string, "required">;
@@ -1099,7 +1310,7 @@ export declare function setup(amounts?: number[]): Promise<{
1099
1310
  activePhase: import("convex/values").VUnion<"execute" | "reconcile" | undefined, [import("convex/values").VLiteral<"execute", "required">, import("convex/values").VLiteral<"reconcile", "required">], "optional", never>;
1100
1311
  resumeQueued: import("convex/values").VBoolean<boolean, "required">;
1101
1312
  outcome: import("convex/values").VUnion<"collect" | "release" | undefined, [import("convex/values").VLiteral<"collect", "required">, import("convex/values").VLiteral<"release", "required">], "optional", never>;
1102
- }, "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">, {
1313
+ }, "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">, {
1103
1314
  by_group: ["groupKey", "_creationTime"];
1104
1315
  by_source: ["sourceKind", "sourceId", "_creationTime"];
1105
1316
  }, {}, {}>;
@@ -1108,6 +1319,15 @@ export declare function setup(amounts?: number[]): Promise<{
1108
1319
  accountId: string;
1109
1320
  allocation?: {
1110
1321
  adjustmentAmount?: number | undefined;
1322
+ creditSource?: {
1323
+ creditGrantId: string;
1324
+ customerAccount: string;
1325
+ livemode: boolean;
1326
+ purchaseId: string;
1327
+ stripeAccountId: string;
1328
+ stripePriceId: string;
1329
+ stripeProductId: string;
1330
+ } | undefined;
1111
1331
  currency: string;
1112
1332
  gross: number;
1113
1333
  paymentId?: string | undefined;
@@ -1121,6 +1341,22 @@ export declare function setup(amounts?: number[]): Promise<{
1121
1341
  destinationAccountId: string;
1122
1342
  role: "affiliate" | "other" | "store";
1123
1343
  }[];
1344
+ usageSource?: {
1345
+ customerAccount: string;
1346
+ invoicePaymentId: string;
1347
+ livemode: boolean;
1348
+ meterId: string;
1349
+ model: "included_overage" | "pay_as_you_go";
1350
+ period: {
1351
+ end: number;
1352
+ start: number;
1353
+ };
1354
+ stripeAccountId: string;
1355
+ stripePriceId: string;
1356
+ stripeProductId: string;
1357
+ subscriptionId: string;
1358
+ subscriptionItemId: string;
1359
+ } | undefined;
1124
1360
  } | undefined;
1125
1361
  completion?: string | undefined;
1126
1362
  currency: string;
@@ -1141,6 +1377,15 @@ export declare function setup(amounts?: number[]): Promise<{
1141
1377
  accountId: string;
1142
1378
  allocation?: {
1143
1379
  adjustmentAmount?: number | undefined;
1380
+ creditSource?: {
1381
+ creditGrantId: string;
1382
+ customerAccount: string;
1383
+ livemode: boolean;
1384
+ purchaseId: string;
1385
+ stripeAccountId: string;
1386
+ stripePriceId: string;
1387
+ stripeProductId: string;
1388
+ } | undefined;
1144
1389
  currency: string;
1145
1390
  gross: number;
1146
1391
  paymentId?: string | undefined;
@@ -1154,6 +1399,22 @@ export declare function setup(amounts?: number[]): Promise<{
1154
1399
  destinationAccountId: string;
1155
1400
  role: "affiliate" | "other" | "store";
1156
1401
  }[];
1402
+ usageSource?: {
1403
+ customerAccount: string;
1404
+ invoicePaymentId: string;
1405
+ livemode: boolean;
1406
+ meterId: string;
1407
+ model: "included_overage" | "pay_as_you_go";
1408
+ period: {
1409
+ end: number;
1410
+ start: number;
1411
+ };
1412
+ stripeAccountId: string;
1413
+ stripePriceId: string;
1414
+ stripeProductId: string;
1415
+ subscriptionId: string;
1416
+ subscriptionItemId: string;
1417
+ } | undefined;
1157
1418
  } | undefined;
1158
1419
  completion?: string | undefined;
1159
1420
  currency: string;
@@ -1179,6 +1440,15 @@ export declare function setup(amounts?: number[]): Promise<{
1179
1440
  retryDelayMs: import("convex/values").VFloat64<number, "required">;
1180
1441
  allocation: import("convex/values").VObject<{
1181
1442
  adjustmentAmount?: number | undefined;
1443
+ creditSource?: {
1444
+ creditGrantId: string;
1445
+ customerAccount: string;
1446
+ livemode: boolean;
1447
+ purchaseId: string;
1448
+ stripeAccountId: string;
1449
+ stripePriceId: string;
1450
+ stripeProductId: string;
1451
+ } | undefined;
1182
1452
  currency: string;
1183
1453
  gross: number;
1184
1454
  paymentId?: string | undefined;
@@ -1192,10 +1462,77 @@ export declare function setup(amounts?: number[]): Promise<{
1192
1462
  destinationAccountId: string;
1193
1463
  role: "affiliate" | "other" | "store";
1194
1464
  }[];
1465
+ usageSource?: {
1466
+ customerAccount: string;
1467
+ invoicePaymentId: string;
1468
+ livemode: boolean;
1469
+ meterId: string;
1470
+ model: "included_overage" | "pay_as_you_go";
1471
+ period: {
1472
+ end: number;
1473
+ start: number;
1474
+ };
1475
+ stripeAccountId: string;
1476
+ stripePriceId: string;
1477
+ stripeProductId: string;
1478
+ subscriptionId: string;
1479
+ subscriptionItemId: string;
1480
+ } | undefined;
1195
1481
  } | undefined, {
1196
1482
  sourceChargeId: import("convex/values").VString<string, "required">;
1197
1483
  paymentIntentId: import("convex/values").VString<string | undefined, "optional">;
1198
1484
  sourceInvoiceId: import("convex/values").VString<string | undefined, "optional">;
1485
+ usageSource: import("convex/values").VObject<{
1486
+ customerAccount: string;
1487
+ invoicePaymentId: string;
1488
+ livemode: boolean;
1489
+ meterId: string;
1490
+ model: "included_overage" | "pay_as_you_go";
1491
+ period: {
1492
+ end: number;
1493
+ start: number;
1494
+ };
1495
+ stripeAccountId: string;
1496
+ stripePriceId: string;
1497
+ stripeProductId: string;
1498
+ subscriptionId: string;
1499
+ subscriptionItemId: string;
1500
+ } | undefined, {
1501
+ stripeAccountId: import("convex/values").VString<string, "required">;
1502
+ customerAccount: import("convex/values").VString<string, "required">;
1503
+ livemode: import("convex/values").VBoolean<boolean, "required">;
1504
+ meterId: import("convex/values").VString<string, "required">;
1505
+ stripePriceId: import("convex/values").VString<string, "required">;
1506
+ stripeProductId: import("convex/values").VString<string, "required">;
1507
+ subscriptionId: import("convex/values").VString<string, "required">;
1508
+ subscriptionItemId: import("convex/values").VString<string, "required">;
1509
+ invoicePaymentId: import("convex/values").VString<string, "required">;
1510
+ period: import("convex/values").VObject<{
1511
+ end: number;
1512
+ start: number;
1513
+ }, {
1514
+ start: import("convex/values").VFloat64<number, "required">;
1515
+ end: import("convex/values").VFloat64<number, "required">;
1516
+ }, "required", "end" | "start">;
1517
+ 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>;
1518
+ }, "optional", "customerAccount" | "invoicePaymentId" | "livemode" | "meterId" | "model" | "period" | "period.end" | "period.start" | "stripeAccountId" | "stripePriceId" | "stripeProductId" | "subscriptionId" | "subscriptionItemId">;
1519
+ creditSource: import("convex/values").VObject<{
1520
+ creditGrantId: string;
1521
+ customerAccount: string;
1522
+ livemode: boolean;
1523
+ purchaseId: string;
1524
+ stripeAccountId: string;
1525
+ stripePriceId: string;
1526
+ stripeProductId: string;
1527
+ } | undefined, {
1528
+ stripeAccountId: import("convex/values").VString<string, "required">;
1529
+ customerAccount: import("convex/values").VString<string, "required">;
1530
+ livemode: import("convex/values").VBoolean<boolean, "required">;
1531
+ purchaseId: import("convex/values").VString<string, "required">;
1532
+ creditGrantId: import("convex/values").VString<string, "required">;
1533
+ stripePriceId: import("convex/values").VString<string, "required">;
1534
+ stripeProductId: import("convex/values").VString<string, "required">;
1535
+ }, "optional", "creditGrantId" | "customerAccount" | "livemode" | "purchaseId" | "stripeAccountId" | "stripePriceId" | "stripeProductId">;
1199
1536
  gross: import("convex/values").VFloat64<number, "required">;
1200
1537
  currency: import("convex/values").VString<string, "required">;
1201
1538
  processingFee: import("convex/values").VFloat64<number, "required">;
@@ -1215,10 +1552,10 @@ export declare function setup(amounts?: number[]): Promise<{
1215
1552
  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>;
1216
1553
  amount: import("convex/values").VFloat64<number, "required">;
1217
1554
  }, "required", "amount" | "destinationAccountId" | "role">, "required">;
1218
- }, "optional", "adjustmentAmount" | "currency" | "gross" | "paymentId" | "paymentIntentId" | "platformNet" | "processingFee" | "sourceChargeId" | "sourceInvoiceId" | "transfers">;
1219
- }, "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">;
1555
+ }, "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">;
1556
+ }, "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">;
1220
1557
  operationId: import("convex/values").VId<import("convex/values").GenericId<"recoveryWorkflowOperations">, "required">;
1221
- }, "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">, {
1558
+ }, "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">, {
1222
1559
  by_key: ["requestKey", "_creationTime"];
1223
1560
  }, {}, {}>;
1224
1561
  balanceFundingPreparations: import("convex/server").TableDefinition<import("convex/values").VObject<{
@@ -3016,6 +3353,15 @@ export declare function setup(amounts?: number[]): Promise<{
3016
3353
  }, {}, {}>;
3017
3354
  settlementAllocations: import("convex/server").TableDefinition<import("convex/values").VObject<{
3018
3355
  adjustmentAmount?: number | undefined;
3356
+ creditSource?: {
3357
+ creditGrantId: string;
3358
+ customerAccount: string;
3359
+ livemode: boolean;
3360
+ purchaseId: string;
3361
+ stripeAccountId: string;
3362
+ stripePriceId: string;
3363
+ stripeProductId: string;
3364
+ } | undefined;
3019
3365
  currency: string;
3020
3366
  gross: number;
3021
3367
  paymentId?: string | undefined;
@@ -3029,10 +3375,77 @@ export declare function setup(amounts?: number[]): Promise<{
3029
3375
  destinationAccountId: string;
3030
3376
  role: "affiliate" | "other" | "store";
3031
3377
  }[];
3378
+ usageSource?: {
3379
+ customerAccount: string;
3380
+ invoicePaymentId: string;
3381
+ livemode: boolean;
3382
+ meterId: string;
3383
+ model: "included_overage" | "pay_as_you_go";
3384
+ period: {
3385
+ end: number;
3386
+ start: number;
3387
+ };
3388
+ stripeAccountId: string;
3389
+ stripePriceId: string;
3390
+ stripeProductId: string;
3391
+ subscriptionId: string;
3392
+ subscriptionItemId: string;
3393
+ } | undefined;
3032
3394
  }, {
3033
3395
  sourceChargeId: import("convex/values").VString<string, "required">;
3034
3396
  paymentIntentId: import("convex/values").VString<string | undefined, "optional">;
3035
3397
  sourceInvoiceId: import("convex/values").VString<string | undefined, "optional">;
3398
+ usageSource: import("convex/values").VObject<{
3399
+ customerAccount: string;
3400
+ invoicePaymentId: string;
3401
+ livemode: boolean;
3402
+ meterId: string;
3403
+ model: "included_overage" | "pay_as_you_go";
3404
+ period: {
3405
+ end: number;
3406
+ start: number;
3407
+ };
3408
+ stripeAccountId: string;
3409
+ stripePriceId: string;
3410
+ stripeProductId: string;
3411
+ subscriptionId: string;
3412
+ subscriptionItemId: string;
3413
+ } | undefined, {
3414
+ stripeAccountId: import("convex/values").VString<string, "required">;
3415
+ customerAccount: import("convex/values").VString<string, "required">;
3416
+ livemode: import("convex/values").VBoolean<boolean, "required">;
3417
+ meterId: import("convex/values").VString<string, "required">;
3418
+ stripePriceId: import("convex/values").VString<string, "required">;
3419
+ stripeProductId: import("convex/values").VString<string, "required">;
3420
+ subscriptionId: import("convex/values").VString<string, "required">;
3421
+ subscriptionItemId: import("convex/values").VString<string, "required">;
3422
+ invoicePaymentId: import("convex/values").VString<string, "required">;
3423
+ period: import("convex/values").VObject<{
3424
+ end: number;
3425
+ start: number;
3426
+ }, {
3427
+ start: import("convex/values").VFloat64<number, "required">;
3428
+ end: import("convex/values").VFloat64<number, "required">;
3429
+ }, "required", "end" | "start">;
3430
+ 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>;
3431
+ }, "optional", "customerAccount" | "invoicePaymentId" | "livemode" | "meterId" | "model" | "period" | "period.end" | "period.start" | "stripeAccountId" | "stripePriceId" | "stripeProductId" | "subscriptionId" | "subscriptionItemId">;
3432
+ creditSource: import("convex/values").VObject<{
3433
+ creditGrantId: string;
3434
+ customerAccount: string;
3435
+ livemode: boolean;
3436
+ purchaseId: string;
3437
+ stripeAccountId: string;
3438
+ stripePriceId: string;
3439
+ stripeProductId: string;
3440
+ } | undefined, {
3441
+ stripeAccountId: import("convex/values").VString<string, "required">;
3442
+ customerAccount: import("convex/values").VString<string, "required">;
3443
+ livemode: import("convex/values").VBoolean<boolean, "required">;
3444
+ purchaseId: import("convex/values").VString<string, "required">;
3445
+ creditGrantId: import("convex/values").VString<string, "required">;
3446
+ stripePriceId: import("convex/values").VString<string, "required">;
3447
+ stripeProductId: import("convex/values").VString<string, "required">;
3448
+ }, "optional", "creditGrantId" | "customerAccount" | "livemode" | "purchaseId" | "stripeAccountId" | "stripePriceId" | "stripeProductId">;
3036
3449
  gross: import("convex/values").VFloat64<number, "required">;
3037
3450
  currency: import("convex/values").VString<string, "required">;
3038
3451
  processingFee: import("convex/values").VFloat64<number, "required">;
@@ -3052,7 +3465,7 @@ export declare function setup(amounts?: number[]): Promise<{
3052
3465
  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>;
3053
3466
  amount: import("convex/values").VFloat64<number, "required">;
3054
3467
  }, "required", "amount" | "destinationAccountId" | "role">, "required">;
3055
- }, "required", "adjustmentAmount" | "currency" | "gross" | "paymentId" | "paymentIntentId" | "platformNet" | "processingFee" | "sourceChargeId" | "sourceInvoiceId" | "transfers">, {
3468
+ }, "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">, {
3056
3469
  by_source_charge: ["sourceChargeId", "_creationTime"];
3057
3470
  }, {}, {}>;
3058
3471
  commissionTerms: import("convex/server").TableDefinition<import("convex/values").VObject<{