@fantastic.dev/better-stripe 0.84.0 → 0.86.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 (59) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -1
  3. package/dist/client/billing/renewalAggregate/configure.d.ts.map +1 -1
  4. package/dist/client/billing/renewalAggregate/configure.js +4 -56
  5. package/dist/client/billing/renewalAggregate/configure.js.map +1 -1
  6. package/dist/client/billing/renewalAggregate/configureMaterial.d.ts +29 -0
  7. package/dist/client/billing/renewalAggregate/configureMaterial.d.ts.map +1 -0
  8. package/dist/client/billing/renewalAggregate/configureMaterial.js +63 -0
  9. package/dist/client/billing/renewalAggregate/configureMaterial.js.map +1 -0
  10. package/dist/client/billing/renewalAggregate/phases.d.ts +2 -2
  11. package/dist/client/billing/renewalAggregate/phases.d.ts.map +1 -1
  12. package/dist/client/billing/renewalAggregate/phases.js.map +1 -1
  13. package/dist/client/billing/renewalAggregate/preflight.d.ts +1 -118
  14. package/dist/client/billing/renewalAggregate/preflight.d.ts.map +1 -1
  15. package/dist/client/billing/renewalAggregate/preflight.js +3 -118
  16. package/dist/client/billing/renewalAggregate/preflight.js.map +1 -1
  17. package/dist/client/billing/renewalAggregate/readMaterial.d.ts +335 -0
  18. package/dist/client/billing/renewalAggregate/readMaterial.d.ts.map +1 -0
  19. package/dist/client/billing/renewalAggregate/readMaterial.js +121 -0
  20. package/dist/client/billing/renewalAggregate/readMaterial.js.map +1 -0
  21. package/dist/client/billing/renewalV2/binding.d.ts +1 -1
  22. package/dist/client/billing/renewalV2/binding.d.ts.map +1 -1
  23. package/dist/client/billing/renewalV2/binding.js.map +1 -1
  24. package/dist/client/billing/renewalV2/configureInput.d.ts +45 -0
  25. package/dist/client/billing/renewalV2/configureInput.d.ts.map +1 -0
  26. package/dist/client/billing/renewalV2/configureInput.js +69 -0
  27. package/dist/client/billing/renewalV2/configureInput.js.map +1 -0
  28. package/dist/client/billing/renewalV2/index.d.ts +46 -0
  29. package/dist/client/billing/renewalV2/index.d.ts.map +1 -1
  30. package/dist/client/billing/renewalV2/index.js +134 -1
  31. package/dist/client/billing/renewalV2/index.js.map +1 -1
  32. package/dist/client/billing/renewalV2/receipt.d.ts +37 -0
  33. package/dist/client/billing/renewalV2/receipt.d.ts.map +1 -0
  34. package/dist/client/billing/renewalV2/receipt.js +131 -0
  35. package/dist/client/billing/renewalV2/receipt.js.map +1 -0
  36. package/dist/client/renewal.d.ts +2 -2
  37. package/dist/client/renewal.d.ts.map +1 -1
  38. package/dist/client/renewal.js +1 -1
  39. package/dist/client/renewal.js.map +1 -1
  40. package/dist/client/usage/observationClient.d.ts +2 -2
  41. package/dist/client/usage/observationClient.d.ts.map +1 -1
  42. package/dist/component/payoutRelease/queries.d.ts +2 -2
  43. package/dist/component/payoutRelease/queries.d.ts.map +1 -1
  44. package/dist/component/processingCostReconciliation/rollback.d.ts +1 -1
  45. package/docs/renewal-context-reads.md +73 -3
  46. package/docs/renewal-phase-assembly.md +78 -0
  47. package/package.json +1 -1
  48. package/src/client/billing/renewalAggregate/configure.ts +12 -79
  49. package/src/client/billing/renewalAggregate/configureMaterial.ts +122 -0
  50. package/src/client/billing/renewalAggregate/phases.ts +2 -2
  51. package/src/client/billing/renewalAggregate/preflight.ts +6 -161
  52. package/src/client/billing/renewalAggregate/readMaterial.ts +173 -0
  53. package/src/client/billing/renewalV2/binding.ts +7 -1
  54. package/src/client/billing/renewalV2/configure.test.ts +362 -0
  55. package/src/client/billing/renewalV2/configureInput.ts +84 -0
  56. package/src/client/billing/renewalV2/index.ts +228 -1
  57. package/src/client/billing/renewalV2/receipt.test.ts +289 -0
  58. package/src/client/billing/renewalV2/receipt.ts +163 -0
  59. package/src/client/renewal.ts +7 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/client/billing/renewalV2/index.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,qCAAqC,EAC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;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AACF,MAAM,MAAM,+BAA+B,GAAG,IAAI,CAChD,6BAA6B,EAC7B,SAAS,CACV,GAAG;IAAE,OAAO,EAAE,CAAC,CAAA;CAAE,CAAC;AACnB,MAAM,MAAM,qCAAqC,GAAG,OAAO,CAAC;AAE5D,sFAAsF;AACtF,wBAAsB,6BAA6B,CACjD,OAAO,EAAE,oCAAoC,GAC5C,OAAO,CACR,+BAA+B,GAAG,qCAAqC,CACxE,CAwFA"}
@@ -1,9 +1,13 @@
1
1
  import { z } from "zod";
