@fantastic.dev/better-stripe 0.90.0 → 0.92.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/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 +14 -0
- package/dist/client/billing/renewalAttach/internal/configure/actor.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/configure/actor.js +444 -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/ownedContinuation.d.ts +3 -0
- package/dist/client/billing/renewalAttach/internal/configure/ownedContinuation.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/configure/ownedContinuation.js +61 -0
- package/dist/client/billing/renewalAttach/internal/configure/ownedContinuation.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 +383 -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 +216 -0
- package/dist/client/billing/renewalAttach/internal/observation/capture.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/observation/configureAcknowledgement.d.ts +5 -0
- package/dist/client/billing/renewalAttach/internal/observation/configureAcknowledgement.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/observation/configureAcknowledgement.js +11 -0
- package/dist/client/billing/renewalAttach/internal/observation/configureAcknowledgement.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 +84 -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/payoutExecutionTestHelpers.d.ts +16 -16
- package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +32 -32
- package/dist/component/balanceFunding/internal/actions.d.ts +11 -11
- package/dist/component/financialObservations/settlementHelpers.d.ts +3 -3
- package/dist/component/usage/allowance.fixtures.d.ts +16 -16
- package/dist/component/usageCredits/accounting.fixtures.d.ts +16 -16
- package/docs/renewal-context-reads.md +26 -8
- package/docs/renewal-material-observation.md +58 -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 +586 -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/ownedContinuation.ts +56 -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 +487 -0
- package/src/client/billing/renewalAttach/internal/observation/capture.ts +251 -0
- package/src/client/billing/renewalAttach/internal/observation/configureAcknowledgement.ts +20 -0
- package/src/client/billing/renewalAttach/internal/observation/observation.integration.test.ts +220 -0
- package/src/client/billing/renewalAttach/internal/observation/observationConfigureACK.integration.test.ts +36 -0
- package/src/client/billing/renewalAttach/internal/observation/observationConfigureACKControls.integration.test.ts +48 -0
- package/src/client/billing/renewalAttach/internal/observation/observationConfigureACKLifecycle.integration.test.ts +44 -0
- package/src/client/billing/renewalAttach/internal/observation/observationConfiguredHistory.integration.test.ts +34 -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 +107 -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 +537 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteBarriers.ts +125 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteDeclarations.ts +325 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteDelegate.ts +38 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteHistory.ts +471 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteObservations.ts +515 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteOperation.ts +587 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationAssertions.ts +211 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfigureACKAssertions.ts +115 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfigureACKDeclarations.ts +141 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfigureACKLifecycleAssertions.ts +74 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfigureACKLifecycleDeclarations.ts +79 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfigureACKLifecycleInstrumentation.ts +207 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfigureACKLifecycleOperation.ts +494 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfigureACKOperation.ts +452 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfiguredHistoryAssertions.ts +88 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfiguredHistoryDeclarations.ts +170 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfiguredHistoryNative.ts +99 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfiguredHistoryOperation.ts +411 -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,211 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { data } from "./configurePreflightControls.js";
|
|
3
|
+
import { assertFit } from "./configurePreflightAssertions.js";
|
|
4
|
+
import type { ObservationFixture } from "./observationOperation.js";
|
|
5
|
+
|
|
6
|
+
export function logObservationPrerequisites(h: {
|
|
7
|
+
initialOutput: unknown;
|
|
8
|
+
record: unknown;
|
|
9
|
+
input: unknown;
|
|
10
|
+
expectedOutput: unknown;
|
|
11
|
+
calls: number;
|
|
12
|
+
targetCalls: number;
|
|
13
|
+
}) {
|
|
14
|
+
assert.equal(h.calls, 0);
|
|
15
|
+
assert.equal(h.targetCalls, 0);
|
|
16
|
+
for (const part of [
|
|
17
|
+
"initialOutput",
|
|
18
|
+
"record",
|
|
19
|
+
"input",
|
|
20
|
+
"expectedOutput",
|
|
21
|
+
] as const)
|
|
22
|
+
console.log(
|
|
23
|
+
JSON.stringify({
|
|
24
|
+
kind: "REPOSITORY_OBSERVATION_PREREQUISITE_METRICS",
|
|
25
|
+
part,
|
|
26
|
+
...assertFit(h[part]),
|
|
27
|
+
}),
|
|
28
|
+
);
|
|
29
|
+
console.log(
|
|
30
|
+
JSON.stringify({
|
|
31
|
+
kind: "REPOSITORY_OBSERVATION_PREREQUISITES",
|
|
32
|
+
actualInitialACK: true,
|
|
33
|
+
actualSourceENTRYAndOwner: true,
|
|
34
|
+
actualACKPointer: true,
|
|
35
|
+
actualCurrentC6: true,
|
|
36
|
+
directUnchangedObserver: "attached_unconfigured_match",
|
|
37
|
+
observationHTTP: 0,
|
|
38
|
+
targetCalls: 0,
|
|
39
|
+
retainedConfigureAcknowledgement: "absent",
|
|
40
|
+
operationalAuthority: false,
|
|
41
|
+
}),
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function assertObservationOutput(h: ObservationFixture, value: unknown) {
|
|
46
|
+
assert.deepEqual(value, h.expectedOutput);
|
|
47
|
+
const out = data(value);
|
|
48
|
+
assert.notEqual(value, h.expectedOutput);
|
|
49
|
+
assert.notEqual(out.reads, h.declaration.reads);
|
|
50
|
+
assert.deepEqual(
|
|
51
|
+
Object.keys(out).sort(),
|
|
52
|
+
[
|
|
53
|
+
"status",
|
|
54
|
+
"observation",
|
|
55
|
+
"reads",
|
|
56
|
+
"observedAt",
|
|
57
|
+
"retainedConfigureAcknowledgement",
|
|
58
|
+
"operationalAuthority",
|
|
59
|
+
].sort(),
|
|
60
|
+
);
|
|
61
|
+
assert.equal(
|
|
62
|
+
Object.prototype.hasOwnProperty.call(h.input, "configureReceipt"),
|
|
63
|
+
false,
|
|
64
|
+
);
|
|
65
|
+
assert.equal(h.state.targetCalls, 1);
|
|
66
|
+
assert.equal(h.state.sourceLoads, 1);
|
|
67
|
+
assert.equal(h.http.calls.length, h.declaration.rows.length);
|
|
68
|
+
assert.equal(h.declaration.rows.length, 6);
|
|
69
|
+
for (const [i, row] of h.http.calls.entries()) {
|
|
70
|
+
assert.equal(row.method, "GET");
|
|
71
|
+
assert.equal(row.path, h.declaration.rows[i]!.path);
|
|
72
|
+
}
|
|
73
|
+
assert.equal(h.state.ownedC6, 1);
|
|
74
|
+
assert.equal(h.state.ownedC3, 1);
|
|
75
|
+
assert.equal(h.state.ownedC9, 0);
|
|
76
|
+
assert.equal(h.state.ownedObserver, 1);
|
|
77
|
+
assert.equal(h.state.coverage, 1);
|
|
78
|
+
const sample = h.http.finalSample();
|
|
79
|
+
assert(sample);
|
|
80
|
+
assert.equal(out.observedAt, Math.floor(sample.wallMs / 1000));
|
|
81
|
+
assert.equal(h.prerequisite.deltas().records, 0);
|
|
82
|
+
assert.equal(h.prerequisite.deltas().POST, 0);
|
|
83
|
+
assertFit(h.record);
|
|
84
|
+
assertFit(h.input);
|
|
85
|
+
assertFit(value);
|
|
86
|
+
const frozen = (x: unknown) => {
|
|
87
|
+
if (x && typeof x === "object") {
|
|
88
|
+
assert(Object.isFrozen(x));
|
|
89
|
+
for (const child of Object.values(x)) frozen(child);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
frozen(value);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export function assertNoObservationReads(h: ObservationFixture) {
|
|
96
|
+
assert.equal(h.http.calls.length, 0);
|
|
97
|
+
assert.equal(h.http.argsSeen.length, 0);
|
|
98
|
+
assert.equal(h.http.delegateEntriesAfterOwner(), 0);
|
|
99
|
+
assert.equal(h.http.originals.length, 0);
|
|
100
|
+
assert.equal(h.prerequisite.deltas().POST, 0);
|
|
101
|
+
assert.equal(h.prerequisite.deltas().records, 0);
|
|
102
|
+
assert.equal(h.state.ownedC9, 0);
|
|
103
|
+
assert.equal(h.state.ownedObserver, 0);
|
|
104
|
+
assert.equal(h.state.coverage, 0);
|
|
105
|
+
}
|
|
106
|
+
export function assertPrivateObservationError(
|
|
107
|
+
error: unknown,
|
|
108
|
+
expected:
|
|
109
|
+
| "OWNED_OBSERVATION_STOP"
|
|
110
|
+
| "OWNED_OBSERVATION_ONCE"
|
|
111
|
+
| "ORIGINAL_OWNER_STOP"
|
|
112
|
+
| "MATERIAL_V2_UNSUPPORTED" = "OWNED_OBSERVATION_STOP",
|
|
113
|
+
) {
|
|
114
|
+
assert(error instanceof Error);
|
|
115
|
+
assert.equal(error.message, expected);
|
|
116
|
+
assert.notEqual(error.message, "OWNED_OBSERVATION_PROVIDER_REJECTED");
|
|
117
|
+
assert.equal(Object.prototype.hasOwnProperty.call(error, "failure"), false);
|
|
118
|
+
}
|
|
119
|
+
export async function observationOutcome<T>(promise: Promise<T>) {
|
|
120
|
+
return promise.then(
|
|
121
|
+
(value) => ({ ok: true as const, value }),
|
|
122
|
+
(error: unknown) => ({ ok: false as const, error }),
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export function assertObservationReadPrefix(
|
|
127
|
+
h: ObservationFixture,
|
|
128
|
+
count: number,
|
|
129
|
+
) {
|
|
130
|
+
assert.equal(h.declaration.rows.length, 6);
|
|
131
|
+
assert.equal(h.http.calls.length, count);
|
|
132
|
+
assert.equal(h.http.argsSeen.length, count);
|
|
133
|
+
assert.equal(h.http.delegateEntries(), count);
|
|
134
|
+
assert.equal(h.http.delegateEntriesAfterOwner(), count);
|
|
135
|
+
assert.equal(h.http.originals.length, count);
|
|
136
|
+
for (let i = 0; i < count; i++) {
|
|
137
|
+
const row = h.declaration.rows[i]!;
|
|
138
|
+
assert.deepEqual(h.http.calls[i], { method: "GET", path: row.path });
|
|
139
|
+
assert.deepEqual(h.http.argsSeen[i], [
|
|
140
|
+
"GET",
|
|
141
|
+
row.path,
|
|
142
|
+
undefined,
|
|
143
|
+
row.options,
|
|
144
|
+
]);
|
|
145
|
+
assert(h.http.originals[i] instanceof Promise);
|
|
146
|
+
}
|
|
147
|
+
assert.equal(h.state.sourceLoads, 1);
|
|
148
|
+
assert.equal(h.state.ownedC6, 1);
|
|
149
|
+
assert.equal(h.state.ownedC3, 1);
|
|
150
|
+
assert.equal(h.state.C3Fulfilled, 1);
|
|
151
|
+
assert.equal(h.state.recordVerificationCompleted, 1);
|
|
152
|
+
assert.equal(h.state.ownedObserver, 0);
|
|
153
|
+
assert.equal(h.state.coverage, 0);
|
|
154
|
+
assert.equal(h.state.ownedC9, 0);
|
|
155
|
+
assert.equal(h.prerequisite.state.pairLoads, 0);
|
|
156
|
+
assert.equal(h.prerequisite.state.readonlyCalls, 0);
|
|
157
|
+
assert.equal(h.prerequisite.deltas().POST, 0);
|
|
158
|
+
assert.equal(h.prerequisite.deltas().records, 0);
|
|
159
|
+
}
|
|
160
|
+
export function assertObservationProviderFailure(
|
|
161
|
+
h: ObservationFixture,
|
|
162
|
+
error: unknown,
|
|
163
|
+
) {
|
|
164
|
+
assert(error instanceof Error);
|
|
165
|
+
assert.equal(error.message, "OWNED_OBSERVATION_PROVIDER_REJECTED");
|
|
166
|
+
assert.equal(Object.prototype.hasOwnProperty.call(error, "cause"), false);
|
|
167
|
+
const descriptor = Object.getOwnPropertyDescriptor(error, "failure");
|
|
168
|
+
assert(
|
|
169
|
+
descriptor &&
|
|
170
|
+
"value" in descriptor &&
|
|
171
|
+
!descriptor.enumerable &&
|
|
172
|
+
!descriptor.writable &&
|
|
173
|
+
!descriptor.configurable,
|
|
174
|
+
);
|
|
175
|
+
const row = h.declaration.rows[h.declaration.transport.ordinal - 1]!;
|
|
176
|
+
const failure = data(descriptor.value);
|
|
177
|
+
assert.deepEqual(failure, {
|
|
178
|
+
category: "provider_rejected",
|
|
179
|
+
phase: "read",
|
|
180
|
+
resource: row.resource,
|
|
181
|
+
ordinal: row.ordinal,
|
|
182
|
+
request: {
|
|
183
|
+
method: "GET",
|
|
184
|
+
path: row.path,
|
|
185
|
+
apiVersion: h.declaration.baseline.apiVersion,
|
|
186
|
+
},
|
|
187
|
+
diagnostics: h.declaration.transport.expectedDiagnostics,
|
|
188
|
+
outcome: "unknown",
|
|
189
|
+
operationalAuthority: false,
|
|
190
|
+
});
|
|
191
|
+
assert.deepEqual(
|
|
192
|
+
Object.keys(failure).sort(),
|
|
193
|
+
[
|
|
194
|
+
"category",
|
|
195
|
+
"phase",
|
|
196
|
+
"resource",
|
|
197
|
+
"ordinal",
|
|
198
|
+
"request",
|
|
199
|
+
"diagnostics",
|
|
200
|
+
"outcome",
|
|
201
|
+
"operationalAuthority",
|
|
202
|
+
].sort(),
|
|
203
|
+
);
|
|
204
|
+
for (const value of [failure, failure.request, failure.diagnostics])
|
|
205
|
+
assert(Object.isFrozen(value));
|
|
206
|
+
for (const key of ["rawError", "rawReply", "headers", "token"])
|
|
207
|
+
assert.equal(Object.prototype.hasOwnProperty.call(failure, key), false);
|
|
208
|
+
assert.equal(h.http.actualError(), h.http.transformedError());
|
|
209
|
+
assert(h.http.actualError() instanceof Error);
|
|
210
|
+
assert.equal(h.http.errorConfigurationVerified(), 1);
|
|
211
|
+
}
|
package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfigureACKAssertions.ts
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { data } from "./configurePreflightControls.js";
|
|
3
|
+
import { assertFit } from "./configurePreflightAssertions.js";
|
|
4
|
+
import type { optionalConfigureACK18Fixture } from "./observationConfigureACKOperation.js";
|
|
5
|
+
|
|
6
|
+
export function assertOptionalConfigureACK18(
|
|
7
|
+
h: Awaited<ReturnType<typeof optionalConfigureACK18Fixture>>,
|
|
8
|
+
output: unknown,
|
|
9
|
+
) {
|
|
10
|
+
assert.deepEqual(output, h.expectedOutput);
|
|
11
|
+
const out = data(output);
|
|
12
|
+
assert.deepEqual(
|
|
13
|
+
Object.keys(out).sort(),
|
|
14
|
+
[
|
|
15
|
+
"status",
|
|
16
|
+
"observation",
|
|
17
|
+
"reads",
|
|
18
|
+
"observedAt",
|
|
19
|
+
"retainedConfigureAcknowledgement",
|
|
20
|
+
"operationalAuthority",
|
|
21
|
+
].sort(),
|
|
22
|
+
);
|
|
23
|
+
assert.equal(out.retainedConfigureAcknowledgement, "present");
|
|
24
|
+
assert.equal(out.operationalAuthority, false);
|
|
25
|
+
assert.equal(h.counters.target, 1);
|
|
26
|
+
assert.equal(h.counters.source, 1);
|
|
27
|
+
assert.equal(h.counters.coverage, 1);
|
|
28
|
+
assert.equal(h.counters.observer, 1);
|
|
29
|
+
assert.equal(h.counters.C6, 1);
|
|
30
|
+
assert.equal(h.counters.C3, 1);
|
|
31
|
+
assert.equal(h.counters.C9, 1);
|
|
32
|
+
assert.equal(h.counters.lookup, 1);
|
|
33
|
+
assert.notEqual(output, h.expectedOutput);
|
|
34
|
+
assert.notEqual(out.reads, h.declaration.reads);
|
|
35
|
+
assert.notEqual(data(out.reads).schedule, h.declaration.reads.schedule);
|
|
36
|
+
assert.notEqual(out.observation, data(h.expectedOutput).observation);
|
|
37
|
+
assert.equal(h.writer.writeState.explicitC9, h.writerBefore.c9);
|
|
38
|
+
assert.equal(h.calls.length, 6);
|
|
39
|
+
assert.equal(h.promises.length, 6);
|
|
40
|
+
assert.deepEqual(
|
|
41
|
+
h.calls,
|
|
42
|
+
h.declaration.rows.map((row) => ({ method: "GET", path: row.path })),
|
|
43
|
+
);
|
|
44
|
+
assert.equal(h.writer.writeState.records.length, h.writerBefore.records);
|
|
45
|
+
assert.equal(
|
|
46
|
+
h.writer.writeState.calls.filter((row) => row.method === "POST").length,
|
|
47
|
+
h.writerBefore.posts,
|
|
48
|
+
);
|
|
49
|
+
assert.equal(h.writer.state.records.length, h.setupBefore.records);
|
|
50
|
+
assert.equal(
|
|
51
|
+
h.writer.state.calls.filter((row) => row.method === "POST").length,
|
|
52
|
+
h.setupBefore.posts,
|
|
53
|
+
);
|
|
54
|
+
assert.equal(h.writer.OWNER.basis, h.basis);
|
|
55
|
+
assert.equal(h.operation.configureOperation, h.writer.fixedAOperation());
|
|
56
|
+
assert.equal(h.operation.configureAcknowledgement, h.writerACK);
|
|
57
|
+
assert.equal(
|
|
58
|
+
h.operation.actualAttachAcknowledgement,
|
|
59
|
+
h.writer.acknowledgement,
|
|
60
|
+
);
|
|
61
|
+
assertFit(output);
|
|
62
|
+
const frozen = (value: unknown) => {
|
|
63
|
+
if (value && typeof value === "object") {
|
|
64
|
+
assert(Object.isFrozen(value));
|
|
65
|
+
for (const child of Object.values(value)) frozen(child);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
frozen(output);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function assertOptionalConfigureACKRefusal(
|
|
72
|
+
h: Awaited<ReturnType<typeof optionalConfigureACK18Fixture>>,
|
|
73
|
+
error: unknown,
|
|
74
|
+
) {
|
|
75
|
+
assert.notEqual(h.selected.stage, "positive");
|
|
76
|
+
assert(error instanceof Error);
|
|
77
|
+
assert.equal(error.message, "OWNED_OBSERVATION_STOP");
|
|
78
|
+
for (const key of [
|
|
79
|
+
"failure",
|
|
80
|
+
"cause",
|
|
81
|
+
"rawError",
|
|
82
|
+
"rawReply",
|
|
83
|
+
"headers",
|
|
84
|
+
"token",
|
|
85
|
+
])
|
|
86
|
+
assert.equal(Object.prototype.hasOwnProperty.call(error, key), false);
|
|
87
|
+
const grammar = h.selected.stage === "grammar";
|
|
88
|
+
assert.deepEqual(h.counters, {
|
|
89
|
+
source: 1,
|
|
90
|
+
target: 1,
|
|
91
|
+
coverage: 0,
|
|
92
|
+
observer: 0,
|
|
93
|
+
C6: grammar ? 0 : 1,
|
|
94
|
+
C3: grammar ? 0 : 1,
|
|
95
|
+
C9: 0,
|
|
96
|
+
lookup: grammar ? 0 : 1,
|
|
97
|
+
});
|
|
98
|
+
assert.equal(h.calls.length, 0);
|
|
99
|
+
assert.equal(h.promises.length, 0);
|
|
100
|
+
assert.equal(h.writer.writeState.explicitC9, h.writerBefore.c9);
|
|
101
|
+
assert.equal(h.writer.writeState.records.length, h.writerBefore.records);
|
|
102
|
+
assert.equal(
|
|
103
|
+
h.writer.writeState.calls.filter((row) => row.method === "POST").length,
|
|
104
|
+
h.writerBefore.posts,
|
|
105
|
+
);
|
|
106
|
+
assert.equal(h.writer.state.records.length, h.setupBefore.records);
|
|
107
|
+
assert.equal(
|
|
108
|
+
h.writer.state.calls.filter((row) => row.method === "POST").length,
|
|
109
|
+
h.setupBefore.posts,
|
|
110
|
+
);
|
|
111
|
+
assert.equal(h.writer.OWNER.basis, h.basis);
|
|
112
|
+
assert.equal(h.writer.OWNER.check().retired, false);
|
|
113
|
+
assert.equal(h.operation.configureOperation, h.writer.fixedAOperation());
|
|
114
|
+
assert.equal(h.operation.configureAcknowledgement, h.writerACK);
|
|
115
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { declareConfigureWriteCase } from "./configureWriteDeclarations.js";
|
|
3
|
+
import { deepFreeze } from "./configurePreflightControls.js";
|
|
4
|
+
|
|
5
|
+
export const optionalConfigureACKControlCases = [
|
|
6
|
+
"actual19-default-null",
|
|
7
|
+
"actual19-default-object",
|
|
8
|
+
"cloned-returnedACK",
|
|
9
|
+
"foreign-operation",
|
|
10
|
+
"cloned-actual-operation",
|
|
11
|
+
"raw-C9-input-instead-of-returnedACK",
|
|
12
|
+
"own-ACK-undefined",
|
|
13
|
+
"own-ACK-null",
|
|
14
|
+
"ACK-present-operation-absent",
|
|
15
|
+
"operation-present-ACK-absent",
|
|
16
|
+
] as const;
|
|
17
|
+
export type OptionalConfigureACKControl =
|
|
18
|
+
(typeof optionalConfigureACKControlCases)[number];
|
|
19
|
+
export type OptionalConfigureACKCase =
|
|
20
|
+
OptionalConfigureACKControl | "actual18-default-absent";
|
|
21
|
+
|
|
22
|
+
/** Only raw/data recipes here; all precede actual setup constructors. */
|
|
23
|
+
function declareOptionalConfigureACK(
|
|
24
|
+
writerMode: "ack" | "defaults-null" | "defaults-object",
|
|
25
|
+
) {
|
|
26
|
+
const writer = declareConfigureWriteCase(writerMode);
|
|
27
|
+
const b = writer.currentBundle;
|
|
28
|
+
assert.equal(typeof writer.response.id, "string");
|
|
29
|
+
const scheduleId = writer.response.id;
|
|
30
|
+
assert(typeof scheduleId === "string");
|
|
31
|
+
const reads = {
|
|
32
|
+
schedule: structuredClone(writer.response),
|
|
33
|
+
subscription: structuredClone(b.wireSubscription),
|
|
34
|
+
targetPrice: structuredClone(b.wireTargetPrice),
|
|
35
|
+
billingCustomer: structuredClone(b.wireBillingCustomer),
|
|
36
|
+
coupons: b.couponReads.map((row) => structuredClone(row.wireCoupon)),
|
|
37
|
+
};
|
|
38
|
+
const query = new URLSearchParams([
|
|
39
|
+
["expand[0]", "discounts"],
|
|
40
|
+
["expand[1]", "items.data.discounts"],
|
|
41
|
+
["expand[2]", "items.data.price"],
|
|
42
|
+
]);
|
|
43
|
+
const e = writer.baseline.original.attachRequest.preparation.expected;
|
|
44
|
+
const rows = [
|
|
45
|
+
{
|
|
46
|
+
resource: "schedule",
|
|
47
|
+
path: "/v1/subscription_schedules/" + encodeURIComponent(scheduleId),
|
|
48
|
+
body: reads.schedule,
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
resource: "subscription",
|
|
52
|
+
path:
|
|
53
|
+
"/v1/subscriptions/" +
|
|
54
|
+
encodeURIComponent(e.subscriptionId) +
|
|
55
|
+
"?" +
|
|
56
|
+
query,
|
|
57
|
+
body: reads.subscription,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
resource: "price",
|
|
61
|
+
path: "/v1/prices/" + encodeURIComponent(e.targetPriceId),
|
|
62
|
+
body: reads.targetPrice,
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
resource: "customer",
|
|
66
|
+
path: "/v1/customers/" + encodeURIComponent(b.wireBillingCustomer.id),
|
|
67
|
+
body: reads.billingCustomer,
|
|
68
|
+
},
|
|
69
|
+
...b.couponReads.map((row) => ({
|
|
70
|
+
resource: "coupon",
|
|
71
|
+
path: "/v1/coupons/" + encodeURIComponent(row.couponId),
|
|
72
|
+
body: row.wireCoupon,
|
|
73
|
+
})),
|
|
74
|
+
];
|
|
75
|
+
return deepFreeze({
|
|
76
|
+
name:
|
|
77
|
+
writerMode === "ack"
|
|
78
|
+
? "actual-published-ACK18"
|
|
79
|
+
: "actual-published-ACK19",
|
|
80
|
+
writer,
|
|
81
|
+
reads,
|
|
82
|
+
rows: rows.map((row, i) => ({
|
|
83
|
+
...row,
|
|
84
|
+
ordinal: i + 1,
|
|
85
|
+
options: {
|
|
86
|
+
apiVersion: writer.baseline.apiVersion,
|
|
87
|
+
maxNetworkRetries: 0 as const,
|
|
88
|
+
},
|
|
89
|
+
})),
|
|
90
|
+
// Every declared writer response retains one phase. Absent/null defaults
|
|
91
|
+
// lack a historical object; object defaults still do not prove configured phases.
|
|
92
|
+
expectedObservation: {
|
|
93
|
+
acknowledgementEstablished: false,
|
|
94
|
+
authenticationEstablished: false,
|
|
95
|
+
providerQualificationRequired: true,
|
|
96
|
+
predicate: "unknown" as const,
|
|
97
|
+
reason:
|
|
98
|
+
writerMode === "defaults-object"
|
|
99
|
+
? "configured_baseline_material_unproven"
|
|
100
|
+
: "incomplete_object",
|
|
101
|
+
},
|
|
102
|
+
observedAt: Math.floor(writer.writeAt / 1000),
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
export type OptionalConfigureACK18 = ReturnType<
|
|
106
|
+
typeof declareOptionalConfigureACK18
|
|
107
|
+
>;
|
|
108
|
+
|
|
109
|
+
/** Original no-argument raw declaration remains the fixed absent-default18 recipe. */
|
|
110
|
+
export function declareOptionalConfigureACK18() {
|
|
111
|
+
return declareOptionalConfigureACK("ack");
|
|
112
|
+
}
|
|
113
|
+
export function declareOptionalConfigureACKCase(
|
|
114
|
+
controlCase: OptionalConfigureACKCase,
|
|
115
|
+
) {
|
|
116
|
+
const allowed: readonly string[] = [
|
|
117
|
+
"actual18-default-absent",
|
|
118
|
+
...optionalConfigureACKControlCases,
|
|
119
|
+
];
|
|
120
|
+
assert(allowed.includes(controlCase), "UNDECLARED_OPTIONAL_ACK_CASE");
|
|
121
|
+
const writerMode =
|
|
122
|
+
controlCase === "actual19-default-null"
|
|
123
|
+
? "defaults-null"
|
|
124
|
+
: controlCase === "actual19-default-object"
|
|
125
|
+
? "defaults-object"
|
|
126
|
+
: "ack";
|
|
127
|
+
const stage =
|
|
128
|
+
controlCase === "ACK-present-operation-absent" ||
|
|
129
|
+
controlCase === "operation-present-ACK-absent"
|
|
130
|
+
? "grammar"
|
|
131
|
+
: controlCase === "actual18-default-absent" ||
|
|
132
|
+
controlCase.startsWith("actual19-")
|
|
133
|
+
? "positive"
|
|
134
|
+
: "returned-value";
|
|
135
|
+
return deepFreeze({
|
|
136
|
+
controlCase,
|
|
137
|
+
writerMode,
|
|
138
|
+
stage,
|
|
139
|
+
declaration: declareOptionalConfigureACK(writerMode),
|
|
140
|
+
} as const);
|
|
141
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import type { configureACKLifecycleFixture } from "./observationConfigureACKLifecycleOperation.js";
|
|
3
|
+
|
|
4
|
+
export function assertConfigureACKLifecycleResult(
|
|
5
|
+
h: Awaited<ReturnType<typeof configureACKLifecycleFixture>>,
|
|
6
|
+
value: unknown,
|
|
7
|
+
) {
|
|
8
|
+
const retired = h.declaration.expectedOwner === "retired";
|
|
9
|
+
const c6Failure = h.declaration.controlCase === "L07-C6Failure-priority";
|
|
10
|
+
if (c6Failure) {
|
|
11
|
+
assert.equal(value, h.lastC6());
|
|
12
|
+
assert.deepEqual(value, h.directFailure);
|
|
13
|
+
} else {
|
|
14
|
+
assert(value instanceof Error);
|
|
15
|
+
assert.equal(
|
|
16
|
+
value.message,
|
|
17
|
+
retired ? "ORIGINAL_OWNER_STOP" : "OWNED_OBSERVATION_STOP",
|
|
18
|
+
);
|
|
19
|
+
for (const key of [
|
|
20
|
+
"failure",
|
|
21
|
+
"cause",
|
|
22
|
+
"rawError",
|
|
23
|
+
"rawReply",
|
|
24
|
+
"headers",
|
|
25
|
+
"token",
|
|
26
|
+
])
|
|
27
|
+
assert.equal(Object.prototype.hasOwnProperty.call(value, key), false);
|
|
28
|
+
}
|
|
29
|
+
assert.deepEqual(h.counters, {
|
|
30
|
+
source: retired ? 0 : 1,
|
|
31
|
+
target: 1,
|
|
32
|
+
captureEntered: retired ? 0 : 1,
|
|
33
|
+
captureCompleted: retired ? 0 : 1,
|
|
34
|
+
C6: retired ? 0 : 1,
|
|
35
|
+
C3: retired || c6Failure ? 0 : 1,
|
|
36
|
+
C9: 0,
|
|
37
|
+
lookup: retired || c6Failure ? 0 : 1,
|
|
38
|
+
lookupReturned: 0,
|
|
39
|
+
lookupThrew: retired || c6Failure ? 0 : 1,
|
|
40
|
+
observer: 0,
|
|
41
|
+
coverage: 0,
|
|
42
|
+
delegateEntered: 0,
|
|
43
|
+
});
|
|
44
|
+
assert.equal(h.calls.length, 0);
|
|
45
|
+
assert.equal(h.promises.length, 0);
|
|
46
|
+
assert.equal(h.writer.writeState.records.length, h.writerBefore.records);
|
|
47
|
+
assert.equal(
|
|
48
|
+
h.writer.writeState.calls.filter((row) => row.method === "POST").length,
|
|
49
|
+
h.writerBefore.POST,
|
|
50
|
+
);
|
|
51
|
+
assert.equal(h.writer.writeState.explicitC9, h.writerBefore.C9);
|
|
52
|
+
assert.equal(h.writer.state.records.length, h.setupBefore.records);
|
|
53
|
+
assert.equal(
|
|
54
|
+
h.writer.state.calls.filter((row) => row.method === "POST").length,
|
|
55
|
+
h.setupBefore.POST,
|
|
56
|
+
);
|
|
57
|
+
assert.equal(h.operation.configureOperation, h.writer.fixedAOperation());
|
|
58
|
+
assert.equal(
|
|
59
|
+
h.operation.actualAttachAcknowledgement,
|
|
60
|
+
h.writer.acknowledgement,
|
|
61
|
+
);
|
|
62
|
+
assert.deepEqual(h.writer.expectedRecord, h.savedOriginalRecord);
|
|
63
|
+
assert.deepEqual(h.writer.expectedACK, h.savedOracleACK);
|
|
64
|
+
if (retired)
|
|
65
|
+
assert.throws(() => h.writer.OWNER.basis, {
|
|
66
|
+
message: "ORIGINAL_OWNER_STOP",
|
|
67
|
+
});
|
|
68
|
+
else {
|
|
69
|
+
assert.equal(h.writer.OWNER.basis, h.basis);
|
|
70
|
+
assert.equal(h.writer.OWNER.check().retired, false);
|
|
71
|
+
}
|
|
72
|
+
if (h.declaration.controlCase === "L04-POST-pending")
|
|
73
|
+
assert.equal(h.writerSettled(), false);
|
|
74
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { deepFreeze } from "./configurePreflightControls.js";
|
|
3
|
+
import { declareConfigureWriteCase } from "./configureWriteDeclarations.js";
|
|
4
|
+
import { declareOptionalConfigureACK18 } from "./observationConfigureACKDeclarations.js";
|
|
5
|
+
|
|
6
|
+
export const configureACKLifecycleCases = [
|
|
7
|
+
"L01-output-abort",
|
|
8
|
+
"L02-receipt-ACK-fault",
|
|
9
|
+
"L03-final-discard-abort",
|
|
10
|
+
"L04-POST-pending",
|
|
11
|
+
"L05-POST-unknown",
|
|
12
|
+
"L06-receipt-ACK-retire",
|
|
13
|
+
"L07-C6Failure-priority",
|
|
14
|
+
] as const;
|
|
15
|
+
export type ConfigureACKLifecycleCase =
|
|
16
|
+
(typeof configureACKLifecycleCases)[number];
|
|
17
|
+
/** All choices and raw rows precede actual fixture constructors. */
|
|
18
|
+
export function declareConfigureACKLifecycle(
|
|
19
|
+
controlCase: ConfigureACKLifecycleCase,
|
|
20
|
+
) {
|
|
21
|
+
const allowed: readonly string[] = configureACKLifecycleCases;
|
|
22
|
+
assert(allowed.includes(controlCase), "UNDECLARED_LIFECYCLE_CASE");
|
|
23
|
+
const writerMode =
|
|
24
|
+
controlCase === "L04-POST-pending"
|
|
25
|
+
? "pending-prior"
|
|
26
|
+
: controlCase === "L05-POST-unknown"
|
|
27
|
+
? "post-reject"
|
|
28
|
+
: "ack";
|
|
29
|
+
const expectedOwner =
|
|
30
|
+
controlCase === "L06-receipt-ACK-retire" ? "retired" : "live";
|
|
31
|
+
const known = [
|
|
32
|
+
"L01-output-abort",
|
|
33
|
+
"L02-receipt-ACK-fault",
|
|
34
|
+
"L03-final-discard-abort",
|
|
35
|
+
"L06-receipt-ACK-retire",
|
|
36
|
+
].includes(controlCase);
|
|
37
|
+
const recordCount =
|
|
38
|
+
controlCase === "L01-output-abort"
|
|
39
|
+
? 2
|
|
40
|
+
: controlCase === "L04-POST-pending" || controlCase === "L05-POST-unknown"
|
|
41
|
+
? 1
|
|
42
|
+
: 3;
|
|
43
|
+
return deepFreeze({
|
|
44
|
+
controlCase,
|
|
45
|
+
writerMode,
|
|
46
|
+
expectedOwner,
|
|
47
|
+
known,
|
|
48
|
+
writer: declareConfigureWriteCase(writerMode),
|
|
49
|
+
readonly: declareOptionalConfigureACK18(),
|
|
50
|
+
expectedWriterAtRefusal: {
|
|
51
|
+
records: recordCount,
|
|
52
|
+
POST: 1,
|
|
53
|
+
C9: known || controlCase === "L07-C6Failure-priority" ? 1 : 0,
|
|
54
|
+
},
|
|
55
|
+
candidateKind:
|
|
56
|
+
controlCase === "L07-C6Failure-priority"
|
|
57
|
+
? "actual-returned-ACK"
|
|
58
|
+
: known
|
|
59
|
+
? "actual-admission-DATA-never-returned"
|
|
60
|
+
: "pure-oracle-DATA-only",
|
|
61
|
+
invalidAPI: "2026-01-01.unsupported",
|
|
62
|
+
expectedC6FailureReason: "invalid_attach_receipt_binding",
|
|
63
|
+
faults: {
|
|
64
|
+
output: "TEST_ABORT_AFTER_REAL_ACK_ADMISSION",
|
|
65
|
+
discard: "TEST_ABORT_AFTER_REAL_DISCARD",
|
|
66
|
+
},
|
|
67
|
+
expectedUnknown: {
|
|
68
|
+
status: "configure_unknown",
|
|
69
|
+
reason:
|
|
70
|
+
expectedOwner === "retired"
|
|
71
|
+
? "owner_closed_after_post"
|
|
72
|
+
: "post_unverified",
|
|
73
|
+
operationalAuthority: false,
|
|
74
|
+
},
|
|
75
|
+
} as const);
|
|
76
|
+
}
|
|
77
|
+
export type ConfigureACKLifecycleDeclaration = ReturnType<
|
|
78
|
+
typeof declareConfigureACKLifecycle
|
|
79
|
+
>;
|