@fantastic.dev/better-stripe 0.40.0 → 0.42.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 (183) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +1 -1
  3. package/dist/client/balanceFundingWorkflow/client.d.ts +172 -0
  4. package/dist/client/balanceFundingWorkflow/client.d.ts.map +1 -0
  5. package/dist/client/balanceFundingWorkflow/client.js +289 -0
  6. package/dist/client/balanceFundingWorkflow/client.js.map +1 -0
  7. package/dist/client/billing/balanceFunding.d.ts +5 -0
  8. package/dist/client/billing/balanceFunding.d.ts.map +1 -1
  9. package/dist/client/billing/balanceFunding.js +30 -0
  10. package/dist/client/billing/balanceFunding.js.map +1 -1
  11. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +808 -2
  12. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts.map +1 -1
  13. package/dist/client/connect/payoutExecutionTestHelpers.d.ts +404 -1
  14. package/dist/client/connect/payoutExecutionTestHelpers.d.ts.map +1 -1
  15. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +808 -2
  16. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts.map +1 -1
  17. package/dist/client/connect/payoutSyncTestHelpers.d.ts +404 -1
  18. package/dist/client/connect/payoutSyncTestHelpers.d.ts.map +1 -1
  19. package/dist/client/costRecovery-invoices.d.ts +2 -2
  20. package/dist/client/costRecovery-invoices.d.ts.map +1 -1
  21. package/dist/client/costRecovery-invoices.js +4 -1
  22. package/dist/client/costRecovery-invoices.js.map +1 -1
  23. package/dist/client/costRecovery.d.ts +5 -2
  24. package/dist/client/costRecovery.d.ts.map +1 -1
  25. package/dist/client/costRecovery.js +3 -1
  26. package/dist/client/costRecovery.js.map +1 -1
  27. package/dist/client/index.d.ts +3 -0
  28. package/dist/client/index.d.ts.map +1 -1
  29. package/dist/client/index.js +4 -0
  30. package/dist/client/index.js.map +1 -1
  31. package/dist/client/recoveryWorkflow/client.d.ts +14 -0
  32. package/dist/client/recoveryWorkflow/client.d.ts.map +1 -0
  33. package/dist/client/recoveryWorkflow/client.js +34 -0
  34. package/dist/client/recoveryWorkflow/client.js.map +1 -0
  35. package/dist/client/recoveryWorkflow/contracts.d.ts +63 -0
  36. package/dist/client/recoveryWorkflow/contracts.d.ts.map +1 -0
  37. package/dist/client/recoveryWorkflow/contracts.js +11 -0
  38. package/dist/client/recoveryWorkflow/contracts.js.map +1 -0
  39. package/dist/client/recoveryWorkflow/provider.d.ts +10 -0
  40. package/dist/client/recoveryWorkflow/provider.d.ts.map +1 -0
  41. package/dist/client/recoveryWorkflow/provider.js +80 -0
  42. package/dist/client/recoveryWorkflow/provider.js.map +1 -0
  43. package/dist/client/recoveryWorkflow/settlement.d.ts +6 -0
  44. package/dist/client/recoveryWorkflow/settlement.d.ts.map +1 -0
  45. package/dist/client/recoveryWorkflow/settlement.js +43 -0
  46. package/dist/client/recoveryWorkflow/settlement.js.map +1 -0
  47. package/dist/component/_generated/api.d.ts +30 -0
  48. package/dist/component/_generated/api.d.ts.map +1 -1
  49. package/dist/component/_generated/api.js.map +1 -1
  50. package/dist/component/_generated/component.d.ts +637 -0
  51. package/dist/component/_generated/component.d.ts.map +1 -1
  52. package/dist/component/balanceFunding/helpers.d.ts +42 -0
  53. package/dist/component/balanceFunding/helpers.d.ts.map +1 -1
  54. package/dist/component/balanceFunding/internal/actions.d.ts +39 -0
  55. package/dist/component/balanceFunding/internal/actions.d.ts.map +1 -0
  56. package/dist/component/balanceFunding/internal/actions.js +80 -0
  57. package/dist/component/balanceFunding/internal/actions.js.map +1 -0
  58. package/dist/component/balanceFunding/internal/mutations.d.ts +55 -0
  59. package/dist/component/balanceFunding/internal/mutations.d.ts.map +1 -0
  60. package/dist/component/balanceFunding/internal/mutations.js +54 -0
  61. package/dist/component/balanceFunding/internal/mutations.js.map +1 -0
  62. package/dist/component/balanceFunding/internal/queries.d.ts +116 -0
  63. package/dist/component/balanceFunding/internal/queries.d.ts.map +1 -0
  64. package/dist/component/balanceFunding/internal/queries.js +35 -0
  65. package/dist/component/balanceFunding/internal/queries.js.map +1 -0
  66. package/dist/component/balanceFunding/internal/workflow.d.ts +10 -0
  67. package/dist/component/balanceFunding/internal/workflow.d.ts.map +1 -0
  68. package/dist/component/balanceFunding/internal/workflow.js +31 -0
  69. package/dist/component/balanceFunding/internal/workflow.js.map +1 -0
  70. package/dist/component/balanceFunding/lifecycleHandlers.d.ts +126 -0
  71. package/dist/component/balanceFunding/lifecycleHandlers.d.ts.map +1 -1
  72. package/dist/component/balanceFunding/mutations.d.ts +419 -16
  73. package/dist/component/balanceFunding/mutations.d.ts.map +1 -1
  74. package/dist/component/balanceFunding/mutations.js +24 -0
  75. package/dist/component/balanceFunding/mutations.js.map +1 -1
  76. package/dist/component/balanceFunding/preparationHandlers.d.ts +42 -0
  77. package/dist/component/balanceFunding/preparationHandlers.d.ts.map +1 -1
  78. package/dist/component/balanceFunding/queries.d.ts +78 -0
  79. package/dist/component/balanceFunding/queries.d.ts.map +1 -1
  80. package/dist/component/balanceFunding/queries.js +35 -0
  81. package/dist/component/balanceFunding/queries.js.map +1 -1
  82. package/dist/component/balanceFunding/receipt.d.ts +5 -0
  83. package/dist/component/balanceFunding/receipt.d.ts.map +1 -0
  84. package/dist/component/balanceFunding/receipt.js +37 -0
  85. package/dist/component/balanceFunding/receipt.js.map +1 -0
  86. package/dist/component/balanceFunding/schema.d.ts +506 -2
  87. package/dist/component/balanceFunding/schema.d.ts.map +1 -1
  88. package/dist/component/balanceFunding/schema.js +2 -0
  89. package/dist/component/balanceFunding/schema.js.map +1 -1
  90. package/dist/component/balanceFunding/stateHandlers.d.ts +42 -0
  91. package/dist/component/balanceFunding/stateHandlers.d.ts.map +1 -1
  92. package/dist/component/balanceFunding/workflowControl.d.ts +19 -0
  93. package/dist/component/balanceFunding/workflowControl.d.ts.map +1 -0
  94. package/dist/component/balanceFunding/workflowControl.js +149 -0
  95. package/dist/component/balanceFunding/workflowControl.js.map +1 -0
  96. package/dist/component/balanceFunding/workflowSchema.d.ts +356 -0
  97. package/dist/component/balanceFunding/workflowSchema.d.ts.map +1 -0
  98. package/dist/component/balanceFunding/workflowSchema.js +48 -0
  99. package/dist/component/balanceFunding/workflowSchema.js.map +1 -0
  100. package/dist/component/balanceFunding/workflowState.d.ts +157 -0
  101. package/dist/component/balanceFunding/workflowState.d.ts.map +1 -0
  102. package/dist/component/balanceFunding/workflowState.js +194 -0
  103. package/dist/component/balanceFunding/workflowState.js.map +1 -0
  104. package/dist/component/balanceFunding/workflowValidators.d.ts +306 -0
  105. package/dist/component/balanceFunding/workflowValidators.d.ts.map +1 -0
  106. package/dist/component/balanceFunding/workflowValidators.js +27 -0
  107. package/dist/component/balanceFunding/workflowValidators.js.map +1 -0
  108. package/dist/component/earnings/triggers.d.ts +280 -2
  109. package/dist/component/earnings/triggers.d.ts.map +1 -1
  110. package/dist/component/payoutRelease/queries.d.ts +2 -2
  111. package/dist/component/payoutRelease/queries.d.ts.map +1 -1
  112. package/dist/component/recoveryWorkflow/bridge.d.ts +21 -0
  113. package/dist/component/recoveryWorkflow/bridge.d.ts.map +1 -0
  114. package/dist/component/recoveryWorkflow/bridge.js +52 -0
  115. package/dist/component/recoveryWorkflow/bridge.js.map +1 -0
  116. package/dist/component/recoveryWorkflow/helpers.d.ts +83 -0
  117. package/dist/component/recoveryWorkflow/helpers.d.ts.map +1 -0
  118. package/dist/component/recoveryWorkflow/helpers.js +48 -0
  119. package/dist/component/recoveryWorkflow/helpers.js.map +1 -0
  120. package/dist/component/recoveryWorkflow/mutations.d.ts +91 -0
  121. package/dist/component/recoveryWorkflow/mutations.d.ts.map +1 -0
  122. package/dist/component/recoveryWorkflow/mutations.js +177 -0
  123. package/dist/component/recoveryWorkflow/mutations.js.map +1 -0
  124. package/dist/component/recoveryWorkflow/queries.d.ts +118 -0
  125. package/dist/component/recoveryWorkflow/queries.d.ts.map +1 -0
  126. package/dist/component/recoveryWorkflow/queries.js +20 -0
  127. package/dist/component/recoveryWorkflow/queries.js.map +1 -0
  128. package/dist/component/recoveryWorkflow/schema.d.ts +653 -0
  129. package/dist/component/recoveryWorkflow/schema.d.ts.map +1 -0
  130. package/dist/component/recoveryWorkflow/schema.js +81 -0
  131. package/dist/component/recoveryWorkflow/schema.js.map +1 -0
  132. package/dist/component/recoveryWorkflow/steps.d.ts +70 -0
  133. package/dist/component/recoveryWorkflow/steps.d.ts.map +1 -0
  134. package/dist/component/recoveryWorkflow/steps.js +94 -0
  135. package/dist/component/recoveryWorkflow/steps.js.map +1 -0
  136. package/dist/component/recoveryWorkflow/workflow.d.ts +22 -0
  137. package/dist/component/recoveryWorkflow/workflow.d.ts.map +1 -0
  138. package/dist/component/recoveryWorkflow/workflow.js +56 -0
  139. package/dist/component/recoveryWorkflow/workflow.js.map +1 -0
  140. package/dist/component/schema.d.ts +404 -1
  141. package/dist/component/schema.js +3 -0
  142. package/dist/component/schema.js.map +1 -1
  143. package/package.json +1 -1
  144. package/src/client/balanceFundingWorkflow/capture.test.ts +144 -0
  145. package/src/client/balanceFundingWorkflow/client.ts +419 -0
  146. package/src/client/billing/balanceFunding.ts +50 -0
  147. package/src/client/costRecovery-invoices.ts +6 -0
  148. package/src/client/costRecovery.ts +8 -3
  149. package/src/client/index.ts +15 -0
  150. package/src/client/recoveryWorkflow/client.test.ts +37 -0
  151. package/src/client/recoveryWorkflow/client.ts +76 -0
  152. package/src/client/recoveryWorkflow/contracts.ts +72 -0
  153. package/src/client/recoveryWorkflow/provider.test.ts +424 -0
  154. package/src/client/recoveryWorkflow/provider.ts +119 -0
  155. package/src/client/recoveryWorkflow/settlement.ts +67 -0
  156. package/src/component/_generated/api.ts +30 -0
  157. package/src/component/_generated/component.ts +746 -0
  158. package/src/component/balanceFunding/internal/actions.ts +107 -0
  159. package/src/component/balanceFunding/internal/mutations.ts +66 -0
  160. package/src/component/balanceFunding/internal/queries.ts +34 -0
  161. package/src/component/balanceFunding/internal/workflow.ts +49 -0
  162. package/src/component/balanceFunding/mutations.ts +34 -0
  163. package/src/component/balanceFunding/queries.ts +38 -0
  164. package/src/component/balanceFunding/receipt.ts +48 -0
  165. package/src/component/balanceFunding/schema.ts +2 -0
  166. package/src/component/balanceFunding/scopeLookup.test.ts +94 -0
  167. package/src/component/balanceFunding/workflow.fixtures.ts +366 -0
  168. package/src/component/balanceFunding/workflow.test.ts +552 -0
  169. package/src/component/balanceFunding/workflowControl.ts +198 -0
  170. package/src/component/balanceFunding/workflowSchema.ts +78 -0
  171. package/src/component/balanceFunding/workflowState.ts +285 -0
  172. package/src/component/balanceFunding/workflowValidators.ts +40 -0
  173. package/src/component/recoveryWorkflow/bridge.test.ts +481 -0
  174. package/src/component/recoveryWorkflow/bridge.ts +66 -0
  175. package/src/component/recoveryWorkflow/helpers.ts +58 -0
  176. package/src/component/recoveryWorkflow/journal.test.ts +104 -0
  177. package/src/component/recoveryWorkflow/mutations.ts +224 -0
  178. package/src/component/recoveryWorkflow/queries.ts +19 -0
  179. package/src/component/recoveryWorkflow/schema.ts +92 -0
  180. package/src/component/recoveryWorkflow/state.test.ts +191 -0
  181. package/src/component/recoveryWorkflow/steps.ts +97 -0
  182. package/src/component/recoveryWorkflow/workflow.ts +73 -0
  183. package/src/component/schema.ts +6 -0
