@fantastic.dev/better-stripe 0.100.0 → 0.102.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 (119) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -1
  3. package/dist/client/billing/renewalAttach/internal/producer/classOwnedActionRoot.d.ts +2 -0
  4. package/dist/client/billing/renewalAttach/internal/producer/classOwnedActionRoot.d.ts.map +1 -1
  5. package/dist/client/billing/renewalAttach/internal/producer/classOwnedActionRoot.js +16 -0
  6. package/dist/client/billing/renewalAttach/internal/producer/classOwnedActionRoot.js.map +1 -1
  7. package/dist/client/billing/renewalAttach/internal/producer/configureAdmission.d.ts +7 -0
  8. package/dist/client/billing/renewalAttach/internal/producer/configureAdmission.d.ts.map +1 -0
  9. package/dist/client/billing/renewalAttach/internal/producer/configureAdmission.js +117 -0
  10. package/dist/client/billing/renewalAttach/internal/producer/configureAdmission.js.map +1 -0
  11. package/dist/client/billing/renewalAttach/internal/producer/configureJournalData.d.ts +53 -0
  12. package/dist/client/billing/renewalAttach/internal/producer/configureJournalData.d.ts.map +1 -0
  13. package/dist/client/billing/renewalAttach/internal/producer/configureJournalData.js +198 -0
  14. package/dist/client/billing/renewalAttach/internal/producer/configureJournalData.js.map +1 -0
  15. package/dist/client/billing/renewalAttach/internal/producer/configureLineage.d.ts +959 -0
  16. package/dist/client/billing/renewalAttach/internal/producer/configureLineage.d.ts.map +1 -0
  17. package/dist/client/billing/renewalAttach/internal/producer/configureLineage.js +115 -0
  18. package/dist/client/billing/renewalAttach/internal/producer/configureLineage.js.map +1 -0
  19. package/dist/client/billing/renewalAttach/internal/producer/invocationProducer.d.ts +2 -0
  20. package/dist/client/billing/renewalAttach/internal/producer/invocationProducer.d.ts.map +1 -1
  21. package/dist/client/billing/renewalAttach/internal/producer/invocationProducer.js +4 -0
  22. package/dist/client/billing/renewalAttach/internal/producer/invocationProducer.js.map +1 -1
  23. package/dist/client/billing/renewalAttach/internal/producer/lineageAuthority.d.ts +1 -0
  24. package/dist/client/billing/renewalAttach/internal/producer/lineageAuthority.d.ts.map +1 -1
  25. package/dist/client/billing/renewalAttach/internal/producer/lineageAuthority.js +1 -0
  26. package/dist/client/billing/renewalAttach/internal/producer/lineageAuthority.js.map +1 -1
  27. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +18 -18
  28. package/dist/client/connect/payoutExecutionTestHelpers.d.ts +9 -9
  29. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +50 -50
  30. package/dist/client/connect/payoutSyncTestHelpers.d.ts +25 -25
  31. package/dist/component/balanceFunding/mutations.d.ts +27 -27
  32. package/dist/component/balanceFunding/queries.d.ts +1 -1
  33. package/dist/component/balanceFunding/stateHandlers.d.ts +8 -8
  34. package/dist/component/earnings/triggers.d.ts +22 -22
  35. package/dist/component/payoutRelease/queries.d.ts +2 -2
  36. package/dist/component/payoutRelease/queries.d.ts.map +1 -1
  37. package/dist/component/processingCostReconciliation/rollback.d.ts +1 -1
  38. package/dist/component/renewalOperations/attachValidation.d.ts +19 -0
  39. package/dist/component/renewalOperations/attachValidation.d.ts.map +1 -0
  40. package/dist/component/renewalOperations/attachValidation.js +167 -0
  41. package/dist/component/renewalOperations/attachValidation.js.map +1 -0
  42. package/dist/component/renewalOperations/configureAcknowledgement.d.ts +13 -0
  43. package/dist/component/renewalOperations/configureAcknowledgement.d.ts.map +1 -0
  44. package/dist/component/renewalOperations/configureAcknowledgement.js +108 -0
  45. package/dist/component/renewalOperations/configureAcknowledgement.js.map +1 -0
  46. package/dist/component/renewalOperations/configureParent.d.ts +10 -0
  47. package/dist/component/renewalOperations/configureParent.d.ts.map +1 -0
  48. package/dist/component/renewalOperations/configureParent.js +62 -0
  49. package/dist/component/renewalOperations/configureParent.js.map +1 -0
  50. package/dist/component/renewalOperations/configureValidation.d.ts +12 -0
  51. package/dist/component/renewalOperations/configureValidation.d.ts.map +1 -0
  52. package/dist/component/renewalOperations/configureValidation.js +64 -0
  53. package/dist/component/renewalOperations/configureValidation.js.map +1 -0
  54. package/dist/component/renewalOperations/helpers.d.ts +16 -21
  55. package/dist/component/renewalOperations/helpers.d.ts.map +1 -1
  56. package/dist/component/renewalOperations/helpers.js +13 -169
  57. package/dist/component/renewalOperations/helpers.js.map +1 -1
  58. package/dist/component/renewalOperations/mutations.d.ts +6 -6
  59. package/dist/component/renewalOperations/mutations.d.ts.map +1 -1
  60. package/dist/component/renewalOperations/mutations.js +14 -7
  61. package/dist/component/renewalOperations/mutations.js.map +1 -1
  62. package/dist/component/renewalOperations/operationContext.d.ts +12 -0
  63. package/dist/component/renewalOperations/operationContext.d.ts.map +1 -0
  64. package/dist/component/renewalOperations/operationContext.js +14 -0
  65. package/dist/component/renewalOperations/operationContext.js.map +1 -0
  66. package/dist/component/renewalOperations/queries.d.ts +4 -4
  67. package/dist/component/renewalOperations/queries.js +2 -1
  68. package/dist/component/renewalOperations/queries.js.map +1 -1
  69. package/dist/component/renewalOperations/schema.d.ts +59 -59
  70. package/dist/component/renewalOperations/schema.js +3 -3
  71. package/dist/component/renewalOperations/schema.js.map +1 -1
  72. package/dist/component/renewalOperations/stageAcknowledgement.d.ts +15 -0
  73. package/dist/component/renewalOperations/stageAcknowledgement.d.ts.map +1 -0
  74. package/dist/component/renewalOperations/stageAcknowledgement.js +20 -0
  75. package/dist/component/renewalOperations/stageAcknowledgement.js.map +1 -0
  76. package/dist/component/renewalOperations/validationTypes.d.ts +9 -0
  77. package/dist/component/renewalOperations/validationTypes.d.ts.map +1 -0
  78. package/dist/component/renewalOperations/validationTypes.js +2 -0
  79. package/dist/component/renewalOperations/validationTypes.js.map +1 -0
  80. package/dist/component/schema.d.ts +9 -9
  81. package/dist/component/usage/allowance.fixtures.d.ts +25 -25
  82. package/dist/component/usageCredits/accounting.fixtures.d.ts +9 -9
  83. package/dist/shared/renewalOperationJournal.d.ts +1 -1
  84. package/dist/shared/renewalOperationJournal.d.ts.map +1 -1
  85. package/dist/shared/renewalOperationJournal.js +41 -9
  86. package/dist/shared/renewalOperationJournal.js.map +1 -1
  87. package/docs/renewal-context-reads.md +81 -11
  88. package/package.json +1 -1
  89. package/src/client/billing/renewalAttach/internal/producer/classOwnedActionRoot.ts +21 -0
  90. package/src/client/billing/renewalAttach/internal/producer/configureAdmission.ts +179 -0
  91. package/src/client/billing/renewalAttach/internal/producer/configureJournalData.ts +248 -0
  92. package/src/client/billing/renewalAttach/internal/producer/configureLineage.ts +166 -0
  93. package/src/client/billing/renewalAttach/internal/producer/invocationProducer.ts +13 -0
  94. package/src/client/billing/renewalAttach/internal/producer/lineageAuthority.ts +2 -0
  95. package/src/client/billing/renewalAttach/internal/producer/producerConfigureAdmission.integration.test.ts +203 -0
  96. package/src/client/billing/renewalAttach/internal/producer/producerConfigureControls.integration.test.ts +566 -0
  97. package/src/client/billing/renewalAttach/internal/test-fixtures/producerConfigureAdmission.ts +316 -0
  98. package/src/client/billing/renewalAttach/internal/test-fixtures/producerInitialOperation.ts +61 -3
  99. package/src/component/renewalOperations/attachValidation.ts +203 -0
  100. package/src/component/renewalOperations/configureAcknowledgement.test.ts +30 -0
  101. package/src/component/renewalOperations/configureAcknowledgement.ts +182 -0
  102. package/src/component/renewalOperations/configureAcknowledgementControls.test.ts +96 -0
  103. package/src/component/renewalOperations/configureBasis.test.ts +77 -0
  104. package/src/component/renewalOperations/configureCreation.test.ts +75 -0
  105. package/src/component/renewalOperations/configureJournal.fixtures.ts +385 -0
  106. package/src/component/renewalOperations/configureParent.ts +71 -0
  107. package/src/component/renewalOperations/configurePolicy.test.ts +105 -0
  108. package/src/component/renewalOperations/configurePublication.test.ts +85 -0
  109. package/src/component/renewalOperations/configureReceiptBounds.test.ts +39 -0
  110. package/src/component/renewalOperations/configureSourceControls.test.ts +65 -0
  111. package/src/component/renewalOperations/configureValidation.ts +70 -0
  112. package/src/component/renewalOperations/helpers.ts +21 -204
  113. package/src/component/renewalOperations/mutations.ts +16 -7
  114. package/src/component/renewalOperations/operationContext.ts +21 -0
  115. package/src/component/renewalOperations/queries.ts +1 -1
  116. package/src/component/renewalOperations/schema.ts +3 -3
  117. package/src/component/renewalOperations/stageAcknowledgement.ts +45 -0
  118. package/src/component/renewalOperations/validationTypes.ts +9 -0
  119. package/src/shared/renewalOperationJournal.ts +49 -8
