@fantastic.dev/better-stripe 0.110.0 → 0.112.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 (134) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -1
  3. package/dist/client/billing/renewalAttach/internal/observation/freshActor.d.ts +564 -0
  4. package/dist/client/billing/renewalAttach/internal/observation/freshActor.d.ts.map +1 -1
  5. package/dist/client/billing/renewalAttach/internal/observation/freshActor.js +103 -21
  6. package/dist/client/billing/renewalAttach/internal/observation/freshActor.js.map +1 -1
  7. package/dist/client/billing/renewalAttach/internal/observation/freshTransport.d.ts +18 -1
  8. package/dist/client/billing/renewalAttach/internal/observation/freshTransport.d.ts.map +1 -1
  9. package/dist/client/billing/renewalAttach/internal/observation/freshTransport.js +54 -1
  10. package/dist/client/billing/renewalAttach/internal/observation/freshTransport.js.map +1 -1
  11. package/dist/client/billing/renewalAttach/internal/observation/invocation.d.ts +4 -0
  12. package/dist/client/billing/renewalAttach/internal/observation/invocation.d.ts.map +1 -1
  13. package/dist/client/billing/renewalAttach/internal/observation/invocation.js +1 -0
  14. package/dist/client/billing/renewalAttach/internal/observation/invocation.js.map +1 -1
  15. package/dist/client/billing/renewalAttach/internal/observation/readerAuthorization.d.ts +4 -0
  16. package/dist/client/billing/renewalAttach/internal/observation/readerAuthorization.d.ts.map +1 -1
  17. package/dist/client/billing/renewalAttach/internal/observation/readerAuthorization.js +6 -1
  18. package/dist/client/billing/renewalAttach/internal/observation/readerAuthorization.js.map +1 -1
  19. package/dist/client/billing/renewalAttach/internal/observation/witnessAuthorization.d.ts +38 -0
  20. package/dist/client/billing/renewalAttach/internal/observation/witnessAuthorization.d.ts.map +1 -0
  21. package/dist/client/billing/renewalAttach/internal/observation/witnessAuthorization.js +172 -0
  22. package/dist/client/billing/renewalAttach/internal/observation/witnessAuthorization.js.map +1 -0
  23. package/dist/client/billing/renewalAttach/internal/observation/witnessData.d.ts +135 -0
  24. package/dist/client/billing/renewalAttach/internal/observation/witnessData.d.ts.map +1 -0
  25. package/dist/client/billing/renewalAttach/internal/observation/witnessData.js +143 -0
  26. package/dist/client/billing/renewalAttach/internal/observation/witnessData.js.map +1 -0
  27. package/dist/client/billing/renewalAttach/internal/observation/witnessOperation.d.ts +85 -0
  28. package/dist/client/billing/renewalAttach/internal/observation/witnessOperation.d.ts.map +1 -0
  29. package/dist/client/billing/renewalAttach/internal/observation/witnessOperation.js +121 -0
  30. package/dist/client/billing/renewalAttach/internal/observation/witnessOperation.js.map +1 -0
  31. package/dist/client/billing/renewalAttach/internal/operations/witnessProfiles.d.ts +44 -0
  32. package/dist/client/billing/renewalAttach/internal/operations/witnessProfiles.d.ts.map +1 -0
  33. package/dist/client/billing/renewalAttach/internal/operations/witnessProfiles.js +4 -0
  34. package/dist/client/billing/renewalAttach/internal/operations/witnessProfiles.js.map +1 -0
  35. package/dist/client/billing/renewalAttach/internal/producer/configureJournalWork.d.ts +1 -1
  36. package/dist/client/billing/renewalAttach/internal/producer/configureLineage.d.ts +21 -21
  37. package/dist/client/billing/renewalAttach/internal/producer/journalWorkFactory.d.ts +3 -3
  38. package/dist/client/billing/renewalAttach/internal/producer/operationFactory.d.ts +1 -1
  39. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +84 -32
  40. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts.map +1 -1
  41. package/dist/client/connect/payoutExecutionTestHelpers.d.ts +26 -0
  42. package/dist/client/connect/payoutExecutionTestHelpers.d.ts.map +1 -1
  43. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +84 -32
  44. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts.map +1 -1
  45. package/dist/client/connect/payoutSyncTestHelpers.d.ts +26 -0
  46. package/dist/client/connect/payoutSyncTestHelpers.d.ts.map +1 -1
  47. package/dist/component/_generated/api.d.ts +24 -0
  48. package/dist/component/_generated/api.d.ts.map +1 -1
  49. package/dist/component/_generated/api.js.map +1 -1
  50. package/dist/component/_generated/component.d.ts +94 -10
  51. package/dist/component/_generated/component.d.ts.map +1 -1
  52. package/dist/component/balanceFunding/internal/actions.d.ts +11 -11
  53. package/dist/component/balanceFunding/mutations.d.ts +16 -16
  54. package/dist/component/balanceFunding/preparationHandlers.d.ts +8 -8
  55. package/dist/component/balanceFunding/queries.d.ts +1 -1
  56. package/dist/component/balanceFunding/workflowValidators.d.ts +16 -16
  57. package/dist/component/earnings/triggers.d.ts +44 -0
  58. package/dist/component/earnings/triggers.d.ts.map +1 -1
  59. package/dist/component/financialObservations/settlementHelpers.d.ts +3 -3
  60. package/dist/component/renewalWitnesses/eligibility.d.ts +36 -0
  61. package/dist/component/renewalWitnesses/eligibility.d.ts.map +1 -0
  62. package/dist/component/renewalWitnesses/eligibility.js +60 -0
  63. package/dist/component/renewalWitnesses/eligibility.js.map +1 -0
  64. package/dist/component/renewalWitnesses/mutations.d.ts +45 -0
  65. package/dist/component/renewalWitnesses/mutations.d.ts.map +1 -0
  66. package/dist/component/renewalWitnesses/mutations.js +14 -0
  67. package/dist/component/renewalWitnesses/mutations.js.map +1 -0
  68. package/dist/component/renewalWitnesses/protocol.d.ts +75 -0
  69. package/dist/component/renewalWitnesses/protocol.d.ts.map +1 -0
  70. package/dist/component/renewalWitnesses/protocol.js +82 -0
  71. package/dist/component/renewalWitnesses/protocol.js.map +1 -0
  72. package/dist/component/renewalWitnesses/queries.d.ts +39 -0
  73. package/dist/component/renewalWitnesses/queries.d.ts.map +1 -0
  74. package/dist/component/renewalWitnesses/queries.js +11 -0
  75. package/dist/component/renewalWitnesses/queries.js.map +1 -0
  76. package/dist/component/renewalWitnesses/schema.d.ts +99 -0
  77. package/dist/component/renewalWitnesses/schema.d.ts.map +1 -0
  78. package/dist/component/renewalWitnesses/schema.js +36 -0
  79. package/dist/component/renewalWitnesses/schema.js.map +1 -0
  80. package/dist/component/renewalWitnesses/source.d.ts +22 -0
  81. package/dist/component/renewalWitnesses/source.d.ts.map +1 -0
  82. package/dist/component/renewalWitnesses/source.js +108 -0
  83. package/dist/component/renewalWitnesses/source.js.map +1 -0
  84. package/dist/component/schema.d.ts +42 -16
  85. package/dist/component/schema.js +2 -0
  86. package/dist/component/schema.js.map +1 -1
  87. package/dist/component/usage/allowance.fixtures.d.ts +42 -16
  88. package/dist/component/usage/allowance.fixtures.d.ts.map +1 -1
  89. package/dist/component/usageCredits/accounting.fixtures.d.ts +26 -0
  90. package/dist/component/usageCredits/accounting.fixtures.d.ts.map +1 -1
  91. package/dist/shared/renewalWitness.d.ts +51 -0
  92. package/dist/shared/renewalWitness.d.ts.map +1 -0
  93. package/dist/shared/renewalWitness.js +127 -0
  94. package/dist/shared/renewalWitness.js.map +1 -0
  95. package/docs/renewal-witness-protocol.md +139 -0
  96. package/package.json +1 -1
  97. package/src/client/billing/renewalAttach/internal/observation/freshActor.ts +142 -19
  98. package/src/client/billing/renewalAttach/internal/observation/freshTransport.ts +90 -1
  99. package/src/client/billing/renewalAttach/internal/observation/invocation.ts +2 -0
  100. package/src/client/billing/renewalAttach/internal/observation/readerAuthorization.ts +6 -1
  101. package/src/client/billing/renewalAttach/internal/observation/witnessAcquisition.integration.test.ts +348 -0
  102. package/src/client/billing/renewalAttach/internal/observation/witnessActor.integration.test.ts +204 -0
  103. package/src/client/billing/renewalAttach/internal/observation/witnessAuthorization.ts +239 -0
  104. package/src/client/billing/renewalAttach/internal/observation/witnessCapabilities.integration.test.ts +231 -0
  105. package/src/client/billing/renewalAttach/internal/observation/witnessData.ts +189 -0
  106. package/src/client/billing/renewalAttach/internal/observation/witnessHistorical.integration.test.ts +98 -0
  107. package/src/client/billing/renewalAttach/internal/observation/witnessImmutable.integration.test.ts +78 -0
  108. package/src/client/billing/renewalAttach/internal/observation/witnessInvoice.integration.test.ts +85 -0
  109. package/src/client/billing/renewalAttach/internal/observation/witnessLifecycle.integration.test.ts +264 -0
  110. package/src/client/billing/renewalAttach/internal/observation/witnessOperation.ts +205 -0
  111. package/src/client/billing/renewalAttach/internal/observation/witnessProfile.integration.test.ts +93 -0
  112. package/src/client/billing/renewalAttach/internal/observation/witnessRPCControls.integration.test.ts +256 -0
  113. package/src/client/billing/renewalAttach/internal/operations/witnessProfiles.ts +58 -0
  114. package/src/client/billing/renewalAttach/internal/test-fixtures/invoiceObservation.ts +3 -1
  115. package/src/client/billing/renewalAttach/internal/test-fixtures/producerConfigureAdmission.ts +8 -0
  116. package/src/client/billing/renewalAttach/internal/test-fixtures/producerInitialOperation.ts +18 -7
  117. package/src/client/billing/renewalAttach/internal/test-fixtures/witnessHistory.ts +70 -0
  118. package/src/client/billing/renewalAttach/internal/test-fixtures/witnessObservation.ts +353 -0
  119. package/src/component/_generated/api.ts +24 -0
  120. package/src/component/_generated/component.ts +98 -10
  121. package/src/component/renewalOperations/configureJournal.fixtures.ts +25 -3
  122. package/src/component/renewalWitnesses/bounds.test.ts +204 -0
  123. package/src/component/renewalWitnesses/codec.test.ts +84 -0
  124. package/src/component/renewalWitnesses/controls.test.ts +250 -0
  125. package/src/component/renewalWitnesses/eligibility.ts +78 -0
  126. package/src/component/renewalWitnesses/mutations.ts +17 -0
  127. package/src/component/renewalWitnesses/protocol.test.ts +63 -0
  128. package/src/component/renewalWitnesses/protocol.ts +103 -0
  129. package/src/component/renewalWitnesses/queries.ts +11 -0
  130. package/src/component/renewalWitnesses/routes.test.ts +154 -0
  131. package/src/component/renewalWitnesses/schema.ts +36 -0
  132. package/src/component/renewalWitnesses/source.ts +157 -0
  133. package/src/component/schema.ts +2 -0
  134. package/src/shared/renewalWitness.ts +179 -0
