@fantastic.dev/better-stripe 0.23.1 → 0.23.2

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 (77) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +1 -1
  3. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +42 -0
  4. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts.map +1 -1
  5. package/dist/client/connect/payoutSync.d.ts +32 -0
  6. package/dist/client/connect/payoutSync.d.ts.map +1 -0
  7. package/dist/client/connect/payoutSync.js +48 -0
  8. package/dist/client/connect/payoutSync.js.map +1 -0
  9. package/dist/client/connect/payoutSyncTestHelpers.d.ts +1263 -0
  10. package/dist/client/connect/payoutSyncTestHelpers.d.ts.map +1 -0
  11. package/dist/client/connect/payoutSyncTestHelpers.js +62 -0
  12. package/dist/client/connect/payoutSyncTestHelpers.js.map +1 -0
  13. package/dist/client/connect/payoutSyncValidation.d.ts +16 -0
  14. package/dist/client/connect/payoutSyncValidation.d.ts.map +1 -0
  15. package/dist/client/connect/payoutSyncValidation.js +54 -0
  16. package/dist/client/connect/payoutSyncValidation.js.map +1 -0
  17. package/dist/client/index.d.ts +26 -9
  18. package/dist/client/index.d.ts.map +1 -1
  19. package/dist/client/index.js +3 -5
  20. package/dist/client/index.js.map +1 -1
  21. package/dist/client/readContracts.d.ts +8 -0
  22. package/dist/client/readContracts.d.ts.map +1 -1
  23. package/dist/client/readContracts.js +7 -0
  24. package/dist/client/readContracts.js.map +1 -1
  25. package/dist/component/_generated/component.d.ts +69 -0
  26. package/dist/component/_generated/component.d.ts.map +1 -1
  27. package/dist/component/connect/mutations.d.ts.map +1 -1
  28. package/dist/component/connect/mutations.js +4 -27
  29. package/dist/component/connect/mutations.js.map +1 -1
  30. package/dist/component/connect/payoutWrites.d.ts +21 -0
  31. package/dist/component/connect/payoutWrites.d.ts.map +1 -0
  32. package/dist/component/connect/payoutWrites.js +19 -0
  33. package/dist/component/connect/payoutWrites.js.map +1 -0
  34. package/dist/component/earnings/triggers.d.ts +44 -0
  35. package/dist/component/earnings/triggers.d.ts.map +1 -1
  36. package/dist/component/payoutSync/helpers.d.ts +44 -0
  37. package/dist/component/payoutSync/helpers.d.ts.map +1 -0
  38. package/dist/component/payoutSync/helpers.js +60 -0
  39. package/dist/component/payoutSync/helpers.js.map +1 -0
  40. package/dist/component/payoutSync/mutations.d.ts +51 -0
  41. package/dist/component/payoutSync/mutations.d.ts.map +1 -0
  42. package/dist/component/payoutSync/mutations.js +88 -0
  43. package/dist/component/payoutSync/mutations.js.map +1 -0
  44. package/dist/component/payoutSync/queries.d.ts +16 -0
  45. package/dist/component/payoutSync/queries.d.ts.map +1 -0
  46. package/dist/component/payoutSync/queries.js +11 -0
  47. package/dist/component/payoutSync/queries.js.map +1 -0
  48. package/dist/component/payoutSync/schema.d.ts +46 -0
  49. package/dist/component/payoutSync/schema.d.ts.map +1 -0
  50. package/dist/component/payoutSync/schema.js +22 -0
  51. package/dist/component/payoutSync/schema.js.map +1 -0
  52. package/dist/component/payoutSync/validators.d.ts +137 -0
  53. package/dist/component/payoutSync/validators.d.ts.map +1 -0
  54. package/dist/component/payoutSync/validators.js +19 -0
  55. package/dist/component/payoutSync/validators.js.map +1 -0
  56. package/dist/component/schema.d.ts +21 -0
  57. package/dist/component/schema.js +2 -0
  58. package/dist/component/schema.js.map +1 -1
  59. package/docs/read-contracts.md +40 -5
  60. package/package.json +1 -1
  61. package/src/client/connect/payoutSync.test.ts +313 -0
  62. package/src/client/connect/payoutSync.ts +93 -0
  63. package/src/client/connect/payoutSyncTestHelpers.ts +82 -0
  64. package/src/client/connect/payoutSyncValidation.ts +74 -0
  65. package/src/client/index.ts +14 -11
  66. package/src/client/readContracts.ts +12 -0
  67. package/src/component/_generated/api.ts +10 -0
  68. package/src/component/_generated/component.ts +82 -0
  69. package/src/component/connect/mutations.ts +4 -30
  70. package/src/component/connect/payoutWrites.ts +25 -0
  71. package/src/component/payout-sync.test.ts +117 -0
  72. package/src/component/payoutSync/helpers.ts +86 -0
  73. package/src/component/payoutSync/mutations.ts +102 -0
  74. package/src/component/payoutSync/queries.ts +10 -0
  75. package/src/component/payoutSync/schema.ts +25 -0
  76. package/src/component/payoutSync/validators.ts +21 -0
  77. package/src/component/schema.ts +2 -0
