@fantastic.dev/better-stripe 0.90.0 → 0.91.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 +6 -0
- package/README.md +1 -1
- package/dist/client/billing/renewalAttach/internal/acquisition/ownedAcquisition.d.ts +41 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/ownedAcquisition.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/ownedAcquisition.js +187 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/ownedAcquisition.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/rawAcquisition.d.ts +2 -23
- package/dist/client/billing/renewalAttach/internal/acquisition/rawAcquisition.d.ts.map +1 -1
- package/dist/client/billing/renewalAttach/internal/acquisition/rawAcquisition.js +1 -112
- package/dist/client/billing/renewalAttach/internal/acquisition/rawAcquisition.js.map +1 -1
- package/dist/client/billing/renewalAttach/internal/acquisition/rawWireSource.d.ts +8 -3
- package/dist/client/billing/renewalAttach/internal/acquisition/rawWireSource.d.ts.map +1 -1
- package/dist/client/billing/renewalAttach/internal/acquisition/rawWireSource.js +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/rawWireSource.js.map +1 -1
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/sourcePort.d.mts +1 -1
- package/dist/client/billing/renewalAttach/internal/configure/actor.d.ts +8 -0
- package/dist/client/billing/renewalAttach/internal/configure/actor.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/configure/actor.js +454 -0
- package/dist/client/billing/renewalAttach/internal/configure/actor.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/configure/capture.d.ts +12 -0
- package/dist/client/billing/renewalAttach/internal/configure/capture.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/configure/capture.js +99 -0
- package/dist/client/billing/renewalAttach/internal/configure/capture.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/configure/output.d.ts +16 -0
- package/dist/client/billing/renewalAttach/internal/configure/output.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/configure/output.js +274 -0
- package/dist/client/billing/renewalAttach/internal/configure/output.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/configure/replay.d.ts +3 -0
- package/dist/client/billing/renewalAttach/internal/configure/replay.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/configure/replay.js +9 -0
- package/dist/client/billing/renewalAttach/internal/configure/replay.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/configure/request.d.ts +39 -0
- package/dist/client/billing/renewalAttach/internal/configure/request.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/configure/request.js +245 -0
- package/dist/client/billing/renewalAttach/internal/configure/request.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/configure/transport.d.ts +88 -0
- package/dist/client/billing/renewalAttach/internal/configure/transport.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/configure/transport.js +289 -0
- package/dist/client/billing/renewalAttach/internal/configure/transport.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/observation/actor.d.ts +16 -0
- package/dist/client/billing/renewalAttach/internal/observation/actor.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/observation/actor.js +362 -0
- package/dist/client/billing/renewalAttach/internal/observation/actor.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/observation/capture.d.ts +9 -0
- package/dist/client/billing/renewalAttach/internal/observation/capture.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/observation/capture.js +215 -0
- package/dist/client/billing/renewalAttach/internal/observation/capture.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/observation/profile.d.ts +7 -0
- package/dist/client/billing/renewalAttach/internal/observation/profile.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/observation/profile.js +190 -0
- package/dist/client/billing/renewalAttach/internal/observation/profile.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/observation/record.d.ts +5 -0
- package/dist/client/billing/renewalAttach/internal/observation/record.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/observation/record.js +317 -0
- package/dist/client/billing/renewalAttach/internal/observation/record.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/observation/types.d.ts +79 -0
- package/dist/client/billing/renewalAttach/internal/observation/types.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/observation/types.js +27 -0
- package/dist/client/billing/renewalAttach/internal/observation/types.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/operations/configureReadTransport.d.ts +18 -0
- package/dist/client/billing/renewalAttach/internal/operations/configureReadTransport.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/operations/configureReadTransport.js +229 -0
- package/dist/client/billing/renewalAttach/internal/operations/configureReadTransport.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/operations/fixedTransport.d.ts +163 -0
- package/dist/client/billing/renewalAttach/internal/operations/fixedTransport.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/operations/fixedTransport.js +443 -0
- package/dist/client/billing/renewalAttach/internal/operations/fixedTransport.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/operations/initialAttach.d.ts +8 -0
- package/dist/client/billing/renewalAttach/internal/operations/initialAttach.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/operations/initialAttach.js +467 -0
- package/dist/client/billing/renewalAttach/internal/operations/initialAttach.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/operations/ownedAwait.d.ts +6 -0
- package/dist/client/billing/renewalAttach/internal/operations/ownedAwait.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/operations/ownedAwait.js +59 -0
- package/dist/client/billing/renewalAttach/internal/operations/ownedAwait.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/operations/providerFailure.d.ts +10 -0
- package/dist/client/billing/renewalAttach/internal/operations/providerFailure.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/operations/providerFailure.js +48 -0
- package/dist/client/billing/renewalAttach/internal/operations/providerFailure.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/operations/sourceOperations.d.ts +20 -0
- package/dist/client/billing/renewalAttach/internal/operations/sourceOperations.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/operations/sourceOperations.js +44 -0
- package/dist/client/billing/renewalAttach/internal/operations/sourceOperations.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/operations/types.d.ts +42 -0
- package/dist/client/billing/renewalAttach/internal/operations/types.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/operations/types.js +158 -0
- package/dist/client/billing/renewalAttach/internal/operations/types.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/preflight/configurePreflight.d.ts +5 -0
- package/dist/client/billing/renewalAttach/internal/preflight/configurePreflight.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/preflight/configurePreflight.js +214 -0
- package/dist/client/billing/renewalAttach/internal/preflight/configurePreflight.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/preflight/grammar.d.ts +33 -0
- package/dist/client/billing/renewalAttach/internal/preflight/grammar.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/preflight/grammar.js +208 -0
- package/dist/client/billing/renewalAttach/internal/preflight/grammar.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/preflight/output.d.ts +4 -0
- package/dist/client/billing/renewalAttach/internal/preflight/output.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/preflight/output.js +25 -0
- package/dist/client/billing/renewalAttach/internal/preflight/output.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/preflight/record.d.ts +16 -0
- package/dist/client/billing/renewalAttach/internal/preflight/record.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/preflight/record.js +93 -0
- package/dist/client/billing/renewalAttach/internal/preflight/record.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/preflight/relations.d.ts +7 -0
- package/dist/client/billing/renewalAttach/internal/preflight/relations.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/preflight/relations.js +153 -0
- package/dist/client/billing/renewalAttach/internal/preflight/relations.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/recovery/material.d.ts +22 -0
- package/dist/client/billing/renewalAttach/internal/recovery/material.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/recovery/material.js +221 -0
- package/dist/client/billing/renewalAttach/internal/recovery/material.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/recovery/output.d.ts +8 -0
- package/dist/client/billing/renewalAttach/internal/recovery/output.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/recovery/output.js +101 -0
- package/dist/client/billing/renewalAttach/internal/recovery/output.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/recovery/record.d.ts +12 -0
- package/dist/client/billing/renewalAttach/internal/recovery/record.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/recovery/record.js +186 -0
- package/dist/client/billing/renewalAttach/internal/recovery/record.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/recovery/recoveryActor.d.ts +5 -0
- package/dist/client/billing/renewalAttach/internal/recovery/recoveryActor.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/recovery/recoveryActor.js +498 -0
- package/dist/client/billing/renewalAttach/internal/recovery/recoveryActor.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/recovery/relation.d.ts +21 -0
- package/dist/client/billing/renewalAttach/internal/recovery/relation.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/recovery/relation.js +119 -0
- package/dist/client/billing/renewalAttach/internal/recovery/relation.js.map +1 -0
- package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +32 -32
- package/dist/client/connect/payoutExecutionTestHelpers.d.ts +16 -16
- package/dist/component/balanceFunding/internal/actions.d.ts +11 -11
- package/dist/component/balanceFunding/mutations.d.ts +16 -16
- package/dist/component/balanceFunding/preparationHandlers.d.ts +8 -8
- package/dist/component/payoutRelease/queries.d.ts +2 -2
- package/dist/component/payoutRelease/queries.d.ts.map +1 -1
- package/dist/component/processingCostReconciliation/rollback.d.ts +1 -1
- package/dist/component/usage/allowance.fixtures.d.ts +16 -16
- package/docs/renewal-context-reads.md +26 -8
- package/docs/renewal-material-observation.md +37 -0
- package/docs/renewal-phase-assembly.md +68 -0
- package/docs/renewal-raw-acquisition.md +19 -5
- package/package.json +1 -1
- package/src/client/billing/renewalAttach/internal/acquisition/ownedAcquisition.ts +304 -0
- package/src/client/billing/renewalAttach/internal/acquisition/rawAcquisition.ts +2 -160
- package/src/client/billing/renewalAttach/internal/acquisition/rawWireSource.ts +15 -3
- package/src/client/billing/renewalAttach/internal/configure/actor.ts +575 -0
- package/src/client/billing/renewalAttach/internal/configure/capture.ts +117 -0
- package/src/client/billing/renewalAttach/internal/configure/dispatch.integration.test.ts +32 -0
- package/src/client/billing/renewalAttach/internal/configure/limits.test.ts +510 -0
- package/src/client/billing/renewalAttach/internal/configure/order.integration.test.ts +207 -0
- package/src/client/billing/renewalAttach/internal/configure/output.ts +372 -0
- package/src/client/billing/renewalAttach/internal/configure/ownership.integration.test.ts +148 -0
- package/src/client/billing/renewalAttach/internal/configure/replay.integration.test.ts +173 -0
- package/src/client/billing/renewalAttach/internal/configure/replay.ts +13 -0
- package/src/client/billing/renewalAttach/internal/configure/request.ts +312 -0
- package/src/client/billing/renewalAttach/internal/configure/transport.integration.test.ts +507 -0
- package/src/client/billing/renewalAttach/internal/configure/transport.ts +348 -0
- package/src/client/billing/renewalAttach/internal/observation/actor.ts +444 -0
- package/src/client/billing/renewalAttach/internal/observation/capture.ts +250 -0
- package/src/client/billing/renewalAttach/internal/observation/observation.integration.test.ts +220 -0
- package/src/client/billing/renewalAttach/internal/observation/observationRetirement.integration.test.ts +60 -0
- package/src/client/billing/renewalAttach/internal/observation/profile.ts +264 -0
- package/src/client/billing/renewalAttach/internal/observation/record.ts +408 -0
- package/src/client/billing/renewalAttach/internal/observation/types.ts +102 -0
- package/src/client/billing/renewalAttach/internal/operations/configureReadTransport.ts +285 -0
- package/src/client/billing/renewalAttach/internal/operations/defaultBindings.test.ts +69 -0
- package/src/client/billing/renewalAttach/internal/operations/fixedTransport.ts +574 -0
- package/src/client/billing/renewalAttach/internal/operations/initialAttach.integration.test.ts +34 -0
- package/src/client/billing/renewalAttach/internal/operations/initialAttach.ts +535 -0
- package/src/client/billing/renewalAttach/internal/operations/ownedAwait.ts +63 -0
- package/src/client/billing/renewalAttach/internal/operations/providerFailure.integration.test.ts +61 -0
- package/src/client/billing/renewalAttach/internal/operations/providerFailure.ts +66 -0
- package/src/client/billing/renewalAttach/internal/operations/sourceOperations.ts +50 -0
- package/src/client/billing/renewalAttach/internal/operations/transport.integration.test.ts +116 -0
- package/src/client/billing/renewalAttach/internal/operations/types.ts +223 -0
- package/src/client/billing/renewalAttach/internal/preflight/configurePreflight.integration.test.ts +285 -0
- package/src/client/billing/renewalAttach/internal/preflight/configurePreflight.ts +258 -0
- package/src/client/billing/renewalAttach/internal/preflight/configureReads.integration.test.ts +139 -0
- package/src/client/billing/renewalAttach/internal/preflight/grammar.ts +257 -0
- package/src/client/billing/renewalAttach/internal/preflight/output.ts +42 -0
- package/src/client/billing/renewalAttach/internal/preflight/owner.integration.test.ts +82 -0
- package/src/client/billing/renewalAttach/internal/preflight/preflight.integration.test.ts +354 -0
- package/src/client/billing/renewalAttach/internal/preflight/record.ts +127 -0
- package/src/client/billing/renewalAttach/internal/preflight/relations.ts +209 -0
- package/src/client/billing/renewalAttach/internal/recovery/material.ts +311 -0
- package/src/client/billing/renewalAttach/internal/recovery/output.ts +136 -0
- package/src/client/billing/renewalAttach/internal/recovery/record.ts +230 -0
- package/src/client/billing/renewalAttach/internal/recovery/recovery.integration.test.ts +463 -0
- package/src/client/billing/renewalAttach/internal/recovery/recoveryActor.ts +599 -0
- package/src/client/billing/renewalAttach/internal/recovery/relation.ts +175 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/attachEntries.ts +217 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/attachObservations.ts +226 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/attachScenario.ts +556 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/attachScenarioAssertions.ts +180 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/attachScenarioBarriers.ts +144 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/configurePreflightAssertions.ts +122 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/configurePreflightBarriers.ts +330 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/configurePreflightControls.ts +139 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/configurePreflightOperation.ts +513 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/configureReadNativeBaseline.ts +344 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/configureReadOperation.ts +278 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/configureReadPort.ts +17 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteAssertions.ts +533 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteBarriers.ts +125 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteDeclarations.ts +314 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteHistory.ts +463 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteObservations.ts +515 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteOperation.ts +600 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationAssertions.ts +211 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationDeclarations.ts +192 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationHTTP.ts +197 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationObservations.ts +269 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationOperation.ts +262 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationProbe.ts +319 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/ownedOperations.ts +94 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/sourceOperationPort.ts +16 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/stockHttp.ts +21 -0
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { vi } from "vitest";
|
|
3
|
+
import type {
|
|
4
|
+
ObservationControl,
|
|
5
|
+
ObservationDeclaration,
|
|
6
|
+
} from "./observationDeclarations.js";
|
|
7
|
+
|
|
8
|
+
export function observationState() {
|
|
9
|
+
return {
|
|
10
|
+
targetCalls: 0,
|
|
11
|
+
sourceLoads: 0,
|
|
12
|
+
ownedC6: 0,
|
|
13
|
+
ownedC3: 0,
|
|
14
|
+
C3Fulfilled: 0,
|
|
15
|
+
C3Rejected: 0,
|
|
16
|
+
recordVerificationEntered: 0,
|
|
17
|
+
recordVerificationCompleted: 0,
|
|
18
|
+
ownedC9: 0,
|
|
19
|
+
ownedObserver: 0,
|
|
20
|
+
coverage: 0,
|
|
21
|
+
tupleTraps: 0,
|
|
22
|
+
methodGetterCalls: 0,
|
|
23
|
+
exportFactoryLoads: 0,
|
|
24
|
+
exportReads: 0,
|
|
25
|
+
exportCalls: 0,
|
|
26
|
+
exportProxyApplies: 0,
|
|
27
|
+
exportDescriptorData: false,
|
|
28
|
+
exportDescriptorGetter: false,
|
|
29
|
+
lastC6: null as unknown,
|
|
30
|
+
pending: [] as Promise<unknown>[],
|
|
31
|
+
originals: [] as Promise<unknown>[],
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export type ObservationState = ReturnType<typeof observationState>;
|
|
35
|
+
|
|
36
|
+
/** Install only after the actual initial actor/Owner/ACK have been captured. */
|
|
37
|
+
export async function observeObservationAPI(
|
|
38
|
+
s: ObservationState,
|
|
39
|
+
owner: typeof import("../originalOwner.js").OWNER,
|
|
40
|
+
mode: ObservationControl,
|
|
41
|
+
) {
|
|
42
|
+
const actual = await vi.importActual<
|
|
43
|
+
typeof import("../../../renewalV2/index.js")
|
|
44
|
+
>("../../../renewalV2/index.js");
|
|
45
|
+
const observer = await vi.importActual<
|
|
46
|
+
typeof import("../../../renewalV2/observation.js")
|
|
47
|
+
>("../../../renewalV2/observation.js");
|
|
48
|
+
assert.equal(typeof observer.inspectRenewalScheduleMaterialV2, "function");
|
|
49
|
+
const actualRecord = await vi.importActual<
|
|
50
|
+
typeof import("../observation/record.js")
|
|
51
|
+
>("../observation/record.js");
|
|
52
|
+
const verify = actualRecord.verifyObservationRecord;
|
|
53
|
+
vi.doMock("../observation/record.js", () => ({
|
|
54
|
+
...actualRecord,
|
|
55
|
+
verifyObservationRecord(...args: Parameters<typeof verify>) {
|
|
56
|
+
s.recordVerificationEntered++;
|
|
57
|
+
const result = Reflect.apply(verify, actualRecord, args) as ReturnType<
|
|
58
|
+
typeof verify
|
|
59
|
+
>;
|
|
60
|
+
s.recordVerificationCompleted++;
|
|
61
|
+
return result;
|
|
62
|
+
},
|
|
63
|
+
}));
|
|
64
|
+
const keep = <T>(promise: Promise<T>) => {
|
|
65
|
+
s.originals.push(promise);
|
|
66
|
+
s.pending.push(
|
|
67
|
+
promise.then(
|
|
68
|
+
() => {},
|
|
69
|
+
() => {},
|
|
70
|
+
),
|
|
71
|
+
);
|
|
72
|
+
return promise;
|
|
73
|
+
};
|
|
74
|
+
vi.doMock("../../../renewalV2/index.js", () => ({
|
|
75
|
+
...actual,
|
|
76
|
+
projectRenewalConfigurationV2(
|
|
77
|
+
...args: Parameters<typeof actual.projectRenewalConfigurationV2>
|
|
78
|
+
) {
|
|
79
|
+
s.ownedC6++;
|
|
80
|
+
const promise = Reflect.apply(
|
|
81
|
+
actual.projectRenewalConfigurationV2,
|
|
82
|
+
actual,
|
|
83
|
+
args,
|
|
84
|
+
) as ReturnType<typeof actual.projectRenewalConfigurationV2>;
|
|
85
|
+
s.pending.push(
|
|
86
|
+
promise.then(
|
|
87
|
+
(value) => {
|
|
88
|
+
s.lastC6 = value;
|
|
89
|
+
if (mode === "G03-retire") owner.retire();
|
|
90
|
+
},
|
|
91
|
+
() => {},
|
|
92
|
+
),
|
|
93
|
+
);
|
|
94
|
+
return keep(promise);
|
|
95
|
+
},
|
|
96
|
+
constructRenewalScheduleAttachmentReceiptV2(
|
|
97
|
+
...args: Parameters<
|
|
98
|
+
typeof actual.constructRenewalScheduleAttachmentReceiptV2
|
|
99
|
+
>
|
|
100
|
+
) {
|
|
101
|
+
s.ownedC3++;
|
|
102
|
+
const promise = Reflect.apply(
|
|
103
|
+
actual.constructRenewalScheduleAttachmentReceiptV2,
|
|
104
|
+
actual,
|
|
105
|
+
args,
|
|
106
|
+
) as ReturnType<
|
|
107
|
+
typeof actual.constructRenewalScheduleAttachmentReceiptV2
|
|
108
|
+
>;
|
|
109
|
+
s.pending.push(
|
|
110
|
+
promise.then(
|
|
111
|
+
() => {
|
|
112
|
+
s.C3Fulfilled++;
|
|
113
|
+
},
|
|
114
|
+
() => {
|
|
115
|
+
s.C3Rejected++;
|
|
116
|
+
},
|
|
117
|
+
),
|
|
118
|
+
);
|
|
119
|
+
return keep(promise);
|
|
120
|
+
},
|
|
121
|
+
constructRenewalConfigurationReceiptV2(
|
|
122
|
+
...args: Parameters<typeof actual.constructRenewalConfigurationReceiptV2>
|
|
123
|
+
) {
|
|
124
|
+
s.ownedC9++;
|
|
125
|
+
return keep(
|
|
126
|
+
Reflect.apply(
|
|
127
|
+
actual.constructRenewalConfigurationReceiptV2,
|
|
128
|
+
actual,
|
|
129
|
+
args,
|
|
130
|
+
) as ReturnType<typeof actual.constructRenewalConfigurationReceiptV2>,
|
|
131
|
+
);
|
|
132
|
+
},
|
|
133
|
+
}));
|
|
134
|
+
vi.doMock("../../../renewalV2/observation.js", () => ({
|
|
135
|
+
...observer,
|
|
136
|
+
inspectRenewalScheduleMaterialV2(
|
|
137
|
+
...args: Parameters<typeof observer.inspectRenewalScheduleMaterialV2>
|
|
138
|
+
) {
|
|
139
|
+
s.ownedObserver++;
|
|
140
|
+
return keep(
|
|
141
|
+
Reflect.apply(
|
|
142
|
+
observer.inspectRenewalScheduleMaterialV2,
|
|
143
|
+
observer,
|
|
144
|
+
args,
|
|
145
|
+
) as ReturnType<typeof observer.inspectRenewalScheduleMaterialV2>,
|
|
146
|
+
);
|
|
147
|
+
},
|
|
148
|
+
}));
|
|
149
|
+
return Object.freeze({ configuration: actual, observation: observer });
|
|
150
|
+
}
|
|
151
|
+
export function cleanObservationAPI() {
|
|
152
|
+
vi.doUnmock("../../../renewalV2/observation.js");
|
|
153
|
+
vi.doUnmock("../observation/record.js");
|
|
154
|
+
vi.doUnmock("../material/classifiers.js");
|
|
155
|
+
}
|
|
156
|
+
export async function joinObservationWork(s: ObservationState) {
|
|
157
|
+
const joined = await Promise.allSettled(s.pending);
|
|
158
|
+
assert.equal(joined.length, s.pending.length);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/** Fixed TEST export variants after genuine initial ACK; default positive is unmocked SSR. */
|
|
162
|
+
export async function installTrustedExportCase(
|
|
163
|
+
s: ObservationState,
|
|
164
|
+
owner: typeof import("../originalOwner.js").OWNER,
|
|
165
|
+
declaration: ObservationDeclaration,
|
|
166
|
+
) {
|
|
167
|
+
const mode = declaration.controlCase;
|
|
168
|
+
if (!mode.startsWith("ABI-") && mode !== "G03-failure") return;
|
|
169
|
+
const actual = await vi.importActual<
|
|
170
|
+
typeof import("../material/classifiers.js")
|
|
171
|
+
>("../material/classifiers.js");
|
|
172
|
+
const classify = actual.classifyOwnedRetainedInitialAttachment;
|
|
173
|
+
vi.doMock("../material/classifiers.js", () => {
|
|
174
|
+
s.exportFactoryLoads++;
|
|
175
|
+
const forward = (...args: Parameters<typeof classify>) => {
|
|
176
|
+
s.exportCalls++;
|
|
177
|
+
const promise = Reflect.apply(classify, actual, args) as ReturnType<
|
|
178
|
+
typeof classify
|
|
179
|
+
>;
|
|
180
|
+
s.pending.push(
|
|
181
|
+
promise.then(
|
|
182
|
+
() => {},
|
|
183
|
+
() => {},
|
|
184
|
+
),
|
|
185
|
+
);
|
|
186
|
+
return promise;
|
|
187
|
+
};
|
|
188
|
+
const namespace = { ...actual };
|
|
189
|
+
let value: unknown = forward;
|
|
190
|
+
if (mode === "ABI-undefined-export") value = undefined;
|
|
191
|
+
if (mode === "ABI-nonfunction-export")
|
|
192
|
+
value = Object.freeze({ declared: "NOT_A_FUNCTION" });
|
|
193
|
+
if (mode === "ABI-proxy-function-export")
|
|
194
|
+
value = new Proxy(forward, {
|
|
195
|
+
apply(target, receiver, args: Parameters<typeof classify>) {
|
|
196
|
+
s.exportProxyApplies++;
|
|
197
|
+
return Reflect.apply(target, receiver, args);
|
|
198
|
+
},
|
|
199
|
+
});
|
|
200
|
+
if (
|
|
201
|
+
[
|
|
202
|
+
"ABI-getter-once",
|
|
203
|
+
"ABI-getter-retire",
|
|
204
|
+
"ABI-getter-throws",
|
|
205
|
+
"G03-failure",
|
|
206
|
+
].includes(mode)
|
|
207
|
+
)
|
|
208
|
+
Object.defineProperty(
|
|
209
|
+
namespace,
|
|
210
|
+
"classifyOwnedRetainedInitialAttachment",
|
|
211
|
+
{
|
|
212
|
+
enumerable: true,
|
|
213
|
+
configurable: true,
|
|
214
|
+
get() {
|
|
215
|
+
s.exportReads++;
|
|
216
|
+
if (mode === "ABI-getter-retire") owner.retire();
|
|
217
|
+
if (mode === "ABI-getter-throws" || mode === "G03-failure")
|
|
218
|
+
throw Error(declaration.exportThrow);
|
|
219
|
+
return forward;
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
);
|
|
223
|
+
else
|
|
224
|
+
Object.defineProperty(
|
|
225
|
+
namespace,
|
|
226
|
+
"classifyOwnedRetainedInitialAttachment",
|
|
227
|
+
{
|
|
228
|
+
enumerable: true,
|
|
229
|
+
configurable: true,
|
|
230
|
+
value,
|
|
231
|
+
},
|
|
232
|
+
);
|
|
233
|
+
return namespace;
|
|
234
|
+
});
|
|
235
|
+
if (mode.startsWith("ABI-")) {
|
|
236
|
+
const resolved = await import("../material/classifiers.js");
|
|
237
|
+
const descriptor = Object.getOwnPropertyDescriptor(
|
|
238
|
+
resolved,
|
|
239
|
+
"classifyOwnedRetainedInitialAttachment",
|
|
240
|
+
);
|
|
241
|
+
assert(descriptor, "TRUSTED_EXPORT_VARIANT_MUST_RESOLVE");
|
|
242
|
+
s.exportDescriptorData = Object.prototype.hasOwnProperty.call(
|
|
243
|
+
descriptor,
|
|
244
|
+
"value",
|
|
245
|
+
);
|
|
246
|
+
s.exportDescriptorGetter = typeof descriptor.get === "function";
|
|
247
|
+
const getter = [
|
|
248
|
+
"ABI-getter-once",
|
|
249
|
+
"ABI-getter-retire",
|
|
250
|
+
"ABI-getter-throws",
|
|
251
|
+
].includes(mode);
|
|
252
|
+
assert.equal(
|
|
253
|
+
s.exportDescriptorGetter,
|
|
254
|
+
getter,
|
|
255
|
+
"DECLARED_ABI_SHAPE_BEFORE_TARGET",
|
|
256
|
+
);
|
|
257
|
+
assert.equal(
|
|
258
|
+
s.exportDescriptorData,
|
|
259
|
+
!getter,
|
|
260
|
+
"DECLARED_ABI_SHAPE_BEFORE_TARGET",
|
|
261
|
+
);
|
|
262
|
+
assert.equal(
|
|
263
|
+
s.exportReads,
|
|
264
|
+
0,
|
|
265
|
+
"descriptor inspection never invokes getter",
|
|
266
|
+
);
|
|
267
|
+
assert.equal(s.exportCalls, 0);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { types } from "node:util";
|
|
3
|
+
import {
|
|
4
|
+
declareObservationPositive,
|
|
5
|
+
type ObservationControl,
|
|
6
|
+
} from "./observationDeclarations.js";
|
|
7
|
+
import { configurePreflightFixture } from "./configurePreflightOperation.js";
|
|
8
|
+
import { data, deepFreeze } from "./configurePreflightControls.js";
|
|
9
|
+
import { observationHTTP } from "./observationHTTP.js";
|
|
10
|
+
import {
|
|
11
|
+
observationState,
|
|
12
|
+
observeObservationAPI,
|
|
13
|
+
joinObservationWork,
|
|
14
|
+
cleanObservationAPI,
|
|
15
|
+
installTrustedExportCase,
|
|
16
|
+
} from "./observationObservations.js";
|
|
17
|
+
import { vi } from "vitest";
|
|
18
|
+
import { logObservationPrerequisites } from "./observationAssertions.js";
|
|
19
|
+
import { controlOperation } from "./observationProbe.js";
|
|
20
|
+
|
|
21
|
+
/** Complete positive setup; no module reset after actual Owner/ENTRY/ACK capture. */
|
|
22
|
+
export async function observationFixture(
|
|
23
|
+
controlCase: ObservationControl = "positive",
|
|
24
|
+
) {
|
|
25
|
+
const declaration = declareObservationPositive(controlCase);
|
|
26
|
+
const state = observationState();
|
|
27
|
+
const prerequisite = await configurePreflightFixture("positive");
|
|
28
|
+
try {
|
|
29
|
+
const { OWNER } = await import("../originalOwner.js");
|
|
30
|
+
assert.equal(OWNER, prerequisite.OWNER);
|
|
31
|
+
const basis = OWNER.basis;
|
|
32
|
+
assert.equal(basis, prerequisite.basis);
|
|
33
|
+
const source = await import("../operations/sourceOperations.js");
|
|
34
|
+
assert.equal(source.COMPILED_INITIAL_ENTRIES.length, 1);
|
|
35
|
+
const entry = source.COMPILED_INITIAL_ENTRIES[0];
|
|
36
|
+
assert(entry && typeof entry === "object" && !types.isProxy(entry));
|
|
37
|
+
const retained = Object.getOwnPropertyDescriptor(entry, "coversRetained");
|
|
38
|
+
assert(
|
|
39
|
+
retained && "value" in retained && typeof retained.value === "function",
|
|
40
|
+
);
|
|
41
|
+
const initialOperation = data(source.loadFixedInitialOperation());
|
|
42
|
+
assert.equal(initialOperation.owner, OWNER);
|
|
43
|
+
assert.equal(
|
|
44
|
+
initialOperation.originAssociation,
|
|
45
|
+
source.ORIGINAL_ORIGIN_ASSOCIATION,
|
|
46
|
+
);
|
|
47
|
+
assert(
|
|
48
|
+
source.ORIGINAL_ORIGIN_ASSOCIATION &&
|
|
49
|
+
!types.isProxy(source.ORIGINAL_ORIGIN_ASSOCIATION),
|
|
50
|
+
);
|
|
51
|
+
assert.deepEqual(prerequisite.declared, declaration.baseline);
|
|
52
|
+
assert.equal(
|
|
53
|
+
data(prerequisite.initialOutput).status,
|
|
54
|
+
"attach_acknowledged",
|
|
55
|
+
);
|
|
56
|
+
assert.equal(prerequisite.state.records.length, 3);
|
|
57
|
+
assert.equal(
|
|
58
|
+
prerequisite.state.calls.filter((r) => r.method === "POST").length,
|
|
59
|
+
1,
|
|
60
|
+
);
|
|
61
|
+
const record = prerequisite.expectedRecord;
|
|
62
|
+
assert.equal(record.attachReceipt, prerequisite.acknowledgement);
|
|
63
|
+
assert.equal(prerequisite.boundRecord, record);
|
|
64
|
+
assert.deepEqual(
|
|
65
|
+
record.originalBundle,
|
|
66
|
+
declaration.baseline.original.originalBundle,
|
|
67
|
+
);
|
|
68
|
+
assert.deepEqual(
|
|
69
|
+
data(prerequisite.acknowledgement).providerSnapshot,
|
|
70
|
+
declaration.reads.schedule,
|
|
71
|
+
);
|
|
72
|
+
const now = OWNER.check();
|
|
73
|
+
assert.equal(now.wallMs, declaration.expectedOwnerAt);
|
|
74
|
+
assert(now.wallMs > declaration.originalFirstAt + 60000);
|
|
75
|
+
assert.equal(now.nowSeconds - declaration.retentionEpoch, 61);
|
|
76
|
+
assert.equal(prerequisite.state.pairLoads, 0);
|
|
77
|
+
assert.equal(prerequisite.state.readonlyCalls, 0);
|
|
78
|
+
assert.equal(prerequisite.state.coverage, 0);
|
|
79
|
+
assert.deepEqual(prerequisite.deltas(), { GET: 0, POST: 0, records: 0 });
|
|
80
|
+
// No preflight capture/invoke is called: its readonly Schedule-last pair stays unused.
|
|
81
|
+
const { configuration: actual, observation: observer } =
|
|
82
|
+
await observeObservationAPI(state, OWNER, controlCase);
|
|
83
|
+
OWNER.check();
|
|
84
|
+
const desired = await actual.projectRenewalConfigurationV2(
|
|
85
|
+
record.configuration,
|
|
86
|
+
);
|
|
87
|
+
OWNER.check();
|
|
88
|
+
assert.equal(
|
|
89
|
+
desired.status,
|
|
90
|
+
"projected_configure_request",
|
|
91
|
+
"ACTUAL_CURRENT_C6_PREREQUISITE",
|
|
92
|
+
);
|
|
93
|
+
assert.deepEqual(desired, record.request);
|
|
94
|
+
const input = deepFreeze({
|
|
95
|
+
configuration: record.configuration,
|
|
96
|
+
reads: declaration.reads,
|
|
97
|
+
});
|
|
98
|
+
const oracle = await observer.inspectRenewalScheduleMaterialV2(input);
|
|
99
|
+
OWNER.check();
|
|
100
|
+
assert.deepEqual(
|
|
101
|
+
oracle,
|
|
102
|
+
declaration.expected,
|
|
103
|
+
"ACTUAL_CURRENT_OBSERVER_APPLICABILITY",
|
|
104
|
+
);
|
|
105
|
+
const http = await observationHTTP(declaration, OWNER);
|
|
106
|
+
OWNER.check();
|
|
107
|
+
const expectedOutput = deepFreeze({
|
|
108
|
+
status: "owned_observation_data",
|
|
109
|
+
observation: declaration.expected,
|
|
110
|
+
reads: declaration.reads,
|
|
111
|
+
observedAt: now.nowSeconds,
|
|
112
|
+
retainedConfigureAcknowledgement: "absent",
|
|
113
|
+
operationalAuthority: false,
|
|
114
|
+
});
|
|
115
|
+
const observationEntry = Object.freeze({
|
|
116
|
+
originalEntry: entry,
|
|
117
|
+
coversObservation(
|
|
118
|
+
candidateRecord: unknown,
|
|
119
|
+
candidateInput: unknown,
|
|
120
|
+
result: unknown,
|
|
121
|
+
) {
|
|
122
|
+
state.coverage++;
|
|
123
|
+
assert.deepEqual(candidateRecord, record);
|
|
124
|
+
assert.deepEqual(candidateInput, input);
|
|
125
|
+
assert.deepEqual(result, oracle);
|
|
126
|
+
return true;
|
|
127
|
+
},
|
|
128
|
+
});
|
|
129
|
+
// Prospective TEST tuple only, not registered in an alternate registry or Source.
|
|
130
|
+
const operation = Object.freeze({
|
|
131
|
+
owner: OWNER,
|
|
132
|
+
originAssociation: source.ORIGINAL_ORIGIN_ASSOCIATION,
|
|
133
|
+
originalEntry: entry,
|
|
134
|
+
observationEntry,
|
|
135
|
+
record,
|
|
136
|
+
actualAttachAcknowledgement: prerequisite.acknowledgement,
|
|
137
|
+
readTransport: http.delegate,
|
|
138
|
+
});
|
|
139
|
+
assert.equal(operation.originalEntry, source.COMPILED_INITIAL_ENTRIES[0]);
|
|
140
|
+
assert.equal(
|
|
141
|
+
operation.record.attachReceipt,
|
|
142
|
+
operation.actualAttachAcknowledgement,
|
|
143
|
+
);
|
|
144
|
+
assert.equal(
|
|
145
|
+
Object.prototype.hasOwnProperty.call(
|
|
146
|
+
operation,
|
|
147
|
+
"configureAcknowledgement",
|
|
148
|
+
),
|
|
149
|
+
false,
|
|
150
|
+
);
|
|
151
|
+
assert.deepEqual(
|
|
152
|
+
[
|
|
153
|
+
state.sourceLoads,
|
|
154
|
+
state.ownedC6,
|
|
155
|
+
state.ownedC3,
|
|
156
|
+
state.ownedC9,
|
|
157
|
+
state.ownedObserver,
|
|
158
|
+
state.coverage,
|
|
159
|
+
state.targetCalls,
|
|
160
|
+
],
|
|
161
|
+
[0, 0, 0, 0, 0, 0, 0],
|
|
162
|
+
);
|
|
163
|
+
assert.equal(OWNER.basis, basis);
|
|
164
|
+
logObservationPrerequisites({
|
|
165
|
+
initialOutput: prerequisite.initialOutput,
|
|
166
|
+
record,
|
|
167
|
+
input,
|
|
168
|
+
expectedOutput,
|
|
169
|
+
calls: http.calls.length,
|
|
170
|
+
targetCalls: state.targetCalls,
|
|
171
|
+
});
|
|
172
|
+
console.log(
|
|
173
|
+
JSON.stringify({
|
|
174
|
+
kind: "OBSERVATION_CONTROL_DECLARATION",
|
|
175
|
+
controlCase,
|
|
176
|
+
baselinePrerequisitesOnly: controlCase !== "positive",
|
|
177
|
+
expectedOwner: declaration.expectedOwner,
|
|
178
|
+
rawFaultRecipeDeclaredBeforeConstructors: true,
|
|
179
|
+
operationalAuthority: false,
|
|
180
|
+
}),
|
|
181
|
+
);
|
|
182
|
+
const sourceOperation = controlOperation(operation, declaration, state);
|
|
183
|
+
await installTrustedExportCase(state, OWNER, declaration);
|
|
184
|
+
OWNER.check();
|
|
185
|
+
// Fixed TEST Source only. Preserve the writer's and initial actor's aliases.
|
|
186
|
+
const normalSource = await vi.importActual<
|
|
187
|
+
typeof import("../operations/sourceOperations.js")
|
|
188
|
+
>("../operations/sourceOperations.js");
|
|
189
|
+
vi.doMock("../operations/sourceOperations.js", () => ({
|
|
190
|
+
...normalSource,
|
|
191
|
+
...source,
|
|
192
|
+
COMPILED_OBSERVATION_ENTRIES: Object.freeze([observationEntry]),
|
|
193
|
+
loadFixedObservationOperation() {
|
|
194
|
+
assert.equal(arguments.length, 0);
|
|
195
|
+
state.sourceLoads++;
|
|
196
|
+
return sourceOperation;
|
|
197
|
+
},
|
|
198
|
+
}));
|
|
199
|
+
const actor = await import("../observation/actor.js");
|
|
200
|
+
OWNER.check();
|
|
201
|
+
return {
|
|
202
|
+
prerequisite,
|
|
203
|
+
actual,
|
|
204
|
+
actor,
|
|
205
|
+
controlCase,
|
|
206
|
+
sourceOperation,
|
|
207
|
+
declaration,
|
|
208
|
+
state,
|
|
209
|
+
OWNER,
|
|
210
|
+
basis,
|
|
211
|
+
record,
|
|
212
|
+
input,
|
|
213
|
+
operation,
|
|
214
|
+
http,
|
|
215
|
+
expectedOutput,
|
|
216
|
+
capture(...args: unknown[]) {
|
|
217
|
+
const handle = Reflect.apply(
|
|
218
|
+
actor.captureOwnedRenewalObservationV2,
|
|
219
|
+
actor,
|
|
220
|
+
args,
|
|
221
|
+
) as ReturnType<typeof actor.captureOwnedRenewalObservationV2>;
|
|
222
|
+
return Object.freeze({
|
|
223
|
+
invoke(...invokeArgs: unknown[]) {
|
|
224
|
+
state.targetCalls++;
|
|
225
|
+
return Reflect.apply(
|
|
226
|
+
handle.invoke,
|
|
227
|
+
handle,
|
|
228
|
+
invokeArgs,
|
|
229
|
+
) as ReturnType<typeof handle.invoke>;
|
|
230
|
+
},
|
|
231
|
+
});
|
|
232
|
+
},
|
|
233
|
+
async cleanup() {
|
|
234
|
+
try {
|
|
235
|
+
await http.cleanup();
|
|
236
|
+
await joinObservationWork(state);
|
|
237
|
+
assert.equal(record.attachReceipt, prerequisite.acknowledgement);
|
|
238
|
+
if (declaration.expectedOwner === "retired")
|
|
239
|
+
assert.throws(() => OWNER.basis, {
|
|
240
|
+
name: "Error",
|
|
241
|
+
message: "ORIGINAL_OWNER_STOP",
|
|
242
|
+
});
|
|
243
|
+
else assert.equal(OWNER.basis, basis);
|
|
244
|
+
assert.equal(prerequisite.state.records.length, 3);
|
|
245
|
+
assert.equal(
|
|
246
|
+
prerequisite.state.calls.filter((r) => r.method === "POST").length,
|
|
247
|
+
1,
|
|
248
|
+
);
|
|
249
|
+
} finally {
|
|
250
|
+
http.hold.release.resolve();
|
|
251
|
+
cleanObservationAPI();
|
|
252
|
+
await prerequisite.cleanup();
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
};
|
|
256
|
+
} catch (error) {
|
|
257
|
+
cleanObservationAPI();
|
|
258
|
+
await prerequisite.cleanup();
|
|
259
|
+
throw error;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
export type ObservationFixture = Awaited<ReturnType<typeof observationFixture>>;
|