@fantastic.dev/better-stripe 0.34.0 → 0.35.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 (258) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +1 -1
  3. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +486 -2
  4. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts.map +1 -1
  5. package/dist/client/connect/payoutExecutionTestHelpers.d.ts +243 -1
  6. package/dist/client/connect/payoutExecutionTestHelpers.d.ts.map +1 -1
  7. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +486 -2
  8. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts.map +1 -1
  9. package/dist/client/connect/payoutSyncTestHelpers.d.ts +243 -1
  10. package/dist/client/connect/payoutSyncTestHelpers.d.ts.map +1 -1
  11. package/dist/client/connect/refundCommandEvidence.d.ts +14 -0
  12. package/dist/client/connect/refundCommandEvidence.d.ts.map +1 -0
  13. package/dist/client/connect/refundCommandEvidence.js +20 -0
  14. package/dist/client/connect/refundCommandEvidence.js.map +1 -0
  15. package/dist/client/connect/refundCommandNormalization.d.ts +11 -0
  16. package/dist/client/connect/refundCommandNormalization.d.ts.map +1 -0
  17. package/dist/client/connect/refundCommandNormalization.js +12 -0
  18. package/dist/client/connect/refundCommandNormalization.js.map +1 -0
  19. package/dist/client/financialObservations.d.ts +42 -0
  20. package/dist/client/financialObservations.d.ts.map +1 -0
  21. package/dist/client/financialObservations.js +58 -0
  22. package/dist/client/financialObservations.js.map +1 -0
  23. package/dist/client/financialOwnership.d.ts +52 -0
  24. package/dist/client/financialOwnership.d.ts.map +1 -0
  25. package/dist/client/financialOwnership.js +72 -0
  26. package/dist/client/financialOwnership.js.map +1 -0
  27. package/dist/client/index.d.ts +2 -2
  28. package/dist/client/index.d.ts.map +1 -1
  29. package/dist/client/index.js +2 -2
  30. package/dist/client/index.js.map +1 -1
  31. package/dist/client/observationPagination.d.ts +10 -0
  32. package/dist/client/observationPagination.d.ts.map +1 -0
  33. package/dist/client/observationPagination.js +12 -0
  34. package/dist/client/observationPagination.js.map +1 -0
  35. package/dist/client/publicTypes.d.ts +5 -0
  36. package/dist/client/publicTypes.d.ts.map +1 -1
  37. package/dist/client/readContracts.d.ts +29 -0
  38. package/dist/client/readContracts.d.ts.map +1 -1
  39. package/dist/client/readContracts.js +10 -0
  40. package/dist/client/readContracts.js.map +1 -1
  41. package/dist/client/transferObservations.d.ts +59 -0
  42. package/dist/client/transferObservations.d.ts.map +1 -0
  43. package/dist/client/transferObservations.js +82 -0
  44. package/dist/client/transferObservations.js.map +1 -0
  45. package/dist/component/_generated/component.d.ts +506 -0
  46. package/dist/component/_generated/component.d.ts.map +1 -1
  47. package/dist/component/affiliateRecovery/mutations.d.ts.map +1 -1
  48. package/dist/component/affiliateRecovery/mutations.js +4 -1
  49. package/dist/component/affiliateRecovery/mutations.js.map +1 -1
  50. package/dist/component/connect/mutations.d.ts.map +1 -1
  51. package/dist/component/connect/mutations.js +18 -2
  52. package/dist/component/connect/mutations.js.map +1 -1
  53. package/dist/component/connect/queries.d.ts +8 -0
  54. package/dist/component/connect/queries.d.ts.map +1 -1
  55. package/dist/component/connect/reversalClaims.d.ts.map +1 -1
  56. package/dist/component/connect/reversalClaims.js +7 -1
  57. package/dist/component/connect/reversalClaims.js.map +1 -1
  58. package/dist/component/connect/reversalReceipts.d.ts.map +1 -1
  59. package/dist/component/connect/reversalReceipts.js +2 -0
  60. package/dist/component/connect/reversalReceipts.js.map +1 -1
  61. package/dist/component/connect/schema.d.ts +11 -1
  62. package/dist/component/connect/schema.d.ts.map +1 -1
  63. package/dist/component/connect/schema.js +9 -1
  64. package/dist/component/connect/schema.js.map +1 -1
  65. package/dist/component/connect/validators.d.ts +9 -1
  66. package/dist/component/connect/validators.d.ts.map +1 -1
  67. package/dist/component/connect/validators.js +2 -0
  68. package/dist/component/connect/validators.js.map +1 -1
  69. package/dist/component/earnings/triggers.d.ts +426 -2
  70. package/dist/component/earnings/triggers.d.ts.map +1 -1
  71. package/dist/component/earnings/triggers.js +7 -1
  72. package/dist/component/earnings/triggers.js.map +1 -1
  73. package/dist/component/financialObservations/continuation.d.ts +7 -0
  74. package/dist/component/financialObservations/continuation.d.ts.map +1 -0
  75. package/dist/component/financialObservations/continuation.js +131 -0
  76. package/dist/component/financialObservations/continuation.js.map +1 -0
  77. package/dist/component/financialObservations/generations.d.ts +6 -0
  78. package/dist/component/financialObservations/generations.d.ts.map +1 -0
  79. package/dist/component/financialObservations/generations.js +46 -0
  80. package/dist/component/financialObservations/generations.js.map +1 -0
  81. package/dist/component/financialObservations/mutations.d.ts +62 -0
  82. package/dist/component/financialObservations/mutations.d.ts.map +1 -0
  83. package/dist/component/financialObservations/mutations.js +69 -0
  84. package/dist/component/financialObservations/mutations.js.map +1 -0
  85. package/dist/component/financialObservations/queries.d.ts +307 -0
  86. package/dist/component/financialObservations/queries.d.ts.map +1 -0
  87. package/dist/component/financialObservations/queries.js +219 -0
  88. package/dist/component/financialObservations/queries.js.map +1 -0
  89. package/dist/component/financialObservations/schema.d.ts +182 -0
  90. package/dist/component/financialObservations/schema.d.ts.map +1 -0
  91. package/dist/component/financialObservations/schema.js +53 -0
  92. package/dist/component/financialObservations/schema.js.map +1 -0
  93. package/dist/component/financialObservations/settlement.d.ts +7 -0
  94. package/dist/component/financialObservations/settlement.d.ts.map +1 -0
  95. package/dist/component/financialObservations/settlement.js +118 -0
  96. package/dist/component/financialObservations/settlement.js.map +1 -0
  97. package/dist/component/financialObservations/settlementHelpers.d.ts +46 -0
  98. package/dist/component/financialObservations/settlementHelpers.d.ts.map +1 -0
  99. package/dist/component/financialObservations/settlementHelpers.js +70 -0
  100. package/dist/component/financialObservations/settlementHelpers.js.map +1 -0
  101. package/dist/component/financialObservations/transferBatches.d.ts +12 -0
  102. package/dist/component/financialObservations/transferBatches.d.ts.map +1 -0
  103. package/dist/component/financialObservations/transferBatches.js +76 -0
  104. package/dist/component/financialObservations/transferBatches.js.map +1 -0
  105. package/dist/component/financialObservations/transferContinuation.d.ts +5 -0
  106. package/dist/component/financialObservations/transferContinuation.d.ts.map +1 -0
  107. package/dist/component/financialObservations/transferContinuation.js +35 -0
  108. package/dist/component/financialObservations/transferContinuation.js.map +1 -0
  109. package/dist/component/financialObservations/transferContinuationState.d.ts +8 -0
  110. package/dist/component/financialObservations/transferContinuationState.d.ts.map +1 -0
  111. package/dist/component/financialObservations/transferContinuationState.js +69 -0
  112. package/dist/component/financialObservations/transferContinuationState.js.map +1 -0
  113. package/dist/component/financialObservations/transferContinuationSteps.d.ts +5 -0
  114. package/dist/component/financialObservations/transferContinuationSteps.d.ts.map +1 -0
  115. package/dist/component/financialObservations/transferContinuationSteps.js +174 -0
  116. package/dist/component/financialObservations/transferContinuationSteps.js.map +1 -0
  117. package/dist/component/financialObservations/transferHelpers.d.ts +18 -0
  118. package/dist/component/financialObservations/transferHelpers.d.ts.map +1 -0
  119. package/dist/component/financialObservations/transferHelpers.js +37 -0
  120. package/dist/component/financialObservations/transferHelpers.js.map +1 -0
  121. package/dist/component/financialObservations/transferReferenceSchema.d.ts +56 -0
  122. package/dist/component/financialObservations/transferReferenceSchema.d.ts.map +1 -0
  123. package/dist/component/financialObservations/transferReferenceSchema.js +21 -0
  124. package/dist/component/financialObservations/transferReferenceSchema.js.map +1 -0
  125. package/dist/component/financialObservations/transferSchema.d.ts +237 -0
  126. package/dist/component/financialObservations/transferSchema.d.ts.map +1 -0
  127. package/dist/component/financialObservations/transferSchema.js +65 -0
  128. package/dist/component/financialObservations/transferSchema.js.map +1 -0
  129. package/dist/component/financialObservations/transfers.d.ts +7 -0
  130. package/dist/component/financialObservations/transfers.d.ts.map +1 -0
  131. package/dist/component/financialObservations/transfers.js +79 -0
  132. package/dist/component/financialObservations/transfers.js.map +1 -0
  133. package/dist/component/financialOwnership/helpers.d.ts +37 -0
  134. package/dist/component/financialOwnership/helpers.d.ts.map +1 -0
  135. package/dist/component/financialOwnership/helpers.js +76 -0
  136. package/dist/component/financialOwnership/helpers.js.map +1 -0
  137. package/dist/component/financialOwnership/mutations.d.ts +28 -0
  138. package/dist/component/financialOwnership/mutations.d.ts.map +1 -0
  139. package/dist/component/financialOwnership/mutations.js +74 -0
  140. package/dist/component/financialOwnership/mutations.js.map +1 -0
  141. package/dist/component/financialOwnership/queries.d.ts +57 -0
  142. package/dist/component/financialOwnership/queries.d.ts.map +1 -0
  143. package/dist/component/financialOwnership/queries.js +50 -0
  144. package/dist/component/financialOwnership/queries.js.map +1 -0
  145. package/dist/component/financialOwnership/schema.d.ts +140 -0
  146. package/dist/component/financialOwnership/schema.d.ts.map +1 -0
  147. package/dist/component/financialOwnership/schema.js +35 -0
  148. package/dist/component/financialOwnership/schema.js.map +1 -0
  149. package/dist/component/payoutRelease/queries.d.ts +2 -2
  150. package/dist/component/payoutRelease/queries.d.ts.map +1 -1
  151. package/dist/component/refundHistory/commandBinding.d.ts +17 -0
  152. package/dist/component/refundHistory/commandBinding.d.ts.map +1 -0
  153. package/dist/component/refundHistory/commandBinding.js +41 -0
  154. package/dist/component/refundHistory/commandBinding.js.map +1 -0
  155. package/dist/component/refundHistory/commandEvidence.d.ts +50 -0
  156. package/dist/component/refundHistory/commandEvidence.d.ts.map +1 -0
  157. package/dist/component/refundHistory/commandEvidence.js +54 -0
  158. package/dist/component/refundHistory/commandEvidence.js.map +1 -0
  159. package/dist/component/refundHistory/commandEvidenceValidator.d.ts +89 -0
  160. package/dist/component/refundHistory/commandEvidenceValidator.d.ts.map +1 -0
  161. package/dist/component/refundHistory/commandEvidenceValidator.js +8 -0
  162. package/dist/component/refundHistory/commandEvidenceValidator.js.map +1 -0
  163. package/dist/component/refundHistory/commandFields.d.ts +8 -0
  164. package/dist/component/refundHistory/commandFields.d.ts.map +1 -0
  165. package/dist/component/refundHistory/commandFields.js +9 -0
  166. package/dist/component/refundHistory/commandFields.js.map +1 -0
  167. package/dist/component/refundHistory/mutations.d.ts +8 -0
  168. package/dist/component/refundHistory/mutations.d.ts.map +1 -0
  169. package/dist/component/refundHistory/mutations.js +25 -0
  170. package/dist/component/refundHistory/mutations.js.map +1 -0
  171. package/dist/component/refundHistory/queries.d.ts +51 -0
  172. package/dist/component/refundHistory/queries.d.ts.map +1 -1
  173. package/dist/component/refundHistory/queries.js +14 -0
  174. package/dist/component/refundHistory/queries.js.map +1 -1
  175. package/dist/component/schema.d.ts +243 -1
  176. package/dist/component/schema.js +12 -0
  177. package/dist/component/schema.js.map +1 -1
  178. package/dist/component/settlement/mutations.d.ts.map +1 -1
  179. package/dist/component/settlement/mutations.js +5 -1
  180. package/dist/component/settlement/mutations.js.map +1 -1
  181. package/dist/shared/refundCommandScope.d.ts +10 -0
  182. package/dist/shared/refundCommandScope.d.ts.map +1 -0
  183. package/dist/shared/refundCommandScope.js +9 -0
  184. package/dist/shared/refundCommandScope.js.map +1 -0
  185. package/docs/financial-observations.md +159 -0
  186. package/docs/financial-ownership.md +54 -0
  187. package/docs/refund-command-evidence.md +49 -0
  188. package/package.json +5 -2
  189. package/src/client/connect/refundCommandEvidence.ts +41 -0
  190. package/src/client/connect/refundCommandNormalization.ts +28 -0
  191. package/src/client/financialObservations.test.ts +109 -0
  192. package/src/client/financialObservations.ts +106 -0
  193. package/src/client/financialOwnership.test.ts +80 -0
  194. package/src/client/financialOwnership.ts +116 -0
  195. package/src/client/index.ts +2 -2
  196. package/src/client/observationPagination.ts +11 -0
  197. package/src/client/publicTypes.ts +37 -0
  198. package/src/client/readContracts.ts +21 -0
  199. package/src/client/refund-command-evidence.test.ts +68 -0
  200. package/src/client/refund-command-normalization.test.ts +61 -0
  201. package/src/client/transferContinuation.test.ts +94 -0
  202. package/src/client/transferObservations.test.ts +98 -0
  203. package/src/client/transferObservations.ts +180 -0
  204. package/src/component/_generated/api.ts +44 -0
  205. package/src/component/_generated/component.ts +590 -0
  206. package/src/component/affiliateRecovery/mutations.ts +10 -1
  207. package/src/component/connect/mutations.ts +29 -2
  208. package/src/component/connect/reversalClaims.ts +19 -1
  209. package/src/component/connect/reversalReceipts.ts +2 -0
  210. package/src/component/connect/schema.ts +9 -1
  211. package/src/component/connect/validators.ts +2 -0
  212. package/src/component/core/reset.test.ts +8 -1
  213. package/src/component/earnings/earnings-totals.test.ts +14 -10
  214. package/src/component/earnings/triggers.ts +9 -1
  215. package/src/component/financialObservations/continuation.test.ts +445 -0
  216. package/src/component/financialObservations/continuation.ts +159 -0
  217. package/src/component/financialObservations/generations.ts +53 -0
  218. package/src/component/financialObservations/mutations.ts +75 -0
  219. package/src/component/financialObservations/observation-boundaries.test.ts +466 -0
  220. package/src/component/financialObservations/queries.ts +246 -0
  221. package/src/component/financialObservations/schema.ts +68 -0
  222. package/src/component/financialObservations/settlement-observations.test.ts +86 -0
  223. package/src/component/financialObservations/settlement.ts +142 -0
  224. package/src/component/financialObservations/settlementHelpers.ts +92 -0
  225. package/src/component/financialObservations/transfer-batches.test.ts +61 -0
  226. package/src/component/financialObservations/transfer-boundaries.test.ts +116 -0
  227. package/src/component/financialObservations/transfer-continuation-guards.test.ts +428 -0
  228. package/src/component/financialObservations/transfer-continuation.test.ts +154 -0
  229. package/src/component/financialObservations/transfer-observations.test.ts +212 -0
  230. package/src/component/financialObservations/transfer-overflow.test.ts +181 -0
  231. package/src/component/financialObservations/transfer-writers.test.ts +162 -0
  232. package/src/component/financialObservations/transferBatches.ts +96 -0
  233. package/src/component/financialObservations/transferContinuation.ts +53 -0
  234. package/src/component/financialObservations/transferContinuationState.ts +85 -0
  235. package/src/component/financialObservations/transferContinuationSteps.ts +232 -0
  236. package/src/component/financialObservations/transferHelpers.ts +38 -0
  237. package/src/component/financialObservations/transferReferenceSchema.ts +20 -0
  238. package/src/component/financialObservations/transferSchema.ts +74 -0
  239. package/src/component/financialObservations/transfers.ts +99 -0
  240. package/src/component/financialOwnership/financial-ownership.test.ts +102 -0
  241. package/src/component/financialOwnership/helpers.ts +98 -0
  242. package/src/component/financialOwnership/mutations.ts +83 -0
  243. package/src/component/financialOwnership/ownership-boundaries.test.ts +308 -0
  244. package/src/component/financialOwnership/queries.ts +65 -0
  245. package/src/component/financialOwnership/schema.ts +35 -0
  246. package/src/component/refundHistory/command-evidence.test.ts +288 -0
  247. package/src/component/refundHistory/command-normalization-resource.test.ts +77 -0
  248. package/src/component/refundHistory/command-normalization.test.ts +229 -0
  249. package/src/component/refundHistory/command-provenance.test.ts +59 -0
  250. package/src/component/refundHistory/commandBinding.ts +54 -0
  251. package/src/component/refundHistory/commandEvidence.ts +71 -0
  252. package/src/component/refundHistory/commandEvidenceValidator.ts +18 -0
  253. package/src/component/refundHistory/commandFields.ts +9 -0
  254. package/src/component/refundHistory/mutations.ts +33 -0
  255. package/src/component/refundHistory/queries.ts +15 -0
  256. package/src/component/schema.ts +22 -0
  257. package/src/component/settlement/mutations.ts +5 -1
  258. package/src/shared/refundCommandScope.ts +19 -0
