@fantastic.dev/better-stripe 0.10.2 → 0.12.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 (140) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +220 -4
  3. package/dist/client/billing/balanceFunding.d.ts +36 -0
  4. package/dist/client/billing/balanceFunding.d.ts.map +1 -0
  5. package/dist/client/billing/balanceFunding.js +107 -0
  6. package/dist/client/billing/balanceFunding.js.map +1 -0
  7. package/dist/client/billing/invoicePreview.d.ts +28 -0
  8. package/dist/client/billing/invoicePreview.d.ts.map +1 -0
  9. package/dist/client/billing/invoicePreview.js +56 -0
  10. package/dist/client/billing/invoicePreview.js.map +1 -0
  11. package/dist/client/charge-currency-format.d.ts +3 -0
  12. package/dist/client/charge-currency-format.d.ts.map +1 -0
  13. package/dist/client/charge-currency-format.js +22 -0
  14. package/dist/client/charge-currency-format.js.map +1 -0
  15. package/dist/client/charge-currency.d.ts +14 -0
  16. package/dist/client/charge-currency.d.ts.map +1 -0
  17. package/dist/client/charge-currency.js +85 -0
  18. package/dist/client/charge-currency.js.map +1 -0
  19. package/dist/client/costRecovery.d.ts +115 -0
  20. package/dist/client/costRecovery.d.ts.map +1 -0
  21. package/dist/client/costRecovery.js +50 -0
  22. package/dist/client/costRecovery.js.map +1 -0
  23. package/dist/client/index.d.ts +28 -64
  24. package/dist/client/index.d.ts.map +1 -1
  25. package/dist/client/index.js +25 -0
  26. package/dist/client/index.js.map +1 -1
  27. package/dist/client/products/prices.d.ts +4 -2
  28. package/dist/client/products/prices.d.ts.map +1 -1
  29. package/dist/client/products/prices.js +5 -4
  30. package/dist/client/products/prices.js.map +1 -1
  31. package/dist/client/products/products.d.ts +4 -2
  32. package/dist/client/products/products.d.ts.map +1 -1
  33. package/dist/client/products/products.js +7 -5
  34. package/dist/client/products/products.js.map +1 -1
  35. package/dist/client/settlement/processingCosts.d.ts +56 -0
  36. package/dist/client/settlement/processingCosts.d.ts.map +1 -0
  37. package/dist/client/settlement/processingCosts.js +173 -0
  38. package/dist/client/settlement/processingCosts.js.map +1 -0
  39. package/dist/client/utils/webhookEndpoints.d.ts +1 -1
  40. package/dist/client/utils/webhookEndpoints.d.ts.map +1 -1
  41. package/dist/client/utils/webhookEndpoints.js +1 -0
  42. package/dist/client/utils/webhookEndpoints.js.map +1 -1
  43. package/dist/client/webhooks/processors.d.ts.map +1 -1
  44. package/dist/client/webhooks/processors.js +1 -0
  45. package/dist/client/webhooks/processors.js.map +1 -1
  46. package/dist/component/_generated/component.d.ts +244 -0
  47. package/dist/component/_generated/component.d.ts.map +1 -1
  48. package/dist/component/costRecovery/claims.d.ts +68 -0
  49. package/dist/component/costRecovery/claims.d.ts.map +1 -0
  50. package/dist/component/costRecovery/claims.js +85 -0
  51. package/dist/component/costRecovery/claims.js.map +1 -0
  52. package/dist/component/costRecovery/completion.d.ts +33 -0
  53. package/dist/component/costRecovery/completion.d.ts.map +1 -0
  54. package/dist/component/costRecovery/completion.js +69 -0
  55. package/dist/component/costRecovery/completion.js.map +1 -0
  56. package/dist/component/costRecovery/helpers.d.ts +62 -0
  57. package/dist/component/costRecovery/helpers.d.ts.map +1 -0
  58. package/dist/component/costRecovery/helpers.js +71 -0
  59. package/dist/component/costRecovery/helpers.js.map +1 -0
  60. package/dist/component/costRecovery/mutations.d.ts +138 -0
  61. package/dist/component/costRecovery/mutations.d.ts.map +1 -0
  62. package/dist/component/costRecovery/mutations.js +36 -0
  63. package/dist/component/costRecovery/mutations.js.map +1 -0
  64. package/dist/component/costRecovery/queries.d.ts +102 -0
  65. package/dist/component/costRecovery/queries.d.ts.map +1 -0
  66. package/dist/component/costRecovery/queries.js +73 -0
  67. package/dist/component/costRecovery/queries.js.map +1 -0
  68. package/dist/component/costRecovery/reservations.d.ts +83 -0
  69. package/dist/component/costRecovery/reservations.d.ts.map +1 -0
  70. package/dist/component/costRecovery/reservations.js +134 -0
  71. package/dist/component/costRecovery/reservations.js.map +1 -0
  72. package/dist/component/costRecovery/schema.d.ts +340 -0
  73. package/dist/component/costRecovery/schema.d.ts.map +1 -0
  74. package/dist/component/costRecovery/schema.js +109 -0
  75. package/dist/component/costRecovery/schema.js.map +1 -0
  76. package/dist/component/schema.d.ts +119 -0
  77. package/dist/component/schema.js +5 -0
  78. package/dist/component/schema.js.map +1 -1
  79. package/dist/react/components/PriceCard.d.ts +3 -1
  80. package/dist/react/components/PriceCard.d.ts.map +1 -1
  81. package/dist/react/components/PriceCard.js +2 -2
  82. package/dist/react/components/PriceCard.js.map +1 -1
  83. package/dist/react/index.d.ts +1 -0
  84. package/dist/react/index.d.ts.map +1 -1
  85. package/dist/react/index.js +1 -0
  86. package/dist/react/index.js.map +1 -1
  87. package/dist/react/lib/price-helpers.d.ts +4 -6
  88. package/dist/react/lib/price-helpers.d.ts.map +1 -1
  89. package/dist/react/lib/price-helpers.js +16 -9
  90. package/dist/react/lib/price-helpers.js.map +1 -1
  91. package/dist/react/workflows/PlanPricingEditor.d.ts +4 -0
  92. package/dist/react/workflows/PlanPricingEditor.d.ts.map +1 -1
  93. package/dist/react/workflows/PlanPricingEditor.js +12 -9
  94. package/dist/react/workflows/PlanPricingEditor.js.map +1 -1
  95. package/docs/react-workflows.md +91 -0
  96. package/package.json +2 -2
  97. package/src/client/billing/balanceFunding.test.ts +257 -0
  98. package/src/client/billing/balanceFunding.ts +183 -0
  99. package/src/client/billing/balanceFundingTransport.test.ts +89 -0
  100. package/src/client/billing/invoicePreview.test.ts +123 -0
  101. package/src/client/billing/invoicePreview.ts +94 -0
  102. package/src/client/billing/invoicePreviewTransport.test.ts +70 -0
  103. package/src/client/charge-currency-format.ts +29 -0
  104. package/src/client/charge-currency.test.ts +113 -0
  105. package/src/client/charge-currency.ts +119 -0
  106. package/src/client/costRecovery.test.ts +76 -0
  107. package/src/client/costRecovery.ts +149 -0
  108. package/src/client/index.ts +76 -73
  109. package/src/client/products/catalog-idempotency.test.ts +116 -0
  110. package/src/client/products/prices.ts +18 -11
  111. package/src/client/products/products.ts +17 -11
  112. package/src/client/settlement/processingCosts.test.ts +349 -0
  113. package/src/client/settlement/processingCosts.ts +315 -0
  114. package/src/client/settlement/processingCostsTransport.test.ts +135 -0
  115. package/src/client/utils/webhookEndpoints.test.ts +5 -0
  116. package/src/client/utils/webhookEndpoints.ts +1 -0
  117. package/src/client/webhooks/hooks.test.ts +9 -0
  118. package/src/client/webhooks/payout-canceled.integration.test.ts +192 -0
  119. package/src/client/webhooks/processors.ts +1 -0
  120. package/src/component/_generated/api.ts +12 -0
  121. package/src/component/_generated/component.ts +308 -0
  122. package/src/component/cost-recovery.test.ts +344 -0
  123. package/src/component/costRecovery/claims.ts +109 -0
  124. package/src/component/costRecovery/completion.ts +92 -0
  125. package/src/component/costRecovery/helpers.ts +83 -0
  126. package/src/component/costRecovery/mutations.ts +43 -0
  127. package/src/component/costRecovery/queries.ts +88 -0
  128. package/src/component/costRecovery/reservations.ts +164 -0
  129. package/src/component/costRecovery/schema.ts +127 -0
  130. package/src/component/schema.ts +10 -0
  131. package/src/react/components/PayoutSchedule.render.test.tsx +15 -0
  132. package/src/react/components/PriceCard.render.test.tsx +37 -0
  133. package/src/react/components/PriceCard.tsx +9 -1
  134. package/src/react/index.test.ts +5 -0
  135. package/src/react/index.ts +7 -0
  136. package/src/react/lib/price-helpers.test.ts +15 -2
  137. package/src/react/lib/price-helpers.ts +25 -8
  138. package/src/react/workflows/Billing.test.tsx +1 -1
  139. package/src/react/workflows/PlanPricingEditor.currency.test.tsx +164 -0
  140. package/src/react/workflows/PlanPricingEditor.tsx +26 -10
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reservations.js","sourceRoot":"","sources":["../../../src/component/costRecovery/reservations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAElC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EACL,OAAO,EACP,UAAU,EACV,QAAQ,EACR,WAAW,EAC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AE,QAAQ,EAAE,CAAC,CAAC;IACtE,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,gBAAgB,EAAE,KAAK,CAAC,GAAG,CAAC,CAAE,CAAC;AAC1D,CAAC"}
@@ -0,0 +1,340 @@
1
+ export declare const scopeFields: {
2
+ accountId: import("convex/values").VString<string, "required">;
3
+ scopeKey: import("convex/values").VString<string, "required">;
4
+ currency: import("convex/values").VString<string, "required">;
5
+ };
6
+ export declare const totalsFields: {
7
+ amountDue: import("convex/values").VFloat64<number, "required">;
8
+ collectedAmount: import("convex/values").VFloat64<number, "required">;
9
+ reservedAmount: import("convex/values").VFloat64<number, "required">;
10
+ outstanding: import("convex/values").VFloat64<number, "required">;
11
+ };
12
+ export declare const signValidator: import("convex/values").VUnion<"negative" | "positive" | "zero", [import("convex/values").VLiteral<"positive", "required">, import("convex/values").VLiteral<"negative", "required">, import("convex/values").VLiteral<"zero", "required">], "required", never>;
13
+ export declare const observationFields: {
14
+ accountId: import("convex/values").VString<string, "required">;
15
+ scopeKey: import("convex/values").VString<string, "required">;
16
+ currency: import("convex/values").VString<string, "required">;
17
+ claimKey: import("convex/values").VString<string, "required">;
18
+ sourceChargeId: import("convex/values").VString<string, "required">;
19
+ sourceGross: import("convex/values").VFloat64<number, "required">;
20
+ sourceProcessingFee: import("convex/values").VFloat64<number, "required">;
21
+ amountDue: import("convex/values").VFloat64<number, "required">;
22
+ revision: import("convex/values").VFloat64<number, "required">;
23
+ };
24
+ export declare const claimFields: {
25
+ accountId: import("convex/values").VString<string, "required">;
26
+ scopeKey: import("convex/values").VString<string, "required">;
27
+ currency: import("convex/values").VString<string, "required">;
28
+ claimKey: import("convex/values").VString<string, "required">;
29
+ sourceChargeId: import("convex/values").VString<string, "required">;
30
+ sourceGross: import("convex/values").VFloat64<number, "required">;
31
+ sourceProcessingFee: import("convex/values").VFloat64<number, "required">;
32
+ amountDue: import("convex/values").VFloat64<number, "required">;
33
+ revision: import("convex/values").VFloat64<number, "required">;
34
+ collectedAmount: import("convex/values").VFloat64<number, "required">;
35
+ reservedAmount: import("convex/values").VFloat64<number, "required">;
36
+ outstanding: import("convex/values").VFloat64<number, "required">;
37
+ sign: import("convex/values").VUnion<"negative" | "positive" | "zero", [import("convex/values").VLiteral<"positive", "required">, import("convex/values").VLiteral<"negative", "required">, import("convex/values").VLiteral<"zero", "required">], "required", never>;
38
+ };
39
+ export declare const claimDoc: import("convex/values").VObject<{
40
+ _creationTime: number;
41
+ _id: import("convex/values").GenericId<"recoveryClaims">;
42
+ accountId: string;
43
+ amountDue: number;
44
+ claimKey: string;
45
+ collectedAmount: number;
46
+ currency: string;
47
+ outstanding: number;
48
+ reservedAmount: number;
49
+ revision: number;
50
+ scopeKey: string;
51
+ sign: "negative" | "positive" | "zero";
52
+ sourceChargeId: string;
53
+ sourceGross: number;
54
+ sourceProcessingFee: number;
55
+ }, {
56
+ accountId: import("convex/values").VString<string, "required">;
57
+ scopeKey: import("convex/values").VString<string, "required">;
58
+ currency: import("convex/values").VString<string, "required">;
59
+ claimKey: import("convex/values").VString<string, "required">;
60
+ sourceChargeId: import("convex/values").VString<string, "required">;
61
+ sourceGross: import("convex/values").VFloat64<number, "required">;
62
+ sourceProcessingFee: import("convex/values").VFloat64<number, "required">;
63
+ amountDue: import("convex/values").VFloat64<number, "required">;
64
+ revision: import("convex/values").VFloat64<number, "required">;
65
+ collectedAmount: import("convex/values").VFloat64<number, "required">;
66
+ reservedAmount: import("convex/values").VFloat64<number, "required">;
67
+ outstanding: import("convex/values").VFloat64<number, "required">;
68
+ sign: import("convex/values").VUnion<"negative" | "positive" | "zero", [import("convex/values").VLiteral<"positive", "required">, import("convex/values").VLiteral<"negative", "required">, import("convex/values").VLiteral<"zero", "required">], "required", never>;
69
+ _id: import("convex/values").VId<import("convex/values").GenericId<"recoveryClaims">, "required">;
70
+ _creationTime: import("convex/values").VFloat64<number, "required">;
71
+ }, "required", "_creationTime" | "_id" | "accountId" | "amountDue" | "claimKey" | "collectedAmount" | "currency" | "outstanding" | "reservedAmount" | "revision" | "scopeKey" | "sign" | "sourceChargeId" | "sourceGross" | "sourceProcessingFee">;
72
+ export declare const balanceFields: {
73
+ accountId: import("convex/values").VString<string, "required">;
74
+ scopeKey: import("convex/values").VString<string, "required">;
75
+ currency: import("convex/values").VString<string, "required">;
76
+ amountDue: import("convex/values").VFloat64<number, "required">;
77
+ collectedAmount: import("convex/values").VFloat64<number, "required">;
78
+ reservedAmount: import("convex/values").VFloat64<number, "required">;
79
+ outstanding: import("convex/values").VFloat64<number, "required">;
80
+ activeGroupKey: import("convex/values").VString<string | undefined, "optional">;
81
+ };
82
+ export declare const groupInput: {
83
+ accountId: import("convex/values").VString<string, "required">;
84
+ scopeKey: import("convex/values").VString<string, "required">;
85
+ currency: import("convex/values").VString<string, "required">;
86
+ groupKey: import("convex/values").VString<string, "required">;
87
+ sourceKind: import("convex/values").VUnion<"invoice" | "settlement", [import("convex/values").VLiteral<"settlement", "required">, import("convex/values").VLiteral<"invoice", "required">], "required", never>;
88
+ sourceId: import("convex/values").VString<string, "required">;
89
+ sourceGross: import("convex/values").VFloat64<number | undefined, "optional">;
90
+ sourceProcessingFee: import("convex/values").VFloat64<number | undefined, "optional">;
91
+ maxDebit: import("convex/values").VFloat64<number, "required">;
92
+ maxCredit: import("convex/values").VFloat64<number, "required">;
93
+ };
94
+ export declare const groupFields: {
95
+ accountId: import("convex/values").VString<string, "required">;
96
+ scopeKey: import("convex/values").VString<string, "required">;
97
+ currency: import("convex/values").VString<string, "required">;
98
+ groupKey: import("convex/values").VString<string, "required">;
99
+ sourceKind: import("convex/values").VUnion<"invoice" | "settlement", [import("convex/values").VLiteral<"settlement", "required">, import("convex/values").VLiteral<"invoice", "required">], "required", never>;
100
+ sourceId: import("convex/values").VString<string, "required">;
101
+ sourceGross: import("convex/values").VFloat64<number | undefined, "optional">;
102
+ sourceProcessingFee: import("convex/values").VFloat64<number | undefined, "optional">;
103
+ maxDebit: import("convex/values").VFloat64<number, "required">;
104
+ maxCredit: import("convex/values").VFloat64<number, "required">;
105
+ amount: import("convex/values").VFloat64<number, "required">;
106
+ pendingOperations: import("convex/values").VFloat64<number, "required">;
107
+ status: import("convex/values").VUnion<"collected" | "collecting" | "open" | "released" | "releasing" | "sealed", [import("convex/values").VLiteral<"open", "required">, import("convex/values").VLiteral<"sealed", "required">, import("convex/values").VLiteral<"collecting", "required">, import("convex/values").VLiteral<"releasing", "required">, import("convex/values").VLiteral<"collected", "required">, import("convex/values").VLiteral<"released", "required">], "required", never>;
108
+ };
109
+ export declare const groupDoc: import("convex/values").VObject<{
110
+ _creationTime: number;
111
+ _id: import("convex/values").GenericId<"recoveryGroups">;
112
+ accountId: string;
113
+ amount: number;
114
+ currency: string;
115
+ groupKey: string;
116
+ maxCredit: number;
117
+ maxDebit: number;
118
+ pendingOperations: number;
119
+ scopeKey: string;
120
+ sourceGross?: number | undefined;
121
+ sourceId: string;
122
+ sourceKind: "invoice" | "settlement";
123
+ sourceProcessingFee?: number | undefined;
124
+ status: "collected" | "collecting" | "open" | "released" | "releasing" | "sealed";
125
+ }, {
126
+ accountId: import("convex/values").VString<string, "required">;
127
+ scopeKey: import("convex/values").VString<string, "required">;
128
+ currency: import("convex/values").VString<string, "required">;
129
+ groupKey: import("convex/values").VString<string, "required">;
130
+ sourceKind: import("convex/values").VUnion<"invoice" | "settlement", [import("convex/values").VLiteral<"settlement", "required">, import("convex/values").VLiteral<"invoice", "required">], "required", never>;
131
+ sourceId: import("convex/values").VString<string, "required">;
132
+ sourceGross: import("convex/values").VFloat64<number | undefined, "optional">;
133
+ sourceProcessingFee: import("convex/values").VFloat64<number | undefined, "optional">;
134
+ maxDebit: import("convex/values").VFloat64<number, "required">;
135
+ maxCredit: import("convex/values").VFloat64<number, "required">;
136
+ amount: import("convex/values").VFloat64<number, "required">;
137
+ pendingOperations: import("convex/values").VFloat64<number, "required">;
138
+ status: import("convex/values").VUnion<"collected" | "collecting" | "open" | "released" | "releasing" | "sealed", [import("convex/values").VLiteral<"open", "required">, import("convex/values").VLiteral<"sealed", "required">, import("convex/values").VLiteral<"collecting", "required">, import("convex/values").VLiteral<"releasing", "required">, import("convex/values").VLiteral<"collected", "required">, import("convex/values").VLiteral<"released", "required">], "required", never>;
139
+ _id: import("convex/values").VId<import("convex/values").GenericId<"recoveryGroups">, "required">;
140
+ _creationTime: import("convex/values").VFloat64<number, "required">;
141
+ }, "required", "_creationTime" | "_id" | "accountId" | "amount" | "currency" | "groupKey" | "maxCredit" | "maxDebit" | "pendingOperations" | "scopeKey" | "sourceGross" | "sourceId" | "sourceKind" | "sourceProcessingFee" | "status">;
142
+ export declare const reservationFields: {
143
+ operationKey: import("convex/values").VString<string, "required">;
144
+ groupKey: import("convex/values").VString<string, "required">;
145
+ amount: import("convex/values").VFloat64<number, "required">;
146
+ limit: import("convex/values").VFloat64<number, "required">;
147
+ allocations: import("convex/values").VArray<{
148
+ amount: number;
149
+ claimId: import("convex/values").GenericId<"recoveryClaims">;
150
+ claimKey: string;
151
+ }[], import("convex/values").VObject<{
152
+ amount: number;
153
+ claimId: import("convex/values").GenericId<"recoveryClaims">;
154
+ claimKey: string;
155
+ }, {
156
+ claimId: import("convex/values").VId<import("convex/values").GenericId<"recoveryClaims">, "required">;
157
+ claimKey: import("convex/values").VString<string, "required">;
158
+ amount: import("convex/values").VFloat64<number, "required">;
159
+ }, "required", "amount" | "claimId" | "claimKey">, "required">;
160
+ status: import("convex/values").VUnion<"collected" | "empty" | "released" | "reserved", [import("convex/values").VLiteral<"reserved", "required">, import("convex/values").VLiteral<"collected", "required">, import("convex/values").VLiteral<"released", "required">, import("convex/values").VLiteral<"empty", "required">], "required", never>;
161
+ };
162
+ export declare const reservationDoc: import("convex/values").VObject<{
163
+ _creationTime: number;
164
+ _id: import("convex/values").GenericId<"recoveryReservations">;
165
+ allocations: {
166
+ amount: number;
167
+ claimId: import("convex/values").GenericId<"recoveryClaims">;
168
+ claimKey: string;
169
+ }[];
170
+ amount: number;
171
+ groupKey: string;
172
+ limit: number;
173
+ operationKey: string;
174
+ status: "collected" | "empty" | "released" | "reserved";
175
+ }, {
176
+ operationKey: import("convex/values").VString<string, "required">;
177
+ groupKey: import("convex/values").VString<string, "required">;
178
+ amount: import("convex/values").VFloat64<number, "required">;
179
+ limit: import("convex/values").VFloat64<number, "required">;
180
+ allocations: import("convex/values").VArray<{
181
+ amount: number;
182
+ claimId: import("convex/values").GenericId<"recoveryClaims">;
183
+ claimKey: string;
184
+ }[], import("convex/values").VObject<{
185
+ amount: number;
186
+ claimId: import("convex/values").GenericId<"recoveryClaims">;
187
+ claimKey: string;
188
+ }, {
189
+ claimId: import("convex/values").VId<import("convex/values").GenericId<"recoveryClaims">, "required">;
190
+ claimKey: import("convex/values").VString<string, "required">;
191
+ amount: import("convex/values").VFloat64<number, "required">;
192
+ }, "required", "amount" | "claimId" | "claimKey">, "required">;
193
+ status: import("convex/values").VUnion<"collected" | "empty" | "released" | "reserved", [import("convex/values").VLiteral<"reserved", "required">, import("convex/values").VLiteral<"collected", "required">, import("convex/values").VLiteral<"released", "required">, import("convex/values").VLiteral<"empty", "required">], "required", never>;
194
+ _id: import("convex/values").VId<import("convex/values").GenericId<"recoveryReservations">, "required">;
195
+ _creationTime: import("convex/values").VFloat64<number, "required">;
196
+ }, "required", "_creationTime" | "_id" | "allocations" | "amount" | "groupKey" | "limit" | "operationKey" | "status">;
197
+ export declare const claimsTable: import("convex/server").TableDefinition<import("convex/values").VObject<{
198
+ accountId: string;
199
+ amountDue: number;
200
+ claimKey: string;
201
+ collectedAmount: number;
202
+ currency: string;
203
+ outstanding: number;
204
+ reservedAmount: number;
205
+ revision: number;
206
+ scopeKey: string;
207
+ sign: "negative" | "positive" | "zero";
208
+ sourceChargeId: string;
209
+ sourceGross: number;
210
+ sourceProcessingFee: number;
211
+ }, {
212
+ accountId: import("convex/values").VString<string, "required">;
213
+ scopeKey: import("convex/values").VString<string, "required">;
214
+ currency: import("convex/values").VString<string, "required">;
215
+ claimKey: import("convex/values").VString<string, "required">;
216
+ sourceChargeId: import("convex/values").VString<string, "required">;
217
+ sourceGross: import("convex/values").VFloat64<number, "required">;
218
+ sourceProcessingFee: import("convex/values").VFloat64<number, "required">;
219
+ amountDue: import("convex/values").VFloat64<number, "required">;
220
+ revision: import("convex/values").VFloat64<number, "required">;
221
+ collectedAmount: import("convex/values").VFloat64<number, "required">;
222
+ reservedAmount: import("convex/values").VFloat64<number, "required">;
223
+ outstanding: import("convex/values").VFloat64<number, "required">;
224
+ sign: import("convex/values").VUnion<"negative" | "positive" | "zero", [import("convex/values").VLiteral<"positive", "required">, import("convex/values").VLiteral<"negative", "required">, import("convex/values").VLiteral<"zero", "required">], "required", never>;
225
+ }, "required", "accountId" | "amountDue" | "claimKey" | "collectedAmount" | "currency" | "outstanding" | "reservedAmount" | "revision" | "scopeKey" | "sign" | "sourceChargeId" | "sourceGross" | "sourceProcessingFee">, {
226
+ by_key: ["claimKey", "_creationTime"];
227
+ by_scope: ["accountId", "scopeKey", "currency", "_creationTime"];
228
+ by_sign: ["accountId", "scopeKey", "currency", "sign", "_creationTime"];
229
+ }, {}, {}>;
230
+ export declare const balancesTable: import("convex/server").TableDefinition<import("convex/values").VObject<{
231
+ accountId: string;
232
+ activeGroupKey?: string | undefined;
233
+ amountDue: number;
234
+ collectedAmount: number;
235
+ currency: string;
236
+ outstanding: number;
237
+ reservedAmount: number;
238
+ scopeKey: string;
239
+ }, {
240
+ accountId: import("convex/values").VString<string, "required">;
241
+ scopeKey: import("convex/values").VString<string, "required">;
242
+ currency: import("convex/values").VString<string, "required">;
243
+ amountDue: import("convex/values").VFloat64<number, "required">;
244
+ collectedAmount: import("convex/values").VFloat64<number, "required">;
245
+ reservedAmount: import("convex/values").VFloat64<number, "required">;
246
+ outstanding: import("convex/values").VFloat64<number, "required">;
247
+ activeGroupKey: import("convex/values").VString<string | undefined, "optional">;
248
+ }, "required", "accountId" | "activeGroupKey" | "amountDue" | "collectedAmount" | "currency" | "outstanding" | "reservedAmount" | "scopeKey">, {
249
+ by_scope: ["accountId", "scopeKey", "currency", "_creationTime"];
250
+ }, {}, {}>;
251
+ export declare const groupsTable: import("convex/server").TableDefinition<import("convex/values").VObject<{
252
+ accountId: string;
253
+ amount: number;
254
+ currency: string;
255
+ groupKey: string;
256
+ maxCredit: number;
257
+ maxDebit: number;
258
+ pendingOperations: number;
259
+ scopeKey: string;
260
+ sourceGross?: number | undefined;
261
+ sourceId: string;
262
+ sourceKind: "invoice" | "settlement";
263
+ sourceProcessingFee?: number | undefined;
264
+ status: "collected" | "collecting" | "open" | "released" | "releasing" | "sealed";
265
+ }, {
266
+ accountId: import("convex/values").VString<string, "required">;
267
+ scopeKey: import("convex/values").VString<string, "required">;
268
+ currency: import("convex/values").VString<string, "required">;
269
+ groupKey: import("convex/values").VString<string, "required">;
270
+ sourceKind: import("convex/values").VUnion<"invoice" | "settlement", [import("convex/values").VLiteral<"settlement", "required">, import("convex/values").VLiteral<"invoice", "required">], "required", never>;
271
+ sourceId: import("convex/values").VString<string, "required">;
272
+ sourceGross: import("convex/values").VFloat64<number | undefined, "optional">;
273
+ sourceProcessingFee: import("convex/values").VFloat64<number | undefined, "optional">;
274
+ maxDebit: import("convex/values").VFloat64<number, "required">;
275
+ maxCredit: import("convex/values").VFloat64<number, "required">;
276
+ amount: import("convex/values").VFloat64<number, "required">;
277
+ pendingOperations: import("convex/values").VFloat64<number, "required">;
278
+ status: import("convex/values").VUnion<"collected" | "collecting" | "open" | "released" | "releasing" | "sealed", [import("convex/values").VLiteral<"open", "required">, import("convex/values").VLiteral<"sealed", "required">, import("convex/values").VLiteral<"collecting", "required">, import("convex/values").VLiteral<"releasing", "required">, import("convex/values").VLiteral<"collected", "required">, import("convex/values").VLiteral<"released", "required">], "required", never>;
279
+ }, "required", "accountId" | "amount" | "currency" | "groupKey" | "maxCredit" | "maxDebit" | "pendingOperations" | "scopeKey" | "sourceGross" | "sourceId" | "sourceKind" | "sourceProcessingFee" | "status">, {
280
+ by_key: ["groupKey", "_creationTime"];
281
+ }, {}, {}>;
282
+ export declare const reservationsTable: import("convex/server").TableDefinition<import("convex/values").VObject<{
283
+ allocations: {
284
+ amount: number;
285
+ claimId: import("convex/values").GenericId<"recoveryClaims">;
286
+ claimKey: string;
287
+ }[];
288
+ amount: number;
289
+ groupKey: string;
290
+ limit: number;
291
+ operationKey: string;
292
+ status: "collected" | "empty" | "released" | "reserved";
293
+ }, {
294
+ operationKey: import("convex/values").VString<string, "required">;
295
+ groupKey: import("convex/values").VString<string, "required">;
296
+ amount: import("convex/values").VFloat64<number, "required">;
297
+ limit: import("convex/values").VFloat64<number, "required">;
298
+ allocations: import("convex/values").VArray<{
299
+ amount: number;
300
+ claimId: import("convex/values").GenericId<"recoveryClaims">;
301
+ claimKey: string;
302
+ }[], import("convex/values").VObject<{
303
+ amount: number;
304
+ claimId: import("convex/values").GenericId<"recoveryClaims">;
305
+ claimKey: string;
306
+ }, {
307
+ claimId: import("convex/values").VId<import("convex/values").GenericId<"recoveryClaims">, "required">;
308
+ claimKey: import("convex/values").VString<string, "required">;
309
+ amount: import("convex/values").VFloat64<number, "required">;
310
+ }, "required", "amount" | "claimId" | "claimKey">, "required">;
311
+ status: import("convex/values").VUnion<"collected" | "empty" | "released" | "reserved", [import("convex/values").VLiteral<"reserved", "required">, import("convex/values").VLiteral<"collected", "required">, import("convex/values").VLiteral<"released", "required">, import("convex/values").VLiteral<"empty", "required">], "required", never>;
312
+ }, "required", "allocations" | "amount" | "groupKey" | "limit" | "operationKey" | "status">, {
313
+ by_group_status: ["groupKey", "status", "_creationTime"];
314
+ by_key: ["operationKey", "_creationTime"];
315
+ }, {}, {}>;
316
+ export declare const reserveArgs: {
317
+ accountId: import("convex/values").VString<string, "required">;
318
+ scopeKey: import("convex/values").VString<string, "required">;
319
+ currency: import("convex/values").VString<string, "required">;
320
+ groupKey: import("convex/values").VString<string, "required">;
321
+ sourceKind: import("convex/values").VUnion<"invoice" | "settlement", [import("convex/values").VLiteral<"settlement", "required">, import("convex/values").VLiteral<"invoice", "required">], "required", never>;
322
+ sourceId: import("convex/values").VString<string, "required">;
323
+ sourceGross: import("convex/values").VFloat64<number | undefined, "optional">;
324
+ sourceProcessingFee: import("convex/values").VFloat64<number | undefined, "optional">;
325
+ maxDebit: import("convex/values").VFloat64<number, "required">;
326
+ maxCredit: import("convex/values").VFloat64<number, "required">;
327
+ operationKey: import("convex/values").VString<string, "required">;
328
+ limit: import("convex/values").VFloat64<number | undefined, "optional">;
329
+ };
330
+ export declare const finishArgs: {
331
+ groupKey: import("convex/values").VString<string, "required">;
332
+ outcome: import("convex/values").VUnion<"collect" | "release", [import("convex/values").VLiteral<"collect", "required">, import("convex/values").VLiteral<"release", "required">], "required", never>;
333
+ limit: import("convex/values").VFloat64<number | undefined, "optional">;
334
+ };
335
+ export declare const rollbackArgs: {
336
+ groupKey: import("convex/values").VString<string, "required">;
337
+ returnedPrincipal: import("convex/values").VFloat64<number, "required">;
338
+ revision: import("convex/values").VFloat64<number, "required">;
339
+ };
340
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/component/costRecovery/schema.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW;IACtB,SAAS;IACT,QAAQ;IACR,QAAQ;CACT,CAAC;AACF,eAAO,MAAM,YAAY;IACvB,SAAS;IACT,eAAe;IACf,cAAc;IACd,WAAW;CACZ,CAAC;AACF,eAAO,MAAM,aAAa,iQAIzB,CAAC;AACF,eAAO,MAAM,iBAAiB;;;;;;;;;;CAQ7B,CAAC;AACF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;CAMvB,CAAC;AACF,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kPAInB,CAAC;AACH,eAAO,MAAM,aAAa;;;;;;;;;CAIzB,CAAC;AACF,eAAO,MAAM,UAAU;;;;;;;;;;;CAStB,CAAC;AACF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;CAYvB,CAAC;AACF,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uOAInB,CAAC;AACH,eAAO,MAAM,iBAAiB;IAC5B,YAAY;IACZ,QAAQ;IACR,MAAM;IACN,KAAK;IACL,WAAW;;;;;;;;;;;;;IAOX,MAAM;CAMP,CAAC;AACF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qHAIzB,CAAC;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAG0C,CAAC;AACnE,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;UAIxB,CAAC;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAEtB,CAAC;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAEqB,CAAC;AAEpD,eAAO,MAAM,WAAW;;;;;;;;;;;;;CAIvB,CAAC;AACF,eAAO,MAAM,UAAU;IACrB,QAAQ;IACR,OAAO;IACP,KAAK;CACN,CAAC;AACF,eAAO,MAAM,YAAY;IACvB,QAAQ;IACR,iBAAiB;IACjB,QAAQ;CACT,CAAC"}
@@ -0,0 +1,109 @@
1
+ import { defineTable } from "convex/server";
2
+ import { v } from "convex/values";
3
+ export const scopeFields = {
4
+ accountId: v.string(),
5
+ scopeKey: v.string(),
6
+ currency: v.string(),
7
+ };
8
+ export const totalsFields = {
9
+ amountDue: v.number(),
10
+ collectedAmount: v.number(),
11
+ reservedAmount: v.number(),
12
+ outstanding: v.number(),
13
+ };
14
+ export const signValidator = v.union(v.literal("positive"), v.literal("negative"), v.literal("zero"));
15
+ export const observationFields = {
16
+ ...scopeFields,
17
+ claimKey: v.string(),
18
+ sourceChargeId: v.string(),
19
+ sourceGross: v.number(),
20
+ sourceProcessingFee: v.number(),
21
+ amountDue: v.number(),
22
+ revision: v.number(),
23
+ };
24
+ export const claimFields = {
25
+ ...observationFields,
26
+ collectedAmount: v.number(),
27
+ reservedAmount: v.number(),
28
+ outstanding: v.number(),
29
+ sign: signValidator,
30
+ };
31
+ export const claimDoc = v.object({
32
+ ...claimFields,
33
+ _id: v.id("recoveryClaims"),
34
+ _creationTime: v.number(),
35
+ });
36
+ export const balanceFields = {
37
+ ...scopeFields,
38
+ ...totalsFields,
39
+ activeGroupKey: v.optional(v.string()),
40
+ };
41
+ export const groupInput = {
42
+ ...scopeFields,
43
+ groupKey: v.string(),
44
+ sourceKind: v.union(v.literal("settlement"), v.literal("invoice")),
45
+ sourceId: v.string(),
46
+ sourceGross: v.optional(v.number()),
47
+ sourceProcessingFee: v.optional(v.number()),
48
+ maxDebit: v.number(),
49
+ maxCredit: v.number(),
50
+ };
51
+ export const groupFields = {
52
+ ...groupInput,
53
+ amount: v.number(),
54
+ pendingOperations: v.number(),
55
+ status: v.union(v.literal("open"), v.literal("sealed"), v.literal("collecting"), v.literal("releasing"), v.literal("collected"), v.literal("released")),
56
+ };
57
+ export const groupDoc = v.object({
58
+ ...groupFields,
59
+ _id: v.id("recoveryGroups"),
60
+ _creationTime: v.number(),
61
+ });
62
+ export const reservationFields = {
63
+ operationKey: v.string(),
64
+ groupKey: v.string(),
65
+ amount: v.number(),
66
+ limit: v.number(),
67
+ allocations: v.array(v.object({
68
+ claimId: v.id("recoveryClaims"),
69
+ claimKey: v.string(),
70
+ amount: v.number(),
71
+ })),
72
+ status: v.union(v.literal("reserved"), v.literal("collected"), v.literal("released"), v.literal("empty")),
73
+ };
74
+ export const reservationDoc = v.object({
75
+ ...reservationFields,
76
+ _id: v.id("recoveryReservations"),
77
+ _creationTime: v.number(),
78
+ });
79
+ export const claimsTable = defineTable(claimFields)
80
+ .index("by_key", ["claimKey"])
81
+ .index("by_scope", ["accountId", "scopeKey", "currency"])
82
+ .index("by_sign", ["accountId", "scopeKey", "currency", "sign"]);
83
+ export const balancesTable = defineTable(balanceFields).index("by_scope", [
84
+ "accountId",
85
+ "scopeKey",
86
+ "currency",
87
+ ]);
88
+ export const groupsTable = defineTable(groupFields).index("by_key", [
89
+ "groupKey",
90
+ ]);
91
+ export const reservationsTable = defineTable(reservationFields)
92
+ .index("by_key", ["operationKey"])
93
+ .index("by_group_status", ["groupKey", "status"]);
94
+ export const reserveArgs = {
95
+ ...groupInput,
96
+ operationKey: v.string(),
97
+ limit: v.optional(v.number()),
98
+ };
99
+ export const finishArgs = {
100
+ groupKey: v.string(),
101
+ outcome: v.union(v.literal("collect"), v.literal("release")),
102
+ limit: v.optional(v.number()),
103
+ };
104
+ export const rollbackArgs = {
105
+ groupKey: v.string(),
106
+ returnedPrincipal: v.number(),
107
+ revision: v.number(),
108
+ };
109
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/component/costRecovery/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;CACrB,CAAC;AACF,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE;IAC3B,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;IAC1B,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;CACxB,CAAC;AACF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAClC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,EACrB,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,EACrB,CAAC,CAAC,OAAO,CAAC,MAAM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AAW,GAAG;IACzB,GAAG,UAAU;IACb,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;IACxB,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;CAC9B,CAAC;AACF,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAC5D,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;CAC9B,CAAC;AACF,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE;IAC7B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;CACrB,CAAC"}
@@ -1,4 +1,123 @@
1
1
  declare const _default: import("convex/server").SchemaDefinition<{
2
+ recoveryClaims: import("convex/server").TableDefinition<import("convex/values").VObject<{
3
+ accountId: string;
4
+ amountDue: number;
5
+ claimKey: string;
6
+ collectedAmount: number;
7
+ currency: string;
8
+ outstanding: number;
9
+ reservedAmount: number;
10
+ revision: number;
11
+ scopeKey: string;
12
+ sign: "negative" | "positive" | "zero";
13
+ sourceChargeId: string;
14
+ sourceGross: number;
15
+ sourceProcessingFee: number;
16
+ }, {
17
+ accountId: import("convex/values").VString<string, "required">;
18
+ scopeKey: import("convex/values").VString<string, "required">;
19
+ currency: import("convex/values").VString<string, "required">;
20
+ claimKey: import("convex/values").VString<string, "required">;
21
+ sourceChargeId: import("convex/values").VString<string, "required">;
22
+ sourceGross: import("convex/values").VFloat64<number, "required">;
23
+ sourceProcessingFee: import("convex/values").VFloat64<number, "required">;
24
+ amountDue: import("convex/values").VFloat64<number, "required">;
25
+ revision: import("convex/values").VFloat64<number, "required">;
26
+ collectedAmount: import("convex/values").VFloat64<number, "required">;
27
+ reservedAmount: import("convex/values").VFloat64<number, "required">;
28
+ outstanding: import("convex/values").VFloat64<number, "required">;
29
+ sign: import("convex/values").VUnion<"negative" | "positive" | "zero", [import("convex/values").VLiteral<"positive", "required">, import("convex/values").VLiteral<"negative", "required">, import("convex/values").VLiteral<"zero", "required">], "required", never>;
30
+ }, "required", "accountId" | "amountDue" | "claimKey" | "collectedAmount" | "currency" | "outstanding" | "reservedAmount" | "revision" | "scopeKey" | "sign" | "sourceChargeId" | "sourceGross" | "sourceProcessingFee">, {
31
+ by_key: ["claimKey", "_creationTime"];
32
+ by_scope: ["accountId", "scopeKey", "currency", "_creationTime"];
33
+ by_sign: ["accountId", "scopeKey", "currency", "sign", "_creationTime"];
34
+ }, {}, {}>;
35
+ recoveryBalances: import("convex/server").TableDefinition<import("convex/values").VObject<{
36
+ accountId: string;
37
+ activeGroupKey?: string | undefined;
38
+ amountDue: number;
39
+ collectedAmount: number;
40
+ currency: string;
41
+ outstanding: number;
42
+ reservedAmount: number;
43
+ scopeKey: string;
44
+ }, {
45
+ accountId: import("convex/values").VString<string, "required">;
46
+ scopeKey: import("convex/values").VString<string, "required">;
47
+ currency: import("convex/values").VString<string, "required">;
48
+ amountDue: import("convex/values").VFloat64<number, "required">;
49
+ collectedAmount: import("convex/values").VFloat64<number, "required">;
50
+ reservedAmount: import("convex/values").VFloat64<number, "required">;
51
+ outstanding: import("convex/values").VFloat64<number, "required">;
52
+ activeGroupKey: import("convex/values").VString<string | undefined, "optional">;
53
+ }, "required", "accountId" | "activeGroupKey" | "amountDue" | "collectedAmount" | "currency" | "outstanding" | "reservedAmount" | "scopeKey">, {
54
+ by_scope: ["accountId", "scopeKey", "currency", "_creationTime"];
55
+ }, {}, {}>;
56
+ recoveryGroups: import("convex/server").TableDefinition<import("convex/values").VObject<{
57
+ accountId: string;
58
+ amount: number;
59
+ currency: string;
60
+ groupKey: string;
61
+ maxCredit: number;
62
+ maxDebit: number;
63
+ pendingOperations: number;
64
+ scopeKey: string;
65
+ sourceGross?: number | undefined;
66
+ sourceId: string;
67
+ sourceKind: "invoice" | "settlement";
68
+ sourceProcessingFee?: number | undefined;
69
+ status: "collected" | "collecting" | "open" | "released" | "releasing" | "sealed";
70
+ }, {
71
+ accountId: import("convex/values").VString<string, "required">;
72
+ scopeKey: import("convex/values").VString<string, "required">;
73
+ currency: import("convex/values").VString<string, "required">;
74
+ groupKey: import("convex/values").VString<string, "required">;
75
+ sourceKind: import("convex/values").VUnion<"invoice" | "settlement", [import("convex/values").VLiteral<"settlement", "required">, import("convex/values").VLiteral<"invoice", "required">], "required", never>;
76
+ sourceId: import("convex/values").VString<string, "required">;
77
+ sourceGross: import("convex/values").VFloat64<number | undefined, "optional">;
78
+ sourceProcessingFee: import("convex/values").VFloat64<number | undefined, "optional">;
79
+ maxDebit: import("convex/values").VFloat64<number, "required">;
80
+ maxCredit: import("convex/values").VFloat64<number, "required">;
81
+ amount: import("convex/values").VFloat64<number, "required">;
82
+ pendingOperations: import("convex/values").VFloat64<number, "required">;
83
+ status: import("convex/values").VUnion<"collected" | "collecting" | "open" | "released" | "releasing" | "sealed", [import("convex/values").VLiteral<"open", "required">, import("convex/values").VLiteral<"sealed", "required">, import("convex/values").VLiteral<"collecting", "required">, import("convex/values").VLiteral<"releasing", "required">, import("convex/values").VLiteral<"collected", "required">, import("convex/values").VLiteral<"released", "required">], "required", never>;
84
+ }, "required", "accountId" | "amount" | "currency" | "groupKey" | "maxCredit" | "maxDebit" | "pendingOperations" | "scopeKey" | "sourceGross" | "sourceId" | "sourceKind" | "sourceProcessingFee" | "status">, {
85
+ by_key: ["groupKey", "_creationTime"];
86
+ }, {}, {}>;
87
+ recoveryReservations: import("convex/server").TableDefinition<import("convex/values").VObject<{
88
+ allocations: {
89
+ amount: number;
90
+ claimId: import("convex/values").GenericId<"recoveryClaims">;
91
+ claimKey: string;
92
+ }[];
93
+ amount: number;
94
+ groupKey: string;
95
+ limit: number;
96
+ operationKey: string;
97
+ status: "collected" | "empty" | "released" | "reserved";
98
+ }, {
99
+ operationKey: import("convex/values").VString<string, "required">;
100
+ groupKey: import("convex/values").VString<string, "required">;
101
+ amount: import("convex/values").VFloat64<number, "required">;
102
+ limit: import("convex/values").VFloat64<number, "required">;
103
+ allocations: import("convex/values").VArray<{
104
+ amount: number;
105
+ claimId: import("convex/values").GenericId<"recoveryClaims">;
106
+ claimKey: string;
107
+ }[], import("convex/values").VObject<{
108
+ amount: number;
109
+ claimId: import("convex/values").GenericId<"recoveryClaims">;
110
+ claimKey: string;
111
+ }, {
112
+ claimId: import("convex/values").VId<import("convex/values").GenericId<"recoveryClaims">, "required">;
113
+ claimKey: import("convex/values").VString<string, "required">;
114
+ amount: import("convex/values").VFloat64<number, "required">;
115
+ }, "required", "amount" | "claimId" | "claimKey">, "required">;
116
+ status: import("convex/values").VUnion<"collected" | "empty" | "released" | "reserved", [import("convex/values").VLiteral<"reserved", "required">, import("convex/values").VLiteral<"collected", "required">, import("convex/values").VLiteral<"released", "required">, import("convex/values").VLiteral<"empty", "required">], "required", never>;
117
+ }, "required", "allocations" | "amount" | "groupKey" | "limit" | "operationKey" | "status">, {
118
+ by_group_status: ["groupKey", "status", "_creationTime"];
119
+ by_key: ["operationKey", "_creationTime"];
120
+ }, {}, {}>;
2
121
  settlementAllocations: import("convex/server").TableDefinition<import("convex/values").VObject<{
3
122
  adjustmentAmount?: number | undefined;
4
123
  currency: string;
@@ -1,3 +1,4 @@
1
+ import { claimsTable, balancesTable, groupsTable, reservationsTable, } from "./costRecovery/schema";
1
2
  import { allocationsTable, commissionTermsTable, commissionDecisionsTable, } from "./settlement/schema";
2
3
  import { defineSchema } from "convex/server";
3
4
  import { checkoutSessionsTable, invoicesTable, subscriptionsTable, } from "./billing/schema";
@@ -6,6 +7,10 @@ import { accountsTable } from "./core/schema";
6
7
  import { pricesTable, productsTable } from "./products/schema";
7
8
  import { webhookEventsTable } from "./webhooks/schema";
8
9
  export default defineSchema({
10
+ recoveryClaims: claimsTable,
11
+ recoveryBalances: balancesTable,
12
+ recoveryGroups: groupsTable,
13
+ recoveryReservations: reservationsTable,
9
14
  settlementAllocations: allocationsTable,
10
15
  commissionTerms: commissionTermsTable,
11
16
  commissionDecisions: commissionDecisionsTable,