@fantastic.dev/better-stripe 0.38.0 → 0.39.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 (127) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/MIGRATION.md +9 -0
  3. package/README.md +21 -1
  4. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +506 -2
  5. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts.map +1 -1
  6. package/dist/client/connect/payoutExecutionTestHelpers.d.ts +253 -1
  7. package/dist/client/connect/payoutExecutionTestHelpers.d.ts.map +1 -1
  8. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +506 -2
  9. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts.map +1 -1
  10. package/dist/client/connect/payoutSyncTestHelpers.d.ts +253 -1
  11. package/dist/client/connect/payoutSyncTestHelpers.d.ts.map +1 -1
  12. package/dist/client/costRecovery.d.ts +18 -0
  13. package/dist/client/costRecovery.d.ts.map +1 -1
  14. package/dist/client/costRecovery.js +4 -0
  15. package/dist/client/costRecovery.js.map +1 -1
  16. package/dist/client/index.d.ts +1 -0
  17. package/dist/client/index.d.ts.map +1 -1
  18. package/dist/client/index.js +1 -0
  19. package/dist/client/index.js.map +1 -1
  20. package/dist/client/processingCostDeficit/index.d.ts +27 -0
  21. package/dist/client/processingCostDeficit/index.d.ts.map +1 -0
  22. package/dist/client/processingCostDeficit/index.js +54 -0
  23. package/dist/client/processingCostDeficit/index.js.map +1 -0
  24. package/dist/component/_generated/api.d.ts +284 -0
  25. package/dist/component/_generated/api.d.ts.map +1 -0
  26. package/dist/component/_generated/api.js +31 -0
  27. package/dist/component/_generated/api.js.map +1 -0
  28. package/dist/component/_generated/component.d.ts +527 -0
  29. package/dist/component/_generated/component.d.ts.map +1 -1
  30. package/dist/component/balanceFunding/helpers.d.ts +86 -0
  31. package/dist/component/balanceFunding/helpers.d.ts.map +1 -0
  32. package/dist/component/balanceFunding/helpers.js +68 -0
  33. package/dist/component/balanceFunding/helpers.js.map +1 -0
  34. package/dist/component/balanceFunding/importHandler.d.ts +13 -0
  35. package/dist/component/balanceFunding/importHandler.d.ts.map +1 -0
  36. package/dist/component/balanceFunding/importHandler.js +130 -0
  37. package/dist/component/balanceFunding/importHandler.js.map +1 -0
  38. package/dist/component/balanceFunding/lifecycleHandlers.d.ts +85 -0
  39. package/dist/component/balanceFunding/lifecycleHandlers.d.ts.map +1 -0
  40. package/dist/component/balanceFunding/lifecycleHandlers.js +60 -0
  41. package/dist/component/balanceFunding/lifecycleHandlers.js.map +1 -0
  42. package/dist/component/balanceFunding/mutationValidators.d.ts +238 -0
  43. package/dist/component/balanceFunding/mutationValidators.d.ts.map +1 -0
  44. package/dist/component/balanceFunding/mutationValidators.js +55 -0
  45. package/dist/component/balanceFunding/mutationValidators.js.map +1 -0
  46. package/dist/component/balanceFunding/mutations.d.ts +335 -0
  47. package/dist/component/balanceFunding/mutations.d.ts.map +1 -0
  48. package/dist/component/balanceFunding/mutations.js +106 -0
  49. package/dist/component/balanceFunding/mutations.js.map +1 -0
  50. package/dist/component/balanceFunding/preparationHandlers.d.ts +55 -0
  51. package/dist/component/balanceFunding/preparationHandlers.d.ts.map +1 -0
  52. package/dist/component/balanceFunding/preparationHandlers.js +165 -0
  53. package/dist/component/balanceFunding/preparationHandlers.js.map +1 -0
  54. package/dist/component/balanceFunding/queries.d.ts +151 -0
  55. package/dist/component/balanceFunding/queries.d.ts.map +1 -0
  56. package/dist/component/balanceFunding/queries.js +180 -0
  57. package/dist/component/balanceFunding/queries.js.map +1 -0
  58. package/dist/component/balanceFunding/schema.d.ts +748 -0
  59. package/dist/component/balanceFunding/schema.d.ts.map +1 -0
  60. package/dist/component/balanceFunding/schema.js +124 -0
  61. package/dist/component/balanceFunding/schema.js.map +1 -0
  62. package/dist/component/balanceFunding/stateHandlers.d.ts +58 -0
  63. package/dist/component/balanceFunding/stateHandlers.d.ts.map +1 -0
  64. package/dist/component/balanceFunding/stateHandlers.js +160 -0
  65. package/dist/component/balanceFunding/stateHandlers.js.map +1 -0
  66. package/dist/component/convex.config.d.ts.map +1 -1
  67. package/dist/component/convex.config.js +2 -0
  68. package/dist/component/convex.config.js.map +1 -1
  69. package/dist/component/costRecovery/completion.d.ts +1 -0
  70. package/dist/component/costRecovery/completion.d.ts.map +1 -1
  71. package/dist/component/costRecovery/helpers.d.ts +1 -0
  72. package/dist/component/costRecovery/helpers.d.ts.map +1 -1
  73. package/dist/component/costRecovery/mutations.d.ts +5 -0
  74. package/dist/component/costRecovery/mutations.d.ts.map +1 -1
  75. package/dist/component/costRecovery/preparation.d.ts +50 -0
  76. package/dist/component/costRecovery/preparation.d.ts.map +1 -0
  77. package/dist/component/costRecovery/preparation.js +108 -0
  78. package/dist/component/costRecovery/preparation.js.map +1 -0
  79. package/dist/component/costRecovery/queries.d.ts +1 -0
  80. package/dist/component/costRecovery/queries.d.ts.map +1 -1
  81. package/dist/component/costRecovery/reservations.d.ts +2 -0
  82. package/dist/component/costRecovery/reservations.d.ts.map +1 -1
  83. package/dist/component/costRecovery/schema.d.ts +7 -2
  84. package/dist/component/costRecovery/schema.d.ts.map +1 -1
  85. package/dist/component/costRecovery/schema.js +1 -0
  86. package/dist/component/costRecovery/schema.js.map +1 -1
  87. package/dist/component/durableExecution/runtime.d.ts +3 -0
  88. package/dist/component/durableExecution/runtime.d.ts.map +1 -0
  89. package/dist/component/durableExecution/runtime.js +12 -0
  90. package/dist/component/durableExecution/runtime.js.map +1 -0
  91. package/dist/component/earnings/triggers.d.ts +242 -2
  92. package/dist/component/earnings/triggers.d.ts.map +1 -1
  93. package/dist/component/schema.d.ts +253 -1
  94. package/dist/component/schema.js +4 -0
  95. package/dist/component/schema.js.map +1 -1
  96. package/package.json +4 -2
  97. package/src/client/costRecovery.test.ts +34 -0
  98. package/src/client/costRecovery.ts +21 -0
  99. package/src/client/index.ts +1 -0
  100. package/src/client/processingCostDeficit/README.md +35 -0
  101. package/src/client/processingCostDeficit/calculator.test.ts +176 -0
  102. package/src/client/processingCostDeficit/index.ts +91 -0
  103. package/src/component/_generated/api.ts +23 -1
  104. package/src/component/_generated/component.ts +693 -0
  105. package/src/component/balanceFunding/failure.test.ts +116 -0
  106. package/src/component/balanceFunding/helpers.ts +102 -0
  107. package/src/component/balanceFunding/import.test.ts +221 -0
  108. package/src/component/balanceFunding/importHandler.ts +146 -0
  109. package/src/component/balanceFunding/lifecycleHandlers.ts +90 -0
  110. package/src/component/balanceFunding/lookup.test.ts +113 -0
  111. package/src/component/balanceFunding/mutationValidators.ts +63 -0
  112. package/src/component/balanceFunding/mutations.ts +136 -0
  113. package/src/component/balanceFunding/preparation.test.ts +146 -0
  114. package/src/component/balanceFunding/preparationHandlers.ts +204 -0
  115. package/src/component/balanceFunding/queries.ts +221 -0
  116. package/src/component/balanceFunding/requestLookup.test.ts +160 -0
  117. package/src/component/balanceFunding/schema.ts +169 -0
  118. package/src/component/balanceFunding/state.test.ts +352 -0
  119. package/src/component/balanceFunding/stateHandlers.ts +198 -0
  120. package/src/component/balanceFunding/validation.test.ts +100 -0
  121. package/src/component/convex.config.ts +2 -0
  122. package/src/component/costRecovery/preparation.test.ts +355 -0
  123. package/src/component/costRecovery/preparation.ts +124 -0
  124. package/src/component/costRecovery/schema.ts +1 -0
  125. package/src/component/durableExecution/composition.test.ts +568 -0
  126. package/src/component/durableExecution/runtime.ts +12 -0
  127. package/src/component/schema.ts +8 -0