@@ -163,10 +163,10 @@ export declare const snapshot: import("convex/server").RegisteredQuery<"public",
163
163
  accountId: string;
164
164
  ownerKey: string;
165
165
  }, Promise<{
166
- transfers?: undefined;
167
- claims?: undefined;
168
166
  status: "held";
169
167
  reason: "snapshot_limit";
168
+ transfers?: undefined;
169
+ claims?: undefined;
170
170
  } | {
171
171
  reason?: undefined;
172
172
  status: "ready";
@@ -1 +1 @@
1
- {"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/component/payoutRelease/queries.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAIlB,CAAC;AACH,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAiBd,CAAC;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BlB,CAAC;AAEH,eAAO,MAAM,IAAI;;;;;;;GAQf,CAAC;AAEH,4FAA4F;AAC5F,eAAO,MAAM,QAAQ;;;;;;YAsBE,MAAM;YAAmB,gBAAgB;;;YAS3C,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAE1B,CAAC"}
1
+ {"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/component/payoutRelease/queries.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAIlB,CAAC;AACH,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAiBd,CAAC;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BlB,CAAC;AAEH,eAAO,MAAM,IAAI;;;;;;;GAQf,CAAC;AAEH,4FAA4F;AAC5F,eAAO,MAAM,QAAQ;;;;YAsBE,MAAM;YAAmB,gBAAgB;;;;;YAS3C,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAE1B,CAAC"}
@@ -14,7 +14,7 @@ export declare function checkRollback(ctx: MutationCtx, op: Doc<"processingCostR
14
14
  readonly bindFunding?: undefined;
15
15
  } | {
16
16
  reason?: undefined;
17
- retryable?: undefined;
17
+ readonly retryable?: undefined;
18
18
  readonly status: "ready";
19
19
  readonly bindFunding: boolean;
20
20
  }>;
@@ -0,0 +1,19 @@
1
+ import { constructRenewalScheduleAttachmentReceiptV2 } from "../../client/billing/renewalV2/index.js";
2
+ import type { canonicalJournalRecord } from "../../shared/renewalOperationJournal.js";
3
+ import type { Reservation, CheckedEvents } from "./validationTypes.js";
4
+ export declare function acknowledgementConflict(): never;
5
+ export declare function jsonObject(value: unknown): Record<string, unknown>;
6
+ export declare function sameJSON(left: unknown, right: unknown): boolean;
7
+ type AttachReceipt = Awaited<ReturnType<typeof constructRenewalScheduleAttachmentReceiptV2>>;
8
+ /** Parsed JSON DATA admission only; no caller-object or provider provenance. */
9
+ export declare function admitAttachReceiptOutputDATA(receiptJSON: string, rebuilt: AttachReceipt): string;
10
+ /** Full stored-source/event/C3 consistency; these are unsigned DATA checks. */
11
+ export declare function validateAttachAcknowledgement(full: ReturnType<typeof canonicalJournalRecord>, reservation: Reservation, events: CheckedEvents, receiptJSON: string): Promise<{
12
+ receiptJSON: string;
13
+ receiptBinding: string;
14
+ receipt: import("../../client/renewal.js").RenewalScheduleAttachmentReceiptV2;
15
+ }>;
16
+ /** Whole typed C10 DATA and full request/receipt equality, never ACK authority. */
17
+ export declare function validateAttachReceiptEventDATA(raw: string, receipt: AttachReceipt): void;
18
+ export {};
19
+ //# sourceMappingURL=attachValidation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attachValidation.d.ts","sourceRoot":"","sources":["../../../src/component/renewalOperations/attachValidation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,2CAA2C,EAAE,MAAM,yCAAyC,CAAC;AAStG,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACtF,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAEvE,wBAAgB,uBAAuB,IAAI,KAAK,CAE/C;AAID,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,2BAGxC;AACD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,WAKrD;AACD,KAAK,aAAa,GAAG,OAAO,CAC1B,UAAU,CAAC,OAAO,2CAA2C,CAAC,CAC/D,CAAC;AAEF,gFAAgF;AAChF,wBAAgB,4BAA4B,CAC1C,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,aAAa,UAmEvB;AAED,+EAA+E;AAC/E,wBAAsB,6BAA6B,CACjD,IAAI,EAAE,UAAU,CAAC,OAAO,sBAAsB,CAAC,EAC/C,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,aAAa,EACrB,WAAW,EAAE,MAAM;;;;GA0EpB;AAED,mFAAmF;AACnF,wBAAgB,8BAA8B,CAC5C,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,aAAa,QAavB"}
@@ -0,0 +1,167 @@
1
+ import { renewalSnapshot } from "../../client/billing/renewalReplacementSnapshot.js";
2
+ import { constructRenewalScheduleAttachmentReceiptV2 } from "../../client/billing/renewalV2/index.js";
3
+ import { captureAttachmentReceipt } from "../../client/billing/renewalV2/receipt.js";
4
+ import { captureAttachSource, captureAttachDispatch, captureAttachResponse, captureAttachReceipt, } from "../../client/billing/renewalAttach/internal/c10/eventCapture.js";
5
+ import { requiredJSONSnapshot } from "../../client/billing/renewalAttach/internal/material/requiredJson.js";
6
+ export function acknowledgementConflict() {
7
+ throw Error("RENEWAL_JOURNAL_CONFLICT");
8
+ }
9
+ function isJSONObject(value) {
10
+ return value !== null && typeof value === "object" && !Array.isArray(value);
11
+ }
12
+ export function jsonObject(value) {
13
+ if (!isJSONObject(value))
14
+ acknowledgementConflict();
15
+ return value;
16
+ }
17
+ export function sameJSON(left, right) {
18
+ return (JSON.stringify(renewalSnapshot(left)) ===
19
+ JSON.stringify(renewalSnapshot(right)));
20
+ }
21
+ /** Parsed JSON DATA admission only; no caller-object or provider provenance. */
22
+ export function admitAttachReceiptOutputDATA(receiptJSON, rebuilt) {
23
+ if (typeof receiptJSON !== "string" ||
24
+ receiptJSON.length > 500000 ||
25
+ new TextEncoder().encode(receiptJSON).length > 500000)
26
+ acknowledgementConflict();
27
+ const parsed = JSON.parse(receiptJSON);
28
+ if (!sameJSON(parsed, rebuilt))
29
+ acknowledgementConflict();
30
+ const output = renewalSnapshot({
31
+ status: "attach_acknowledged",
32
+ operationalAuthority: false,
33
+ receipt: parsed,
34
+ });
35
+ const slots = new Map([
36
+ [
37
+ JSON.stringify(["receipt", "logicalBinding"]),
38
+ { expected: rebuilt.logicalBinding, family: "renewal" },
39
+ ],
40
+ [
41
+ JSON.stringify(["receipt", "request", "logicalBinding"]),
42
+ { expected: rebuilt.request.logicalBinding, family: "renewal" },
43
+ ],
44
+ [
45
+ JSON.stringify(["receipt", "request", "requestIdentity", "binding"]),
46
+ {
47
+ expected: rebuilt.request.requestIdentity.binding,
48
+ family: "renewal-attach",
49
+ },
50
+ ],
51
+ [
52
+ JSON.stringify(["receipt", "binding"]),
53
+ { expected: rebuilt.binding, family: "renewal-attach-receipt" },
54
+ ],
55
+ ]);
56
+ const found = new Set();
57
+ function walk(value, path) {
58
+ const key = JSON.stringify(path);
59
+ const slot = slots.get(key);
60
+ if (slot) {
61
+ if (value !== slot.expected ||
62
+ typeof value !== "string" ||
63
+ !new RegExp("^" + slot.family + ":v2:sha256:[0-9a-f]{64}$").test(value))
64
+ acknowledgementConflict();
65
+ found.add(key);
66
+ return;
67
+ }
68
+ if (value === null || typeof value !== "object") {
69
+ requiredJSONSnapshot(value);
70
+ return;
71
+ }
72
+ for (const [name, child] of Object.entries(value)) {
73
+ requiredJSONSnapshot(name);
74
+ requiredJSONSnapshot({ [name]: child === null ? null : true });
75
+ walk(child, [...path, name]);
76
+ }
77
+ }
78
+ walk(output, []);
79
+ if (found.size !== 4 ||
80
+ new TextEncoder().encode(JSON.stringify(output)).length > 500000)
81
+ acknowledgementConflict();
82
+ return JSON.stringify(output.receipt);
83
+ }
84
+ /** Full stored-source/event/C3 consistency; these are unsigned DATA checks. */
85
+ export async function validateAttachAcknowledgement(full, reservation, events, receiptJSON) {
86
+ if (reservation.stage !== "attach" ||
87
+ (events.length !== 2 && events.length !== 3) ||
88
+ events[0].sequence !== 1 ||
89
+ events[1].sequence !== 2)
90
+ acknowledgementConflict();
91
+ const parsedOriginal = JSON.parse(full.json);
92
+ const original = jsonObject(parsedOriginal);
93
+ const account = jsonObject(original.account);
94
+ const source = captureAttachSource(original.attachRequest);
95
+ if (!sameJSON(original.attachRequest, source))
96
+ acknowledgementConflict();
97
+ const parsedDispatch = JSON.parse(events[0].dataJSON);
98
+ const parsedResponse = JSON.parse(events[1].dataJSON);
99
+ captureAttachDispatch(parsedDispatch);
100
+ captureAttachResponse(parsedResponse);
101
+ const dispatch = jsonObject(parsedDispatch);
102
+ const response = jsonObject(parsedResponse);
103
+ const raw = captureAttachmentReceipt({
104
+ attachRequest: source,
105
+ actualDispatch: original.dispatch,
106
+ providerSnapshot: response.body,
107
+ });
108
+ // C3 internally rebuilds C1/C2 and compares the entire closed seven-wire input.
109
+ const rebuilt = await constructRenewalScheduleAttachmentReceiptV2({
110
+ attachRequest: source,
111
+ actualDispatch: raw.actualDispatch,
112
+ providerSnapshot: raw.providerSnapshot,
113
+ });
114
+ const request = rebuilt.request;
115
+ const seven = {
116
+ scope: request.scope,
117
+ apiVersion: request.apiVersion,
118
+ method: request.method,
119
+ path: request.path,
120
+ payload: request.payload,
121
+ key: request.key,
122
+ firstDispatchedAt: request.firstDispatchedAt,
123
+ };
124
+ if (!sameJSON(original.dispatch, seven) ||
125
+ !sameJSON(dispatch.request, request) ||
126
+ !sameJSON(response.request, request) ||
127
+ original.stage !== "attach" ||
128
+ original.apiVersion !== request.apiVersion ||
129
+ full.requestBinding !== request.requestIdentity.binding ||
130
+ reservation.key !== request.key ||
131
+ reservation.apiVersion !== request.apiVersion ||
132
+ reservation.firstDispatchedAt !== request.firstDispatchedAt ||
133
+ account.mode !== "platform" ||
134
+ account.stripeAccount !== null ||
135
+ account.livemode !== rebuilt.livemode ||
136
+ !sameJSON(JSON.parse(reservation.accountJSON), account))
137
+ acknowledgementConflict();
138
+ if ("recordVersion" in reservation) {
139
+ if (!sameJSON(JSON.parse(reservation.timingPolicyJSON), original.timingPolicy))
140
+ acknowledgementConflict();
141
+ }
142
+ else if (!sameJSON(JSON.parse(reservation.basisJSON), original.basis))
143
+ acknowledgementConflict();
144
+ const admittedJSON = admitAttachReceiptOutputDATA(receiptJSON, rebuilt);
145
+ // Only ACTUAL published event3 is checked. A head2 retention does not model
146
+ // or require a prospective receipt-event envelope to pass another cap.
147
+ if (events.length === 3)
148
+ validateAttachReceiptEventDATA(events[2].dataJSON, rebuilt);
149
+ return {
150
+ receiptJSON: admittedJSON,
151
+ receiptBinding: rebuilt.binding,
152
+ receipt: rebuilt,
153
+ };
154
+ }
155
+ /** Whole typed C10 DATA and full request/receipt equality, never ACK authority. */
156
+ export function validateAttachReceiptEventDATA(raw, receipt) {
157
+ const parsed = JSON.parse(raw);
158
+ captureAttachReceipt(parsed);
159
+ if (!sameJSON(parsed, {
160
+ event: "receipt",
161
+ stage: "attach",
162
+ request: receipt.request,
163
+ receipt,
164
+ }))
165
+ acknowledgementConflict();
166
+ }
167
+ //# sourceMappingURL=attachValidation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attachValidation.js","sourceRoot":"","sources":["../../../src/component/renewalOperations/attachValidation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oDAAoD,CAAC;AACrF,OAAO,EAAE,2CAA2C,EAAE,MAAM,yCAAyC,CAAC;AACtG,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AACrF,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,iEAAiE,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sEAAsE,CAAC;AAI5G,MAAM,UAAU,uBAAuB;IACrC,MAAM,KAAK,CAAC,0BAA0B,CAAC,CAAC;AAC1C,CAAC;AACD,SAAS,YAAY,CAAC,KAAc;IAClC,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AACD,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC;QAAE,uBAAuB,EAAE,CAAC;IACpD,OAAO,KAAK,CAAC;AACf,CAAC;AACD,MAAM,UAAU,QAAQ,CAAC,IAAa,EAAE,KAAc;IACpD,OAAO,CACL,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QACrC,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CACvC,CAAC;AACJ,CAAC;AAKD,gFAAgF;AAChF,MAAM,UAAU,4BAA4B,CAC1C,WAAmB,EACnB,OAAsB;IAEtB,IACE,OAAO,WAAW,KAAK,QAAQ;QAC/B,WAAW,CAAC,MAAM,GAAG,MAAM;QAC3B,IAAI,WAAW,EAAE,CA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C,KAAK,CAAC,WAAW,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;QAEvD,uBAAuB,EAAE,CAAC;IAC5B,IAAI,eAAe,IAAI,WAAW,EAAE,CAAC;QACnC,IACE,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC;YAE1E,uBAAuB,EAAE,CAAC;IAC9B,CAAC;SAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC;QACrE,uBAAuB,EAAE,CAAC;IAC5B,MAAM,YAAY,GAAG,4BAA4B,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IACxE,4EAA4E;IAC5E,uEAAuE;IACvE,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QACrB,8BAA8B,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC9D,OAAO;QACL,WAAW,EAAE,YAAY;QACzB,cAAc,EAAE,OAAO,CAAC,OAAO;QAC/B,OAAO,EAAE,OAAO;KACjB,CAAC;AACJ,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,8BAA8B,CAC5C,GAAW,EACX,OAAsB;IAEtB,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACxC,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAC7B,IACE,CAAC,QAAQ,CAAC,MAAM,EAAE;QAChB,KAAK,EAAE,SAAS;QAChB,KAAK,EAAE,QAAQ;QACf,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,OAAO;KACR,CAAC;QAEF,uBAAuB,EAAE,CAAC;AAC9B,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { constructRenewalConfigurationReceiptV2 } from "../../client/billing/renewalV2/index.js";
2
+ import type { canonicalJournalRecord } from "../../shared/renewalOperationJournal.js";
3
+ import type { Reservation, CheckedEvents } from "./validationTypes.js";
4
+ type Receipt = Awaited<ReturnType<typeof constructRenewalConfigurationReceiptV2>>;
5
+ /** Complete C9 DATA against checked C3/C6/C7 source and actual stored events. */
6
+ export declare function validateConfigureAcknowledgement(full: ReturnType<typeof canonicalJournalRecord>, reservation: Reservation, events: CheckedEvents, receiptJSON: string): Promise<{
7
+ receiptJSON: string;
8
+ receiptBinding: string;
9
+ receipt: import("../../client/renewal.js").RenewalConfigurationReceiptV2;
10
+ }>;
11
+ export declare function validateConfigureReceiptEventDATA(raw: string, receipt: Receipt): void;
12
+ export {};
13
+ //# sourceMappingURL=configureAcknowledgement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configureAcknowledgement.d.ts","sourceRoot":"","sources":["../../../src/component/renewalOperations/configureAcknowledgement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sCAAsC,EAAE,MAAM,yCAAyC,CAAC;AASjG,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACtF,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAOvE,KAAK,OAAO,GAAG,OAAO,CACpB,UAAU,CAAC,OAAO,sCAAsC,CAAC,CAC1D,CAAC;AAyFF,iFAAiF;AACjF,wBAAsB,gCAAgC,CACpD,IAAI,EAAE,UAAU,CAAC,OAAO,sBAAsB,CAAC,EAC/C,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,aAAa,EACrB,WAAW,EAAE,MAAM;;;;GAoDpB;AACD,wBAAgB,iCAAiC,CAC/C,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,OAAO,QAajB"}
@@ -0,0 +1,108 @@
1
+ import { constructRenewalConfigurationReceiptV2 } from "../../client/billing/renewalV2/index.js";
2
+ import { captureConfigureDispatch, captureConfigureResponse, captureConfigureReceipt, } from "../../client/billing/renewalAttach/internal/c10/eventCapture.js";
3
+ import { requiredJSONSnapshot } from "../../client/billing/renewalAttach/internal/material/requiredJson.js";
4
+ import { renewalSnapshot } from "../../client/billing/renewalReplacementSnapshot.js";
5
+ import { equal } from "../../client/billing/renewalAggregate/shared.js";
6
+ import { validateOperationalConfigureSource, configureConflict, jsonObject, } from "./configureValidation.js";
7
+ function admitReceipt(receiptJSON, rebuilt) {
8
+ if (receiptJSON.length > 500000 ||
9
+ new TextEncoder().encode(receiptJSON).length > 500000)
10
+ configureConflict();
11
+ const parsed = JSON.parse(receiptJSON);
12
+ if (!equal(parsed, rebuilt))
13
+ configureConflict();
14
+ const output = renewalSnapshot({
15
+ status: "configure_acknowledged",
16
+ operationalAuthority: false,
17
+ receipt: parsed,
18
+ });
19
+ const slots = new Map();
20
+ const add = (path, expected, family) => slots.set(JSON.stringify(["receipt", ...path]), { expected, family });
21
+ add(["logicalBinding"], rebuilt.logicalBinding, "renewal");
22
+ add(["attachReceiptBinding"], rebuilt.attachReceiptBinding, "renewal-attach-receipt");
23
+ add(["providerSnapshotBinding"], rebuilt.providerSnapshotBinding, "renewal-configured-baseline");
24
+ add(["binding"], rebuilt.binding, "renewal-configure-receipt");
25
+ if (rebuilt.defaultSettingsBinding !== undefined)
26
+ add(["defaultSettingsBinding"], rebuilt.defaultSettingsBinding, "renewal-configured-defaults");
27
+ add(["request", "logicalBinding"], rebuilt.request.logicalBinding, "renewal");
28
+ add(["request", "attachReceiptBinding"], rebuilt.request.attachReceiptBinding, "renewal-attach-receipt");
29
+ add(["request", "baselineBinding"], rebuilt.request.baselineBinding, "renewal-baseline");
30
+ add(["request", "defaultSettingsBinding"], rebuilt.request.defaultSettingsBinding, "renewal-defaults");
31
+ add(["request", "requestIdentity", "binding"], rebuilt.request.requestIdentity.binding, "renewal-configure");
32
+ const found = new Set();
33
+ function walk(value, path) {
34
+ const key = JSON.stringify(path), slot = slots.get(key);
35
+ if (slot) {
36
+ if (value !== slot.expected ||
37
+ typeof value !== "string" ||
38
+ !new RegExp("^" + slot.family + ":v2:sha256:[0-9a-f]{64}$").test(value))
39
+ configureConflict();
40
+ found.add(key);
41
+ return;
42
+ }
43
+ if (value === null || typeof value !== "object") {
44
+ requiredJSONSnapshot(value);
45
+ return;
46
+ }
47
+ for (const [name, child] of Object.entries(value)) {
48
+ requiredJSONSnapshot(name);
49
+ requiredJSONSnapshot({ [name]: child === null ? null : true });
50
+ walk(child, [...path, name]);
51
+ }
52
+ }
53
+ walk(output, []);
54
+ if (found.size !== slots.size ||
55
+ new TextEncoder().encode(JSON.stringify(output)).length > 500000)
56
+ configureConflict();
57
+ return JSON.stringify(output.receipt);
58
+ }
59
+ /** Complete C9 DATA against checked C3/C6/C7 source and actual stored events. */
60
+ export async function validateConfigureAcknowledgement(full, reservation, events, receiptJSON) {
61
+ if (!("recordVersion" in reservation) ||
62
+ reservation.stage !== "configure" ||
63
+ (events.length !== 2 && events.length !== 3) ||
64
+ events[0].sequence !== 1 ||
65
+ events[1].sequence !== 2)
66
+ configureConflict();
67
+ const checked = await validateOperationalConfigureSource(full);
68
+ const dispatch = JSON.parse(events[0].dataJSON), response = JSON.parse(events[1].dataJSON);
69
+ captureConfigureDispatch(dispatch);
70
+ captureConfigureResponse(response);
71
+ const sent = jsonObject(dispatch), received = jsonObject(response);
72
+ if (!equal(sent.request, checked.request) ||
73
+ !equal(received.request, checked.request) ||
74
+ reservation.requestBinding !== checked.request.requestIdentity.binding ||
75
+ reservation.key !== checked.request.key ||
76
+ reservation.apiVersion !== checked.request.apiVersion ||
77
+ reservation.firstDispatchedAt !== checked.request.firstDispatchedAt ||
78
+ !equal(JSON.parse(reservation.accountJSON), checked.original.account) ||
79
+ !equal(JSON.parse(reservation.timingPolicyJSON), checked.original.timingPolicy))
80
+ configureConflict();
81
+ const rebuilt = await constructRenewalConfigurationReceiptV2({
82
+ configuration: checked.configuration,
83
+ actualDispatch: checked.original.dispatch,
84
+ providerSnapshot: received.body,
85
+ transport: received.transport,
86
+ });
87
+ const admittedJSON = admitReceipt(receiptJSON, rebuilt);
88
+ // Retention at head2 never models a prospective, potentially larger event3.
89
+ if (events.length === 3)
90
+ validateConfigureReceiptEventDATA(events[2].dataJSON, rebuilt);
91
+ return {
92
+ receiptJSON: admittedJSON,
93
+ receiptBinding: rebuilt.binding,
94
+ receipt: rebuilt,
95
+ };
96
+ }
97
+ export function validateConfigureReceiptEventDATA(raw, receipt) {
98
+ const parsed = JSON.parse(raw);
99
+ captureConfigureReceipt(parsed);
100
+ if (!equal(parsed, {
101
+ event: "receipt",
102
+ stage: "configure",
103
+ request: receipt.request,
104
+ receipt,
105
+ }))
106
+ configureConflict();
107
+ }
108
+ //# sourceMappingURL=configureAcknowledgement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configureAcknowledgement.js","sourceRoot":"","sources":["../../../src/component/renewalOperations/configureAcknowledgement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sCAAsC,EAAE,MAAM,yCAAyC,CAAC;AACjG,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,iEAAiE,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sEAAsE,CAAC;AAC5G,OAAO,EAAE,eAAe,EAAE,MAAM,oDAAoD,CAAC;AACrF,OAAO,EAAE,KAAK,EAAE,MAAM,iDAAiD,CAAC;AAGxE,OAAO,EACL,kCAAkC,EAClC,iBAAiB,EACjB,UAAU,GACX,MAAM,0BAA0B,CAAC;AAKlC,SAAS,YAAY,CAAC,WAAmB,EAAE,OAAgB;IACzD,IACE,WAAW,CAAC,MAAM,GAAG,MAAM;QAC3B,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,MAAM,GAAG,MAAM;QAErD,iBAAiB,EAAE,CAAC;IACtB,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAChD,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC;QAAE,iBAAiB,EAAE,CAAC;IACjD,M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,GAAW,EACX,OAAgB;IAEhB,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACxC,uBAAuB,CAAC,MAAM,CAAC,CAAC;IAChC,IACE,CAAC,KAAK,CAAC,MAAM,EAAE;QACb,KAAK,EAAE,SAAS;QAChB,KAAK,EAAE,WAAW;QAClB,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,OAAO;KACR,CAAC;QAEF,iBAAiB,EAAE,CAAC;AACxB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { QueryCtx } from "../_generated/server.js";
2
+ import { canonicalJournalRecord } from "../../shared/renewalOperationJournal.js";
3
+ type Reader = Pick<QueryCtx, "db">;
4
+ /** Parent linkage is checked DATA; host authorization and live custody remain separate. */
5
+ export declare function validateConfigureParent(ctx: Reader, full: ReturnType<typeof canonicalJournalRecord>): Promise<{
6
+ basisJSON: string;
7
+ parentOperationId: import("convex/values").GenericId<"renewalOperations">;
8
+ } | null>;
9
+ export {};
10
+ //# sourceMappingURL=configureParent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configureParent.d.ts","sourceRoot":"","sources":["../../../src/component/renewalOperations/configureParent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AAWjF,KAAK,MAAM,GAAG,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AACnC,2FAA2F;AAC3F,wBAAsB,uBAAuB,CAC3C,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,UAAU,CAAC,OAAO,sBAAsB,CAAC;;;UAsDhD"}
@@ -0,0 +1,62 @@
1
+ import { equal } from "../../client/billing/renewalAggregate/shared.js";
2
+ import { originalRecord, currentReservation, eventChain, checkedInitialBasis, validateV2KnownAcknowledgement, } from "./helpers.js";
3
+ import { configureConflict, jsonObject } from "./configureValidation.js";
4
+ /** Parent linkage is checked DATA; host authorization and live custody remain separate. */
5
+ export async function validateConfigureParent(ctx, full) {
6
+ if (!("recordVersion" in full))
7
+ return null;
8
+ const child = jsonObject(JSON.parse(full.json));
9
+ if (child.stage !== "configure")
10
+ return null;
11
+ try {
12
+ const link = jsonObject(child.parentAttachment);
13
+ if (typeof link.operationId !== "string")
14
+ configureConflict();
15
+ const parentId = ctx.db.normalizeId("renewalOperations", link.operationId);
16
+ if (!parentId)
17
+ configureConflict();
18
+ const row = await ctx.db.get("renewalOperations", parentId);
19
+ if (!row || row.recordVersion !== 2)
20
+ configureConflict();
21
+ const parentFull = await originalRecord(ctx, row);
22
+ const parent = jsonObject(JSON.parse(parentFull.json));
23
+ if (parent.stage !== "attach")
24
+ configureConflict();
25
+ const reservation = await currentReservation(ctx, row, parentFull);
26
+ if (!reservation || reservation.stage !== "attach")
27
+ configureConflict();
28
+ const basis = checkedInitialBasis(row, reservation.attemptId, reservation);
29
+ if (!basis)
30
+ configureConflict();
31
+ const events = await eventChain(ctx, reservation);
32
+ if (events.length !== 3)
33
+ configureConflict();
34
+ const known = await validateV2KnownAcknowledgement(ctx, row, parentFull, reservation, events);
35
+ if (!known)
36
+ configureConflict();
37
+ const source = jsonObject(child.configureRecord);
38
+ const configuration = jsonObject(source.configuration);
39
+ const rawReceipt = jsonObject(configuration.attachReceipt);
40
+ const policy = jsonObject(child.timingPolicy);
41
+ const parentPolicy = jsonObject(parent.timingPolicy);
42
+ if (link.operationId !== row._id ||
43
+ link.attemptId !== reservation.attemptId ||
44
+ link.sourcePayloadId !== reservation.payloadId ||
45
+ link.receiptBinding !== known.admitted.receiptBinding ||
46
+ !equal(source.attachReceipt, JSON.parse(known.admitted.receiptJSON)) ||
47
+ !equal(rawReceipt.attachRequest, parent.attachRequest) ||
48
+ !equal(source.originalBundle, parent.originalBundle) ||
49
+ !equal(child.account, parent.account) ||
50
+ child.apiVersion !== parent.apiVersion ||
51
+ policy.workEndWallMs !== parentPolicy.workEndWallMs ||
52
+ policy.endWallMs !== parentPolicy.endWallMs ||
53
+ policy.periodStart !== parentPolicy.periodStart ||
54
+ policy.periodEnd !== parentPolicy.periodEnd)
55
+ configureConflict();
56
+ return { basisJSON: basis.basisJSON, parentOperationId: row._id };
57
+ }
58
+ catch {
59
+ return configureConflict();
60
+ }
61
+ }
62
+ //# sourceMappingURL=configureParent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configureParent.js","sourceRoot":"","sources":["../../../src/component/renewalOperations/configureParent.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,iDAAiD,CAAC;AACxE,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,UAAU,EACV,mBAAmB,EACnB,8BAA8B,GAC/B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAGzE,2FAA2F;AAC3F,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,GAAW,EACX,IAA+C;IAE/C,IAAI,CAAC,CAAC,eAAe,IAAI,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IAC5C,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAChD,IAAI,KAAK,CAAC,KAAK,KAAK,WAAW;QAAE,OAAO,IAAI,CAAC;IAC7C,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;QAChD,IAAI,OAAO,IAAI,CAAC,WAAW,KAAK,QAAQ;YAAE,iBAAiB,EAAE,CAAC;QAC9D,MAAM,QAAQ,GAAG,GAAG,CAAC,EAAE,CAAC,WAAW,CAAC,mBAAmB,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAC3E,IAAI,CAAC,QAAQ;YAAE,iBAAiB,EAAE,CAAC;QACnC,MAAM,GAAG,GAAG,MAAM,GAAG,CAAC,EAAE,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K,CAAC,YAAY,CAAC,CAAC;QAC9C,MAAM,YAAY,GAAG,UAAU,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QACrD,IACE,IAAI,CAAC,WAAW,KAAK,GAAG,CAAC,GAAG;YAC5B,IAAI,CAAC,SAAS,KAAK,WAAW,CAAC,SAAS;YACxC,IAAI,CAAC,eAAe,KAAK,WAAW,CAAC,SAAS;YAC9C,IAAI,CAAC,cAAc,KAAK,KAAK,CAAC,QAAQ,CAAC,cAAc;YACrD,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;YACpE,CAAC,KAAK,CAAC,UAAU,CAAC,aAAa,EAAE,MAAM,CAAC,aAAa,CAAC;YACtD,CAAC,KAAK,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,cAAc,CAAC;YACpD,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC;YACrC,KAAK,CAAC,UAAU,KAAK,MAAM,CAAC,UAAU;YACtC,MAAM,CAAC,aAAa,KAAK,YAAY,CAAC,aAAa;YACnD,MAAM,CAAC,SAAS,KAAK,YAAY,CAAC,SAAS;YAC3C,MAAM,CAAC,WAAW,KAAK,YAAY,CAAC,WAAW;YAC/C,MAAM,CAAC,SAAS,KAAK,YAAY,CAAC,SAAS;YAE3C,iBAAiB,EAAE,CAAC;QACtB,OAAO,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,iBAAiB,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC;IACpE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,iBAAiB,EAAE,CAAC;IAC7B,CAAC;AACH,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { canonicalJournalRecord } from "../../shared/renewalOperationJournal.js";
2
+ export declare function configureConflict(): never;
3
+ export declare function jsonObject(value: unknown): Record<string, unknown>;
4
+ /** Complete C3/C6/C7 reconstruction of unsigned configure DATA. */
5
+ export declare function validateOperationalConfigureSource(full: ReturnType<typeof canonicalJournalRecord>): Promise<{
6
+ original: Record<string, unknown>;
7
+ source: Record<string, unknown>;
8
+ configuration: import("../../client/renewal.js").ProjectRenewalConfigurationV2Options;
9
+ request: import("../../client/renewal.js").ProjectedRenewalConfigurationV2;
10
+ receipt: import("../../client/renewal.js").RenewalScheduleAttachmentReceiptV2;
11
+ }>;
12
+ //# sourceMappingURL=configureValidation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configureValidation.d.ts","sourceRoot":"","sources":["../../../src/component/renewalOperations/configureValidation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AAKjF,wBAAgB,iBAAiB,IAAI,KAAK,CAEzC;AACD,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAIlE;AACD,mEAAmE;AACnE,wBAAsB,kCAAkC,CACtD,IAAI,EAAE,UAAU,CAAC,OAAO,sBAAsB,CAAC;;;;;;GAsDhD"}
@@ -0,0 +1,64 @@
1
+ import { captureConfigureSource } from "../../client/billing/renewalAttach/internal/c10/eventCapture.js";
2
+ import { reconstructConfigurationV2 } from "../../client/billing/renewalV2/index.js";
3
+ import { equal } from "../../client/billing/renewalAggregate/shared.js";
4
+ export function configureConflict() {
5
+ throw Error("RENEWAL_JOURNAL_CONFLICT");
6
+ }
7
+ export function jsonObject(value) {
8
+ if (!value || typeof value !== "object" || Array.isArray(value))
9
+ configureConflict();
10
+ return value;
11
+ }
12
+ /** Complete C3/C6/C7 reconstruction of unsigned configure DATA. */
13
+ export async function validateOperationalConfigureSource(full) {
14
+ try {
15
+ const original = jsonObject(JSON.parse(full.json));
16
+ const source = jsonObject(original.configureRecord);
17
+ const keys = [
18
+ "configuration",
19
+ "request",
20
+ "attachReceipt",
21
+ "originalBundle",
22
+ ];
23
+ if (Object.keys(source).length !== keys.length ||
24
+ Object.keys(source).some((key) => !keys.includes(key)))
25
+ configureConflict();
26
+ const configuration = captureConfigureSource(source.configuration);
27
+ // The constructor revalidates all semantic fields of this captured JSON DATA.
28
+ const rebuilt = await reconstructConfigurationV2(configuration);
29
+ if (!rebuilt.material || !("requestIdentity" in rebuilt.result))
30
+ configureConflict();
31
+ const { prepared, receipt } = rebuilt.material;
32
+ const request = rebuilt.result;
33
+ const account = jsonObject(original.account);
34
+ const policy = jsonObject(original.timingPolicy);
35
+ const seven = {
36
+ scope: request.scope,
37
+ apiVersion: request.apiVersion,
38
+ method: request.method,
39
+ path: request.path,
40
+ payload: request.payload,
41
+ key: request.key,
42
+ firstDispatchedAt: request.firstDispatchedAt,
43
+ };
44
+ if (original.stage !== "configure" ||
45
+ original.apiVersion !== request.apiVersion ||
46
+ !equal(source.configuration, configuration) ||
47
+ !equal(source.request, request) ||
48
+ !equal(source.attachReceipt, receipt) ||
49
+ !equal(original.dispatch, seven) ||
50
+ full.requestBinding !== request.requestIdentity.binding ||
51
+ account.mode !== "platform" ||
52
+ account.stripeAccount !== null ||
53
+ account.livemode !== prepared.expected.livemode ||
54
+ policy.firstDispatchedAt !== request.firstDispatchedAt ||
55
+ policy.periodStart !== prepared.expected.periodStart ||
56
+ policy.periodEnd !== prepared.expected.periodEnd)
57
+ configureConflict();
58
+ return { original, source, configuration, request, receipt };
59
+ }
60
+ catch {
61
+ return configureConflict();
62
+ }
63
+ }
64
+ //# sourceMappingURL=configureValidation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configureValidation.js","sourceRoot":"","sources":["../../../src/component/renewalOperations/configureValidation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,iEAAiE,CAAC;AACzG,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AACrF,OAAO,EAAE,KAAK,EAAE,MAAM,iDAAiD,CAAC;AAExE,MAAM,UAAU,iBAAiB;IAC/B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