@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
|
@@ -332,6 +332,74 @@ provider compare-and-swap; host serialization cannot exclude Dashboard or other
|
|
|
332
332
|
provider writers. Required consumer contexts outside this finite profile remain
|
|
333
333
|
open instead of being replaced by a provenance flag or hidden fallback.
|
|
334
334
|
|
|
335
|
+
## Internal owned configure preflight
|
|
336
|
+
|
|
337
|
+
The internal `captureOwnedConfigurePreflightV2` captures one fixed Source
|
|
338
|
+
operation and permits one invocation. Its normal registry is empty and its
|
|
339
|
+
Source bindings remain unbound. It has no package export or caller-supplied
|
|
340
|
+
owner, client or qualification context.
|
|
341
|
+
|
|
342
|
+
The Source association must retain the actual initial attachment's acknowledged
|
|
343
|
+
receipt identity. Reconstructing an equal receipt with the public constructor
|
|
344
|
+
does not establish that association. After bounded record capture, the original
|
|
345
|
+
public configuration projection runs first. A supported projection Failure
|
|
346
|
+
returns unchanged before the actor's explicit receipt reconstruction, reads or
|
|
347
|
+
coverage checks.
|
|
348
|
+
|
|
349
|
+
On success, a separate read-only transport admits at most 44 GETs. The Schedule
|
|
350
|
+
is read before the same acquisition lifetime finishes. Complete current raw
|
|
351
|
+
Subscription, Price, Customer, Coupon and Schedule material must match the
|
|
352
|
+
retained preconfigure baseline, including unknown fields and counters. A fresh
|
|
353
|
+
projection must equal the entire retained request. The result retains the final
|
|
354
|
+
Schedule read's timestamp even when later owner checks sample a newer time.
|
|
355
|
+
|
|
356
|
+
`configure_preflight_consistent` contains `originalRecord`, `currentEvidence`,
|
|
357
|
+
`request` and `operationalAuthority: false`. The complete result is detached,
|
|
358
|
+
bounded and frozen before its final owner check. It grants no write authority
|
|
359
|
+
and makes no POST. These sequential snapshots provide no atomic exclusion of
|
|
360
|
+
concurrent provider changes.
|
|
361
|
+
|
|
362
|
+
## Internal configure dispatch and explicit replay
|
|
363
|
+
|
|
364
|
+
The internal configure writer uses distinct fixed Source operations for an
|
|
365
|
+
initial invocation and an explicit replay. Each captured handle is single-use.
|
|
366
|
+
Its normal registry remains empty and its loaders unbound; these internal
|
|
367
|
+
operations have no package export or caller-supplied qualification context.
|
|
368
|
+
|
|
369
|
+
Each invocation performs its own preflight within a new transport that permits
|
|
370
|
+
at most 44 GETs followed by one configure POST. The detached read-only preflight
|
|
371
|
+
result cannot authorize that POST. The writer requires the original attachment
|
|
372
|
+
receipt association, complete retained request and current raw baseline, plus a
|
|
373
|
+
separate configure coverage relation. A supported original projection Failure
|
|
374
|
+
returns unchanged before receipt proof, reads or reservation.
|
|
375
|
+
|
|
376
|
+
Before mutation, the dispatch event must both finish sending and receive its
|
|
377
|
+
matching acknowledgement. A safe provider response is likewise sent and
|
|
378
|
+
acknowledged before the public receipt constructor runs. Complete acknowledged
|
|
379
|
+
output must fit the JSON limits before the receipt event is sent and
|
|
380
|
+
acknowledged. A later refusal preserves earlier retained events. An acknowledged
|
|
381
|
+
configure receipt establishes neither pending nor effective state.
|
|
382
|
+
|
|
383
|
+
Explicit replay requires an actual earlier terminal unknown POST from the same
|
|
384
|
+
internal operation lineage. An unknown return value alone grants no replay;
|
|
385
|
+
an ambiguous delegate start without a settled POST fact remains non-replayable.
|
|
386
|
+
Replay retains the original request, payload, key, first-dispatch time, Owner
|
|
387
|
+
and preconfigure baseline. It also requires a live original Owner
|
|
388
|
+
and a nonnegative elapsed interval strictly below 24 hours. Owner expiry can
|
|
389
|
+
prevent replay much earlier. An already-applied two-phase schedule or any other
|
|
390
|
+
baseline drift prevents another POST and requires observation. Once the writer
|
|
391
|
+
constructs a valid receipt from its actual acknowledged response, the older
|
|
392
|
+
unknown attempts in that lineage close. A later output-limit or
|
|
393
|
+
receipt-publication failure cannot reopen them; the known receipt remains
|
|
394
|
+
retained. Calling the pure receipt constructor alone establishes no response
|
|
395
|
+
provenance or custody.
|
|
396
|
+
|
|
397
|
+
There is no automatic replay, key rotation, unkeyed fallback or rollback. The
|
|
398
|
+
internal history is process-local. It does not provide durable storage,
|
|
399
|
+
authority rehydration after a restart or permanent provider replay. A qualified
|
|
400
|
+
host integration must separately retain original request and receipt custody.
|
|
401
|
+
Native/provider and genuine Source qualification remain acceptance requirements.
|
|
402
|
+
|
|
335
403
|
## Internal event continuations
|
|
336
404
|
|
|
337
405
|
The internal C10 compilers reconstruct each attach or configure event from its
|
|
@@ -8,7 +8,9 @@ change `readRenewalPriceReplacementContext` or any public package export.
|
|
|
8
8
|
same original-operation Owner and the fixed stock Stripe delegate. The compiled
|
|
9
9
|
registry is empty and Source loaders remain unbound, so normal package use cannot
|
|
10
10
|
start this reader or make a request through it. There is no caller-supplied
|
|
11
|
-
client, clock, qualification flag or replacement deadline.
|
|
11
|
+
client, clock, qualification flag or replacement deadline. Internal operation
|
|
12
|
+
composition can bind the same reader to an already selected transport pair.
|
|
13
|
+
That binding returns unsigned read data and grants no operation authority.
|
|
12
14
|
|
|
13
15
|
## Read sequence and data
|
|
14
16
|
|
|
@@ -26,7 +28,17 @@ The joins retain each discount's source index, original Coupon reference and
|
|
|
26
28
|
read index. They do not replace the discounts in the raw Subscription. Unknown
|
|
27
29
|
JSON fields, counters, decimal strings and own `__proto__` data survive the
|
|
28
30
|
bounded copy. A non-null Schedule association remains an observation; the reader
|
|
29
|
-
does not create an attachment receipt or fetch a Schedule.
|
|
31
|
+
does not create an attachment receipt or fetch a Schedule in the attach profile.
|
|
32
|
+
|
|
33
|
+
The separate internal configure-read profile captures an expected subscription
|
|
34
|
+
and Schedule ID once. It follows the same Subscription, Price, Customer and
|
|
35
|
+
Coupon sequence, then reads that exact Schedule before the same child lifetime
|
|
36
|
+
finishes. The Subscription's Schedule reference must match the captured ID.
|
|
37
|
+
This profile allows at most 44 GETs and has no POST. Its result adds the complete
|
|
38
|
+
raw `schedule` alongside `bundle`; it preserves unknown Schedule fields rather
|
|
39
|
+
than reconstructing a Schedule from selected properties. The complete wrapper
|
|
40
|
+
must fit the same JSON limits. These reads do not establish receipt custody or
|
|
41
|
+
permission to configure the Schedule.
|
|
30
42
|
|
|
31
43
|
Every original identity, account, mode and paid-period predicate still applies.
|
|
32
44
|
Each body and the complete result must fit 500,000 JSON characters and UTF-8
|
|
@@ -57,8 +69,10 @@ unbound.
|
|
|
57
69
|
|
|
58
70
|
Failure returns the fixed content-free `RAW_ACQUISITION_STOP` result; partial
|
|
59
71
|
bodies and raw errors are not exposed. `observedAt` comes from the accepted
|
|
60
|
-
original Owner sample.
|
|
61
|
-
|
|
62
|
-
|
|
72
|
+
original Owner sample after the final read. A later liveness check does not
|
|
73
|
+
replace that timestamp. Success labels explicitly leave source fulfillment,
|
|
74
|
+
clock provenance and operator readiness false. The 43-call attach bound and
|
|
75
|
+
44-call configure-read bound count helper invocations, not a network trace.
|
|
76
|
+
These internal mechanics do not establish
|
|
63
77
|
provider execution, custody, an authenticated clock, attachment dispatch or a
|
|
64
78
|
qualified operational profile.
|
package/package.json
CHANGED
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import { types } from "node:util";
|
|
2
|
+
import { OWNER } from "../originalOwner.js";
|
|
3
|
+
import { createSourceStockRawDelegate } from "../stockRawDelegate.js";
|
|
4
|
+
import { freeze } from "../material/nodeKernel.js";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
import {
|
|
7
|
+
renewalExpected,
|
|
8
|
+
renewalSubscription,
|
|
9
|
+
renewalPrice,
|
|
10
|
+
renewalBillingCustomer,
|
|
11
|
+
} from "../../../renewalReplacementSchema.js";
|
|
12
|
+
import {
|
|
13
|
+
resourceId,
|
|
14
|
+
productId,
|
|
15
|
+
referenceId,
|
|
16
|
+
} from "../../../renewalAggregate/shared.js";
|
|
17
|
+
import { requiredJSONSnapshot } from "../material/requiredJson.js";
|
|
18
|
+
import { createReadLifetime } from "./readLifetime.js";
|
|
19
|
+
import {
|
|
20
|
+
bindWireSource,
|
|
21
|
+
rejectProxyJSON,
|
|
22
|
+
type RawReadTransport,
|
|
23
|
+
} from "./rawWireSource.js";
|
|
24
|
+
import { acquireCouponJoins } from "./rawCouponJoins.js";
|
|
25
|
+
const need: (x: unknown) => asserts x = (x) => {
|
|
26
|
+
if (!x) throw Error("RAW_ACQUISITION_STOP");
|
|
27
|
+
};
|
|
28
|
+
const STOP = Object.freeze({
|
|
29
|
+
ok: false,
|
|
30
|
+
complete: false,
|
|
31
|
+
code: "RAW_ACQUISITION_STOP",
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
type RawSuccess = Readonly<{
|
|
35
|
+
ok: true;
|
|
36
|
+
dataOnly: true;
|
|
37
|
+
bundle: {
|
|
38
|
+
wireSubscription: Record<string, unknown>;
|
|
39
|
+
wireTargetPrice: Record<string, unknown>;
|
|
40
|
+
wireBillingCustomer: Record<string, unknown>;
|
|
41
|
+
} & Awaited<ReturnType<typeof acquireCouponJoins>>;
|
|
42
|
+
observedAt: number;
|
|
43
|
+
sourceFulfillmentEstablished: false;
|
|
44
|
+
clockProvenanceEstablished: false;
|
|
45
|
+
operatorReady: false;
|
|
46
|
+
}>;
|
|
47
|
+
export type RawAcquisitionResult = typeof STOP | RawSuccess;
|
|
48
|
+
export type RawConfigureAcquisitionResult =
|
|
49
|
+
typeof STOP | (RawSuccess & Readonly<{ schedule: Record<string, unknown> }>);
|
|
50
|
+
const observed = z.union([
|
|
51
|
+
z.null(),
|
|
52
|
+
resourceId("sub_sched"),
|
|
53
|
+
z
|
|
54
|
+
.object({
|
|
55
|
+
id: resourceId("sub_sched"),
|
|
56
|
+
object: z.literal("subscription_schedule"),
|
|
57
|
+
deleted: z.literal(false).optional(),
|
|
58
|
+
})
|
|
59
|
+
.passthrough(),
|
|
60
|
+
]);
|
|
61
|
+
const subscriptionView = renewalSubscription.extend({ schedule: observed });
|
|
62
|
+
// No public/operational entry binds this primitive. Only the separate TEST port binds fakes.
|
|
63
|
+
export function createSourceRawAcquisition(): Readonly<{
|
|
64
|
+
acquire(rawExpected: unknown): Promise<RawAcquisitionResult>;
|
|
65
|
+
}> {
|
|
66
|
+
if (arguments.length !== 0) throw Error("RAW_ACQUISITION_STOP");
|
|
67
|
+
const sourceOwner = OWNER;
|
|
68
|
+
sourceOwner.check();
|
|
69
|
+
const sourceTransport = createSourceStockRawDelegate();
|
|
70
|
+
sourceOwner.check();
|
|
71
|
+
return createSelectedRawAcquisition(sourceOwner, sourceTransport);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** Internal mechanical binding. It returns unsigned read data, not an operation context. */
|
|
75
|
+
export function bindRawAcquisitionFromSource(
|
|
76
|
+
sourceOwner: typeof OWNER,
|
|
77
|
+
sourceTransport: RawReadTransport,
|
|
78
|
+
): Readonly<{ acquire(rawExpected: unknown): Promise<RawAcquisitionResult> }> {
|
|
79
|
+
if (arguments.length !== 2 || sourceOwner !== OWNER)
|
|
80
|
+
throw Error("RAW_ACQUISITION_STOP");
|
|
81
|
+
sourceOwner.check();
|
|
82
|
+
const capturedTransport = captureTransport(sourceTransport);
|
|
83
|
+
sourceOwner.check();
|
|
84
|
+
return createSelectedRawAcquisition(sourceOwner, capturedTransport);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** Fixed readonly configure profile. Its output is unsigned DATA, never operation authority. */
|
|
88
|
+
export function bindConfigureReadAcquisitionFromSource(
|
|
89
|
+
sourceOwner: typeof OWNER,
|
|
90
|
+
sourceTransport: RawReadTransport,
|
|
91
|
+
fixedScope: Readonly<{ expected: unknown; scheduleId: string }>,
|
|
92
|
+
): Readonly<{ acquire(): Promise<RawConfigureAcquisitionResult> }> {
|
|
93
|
+
if (arguments.length !== 3 || sourceOwner !== OWNER)
|
|
94
|
+
throw Error("RAW_ACQUISITION_STOP");
|
|
95
|
+
sourceOwner.check();
|
|
96
|
+
need(fixedScope !== null && typeof fixedScope === "object");
|
|
97
|
+
need(!types.isProxy(fixedScope));
|
|
98
|
+
const prototype = Object.getPrototypeOf(fixedScope);
|
|
99
|
+
need(prototype === Object.prototype || prototype === null);
|
|
100
|
+
const keys = Reflect.ownKeys(fixedScope);
|
|
101
|
+
need(
|
|
102
|
+
keys.length === 2 &&
|
|
103
|
+
keys.includes("expected") &&
|
|
104
|
+
keys.includes("scheduleId"),
|
|
105
|
+
);
|
|
106
|
+
const expectedDescriptor = Object.getOwnPropertyDescriptor(
|
|
107
|
+
fixedScope,
|
|
108
|
+
"expected",
|
|
109
|
+
),
|
|
110
|
+
scheduleDescriptor = Object.getOwnPropertyDescriptor(
|
|
111
|
+
fixedScope,
|
|
112
|
+
"scheduleId",
|
|
113
|
+
);
|
|
114
|
+
need(
|
|
115
|
+
expectedDescriptor &&
|
|
116
|
+
expectedDescriptor.enumerable &&
|
|
117
|
+
"value" in expectedDescriptor,
|
|
118
|
+
);
|
|
119
|
+
need(
|
|
120
|
+
scheduleDescriptor &&
|
|
121
|
+
scheduleDescriptor.enumerable &&
|
|
122
|
+
"value" in scheduleDescriptor,
|
|
123
|
+
);
|
|
124
|
+
need(typeof scheduleDescriptor.value === "string");
|
|
125
|
+
rejectProxyJSON(expectedDescriptor.value);
|
|
126
|
+
const expected = freeze(requiredJSONSnapshot(expectedDescriptor.value)),
|
|
127
|
+
scheduleId = resourceId("sub_sched").parse(scheduleDescriptor.value),
|
|
128
|
+
capturedTransport = captureTransport(sourceTransport);
|
|
129
|
+
sourceOwner.check();
|
|
130
|
+
const reader = createSelectedRawAcquisition(
|
|
131
|
+
sourceOwner,
|
|
132
|
+
capturedTransport,
|
|
133
|
+
scheduleId,
|
|
134
|
+
);
|
|
135
|
+
return Object.freeze({
|
|
136
|
+
acquire() {
|
|
137
|
+
return reader.acquire(expected);
|
|
138
|
+
},
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function captureTransport(sourceTransport: RawReadTransport): RawReadTransport {
|
|
143
|
+
need(sourceTransport !== null && typeof sourceTransport === "object");
|
|
144
|
+
need(!types.isProxy(sourceTransport));
|
|
145
|
+
const prototype = Object.getPrototypeOf(sourceTransport);
|
|
146
|
+
need(prototype === Object.prototype || prototype === null);
|
|
147
|
+
const keys = Reflect.ownKeys(sourceTransport);
|
|
148
|
+
need(keys.length === 1 && keys[0] === "rawRequest");
|
|
149
|
+
const descriptor = Object.getOwnPropertyDescriptor(
|
|
150
|
+
sourceTransport,
|
|
151
|
+
"rawRequest",
|
|
152
|
+
);
|
|
153
|
+
need(
|
|
154
|
+
descriptor &&
|
|
155
|
+
descriptor.enumerable &&
|
|
156
|
+
"value" in descriptor &&
|
|
157
|
+
typeof descriptor.value === "function",
|
|
158
|
+
);
|
|
159
|
+
const method = descriptor.value as RawReadTransport["rawRequest"];
|
|
160
|
+
const capturedTransport: RawReadTransport = Object.freeze({
|
|
161
|
+
rawRequest(...args: Parameters<RawReadTransport["rawRequest"]>) {
|
|
162
|
+
return Reflect.apply(method, sourceTransport, args) as ReturnType<
|
|
163
|
+
RawReadTransport["rawRequest"]
|
|
164
|
+
>;
|
|
165
|
+
},
|
|
166
|
+
});
|
|
167
|
+
return capturedTransport;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function createSelectedRawAcquisition(
|
|
171
|
+
sourceOwner: typeof OWNER,
|
|
172
|
+
sourceTransport: RawReadTransport,
|
|
173
|
+
): Readonly<{ acquire(rawExpected: unknown): Promise<RawAcquisitionResult> }>;
|
|
174
|
+
function createSelectedRawAcquisition(
|
|
175
|
+
sourceOwner: typeof OWNER,
|
|
176
|
+
sourceTransport: RawReadTransport,
|
|
177
|
+
fixedScheduleId: string,
|
|
178
|
+
): Readonly<{
|
|
179
|
+
acquire(rawExpected: unknown): Promise<RawConfigureAcquisitionResult>;
|
|
180
|
+
}>;
|
|
181
|
+
function createSelectedRawAcquisition(
|
|
182
|
+
sourceOwner: typeof OWNER,
|
|
183
|
+
sourceTransport: RawReadTransport,
|
|
184
|
+
fixedScheduleId: string | null = null,
|
|
185
|
+
): Readonly<{
|
|
186
|
+
acquire(
|
|
187
|
+
rawExpected: unknown,
|
|
188
|
+
): Promise<RawAcquisitionResult | RawConfigureAcquisitionResult>;
|
|
189
|
+
}> {
|
|
190
|
+
const lifetime = createReadLifetime(sourceOwner),
|
|
191
|
+
read = bindWireSource(sourceTransport, lifetime);
|
|
192
|
+
return Object.freeze({
|
|
193
|
+
async acquire(rawExpected: unknown) {
|
|
194
|
+
try {
|
|
195
|
+
if (!lifetime.begin()) return STOP;
|
|
196
|
+
} catch {
|
|
197
|
+
return STOP;
|
|
198
|
+
}
|
|
199
|
+
try {
|
|
200
|
+
rejectProxyJSON(rawExpected);
|
|
201
|
+
const expected = renewalExpected.parse(
|
|
202
|
+
requiredJSONSnapshot(rawExpected),
|
|
203
|
+
),
|
|
204
|
+
context = {
|
|
205
|
+
customerAccountId: expected.customerAccountId,
|
|
206
|
+
livemode: expected.livemode,
|
|
207
|
+
};
|
|
208
|
+
const wireSubscription = await read(
|
|
209
|
+
"subscription",
|
|
210
|
+
expected.subscriptionId,
|
|
211
|
+
);
|
|
212
|
+
lifetime.check();
|
|
213
|
+
const subscription = subscriptionView.parse(wireSubscription),
|
|
214
|
+
item = subscription.items.data[0];
|
|
215
|
+
need(
|
|
216
|
+
subscription.id === expected.subscriptionId &&
|
|
217
|
+
subscription.customer_account === expected.customerAccountId &&
|
|
218
|
+
subscription.livemode === expected.livemode &&
|
|
219
|
+
item.id === expected.itemId &&
|
|
220
|
+
item.subscription === expected.subscriptionId &&
|
|
221
|
+
item.price.id === expected.currentPriceId &&
|
|
222
|
+
item.price.livemode === expected.livemode &&
|
|
223
|
+
productId(item.price.product, context) ===
|
|
224
|
+
expected.currentProductId &&
|
|
225
|
+
item.current_period_start === expected.periodStart &&
|
|
226
|
+
item.current_period_end === expected.periodEnd,
|
|
227
|
+
);
|
|
228
|
+
const wireTargetPrice = await read("price", expected.targetPriceId);
|
|
229
|
+
lifetime.check();
|
|
230
|
+
const price = renewalPrice.parse(wireTargetPrice);
|
|
231
|
+
need(
|
|
232
|
+
price.id === expected.targetPriceId &&
|
|
233
|
+
price.livemode === expected.livemode &&
|
|
234
|
+
productId(price.product, context) === expected.targetProductId,
|
|
235
|
+
);
|
|
236
|
+
const customerID = referenceId(
|
|
237
|
+
subscription.customer,
|
|
238
|
+
"cus",
|
|
239
|
+
"customer",
|
|
240
|
+
context,
|
|
241
|
+
),
|
|
242
|
+
wireBillingCustomer = await read("customer", customerID);
|
|
243
|
+
lifetime.check();
|
|
244
|
+
const customer = renewalBillingCustomer.parse(wireBillingCustomer);
|
|
245
|
+
need(
|
|
246
|
+
customer.id === customerID &&
|
|
247
|
+
customer.customer_account === expected.customerAccountId &&
|
|
248
|
+
customer.livemode === expected.livemode,
|
|
249
|
+
);
|
|
250
|
+
const joined = await acquireCouponJoins(
|
|
251
|
+
wireSubscription,
|
|
252
|
+
(wireSubscription as z.infer<typeof subscriptionView>).items.data[0],
|
|
253
|
+
expected.livemode,
|
|
254
|
+
read,
|
|
255
|
+
lifetime,
|
|
256
|
+
);
|
|
257
|
+
lifetime.check();
|
|
258
|
+
let schedule: Record<string, unknown> | undefined;
|
|
259
|
+
if (fixedScheduleId !== null) {
|
|
260
|
+
need(
|
|
261
|
+
referenceId(
|
|
262
|
+
subscription.schedule,
|
|
263
|
+
"sub_sched",
|
|
264
|
+
"subscription_schedule",
|
|
265
|
+
context,
|
|
266
|
+
) === fixedScheduleId,
|
|
267
|
+
);
|
|
268
|
+
schedule = await read("schedule", fixedScheduleId);
|
|
269
|
+
lifetime.check();
|
|
270
|
+
need(
|
|
271
|
+
schedule.id === fixedScheduleId &&
|
|
272
|
+
schedule.object === "subscription_schedule" &&
|
|
273
|
+
schedule.deleted !== true,
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
const sample = lifetime.check(),
|
|
277
|
+
bundle = {
|
|
278
|
+
wireSubscription,
|
|
279
|
+
wireTargetPrice,
|
|
280
|
+
wireBillingCustomer,
|
|
281
|
+
...joined,
|
|
282
|
+
};
|
|
283
|
+
const result = requiredJSONSnapshot({
|
|
284
|
+
ok: true,
|
|
285
|
+
dataOnly: true,
|
|
286
|
+
bundle,
|
|
287
|
+
...(fixedScheduleId === null ? {} : { schedule }),
|
|
288
|
+
observedAt: Math.floor(sample.wallMs / 1000),
|
|
289
|
+
sourceFulfillmentEstablished: false,
|
|
290
|
+
clockProvenanceEstablished: false,
|
|
291
|
+
operatorReady: false,
|
|
292
|
+
}) as RawAcquisitionResult | RawConfigureAcquisitionResult;
|
|
293
|
+
lifetime.finish();
|
|
294
|
+
return freeze(result);
|
|
295
|
+
} catch {
|
|
296
|
+
try {
|
|
297
|
+
lifetime.check();
|
|
298
|
+
} catch {}
|
|
299
|
+
lifetime.fail();
|
|
300
|
+
return STOP;
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
});
|
|
304
|
+
}
|
|
@@ -1,160 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { freeze } from "../material/nodeKernel.js";
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
import {
|
|
6
|
-
renewalExpected,
|
|
7
|
-
renewalSubscription,
|
|
8
|
-
renewalPrice,
|
|
9
|
-
renewalBillingCustomer,
|
|
10
|
-
} from "../../../renewalReplacementSchema.js";
|
|
11
|
-
import {
|
|
12
|
-
resourceId,
|
|
13
|
-
productId,
|
|
14
|
-
referenceId,
|
|
15
|
-
} from "../../../renewalAggregate/shared.js";
|
|
16
|
-
import { requiredJSONSnapshot } from "../material/requiredJson.js";
|
|
17
|
-
import { createReadLifetime } from "./readLifetime.js";
|
|
18
|
-
import { bindWireSource, rejectProxyJSON } from "./rawWireSource.js";
|
|
19
|
-
import { acquireCouponJoins } from "./rawCouponJoins.js";
|
|
20
|
-
const need: (x: unknown) => asserts x = (x) => {
|
|
21
|
-
if (!x) throw Error("RAW_ACQUISITION_STOP");
|
|
22
|
-
};
|
|
23
|
-
const STOP = Object.freeze({
|
|
24
|
-
ok: false,
|
|
25
|
-
complete: false,
|
|
26
|
-
code: "RAW_ACQUISITION_STOP",
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
export type RawAcquisitionResult =
|
|
30
|
-
| typeof STOP
|
|
31
|
-
| Readonly<{
|
|
32
|
-
ok: true;
|
|
33
|
-
dataOnly: true;
|
|
34
|
-
bundle: {
|
|
35
|
-
wireSubscription: Record<string, unknown>;
|
|
36
|
-
wireTargetPrice: Record<string, unknown>;
|
|
37
|
-
wireBillingCustomer: Record<string, unknown>;
|
|
38
|
-
} & Awaited<ReturnType<typeof acquireCouponJoins>>;
|
|
39
|
-
observedAt: number;
|
|
40
|
-
sourceFulfillmentEstablished: false;
|
|
41
|
-
clockProvenanceEstablished: false;
|
|
42
|
-
operatorReady: false;
|
|
43
|
-
}>;
|
|
44
|
-
const observed = z.union([
|
|
45
|
-
z.null(),
|
|
46
|
-
resourceId("sub_sched"),
|
|
47
|
-
z
|
|
48
|
-
.object({
|
|
49
|
-
id: resourceId("sub_sched"),
|
|
50
|
-
object: z.literal("subscription_schedule"),
|
|
51
|
-
deleted: z.literal(false).optional(),
|
|
52
|
-
})
|
|
53
|
-
.passthrough(),
|
|
54
|
-
]);
|
|
55
|
-
const subscriptionView = renewalSubscription.extend({ schedule: observed });
|
|
56
|
-
// No public/operational entry binds this primitive. Only the separate TEST port binds fakes.
|
|
57
|
-
export function createSourceRawAcquisition(): Readonly<{
|
|
58
|
-
acquire(rawExpected: unknown): Promise<RawAcquisitionResult>;
|
|
59
|
-
}> {
|
|
60
|
-
if (arguments.length !== 0) throw Error("RAW_ACQUISITION_STOP");
|
|
61
|
-
const sourceOwner = OWNER;
|
|
62
|
-
sourceOwner.check();
|
|
63
|
-
const sourceTransport = createSourceStockRawDelegate();
|
|
64
|
-
sourceOwner.check();
|
|
65
|
-
const lifetime = createReadLifetime(sourceOwner),
|
|
66
|
-
read = bindWireSource(sourceTransport, lifetime);
|
|
67
|
-
return Object.freeze({
|
|
68
|
-
async acquire(rawExpected: unknown) {
|
|
69
|
-
try {
|
|
70
|
-
if (!lifetime.begin()) return STOP;
|
|
71
|
-
} catch {
|
|
72
|
-
return STOP;
|
|
73
|
-
}
|
|
74
|
-
try {
|
|
75
|
-
rejectProxyJSON(rawExpected);
|
|
76
|
-
const expected = renewalExpected.parse(
|
|
77
|
-
requiredJSONSnapshot(rawExpected),
|
|
78
|
-
),
|
|
79
|
-
context = {
|
|
80
|
-
customerAccountId: expected.customerAccountId,
|
|
81
|
-
livemode: expected.livemode,
|
|
82
|
-
};
|
|
83
|
-
const wireSubscription = await read(
|
|
84
|
-
"subscription",
|
|
85
|
-
expected.subscriptionId,
|
|
86
|
-
);
|
|
87
|
-
lifetime.check();
|
|
88
|
-
const subscription = subscriptionView.parse(wireSubscription),
|
|
89
|
-
item = subscription.items.data[0];
|
|
90
|
-
need(
|
|
91
|
-
subscription.id === expected.subscriptionId &&
|
|
92
|
-
subscription.customer_account === expected.customerAccountId &&
|
|
93
|
-
subscription.livemode === expected.livemode &&
|
|
94
|
-
item.id === expected.itemId &&
|
|
95
|
-
item.subscription === expected.subscriptionId &&
|
|
96
|
-
item.price.id === expected.currentPriceId &&
|
|
97
|
-
item.price.livemode === expected.livemode &&
|
|
98
|
-
productId(item.price.product, context) ===
|
|
99
|
-
expected.currentProductId &&
|
|
100
|
-
item.current_period_start === expected.periodStart &&
|
|
101
|
-
item.current_period_end === expected.periodEnd,
|
|
102
|
-
);
|
|
103
|
-
const wireTargetPrice = await read("price", expected.targetPriceId);
|
|
104
|
-
lifetime.check();
|
|
105
|
-
const price = renewalPrice.parse(wireTargetPrice);
|
|
106
|
-
need(
|
|
107
|
-
price.id === expected.targetPriceId &&
|
|
108
|
-
price.livemode === expected.livemode &&
|
|
109
|
-
productId(price.product, context) === expected.targetProductId,
|
|
110
|
-
);
|
|
111
|
-
const customerID = referenceId(
|
|
112
|
-
subscription.customer,
|
|
113
|
-
"cus",
|
|
114
|
-
"customer",
|
|
115
|
-
context,
|
|
116
|
-
),
|
|
117
|
-
wireBillingCustomer = await read("customer", customerID);
|
|
118
|
-
lifetime.check();
|
|
119
|
-
const customer = renewalBillingCustomer.parse(wireBillingCustomer);
|
|
120
|
-
need(
|
|
121
|
-
customer.id === customerID &&
|
|
122
|
-
customer.customer_account === expected.customerAccountId &&
|
|
123
|
-
customer.livemode === expected.livemode,
|
|
124
|
-
);
|
|
125
|
-
const joined = await acquireCouponJoins(
|
|
126
|
-
wireSubscription,
|
|
127
|
-
(wireSubscription as z.infer<typeof subscriptionView>).items.data[0],
|
|
128
|
-
expected.livemode,
|
|
129
|
-
read,
|
|
130
|
-
lifetime,
|
|
131
|
-
);
|
|
132
|
-
lifetime.check();
|
|
133
|
-
const sample = lifetime.check(),
|
|
134
|
-
bundle = {
|
|
135
|
-
wireSubscription,
|
|
136
|
-
wireTargetPrice,
|
|
137
|
-
wireBillingCustomer,
|
|
138
|
-
...joined,
|
|
139
|
-
};
|
|
140
|
-
const result = requiredJSONSnapshot({
|
|
141
|
-
ok: true,
|
|
142
|
-
dataOnly: true,
|
|
143
|
-
bundle,
|
|
144
|
-
observedAt: Math.floor(sample.wallMs / 1000),
|
|
145
|
-
sourceFulfillmentEstablished: false,
|
|
146
|
-
clockProvenanceEstablished: false,
|
|
147
|
-
operatorReady: false,
|
|
148
|
-
}) as RawAcquisitionResult;
|
|
149
|
-
lifetime.finish();
|
|
150
|
-
return freeze(result);
|
|
151
|
-
} catch {
|
|
152
|
-
try {
|
|
153
|
-
lifetime.check();
|
|
154
|
-
} catch {}
|
|
155
|
-
lifetime.fail();
|
|
156
|
-
return STOP;
|
|
157
|
-
}
|
|
158
|
-
},
|
|
159
|
-
});
|
|
160
|
-
}
|
|
1
|
+
export { createSourceRawAcquisition } from "./ownedAcquisition.js";
|
|
2
|
+
export type { RawAcquisitionResult } from "./ownedAcquisition.js";
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import type { createReadLifetime } from "./readLifetime.js";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
export type RawReadTransport = Readonly<{
|
|
3
|
+
rawRequest(
|
|
4
|
+
method: "GET",
|
|
5
|
+
path: string,
|
|
6
|
+
body: undefined,
|
|
7
|
+
options: Readonly<{
|
|
8
|
+
apiVersion: "2026-09-30.endive";
|
|
9
|
+
maxNetworkRetries: 0;
|
|
10
|
+
}>,
|
|
11
|
+
): Promise<unknown>;
|
|
12
|
+
}>;
|
|
13
|
+
export type Resource =
|
|
14
|
+
"subscription" | "price" | "customer" | "coupon" | "schedule";
|
|
4
15
|
export type Read = ReturnType<typeof bindWireSource>;
|
|
5
16
|
import { types } from "node:util";
|
|
6
17
|
import { requiredJSONSnapshot } from "../material/requiredJson.js";
|
|
@@ -16,6 +27,7 @@ const specs = Object.freeze({
|
|
|
16
27
|
price: ["prices", resourceId("price")],
|
|
17
28
|
customer: ["customers", resourceId("cus")],
|
|
18
29
|
coupon: ["coupons", null],
|
|
30
|
+
schedule: ["subscription_schedules", resourceId("sub_sched")],
|
|
19
31
|
} as const);
|
|
20
32
|
const expansions = ["discounts", "items.data.discounts", "items.data.price"];
|
|
21
33
|
// Fixed pinned Node intrinsics, captured before any reply; not a provenance assertion.
|
|
@@ -118,7 +130,7 @@ function captureReply(reply: unknown): Record<string, unknown> {
|
|
|
118
130
|
}
|
|
119
131
|
// Fixed Source transport only. Never await the old helper, which reflects before caller resumes.
|
|
120
132
|
export function bindWireSource(
|
|
121
|
-
sourceTransport:
|
|
133
|
+
sourceTransport: RawReadTransport,
|
|
122
134
|
lifetime: ReturnType<typeof createReadLifetime>,
|
|
123
135
|
) {
|
|
124
136
|
return async function read(resource: Resource, id: string) {
|