@fantastic.dev/better-stripe 0.57.0 → 0.59.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 (230) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +3 -1
  3. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +356 -50
  4. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts.map +1 -1
  5. package/dist/client/connect/payoutExecutionTestHelpers.d.ts +162 -9
  6. package/dist/client/connect/payoutExecutionTestHelpers.d.ts.map +1 -1
  7. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +356 -50
  8. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts.map +1 -1
  9. package/dist/client/connect/payoutSyncTestHelpers.d.ts +162 -9
  10. package/dist/client/connect/payoutSyncTestHelpers.d.ts.map +1 -1
  11. package/dist/client/usage/allowanceClient.d.ts +51 -0
  12. package/dist/client/usage/allowanceClient.d.ts.map +1 -0
  13. package/dist/client/usage/allowanceClient.js +64 -0
  14. package/dist/client/usage/allowanceClient.js.map +1 -0
  15. package/dist/client/usage/allowanceTerms.d.ts +64 -0
  16. package/dist/client/usage/allowanceTerms.d.ts.map +1 -0
  17. package/dist/client/usage/allowanceTerms.js +101 -0
  18. package/dist/client/usage/allowanceTerms.js.map +1 -0
  19. package/dist/client/usage/client.d.ts +2 -2
  20. package/dist/client/usage/client.d.ts.map +1 -1
  21. package/dist/client/usage/client.js +2 -2
  22. package/dist/client/usage/client.js.map +1 -1
  23. package/dist/client/usage/correctionClient.d.ts +33 -0
  24. package/dist/client/usage/correctionClient.d.ts.map +1 -0
  25. package/dist/client/usage/correctionClient.js +27 -0
  26. package/dist/client/usage/correctionClient.js.map +1 -0
  27. package/dist/client/usage/correctionEligibility.d.ts +4 -0
  28. package/dist/client/usage/correctionEligibility.d.ts.map +1 -0
  29. package/dist/client/usage/correctionEligibility.js +7 -0
  30. package/dist/client/usage/correctionEligibility.js.map +1 -0
  31. package/dist/client/usage/correctionInvoice.d.ts +9 -0
  32. package/dist/client/usage/correctionInvoice.d.ts.map +1 -0
  33. package/dist/client/usage/correctionInvoice.js +218 -0
  34. package/dist/client/usage/correctionInvoice.js.map +1 -0
  35. package/dist/client/usage/correctionInvoiceProof.d.ts +29 -0
  36. package/dist/client/usage/correctionInvoiceProof.d.ts.map +1 -0
  37. package/dist/client/usage/correctionInvoiceProof.js +41 -0
  38. package/dist/client/usage/correctionInvoiceProof.js.map +1 -0
  39. package/dist/client/usage/correctionProofs.d.ts +36 -0
  40. package/dist/client/usage/correctionProofs.d.ts.map +1 -0
  41. package/dist/client/usage/correctionProofs.js +41 -0
  42. package/dist/client/usage/correctionProofs.js.map +1 -0
  43. package/dist/client/usage/correctionProvider.d.ts +6 -0
  44. package/dist/client/usage/correctionProvider.d.ts.map +1 -0
  45. package/dist/client/usage/correctionProvider.js +243 -0
  46. package/dist/client/usage/correctionProvider.js.map +1 -0
  47. package/dist/client/usage/correctionRead.d.ts +27 -0
  48. package/dist/client/usage/correctionRead.d.ts.map +1 -0
  49. package/dist/client/usage/correctionRead.js +36 -0
  50. package/dist/client/usage/correctionRead.js.map +1 -0
  51. package/dist/client/usage/correctionTerms.d.ts +64 -0
  52. package/dist/client/usage/correctionTerms.d.ts.map +1 -0
  53. package/dist/client/usage/correctionTerms.js +65 -0
  54. package/dist/client/usage/correctionTerms.js.map +1 -0
  55. package/dist/client/usage/correctionTransport.fixtures.d.ts +37 -0
  56. package/dist/client/usage/correctionTransport.fixtures.d.ts.map +1 -0
  57. package/dist/client/usage/correctionTransport.fixtures.js +322 -0
  58. package/dist/client/usage/correctionTransport.fixtures.js.map +1 -0
  59. package/dist/client/usage/creditClient.d.ts +1 -1
  60. package/dist/client/usage/index.d.ts +4 -0
  61. package/dist/client/usage/index.d.ts.map +1 -1
  62. package/dist/client/usage/observationClient.d.ts +20 -0
  63. package/dist/client/usage/observationClient.d.ts.map +1 -1
  64. package/dist/client/usage/observationClient.js +20 -6
  65. package/dist/client/usage/observationClient.js.map +1 -1
  66. package/dist/client/usage/records.d.ts +1 -1
  67. package/dist/client/usage/records.d.ts.map +1 -1
  68. package/dist/client/usage/records.js.map +1 -1
  69. package/dist/client/usage/summary.d.ts +3 -0
  70. package/dist/client/usage/summary.d.ts.map +1 -1
  71. package/dist/client/usage/summary.js +9 -4
  72. package/dist/client/usage/summary.js.map +1 -1
  73. package/dist/client/usageExports.d.ts +4 -0
  74. package/dist/client/usageExports.d.ts.map +1 -1
  75. package/dist/component/_generated/api.d.ts +20 -0
  76. package/dist/component/_generated/api.d.ts.map +1 -1
  77. package/dist/component/_generated/api.js.map +1 -1
  78. package/dist/component/_generated/component.d.ts +324 -13
  79. package/dist/component/_generated/component.d.ts.map +1 -1
  80. package/dist/component/accountClosure/mutations.d.ts.map +1 -1
  81. package/dist/component/accountClosure/mutations.js +13 -0
  82. package/dist/component/accountClosure/mutations.js.map +1 -1
  83. package/dist/component/balanceFunding/internal/actions.d.ts +11 -11
  84. package/dist/component/balanceFunding/mutations.d.ts +43 -43
  85. package/dist/component/balanceFunding/workflowValidators.d.ts +16 -16
  86. package/dist/component/earnings/triggers.d.ts +288 -10
  87. package/dist/component/earnings/triggers.d.ts.map +1 -1
  88. package/dist/component/schema.d.ts +162 -9
  89. package/dist/component/schema.js +7 -0
  90. package/dist/component/schema.js.map +1 -1
  91. package/dist/component/usage/mutations.d.ts.map +1 -1
  92. package/dist/component/usage/mutations.js +4 -0
  93. package/dist/component/usage/mutations.js.map +1 -1
  94. package/dist/component/usage/queries.d.ts +2 -2
  95. package/dist/component/usage/schema.d.ts +21 -15
  96. package/dist/component/usage/schema.d.ts.map +1 -1
  97. package/dist/component/usage/schema.js +4 -2
  98. package/dist/component/usage/schema.js.map +1 -1
  99. package/dist/component/usageAllowance/helpers.d.ts +78 -0
  100. package/dist/component/usageAllowance/helpers.d.ts.map +1 -0
  101. package/dist/component/usageAllowance/helpers.js +99 -0
  102. package/dist/component/usageAllowance/helpers.js.map +1 -0
  103. package/dist/component/usageAllowance/mutations.d.ts +37 -0
  104. package/dist/component/usageAllowance/mutations.d.ts.map +1 -0
  105. package/dist/component/usageAllowance/mutations.js +99 -0
  106. package/dist/component/usageAllowance/mutations.js.map +1 -0
  107. package/dist/component/usageAllowance/queries.d.ts +36 -0
  108. package/dist/component/usageAllowance/queries.d.ts.map +1 -0
  109. package/dist/component/usageAllowance/queries.js +122 -0
  110. package/dist/component/usageAllowance/queries.js.map +1 -0
  111. package/dist/component/usageAllowance/reservations.d.ts +25 -0
  112. package/dist/component/usageAllowance/reservations.d.ts.map +1 -0
  113. package/dist/component/usageAllowance/reservations.js +150 -0
  114. package/dist/component/usageAllowance/reservations.js.map +1 -0
  115. package/dist/component/usageAllowance/schema.d.ts +77 -0
  116. package/dist/component/usageAllowance/schema.d.ts.map +1 -0
  117. package/dist/component/usageAllowance/schema.js +32 -0
  118. package/dist/component/usageAllowance/schema.js.map +1 -0
  119. package/dist/component/usageCorrections/accounting.d.ts +5 -0
  120. package/dist/component/usageCorrections/accounting.d.ts.map +1 -0
  121. package/dist/component/usageCorrections/accounting.js +55 -0
  122. package/dist/component/usageCorrections/accounting.js.map +1 -0
  123. package/dist/component/usageCorrections/cancellation.d.ts +6 -0
  124. package/dist/component/usageCorrections/cancellation.d.ts.map +1 -0
  125. package/dist/component/usageCorrections/cancellation.js +29 -0
  126. package/dist/component/usageCorrections/cancellation.js.map +1 -0
  127. package/dist/component/usageCorrections/helpers.d.ts +60 -0
  128. package/dist/component/usageCorrections/helpers.d.ts.map +1 -0
  129. package/dist/component/usageCorrections/helpers.js +52 -0
  130. package/dist/component/usageCorrections/helpers.js.map +1 -0
  131. package/dist/component/usageCorrections/invoice.d.ts +38 -0
  132. package/dist/component/usageCorrections/invoice.d.ts.map +1 -0
  133. package/dist/component/usageCorrections/invoice.js +82 -0
  134. package/dist/component/usageCorrections/invoice.js.map +1 -0
  135. package/dist/component/usageCorrections/mutations.d.ts +121 -0
  136. package/dist/component/usageCorrections/mutations.d.ts.map +1 -0
  137. package/dist/component/usageCorrections/mutations.js +256 -0
  138. package/dist/component/usageCorrections/mutations.js.map +1 -0
  139. package/dist/component/usageCorrections/queries.d.ts +115 -0
  140. package/dist/component/usageCorrections/queries.d.ts.map +1 -0
  141. package/dist/component/usageCorrections/queries.js +84 -0
  142. package/dist/component/usageCorrections/queries.js.map +1 -0
  143. package/dist/component/usageCorrections/schema.d.ts +248 -0
  144. package/dist/component/usageCorrections/schema.d.ts.map +1 -0
  145. package/dist/component/usageCorrections/schema.js +74 -0
  146. package/dist/component/usageCorrections/schema.js.map +1 -0
  147. package/dist/component/usageCredits/queries.d.ts +1 -1
  148. package/dist/component/usageCredits/queries.d.ts.map +1 -1
  149. package/dist/component/usageCredits/queries.js +6 -0
  150. package/dist/component/usageCredits/queries.js.map +1 -1
  151. package/dist/component/usageCredits/schema.d.ts +5 -5
  152. package/dist/component/usageCredits/schema.d.ts.map +1 -1
  153. package/dist/component/usageCredits/schema.js +1 -1
  154. package/dist/component/usageCredits/schema.js.map +1 -1
  155. package/dist/component/usageDelivery/fields.d.ts +2 -2
  156. package/dist/component/usageDelivery/fields.d.ts.map +1 -1
  157. package/dist/component/usageDelivery/fields.js +1 -1
  158. package/dist/component/usageDelivery/fields.js.map +1 -1
  159. package/dist/component/usageDelivery/helpers.d.ts +7 -6
  160. package/dist/component/usageDelivery/helpers.d.ts.map +1 -1
  161. package/dist/component/usageDelivery/mutations.d.ts +6 -6
  162. package/dist/component/usageDelivery/mutations.d.ts.map +1 -1
  163. package/dist/component/usageDelivery/mutations.js +9 -1
  164. package/dist/component/usageDelivery/mutations.js.map +1 -1
  165. package/dist/component/usageDelivery/queries.d.ts +8 -6
  166. package/dist/component/usageDelivery/queries.d.ts.map +1 -1
  167. package/dist/component/usageDelivery/schema.d.ts +4 -4
  168. package/dist/component/usageDelivery/steps.d.ts +2 -2
  169. package/dist/component/usageDelivery/steps.js +1 -1
  170. package/dist/component/usageDelivery/steps.js.map +1 -1
  171. package/dist/component/usageObservations/queries.d.ts.map +1 -1
  172. package/dist/component/usageObservations/queries.js +4 -2
  173. package/dist/component/usageObservations/queries.js.map +1 -1
  174. package/dist/component/usageSubscriptions/retirement.d.ts.map +1 -1
  175. package/dist/component/usageSubscriptions/retirement.js +24 -2
  176. package/dist/component/usageSubscriptions/retirement.js.map +1 -1
  177. package/docs/README.md +4 -0
  178. package/docs/usage-corrections.md +249 -0
  179. package/docs/usage-limits.md +217 -0
  180. package/package.json +3 -1
  181. package/src/client/usage/allowanceClient.test.ts +93 -0
  182. package/src/client/usage/allowanceClient.ts +134 -0
  183. package/src/client/usage/allowanceTerms.test.ts +131 -0
  184. package/src/client/usage/allowanceTerms.ts +172 -0
  185. package/src/client/usage/client.ts +2 -2
  186. package/src/client/usage/correctionClient.test.ts +153 -0
  187. package/src/client/usage/correctionClient.ts +62 -0
  188. package/src/client/usage/correctionCredits.test.ts +156 -0
  189. package/src/client/usage/correctionEligibility.ts +14 -0
  190. package/src/client/usage/correctionInvoice.test.ts +127 -0
  191. package/src/client/usage/correctionInvoice.ts +269 -0
  192. package/src/client/usage/correctionInvoiceProof.ts +40 -0
  193. package/src/client/usage/correctionProofs.ts +40 -0
  194. package/src/client/usage/correctionProvider.ts +326 -0
  195. package/src/client/usage/correctionRead.ts +73 -0
  196. package/src/client/usage/correctionRecovery.test.ts +113 -0
  197. package/src/client/usage/correctionTerms.ts +98 -0
  198. package/src/client/usage/correctionTransport.fixtures.ts +372 -0
  199. package/src/client/usage/index.ts +19 -0
  200. package/src/client/usage/observationClient.ts +20 -6
  201. package/src/client/usage/records.ts +7 -1
  202. package/src/client/usage/summary.ts +12 -4
  203. package/src/client/usageExports.ts +19 -0
  204. package/src/component/_generated/api.ts +20 -0
  205. package/src/component/_generated/component.ts +423 -1
  206. package/src/component/accountClosure/mutations.ts +17 -0
  207. package/src/component/schema.ts +14 -0
  208. package/src/component/usage/allowance.test.ts +435 -0
  209. package/src/component/usage/mutations.ts +13 -0
  210. package/src/component/usage/schema.ts +6 -1
  211. package/src/component/usageAllowance/helpers.ts +137 -0
  212. package/src/component/usageAllowance/mutations.ts +139 -0
  213. package/src/component/usageAllowance/queries.ts +140 -0
  214. package/src/component/usageAllowance/reservations.ts +220 -0
  215. package/src/component/usageAllowance/schema.ts +37 -0
  216. package/src/component/usageCorrections/accounting.ts +79 -0
  217. package/src/component/usageCorrections/cancellation.ts +32 -0
  218. package/src/component/usageCorrections/corrections.test.ts +389 -0
  219. package/src/component/usageCorrections/helpers.ts +57 -0
  220. package/src/component/usageCorrections/invoice.ts +103 -0
  221. package/src/component/usageCorrections/mutations.ts +278 -0
  222. package/src/component/usageCorrections/queries.ts +94 -0
  223. package/src/component/usageCorrections/schema.ts +90 -0
  224. package/src/component/usageCredits/queries.ts +4 -0
  225. package/src/component/usageCredits/schema.ts +1 -0
  226. package/src/component/usageDelivery/fields.ts +1 -0
  227. package/src/component/usageDelivery/mutations.ts +8 -3
  228. package/src/component/usageDelivery/steps.ts +1 -1
  229. package/src/component/usageObservations/queries.ts +5 -2
  230. package/src/component/usageSubscriptions/retirement.ts +31 -2