@@ -1 +1 @@
1
- {"version":3,"file":"accounting.fixtures.d.ts","sourceRoot":"","sources":["../../../src/component/usageCredits/accounting.fixtures.ts"],"names":[],"mappings":"AAgBA,wBAAsB,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAS1B,GAAG,EAAE,OAAO;yBACZ,OAAO,EAAE,IAAI;yBACb,KAAK,EAAE,SAAS;yBAChB,IAAI;6BAAI,IAAI,EAAE,MAAM;6BAAE,SAAS,EAAE,CAAC;;yBAClC,IAAI;6BAAI,QAAQ,EAAE,KAAK;6BAAE,iBAAiB,EAAE,GAAG;;yBAC/C,mBAAmB,EAAE,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAuDvB,KAAK;YAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAU5B"}
@@ -0,0 +1,51 @@
1
+ import type { ObservationReads } from "../client/billing/renewalAttach/internal/observation/types.js";
2
+ import type { InvoiceContextV1 } from "../client/billing/renewalObservation/evidence-v1-types.js";
3
+ export declare function witnessStop(): never;
4
+ export declare function witnessNeed(value: unknown): asserts value;
5
+ export declare function witnessObject(raw: unknown): Record<string, unknown>;
6
+ export declare function witnessClosed(raw: unknown, keys: readonly string[]): Record<string, unknown>;
7
+ export declare function witnessText(raw: unknown, max?: number): string;
8
+ export type WitnessIdentity = Readonly<{
9
+ componentScope: string;
10
+ witnessId: string;
11
+ parentOperationId: string;
12
+ operationId: string;
13
+ }>;
14
+ export declare function witnessIdentity(raw: unknown): WitnessIdentity;
15
+ export type WitnessAcknowledgement = Readonly<{
16
+ retention: Record<string, unknown>;
17
+ receipt: Record<string, unknown>;
18
+ }>;
19
+ export type WitnessStage = Readonly<{
20
+ record: Record<string, unknown>;
21
+ reservation: Record<string, unknown>;
22
+ acknowledgement: WitnessAcknowledgement | null;
23
+ }>;
24
+ export type WitnessPayload = Readonly<{
25
+ version: 1;
26
+ kind: "renewal_witness_payload";
27
+ identity: WitnessIdentity;
28
+ capturedSubject: string;
29
+ acquisition: Readonly<{
30
+ observedAtMs: number;
31
+ elapsedWallMs: number;
32
+ elapsedNsDecimal: string;
33
+ apiVersion: "2026-09-30.endive";
34
+ baseReadProfile: "endive-schedule-first-44-v1";
35
+ invoiceReadProfile: "endive-pinned-invoices-fence-7-v1" | null;
36
+ }>;
37
+ source: Readonly<{
38
+ parent: WitnessStage & Readonly<{
39
+ initialBasis: Record<string, unknown>;
40
+ }>;
41
+ configure: WitnessStage;
42
+ }>;
43
+ reads: ObservationReads;
44
+ invoiceContext: InvoiceContextV1 | null;
45
+ }>;
46
+ /** Complete canonical JSON only. This admits DATA, not capture/authentication authority. */
47
+ export declare function canonicalWitnessJSON(raw: string): Readonly<{
48
+ json: string;
49
+ value: WitnessPayload;
50
+ }>;
51
+ //# sourceMappingURL=renewalWitness.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renewalWitness.d.ts","sourceRoot":"","sources":["../../src/shared/renewalWitness.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+DAA+D,CAAC;AACtG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2DAA2D,CAAC;AAElG,wBAAgB,WAAW,IAAI,KAAK,CAEnC;AACD,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,CAEzD;AACD,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAGnE;AACD,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,2BAOlE;AACD,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,SAAM,GAAG,MAAM,CAG3D;AACD,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC;IACrC,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC,CAAC;AACH,wBAAgB,eAAe,C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V,QAAQ,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,cAAc,CAAA;CAAE,CAAC,CA4EnD"}
@@ -0,0 +1,127 @@
1
+ import { renewalSnapshot } from "../client/billing/renewalReplacementSnapshot.js";
2
+ export function witnessStop() {
3
+ throw Error("RENEWAL_WITNESS_INVALID");
4
+ }
5
+ export function witnessNeed(value) {
6
+ if (!value)
7
+ witnessStop();
8
+ }
9
+ export function witnessObject(raw) {
10
+ witnessNeed(raw !== null && typeof raw === "object" && !Array.isArray(raw));
11
+ return raw;
12
+ }
13
+ export function witnessClosed(raw, keys) {
14
+ const value = witnessObject(raw), actual = Object.keys(value);
15
+ witnessNeed(actual.length === keys.length && actual.every((key) => keys.includes(key)));
16
+ return value;
17
+ }
18
+ export function witnessText(raw, max = 255) {
19
+ witnessNeed(typeof raw === "string" && raw.length > 0 && raw.length <= max);
20
+ return raw;
21
+ }
22
+ export function witnessIdentity(raw) {
23
+ const value = witnessClosed(raw, [
24
+ "componentScope",
25
+ "witnessId",
26
+ "parentOperationId",
27
+ "operationId",
28
+ ]);
29
+ const identity = {
30
+ componentScope: witnessText(value.componentScope),
31
+ witnessId: witnessText(value.witnessId),
32
+ parentOperationId: witnessText(value.parentOperationId),
33
+ operationId: witnessText(value.operationId),
34
+ };
35
+ witnessNeed(identity.operationId !== identity.parentOperationId);
36
+ return identity;
37
+ }
38
+ function acknowledgement(raw) {
39
+ if (raw === null)
40
+ return null;
41
+ const value = witnessClosed(raw, ["retention", "receipt"]);
42
+ return {
43
+ retention: witnessObject(value.retention),
44
+ receipt: witnessObject(value.receipt),
45
+ };
46
+ }
47
+ function stage(raw, parent) {
48
+ const value = witnessClosed(raw, [
49
+ "record",
50
+ "reservation",
51
+ "acknowledgement",
52
+ ...(parent ? ["initialBasis"] : []),
53
+ ]);
54
+ return {
55
+ record: witnessObject(value.record),
56
+ reservation: witnessObject(value.reservation),
57
+ acknowledgement: acknowledgement(value.acknowledgement),
58
+ ...(parent ? { initialBasis: witnessObject(value.initialBasis) } : {}),
59
+ };
60
+ }
61
+ /** Complete canonical JSON only. This admits DATA, not capture/authentication authority. */
62
+ export function canonicalWitnessJSON(raw) {
63
+ witnessNeed(typeof raw === "string" &&
64
+ raw.length <= 500000 &&
65
+ new TextEncoder().encode(raw).length <= 500000);
66
+ const copy = renewalSnapshot(JSON.parse(raw));
67
+ witnessNeed(JSON.stringify(copy) === raw);
68
+ const value = witnessClosed(copy, [
69
+ "version",
70
+ "kind",
71
+ "identity",
72
+ "capturedSubject",
73
+ "acquisition",
74
+ "source",
75
+ "reads",
76
+ "invoiceContext",
77
+ ]);
78
+ witnessNeed(value.version === 1 && value.kind === "renewal_witness_payload");
79
+ witnessIdentity(value.identity);
80
+ witnessText(value.capturedSubject, 2048);
81
+ const acquired = witnessClosed(value.acquisition, [
82
+ "observedAtMs",
83
+ "elapsedWallMs",
84
+ "elapsedNsDecimal",
85
+ "apiVersion",
86
+ "baseReadProfile",
87
+ "invoiceReadProfile",
88
+ ]);
89
+ witnessNeed(typeof acquired.observedAtMs === "number" &&
90
+ Number.isSafeInteger(acquired.observedAtMs) &&
91
+ acquired.observedAtMs >= 0);
92
+ witnessNeed(typeof acquired.elapsedWallMs === "number" &&
93
+ Number.isSafeInteger(acquired.elapsedWallMs) &&
94
+ acquired.elapsedWallMs >= 0 &&
95
+ acquired.elapsedWallMs < 30000 &&
96
+ acquired.observedAtMs - acquired.elapsedWallMs >= 0);
97
+ witnessNeed(typeof acquired.elapsedNsDecimal === "string" &&
98
+ /^(0|[1-9][0-9]{0,10})$/.test(acquired.elapsedNsDecimal) &&
99
+ BigInt(acquired.elapsedNsDecimal) < 30000000000n);
100
+ witnessNeed(acquired.apiVersion === "2026-09-30.endive" &&
101
+ acquired.baseReadProfile === "endive-schedule-first-44-v1");
102
+ witnessNeed(value.invoiceContext === null
103
+ ? acquired.invoiceReadProfile === null
104
+ : acquired.invoiceReadProfile === "endive-pinned-invoices-fence-7-v1");
105
+ const source = witnessClosed(value.source, ["parent", "configure"]);
106
+ witnessNeed(stage(source.parent, true).acknowledgement !== null);
107
+ stage(source.configure, false);
108
+ const reads = witnessClosed(value.reads, [
109
+ "schedule",
110
+ "subscription",
111
+ "targetPrice",
112
+ "billingCustomer",
113
+ "coupons",
114
+ ]);
115
+ for (const name of [
116
+ "schedule",
117
+ "subscription",
118
+ "targetPrice",
119
+ "billingCustomer",
120
+ ])
121
+ witnessObject(reads[name]);
122
+ witnessNeed(Array.isArray(reads.coupons));
123
+ if (value.invoiceContext !== null)
124
+ witnessClosed(value.invoiceContext, ["original", "current"]);
125
+ return Object.freeze({ json: raw, value: copy });
126
+ }
127
+ //# sourceMappingURL=renewalWitness.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renewalWitness.js","sourceRoot":"","sources":["../../src/shared/renewalWitness.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iDAAiD,CAAC;AAIlF,MAAM,UAAU,WAAW;IACzB,MAAM,KAAK,CAAC,yBAAyB,CAAC,CAAC;AACzC,CAAC;AACD,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,IAAI,CAAC,KAAK;QAAE,WAAW,EAAE,CAAC;AAC5B,CAAC;AACD,MAAM,UAAU,aAAa,CAAC,GAAY;IACxC,WAAW,CAAC,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5E,OAAO,GAA8B,CAAC;AACxC,CAAC;AACD,MAAM,UAAU,aAAa,CAAC,GAAY,EAAE,IAAuB;IACjE,MAAM,KAAK,GAAG,aAAa,CAAC,GAAG,CAAC,EAC9B,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC9B,WAAW,CACT,MAAM,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EA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C,eAAe,KAAK,IAAI,CAAC,CAAC;IACjE,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAC/B,MAAM,KAAK,GAAG,aAAa,CAAC,KAAK,CAAC,KAAK,EAAE;QACvC,UAAU;QACV,cAAc;QACd,aAAa;QACb,iBAAiB;QACjB,SAAS;KACV,CAAC,CAAC;IACH,KAAK,MAAM,IAAI,IAAI;QACjB,UAAU;QACV,cAAc;QACd,aAAa;QACb,iBAAiB;KAClB;QACC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IAC7B,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IAC1C,IAAI,KAAK,CAAC,cAAc,KAAK,IAAI;QAC/B,aAAa,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC;IAC/D,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,IAAsB,EAAE,CAAC,CAAC;AACrE,CAAC"}
@@ -0,0 +1,139 @@
1
+ # Immutable renewal witness protocol
2
+
3
+ This component protocol stores complete unsigned renewal snapshot DATA. Its
4
+ trusted host component routes retain and read immutable witnesses through strict
5
+ argument and return validators. Host authentication and authorization must precede
6
+ component calls; storage DATA does not supply either permission.
7
+
8
+ Private source wrappers connect the protocol to a fresh observation invocation.
9
+ Their production capture and read profiles remain frozen and EMPTY. Genuine
10
+ generated references, qualified host bindings, deployed compatibility and provider
11
+ qualification remain required before activation. These private wrappers are not
12
+ public SDK entrypoints.
13
+
14
+ ## Payload and source checks
15
+
16
+ The canonical envelope contains exact installation/witness/parent/configure
17
+ identity, captured subject, bounded acquisition metadata, complete source records
18
+ and reservations, retained attachment receipt, optional retained configure
19
+ receipt, full raw reads and optional complete invoice context. Unknown resource
20
+ fields, own null values and wire decimal strings remain intact.
21
+
22
+ Acquisition metadata names the base 44-read profile and a separate nullable
23
+ seven-extra-read invoice profile. Wall and canonical decimal nanosecond durations
24
+ must fit the original 30-second profile; the derived wall start is nonnegative.
25
+ These are unsigned metadata checks. They establish neither an actual invocation
26
+ nor provider historical time.
27
+
28
+ At both retain and read boundaries, validation reloads the actual original
29
+ component records, payload owners, active reservations, parent basis, complete
30
+ event chains and retained acknowledgements. It checks the parent link and full
31
+ stored source against those records. Configure events must match the complete
32
+ C7 request; response2 is reconstructed even without retained C9. Opaque generic
33
+ journal events do not qualify this protocol. Full stage events need not be
34
+ duplicated in each witness because their actual immutable records are checked.
35
+
36
+ Configuration comes from the complete C7 record. Captured-present C9 must match
37
+ its full retained counterpart; raw constructor input is reconstructed from exact
38
+ dispatch, provider snapshot and transport. Captured-null C9 remains null even if
39
+ a valid C9 is retained later. Later journal integrity is checked without
40
+ injecting the newer receipt into the stored snapshot.
41
+
42
+ The existing evidence analyzer must recompute `current_target_material_match`.
43
+ If invoice context is included, it must also supply complete paired correlation.
44
+ Stored analysis flags and hashes alone do not qualify material. Descriptor
45
+ scope, successor item and native period derive from the complete admitted
46
+ evidence. No live provider resource is fetched during persistence or retrieval.
47
+
48
+ ## Immutable transactions and bounds
49
+
50
+ The logical uniqueness key is installation `componentScope` plus `witnessId`.
51
+ The complete identity additionally binds parent and configure operation IDs.
52
+ Indexed lookups use `take(2)` to detect duplicate rows. First identity wins:
53
+ identical canonical payloads return the same descriptor, while a changed payload
54
+ or operation under that key conflicts. The protocol never overwrites, repairs
55
+ or chooses a new identity automatically.
56
+
57
+ A read checks the full requested identity before releasing content. Wrong
58
+ installation, witness or operation returns no payload. The stored payload is
59
+ revalidated against original component context and its full digest; corrupted,
60
+ missing or duplicate source/storage rows refuse. Later live resource drift does
61
+ not replace the earlier snapshot.
62
+
63
+ The complete canonical envelope keeps the existing 500,000-byte, 10,000-node and
64
+ 40-depth bounds. Before insertion, the protocol also charges the complete stored
65
+ value and full read reply, reserving the admitted maximum opaque ID length for
66
+ its future descriptor. It never crops resources to fit. Transactional helpers
67
+ are intended for one retain operation per registered transaction; normal Convex
68
+ transaction concurrency provides the first-wins behavior across calls.
69
+
70
+ ## Retention and historical meaning
71
+
72
+ The private capture wrapper uses the actual fresh Action, selected SDK and original
73
+ 30-second observation lifetime. It accepts the operation pair and one fixed
74
+ witness identity, acquires complete current reads, and requires
75
+ `current_target_material_match`. A selected invoice profile must acquire its full
76
+ context and establish complete paired correlation. The existing base and invoice
77
+ wrappers retain their own outputs and provider GET bounds.
78
+
79
+ The original transport privately registers one acquisition cell per invocation
80
+ after actual SDK selection. It records only its settled original GET bodies and
81
+ complete fenced invoice context. Retention consumes that acquisition once; it
82
+ accepts no supplied reads, invoice context or guard callback. A fresh invocation,
83
+ selected SDK or copied observation DATA alone cannot create this receipt. Partial
84
+ reads and a second transport under the same invocation refuse.
85
+
86
+ A separate fixed host retention capability binds installation, current subject,
87
+ operation pair, Customer/account/mode, schedule/subscription, complete C7 request
88
+ binding, successor item and native period. Invoice permission does not imply
89
+ retention permission. The wrapper awaits the original native mutation Promise,
90
+ checks the complete descriptor, reads back the exact full payload, then rechecks
91
+ the base, applicable invoice and retention grants before returning retention DATA.
92
+ Public `.then` substitutions and copied replies cannot replace the original RPC
93
+ settlement. Pending or rejected replies do not become acknowledgements. The wrapper
94
+ does not retry a lost reply or choose another witness identity.
95
+
96
+ Acquisition metadata measures the same fresh lifetime used for those reads. It
97
+ does not reuse the old write Owner or restart a deadline. Its wall and monotonic
98
+ durations remain unsigned host observation metadata.
99
+
100
+ A successful transaction returns a row descriptor and full payload binding. It
101
+ does not prove that an external caller received that result. A lost response can
102
+ leave a durable row with no returned public acknowledgement. An explicit later
103
+ identical request can recover the same descriptor, subject to the separate host
104
+ policy and runtime custody checks required for historical acquisition.
105
+
106
+ Descriptors always report false authentication, operational authority and public
107
+ delivery, with provider qualification still required. The captured subject is
108
+ immutable DATA, not permission for a later reader. A later host authorization
109
+ may permit a different subject without rewriting the capture.
110
+
111
+ Stored raw material may supply `{reads, invoiceContext}` to the historical
112
+ evidence axis, independently of later live settings or terminal drift. It does
113
+ not revive a write Owner, manufacture a native past observation, prove atomic
114
+ acquisition or establish exclusive causality. Fetching an old invoice later is
115
+ not a substitute for the complete active snapshot.
116
+
117
+ A later fresh invocation obtains a distinct host read grant before loading the
118
+ complete stored witness. The grant binds its full scope, row identity and payload
119
+ digest and is rechecked before release. A separately authorized later subject can
120
+ read without replacing the immutable captured subject. Source/material/digest
121
+ checks and the current immutable C7 context still apply.
122
+
123
+ Current and lifecycle analysis use the later invocation's current C9 context.
124
+ Historical material analysis uses the witness's own stored C7 and nullable C9
125
+ context. A C9 retained later is not injected into a captured-null witness. This
126
+ keeps historical material independent of current settings, terminal status or
127
+ invoice-read availability while preserving the existing seven-field evidence
128
+ input and twelve-field result. The stored full invoice context can establish
129
+ historical material even when the later invocation has no invoice-read capability.
130
+ If live acquisition fails before intent identity can be reconstructed, the read
131
+ wrapper preserves the already validated immutable C7 identity. Current and
132
+ lifecycle evidence remain unknown; stored historical material does not replace
133
+ those axes.
134
+
135
+ The controlled tests exercise actual registered component transactions, complete
136
+ journal records and private Action/SDK capture and readback. Genuine route
137
+ generation, deployment, native/provider qualification, complete integration and
138
+ release acceptance and Dojo adoption remain separate requirements. Existing
139
+ execution holds remain in force.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fantastic.dev/better-stripe",
3
- "version": "0.110.0",
3
+ "version": "0.112.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",
@@ -1,4 +1,18 @@
1
1
  import { getFunctionAddress } from "convex/server";
