@fantastic.dev/better-stripe 0.88.1 → 0.90.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/array-order.test.d.ts +2 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/array-order.test.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/array-order.test.js +61 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/array-order.test.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/coupon-stop-order.test.d.ts +2 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/coupon-stop-order.test.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/coupon-stop-order.test.js +18 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/coupon-stop-order.test.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/fetch-metadata.test.d.ts +2 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/fetch-metadata.test.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/fetch-metadata.test.js +67 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/fetch-metadata.test.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/raw-acquisition.test.d.ts +2 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/raw-acquisition.test.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/raw-acquisition.test.js +372 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/raw-acquisition.test.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/rawAcquisition.d.ts +24 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/rawAcquisition.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/rawAcquisition.js +113 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/rawAcquisition.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/rawCouponJoins.d.ts +55 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/rawCouponJoins.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/rawCouponJoins.js +87 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/rawCouponJoins.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/rawWireSource.d.ts +7 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/rawWireSource.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/rawWireSource.js +130 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/rawWireSource.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/readLifetime.d.ts +14 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/readLifetime.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/readLifetime.js +60 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/readLifetime.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/sourceBinding.test.d.ts +2 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/sourceBinding.test.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/sourceBinding.test.js +126 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/sourceBinding.test.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/fixture.d.mts +627 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/fixture.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/fixture.mjs +488 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/fixture.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/raw-retention-fixture.d.mts +214 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/raw-retention-fixture.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/raw-retention-fixture.mjs +63 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/raw-retention-fixture.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/scenario.d.mts +75 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/scenario.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/scenario.mjs +145 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/scenario.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/sourcePort.d.mts +7 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/sourcePort.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/sourcePort.mjs +26 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/sourcePort.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/appendAck.d.ts +14 -0
- package/dist/client/billing/renewalAttach/internal/c10/appendAck.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/appendAck.js +202 -0
- package/dist/client/billing/renewalAttach/internal/c10/appendAck.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/attachEvents.d.ts +23 -0
- package/dist/client/billing/renewalAttach/internal/c10/attachEvents.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/attachEvents.js +117 -0
- package/dist/client/billing/renewalAttach/internal/c10/attachEvents.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/configureEvents.d.ts +23 -0
- package/dist/client/billing/renewalAttach/internal/c10/configureEvents.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/configureEvents.js +111 -0
- package/dist/client/billing/renewalAttach/internal/c10/configureEvents.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/eventCapture.d.ts +11 -0
- package/dist/client/billing/renewalAttach/internal/c10/eventCapture.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/eventCapture.js +376 -0
- package/dist/client/billing/renewalAttach/internal/c10/eventCapture.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/eventCodec.d.ts +16 -0
- package/dist/client/billing/renewalAttach/internal/c10/eventCodec.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/eventCodec.js +119 -0
- package/dist/client/billing/renewalAttach/internal/c10/eventCodec.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/ownData.d.ts +30 -0
- package/dist/client/billing/renewalAttach/internal/c10/ownData.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/ownData.js +74 -0
- package/dist/client/billing/renewalAttach/internal/c10/ownData.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/ownerBinding.d.ts +3 -0
- package/dist/client/billing/renewalAttach/internal/c10/ownerBinding.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/ownerBinding.js +3 -0
- package/dist/client/billing/renewalAttach/internal/c10/ownerBinding.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/privacy.d.ts +2 -0
- package/dist/client/billing/renewalAttach/internal/c10/privacy.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/privacy.js +175 -0
- package/dist/client/billing/renewalAttach/internal/c10/privacy.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/publicApi.d.ts +3 -0
- package/dist/client/billing/renewalAttach/internal/c10/publicApi.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/publicApi.js +3 -0
- package/dist/client/billing/renewalAttach/internal/c10/publicApi.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/compilerIndex.d.mts +3 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/compilerIndex.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/compilerIndex.mjs +4 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/compilerIndex.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/fixture.d.mts +26 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/fixture.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/fixture.mjs +42 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/fixture.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f00.d.mts +7 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f00.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f00.mjs +60 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f00.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f01.d.mts +335 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f01.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f01.mjs +122 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f01.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f02.d.mts +46 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f02.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f02.mjs +87 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f02.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f03.d.mts +35 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f03.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f03.mjs +90 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f03.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f04.d.mts +132 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f04.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f04.mjs +82 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f04.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f05.d.mts +4 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f05.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f05.mjs +23 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f05.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f06.d.mts +16 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f06.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f06.mjs +41 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f06.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f07.d.mts +43 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f07.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f07.mjs +132 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f07.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f08.d.mts +200 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f08.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f08.mjs +150 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f08.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f09.d.mts +124 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f09.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f09.mjs +127 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f09.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f10.d.mts +3 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f10.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f10.mjs +69 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f10.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f11.d.mts +2 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f11.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f11.mjs +152 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f11.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f12.d.mts +2 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f12.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f12.mjs +2 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f12.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f13.d.mts +5 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f13.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f13.mjs +243 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f13.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f14.d.mts +17 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f14.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f14.mjs +75 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f14.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f15.d.mts +2 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f15.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f15.mjs +173 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f15.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f16.d.mts +4 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f16.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f16.mjs +4 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f16.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f17.d.mts +7 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f17.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f17.mjs +30 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f17.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f18.d.mts +29 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f18.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f18.mjs +33 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f18.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f19.json +452 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f20.d.mts +2 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f20.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f20.mjs +173 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f20.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f21.d.mts +2 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f21.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f21.mjs +449 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f21.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f22.d.mts +9 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f22.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f22.mjs +27 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f22.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f23.d.mts +7 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f23.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f23.mjs +150 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f23.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f24.d.mts +3 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f24.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f24.mjs +503 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f24.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f25.d.mts +2 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f25.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f25.mjs +91 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f25.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f26.d.mts +14 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f26.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f26.mjs +41 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f26.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f27.d.mts +103 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f27.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f27.mjs +46 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f27.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f28.d.mts +73 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f28.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f28.mjs +294 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f28.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f29.d.mts +2 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f29.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f29.mjs +60 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f29.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/publishedRawkeyHelper.d.mts +58 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/publishedRawkeyHelper.d.mts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/publishedRawkeyHelper.mjs +96 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/publishedRawkeyHelper.mjs.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/semanticSetup.d.ts +2 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/semanticSetup.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/semanticSetup.js +40 -0
- package/dist/client/billing/renewalAttach/internal/c10/test-fixtures/semanticSetup.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/material/capture.d.ts +88 -0
- package/dist/client/billing/renewalAttach/internal/material/capture.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/material/capture.js +181 -0
- package/dist/client/billing/renewalAttach/internal/material/capture.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/material/classifiers.d.ts +522 -0
- package/dist/client/billing/renewalAttach/internal/material/classifiers.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/material/classifiers.js +226 -0
- package/dist/client/billing/renewalAttach/internal/material/classifiers.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/material/nodeKernel.d.ts +17 -0
- package/dist/client/billing/renewalAttach/internal/material/nodeKernel.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/material/nodeKernel.js +95 -0
- package/dist/client/billing/renewalAttach/internal/material/nodeKernel.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/material/readMaterial.d.ts +338 -0
- package/dist/client/billing/renewalAttach/internal/material/readMaterial.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/material/readMaterial.js +122 -0
- package/dist/client/billing/renewalAttach/internal/material/readMaterial.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/material/requiredJson.d.ts +2 -0
- package/dist/client/billing/renewalAttach/internal/material/requiredJson.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/material/requiredJson.js +174 -0
- package/dist/client/billing/renewalAttach/internal/material/requiredJson.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/originalOwner.d.ts +27 -0
- package/dist/client/billing/renewalAttach/internal/originalOwner.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/originalOwner.js +236 -0
- package/dist/client/billing/renewalAttach/internal/originalOwner.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/sourceBindings.d.ts +5 -0
- package/dist/client/billing/renewalAttach/internal/sourceBindings.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/sourceBindings.js +9 -0
- package/dist/client/billing/renewalAttach/internal/sourceBindings.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/stockRawDelegate.d.ts +6 -0
- package/dist/client/billing/renewalAttach/internal/stockRawDelegate.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/stockRawDelegate.js +35 -0
- package/dist/client/billing/renewalAttach/internal/stockRawDelegate.js.map +1 -0
- package/docs/renewal-context-reads.md +43 -0
- package/docs/renewal-phase-assembly.md +23 -0
- package/docs/renewal-raw-acquisition.md +64 -0
- package/package.json +1 -1
- package/src/client/billing/renewalAttach/internal/acquisition/array-order.test.js +70 -0
- package/src/client/billing/renewalAttach/internal/acquisition/coupon-stop-order.test.js +23 -0
- package/src/client/billing/renewalAttach/internal/acquisition/fetch-metadata.test.js +77 -0
- package/src/client/billing/renewalAttach/internal/acquisition/raw-acquisition.test.js +418 -0
- package/src/client/billing/renewalAttach/internal/acquisition/rawAcquisition.ts +160 -0
- package/src/client/billing/renewalAttach/internal/acquisition/rawCouponJoins.ts +110 -0
- package/src/client/billing/renewalAttach/internal/acquisition/rawWireSource.ts +156 -0
- package/src/client/billing/renewalAttach/internal/acquisition/readLifetime.ts +64 -0
- package/src/client/billing/renewalAttach/internal/acquisition/sourceBinding.test.js +138 -0
- package/src/client/billing/renewalAttach/internal/acquisition/test-fixtures/fixture.mjs +510 -0
- package/src/client/billing/renewalAttach/internal/acquisition/test-fixtures/raw-retention-fixture.mjs +64 -0
- package/src/client/billing/renewalAttach/internal/acquisition/test-fixtures/scenario.mjs +159 -0
- package/src/client/billing/renewalAttach/internal/acquisition/test-fixtures/sourcePort.mjs +25 -0
- package/src/client/billing/renewalAttach/internal/c10/appendAck.first.test.ts +86 -0
- package/src/client/billing/renewalAttach/internal/c10/appendAck.ts +226 -0
- package/src/client/billing/renewalAttach/internal/c10/appendCodec.test.ts +186 -0
- package/src/client/billing/renewalAttach/internal/c10/arrayOrder.test.ts +47 -0
- package/src/client/billing/renewalAttach/internal/c10/attachEvents.ts +144 -0
- package/src/client/billing/renewalAttach/internal/c10/compiler.test.ts +443 -0
- package/src/client/billing/renewalAttach/internal/c10/configureEvents.ts +145 -0
- package/src/client/billing/renewalAttach/internal/c10/eventCapture.ts +464 -0
- package/src/client/billing/renewalAttach/internal/c10/eventCodec.ts +131 -0
- package/src/client/billing/renewalAttach/internal/c10/hardening.test.ts +175 -0
- package/src/client/billing/renewalAttach/internal/c10/historicalClassifier.test.ts +114 -0
- package/src/client/billing/renewalAttach/internal/c10/ownData.ts +103 -0
- package/src/client/billing/renewalAttach/internal/c10/ownerBinding.ts +2 -0
- package/src/client/billing/renewalAttach/internal/c10/ownerContinuations.test.ts +283 -0
- package/src/client/billing/renewalAttach/internal/c10/privacy.ts +181 -0
- package/src/client/billing/renewalAttach/internal/c10/publicApi.ts +8 -0
- package/src/client/billing/renewalAttach/internal/c10/reflectionPrivacy.test.ts +87 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/compilerIndex.mjs +3 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/fixture.mjs +49 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f00.mjs +63 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f01.mjs +160 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f02.mjs +88 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f03.mjs +102 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f04.mjs +82 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f05.mjs +20 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f06.mjs +41 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f07.mjs +137 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f08.mjs +153 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f09.mjs +127 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f10.mjs +85 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f11.mjs +170 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f12.mjs +6 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f13.mjs +295 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f14.mjs +78 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f15.mjs +177 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f16.mjs +8 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f17.mjs +34 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f18.mjs +32 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f19.json +452 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f20.mjs +177 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f21.mjs +466 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f22.mjs +29 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f23.mjs +165 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f24.mjs +507 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f25.mjs +89 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f26.mjs +38 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f27.mjs +45 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f28.mjs +309 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f29.mjs +58 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/publishedRawkeyHelper.mjs +104 -0
- package/src/client/billing/renewalAttach/internal/c10/test-fixtures/semanticSetup.ts +43 -0
- package/src/client/billing/renewalAttach/internal/material/capture.ts +243 -0
- package/src/client/billing/renewalAttach/internal/material/classifiers.test.ts +510 -0
- package/src/client/billing/renewalAttach/internal/material/classifiers.ts +313 -0
- package/src/client/billing/renewalAttach/internal/material/nodeKernel.ts +118 -0
- package/src/client/billing/renewalAttach/internal/material/readMaterial.ts +176 -0
- package/src/client/billing/renewalAttach/internal/material/requiredJson.ts +183 -0
- package/src/client/billing/renewalAttach/internal/originalOwner.test.ts +258 -0
- package/src/client/billing/renewalAttach/internal/originalOwner.ts +280 -0
- package/src/client/billing/renewalAttach/internal/sourceBindings.test.ts +13 -0
- package/src/client/billing/renewalAttach/internal/sourceBindings.ts +8 -0
- package/src/client/billing/renewalAttach/internal/stockRawDelegate.test.ts +156 -0
- package/src/client/billing/renewalAttach/internal/stockRawDelegate.ts +43 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import type { Read } from "./rawWireSource.js";
|
|
2
|
+
import type { createReadLifetime } from "./readLifetime.js";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { equal } from "../../../renewalAggregate/shared.js";
|
|
5
|
+
const need: (x: unknown) => asserts x = (x) => {
|
|
6
|
+
if (!x) throw Error("RAW_ACQUISITION_STOP");
|
|
7
|
+
};
|
|
8
|
+
const id = z.string().min(1).max(255).regex(/\S/);
|
|
9
|
+
const discount = z
|
|
10
|
+
.object({
|
|
11
|
+
id: z.string().regex(/^di_[A-Za-z0-9_]+$/),
|
|
12
|
+
object: z.literal("discount"),
|
|
13
|
+
deleted: z.literal(false).optional(),
|
|
14
|
+
source: z
|
|
15
|
+
.object({
|
|
16
|
+
type: z.literal("coupon"),
|
|
17
|
+
coupon: z.union([
|
|
18
|
+
id,
|
|
19
|
+
z
|
|
20
|
+
.object({
|
|
21
|
+
id,
|
|
22
|
+
object: z.literal("coupon"),
|
|
23
|
+
deleted: z.literal(false).optional(),
|
|
24
|
+
})
|
|
25
|
+
.passthrough(),
|
|
26
|
+
]),
|
|
27
|
+
})
|
|
28
|
+
.passthrough(),
|
|
29
|
+
})
|
|
30
|
+
.passthrough();
|
|
31
|
+
type Discount = z.infer<typeof discount>;
|
|
32
|
+
export async function acquireCouponJoins(
|
|
33
|
+
subscription: Record<string, unknown>,
|
|
34
|
+
item: Record<string, unknown>,
|
|
35
|
+
livemode: boolean,
|
|
36
|
+
read: Read,
|
|
37
|
+
lifetime: ReturnType<typeof createReadLifetime>,
|
|
38
|
+
) {
|
|
39
|
+
const rawLists = [subscription.discounts, item.discounts];
|
|
40
|
+
const lists = rawLists as Discount[][];
|
|
41
|
+
for (const list of lists) {
|
|
42
|
+
need(z.array(discount).max(20).safeParse(list).success);
|
|
43
|
+
for (const d of list) {
|
|
44
|
+
const ref = d.source.coupon;
|
|
45
|
+
need(
|
|
46
|
+
typeof ref === "string" ||
|
|
47
|
+
ref.livemode === undefined ||
|
|
48
|
+
ref.livemode === livemode,
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const ids = new Map<string, number | null>();
|
|
53
|
+
for (const list of lists)
|
|
54
|
+
for (const d of list) {
|
|
55
|
+
const ref = d.source.coupon,
|
|
56
|
+
key = typeof ref === "string" ? ref : ref.id;
|
|
57
|
+
if (!ids.has(key)) ids.set(key, null);
|
|
58
|
+
}
|
|
59
|
+
need(ids.size <= 40);
|
|
60
|
+
const couponReads: {
|
|
61
|
+
couponId: string;
|
|
62
|
+
wireCoupon: Record<string, unknown>;
|
|
63
|
+
association: { resource: string; ordinal: number };
|
|
64
|
+
}[] = [];
|
|
65
|
+
for (const list of lists)
|
|
66
|
+
for (const d of list) {
|
|
67
|
+
const ref = d.source.coupon,
|
|
68
|
+
key = typeof ref === "string" ? ref : ref.id;
|
|
69
|
+
if (ids.get(key) === null) {
|
|
70
|
+
const coupon = await read("coupon", key);
|
|
71
|
+
lifetime.check();
|
|
72
|
+
need(
|
|
73
|
+
coupon.id === key &&
|
|
74
|
+
coupon.object === "coupon" &&
|
|
75
|
+
coupon.deleted !== true &&
|
|
76
|
+
(coupon.livemode === undefined || coupon.livemode === livemode),
|
|
77
|
+
);
|
|
78
|
+
ids.set(key, couponReads.length);
|
|
79
|
+
couponReads.push({
|
|
80
|
+
couponId: key,
|
|
81
|
+
wireCoupon: coupon,
|
|
82
|
+
association: { resource: "coupon", ordinal: 4 + couponReads.length },
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
// Preserve maintained failure frontier: compare this full expanded read before any next GET.
|
|
86
|
+
need(
|
|
87
|
+
typeof ref === "string" ||
|
|
88
|
+
equal(ref, couponReads[ids.get(key)!].wireCoupon),
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
const derived = lists.map((list) =>
|
|
92
|
+
list.map((d, index) => {
|
|
93
|
+
const ref = d.source.coupon,
|
|
94
|
+
key = typeof ref === "string" ? ref : ref.id,
|
|
95
|
+
couponReadIndex = ids.get(key)!,
|
|
96
|
+
coupon = couponReads[couponReadIndex].wireCoupon;
|
|
97
|
+
return {
|
|
98
|
+
index,
|
|
99
|
+
discountId: d.id,
|
|
100
|
+
originalCouponReference: ref,
|
|
101
|
+
couponReadIndex,
|
|
102
|
+
joinedDiscount: { ...d, source: { ...d.source, coupon } },
|
|
103
|
+
};
|
|
104
|
+
}),
|
|
105
|
+
);
|
|
106
|
+
return {
|
|
107
|
+
couponReads,
|
|
108
|
+
derivedCouponJoins: { subscription: derived[0], item: derived[1] },
|
|
109
|
+
};
|
|
110
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import type { createReadLifetime } from "./readLifetime.js";
|
|
2
|
+
import type { createSourceStockRawDelegate } from "../stockRawDelegate.js";
|
|
3
|
+
export type Resource = "subscription" | "price" | "customer" | "coupon";
|
|
4
|
+
export type Read = ReturnType<typeof bindWireSource>;
|
|
5
|
+
import { types } from "node:util";
|
|
6
|
+
import { requiredJSONSnapshot } from "../material/requiredJson.js";
|
|
7
|
+
import { resourceId } from "../../../renewalAggregate/shared.js";
|
|
8
|
+
const stop = () => {
|
|
9
|
+
throw Error("RAW_ACQUISITION_STOP");
|
|
10
|
+
};
|
|
11
|
+
const need: (x: unknown) => asserts x = (x) => {
|
|
12
|
+
if (!x) stop();
|
|
13
|
+
};
|
|
14
|
+
const specs = Object.freeze({
|
|
15
|
+
subscription: ["subscriptions", resourceId("sub")],
|
|
16
|
+
price: ["prices", resourceId("price")],
|
|
17
|
+
customer: ["customers", resourceId("cus")],
|
|
18
|
+
coupon: ["coupons", null],
|
|
19
|
+
} as const);
|
|
20
|
+
const expansions = ["discounts", "items.data.discounts", "items.data.price"];
|
|
21
|
+
// Fixed pinned Node intrinsics, captured before any reply; not a provenance assertion.
|
|
22
|
+
const nativeResponsePrototype = Response.prototype,
|
|
23
|
+
nativeStatusGetter = Object.getOwnPropertyDescriptor(
|
|
24
|
+
nativeResponsePrototype,
|
|
25
|
+
"status",
|
|
26
|
+
)!.get!,
|
|
27
|
+
apply = Reflect.apply,
|
|
28
|
+
isProxy = types.isProxy;
|
|
29
|
+
function selectedID(resource: Resource, id: string) {
|
|
30
|
+
const spec = specs[resource];
|
|
31
|
+
need(spec);
|
|
32
|
+
if (spec[1]) return spec[1].parse(id);
|
|
33
|
+
need(
|
|
34
|
+
typeof id === "string" &&
|
|
35
|
+
id.length >= 1 &&
|
|
36
|
+
id.length <= 255 &&
|
|
37
|
+
/\S/.test(id) &&
|
|
38
|
+
id !== "." &&
|
|
39
|
+
id !== "..",
|
|
40
|
+
);
|
|
41
|
+
return id;
|
|
42
|
+
}
|
|
43
|
+
// Unsupported Proxies are rejected BEFORE any trap-capable JSON reflection.
|
|
44
|
+
// Count every occurrence, while removing active-path entries so repeated values may pass.
|
|
45
|
+
export function rejectProxyJSON(value: unknown, transportRoot = false) {
|
|
46
|
+
const active = new Set<object>();
|
|
47
|
+
let nodes = 0;
|
|
48
|
+
function walk(x: unknown, depth: number, isRoot: boolean): void {
|
|
49
|
+
need(++nodes <= 10000 && depth <= 40);
|
|
50
|
+
need(!isProxy(x));
|
|
51
|
+
if (x === null || typeof x !== "object") return;
|
|
52
|
+
need(!active.has(x));
|
|
53
|
+
active.add(x);
|
|
54
|
+
const array = Array.isArray(x),
|
|
55
|
+
keys = Reflect.ownKeys(x);
|
|
56
|
+
need(keys.length <= 10001);
|
|
57
|
+
for (const key of keys) {
|
|
58
|
+
need(typeof key === "string");
|
|
59
|
+
const d = Object.getOwnPropertyDescriptor(x, key);
|
|
60
|
+
need(d && "value" in d);
|
|
61
|
+
if (isRoot && transportRoot && key === "lastResponse" && !d.enumerable)
|
|
62
|
+
continue;
|
|
63
|
+
if (array && key === "length") continue;
|
|
64
|
+
need(d.enumerable);
|
|
65
|
+
walk(d.value, depth + 1, false);
|
|
66
|
+
}
|
|
67
|
+
active.delete(x);
|
|
68
|
+
}
|
|
69
|
+
walk(value, 0, true);
|
|
70
|
+
}
|
|
71
|
+
function captureReply(reply: unknown): Record<string, unknown> {
|
|
72
|
+
rejectProxyJSON(reply, true);
|
|
73
|
+
need(reply !== null && typeof reply === "object" && !Array.isArray(reply));
|
|
74
|
+
const proto = Object.getPrototypeOf(reply);
|
|
75
|
+
need(proto === Object.prototype || proto === null);
|
|
76
|
+
const meta = Object.getOwnPropertyDescriptor(reply, "lastResponse");
|
|
77
|
+
need(
|
|
78
|
+
meta &&
|
|
79
|
+
!meta.enumerable &&
|
|
80
|
+
"value" in meta &&
|
|
81
|
+
meta.value !== null &&
|
|
82
|
+
typeof meta.value === "object",
|
|
83
|
+
);
|
|
84
|
+
const metadata = meta.value;
|
|
85
|
+
need(!isProxy(metadata));
|
|
86
|
+
const codes: unknown[] = [];
|
|
87
|
+
for (const key of ["status", "statusCode"]) {
|
|
88
|
+
const d = Object.getOwnPropertyDescriptor(metadata, key);
|
|
89
|
+
if (!d) continue;
|
|
90
|
+
need("value" in d);
|
|
91
|
+
if (d.value !== undefined) codes.push(d.value);
|
|
92
|
+
}
|
|
93
|
+
if (Object.getPrototypeOf(metadata) === nativeResponsePrototype)
|
|
94
|
+
codes.push(apply(nativeStatusGetter, metadata, []));
|
|
95
|
+
need(
|
|
96
|
+
codes.length > 0 &&
|
|
97
|
+
codes.every(
|
|
98
|
+
(x) =>
|
|
99
|
+
typeof x === "number" &&
|
|
100
|
+
Number.isInteger(x) &&
|
|
101
|
+
x >= 200 &&
|
|
102
|
+
x < 300 &&
|
|
103
|
+
x === codes[0],
|
|
104
|
+
),
|
|
105
|
+
);
|
|
106
|
+
const entries: [string, unknown][] = [];
|
|
107
|
+
for (const key of Reflect.ownKeys(reply)) {
|
|
108
|
+
need(typeof key === "string");
|
|
109
|
+
if (key === "lastResponse") continue;
|
|
110
|
+
const d = Object.getOwnPropertyDescriptor(reply, key);
|
|
111
|
+
need(d && d.enumerable && "value" in d);
|
|
112
|
+
entries.push([key, d.value]);
|
|
113
|
+
}
|
|
114
|
+
return requiredJSONSnapshot(Object.fromEntries(entries)) as Record<
|
|
115
|
+
string,
|
|
116
|
+
unknown
|
|
117
|
+
>;
|
|
118
|
+
}
|
|
119
|
+
// Fixed Source transport only. Never await the old helper, which reflects before caller resumes.
|
|
120
|
+
export function bindWireSource(
|
|
121
|
+
sourceTransport: ReturnType<typeof createSourceStockRawDelegate>,
|
|
122
|
+
lifetime: ReturnType<typeof createReadLifetime>,
|
|
123
|
+
) {
|
|
124
|
+
return async function read(resource: Resource, id: string) {
|
|
125
|
+
const selected = selectedID(resource, id),
|
|
126
|
+
query =
|
|
127
|
+
resource === "subscription"
|
|
128
|
+
? "?" +
|
|
129
|
+
new URLSearchParams(
|
|
130
|
+
expansions.map((v, i) => ["expand[" + i + "]", v]),
|
|
131
|
+
)
|
|
132
|
+
: "";
|
|
133
|
+
lifetime.check();
|
|
134
|
+
let reply;
|
|
135
|
+
try {
|
|
136
|
+
reply = await sourceTransport.rawRequest(
|
|
137
|
+
"GET",
|
|
138
|
+
"/v1/" +
|
|
139
|
+
specs[resource][0] +
|
|
140
|
+
"/" +
|
|
141
|
+
encodeURIComponent(selected) +
|
|
142
|
+
query,
|
|
143
|
+
undefined,
|
|
144
|
+
{ apiVersion: "2026-09-30.endive", maxNetworkRetries: 0 },
|
|
145
|
+
);
|
|
146
|
+
} catch {
|
|
147
|
+
lifetime.check();
|
|
148
|
+
stop();
|
|
149
|
+
}
|
|
150
|
+
// FIRST action after fulfillment: no body or metadata access may precede this guard.
|
|
151
|
+
lifetime.check();
|
|
152
|
+
const body = captureReply(reply);
|
|
153
|
+
lifetime.check();
|
|
154
|
+
return body;
|
|
155
|
+
};
|
|
156
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { OWNER } from "../originalOwner.js";
|
|
2
|
+
// Child completion closes this reader, not the original invocation owner.
|
|
3
|
+
const stop = () => {
|
|
4
|
+
throw Error("RAW_ACQUISITION_STOP");
|
|
5
|
+
};
|
|
6
|
+
export function createReadLifetime(sourceOwner: typeof OWNER) {
|
|
7
|
+
const basis = sourceOwner.basis;
|
|
8
|
+
let state = "unused",
|
|
9
|
+
last: { wallMs: number; ns: bigint } | null = null;
|
|
10
|
+
const wall = (v: number) => Number.isSafeInteger(v) && v >= 0,
|
|
11
|
+
ns = (v: unknown) =>
|
|
12
|
+
typeof v === "bigint" && v >= 0n && v <= 18446744073709551615n;
|
|
13
|
+
const valid =
|
|
14
|
+
wall(basis.startWallMs) &&
|
|
15
|
+
wall(basis.workEndWallMs) &&
|
|
16
|
+
wall(basis.endWallMs) &&
|
|
17
|
+
ns(basis.startNs) &&
|
|
18
|
+
ns(basis.workEndNs) &&
|
|
19
|
+
ns(basis.endNs) &&
|
|
20
|
+
basis.startWallMs < basis.workEndWallMs &&
|
|
21
|
+
basis.workEndWallMs <= basis.endWallMs &&
|
|
22
|
+
basis.startNs < basis.workEndNs &&
|
|
23
|
+
basis.workEndNs <= basis.endNs;
|
|
24
|
+
function check() {
|
|
25
|
+
if (state !== "running") stop();
|
|
26
|
+
const x = sourceOwner.sample();
|
|
27
|
+
if (
|
|
28
|
+
!valid ||
|
|
29
|
+
!x ||
|
|
30
|
+
!wall(x.wallMs) ||
|
|
31
|
+
!ns(x.ns) ||
|
|
32
|
+
x.retired !== false ||
|
|
33
|
+
x.wallMs < basis.startWallMs ||
|
|
34
|
+
x.ns < basis.startNs ||
|
|
35
|
+
x.wallMs >= basis.workEndWallMs ||
|
|
36
|
+
x.ns >= basis.workEndNs ||
|
|
37
|
+
x.wallMs >= basis.endWallMs ||
|
|
38
|
+
x.ns >= basis.endNs ||
|
|
39
|
+
(last && (x.wallMs < last.wallMs || x.ns < last.ns))
|
|
40
|
+
) {
|
|
41
|
+
state = "stopped";
|
|
42
|
+
stop();
|
|
43
|
+
}
|
|
44
|
+
last = { wallMs: x.wallMs, ns: x.ns };
|
|
45
|
+
return last;
|
|
46
|
+
}
|
|
47
|
+
return Object.freeze({
|
|
48
|
+
begin() {
|
|
49
|
+
if (state !== "unused") return false;
|
|
50
|
+
state = "running";
|
|
51
|
+
check();
|
|
52
|
+
return true;
|
|
53
|
+
},
|
|
54
|
+
check,
|
|
55
|
+
finish() {
|
|
56
|
+
const x = check();
|
|
57
|
+
state = "readclosed";
|
|
58
|
+
return x;
|
|
59
|
+
},
|
|
60
|
+
fail() {
|
|
61
|
+
state = "stopped";
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { afterEach, expect, it, vi } from "vitest";
|
|
2
|
+
import { scenario } from "./test-fixtures/scenario.mjs";
|
|
3
|
+
afterEach(() => {
|
|
4
|
+
vi.doUnmock("../sourceBindings.js");
|
|
5
|
+
vi.resetModules();
|
|
6
|
+
vi.unstubAllGlobals();
|
|
7
|
+
});
|
|
8
|
+
it("default unbound Source factory refuses before any I/O", async () => {
|
|
9
|
+
vi.resetModules();
|
|
10
|
+
let calls = 0;
|
|
11
|
+
vi.stubGlobal("fetch", () => {
|
|
12
|
+
calls++;
|
|
13
|
+
throw Error("NETWORK_FORBIDDEN");
|
|
14
|
+
});
|
|
15
|
+
const { createSourceRawAcquisition } = await import("./rawAcquisition.js");
|
|
16
|
+
const { COMPILED_ENTRIES } = await import("../sourceBindings.js");
|
|
17
|
+
expect(COMPILED_ENTRIES).toEqual([]);
|
|
18
|
+
expect(Object.isFrozen(COMPILED_ENTRIES)).toBe(true);
|
|
19
|
+
expect(() => createSourceRawAcquisition()).toThrow("ORIGINAL_OWNER_STOP");
|
|
20
|
+
expect(calls).toBe(0);
|
|
21
|
+
});
|
|
22
|
+
it("fixed factory rejects foreign arguments without reflecting them", async () => {
|
|
23
|
+
vi.resetModules();
|
|
24
|
+
const { createSourceRawAcquisition } = await import("./rawAcquisition.js");
|
|
25
|
+
let traps = 0;
|
|
26
|
+
const foreign = new Proxy(
|
|
27
|
+
{},
|
|
28
|
+
{
|
|
29
|
+
get() {
|
|
30
|
+
traps++;
|
|
31
|
+
throw Error("FOREIGN_ARG");
|
|
32
|
+
},
|
|
33
|
+
getPrototypeOf() {
|
|
34
|
+
traps++;
|
|
35
|
+
throw Error("FOREIGN_ARG");
|
|
36
|
+
},
|
|
37
|
+
ownKeys() {
|
|
38
|
+
traps++;
|
|
39
|
+
throw Error("FOREIGN_ARG");
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
);
|
|
43
|
+
expect(() =>
|
|
44
|
+
Reflect.apply(createSourceRawAcquisition, undefined, [foreign]),
|
|
45
|
+
).toThrow("RAW_ACQUISITION_STOP");
|
|
46
|
+
expect(traps).toBe(0);
|
|
47
|
+
});
|
|
48
|
+
it("actual stock SingleAttempt decode retains raw bodies and child completion leaves the SAME original owner live", async () => {
|
|
49
|
+
vi.resetModules();
|
|
50
|
+
const s = scenario(),
|
|
51
|
+
wallMs = (s.expected.periodStart + 1) * 1000,
|
|
52
|
+
ns = 1_000_000_000n;
|
|
53
|
+
let samples = 0;
|
|
54
|
+
const paths = [];
|
|
55
|
+
vi.stubGlobal("fetch", async (input, init) => {
|
|
56
|
+
const url = new URL(String(input));
|
|
57
|
+
expect(init.method).toBe("GET");
|
|
58
|
+
expect(init.redirect).toBe("error");
|
|
59
|
+
paths.push(url.pathname);
|
|
60
|
+
const body = url.pathname.startsWith("/v1/subscriptions/")
|
|
61
|
+
? s.subscription
|
|
62
|
+
: url.pathname.startsWith("/v1/prices/")
|
|
63
|
+
? s.targetPrice
|
|
64
|
+
: url.pathname.startsWith("/v1/customers/")
|
|
65
|
+
? s.billingCustomer
|
|
66
|
+
: s.coupons.get(
|
|
67
|
+
decodeURIComponent(url.pathname.slice("/v1/coupons/".length)),
|
|
68
|
+
);
|
|
69
|
+
expect(body).toBeDefined();
|
|
70
|
+
return new Response(JSON.stringify(body), {
|
|
71
|
+
status: 200,
|
|
72
|
+
headers: {
|
|
73
|
+
"content-type": "application/json",
|
|
74
|
+
"request-id": "req_SYNTHETIC_314",
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
const { getStripeClient } = await import("../../../../helpers.js");
|
|
79
|
+
const client = getStripeClient(
|
|
80
|
+
"sk_test_SYNTHETIC_REPO_314_NO_CREDENTIAL",
|
|
81
|
+
"2026-09-30.endive",
|
|
82
|
+
{ singleAttempt: true },
|
|
83
|
+
);
|
|
84
|
+
const source = {
|
|
85
|
+
clock: {
|
|
86
|
+
basis: {
|
|
87
|
+
startWallMs: wallMs,
|
|
88
|
+
startNs: ns,
|
|
89
|
+
workEndWallMs: wallMs + 5000,
|
|
90
|
+
workEndNs: ns + 5_000_000_000n,
|
|
91
|
+
endWallMs: wallMs + 8000,
|
|
92
|
+
endNs: ns + 8_000_000_000n,
|
|
93
|
+
},
|
|
94
|
+
sample() {
|
|
95
|
+
samples++;
|
|
96
|
+
return { wallMs, ns };
|
|
97
|
+
},
|
|
98
|
+
subscribeRetirement() {
|
|
99
|
+
return () => {};
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
originalPolicy: {
|
|
103
|
+
firstDispatchedAt: s.expected.periodStart + 1,
|
|
104
|
+
periodStart: s.expected.periodStart,
|
|
105
|
+
periodEnd: s.expected.periodEnd,
|
|
106
|
+
},
|
|
107
|
+
originAssociation: Object.freeze({}),
|
|
108
|
+
};
|
|
109
|
+
vi.doMock("../sourceBindings.js", () => ({
|
|
110
|
+
loadOwnedOriginalSource: () => source,
|
|
111
|
+
loadFixedStockClient: () => client,
|
|
112
|
+
}));
|
|
113
|
+
const { OWNER } = await import("../originalOwner.js");
|
|
114
|
+
const { createSourceRawAcquisition } = await import("./rawAcquisition.js");
|
|
115
|
+
const basis = OWNER.basis;
|
|
116
|
+
const reader = createSourceRawAcquisition();
|
|
117
|
+
const result = await reader.acquire(s.expected);
|
|
118
|
+
expect(result.ok).toBe(true);
|
|
119
|
+
expect(result.bundle.wireSubscription).toEqual(s.subscription);
|
|
120
|
+
expect(result.bundle.wireTargetPrice).toEqual(s.targetPrice);
|
|
121
|
+
expect(result.bundle.wireBillingCustomer).toEqual(s.billingCustomer);
|
|
122
|
+
expect(paths).toHaveLength(5);
|
|
123
|
+
expect(result.observedAt).toBe(s.expected.periodStart + 1);
|
|
124
|
+
expect(result.sourceFulfillmentEstablished).toBe(false);
|
|
125
|
+
expect(result.clockProvenanceEstablished).toBe(false);
|
|
126
|
+
expect(result.operatorReady).toBe(false);
|
|
127
|
+
expect(OWNER.basis).toBe(basis);
|
|
128
|
+
expect(OWNER.check().retired).toBe(false);
|
|
129
|
+
expect(samples).toBeGreaterThan(paths.length);
|
|
130
|
+
expect(OWNER.check).toBe(OWNER.sample);
|
|
131
|
+
expect(await reader.acquire(s.expected)).toEqual({
|
|
132
|
+
ok: false,
|
|
133
|
+
complete: false,
|
|
134
|
+
code: "RAW_ACQUISITION_STOP",
|
|
135
|
+
});
|
|
136
|
+
expect(paths).toHaveLength(5);
|
|
137
|
+
expect(OWNER.check().retired).toBe(false);
|
|
138
|
+
});
|