2
2
  import { prepareRenewalPriceReplacement, } from "../renewalPriceReplacement.js";
3
3
  import { renewalSnapshot } from "../renewalReplacementSnapshot.js";
4
- import { supportedVersion, timestamp } from "../renewalAggregate/shared.js";
4
+ import { supportedVersion, timestamp, resourceId, equal, conflict, failure, } from "../renewalAggregate/shared.js";
5
+ import { validateReadMaterial } from "../renewalAggregate/readMaterial.js";
6
+ import { configureMaterial, validateConfigureStart, } from "../renewalAggregate/configureMaterial.js";
5
7
  import { idempotencyOptions } from "../../core/idempotency.js";
6
8
  import { renewalBindingV2 } from "./binding.js";
9
+ import { captureAttachmentReceipt, assertAttachmentIdentity, } from "./receipt.js";
10
+ import { captureConfiguration } from "./configureInput.js";
7
11
  /** Pure preparation. Protect retained full records under host authorization. */
8
12
  export async function prepareRenewalPriceReplacementV2(options) {
9
13
  // Reuse the existing raw constructor's semantic checks, not a stored V1 claim.
@@ -67,4 +71,133 @@ export async function prepareRenewalScheduleAttachmentV2(options) {
67
71
  const binding = await renewalBindingV2("renewal-attach", request);
68
72
  return { ...request, requestIdentity: { key, binding } };
69
73
  }
74
+ /** Pure unsigned consistency data. Does not authenticate or acknowledge a POST. */
75
+ export async function constructRenewalScheduleAttachmentReceiptV2(options) {
76
+ const args = captureAttachmentReceipt(options);
77
+ const prepared = await prepareRenewalPriceReplacementV2({
78
+ ...args.attachRequest.preparation,
79
+ expected: args.attachRequest.preparation
80
+ .expected,
81
+ });
82
+ const request = await prepareRenewalScheduleAttachmentV2({
83
+ prepared,
84
+ apiVersion: args.attachRequest.apiVersion,
85
+ attachKey: args.attachRequest.attachKey,
86
+ firstDispatchedAt: args.attachRequest.firstDispatchedAt,
87
+ });
88
+ const { scope, apiVersion, method, path, payload, key, firstDispatchedAt } = request;
89
+ if (!equal(args.actualDispatch, {
90
+ scope,
91
+ apiVersion,
92
+ method,
93
+ path,
94
+ payload,
95
+ key,
96
+ firstDispatchedAt,
97
+ }))
98
+ throw Error("Renewal attachment dispatch does not match its complete request.");
99
+ const billingCustomer = prepared.providerSnapshot.billingCustomer;
100
+ if (!billingCustomer)
101
+ throw Error("Renewal attachment requires its retained billing Customer.");
102
+ const scheduleId = resourceId("sub_sched").parse(args.providerSnapshot.id);
103
+ assertAttachmentIdentity(args.providerSnapshot, {
104
+ scheduleId,
105
+ subscriptionId: prepared.expected.subscriptionId,
106
+ billingCustomerId: billingCustomer.id,
107
+ customerAccountId: prepared.expected.customerAccountId,
108
+ livemode: prepared.expected.livemode,
109
+ });
110
+ const receipt = {
111
+ version: 2,
112
+ stage: "attached_unconfigured",
113
+ scope: "platform",
114
+ logicalBinding: prepared.requestIdentity.binding,
115
+ request,
116
+ scheduleId,
117
+ subscriptionId: prepared.expected.subscriptionId,
118
+ customerAccountId: prepared.expected.customerAccountId,
119
+ livemode: prepared.expected.livemode,
120
+ providerSnapshot: args.providerSnapshot,
121
+ };
122
+ return {
123
+ ...receipt,
124
+ binding: await renewalBindingV2("renewal-attach-receipt", receipt),
125
+ };
126
+ }
127
+ /** Pure raw-only configuration candidate; provider qualification remains required. */
128
+ export async function projectRenewalConfigurationV2(options) {
129
+ const args = captureConfiguration(options);
130
+ let ownedScheduleId;
131
+ try {
132
+ if (!equal(args.preparation, args.attachReceipt.attachRequest.preparation))
133
+ conflict("invalid_prepared_binding");
134
+ let prepared;
135
+ try {
136
+ prepared = await prepareRenewalPriceReplacementV2({
137
+ ...args.preparation,
138
+ expected: args.preparation
139
+ .expected,
140
+ });
141
+ }
142
+ catch {
143
+ conflict("invalid_prepared_binding");
144
+ }
145
+ let receipt;
146
+ try {
147
+ receipt = await constructRenewalScheduleAttachmentReceiptV2(args.attachReceipt);
148
+ }
149
+ catch {
150
+ conflict("invalid_attach_receipt_binding");
151
+ }
152
+ if (receipt.logicalBinding !== prepared.requestIdentity.binding ||
153
+ receipt.request.logicalBinding !== prepared.requestIdentity.binding ||
154
+ receipt.request.apiVersion !== args.apiVersion ||
155
+ receipt.request.payload.from_subscription !==
156
+ prepared.expected.subscriptionId ||
157
+ receipt.subscriptionId !== prepared.expected.subscriptionId ||
158
+ receipt.customerAccountId !== prepared.expected.customerAccountId ||
159
+ receipt.livemode !== prepared.expected.livemode ||
160
+ receipt.request.firstDispatchedAt > args.observedAt)
161
+ conflict("invalid_attach_receipt_binding");
162
+ ownedScheduleId = receipt.scheduleId;
163
+ const key = validateConfigureStart(args, receipt);
164
+ const reads = validateReadMaterial(args, prepared, receipt.scheduleId);
165
+ const { schedule, payload } = configureMaterial(
166
+ // Unlike V1's record parser, retain every own key of the captured body.
167
+ z
168
+ .custom((value) => value !== null &&
169
+ typeof value === "object" &&
170
+ !Array.isArray(value))
171
+ .parse(args.schedule), prepared, receipt, reads);
172
+ const request = {
173
+ version: 2,
174
+ stage: "configure",
175
+ scope: "platform",
176
+ apiVersion: args.apiVersion,
177
+ logicalBinding: prepared.requestIdentity.binding,
178
+ scheduleId: receipt.scheduleId,
179
+ method: "POST",
180
+ path: `/v1/subscription_schedules/${receipt.scheduleId}`,
181
+ key,
182
+ payload,
183
+ firstDispatchedAt: args.firstDispatchedAt,
184
+ attachReceiptBinding: receipt.binding,
185
+ baselineBinding: await renewalBindingV2("renewal-baseline", receipt.providerSnapshot),
186
+ defaultSettingsBinding: await renewalBindingV2("renewal-defaults", schedule.default_settings),
187
+ };
188
+ return renewalSnapshot({
189
+ ...request,
190
+ status: "projected_configure_request",
191
+ providerQualification: "required",
192
+ profile: reads.profile,
193
+ requestIdentity: {
194
+ key,
195
+ binding: await renewalBindingV2("renewal-configure", request),
196
+ },
197
+ });
198
+ }
199
+ catch (error) {
200
+ return failure(error, ownedScheduleId);
201
+ }
202
+ }
70
203
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/client/billing/renewalV2/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,8BAA8B,GAG/B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAYhD,gFAAgF;AAChF,MAAM,CAAC,KAAK,UAAU,gCAAgC,CACpD,OAAgD;IAEhD,+EAA+E;IAC/E,MAAM,QAAQ,GAAG,8BAA8B,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC;IAC1E,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,eAAe,EAAE,GAAG,MAAM,EAAE,GAAG,QAAQ,CAAC;IACtE,MAAM,KAAK,GAAG,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,CAAU,EAAE,CAAC;IACjD,MAAM,OAAO,GAAG,MAAM,gBAAgB,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IACzD,OAAO;QACL,GAAG,KAAK;QACR,MAAM;QACN,YAAY;QACZ,eAAe,EAAE,EAAE,GAAG,EAAE,eAAe,CAAC,GAAG,EAAE,OAAO,EAAE;KACvD,C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sB,EAAE,MAAM,gBAAgB,CAC5C,kBAAkB,EAClB,QAAQ,CAAC,gBAAgB,CAC1B;SACF,CAAC;QACF,OAAO,eAAe,CAAC;YACrB,GAAG,OAAO;YACV,MAAM,EAAE,6BAAsC;YAC9C,qBAAqB,EAAE,UAAmB;YAC1C,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,eAAe,EAAE;gBACf,GAAG;gBACH,OAAO,EAAE,MAAM,gBAAgB,CAAC,mBAAmB,EAAE,OAAO,CAAC;aAC9D;SACF,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,OAAO,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;IACzC,CAAC;AACH,CAAC"}
@@ -0,0 +1,37 @@
1
+ import { type ObjectData } from "../renewalAggregate/shared.js";
2
+ export declare function validateAttachmentReceiptFields(raw: unknown): void;
3
+ export declare function captureAttachmentReceipt(raw: unknown): {
4
+ attachRequest: {
5
+ preparation: {
6
+ subscription: unknown;
7
+ targetPrice: unknown;
8
+ billingCustomer?: unknown;
9
+ expected: unknown;
10
+ key: string;
11
+ };
12
+ apiVersion: string;
13
+ attachKey: string;
14
+ firstDispatchedAt: number;
15
+ };
16
+ actualDispatch: {
17
+ scope: "platform";
18
+ apiVersion: string;
19
+ method: "POST";
20
+ path: "/v1/subscription_schedules";
21
+ payload: {
22
+ from_subscription: string;
23
+ };
24
+ key: string;
25
+ firstDispatchedAt: number;
26
+ };
27
+ providerSnapshot: ObjectData;
28
+ };
29
+ /** Available identity facts only, never response provenance or financial proof. */
30
+ export declare function assertAttachmentIdentity(body: ObjectData, operation: {
31
+ scheduleId: string;
32
+ subscriptionId: string;
33
+ billingCustomerId: string;
34
+ customerAccountId: string;
35
+ livemode: boolean;
36
+ }): void;
37
+ //# sourceMappingURL=receipt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"receipt.d.ts","sourceRoot":"","sources":["../../../../src/client/billing/renewalV2/receipt.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,UAAU,EAChB,MAAM,+BAA+B,CAAC;AA8DvC,wBAAgB,+BAA+B,CAAC,GAAG,EAAE,OAAO,QA2B3D;AACD,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;EAMpD;AAED,mFAAmF;AACnF,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,UAAU,EAChB,SAAS,EAAE;IACT,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,OAAO,CAAC;CACnB,QAiDF"}
@@ -0,0 +1,131 @@
1
+ import { z } from "zod";
2
+ import { renewalSnapshot } from "../renewalReplacementSnapshot.js";
3
+ import { referenceId, timestamp, } from "../renewalAggregate/shared.js";
4
+ const preparation = z
5
+ .object({
6
+ subscription: z.unknown(),
7
+ targetPrice: z.unknown(),
8
+ billingCustomer: z.unknown().optional(),
9
+ expected: z.unknown(),
10
+ key: z.string(),
11
+ })
12
+ .strict();
13
+ const attachRequest = z
14
+ .object({
15
+ preparation,
16
+ apiVersion: z.string(),
17
+ attachKey: z.string(),
18
+ firstDispatchedAt: timestamp,
19
+ })
20
+ .strict();
21
+ const dispatch = z
22
+ .object({
23
+ scope: z.literal("platform"),
24
+ apiVersion: z.string(),
25
+ method: z.literal("POST"),
26
+ path: z.literal("/v1/subscription_schedules"),
27
+ payload: z.object({ from_subscription: z.string() }).strict(),
28
+ key: z.string(),
29
+ firstDispatchedAt: timestamp,
30
+ })
31
+ .strict();
32
+ const input = z
33
+ .object({
34
+ attachRequest,
35
+ actualDispatch: dispatch,
36
+ // The bounded JSON capture already owns this plain object. A record parser
37
+ // can discard special own keys such as __proto__, changing the bound body.
38
+ providerSnapshot: z.custom((v) => v !== null && typeof v === "object" && !Array.isArray(v)),
39
+ })
40
+ .strict();
41
+ function ownData(raw, required, optional = []) {
42
+ if (!raw || typeof raw !== "object" || Array.isArray(raw))
43
+ throw Error("Invalid renewal receipt input.");
44
+ const keys = Reflect.ownKeys(raw);
45
+ if (keys.some((k) => typeof k !== "string" || ![...required, ...optional].includes(k)) ||
46
+ required.some((k) => !keys.includes(k)))
47
+ throw Error("Invalid renewal receipt fields.");
48
+ const result = {};
49
+ for (const key of keys) {
50
+ const d = Object.getOwnPropertyDescriptor(raw, key);
51
+ if (!d || !d.enumerable || !("value" in d))
52
+ throw Error("Renewal receipt requires own JSON data.");
53
+ result[key] = d.value;
54
+ }
55
+ return result;
56
+ }
57
+ export function validateAttachmentReceiptFields(raw) {
58
+ const root = ownData(raw, [
59
+ "attachRequest",
60
+ "actualDispatch",
61
+ "providerSnapshot",
62
+ ]);
63
+ const request = ownData(root.attachRequest, [
64
+ "preparation",
65
+ "apiVersion",
66
+ "attachKey",
67
+ "firstDispatchedAt",
68
+ ]);
69
+ ownData(request.preparation, ["subscription", "targetPrice", "expected", "key"], ["billingCustomer"]);
70
+ const wire = ownData(root.actualDispatch, [
71
+ "scope",
72
+ "apiVersion",
73
+ "method",
74
+ "path",
75
+ "payload",
76
+ "key",
77
+ "firstDispatchedAt",
78
+ ]);
79
+ ownData(wire.payload, ["from_subscription"]);
80
+ }
81
+ export function captureAttachmentReceipt(raw) {
82
+ validateAttachmentReceiptFields(raw);
83
+ const captured = renewalSnapshot(raw);
84
+ // Recheck the detached object: hostile reflection can mutate the live source.
85
+ validateAttachmentReceiptFields(captured);
86
+ return input.parse(captured);
87
+ }
88
+ /** Available identity facts only, never response provenance or financial proof. */
89
+ export function assertAttachmentIdentity(body, operation) {
90
+ const need = (v) => {
91
+ if (!v)
92
+ throw Error("Unverified renewal attachment identity.");
93
+ };
94
+ const context = {
95
+ customerAccountId: operation.customerAccountId,
96
+ livemode: operation.livemode,
97
+ };
98
+ const check = (value, kind, depth) => {
99
+ need(depth <= 40);
100
+ const prefix = kind === "customer"
101
+ ? "cus"
102
+ : kind === "subscription"
103
+ ? "sub"
104
+ : "sub_sched";
105
+ const expected = kind === "customer"
106
+ ? operation.billingCustomerId
107
+ : kind === "subscription"
108
+ ? operation.subscriptionId
109
+ : operation.scheduleId;
110
+ need(referenceId(value, prefix, kind, context) === expected);
111
+ if (typeof value === "string")
112
+ return;
113
+ const expanded = value;
114
+ need(expanded.deleted === undefined || expanded.deleted === false);
115
+ const owns = (key) => Object.prototype.hasOwnProperty.call(expanded, key);
116
+ if (kind !== "customer" && owns("customer"))
117
+ check(expanded.customer, "customer", depth + 1);
118
+ if (kind === "subscription" && owns("schedule"))
119
+ check(expanded.schedule, "subscription_schedule", depth + 1);
120
+ if (kind === "subscription_schedule" && owns("subscription"))
121
+ check(expanded.subscription, "subscription", depth + 1);
122
+ };
123
+ need(body.object === "subscription_schedule" &&
124
+ body.id === operation.scheduleId &&
125
+ (body.deleted === undefined || body.deleted === false) &&
126
+ body.customer_account === operation.customerAccountId &&
127
+ body.livemode === operation.livemode);
128
+ check(body.customer, "customer", 0);
129
+ check(body.subscription, "subscription", 0);
130
+ }
131
+ //# sourceMappingURL=receipt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"receipt.js","sourceRoot":"","sources":["../../../../src/client/billing/renewalV2/receipt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EACL,WAAW,EACX,SAAS,GAEV,MAAM,+BAA+B,CAAC;AAEvC,MAAM,WAAW,GAAG,CAAC;KAClB,MAAM,CAAC;IACN,YAAY,EAAE,CAAC,CAAC,OAAO,EAAE;IACzB,WAAW,EAAE,CAAC,CAAC,OAAO,EAAE;IACxB,eAAe,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACvC,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE;IACrB,GAAG,EAAE,CAAC,CAAC,MAAM,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AK,SAAS,CAAC,QAAQ,CACvC,CAAC;IACF,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;IACpC,KAAK,CAAC,IAAI,CAAC,YAAY,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC;AAC9C,CAAC"}
@@ -5,6 +5,6 @@ export type { RenewalPriceReplacementExpected } from "./billing/renewalReplaceme
5
5
  export { prepareRenewalScheduleAttachment } from "./billing/renewalAttach/request.js";
6
6
  export type { PrepareRenewalScheduleAttachmentOptions, PreparedRenewalScheduleAttachment, } from "./billing/renewalAttach/request.js";
7
7
  export type { ReadRenewalPriceReplacementContextOptions } from "./billing/renewalAttach/reader.js";
8
- export { prepareRenewalPriceReplacementV2, prepareRenewalScheduleAttachmentV2, } from "./billing/renewalV2/index.js";
9
- export type { PrepareRenewalPriceReplacementV2Options, PreparedRenewalPriceReplacementV2, PrepareRenewalScheduleAttachmentV2Options, PreparedRenewalScheduleAttachmentV2, } from "./billing/renewalV2/index.js";
8
+ export { prepareRenewalPriceReplacementV2, prepareRenewalScheduleAttachmentV2, constructRenewalScheduleAttachmentReceiptV2, projectRenewalConfigurationV2, } from "./billing/renewalV2/index.js";
9
+ export type { PrepareRenewalPriceReplacementV2Options, PreparedRenewalPriceReplacementV2, PrepareRenewalScheduleAttachmentV2Options, PreparedRenewalScheduleAttachmentV2, ConstructRenewalScheduleAttachmentReceiptV2Options, RenewalScheduleAttachmentReceiptV2, ProjectRenewalConfigurationV2Options, ProjectedRenewalConfigurationV2, RenewalConfigurationProjectionFailure, } from "./billing/renewalV2/index.js";
10
10
  //# sourceMappingURL=renewal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"renewal.d.ts","sourceRoot":"","sources":["../../src/client/renewal.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,OAAO,EAAE,8BAA8B,EAAE,MAAM,sCAAsC,CAAC;AACtF,YAAY,EACV,qCAAqC,EACrC,+BAA+B,GAChC,MAAM,sCAAsC,CAAC;AAC9C,YAAY,EAAE,+BAA+B,EAAE,MAAM,uCAAuC,CAAC;AAC7F,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AACtF,YAAY,EACV,uCAAuC,EACvC,iCAAiC,GAClC,MAAM,oCAAoC,CAAC;AAC5C,YAAY,EAAE,yCAAyC,EAAE,MAAM,mCAAmC,CAAC;AACnG,OAAO,EACL,gCAAgC,EAChC,kCAAkC,GACnC,MAAM,8BAA8B,CAAC;AACtC,YAAY,EACV,uCAAuC,EACvC,iCAAiC,EACjC,yCAAyC,EACzC,mCAAmC,GACpC,MAAM,8BAA8B,CAAC"}
1
+ {"version":3,"file":"renewal.d.ts","sourceRoot":"","sources":["../../src/client/renewal.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,OAAO,EAAE,8BAA8B,EAAE,MAAM,sCAAsC,CAAC;AACtF,YAAY,EACV,qCAAqC,EACrC,+BAA+B,GAChC,MAAM,sCAAsC,CAAC;AAC9C,YAAY,EAAE,+BAA+B,EAAE,MAAM,uCAAuC,CAAC;AAC7F,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AACtF,YAAY,EACV,uCAAuC,EACvC,iCAAiC,GAClC,MAAM,oCAAoC,CAAC;AAC5C,YAAY,EAAE,yCAAyC,EAAE,MAAM,mCAAmC,CAAC;AACnG,OAAO,EACL,gCAAgC,EAChC,kCAAkC,EAClC,2CAA2C,EAC3C,6BAA6B,GAC9B,MAAM,8BAA8B,CAAC;AACtC,YAAY,EACV,uCAAuC,EACvC,iCAAiC,EACjC,yCAAyC,EACzC,mCAAmC,EACnC,kDAAkD,EAClD,kCAAkC,EAClC,oCAAoC,EACpC,+BAA+B,EAC/B,qCAAqC,GACtC,MAAM,8BAA8B,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /** Public pure renewal preparation functions and their input/result types. */
2
2
  export { prepareRenewalPriceReplacement } from "./billing/renewalPriceReplacement.js";
3
3
  export { prepareRenewalScheduleAttachment } from "./billing/renewalAttach/request.js";
4
- export { prepareRenewalPriceReplacementV2, prepareRenewalScheduleAttachmentV2, } from "./billing/renewalV2/index.js";
4
+ export { prepareRenewalPriceReplacementV2, prepareRenewalScheduleAttachmentV2, constructRenewalScheduleAttachmentReceiptV2, projectRenewalConfigurationV2, } from "./billing/renewalV2/index.js";
5
5
  //# sourceMappingURL=renewal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"renewal.js","sourceRoot":"","sources":["../../src/client/renewal.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,OAAO,EAAE,8BAA8B,EAAE,MAAM,sCAAsC,CAAC;AAMtF,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AAMtF,OAAO,EACL,gCAAgC,EAChC,kCAAkC,GACnC,MAAM,8BAA8B,CAAC"}
1
+ {"version":3,"file":"renewal.js","sourceRoot":"","sources":["../../src/client/renewal.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,OAAO,EAAE,8BAA8B,EAAE,MAAM,sCAAsC,CAAC;AAMtF,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AAMtF,OAAO,EACL,gCAAgC,EAChC,kCAAkC,EAClC,2CAA2C,EAC3C,6BAA6B,GAC9B,MAAM,8BAA8B,CAAC"}
@@ -59,10 +59,10 @@ export declare class UsageObservationClient extends UsageDeliveryClient {
59
59
  retryable: boolean;
60
60
  };
61
61
  correctionHistory: {
62
- reason?: undefined;
63
62
  status: "available";
64
63
  observedAt: number;
65
64
  value: import("./correctionRead.js").UsageCorrectionHistoryPage;
65
+ reason?: undefined;
66
66
  retryable?: undefined;
67
67
  legacyHistoryMissing?: undefined;
68
68
  } | {
@@ -84,10 +84,10 @@ export declare class UsageObservationClient extends UsageDeliveryClient {
84
84
  retryable: boolean;
85
85
  };
86
86
  correctionHistory: {
87
- reason?: undefined;
88
87
  status: "available";
89
88
  observedAt: number;
90
89
  value: import("./correctionRead.js").UsageCorrectionHistoryPage;
90
+ reason?: undefined;
91
91
  retryable?: undefined;
92
92
  legacyHistoryMissing?: undefined;
93
93
  } | {
@@ -1 +1 @@
1
- {"version":3,"file":"observationClient.d.ts","sourceRoot":"","sources":["../../../src/client/usage/observationClient.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAG5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAI5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAE1E,OAAO,EAGL,KAAK,uBAAuB,EAC5B,KAAK,yBAAyB,EAC/B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAA4B,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE7E,MAAM,MAAM,0BAA0B,GAAG,uBAAuB,GAAG;IACjE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AACF,8EAA8E;AAC9E,qBAAa,sBAAuB,SAAQ,mBAAmB;IACvD,UAAU,CACd,GAAG,EAAE,MAAM,EACX,KAAK,EAAE;QAAE,KAAK,EAAE,UAAU,CAAC;QAAC,MAAM,EAAE,WAAW,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,GACrE,OAAO,CAAC,iBAAiB,CAAC,CAY5B;IACK,gBAAgB,CACpB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,0BAA0B,GAChC,OAAO,CAAC,yBAAyB,CAAC,CA0BpC;IACK,oBAAoB,CACxB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,uBAAuB,EAC9B,OAAO,EAAE,4BAA4B,GAC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SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,EACvD,OAAO,EAAE,4BAA4B,mHAgBtC;IACK,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,0BAA0B;;;;;YAqBhE,MAAM,EAAE,aAAa;YACrB,MAAM;YACN,SAAS;;;oBAIG,WAAW;;;;;;;;;oBAKX,aAAa;;;;;OAM9B;IACK,SAAS,CACb,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,0BAA0B,EACjC,OAAO,EAAE,4BAA4B;;;;;YArBjC,MAAM,EAAE,aAAa;YACrB,MAAM;YACN,SAAS;;;oBAIG,WAAW;;;;;;;;;oBAKX,aAAa;;;;;OAc9B;CACF"}
@@ -163,10 +163,10 @@ export declare const snapshot: import("convex/server").RegisteredQuery<"public",
163
163
  accountId: string;
164
164
  ownerKey: string;
165
165
  }, Promise<{
166
- status: "held";
167
- reason: "snapshot_limit";
168
166
  transfers?: undefined;
169
167
  claims?: undefined;
168
+ status: "held";
169
+ reason: "snapshot_limit";
170
170
  } | {
171
171
  reason?: undefined;
172
172
  status: "ready";
@@ -1 +1 @@
1
- {"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/component/payoutRelease/queries.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAIlB,CAAC;AACH,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAiBd,CAAC;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BlB,CAAC;AAEH,eAAO,MAAM,IAAI;;;;;;;GAQf,CAAC;AAEH,4FAA4F;AAC5F,eAAO,MAAM,QAAQ;;;;YAsBE,MAAM;YAAmB,gBAAgB;;;;;YAS3C,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAE1B,CAAC"}
1
+ {"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/component/payoutRelease/queries.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAIlB,CAAC;AACH,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAiBd,CAAC;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BlB,CAAC;AAEH,eAAO,MAAM,IAAI;;;;;;;GAQf,CAAC;AAEH,4FAA4F;AAC5F,eAAO,MAAM,QAAQ;;;;;;YAsBE,MAAM;YAAmB,gBAAgB;;;YAS3C,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAE1B,CAAC"}
@@ -14,7 +14,7 @@ export declare function checkRollback(ctx: MutationCtx, op: Doc<"processingCostR
14
14
  readonly bindFunding?: undefined;
15
15
  } | {
16
16
  reason?: undefined;
17
- readonly retryable?: undefined;
17
+ retryable?: undefined;
18
18
  readonly status: "ready";
19
19
  readonly bindFunding: boolean;
20
20
  }>;
@@ -179,8 +179,10 @@ from its full provider snapshot, expected selectors and retained logical key,
179
179
  and compares the entire result before constructing the request. A matching
180
180
  digest alone is insufficient. V1 preparations are rejected by this builder;
181
181
  there is no automatic migration or fallback. Existing V1 projection, receipt
182
- and configure consumers do not accept V2 records. This release adds preparation
183
- and request construction only, without a V2 writer or receipt constructor.
182
+ and configure consumers do not accept V2 records. V2 adds pure preparation,
183
+ request and attachment-receipt construction, plus
184
+ [raw configuration projection](renewal-phase-assembly.md#raw-v2-configuration-projection).
185
+ It does not add a provider writer or configured-response receipt constructor.
184
186
 
185
187
  V2 retains the same raw preparation semantic checks and bounded JSON policy as
186
188
  V1. It adds a limit of 500,000 UTF-8 bytes on each exact encoded hash preimage,
@@ -197,7 +199,11 @@ the existing ordering, including JavaScript's numeric-index enumeration;
197
199
  arrays retain their order and negative zero serializes as zero. The output is
198
200
  `family:v2:sha256:` followed by the full 64 lowercase hexadecimal digest.
199
201
  Families are selected internally: `renewal` for preparation and
200
- `renewal-attach` for the attachment request.
202
+ `renewal-attach` for the attachment request and `renewal-attach-receipt` for the
203
+ complete attachment receipt.
204
+ Configuration projection also selects `renewal-baseline`, `renewal-defaults`
205
+ and `renewal-configure` internally for its complete baseline, defaults and
206
+ unsigned request. No caller-supplied family selector is exposed.
201
207
 
202
208
  The preparation preimage contains version, platform scope, expected selectors,
203
209
  quantity and complete provider snapshot. Its logical key is separately retained
@@ -209,6 +215,70 @@ complete payload, explicit attachment key and original first-dispatch time.
209
215
  Neither digest authenticates a caller, proves provenance, acknowledges a POST
210
216
  or guarantees provider replay. Hosts retain the complete original records.
211
217
 
218
+ ### V2 attachment receipt consistency
219
+
220
+ `constructRenewalScheduleAttachmentReceiptV2` constructs unsigned receipt data
221
+ from raw preparation inputs, the complete actual dispatch and the retained
222
+ Schedule body:
223
+
224
+ ```ts
225
+ import { constructRenewalScheduleAttachmentReceiptV2 } from "@fantastic.dev/better-stripe";
226
+
227
+ const receiptV2 = await constructRenewalScheduleAttachmentReceiptV2({
228
+ attachRequest: {
229
+ preparation: {
230
+ subscription: context.subscription,
231
+ targetPrice: context.targetPrice,
232
+ billingCustomer: context.billingCustomer,
233
+ expected,
234
+ key: logicalKey,
235
+ },
236
+ apiVersion: context.apiVersion,
237
+ attachKey,
238
+ firstDispatchedAt,
239
+ },
240
+ actualDispatch: {
241
+ scope: "platform",
242
+ apiVersion: context.apiVersion,
243
+ method: "POST",
244
+ path: "/v1/subscription_schedules",
245
+ payload: { from_subscription: expected.subscriptionId },
246
+ key: attachKey,
247
+ firstDispatchedAt,
248
+ },
249
+ providerSnapshot: retainedScheduleBody,
250
+ });
251
+ ```
252
+
253
+ Supply the original raw preparation and dispatch facts from protected host
254
+ storage. The constructor rebuilds C1 and C2 itself. It accepts neither a prepared
255
+ record in place of raw preparation nor caller-supplied verification flags. All
256
+ seven dispatch fields must equal the rebuilt request, including its complete
257
+ payload, explicit key and original first-dispatch time. A retained billing
258
+ Customer is required.
259
+
260
+ The Schedule must match the expected subscription, Customer, customer account
261
+ and mode. Available expanded identity relations must agree, including their
262
+ declared Customer, subscription and Schedule references. Deleted identities
263
+ reject. The complete Schedule body, including unknown JSON fields, remains in
264
+ the receipt and its `renewal-attach-receipt` binding. The receipt also binds its
265
+ entire rebuilt attachment request and logical binding. Its version is `2` and
266
+ stage is `attached_unconfigured`.
267
+
268
+ The constructor captures all raw inputs before its first await. Closed input
269
+ objects require own data properties and reject unexpected names; the captured
270
+ copy is checked again before hashing. Raw provider records retain the existing
271
+ bounded JSON policy. Each digest preimage, including its domain tuple and all
272
+ nested records, remains limited to 500,000 UTF-8 bytes.
273
+
274
+ This pure function performs no HTTP request or storage operation. Matching data
275
+ does not authenticate a response, prove that a POST succeeded, establish
276
+ ownership, qualify a provider profile or authorize configuration. A coherent
277
+ unsigned forgery can pass. No transport status or observation time is invented.
278
+ Hosts must separately establish acknowledgement provenance and preserve the
279
+ original records. Existing V1 configure and receipt consumers still reject V2;
280
+ there is no migration, writer or V2 configure executor.
281
+
212
282
  These helpers retain ordinary provider and caller metadata within their JSON
213
283
  limits. They do not redact, encrypt or certify that input or output is safe to
214
284
  log. Do not place secrets in metadata, and protect retained full records.
@@ -6,6 +6,84 @@ not a public package entrypoint. It complements the public
6
6
  [preparation contract](renewal-price-replacements.md) and internal
7
7
  [preservation mappings](renewal-preservation-mappings.md).
8
8
 
9
+ This aggregate consumes V1 records. The public
10
+ [V2 attachment receipt constructor](renewal-context-reads.md#v2-attachment-receipt-consistency)
11
+ produces separate unsigned consistency data; it does not migrate records or
12
+ enable this projector to accept V2 receipts.
13
+
14
+ ## Raw V2 configuration projection
15
+
16
+ `projectRenewalConfigurationV2` is a public async constructor. It shares the
17
+ complete material checks and phase assembly below with the V1 aggregate, while
18
+ constructing compact V2 bindings directly:
19
+
20
+ ```ts
21
+ import { projectRenewalConfigurationV2 } from "@fantastic.dev/better-stripe";
22
+
23
+ const candidate = await projectRenewalConfigurationV2({
24
+ preparation: originalPreparationInputs,
25
+ attachReceipt: {
26
+ attachRequest: {
27
+ preparation: originalPreparationInputs,
28
+ apiVersion,
29
+ attachKey,
30
+ firstDispatchedAt: attachFirstDispatchedAt,
31
+ },
32
+ actualDispatch: retainedAttachDispatch,
33
+ providerSnapshot: retainedAttachScheduleBody,
34
+ },
35
+ freshSubscription,
36
+ targetPrice,
37
+ billingCustomer,
38
+ schedule: freshSchedule,
39
+ apiVersion,
40
+ observedAt,
41
+ firstDispatchedAt: configureFirstDispatchedAt,
42
+ configureKey,
43
+ });
44
+ ```
45
+
46
+ `preparation` contains the original raw Subscription, target Price, billing
47
+ Customer, expected selectors and logical key. `attachReceipt` contains the raw
48
+ inputs to the [C3 constructor](renewal-context-reads.md#v2-attachment-receipt-consistency),
49
+ including all seven actual attachment dispatch fields. It is not a previously
50
+ computed receipt. Both complete preparation inputs must agree. The function
51
+ rebuilds C1 and C3 internally instead of accepting a derived handle, verification
52
+ flag or converted V1 record.
53
+
54
+ All inputs are captured before the first await. Closed constructor inputs
55
+ require own data properties, reject unexpected names and are checked again on
56
+ the detached copy. Provider records retain the existing bounded JSON policy;
57
+ optional fields are not replaced with null or invented defaults. The same
58
+ original-source, profile, Discount, payment, tax, settings, identity, period,
59
+ full-baseline and default-preservation checks apply. Actual subscription
60
+ association is required; the constructor does not replace it with null to pass
61
+ the original preparation checks.
62
+
63
+ Success is `projected_configure_request`, with version `2`, the complete
64
+ normalized two-phase payload and `providerQualification: "required"`. C4
65
+ (`renewal-baseline`) binds the entire original Schedule body. C5
66
+ (`renewal-defaults`) binds the exact validated default settings. C6
67
+ (`renewal-configure`) binds the complete unsigned request, including the rebuilt
68
+ C1/C3 identities, key, API version, POST path, payload and original configure
69
+ first-dispatch time. Each uses the same fixed V2 domain encoding and 500,000-byte
70
+ UTF-8 preimage limit. No nested V1 claim is constructed or rewritten to obtain
71
+ these bindings.
72
+
73
+ Semantic failures retain the existing `unsupported`, `conflict` and
74
+ `attached_unconfigured` data shapes and reasons. Once the rebuilt attachment's
75
+ identity and time joins are accepted, an unsupported projection includes its
76
+ Schedule ID. This is a consistency classification, not authenticated ownership.
77
+ Malformed constructor inputs or JSON capture errors reject the promise; handle
78
+ those separately from returned projection failures.
79
+
80
+ The function performs no provider call or storage operation. It does not produce
81
+ a configured-response receipt, execute the configure request, establish provider
82
+ qualification, prove acknowledgement provenance or certify renewal
83
+ effectiveness. Protect original records and enforce host authorization and all
84
+ provider qualification gates before dispatch. Existing V1 APIs and record
85
+ formats are unchanged.
86
+
9
87
  A candidate always has `providerQualification: "required"`. This describes a
10
88
  remaining requirement, not authorization to dispatch. Host-supplied flags cannot
11
89
  prove provider behavior, ownership, original configuration or historical intent.