@fantastic.dev/better-stripe 0.94.0 → 0.95.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 (48) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +1 -1
  3. package/dist/client/billing/renewalAttach/internal/operationJournal.d.ts +6 -0
  4. package/dist/client/billing/renewalAttach/internal/operationJournal.d.ts.map +1 -1
  5. package/dist/client/billing/renewalAttach/internal/operationJournal.js +10 -0
  6. package/dist/client/billing/renewalAttach/internal/operationJournal.js.map +1 -1
  7. package/dist/client/billing/renewalAttach/internal/producer/classOwnedActionRoot.d.ts +5 -0
  8. package/dist/client/billing/renewalAttach/internal/producer/classOwnedActionRoot.d.ts.map +1 -1
  9. package/dist/client/billing/renewalAttach/internal/producer/classOwnedActionRoot.js +40 -0
  10. package/dist/client/billing/renewalAttach/internal/producer/classOwnedActionRoot.js.map +1 -1
  11. package/dist/client/billing/renewalAttach/internal/producer/invocationProducer.d.ts +13 -0
  12. package/dist/client/billing/renewalAttach/internal/producer/invocationProducer.d.ts.map +1 -0
  13. package/dist/client/billing/renewalAttach/internal/producer/invocationProducer.js +43 -0
  14. package/dist/client/billing/renewalAttach/internal/producer/invocationProducer.js.map +1 -0
  15. package/dist/client/billing/renewalAttach/internal/producer/lineageAuthority.d.ts +32 -0
  16. package/dist/client/billing/renewalAttach/internal/producer/lineageAuthority.d.ts.map +1 -0
  17. package/dist/client/billing/renewalAttach/internal/producer/lineageAuthority.js +105 -0
  18. package/dist/client/billing/renewalAttach/internal/producer/lineageAuthority.js.map +1 -0
  19. package/dist/client/billing/renewalAttach/internal/producer/ownedAwaitFactory.d.ts +3 -0
  20. package/dist/client/billing/renewalAttach/internal/producer/ownedAwaitFactory.d.ts.map +1 -0
  21. package/dist/client/billing/renewalAttach/internal/producer/ownedAwaitFactory.js +59 -0
  22. package/dist/client/billing/renewalAttach/internal/producer/ownedAwaitFactory.js.map +1 -0
  23. package/dist/client/billing/renewalAttach/internal/producer/ownerFactory.d.ts +11 -0
  24. package/dist/client/billing/renewalAttach/internal/producer/ownerFactory.d.ts.map +1 -0
  25. package/dist/client/billing/renewalAttach/internal/producer/ownerFactory.js +121 -0
  26. package/dist/client/billing/renewalAttach/internal/producer/ownerFactory.js.map +1 -0
  27. package/dist/client/billing/renewalAttach/internal/producer/stockDelegateFactory.d.ts +6 -0
  28. package/dist/client/billing/renewalAttach/internal/producer/stockDelegateFactory.d.ts.map +1 -0
  29. package/dist/client/billing/renewalAttach/internal/producer/stockDelegateFactory.js +16 -0
  30. package/dist/client/billing/renewalAttach/internal/producer/stockDelegateFactory.js.map +1 -0
  31. package/dist/client/connect/payoutExecutionTestHelpers.d.ts +16 -16
  32. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +32 -32
  33. package/dist/component/balanceFunding/internal/actions.d.ts +11 -11
  34. package/dist/component/balanceFunding/queries.d.ts +1 -1
  35. package/dist/component/financialObservations/settlementHelpers.d.ts +3 -3
  36. package/dist/component/usageCredits/accounting.fixtures.d.ts +16 -16
  37. package/docs/renewal-context-reads.md +24 -0
  38. package/package.json +1 -1
  39. package/src/client/billing/renewalAttach/internal/operationJournal.ts +12 -0
  40. package/src/client/billing/renewalAttach/internal/producer/classOwnedActionRoot.ts +59 -0
  41. package/src/client/billing/renewalAttach/internal/producer/invocationProducer.ts +58 -0
  42. package/src/client/billing/renewalAttach/internal/producer/lineageAuthority.ts +161 -0
  43. package/src/client/billing/renewalAttach/internal/producer/ownedAwaitFactory.ts +54 -0
  44. package/src/client/billing/renewalAttach/internal/producer/ownerFactory.ts +124 -0
  45. package/src/client/billing/renewalAttach/internal/producer/producerOwner.integration.test.ts +457 -0
  46. package/src/client/billing/renewalAttach/internal/producer/stockDelegateFactory.ts +23 -0
  47. package/src/client/billing/renewalAttach/internal/test-fixtures/producerInitialDeclarations.ts +5 -0
  48. package/src/client/billing/renewalAttach/internal/test-fixtures/producerInitialOperation.ts +80 -0
