@fantastic.dev/better-stripe 0.107.0 → 0.108.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 (40) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +1 -1
  3. package/dist/client/billing/renewalAttach/internal/observation/reader.d.ts +64 -0
  4. package/dist/client/billing/renewalAttach/internal/observation/reader.d.ts.map +1 -0
  5. package/dist/client/billing/renewalAttach/internal/observation/reader.js +170 -0
  6. package/dist/client/billing/renewalAttach/internal/observation/reader.js.map +1 -0
  7. package/dist/client/billing/renewalAttach/internal/observation/readerAuthorization.d.ts +44 -0
  8. package/dist/client/billing/renewalAttach/internal/observation/readerAuthorization.d.ts.map +1 -0
  9. package/dist/client/billing/renewalAttach/internal/observation/readerAuthorization.js +145 -0
  10. package/dist/client/billing/renewalAttach/internal/observation/readerAuthorization.js.map +1 -0
  11. package/dist/client/billing/renewalAttach/internal/operations/sourceOperations.d.ts +2 -0
  12. package/dist/client/billing/renewalAttach/internal/operations/sourceOperations.d.ts.map +1 -1
  13. package/dist/client/billing/renewalAttach/internal/operations/sourceOperations.js +1 -0
  14. package/dist/client/billing/renewalAttach/internal/operations/sourceOperations.js.map +1 -1
  15. package/dist/client/billing/renewalAttach/internal/producer/classOwnedActionRoot.d.ts +2 -0
  16. package/dist/client/billing/renewalAttach/internal/producer/classOwnedActionRoot.d.ts.map +1 -1
  17. package/dist/client/billing/renewalAttach/internal/producer/classOwnedActionRoot.js +9 -0
  18. package/dist/client/billing/renewalAttach/internal/producer/classOwnedActionRoot.js.map +1 -1
  19. package/dist/client/connect/payoutExecutionTestHelpers.d.ts +16 -16
  20. package/dist/client/connect/payoutSyncTestHelpers.d.ts +16 -16
  21. package/dist/component/balanceFunding/internal/actions.d.ts +11 -11
  22. package/dist/component/balanceFunding/mutations.d.ts +27 -27
  23. package/dist/component/balanceFunding/stateHandlers.d.ts +8 -8
  24. package/dist/component/earnings/triggers.d.ts +16 -16
  25. package/dist/component/financialObservations/settlementHelpers.d.ts +3 -3
  26. package/dist/component/payoutRelease/queries.d.ts +2 -2
  27. package/dist/component/payoutRelease/queries.d.ts.map +1 -1
  28. package/dist/component/processingCostReconciliation/rollback.d.ts +1 -1
  29. package/dist/component/usage/allowance.fixtures.d.ts +16 -16
  30. package/docs/renewal-context-reads.md +52 -0
  31. package/package.json +1 -1
  32. package/src/client/billing/renewalAttach/internal/observation/reader.integration.test.ts +93 -0
  33. package/src/client/billing/renewalAttach/internal/observation/reader.ts +241 -0
  34. package/src/client/billing/renewalAttach/internal/observation/readerAuthorization.ts +179 -0
  35. package/src/client/billing/renewalAttach/internal/observation/readerControls.integration.test.ts +553 -0
  36. package/src/client/billing/renewalAttach/internal/operations/sourceOperations.ts +3 -0
  37. package/src/client/billing/renewalAttach/internal/producer/classOwnedActionRoot.ts +12 -0
  38. package/src/client/billing/renewalAttach/internal/test-fixtures/observationReader.ts +100 -0
  39. package/src/client/billing/renewalAttach/internal/test-fixtures/producerConfigureAdmission.ts +9 -0
  40. package/src/client/billing/renewalAttach/internal/test-fixtures/producerInitialOperation.ts +5 -1
