@fantastic.dev/better-stripe 0.91.0 → 0.93.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 (132) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -1
  3. package/dist/client/billing/renewalAttach/internal/configure/actor.d.ts +6 -0
  4. package/dist/client/billing/renewalAttach/internal/configure/actor.d.ts.map +1 -1
  5. package/dist/client/billing/renewalAttach/internal/configure/actor.js +46 -56
  6. package/dist/client/billing/renewalAttach/internal/configure/actor.js.map +1 -1
  7. package/dist/client/billing/renewalAttach/internal/configure/ownedContinuation.d.ts +3 -0
  8. package/dist/client/billing/renewalAttach/internal/configure/ownedContinuation.d.ts.map +1 -0
  9. package/dist/client/billing/renewalAttach/internal/configure/ownedContinuation.js +61 -0
  10. package/dist/client/billing/renewalAttach/internal/configure/ownedContinuation.js.map +1 -0
  11. package/dist/client/billing/renewalAttach/internal/observation/actor.d.ts.map +1 -1
  12. package/dist/client/billing/renewalAttach/internal/observation/actor.js +25 -4
  13. package/dist/client/billing/renewalAttach/internal/observation/actor.js.map +1 -1
  14. package/dist/client/billing/renewalAttach/internal/observation/capture.d.ts.map +1 -1
  15. package/dist/client/billing/renewalAttach/internal/observation/capture.js +3 -2
  16. package/dist/client/billing/renewalAttach/internal/observation/capture.js.map +1 -1
  17. package/dist/client/billing/renewalAttach/internal/observation/configureAcknowledgement.d.ts +5 -0
  18. package/dist/client/billing/renewalAttach/internal/observation/configureAcknowledgement.d.ts.map +1 -0
  19. package/dist/client/billing/renewalAttach/internal/observation/configureAcknowledgement.js +11 -0
  20. package/dist/client/billing/renewalAttach/internal/observation/configureAcknowledgement.js.map +1 -0
  21. package/dist/client/billing/renewalAttach/internal/observation/types.d.ts +5 -0
  22. package/dist/client/billing/renewalAttach/internal/observation/types.d.ts.map +1 -1
  23. package/dist/client/billing/renewalAttach/internal/observation/types.js.map +1 -1
  24. package/dist/client/billing/renewalAttach/internal/producer/classOwnedActionRoot.d.ts +30 -0
  25. package/dist/client/billing/renewalAttach/internal/producer/classOwnedActionRoot.d.ts.map +1 -0
  26. package/dist/client/billing/renewalAttach/internal/producer/classOwnedActionRoot.js +113 -0
  27. package/dist/client/billing/renewalAttach/internal/producer/classOwnedActionRoot.js.map +1 -0
  28. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +562 -0
  29. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts.map +1 -1
  30. package/dist/client/connect/payoutExecutionTestHelpers.d.ts +281 -0
  31. package/dist/client/connect/payoutExecutionTestHelpers.d.ts.map +1 -1
  32. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +562 -0
  33. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts.map +1 -1
  34. package/dist/client/connect/payoutSyncTestHelpers.d.ts +281 -0
  35. package/dist/client/connect/payoutSyncTestHelpers.d.ts.map +1 -1
  36. package/dist/client/index.d.ts +3 -2
  37. package/dist/client/index.d.ts.map +1 -1
  38. package/dist/client/index.js +16 -3
  39. package/dist/client/index.js.map +1 -1
  40. package/dist/component/_generated/api.d.ts +6 -0
  41. package/dist/component/_generated/api.d.ts.map +1 -1
  42. package/dist/component/_generated/api.js.map +1 -1
  43. package/dist/component/_generated/component.d.ts +406 -0
  44. package/dist/component/_generated/component.d.ts.map +1 -1
  45. package/dist/component/balanceFunding/workflowValidators.d.ts +16 -16
  46. package/dist/component/earnings/triggers.d.ts +294 -0
  47. package/dist/component/earnings/triggers.d.ts.map +1 -1
  48. package/dist/component/payoutRelease/queries.d.ts +2 -2
  49. package/dist/component/payoutRelease/queries.d.ts.map +1 -1
  50. package/dist/component/processingCostReconciliation/rollback.d.ts +1 -1
  51. package/dist/component/renewalOperations/helpers.d.ts +236 -0
  52. package/dist/component/renewalOperations/helpers.d.ts.map +1 -0
  53. package/dist/component/renewalOperations/helpers.js +457 -0
  54. package/dist/component/renewalOperations/helpers.js.map +1 -0
  55. package/dist/component/renewalOperations/mutations.d.ts +252 -0
  56. package/dist/component/renewalOperations/mutations.d.ts.map +1 -0
  57. package/dist/component/renewalOperations/mutations.js +340 -0
  58. package/dist/component/renewalOperations/mutations.js.map +1 -0
  59. package/dist/component/renewalOperations/queries.d.ts +163 -0
  60. package/dist/component/renewalOperations/queries.d.ts.map +1 -0
  61. package/dist/component/renewalOperations/queries.js +167 -0
  62. package/dist/component/renewalOperations/queries.js.map +1 -0
  63. package/dist/component/renewalOperations/schema.d.ts +1988 -0
  64. package/dist/component/renewalOperations/schema.d.ts.map +1 -0
  65. package/dist/component/renewalOperations/schema.js +227 -0
  66. package/dist/component/renewalOperations/schema.js.map +1 -0
  67. package/dist/component/schema.d.ts +281 -0
  68. package/dist/component/schema.js +5 -0
  69. package/dist/component/schema.js.map +1 -1
  70. package/dist/component/usage/allowance.fixtures.d.ts +281 -0
  71. package/dist/component/usage/allowance.fixtures.d.ts.map +1 -1
  72. package/dist/component/usageCredits/accounting.fixtures.d.ts +281 -0
  73. package/dist/component/usageCredits/accounting.fixtures.d.ts.map +1 -1
  74. package/dist/shared/renewalOperationJournal.d.ts +43 -0
  75. package/dist/shared/renewalOperationJournal.d.ts.map +1 -0
  76. package/dist/shared/renewalOperationJournal.js +294 -0
  77. package/dist/shared/renewalOperationJournal.js.map +1 -0
  78. package/docs/renewal-context-reads.md +152 -0
  79. package/docs/renewal-material-observation.md +32 -11
  80. package/package.json +1 -1
  81. package/src/client/billing/renewalAttach/internal/configure/actor.ts +63 -52
  82. package/src/client/billing/renewalAttach/internal/configure/ownedContinuation.ts +56 -0
  83. package/src/client/billing/renewalAttach/internal/observation/actor.ts +46 -3
  84. package/src/client/billing/renewalAttach/internal/observation/capture.ts +3 -2
  85. package/src/client/billing/renewalAttach/internal/observation/configureAcknowledgement.ts +20 -0
  86. package/src/client/billing/renewalAttach/internal/observation/observationConfigureACK.integration.test.ts +36 -0
  87. package/src/client/billing/renewalAttach/internal/observation/observationConfigureACKControls.integration.test.ts +48 -0
  88. package/src/client/billing/renewalAttach/internal/observation/observationConfigureACKLifecycle.integration.test.ts +44 -0
  89. package/src/client/billing/renewalAttach/internal/observation/observationConfiguredHistory.integration.test.ts +34 -0
  90. package/src/client/billing/renewalAttach/internal/observation/types.ts +5 -0
  91. package/src/client/billing/renewalAttach/internal/operationJournal.integration.test.ts +380 -0
  92. package/src/client/billing/renewalAttach/internal/producer/classOwnedActionRoot.ts +155 -0
  93. package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteAssertions.ts +5 -1
  94. package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteDeclarations.ts +12 -1
  95. package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteDelegate.ts +38 -0
  96. package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteHistory.ts +8 -0
  97. package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteOperation.ts +10 -23
  98. package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfigureACKAssertions.ts +115 -0
  99. package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfigureACKDeclarations.ts +141 -0
  100. package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfigureACKLifecycleAssertions.ts +74 -0
  101. package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfigureACKLifecycleDeclarations.ts +79 -0
  102. package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfigureACKLifecycleInstrumentation.ts +207 -0
  103. package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfigureACKLifecycleOperation.ts +494 -0
  104. package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfigureACKOperation.ts +452 -0
  105. package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfiguredHistoryAssertions.ts +88 -0
  106. package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfiguredHistoryDeclarations.ts +170 -0
  107. package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfiguredHistoryNative.ts +99 -0
  108. package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfiguredHistoryOperation.ts +411 -0
  109. package/src/client/index.ts +24 -3
  110. package/src/component/_generated/api.ts +6 -0
  111. package/src/component/_generated/component.ts +450 -0
  112. package/src/component/renewalOperations/acknowledgement.fixtures.ts +552 -0
  113. package/src/component/renewalOperations/acknowledgement.test.ts +573 -0
  114. package/src/component/renewalOperations/acknowledgementReads.test.ts +442 -0
  115. package/src/component/renewalOperations/acknowledgementV2.test.ts +493 -0
  116. package/src/component/renewalOperations/acknowledgementV2Publication.test.ts +373 -0
  117. package/src/component/renewalOperations/basisBinding.test.ts +567 -0
  118. package/src/component/renewalOperations/basisLifecycle.test.ts +569 -0
  119. package/src/component/renewalOperations/boundHistory.test.ts +474 -0
  120. package/src/component/renewalOperations/helpers.ts +592 -0
  121. package/src/component/renewalOperations/historyReads.test.ts +595 -0
  122. package/src/component/renewalOperations/initialBasis.test.ts +578 -0
  123. package/src/component/renewalOperations/journal.test.ts +567 -0
  124. package/src/component/renewalOperations/mutations.ts +456 -0
  125. package/src/component/renewalOperations/payload.test.ts +589 -0
  126. package/src/component/renewalOperations/payloadEncoding.test.ts +592 -0
  127. package/src/component/renewalOperations/queries.ts +204 -0
  128. package/src/component/renewalOperations/schema.ts +268 -0
  129. package/src/component/renewalOperations/timingPolicy.fixtures.ts +193 -0
  130. package/src/component/renewalOperations/timingPolicy.test.ts +523 -0
  131. package/src/component/schema.ts +11 -0
  132. package/src/shared/renewalOperationJournal.ts +333 -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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from "convex/values";
