@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,4 +1,154 @@
1
1
  declare const _default: import("convex/server").SchemaDefinition<{
2
+ usageCorrectionClaims: import("convex/server").TableDefinition<import("convex/values").VObject<{
3
+ key: string;
4
+ operationKey: string;
5
+ proofJson: string;
6
+ }, {
7
+ key: import("convex/values").VString<string, "required">;
8
+ operationKey: import("convex/values").VString<string, "required">;
9
+ proofJson: import("convex/values").VString<string, "required">;
10
+ }, "required", "key" | "operationKey" | "proofJson">, {
11
+ by_key: ["key", "_creationTime"];
12
+ }, {}, {}>;
13
+ usageCorrections: import("convex/server").TableDefinition<import("convex/values").VObject<{
14
+ adjustmentJson?: string | undefined;
15
+ attempt: number;
16
+ attemptedAt?: number | undefined;
17
+ cashConsequence: "none" | "operator_resolution_required" | "verified_external_adjustment";
18
+ correctionId: string;
19
+ creditNoteId?: string | undefined;
20
+ customerAccount?: string | undefined;
21
+ eventId: import("convex/values").GenericId<"usageEvents">;
22
+ firstAttemptAt: number;
23
+ historyCount: number;
24
+ inputJson: string;
25
+ invoiceId?: string | undefined;
26
+ key: string;
27
+ leaseUntil?: number | undefined;
28
+ nativeAdjustmentId?: string | undefined;
29
+ nativeCreditNoteStatus?: "issued" | "void" | undefined;
30
+ nativeStatus?: "complete" | "pending" | undefined;
31
+ observedAt?: number | undefined;
32
+ quantity: string;
33
+ reason: string;
34
+ recordJson: string;
35
+ refundId?: string | undefined;
36
+ resolution?: "event_cancellation" | "invoice_credit" | undefined;
37
+ restoredQuantity: string;
38
+ scaledQuantity: string;
39
+ scopeKey: string;
40
+ state: "confirmed" | "held" | "invoice_adjustment_required" | "provider_accepted" | "requested" | "unsupported";
41
+ stripeAccountId?: string | undefined;
42
+ subscriptionJson: string;
43
+ }, {
44
+ stripeAccountId: import("convex/values").VString<string | undefined, "optional">;
45
+ customerAccount: import("convex/values").VString<string | undefined, "optional">;
46
+ observedAt: import("convex/values").VFloat64<number | undefined, "optional">;
47
+ nativeCreditNoteStatus: import("convex/values").VUnion<"issued" | "void" | undefined, [import("convex/values").VLiteral<"issued", "required">, import("convex/values").VLiteral<"void", "required">], "optional", never>;
48
+ resolution: import("convex/values").VUnion<"event_cancellation" | "invoice_credit" | undefined, [import("convex/values").VLiteral<"event_cancellation", "required">, import("convex/values").VLiteral<"invoice_credit", "required">], "optional", never>;
49
+ adjustmentJson: import("convex/values").VString<string | undefined, "optional">;
50
+ key: import("convex/values").VString<string, "required">;
51
+ scopeKey: import("convex/values").VString<string, "required">;
52
+ eventId: import("convex/values").VId<import("convex/values").GenericId<"usageEvents">, "required">;
53
+ correctionId: import("convex/values").VString<string, "required">;
54
+ inputJson: import("convex/values").VString<string, "required">;
55
+ recordJson: import("convex/values").VString<string, "required">;
56
+ subscriptionJson: import("convex/values").VString<string, "required">;
57
+ quantity: import("convex/values").VString<string, "required">;
58
+ scaledQuantity: import("convex/values").VString<string, "required">;
59
+ state: import("convex/values").VUnion<"confirmed" | "held" | "invoice_adjustment_required" | "provider_accepted" | "requested" | "unsupported", [import("convex/values").VLiteral<"requested", "required">, import("convex/values").VLiteral<"provider_accepted", "required">, import("convex/values").VLiteral<"confirmed", "required">, import("convex/values").VLiteral<"held", "required">, import("convex/values").VLiteral<"unsupported", "required">, import("convex/values").VLiteral<"invoice_adjustment_required", "required">], "required", never>;
60
+ reason: import("convex/values").VString<string, "required">;
61
+ firstAttemptAt: import("convex/values").VFloat64<number, "required">;
62
+ attemptedAt: import("convex/values").VFloat64<number | undefined, "optional">;
63
+ leaseUntil: import("convex/values").VFloat64<number | undefined, "optional">;
64
+ attempt: import("convex/values").VFloat64<number, "required">;
65
+ nativeAdjustmentId: import("convex/values").VString<string | undefined, "optional">;
66
+ nativeStatus: import("convex/values").VUnion<"complete" | "pending" | undefined, [import("convex/values").VLiteral<"pending", "required">, import("convex/values").VLiteral<"complete", "required">], "optional", never>;
67
+ invoiceId: import("convex/values").VString<string | undefined, "optional">;
68
+ creditNoteId: import("convex/values").VString<string | undefined, "optional">;
69
+ refundId: import("convex/values").VString<string | undefined, "optional">;
70
+ cashConsequence: import("convex/values").VUnion<"none" | "operator_resolution_required" | "verified_external_adjustment", [import("convex/values").VLiteral<"none", "required">, import("convex/values").VLiteral<"operator_resolution_required", "required">, import("convex/values").VLiteral<"verified_external_adjustment", "required">], "required", never>;
71
+ restoredQuantity: import("convex/values").VString<string, "required">;
72
+ historyCount: import("convex/values").VFloat64<number, "required">;
73
+ }, "required", "adjustmentJson" | "attempt" | "attemptedAt" | "cashConsequence" | "correctionId" | "creditNoteId" | "customerAccount" | "eventId" | "firstAttemptAt" | "historyCount" | "inputJson" | "invoiceId" | "key" | "leaseUntil" | "nativeAdjustmentId" | "nativeCreditNoteStatus" | "nativeStatus" | "observedAt" | "quantity" | "reason" | "recordJson" | "refundId" | "resolution" | "restoredQuantity" | "scaledQuantity" | "scopeKey" | "state" | "stripeAccountId" | "subscriptionJson">, {
74
+ by_event: ["eventId", "_creationTime"];
75
+ by_key: ["key", "_creationTime"];
76
+ by_payer_state: ["customerAccount", "state", "_creationTime"];
77
+ by_realm_state: ["stripeAccountId", "state", "_creationTime"];
78
+ by_scope: ["scopeKey", "_creationTime"];
79
+ by_scope_state: ["scopeKey", "state", "_creationTime"];
80
+ }, {}, {}>;
81
+ usageCorrectionHistory: import("convex/server").TableDefinition<import("convex/values").VObject<{
82
+ at: number;
83
+ eventId: import("convex/values").GenericId<"usageEvents">;
84
+ evidenceJson: string;
85
+ key: string;
86
+ occurredAt?: number | undefined;
87
+ reason: string;
88
+ recordJson: string;
89
+ scopeKey: string;
90
+ sequence: number;
91
+ state: "confirmed" | "held" | "invoice_adjustment_required" | "provider_accepted" | "requested" | "unsupported";
92
+ subscriptionJson: string;
93
+ }, {
94
+ key: import("convex/values").VString<string, "required">;
95
+ scopeKey: import("convex/values").VString<string, "required">;
96
+ eventId: import("convex/values").VId<import("convex/values").GenericId<"usageEvents">, "required">;
97
+ sequence: import("convex/values").VFloat64<number, "required">;
98
+ state: import("convex/values").VUnion<"confirmed" | "held" | "invoice_adjustment_required" | "provider_accepted" | "requested" | "unsupported", [import("convex/values").VLiteral<"requested", "required">, import("convex/values").VLiteral<"provider_accepted", "required">, import("convex/values").VLiteral<"confirmed", "required">, import("convex/values").VLiteral<"held", "required">, import("convex/values").VLiteral<"unsupported", "required">, import("convex/values").VLiteral<"invoice_adjustment_required", "required">], "required", never>;
99
+ reason: import("convex/values").VString<string, "required">;
100
+ recordJson: import("convex/values").VString<string, "required">;
101
+ subscriptionJson: import("convex/values").VString<string, "required">;
102
+ evidenceJson: import("convex/values").VString<string, "required">;
103
+ occurredAt: import("convex/values").VFloat64<number | undefined, "optional">;
104
+ at: import("convex/values").VFloat64<number, "required">;
105
+ }, "required", "at" | "eventId" | "evidenceJson" | "key" | "occurredAt" | "reason" | "recordJson" | "scopeKey" | "sequence" | "state" | "subscriptionJson">, {
106
+ by_event: ["eventId", "_creationTime"];
107
+ by_scope_occurrence: ["scopeKey", "occurredAt", "_creationTime"];
108
+ by_scope_time: ["scopeKey", "at", "_creationTime"];
109
+ }, {}, {}>;
110
+ usageAllowancePolicies: import("convex/server").TableDefinition<import("convex/values").VObject<{
111
+ bindingJson: string;
112
+ consumed: string;
113
+ end: number;
114
+ historyCount: number;
115
+ key: string;
116
+ nativeKey: string;
117
+ policyJson: string;
118
+ reserved: string;
119
+ revision: number;
120
+ scopeKey: string;
121
+ start: number;
122
+ }, {
123
+ key: import("convex/values").VString<string, "required">;
124
+ nativeKey: import("convex/values").VString<string, "required">;
125
+ scopeKey: import("convex/values").VString<string, "required">;
126
+ bindingJson: import("convex/values").VString<string, "required">;
127
+ start: import("convex/values").VFloat64<number, "required">;
128
+ end: import("convex/values").VFloat64<number, "required">;
129
+ policyJson: import("convex/values").VString<string, "required">;
130
+ revision: import("convex/values").VFloat64<number, "required">;
131
+ consumed: import("convex/values").VString<string, "required">;
132
+ reserved: import("convex/values").VString<string, "required">;
133
+ historyCount: import("convex/values").VFloat64<number, "required">;
134
+ }, "required", "bindingJson" | "consumed" | "end" | "historyCount" | "key" | "nativeKey" | "policyJson" | "reserved" | "revision" | "scopeKey" | "start">, {
135
+ by_key: ["key", "_creationTime"];
136
+ by_native_start: ["nativeKey", "start", "_creationTime"];
137
+ by_scope_start: ["scopeKey", "start", "_creationTime"];
138
+ }, {}, {}>;
139
+ usageAllowanceHistory: import("convex/server").TableDefinition<import("convex/values").VObject<{
140
+ at: number;
141
+ evidenceJson: string;
142
+ key: string;
143
+ kind: "commit" | "correction" | "policy" | "release" | "reservation";
144
+ }, {
145
+ key: import("convex/values").VString<string, "required">;
146
+ kind: import("convex/values").VUnion<"commit" | "correction" | "policy" | "release" | "reservation", [import("convex/values").VLiteral<"policy", "required">, import("convex/values").VLiteral<"reservation", "required">, import("convex/values").VLiteral<"commit", "required">, import("convex/values").VLiteral<"release", "required">, import("convex/values").VLiteral<"correction", "required">], "required", never>;
147
+ evidenceJson: import("convex/values").VString<string, "required">;
148
+ at: import("convex/values").VFloat64<number, "required">;
149
+ }, "required", "at" | "evidenceJson" | "key" | "kind">, {
150
+ by_key: ["key", "_creationTime"];
151
+ }, {}, {}>;
2
152
  usageSubscriptionControls: import("convex/server").TableDefinition<import("convex/values").VObject<{
3
153
  cancelAtPeriodEnd: boolean;
4
154
  firstAttemptAt: number;
@@ -200,6 +350,7 @@ declare const _default: import("convex/server").SchemaDefinition<{
200
350
  }, {}, {}>;
201
351
  usageOutbox: import("convex/server").TableDefinition<import("convex/values").VObject<{
202
352
  attempts: number;
353
+ correctionKey?: string | undefined;
203
354
  definitionVersion?: 1 | undefined;
204
355
  dispatch?: string | undefined;
205
356
  eventId: import("convex/values").GenericId<"usageEvents">;
@@ -210,13 +361,13 @@ declare const _default: import("convex/server").SchemaDefinition<{
210
361
  nextAttemptAt: number;
211
362
  provider?: string | undefined;
212
363
  providerIdentifier: string;
213
- reason?: "administrative_hold" | "billing_period_closed" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined;
364
+ reason?: "administrative_hold" | "billing_period_closed" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | "usage_canceled" | undefined;
214
365
  receipt?: {
215
366
  created: number;
216
367
  identifier: string;
217
368
  } | undefined;
218
369
  scopeKey: string;
219
- state: "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
370
+ state: "canceled" | "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
220
371
  workflowId?: string | undefined;
221
372
  }, {
222
373
  historySequence: import("convex/values").VFloat64<number | undefined, "optional">;
@@ -226,7 +377,7 @@ declare const _default: import("convex/server").SchemaDefinition<{
226
377
  firstSendAt: import("convex/values").VFloat64<number | undefined, "optional">;
227
378
  leaseUntil: import("convex/values").VFloat64<number | undefined, "optional">;
228
379
  held: import("convex/values").VBoolean<boolean | undefined, "optional">;
229
- reason: import("convex/values").VUnion<"administrative_hold" | "billing_period_closed" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined, [import("convex/values").VLiteral<"billing_period_closed", "required">, import("convex/values").VLiteral<"rate_limited", "required">, import("convex/values").VLiteral<"provider_unavailable", "required">, import("convex/values").VLiteral<"provider_outcome_unknown", "required">, import("convex/values").VLiteral<"provider_rejected", "required">, import("convex/values").VLiteral<"retry_exhausted", "required">, import("convex/values").VLiteral<"delivery_window_expired", "required">, import("convex/values").VLiteral<"scope_busy", "required">, import("convex/values").VLiteral<"administrative_hold", "required">], "optional", never>;
380
+ reason: import("convex/values").VUnion<"administrative_hold" | "billing_period_closed" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | "usage_canceled" | undefined, [import("convex/values").VLiteral<"usage_canceled", "required">, import("convex/values").VLiteral<"billing_period_closed", "required">, import("convex/values").VLiteral<"rate_limited", "required">, import("convex/values").VLiteral<"provider_unavailable", "required">, import("convex/values").VLiteral<"provider_outcome_unknown", "required">, import("convex/values").VLiteral<"provider_rejected", "required">, import("convex/values").VLiteral<"retry_exhausted", "required">, import("convex/values").VLiteral<"delivery_window_expired", "required">, import("convex/values").VLiteral<"scope_busy", "required">, import("convex/values").VLiteral<"administrative_hold", "required">], "optional", never>;
230
381
  receipt: import("convex/values").VObject<{
231
382
  created: number;
232
383
  identifier: string;
@@ -234,14 +385,15 @@ declare const _default: import("convex/server").SchemaDefinition<{
234
385
  identifier: import("convex/values").VString<string, "required">;
235
386
  created: import("convex/values").VFloat64<number, "required">;
236
387
  }, "optional", "created" | "identifier">;
388
+ correctionKey: import("convex/values").VString<string | undefined, "optional">;
237
389
  eventId: import("convex/values").VId<import("convex/values").GenericId<"usageEvents">, "required">;
238
390
  scopeKey: import("convex/values").VString<string, "required">;
239
- state: import("convex/values").VUnion<"held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown", [import("convex/values").VLiteral<"queued", "required">, import("convex/values").VLiteral<"sending", "required">, import("convex/values").VLiteral<"provider_accepted", "required">, import("convex/values").VLiteral<"rejected", "required">, import("convex/values").VLiteral<"unknown", "required">, import("convex/values").VLiteral<"held", "required">], "required", never>;
391
+ state: import("convex/values").VUnion<"canceled" | "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown", [import("convex/values").VLiteral<"queued", "required">, import("convex/values").VLiteral<"canceled", "required">, import("convex/values").VLiteral<"sending", "required">, import("convex/values").VLiteral<"provider_accepted", "required">, import("convex/values").VLiteral<"rejected", "required">, import("convex/values").VLiteral<"unknown", "required">, import("convex/values").VLiteral<"held", "required">], "required", never>;
240
392
  attempts: import("convex/values").VFloat64<number, "required">;
241
393
  nextAttemptAt: import("convex/values").VFloat64<number, "required">;
242
394
  providerIdentifier: import("convex/values").VString<string, "required">;
243
395
  dispatch: import("convex/values").VString<string | undefined, "optional">;
244
- }, "required", "attempts" | "definitionVersion" | "dispatch" | "eventId" | "firstSendAt" | "held" | "historySequence" | "leaseUntil" | "nextAttemptAt" | "provider" | "providerIdentifier" | "reason" | "receipt" | "receipt.created" | "receipt.identifier" | "scopeKey" | "state" | "workflowId">, {
396
+ }, "required", "attempts" | "correctionKey" | "definitionVersion" | "dispatch" | "eventId" | "firstSendAt" | "held" | "historySequence" | "leaseUntil" | "nextAttemptAt" | "provider" | "providerIdentifier" | "reason" | "receipt" | "receipt.created" | "receipt.identifier" | "scopeKey" | "state" | "workflowId">, {
245
397
  by_event: ["eventId", "_creationTime"];
246
398
  by_provider_identifier: ["providerIdentifier", "_creationTime"];
247
399
  by_scope_state: ["scopeKey", "state", "_creationTime"];
@@ -258,7 +410,7 @@ declare const _default: import("convex/server").SchemaDefinition<{
258
410
  }, {}, {}>;
259
411
  usageReservations: import("convex/server").TableDefinition<import("convex/values").VObject<{
260
412
  accountKey?: string | undefined;
261
- accountingKind?: "prepaid" | undefined;
413
+ accountingKind?: "allowance" | "prepaid" | undefined;
262
414
  allocationsJson?: string | undefined;
263
415
  eventId?: import("convex/values").GenericId<"usageEvents"> | undefined;
264
416
  inputJson?: string | undefined;
@@ -276,13 +428,14 @@ declare const _default: import("convex/server").SchemaDefinition<{
276
428
  scaledQuantity: import("convex/values").VString<string, "required">;
277
429
  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>;
278
430
  eventId: import("convex/values").VId<import("convex/values").GenericId<"usageEvents"> | undefined, "optional">;
279
- accountingKind: import("convex/values").VLiteral<"prepaid" | undefined, "optional">;
431
+ accountingKind: import("convex/values").VUnion<"allowance" | "prepaid" | undefined, [import("convex/values").VLiteral<"prepaid", "required">, import("convex/values").VLiteral<"allowance", "required">], "optional", never>;
280
432
  accountKey: import("convex/values").VString<string | undefined, "optional">;
281
433
  inputJson: import("convex/values").VString<string | undefined, "optional">;
282
434
  subscriptionJson: import("convex/values").VString<string | undefined, "optional">;
283
435
  allocationsJson: import("convex/values").VString<string | undefined, "optional">;
284
436
  releaseReason: import("convex/values").VString<string | undefined, "optional">;
285
437
  }, "required", "accountKey" | "accountingKind" | "allocationsJson" | "eventId" | "inputJson" | "planJson" | "releaseReason" | "scaledQuantity" | "scopeKey" | "sourceEventId" | "state" | "subscriptionJson">, {
438
+ by_account_state: ["accountKey", "state", "_creationTime"];
286
439
  by_scope_source: ["scopeKey", "sourceEventId", "_creationTime"];
287
440
  by_scope_state: ["scopeKey", "state", "_creationTime"];
288
441
  }, {}, {}>;
@@ -396,13 +549,13 @@ declare const _default: import("convex/server").SchemaDefinition<{
396
549
  at: number;
397
550
  evidenceJson: string;
398
551
  fingerprint: string;
399
- kind: "closure" | "commit" | "grant" | "observation" | "payment" | "purchase" | "recovery" | "release" | "reservation";
552
+ kind: "closure" | "commit" | "correction" | "grant" | "observation" | "payment" | "purchase" | "recovery" | "release" | "reservation";
400
553
  purchaseKey?: string | undefined;
401
554
  sourceKey: string;
402
555
  }, {
403
556
  accountKey: import("convex/values").VString<string, "required">;
404
557
  purchaseKey: import("convex/values").VString<string | undefined, "optional">;
405
- kind: import("convex/values").VUnion<"closure" | "commit" | "grant" | "observation" | "payment" | "purchase" | "recovery" | "release" | "reservation", [import("convex/values").VLiteral<"purchase", "required">, import("convex/values").VLiteral<"payment", "required">, import("convex/values").VLiteral<"grant", "required">, import("convex/values").VLiteral<"reservation", "required">, import("convex/values").VLiteral<"commit", "required">, import("convex/values").VLiteral<"release", "required">, import("convex/values").VLiteral<"observation", "required">, import("convex/values").VLiteral<"recovery", "required">, import("convex/values").VLiteral<"closure", "required">], "required", never>;
558
+ kind: import("convex/values").VUnion<"closure" | "commit" | "correction" | "grant" | "observation" | "payment" | "purchase" | "recovery" | "release" | "reservation", [import("convex/values").VLiteral<"purchase", "required">, import("convex/values").VLiteral<"payment", "required">, import("convex/values").VLiteral<"grant", "required">, import("convex/values").VLiteral<"reservation", "required">, import("convex/values").VLiteral<"commit", "required">, import("convex/values").VLiteral<"release", "required">, import("convex/values").VLiteral<"observation", "required">, import("convex/values").VLiteral<"recovery", "required">, import("convex/values").VLiteral<"closure", "required">, import("convex/values").VLiteral<"correction", "required">], "required", never>;
406
559
  sourceKey: import("convex/values").VString<string, "required">;
407
560
  fingerprint: import("convex/values").VString<string, "required">;
408
561
  evidenceJson: import("convex/values").VString<string, "required">;
@@ -1,3 +1,5 @@
1
+ import { claimsTable as usageCorrectionClaims, operationsTable as usageCorrections, historyTable as usageCorrectionHistory, } from "./usageCorrections/schema.js";
2
+ import { policiesTable as usageAllowancePolicies, historyTable as usageAllowanceHistory, } from "./usageAllowance/schema.js";
1
3
  import { accountsTable as usageCreditAccounts, purchasesTable as usageCreditPurchases, grantsTable as usageCreditGrants, historyTable as usageCreditHistory, } from "./usageCredits/schema.js";
2
4
  import { controlsTable as usageSubscriptionControls, intentsTable as usageSubscriptionIntents, locksTable as usageSubscriptionLocks, historyTable as usageSubscriptionHistory, } from "./usageSubscriptions/schema.js";
3
5
  import { historyTable as usageDeliveryHistory, observationsTable as usageProviderObservations, } from "./usageObservations/schema.js";
@@ -31,6 +33,11 @@ import { accountsTable } from "./core/schema";
31
33
  import { pricesTable, productsTable } from "./products/schema";
32
34
  import { webhookEventsTable } from "./webhooks/schema";
33
35
  export default defineSchema({
36
+ usageCorrectionClaims,
37
+ usageCorrections,
38
+ usageCorrectionHistory,
39
+ usageAllowancePolicies,
40
+ usageAllowanceHistory,
34
41
  usageSubscriptionControls,
35
42
  usageSubscriptionIntents,
36
43
  usageSubscriptionLocks,
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/component/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,IAAI,mBAAmB,EACpC,cAAc,IAAI,oBAAoB,EACtC,WAAW,IAAI,iBAAiB,EAChC,YAAY,IAAI,kBAAkB,GACnC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,aAAa,IAAI,yBAAyB,EAC1C,YAAY,IAAI,wBAAwB,EACxC,UAAU,IAAI,sBAAsB,EACpC,YAAY,IAAI,wBAAwB,GACzC,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,YAAY,IAAI,oBAAoB,EACpC,iBAAiB,IAAI,yBAAyB,GAC/C,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,WAAW,IAAI,mBAAmB,EAClC,UAAU,IAAI,kBAAkB,GACjC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,WAAW,IAAI,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EAAE,eAAe,IAAI,sCAAsC,EAAE,MAAM,0CAA0C,CAAC;AACrH,OAAO,EACL,eAAe,IAAI,0BAA0B,EAC7C,aAAa,IAAI,wBAAwB,GAC1C,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,iBAAiB,IAAI,0BAA0B,EAC/C,eAAe,IAAI,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,EAAE,qBAAqB;IACvC,QAAQ,EAAE,aAAa;IAEvB,UAAU;IACV,QAAQ,EAAE,aAAa;IACvB,OAAO,EAAE,YAAY;IACrB,iBAAiB,EAAE,sBAAsB;IACzC,OAAO,EAAE,YAAY;IACrB,QAAQ,EAAE,aAAa;IACvB,SAAS,EAAE,cAAc;IACzB,mBAAmB,EAAE,wBAAwB;IAE7C,WAAW;IACX,aAAa,EAAE,kBAAkB;CAClC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../../src/component/usage/mutations.ts"],"names":[],"mappings":"AAaA,4FAA4F;AAC5F,eAAO,MAAM,MAAM;;;;;;;;;;cA+CD,QAAQ;GA2FxB,CAAC"}
1
+ {"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../../src/component/usage/mutations.ts"],"names":[],"mappings":"AAiBA,4FAA4F;AAC5F,eAAO,MAAM,MAAM;;;;;;;;;;cA+CD,QAAQ;GAoGxB,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { commit as commitAllowanceReservation, requireReservation, } from "../usageAllowance/reservations.js";
1
2
  import { commit as commitCreditReservation } from "../usageCredits/reservations.js";
2
3
  import { managedBillingCutoff } from "../usageSubscriptions/acceptance.js";
3
4
  import { v } from "convex/values";
@@ -87,6 +88,7 @@ export const record = mutation({
87
88
  reservation.scaledQuantity !== event.scaledQuantity ||
88
89
  reservation.state !== "reserved"))
89
90
  throw new Error("Usage reservation does not match event");
91
+ await requireReservation(ctx, event, subscription, reservation);
90
92
  const eventId = await ctx.db.insert("usageEvents", {
91
93
  subscriptionId: subscription.subscriptionId,
92
94
  reservationId: args.reservationId,
@@ -114,6 +116,8 @@ export const record = mutation({
114
116
  await ctx.db.insert("usageScopeCounters", { scopeKey: key, count: 1 });
115
117
  if (reservation && event.binding.plan.model === "prepaid")
116
118
  await commitCreditReservation(ctx, reservation, event, subscription, eventId);
119
+ if (reservation?.accountingKind === "allowance")
120
+ await commitAllowanceReservation(ctx, reservation, event, subscription, eventId);
117
121
  if (reservation)
118
122
  await ctx.db.patch("usageReservations", reservation._id, {
119
123
  state: "committed",
@@ -1 +1 @@
1
- {"version":3,"file":"mutations.js","sourceRoot":"","sources":["../../../src/component/usage/mutations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AACpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAElC,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EACL,kBAAkB,GAEnB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAE9D,4FAA4F;AAC5F,MAAM,CAAC,MAAM,MAAM,GAAG,QAAQ,CAAC;IAC7B,IAAI,EAAE;QACJ,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;QACrB,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE;QAC5B,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QAChC,aAAa,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,mBAAmB,CAAC,CAAC;QACpD,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;KAC9B;IACD,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC;QAChB,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC;QAC5B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;QACpB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;QACtB,QAAQ,E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GAAG,EAAE;gBACpD,KAAK,EAAE,OAAO,CAAC,KAAK,GAAG,CAAC;aACzB,CAAC,CAAC;;YACA,MAAM,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,oBAAoB,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;QAC5E,IAAI,WAAW,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,KAAK,SAAS;YACvD,MAAM,uBAAuB,CAC3B,GAAG,EACH,WAAW,EACX,KAAK,EACL,YAAY,EACZ,OAAO,CACR,CAAC;QACJ,IAAI,WAAW,EAAE,cAAc,KAAK,WAAW;YAC7C,MAAM,0BAA0B,CAC9B,GAAG,EACH,WAAW,EACX,KAAK,EACL,YAAY,EACZ,OAAO,CACR,CAAC;QACJ,IAAI,WAAW;YACb,MAAM,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,mBAAmB,EAAE,WAAW,CAAC,GAAG,EAAE;gBACvD,KAAK,EAAE,WAAW;gBAClB,OAAO;aACR,CAAC,CAAC;QACL,IAAI,IAAI,CAAC,QAAQ;YACf,MAAM,GAAG,CAAC,SAAS,CAAC,QAAQ,CAC1B,CAAC,EACD,IAAI,CAAC,QAAoC,EACzC,EAAE,OAAO,EAAE,CACZ,CAAC;QACJ,OAAO;YACL,OAAO;YACP,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,UAAU,EAAE,GAAG;YACf,QAAQ,EAAE,QAAiB;SAC5B,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -19,7 +19,7 @@ export declare const get: import("convex/server").RegisteredQuery<"public", {
19
19
  subscriptionId?: string | undefined;
20
20
  subscriptionJson: string;
21
21
  };
22
- delivery: "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
22
+ delivery: "canceled" | "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
23
23
  } | null>>;
24
24
  export declare const read: import("convex/server").RegisteredQuery<"public", {
25
25
  paginationOpts: {
@@ -58,7 +58,7 @@ export declare const read: import("convex/server").RegisteredQuery<"public", {
58
58
  subscriptionId?: string | undefined;
59
59
  subscriptionJson: string;
60
60
  };
61
- delivery: "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
61
+ delivery: "canceled" | "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
62
62
  }[];
63
63
  }>>;
64
64
  //# sourceMappingURL=queries.d.ts.map
@@ -9,7 +9,7 @@ export declare const scopeValidator: import("convex/values").VObject<{
9
9
  meterId: import("convex/values").VString<string, "required">;
10
10
  livemode: import("convex/values").VBoolean<boolean, "required">;
11
11
  }, "required", "customerAccount" | "livemode" | "meterId" | "stripeAccountId">;
12
- export declare const deliveryValidator: 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>;
12
+ export declare const deliveryValidator: 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>;
13
13
  export declare const eventFields: {
14
14
  subscriptionId: import("convex/values").VString<string | undefined, "optional">;
15
15
  reservationId: import("convex/values").VId<import("convex/values").GenericId<"usageReservations"> | undefined, "optional">;
@@ -75,7 +75,7 @@ export declare const outboxFields: {
75
75
  firstSendAt: import("convex/values").VFloat64<number | undefined, "optional">;
76
76
  leaseUntil: import("convex/values").VFloat64<number | undefined, "optional">;
77
77
  held: import("convex/values").VBoolean<boolean | undefined, "optional">;
78
- 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>;
78
+ 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>;
79
79
  receipt: import("convex/values").VObject<{
80
80
  created: number;
81
81
  identifier: string;
@@ -83,9 +83,10 @@ export declare const outboxFields: {
83
83
  identifier: import("convex/values").VString<string, "required">;
84
84
  created: import("convex/values").VFloat64<number, "required">;
85
85
  }, "optional", "created" | "identifier">;
86
+ correctionKey: import("convex/values").VString<string | undefined, "optional">;
86
87
  eventId: import("convex/values").VId<import("convex/values").GenericId<"usageEvents">, "required">;
87
88
  scopeKey: import("convex/values").VString<string, "required">;
88
- 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>;
89
+ 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>;
89
90
  attempts: import("convex/values").VFloat64<number, "required">;
90
91
  nextAttemptAt: import("convex/values").VFloat64<number, "required">;
91
92
  providerIdentifier: import("convex/values").VString<string, "required">;
@@ -95,6 +96,7 @@ export declare const outboxDoc: import("convex/values").VObject<{
95
96
  _creationTime: number;
96
97
  _id: import("convex/values").GenericId<"usageOutbox">;
97
98
  attempts: number;
99
+ correctionKey?: string | undefined;
98
100
  definitionVersion?: 1 | undefined;
99
101
  dispatch?: string | undefined;
100
102
  eventId: import("convex/values").GenericId<"usageEvents">;
@@ -105,13 +107,13 @@ export declare const outboxDoc: import("convex/values").VObject<{
105
107
  nextAttemptAt: number;
106
108
  provider?: string | undefined;
107
109
  providerIdentifier: string;
108
- reason?: "administrative_hold" | "billing_period_closed" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined;
110
+ 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;
109
111
  receipt?: {
110
112
  created: number;
111
113
  identifier: string;
112
114
  } | undefined;
113
115
  scopeKey: string;
114
- state: "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
116
+ state: "canceled" | "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
115
117
  workflowId?: string | undefined;
116
118
  }, {
117
119
  historySequence: import("convex/values").VFloat64<number | undefined, "optional">;
@@ -121,7 +123,7 @@ export declare const outboxDoc: import("convex/values").VObject<{
121
123
  firstSendAt: import("convex/values").VFloat64<number | undefined, "optional">;
122
124
  leaseUntil: import("convex/values").VFloat64<number | undefined, "optional">;
123
125
  held: import("convex/values").VBoolean<boolean | undefined, "optional">;
124
- 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>;
126
+ 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>;
125
127
  receipt: import("convex/values").VObject<{
126
128
  created: number;
127
129
  identifier: string;
@@ -129,18 +131,20 @@ export declare const outboxDoc: import("convex/values").VObject<{
129
131
  identifier: import("convex/values").VString<string, "required">;
130
132
  created: import("convex/values").VFloat64<number, "required">;
131
133
  }, "optional", "created" | "identifier">;
134
+ correctionKey: import("convex/values").VString<string | undefined, "optional">;
132
135
  eventId: import("convex/values").VId<import("convex/values").GenericId<"usageEvents">, "required">;
133
136
  scopeKey: import("convex/values").VString<string, "required">;
134
- 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>;
137
+ 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>;
135
138
  attempts: import("convex/values").VFloat64<number, "required">;
136
139
  nextAttemptAt: import("convex/values").VFloat64<number, "required">;
137
140
  providerIdentifier: import("convex/values").VString<string, "required">;
138
141
  dispatch: import("convex/values").VString<string | undefined, "optional">;
139
142
  _id: import("convex/values").VId<import("convex/values").GenericId<"usageOutbox">, "required">;
140
143
  _creationTime: import("convex/values").VFloat64<number, "required">;
141
- }, "required", "_creationTime" | "_id" | "attempts" | "definitionVersion" | "dispatch" | "eventId" | "firstSendAt" | "held" | "historySequence" | "leaseUntil" | "nextAttemptAt" | "provider" | "providerIdentifier" | "reason" | "receipt" | "receipt.created" | "receipt.identifier" | "scopeKey" | "state" | "workflowId">;
144
+ }, "required", "_creationTime" | "_id" | "attempts" | "correctionKey" | "definitionVersion" | "dispatch" | "eventId" | "firstSendAt" | "held" | "historySequence" | "leaseUntil" | "nextAttemptAt" | "provider" | "providerIdentifier" | "reason" | "receipt" | "receipt.created" | "receipt.identifier" | "scopeKey" | "state" | "workflowId">;
142
145
  export declare const usageOutboxTable: import("convex/server").TableDefinition<import("convex/values").VObject<{
143
146
  attempts: number;
147
+ correctionKey?: string | undefined;
144
148
  definitionVersion?: 1 | undefined;
145
149
  dispatch?: string | undefined;
146
150
  eventId: import("convex/values").GenericId<"usageEvents">;
@@ -151,13 +155,13 @@ export declare const usageOutboxTable: import("convex/server").TableDefinition<i
151
155
  nextAttemptAt: number;
152
156
  provider?: string | undefined;
153
157
  providerIdentifier: string;
154
- reason?: "administrative_hold" | "billing_period_closed" | "delivery_window_expired" | "provider_outcome_unknown" | "provider_rejected" | "provider_unavailable" | "rate_limited" | "retry_exhausted" | "scope_busy" | undefined;
158
+ 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;
155
159
  receipt?: {
156
160
  created: number;
157
161
  identifier: string;
158
162
  } | undefined;
159
163
  scopeKey: string;
160
- state: "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
164
+ state: "canceled" | "held" | "provider_accepted" | "queued" | "rejected" | "sending" | "unknown";
161
165
  workflowId?: string | undefined;
162
166
  }, {
163
167
  historySequence: import("convex/values").VFloat64<number | undefined, "optional">;
@@ -167,7 +171,7 @@ export declare const usageOutboxTable: import("convex/server").TableDefinition<i
167
171
  firstSendAt: import("convex/values").VFloat64<number | undefined, "optional">;
168
172
  leaseUntil: import("convex/values").VFloat64<number | undefined, "optional">;
169
173
  held: import("convex/values").VBoolean<boolean | undefined, "optional">;
170
- 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>;
174
+ 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>;
171
175
  receipt: import("convex/values").VObject<{
172
176
  created: number;
173
177
  identifier: string;
@@ -175,14 +179,15 @@ export declare const usageOutboxTable: import("convex/server").TableDefinition<i
175
179
  identifier: import("convex/values").VString<string, "required">;
176
180
  created: import("convex/values").VFloat64<number, "required">;
177
181
  }, "optional", "created" | "identifier">;
182
+ correctionKey: import("convex/values").VString<string | undefined, "optional">;
178
183
  eventId: import("convex/values").VId<import("convex/values").GenericId<"usageEvents">, "required">;
179
184
  scopeKey: import("convex/values").VString<string, "required">;
180
- 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>;
185
+ 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>;
181
186
  attempts: import("convex/values").VFloat64<number, "required">;
182
187
  nextAttemptAt: import("convex/values").VFloat64<number, "required">;
183
188
  providerIdentifier: import("convex/values").VString<string, "required">;
184
189
  dispatch: import("convex/values").VString<string | undefined, "optional">;
185
- }, "required", "attempts" | "definitionVersion" | "dispatch" | "eventId" | "firstSendAt" | "held" | "historySequence" | "leaseUntil" | "nextAttemptAt" | "provider" | "providerIdentifier" | "reason" | "receipt" | "receipt.created" | "receipt.identifier" | "scopeKey" | "state" | "workflowId">, {
190
+ }, "required", "attempts" | "correctionKey" | "definitionVersion" | "dispatch" | "eventId" | "firstSendAt" | "held" | "historySequence" | "leaseUntil" | "nextAttemptAt" | "provider" | "providerIdentifier" | "reason" | "receipt" | "receipt.created" | "receipt.identifier" | "scopeKey" | "state" | "workflowId">, {
186
191
  by_event: ["eventId", "_creationTime"];
187
192
  by_provider_identifier: ["providerIdentifier", "_creationTime"];
188
193
  by_scope_state: ["scopeKey", "state", "_creationTime"];
@@ -199,7 +204,7 @@ export declare const usageScopeCountersTable: import("convex/server").TableDefin
199
204
  }, {}, {}>;
200
205
  export declare const usageReservationsTable: import("convex/server").TableDefinition<import("convex/values").VObject<{
201
206
  accountKey?: string | undefined;
202
- accountingKind?: "prepaid" | undefined;
207
+ accountingKind?: "allowance" | "prepaid" | undefined;
203
208
  allocationsJson?: string | undefined;
204
209
  eventId?: import("convex/values").GenericId<"usageEvents"> | undefined;
205
210
  inputJson?: string | undefined;
@@ -217,13 +222,14 @@ export declare const usageReservationsTable: import("convex/server").TableDefini
217
222
  scaledQuantity: import("convex/values").VString<string, "required">;
218
223
  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>;
219
224
  eventId: import("convex/values").VId<import("convex/values").GenericId<"usageEvents"> | undefined, "optional">;
220
- accountingKind: import("convex/values").VLiteral<"prepaid" | undefined, "optional">;
225
+ accountingKind: import("convex/values").VUnion<"allowance" | "prepaid" | undefined, [import("convex/values").VLiteral<"prepaid", "required">, import("convex/values").VLiteral<"allowance", "required">], "optional", never>;
221
226
  accountKey: import("convex/values").VString<string | undefined, "optional">;
222
227
  inputJson: import("convex/values").VString<string | undefined, "optional">;
223
228
  subscriptionJson: import("convex/values").VString<string | undefined, "optional">;
224
229
  allocationsJson: import("convex/values").VString<string | undefined, "optional">;
225
230
  releaseReason: import("convex/values").VString<string | undefined, "optional">;
226
231
  }, "required", "accountKey" | "accountingKind" | "allocationsJson" | "eventId" | "inputJson" | "planJson" | "releaseReason" | "scaledQuantity" | "scopeKey" | "sourceEventId" | "state" | "subscriptionJson">, {
232
+ by_account_state: ["accountKey", "state", "_creationTime"];
227
233
  by_scope_source: ["scopeKey", "sourceEventId", "_creationTime"];
228
234
  by_scope_state: ["scopeKey", "state", "_creationTime"];
229
235
  }, {}, {}>;
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/component/usage/schema.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,cAAc;;;;;;;;;;8EAKzB,CAAC;AACH,eAAO,MAAM,iBAAiB,geAO7B,CAAC;AACF,eAAO,MAAM,WAAW;IACtB,cAAc;IACd,aAAa;IACb,QAAQ;IACR,QAA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