@@ -0,0 +1,356 @@
1
+ import { type Infer } from "convex/values";
2
+ export declare const FUNDING_WORKFLOW_VERSION = "balance-funding/v1";
3
+ export declare const providerPhase: import("convex/values").VUnion<"apply" | "attach" | "create", [import("convex/values").VLiteral<"create", "required">, import("convex/values").VLiteral<"attach", "required">, import("convex/values").VLiteral<"apply", "required">], "required", never>;
4
+ export type ProviderPhase = Infer<typeof providerPhase>;
5
+ export declare const provisioningReceipt: import("convex/values").VObject<{
6
+ customerAccount: string;
7
+ enabled?: boolean | undefined;
8
+ paymentMethodId: string | null;
9
+ paymentMethodTypes?: string[] | null | undefined;
10
+ phase: "apply" | "attach" | "create";
11
+ providerApiVersion: string;
12
+ stripeSubscriptionId: string;
13
+ }, {
14
+ phase: import("convex/values").VUnion<"apply" | "attach" | "create", [import("convex/values").VLiteral<"create", "required">, import("convex/values").VLiteral<"attach", "required">, import("convex/values").VLiteral<"apply", "required">], "required", never>;
15
+ customerAccount: import("convex/values").VString<string, "required">;
16
+ stripeSubscriptionId: import("convex/values").VString<string, "required">;
17
+ paymentMethodId: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
18
+ paymentMethodTypes: import("convex/values").VUnion<string[] | null | undefined, [import("convex/values").VArray<string[], import("convex/values").VString<string, "required">, "required">, import("convex/values").VNull<null, "required">], "optional", never>;
19
+ enabled: import("convex/values").VBoolean<boolean | undefined, "optional">;
20
+ providerApiVersion: import("convex/values").VString<string, "required">;
21
+ }, "required", "customerAccount" | "enabled" | "paymentMethodId" | "paymentMethodTypes" | "phase" | "providerApiVersion" | "stripeSubscriptionId">;
22
+ export type ProvisioningReceipt = Infer<typeof provisioningReceipt>;
23
+ export declare const workflowBinding: import("convex/values").VObject<{
24
+ apply?: {
25
+ receipt?: {
26
+ customerAccount: string;
27
+ enabled?: boolean | undefined;
28
+ paymentMethodId: string | null;
29
+ paymentMethodTypes?: string[] | null | undefined;
30
+ phase: "apply" | "attach" | "create";
31
+ providerApiVersion: string;
32
+ stripeSubscriptionId: string;
33
+ } | undefined;
34
+ state: "running" | "succeeded" | "unknown";
35
+ } | undefined;
36
+ attach?: {
37
+ receipt?: {
38
+ customerAccount: string;
39
+ enabled?: boolean | undefined;
40
+ paymentMethodId: string | null;
41
+ paymentMethodTypes?: string[] | null | undefined;
42
+ phase: "apply" | "attach" | "create";
43
+ providerApiVersion: string;
44
+ stripeSubscriptionId: string;
45
+ } | undefined;
46
+ state: "running" | "succeeded" | "unknown";
47
+ } | undefined;
48
+ create?: {
49
+ receipt?: {
50
+ customerAccount: string;
51
+ enabled?: boolean | undefined;
52
+ paymentMethodId: string | null;
53
+ paymentMethodTypes?: string[] | null | undefined;
54
+ phase: "apply" | "attach" | "create";
55
+ providerApiVersion: string;
56
+ stripeSubscriptionId: string;
57
+ } | undefined;
58
+ state: "running" | "succeeded" | "unknown";
59
+ } | undefined;
60
+ definitionVersion: string;
61
+ providerAction: string;
62
+ providerApiVersion: string;
63
+ workflowId?: string | undefined;
64
+ }, {
65
+ workflowId: import("convex/values").VString<string | undefined, "optional">;
66
+ definitionVersion: import("convex/values").VString<string, "required">;
67
+ providerApiVersion: import("convex/values").VString<string, "required">;
68
+ providerAction: import("convex/values").VString<string, "required">;
69
+ create: import("convex/values").VObject<{
70
+ receipt?: {
71
+ customerAccount: string;
72
+ enabled?: boolean | undefined;
73
+ paymentMethodId: string | null;
74
+ paymentMethodTypes?: string[] | null | undefined;
75
+ phase: "apply" | "attach" | "create";
76
+ providerApiVersion: string;
77
+ stripeSubscriptionId: string;
78
+ } | undefined;
79
+ state: "running" | "succeeded" | "unknown";
80
+ } | undefined, {
81
+ state: import("convex/values").VUnion<"running" | "succeeded" | "unknown", [import("convex/values").VLiteral<"running", "required">, import("convex/values").VLiteral<"unknown", "required">, import("convex/values").VLiteral<"succeeded", "required">], "required", never>;
82
+ receipt: import("convex/values").VObject<{
83
+ customerAccount: string;
84
+ enabled?: boolean | undefined;
85
+ paymentMethodId: string | null;
86
+ paymentMethodTypes?: string[] | null | undefined;
87
+ phase: "apply" | "attach" | "create";
88
+ providerApiVersion: string;
89
+ stripeSubscriptionId: string;
90
+ } | undefined, {
91
+ phase: import("convex/values").VUnion<"apply" | "attach" | "create", [import("convex/values").VLiteral<"create", "required">, import("convex/values").VLiteral<"attach", "required">, import("convex/values").VLiteral<"apply", "required">], "required", never>;
92
+ customerAccount: import("convex/values").VString<string, "required">;
93
+ stripeSubscriptionId: import("convex/values").VString<string, "required">;
94
+ paymentMethodId: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
95
+ paymentMethodTypes: import("convex/values").VUnion<string[] | null | undefined, [import("convex/values").VArray<string[], import("convex/values").VString<string, "required">, "required">, import("convex/values").VNull<null, "required">], "optional", never>;
96
+ enabled: import("convex/values").VBoolean<boolean | undefined, "optional">;
97
+ providerApiVersion: import("convex/values").VString<string, "required">;
98
+ }, "optional", "customerAccount" | "enabled" | "paymentMethodId" | "paymentMethodTypes" | "phase" | "providerApiVersion" | "stripeSubscriptionId">;
99
+ }, "optional", "receipt" | "receipt.customerAccount" | "receipt.enabled" | "receipt.paymentMethodId" | "receipt.paymentMethodTypes" | "receipt.phase" | "receipt.providerApiVersion" | "receipt.stripeSubscriptionId" | "state">;
100
+ attach: import("convex/values").VObject<{
101
+ receipt?: {
102
+ customerAccount: string;
103
+ enabled?: boolean | undefined;
104
+ paymentMethodId: string | null;
105
+ paymentMethodTypes?: string[] | null | undefined;
106
+ phase: "apply" | "attach" | "create";
107
+ providerApiVersion: string;
108
+ stripeSubscriptionId: string;
109
+ } | undefined;
110
+ state: "running" | "succeeded" | "unknown";
111
+ } | undefined, {
112
+ state: import("convex/values").VUnion<"running" | "succeeded" | "unknown", [import("convex/values").VLiteral<"running", "required">, import("convex/values").VLiteral<"unknown", "required">, import("convex/values").VLiteral<"succeeded", "required">], "required", never>;
113
+ receipt: import("convex/values").VObject<{
114
+ customerAccount: string;
115
+ enabled?: boolean | undefined;
116
+ paymentMethodId: string | null;
117
+ paymentMethodTypes?: string[] | null | undefined;
118
+ phase: "apply" | "attach" | "create";
119
+ providerApiVersion: string;
120
+ stripeSubscriptionId: string;
121
+ } | undefined, {
122
+ phase: import("convex/values").VUnion<"apply" | "attach" | "create", [import("convex/values").VLiteral<"create", "required">, import("convex/values").VLiteral<"attach", "required">, import("convex/values").VLiteral<"apply", "required">], "required", never>;
123
+ customerAccount: import("convex/values").VString<string, "required">;
124
+ stripeSubscriptionId: import("convex/values").VString<string, "required">;
125
+ paymentMethodId: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
126
+ paymentMethodTypes: import("convex/values").VUnion<string[] | null | undefined, [import("convex/values").VArray<string[], import("convex/values").VString<string, "required">, "required">, import("convex/values").VNull<null, "required">], "optional", never>;
127
+ enabled: import("convex/values").VBoolean<boolean | undefined, "optional">;
128
+ providerApiVersion: import("convex/values").VString<string, "required">;
129
+ }, "optional", "customerAccount" | "enabled" | "paymentMethodId" | "paymentMethodTypes" | "phase" | "providerApiVersion" | "stripeSubscriptionId">;
130
+ }, "optional", "receipt" | "receipt.customerAccount" | "receipt.enabled" | "receipt.paymentMethodId" | "receipt.paymentMethodTypes" | "receipt.phase" | "receipt.providerApiVersion" | "receipt.stripeSubscriptionId" | "state">;
131
+ apply: import("convex/values").VObject<{
132
+ receipt?: {
133
+ customerAccount: string;
134
+ enabled?: boolean | undefined;
135
+ paymentMethodId: string | null;
136
+ paymentMethodTypes?: string[] | null | undefined;
137
+ phase: "apply" | "attach" | "create";
138
+ providerApiVersion: string;
139
+ stripeSubscriptionId: string;
140
+ } | undefined;
141
+ state: "running" | "succeeded" | "unknown";
142
+ } | undefined, {
143
+ state: import("convex/values").VUnion<"running" | "succeeded" | "unknown", [import("convex/values").VLiteral<"running", "required">, import("convex/values").VLiteral<"unknown", "required">, import("convex/values").VLiteral<"succeeded", "required">], "required", never>;
144
+ receipt: import("convex/values").VObject<{
145
+ customerAccount: string;
146
+ enabled?: boolean | undefined;
147
+ paymentMethodId: string | null;
148
+ paymentMethodTypes?: string[] | null | undefined;
149
+ phase: "apply" | "attach" | "create";
150
+ providerApiVersion: string;
151
+ stripeSubscriptionId: string;
152
+ } | undefined, {
153
+ phase: import("convex/values").VUnion<"apply" | "attach" | "create", [import("convex/values").VLiteral<"create", "required">, import("convex/values").VLiteral<"attach", "required">, import("convex/values").VLiteral<"apply", "required">], "required", never>;
154
+ customerAccount: import("convex/values").VString<string, "required">;
155
+ stripeSubscriptionId: import("convex/values").VString<string, "required">;
156
+ paymentMethodId: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
157
+ paymentMethodTypes: import("convex/values").VUnion<string[] | null | undefined, [import("convex/values").VArray<string[], import("convex/values").VString<string, "required">, "required">, import("convex/values").VNull<null, "required">], "optional", never>;
158
+ enabled: import("convex/values").VBoolean<boolean | undefined, "optional">;
159
+ providerApiVersion: import("convex/values").VString<string, "required">;
160
+ }, "optional", "customerAccount" | "enabled" | "paymentMethodId" | "paymentMethodTypes" | "phase" | "providerApiVersion" | "stripeSubscriptionId">;
161
+ }, "optional", "receipt" | "receipt.customerAccount" | "receipt.enabled" | "receipt.paymentMethodId" | "receipt.paymentMethodTypes" | "receipt.phase" | "receipt.providerApiVersion" | "receipt.stripeSubscriptionId" | "state">;
162
+ }, "required", "apply" | "apply.receipt" | "apply.receipt.customerAccount" | "apply.receipt.enabled" | "apply.receipt.paymentMethodId" | "apply.receipt.paymentMethodTypes" | "apply.receipt.phase" | "apply.receipt.providerApiVersion" | "apply.receipt.stripeSubscriptionId" | "apply.state" | "attach" | "attach.receipt" | "attach.receipt.customerAccount" | "attach.receipt.enabled" | "attach.receipt.paymentMethodId" | "attach.receipt.paymentMethodTypes" | "attach.receipt.phase" | "attach.receipt.providerApiVersion" | "attach.receipt.stripeSubscriptionId" | "attach.state" | "create" | "create.receipt" | "create.receipt.customerAccount" | "create.receipt.enabled" | "create.receipt.paymentMethodId" | "create.receipt.paymentMethodTypes" | "create.receipt.phase" | "create.receipt.providerApiVersion" | "create.receipt.stripeSubscriptionId" | "create.state" | "definitionVersion" | "providerAction" | "providerApiVersion" | "workflowId">;
163
+ export declare const providerUnknown: import("convex/values").VObject<{
164
+ reason: "history_incomplete" | "provider_outcome_unknown";
165
+ retryable: false;
166
+ status: "unknown";
167
+ }, {
168
+ status: import("convex/values").VLiteral<"unknown", "required">;
169
+ reason: import("convex/values").VUnion<"history_incomplete" | "provider_outcome_unknown", [import("convex/values").VLiteral<"provider_outcome_unknown", "required">, import("convex/values").VLiteral<"history_incomplete", "required">], "required", never>;
170
+ retryable: import("convex/values").VLiteral<false, "required">;
171
+ }, "required", "reason" | "retryable" | "status">;
172
+ export declare const providerConflict: import("convex/values").VObject<{
173
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
174
+ retryable: false;
175
+ status: "conflict";
176
+ }, {
177
+ status: import("convex/values").VLiteral<"conflict", "required">;
178
+ reason: import("convex/values").VUnion<"identity_changed" | "revision_changed" | "scope_busy", [import("convex/values").VLiteral<"scope_busy", "required">, import("convex/values").VLiteral<"identity_changed", "required">, import("convex/values").VLiteral<"revision_changed", "required">], "required", never>;
179
+ retryable: import("convex/values").VLiteral<false, "required">;
180
+ }, "required", "reason" | "retryable" | "status">;
181
+ export declare const providerRejected: import("convex/values").VObject<{
182
+ reason: "invalid_scope" | "policy_invalid" | "unsupported_source";
183
+ retryable: false;
184
+ status: "rejected";
185
+ }, {
186
+ status: import("convex/values").VLiteral<"rejected", "required">;
187
+ reason: import("convex/values").VUnion<"invalid_scope" | "policy_invalid" | "unsupported_source", [import("convex/values").VLiteral<"invalid_scope", "required">, import("convex/values").VLiteral<"unsupported_source", "required">, import("convex/values").VLiteral<"policy_invalid", "required">], "required", never>;
188
+ retryable: import("convex/values").VLiteral<false, "required">;
189
+ }, "required", "reason" | "retryable" | "status">;
190
+ export declare const providerNotReady: import("convex/values").VObject<{
191
+ reason: "provider_pending";
192
+ retryable: true;
193
+ status: "not_ready";
194
+ }, {
195
+ status: import("convex/values").VLiteral<"not_ready", "required">;
196
+ reason: import("convex/values").VLiteral<"provider_pending", "required">;
197
+ retryable: import("convex/values").VLiteral<true, "required">;
198
+ }, "required", "reason" | "retryable" | "status">;
199
+ export declare const workflowUnavailable: import("convex/values").VUnion<{
200
+ reason: "history_incomplete" | "provider_outcome_unknown";
201
+ retryable: false;
202
+ status: "unknown";
203
+ } | {
204
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
205
+ retryable: false;
206
+ status: "conflict";
207
+ } | {
208
+ reason: "invalid_scope" | "policy_invalid" | "unsupported_source";
209
+ retryable: false;
210
+ status: "rejected";
211
+ } | {
212
+ reason: "provider_pending";
213
+ retryable: true;
214
+ status: "not_ready";
215
+ }, [import("convex/values").VObject<{
216
+ reason: "history_incomplete" | "provider_outcome_unknown";
217
+ retryable: false;
218
+ status: "unknown";
219
+ }, {
220
+ status: import("convex/values").VLiteral<"unknown", "required">;
221
+ reason: import("convex/values").VUnion<"history_incomplete" | "provider_outcome_unknown", [import("convex/values").VLiteral<"provider_outcome_unknown", "required">, import("convex/values").VLiteral<"history_incomplete", "required">], "required", never>;
222
+ retryable: import("convex/values").VLiteral<false, "required">;
223
+ }, "required", "reason" | "retryable" | "status">, import("convex/values").VObject<{
224
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
225
+ retryable: false;
226
+ status: "conflict";
227
+ }, {
228
+ status: import("convex/values").VLiteral<"conflict", "required">;
229
+ reason: import("convex/values").VUnion<"identity_changed" | "revision_changed" | "scope_busy", [import("convex/values").VLiteral<"scope_busy", "required">, import("convex/values").VLiteral<"identity_changed", "required">, import("convex/values").VLiteral<"revision_changed", "required">], "required", never>;
230
+ retryable: import("convex/values").VLiteral<false, "required">;
231
+ }, "required", "reason" | "retryable" | "status">, import("convex/values").VObject<{
232
+ reason: "invalid_scope" | "policy_invalid" | "unsupported_source";
233
+ retryable: false;
234
+ status: "rejected";
235
+ }, {
236
+ status: import("convex/values").VLiteral<"rejected", "required">;
237
+ reason: import("convex/values").VUnion<"invalid_scope" | "policy_invalid" | "unsupported_source", [import("convex/values").VLiteral<"invalid_scope", "required">, import("convex/values").VLiteral<"unsupported_source", "required">, import("convex/values").VLiteral<"policy_invalid", "required">], "required", never>;
238
+ retryable: import("convex/values").VLiteral<false, "required">;
239
+ }, "required", "reason" | "retryable" | "status">, import("convex/values").VObject<{
240
+ reason: "provider_pending";
241
+ retryable: true;
242
+ status: "not_ready";
243
+ }, {
244
+ status: import("convex/values").VLiteral<"not_ready", "required">;
245
+ reason: import("convex/values").VLiteral<"provider_pending", "required">;
246
+ retryable: import("convex/values").VLiteral<true, "required">;
247
+ }, "required", "reason" | "retryable" | "status">], "required", "reason" | "retryable" | "status">;
248
+ export type WorkflowUnavailable = Infer<typeof workflowUnavailable>;
249
+ export declare const providerResult: import("convex/values").VUnion<{
250
+ reason: "history_incomplete" | "provider_outcome_unknown";
251
+ retryable: false;
252
+ status: "unknown";
253
+ } | {
254
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
255
+ retryable: false;
256
+ status: "conflict";
257
+ } | {
258
+ reason: "invalid_scope" | "policy_invalid" | "unsupported_source";
259
+ retryable: false;
260
+ status: "rejected";
261
+ } | {
262
+ reason: "provider_pending";
263
+ retryable: true;
264
+ status: "not_ready";
265
+ } | {
266
+ status: "ready";
267
+ value: {
268
+ customerAccount: string;
269
+ enabled?: boolean | undefined;
270
+ paymentMethodId: string | null;
271
+ paymentMethodTypes?: string[] | null | undefined;
272
+ phase: "apply" | "attach" | "create";
273
+ providerApiVersion: string;
274
+ stripeSubscriptionId: string;
275
+ };
276
+ }, [import("convex/values").VObject<{
277
+ status: "ready";
278
+ value: {
279
+ customerAccount: string;
280
+ enabled?: boolean | undefined;
281
+ paymentMethodId: string | null;
282
+ paymentMethodTypes?: string[] | null | undefined;
283
+ phase: "apply" | "attach" | "create";
284
+ providerApiVersion: string;
285
+ stripeSubscriptionId: string;
286
+ };
287
+ }, {
288
+ status: import("convex/values").VLiteral<"ready", "required">;
289
+ value: import("convex/values").VObject<{
290
+ customerAccount: string;
291
+ enabled?: boolean | undefined;
292
+ paymentMethodId: string | null;
293
+ paymentMethodTypes?: string[] | null | undefined;
294
+ phase: "apply" | "attach" | "create";
295
+ providerApiVersion: string;
296
+ stripeSubscriptionId: string;
297
+ }, {
298
+ phase: import("convex/values").VUnion<"apply" | "attach" | "create", [import("convex/values").VLiteral<"create", "required">, import("convex/values").VLiteral<"attach", "required">, import("convex/values").VLiteral<"apply", "required">], "required", never>;
299
+ customerAccount: import("convex/values").VString<string, "required">;
300
+ stripeSubscriptionId: import("convex/values").VString<string, "required">;
301
+ paymentMethodId: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
302
+ paymentMethodTypes: import("convex/values").VUnion<string[] | null | undefined, [import("convex/values").VArray<string[], import("convex/values").VString<string, "required">, "required">, import("convex/values").VNull<null, "required">], "optional", never>;
303
+ enabled: import("convex/values").VBoolean<boolean | undefined, "optional">;
304
+ providerApiVersion: import("convex/values").VString<string, "required">;
305
+ }, "required", "customerAccount" | "enabled" | "paymentMethodId" | "paymentMethodTypes" | "phase" | "providerApiVersion" | "stripeSubscriptionId">;
306
+ }, "required", "status" | "value" | "value.customerAccount" | "value.enabled" | "value.paymentMethodId" | "value.paymentMethodTypes" | "value.phase" | "value.providerApiVersion" | "value.stripeSubscriptionId">, import("convex/values").VUnion<{
307
+ reason: "history_incomplete" | "provider_outcome_unknown";
308
+ retryable: false;
309
+ status: "unknown";
310
+ } | {
311
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
312
+ retryable: false;
313
+ status: "conflict";
314
+ } | {
315
+ reason: "invalid_scope" | "policy_invalid" | "unsupported_source";
316
+ retryable: false;
317
+ status: "rejected";
318
+ } | {
319
+ reason: "provider_pending";
320
+ retryable: true;
321
+ status: "not_ready";
322
+ }, [import("convex/values").VObject<{
323
+ reason: "history_incomplete" | "provider_outcome_unknown";
324
+ retryable: false;
325
+ status: "unknown";
326
+ }, {
327
+ status: import("convex/values").VLiteral<"unknown", "required">;
328
+ reason: import("convex/values").VUnion<"history_incomplete" | "provider_outcome_unknown", [import("convex/values").VLiteral<"provider_outcome_unknown", "required">, import("convex/values").VLiteral<"history_incomplete", "required">], "required", never>;
329
+ retryable: import("convex/values").VLiteral<false, "required">;
330
+ }, "required", "reason" | "retryable" | "status">, import("convex/values").VObject<{
331
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
332
+ retryable: false;
333
+ status: "conflict";
334
+ }, {
335
+ status: import("convex/values").VLiteral<"conflict", "required">;
336
+ reason: import("convex/values").VUnion<"identity_changed" | "revision_changed" | "scope_busy", [import("convex/values").VLiteral<"scope_busy", "required">, import("convex/values").VLiteral<"identity_changed", "required">, import("convex/values").VLiteral<"revision_changed", "required">], "required", never>;
337
+ retryable: import("convex/values").VLiteral<false, "required">;
338
+ }, "required", "reason" | "retryable" | "status">, import("convex/values").VObject<{
339
+ reason: "invalid_scope" | "policy_invalid" | "unsupported_source";
340
+ retryable: false;
341
+ status: "rejected";
342
+ }, {
343
+ status: import("convex/values").VLiteral<"rejected", "required">;
344
+ reason: import("convex/values").VUnion<"invalid_scope" | "policy_invalid" | "unsupported_source", [import("convex/values").VLiteral<"invalid_scope", "required">, import("convex/values").VLiteral<"unsupported_source", "required">, import("convex/values").VLiteral<"policy_invalid", "required">], "required", never>;
345
+ retryable: import("convex/values").VLiteral<false, "required">;
346
+ }, "required", "reason" | "retryable" | "status">, import("convex/values").VObject<{
347
+ reason: "provider_pending";
348
+ retryable: true;
349
+ status: "not_ready";
350
+ }, {
351
+ status: import("convex/values").VLiteral<"not_ready", "required">;
352
+ reason: import("convex/values").VLiteral<"provider_pending", "required">;
353
+ retryable: import("convex/values").VLiteral<true, "required">;
354
+ }, "required", "reason" | "retryable" | "status">], "required", "reason" | "retryable" | "status">], "required", "reason" | "retryable" | "status" | "value" | "value.customerAccount" | "value.enabled" | "value.paymentMethodId" | "value.paymentMethodTypes" | "value.phase" | "value.providerApiVersion" | "value.stripeSubscriptionId">;
355
+ export type ProviderResult = Infer<typeof providerResult>;
356
+ //# sourceMappingURL=workflowSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflowSchema.d.ts","sourceRoot":"","sources":["../../../src/component/balanceFunding/workflowSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAK,KAAK,KAAK,EAAE,MAAM,eAAe,CAAC;AAC9C,eAAO,MAAM,wBAAwB,uBAAuB,CAAC;AAC7D,eAAO,MAAM,aAAa,2PAIzB,CAAC;AACF,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AACxD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;kJAQ9B,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AASpE,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;y6BAQ1B,CAAC;AACH,eAAO,MAAM,eAAe;;;;;;;;iDAO1B,CAAC;AACH,eAAO,MAAM,gBAAgB;;;;;;;;iDAQ3B,CAAC;AACH,eAAO,MAAM,gBAAgB;;;;;;;;iDAQ3B,CAAC;AACH,eAAO,MAAM,gBAAgB;;;;;;;;iDAI3B,CAAC;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kGAK/B,CAAC;AACF,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AACpE,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4UAG1B,CAAC;AACF,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC"}
@@ -0,0 +1,48 @@
1
+ import { v } from "convex/values";
2
+ export const FUNDING_WORKFLOW_VERSION = "balance-funding/v1";
3
+ export const providerPhase = v.union(v.literal("create"), v.literal("attach"), v.literal("apply"));
4
+ export const provisioningReceipt = v.object({
5
+ phase: providerPhase,
6
+ customerAccount: v.string(),
7
+ stripeSubscriptionId: v.string(),
8
+ paymentMethodId: v.union(v.string(), v.null()),
9
+ paymentMethodTypes: v.optional(v.union(v.array(v.string()), v.null())),
10
+ enabled: v.optional(v.boolean()),
11
+ providerApiVersion: v.string(),
12
+ });
13
+ const phaseState = v.object({
14
+ state: v.union(v.literal("running"), v.literal("unknown"), v.literal("succeeded")),
15
+ receipt: v.optional(provisioningReceipt),
16
+ });
17
+ export const workflowBinding = v.object({
18
+ workflowId: v.optional(v.string()),
19
+ definitionVersion: v.string(),
20
+ providerApiVersion: v.string(),
21
+ providerAction: v.string(),
22
+ create: v.optional(phaseState),
23
+ attach: v.optional(phaseState),
24
+ apply: v.optional(phaseState),
25
+ });
26
+ export const providerUnknown = v.object({
27
+ status: v.literal("unknown"),
28
+ reason: v.union(v.literal("provider_outcome_unknown"), v.literal("history_incomplete")),
29
+ retryable: v.literal(false),
30
+ });
31
+ export const providerConflict = v.object({
32
+ status: v.literal("conflict"),
33
+ reason: v.union(v.literal("scope_busy"), v.literal("identity_changed"), v.literal("revision_changed")),
34
+ retryable: v.literal(false),
35
+ });
36
+ export const providerRejected = v.object({
37
+ status: v.literal("rejected"),
38
+ reason: v.union(v.literal("invalid_scope"), v.literal("unsupported_source"), v.literal("policy_invalid")),
39
+ retryable: v.literal(false),
40
+ });
41
+ export const providerNotReady = v.object({
42
+ status: v.literal("not_ready"),
43
+ reason: v.literal("provider_pending"),
44
+ retryable: v.literal(true),
45
+ });
46
+ export const workflowUnavailable = v.union(providerUnknown, providerConflict, providerRejected, providerNotReady);
47
+ export const providerResult = v.union(v.object({ status: v.literal("ready"), value: provisioningReceipt }), workflowUnavailable);
48
+ //# sourceMappingURL=workflowSchema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflowSchema.js","sourceRoot":"","sources":["../../../src/component/balanceFunding/workflowSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAc,MAAM,eAAe,CAAC;AAC9C,MAAM,CAAC,MAAM,wBAAwB,GAAG,oBAAoB,CAAC;AAC7D,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,KAA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AC,CAAC,OAAO,CAAC,KAAK,CAAC;CAC5B,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC;IAC9B,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC;IACrC,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;CAC3B,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CACxC,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,CACjB,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CACnC,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,mBAAmB,EAAE,CAAC,EACpE,mBAAmB,CACpB,CAAC"}
@@ -0,0 +1,157 @@
1
+ import type { QueryCtx, MutationCtx } from "../_generated/server.js";
2
+ import type { FundingWorkflowRef, FundingPhaseRef } from "./workflowValidators.js";
3
+ import { type WorkflowUnavailable, type ProvisioningReceipt } from "./workflowSchema.js";
4
+ export declare const unknown: (reason?: "provider_outcome_unknown" | "history_incomplete") => WorkflowUnavailable;
5
+ export declare const conflict: (reason: "identity_changed" | "revision_changed" | "scope_busy") => WorkflowUnavailable;
6
+ export declare class FundingWorkflowError extends Error {
7
+ readonly outcome: WorkflowUnavailable;
8
+ constructor(outcome: WorkflowUnavailable);
9
+ }
10
+ export declare function requireWorkflow(value: unknown, outcome: WorkflowUnavailable): asserts value;
11
+ export declare function readWorkflowContext(ctx: QueryCtx | MutationCtx, args: FundingWorkflowRef, binding?: boolean): Promise<{
12
+ operation: {
13
+ _creationTime: number;
14
+ _id: import("convex/values").GenericId<"balanceFundingOperations">;
15
+ accountId: string;
16
+ cancelRequested: boolean;
17
+ enabled: boolean;
18
+ execution?: {
19
+ apply?: {
20
+ receipt?: {
21
+ customerAccount: string;
22
+ enabled?: boolean | undefined;
23
+ paymentMethodId: string | null;
24
+ paymentMethodTypes?: string[] | null | undefined;
25
+ phase: "apply" | "attach" | "create";
26
+ providerApiVersion: string;
27
+ stripeSubscriptionId: string;
28
+ } | undefined;
29
+ state: "running" | "succeeded" | "unknown";
30
+ } | undefined;
31
+ attach?: {
32
+ receipt?: {
33
+ customerAccount: string;
34
+ enabled?: boolean | undefined;
35
+ paymentMethodId: string | null;
36
+ paymentMethodTypes?: string[] | null | undefined;
37
+ phase: "apply" | "attach" | "create";
38
+ providerApiVersion: string;
39
+ stripeSubscriptionId: string;
40
+ } | undefined;
41
+ state: "running" | "succeeded" | "unknown";
42
+ } | undefined;
43
+ create?: {
44
+ receipt?: {
45
+ customerAccount: string;
46
+ enabled?: boolean | undefined;
47
+ paymentMethodId: string | null;
48
+ paymentMethodTypes?: string[] | null | undefined;
49
+ phase: "apply" | "attach" | "create";
50
+ providerApiVersion: string;
51
+ stripeSubscriptionId: string;
52
+ } | undefined;
53
+ state: "running" | "succeeded" | "unknown";
54
+ } | undefined;
55
+ definitionVersion: string;
56
+ providerAction: string;
57
+ providerApiVersion: string;
58
+ workflowId?: string | undefined;
59
+ } | undefined;
60
+ failureCode?: "invalid_scope" | "policy_invalid" | "unsupported_source" | undefined;
61
+ kind: "apply" | "prepare";
62
+ preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
63
+ providerKey: string;
64
+ providerKeys: {
65
+ attach?: string | undefined;
66
+ create?: string | undefined;
67
+ disable: string;
68
+ enable: string;
69
+ };
70
+ receipt?: {
71
+ customerAccount: string;
72
+ paymentMethodId: string | null;
73
+ paymentMethodTypes: string[] | null;
74
+ providerApiVersion: string;
75
+ stripeSubscriptionId: string;
76
+ } | undefined;
77
+ scopeKey: string;
78
+ state: "canceled" | "failed" | "pending" | "running" | "succeeded" | "unknown";
79
+ version: number;
80
+ };
81
+ preparation: {
82
+ _creationTime: number;
83
+ _id: import("convex/values").GenericId<"balanceFundingPreparations">;
84
+ accountId: string;
85
+ activeOperationId?: import("convex/values").GenericId<"balanceFundingOperations"> | undefined;
86
+ consentAt: number;
87
+ consentReference: string;
88
+ enabled: boolean;
89
+ operationVersion: number;
90
+ preparation: {
91
+ customerAccount: string;
92
+ paymentMethodId?: string | undefined;
93
+ previousPaymentMethodId: string | null;
94
+ previousPaymentMethodTypes: string[] | null;
95
+ stripeSubscriptionId: string;
96
+ };
97
+ preparationOperationId?: import("convex/values").GenericId<"balanceFundingOperations"> | undefined;
98
+ providerApiVersion: string;
99
+ scopeKey: string;
100
+ startsPaused: boolean;
101
+ verified: boolean;
102
+ };
103
+ }>;
104
+ export declare function claimProviderPhaseHandler(ctx: MutationCtx, args: FundingPhaseRef): Promise<{
105
+ reason: "history_incomplete" | "provider_outcome_unknown";
106
+ retryable: false;
107
+ status: "unknown";
108
+ } | {
109
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
110
+ retryable: false;
111
+ status: "conflict";
112
+ } | {
113
+ reason: "invalid_scope" | "policy_invalid" | "unsupported_source";
114
+ retryable: false;
115
+ status: "rejected";
116
+ } | {
117
+ reason: "provider_pending";
118
+ retryable: true;
119
+ status: "not_ready";
120
+ } | {
121
+ status: "ready";
122
+ value: {
123
+ customerAccount: string;
124
+ enabled?: boolean | undefined;
125
+ paymentMethodId: string | null;
126
+ paymentMethodTypes?: string[] | null | undefined;
127
+ phase: "apply" | "attach" | "create";
128
+ providerApiVersion: string;
129
+ stripeSubscriptionId: string;
130
+ };
131
+ } | {
132
+ value?: undefined;
133
+ status: "claimed";
134
+ mode: "reconcile";
135
+ paymentMethodId?: string | undefined;
136
+ } | {
137
+ value?: undefined;
138
+ status: "claimed";
139
+ mode: "execute";
140
+ paymentMethodId?: string | undefined;
141
+ }>;
142
+ export declare function recordProviderReceiptHandler(ctx: MutationCtx, args: FundingPhaseRef & {
143
+ receipt: ProvisioningReceipt;
144
+ }): Promise<null>;
145
+ export declare function markProviderUnknownHandler(ctx: MutationCtx, args: FundingPhaseRef): Promise<null>;
146
+ export declare function finishFromReceiptsHandler(ctx: MutationCtx, args: FundingWorkflowRef): Promise<null>;
147
+ export declare function phaseKey(op: {
148
+ providerKey: string;
149
+ enabled: boolean;
150
+ providerKeys: {
151
+ create?: string;
152
+ attach?: string;
153
+ enable: string;
154
+ disable: string;
155
+ };
156
+ }, phase: "create" | "attach" | "apply"): string | undefined;
157
+ //# sourceMappingURL=workflowState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflowState.d.ts","sourceRoot":"","sources":["../../../src/component/balanceFunding/workflowState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,KAAK,EACV,kBAAkB,EAClB,eAAe,EAChB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACzB,MAAM,qBAAqB,CAAC;AAK7B,eAAO,MAAM,OAAO,YAEd,0BAA0B,GAC1B,oBAAoB,KACvB,mBAAwE,CAAC;AAC5E,eAAO,MAAM,QAAQ,WACX,kBAAkB,GAAG,kBAAkB,GAAG,YAAY,KAC7D,mBAAyE,CAAC;AAC7E,qBAAa,oBAAqB,SAAQ,KAAK;IACjC,QAAQ,CAAC,OAAO,EAAE,mBAAmB;IAAjD,YAAqB,OAAO,EAAE,mBAAmB,EAEhD;CACF;AACD,wBAAgB,eAAe,CAC7B,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,KAAK,CAEf;AACD,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,QAAQ,GAAG,WAAW,EAC3B,IAAI,EAAE,kBAAkB,EACxB,OAAO,UAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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