2
+ /** Canonical immutable authorization DATA only, never Source or provider proof. */
3
+ export declare function canonicalJournalRecord(raw: string): Readonly<{
4
+ json: string;
5
+ authorizationScope: string;
6
+ authorizationId: string;
7
+ authorizationRevision: number;
8
+ logicalOperationId: string;
9
+ requestBinding: string;
10
+ }>;
11
+ /** Complete immutable reservation DATA. This does not validate a live Owner. */
12
+ export declare function journalReservationMaterial(full: ReturnType<typeof canonicalJournalRecord>): Readonly<{
13
+ key: string;
14
+ apiVersion: string;
15
+ firstDispatchedAt: number;
16
+ accountJSON: string;
17
+ stage: "attach";
18
+ recordVersion: 2;
19
+ timingPolicyJSON: string;
20
+ }> | Readonly<{
21
+ stage: "attach" | "configure";
22
+ key: string;
23
+ apiVersion: string;
24
+ firstDispatchedAt: number;
25
+ accountJSON: string;
26
+ basisJSON: string;
27
+ }>;
28
+ /** Canonical six-field basis DATA and exact original-policy projection only. */
29
+ export declare function canonicalInitialBasis(policyJSON: string, basisJSON: string): Readonly<{
30
+ policyJSON: string;
31
+ basisJSON: string;
32
+ }>;
33
+ /** Existing C10 hash domain and whole budgets, for DATA consistency only. */
34
+ export declare function canonicalJournalEvent(sequence: number, raw: string): Promise<Readonly<{
35
+ sequence: 1 | 2 | 3;
36
+ binding: string;
37
+ json: string;
38
+ }>>;
39
+ /** Journal receiver boundary: exactly 1 MiB fits; strictly greater refuses. */
40
+ export declare function admitJournalValue(value: Value): void;
41
+ /** Admit extracted database strings without changing the retained JSON model. */
42
+ export declare function admitJournalStrings(values: readonly string[]): void;
43
+ //# sourceMappingURL=renewalOperationJournal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renewalOperationJournal.d.ts","sourceRoot":"","sources":["../../src/shared/renewalOperationJournal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,KAAK,EAAE,MAAM,eAAe,CAAC;AA4E1D,mFAAmF;AACnF,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM;;;;;;;GAwCjD;AAED,gFAAgF;AAChF,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,UAAU,CAAC,OAAO,sBAAsB,CAAC;;;;;WA0CpC,QAAQ;mBACA,CAAC;;;;;;;;;GAQrB;AAED,gFAAgF;AAChF,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;;;GA4F1E;AAED,6EAA6E;AAC7E,wBAAsB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM;;;;IAoCxE;AAED,+EAA+E;AAC/E,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAMpD;AAED,iFAAiF;AACjF,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAcnE"}
@@ -0,0 +1,294 @@
1
+ import { getConvexSize } from "convex/values";
2
+ import { eventDigest, objectNode, scalarNode, } from "../client/billing/renewalAttach/internal/c10/eventCodec.js";
3
+ import { renewalSnapshot } from "../client/billing/renewalReplacementSnapshot.js";
4
+ function stop() {
5
+ throw Error("RENEWAL_JOURNAL_JSON_STOP");
6
+ }
7
+ function record(value) {
8
+ return value !== null && typeof value === "object" && !Array.isArray(value);
9
+ }
10
+ function text(value) {
11
+ return typeof value === "string" && value.length > 0;
12
+ }
13
+ /** Intrinsic V2 policy DATA only; full C1/C2 validation is an async boundary. */
14
+ function validateAttachTimingPolicy(value) {
15
+ const policy = value.timingPolicy;
16
+ const dispatch = value.dispatch;
17
+ const source = value.attachRequest;
18
+ if (value.stage !== "attach" ||
19
+ Object.prototype.hasOwnProperty.call(value, "basis") ||
20
+ !Object.prototype.hasOwnProperty.call(value, "timingPolicy") ||
21
+ !record(policy) ||
22
+ !record(dispatch) ||
23
+ !record(source) ||
24
+ !record(source.preparation) ||
25
+ !record(source.preparation.expected))
26
+ stop();
27
+ const fields = [
28
+ "version",
29
+ "firstDispatchedAt",
30
+ "periodStart",
31
+ "periodEnd",
32
+ "workEndWallMs",
33
+ "endWallMs",
34
+ ];
35
+ const keys = Object.keys(policy);
36
+ if (keys.length !== fields.length ||
37
+ keys.some((key) => !fields.includes(key)))
38
+ stop();
39
+ const { firstDispatchedAt, periodStart, periodEnd, workEndWallMs, endWallMs, } = policy;
40
+ const integer = (candidate) => typeof candidate === "number" &&
41
+ Number.isSafeInteger(candidate) &&
42
+ candidate >= 0;
43
+ if (policy.version !== 1 ||
44
+ !integer(firstDispatchedAt) ||
45
+ !integer(periodStart) ||
46
+ !integer(periodEnd) ||
47
+ !integer(workEndWallMs) ||
48
+ !integer(endWallMs) ||
49
+ periodEnd <= periodStart ||
50
+ endWallMs < workEndWallMs ||
51
+ firstDispatchedAt !== dispatch.firstDispatchedAt ||
52
+ firstDispatchedAt !== source.firstDispatchedAt ||
53
+ periodStart !== source.preparation.expected.periodStart ||
54
+ periodEnd !== source.preparation.expected.periodEnd)
55
+ stop();
56
+ }
57
+ /** Canonical immutable authorization DATA only, never Source or provider proof. */
58
+ export function canonicalJournalRecord(raw) {
59
+ try {
60
+ if (raw.length > 500000)
61
+ stop();
62
+ const parsed = JSON.parse(raw);
63
+ const value = renewalSnapshot(parsed);
64
+ if (!record(value) ||
65
+ (value.schemaVersion !== 1 && value.schemaVersion !== 2))
66
+ stop();
67
+ if (value.schemaVersion === 2)
68
+ validateAttachTimingPolicy(value);
69
+ const authorization = value.authorization;
70
+ if (!record(authorization) ||
71
+ !text(authorization.scope) ||
72
+ !text(authorization.id) ||
73
+ typeof authorization.revision !== "number" ||
74
+ !Number.isSafeInteger(authorization.revision) ||
75
+ authorization.revision < 1 ||
76
+ !text(value.logicalOperationId) ||
77
+ !text(value.requestBinding))
78
+ stop();
79
+ const json = JSON.stringify(value);
80
+ if (json.length > 500000 || new TextEncoder().encode(json).length > 500000)
81
+ stop();
82
+ const normalized = {
83
+ json,
84
+ authorizationScope: authorization.scope,
85
+ authorizationId: authorization.id,
86
+ authorizationRevision: authorization.revision,
87
+ logicalOperationId: value.logicalOperationId,
88
+ requestBinding: value.requestBinding,
89
+ };
90
+ return value.schemaVersion === 2
91
+ ? Object.freeze({ ...normalized, recordVersion: 2 })
92
+ : Object.freeze(normalized);
93
+ }
94
+ catch {
95
+ return stop();
96
+ }
97
+ }
98
+ /** Complete immutable reservation DATA. This does not validate a live Owner. */
99
+ export function journalReservationMaterial(full) {
100
+ const value = JSON.parse(full.json);
101
+ if (!record(value))
102
+ stop();
103
+ const dispatch = value.dispatch;
104
+ const account = value.account;
105
+ const basis = value.basis;
106
+ if ((value.stage !== "attach" && value.stage !== "configure") ||
107
+ !record(dispatch) ||
108
+ !text(dispatch.key) ||
109
+ typeof dispatch.firstDispatchedAt !== "number" ||
110
+ !Number.isSafeInteger(dispatch.firstDispatchedAt) ||
111
+ dispatch.firstDispatchedAt < 0 ||
112
+ !text(value.apiVersion) ||
113
+ dispatch.apiVersion !== value.apiVersion ||
114
+ dispatch.method !== "POST" ||
115
+ !text(dispatch.path) ||
116
+ !record(dispatch.payload) ||
117
+ !record(account) ||
118
+ (value.schemaVersion !== 2 && !record(basis)) ||
119
+ (account.mode !== "platform" && account.mode !== "connected") ||
120
+ dispatch.scope !== account.mode ||
121
+ typeof account.livemode !== "boolean" ||
122
+ (account.mode === "platform"
123
+ ? account.stripeAccount !== null
124
+ : !text(account.stripeAccount)))
125
+ stop();
126
+ admitJournalStrings([dispatch.key, value.apiVersion]);
127
+ const common = Object.freeze({
128
+ stage: value.stage,
129
+ key: dispatch.key,
130
+ apiVersion: value.apiVersion,
131
+ firstDispatchedAt: dispatch.firstDispatchedAt,
132
+ accountJSON: JSON.stringify(renewalSnapshot(account)),
133
+ });
134
+ if (value.schemaVersion === 2) {
135
+ if (value.stage !== "attach")
136
+ stop();
137
+ validateAttachTimingPolicy(value);
138
+ return Object.freeze({
139
+ ...common,
140
+ stage: "attach",
141
+ recordVersion: 2,
142
+ timingPolicyJSON: JSON.stringify(renewalSnapshot(value.timingPolicy)),
143
+ });
144
+ }
145
+ return Object.freeze({
146
+ ...common,
147
+ basisJSON: JSON.stringify(renewalSnapshot(basis)),
148
+ });
149
+ }
150
+ /** Canonical six-field basis DATA and exact original-policy projection only. */
151
+ export function canonicalInitialBasis(policyJSON, basisJSON) {
152
+ try {
153
+ function capture(raw) {
154
+ if (raw.length > 500000)
155
+ throw Error();
156
+ const parsed = JSON.parse(raw);
157
+ const value = renewalSnapshot(parsed);
158
+ const json = JSON.stringify(value);
159
+ if (json.length > 500000 ||
160
+ new TextEncoder().encode(json).length > 500000)
161
+ throw Error();
162
+ if (!record(value))
163
+ throw Error();
164
+ return { value, json };
165
+ }
166
+ const policy = capture(policyJSON);
167
+ const basis = capture(basisJSON);
168
+ const policyKeys = [
169
+ "version",
170
+ "firstDispatchedAt",
171
+ "periodStart",
172
+ "periodEnd",
173
+ "workEndWallMs",
174
+ "endWallMs",
175
+ ];
176
+ const basisKeys = [
177
+ "startWallMs",
178
+ "startNsDecimal",
179
+ "workEndWallMs",
180
+ "workEndNsDecimal",
181
+ "endWallMs",
182
+ "endNsDecimal",
183
+ ];
184
+ if (Object.keys(policy.value).length !== policyKeys.length ||
185
+ Object.keys(policy.value).some((key) => !policyKeys.includes(key)) ||
186
+ Object.keys(basis.value).length !== basisKeys.length ||
187
+ Object.keys(basis.value).some((key) => !basisKeys.includes(key)))
188
+ throw Error();
189
+ const integer = (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
190
+ const { firstDispatchedAt, periodStart, periodEnd } = policy.value;
191
+ const policyWork = policy.value.workEndWallMs;
192
+ const policyEnd = policy.value.endWallMs;
193
+ const { startWallMs, workEndWallMs, endWallMs } = basis.value;
194
+ if (policy.value.version !== 1 ||
195
+ !integer(firstDispatchedAt) ||
196
+ !integer(periodStart) ||
197
+ !integer(periodEnd) ||
198
+ periodEnd <= periodStart ||
199
+ !integer(policyWork) ||
200
+ !integer(policyEnd) ||
201
+ policyEnd < policyWork ||
202
+ !integer(startWallMs) ||
203
+ !integer(workEndWallMs) ||
204
+ !integer(endWallMs) ||
205
+ startWallMs >= workEndWallMs ||
206
+ workEndWallMs !== policyWork ||
207
+ endWallMs !== policyEnd)
208
+ throw Error();
209
+ function u64(value) {
210
+ if (typeof value !== "string" ||
211
+ value.length > 20 ||
212
+ !/^(0|[1-9][0-9]*)$/.test(value))
213
+ throw Error();
214
+ const number = BigInt(value);
215
+ if (number > 18446744073709551615n)
216
+ throw Error();
217
+ return number;
218
+ }
219
+ const startNs = u64(basis.value.startNsDecimal);
220
+ const workNs = u64(basis.value.workEndNsDecimal);
221
+ const endNs = u64(basis.value.endNsDecimal);
222
+ const workProjection = startNs + (BigInt(workEndWallMs) - BigInt(startWallMs)) * 1000000n;
223
+ const endProjection = startNs + (BigInt(endWallMs) - BigInt(startWallMs)) * 1000000n;
224
+ if (workNs !== workProjection ||
225
+ endNs !== endProjection ||
226
+ startNs >= workNs ||
227
+ workNs > endNs)
228
+ throw Error();
229
+ return Object.freeze({ policyJSON: policy.json, basisJSON: basis.json });
230
+ }
231
+ catch {
232
+ throw Error("RENEWAL_JOURNAL_CONFLICT");
233
+ }
234
+ }
235
+ /** Existing C10 hash domain and whole budgets, for DATA consistency only. */
236
+ export async function canonicalJournalEvent(sequence, raw) {
237
+ try {
238
+ if (sequence !== 1 && sequence !== 2 && sequence !== 3)
239
+ throw Error();
240
+ if (raw.length > 500000)
241
+ throw Error();
242
+ const parsed = JSON.parse(raw);
243
+ const value = renewalSnapshot(parsed);
244
+ const json = JSON.stringify(value);
245
+ if (json.length > 500000 || new TextEncoder().encode(json).length > 500000)
246
+ throw Error();
247
+ function capture(value) {
248
+ if (value === null || typeof value !== "object")
249
+ return scalarNode(value);
250
+ if (Array.isArray(value))
251
+ return Object.freeze({
252
+ kind: "array",
253
+ entries: Object.freeze(value.map((item, index) => Object.freeze([String(index), capture(item)]))),
254
+ });
255
+ return objectNode(Object.entries(value).map(([key, item]) => [key, capture(item)]));
256
+ }
257
+ const binding = await eventDigest(objectNode([
258
+ ["sequence", scalarNode(sequence)],
259
+ ["data", capture(value)],
260
+ ]));
261
+ return Object.freeze({ sequence, binding, json });
262
+ }
263
+ catch {
264
+ throw Error("RENEWAL_JOURNAL_CONFLICT");
265
+ }
266
+ }
267
+ /** Journal receiver boundary: exactly 1 MiB fits; strictly greater refuses. */
268
+ export function admitJournalValue(value) {
269
+ try {
270
+ if (getConvexSize(value) > 1048576)
271
+ throw Error();
272
+ }
273
+ catch {
274
+ throw Error("RENEWAL_JOURNAL_LIMIT");
275
+ }
276
+ }
277
+ /** Admit extracted database strings without changing the retained JSON model. */
278
+ export function admitJournalStrings(values) {
279
+ for (const value of values) {
280
+ for (let index = 0; index < value.length; index++) {
281
+ const unit = value.charCodeAt(index);
282
+ if (unit >= 0xd800 && unit <= 0xdbff) {
283
+ const next = value.charCodeAt(index + 1);
284
+ if (!(next >= 0xdc00 && next <= 0xdfff))
285
+ throw Error("RENEWAL_JOURNAL_ENCODING");
286
+ index++;
287
+ }
288
+ else if (unit >= 0xdc00 && unit <= 0xdfff) {
289
+ throw Error("RENEWAL_JOURNAL_ENCODING");
290
+ }
291
+ }
292
+ }
293
+ }
294
+ //# sourceMappingURL=renewalOperationJournal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renewalOperationJournal.js","sourceRoot":"","sources":["../../src/shared/renewalOperationJournal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAc,MAAM,eAAe,CAAC;AAC1D,OAAO,EACL,WAAW,EACX,UAAU,EACV,UAAU,GAEX,MAAM,4DAA4D,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,iDAAiD,CAAC;AAElF,SAAS,IAAI;IACX,MAAM,KAAK,CAAC,2BAA2B,CAAC,CAAC;AAC3C,CAAC;AACD,SAAS,MAAM,CAAC,KAAc;IAC5B,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AACD,SAAS,I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,CAAC;QACP,MAAM,KAAK,CAAC,0BAA0B,CAAC,CAAC;IAC1C,CAAC;AACH,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,iBAAiB,CAAC,KAAY;IAC5C,IAAI,CAAC;QACH,IAAI,aAAa,CAAC,KAAK,CAAC,GAAG,OAAO;YAAE,MAAM,KAAK,EAAE,CAAC;IACpD,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,KAAK,CAAC,uBAAuB,CAAC,CAAC;IACvC,CAAC;AACH,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,mBAAmB,CAAC,MAAyB;IAC3D,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;YAClD,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;YACrC,IAAI,IAAI,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,EAAE,CAAC;gBACrC,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;gBACzC,IAAI,CAAC,CAAC,IAAI,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,CAAC;oBACrC,MAAM,KAAK,CAAC,0BAA0B,CAAC,CAAC;gBAC1C,KAAK,EAAE,CAAC;YACV,CAAC;iBAAM,IAAI,IAAI,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,EAAE,CAAC;gBAC5C,MAAM,KAAK,CAAC,0BAA0B,CAAC,CAAC;YAC1C,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -71,6 +71,158 @@ Node-only mechanics establish no provider custody or native qualification and
71
71
  expose no caller-supplied clock, client or qualification API. The public
72
72
  preparation and receipt constructors are unchanged.
73
73
 
74
+ The maintained SDK constructor also records an inert identity for its private
75
+ renewal bridge. While operational profiles remain unqualified, the bridge
76
+ refuses before invoking its client selector or entry. Normal construction and
77
+ context reads remain available. This internal setup adds no public schedule
78
+ writer.
79
+
80
+ ## Component operation journal
81
+
82
+ The component's `renewalOperations` functions retain host-authorized operation
83
+ DATA separately from the process-local ownership and transport machinery above.
84
+ The host authenticates the caller and authorizes the exact operation before
85
+ calling these server functions. An operation ID, stored request, binding or
86
+ commit receipt does not establish provider provenance or a live owner.
87
+
88
+ `createAuthorizedOperation` stores the complete canonical JSON record and its
89
+ original authorization scope, revision and logical operation identity. An
90
+ identical canonical request returns the existing operation. Changing the full
91
+ request under the same logical identity returns a conflict and preserves the
92
+ original. A new authorization revision requires a new logical operation identity.
93
+ The finite JSON model preserves unknown nested fields, array order and own
94
+ properties, including absent versus null values. Original record JSON must fit
95
+ 500,000 characters and UTF-8 bytes, 10,000 nodes and depth 40.
96
+
97
+ Legacy `schemaVersion: 1` records retain their existing shape. Attachment-only
98
+ `schemaVersion: 2` records instead declare a closed `timingPolicy` with `version: 1`,
99
+ `firstDispatchedAt`, `periodStart`, `periodEnd`, `workEndWallMs` and `endWallMs`.
100
+ First-dispatch and period fields use epoch seconds; wall cutoff fields use epoch
101
+ milliseconds. They have no root `basis`; a policy does not establish a live
102
+ execution origin.
103
+
104
+ Before V2 creation, a successful creation duplicate or a stored-source read,
105
+ the component reconstructs the actual pure C1 preparation from the complete
106
+ `attachRequest.preparation`, then reconstructs C2. The entire seven-field
107
+ dispatch, account, API version, request binding and policy must match the
108
+ retained source. A stored preparation flag or matching period fields alone
109
+ cannot replace these checks. The complete `originalBundle` remains opaque
110
+ host-authorized DATA: no layout or equality to the preparation is inferred.
111
+ Changing it still changes the immutable full record. Existing V1 records are
112
+ not migrated or supplied with a new basis.
113
+
114
+ `reserveAttempt` performs the first PREPARED-to-RESERVED transaction. Exactly one
115
+ winning invocation receives `acquired`; an identical later request receives
116
+ `existing` with the retained reservation. The result is DATA. Copying or loading
117
+ it cannot create a fresh execution capability. Expiry, process loss and a missing
118
+ reply do not release a new reservation or authorize another provider request.
119
+
120
+ A V2 reservation carries `recordVersion: 2` and complete canonical
121
+ `timingPolicyJSON` instead of legacy `basisJSON`. A reserved attempt with no
122
+ bound basis is valid only at head zero, without events or a known receipt.
123
+ This pending or orphaned DATA cannot authorize another execution.
124
+
125
+ `bindInitialBasis` accepts exactly `operationId`, `attemptId`, `policyJSON` and
126
+ `basisJSON`. The first binding requires the actual current V2 reservation,
127
+ head zero, no events and no known receipt. It atomically adds only an inline
128
+ `initialBasis` descriptor containing `version`, `attemptId`, `sourcePayloadId`,
129
+ `stage`, `policyJSON` and `basisJSON`; source, attempt and revision remain unchanged.
130
+ The result is `{ status: "bound", operationId, initialBasis }`.
131
+
132
+ The closed six-field basis DATA consists of `startWallMs`, `startNsDecimal`,
133
+ `workEndWallMs`, `workEndNsDecimal`, `endWallMs` and `endNsDecimal`. Wall values
134
+ must be safe nonnegative integers, with start strictly before the work cutoff.
135
+ Both cutoff wall values must equal the original policy. Nanoseconds use
136
+ canonical unsigned decimal strings within the u64 range. Exact BigInt arithmetic
137
+ checks each cutoff as `startNs + (cutoffWallMs - startWallMs) * 1000000`, with
138
+ ordered endpoints and no Number rounding.
139
+
140
+ The server checks arithmetic and retained identity without sampling a clock.
141
+ It does not establish current paid-period or replay-age eligibility. Those checks
142
+ require a separately qualified live invocation. Repeating the same complete
143
+ normalized binding returns the original descriptor without writes, including
144
+ after valid history and a known receipt. Changed input or corrupt retained
145
+ links, canonical JSON, arithmetic, history or known DATA refuses without repair.
146
+ Binding never reconstructs an owner from stored nanoseconds or extends a cutoff.
147
+
148
+ `appendStageEvent` compares the complete retained reservation and appends a
149
+ canonical event at the next sequence, from 1 through 3. An identical duplicate
150
+ returns the original commit receipt. A conflicting duplicate refuses without
151
+ replacing stored evidence. A dispatch event records intent, and a committed
152
+ receipt event does not establish that the host returned success to its caller.
153
+ V2 event writes require the checked bound basis for that same operation and
154
+ attempt. Events or a known receipt without a bound basis are corruption; they
155
+ cannot be adopted as a fresh binding.
156
+
157
+ `retainProviderAcknowledgement` reconstructs the complete attachment receipt
158
+ from the original raw preparation, dispatch and stored response. It compares
159
+ the full receipt and applies the existing whole-output JSON and privacy rules.
160
+ The transaction stores one owned receipt payload and a stable
161
+ `knownAcknowledgement` reference. It does not append receipt event 3.
162
+
163
+ A first retention must name the current history head, 2 or 3. When event 3
164
+ exists, its complete request and receipt must match. An identical retry returns
165
+ the original retention descriptor without writes. A caller that retained at
166
+ head 2 can repeat that same request after matching event 3 is appended. A
167
+ request for a future head refuses. Once a receipt is retained, event 3 must
168
+ match its complete request and receipt before any append writes; copying the
169
+ receipt binding alone is insufficient.
170
+
171
+ Operation payloads carry their immutable operation ID. Event payloads also carry
172
+ an attempt, stage and sequence. Receipt payloads carry their operation, attempt
173
+ and stage. Creation links a new source payload to its actual
174
+ operation within the same transaction. Readers refuse missing or conflicting
175
+ ownership links, even when a foreign payload has identical JSON and a matching
176
+ hash. They never infer or repair ownership from its contents.
177
+
178
+ For V2, complete owned history and any known receipt are also checked before
179
+ successful create-existing, reserve-existing and bind-duplicate returns, append
180
+ returns or writes, and all four queries below. These checks reconstruct the full
181
+ C3 receipt and validate every retained source/event/receipt reference, payload
182
+ owner and complete canonical receipt JSON. An absent sequence or an identical
183
+ old event does not bypass corrupt known DATA. The acknowledgement getter reuses
184
+ that validated receipt; it does not treat a matching binding alone as sufficient.
185
+
186
+ Read complete retained data through the bounded query protocol:
187
+
188
+ | Query | Result |
189
+ | ----------------------------- | --------------------------------------------------------------------------------------------------------------------- |
190
+ | `loadAuthorizedOperation` | Full canonical `recordJSON` once, revision and an active-attempt summary containing the remaining reservation fields. |
191
+ | `readAttempt` | Complete reservation DATA and up to three ordered event descriptors, after validating the entire stored chain. |
192
+ | `readStageEvent` | One complete canonical event JSON and its descriptor, selected by operation ID, active attempt ID and sequence. |
193
+ | `readProviderAcknowledgement` | `{ retention, receiptJSON }`, with the stable descriptor and full canonical receipt JSON once. |
194
+
195
+ A V1 load keeps its four keys: `operationId`, `recordJSON`, `revision` and
196
+ `activeAttempt`, with no added basis field. A V2 load has six keys: those four
197
+ plus `recordVersion: 2` and the complete `initialBasis` descriptor or null.
198
+ PREPARED revision zero has null attempt and basis. RESERVED revision one returns
199
+ the checked policy-only attempt summary and its bound basis, or null while still
200
+ unbound at head zero. Full source JSON appears only once in either load result.
201
+
202
+ An event descriptor contains the operation, attempt, stage, original source payload,
203
+ sequence, binding, event payload and event IDs. It contains no event JSON. Read
204
+ each manifested event separately, comparing its complete descriptor with the
205
+ manifest. Three events require one manifest query and three event queries.
206
+ Previously stored entries remain immutable if another event is appended between
207
+ reads; this protocol does not promise a snapshot across those calls.
208
+
209
+ A missing operation returns null. For `readAttempt` and
210
+ `readStageEvent`, an existing operation with a wrong or absent active attempt
211
+ refuses. A valid sequence beyond the committed chain returns null
212
+ only after the existing chain passes validation. Corrupt or incomplete history
213
+ never becomes an empty or partial successful result.
214
+
215
+ For `readProviderAcknowledgement`, null means no retained reference at the time
216
+ of the query. A present reference with a missing or corrupt receipt, source,
217
+ attempt or history refuses. This result cannot authorize another provider
218
+ request. Read full source and event JSON through the other bounded queries when
219
+ comparing the complete retained records.
220
+
221
+ These storage APIs do not activate the internal actors or add a public SDK
222
+ schedule writer. Host policy, actual runtime ownership, provider qualification
223
+ and restart recovery require their own integration. Stored DATA never revives an
224
+ old owner, resets a deadline or establishes delivery to a disconnected caller.
225
+
74
226
  ## Internal initial material consistency
75
227
 
76
228
  The internal `renewalAttach/internal/material` classifiers compare complete
@@ -123,7 +123,7 @@ a fixed error; safe but insufficient material returns `unknown` or `conflict`
123
123
  with a fixed reason. No raw provider error is logged or returned. The host remains
124
124
  responsible for retaining its immutable request and response data when reads fail.
125
125
 
126
- ## Internal owned observation without a configure acknowledgement
126
+ ## Internal owned observation and retained configure acknowledgements
127
127
 
128
128
  `captureOwnedRenewalObservationV2` is internal; each captured handle permits one
129
129
  invocation. Its fixed Source must bind the original Owner and origin, original
@@ -141,21 +141,42 @@ The read order is Schedule, expanded Subscription, target Price, billing Custome
141
141
  then unique Coupon IDs across the original and current subscription and item
142
142
  discounts. Two distinct Coupon IDs give six GETs; the union permits at most 40
143
143
  Coupons and 44 GETs. Complete bare response bodies and ordinary unknown fields are
144
- retained. This invocation makes no POST, calls no configure-receipt constructor
145
- and appends no C10 events.
144
+ retained. This invocation makes no POST and appends no C10 events. When both
145
+ configure fields are absent, it calls no configure-receipt constructor. The
146
+ optional branch reconstructs the retained receipt before current reads.
146
147
 
147
148
  `owned_observation_data` contains `observation`, `reads`, the final read's
148
- `observedAt`, `retainedConfigureAcknowledgement: "absent"` and
149
+ `observedAt`, `retainedConfigureAcknowledgement: "absent" | "present"` and
149
150
  `operationalAuthority: false`. The complete pure-helper result is preserved.
150
151
  Record, observer input and result each remain within 500000 serialized characters
151
152
  and UTF-8 bytes, 10000 nodes counting repeated occurrences, and depth 40. The
152
153
  result is detached and frozen before its final Owner check. Owner checks guard
153
154
  settled continuations; they do not promise immediate cancellation of pending HTTP.
154
155
 
155
- This branch requires `configureAcknowledgement` to be absent. The public pure
156
- helper's optional `configureReceipt` remains a separate input. The internal branch
157
- does not widen the helper's absent-response pending/effective classes or
158
- invoice-pointer limitation. Historical configure-response custody, successor
159
- invoice evidence, genuine Source binding and provider qualification remain
160
- separate requirements. These sequential reads do not atomically exclude other
161
- provider writers or establish payment, authentication or entitlement.
156
+ The fixed Source can omit both `configureAcknowledgement` and
157
+ `configureOperation`, or supply both. Supplying only one rejects before the
158
+ original projection. With both present, a supported original projection Failure
159
+ still returns unchanged before configure custody checks or reads.
160
+
161
+ The optional branch requires the actual configure operation and the exact
162
+ acknowledgement wrapper returned by its writer under the same original Owner, origin, attachment
163
+ entry and complete retained record. An equal reconstructed object does not
164
+ establish custody. A valid receipt that was constructed but never returned does
165
+ not satisfy this relation. The lookup exposes detached frozen data, including
166
+ the complete original receipt-constructor input, without exposing private history
167
+ or transport capabilities. The observer constructs a fresh receipt from that
168
+ input and checks the entire acknowledgement, including default-setting presence,
169
+ before acquiring current reads. It supplies the full retained input to the
170
+ unchanged public pure helper as `configureReceipt`.
171
+
172
+ The `present` marker describes this process-local returned-receipt association.
173
+ It does not establish durable custody after restart, provider qualification,
174
+ pending or effective state. A retained one-phase response can still produce an
175
+ honest `unknown` result. With complete configured historical material, the branch
176
+ preserves the pure helper's `pending_material_match` or
177
+ `current_target_material_match` comparisons. Those results remain unsigned
178
+ material predicates. The absent branch keeps the helper's existing
179
+ pending/effective classes and invoice-pointer limitation. Historical and terminal
180
+ provider qualification, successor invoice evidence and genuine Source binding
181
+ remain separate requirements. These sequential reads do not atomically exclude other provider
182
+ writers or establish payment, authentication or entitlement.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fantastic.dev/better-stripe",
3
- "version": "0.91.0",
3
+ "version": "0.93.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",