@@ -1,4 +1,236 @@
1
1
  declare const _default: import("convex/server").SchemaDefinition<{
2
+ financialTransferObservations: import("convex/server").TableDefinition<import("convex/values").VObject<{
3
+ bucketKey: string;
4
+ fingerprint: string;
5
+ generation: number;
6
+ isContradictory: boolean;
7
+ observedFingerprint: string;
8
+ orgId?: string | undefined;
9
+ ownershipFingerprint: string;
10
+ ownershipStatus: "ambiguous" | "contradictory" | "registered" | "unknown";
11
+ producer: "transfer_fact";
12
+ producerVersion: 1;
13
+ registrationId?: import("convex/values").GenericId<"financialOwnership"> | undefined;
14
+ role?: "affiliate" | "other" | "store" | undefined;
15
+ sourceChargeId?: string | undefined;
16
+ sourceInvoiceId?: string | undefined;
17
+ stripeTransferId: string;
18
+ transferId: import("convex/values").GenericId<"transfers">;
19
+ userId?: string | undefined;
20
+ }, {
21
+ transferId: import("convex/values").VId<import("convex/values").GenericId<"transfers">, "required">;
22
+ stripeTransferId: import("convex/values").VString<string, "required">;
23
+ sourceChargeId: import("convex/values").VString<string | undefined, "optional">;
24
+ sourceInvoiceId: import("convex/values").VString<string | undefined, "optional">;
25
+ bucketKey: import("convex/values").VString<string, "required">;
26
+ role: import("convex/values").VUnion<"affiliate" | "other" | "store" | undefined, [import("convex/values").VLiteral<"store", "required">, import("convex/values").VLiteral<"affiliate", "required">, import("convex/values").VLiteral<"other", "required">], "optional", never>;
27
+ registrationId: import("convex/values").VId<import("convex/values").GenericId<"financialOwnership"> | undefined, "optional">;
28
+ userId: import("convex/values").VString<string | undefined, "optional">;
29
+ orgId: import("convex/values").VString<string | undefined, "optional">;
30
+ ownershipStatus: import("convex/values").VUnion<"ambiguous" | "contradictory" | "registered" | "unknown", [import("convex/values").VLiteral<"registered", "required">, import("convex/values").VLiteral<"unknown", "required">, import("convex/values").VLiteral<"ambiguous", "required">, import("convex/values").VLiteral<"contradictory", "required">], "required", never>;
31
+ producer: import("convex/values").VLiteral<"transfer_fact", "required">;
32
+ producerVersion: import("convex/values").VLiteral<1, "required">;
33
+ fingerprint: import("convex/values").VString<string, "required">;
34
+ observedFingerprint: import("convex/values").VString<string, "required">;
35
+ ownershipFingerprint: import("convex/values").VString<string, "required">;
36
+ generation: import("convex/values").VFloat64<number, "required">;
37
+ isContradictory: import("convex/values").VBoolean<boolean, "required">;
38
+ }, "required", "bucketKey" | "fingerprint" | "generation" | "isContradictory" | "observedFingerprint" | "orgId" | "ownershipFingerprint" | "ownershipStatus" | "producer" | "producerVersion" | "registrationId" | "role" | "sourceChargeId" | "sourceInvoiceId" | "stripeTransferId" | "transferId" | "userId">, {
39
+ by_bucket_key: ["bucketKey", "_creationTime"];
40
+ by_owner: ["userId", "orgId", "_creationTime"];
41
+ by_transfer_id: ["transferId", "_creationTime"];
42
+ }, {}, {}>;
43
+ financialTransferBatches: import("convex/server").TableDefinition<import("convex/values").VObject<{
44
+ continuation?: {
45
+ nextReference: number;
46
+ producerGeneration: number;
47
+ sourceFingerprint: string;
48
+ state: "complete" | "held" | "indexing" | "validating";
49
+ validatedReferences: number;
50
+ } | undefined;
51
+ fingerprint: string;
52
+ generation: number;
53
+ isContradictory: boolean;
54
+ isOverflow: true;
55
+ observedFingerprint: string;
56
+ operationId: string;
57
+ originalOperationId: import("convex/values").GenericId<"transferReversalOps">;
58
+ producer: "transfer_frontier_claim" | "transfer_frontier_release";
59
+ producerVersion: 1;
60
+ referenceCount: number;
61
+ sourceChargeId: string;
62
+ state: "complete" | "pending";
63
+ transferIds: import("convex/values").GenericId<"transfers">[];
64
+ }, {
65
+ originalOperationId: import("convex/values").VId<import("convex/values").GenericId<"transferReversalOps">, "required">;
66
+ operationId: import("convex/values").VString<string, "required">;
67
+ sourceChargeId: import("convex/values").VString<string, "required">;
68
+ producer: import("convex/values").VUnion<"transfer_frontier_claim" | "transfer_frontier_release", [import("convex/values").VLiteral<"transfer_frontier_release", "required">, import("convex/values").VLiteral<"transfer_frontier_claim", "required">], "required", never>;
69
+ producerVersion: import("convex/values").VLiteral<1, "required">;
70
+ fingerprint: import("convex/values").VString<string, "required">;
71
+ generation: import("convex/values").VFloat64<number, "required">;
72
+ observedFingerprint: import("convex/values").VString<string, "required">;
73
+ isContradictory: import("convex/values").VBoolean<boolean, "required">;
74
+ referenceCount: import("convex/values").VFloat64<number, "required">;
75
+ transferIds: import("convex/values").VArray<import("convex/values").GenericId<"transfers">[], import("convex/values").VId<import("convex/values").GenericId<"transfers">, "required">, "required">;
76
+ isOverflow: import("convex/values").VLiteral<true, "required">;
77
+ state: import("convex/values").VUnion<"complete" | "pending", [import("convex/values").VLiteral<"pending", "required">, import("convex/values").VLiteral<"complete", "required">], "required", never>;
78
+ continuation: import("convex/values").VObject<{
79
+ nextReference: number;
80
+ producerGeneration: number;
81
+ sourceFingerprint: string;
82
+ state: "complete" | "held" | "indexing" | "validating";
83
+ validatedReferences: number;
84
+ } | undefined, {
85
+ state: import("convex/values").VUnion<"complete" | "held" | "indexing" | "validating", [import("convex/values").VLiteral<"indexing", "required">, import("convex/values").VLiteral<"validating", "required">, import("convex/values").VLiteral<"complete", "required">, import("convex/values").VLiteral<"held", "required">], "required", never>;
86
+ nextReference: import("convex/values").VFloat64<number, "required">;
87
+ validatedReferences: import("convex/values").VFloat64<number, "required">;
88
+ producerGeneration: import("convex/values").VFloat64<number, "required">;
89
+ sourceFingerprint: import("convex/values").VString<string, "required">;
90
+ }, "optional", "nextReference" | "producerGeneration" | "sourceFingerprint" | "state" | "validatedReferences">;
91
+ }, "required", "continuation" | "continuation.nextReference" | "continuation.producerGeneration" | "continuation.sourceFingerprint" | "continuation.state" | "continuation.validatedReferences" | "fingerprint" | "generation" | "isContradictory" | "isOverflow" | "observedFingerprint" | "operationId" | "originalOperationId" | "producer" | "producerVersion" | "referenceCount" | "sourceChargeId" | "state" | "transferIds">, {
92
+ by_operation_id: ["operationId", "_creationTime"];
93
+ by_original_operation_id: ["originalOperationId", "_creationTime"];
94
+ by_original_operation_producer: ["originalOperationId", "producer", "_creationTime"];
95
+ by_state: ["state", "_creationTime"];
96
+ }, {}, {}>;
97
+ financialTransferBatchReferences: import("convex/server").TableDefinition<import("convex/values").VObject<{
98
+ batchId: import("convex/values").GenericId<"financialTransferBatches">;
99
+ observationGeneration: number;
100
+ observationId: import("convex/values").GenericId<"financialTransferObservations">;
101
+ observedFingerprint: string;
102
+ ownershipFingerprint: string;
103
+ position: number;
104
+ sourceFingerprint: string;
105
+ transferId: import("convex/values").GenericId<"transfers">;
106
+ }, {
107
+ batchId: import("convex/values").VId<import("convex/values").GenericId<"financialTransferBatches">, "required">;
108
+ position: import("convex/values").VFloat64<number, "required">;
109
+ transferId: import("convex/values").VId<import("convex/values").GenericId<"transfers">, "required">;
110
+ observationId: import("convex/values").VId<import("convex/values").GenericId<"financialTransferObservations">, "required">;
111
+ observationGeneration: import("convex/values").VFloat64<number, "required">;
112
+ sourceFingerprint: import("convex/values").VString<string, "required">;
113
+ observedFingerprint: import("convex/values").VString<string, "required">;
114
+ ownershipFingerprint: import("convex/values").VString<string, "required">;
115
+ }, "required", "batchId" | "observationGeneration" | "observationId" | "observedFingerprint" | "ownershipFingerprint" | "position" | "sourceFingerprint" | "transferId">, {
116
+ by_batch_position: ["batchId", "position", "_creationTime"];
117
+ by_batch_transfer: ["batchId", "transferId", "_creationTime"];
118
+ }, {}, {}>;
119
+ financialSourceObservations: import("convex/server").TableDefinition<import("convex/values").VObject<{
120
+ allocationId: import("convex/values").GenericId<"settlementAllocations">;
121
+ continuation?: {
122
+ nextLeg: number;
123
+ state: "complete" | "held" | "indexing" | "validating";
124
+ validatedLegs: number;
125
+ } | undefined;
126
+ fingerprint: string;
127
+ generation: number;
128
+ indexedLegCount: number;
129
+ isContradictory: boolean;
130
+ isOverflow: boolean;
131
+ legCount: number;
132
+ observedFingerprint: string;
133
+ ownershipFingerprint: string;
134
+ producer: "settlement_allocation";
135
+ producerVersion: 1;
136
+ sourceChargeId: string;
137
+ }, {
138
+ allocationId: import("convex/values").VId<import("convex/values").GenericId<"settlementAllocations">, "required">;
139
+ sourceChargeId: import("convex/values").VString<string, "required">;
140
+ producer: import("convex/values").VLiteral<"settlement_allocation", "required">;
141
+ producerVersion: import("convex/values").VLiteral<1, "required">;
142
+ fingerprint: import("convex/values").VString<string, "required">;
143
+ observedFingerprint: import("convex/values").VString<string, "required">;
144
+ ownershipFingerprint: import("convex/values").VString<string, "required">;
145
+ generation: import("convex/values").VFloat64<number, "required">;
146
+ legCount: import("convex/values").VFloat64<number, "required">;
147
+ indexedLegCount: import("convex/values").VFloat64<number, "required">;
148
+ isOverflow: import("convex/values").VBoolean<boolean, "required">;
149
+ isContradictory: import("convex/values").VBoolean<boolean, "required">;
150
+ continuation: import("convex/values").VObject<{
151
+ nextLeg: number;
152
+ state: "complete" | "held" | "indexing" | "validating";
153
+ validatedLegs: number;
154
+ } | undefined, {
155
+ state: import("convex/values").VUnion<"complete" | "held" | "indexing" | "validating", [import("convex/values").VLiteral<"indexing", "required">, import("convex/values").VLiteral<"validating", "required">, import("convex/values").VLiteral<"complete", "required">, import("convex/values").VLiteral<"held", "required">], "required", never>;
156
+ nextLeg: import("convex/values").VFloat64<number, "required">;
157
+ validatedLegs: import("convex/values").VFloat64<number, "required">;
158
+ }, "optional", "nextLeg" | "state" | "validatedLegs">;
159
+ }, "required", "allocationId" | "continuation" | "continuation.nextLeg" | "continuation.state" | "continuation.validatedLegs" | "fingerprint" | "generation" | "indexedLegCount" | "isContradictory" | "isOverflow" | "legCount" | "observedFingerprint" | "ownershipFingerprint" | "producer" | "producerVersion" | "sourceChargeId">, {
160
+ by_allocation_id: ["allocationId", "_creationTime"];
161
+ }, {}, {}>;
162
+ financialSourceLegs: import("convex/server").TableDefinition<import("convex/values").VObject<{
163
+ allocationId: import("convex/values").GenericId<"settlementAllocations">;
164
+ bucketKey: string;
165
+ legIndex: number;
166
+ orgId?: string | undefined;
167
+ ownershipStatus: "ambiguous" | "contradictory" | "registered" | "unknown";
168
+ registrationId?: import("convex/values").GenericId<"financialOwnership"> | undefined;
169
+ role: "affiliate" | "other" | "store";
170
+ sourceChargeId: string;
171
+ userId?: string | undefined;
172
+ }, {
173
+ allocationId: import("convex/values").VId<import("convex/values").GenericId<"settlementAllocations">, "required">;
174
+ sourceChargeId: import("convex/values").VString<string, "required">;
175
+ legIndex: import("convex/values").VFloat64<number, "required">;
176
+ bucketKey: import("convex/values").VString<string, "required">;
177
+ role: import("convex/values").VUnion<"affiliate" | "other" | "store", [import("convex/values").VLiteral<"store", "required">, import("convex/values").VLiteral<"affiliate", "required">, import("convex/values").VLiteral<"other", "required">], "required", never>;
178
+ registrationId: import("convex/values").VId<import("convex/values").GenericId<"financialOwnership"> | undefined, "optional">;
179
+ userId: import("convex/values").VString<string | undefined, "optional">;
180
+ orgId: import("convex/values").VString<string | undefined, "optional">;
181
+ ownershipStatus: import("convex/values").VUnion<"ambiguous" | "contradictory" | "registered" | "unknown", [import("convex/values").VLiteral<"registered", "required">, import("convex/values").VLiteral<"unknown", "required">, import("convex/values").VLiteral<"ambiguous", "required">, import("convex/values").VLiteral<"contradictory", "required">], "required", never>;
182
+ }, "required", "allocationId" | "bucketKey" | "legIndex" | "orgId" | "ownershipStatus" | "registrationId" | "role" | "sourceChargeId" | "userId">, {
183
+ by_allocation_id_and_leg_index: ["allocationId", "legIndex", "_creationTime"];
184
+ by_bucket_key: ["bucketKey", "_creationTime"];
185
+ by_owner: ["userId", "orgId", "_creationTime"];
186
+ }, {}, {}>;
187
+ financialObservationGenerations: import("convex/server").TableDefinition<import("convex/values").VObject<{
188
+ generation: number;
189
+ scopeKey: string;
190
+ }, {
191
+ scopeKey: import("convex/values").VString<string, "required">;
192
+ generation: import("convex/values").VFloat64<number, "required">;
193
+ }, "required", "generation" | "scopeKey">, {
194
+ by_scope_key: ["scopeKey", "_creationTime"];
195
+ }, {}, {}>;
196
+ financialOwnership: import("convex/server").TableDefinition<import("convex/values").VObject<{
197
+ bucketKey: string;
198
+ generation: number;
199
+ kind: "logical" | "stripe_account";
200
+ orgId?: string | undefined;
201
+ source: {
202
+ integration: string;
203
+ recordId: string;
204
+ };
205
+ userId: string;
206
+ }, {
207
+ userId: import("convex/values").VString<string, "required">;
208
+ orgId: import("convex/values").VString<string | undefined, "optional">;
209
+ bucketKey: import("convex/values").VString<string, "required">;
210
+ kind: import("convex/values").VUnion<"logical" | "stripe_account", [import("convex/values").VLiteral<"stripe_account", "required">, import("convex/values").VLiteral<"logical", "required">], "required", never>;
211
+ source: import("convex/values").VObject<{
212
+ integration: string;
213
+ recordId: string;
214
+ }, {
215
+ integration: import("convex/values").VString<string, "required">;
216
+ recordId: import("convex/values").VString<string, "required">;
217
+ }, "required", "integration" | "recordId">;
218
+ generation: import("convex/values").VFloat64<number, "required">;
219
+ }, "required", "bucketKey" | "generation" | "kind" | "orgId" | "source" | "source.integration" | "source.recordId" | "userId">, {
220
+ by_bucket_key: ["bucketKey", "_creationTime"];
221
+ by_owner: ["userId", "orgId", "_creationTime"];
222
+ }, {}, {}>;
223
+ financialOwnershipGenerations: import("convex/server").TableDefinition<import("convex/values").VObject<{
224
+ generation: number;
225
+ orgId?: string | undefined;
226
+ userId: string;
227
+ }, {
228
+ userId: import("convex/values").VString<string, "required">;
229
+ orgId: import("convex/values").VString<string | undefined, "optional">;
230
+ generation: import("convex/values").VFloat64<number, "required">;
231
+ }, "required", "generation" | "orgId" | "userId">, {
232
+ by_owner: ["userId", "orgId", "_creationTime"];
233
+ }, {}, {}>;
2
234
  payoutWorkerJobs: import("convex/server").TableDefinition<import("convex/values").VObject<{
3
235
  accountId: string;
4
236
  cadenceMs: number;
@@ -1540,11 +1772,19 @@ declare const _default: import("convex/server").SchemaDefinition<{
1540
1772
  failureReason?: string | undefined;
1541
1773
  metadata?: any;
1542
1774
  reason?: "duplicate" | "expired_uncaptured_charge" | "fraudulent" | "requested_by_customer" | undefined;
1775
+ refundCommandConflict?: boolean | undefined;
1776
+ refundCommandKey?: string | undefined;
1777
+ refundCommandNormalizationVersion?: 1 | undefined;
1778
+ refundCommandObservedAt?: number | undefined;
1543
1779
  status: "canceled" | "failed" | "pending" | "requires_action" | "succeeded";
1544
1780
  stripeChargeId?: string | undefined;
1545
1781
  stripePaymentIntentId?: string | undefined;
1546
1782
  stripeRefundId: string;
1547
1783
  }, {
1784
+ refundCommandNormalizationVersion: import("convex/values").VLiteral<1 | undefined, "optional">;
1785
+ refundCommandKey: import("convex/values").VString<string | undefined, "optional">;
1786
+ refundCommandConflict: import("convex/values").VBoolean<boolean | undefined, "optional">;
1787
+ refundCommandObservedAt: import("convex/values").VFloat64<number | undefined, "optional">;
1548
1788
  stripeRefundId: import("convex/values").VString<string, "required">;
1549
1789
  stripePaymentIntentId: import("convex/values").VString<string | undefined, "optional">;
1550
1790
  stripeChargeId: import("convex/values").VString<string | undefined, "optional">;
@@ -1555,12 +1795,14 @@ declare const _default: import("convex/server").SchemaDefinition<{
1555
1795
  reason: import("convex/values").VUnion<"duplicate" | "expired_uncaptured_charge" | "fraudulent" | "requested_by_customer" | undefined, [import("convex/values").VLiteral<"duplicate", "required">, import("convex/values").VLiteral<"fraudulent", "required">, import("convex/values").VLiteral<"requested_by_customer", "required">, import("convex/values").VLiteral<"expired_uncaptured_charge", "required">], "optional", never>;
1556
1796
  failureReason: import("convex/values").VString<string | undefined, "optional">;
1557
1797
  metadata: import("convex/values").VAny<any, "optional", string>;
1558
- }, "required", "accountId" | "amount" | "currency" | "failureReason" | "metadata" | "reason" | "status" | "stripeChargeId" | "stripePaymentIntentId" | "stripeRefundId" | `metadata.${string}`>, {
1798
+ }, "required", "accountId" | "amount" | "currency" | "failureReason" | "metadata" | "reason" | "refundCommandConflict" | "refundCommandKey" | "refundCommandNormalizationVersion" | "refundCommandObservedAt" | "status" | "stripeChargeId" | "stripePaymentIntentId" | "stripeRefundId" | `metadata.${string}`>, {
1559
1799
  by_account_id: ["accountId", "_creationTime"];
1560
1800
  by_account_id_and_status: ["accountId", "status", "_creationTime"];
1561
1801
  by_account_id_and_stripe_payment_intent_id: ["accountId", "stripePaymentIntentId", "_creationTime"];
1562
1802
  by_account_id_and_stripe_payment_intent_id_and_status: ["accountId", "stripePaymentIntentId", "status", "_creationTime"];
1563
1803
  by_payment_intent_id_and_status: ["stripePaymentIntentId", "status", "_creationTime"];
1804
+ by_refund_command_key: ["refundCommandKey", "_creationTime"];
1805
+ by_refund_command_normalization_version: ["refundCommandNormalizationVersion", "_creationTime"];
1564
1806
  by_status: ["status", "_creationTime"];
1565
1807
  by_stripe_payment_intent_id: ["stripePaymentIntentId", "_creationTime"];
1566
1808
  by_stripe_refund_id: ["stripeRefundId", "_creationTime"];
@@ -1,3 +1,7 @@
1
+ import { transferBatchReferencesTable } from "./financialObservations/transferReferenceSchema.js";
2
+ import { transferObservationsTable, transferBatchesTable, } from "./financialObservations/transferSchema.js";
3
+ import { sourceObservationsTable, sourceLegsTable, observationGenerationsTable, } from "./financialObservations/schema.js";
4
+ import { ownershipTable, generationsTable, } from "./financialOwnership/schema.js";
1
5
  import { accountClosuresTable } from "./accountClosure/schema.js";
2
6
  import { jobsTable as payoutWorkerJobsTable } from "./payoutWorker/schema.js";
3
7
  import { financialRevisionsTable, riskEventsTable, riskRevisionsTable, snapshotsTable, snapshotSourcesTable, snapshotClaimsTable, snapshotFeesTable, } from "./payoutSnapshots/schema.js";
@@ -16,6 +20,14 @@ import { accountsTable } from "./core/schema";
16
20
  import { pricesTable, productsTable } from "./products/schema";
17
21
  import { webhookEventsTable } from "./webhooks/schema";
18
22
  export default defineSchema({
23
+ financialTransferObservations: transferObservationsTable,
24
+ financialTransferBatches: transferBatchesTable,
25
+ financialTransferBatchReferences: transferBatchReferencesTable,
26
+ financialSourceObservations: sourceObservationsTable,
27
+ financialSourceLegs: sourceLegsTable,
28
+ financialObservationGenerations: observationGenerationsTable,
29
+ financialOwnership: ownershipTable,
30
+ financialOwnershipGenerations: generationsTable,
19
31
  payoutWorkerJobs: payoutWorkerJobsTable,
20
32
  payoutFinancialRevisions: financialRevisionsTable,
21
33
  payoutRiskEvents: riskEventsTable,
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/component/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,SAAS,IAAI,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAC9E,OAAO,EACL,uBAAuB,EACvB,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,WAAW,IAAI,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EACL,mBAAmB,IAAI,uBAAuB,EAC9C,eAAe,IAAI,mBAAmB,EACtC,aAAa,IAAI,iBAAiB,EAClC,YAAY,IAAI,gBAAgB,EAChC,aAAa,IAAI,iBAAiB,GACnC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,yBAAyB,EACzB,8BAA8B,GAC/B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,gBAAgB,IAAI,sBAAsB,EAC1C,WAAW,IAAI,wBAAwB,EACvC,YAAY,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B,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/settlement/mutations.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDtC,CAAC;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;GA2DjC,CAAC;AAEH,+EAA+E;AAC/E,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;GA8CtC,CAAC"}
1
+ {"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../../src/component/settlement/mutations.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDtC,CAAC;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;GA2DjC,CAAC;AAEH,+EAA+E;AAC/E,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;GA8CtC,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { observeSettlementAllocation } from "../financialObservations/settlement.js";
1
2
  import { paginator } from "convex-helpers/server/pagination";
2
3
  import schema from "../schema.js";
3
4
  import { updateObligation } from "../affiliateRecovery/accounting.js";
@@ -24,6 +25,7 @@ export const reserveSettlementAllocation = mutation({
24
25
  existing.paymentIntentId !== args.paymentIntentId ||
25
26
  existing.sourceInvoiceId !== args.sourceInvoiceId)
26
27
  throw new Error("Settlement source identity cannot change.");
28
+ await observeSettlementAllocation(ctx, existing);
27
29
  return existing;
28
30
  }
29
31
  const adjustment = args.adjustmentAmount ?? 0;
@@ -49,7 +51,9 @@ export const reserveSettlementAllocation = mutation({
49
51
  args.transfers.reduce((sum, t) => sum + t.amount, 0))
50
52
  throw new Error("Settlement allocation must reconcile in integer currency units with unique recipient legs.");
51
53
  const id = await ctx.db.insert("settlementAllocations", args);
52
- return (await ctx.db.get("settlementAllocations", id));
54
+ const stored = (await ctx.db.get("settlementAllocations", id));
55
+ await observeSettlementAllocation(ctx, stored);
56
+ return stored;
53
57
  },
54
58
  });
55
59
  export const claimCommissionInvoice = mutation({
@@ -1 +1 @@
1
- {"version":3,"file":"mutations.js","sourceRoot":"","sources":["../../../src/component/settlement/mutations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAChF,MAAM,GAAG,GAAG,CAAC,CAAC,MAAM,CAAC;IACnB,GAAG,gBAAgB;IACnB,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,uBAAuB,CAAC;IAClC,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;CAC1B,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,QAAQ,CAAC;IAClD,IAAI,EAAE,gBAAgB;IACtB,OAAO,EAAE,GAAG;IACZ,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QAC3B,MAAM,QAAQ,GAAG,MAAM,GA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BAChB,OAAO,EAAE,CAAC;gBACV,SAAS;YACX,CAAC;YACD,MAAM,UAAU,GAAG,MAAM,0BAA0B,CACjD,GAAG,EACH,QAAQ,EACR,UAAU,CAAC,KAAK,CACjB,CAAC;YACF,MAAM,gBAAgB,CAAC,GAAG,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC;YAC5C,QAAQ,EAAE,CAAC;QACb,CAAC;QACD,OAAO;YACL,QAAQ;YACR,OAAO;YACP,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,cAAc,EAAE,IAAI,CAAC,cAAc;SACpC,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ /** Canonical server-owned selectors. Shape validation is not host authorization or currency support. */
2
+ export type RefundCommandScope = {
3
+ commandKey: string;
4
+ accountId: string;
5
+ stripePaymentIntentId: string;
6
+ stripeChargeId: string;
7
+ currency: string;
8
+ };
9
+ export declare function assertRefundCommandScope(input: RefundCommandScope): void;
10
+ //# sourceMappingURL=refundCommandScope.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refundCommandScope.d.ts","sourceRoot":"","sources":["../../src/shared/refundCommandScope.ts"],"names":[],"mappings":"AAAA,wGAAwG;AACxG,MAAM,MAAM,kBAAkB,GAAG;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,kBAAkB,GAAG,IAAI,CASxE"}
@@ -0,0 +1,9 @@
1
+ export function assertRefundCommandScope(input) {
2
+ if (!/^[A-Za-z0-9:_-]{16,200}$/.test(input.commandKey) ||
3
+ !/^acct_[A-Za-z0-9_]{1,128}$/.test(input.accountId) ||
4
+ !/^pi_[A-Za-z0-9_]{1,252}$/.test(input.stripePaymentIntentId) ||
5
+ !/^ch_[A-Za-z0-9_]{1,252}$/.test(input.stripeChargeId) ||
6
+ !/^[a-z]{3}$/.test(input.currency))
7
+ throw new Error("Invalid refund command selectors");
8
+ }
9
+ //# sourceMappingURL=refundCommandScope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refundCommandScope.js","sourceRoot":"","sources":["../../src/shared/refundCommandScope.ts"],"names":[],"mappings":"AASA,MAAM,UAAU,wBAAwB,CAAC,KAAyB;IAChE,IACE,CAAC,0BAA0B,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC;QAClD,CAAC,4BAA4B,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;QACnD,CAAC,0BAA0B,CAAC,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC;QAC7D,CAAC,0BAA0B,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC;QACtD,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;QAElC,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;AACxD,CAAC"}
@@ -0,0 +1,159 @@
1
+ # Settlement source observations
2
+
3
+ `betterStripe.financialObservations` exposes trusted host diagnostics for original settlement allocation sources and destinations. It records references and fingerprints, not a second financial ledger. Every response reports `coverage: "unknown"`; a registered owner, indexed destination or exhausted page never proves the absence of outstanding work or authorizes account closure.
4
+
5
+ ## Observed producer and bounds
6
+
7
+ The version 1 producer is the actual raw-context `reserveSettlementAllocation` mutation. Its transaction records the original allocation ID, charge identity, immutable source fingerprint and diagnostic generation. Matching reservation replay observes the original persisted allocation, preserving existing financial behavior when caller amounts differ. No source row, amount, balance, claim or provider request is rewritten by observation.
8
+
9
+ At most **100 destination legs** are indexed synchronously. Within that bound, each leg retains its original allocation ID, leg index, destination key and role. An allocation with more than 100 legs remains financially valid and records a durable `isOverflow: true` source marker with UNKNOWN coverage and no synchronous destination rows. The marker retains the original allocation reference and total leg count. The trusted host can explicitly resume oversized traversal in bounded transactions. No capped list is described as complete. An allocation with no legs records an empty source marker without inventing a recipient.
10
+
11
+ Existing allocations have no automatic legacy backfill. A missing source observation remains unknown until an actual reservation replay observes it. Transfer fact writers, claimed reversal slices, affiliate/seller-cost/payout producers, legacy backfill, attempt admission and whole-V2 host purchase/configuration/consent guards require separate accepted integrations. This feature does not make account closure safe or activate a close control.
12
+
13
+ ## Ownership and late facts
14
+
15
+ Leg ownership comes only from the exact immutable financial ownership registry binding. No user is inferred from destination spelling, provider mapping, account creation time or a caller-supplied alias. An unregistered bucket is indexed with `ownershipStatus: "unknown"`, without an owner. For synchronous allocations, a later legitimate first registration becomes visible when the actual source writer replays. Pending oversized continuation can observe it when validation reaches that slot. A completed traversal remains historical; none of these observations certifies complete coverage.
16
+
17
+ Once observed, a registered leg keeps its original owner pin through registry absence, ambiguity or contradictory replacement. Historical destination rows never redirect to a replacement owner. Missing registration yields unknown ownership, duplicate registration yields ambiguous ownership, and changed ownership yields contradictory ownership. Source identity conflicts, duplicate charge sources and changed original financial source content retain an explicit contradictory source marker. Missing previously indexed slots, duplicate slots and malformed observation slots are held before selecting any leg: index, original destination, role and source-charge identity must agree. Ambiguous observation rows are retained unchanged, with a contradictory source marker rather than a silent repair. Contradictions are held rather than repaired by rewriting financial facts.
18
+
19
+ Source generations advance when source or ownership observations change. Matching replay remains stable, including repeated contradictory facts. Exact-bucket and owner diagnostic generations advance for affected indexed scopes; they are diagnostic invalidation tokens, not certified financial coverage. A missing scope starts at generation zero; an ambiguous or invalid generation is returned as null. Overflow destinations that have not been indexed cannot be discovered through those scope indexes, which is why UNKNOWN must be preserved until and after those destinations are indexed.
20
+
21
+ ## Server integration
22
+
23
+ Authenticate the current host actor and derive the allowed owner/bucket scope before calling these readers. They are trusted component/server APIs: a bucket key, allocation ID, user identifier or cursor is not end-user authorization. Keep organization scope explicit rather than inheriting organization history into personal queries.
24
+
25
+ ```ts
26
+ const diagnostic = await betterStripe.financialObservations.source(ctx, {
27
+ allocationId: originalAllocationId,
28
+ });
29
+ const destinations = await betterStripe.financialObservations.bucket(ctx, {
30
+ bucketKey: authorizedBucketKey,
31
+ paginationOpts: { numItems: 25, cursor: previousCursor },
32
+ });
33
+ const ownerSources = await betterStripe.financialObservations.owner(ctx, {
34
+ userId: authenticatedOwnerId,
35
+ paginationOpts: { numItems: 25, cursor: previousCursor },
36
+ });
37
+ ```
38
+
39
+ Bucket/owner readers use exact indexed pagination, request sizes 1–100, fixed 200-row/1 MB read bounds and native continuation/split metadata. Preserve `continueCursor`, `isDone` and native pagination identity. A full final page may require an empty continuation. Cursors are scoped to the authorized query and do not establish an immutable snapshot. All pages, including empty/exhausted pages, remain UNKNOWN; there is no caller complete flag or closure-readiness API.
40
+
41
+ ## Explicit oversized continuation
42
+
43
+ After observing an oversized allocation, call `financialObservations.resume` with its current diagnostic generation. Each transaction indexes at most 100 original destination slots, then advances a durable cursor atomically with those rows. Once every original slot is indexed, subsequent calls advance validation by at most 100 stored slots per transaction, with one indexed lookahead row. Only an actual end-of-source validation marks `continuation.state` as `"complete"`. `isOverflow` remains true because the original allocation exceeded the synchronous bound.
44
+
45
+ ```ts
46
+ const result = await betterStripe.financialObservations.resume(ctx, {
47
+ allocationId: authorizedOriginalAllocationId,
48
+ expectedGeneration: diagnostic.observation.generation,
49
+ });
50
+ ```
51
+
52
+ The host must authorize the allocation and explicitly drain both phases, persisting or rereading the returned generation between calls. There is no implicit scheduler, automatic legacy discovery or fixed lifetime batch limit. A lost acknowledgement can replay the same generation safely: it returns the current diagnostic without advancing another batch. A transaction failure commits neither destination rows nor cursor progress. The source reader supplies durable progress after a host restart.
53
+
54
+ A missing or duplicate marker returns a null UNKNOWN observation. Changed original financial content, ambiguous charge identity and structurally inconsistent cursors hold the traversal with `isContradictory: true`. The validation pass holds when its current indexed page contains missing, duplicate or malformed slots. Existing ambiguous rows are preserved; continuation never repairs them by recreating an owner pin. Previously observed owners remain pinned through registry absence or replacement. Validation can update their diagnostic ownership status without redirecting historical rows.
55
+
56
+ The integrity boundary is the package-owned writers. They append destination slots and patch diagnostic ownership, advancing the source generation in the same transaction. They never selectively delete slots or change a committed slot's identity. Validation advances over that stable prefix in separate transactions. A privileged database edit that deletes an already validated prefix or forges an otherwise consistent completed marker bypasses this writer/generation contract; this API does not certify arbitrary database-tamper integrity or rescan the entire prefix on every call.
57
+
58
+ Completion describes a historical validated traversal of this one original allocation, not a fresh ownership snapshot. A first ownership registration arriving after its slot was validated, or after completion, does not automatically rewrite that historical observation. Neither completion nor its ownership statuses certify current ownership or current liabilities. It does not prove complete financial ownership, absence of liabilities, complete producer coverage or completed legacy backfill. The host must stop on held/null results and handle recovery explicitly. Every response, including a completed traversal, still reports `coverage: "unknown"`. Source allocations, destination amounts and provider operations remain untouched.
59
+
60
+ ## Verification boundary
61
+
62
+ Real-schema tests exercise raw-context reservation, persisted-original replay, late observations, source/owner contradictions, organization isolation, more than one page, empty allocations and allocations over the synchronous bound. Public SDK tests dispatch into the actual component without Stripe credentials. Native evidence uses an isolated local component. These tests perform no provider financial operations, closure, payout, settlement transfer or admission fencing.
63
+
64
+ ## Transfer facts and deferred batches
65
+
66
+ `stripe.financialObservations.transfer(ctx, { transferId })` reads one exact
67
+ component transfer document reference. `transferBucket` and `transferOwner`
68
+ paginate the original destination and trusted registered owner. Personal and
69
+ organization scopes stay separate. `transferBatches` paginates one exact
70
+ operation identifier. All four readers always return `coverage: "unknown"`.
71
+ The host must authorize each selector before exposing these server APIs.
72
+
73
+ The package records transfer observations atomically with Connect upserts,
74
+ confirmed reversal receipts, affiliate recovery/restoration, claim-frontier
75
+ updates and releases. Derived earnings backfill also observes its stored fact.
76
+ Original transfer, source, destination and first registered owner references stay
77
+ pinned. Matching observations replay without advancing their generation; later
78
+ financial facts advance it. Missing or ambiguous ownership stays unknown.
79
+ Contradictory original identity remains diagnostic and never repairs a monetary
80
+ row. Only the derived `totalsRecorded` flag is excluded from the financial
81
+ fingerprint. Metadata and other persisted financial fields are included.
82
+
83
+ Claim and release batches synchronously observe at most 100 affected transfers.
84
+ Larger financial operations still process their complete existing slices. In the
85
+ same transaction they retain a pending batch with the original operation document
86
+ reference, source charge, producer/version, fingerprint/generation and every
87
+ compact original transfer document reference. The two producer kinds are
88
+ `transfer_frontier_claim` and `transfer_frontier_release`. A release can delete its
89
+ original operation while its reference and deferred transfer references survive.
90
+ These records contain provenance, not another monetary ledger. Trusted hosts
91
+ explicitly drain them through the bounded continuation API below.
92
+
93
+ Every transfer reader includes `producerGeneration` and `hasDeferredWork`.
94
+ Pending batches invalidate any inference that an older owner or destination page
95
+ reflects the latest batch. Exhausting a page does not clear pending work or prove
96
+ complete financial history. Missing legacy observations and producer versions
97
+ remain unknown. A completed historical observation never certifies current
98
+ ownership, current liabilities or account-closure eligibility. Initial ownership
99
+ registration after an observation does not automatically refresh it.
100
+
101
+ Native checks preserve the previously supported 1,000-transfer claim across four
102
+ shared destination buckets, with registered personal/organization and unknown
103
+ ownership, and the 100-transfer synchronous boundary. Historical public claims
104
+ with 1,001 transfers can still be released without per-row observation work.
105
+ The accepted baseline separately exceeds native read limits for a claim with
106
+ 1,000 distinct destinations because of existing earnings-summary work; this
107
+ observation contract does not fix or claim support for that shape.
108
+
109
+ Observations rely on package-owned append/patch writers and their transactional
110
+ generation changes. They do not certify arbitrary privileged database edits,
111
+ selective deletion of historical observations or forged diagnostic markers.
112
+ No provider operation, financial-attempt admission or positive closure clearance
113
+ is part of this contract.
114
+
115
+ ## Resume every retained transfer reference
116
+
117
+ Use `stripe.financialObservations.transferBatch(ctx, { batchId })` to read an
118
+ exact marker, then call `resumeTransferBatch(ctx, { batchId, expectedGeneration })`
119
+ with its returned generation. One transaction indexes at most 50 original
120
+ transfer document references or validates at most 50 committed reference receipts.
121
+ Repeat until the marker reports historical completion or a held cursor. Callers
122
+ never supply cursor state or a complete flag. A stale acknowledgement returns the
123
+ current marker without advancing twice. There is no fixed lifetime reference cap.
124
+ The original financial operation and every retained reference stay intact.
125
+
126
+ `transferReferences(ctx, { batchId, paginationOpts })` exposes compact provenance
127
+ receipts through exact indexed pagination, up to 100 rows per page. Preserve native
128
+ cursor, split and page-status metadata. Receipts hold original transfer and
129
+ observation references, position, generation and fingerprints. They contain no
130
+ duplicated amounts. A successful final pass checks every retained slot and its
131
+ actual source/observation before the marker leaves pending state. Missing or
132
+ duplicate sources, ambiguous provenance, contradictory identities, cursor drift
133
+ and supersession hold the marker with UNKNOWN coverage rather than recreate or
134
+ repin history. Both claim and release markers use this same protocol, including
135
+ releases whose original operation document was deleted.
136
+
137
+ Each active cursor binds immutable marker source/version/fingerprint and the
138
+ global transfer-producer generation. Its own indexing writes and checkpoint
139
+ commit atomically. A financial write between commits holds the cursor without
140
+ resetting or silently accepting a previously validated prefix. This conservative
141
+ global fence can also hold traversal after an unrelated transfer changes; it is
142
+ not an availability guarantee under continuous writes. Held references remain
143
+ pending, with no automatic restart or closure permission.
144
+
145
+ Existing registered owner pins and explicitly unregistered ownership snapshots
146
+ survive traversal. A late first registration does not repin an already unknown
147
+ observation. A legacy transfer's first observation may bind its current trusted
148
+ registration, but that is not proof of who historically owned the original sale.
149
+ Completed traversals remain historical after later financial or ownership facts.
150
+ They never certify fresh ownership, current liabilities, complete financial
151
+ coverage or safe account closure. Aggregate coverage always remains UNKNOWN.
152
+
153
+ The final pass relies on supported package-owned append/patch writers and atomic
154
+ generation invalidation. It does not certify arbitrary privileged marker forgery
155
+ or deletion of an already validated prefix. The native capacity proof drains every
156
+ reference from an actual old-public 1,001-transfer claim/release and a current
157
+ 1,000-transfer mixed-owner claim across separate committed calls, while retaining
158
+ all financial rows and amounts. No provider operation or financial-attempt
159
+ admission is part of this continuation API.