@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,586 @@
|
|
|
1
|
+
import { types } from "node:util";
|
|
2
|
+
import { owned } from "./ownedContinuation.js";
|
|
3
|
+
import { renewalSnapshot } from "../../../renewalReplacementSnapshot.js";
|
|
4
|
+
import { freeze } from "../material/nodeKernel.js";
|
|
5
|
+
import { OWNER } from "../originalOwner.js";
|
|
6
|
+
import {
|
|
7
|
+
COMPILED_CONFIGURE_WRITE_ENTRIES as ENTRIES,
|
|
8
|
+
COMPILED_INITIAL_ENTRIES,
|
|
9
|
+
ORIGINAL_ORIGIN_ASSOCIATION,
|
|
10
|
+
loadFixedConfigureWriteOperation,
|
|
11
|
+
loadFixedConfigureReplayOperation,
|
|
12
|
+
} from "../operations/sourceOperations.js";
|
|
13
|
+
import { closed } from "../operations/types.js";
|
|
14
|
+
import {
|
|
15
|
+
projectRenewalConfigurationV2 as c6,
|
|
16
|
+
constructRenewalScheduleAttachmentReceiptV2 as c3,
|
|
17
|
+
constructRenewalConfigurationReceiptV2 as c9,
|
|
18
|
+
} from "../../../renewalV2/index.js";
|
|
19
|
+
import { equal } from "../../../renewalAggregate/shared.js";
|
|
20
|
+
import { capturePreflightRecord } from "../preflight/record.js";
|
|
21
|
+
import {
|
|
22
|
+
verifyPreflightRecord,
|
|
23
|
+
verifyCurrentPreflight,
|
|
24
|
+
} from "../preflight/relations.js";
|
|
25
|
+
import { releasePreflight } from "../preflight/output.js";
|
|
26
|
+
import { classifyOwnedRetainedInitialAttachment } from "../material/classifiers.js";
|
|
27
|
+
import { bindConfigureReadAcquisitionFromSource } from "../acquisition/ownedAcquisition.js";
|
|
28
|
+
import { createConfigureEventCompiler } from "../c10/configureEvents.js";
|
|
29
|
+
import {
|
|
30
|
+
createConfigureWriteTransport,
|
|
31
|
+
createConfigureReplayTransport,
|
|
32
|
+
} from "./transport.js";
|
|
33
|
+
import { ownMethod, need, stop, expectedPlan, seven } from "./request.js";
|
|
34
|
+
import {
|
|
35
|
+
admitConfigureACK,
|
|
36
|
+
admitConfigureFailure,
|
|
37
|
+
configureControl,
|
|
38
|
+
} from "./output.js";
|
|
39
|
+
import { withinConfigureRetention } from "./replay.js";
|
|
40
|
+
import type { PreflightRecord } from "../preflight/grammar.js";
|
|
41
|
+
import type { Bundle } from "../material/capture.js";
|
|
42
|
+
|
|
43
|
+
type Pair = ReturnType<typeof createConfigureWriteTransport>;
|
|
44
|
+
type Lineage = {
|
|
45
|
+
receiptKnown: boolean;
|
|
46
|
+
receiptPending: boolean;
|
|
47
|
+
busy: boolean;
|
|
48
|
+
};
|
|
49
|
+
type History = {
|
|
50
|
+
record: PreflightRecord;
|
|
51
|
+
owner: typeof OWNER;
|
|
52
|
+
basis: typeof OWNER.basis;
|
|
53
|
+
origin: unknown;
|
|
54
|
+
entry: unknown;
|
|
55
|
+
configureEntry: unknown;
|
|
56
|
+
actualAttachAcknowledgement: unknown;
|
|
57
|
+
lineage: Lineage;
|
|
58
|
+
state:
|
|
59
|
+
| "not_started"
|
|
60
|
+
| "post_pending"
|
|
61
|
+
| "post_unknown"
|
|
62
|
+
| "receipt_prepared"
|
|
63
|
+
| "receipt_recorded";
|
|
64
|
+
pair: Pair | null;
|
|
65
|
+
receipt?: Parameters<typeof admitConfigureACK>[2];
|
|
66
|
+
rawReceipt?: Parameters<typeof admitConfigureACK>[1];
|
|
67
|
+
returned: boolean;
|
|
68
|
+
output?: unknown;
|
|
69
|
+
};
|
|
70
|
+
// Local actual Source identities only. JSON and public preflight output never enter this map.
|
|
71
|
+
const attempts = new WeakMap<object, History>(),
|
|
72
|
+
reserved = new WeakSet<object>();
|
|
73
|
+
function historyFor(value: unknown) {
|
|
74
|
+
return value !== null && typeof value === "object" && !types.isProxy(value)
|
|
75
|
+
? attempts.get(value)
|
|
76
|
+
: undefined;
|
|
77
|
+
}
|
|
78
|
+
function isCurrentBundle(
|
|
79
|
+
value: unknown,
|
|
80
|
+
record: PreflightRecord,
|
|
81
|
+
): value is Bundle {
|
|
82
|
+
return equal(value, {
|
|
83
|
+
...record.originalBundle,
|
|
84
|
+
wireSubscription: record.configuration.freshSubscription,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
/** Checked process-local custody only; neither a caller context nor write authority. */
|
|
88
|
+
export function readOwnedConfigureAcknowledgement(
|
|
89
|
+
operation: unknown,
|
|
90
|
+
acknowledgement: unknown,
|
|
91
|
+
record: PreflightRecord,
|
|
92
|
+
actualAttachAcknowledgement: unknown,
|
|
93
|
+
origin: unknown,
|
|
94
|
+
originalEntry: unknown,
|
|
95
|
+
) {
|
|
96
|
+
OWNER.check();
|
|
97
|
+
need(arguments.length === 6);
|
|
98
|
+
const row = historyFor(operation);
|
|
99
|
+
need(row && row.owner === OWNER && row.basis === OWNER.basis);
|
|
100
|
+
need(
|
|
101
|
+
row.origin === ORIGINAL_ORIGIN_ASSOCIATION &&
|
|
102
|
+
row.origin === origin &&
|
|
103
|
+
row.entry === originalEntry &&
|
|
104
|
+
!types.isProxy(COMPILED_INITIAL_ENTRIES) &&
|
|
105
|
+
Array.isArray(COMPILED_INITIAL_ENTRIES) &&
|
|
106
|
+
COMPILED_INITIAL_ENTRIES.includes(row.entry) &&
|
|
107
|
+
!types.isProxy(ENTRIES) &&
|
|
108
|
+
Array.isArray(ENTRIES) &&
|
|
109
|
+
ENTRIES.includes(row.configureEntry),
|
|
110
|
+
);
|
|
111
|
+
const entry = closed(row.configureEntry, [
|
|
112
|
+
"originalEntry",
|
|
113
|
+
"coversConfigure",
|
|
114
|
+
]);
|
|
115
|
+
need(entry.originalEntry === row.entry);
|
|
116
|
+
need(
|
|
117
|
+
row.actualAttachAcknowledgement === actualAttachAcknowledgement &&
|
|
118
|
+
equal(row.record, record) &&
|
|
119
|
+
row.lineage.receiptKnown &&
|
|
120
|
+
row.state === "receipt_recorded" &&
|
|
121
|
+
row.returned === true &&
|
|
122
|
+
row.output === acknowledgement &&
|
|
123
|
+
row.rawReceipt &&
|
|
124
|
+
row.receipt,
|
|
125
|
+
);
|
|
126
|
+
// Re-admit the whole18/19 wrapper, then return detached immutable DATA only.
|
|
127
|
+
const admitted = closed(
|
|
128
|
+
admitConfigureACK(row.record, row.rawReceipt, row.receipt),
|
|
129
|
+
[
|
|
130
|
+
"status",
|
|
131
|
+
"originalRecord",
|
|
132
|
+
"rawReceipt",
|
|
133
|
+
"receipt",
|
|
134
|
+
"operationalAuthority",
|
|
135
|
+
],
|
|
136
|
+
);
|
|
137
|
+
const result = Object.freeze({
|
|
138
|
+
rawReceipt: freeze(renewalSnapshot(row.rawReceipt)),
|
|
139
|
+
receipt: admitted.receipt,
|
|
140
|
+
});
|
|
141
|
+
OWNER.check();
|
|
142
|
+
return result;
|
|
143
|
+
}
|
|
144
|
+
function capture(replay: boolean) {
|
|
145
|
+
let consumed = false;
|
|
146
|
+
return Object.freeze({
|
|
147
|
+
async invoke() {
|
|
148
|
+
need(arguments.length === 0 && !consumed);
|
|
149
|
+
consumed = true;
|
|
150
|
+
need(!types.isProxy(ENTRIES) && Array.isArray(ENTRIES));
|
|
151
|
+
if (ENTRIES.length === 0)
|
|
152
|
+
return configureControl(
|
|
153
|
+
"not_dispatched",
|
|
154
|
+
"no_qualified_configure_class",
|
|
155
|
+
);
|
|
156
|
+
let pair: Pair | null = null,
|
|
157
|
+
row: History | null = null,
|
|
158
|
+
actualError: Error | null = null,
|
|
159
|
+
dispatchEntered = false,
|
|
160
|
+
structuralError: unknown,
|
|
161
|
+
hasStructuralError = false;
|
|
162
|
+
const control = (
|
|
163
|
+
status: "not_dispatched" | "configure_unknown",
|
|
164
|
+
reason: string,
|
|
165
|
+
) => {
|
|
166
|
+
if (row) row.lineage.busy = false;
|
|
167
|
+
return configureControl(status, reason);
|
|
168
|
+
};
|
|
169
|
+
try {
|
|
170
|
+
OWNER.check();
|
|
171
|
+
const live = replay
|
|
172
|
+
? loadFixedConfigureReplayOperation()
|
|
173
|
+
: loadFixedConfigureWriteOperation();
|
|
174
|
+
OWNER.check();
|
|
175
|
+
need(live !== null && typeof live === "object" && !types.isProxy(live));
|
|
176
|
+
const op = closed(
|
|
177
|
+
live,
|
|
178
|
+
replay
|
|
179
|
+
? [
|
|
180
|
+
"owner",
|
|
181
|
+
"originAssociation",
|
|
182
|
+
"originalEntry",
|
|
183
|
+
"configureEntry",
|
|
184
|
+
"previousOperation",
|
|
185
|
+
"readPlan",
|
|
186
|
+
"delegate",
|
|
187
|
+
"sink",
|
|
188
|
+
"reserve",
|
|
189
|
+
]
|
|
190
|
+
: [
|
|
191
|
+
"owner",
|
|
192
|
+
"originAssociation",
|
|
193
|
+
"originalEntry",
|
|
194
|
+
"configureEntry",
|
|
195
|
+
"originalRecord",
|
|
196
|
+
"actualAttachAcknowledgement",
|
|
197
|
+
"readPlan",
|
|
198
|
+
"delegate",
|
|
199
|
+
"sink",
|
|
200
|
+
"reserve",
|
|
201
|
+
],
|
|
202
|
+
);
|
|
203
|
+
need(
|
|
204
|
+
op.owner === OWNER &&
|
|
205
|
+
op.originAssociation !== null &&
|
|
206
|
+
typeof op.originAssociation === "object" &&
|
|
207
|
+
!types.isProxy(op.originAssociation) &&
|
|
208
|
+
op.originAssociation === ORIGINAL_ORIGIN_ASSOCIATION,
|
|
209
|
+
);
|
|
210
|
+
need(
|
|
211
|
+
!types.isProxy(COMPILED_INITIAL_ENTRIES) &&
|
|
212
|
+
Array.isArray(COMPILED_INITIAL_ENTRIES) &&
|
|
213
|
+
COMPILED_INITIAL_ENTRIES.includes(op.originalEntry),
|
|
214
|
+
);
|
|
215
|
+
need(
|
|
216
|
+
ENTRIES.includes(op.configureEntry) &&
|
|
217
|
+
!types.isProxy(op.configureEntry),
|
|
218
|
+
);
|
|
219
|
+
const coverage = closed(op.configureEntry, [
|
|
220
|
+
"originalEntry",
|
|
221
|
+
"coversConfigure",
|
|
222
|
+
]);
|
|
223
|
+
need(coverage.originalEntry === op.originalEntry);
|
|
224
|
+
const covers = ownMethod(op.configureEntry, "coversConfigure"),
|
|
225
|
+
retainedPredicate = ownMethod(op.originalEntry, "coversRetained"),
|
|
226
|
+
rawMethod = ownMethod(op.delegate, "rawRequest"),
|
|
227
|
+
reserve = ownMethod(live, "reserve"),
|
|
228
|
+
send = ownMethod(op.sink, "send");
|
|
229
|
+
const prior = replay ? historyFor(op.previousOperation) : undefined;
|
|
230
|
+
if (replay && !prior)
|
|
231
|
+
return control("not_dispatched", "prior_attempt_unavailable");
|
|
232
|
+
const sourceRecord = prior ? prior.record : op.originalRecord;
|
|
233
|
+
need(!types.isProxy(sourceRecord));
|
|
234
|
+
const raw = closed(sourceRecord, [
|
|
235
|
+
"configuration",
|
|
236
|
+
"request",
|
|
237
|
+
"attachReceipt",
|
|
238
|
+
"originalBundle",
|
|
239
|
+
]);
|
|
240
|
+
const actualAttachAcknowledgement = prior
|
|
241
|
+
? prior.actualAttachAcknowledgement
|
|
242
|
+
: op.actualAttachAcknowledgement;
|
|
243
|
+
// Detached prior record was originally proved against this actual pointer; it is not rehydrated.
|
|
244
|
+
if (!prior) need(raw.attachReceipt === actualAttachAcknowledgement);
|
|
245
|
+
const retained = capturePreflightRecord(sourceRecord);
|
|
246
|
+
OWNER.check();
|
|
247
|
+
let original: Awaited<ReturnType<typeof c6>>;
|
|
248
|
+
try {
|
|
249
|
+
original = await owned(() => c6(retained.configuration));
|
|
250
|
+
} catch (error) {
|
|
251
|
+
OWNER.check();
|
|
252
|
+
structuralError = error;
|
|
253
|
+
hasStructuralError = true;
|
|
254
|
+
throw error;
|
|
255
|
+
}
|
|
256
|
+
OWNER.check();
|
|
257
|
+
if (original.status !== "projected_configure_request") return original;
|
|
258
|
+
const ack = await owned(() => c3(retained.configuration.attachReceipt));
|
|
259
|
+
OWNER.check();
|
|
260
|
+
const record = verifyPreflightRecord(retained, original, ack);
|
|
261
|
+
const classification = await owned(() =>
|
|
262
|
+
classifyOwnedRetainedInitialAttachment({
|
|
263
|
+
attachRequest: record.configuration.attachReceipt.attachRequest,
|
|
264
|
+
originalBundle: record.originalBundle,
|
|
265
|
+
}),
|
|
266
|
+
);
|
|
267
|
+
OWNER.check();
|
|
268
|
+
need(classification.status === "classified");
|
|
269
|
+
need(
|
|
270
|
+
Reflect.apply(retainedPredicate, op.originalEntry, [
|
|
271
|
+
classification.material,
|
|
272
|
+
record.originalBundle,
|
|
273
|
+
]) === true,
|
|
274
|
+
);
|
|
275
|
+
OWNER.check();
|
|
276
|
+
const basis = OWNER.basis;
|
|
277
|
+
if (prior) {
|
|
278
|
+
need(
|
|
279
|
+
prior.owner === OWNER &&
|
|
280
|
+
prior.basis === basis &&
|
|
281
|
+
prior.origin === op.originAssociation &&
|
|
282
|
+
prior.entry === op.originalEntry &&
|
|
283
|
+
prior.configureEntry === op.configureEntry &&
|
|
284
|
+
equal(prior.record, record),
|
|
285
|
+
);
|
|
286
|
+
if (
|
|
287
|
+
prior.state !== "post_unknown" ||
|
|
288
|
+
prior.lineage.receiptKnown ||
|
|
289
|
+
prior.lineage.receiptPending ||
|
|
290
|
+
prior.lineage.busy
|
|
291
|
+
)
|
|
292
|
+
return control("not_dispatched", "prior_attempt_not_replayable");
|
|
293
|
+
if (
|
|
294
|
+
!withinConfigureRetention(
|
|
295
|
+
OWNER.check().nowSeconds,
|
|
296
|
+
record.request.firstDispatchedAt,
|
|
297
|
+
)
|
|
298
|
+
)
|
|
299
|
+
return control("not_dispatched", "retention_expired");
|
|
300
|
+
}
|
|
301
|
+
need(!reserved.has(live));
|
|
302
|
+
OWNER.check();
|
|
303
|
+
need(Reflect.apply(reserve, live, []) === true);
|
|
304
|
+
OWNER.check();
|
|
305
|
+
reserved.add(live);
|
|
306
|
+
pair = replay
|
|
307
|
+
? createConfigureReplayTransport()
|
|
308
|
+
: createConfigureWriteTransport();
|
|
309
|
+
OWNER.check();
|
|
310
|
+
need(
|
|
311
|
+
pair.capability.assertSourceOperationBinding(
|
|
312
|
+
live,
|
|
313
|
+
original,
|
|
314
|
+
op.readPlan,
|
|
315
|
+
op.delegate,
|
|
316
|
+
rawMethod,
|
|
317
|
+
expectedPlan(record),
|
|
318
|
+
),
|
|
319
|
+
);
|
|
320
|
+
OWNER.check();
|
|
321
|
+
need(pair.capability.reserveAcquisition());
|
|
322
|
+
OWNER.check();
|
|
323
|
+
const lineage = prior
|
|
324
|
+
? prior.lineage
|
|
325
|
+
: { receiptKnown: false, receiptPending: false, busy: false };
|
|
326
|
+
need(!lineage.busy && !lineage.receiptKnown && !lineage.receiptPending);
|
|
327
|
+
lineage.busy = true;
|
|
328
|
+
row = {
|
|
329
|
+
record,
|
|
330
|
+
owner: OWNER,
|
|
331
|
+
basis,
|
|
332
|
+
origin: op.originAssociation,
|
|
333
|
+
entry: op.originalEntry,
|
|
334
|
+
configureEntry: op.configureEntry,
|
|
335
|
+
actualAttachAcknowledgement,
|
|
336
|
+
lineage,
|
|
337
|
+
state: "not_started",
|
|
338
|
+
returned: false,
|
|
339
|
+
pair,
|
|
340
|
+
};
|
|
341
|
+
attempts.set(live, row);
|
|
342
|
+
const reader = bindConfigureReadAcquisitionFromSource(
|
|
343
|
+
OWNER,
|
|
344
|
+
pair.transport.readTransport,
|
|
345
|
+
Object.freeze({
|
|
346
|
+
expected: record.configuration.preparation.expected,
|
|
347
|
+
scheduleId: ack.scheduleId,
|
|
348
|
+
}),
|
|
349
|
+
);
|
|
350
|
+
OWNER.check();
|
|
351
|
+
let acquired: Awaited<ReturnType<typeof reader.acquire>>;
|
|
352
|
+
try {
|
|
353
|
+
acquired = await owned(() => reader.acquire());
|
|
354
|
+
} catch {
|
|
355
|
+
OWNER.check();
|
|
356
|
+
const fact = pair.capability.consumeReadCatch();
|
|
357
|
+
if (fact) {
|
|
358
|
+
const failure = admitConfigureFailure(
|
|
359
|
+
fact.phase,
|
|
360
|
+
fact.resource,
|
|
361
|
+
fact.ordinal,
|
|
362
|
+
original,
|
|
363
|
+
fact.diagnostics,
|
|
364
|
+
);
|
|
365
|
+
actualError = Error("OWNED_CONFIGURE_PROVIDER_REJECTED");
|
|
366
|
+
Object.defineProperty(actualError, "failure", {
|
|
367
|
+
value: failure,
|
|
368
|
+
enumerable: false,
|
|
369
|
+
writable: false,
|
|
370
|
+
configurable: false,
|
|
371
|
+
});
|
|
372
|
+
throw actualError;
|
|
373
|
+
}
|
|
374
|
+
return stop();
|
|
375
|
+
}
|
|
376
|
+
OWNER.check();
|
|
377
|
+
if (!acquired.ok) {
|
|
378
|
+
const fact = pair.capability.consumeReadCatch();
|
|
379
|
+
if (fact) {
|
|
380
|
+
const failure = admitConfigureFailure(
|
|
381
|
+
fact.phase,
|
|
382
|
+
fact.resource,
|
|
383
|
+
fact.ordinal,
|
|
384
|
+
original,
|
|
385
|
+
fact.diagnostics,
|
|
386
|
+
);
|
|
387
|
+
actualError = Error("OWNED_CONFIGURE_PROVIDER_REJECTED");
|
|
388
|
+
Object.defineProperty(actualError, "failure", {
|
|
389
|
+
value: failure,
|
|
390
|
+
enumerable: false,
|
|
391
|
+
writable: false,
|
|
392
|
+
configurable: false,
|
|
393
|
+
});
|
|
394
|
+
throw actualError;
|
|
395
|
+
}
|
|
396
|
+
return stop();
|
|
397
|
+
}
|
|
398
|
+
if (!isCurrentBundle(acquired.bundle, record))
|
|
399
|
+
return control("not_dispatched", "preconfigure_baseline_changed");
|
|
400
|
+
const evidence = Object.freeze({
|
|
401
|
+
bundle: acquired.bundle,
|
|
402
|
+
schedule: acquired.schedule,
|
|
403
|
+
observedAt: acquired.observedAt,
|
|
404
|
+
});
|
|
405
|
+
try {
|
|
406
|
+
verifyCurrentPreflight(record, evidence);
|
|
407
|
+
} catch {
|
|
408
|
+
OWNER.check();
|
|
409
|
+
return control("not_dispatched", "preconfigure_baseline_changed");
|
|
410
|
+
}
|
|
411
|
+
OWNER.check();
|
|
412
|
+
const configuration = {
|
|
413
|
+
...record.configuration,
|
|
414
|
+
freshSubscription: evidence.bundle.wireSubscription,
|
|
415
|
+
targetPrice: evidence.bundle.wireTargetPrice,
|
|
416
|
+
...(Object.prototype.hasOwnProperty.call(
|
|
417
|
+
record.configuration,
|
|
418
|
+
"billingCustomer",
|
|
419
|
+
)
|
|
420
|
+
? { billingCustomer: evidence.bundle.wireBillingCustomer }
|
|
421
|
+
: {}),
|
|
422
|
+
schedule: evidence.schedule,
|
|
423
|
+
observedAt: evidence.observedAt,
|
|
424
|
+
};
|
|
425
|
+
const fresh = await owned(() => c6(configuration));
|
|
426
|
+
OWNER.check();
|
|
427
|
+
if (fresh.status !== "projected_configure_request") {
|
|
428
|
+
row.lineage.busy = false;
|
|
429
|
+
return fresh;
|
|
430
|
+
}
|
|
431
|
+
need(equal(fresh, original) && equal(fresh, record.request));
|
|
432
|
+
need(
|
|
433
|
+
Reflect.apply(covers, op.configureEntry, [
|
|
434
|
+
record,
|
|
435
|
+
evidence,
|
|
436
|
+
fresh,
|
|
437
|
+
]) === true,
|
|
438
|
+
);
|
|
439
|
+
OWNER.check();
|
|
440
|
+
releasePreflight(record, evidence, fresh, original, ack);
|
|
441
|
+
OWNER.check();
|
|
442
|
+
const compiler = createConfigureEventCompiler(record.configuration, {
|
|
443
|
+
timeoutMs: 5000,
|
|
444
|
+
send(event: unknown, acknowledge: unknown) {
|
|
445
|
+
OWNER.check();
|
|
446
|
+
return Reflect.apply(send, op.sink, [event, acknowledge]);
|
|
447
|
+
},
|
|
448
|
+
});
|
|
449
|
+
OWNER.check();
|
|
450
|
+
dispatchEntered = true;
|
|
451
|
+
await owned(() =>
|
|
452
|
+
compiler.dispatch({
|
|
453
|
+
event: "dispatch",
|
|
454
|
+
stage: "configure",
|
|
455
|
+
request: original,
|
|
456
|
+
}),
|
|
457
|
+
);
|
|
458
|
+
OWNER.check();
|
|
459
|
+
row.state = "post_pending";
|
|
460
|
+
const activePair = pair;
|
|
461
|
+
const reply = await owned(() => activePair.transport.postConfigure());
|
|
462
|
+
OWNER.check();
|
|
463
|
+
if (activePair.capability.consumeNotStarted(reply)) {
|
|
464
|
+
row.state = "not_started";
|
|
465
|
+
return control("not_dispatched", "post_not_started");
|
|
466
|
+
}
|
|
467
|
+
const disposition = activePair.transport.postDisposition();
|
|
468
|
+
if (
|
|
469
|
+
disposition !== "REJECTED" &&
|
|
470
|
+
disposition !== "FULFILLED_UNVERIFIED" &&
|
|
471
|
+
disposition !== "FULFILLED_SAFE"
|
|
472
|
+
)
|
|
473
|
+
return control("configure_unknown", "post_unverified");
|
|
474
|
+
row.state = "post_unknown";
|
|
475
|
+
const fact = activePair.capability.consumePostCatch(reply);
|
|
476
|
+
OWNER.check();
|
|
477
|
+
if (fact) {
|
|
478
|
+
const failure = admitConfigureFailure(
|
|
479
|
+
fact.phase,
|
|
480
|
+
fact.resource,
|
|
481
|
+
fact.ordinal,
|
|
482
|
+
original,
|
|
483
|
+
fact.diagnostics,
|
|
484
|
+
);
|
|
485
|
+
actualError = Error("OWNED_CONFIGURE_PROVIDER_REJECTED");
|
|
486
|
+
Object.defineProperty(actualError, "failure", {
|
|
487
|
+
value: failure,
|
|
488
|
+
enumerable: false,
|
|
489
|
+
writable: false,
|
|
490
|
+
configurable: false,
|
|
491
|
+
});
|
|
492
|
+
throw actualError;
|
|
493
|
+
}
|
|
494
|
+
if (reply.outcome !== "fulfilled_safe")
|
|
495
|
+
return control("configure_unknown", "post_unverified");
|
|
496
|
+
await owned(() =>
|
|
497
|
+
compiler.response({
|
|
498
|
+
event: "response",
|
|
499
|
+
stage: "configure",
|
|
500
|
+
request: original,
|
|
501
|
+
body: reply.body,
|
|
502
|
+
transport: reply.transport,
|
|
503
|
+
}),
|
|
504
|
+
);
|
|
505
|
+
OWNER.check();
|
|
506
|
+
const rawReceipt = Object.freeze({
|
|
507
|
+
configuration: record.configuration,
|
|
508
|
+
actualDispatch: seven(original),
|
|
509
|
+
providerSnapshot: reply.body,
|
|
510
|
+
transport: reply.transport,
|
|
511
|
+
});
|
|
512
|
+
const receipt = await owned(() => c9(rawReceipt));
|
|
513
|
+
OWNER.check();
|
|
514
|
+
// Actual C9 success is retained before output admission or receipt-event publication.
|
|
515
|
+
// This closes the whole lineage even if either later admission/publication fails.
|
|
516
|
+
row.rawReceipt = rawReceipt;
|
|
517
|
+
row.receipt = receipt;
|
|
518
|
+
row.state = "receipt_prepared";
|
|
519
|
+
lineage.receiptKnown = true;
|
|
520
|
+
const output = admitConfigureACK(record, rawReceipt, receipt);
|
|
521
|
+
OWNER.check();
|
|
522
|
+
row.output = output;
|
|
523
|
+
lineage.receiptPending = true;
|
|
524
|
+
await owned(() =>
|
|
525
|
+
compiler.receipt({
|
|
526
|
+
event: "receipt",
|
|
527
|
+
stage: "configure",
|
|
528
|
+
request: original,
|
|
529
|
+
receipt,
|
|
530
|
+
}),
|
|
531
|
+
);
|
|
532
|
+
row.state = "receipt_recorded";
|
|
533
|
+
lineage.busy = false;
|
|
534
|
+
OWNER.check();
|
|
535
|
+
activePair.capability.discardFulfilledQuarantine();
|
|
536
|
+
row.returned = true;
|
|
537
|
+
return output;
|
|
538
|
+
} catch (error) {
|
|
539
|
+
let live = false;
|
|
540
|
+
try {
|
|
541
|
+
OWNER.check();
|
|
542
|
+
live = true;
|
|
543
|
+
} catch {
|
|
544
|
+
/* Closed Owner permits no provider reflection. */
|
|
545
|
+
}
|
|
546
|
+
if (row) {
|
|
547
|
+
row.lineage.busy = false;
|
|
548
|
+
if (live && !row.lineage.receiptKnown)
|
|
549
|
+
row.lineage.receiptPending = false;
|
|
550
|
+
}
|
|
551
|
+
if (live && hasStructuralError && error === structuralError)
|
|
552
|
+
throw error;
|
|
553
|
+
if (live && actualError !== null && error === actualError) throw error;
|
|
554
|
+
if (pair && dispatchEntered) {
|
|
555
|
+
const disposition = pair.transport.postDisposition();
|
|
556
|
+
if (disposition === "NOT_STARTED") {
|
|
557
|
+
if (!live) return stop();
|
|
558
|
+
if (row) row.state = "not_started";
|
|
559
|
+
return control("not_dispatched", "post_not_started");
|
|
560
|
+
}
|
|
561
|
+
if (
|
|
562
|
+
row &&
|
|
563
|
+
disposition !== "PENDING" &&
|
|
564
|
+
row.state !== "receipt_prepared" &&
|
|
565
|
+
row.state !== "receipt_recorded"
|
|
566
|
+
)
|
|
567
|
+
row.state = "post_unknown";
|
|
568
|
+
return control(
|
|
569
|
+
"configure_unknown",
|
|
570
|
+
live ? "post_unverified" : "owner_closed_after_post",
|
|
571
|
+
);
|
|
572
|
+
}
|
|
573
|
+
return stop();
|
|
574
|
+
}
|
|
575
|
+
},
|
|
576
|
+
});
|
|
577
|
+
}
|
|
578
|
+
/** Internal fixed zeroarg entrypoints. Normal Source registries stay EMPTY. */
|
|
579
|
+
export function captureOwnedConfigureV2() {
|
|
580
|
+
need(arguments.length === 0);
|
|
581
|
+
return capture(false);
|
|
582
|
+
}
|
|
583
|
+
export function captureOwnedConfigureReplayV2() {
|
|
584
|
+
need(arguments.length === 0);
|
|
585
|
+
return capture(true);
|
|
586
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { types } from "node:util";
|
|
2
|
+
import { rejectProxyJSON } from "../acquisition/rawWireSource.js";
|
|
3
|
+
import { requiredJSONSnapshot } from "../material/requiredJson.js";
|
|
4
|
+
import { freeze } from "../material/nodeKernel.js";
|
|
5
|
+
import { need } from "./request.js";
|
|
6
|
+
import type { Diagnostics } from "../operations/providerFailure.js";
|
|
7
|
+
const responsePrototype = Response.prototype;
|
|
8
|
+
const statusGetter = Object.getOwnPropertyDescriptor(
|
|
9
|
+
responsePrototype,
|
|
10
|
+
"status",
|
|
11
|
+
)!.get!;
|
|
12
|
+
|
|
13
|
+
/** Owner gating is supplied by the actual pair before this DATA capture. */
|
|
14
|
+
export function captureConfigureReply(raw: unknown) {
|
|
15
|
+
rejectProxyJSON(raw, true);
|
|
16
|
+
need(raw !== null && typeof raw === "object" && !Array.isArray(raw));
|
|
17
|
+
const proto = Object.getPrototypeOf(raw);
|
|
18
|
+
need(proto === Object.prototype || proto === null);
|
|
19
|
+
const descriptor = Object.getOwnPropertyDescriptor(raw, "lastResponse");
|
|
20
|
+
need(
|
|
21
|
+
descriptor &&
|
|
22
|
+
!descriptor.enumerable &&
|
|
23
|
+
"value" in descriptor &&
|
|
24
|
+
descriptor.value !== null &&
|
|
25
|
+
typeof descriptor.value === "object" &&
|
|
26
|
+
!types.isProxy(descriptor.value),
|
|
27
|
+
);
|
|
28
|
+
const meta: object = descriptor.value,
|
|
29
|
+
codes: unknown[] = [];
|
|
30
|
+
for (const key of ["status", "statusCode"]) {
|
|
31
|
+
const d = Object.getOwnPropertyDescriptor(meta, key);
|
|
32
|
+
if (d) {
|
|
33
|
+
need("value" in d);
|
|
34
|
+
if (d.value !== undefined) codes.push(d.value);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (Object.getPrototypeOf(meta) === responsePrototype)
|
|
38
|
+
codes.push(Reflect.apply(statusGetter, meta, []));
|
|
39
|
+
need(
|
|
40
|
+
codes.length > 0 &&
|
|
41
|
+
codes.every(
|
|
42
|
+
(x) =>
|
|
43
|
+
typeof x === "number" &&
|
|
44
|
+
Number.isInteger(x) &&
|
|
45
|
+
x >= 200 &&
|
|
46
|
+
x < 300 &&
|
|
47
|
+
x === codes[0],
|
|
48
|
+
),
|
|
49
|
+
);
|
|
50
|
+
const status = codes[0];
|
|
51
|
+
need(typeof status === "number");
|
|
52
|
+
const entries: [string, unknown][] = [];
|
|
53
|
+
for (const key of Reflect.ownKeys(raw)) {
|
|
54
|
+
need(typeof key === "string");
|
|
55
|
+
if (key === "lastResponse") continue;
|
|
56
|
+
const d = Object.getOwnPropertyDescriptor(raw, key);
|
|
57
|
+
need(d && d.enumerable && "value" in d);
|
|
58
|
+
entries.push([key, d.value]);
|
|
59
|
+
}
|
|
60
|
+
const body = requiredJSONSnapshot(Object.fromEntries(entries));
|
|
61
|
+
need(body !== null && typeof body === "object" && !Array.isArray(body));
|
|
62
|
+
const d = Object.getOwnPropertyDescriptor(meta, "requestId");
|
|
63
|
+
let requestId: string | undefined;
|
|
64
|
+
if (d) {
|
|
65
|
+
need("value" in d);
|
|
66
|
+
if (d.value !== undefined) {
|
|
67
|
+
need(
|
|
68
|
+
typeof d.value === "string" &&
|
|
69
|
+
d.value.length >= 1 &&
|
|
70
|
+
d.value.length <= 255,
|
|
71
|
+
);
|
|
72
|
+
requiredJSONSnapshot(d.value);
|
|
73
|
+
requestId = d.value;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return freeze({
|
|
77
|
+
body: body as Record<string, unknown>,
|
|
78
|
+
transport: { status, ...(requestId === undefined ? {} : { requestId }) },
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
/** Read own DATA only after actual live catch. Unsafe optional diagnostics are omitted. */
|
|
82
|
+
export function configureDiagnostics(raw: unknown): Diagnostics {
|
|
83
|
+
const result: {
|
|
84
|
+
type?: string;
|
|
85
|
+
code?: string;
|
|
86
|
+
statusCode?: number;
|
|
87
|
+
requestId?: string;
|
|
88
|
+
} = {};
|
|
89
|
+
if (raw === null || typeof raw !== "object" || types.isProxy(raw))
|
|
90
|
+
return Object.freeze(result);
|
|
91
|
+
for (const key of ["type", "code", "statusCode", "requestId"] as const) {
|
|
92
|
+
const d = Object.getOwnPropertyDescriptor(raw, key);
|
|
93
|
+
if (!d || !("value" in d)) continue;
|
|
94
|
+
const value: unknown = d.value;
|
|
95
|
+
if (key === "statusCode") {
|
|
96
|
+
if (
|
|
97
|
+
typeof value === "number" &&
|
|
98
|
+
Number.isInteger(value) &&
|
|
99
|
+
value >= 100 &&
|
|
100
|
+
value <= 599
|
|
101
|
+
)
|
|
102
|
+
result[key] = value;
|
|
103
|
+
} else if (
|
|
104
|
+
typeof value === "string" &&
|
|
105
|
+
value.length >= 1 &&
|
|
106
|
+
value.length <= 255
|
|
107
|
+
) {
|
|
108
|
+
try {
|
|
109
|
+
requiredJSONSnapshot(value);
|
|
110
|
+
result[key] = value;
|
|
111
|
+
} catch {
|
|
112
|
+
/* Unsafe diagnostics do not change actual catch identity. */
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return Object.freeze(result);
|
|
117
|
+
}
|