2
+ import { types } from "node:util";
3
+ import { closed } from "../c10/ownData.js";
4
+ import {
5
+ witnessIdentity,
6
+ witnessText,
7
+ } from "../../../../../shared/renewalWitness.js";
8
+ import {
9
+ captureWitnessProfile,
10
+ witnessProfileGuard,
11
+ witnessAddress,
12
+ type WitnessMode,
13
+ type WitnessProfile,
14
+ } from "./witnessAuthorization.js";
15
+ import { createWitnessOperation } from "./witnessOperation.js";
2
16
  import {
3
17
  captureInvoiceObservationProfile,
4
18
  invoiceProfileGuard,
@@ -45,16 +59,77 @@ export async function captureFreshInvoiceRenewalObservation(
45
59
  const profile = captureInvoiceObservationProfile(root);
46
60
  return captureFreshObservation(root, raw, profile);
47
61
  }
62
+ type WitnessSpec = Readonly<{
63
+ profile: WitnessProfile;
64
+ mode: WitnessMode;
65
+ identity: ReturnType<typeof witnessIdentity>;
66
+ }>;
67
+ export async function captureFreshWitnessRenewalObservation(
68
+ root: object,
69
+ raw: unknown,
70
+ ) {
71
+ need(arguments.length === 2);
72
+ return captureWitnessObservation(root, raw, "retain");
73
+ }
74
+ export async function captureHistoricalWitnessRenewalObservation(
75
+ root: object,
76
+ raw: unknown,
77
+ ) {
78
+ need(arguments.length === 2);
79
+ return captureWitnessObservation(root, raw, "read");
80
+ }
81
+ function captureWitnessObservation(
82
+ root: object,
83
+ raw: unknown,
84
+ mode: WitnessMode,
85
+ ) {
86
+ const profile = captureWitnessProfile(root, mode);
87
+ need(!types.isProxy(raw));
88
+ const input = closed(raw, [
89
+ "actualActionCtx",
90
+ "parentOperationId",
91
+ "operationId",
92
+ "witnessId",
93
+ ]);
94
+ const identity = witnessIdentity({
95
+ componentScope: profile.freshProfile.historyEntry.componentScope,
96
+ witnessId: witnessText(input.witnessId),
97
+ parentOperationId: input.parentOperationId,
98
+ operationId: input.operationId,
99
+ });
100
+ return captureFreshObservation(
101
+ root,
102
+ {
103
+ actualActionCtx: input.actualActionCtx,
104
+ parentOperationId: identity.parentOperationId,
105
+ operationId: identity.operationId,
106
+ },
107
+ profile.invoiceProfile,
108
+ { profile, mode, identity },
109
+ );
110
+ }
48
111
  async function captureFreshObservation(
49
112
  root: object,
50
113
  raw: unknown,
51
114
  invoiceProfile: InvoiceObservationProfile | null,
115
+ witnessSpec: WitnessSpec | null = null,
52
116
  ) {
53
117
  const profile = captureFreshObservationProfile(root);
118
+ const witnessQueryAddress =
119
+ witnessSpec && witnessAddress(witnessSpec.profile.authorizationQuery);
54
120
  const invoiceAddress =
55
121
  invoiceProfile &&
56
122
  JSON.stringify(getFunctionAddress(invoiceProfile.authorizationQuery));
57
123
  const invoiceGuard = () => {
124
+ if (witnessSpec) {
125
+ witnessProfileGuard(witnessSpec.profile, witnessSpec.mode);
126
+ need(
127
+ witnessSpec.profile.freshProfile === profile &&
128
+ witnessSpec.profile.invoiceProfile === invoiceProfile &&
129
+ witnessAddress(witnessSpec.profile.authorizationQuery) ===
130
+ witnessQueryAddress,
131
+ );
132
+ }
58
133
  if (invoiceProfile) {
59
134
  invoiceProfileGuard(invoiceProfile);
60
135
  need(
@@ -90,9 +165,42 @@ async function captureFreshObservation(
90
165
  profile,
91
166
  invoiceProfile,
92
167
  );
168
+ const witness =
169
+ witnessSpec &&
170
+ createWitnessOperation(
171
+ token,
172
+ witnessSpec.profile,
173
+ witnessSpec.mode,
174
+ witnessSpec.identity,
175
+ );
176
+ if (witnessSpec?.mode === "read") await witness!.load();
93
177
  let invoiceResult: Awaited<
94
178
  ReturnType<typeof transport.acquireInvoices>
95
179
  > | null = null;
180
+ async function analyze(reads: ObservationReads | null) {
181
+ return state.owned(async () => {
182
+ try {
183
+ const evidence = await inspectRenewalEvidenceV1({
184
+ version: 1,
185
+ apiVersion: "2026-09-30.endive",
186
+ configuration: captured.history.record.configuration,
187
+ configureReceipt: captured.history.rawConfigureReceipt,
188
+ reads,
189
+ invoiceContext: invoiceResult?.context ?? null,
190
+ historicalSnapshot: null,
191
+ });
192
+ if (witnessSpec?.mode !== "read") return evidence;
193
+ const historical = await witness!.historicalEvidence();
194
+ return {
195
+ ...evidence,
196
+ identity: evidence.identity ?? historical.identity,
197
+ historicalMaterial: historical.material,
198
+ };
199
+ } catch {
200
+ return null;
201
+ }
202
+ }, transport.guard);
203
+ }
96
204
  async function release(
97
205
  status:
98
206
  | "fresh_observation_data"
@@ -107,8 +215,33 @@ async function captureFreshObservation(
107
215
  ) {
108
216
  await transport.finalizeInvoices();
109
217
  transport.guard();
218
+ let witnessRetention: Awaited<
219
+ ReturnType<ReturnType<typeof createWitnessOperation>["retain"]>
220
+ > | null = null;
221
+ if (witnessSpec?.mode === "retain") {
222
+ need(
223
+ status === "fresh_observation_data" &&
224
+ reads &&
225
+ evidence?.currentMaterial.predicate ===
226
+ "current_target_material_match" &&
227
+ couponInventory === "complete",
228
+ );
229
+ if (invoiceProfile)
230
+ need(
231
+ invoiceResult?.status === "complete" && invoiceResult.context,
232
+ );
233
+ witnessRetention = await witness!.retain();
234
+ await transport.finalizeInvoices();
235
+ } else if (witnessSpec?.mode === "read" && evidence === null)
236
+ evidence = await analyze(reads);
237
+ if (witness) await witness.finalize();
110
238
  const output = captureReaderQueryDATA({
111
239
  status,
240
+ ...(witnessSpec?.mode === "retain"
241
+ ? { witnessRetention }
242
+ : witnessSpec?.mode === "read"
243
+ ? { witness: { descriptor: witness!.descriptor() } }
244
+ : {}),
112
245
  ...(invoiceProfile
113
246
  ? {
114
247
  invoiceContext: invoiceResult?.context ?? null,
@@ -130,11 +263,14 @@ async function captureFreshObservation(
130
263
  operationalAuthority: false as const,
131
264
  });
132
265
  transport.guard();
266
+ witness?.guard();
133
267
  return output;
134
268
  }
135
269
  const base: unknown[] = [];
136
270
  for (const row of baseReadRows(captured.history.record)) {
271
+ witness?.guard();
137
272
  const result = await transport.read(row);
273
+ witness?.guard();
138
274
  if (result.kind === "provider_rejected")
139
275
  return await release(
140
276
  "observation_provider_rejected",
@@ -164,23 +300,6 @@ async function captureFreshObservation(
164
300
  "PROVIDER_IDENTITY_CONFLICT",
165
301
  );
166
302
  }
167
- async function analyze() {
168
- return state.owned(async () => {
169
- try {
170
- return await inspectRenewalEvidenceV1({
171
- version: 1,
172
- apiVersion: "2026-09-30.endive",
173
- configuration: captured.history.record.configuration,
174
- configureReceipt: captured.history.rawConfigureReceipt,
175
- reads,
176
- invoiceContext: invoiceResult?.context ?? null,
177
- historicalSnapshot: null,
178
- });
179
- } catch {
180
- return null;
181
- }
182
- }, transport.guard);
183
- }
184
303
  let ids: readonly string[];
185
304
  try {
186
305
  validateBaseRouting(captured.history.record, reads);
@@ -189,7 +308,7 @@ async function captureFreshObservation(
189
308
  reads.subscription,
190
309
  );
191
310
  } catch {
192
- const analysis = await analyze();
311
+ const analysis = await analyze(reads);
193
312
  return await release(
194
313
  "unsupported_observation_profile",
195
314
  reads,
@@ -200,7 +319,9 @@ async function captureFreshObservation(
200
319
  }
201
320
  for (const id of ids) {
202
321
  const row = couponReadRow(id, 5 + reads.coupons.length);
322
+ witness?.guard();
203
323
  const result = await transport.read(row);
324
+ witness?.guard();
204
325
  if (result.kind === "provider_rejected")
205
326
  return await release(
206
327
  "observation_provider_rejected",
@@ -214,7 +335,9 @@ async function captureFreshObservation(
214
335
  reads.coupons.push(result.body);
215
336
  }
216
337
  if (invoiceProfile) {
338
+ witness?.guard();
217
339
  invoiceResult = await transport.acquireInvoices();
340
+ witness?.guard();
218
341
  if (invoiceResult.status === "provider_rejected")
219
342
  return await release(
220
343
  "observation_provider_rejected",
@@ -225,7 +348,7 @@ async function captureFreshObservation(
225
348
  invoiceResult.failure,
226
349
  );
227
350
  }
228
- const evidence = await analyze();
351
+ const evidence = await analyze(reads);
229
352
  return await release(
230
353
  "fresh_observation_data",
231
354
  reads,