package/CHANGELOG.md CHANGED
@@ -14,6 +14,12 @@
14
14
  - Remove internal tracker references from public documentation and add a
15
15
  regression check that prevents their reintroduction.
16
16
 
17
+ ## [0.23.2](https://github.com/FantasticDevHQ/better-stripe/compare/v0.23.1...v0.23.2) (2026-10-15)
18
+
19
+ ### Bug Fixes
20
+
21
+ - **payouts:** reconcile current provider observations with durable generations ([#196](https://github.com/FantasticDevHQ/better-stripe/issues/196)) ([6db9eb2](https://github.com/FantasticDevHQ/better-stripe/commit/6db9eb2c591a99e36bd868cc0581467a2a4564ec))
22
+
17
23
  ## [0.23.1](https://github.com/FantasticDevHQ/better-stripe/compare/v0.23.0...v0.23.1) (2026-10-15)
18
24
 
19
25
  ### Bug Fixes
package/README.md CHANGED
@@ -55,7 +55,7 @@ schedule controls alone do not enforce a minimum.
55
55
 
56
56
  ## Status
57
57
 
58
- **Version**: `0.23.1` <!-- x-release-please-version --> (pre-1.0). API may change between minor versions until 1.0.
58
+ **Version**: `0.23.2` <!-- x-release-please-version --> (pre-1.0). API may change between minor versions until 1.0.
59
59
 
60
60
  Used in production by its authors. Webhook pipeline is covered by unit tests and a live E2E harness (`npm run e2e:webhooks`) that fires real Stripe-signed events and asserts the ledger.
61
61
 
@@ -9,6 +9,27 @@ export declare const scope: {
9
9
  };
10
10
  export declare function setup(amounts?: number[], currency?: string): Promise<{
11
11
  t: import("convex-test").TestConvex<import("convex/server").SchemaDefinition<{
12
+ payoutSyncClaims: import("convex/server").TableDefinition<import("convex/values").VObject<{
13
+ acceptedAt?: number | undefined;
14
+ acceptedFingerprint?: string | undefined;
15
+ acceptedGeneration?: number | undefined;
16
+ accountId: string;
17
+ generation: number;
18
+ startedAt: number;
19
+ status: "accepted" | "pending" | "unknown";
20
+ stripePayoutId: string;
21
+ }, {
22
+ stripePayoutId: import("convex/values").VString<string, "required">;
23
+ accountId: import("convex/values").VString<string, "required">;
24
+ generation: import("convex/values").VFloat64<number, "required">;
25
+ status: import("convex/values").VUnion<"accepted" | "pending" | "unknown", [import("convex/values").VLiteral<"pending", "required">, import("convex/values").VLiteral<"accepted", "required">, import("convex/values").VLiteral<"unknown", "required">], "required", never>;
26
+ startedAt: import("convex/values").VFloat64<number, "required">;
27
+ acceptedGeneration: import("convex/values").VFloat64<number | undefined, "optional">;
28
+ acceptedAt: import("convex/values").VFloat64<number | undefined, "optional">;
29
+ acceptedFingerprint: import("convex/values").VString<string | undefined, "optional">;
30
+ }, "required", "acceptedAt" | "acceptedFingerprint" | "acceptedGeneration" | "accountId" | "generation" | "startedAt" | "status" | "stripePayoutId">, {
31
+ by_stripe_payout_id: ["stripePayoutId", "_creationTime"];
32
+ }, {}, {}>;
12
33
  payoutFeeBalances: import("convex/server").TableDefinition<import("convex/values").VObject<{
13
34
  accountId: string;
14
35
  amount: number;
@@ -1305,6 +1326,27 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
1305
1326
  }>;
1306
1327
  export declare function historical(currency?: string): Promise<{
1307
1328
  t: import("convex-test").TestConvex<import("convex/server").SchemaDefinition<{
1329
+ payoutSyncClaims: import("convex/server").TableDefinition<import("convex/values").VObject<{
1330
+ acceptedAt?: number | undefined;
1331
+ acceptedFingerprint?: string | undefined;
1332
+ acceptedGeneration?: number | undefined;
1333
+ accountId: string;
1334
+ generation: number;
1335
+ startedAt: number;
1336
+ status: "accepted" | "pending" | "unknown";
1337
+ stripePayoutId: string;
1338
+ }, {
1339
+ stripePayoutId: import("convex/values").VString<string, "required">;
1340
+ accountId: import("convex/values").VString<string, "required">;
1341
+ generation: import("convex/values").VFloat64<number, "required">;
1342
+ status: import("convex/values").VUnion<"accepted" | "pending" | "unknown", [import("convex/values").VLiteral<"pending", "required">, import("convex/values").VLiteral<"accepted", "required">, import("convex/values").VLiteral<"unknown", "required">], "required", never>;
1343
+ startedAt: import("convex/values").VFloat64<number, "required">;
1344
+ acceptedGeneration: import("convex/values").VFloat64<number | undefined, "optional">;
1345
+ acceptedAt: import("convex/values").VFloat64<number | undefined, "optional">;
1346
+ acceptedFingerprint: import("convex/values").VString<string | undefined, "optional">;
1347
+ }, "required", "acceptedAt" | "acceptedFingerprint" | "acceptedGeneration" | "accountId" | "generation" | "startedAt" | "status" | "stripePayoutId">, {
1348
+ by_stripe_payout_id: ["stripePayoutId", "_creationTime"];
1349
+ }, {}, {}>;
1308
1350
  payoutFeeBalances: import("convex/server").TableDefinition<import("convex/values").VObject<{
1309
1351
  accountId: string;
1310
1352
  amount: number;
@@ -1 +1 @@
1
- {"version":3,"file":"payoutAdoptionTestHelpers.d.ts","sourceRoot":"","sources":["../../../src/client/connect/payoutAdoptionTestHelpers.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAKvD,eAAO,MAAM,SAAS,EAIN,SAAS,CAAC;AAC1B,eAAO,MAAM,KAAK;IAChB,SAAS;IACT,QAAQ;IACR,YAAY;IACZ,QAAQ;IACR,sBAAsB;CACvB,CAAC;AACF,wBAAsB,KAAK,CAAC,OAAO,WAAa,EAAE,QAAQ,SAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;YArJ3C,oBAAoB;;;;;;;;;;;YAapB,QAAQ,6BAAmB,MAAM;;;;;;;;;YAYjC,aAAa;;;;;;YAGb,QAAQ,6BAAmB,MAAM;;;;;;;;;;;YAcjC,IAAI,iCAAuB;gBAAE,MAAM,CAAC,EAAE,MAAM,CAAC;gBAAC,KAAK,CAAC,EAAE,MAAM,CAAA;aAAE;;;;;;;;;;;;;;;;YAM9D,QAAQ,6BAAmB,MAAM;;;;;;;;;;;;;;;YAKjC,QAAQ;;;;;wBAQA,IAAI;;;;;;;YAUZ,IAAI;;;;YAIJ,QAAQ,8BAAoB,MAAM;YAGlC,MAAM,iCACW;gBACb,MAAM,EAAE,MAAM,CAAC;gBACf,QAAQ,EAAE,MAAM,CAAC;gBACjB,QAAQ,EAAE,MAAM,CAAC;aAClB;;;;gBA2CG,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDrB"}
@@ -0,0 +1,32 @@
1
+ import type Stripe from "stripe";
2
+ import type { Infer } from "convex/values";
3
+ import type { Component, RunCtx } from "../helpers.js";
4
+ import type { result } from "../../component/payoutSync/validators.js";
5
+ import { type PayoutSyncScope } from "./payoutSyncValidation.js";
6
+ export type PayoutSyncOptions = {
7
+ stripePayoutId: string;
8
+ scope: PayoutSyncScope;
9
+ };
10
+ export type PayoutSyncResult = Infer<typeof result>;
11
+ export type PreparedPayoutSync = Awaited<ReturnType<typeof preparePayoutSync>>;
12
+ /** Package-internal preparation for transactional host webhook dispatch. No financial record write. */
13
+ export declare function preparePayoutSync(stripe: Stripe, component: Component, ctx: RunCtx, opts: PayoutSyncOptions): Promise<{
14
+ stripePayoutId: string;
15
+ accountId: string;
16
+ generation: number;
17
+ payout: {
18
+ accountId: string;
19
+ amount: number;
20
+ arrivalDate?: string | undefined;
21
+ currency: string;
22
+ failureCode?: string | undefined;
23
+ failureMessage?: string | undefined;
24
+ metadata?: Record<string, string> | undefined;
25
+ method?: string | undefined;
26
+ status: "canceled" | "failed" | "in_transit" | "paid" | "pending";
27
+ stripePayoutId: string;
28
+ };
29
+ }>;
30
+ /** Host must authorize scope. This only reads Stripe and synchronizes the existing financial record. */
31
+ export declare function syncPayoutFromStripe(stripe: Stripe, component: Component, ctx: RunCtx, opts: PayoutSyncOptions): Promise<PayoutSyncResult>;
32
+ //# sourceMappingURL=payoutSync.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payoutSync.d.ts","sourceRoot":"","sources":["../../../src/client/connect/payoutSync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAIvD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0CAA0C,CAAC;AACvE,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,2BAA2B,CAAC;AACnC,MAAM,MAAM,iBAAiB,GAAG;IAC9B,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,eAAe,CAAC;CACxB,CAAC;AACF,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,MAAM,CAAC,CAAC;AACpD,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC,CAAC;AAgB/E,uGAAuG;AACvG,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,iBAAiB;;;;;;;;;;;;;;;;GA+BxB;AACD,wGAAwG;AACxG,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,iBAAiB,GACtB,OAAO,CAAC,gBAAgB,CAAC,CAgB3B"}
@@ -0,0 +1,48 @@
1
+ import { runMutationOrThrow } from "../helpers.js";
2
+ import { componentRef } from "../webhooks/helpers.js";
3
+ import { validateIdentity } from "../../component/payoutSync/helpers.js";
4
+ import { payoutAccount, payoutSnapshot, } from "./payoutSyncValidation.js";
5
+ async function markUnknown(component, ctx, observation) {
6
+ await runMutationOrThrow(ctx, componentRef(component, "payoutSync/mutations/markUnknown"), observation);
7
+ }
8
+ /** Package-internal preparation for transactional host webhook dispatch. No financial record write. */
9
+ export async function preparePayoutSync(stripe, component, ctx, opts) {
10
+ const identity = {
11
+ stripePayoutId: opts.stripePayoutId,
12
+ accountId: payoutAccount(opts.scope),
13
+ };
14
+ validateIdentity(identity);
15
+ if (!ctx.runMutation)
16
+ throw new Error("Payout synchronization requires runMutation.");
17
+ const generation = (await runMutationOrThrow(ctx, componentRef(component, "payoutSync/mutations/begin"), identity));
18
+ try {
19
+ const payout = await stripe.payouts.retrieve(identity.stripePayoutId, {}, identity.accountId === "platform"
20
+ ? {}
21
+ : { stripeAccount: identity.accountId });
22
+ return {
23
+ ...identity,
24
+ generation,
25
+ payout: payoutSnapshot(payout, identity),
26
+ };
27
+ }
28
+ catch (error) {
29
+ await markUnknown(component, ctx, { ...identity, generation });
30
+ throw error;
31
+ }
32
+ }
33
+ /** Host must authorize scope. This only reads Stripe and synchronizes the existing financial record. */
34
+ export async function syncPayoutFromStripe(stripe, component, ctx, opts) {
35
+ const observation = await preparePayoutSync(stripe, component, ctx, opts);
36
+ try {
37
+ return (await runMutationOrThrow(ctx, componentRef(component, "payoutSync/mutations/finish"), observation));
38
+ }
39
+ catch (error) {
40
+ await markUnknown(component, ctx, {
41
+ stripePayoutId: observation.stripePayoutId,
42
+ accountId: observation.accountId,
43
+ generation: observation.generation,
44
+ });
45
+ throw error;
46
+ }
47
+ }
48
+ //# sourceMappingURL=payoutSync.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payoutSync.js","sourceRoot":"","sources":["../../../src/client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