@@ -608,6 +608,629 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
608
608
  >;
609
609
  };
610
610
  };
611
+ balanceFunding: {
612
+ mutations: {
613
+ begin: FunctionReference<
614
+ "mutation",
615
+ "internal",
616
+ {
617
+ accountId: string;
618
+ consent?: true;
619
+ enabled: boolean;
620
+ preparationId: string;
621
+ requestKey: string;
622
+ scopeKey: string;
623
+ },
624
+ | {
625
+ operation: {
626
+ accountId: string;
627
+ operationId: string;
628
+ scopeKey: string;
629
+ version: number;
630
+ };
631
+ status: "accepted";
632
+ }
633
+ | { enabled: boolean; status: "unchanged" }
634
+ | {
635
+ reason: "scope_busy" | "identity_changed" | "revision_changed";
636
+ retryable: false;
637
+ status: "conflict";
638
+ }
639
+ | { reason: "policy_invalid"; retryable: false; status: "rejected" }
640
+ | {
641
+ reason: "provider_pending";
642
+ retryable: true;
643
+ status: "not_ready";
644
+ },
645
+ Name
646
+ >;
647
+ failBeforeStart: FunctionReference<
648
+ "mutation",
649
+ "internal",
650
+ {
651
+ accountId: string;
652
+ failureCode:
653
+ "invalid_scope" | "unsupported_source" | "policy_invalid";
654
+ operationId: string;
655
+ scopeKey: string;
656
+ version: number;
657
+ },
658
+ {
659
+ _creationTime: number;
660
+ _id: string;
661
+ accountId: string;
662
+ cancelRequested: boolean;
663
+ enabled: boolean;
664
+ failureCode?:
665
+ "invalid_scope" | "unsupported_source" | "policy_invalid";
666
+ kind: "prepare" | "apply";
667
+ preparationId: string;
668
+ providerKey: string;
669
+ providerKeys: {
670
+ attach?: string;
671
+ create?: string;
672
+ disable: string;
673
+ enable: string;
674
+ };
675
+ receipt?: {
676
+ customerAccount: string;
677
+ paymentMethodId: string | null;
678
+ paymentMethodTypes: Array<string> | null;
679
+ providerApiVersion: string;
680
+ stripeSubscriptionId: string;
681
+ };
682
+ scopeKey: string;
683
+ state:
684
+ | "pending"
685
+ | "running"
686
+ | "unknown"
687
+ | "succeeded"
688
+ | "canceled"
689
+ | "failed";
690
+ version: number;
691
+ },
692
+ Name
693
+ >;
694
+ finish: FunctionReference<
695
+ "mutation",
696
+ "internal",
697
+ {
698
+ accountId: string;
699
+ enabled: boolean;
700
+ operationId: string;
701
+ receipt: {
702
+ customerAccount: string;
703
+ paymentMethodId: string | null;
704
+ paymentMethodTypes: Array<string> | null;
705
+ providerApiVersion: string;
706
+ stripeSubscriptionId: string;
707
+ };
708
+ scopeKey: string;
709
+ version: number;
710
+ },
711
+ {
712
+ _creationTime: number;
713
+ _id: string;
714
+ accountId: string;
715
+ cancelRequested: boolean;
716
+ enabled: boolean;
717
+ failureCode?:
718
+ "invalid_scope" | "unsupported_source" | "policy_invalid";
719
+ kind: "prepare" | "apply";
720
+ preparationId: string;
721
+ providerKey: string;
722
+ providerKeys: {
723
+ attach?: string;
724
+ create?: string;
725
+ disable: string;
726
+ enable: string;
727
+ };
728
+ receipt?: {
729
+ customerAccount: string;
730
+ paymentMethodId: string | null;
731
+ paymentMethodTypes: Array<string> | null;
732
+ providerApiVersion: string;
733
+ stripeSubscriptionId: string;
734
+ };
735
+ scopeKey: string;
736
+ state:
737
+ | "pending"
738
+ | "running"
739
+ | "unknown"
740
+ | "succeeded"
741
+ | "canceled"
742
+ | "failed";
743
+ version: number;
744
+ },
745
+ Name
746
+ >;
747
+ finishPreparation: FunctionReference<
748
+ "mutation",
749
+ "internal",
750
+ {
751
+ accountId: string;
752
+ operationId: string;
753
+ preparation: {
754
+ customerAccount: string;
755
+ paymentMethodId: string;
756
+ previousPaymentMethodId: string | null;
757
+ previousPaymentMethodTypes: Array<string> | null;
758
+ stripeSubscriptionId: string;
759
+ };
760
+ providerApiVersion: string;
761
+ scopeKey: string;
762
+ version: number;
763
+ },
764
+ {
765
+ _creationTime: number;
766
+ _id: string;
767
+ accountId: string;
768
+ cancelRequested: boolean;
769
+ enabled: boolean;
770
+ failureCode?:
771
+ "invalid_scope" | "unsupported_source" | "policy_invalid";
772
+ kind: "prepare" | "apply";
773
+ preparationId: string;
774
+ providerKey: string;
775
+ providerKeys: {
776
+ attach?: string;
777
+ create?: string;
778
+ disable: string;
779
+ enable: string;
780
+ };
781
+ receipt?: {
782
+ customerAccount: string;
783
+ paymentMethodId: string | null;
784
+ paymentMethodTypes: Array<string> | null;
785
+ providerApiVersion: string;
786
+ stripeSubscriptionId: string;
787
+ };
788
+ scopeKey: string;
789
+ state:
790
+ | "pending"
791
+ | "running"
792
+ | "unknown"
793
+ | "succeeded"
794
+ | "canceled"
795
+ | "failed";
796
+ version: number;
797
+ },
798
+ Name
799
+ >;
800
+ importPreparation: FunctionReference<
801
+ "mutation",
802
+ "internal",
803
+ {
804
+ accountId: string;
805
+ consentAt: number;
806
+ consentReference: string;
807
+ enabled: boolean;
808
+ operationVersion: number;
809
+ pending?: {
810
+ enabled: boolean;
811
+ kind?: "prepare" | "apply";
812
+ providerKey: string;
813
+ requestKey: string;
814
+ };
815
+ preparation: {
816
+ customerAccount: string;
817
+ paymentMethodId?: string;
818
+ previousPaymentMethodId: string | null;
819
+ previousPaymentMethodTypes: Array<string> | null;
820
+ stripeSubscriptionId: string;
821
+ };
822
+ providerApiVersion: string;
823
+ scopeKey: string;
824
+ sourceKey: string;
825
+ },
826
+ {
827
+ operation?: {
828
+ accountId: string;
829
+ operationId: string;
830
+ scopeKey: string;
831
+ version: number;
832
+ };
833
+ preparationId: string;
834
+ },
835
+ Name
836
+ >;
837
+ markUnknown: FunctionReference<
838
+ "mutation",
839
+ "internal",
840
+ {
841
+ accountId: string;
842
+ operationId: string;
843
+ scopeKey: string;
844
+ version: number;
845
+ },
846
+ {
847
+ _creationTime: number;
848
+ _id: string;
849
+ accountId: string;
850
+ cancelRequested: boolean;
851
+ enabled: boolean;
852
+ failureCode?:
853
+ "invalid_scope" | "unsupported_source" | "policy_invalid";
854
+ kind: "prepare" | "apply";
855
+ preparationId: string;
856
+ providerKey: string;
857
+ providerKeys: {
858
+ attach?: string;
859
+ create?: string;
860
+ disable: string;
861
+ enable: string;
862
+ };
863
+ receipt?: {
864
+ customerAccount: string;
865
+ paymentMethodId: string | null;
866
+ paymentMethodTypes: Array<string> | null;
867
+ providerApiVersion: string;
868
+ stripeSubscriptionId: string;
869
+ };
870
+ scopeKey: string;
871
+ state:
872
+ | "pending"
873
+ | "running"
874
+ | "unknown"
875
+ | "succeeded"
876
+ | "canceled"
877
+ | "failed";
878
+ version: number;
879
+ },
880
+ Name
881
+ >;
882
+ prepare: FunctionReference<
883
+ "mutation",
884
+ "internal",
885
+ {
886
+ accountId: string;
887
+ consent: true;
888
+ consentAt: number;
889
+ consentReference: string;
890
+ preparation: {
891
+ customerAccount: string;
892
+ previousPaymentMethodId: string | null;
893
+ previousPaymentMethodTypes: Array<string> | null;
894
+ stripeSubscriptionId: string;
895
+ };
896
+ providerApiVersion: string;
897
+ requestKey: string;
898
+ scopeKey: string;
899
+ },
900
+ | {
901
+ operation: {
902
+ accountId: string;
903
+ operationId: string;
904
+ scopeKey: string;
905
+ version: number;
906
+ };
907
+ status: "accepted";
908
+ }
909
+ | { enabled: boolean; status: "unchanged" }
910
+ | {
911
+ reason: "scope_busy" | "identity_changed" | "revision_changed";
912
+ retryable: false;
913
+ status: "conflict";
914
+ }
915
+ | { reason: "policy_invalid"; retryable: false; status: "rejected" }
916
+ | {
917
+ reason: "provider_pending";
918
+ retryable: true;
919
+ status: "not_ready";
920
+ },
921
+ Name
922
+ >;
923
+ requestCancel: FunctionReference<
924
+ "mutation",
925
+ "internal",
926
+ {
927
+ accountId: string;
928
+ operationId: string;
929
+ scopeKey: string;
930
+ version: number;
931
+ },
932
+ {
933
+ _creationTime: number;
934
+ _id: string;
935
+ accountId: string;
936
+ cancelRequested: boolean;
937
+ enabled: boolean;
938
+ failureCode?:
939
+ "invalid_scope" | "unsupported_source" | "policy_invalid";
940
+ kind: "prepare" | "apply";
941
+ preparationId: string;
942
+ providerKey: string;
943
+ providerKeys: {
944
+ attach?: string;
945
+ create?: string;
946
+ disable: string;
947
+ enable: string;
948
+ };
949
+ receipt?: {
950
+ customerAccount: string;
951
+ paymentMethodId: string | null;
952
+ paymentMethodTypes: Array<string> | null;
953
+ providerApiVersion: string;
954
+ stripeSubscriptionId: string;
955
+ };
956
+ scopeKey: string;
957
+ state:
958
+ | "pending"
959
+ | "running"
960
+ | "unknown"
961
+ | "succeeded"
962
+ | "canceled"
963
+ | "failed";
964
+ version: number;
965
+ },
966
+ Name
967
+ >;
968
+ savePreparation: FunctionReference<
969
+ "mutation",
970
+ "internal",
971
+ {
972
+ accountId: string;
973
+ consentAt: number;
974
+ consentReference: string;
975
+ preparation: {
976
+ customerAccount: string;
977
+ paymentMethodId: string;
978
+ previousPaymentMethodId: string | null;
979
+ previousPaymentMethodTypes: Array<string> | null;
980
+ stripeSubscriptionId: string;
981
+ };
982
+ providerApiVersion: string;
983
+ scopeKey: string;
984
+ },
985
+ { preparationId: string },
986
+ Name
987
+ >;
988
+ setStartsPaused: FunctionReference<
989
+ "mutation",
990
+ "internal",
991
+ {
992
+ accountId: string;
993
+ paused: boolean;
994
+ preparationId: string;
995
+ scopeKey: string;
996
+ stripeSubscriptionId: string;
997
+ },
998
+ null,
999
+ Name
1000
+ >;
1001
+ start: FunctionReference<
1002
+ "mutation",
1003
+ "internal",
1004
+ {
1005
+ accountId: string;
1006
+ operationId: string;
1007
+ scopeKey: string;
1008
+ version: number;
1009
+ },
1010
+ {
1011
+ _creationTime: number;
1012
+ _id: string;
1013
+ accountId: string;
1014
+ cancelRequested: boolean;
1015
+ enabled: boolean;
1016
+ failureCode?:
1017
+ "invalid_scope" | "unsupported_source" | "policy_invalid";
1018
+ kind: "prepare" | "apply";
1019
+ preparationId: string;
1020
+ providerKey: string;
1021
+ providerKeys: {
1022
+ attach?: string;
1023
+ create?: string;
1024
+ disable: string;
1025
+ enable: string;
1026
+ };
1027
+ receipt?: {
1028
+ customerAccount: string;
1029
+ paymentMethodId: string | null;
1030
+ paymentMethodTypes: Array<string> | null;
1031
+ providerApiVersion: string;
1032
+ stripeSubscriptionId: string;
1033
+ };
1034
+ scopeKey: string;
1035
+ state:
1036
+ | "pending"
1037
+ | "running"
1038
+ | "unknown"
1039
+ | "succeeded"
1040
+ | "canceled"
1041
+ | "failed";
1042
+ version: number;
1043
+ },
1044
+ Name
1045
+ >;
1046
+ };
1047
+ queries: {
1048
+ findPreparationOperation: FunctionReference<
1049
+ "query",
1050
+ "internal",
1051
+ {
1052
+ accountId: string;
1053
+ consent: boolean;
1054
+ providerApiVersion: string;
1055
+ requestKey: string;
1056
+ scopeKey: string;
1057
+ stripeSubscriptionId: string;
1058
+ },
1059
+ | {
1060
+ accountId: string;
1061
+ cancelRequested: boolean;
1062
+ failureCode?:
1063
+ "invalid_scope" | "unsupported_source" | "policy_invalid";
1064
+ operationId: string;
1065
+ scopeKey: string;
1066
+ state:
1067
+ | "pending"
1068
+ | "running"
1069
+ | "unknown"
1070
+ | "succeeded"
1071
+ | "canceled"
1072
+ | "failed";
1073
+ version: number;
1074
+ }
1075
+ | {
1076
+ reason: "scope_busy" | "identity_changed" | "revision_changed";
1077
+ retryable: false;
1078
+ status: "conflict";
1079
+ }
1080
+ | { reason: "invalid_scope"; retryable: false; status: "rejected" }
1081
+ | null,
1082
+ Name
1083
+ >;
1084
+ getOperation: FunctionReference<
1085
+ "query",
1086
+ "internal",
1087
+ {
1088
+ accountId: string;
1089
+ operationId: string;
1090
+ scopeKey: string;
1091
+ stripeSubscriptionId: string;
1092
+ version: number;
1093
+ },
1094
+ {
1095
+ accountId: string;
1096
+ cancelRequested: boolean;
1097
+ failureCode?:
1098
+ "invalid_scope" | "unsupported_source" | "policy_invalid";
1099
+ operationId: string;
1100
+ scopeKey: string;
1101
+ state:
1102
+ | "pending"
1103
+ | "running"
1104
+ | "unknown"
1105
+ | "succeeded"
1106
+ | "canceled"
1107
+ | "failed";
1108
+ version: number;
1109
+ } | null,
1110
+ Name
1111
+ >;
1112
+ getPreparation: FunctionReference<
1113
+ "query",
1114
+ "internal",
1115
+ {
1116
+ accountId: string;
1117
+ operationId: string;
1118
+ scopeKey: string;
1119
+ stripeSubscriptionId: string;
1120
+ version: number;
1121
+ },
1122
+ | {
1123
+ operation: {
1124
+ accountId: string;
1125
+ operationId: string;
1126
+ scopeKey: string;
1127
+ version: number;
1128
+ };
1129
+ preparationId: string;
1130
+ status: "prepared";
1131
+ stripeSubscriptionId: string;
1132
+ }
1133
+ | {
1134
+ failureCode?:
1135
+ "invalid_scope" | "unsupported_source" | "policy_invalid";
1136
+ operation: {
1137
+ accountId: string;
1138
+ operationId: string;
1139
+ scopeKey: string;
1140
+ version: number;
1141
+ };
1142
+ status: "pending" | "running" | "unknown" | "canceled" | "failed";
1143
+ }
1144
+ | {
1145
+ reason: "scope_busy" | "identity_changed" | "revision_changed";
1146
+ retryable: false;
1147
+ status: "conflict";
1148
+ }
1149
+ | { reason: "invalid_scope"; retryable: false; status: "rejected" }
1150
+ | null,
1151
+ Name
1152
+ >;
1153
+ inspectOperation: FunctionReference<
1154
+ "query",
1155
+ "internal",
1156
+ {
1157
+ accountId: string;
1158
+ operationId: string;
1159
+ scopeKey: string;
1160
+ stripeSubscriptionId: string;
1161
+ version: number;
1162
+ },
1163
+ {
1164
+ _creationTime: number;
1165
+ _id: string;
1166
+ accountId: string;
1167
+ cancelRequested: boolean;
1168
+ enabled: boolean;
1169
+ failureCode?:
1170
+ "invalid_scope" | "unsupported_source" | "policy_invalid";
1171
+ kind: "prepare" | "apply";
1172
+ preparationId: string;
1173
+ providerKey: string;
1174
+ providerKeys: {
1175
+ attach?: string;
1176
+ create?: string;
1177
+ disable: string;
1178
+ enable: string;
1179
+ };
1180
+ receipt?: {
1181
+ customerAccount: string;
1182
+ paymentMethodId: string | null;
1183
+ paymentMethodTypes: Array<string> | null;
1184
+ providerApiVersion: string;
1185
+ stripeSubscriptionId: string;
1186
+ };
1187
+ scopeKey: string;
1188
+ state:
1189
+ | "pending"
1190
+ | "running"
1191
+ | "unknown"
1192
+ | "succeeded"
1193
+ | "canceled"
1194
+ | "failed";
1195
+ version: number;
1196
+ } | null,
1197
+ Name
1198
+ >;
1199
+ readPreparation: FunctionReference<
1200
+ "query",
1201
+ "internal",
1202
+ {
1203
+ accountId: string;
1204
+ preparationId: string;
1205
+ scopeKey: string;
1206
+ stripeSubscriptionId: string;
1207
+ },
1208
+ {
1209
+ _creationTime: number;
1210
+ _id: string;
1211
+ accountId: string;
1212
+ activeOperationId?: string;
1213
+ consentAt: number;
1214
+ consentReference: string;
1215
+ enabled: boolean;
1216
+ operationVersion: number;
1217
+ preparation: {
1218
+ customerAccount: string;
1219
+ paymentMethodId?: string;
1220
+ previousPaymentMethodId: string | null;
1221
+ previousPaymentMethodTypes: Array<string> | null;
1222
+ stripeSubscriptionId: string;
1223
+ };
1224
+ preparationOperationId?: string;
1225
+ providerApiVersion: string;
1226
+ scopeKey: string;
1227
+ startsPaused: boolean;
1228
+ verified: boolean;
1229
+ } | null,
1230
+ Name
1231
+ >;
1232
+ };
1233
+ };
611
1234
  billing: {
612
1235
  mutations: {
613
1236
  upsertCheckoutSession: FunctionReference<
@@ -2400,6 +3023,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
2400
3023
  maxCredit: number;
2401
3024
  maxDebit: number;
2402
3025
  pendingOperations: number;
3026
+ preparationSequence?: number;
2403
3027
  scopeKey: string;
2404
3028
  sourceGross?: number;
2405
3029
  sourceId: string;
@@ -2435,6 +3059,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
2435
3059
  maxCredit: number;
2436
3060
  maxDebit: number;
2437
3061
  pendingOperations: number;
3062
+ preparationSequence?: number;
2438
3063
  scopeKey: string;
2439
3064
  sourceGross?: number;
2440
3065
  sourceId: string;
@@ -2471,6 +3096,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
2471
3096
  maxCredit: number;
2472
3097
  maxDebit: number;
2473
3098
  pendingOperations: number;
3099
+ preparationSequence?: number;
2474
3100
  scopeKey: string;
2475
3101
  sourceGross?: number;
2476
3102
  sourceId: string;
@@ -2602,6 +3228,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
2602
3228
  maxCredit: number;
2603
3229
  maxDebit: number;
2604
3230
  pendingOperations: number;
3231
+ preparationSequence?: number;
2605
3232
  scopeKey: string;
2606
3233
  sourceGross?: number;
2607
3234
  sourceId: string;
@@ -2681,6 +3308,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
2681
3308
  maxCredit: number;
2682
3309
  maxDebit: number;
2683
3310
  pendingOperations: number;
3311
+ preparationSequence?: number;
2684
3312
  scopeKey: string;
2685
3313
  sourceGross?: number;
2686
3314
  sourceId: string;
@@ -2697,6 +3325,70 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
2697
3325
  Name
2698
3326
  >;
2699
3327
  };
3328
+ preparation: {
3329
+ prepare: FunctionReference<
3330
+ "mutation",
3331
+ "internal",
3332
+ {
3333
+ accountId: string;
3334
+ currency: string;
3335
+ groupKey: string;
3336
+ limit?: number;
3337
+ maxCredit: number;
3338
+ maxDebit: number;
3339
+ scopeKey: string;
3340
+ sourceGross?: number;
3341
+ sourceId: string;
3342
+ sourceKind: "settlement" | "invoice";
3343
+ sourceProcessingFee?: number;
3344
+ },
3345
+ | {
3346
+ group: {
3347
+ _creationTime: number;
3348
+ _id: string;
3349
+ accountId: string;
3350
+ amount: number;
3351
+ currency: string;
3352
+ groupKey: string;
3353
+ invoiceFunding?: {
3354
+ sourceChargeId: string;
3355
+ sourceGross: number;
3356
+ sourceProcessingFee: number;
3357
+ };
3358
+ invoiceItemId?: string;
3359
+ maxCredit: number;
3360
+ maxDebit: number;
3361
+ pendingOperations: number;
3362
+ preparationSequence?: number;
3363
+ scopeKey: string;
3364
+ sourceGross?: number;
3365
+ sourceId: string;
3366
+ sourceKind: "settlement" | "invoice";
3367
+ sourceProcessingFee?: number;
3368
+ status:
3369
+ | "open"
3370
+ | "sealed"
3371
+ | "collecting"
3372
+ | "releasing"
3373
+ | "collected"
3374
+ | "released";
3375
+ };
3376
+ isDone: boolean;
3377
+ status: "prepared";
3378
+ }
3379
+ | {
3380
+ reason: "scope_busy" | "identity_changed";
3381
+ retryable: false;
3382
+ status: "conflict";
3383
+ }
3384
+ | {
3385
+ reason: "invalid_scope" | "policy_invalid";
3386
+ retryable: false;
3387
+ status: "rejected";
3388
+ },
3389
+ Name
3390
+ >;
3391
+ };
2700
3392
  queries: {
2701
3393
  balance: FunctionReference<
2702
3394
  "query",
@@ -2763,6 +3455,7 @@ export type ComponentApi<Name extends string | undefined = string | undefined> =
2763
3455
  maxCredit: number;
2764
3456
  maxDebit: number;
2765
3457
  pendingOperations: number;
3458
+ preparationSequence?: number;
2766
3459
  scopeKey: string;
2767
3460
  sourceGross?: number;
2768
3461
  sourceId: string;