@@ -1,5 +1,155 @@
1
1
  export declare function large(count?: number, amount?: number): Promise<{
2
2
  t: import("convex-test").TestConvex<import("convex/server").SchemaDefinition<{
3
+ usageCorrectionClaims: import("convex/server").TableDefinition<import("convex/values").VObject<{
4
+ key: string;
5
+ operationKey: string;
6
+ proofJson: string;
7
+ }, {
8
+ key: import("convex/values").VString<string, "required">;
9
+ operationKey: import("convex/values").VString<string, "required">;
10
+ proofJson: import("convex/values").VString<string, "required">;
11
+ }, "required", "key" | "operationKey" | "proofJson">, {
12
+ by_key: ["key", "_creationTime"];
13
+ }, {}, {}>;
14
+ usageCorrections: import("convex/server").TableDefinition<import("convex/values").VObject<{
15
+ adjustmentJson?: string | undefined;
16
+ attempt: number;
17
+ attemptedAt?: number | undefined;
18
+ cashConsequence: "none" | "operator_resolution_required" | "verified_external_adjustment";
19
+ correctionId: string;
20
+ creditNoteId?: string | undefined;
21
+ customerAccount?: string | undefined;
22
+ eventId: import("convex/values").GenericId<"usageEvents">;
23
+ firstAttemptAt: number;
24
+ historyCount: number;
25
+ inputJson: string;
26
+ invoiceId?: string | undefined;
27
+ key: string;
28
+ leaseUntil?: number | undefined;
29
+ nativeAdjustmentId?: string | undefined;
30
+ nativeCreditNoteStatus?: "issued" | "void" | undefined;
31
+ nativeStatus?: "complete" | "pending" | undefined;
32
+ observedAt?: number | undefined;
33
+ quantity: string;
34
+ reason: string;
35
+ recordJson: string;
36
+ refundId?: string | undefined;
37
+ resolution?: "event_cancellation" | "invoice_credit" | undefined;
38
+ restoredQuantity: string;
39
+ scaledQuantity: string;
40
+ scopeKey: string;
41
+ state: "confirmed" | "held" | "invoice_adjustment_required" | "provider_accepted" | "requested" | "unsupported";
42
+ stripeAccountId?: string | undefined;
43
+ subscriptionJson: string;
44
+ }, {
45
+ stripeAccountId: import("convex/values").VString<string | undefined, "optional">;
46
+ customerAccount: import("convex/values").VString<string | undefined, "optional">;
47
+ observedAt: import("convex/values").VFloat64<number | undefined, "optional">;
48
+ nativeCreditNoteStatus: import("convex/values").VUnion<"issued" | "void" | undefined, [import("convex/values").VLiteral<"issued", "required">, import("convex/values").VLiteral<"void", "required">], "optional", never>;
49
+ 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>;
50
+ adjustmentJson: import("convex/values").VString<string | undefined, "optional">;
51
+ key: import("convex/values").VString<string, "required">;
52
+ scopeKey: import("convex/values").VString<string, "required">;
53
+ eventId: import("convex/values").VId<import("convex/values").GenericId<"usageEvents">, "required">;
54
+ correctionId: import("convex/values").VString<string, "required">;
55
+ inputJson: import("convex/values").VString<string, "required">;
56
+ recordJson: import("convex/values").VString<string, "required">;
57
+ subscriptionJson: import("convex/values").VString<string, "required">;
58
+ quantity: import("convex/values").VString<string, "required">;
59
+ scaledQuantity: import("convex/values").VString<string, "required">;
60
+ 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>;
61
+ reason: import("convex/values").VString<string, "required">;
62
+ firstAttemptAt: import("convex/values").VFloat64<number, "required">;
63
+ attemptedAt: import("convex/values").VFloat64<number | undefined, "optional">;
64
+ leaseUntil: import("convex/values").VFloat64<number | undefined, "optional">;
65
+ attempt: import("convex/values").VFloat64<number, "required">;
66
+ nativeAdjustmentId: import("convex/values").VString<string | undefined, "optional">;
67
+ nativeStatus: import("convex/values").VUnion<"complete" | "pending" | undefined, [import("convex/values").VLiteral<"pending", "required">, import("convex/values").VLiteral<"complete", "required">], "optional", never>;
68
+ invoiceId: import("convex/values").VString<string | undefined, "optional">;
69
+ creditNoteId: import("convex/values").VString<string | undefined, "optional">;
70
+ refundId: import("convex/values").VString<string | undefined, "optional">;
71
+ 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>;
72
+ restoredQuantity: import("convex/values").VString<string, "required">;
73
+ historyCount: import("convex/values").VFloat64<number, "required">;
74
+ }, "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">, {
75
+ by_event: ["eventId", "_creationTime"];
76
+ by_key: ["key", "_creationTime"];
77
+ by_payer_state: ["customerAccount", "state", "_creationTime"];
78
+ by_realm_state: ["stripeAccountId", "state", "_creationTime"];
79
+ by_scope: ["scopeKey", "_creationTime"];
80
+ by_scope_state: ["scopeKey", "state", "_creationTime"];
81
+ }, {}, {}>;
82
+ usageCorrectionHistory: import("convex/server").TableDefinition<import("convex/values").VObject<{
83
+ at: number;
84
+ eventId: import("convex/values").GenericId<"usageEvents">;
85
+ evidenceJson: string;
86
+ key: string;
87
+ occurredAt?: number | undefined;
88
+ reason: string;
89
+ recordJson: string;
90
+ scopeKey: string;
91
+ sequence: number;
92
+ state: "confirmed" | "held" | "invoice_adjustment_required" | "provider_accepted" | "requested" | "unsupported";
93
+ subscriptionJson: string;
94
+ }, {
95
+ key: import("convex/values").VString<string, "required">;
96
+ scopeKey: import("convex/values").VString<string, "required">;
97
+ eventId: import("convex/values").VId<import("convex/values").GenericId<"usageEvents">, "required">;
98
+ sequence: import("convex/values").VFloat64<number, "required">;
99
+ 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>;
100
+ reason: import("convex/values").VString<string, "required">;
101
+ recordJson: import("convex/values").VString<string, "required">;
102
+ subscriptionJson: import("convex/values").VString<string, "required">;
103
+ evidenceJson: import("convex/values").VString<string, "required">;
104
+ occurredAt: import("convex/values").VFloat64<number | undefined, "optional">;
105
+ at: import("convex/values").VFloat64<number, "required">;
106
+ }, "required", "at" | "eventId" | "evidenceJson" | "key" | "occurredAt" | "reason" | "recordJson" | "scopeKey" | "sequence" | "state" | "subscriptionJson">, {
107
+ by_event: ["eventId", "_creationTime"];
108
+ by_scope_occurrence: ["scopeKey", "occurredAt", "_creationTime"];
109
+ by_scope_time: ["scopeKey", "at", "_creationTime"];
110
+ }, {}, {}>;
111
+ usageAllowancePolicies: import("convex/server").TableDefinition<import("convex/values").VObject<{
112
+ bindingJson: string;
113
+ consumed: string;
114
+ end: number;
115
+ historyCount: number;
116
+ key: string;
117
+ nativeKey: string;
118
+ policyJson: string;
119
+ reserved: string;
120
+ revision: number;
121
+ scopeKey: string;
122
+ start: number;
123
+ }, {
124
+ key: import("convex/values").VString<string, "required">;
125
+ nativeKey: import("convex/values").VString<string, "required">;
126
+ scopeKey: import("convex/values").VString<string, "required">;
127
+ bindingJson: import("convex/values").VString<string, "required">;
128
+ start: import("convex/values").VFloat64<number, "required">;
129
+ end: import("convex/values").VFloat64<number, "required">;
130
+ policyJson: import("convex/values").VString<string, "required">;
131
+ revision: import("convex/values").VFloat64<number, "required">;
132
+ consumed: import("convex/values").VString<string, "required">;
133
+ reserved: import("convex/values").VString<string, "required">;
134
+ historyCount: import("convex/values").VFloat64<number, "required">;
135
+ }, "required", "bindingJson" | "consumed" | "end" | "historyCount" | "key" | "nativeKey" | "policyJson" | "reserved" | "revision" | "scopeKey" | "start">, {
136
+ by_key: ["key", "_creationTime"];
137
+ by_native_start: ["nativeKey", "start", "_creationTime"];
138
+ by_scope_start: ["scopeKey", "start", "_creationTime"];
139
+ }, {}, {}>;
140
+ usageAllowanceHistory: import("convex/server").TableDefinition<import("convex/values").VObject<{
141
+ at: number;
142
+ evidenceJson: string;
143
+ key: string;
144
+ kind: "commit" | "correction" | "policy" | "release" | "reservation";
145
+ }, {
146
+ key: import("convex/values").VString<string, "required">;
147
+ 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>;
148
+ evidenceJson: import("convex/values").VString<string, "required">;
149
+ at: import("convex/values").VFloat64<number, "required">;
150
+ }, "required", "at" | "evidenceJson" | "key" | "kind">, {
151
+ by_key: ["key", "_creationTime"];
152
+ }, {}, {}>;
3
153
  usageSubscriptionControls: import("convex/server").TableDefinition<import("convex/values").VObject<{
4
154
  cancelAtPeriodEnd: boolean;
5
155
  firstAttemptAt: number;
@@ -201,6 +351,7 @@ export declare function large(count?: number, amount?: number): Promise<{
201
351
  }, {}, {}>;
202
352
  usageOutbox: import("convex/server").TableDefinition<import("convex/values").VObject<{
203
353
  attempts: number;
354
+ correctionKey?: string | undefined;
204
355
  definitionVersion?: 1 | undefined;
205
356
  dispatch?: string | undefined;
206
357
  eventId: import("convex/values").GenericId<"usageEvents">;
@@ -211,13 +362,13 @@ export declare function large(count?: number, amount?: number): Promise<{
211
362
  nextAttemptAt: number;
212
363
  provider?: string | undefined;
213
364
  providerIdentifier: string;
214
- reason?: "administrative_hold" | "billing_period_closed" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined;
365
+ 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;
215
366
  receipt?: {
216
367
  created: number;
217
368
  identifier: string;
218
369
  } | undefined;
219
370
  scopeKey: string;
220
- state: "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
371
+ state: "canceled" | "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
221
372
  workflowId?: string | undefined;
222
373
  }, {
223
374
  historySequence: import("convex/values").VFloat64<number | undefined, "optional">;
@@ -227,7 +378,7 @@ export declare function large(count?: number, amount?: number): Promise<{
227
378
  firstSendAt: import("convex/values").VFloat64<number | undefined, "optional">;
228
379
  leaseUntil: import("convex/values").VFloat64<number | undefined, "optional">;
229
380
  held: import("convex/values").VBoolean<boolean | undefined, "optional">;
230
- 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>;
381
+ 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>;
231
382
  receipt: import("convex/values").VObject<{
232
383
  created: number;
233
384
  identifier: string;
@@ -235,14 +386,15 @@ export declare function large(count?: number, amount?: number): Promise<{
235
386
  identifier: import("convex/values").VString<string, "required">;
236
387
  created: import("convex/values").VFloat64<number, "required">;
237
388
  }, "optional", "created" | "identifier">;
389
+ correctionKey: import("convex/values").VString<string | undefined, "optional">;
238
390
  eventId: import("convex/values").VId<import("convex/values").GenericId<"usageEvents">, "required">;
239
391
  scopeKey: import("convex/values").VString<string, "required">;
240
- 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>;
392
+ 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>;
241
393
  attempts: import("convex/values").VFloat64<number, "required">;
242
394
  nextAttemptAt: import("convex/values").VFloat64<number, "required">;
243
395
  providerIdentifier: import("convex/values").VString<string, "required">;
244
396
  dispatch: import("convex/values").VString<string | undefined, "optional">;
245
- }, "required", "attempts" | "definitionVersion" | "dispatch" | "eventId" | "firstSendAt" | "held" | "historySequence" | "leaseUntil" | "nextAttemptAt" | "provider" | "providerIdentifier" | "reason" | "receipt" | "receipt.created" | "receipt.identifier" | "scopeKey" | "state" | "workflowId">, {
397
+ }, "required", "attempts" | "correctionKey" | "definitionVersion" | "dispatch" | "eventId" | "firstSendAt" | "held" | "historySequence" | "leaseUntil" | "nextAttemptAt" | "provider" | "providerIdentifier" | "reason" | "receipt" | "receipt.created" | "receipt.identifier" | "scopeKey" | "state" | "workflowId">, {
246
398
  by_event: ["eventId", "_creationTime"];
247
399
  by_provider_identifier: ["providerIdentifier", "_creationTime"];
248
400
  by_scope_state: ["scopeKey", "state", "_creationTime"];
@@ -259,7 +411,7 @@ export declare function large(count?: number, amount?: number): Promise<{
259
411
  }, {}, {}>;
260
412
  usageReservations: import("convex/server").TableDefinition<import("convex/values").VObject<{
261
413
  accountKey?: string | undefined;
262
- accountingKind?: "prepaid" | undefined;
414
+ accountingKind?: "allowance" | "prepaid" | undefined;
263
415
  allocationsJson?: string | undefined;
264
416
  eventId?: import("convex/values").GenericId<"usageEvents"> | undefined;
265
417
  inputJson?: string | undefined;
@@ -277,13 +429,14 @@ export declare function large(count?: number, amount?: number): Promise<{
277
429
  scaledQuantity: import("convex/values").VString<string, "required">;
278
430
  state: import("convex/values").VUnion<"committed" | "released" | "reserved", [import("convex/values").VLiteral<"reserved", "required">, import("convex/values").VLiteral<"committed", "required">, import("convex/values").VLiteral<"released", "required">], "required", never>;
279
431
  eventId: import("convex/values").VId<import("convex/values").GenericId<"usageEvents"> | undefined, "optional">;
280
- accountingKind: import("convex/values").VLiteral<"prepaid" | undefined, "optional">;
432
+ accountingKind: import("convex/values").VUnion<"allowance" | "prepaid" | undefined, [import("convex/values").VLiteral<"prepaid", "required">, import("convex/values").VLiteral<"allowance", "required">], "optional", never>;
281
433
  accountKey: import("convex/values").VString<string | undefined, "optional">;
282
434
  inputJson: import("convex/values").VString<string | undefined, "optional">;
283
435
  subscriptionJson: import("convex/values").VString<string | undefined, "optional">;
284
436
  allocationsJson: import("convex/values").VString<string | undefined, "optional">;
285
437
  releaseReason: import("convex/values").VString<string | undefined, "optional">;
286
438
  }, "required", "accountKey" | "accountingKind" | "allocationsJson" | "eventId" | "inputJson" | "planJson" | "releaseReason" | "scaledQuantity" | "scopeKey" | "sourceEventId" | "state" | "subscriptionJson">, {
439
+ by_account_state: ["accountKey", "state", "_creationTime"];
287
440
  by_scope_source: ["scopeKey", "sourceEventId", "_creationTime"];
288
441
  by_scope_state: ["scopeKey", "state", "_creationTime"];
289
442
  }, {}, {}>;
@@ -397,13 +550,13 @@ export declare function large(count?: number, amount?: number): Promise<{
397
550
  at: number;
398
551
  evidenceJson: string;
399
552
  fingerprint: string;
400
- kind: "closure" | "commit" | "grant" | "observation" | "payment" | "purchase" | "recovery" | "release" | "reservation";
553
+ kind: "closure" | "commit" | "correction" | "grant" | "observation" | "payment" | "purchase" | "recovery" | "release" | "reservation";
401
554
  purchaseKey?: string | undefined;
402
555
  sourceKey: string;
403
556
  }, {
404
557
  accountKey: import("convex/values").VString<string, "required">;
405
558
  purchaseKey: import("convex/values").VString<string | undefined, "optional">;
406
- 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>;
559
+ 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>;
407
560
  sourceKey: import("convex/values").VString<string, "required">;
408
561
  fingerprint: import("convex/values").VString<string, "required">;
409
562
  evidenceJson: import("convex/values").VString<string, "required">;
@@ -1473,14 +1626,6 @@ export declare function large(count?: number, amount?: number): Promise<{
1473
1626
  preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
1474
1627
  requestKey: string;
1475
1628
  result?: {
1476
- reason: "identity_changed" | "revision_changed" | "scope_busy";
1477
- retryable: false;
1478
- status: "conflict";
1479
- } | {
1480
- reason: "policy_invalid";
1481
- retryable: false;
1482
- status: "rejected";
1483
- } | {
1484
1629
  operation: {
1485
1630
  accountId: string;
1486
1631
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -1491,6 +1636,14 @@ export declare function large(count?: number, amount?: number): Promise<{
1491
1636
  } | {
1492
1637
  enabled: boolean;
1493
1638
  status: "unchanged";
1639
+ } | {
1640
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
1641
+ retryable: false;
1642
+ status: "conflict";
1643
+ } | {
1644
+ reason: "policy_invalid";
1645
+ retryable: false;
1646
+ status: "rejected";
1494
1647
  } | {
1495
1648
  reason: "provider_pending";
1496
1649
  retryable: true;
@@ -1501,14 +1654,6 @@ export declare function large(count?: number, amount?: number): Promise<{
1501
1654
  payload: import("convex/values").VString<string, "required">;
1502
1655
  preparationId: import("convex/values").VId<import("convex/values").GenericId<"balanceFundingPreparations">, "required">;
1503
1656
  result: import("convex/values").VUnion<{
1504
- reason: "identity_changed" | "revision_changed" | "scope_busy";
1505
- retryable: false;
1506
- status: "conflict";
1507
- } | {
1508
- reason: "policy_invalid";
1509
- retryable: false;
1510
- status: "rejected";
1511
- } | {
1512
1657
  operation: {
1513
1658
  accountId: string;
1514
1659
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -1519,6 +1664,14 @@ export declare function large(count?: number, amount?: number): Promise<{
1519
1664
  } | {
1520
1665
  enabled: boolean;
1521
1666
  status: "unchanged";
1667
+ } | {
1668
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
1669
+ retryable: false;
1670
+ status: "conflict";
1671
+ } | {
1672
+ reason: "policy_invalid";
1673
+ retryable: false;
1674
+ status: "rejected";
1522
1675
  } | {
1523
1676
  reason: "provider_pending";
1524
1677
  retryable: true;
@@ -3821,6 +3974,156 @@ export declare function large(count?: number, amount?: number): Promise<{
3821
3974
  export declare function withHistory(count?: number, amount?: number): Promise<{
3822
3975
  s: {
3823
3976
  t: import("convex-test").TestConvex<import("convex/server").SchemaDefinition<{
3977
+ usageCorrectionClaims: import("convex/server").TableDefinition<import("convex/values").VObject<{
3978
+ key: string;
3979
+ operationKey: string;
3980
+ proofJson: string;
3981
+ }, {
3982
+ key: import("convex/values").VString<string, "required">;
3983
+ operationKey: import("convex/values").VString<string, "required">;
3984
+ proofJson: import("convex/values").VString<string, "required">;
3985
+ }, "required", "key" | "operationKey" | "proofJson">, {
3986
+ by_key: ["key", "_creationTime"];
3987
+ }, {}, {}>;
3988
+ usageCorrections: import("convex/server").TableDefinition<import("convex/values").VObject<{
3989
+ adjustmentJson?: string | undefined;
3990
+ attempt: number;
3991
+ attemptedAt?: number | undefined;
3992
+ cashConsequence: "none" | "operator_resolution_required" | "verified_external_adjustment";
3993
+ correctionId: string;
3994
+ creditNoteId?: string | undefined;
3995
+ customerAccount?: string | undefined;
3996
+ eventId: import("convex/values").GenericId<"usageEvents">;
3997
+ firstAttemptAt: number;
3998
+ historyCount: number;
3999
+ inputJson: string;
4000
+ invoiceId?: string | undefined;
4001
+ key: string;
4002
+ leaseUntil?: number | undefined;
4003
+ nativeAdjustmentId?: string | undefined;
4004
+ nativeCreditNoteStatus?: "issued" | "void" | undefined;
4005
+ nativeStatus?: "complete" | "pending" | undefined;
4006
+ observedAt?: number | undefined;
4007
+ quantity: string;
4008
+ reason: string;
4009
+ recordJson: string;
4010
+ refundId?: string | undefined;
4011
+ resolution?: "event_cancellation" | "invoice_credit" | undefined;
4012
+ restoredQuantity: string;
4013
+ scaledQuantity: string;
4014
+ scopeKey: string;
4015
+ state: "confirmed" | "held" | "invoice_adjustment_required" | "provider_accepted" | "requested" | "unsupported";
4016
+ stripeAccountId?: string | undefined;
4017
+ subscriptionJson: string;
4018
+ }, {
4019
+ stripeAccountId: import("convex/values").VString<string | undefined, "optional">;
4020
+ customerAccount: import("convex/values").VString<string | undefined, "optional">;
4021
+ observedAt: import("convex/values").VFloat64<number | undefined, "optional">;
4022
+ nativeCreditNoteStatus: import("convex/values").VUnion<"issued" | "void" | undefined, [import("convex/values").VLiteral<"issued", "required">, import("convex/values").VLiteral<"void", "required">], "optional", never>;
4023
+ 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>;
4024
+ adjustmentJson: import("convex/values").VString<string | undefined, "optional">;
4025
+ key: import("convex/values").VString<string, "required">;
4026
+ scopeKey: import("convex/values").VString<string, "required">;
4027
+ eventId: import("convex/values").VId<import("convex/values").GenericId<"usageEvents">, "required">;
4028
+ correctionId: import("convex/values").VString<string, "required">;
4029
+ inputJson: import("convex/values").VString<string, "required">;
4030
+ recordJson: import("convex/values").VString<string, "required">;
4031
+ subscriptionJson: import("convex/values").VString<string, "required">;
4032
+ quantity: import("convex/values").VString<string, "required">;
4033
+ scaledQuantity: import("convex/values").VString<string, "required">;
4034
+ 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>;
4035
+ reason: import("convex/values").VString<string, "required">;
4036
+ firstAttemptAt: import("convex/values").VFloat64<number, "required">;
4037
+ attemptedAt: import("convex/values").VFloat64<number | undefined, "optional">;
4038
+ leaseUntil: import("convex/values").VFloat64<number | undefined, "optional">;
4039
+ attempt: import("convex/values").VFloat64<number, "required">;
4040
+ nativeAdjustmentId: import("convex/values").VString<string | undefined, "optional">;
4041
+ nativeStatus: import("convex/values").VUnion<"complete" | "pending" | undefined, [import("convex/values").VLiteral<"pending", "required">, import("convex/values").VLiteral<"complete", "required">], "optional", never>;
4042
+ invoiceId: import("convex/values").VString<string | undefined, "optional">;
4043
+ creditNoteId: import("convex/values").VString<string | undefined, "optional">;
4044
+ refundId: import("convex/values").VString<string | undefined, "optional">;
4045
+ 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>;
4046
+ restoredQuantity: import("convex/values").VString<string, "required">;
4047
+ historyCount: import("convex/values").VFloat64<number, "required">;
4048
+ }, "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">, {
4049
+ by_event: ["eventId", "_creationTime"];
4050
+ by_key: ["key", "_creationTime"];
4051
+ by_payer_state: ["customerAccount", "state", "_creationTime"];
4052
+ by_realm_state: ["stripeAccountId", "state", "_creationTime"];
4053
+ by_scope: ["scopeKey", "_creationTime"];
4054
+ by_scope_state: ["scopeKey", "state", "_creationTime"];
4055
+ }, {}, {}>;
4056
+ usageCorrectionHistory: import("convex/server").TableDefinition<import("convex/values").VObject<{
4057
+ at: number;
4058
+ eventId: import("convex/values").GenericId<"usageEvents">;
4059
+ evidenceJson: string;
4060
+ key: string;
4061
+ occurredAt?: number | undefined;
4062
+ reason: string;
4063
+ recordJson: string;
4064
+ scopeKey: string;
4065
+ sequence: number;
4066
+ state: "confirmed" | "held" | "invoice_adjustment_required" | "provider_accepted" | "requested" | "unsupported";
4067
+ subscriptionJson: string;
4068
+ }, {
4069
+ key: import("convex/values").VString<string, "required">;
4070
+ scopeKey: import("convex/values").VString<string, "required">;
4071
+ eventId: import("convex/values").VId<import("convex/values").GenericId<"usageEvents">, "required">;
4072
+ sequence: import("convex/values").VFloat64<number, "required">;
4073
+ 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>;
4074
+ reason: import("convex/values").VString<string, "required">;
4075
+ recordJson: import("convex/values").VString<string, "required">;
4076
+ subscriptionJson: import("convex/values").VString<string, "required">;
4077
+ evidenceJson: import("convex/values").VString<string, "required">;
4078
+ occurredAt: import("convex/values").VFloat64<number | undefined, "optional">;
4079
+ at: import("convex/values").VFloat64<number, "required">;
4080
+ }, "required", "at" | "eventId" | "evidenceJson" | "key" | "occurredAt" | "reason" | "recordJson" | "scopeKey" | "sequence" | "state" | "subscriptionJson">, {
4081
+ by_event: ["eventId", "_creationTime"];
4082
+ by_scope_occurrence: ["scopeKey", "occurredAt", "_creationTime"];
4083
+ by_scope_time: ["scopeKey", "at", "_creationTime"];
4084
+ }, {}, {}>;
4085
+ usageAllowancePolicies: import("convex/server").TableDefinition<import("convex/values").VObject<{
4086
+ bindingJson: string;
4087
+ consumed: string;
4088
+ end: number;
4089
+ historyCount: number;
4090
+ key: string;
4091
+ nativeKey: string;
4092
+ policyJson: string;
4093
+ reserved: string;
4094
+ revision: number;
4095
+ scopeKey: string;
4096
+ start: number;
4097
+ }, {
4098
+ key: import("convex/values").VString<string, "required">;
4099
+ nativeKey: import("convex/values").VString<string, "required">;
4100
+ scopeKey: import("convex/values").VString<string, "required">;
4101
+ bindingJson: import("convex/values").VString<string, "required">;
4102
+ start: import("convex/values").VFloat64<number, "required">;
4103
+ end: import("convex/values").VFloat64<number, "required">;
4104
+ policyJson: import("convex/values").VString<string, "required">;
4105
+ revision: import("convex/values").VFloat64<number, "required">;
4106
+ consumed: import("convex/values").VString<string, "required">;
4107
+ reserved: import("convex/values").VString<string, "required">;
4108
+ historyCount: import("convex/values").VFloat64<number, "required">;
4109
+ }, "required", "bindingJson" | "consumed" | "end" | "historyCount" | "key" | "nativeKey" | "policyJson" | "reserved" | "revision" | "scopeKey" | "start">, {
4110
+ by_key: ["key", "_creationTime"];
4111
+ by_native_start: ["nativeKey", "start", "_creationTime"];
4112
+ by_scope_start: ["scopeKey", "start", "_creationTime"];
4113
+ }, {}, {}>;
4114
+ usageAllowanceHistory: import("convex/server").TableDefinition<import("convex/values").VObject<{
4115
+ at: number;
4116
+ evidenceJson: string;
4117
+ key: string;
4118
+ kind: "commit" | "correction" | "policy" | "release" | "reservation";
4119
+ }, {
4120
+ key: import("convex/values").VString<string, "required">;
4121
+ 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>;
4122
+ evidenceJson: import("convex/values").VString<string, "required">;
4123
+ at: import("convex/values").VFloat64<number, "required">;
4124
+ }, "required", "at" | "evidenceJson" | "key" | "kind">, {
4125
+ by_key: ["key", "_creationTime"];
4126
+ }, {}, {}>;
3824
4127
  usageSubscriptionControls: import("convex/server").TableDefinition<import("convex/values").VObject<{
3825
4128
  cancelAtPeriodEnd: boolean;
3826
4129
  firstAttemptAt: number;
@@ -4022,6 +4325,7 @@ export declare function withHistory(count?: number, amount?: number): Promise<{
4022
4325
  }, {}, {}>;
4023
4326
  usageOutbox: import("convex/server").TableDefinition<import("convex/values").VObject<{
4024
4327
  attempts: number;
4328
+ correctionKey?: string | undefined;
4025
4329
  definitionVersion?: 1 | undefined;
4026
4330
  dispatch?: string | undefined;
4027
4331
  eventId: import("convex/values").GenericId<"usageEvents">;
@@ -4032,13 +4336,13 @@ export declare function withHistory(count?: number, amount?: number): Promise<{
4032
4336
  nextAttemptAt: number;
4033
4337
  provider?: string | undefined;
4034
4338
  providerIdentifier: string;
4035
- reason?: "administrative_hold" | "billing_period_closed" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined;
4339
+ 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;
4036
4340
  receipt?: {
4037
4341
  created: number;
4038
4342
  identifier: string;
4039
4343
  } | undefined;
4040
4344
  scopeKey: string;
4041
- state: "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
4345
+ state: "canceled" | "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
4042
4346
  workflowId?: string | undefined;
4043
4347
  }, {
4044
4348
  historySequence: import("convex/values").VFloat64<number | undefined, "optional">;
@@ -4048,7 +4352,7 @@ export declare function withHistory(count?: number, amount?: number): Promise<{
4048
4352
  firstSendAt: import("convex/values").VFloat64<number | undefined, "optional">;
4049
4353
  leaseUntil: import("convex/values").VFloat64<number | undefined, "optional">;
4050
4354
  held: import("convex/values").VBoolean<boolean | undefined, "optional">;
4051
- 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>;
4355
+ 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>;
4052
4356
  receipt: import("convex/values").VObject<{
4053
4357
  created: number;
4054
4358
  identifier: string;
@@ -4056,14 +4360,15 @@ export declare function withHistory(count?: number, amount?: number): Promise<{
4056
4360
  identifier: import("convex/values").VString<string, "required">;
4057
4361
  created: import("convex/values").VFloat64<number, "required">;
4058
4362
  }, "optional", "created" | "identifier">;
4363
+ correctionKey: import("convex/values").VString<string | undefined, "optional">;
4059
4364
  eventId: import("convex/values").VId<import("convex/values").GenericId<"usageEvents">, "required">;
4060
4365
  scopeKey: import("convex/values").VString<string, "required">;
4061
- 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>;
4366
+ 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>;
4062
4367
  attempts: import("convex/values").VFloat64<number, "required">;
4063
4368
  nextAttemptAt: import("convex/values").VFloat64<number, "required">;
4064
4369
  providerIdentifier: import("convex/values").VString<string, "required">;
4065
4370
  dispatch: import("convex/values").VString<string | undefined, "optional">;
4066
- }, "required", "attempts" | "definitionVersion" | "dispatch" | "eventId" | "firstSendAt" | "held" | "historySequence" | "leaseUntil" | "nextAttemptAt" | "provider" | "providerIdentifier" | "reason" | "receipt" | "receipt.created" | "receipt.identifier" | "scopeKey" | "state" | "workflowId">, {
4371
+ }, "required", "attempts" | "correctionKey" | "definitionVersion" | "dispatch" | "eventId" | "firstSendAt" | "held" | "historySequence" | "leaseUntil" | "nextAttemptAt" | "provider" | "providerIdentifier" | "reason" | "receipt" | "receipt.created" | "receipt.identifier" | "scopeKey" | "state" | "workflowId">, {
4067
4372
  by_event: ["eventId", "_creationTime"];
4068
4373
  by_provider_identifier: ["providerIdentifier", "_creationTime"];
4069
4374
  by_scope_state: ["scopeKey", "state", "_creationTime"];
@@ -4080,7 +4385,7 @@ export declare function withHistory(count?: number, amount?: number): Promise<{
4080
4385
  }, {}, {}>;
4081
4386
  usageReservations: import("convex/server").TableDefinition<import("convex/values").VObject<{
4082
4387
  accountKey?: string | undefined;
4083
- accountingKind?: "prepaid" | undefined;
4388
+ accountingKind?: "allowance" | "prepaid" | undefined;
4084
4389
  allocationsJson?: string | undefined;
4085
4390
  eventId?: import("convex/values").GenericId<"usageEvents"> | undefined;
4086
4391
  inputJson?: string | undefined;
@@ -4098,13 +4403,14 @@ export declare function withHistory(count?: number, amount?: number): Promise<{
4098
4403
  scaledQuantity: import("convex/values").VString<string, "required">;
4099
4404
  state: import("convex/values").VUnion<"committed" | "released" | "reserved", [import("convex/values").VLiteral<"reserved", "required">, import("convex/values").VLiteral<"committed", "required">, import("convex/values").VLiteral<"released", "required">], "required", never>;
4100
4405
  eventId: import("convex/values").VId<import("convex/values").GenericId<"usageEvents"> | undefined, "optional">;
4101
- accountingKind: import("convex/values").VLiteral<"prepaid" | undefined, "optional">;
4406
+ accountingKind: import("convex/values").VUnion<"allowance" | "prepaid" | undefined, [import("convex/values").VLiteral<"prepaid", "required">, import("convex/values").VLiteral<"allowance", "required">], "optional", never>;
4102
4407
  accountKey: import("convex/values").VString<string | undefined, "optional">;
4103
4408
  inputJson: import("convex/values").VString<string | undefined, "optional">;
4104
4409
  subscriptionJson: import("convex/values").VString<string | undefined, "optional">;
4105
4410
  allocationsJson: import("convex/values").VString<string | undefined, "optional">;
4106
4411
  releaseReason: import("convex/values").VString<string | undefined, "optional">;
4107
4412
  }, "required", "accountKey" | "accountingKind" | "allocationsJson" | "eventId" | "inputJson" | "planJson" | "releaseReason" | "scaledQuantity" | "scopeKey" | "sourceEventId" | "state" | "subscriptionJson">, {
4413
+ by_account_state: ["accountKey", "state", "_creationTime"];
4108
4414
  by_scope_source: ["scopeKey", "sourceEventId", "_creationTime"];
4109
4415
  by_scope_state: ["scopeKey", "state", "_creationTime"];
4110
4416
  }, {}, {}>;
@@ -4218,13 +4524,13 @@ export declare function withHistory(count?: number, amount?: number): Promise<{
4218
4524
  at: number;
4219
4525
  evidenceJson: string;
4220
4526
  fingerprint: string;
4221
- kind: "closure" | "commit" | "grant" | "observation" | "payment" | "purchase" | "recovery" | "release" | "reservation";
4527
+ kind: "closure" | "commit" | "correction" | "grant" | "observation" | "payment" | "purchase" | "recovery" | "release" | "reservation";
4222
4528
  purchaseKey?: string | undefined;
4223
4529
  sourceKey: string;
4224
4530
  }, {
4225
4531
  accountKey: import("convex/values").VString<string, "required">;
4226
4532
  purchaseKey: import("convex/values").VString<string | undefined, "optional">;
4227
- 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>;
4533
+ 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>;
4228
4534
  sourceKey: import("convex/values").VString<string, "required">;
4229
4535
  fingerprint: import("convex/values").VString<string, "required">;
4230
4536
  evidenceJson: import("convex/values").VString<string, "required">;
@@ -5294,14 +5600,6 @@ export declare function withHistory(count?: number, amount?: number): Promise<{
5294
5600
  preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
5295
5601
  requestKey: string;
5296
5602
  result?: {
5297
- reason: "identity_changed" | "revision_changed" | "scope_busy";
5298
- retryable: false;
5299
- status: "conflict";
5300
- } | {
5301
- reason: "policy_invalid";
5302
- retryable: false;
5303
- status: "rejected";
5304
- } | {
5305
5603
  operation: {
5306
5604
  accountId: string;
5307
5605
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -5312,6 +5610,14 @@ export declare function withHistory(count?: number, amount?: number): Promise<{
5312
5610
  } | {
5313
5611
  enabled: boolean;
5314
5612
  status: "unchanged";
5613
+ } | {
5614
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
5615
+ retryable: false;
5616
+ status: "conflict";
5617
+ } | {
5618
+ reason: "policy_invalid";
5619
+ retryable: false;
5620
+ status: "rejected";
5315
5621
  } | {
5316
5622
  reason: "provider_pending";
5317
5623
  retryable: true;
@@ -5322,14 +5628,6 @@ export declare function withHistory(count?: number, amount?: number): Promise<{
5322
5628
  payload: import("convex/values").VString<string, "required">;
5323
5629
  preparationId: import("convex/values").VId<import("convex/values").GenericId<"balanceFundingPreparations">, "required">;
5324
5630
  result: import("convex/values").VUnion<{
5325
- reason: "identity_changed" | "revision_changed" | "scope_busy";
5326
- retryable: false;
5327
- status: "conflict";
5328
- } | {
5329
- reason: "policy_invalid";
5330
- retryable: false;
5331
- status: "rejected";
5332
- } | {
5333
5631
  operation: {
5334
5632
  accountId: string;
5335
5633
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -5340,6 +5638,14 @@ export declare function withHistory(count?: number, amount?: number): Promise<{
5340
5638
  } | {
5341
5639
  enabled: boolean;
5342
5640
  status: "unchanged";
5641
+ } | {
5642
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
5643
+ retryable: false;
5644
+ status: "conflict";
5645
+ } | {
5646
+ reason: "policy_invalid";
5647
+ retryable: false;
5648
+ status: "rejected";
5343
5649
  } | {
5344
5650
  reason: "provider_pending";
5345
5651
  retryable: true;