@fantastic.dev/better-stripe 0.103.0 → 0.105.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.
- package/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/dist/client/billing/renewalAttach/internal/configure/transport.d.ts +100 -0
- package/dist/client/billing/renewalAttach/internal/configure/transport.d.ts.map +1 -1
- package/dist/client/billing/renewalAttach/internal/configure/transport.js +17 -2
- package/dist/client/billing/renewalAttach/internal/configure/transport.js.map +1 -1
- package/dist/client/billing/renewalAttach/internal/operations/configureReadTransport.d.ts +22 -0
- package/dist/client/billing/renewalAttach/internal/operations/configureReadTransport.d.ts.map +1 -1
- package/dist/client/billing/renewalAttach/internal/operations/configureReadTransport.js +105 -3
- package/dist/client/billing/renewalAttach/internal/operations/configureReadTransport.js.map +1 -1
- package/dist/client/billing/renewalAttach/internal/preflight/output.d.ts +1 -0
- package/dist/client/billing/renewalAttach/internal/preflight/output.d.ts.map +1 -1
- package/dist/client/billing/renewalAttach/internal/preflight/output.js +6 -2
- package/dist/client/billing/renewalAttach/internal/preflight/output.js.map +1 -1
- package/dist/client/billing/renewalAttach/internal/preflight/record.d.ts +3 -1
- package/dist/client/billing/renewalAttach/internal/preflight/record.d.ts.map +1 -1
- package/dist/client/billing/renewalAttach/internal/preflight/record.js +8 -3
- package/dist/client/billing/renewalAttach/internal/preflight/record.js.map +1 -1
- package/dist/client/billing/renewalAttach/internal/preflight/relations.d.ts +2 -0
- package/dist/client/billing/renewalAttach/internal/preflight/relations.d.ts.map +1 -1
- package/dist/client/billing/renewalAttach/internal/preflight/relations.js +12 -5
- package/dist/client/billing/renewalAttach/internal/preflight/relations.js.map +1 -1
- package/dist/client/billing/renewalAttach/internal/producer/configureFrontier.d.ts +19 -0
- package/dist/client/billing/renewalAttach/internal/producer/configureFrontier.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/producer/configureFrontier.js +71 -0
- package/dist/client/billing/renewalAttach/internal/producer/configureFrontier.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/producer/configureJournalData.d.ts +25 -0
- package/dist/client/billing/renewalAttach/internal/producer/configureJournalData.d.ts.map +1 -1
- package/dist/client/billing/renewalAttach/internal/producer/configureJournalData.js +62 -0
- package/dist/client/billing/renewalAttach/internal/producer/configureJournalData.js.map +1 -1
- package/dist/client/billing/renewalAttach/internal/producer/configureJournalWork.d.ts +14 -0
- package/dist/client/billing/renewalAttach/internal/producer/configureJournalWork.d.ts.map +1 -1
- package/dist/client/billing/renewalAttach/internal/producer/configureJournalWork.js +17 -0
- package/dist/client/billing/renewalAttach/internal/producer/configureJournalWork.js.map +1 -1
- package/dist/client/billing/renewalAttach/internal/producer/configurePreflight.d.ts +16 -0
- package/dist/client/billing/renewalAttach/internal/producer/configurePreflight.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/producer/configurePreflight.js +117 -0
- package/dist/client/billing/renewalAttach/internal/producer/configurePreflight.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/producer/configureWrite.d.ts +30 -0
- package/dist/client/billing/renewalAttach/internal/producer/configureWrite.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/producer/configureWrite.js +224 -0
- package/dist/client/billing/renewalAttach/internal/producer/configureWrite.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/producer/configureWriteFactory.d.ts +61 -0
- package/dist/client/billing/renewalAttach/internal/producer/configureWriteFactory.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/producer/configureWriteFactory.js +73 -0
- package/dist/client/billing/renewalAttach/internal/producer/configureWriteFactory.js.map +1 -0
- package/docs/renewal-context-reads.md +79 -4
- package/package.json +1 -1
- package/src/client/billing/renewalAttach/internal/configure/transport.ts +31 -2
- package/src/client/billing/renewalAttach/internal/operations/configureReadTransport.ts +148 -3
- package/src/client/billing/renewalAttach/internal/preflight/output.ts +20 -3
- package/src/client/billing/renewalAttach/internal/preflight/record.ts +11 -3
- package/src/client/billing/renewalAttach/internal/preflight/relations.ts +20 -5
- package/src/client/billing/renewalAttach/internal/producer/configureFrontier.ts +132 -0
- package/src/client/billing/renewalAttach/internal/producer/configureJournalData.ts +84 -0
- package/src/client/billing/renewalAttach/internal/producer/configureJournalWork.ts +16 -0
- package/src/client/billing/renewalAttach/internal/producer/configurePreflight.ts +170 -0
- package/src/client/billing/renewalAttach/internal/producer/configureWrite.ts +317 -0
- package/src/client/billing/renewalAttach/internal/producer/configureWriteFactory.ts +88 -0
- package/src/client/billing/renewalAttach/internal/producer/producerConfigurePreflight.integration.test.ts +67 -0
- package/src/client/billing/renewalAttach/internal/producer/producerConfigurePreflightControls.integration.test.ts +475 -0
- package/src/client/billing/renewalAttach/internal/producer/producerConfigureWrite.integration.test.ts +158 -0
- package/src/client/billing/renewalAttach/internal/producer/producerConfigureWriteControls.integration.test.ts +537 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/producerConfigureAdmission.ts +136 -6
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { freeze } from "../material/nodeKernel.js";
|
|
2
|
+
import { closed as closedFields } from "../operations/types.js";
|
|
3
|
+
import { readConfigureLineage } from "./configureLineage.js";
|
|
4
|
+
import { ownedAwaitForInitialLineage } from "./ownedAwaitFactory.js";
|
|
5
|
+
import { createAdmittedConfigureWriteTransport } from "../configure/transport.js";
|
|
6
|
+
import { createSelectedRawAcquisition } from "../acquisition/ownedAcquisition.js";
|
|
7
|
+
import { createAdmittedConfigureEventCompiler } from "../c10/configureEvents.js";
|
|
8
|
+
import { assertConfigurePreflightFrontier, assertConfigureWriteFrontier, } from "./configureFrontier.js";
|
|
9
|
+
import { journalWorkForConfigureLineage } from "./configureJournalWork.js";
|
|
10
|
+
import { checkConfigureRetention } from "./configureJournalData.js";
|
|
11
|
+
import { projectRenewalConfigurationV2, constructRenewalScheduleAttachmentReceiptV2, constructRenewalConfigurationReceiptV2, } from "../../../renewalV2/index.js";
|
|
12
|
+
import { verifyPreflightRecordDATA, verifyCurrentPreflightDATA, } from "../preflight/relations.js";
|
|
13
|
+
import { releasePreflightDATA } from "../preflight/output.js";
|
|
14
|
+
import { admitConfigureACK, admitConfigureFailure, configureControl, } from "../configure/output.js";
|
|
15
|
+
import { need, seven, stop } from "../configure/request.js";
|
|
16
|
+
import { equal } from "../../../renewalAggregate/shared.js";
|
|
17
|
+
import { renewalSnapshot } from "../../../renewalReplacementSnapshot.js";
|
|
18
|
+
function matchesCurrentBundle(value, record) {
|
|
19
|
+
return equal(value, {
|
|
20
|
+
...record.originalBundle,
|
|
21
|
+
wireSubscription: record.configuration.freshSubscription,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
const attempts = new WeakMap();
|
|
25
|
+
const completions = new WeakMap();
|
|
26
|
+
/** One fixed initial configure attempt. No replay, caller frame or output registration. */
|
|
27
|
+
export function captureAdmittedConfigureWrite(token) {
|
|
28
|
+
const pair = createAdmittedConfigureWriteTransport(token);
|
|
29
|
+
need(arguments.length === 1);
|
|
30
|
+
const attempt = { pair, receipt: null, rawReceipt: null };
|
|
31
|
+
attempts.set(token, attempt);
|
|
32
|
+
const lineage = readConfigureLineage(token), owned = ownedAwaitForInitialLineage(lineage.parentToken);
|
|
33
|
+
const compiler = createAdmittedConfigureEventCompiler(token), work = journalWorkForConfigureLineage(token);
|
|
34
|
+
let used = false, closed = false, receiptKnown = false;
|
|
35
|
+
function guard() {
|
|
36
|
+
need(!closed);
|
|
37
|
+
pair.guard();
|
|
38
|
+
}
|
|
39
|
+
async function checked(call) {
|
|
40
|
+
guard();
|
|
41
|
+
const result = await owned(call);
|
|
42
|
+
guard();
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
function providerFailure(fact) {
|
|
46
|
+
const failure = admitConfigureFailure(fact.phase, fact.resource, fact.ordinal, pair.record.request, fact.diagnostics);
|
|
47
|
+
const error = Error("OWNED_CONFIGURE_PROVIDER_REJECTED");
|
|
48
|
+
Object.defineProperty(error, "failure", { value: failure });
|
|
49
|
+
return error;
|
|
50
|
+
}
|
|
51
|
+
return Object.freeze({
|
|
52
|
+
async invoke() {
|
|
53
|
+
need(!used);
|
|
54
|
+
used = true;
|
|
55
|
+
need(arguments.length === 0);
|
|
56
|
+
let actualError = null;
|
|
57
|
+
try {
|
|
58
|
+
guard();
|
|
59
|
+
await checked(() => assertConfigurePreflightFrontier(token));
|
|
60
|
+
const original = await checked(() => projectRenewalConfigurationV2(pair.record.configuration));
|
|
61
|
+
need(original.status === "projected_configure_request");
|
|
62
|
+
const attachment = await checked(() => constructRenewalScheduleAttachmentReceiptV2(pair.record.configuration.attachReceipt));
|
|
63
|
+
const record = verifyPreflightRecordDATA(pair.retained, original, attachment);
|
|
64
|
+
await checked(() => assertConfigurePreflightFrontier(token));
|
|
65
|
+
const reader = createSelectedRawAcquisition(pair.owner, pair.transport.readTransport, attachment.scheduleId);
|
|
66
|
+
const acquired = await checked(() => reader.acquire(record.configuration.preparation.expected));
|
|
67
|
+
if (!acquired.ok) {
|
|
68
|
+
const fact = pair.capability.consumeReadCatch();
|
|
69
|
+
if (fact) {
|
|
70
|
+
actualError = providerFailure(fact);
|
|
71
|
+
throw actualError;
|
|
72
|
+
}
|
|
73
|
+
return stop();
|
|
74
|
+
}
|
|
75
|
+
if (!matchesCurrentBundle(acquired.bundle, record))
|
|
76
|
+
return configureControl("not_dispatched", "preconfigure_baseline_changed");
|
|
77
|
+
const evidence = Object.freeze({
|
|
78
|
+
bundle: acquired.bundle,
|
|
79
|
+
schedule: acquired.schedule,
|
|
80
|
+
observedAt: acquired.observedAt,
|
|
81
|
+
});
|
|
82
|
+
verifyCurrentPreflightDATA(record, evidence);
|
|
83
|
+
const fresh = await checked(() => projectRenewalConfigurationV2({
|
|
84
|
+
...record.configuration,
|
|
85
|
+
freshSubscription: evidence.bundle.wireSubscription,
|
|
86
|
+
targetPrice: evidence.bundle.wireTargetPrice,
|
|
87
|
+
...(Object.prototype.hasOwnProperty.call(record.configuration, "billingCustomer")
|
|
88
|
+
? { billingCustomer: evidence.bundle.wireBillingCustomer }
|
|
89
|
+
: {}),
|
|
90
|
+
schedule: evidence.schedule,
|
|
91
|
+
observedAt: evidence.observedAt,
|
|
92
|
+
}));
|
|
93
|
+
need(fresh.status === "projected_configure_request" &&
|
|
94
|
+
equal(fresh, original) &&
|
|
95
|
+
equal(fresh, record.request));
|
|
96
|
+
need(Reflect.apply(pair.covers, pair.entry, [record, evidence, fresh]) ===
|
|
97
|
+
true);
|
|
98
|
+
guard();
|
|
99
|
+
releasePreflightDATA(record, evidence, fresh, original, attachment);
|
|
100
|
+
await checked(() => assertConfigurePreflightFrontier(token));
|
|
101
|
+
const dispatch = {
|
|
102
|
+
event: "dispatch",
|
|
103
|
+
stage: "configure",
|
|
104
|
+
request: original,
|
|
105
|
+
};
|
|
106
|
+
await checked(() => compiler.dispatch(dispatch));
|
|
107
|
+
await checked(() => assertConfigureWriteFrontier(token, [dispatch]));
|
|
108
|
+
const reply = await checked(() => pair.transport.postConfigure());
|
|
109
|
+
if (pair.capability.consumeNotStarted(reply))
|
|
110
|
+
return configureControl("not_dispatched", "post_not_started");
|
|
111
|
+
const fact = pair.capability.consumePostCatch(reply);
|
|
112
|
+
if (fact) {
|
|
113
|
+
actualError = providerFailure(fact);
|
|
114
|
+
throw actualError;
|
|
115
|
+
}
|
|
116
|
+
if (reply.outcome !== "fulfilled_safe")
|
|
117
|
+
return configureControl("configure_unknown", "post_unverified");
|
|
118
|
+
const response = {
|
|
119
|
+
event: "response",
|
|
120
|
+
stage: "configure",
|
|
121
|
+
request: original,
|
|
122
|
+
body: reply.body,
|
|
123
|
+
transport: reply.transport,
|
|
124
|
+
};
|
|
125
|
+
await checked(() => compiler.response(response));
|
|
126
|
+
const rawReceipt = Object.freeze({
|
|
127
|
+
configuration: record.configuration,
|
|
128
|
+
actualDispatch: seven(original),
|
|
129
|
+
providerSnapshot: reply.body,
|
|
130
|
+
transport: reply.transport,
|
|
131
|
+
});
|
|
132
|
+
const receipt = await checked(() => constructRenewalConfigurationReceiptV2(rawReceipt));
|
|
133
|
+
// Known receipt closes this once-only attempt before output admission or persistence.
|
|
134
|
+
receiptKnown = true;
|
|
135
|
+
attempt.receipt = freeze(receipt);
|
|
136
|
+
attempt.rawReceipt = freeze(rawReceipt);
|
|
137
|
+
guard();
|
|
138
|
+
const events = await checked(() => assertConfigureWriteFrontier(token, [dispatch, response]));
|
|
139
|
+
const receiptJSON = JSON.stringify(renewalSnapshot(receipt));
|
|
140
|
+
const retained = await checked(() => work.retain(receiptJSON));
|
|
141
|
+
const retention = checkConfigureRetention(retained, lineage.reservation, events, receipt.binding);
|
|
142
|
+
const known = {
|
|
143
|
+
receiptJSON,
|
|
144
|
+
receiptBinding: receipt.binding,
|
|
145
|
+
retention,
|
|
146
|
+
};
|
|
147
|
+
await checked(() => assertConfigureWriteFrontier(token, [dispatch, response], known));
|
|
148
|
+
const output = admitConfigureACK(record, rawReceipt, receipt);
|
|
149
|
+
const returned = closedFields(output, [
|
|
150
|
+
"status",
|
|
151
|
+
"originalRecord",
|
|
152
|
+
"rawReceipt",
|
|
153
|
+
"receipt",
|
|
154
|
+
"operationalAuthority",
|
|
155
|
+
]);
|
|
156
|
+
const published = {
|
|
157
|
+
event: "receipt",
|
|
158
|
+
stage: "configure",
|
|
159
|
+
request: original,
|
|
160
|
+
receipt,
|
|
161
|
+
};
|
|
162
|
+
await checked(() => compiler.receipt(published));
|
|
163
|
+
await checked(() => assertConfigureWriteFrontier(token, [dispatch, response, published], known));
|
|
164
|
+
const view = Object.freeze({
|
|
165
|
+
output,
|
|
166
|
+
receipt: returned.receipt,
|
|
167
|
+
rawReceipt: returned.rawReceipt,
|
|
168
|
+
acknowledgement: pair.preflight.acknowledgement,
|
|
169
|
+
originalEntry: pair.preflight.originalEntry,
|
|
170
|
+
configureEntry: pair.entry,
|
|
171
|
+
coversConfigure: pair.covers,
|
|
172
|
+
operationalAuthority: false,
|
|
173
|
+
});
|
|
174
|
+
guard();
|
|
175
|
+
// No callback, reflection or Owner sample follows the final gate before discard.
|
|
176
|
+
pair.capability.discardFulfilledQuarantine();
|
|
177
|
+
completions.set(token, { view, guard });
|
|
178
|
+
return output;
|
|
179
|
+
}
|
|
180
|
+
catch (error) {
|
|
181
|
+
let live = false;
|
|
182
|
+
try {
|
|
183
|
+
guard();
|
|
184
|
+
live = true;
|
|
185
|
+
}
|
|
186
|
+
catch {
|
|
187
|
+
/* No reflection on provider data after closure. */
|
|
188
|
+
}
|
|
189
|
+
closed = true;
|
|
190
|
+
if (live && actualError === error)
|
|
191
|
+
throw error;
|
|
192
|
+
if (pair.transport.postDisposition() !== "NOT_STARTED" || receiptKnown)
|
|
193
|
+
return configureControl("configure_unknown", live ? "post_unverified" : "owner_closed_after_post");
|
|
194
|
+
throw error;
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
/** Actual returned ACK custody only, without accepting any copied receipt or output. */
|
|
200
|
+
export function readAdmittedConfigureAcknowledgement(token) {
|
|
201
|
+
need(arguments.length === 1);
|
|
202
|
+
const completed = completions.get(token);
|
|
203
|
+
need(completed);
|
|
204
|
+
completed.guard();
|
|
205
|
+
return completed.view;
|
|
206
|
+
}
|
|
207
|
+
/** Private live attempt DATA, never an ACK registration or replay grant. */
|
|
208
|
+
export function readAdmittedConfigureWriteAttempt(token) {
|
|
209
|
+
need(arguments.length === 1);
|
|
210
|
+
const attempt = attempts.get(token);
|
|
211
|
+
need(attempt);
|
|
212
|
+
attempt.pair.guard();
|
|
213
|
+
const view = Object.freeze({
|
|
214
|
+
postDisposition: attempt.pair.transport.postDisposition(),
|
|
215
|
+
receiptKnown: attempt.receipt !== null,
|
|
216
|
+
receipt: attempt.receipt,
|
|
217
|
+
rawReceipt: attempt.rawReceipt,
|
|
218
|
+
returned: completions.has(token),
|
|
219
|
+
operationalAuthority: false,
|
|
220
|
+
});
|
|
221
|
+
attempt.pair.guard();
|
|
222
|
+
return view;
|
|
223
|
+
}
|
|
224
|
+
//# sourceMappingURL=configureWrite.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configureWrite.js","sourceRoot":"","sources":["../../../../../../src/client/billing/renewalAttach/internal/producer/configureWrite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,qCAAqC,EAAE,MAAM,2BAA2B,CAAC;AAClF,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAClF,OAAO,EAAE,oCAAoC,EAAE,MAAM,2BAA2B,CAAC;AACjF,OAAO,EACL,gCAAgC,EAChC,4BAA4B,GAC7B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,8BAA8B,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EACL,6BAA6B,EAC7B,2CAA2C,EAC3C,sCAAsC,GACvC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,yBAAyB,EACzB,0BAA0B,GAC3B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AAIzE,SAAS,oBAAoB,CAC3B,KAAc,EACd,MAAuB;IAEvB,OAAO,KAAK,CA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AAC;IACzC,IAAI,CAAC,SAAS,CAAC,CAAC;IAChB,SAAS,CAAC,KAAK,EAAE,CAAC;IAClB,OAAO,SAAS,CAAC,IAAI,CAAC;AACxB,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,iCAAiC,CAAC,KAAa;IAC7D,IAAI,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC;IAC7B,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,IAAI,CAAC,OAAO,CAAC,CAAC;IACd,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;IACrB,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC;QACzB,eAAe,EAAE,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,eAAe,EAAE;QACzD,YAAY,EAAE,OAAO,CAAC,OAAO,KAAK,IAAI;QACtC,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,QAAQ,EAAE,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC;QAChC,oBAAoB,EAAE,KAAc;KACrC,CAAC,CAAC;IACH,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;IACrB,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/** Derive a fixed write frame from actual completed readonly custody. */
|
|
2
|
+
export declare function captureAdmittedConfigureWriteFrame(token: object, arity: number): Readonly<{
|
|
3
|
+
frame: Readonly<{
|
|
4
|
+
owner: Readonly<{
|
|
5
|
+
basis: Readonly<import("../originalOwner.js").OriginalBasis>;
|
|
6
|
+
check(): Readonly<import("../originalOwner.js").OriginalSample>;
|
|
7
|
+
sample(): Readonly<import("../originalOwner.js").OriginalSample>;
|
|
8
|
+
subscribe(fn: () => void): () => void;
|
|
9
|
+
retire(): void;
|
|
10
|
+
}>;
|
|
11
|
+
operation: object;
|
|
12
|
+
request: import("../../../renewalV2/index.js").ProjectedRenewalConfigurationV2;
|
|
13
|
+
readPlan: readonly Readonly<{
|
|
14
|
+
resource: "coupon" | "customer" | "price" | "schedule" | "subscription";
|
|
15
|
+
ordinal: number;
|
|
16
|
+
method: "GET";
|
|
17
|
+
path: string;
|
|
18
|
+
body: undefined;
|
|
19
|
+
options: Readonly<{
|
|
20
|
+
apiVersion: typeof import("../configure/request.js").API;
|
|
21
|
+
maxNetworkRetries: 0;
|
|
22
|
+
}>;
|
|
23
|
+
}>[];
|
|
24
|
+
delegate: Readonly<{
|
|
25
|
+
rawRequest: import("stripe").Stripe["rawRequest"];
|
|
26
|
+
}>;
|
|
27
|
+
}>;
|
|
28
|
+
expected: readonly Readonly<{
|
|
29
|
+
resource: "coupon" | "customer" | "price" | "schedule" | "subscription";
|
|
30
|
+
ordinal: number;
|
|
31
|
+
method: "GET";
|
|
32
|
+
path: string;
|
|
33
|
+
body: undefined;
|
|
34
|
+
id: string;
|
|
35
|
+
options: Readonly<{
|
|
36
|
+
apiVersion: typeof import("../configure/request.js").API;
|
|
37
|
+
maxNetworkRetries: 0;
|
|
38
|
+
}>;
|
|
39
|
+
}>[];
|
|
40
|
+
owner: Readonly<{
|
|
41
|
+
basis: Readonly<import("../originalOwner.js").OriginalBasis>;
|
|
42
|
+
check(): Readonly<import("../originalOwner.js").OriginalSample>;
|
|
43
|
+
sample(): Readonly<import("../originalOwner.js").OriginalSample>;
|
|
44
|
+
subscribe(fn: () => void): () => void;
|
|
45
|
+
retire(): void;
|
|
46
|
+
}>;
|
|
47
|
+
guard: () => void;
|
|
48
|
+
record: import("../preflight/grammar.js").PreflightRecord;
|
|
49
|
+
retained: import("../preflight/record.js").CapturedPreflightRecord;
|
|
50
|
+
preflight: Readonly<{
|
|
51
|
+
output: import("../preflight/grammar.js").PreflightOutput;
|
|
52
|
+
originalEntry: unknown;
|
|
53
|
+
preflightEntry: unknown;
|
|
54
|
+
coversPreflight: unknown;
|
|
55
|
+
acknowledgement: ReturnType<typeof import("../operations/configureReadTransport.js").createAdmittedConfigureReadTransport>["acknowledgement"];
|
|
56
|
+
operationalAuthority: false;
|
|
57
|
+
}>;
|
|
58
|
+
entry: any;
|
|
59
|
+
covers: import("../configure/request.js").SourceMethod;
|
|
60
|
+
}>;
|
|
61
|
+
//# sourceMappingURL=configureWriteFactory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configureWriteFactory.d.ts","sourceRoot":"","sources":["../../../../../../src/client/billing/renewalAttach/internal/producer/configureWriteFactory.ts"],"names":[],"mappings":"AAUA,yEAAyE;AACzE,wBAAgB,kCAAkC,CAChD,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0Ed"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { types } from "node:util";
|
|
2
|
+
import { COMPILED_CONFIGURE_WRITE_ENTRIES } from "../operations/sourceOperations.js";
|
|
3
|
+
import { closed } from "../operations/types.js";
|
|
4
|
+
import { readConfigureLineage } from "./configureLineage.js";
|
|
5
|
+
import { readAdmittedConfigurePreflight } from "./configurePreflight.js";
|
|
6
|
+
import { captureInitialStockRawDelegate } from "./stockDelegateFactory.js";
|
|
7
|
+
import { capturePreflightRecordDATA } from "../preflight/record.js";
|
|
8
|
+
import { expectedPlan, need, ownMethod } from "../configure/request.js";
|
|
9
|
+
const captures = new WeakSet();
|
|
10
|
+
/** Derive a fixed write frame from actual completed readonly custody. */
|
|
11
|
+
export function captureAdmittedConfigureWriteFrame(token, arity) {
|
|
12
|
+
need(typeof token === "object" && token !== null && !captures.has(token));
|
|
13
|
+
captures.add(token);
|
|
14
|
+
need(arity === 1);
|
|
15
|
+
const lineage = readConfigureLineage(token);
|
|
16
|
+
const preflight = readAdmittedConfigurePreflight(token);
|
|
17
|
+
need(!types.isProxy(COMPILED_CONFIGURE_WRITE_ENTRIES) &&
|
|
18
|
+
Array.isArray(COMPILED_CONFIGURE_WRITE_ENTRIES));
|
|
19
|
+
const candidates = COMPILED_CONFIGURE_WRITE_ENTRIES.filter((entry) => {
|
|
20
|
+
const fields = closed(entry, ["originalEntry", "coversConfigure"]);
|
|
21
|
+
ownMethod(entry, "coversConfigure");
|
|
22
|
+
return fields.originalEntry === preflight.originalEntry;
|
|
23
|
+
});
|
|
24
|
+
need(candidates.length === 1);
|
|
25
|
+
const entry = candidates[0], covers = ownMethod(entry, "coversConfigure");
|
|
26
|
+
const record = preflight.output.originalRecord;
|
|
27
|
+
const retained = capturePreflightRecordDATA(record);
|
|
28
|
+
let closedFrame = false;
|
|
29
|
+
function guard() {
|
|
30
|
+
need(!closedFrame);
|
|
31
|
+
try {
|
|
32
|
+
const current = readConfigureLineage(token);
|
|
33
|
+
need(current.owner === lineage.owner &&
|
|
34
|
+
current.originalReservation === lineage.originalReservation &&
|
|
35
|
+
current.journal === lineage.journal);
|
|
36
|
+
need(readAdmittedConfigurePreflight(token) === preflight);
|
|
37
|
+
need(!types.isProxy(COMPILED_CONFIGURE_WRITE_ENTRIES) &&
|
|
38
|
+
Array.isArray(COMPILED_CONFIGURE_WRITE_ENTRIES) &&
|
|
39
|
+
COMPILED_CONFIGURE_WRITE_ENTRIES.includes(entry));
|
|
40
|
+
const fields = closed(entry, ["originalEntry", "coversConfigure"]);
|
|
41
|
+
need(fields.originalEntry === preflight.originalEntry &&
|
|
42
|
+
fields.coversConfigure === covers &&
|
|
43
|
+
!types.isProxy(covers));
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
closedFrame = true;
|
|
47
|
+
throw error;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
guard();
|
|
51
|
+
const delegate = captureInitialStockRawDelegate(lineage.parentToken);
|
|
52
|
+
const expected = expectedPlan(record);
|
|
53
|
+
const readPlan = Object.freeze(expected.map(({ resource, ordinal, method, path, body, options }) => Object.freeze({ resource, ordinal, method, path, body, options })));
|
|
54
|
+
const frame = Object.freeze({
|
|
55
|
+
owner: lineage.owner,
|
|
56
|
+
operation: token,
|
|
57
|
+
request: record.request,
|
|
58
|
+
readPlan,
|
|
59
|
+
delegate,
|
|
60
|
+
});
|
|
61
|
+
return Object.freeze({
|
|
62
|
+
frame,
|
|
63
|
+
expected,
|
|
64
|
+
owner: lineage.owner,
|
|
65
|
+
guard,
|
|
66
|
+
record,
|
|
67
|
+
retained,
|
|
68
|
+
preflight,
|
|
69
|
+
entry,
|
|
70
|
+
covers,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=configureWriteFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configureWriteFactory.js","sourceRoot":"","sources":["../../../../../../src/client/billing/renewalAttach/internal/producer/configureWriteFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,gCAAgC,EAAE,MAAM,mCAAmC,CAAC;AACrF,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,8BAA8B,EAAE,MAAM,yBAAyB,CAAC;AACzE,OAAO,EAAE,8BAA8B,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAExE,MAAM,QAAQ,GAAG,IAAI,OAAO,EAAU,CAAC;AACvC,yEAAyE;AACzE,MAAM,UAAU,kCAAkC,CAChD,KAAa,EACb,KAAa;IAEb,IAAI,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;IAC1E,QAAQ,CAAC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Q;QACR,QAAQ;KACT,CAAC,CAAC;IACH,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,KAAK;QACL,QAAQ;QACR,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,KAAK;QACL,MAAM;QACN,QAAQ;QACR,SAAS;QACT,KAAK;QACL,MAAM;KACP,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -263,7 +263,7 @@ call.
|
|
|
263
263
|
|
|
264
264
|
The result is an opaque private view containing `owner`, `basisJSON` and
|
|
265
265
|
`operationalAuthority: false`. The separate private C10 factory below can use
|
|
266
|
-
that identity. Configure
|
|
266
|
+
that identity. Configure recovery actors and public scheduling
|
|
267
267
|
remain required, as do genuine generation and operational qualification.
|
|
268
268
|
Production Source profile arrays remain empty.
|
|
269
269
|
|
|
@@ -299,9 +299,84 @@ a committed response or receipt event, and a retained C9 do not establish provid
|
|
|
299
299
|
custody, returned configure ACK custody, pending/effective replacement or fresh
|
|
300
300
|
dispatch permission. Receipt retention remains a separate operation; a future
|
|
301
301
|
configure completion pipeline must retain the complete C9 before publishing
|
|
302
|
-
receipt event 3 and returning its actual acknowledgement.
|
|
303
|
-
|
|
304
|
-
|
|
302
|
+
receipt event 3 and returning its actual acknowledgement. Execution requires its
|
|
303
|
+
own frontier checks. This channel factory supplies no provider transport and
|
|
304
|
+
activates no operational Source profile.
|
|
305
|
+
|
|
306
|
+
## Private admitted configure preflight
|
|
307
|
+
|
|
308
|
+
`captureAdmittedConfigurePreflight(token)` captures one readonly actor for the
|
|
309
|
+
actual admitted child. Capture and invocation are each spent once, including
|
|
310
|
+
failed calls and invalid extra arguments. The factory requires a unique compiled
|
|
311
|
+
preflight entry linked to the actual returned parent ACK entry and retains its
|
|
312
|
+
predicate identity. Production profile arrays remain empty, so this private path
|
|
313
|
+
still refuses without a qualified Source profile.
|
|
314
|
+
|
|
315
|
+
The actor uses the original parent Owner, SDK client, stock delegate promise and
|
|
316
|
+
class-bound child journal. It never loads the legacy singleton Owner or transport
|
|
317
|
+
source. The fixed plan reads the subscription with its existing expansions,
|
|
318
|
+
price, customer, original coupons in order and attached schedule last. Its 4–44
|
|
319
|
+
requests are GETs with explicit undefined bodies, API version
|
|
320
|
+
`2026-09-30.endive` and zero network retries. No caller can substitute a plan,
|
|
321
|
+
transport, source, clock, predicate or output.
|
|
322
|
+
|
|
323
|
+
The actor reconstructs retained C6 and C3 DATA, compares complete current reads,
|
|
324
|
+
reprojects the immutable C7 request and checks the compiled preflight predicate.
|
|
325
|
+
Observation time comes from the original Owner. Reconstruction preserves the
|
|
326
|
+
original first-dispatch time, key and deadlines. Complete operation, basis,
|
|
327
|
+
head-zero and ACK-null journal checks fence acquisition and output release.
|
|
328
|
+
ACK-null precedes the final head read. These bounded reads do not lock the journal
|
|
329
|
+
against a later concurrent write.
|
|
330
|
+
|
|
331
|
+
Successful completion privately retains the actual output identity, parent ACK
|
|
332
|
+
view and compiled entry pointers. Pending reads, copied output or copied tokens
|
|
333
|
+
cannot register completion. Owner retirement and observed custody changes close
|
|
334
|
+
the actor. The legacy preflight functions retain their original Owner checks
|
|
335
|
+
around shared DATA kernels. This readonly consistency result grants no configure
|
|
336
|
+
POST permission, returned configure ACK custody or public scheduling support.
|
|
337
|
+
|
|
338
|
+
## Private admitted configure write
|
|
339
|
+
|
|
340
|
+
`captureAdmittedConfigureWrite(token)` captures one initial write actor from the
|
|
341
|
+
actual completed preflight view. It retains the actual parent ACK, original
|
|
342
|
+
profile entry and preflight predicate pointers. A unique compiled write entry
|
|
343
|
+
must link to that original entry, and its predicate identity remains fixed.
|
|
344
|
+
Copied tokens, output DATA, pending preflight and replacement arguments cannot
|
|
345
|
+
supply custody. Production profile arrays remain empty.
|
|
346
|
+
|
|
347
|
+
The write transport preserves the legacy POST latch and quarantine kernel while
|
|
348
|
+
using the admitted child's original parent Owner and stock SDK delegate. It
|
|
349
|
+
performs its own fixed fresh GET sequence. The separate readonly preflight output
|
|
350
|
+
cannot mark this pair's read generation complete. Current reads and a fresh C6
|
|
351
|
+
reconstruction must still match the retained request exactly, including its key,
|
|
352
|
+
first-dispatch time, path, payload and API version.
|
|
353
|
+
|
|
354
|
+
Before dispatch intent, the actor checks the complete head-zero frontier. It
|
|
355
|
+
awaits the actual committed dispatch event 1 and C10 ACK, then checks full stored
|
|
356
|
+
event DATA, basis, absent acknowledgement, idle journal work and exact head one
|
|
357
|
+
before POST. Each invocation permits at most one POST, with the retained key and
|
|
358
|
+
zero retries. These checks are bounded read fences, not an atomic writer lock.
|
|
359
|
+
The transport marks uncertainty before calling the stock delegate. Synchronous
|
|
360
|
+
throws or non-Promise results cannot establish a proven provider rejection.
|
|
361
|
+
|
|
362
|
+
Fulfillment enters quarantine before response inspection or Owner checks. Only
|
|
363
|
+
safe captured response DATA can publish event 2. After actual C9 construction,
|
|
364
|
+
the actor records the receipt as known, durably retains its complete canonical
|
|
365
|
+
JSON at head two, validates the complete retention reply and reads it back.
|
|
366
|
+
Retention precedes whole-output admission and receipt event 3. Output refusal,
|
|
367
|
+
pending or rejected persistence replies, or failed event-3 publication cannot
|
|
368
|
+
permit another POST or establish a returned ACK. A private live attempt view
|
|
369
|
+
retains immutable actual C9/input DATA and POST disposition independently of the
|
|
370
|
+
returned ACK view. Copied tokens cannot read it, and the view grants no replay
|
|
371
|
+
or dispatch permission.
|
|
372
|
+
|
|
373
|
+
`readAdmittedConfigureAcknowledgement(token)` returns custody only after receipt
|
|
374
|
+
event 3 commits, its actual C10 ACK returns and the final complete history and
|
|
375
|
+
retention fence passes. The view retains the exact returned output and its
|
|
376
|
+
receipt/raw-receipt identities. A final guard precedes quarantine discard with
|
|
377
|
+
no intervening callback or Owner sample. Late fulfillment after retirement stays
|
|
378
|
+
unknown and cannot publish ACK custody. This initial-write path supplies no
|
|
379
|
+
replay, resumption, public scheduling entrypoint or pending/effective claim.
|
|
305
380
|
|
|
306
381
|
## Component operation journal
|
|
307
382
|
|
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { types } from "node:util";
|
|
2
2
|
import { OWNER } from "../originalOwner.js";
|
|
3
|
+
import { captureAdmittedConfigureWriteFrame } from "../producer/configureWriteFactory.js";
|
|
3
4
|
import { closed } from "../operations/types.js";
|
|
4
5
|
import { equal } from "../../../renewalAggregate/shared.js";
|
|
5
6
|
import {
|
|
@@ -34,6 +35,13 @@ function build(load: () => unknown) {
|
|
|
34
35
|
OWNER.check();
|
|
35
36
|
const raw = load();
|
|
36
37
|
OWNER.check();
|
|
38
|
+
return configureWriteKernel(raw, OWNER);
|
|
39
|
+
}
|
|
40
|
+
function configureWriteKernel(
|
|
41
|
+
raw: unknown,
|
|
42
|
+
owner: typeof OWNER,
|
|
43
|
+
guard?: () => void,
|
|
44
|
+
) {
|
|
37
45
|
need(!types.isProxy(raw));
|
|
38
46
|
const frame = closed(raw, [
|
|
39
47
|
"owner",
|
|
@@ -42,7 +50,7 @@ function build(load: () => unknown) {
|
|
|
42
50
|
"readPlan",
|
|
43
51
|
"delegate",
|
|
44
52
|
]);
|
|
45
|
-
need(frame.owner ===
|
|
53
|
+
need(frame.owner === owner);
|
|
46
54
|
const operation = frame.operation,
|
|
47
55
|
readPlanReference = frame.readPlan,
|
|
48
56
|
delegate = frame.delegate;
|
|
@@ -77,7 +85,9 @@ function build(load: () => unknown) {
|
|
|
77
85
|
}
|
|
78
86
|
checking = true;
|
|
79
87
|
try {
|
|
80
|
-
|
|
88
|
+
guard?.();
|
|
89
|
+
owner.check();
|
|
90
|
+
guard?.();
|
|
81
91
|
if (closedOwner) stop();
|
|
82
92
|
} catch {
|
|
83
93
|
closedOwner = true;
|
|
@@ -346,3 +356,22 @@ export function createConfigureReplayTransport() {
|
|
|
346
356
|
need(arguments.length === 0);
|
|
347
357
|
return build(loadConfigureReplayTransportSource);
|
|
348
358
|
}
|
|
359
|
+
|
|
360
|
+
/** Actual completed preflight custody only; no caller-supplied frame or Owner. */
|
|
361
|
+
export function createAdmittedConfigureWriteTransport(token: object) {
|
|
362
|
+
const source = captureAdmittedConfigureWriteFrame(token, arguments.length);
|
|
363
|
+
const pair = configureWriteKernel(source.frame, source.owner, source.guard);
|
|
364
|
+
need(
|
|
365
|
+
pair.capability.assertSourceOperationBinding(
|
|
366
|
+
token,
|
|
367
|
+
source.record.request,
|
|
368
|
+
source.frame.readPlan,
|
|
369
|
+
source.frame.delegate,
|
|
370
|
+
source.frame.delegate.rawRequest,
|
|
371
|
+
source.expected,
|
|
372
|
+
),
|
|
373
|
+
);
|
|
374
|
+
need(pair.capability.reserveAcquisition());
|
|
375
|
+
source.guard();
|
|
376
|
+
return Object.freeze({ ...pair, ...source });
|
|
377
|
+
}
|