@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,251 @@
|
|
|
1
|
+
import { types } from "node:util";
|
|
2
|
+
import { requiredJSONSnapshot } from "../material/requiredJson.js";
|
|
3
|
+
import type { Data, Diagnostics } from "./types.js";
|
|
4
|
+
const stop = (): never => {
|
|
5
|
+
throw Error("OWNED_OBSERVATION_STOP");
|
|
6
|
+
};
|
|
7
|
+
const need: (x: unknown) => asserts x = (x) => {
|
|
8
|
+
if (!x) stop();
|
|
9
|
+
};
|
|
10
|
+
const nativeResponsePrototype = Response.prototype;
|
|
11
|
+
const nativeStatusGetter = Object.getOwnPropertyDescriptor(
|
|
12
|
+
nativeResponsePrototype,
|
|
13
|
+
"status",
|
|
14
|
+
)!.get!;
|
|
15
|
+
const apply = Reflect.apply,
|
|
16
|
+
isProxy = types.isProxy;
|
|
17
|
+
function closed(
|
|
18
|
+
value: unknown,
|
|
19
|
+
required: readonly string[],
|
|
20
|
+
optional: readonly string[] = [],
|
|
21
|
+
): Data {
|
|
22
|
+
need(
|
|
23
|
+
value !== null &&
|
|
24
|
+
typeof value === "object" &&
|
|
25
|
+
!isProxy(value) &&
|
|
26
|
+
!Array.isArray(value),
|
|
27
|
+
);
|
|
28
|
+
const proto = Object.getPrototypeOf(value);
|
|
29
|
+
need(proto === Object.prototype || proto === null);
|
|
30
|
+
const keys = Reflect.ownKeys(value);
|
|
31
|
+
need(
|
|
32
|
+
required.every((k) => keys.includes(k)) &&
|
|
33
|
+
keys.every(
|
|
34
|
+
(k) => typeof k === "string" && [...required, ...optional].includes(k),
|
|
35
|
+
),
|
|
36
|
+
);
|
|
37
|
+
for (const key of keys) {
|
|
38
|
+
const d = Object.getOwnPropertyDescriptor(value, key);
|
|
39
|
+
need(d && d.enumerable && "value" in d);
|
|
40
|
+
}
|
|
41
|
+
return value as Data;
|
|
42
|
+
}
|
|
43
|
+
// Proxy-first complete traversal before ordinary privacy copying. Repeated ordinary
|
|
44
|
+
// references are charged per occurrence; only active-path cycles are rejected.
|
|
45
|
+
export function rejectProxyJSON(value: unknown, transportRoot = false) {
|
|
46
|
+
const active = new Set<object>();
|
|
47
|
+
let nodes = 0;
|
|
48
|
+
function walk(x: unknown, depth: number, isRoot: boolean) {
|
|
49
|
+
need(++nodes <= 10000 && depth <= 40);
|
|
50
|
+
need(!isProxy(x));
|
|
51
|
+
if (x === null || typeof x !== "object") return;
|
|
52
|
+
need(!active.has(x));
|
|
53
|
+
active.add(x);
|
|
54
|
+
const array = Array.isArray(x),
|
|
55
|
+
keys = Reflect.ownKeys(x);
|
|
56
|
+
need(keys.length <= 10001);
|
|
57
|
+
for (const key of keys) {
|
|
58
|
+
need(typeof key === "string");
|
|
59
|
+
const d = Object.getOwnPropertyDescriptor(x, key);
|
|
60
|
+
need(d && "value" in d);
|
|
61
|
+
if (isRoot && transportRoot && key === "lastResponse" && !d.enumerable)
|
|
62
|
+
continue;
|
|
63
|
+
if (array && key === "length") continue;
|
|
64
|
+
need(d.enumerable);
|
|
65
|
+
walk(d.value, depth + 1, false);
|
|
66
|
+
}
|
|
67
|
+
active.delete(x);
|
|
68
|
+
}
|
|
69
|
+
walk(value, 0, true);
|
|
70
|
+
}
|
|
71
|
+
function freeze<T>(value: T): T {
|
|
72
|
+
if (value && typeof value === "object") {
|
|
73
|
+
for (const d of Object.values(Object.getOwnPropertyDescriptors(value)))
|
|
74
|
+
if ("value" in d) freeze(d.value);
|
|
75
|
+
Object.freeze(value);
|
|
76
|
+
}
|
|
77
|
+
return value;
|
|
78
|
+
}
|
|
79
|
+
function ordinary<T>(value: T): T {
|
|
80
|
+
rejectProxyJSON(value);
|
|
81
|
+
return freeze(requiredJSONSnapshot(value)) as T;
|
|
82
|
+
}
|
|
83
|
+
export function captureObservationReply(reply: unknown) {
|
|
84
|
+
rejectProxyJSON(reply, true);
|
|
85
|
+
need(reply !== null && typeof reply === "object" && !Array.isArray(reply));
|
|
86
|
+
const proto = Object.getPrototypeOf(reply);
|
|
87
|
+
need(proto === Object.prototype || proto === null);
|
|
88
|
+
const meta = Object.getOwnPropertyDescriptor(reply, "lastResponse");
|
|
89
|
+
need(
|
|
90
|
+
meta &&
|
|
91
|
+
!meta.enumerable &&
|
|
92
|
+
"value" in meta &&
|
|
93
|
+
meta.value !== null &&
|
|
94
|
+
typeof meta.value === "object",
|
|
95
|
+
);
|
|
96
|
+
const metadata = meta.value as object;
|
|
97
|
+
need(!isProxy(metadata));
|
|
98
|
+
const codes: unknown[] = [];
|
|
99
|
+
for (const key of ["status", "statusCode"]) {
|
|
100
|
+
const d = Object.getOwnPropertyDescriptor(metadata, key);
|
|
101
|
+
if (!d) continue;
|
|
102
|
+
need("value" in d);
|
|
103
|
+
if (d.value !== undefined) codes.push(d.value);
|
|
104
|
+
}
|
|
105
|
+
if (Object.getPrototypeOf(metadata) === nativeResponsePrototype)
|
|
106
|
+
codes.push(apply(nativeStatusGetter, metadata, []));
|
|
107
|
+
need(
|
|
108
|
+
codes.length > 0 &&
|
|
109
|
+
codes.every(
|
|
110
|
+
(x) =>
|
|
111
|
+
typeof x === "number" &&
|
|
112
|
+
Number.isInteger(x) &&
|
|
113
|
+
x >= 200 &&
|
|
114
|
+
x < 300 &&
|
|
115
|
+
x === codes[0],
|
|
116
|
+
),
|
|
117
|
+
);
|
|
118
|
+
const entries: [string, unknown][] = [];
|
|
119
|
+
for (const key of Reflect.ownKeys(reply)) {
|
|
120
|
+
need(typeof key === "string");
|
|
121
|
+
if (key === "lastResponse") continue;
|
|
122
|
+
const d = Object.getOwnPropertyDescriptor(reply, key);
|
|
123
|
+
need(d && d.enumerable && "value" in d);
|
|
124
|
+
entries.push([key, d.value]);
|
|
125
|
+
}
|
|
126
|
+
return ordinary(Object.fromEntries(entries));
|
|
127
|
+
}
|
|
128
|
+
export function captureObservationInput<T>(value: T): T {
|
|
129
|
+
const root = closed(value, ["configuration", "reads"], ["configureReceipt"]);
|
|
130
|
+
const reads = closed(root.reads, [
|
|
131
|
+
"schedule",
|
|
132
|
+
"subscription",
|
|
133
|
+
"targetPrice",
|
|
134
|
+
"billingCustomer",
|
|
135
|
+
"coupons",
|
|
136
|
+
]);
|
|
137
|
+
need(Array.isArray(reads.coupons));
|
|
138
|
+
return ordinary(value);
|
|
139
|
+
}
|
|
140
|
+
export function admitObservationOutput<T>(value: T): T {
|
|
141
|
+
const root = closed(value, [
|
|
142
|
+
"status",
|
|
143
|
+
"observation",
|
|
144
|
+
"reads",
|
|
145
|
+
"observedAt",
|
|
146
|
+
"retainedConfigureAcknowledgement",
|
|
147
|
+
"operationalAuthority",
|
|
148
|
+
]);
|
|
149
|
+
need(
|
|
150
|
+
root.status === "owned_observation_data" &&
|
|
151
|
+
root.operationalAuthority === false &&
|
|
152
|
+
(root.retainedConfigureAcknowledgement === "absent" ||
|
|
153
|
+
root.retainedConfigureAcknowledgement === "present"),
|
|
154
|
+
);
|
|
155
|
+
need(
|
|
156
|
+
typeof root.observedAt === "number" &&
|
|
157
|
+
Number.isSafeInteger(root.observedAt) &&
|
|
158
|
+
root.observedAt >= 0,
|
|
159
|
+
);
|
|
160
|
+
const reads = closed(root.reads, [
|
|
161
|
+
"schedule",
|
|
162
|
+
"subscription",
|
|
163
|
+
"targetPrice",
|
|
164
|
+
"billingCustomer",
|
|
165
|
+
"coupons",
|
|
166
|
+
]);
|
|
167
|
+
need(Array.isArray(reads.coupons));
|
|
168
|
+
const r = closed(
|
|
169
|
+
root.observation,
|
|
170
|
+
[
|
|
171
|
+
"acknowledgementEstablished",
|
|
172
|
+
"authenticationEstablished",
|
|
173
|
+
"providerQualificationRequired",
|
|
174
|
+
"predicate",
|
|
175
|
+
],
|
|
176
|
+
[
|
|
177
|
+
"reason",
|
|
178
|
+
"observedItemId",
|
|
179
|
+
"nativePeriod",
|
|
180
|
+
"providerStatus",
|
|
181
|
+
"effectiveness",
|
|
182
|
+
],
|
|
183
|
+
);
|
|
184
|
+
need(
|
|
185
|
+
r.acknowledgementEstablished === false &&
|
|
186
|
+
r.authenticationEstablished === false &&
|
|
187
|
+
r.providerQualificationRequired === true,
|
|
188
|
+
);
|
|
189
|
+
need(
|
|
190
|
+
typeof r.predicate === "string" &&
|
|
191
|
+
[
|
|
192
|
+
"pending_material_match",
|
|
193
|
+
"current_target_material_match",
|
|
194
|
+
"attached_unconfigured_match",
|
|
195
|
+
"terminal_facts_only",
|
|
196
|
+
"unknown",
|
|
197
|
+
"conflict",
|
|
198
|
+
].includes(r.predicate),
|
|
199
|
+
);
|
|
200
|
+
for (const key of [
|
|
201
|
+
"reason",
|
|
202
|
+
"observedItemId",
|
|
203
|
+
"providerStatus",
|
|
204
|
+
"effectiveness",
|
|
205
|
+
])
|
|
206
|
+
if (Object.prototype.hasOwnProperty.call(r, key))
|
|
207
|
+
need(typeof r[key] === "string");
|
|
208
|
+
if (Object.prototype.hasOwnProperty.call(r, "nativePeriod")) {
|
|
209
|
+
const period = closed(r.nativePeriod, ["start", "end"]);
|
|
210
|
+
need(
|
|
211
|
+
Number.isSafeInteger(period.start) && Number.isSafeInteger(period.end),
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
return ordinary(value);
|
|
215
|
+
}
|
|
216
|
+
// Only bounded own DATA is admitted. Diagnostics never authorize a failure.
|
|
217
|
+
export function safeReadDiagnostics(error: unknown): Diagnostics {
|
|
218
|
+
const out: {
|
|
219
|
+
type?: string;
|
|
220
|
+
code?: string;
|
|
221
|
+
statusCode?: number;
|
|
222
|
+
requestId?: string;
|
|
223
|
+
} = {};
|
|
224
|
+
if (error === null || typeof error !== "object" || isProxy(error))
|
|
225
|
+
return Object.freeze(out);
|
|
226
|
+
for (const key of ["type", "code", "statusCode", "requestId"] as const) {
|
|
227
|
+
const d = Object.getOwnPropertyDescriptor(error, key);
|
|
228
|
+
if (!d || !("value" in d)) continue;
|
|
229
|
+
const value: unknown = d.value;
|
|
230
|
+
if (key === "statusCode") {
|
|
231
|
+
if (
|
|
232
|
+
typeof value === "number" &&
|
|
233
|
+
Number.isInteger(value) &&
|
|
234
|
+
value >= 100 &&
|
|
235
|
+
value <= 599
|
|
236
|
+
)
|
|
237
|
+
out[key] = value;
|
|
238
|
+
} else if (
|
|
239
|
+
typeof value === "string" &&
|
|
240
|
+
value.length >= 1 &&
|
|
241
|
+
value.length <= 255
|
|
242
|
+
) {
|
|
243
|
+
try {
|
|
244
|
+
out[key] = requiredJSONSnapshot(value) as string;
|
|
245
|
+
} catch {
|
|
246
|
+
/* Unsupported diagnostics are omitted. */
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
return Object.freeze(out);
|
|
251
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { admitConfigureACK } from "../configure/output.js";
|
|
2
|
+
import { equal } from "../../../renewalAggregate/shared.js";
|
|
3
|
+
import type { RenewalConfigurationReceiptV2 } from "../../../renewalV2/index.js";
|
|
4
|
+
import type {
|
|
5
|
+
ObservationRecord,
|
|
6
|
+
RetainedConfigureAcknowledgement,
|
|
7
|
+
} from "./types.js";
|
|
8
|
+
|
|
9
|
+
/** Stateless whole relation only; the actor must establish actual returned-ACK custody first. */
|
|
10
|
+
export function admitRetainedConfigureAcknowledgement(
|
|
11
|
+
record: ObservationRecord,
|
|
12
|
+
retained: RetainedConfigureAcknowledgement,
|
|
13
|
+
actualReceipt: RenewalConfigurationReceiptV2,
|
|
14
|
+
) {
|
|
15
|
+
// Existing exact18/19 slot ledger binds the complete request/raw response/default presence.
|
|
16
|
+
admitConfigureACK(record, retained.rawReceipt, actualReceipt);
|
|
17
|
+
if (!equal(actualReceipt, retained.receipt))
|
|
18
|
+
throw Error("OWNED_OBSERVATION_STOP");
|
|
19
|
+
return retained.rawReceipt;
|
|
20
|
+
}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { it } from "vitest";
|
|
2
|
+
import assert from "node:assert/strict";
|
|
3
|
+
import {
|
|
4
|
+
observationFixture,
|
|
5
|
+
type ObservationFixture,
|
|
6
|
+
} from "../test-fixtures/observationOperation.js";
|
|
7
|
+
import {
|
|
8
|
+
assertObservationOutput,
|
|
9
|
+
assertNoObservationReads,
|
|
10
|
+
assertPrivateObservationError,
|
|
11
|
+
observationOutcome,
|
|
12
|
+
} from "../test-fixtures/observationAssertions.js";
|
|
13
|
+
import {
|
|
14
|
+
sourceControlCases,
|
|
15
|
+
publicFailureCases,
|
|
16
|
+
trustedExportCases,
|
|
17
|
+
type ObservationControl,
|
|
18
|
+
} from "../test-fixtures/observationDeclarations.js";
|
|
19
|
+
import {
|
|
20
|
+
assertEmptyObservation,
|
|
21
|
+
logObservationFailureFrontier,
|
|
22
|
+
} from "../test-fixtures/observationProbe.js";
|
|
23
|
+
import { data } from "../test-fixtures/configurePreflightControls.js";
|
|
24
|
+
|
|
25
|
+
async function runControl(
|
|
26
|
+
mode: ObservationControl,
|
|
27
|
+
check: (h: ObservationFixture) => Promise<void>,
|
|
28
|
+
) {
|
|
29
|
+
const h = await observationFixture(mode);
|
|
30
|
+
try {
|
|
31
|
+
await check(h);
|
|
32
|
+
} catch (originalError) {
|
|
33
|
+
try {
|
|
34
|
+
await logObservationFailureFrontier(h);
|
|
35
|
+
} finally {
|
|
36
|
+
throw originalError;
|
|
37
|
+
}
|
|
38
|
+
} finally {
|
|
39
|
+
await h.cleanup();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
it("repository owned observation returns complete absent-ACK evidence", async () => {
|
|
43
|
+
await runControl("positive", async (h) =>
|
|
44
|
+
assertObservationOutput(h, await h.capture().invoke()),
|
|
45
|
+
);
|
|
46
|
+
});
|
|
47
|
+
it("repository observation G02 EMPTY refuses before all declared effects", async () => {
|
|
48
|
+
await assertEmptyObservation();
|
|
49
|
+
});
|
|
50
|
+
for (const mode of sourceControlCases)
|
|
51
|
+
it("repository observation Source control " + mode, async () => {
|
|
52
|
+
await runControl(mode, async (h) => {
|
|
53
|
+
if (mode === "G02-arity") {
|
|
54
|
+
assert.throws(() => h.capture({}), {
|
|
55
|
+
name: "Error",
|
|
56
|
+
message: "OWNED_OBSERVATION_ARITY",
|
|
57
|
+
});
|
|
58
|
+
const handle = h.capture();
|
|
59
|
+
const outcome = await observationOutcome(handle.invoke({}));
|
|
60
|
+
assert.equal(outcome.ok, false);
|
|
61
|
+
if (!outcome.ok)
|
|
62
|
+
assertPrivateObservationError(
|
|
63
|
+
outcome.error,
|
|
64
|
+
"OWNED_OBSERVATION_ONCE",
|
|
65
|
+
);
|
|
66
|
+
assert.equal(h.state.sourceLoads, 0);
|
|
67
|
+
assert.equal(h.state.ownedC6, 0);
|
|
68
|
+
assertNoObservationReads(h);
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
if (mode === "G02-once") {
|
|
72
|
+
const handle = h.capture();
|
|
73
|
+
assertObservationOutput(h, await handle.invoke());
|
|
74
|
+
const counts = [
|
|
75
|
+
h.http.calls.length,
|
|
76
|
+
h.state.sourceLoads,
|
|
77
|
+
h.state.ownedC6,
|
|
78
|
+
h.state.ownedC3,
|
|
79
|
+
h.state.ownedObserver,
|
|
80
|
+
];
|
|
81
|
+
const outcome = await observationOutcome(handle.invoke());
|
|
82
|
+
assert.equal(outcome.ok, false);
|
|
83
|
+
if (!outcome.ok)
|
|
84
|
+
assertPrivateObservationError(
|
|
85
|
+
outcome.error,
|
|
86
|
+
"OWNED_OBSERVATION_ONCE",
|
|
87
|
+
);
|
|
88
|
+
assert.deepEqual(
|
|
89
|
+
[
|
|
90
|
+
h.http.calls.length,
|
|
91
|
+
h.state.sourceLoads,
|
|
92
|
+
h.state.ownedC6,
|
|
93
|
+
h.state.ownedC3,
|
|
94
|
+
h.state.ownedObserver,
|
|
95
|
+
],
|
|
96
|
+
counts,
|
|
97
|
+
);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const outcome = await observationOutcome(h.capture().invoke());
|
|
101
|
+
assert.equal(outcome.ok, false);
|
|
102
|
+
if (!outcome.ok) assertPrivateObservationError(outcome.error);
|
|
103
|
+
assert.equal(h.state.sourceLoads, 1);
|
|
104
|
+
assert.equal(h.state.ownedC6, 0);
|
|
105
|
+
assert.equal(h.state.ownedC3, 0);
|
|
106
|
+
assert.equal(h.state.recordVerificationEntered, 0);
|
|
107
|
+
assert.equal(h.state.tupleTraps, 0);
|
|
108
|
+
assert.equal(h.state.methodGetterCalls, 0);
|
|
109
|
+
assertNoObservationReads(h);
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
for (const mode of publicFailureCases)
|
|
113
|
+
it("repository observation public Failure control " + mode, async () => {
|
|
114
|
+
await runControl(mode, async (h) => {
|
|
115
|
+
if (mode === "G03-structural") {
|
|
116
|
+
const rejected = await observationOutcome(
|
|
117
|
+
Reflect.apply(h.actual.projectRenewalConfigurationV2, h.actual, [
|
|
118
|
+
{},
|
|
119
|
+
]) as ReturnType<typeof h.actual.projectRenewalConfigurationV2>,
|
|
120
|
+
);
|
|
121
|
+
assert.equal(rejected.ok, false);
|
|
122
|
+
const outcome = await observationOutcome(h.capture().invoke());
|
|
123
|
+
assert.equal(outcome.ok, false);
|
|
124
|
+
if (!outcome.ok)
|
|
125
|
+
assertPrivateObservationError(
|
|
126
|
+
outcome.error,
|
|
127
|
+
"MATERIAL_V2_UNSUPPORTED",
|
|
128
|
+
);
|
|
129
|
+
assert.equal(
|
|
130
|
+
h.state.ownedC6,
|
|
131
|
+
0,
|
|
132
|
+
"private capture rejects earlier; not target-C6 throw proof",
|
|
133
|
+
);
|
|
134
|
+
} else {
|
|
135
|
+
const config = data(data(h.sourceOperation).record).configuration;
|
|
136
|
+
const oracle = (await Reflect.apply(
|
|
137
|
+
h.actual.projectRenewalConfigurationV2,
|
|
138
|
+
h.actual,
|
|
139
|
+
[config],
|
|
140
|
+
)) as Awaited<
|
|
141
|
+
ReturnType<typeof h.actual.projectRenewalConfigurationV2>
|
|
142
|
+
>;
|
|
143
|
+
h.OWNER.check();
|
|
144
|
+
assert.notEqual(oracle.status, "projected_configure_request");
|
|
145
|
+
const outcome = await observationOutcome(h.capture().invoke());
|
|
146
|
+
if (mode === "G03-retire") {
|
|
147
|
+
assert.equal(outcome.ok, false);
|
|
148
|
+
if (!outcome.ok) {
|
|
149
|
+
assertPrivateObservationError(outcome.error, "ORIGINAL_OWNER_STOP");
|
|
150
|
+
assert(outcome.error instanceof Error);
|
|
151
|
+
assert.equal(outcome.error.message, "ORIGINAL_OWNER_STOP");
|
|
152
|
+
}
|
|
153
|
+
} else {
|
|
154
|
+
assert.equal(outcome.ok, true);
|
|
155
|
+
if (outcome.ok) {
|
|
156
|
+
assert.equal(
|
|
157
|
+
outcome.value,
|
|
158
|
+
h.state.lastC6,
|
|
159
|
+
"same actual C6 Failure object",
|
|
160
|
+
);
|
|
161
|
+
assert.deepEqual(outcome.value, oracle);
|
|
162
|
+
}
|
|
163
|
+
assert.equal(h.state.exportReads, 0);
|
|
164
|
+
assert.equal(h.state.exportCalls, 0);
|
|
165
|
+
assert.equal(h.state.exportFactoryLoads, 0);
|
|
166
|
+
}
|
|
167
|
+
assert.equal(h.state.ownedC6, 1);
|
|
168
|
+
}
|
|
169
|
+
assert.equal(h.state.ownedC3, 0);
|
|
170
|
+
assert.equal(h.state.recordVerificationEntered, 0);
|
|
171
|
+
assert.equal(h.state.recordVerificationCompleted, 0);
|
|
172
|
+
assertNoObservationReads(h);
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
for (const mode of trustedExportCases)
|
|
176
|
+
it("repository observation trusted export ABI " + mode, async () => {
|
|
177
|
+
await runControl(mode, async (h) => {
|
|
178
|
+
const outcome = await observationOutcome(h.capture().invoke());
|
|
179
|
+
const positive = mode === "ABI-data-export" || mode === "ABI-getter-once";
|
|
180
|
+
if (positive) {
|
|
181
|
+
assert.equal(outcome.ok, true);
|
|
182
|
+
if (outcome.ok) assertObservationOutput(h, outcome.value);
|
|
183
|
+
assert.equal(h.state.exportCalls, 1);
|
|
184
|
+
} else {
|
|
185
|
+
assert.equal(outcome.ok, false);
|
|
186
|
+
if (!outcome.ok) {
|
|
187
|
+
assertPrivateObservationError(
|
|
188
|
+
outcome.error,
|
|
189
|
+
mode === "ABI-getter-retire"
|
|
190
|
+
? "ORIGINAL_OWNER_STOP"
|
|
191
|
+
: "OWNED_OBSERVATION_STOP",
|
|
192
|
+
);
|
|
193
|
+
assert(outcome.error instanceof Error);
|
|
194
|
+
assert.equal(
|
|
195
|
+
outcome.error.message,
|
|
196
|
+
mode === "ABI-getter-retire"
|
|
197
|
+
? "ORIGINAL_OWNER_STOP"
|
|
198
|
+
: "OWNED_OBSERVATION_STOP",
|
|
199
|
+
);
|
|
200
|
+
assert.notEqual(outcome.error.message, h.declaration.exportThrow);
|
|
201
|
+
}
|
|
202
|
+
assert.equal(h.state.exportCalls, 0);
|
|
203
|
+
assertNoObservationReads(h);
|
|
204
|
+
}
|
|
205
|
+
const getter = [
|
|
206
|
+
"ABI-getter-once",
|
|
207
|
+
"ABI-getter-retire",
|
|
208
|
+
"ABI-getter-throws",
|
|
209
|
+
].includes(mode);
|
|
210
|
+
assert.equal(h.state.exportReads, getter ? 1 : 0);
|
|
211
|
+
assert.equal(h.state.exportDescriptorGetter, getter);
|
|
212
|
+
assert.equal(h.state.exportDescriptorData, !getter);
|
|
213
|
+
assert.equal(h.state.exportFactoryLoads, 1);
|
|
214
|
+
assert.equal(h.state.exportProxyApplies, 0);
|
|
215
|
+
assert.equal(h.state.ownedC6, 1);
|
|
216
|
+
assert.equal(h.state.ownedC3, 1);
|
|
217
|
+
assert.equal(h.state.C3Fulfilled, 1);
|
|
218
|
+
assert.equal(h.state.recordVerificationCompleted, 1);
|
|
219
|
+
});
|
|
220
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { it } from "vitest";
|
|
2
|
+
import { optionalConfigureACK18Fixture } from "../test-fixtures/observationConfigureACKOperation.js";
|
|
3
|
+
import { assertOptionalConfigureACK18 } from "../test-fixtures/observationConfigureACKAssertions.js";
|
|
4
|
+
|
|
5
|
+
it("owned observation retains actual published configure ACK18 with historical unknown", async () => {
|
|
6
|
+
const h = await optionalConfigureACK18Fixture();
|
|
7
|
+
try {
|
|
8
|
+
const output = await h.capture().invoke();
|
|
9
|
+
assertOptionalConfigureACK18(h, output);
|
|
10
|
+
} catch (originalError) {
|
|
11
|
+
try {
|
|
12
|
+
console.log(
|
|
13
|
+
JSON.stringify({
|
|
14
|
+
kind: "OPTIONAL_ACK18_TARGET_FAILURE_FRONTIER",
|
|
15
|
+
counters: { ...h.counters },
|
|
16
|
+
observationHTTP: h.calls.length,
|
|
17
|
+
originalReadPromises: h.promises.length,
|
|
18
|
+
writerRecords: h.writer.writeState.records.length,
|
|
19
|
+
writerPOSTs: h.writer.writeState.calls.filter(
|
|
20
|
+
(row) => row.method === "POST",
|
|
21
|
+
).length,
|
|
22
|
+
writerExplicitC9: h.writer.writeState.explicitC9,
|
|
23
|
+
setupRecords: h.writer.state.records.length,
|
|
24
|
+
setupPOSTs: h.writer.state.calls.filter(
|
|
25
|
+
(row) => row.method === "POST",
|
|
26
|
+
).length,
|
|
27
|
+
operationalAuthority: false,
|
|
28
|
+
}),
|
|
29
|
+
);
|
|
30
|
+
} finally {
|
|
31
|
+
throw originalError;
|
|
32
|
+
}
|
|
33
|
+
} finally {
|
|
34
|
+
await h.cleanup();
|
|
35
|
+
}
|
|
36
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { it } from "vitest";
|
|
3
|
+
import { optionalConfigureACKControlCases } from "../test-fixtures/observationConfigureACKDeclarations.js";
|
|
4
|
+
import { optionalConfigureACKControlFixture } from "../test-fixtures/observationConfigureACKOperation.js";
|
|
5
|
+
import {
|
|
6
|
+
assertOptionalConfigureACK18,
|
|
7
|
+
assertOptionalConfigureACKRefusal,
|
|
8
|
+
} from "../test-fixtures/observationConfigureACKAssertions.js";
|
|
9
|
+
|
|
10
|
+
for (const controlCase of optionalConfigureACKControlCases)
|
|
11
|
+
it("owned observation configure ACK control: " + controlCase, async () => {
|
|
12
|
+
const h = await optionalConfigureACKControlFixture(controlCase);
|
|
13
|
+
try {
|
|
14
|
+
const original = h.capture().invoke();
|
|
15
|
+
if (h.selected.stage === "positive")
|
|
16
|
+
assertOptionalConfigureACK18(h, await original);
|
|
17
|
+
else {
|
|
18
|
+
const error = await original.then(
|
|
19
|
+
() => assert.fail("EXPECTED_OPTIONAL_CONFIGURE_ACK_REFUSAL"),
|
|
20
|
+
(error: unknown) => error,
|
|
21
|
+
);
|
|
22
|
+
assertOptionalConfigureACKRefusal(h, error);
|
|
23
|
+
}
|
|
24
|
+
} catch (originalError) {
|
|
25
|
+
try {
|
|
26
|
+
console.log(
|
|
27
|
+
JSON.stringify({
|
|
28
|
+
kind: "OPTIONAL_CONFIGURE_ACK_CONTROL_FAILURE_FRONTIER",
|
|
29
|
+
controlCase,
|
|
30
|
+
declaredStage: h.selected.stage,
|
|
31
|
+
counters: { ...h.counters },
|
|
32
|
+
observationHTTP: h.calls.length,
|
|
33
|
+
originalReadPromises: h.promises.length,
|
|
34
|
+
writerRecords: h.writer.writeState.records.length,
|
|
35
|
+
writerPOSTs: h.writer.writeState.calls.filter(
|
|
36
|
+
(row) => row.method === "POST",
|
|
37
|
+
).length,
|
|
38
|
+
writerExplicitC9: h.writer.writeState.explicitC9,
|
|
39
|
+
operationalAuthority: false,
|
|
40
|
+
}),
|
|
41
|
+
);
|
|
42
|
+
} finally {
|
|
43
|
+
throw originalError;
|
|
44
|
+
}
|
|
45
|
+
} finally {
|
|
46
|
+
await h.cleanup();
|
|
47
|
+
}
|
|
48
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { it } from "vitest";
|
|
3
|
+
import { configureACKLifecycleCases } from "../test-fixtures/observationConfigureACKLifecycleDeclarations.js";
|
|
4
|
+
import { configureACKLifecycleFixture } from "../test-fixtures/observationConfigureACKLifecycleOperation.js";
|
|
5
|
+
import { assertConfigureACKLifecycleResult } from "../test-fixtures/observationConfigureACKLifecycleAssertions.js";
|
|
6
|
+
|
|
7
|
+
for (const controlCase of configureACKLifecycleCases)
|
|
8
|
+
it("owned observation configure ACK lifecycle: " + controlCase, async () => {
|
|
9
|
+
const h = await configureACKLifecycleFixture(controlCase);
|
|
10
|
+
try {
|
|
11
|
+
const original = h.capture().invoke();
|
|
12
|
+
const expectedFailure = controlCase === "L07-C6Failure-priority";
|
|
13
|
+
const value = expectedFailure
|
|
14
|
+
? await original
|
|
15
|
+
: await original.then(
|
|
16
|
+
() => assert.fail("EXPECTED_LIFECYCLE_REFUSAL"),
|
|
17
|
+
(error: unknown) => error,
|
|
18
|
+
);
|
|
19
|
+
assertConfigureACKLifecycleResult(h, value);
|
|
20
|
+
if (controlCase === "L04-POST-pending") await h.finishPendingWriter();
|
|
21
|
+
} catch (originalError) {
|
|
22
|
+
try {
|
|
23
|
+
console.log(
|
|
24
|
+
JSON.stringify({
|
|
25
|
+
kind: "OPTIONAL_ACK_LIFECYCLE_FAILURE_FRONTIER",
|
|
26
|
+
controlCase,
|
|
27
|
+
counters: { ...h.counters },
|
|
28
|
+
observationHTTP: h.calls.length,
|
|
29
|
+
writerRecords: h.writer.writeState.records.length,
|
|
30
|
+
writerPOSTs: h.writer.writeState.calls.filter(
|
|
31
|
+
(row) => row.method === "POST",
|
|
32
|
+
).length,
|
|
33
|
+
writerC9: h.writer.writeState.explicitC9,
|
|
34
|
+
candidateKind: h.declaration.candidateKind,
|
|
35
|
+
operationalAuthority: false,
|
|
36
|
+
}),
|
|
37
|
+
);
|
|
38
|
+
} finally {
|
|
39
|
+
throw originalError;
|
|
40
|
+
}
|
|
41
|
+
} finally {
|
|
42
|
+
await h.cleanup();
|
|
43
|
+
}
|
|
44
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { it } from "vitest";
|
|
2
|
+
import { configuredHistoryCases } from "../test-fixtures/observationConfiguredHistoryDeclarations.js";
|
|
3
|
+
import { configuredHistoryFixture } from "../test-fixtures/observationConfiguredHistoryOperation.js";
|
|
4
|
+
import { assertConfiguredHistoryResult } from "../test-fixtures/observationConfiguredHistoryAssertions.js";
|
|
5
|
+
|
|
6
|
+
for (const controlCase of configuredHistoryCases)
|
|
7
|
+
it("configured history owned observation: " + controlCase, async () => {
|
|
8
|
+
const h = await configuredHistoryFixture(controlCase);
|
|
9
|
+
try {
|
|
10
|
+
assertConfiguredHistoryResult(h, await h.capture().invoke());
|
|
11
|
+
} catch (originalError) {
|
|
12
|
+
try {
|
|
13
|
+
console.log(
|
|
14
|
+
JSON.stringify({
|
|
15
|
+
kind: "CONFIGURED_HISTORY_FAILURE_FRONTIER",
|
|
16
|
+
controlCase,
|
|
17
|
+
counters: { ...h.counters },
|
|
18
|
+
observationHTTP: h.calls.length,
|
|
19
|
+
originalReadPromises: h.promises.length,
|
|
20
|
+
writerRecords: h.writer.writeState.records.length,
|
|
21
|
+
writerPOSTs: h.writer.writeState.calls.filter(
|
|
22
|
+
(row) => row.method === "POST",
|
|
23
|
+
).length,
|
|
24
|
+
writerC9: h.writer.writeState.explicitC9,
|
|
25
|
+
operationalAuthority: false,
|
|
26
|
+
}),
|
|
27
|
+
);
|
|
28
|
+
} finally {
|
|
29
|
+
throw originalError;
|
|
30
|
+
}
|
|
31
|
+
} finally {
|
|
32
|
+
await h.cleanup();
|
|
33
|
+
}
|
|
34
|
+
});
|