@@ -2642,14 +2642,6 @@ export declare function setup(amounts?: number[]): Promise<{
2642
2642
  preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
2643
2643
  requestKey: string;
2644
2644
  result?: {
2645
- reason: "identity_changed" | "revision_changed" | "scope_busy";
2646
- retryable: false;
2647
- status: "conflict";
2648
- } | {
2649
- reason: "policy_invalid";
2650
- retryable: false;
2651
- status: "rejected";
2652
- } | {
2653
2645
  operation: {
2654
2646
  accountId: string;
2655
2647
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -2660,6 +2652,14 @@ export declare function setup(amounts?: number[]): Promise<{
2660
2652
  } | {
2661
2653
  enabled: boolean;
2662
2654
  status: "unchanged";
2655
+ } | {
2656
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
2657
+ retryable: false;
2658
+ status: "conflict";
2659
+ } | {
2660
+ reason: "policy_invalid";
2661
+ retryable: false;
2662
+ status: "rejected";
2663
2663
  } | {
2664
2664
  reason: "provider_pending";
2665
2665
  retryable: true;
@@ -2670,14 +2670,6 @@ export declare function setup(amounts?: number[]): Promise<{
2670
2670
  payload: import("convex/values").VString<string, "required">;
2671
2671
  preparationId: import("convex/values").VId<import("convex/values").GenericId<"balanceFundingPreparations">, "required">;
2672
2672
  result: import("convex/values").VUnion<{
2673
- reason: "identity_changed" | "revision_changed" | "scope_busy";
2674
- retryable: false;
2675
- status: "conflict";
2676
- } | {
2677
- reason: "policy_invalid";
2678
- retryable: false;
2679
- status: "rejected";
2680
- } | {
2681
2673
  operation: {
2682
2674
  accountId: string;
2683
2675
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -2688,6 +2680,14 @@ export declare function setup(amounts?: number[]): Promise<{
2688
2680
  } | {
2689
2681
  enabled: boolean;
2690
2682
  status: "unchanged";
2683
+ } | {
2684
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
2685
+ retryable: false;
2686
+ status: "conflict";
2687
+ } | {
2688
+ reason: "policy_invalid";
2689
+ retryable: false;
2690
+ status: "rejected";
2691
2691
  } | {
2692
2692
  reason: "provider_pending";
2693
2693
  retryable: true;
@@ -2646,6 +2646,14 @@ export declare function setup(scope?: Scope): Promise<{
2646
2646
  preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
2647
2647
  requestKey: string;
2648
2648
  result?: {
2649
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
2650
+ retryable: false;
2651
+ status: "conflict";
2652
+ } | {
2653
+ reason: "policy_invalid";
2654
+ retryable: false;
2655
+ status: "rejected";
2656
+ } | {
2649
2657
  operation: {
2650
2658
  accountId: string;
2651
2659
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -2656,14 +2664,6 @@ export declare function setup(scope?: Scope): Promise<{
2656
2664
  } | {
2657
2665
  enabled: boolean;
2658
2666
  status: "unchanged";
2659
- } | {
2660
- reason: "identity_changed" | "revision_changed" | "scope_busy";
2661
- retryable: false;
2662
- status: "conflict";
2663
- } | {
2664
- reason: "policy_invalid";
2665
- retryable: false;
2666
- status: "rejected";
2667
2667
  } | {
2668
2668
  reason: "provider_pending";
2669
2669
  retryable: true;
@@ -2674,6 +2674,14 @@ export declare function setup(scope?: Scope): Promise<{
2674
2674
  payload: import("convex/values").VString<string, "required">;
2675
2675
  preparationId: import("convex/values").VId<import("convex/values").GenericId<"balanceFundingPreparations">, "required">;
2676
2676
  result: import("convex/values").VUnion<{
2677
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
2678
+ retryable: false;
2679
+ status: "conflict";
2680
+ } | {
2681
+ reason: "policy_invalid";
2682
+ retryable: false;
2683
+ status: "rejected";
2684
+ } | {
2677
2685
  operation: {
2678
2686
  accountId: string;
2679
2687
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -2684,14 +2692,6 @@ export declare function setup(scope?: Scope): Promise<{
2684
2692
  } | {
2685
2693
  enabled: boolean;
2686
2694
  status: "unchanged";
2687
- } | {
2688
- reason: "identity_changed" | "revision_changed" | "scope_busy";
2689
- retryable: false;
2690
- status: "conflict";
2691
- } | {
2692
- reason: "policy_invalid";
2693
- retryable: false;
2694
- status: "rejected";
2695
2695
  } | {
2696
2696
  reason: "provider_pending";
2697
2697
  retryable: true;
@@ -9,6 +9,17 @@ export declare const bridge: import("convex/server").RegisteredAction<"internal"
9
9
  stripeSubscriptionId: string;
10
10
  version: number;
11
11
  }, Promise<{
12
+ status: "ready";
13
+ value: {
14
+ customerAccount: string;
15
+ enabled?: boolean | undefined;
16
+ paymentMethodId: string | null;
17
+ paymentMethodTypes?: string[] | null | undefined;
18
+ phase: "apply" | "attach" | "create";
19
+ providerApiVersion: string;
20
+ stripeSubscriptionId: string;
21
+ };
22
+ } | {
12
23
  reason: "history_incomplete" | "provider_outcome_unknown";
13
24
  retryable: false;
14
25
  status: "unknown";
@@ -24,16 +35,5 @@ export declare const bridge: import("convex/server").RegisteredAction<"internal"
24
35
  reason: "provider_pending";
25
36
  retryable: true;
26
37
  status: "not_ready";
27
- } | {
28
- status: "ready";
29
- value: {
30
- customerAccount: string;
31
- enabled?: boolean | undefined;
32
- paymentMethodId: string | null;
33
- paymentMethodTypes?: string[] | null | undefined;
34
- phase: "apply" | "attach" | "create";
35
- providerApiVersion: string;
36
- stripeSubscriptionId: string;
37
- };
38
38
  }>>;
39
39
  //# sourceMappingURL=actions.d.ts.map
@@ -595,6 +595,22 @@ export declare const startWorkflow: import("convex/server").RegisteredMutation<"
595
595
  } & {
596
596
  providerAction: string;
597
597
  }, Promise<{
598
+ reason: "history_incomplete" | "provider_outcome_unknown";
599
+ retryable: false;
600
+ status: "unknown";
601
+ } | {
602
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
603
+ retryable: false;
604
+ status: "conflict";
605
+ } | {
606
+ reason: "invalid_scope" | "policy_invalid" | "unsupported_source";
607
+ retryable: false;
608
+ status: "rejected";
609
+ } | {
610
+ reason: "provider_pending";
611
+ retryable: true;
612
+ status: "not_ready";
613
+ } | {
598
614
  operation: {
599
615
  accountId: string;
600
616
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -611,7 +627,16 @@ export declare const startWorkflow: import("convex/server").RegisteredMutation<"
611
627
  version: number;
612
628
  };
613
629
  status: "canceled";
614
- } | {
630
+ }>>;
631
+ export declare const resumeWorkflow: import("convex/server").RegisteredMutation<"public", {
632
+ accountId: string;
633
+ definitionVersion: string;
634
+ operationId: import("convex/values").GenericId<"balanceFundingOperations">;
635
+ providerApiVersion: string;
636
+ scopeKey: string;
637
+ stripeSubscriptionId: string;
638
+ version: number;
639
+ }, Promise<{
615
640
  reason: "history_incomplete" | "provider_outcome_unknown";
616
641
  retryable: false;
617
642
  status: "unknown";
@@ -627,16 +652,7 @@ export declare const startWorkflow: import("convex/server").RegisteredMutation<"
627
652
  reason: "provider_pending";
628
653
  retryable: true;
629
654
  status: "not_ready";
630
- }>>;
631
- export declare const resumeWorkflow: import("convex/server").RegisteredMutation<"public", {
632
- accountId: string;
633
- definitionVersion: string;
634
- operationId: import("convex/values").GenericId<"balanceFundingOperations">;
635
- providerApiVersion: string;
636
- scopeKey: string;
637
- stripeSubscriptionId: string;
638
- version: number;
639
- }, Promise<{
655
+ } | {
640
656
  operation: {
641
657
  accountId: string;
642
658
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -653,22 +669,6 @@ export declare const resumeWorkflow: import("convex/server").RegisteredMutation<
653
669
  version: number;
654
670
  };
655
671
  status: "canceled";
656
- } | {
657
- reason: "history_incomplete" | "provider_outcome_unknown";
658
- retryable: false;
659
- status: "unknown";
660
- } | {
661
- reason: "identity_changed" | "revision_changed" | "scope_busy";
662
- retryable: false;
663
- status: "conflict";
664
- } | {
665
- reason: "invalid_scope" | "policy_invalid" | "unsupported_source";
666
- retryable: false;
667
- status: "rejected";
668
- } | {
669
- reason: "provider_pending";
670
- retryable: true;
671
- status: "not_ready";
672
672
  }>>;
673
673
  export declare const cancelWorkflow: import("convex/server").RegisteredMutation<"public", {
674
674
  accountId: string;
@@ -5,6 +5,14 @@ export declare function savePreparationHandler(ctx: MutationCtx, args: Infer<typ
5
5
  preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
6
6
  }>;
7
7
  export declare function beginHandler(ctx: MutationCtx, args: Infer<typeof beginArgs>): Promise<{
8
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
9
+ retryable: false;
10
+ status: "conflict";
11
+ } | {
12
+ reason: "policy_invalid";
13
+ retryable: false;
14
+ status: "rejected";
15
+ } | {
8
16
  operation: {
9
17
  accountId: string;
10
18
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -15,14 +23,6 @@ export declare function beginHandler(ctx: MutationCtx, args: Infer<typeof beginA
15
23
  } | {
16
24
  enabled: boolean;
17
25
  status: "unchanged";
18
- } | {
19
- reason: "identity_changed" | "revision_changed" | "scope_busy";
20
- retryable: false;
21
- status: "conflict";
22
- } | {
23
- reason: "policy_invalid";
24
- retryable: false;
25
- status: "rejected";
26
26
  } | {
27
27
  reason: "provider_pending";
28
28
  retryable: true;
@@ -372,6 +372,14 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
372
372
  preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
373
373
  requestKey: string;
374
374
  result?: {
375
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
376
+ retryable: false;
377
+ status: "conflict";
378
+ } | {
379
+ reason: "policy_invalid";
380
+ retryable: false;
381
+ status: "rejected";
382
+ } | {
375
383
  operation: {
376
384
  accountId: string;
377
385
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -382,14 +390,6 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
382
390
  } | {
383
391
  enabled: boolean;
384
392
  status: "unchanged";
385
- } | {
386
- reason: "identity_changed" | "revision_changed" | "scope_busy";
387
- retryable: false;
388
- status: "conflict";
389
- } | {
390
- reason: "policy_invalid";
391
- retryable: false;
392
- status: "rejected";
393
393
  } | {
394
394
  reason: "provider_pending";
395
395
  retryable: true;
@@ -3417,6 +3417,14 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
3417
3417
  preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
3418
3418
  requestKey: string;
3419
3419
  result?: {
3420
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
3421
+ retryable: false;
3422
+ status: "conflict";
3423
+ } | {
3424
+ reason: "policy_invalid";
3425
+ retryable: false;
3426
+ status: "rejected";
3427
+ } | {
3420
3428
  operation: {
3421
3429
  accountId: string;
3422
3430
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -3427,14 +3435,6 @@ export declare const mutation: import("convex-helpers/server/customFunctions").C
3427
3435
  } | {
3428
3436
  enabled: boolean;
3429
3437
  status: "unchanged";
3430
- } | {
3431
- reason: "identity_changed" | "revision_changed" | "scope_busy";
3432
- retryable: false;
3433
- status: "conflict";
3434
- } | {
3435
- reason: "policy_invalid";
3436
- retryable: false;
3437
- status: "rejected";
3438
3438
  } | {
3439
3439
  reason: "provider_pending";
3440
3440
  retryable: true;
@@ -9,9 +9,9 @@ export declare function legOwnership(ctx: MutationCtx, bucketKey: string, prior:
9
9
  orgId: string | undefined;
10
10
  ownershipStatus: "ambiguous";
11
11
  } | {
12
+ registrationId?: undefined;
12
13
  userId?: undefined;
13
14
  orgId?: undefined;
14
- registrationId?: undefined;
15
15
  ownershipStatus: "ambiguous";
16
16
  } | {
17
17
  registrationId: import("convex/values").GenericId<"financialOwnership">;
@@ -19,9 +19,9 @@ export declare function legOwnership(ctx: MutationCtx, bucketKey: string, prior:
19
19
  orgId: string | undefined;
20
20
  ownershipStatus: "unknown";
21
21
  } | {
22
+ registrationId?: undefined;
22
23
  userId?: undefined;
23
24
  orgId?: undefined;
24
- registrationId?: undefined;
25
25
  ownershipStatus: "unknown";
26
26
  } | {
27
27
  registrationId: import("convex/values").GenericId<"financialOwnership">;
@@ -29,9 +29,9 @@ export declare function legOwnership(ctx: MutationCtx, bucketKey: string, prior:
29
29
  orgId: string | undefined;
30
30
  ownershipStatus: "contradictory";
31
31
  } | {
32
+ registrationId?: undefined;
32
33
  userId?: undefined;
33
34
  orgId?: undefined;
34
- registrationId?: undefined;
35
35
  ownershipStatus: "contradictory";
36
36
  } | {
37
37
  registrationId: import("convex/values").GenericId<"financialOwnership">;
@@ -163,10 +163,10 @@ export declare const snapshot: import("convex/server").RegisteredQuery<"public",
163
163
  accountId: string;
164
164
  ownerKey: string;
165
165
  }, Promise<{
166
- transfers?: undefined;
167
- claims?: undefined;
168
166
  status: "held";
169
167
  reason: "snapshot_limit";
168
+ transfers?: undefined;
169
+ claims?: undefined;
170
170
  } | {
171
171
  reason?: undefined;
172
172
  status: "ready";
@@ -1 +1 @@
1
- {"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/component/payoutRelease/queries.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAIlB,CAAC;AACH,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAiBd,CAAC;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BlB,CAAC;AAEH,eAAO,MAAM,IAAI;;;;;;;GAQf,CAAC;AAEH,4FAA4F;AAC5F,eAAO,MAAM,QAAQ;;;;;;YAsBE,MAAM;YAAmB,gBAAgB;;;YAS3C,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAE1B,CAAC"}
1
+ {"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/component/payoutRelease/queries.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAIlB,CAAC;AACH,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAiBd,CAAC;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BlB,CAAC;AAEH,eAAO,MAAM,IAAI;;;;;;;GAQf,CAAC;AAEH,4FAA4F;AAC5F,eAAO,MAAM,QAAQ;;;;YAsBE,MAAM;YAAmB,gBAAgB;;;;;YAS3C,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAE1B,CAAC"}
@@ -14,7 +14,7 @@ export declare function checkRollback(ctx: MutationCtx, op: Doc<"processingCostR
14
14
  readonly bindFunding?: undefined;
15
15
  } | {
16
16
  reason?: undefined;
17
- retryable?: undefined;
17
+ readonly retryable?: undefined;
18
18
  readonly status: "ready";
19
19
  readonly bindFunding: boolean;
20
20
  }>;
@@ -2632,6 +2632,14 @@ export declare function setupAllowance(): Promise<{
2632
2632
  preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
2633
2633
  requestKey: string;
2634
2634
  result?: {
2635
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
2636
+ retryable: false;
2637
+ status: "conflict";
2638
+ } | {
2639
+ reason: "policy_invalid";
2640
+ retryable: false;
2641
+ status: "rejected";
2642
+ } | {
2635
2643
  operation: {
2636
2644
  accountId: string;
2637
2645
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -2642,14 +2650,6 @@ export declare function setupAllowance(): Promise<{
2642
2650
  } | {
2643
2651
  enabled: boolean;
2644
2652
  status: "unchanged";
2645
- } | {
2646
- reason: "identity_changed" | "revision_changed" | "scope_busy";
2647
- retryable: false;
2648
- status: "conflict";
2649
- } | {
2650
- reason: "policy_invalid";
2651
- retryable: false;
2652
- status: "rejected";
2653
2653
  } | {
2654
2654
  reason: "provider_pending";
2655
2655
  retryable: true;
@@ -2660,6 +2660,14 @@ export declare function setupAllowance(): Promise<{
2660
2660
  payload: import("convex/values").VString<string, "required">;
2661
2661
  preparationId: import("convex/values").VId<import("convex/values").GenericId<"balanceFundingPreparations">, "required">;
2662
2662
  result: import("convex/values").VUnion<{
2663
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
2664
+ retryable: false;
2665
+ status: "conflict";
2666
+ } | {
2667
+ reason: "policy_invalid";
2668
+ retryable: false;
2669
+ status: "rejected";
2670
+ } | {
2663
2671
  operation: {
2664
2672
  accountId: string;
2665
2673
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -2670,14 +2678,6 @@ export declare function setupAllowance(): Promise<{
2670
2678
  } | {
2671
2679
  enabled: boolean;
2672
2680
  status: "unchanged";
2673
- } | {
2674
- reason: "identity_changed" | "revision_changed" | "scope_busy";
2675
- retryable: false;
2676
- status: "conflict";
2677
- } | {
2678
- reason: "policy_invalid";
2679
- retryable: false;
2680
- status: "rejected";
2681
2681
  } | {
2682
2682
  reason: "provider_pending";
2683
2683
  retryable: true;
@@ -942,3 +942,55 @@ future-period observation entry still needs fresh host authorization, a separate
942
942
  bounded GET-only lifetime and complete lifecycle/invoice/history acquisition.
943
943
  Production Source profiles remain empty. Provider qualification, genuine
944
944
  generation/deployed compatibility and final Dojo acceptance remain outstanding.
945
+
946
+ ### Private fresh authorized history reader
947
+
948
+ `captureAuthorizedObservationHistoryReader` supplies a private once-only `read()`
949
+ method for a freshly authenticated Action. Its production compiled entry list is
950
+ empty and refuses before root, Action or clock reflection. An enabled trusted
951
+ entry must bind the exact maintained SDK component object, a stable installation
952
+ scope key and a real host authorization query reference. The class bootstrap
953
+ retains its existing three fields. Calling Action metadata does not identify the
954
+ target component for authorization.
955
+
956
+ The host query receives exactly the installation scope, attachment operation ID
957
+ and configure operation ID. It must authenticate through its own `ctx.auth` and
958
+ apply the host's business policy to both operations. It returns a closed stable
959
+ authorization snapshot containing the authenticated `tokenIdentifier`, those
960
+ exact scope/operation values, provider scope, authorization ID/revision and an
961
+ expiry in wall-clock milliseconds. Provider scope is platform mode, null connected
962
+ account, live mode, customer-account ID, original subscription ID and owned
963
+ schedule ID. The reader compares that scope to the fully reconstructed retained
964
+ history. Authorization snapshots may differ from the original retained host
965
+ envelopes; permission to observe is checked afresh.
966
+
967
+ The Action identity and host authorization query run before component DATA reads
968
+ and again before release. Both authorization snapshots must be identical,
969
+ including expiry; sliding expiries or revision changes reject. Authentication,
970
+ RPC and root pointers, component identity and semantic function addresses are
971
+ checked around every await. Convex generated references may be fresh proxy
972
+ objects on access, so address checks compare the exact `name`, `reference` or
973
+ `functionHandle` discriminator/value rather than proxy object equality.
974
+
975
+ A new 30-second wall/monotonic budget starts before metadata binding and covers
976
+ idle time before `read()`, both authorization phases and reconstruction. A timeout
977
+ race closes hung calls permanently; late fulfillment cannot continue reading.
978
+ Clock rollback, deadline equality, expired authorization and pointer drift close
979
+ the reader. The old write Owner and its period boundary are never consulted.
980
+
981
+ Only four existing component query routes are available: operation load, attempt
982
+ manifest, full event and retained acknowledgement. A complete parent/child read
983
+ makes at most twelve component queries plus two host authorization queries.
984
+ Each query reply is detached and frozen before another query. Event counts are
985
+ captured once from validated own DATA and cannot grow across awaits.
986
+ There is no journal mutation, reservation, client selection or provider request.
987
+ The result contains immutable retained history and the fresh authorization
988
+ snapshot, with operational authority false. The embedded historical DATA retains
989
+ its false provider-authentication and public-delivery claims.
990
+
991
+ These checks establish two authorization points, not uninterrupted permission
992
+ between them or after return. Sequential queries are not an atomic snapshot;
993
+ contradictory history rejects without automatic refetch. A synthetic registered
994
+ host query in controlled tests does not bind a real installation policy. Fresh
995
+ GET acquisition, provider lifecycle/invoice/history evidence, genuine generation
996
+ and deployed compatibility remain outstanding.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fantastic.dev/better-stripe",
3
- "version": "0.107.0",
3
+ "version": "0.108.0",
4
4
  "description": "Convex component for Stripe Accounts v2, subscriptions, metered billing and Connect marketplaces, with React workflows.",
5
5
  "keywords": [
6
6
  "stripe",
@@ -0,0 +1,93 @@
1
+ import { expect, it, vi } from "vitest";
2
+ import {
3
+ configureAdmissionCase,
4
+ admissionControls,
5
+ } from "../test-fixtures/producerConfigureAdmission.js";
6
+ import {
7
+ prepareObservationReader,
8
+ observerIdentity,
9
+ authorizeObservation,
10
+ readerControls,
11
+ } from "../test-fixtures/observationReader.js";
12
+ import { captureAuthorizedObservationHistoryReader } from "./reader.js";
13
+ configureAdmissionCase(
14
+ "fresh authenticated query-only reader survives original write retirement and period boundary",
15
+ prepareObservationReader,
16
+ async (h, state) => {
17
+ const calls = h.calls.length,
18
+ selectors = admissionControls.selectors;
19
+ await h.inAnotherAction(async (ctx) => {
20
+ const reader = await captureAuthorizedObservationHistoryReader(h.sdk, {
21
+ actualActionCtx: ctx,
22
+ operationId: state.operationId,
23
+ parentOperationId: state.parentOperationId,
24
+ });
25
+ expect(Object.keys(reader)).toEqual(["read"]);
26
+ const output = await reader.read();
27
+ expect(output.status).toBe("authorized_observation_history_data");
28
+ expect(output.history.snapshot).toEqual(state.full);
29
+ expect(output.authorization.authorizationRevision).toBe(3);
30
+ expect(output.operationalAuthority).toBe(false);
31
+ expect(Object.isFrozen(output.history.record)).toBe(true);
32
+ await expect(reader.read()).rejects.toThrow();
33
+ });
34
+ expect(readerControls.authorizations).toBe(2);
35
+ expect(h.calls).toHaveLength(calls);
36
+ expect(admissionControls.selectors).toBe(selectors);
37
+ expect(admissionControls.legacy).toBe(0);
38
+ },
39
+ { identity: observerIdentity, hostQuery: authorizeObservation },
40
+ );
41
+ it("EMPTY observation history profile refuses before root/input/clock reflection", async () => {
42
+ admissionControls.history.splice(0);
43
+ let traps = 0;
44
+ const root = new Proxy(
45
+ {},
46
+ {
47
+ getPrototypeOf() {
48
+ traps++;
49
+ throw Error("TRAP");
50
+ },
51
+ },
52
+ );
53
+ const input = new Proxy(
54
+ {},
55
+ {
56
+ ownKeys() {
57
+ traps++;
58
+ throw Error("TRAP");
59
+ },
60
+ },
61
+ );
62
+ const wall = vi.spyOn(Date, "now"),
63
+ ns = vi.spyOn(process.hrtime, "bigint");
64
+ wall.mockClear();
65
+ ns.mockClear();
66
+ await expect(
67
+ captureAuthorizedObservationHistoryReader(root, input),
68
+ ).rejects.toThrow("OBSERVATION_HISTORY_READER_UNBOUND");
69
+ expect(traps).toBe(0);
70
+ expect(wall).not.toHaveBeenCalled();
71
+ expect(ns).not.toHaveBeenCalled();
72
+ });
73
+ configureAdmissionCase(
74
+ "reader consumes before concurrent calls and exposes only four fixed query routes",
75
+ prepareObservationReader,
76
+ async (h, state) => {
77
+ await h.inAnotherAction(async (ctx) => {
78
+ const queries = vi.spyOn(ctx, "runQuery"),
79
+ mutations = vi.spyOn(ctx, "runMutation");
80
+ const reader = await captureAuthorizedObservationHistoryReader(h.sdk, {
81
+ actualActionCtx: ctx,
82
+ operationId: state.operationId,
83
+ parentOperationId: state.parentOperationId,
84
+ });
85
+ const first = reader.read();
86
+ await expect(reader.read()).rejects.toThrow();
87
+ expect((await first).status).toBe("authorized_observation_history_data");
88
+ expect(mutations).not.toHaveBeenCalled();
89
+ expect(queries).toHaveBeenCalledTimes(14);
90
+ });
91
+ },
92
+ { identity: observerIdentity, hostQuery: authorizeObservation },
93
+ );