@@ -0,0 +1,121 @@
1
+ import { readInitialLineage } from "./lineageAuthority.js";
2
+ import { types } from "node:util";
3
+ const owners = new WeakMap();
4
+ function stop() {
5
+ throw Error("INITIAL_OWNER_STOP");
6
+ }
7
+ /** One canonical, independently retired Owner per original private lineage. */
8
+ export function ownerForInitialLineage(token) {
9
+ const existing = owners.get(token);
10
+ if (existing)
11
+ return existing;
12
+ const lineage = readInitialLineage(token);
13
+ const { basis, policy } = lineage;
14
+ let closed = false;
15
+ let checking = false;
16
+ let last = null;
17
+ const listeners = new Set();
18
+ let timer;
19
+ function retire() {
20
+ if (closed)
21
+ return;
22
+ closed = true;
23
+ if (timer !== undefined)
24
+ clearTimeout(timer);
25
+ const active = [...listeners];
26
+ listeners.clear();
27
+ for (const listener of active) {
28
+ if (!listener.active)
29
+ continue;
30
+ listener.active = false;
31
+ try {
32
+ Reflect.apply(listener.fn, undefined, []);
33
+ }
34
+ catch {
35
+ /* Retirement cannot be reversed by a waiter. */
36
+ }
37
+ }
38
+ }
39
+ function check() {
40
+ if (closed || checking) {
41
+ retire();
42
+ stop();
43
+ }
44
+ checking = true;
45
+ try {
46
+ if (readInitialLineage(token) !== lineage)
47
+ stop();
48
+ const wallMs = lineage.wall();
49
+ const ns = lineage.monotonic();
50
+ const nowSeconds = Math.floor(wallMs / 1000);
51
+ if (!Number.isSafeInteger(wallMs) ||
52
+ wallMs < basis.startWallMs ||
53
+ wallMs >= basis.workEndWallMs ||
54
+ wallMs >= basis.endWallMs ||
55
+ ns < lineage.initialHighNs ||
56
+ ns >= basis.workEndNs ||
57
+ ns >= basis.endNs ||
58
+ (last && (wallMs < last.wallMs || ns < last.ns)) ||
59
+ nowSeconds < policy.firstDispatchedAt ||
60
+ nowSeconds - policy.firstDispatchedAt >= 86400 ||
61
+ nowSeconds < policy.periodStart ||
62
+ nowSeconds >= policy.periodEnd ||
63
+ closed)
64
+ stop();
65
+ last = Object.freeze({ wallMs, ns, nowSeconds, retired: false });
66
+ return last;
67
+ }
68
+ catch {
69
+ retire();
70
+ return stop();
71
+ }
72
+ finally {
73
+ checking = false;
74
+ }
75
+ }
76
+ const owner = Object.freeze({
77
+ get basis() {
78
+ if (closed)
79
+ stop();
80
+ return basis;
81
+ },
82
+ check,
83
+ sample: check,
84
+ retire,
85
+ subscribe(listener) {
86
+ if (typeof listener !== "function" || types.isProxy(listener)) {
87
+ retire();
88
+ stop();
89
+ }
90
+ if (closed) {
91
+ try {
92
+ listener();
93
+ }
94
+ catch {
95
+ /* Already retired. */
96
+ }
97
+ return () => { };
98
+ }
99
+ const record = { fn: listener, active: true };
100
+ listeners.add(record);
101
+ return () => {
102
+ record.active = false;
103
+ listeners.delete(record);
104
+ };
105
+ },
106
+ });
107
+ owners.set(token, owner);
108
+ try {
109
+ check();
110
+ // Absolute original cutoff, never a new budget when a continuation resumes.
111
+ timer = setTimeout(retire, Math.max(0, basis.workEndWallMs - lineage.wall()));
112
+ timer.unref?.();
113
+ check();
114
+ return owner;
115
+ }
116
+ catch (error) {
117
+ retire();
118
+ throw error;
119
+ }
120
+ }
121
+ //# sourceMappingURL=ownerFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ownerFactory.js","sourceRoot":"","sources":["../../../../../../src/client/billing/renewalAttach/internal/producer/ownerFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAWlC,MAAM,MAAM,GAAG,IAAI,OAAO,EAAwB,CAAC;AACnD,SAAS,IAAI;IACX,MAAM,KAAK,CAAC,oBAAoB,CAAC,CAAC;AACpC,CAAC;AACD,+EAA+E;AAC/E,MAAM,UAAU,sBAAsB,CAAC,KAAa;IAClD,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACnC,IAAI,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAC9B,MAAM,OAAO,GAAG,kBAAkB,CAAC,KAAK,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9D,MAAM,EAAE,CAAC;gBACT,IAAI,EAAE,CAAC;YACT,CAAC;YACD,IAAI,MAAM,EAAE,CAAC;gBACX,IAAI,CAAC;oBACH,QAAQ,EAAE,CAAC;gBACb,CAAC;gBAAC,MAAM,CAAC;oBACP,sBAAsB;gBACxB,CAAC;gBACD,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;YAClB,CAAC;YACD,MAAM,MAAM,GAAG,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;YAC9C,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YACtB,OAAO,GAAG,EAAE;gBACV,MAAM,CAAC,MAAM,GAAG,KAAK,CAAC;gBACtB,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAC3B,CAAC,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;IACH,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACzB,IAAI,CAAC;QACH,KAAK,EAAE,CAAC;QACR,4EAA4E;QAC5E,KAAK,GAAG,UAAU,CAChB,MAAM,EACN,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,aAAa,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAClD,CAAC;QACF,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC;QAChB,KAAK,EAAE,CAAC;QACR,OAAO,KAAK,CAAC;IACf,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,EAAE,CAAC;QACT,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type Stripe from "stripe";
2
+ /** Fixed selected client and original receiver; no replacement-client parameter. */
3
+ export declare function stockDelegateForInitialLineage(token: object): Readonly<{
4
+ rawRequest: Stripe["rawRequest"];
5
+ }>;
6
+ //# sourceMappingURL=stockDelegateFactory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stockDelegateFactory.d.ts","sourceRoot":"","sources":["../../../../../../src/client/billing/renewalAttach/internal/producer/stockDelegateFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAKjC,oFAAoF;AACpF,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,CAAC;IACtE,UAAU,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC;CAClC,CAAC,CAcD"}
@@ -0,0 +1,16 @@
1
+ import { readInitialLineage } from "./lineageAuthority.js";
2
+ import { ownerForInitialLineage } from "./ownerFactory.js";
3
+ import { ownedAwaitForInitialLineage } from "./ownedAwaitFactory.js";
4
+ /** Fixed selected client and original receiver; no replacement-client parameter. */
5
+ export function stockDelegateForInitialLineage(token) {
6
+ const lineage = readInitialLineage(token);
7
+ const owner = ownerForInitialLineage(token);
8
+ const owned = ownedAwaitForInitialLineage(token);
9
+ return Object.freeze({
10
+ rawRequest(...args) {
11
+ owner.check();
12
+ return owned(() => Reflect.apply(lineage.method, lineage.client, args));
13
+ },
14
+ });
15
+ }
16
+ //# sourceMappingURL=stockDelegateFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stockDelegateFactory.js","sourceRoot":"","sources":["../../../../../../src/client/billing/renewalAttach/internal/producer/stockDelegateFactory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAErE,oFAAoF;AACpF,MAAM,UAAU,8BAA8B,CAAC,KAAa;IAG1D,MAAM,OAAO,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAC1C,MAAM,KAAK,GAAG,sBAAsB,CAAC,KAAK,CAAC,CAAC;IAC5C,MAAM,KAAK,GAAG,2BAA2B,CAAC,KAAK,CAAC,CAAC;IACjD,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,UAAU,CACR,GAAG,IAAsC;YAEzC,KAAK,CAAC,KAAK,EAAE,CAAC;YACd,OAAO,KAAK,CAAC,GAAG,EAAE,CAChB,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAChB,CAAC;QACxC,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -2642,6 +2642,14 @@ 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
+ } | {
2645
2653
  operation: {
2646
2654
  accountId: string;
2647
2655
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -2652,14 +2660,6 @@ export declare function setup(amounts?: number[]): Promise<{
2652
2660
  } | {
2653
2661
  enabled: boolean;
2654
2662
  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,6 +2670,14 @@ 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
+ } | {
2673
2681
  operation: {
2674
2682
  accountId: string;
2675
2683
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -2680,14 +2688,6 @@ export declare function setup(amounts?: number[]): Promise<{
2680
2688
  } | {
2681
2689
  enabled: boolean;
2682
2690
  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;
@@ -2632,14 +2632,6 @@ export declare function large(count?: number, amount?: number): 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
- } | {
2643
2635
  operation: {
2644
2636
  accountId: string;
2645
2637
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -2650,6 +2642,14 @@ export declare function large(count?: number, amount?: number): Promise<{
2650
2642
  } | {
2651
2643
  enabled: boolean;
2652
2644
  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,14 +2660,6 @@ export declare function large(count?: number, amount?: number): 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
- } | {
2671
2663
  operation: {
2672
2664
  accountId: string;
2673
2665
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -2678,6 +2670,14 @@ export declare function large(count?: number, amount?: number): Promise<{
2678
2670
  } | {
2679
2671
  enabled: boolean;
2680
2672
  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;
@@ -7769,14 +7769,6 @@ export declare function withHistory(count?: number, amount?: number): Promise<{
7769
7769
  preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
7770
7770
  requestKey: string;
7771
7771
  result?: {
7772
- reason: "identity_changed" | "revision_changed" | "scope_busy";
7773
- retryable: false;
7774
- status: "conflict";
7775
- } | {
7776
- reason: "policy_invalid";
7777
- retryable: false;
7778
- status: "rejected";
7779
- } | {
7780
7772
  operation: {
7781
7773
  accountId: string;
7782
7774
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -7787,6 +7779,14 @@ export declare function withHistory(count?: number, amount?: number): Promise<{
7787
7779
  } | {
7788
7780
  enabled: boolean;
7789
7781
  status: "unchanged";
7782
+ } | {
7783
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
7784
+ retryable: false;
7785
+ status: "conflict";
7786
+ } | {
7787
+ reason: "policy_invalid";
7788
+ retryable: false;
7789
+ status: "rejected";
7790
7790
  } | {
7791
7791
  reason: "provider_pending";
7792
7792
  retryable: true;
@@ -7797,14 +7797,6 @@ export declare function withHistory(count?: number, amount?: number): Promise<{
7797
7797
  payload: import("convex/values").VString<string, "required">;
7798
7798
  preparationId: import("convex/values").VId<import("convex/values").GenericId<"balanceFundingPreparations">, "required">;
7799
7799
  result: import("convex/values").VUnion<{
7800
- reason: "identity_changed" | "revision_changed" | "scope_busy";
7801
- retryable: false;
7802
- status: "conflict";
7803
- } | {
7804
- reason: "policy_invalid";
7805
- retryable: false;
7806
- status: "rejected";
7807
- } | {
7808
7800
  operation: {
7809
7801
  accountId: string;
7810
7802
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -7815,6 +7807,14 @@ export declare function withHistory(count?: number, amount?: number): Promise<{
7815
7807
  } | {
7816
7808
  enabled: boolean;
7817
7809
  status: "unchanged";
7810
+ } | {
7811
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
7812
+ retryable: false;
7813
+ status: "conflict";
7814
+ } | {
7815
+ reason: "policy_invalid";
7816
+ retryable: false;
7817
+ status: "rejected";
7818
7818
  } | {
7819
7819
  reason: "provider_pending";
7820
7820
  retryable: true;
@@ -9,17 +9,6 @@ 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
- } | {
23
12
  reason: "history_incomplete" | "provider_outcome_unknown";
24
13
  retryable: false;
25
14
  status: "unknown";
@@ -35,5 +24,16 @@ export declare const bridge: import("convex/server").RegisteredAction<"internal"
35
24
  reason: "provider_pending";
36
25
  retryable: true;
37
26
  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
@@ -180,11 +180,11 @@ export declare const findPreparationOperation: import("convex/server").Registere
180
180
  retryable: false;
181
181
  } | {
182
182
  reason?: undefined;
183
+ retryable?: undefined;
183
184
  accountId: string;
184
185
  scopeKey: string;
185
186
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
186
187
  version: number;
187
- retryable?: undefined;
188
188
  status?: undefined;
189
189
  state: "canceled" | "failed" | "pending" | "running" | "succeeded" | "unknown";
190
190
  cancelRequested: boolean;
@@ -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;
13
12
  userId?: undefined;
14
13
  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;
23
22
  userId?: undefined;
24
23
  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;
33
32
  userId?: undefined;
34
33
  orgId?: undefined;
34
+ registrationId?: undefined;
35
35
  ownershipStatus: "contradictory";
36
36
  } | {
37
37
  registrationId: import("convex/values").GenericId<"financialOwnership">;
@@ -2632,6 +2632,14 @@ export declare function setupCredits(): 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 setupCredits(): 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 setupCredits(): 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 setupCredits(): 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;
@@ -88,6 +88,30 @@ remain unsigned bookkeeping DATA; copies cannot create or revive a call, a live
88
88
  Owner or provider authority. A handle lost across an Action return, restart or
89
89
  reply loss is not reconstructed from stored records or retried with a new key.
90
90
 
91
+ The private Node invocation core can consume that original call to construct an
92
+ isolated Owner. It checks the SDK's pre-reservation own-data configuration
93
+ descriptors and values before calling its constructor-captured selector. Extra
94
+ client arguments, changed descriptors, copied handles and existing reservation
95
+ results cannot select a client or sample a clock. This construction step grants
96
+ no operational profile or public scheduling capability.
97
+
98
+ Each lineage retains one selected stock client, its original raw-request method
99
+ and receiver, and one canonical Owner. The core samples monotonic time immediately
100
+ before and after its initial wall-clock sample. It uses the lower monotonic sample
101
+ with the existing six-field basis formula and the original absolute wall cutoffs.
102
+ Capture apertures above one millisecond, u64 overflow and timer spans above
103
+ 2,147,483,647 milliseconds refuse. Both clocks must remain monotone and below
104
+ their work cutoffs, independently of paid-period and replay-age checks. These are
105
+ local Node clock assumptions, not provider or real-time execution qualification.
106
+
107
+ The core awaits the actual component basis-binding result before returning.
108
+ Pending continuations retain their own Owner; retiring one lineage cannot retire
109
+ another. Deadline notification uses a Node timer, whose callback can be delayed
110
+ by event-loop suspension. Every continuation therefore checks both clocks before
111
+ returning a value. Retirement is irreversible and never extends either original
112
+ cutoff. Legacy actors still use their separate dormant identity; extracting and
113
+ wiring their per-invocation kernels remains required before runtime activation.
114
+
91
115
  ## Component operation journal
92
116
 
93
117
  The component's `renewalOperations` functions retain host-authorized operation
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fantastic.dev/better-stripe",
3
- "version": "0.94.0",
3
+ "version": "0.95.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",
@@ -559,3 +559,15 @@ export function consumeClassReservation(
559
559
  return callUnbound();
560
560
  }
561
561
  }
562
+
563
+ /** Fixed Node producer entry, still distinct from operational profile admission. */
564
+ export function consumeInitialClassReservation(
565
+ call: unknown,
566
+ journal: unknown,
567
+ ) {
568
+ const consumed = consumeClassReservation(call, journal);
569
+ if (typeof call !== "object" || call === null) callUnbound();
570
+ const state = winningCalls.get(call);
571
+ if (!state) callUnbound();
572
+ return Object.freeze({ ...consumed, binding: state.binding });
573
+ }
@@ -168,7 +168,9 @@ type JournalState = Readonly<{
168
168
  root: object;
169
169
  cell: ReadyRoot;
170
170
  rpc: JournalRPC;
171
+ configuration: readonly (PropertyDescriptor | undefined)[];
171
172
  }>;
173
+ const configurationKeys = ["_apiKey", "stripeApiVersion"] as const;
172
174
  const pendingJournalEntries = new WeakMap<object, PendingJournal>();
173
175
  const journalBindings = new WeakMap<object, JournalState>();
174
176
  const closedJournalBindings = new WeakSet<object>();
@@ -315,6 +317,11 @@ export async function beginClassAction(
315
317
  root: actualRoot,
316
318
  cell: entry.cell,
317
319
  rpc,
320
+ configuration: Object.freeze(
321
+ configurationKeys.map((key) =>
322
+ Object.getOwnPropertyDescriptor(actualRoot, key),
323
+ ),
324
+ ),
318
325
  });
319
326
  if (
320
327
  metadata.type !== "action" ||
@@ -332,3 +339,55 @@ export async function beginClassAction(
332
339
  entry.binding = binding;
333
340
  return binding;
334
341
  }
342
+
343
+ /** Private construction snapshot; journal DATA alone never calls this selector. */
344
+ export function captureInitialJournalSelection(
345
+ binding: object,
346
+ apiVersion: string,
347
+ ) {
348
+ readCheckedJournalActionRPC(binding);
349
+ const state = journalBindings.get(binding);
350
+ if (!state) journalUnbound();
351
+ const captured = state;
352
+ function check() {
353
+ readCheckedJournalActionRPC(binding);
354
+ for (let index = 0; index < configurationKeys.length; index++) {
355
+ const before = captured.configuration[index];
356
+ const after = Object.getOwnPropertyDescriptor(
357
+ captured.root,
358
+ configurationKeys[index],
359
+ );
360
+ if (
361
+ !before ||
362
+ !after ||
363
+ !("value" in before) ||
364
+ !("value" in after) ||
365
+ before.value !== after.value ||
366
+ before.writable !== after.writable ||
367
+ before.enumerable !== after.enumerable ||
368
+ before.configurable !== after.configurable
369
+ )
370
+ journalUnbound();
371
+ }
372
+ if (
373
+ typeof captured.configuration[0]?.value !== "string" ||
374
+ captured.configuration[0].value.length === 0 ||
375
+ captured.configuration[1]?.value !== apiVersion
376
+ )
377
+ journalUnbound();
378
+ }
379
+ check();
380
+ return Object.freeze({
381
+ check,
382
+ select() {
383
+ check();
384
+ const client: unknown = Reflect.apply(
385
+ captured.cell.bootstrap.select,
386
+ captured.root,
387
+ [],
388
+ );
389
+ check();
390
+ return client;
391
+ },
392
+ });
393
+ }