@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,159 @@
|
|
|
1
|
+
// NEW declared TEST intent built BEFORE SUT calls; never actual wire/provider proof.
|
|
2
|
+
import { expandedRawRetentionInput, own } from "./raw-retention-fixture.mjs";
|
|
3
|
+
export { own };
|
|
4
|
+
export const clone = structuredClone;
|
|
5
|
+
export function scenario({
|
|
6
|
+
perLevel = 1,
|
|
7
|
+
shared = false,
|
|
8
|
+
strings = false,
|
|
9
|
+
} = {}) {
|
|
10
|
+
const p = expandedRawRetentionInput(),
|
|
11
|
+
sub = p.subscription,
|
|
12
|
+
item = sub.items.data[0],
|
|
13
|
+
coupons = new Map();
|
|
14
|
+
for (const [level, key] of [
|
|
15
|
+
["subscription", "discounts"],
|
|
16
|
+
["item", "discounts"],
|
|
17
|
+
]) {
|
|
18
|
+
const source = level === "subscription" ? sub : item,
|
|
19
|
+
template = clone(source[key][0]);
|
|
20
|
+
source[key] = Array.from({ length: perLevel }, (_, index) => {
|
|
21
|
+
const d = clone(template),
|
|
22
|
+
id = shared ? "shared-offer" : `${level}-offer-${index}`;
|
|
23
|
+
d.id = `di_${level}_${index}`;
|
|
24
|
+
const c = clone(template.source.coupon);
|
|
25
|
+
c.id = id;
|
|
26
|
+
c.times_redeemed = 7;
|
|
27
|
+
c.metadata = { declared: "SYNTHETIC_314", keep: "coupon" };
|
|
28
|
+
coupons.set(id, c);
|
|
29
|
+
d.source.coupon = strings ? id : clone(c);
|
|
30
|
+
return d;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
expected: clone(p.expected),
|
|
35
|
+
subscription: sub,
|
|
36
|
+
targetPrice: p.targetPrice,
|
|
37
|
+
billingCustomer: p.billingCustomer,
|
|
38
|
+
coupons,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export function wire(body, metadata = { status: 200 }, descriptor = {}) {
|
|
42
|
+
const reply = clone(body);
|
|
43
|
+
Object.defineProperty(reply, "lastResponse", {
|
|
44
|
+
value: metadata,
|
|
45
|
+
enumerable: false,
|
|
46
|
+
...descriptor,
|
|
47
|
+
});
|
|
48
|
+
return reply;
|
|
49
|
+
}
|
|
50
|
+
export function deferred() {
|
|
51
|
+
let resolve, reject;
|
|
52
|
+
const promise = new Promise((a, b) => {
|
|
53
|
+
resolve = a;
|
|
54
|
+
reject = b;
|
|
55
|
+
});
|
|
56
|
+
return { promise, resolve, reject };
|
|
57
|
+
}
|
|
58
|
+
export const tick = async () => {
|
|
59
|
+
for (let i = 0; i < 1000; i++) await Promise.resolve();
|
|
60
|
+
};
|
|
61
|
+
export function fakeOwner(s, { invalid = false } = {}) {
|
|
62
|
+
const initial = (s.expected.periodStart + 1) * 1000,
|
|
63
|
+
basis = Object.freeze({
|
|
64
|
+
startWallMs: initial,
|
|
65
|
+
startNs: 1000000000n,
|
|
66
|
+
workEndWallMs: initial + 5000,
|
|
67
|
+
workEndNs: 6000000000n,
|
|
68
|
+
endWallMs: initial + 8000,
|
|
69
|
+
endNs: 9000000000n,
|
|
70
|
+
});
|
|
71
|
+
let wallMs = initial,
|
|
72
|
+
ns = basis.startNs,
|
|
73
|
+
retired = false,
|
|
74
|
+
samples = 0;
|
|
75
|
+
const events = [];
|
|
76
|
+
return {
|
|
77
|
+
basis,
|
|
78
|
+
events,
|
|
79
|
+
sample() {
|
|
80
|
+
samples++;
|
|
81
|
+
events.push(["sample", wallMs, String(ns), retired]);
|
|
82
|
+
return { wallMs: invalid ? NaN : wallMs, ns, retired };
|
|
83
|
+
},
|
|
84
|
+
retire() {
|
|
85
|
+
retired = true;
|
|
86
|
+
events.push(["retire"]);
|
|
87
|
+
},
|
|
88
|
+
expire() {
|
|
89
|
+
wallMs = basis.workEndWallMs;
|
|
90
|
+
ns = basis.workEndNs;
|
|
91
|
+
},
|
|
92
|
+
regress() {
|
|
93
|
+
wallMs = initial - 1;
|
|
94
|
+
ns = basis.startNs - 1n;
|
|
95
|
+
},
|
|
96
|
+
get samples() {
|
|
97
|
+
return samples;
|
|
98
|
+
},
|
|
99
|
+
get retired() {
|
|
100
|
+
return retired;
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
export function fakeTransport(s, owner) {
|
|
105
|
+
const calls = [],
|
|
106
|
+
pending = new Map();
|
|
107
|
+
let holdAt = null,
|
|
108
|
+
override = null,
|
|
109
|
+
rejectAt = null;
|
|
110
|
+
const transport = {
|
|
111
|
+
rawRequest(method, path, body, options) {
|
|
112
|
+
const number = calls.length + 1;
|
|
113
|
+
calls.push({ method, path, body, options: clone(options) });
|
|
114
|
+
owner.events.push(["GET", number]);
|
|
115
|
+
const url = new URL(path, "https://synthetic.invalid");
|
|
116
|
+
let value;
|
|
117
|
+
if (url.pathname === `/v1/subscriptions/${s.expected.subscriptionId}`)
|
|
118
|
+
value = s.subscription;
|
|
119
|
+
else if (url.pathname === `/v1/prices/${s.expected.targetPriceId}`)
|
|
120
|
+
value = s.targetPrice;
|
|
121
|
+
else if (url.pathname === `/v1/customers/${s.billingCustomer.id}`)
|
|
122
|
+
value = s.billingCustomer;
|
|
123
|
+
else if (url.pathname.startsWith("/v1/coupons/"))
|
|
124
|
+
value = s.coupons.get(
|
|
125
|
+
decodeURIComponent(url.pathname.slice("/v1/coupons/".length)),
|
|
126
|
+
);
|
|
127
|
+
else throw Error("SYNTHETIC_UNLISTED_READ");
|
|
128
|
+
if (rejectAt === number)
|
|
129
|
+
return Promise.reject(Error("SYNTHETIC_PRIVATE_REJECT_DO_NOT_EXPOSE"));
|
|
130
|
+
const reply = override?.(number, value) ?? wire(value);
|
|
131
|
+
if (holdAt === number) {
|
|
132
|
+
const d = deferred();
|
|
133
|
+
pending.set(number, { ...d, reply });
|
|
134
|
+
return d.promise;
|
|
135
|
+
}
|
|
136
|
+
return Promise.resolve(reply);
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
return {
|
|
140
|
+
transport,
|
|
141
|
+
calls,
|
|
142
|
+
pending,
|
|
143
|
+
hold(number) {
|
|
144
|
+
holdAt = number;
|
|
145
|
+
},
|
|
146
|
+
override(fn) {
|
|
147
|
+
override = fn;
|
|
148
|
+
},
|
|
149
|
+
reject(number) {
|
|
150
|
+
rejectAt = number;
|
|
151
|
+
},
|
|
152
|
+
release(number, value) {
|
|
153
|
+
const d = pending.get(number);
|
|
154
|
+
if (!d) throw Error("SYNTHETIC_MISSING_HELD_GET");
|
|
155
|
+
owner.events.push(["fulfilled", number]);
|
|
156
|
+
d.resolve(value ?? d.reply);
|
|
157
|
+
},
|
|
158
|
+
};
|
|
159
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// TEST-only fixed dependency substitution. No runtime caller binding API.
|
|
2
|
+
import { vi } from "vitest";
|
|
3
|
+
import { createSourceRawAcquisition } from "../rawAcquisition.js";
|
|
4
|
+
const active = vi.hoisted(() => ({ owner: null, transport: null }));
|
|
5
|
+
vi.mock("../../originalOwner.js", () => ({
|
|
6
|
+
OWNER: Object.freeze({
|
|
7
|
+
get basis() {
|
|
8
|
+
return active.owner.basis;
|
|
9
|
+
},
|
|
10
|
+
check() {
|
|
11
|
+
return active.owner.sample();
|
|
12
|
+
},
|
|
13
|
+
sample() {
|
|
14
|
+
return active.owner.sample();
|
|
15
|
+
},
|
|
16
|
+
}),
|
|
17
|
+
}));
|
|
18
|
+
vi.mock("../../stockRawDelegate.js", () => ({
|
|
19
|
+
createSourceStockRawDelegate: () => active.transport,
|
|
20
|
+
}));
|
|
21
|
+
export function createTestOnlyRawAcquisition({ owner, transport }) {
|
|
22
|
+
active.owner = owner;
|
|
23
|
+
active.transport = transport;
|
|
24
|
+
return createSourceRawAcquisition();
|
|
25
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { expect, it, vi } from "vitest";
|
|
3
|
+
|
|
4
|
+
vi.mock("./ownerBinding.js", () => ({
|
|
5
|
+
SOURCE_OWNER: {
|
|
6
|
+
basis: Object.freeze({
|
|
7
|
+
startWallMs: 1000,
|
|
8
|
+
startNs: 1_000_000_000n,
|
|
9
|
+
workEndWallMs: 181000,
|
|
10
|
+
workEndNs: 181_000_000_000n,
|
|
11
|
+
endWallMs: 211000,
|
|
12
|
+
endNs: 211_000_000_000n,
|
|
13
|
+
}),
|
|
14
|
+
check: () => ({ wallMs: 1000, ns: 1_000_000_000n }),
|
|
15
|
+
subscribe: () => () => {},
|
|
16
|
+
},
|
|
17
|
+
}));
|
|
18
|
+
|
|
19
|
+
it("a live internal append records the exact canonical envelope after send AND ACK", async () => {
|
|
20
|
+
const { createAppendAckAdapter } = await import("./appendAck.js");
|
|
21
|
+
const records: unknown[] = [];
|
|
22
|
+
const append = createAppendAckAdapter({
|
|
23
|
+
timeoutMs: 5000,
|
|
24
|
+
send(
|
|
25
|
+
record: { sequence: number; binding: string },
|
|
26
|
+
ack: (value: unknown) => void,
|
|
27
|
+
) {
|
|
28
|
+
records.push(record);
|
|
29
|
+
ack({ sequence: record.sequence, binding: record.binding });
|
|
30
|
+
return Promise.resolve();
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
// Captured primitive nodes only. No constructor, Owner or digest is supplied by options.
|
|
34
|
+
const operation = append({
|
|
35
|
+
kind: "object",
|
|
36
|
+
entries: [["event", { kind: "scalar", value: "synthetic" }]],
|
|
37
|
+
});
|
|
38
|
+
const outcome = await operation.then(
|
|
39
|
+
() => "fulfilled",
|
|
40
|
+
() => "rejected",
|
|
41
|
+
);
|
|
42
|
+
expect(outcome).toBe("fulfilled");
|
|
43
|
+
const data = { event: "synthetic" };
|
|
44
|
+
const expected = createHash("sha256")
|
|
45
|
+
.update(
|
|
46
|
+
JSON.stringify([
|
|
47
|
+
"betterstripe-renewal-binding",
|
|
48
|
+
2,
|
|
49
|
+
"unbound-qualification-event",
|
|
50
|
+
{ data, sequence: 1 },
|
|
51
|
+
]),
|
|
52
|
+
)
|
|
53
|
+
.digest("hex");
|
|
54
|
+
expect(records).toEqual([
|
|
55
|
+
{
|
|
56
|
+
sequence: 1,
|
|
57
|
+
binding: `unbound-qualification-event:v2:sha256:${expected}`,
|
|
58
|
+
data,
|
|
59
|
+
},
|
|
60
|
+
]);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it("rejects an invalid captured node tag rather than encoding it as an object", async () => {
|
|
64
|
+
const { encode } = await import("./eventCodec.js");
|
|
65
|
+
expect(() => encode({ kind: "invalid", entries: [] } as never)).toThrow(
|
|
66
|
+
"C10_SOURCE_STOP",
|
|
67
|
+
);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it("preserves the captured own-data send receiver", async () => {
|
|
71
|
+
const { createAppendAckAdapter } = await import("./appendAck.js");
|
|
72
|
+
let receiverPrototype: unknown = "not called";
|
|
73
|
+
const append = createAppendAckAdapter({
|
|
74
|
+
timeoutMs: 5000,
|
|
75
|
+
send(
|
|
76
|
+
this: unknown,
|
|
77
|
+
record: { sequence: number; binding: string },
|
|
78
|
+
ack: (value: unknown) => void,
|
|
79
|
+
) {
|
|
80
|
+
receiverPrototype = Object.getPrototypeOf(this);
|
|
81
|
+
ack({ sequence: record.sequence, binding: record.binding });
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
await append({ kind: "scalar", value: null });
|
|
85
|
+
expect(receiverPrototype).toBe(null);
|
|
86
|
+
});
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
/** Stage and append share one irreversible latch and the same original owner. */
|
|
2
|
+
import { SOURCE_OWNER } from "./ownerBinding.js";
|
|
3
|
+
import {
|
|
4
|
+
options as checkedOptions,
|
|
5
|
+
closed,
|
|
6
|
+
need,
|
|
7
|
+
stop,
|
|
8
|
+
freeze,
|
|
9
|
+
} from "./ownData.js";
|
|
10
|
+
import {
|
|
11
|
+
objectNode,
|
|
12
|
+
scalarNode,
|
|
13
|
+
eventDigest,
|
|
14
|
+
materialize,
|
|
15
|
+
type CapturedNode,
|
|
16
|
+
} from "./eventCodec.js";
|
|
17
|
+
type Time = { wallMs: number; ns: bigint };
|
|
18
|
+
type Reject = (reason: Error) => void;
|
|
19
|
+
export function createStageChannel(raw: unknown) {
|
|
20
|
+
let closedChannel = false,
|
|
21
|
+
unsubscribe = () => {},
|
|
22
|
+
rejectStage: Reject | null = null,
|
|
23
|
+
rejectAppend: Reject | null = null,
|
|
24
|
+
last: Time | null = null;
|
|
25
|
+
const close = () => {
|
|
26
|
+
if (closedChannel) return;
|
|
27
|
+
closedChannel = true;
|
|
28
|
+
unsubscribe();
|
|
29
|
+
rejectStage?.(Error("C10_SOURCE_STOP"));
|
|
30
|
+
rejectAppend?.(Error("C10_SOURCE_STOP"));
|
|
31
|
+
};
|
|
32
|
+
const basis = SOURCE_OWNER.basis;
|
|
33
|
+
const gate = (): Time => {
|
|
34
|
+
try {
|
|
35
|
+
need(!closedChannel);
|
|
36
|
+
const t = SOURCE_OWNER.check();
|
|
37
|
+
need(
|
|
38
|
+
basis &&
|
|
39
|
+
Number.isSafeInteger(basis.startWallMs) &&
|
|
40
|
+
Number.isSafeInteger(basis.workEndWallMs) &&
|
|
41
|
+
Number.isSafeInteger(basis.endWallMs) &&
|
|
42
|
+
typeof basis.startNs === "bigint" &&
|
|
43
|
+
typeof basis.workEndNs === "bigint" &&
|
|
44
|
+
typeof basis.endNs === "bigint" &&
|
|
45
|
+
basis.startWallMs < basis.workEndWallMs &&
|
|
46
|
+
basis.workEndWallMs <= basis.endWallMs &&
|
|
47
|
+
basis.startNs < basis.workEndNs &&
|
|
48
|
+
basis.workEndNs <= basis.endNs,
|
|
49
|
+
);
|
|
50
|
+
need(
|
|
51
|
+
t &&
|
|
52
|
+
Number.isSafeInteger(t.wallMs) &&
|
|
53
|
+
typeof t.ns === "bigint" &&
|
|
54
|
+
t.wallMs >= basis.startWallMs &&
|
|
55
|
+
t.ns >= basis.startNs &&
|
|
56
|
+
t.wallMs < basis.workEndWallMs &&
|
|
57
|
+
t.ns < basis.workEndNs &&
|
|
58
|
+
t.wallMs < basis.endWallMs &&
|
|
59
|
+
t.ns < basis.endNs &&
|
|
60
|
+
(!last || (t.wallMs >= last.wallMs && t.ns >= last.ns)),
|
|
61
|
+
);
|
|
62
|
+
last = { wallMs: t.wallMs, ns: t.ns };
|
|
63
|
+
return last;
|
|
64
|
+
} catch {
|
|
65
|
+
close();
|
|
66
|
+
stop();
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
gate();
|
|
70
|
+
const detach = SOURCE_OWNER.subscribe(close);
|
|
71
|
+
need(typeof detach === "function");
|
|
72
|
+
unsubscribe = detach;
|
|
73
|
+
if (closedChannel) unsubscribe();
|
|
74
|
+
gate();
|
|
75
|
+
let options: ReturnType<typeof checkedOptions>;
|
|
76
|
+
try {
|
|
77
|
+
options = checkedOptions(raw);
|
|
78
|
+
gate();
|
|
79
|
+
} catch {
|
|
80
|
+
close();
|
|
81
|
+
stop();
|
|
82
|
+
}
|
|
83
|
+
let sequence = 0,
|
|
84
|
+
pending = false;
|
|
85
|
+
async function run<T>(action: () => T | PromiseLike<T>): Promise<T> {
|
|
86
|
+
gate();
|
|
87
|
+
let reject!: Reject;
|
|
88
|
+
const fatal = new Promise<never>((_, r) => {
|
|
89
|
+
reject = r;
|
|
90
|
+
});
|
|
91
|
+
rejectStage = reject;
|
|
92
|
+
const operation = Promise.resolve().then(() => {
|
|
93
|
+
gate();
|
|
94
|
+
return action();
|
|
95
|
+
});
|
|
96
|
+
try {
|
|
97
|
+
const value = await Promise.race([operation, fatal]);
|
|
98
|
+
gate();
|
|
99
|
+
return value;
|
|
100
|
+
} catch {
|
|
101
|
+
close();
|
|
102
|
+
return stop();
|
|
103
|
+
} finally {
|
|
104
|
+
if (rejectStage === reject) rejectStage = null;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
async function append(input: CapturedNode): Promise<void> {
|
|
108
|
+
if (closedChannel || pending) stop();
|
|
109
|
+
pending = true;
|
|
110
|
+
let entry: Time;
|
|
111
|
+
try {
|
|
112
|
+
entry = gate();
|
|
113
|
+
} catch {
|
|
114
|
+
pending = false;
|
|
115
|
+
stop();
|
|
116
|
+
}
|
|
117
|
+
let timer: ReturnType<typeof setTimeout> | undefined,
|
|
118
|
+
received = false,
|
|
119
|
+
failed = false,
|
|
120
|
+
sent = false,
|
|
121
|
+
accept!: () => void,
|
|
122
|
+
rejectFatal!: Reject;
|
|
123
|
+
const acknowledged = new Promise<void>((resolve) => {
|
|
124
|
+
accept = resolve;
|
|
125
|
+
});
|
|
126
|
+
const fatal = new Promise<never>((_, reject) => {
|
|
127
|
+
rejectFatal = reject;
|
|
128
|
+
});
|
|
129
|
+
const fail = () => {
|
|
130
|
+
failed = true;
|
|
131
|
+
close();
|
|
132
|
+
rejectFatal(Error("C10_SOURCE_STOP"));
|
|
133
|
+
};
|
|
134
|
+
rejectAppend = fail;
|
|
135
|
+
let localGate!: () => Time, arm!: () => void;
|
|
136
|
+
const operation = Promise.resolve().then(async () => {
|
|
137
|
+
const next = sequence + 1;
|
|
138
|
+
need(Number.isSafeInteger(next) && next > 0);
|
|
139
|
+
const wallEnd = Math.min(
|
|
140
|
+
entry.wallMs + options.timeoutMs,
|
|
141
|
+
basis.workEndWallMs,
|
|
142
|
+
basis.endWallMs,
|
|
143
|
+
),
|
|
144
|
+
localNs = entry.ns + BigInt(options.timeoutMs) * 1000000n;
|
|
145
|
+
const nsEnd =
|
|
146
|
+
localNs < basis.workEndNs
|
|
147
|
+
? localNs < basis.endNs
|
|
148
|
+
? localNs
|
|
149
|
+
: basis.endNs
|
|
150
|
+
: basis.workEndNs < basis.endNs
|
|
151
|
+
? basis.workEndNs
|
|
152
|
+
: basis.endNs;
|
|
153
|
+
localGate = () => {
|
|
154
|
+
const t = gate();
|
|
155
|
+
need(!failed && pending && t.wallMs < wallEnd && t.ns < nsEnd);
|
|
156
|
+
return t;
|
|
157
|
+
};
|
|
158
|
+
arm = () => {
|
|
159
|
+
const t = localGate(),
|
|
160
|
+
left = Math.min(
|
|
161
|
+
wallEnd - t.wallMs,
|
|
162
|
+
Number((nsEnd - t.ns + 999999n) / 1000000n),
|
|
163
|
+
);
|
|
164
|
+
need(left > 0);
|
|
165
|
+
timer = setTimeout(() => {
|
|
166
|
+
try {
|
|
167
|
+
arm();
|
|
168
|
+
} catch {
|
|
169
|
+
fail();
|
|
170
|
+
}
|
|
171
|
+
}, left);
|
|
172
|
+
};
|
|
173
|
+
arm();
|
|
174
|
+
localGate();
|
|
175
|
+
const envelope = objectNode([
|
|
176
|
+
["sequence", scalarNode(next)],
|
|
177
|
+
["data", input],
|
|
178
|
+
]),
|
|
179
|
+
binding = await eventDigest(envelope);
|
|
180
|
+
localGate();
|
|
181
|
+
const data = freeze(materialize(input)),
|
|
182
|
+
record = Object.freeze({ sequence: next, binding, data });
|
|
183
|
+
localGate();
|
|
184
|
+
const ack = (value: unknown) => {
|
|
185
|
+
try {
|
|
186
|
+
if (received || failed || !pending || closedChannel) return fail();
|
|
187
|
+
localGate();
|
|
188
|
+
const v = closed(value, ["sequence", "binding"]);
|
|
189
|
+
need(v.sequence === next && v.binding === binding);
|
|
190
|
+
localGate();
|
|
191
|
+
received = true;
|
|
192
|
+
accept();
|
|
193
|
+
} catch {
|
|
194
|
+
fail();
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
const sendNow = () => {
|
|
198
|
+
localGate();
|
|
199
|
+
return Promise.resolve(options.send(record, ack)).then(() => {
|
|
200
|
+
localGate();
|
|
201
|
+
sent = true;
|
|
202
|
+
});
|
|
203
|
+
};
|
|
204
|
+
await Promise.all([Promise.resolve().then(sendNow), acknowledged]);
|
|
205
|
+
localGate();
|
|
206
|
+
need(sent && received && sequence === next - 1);
|
|
207
|
+
sequence = next;
|
|
208
|
+
});
|
|
209
|
+
const outcome = Promise.race([operation, fatal]);
|
|
210
|
+
try {
|
|
211
|
+
await outcome;
|
|
212
|
+
localGate();
|
|
213
|
+
} catch {
|
|
214
|
+
fail();
|
|
215
|
+
stop();
|
|
216
|
+
} finally {
|
|
217
|
+
clearTimeout(timer);
|
|
218
|
+
pending = false;
|
|
219
|
+
if (rejectAppend === fail) rejectAppend = null;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return Object.freeze({ gate, close, run, append });
|
|
223
|
+
}
|
|
224
|
+
export function createAppendAckAdapter(raw: unknown) {
|
|
225
|
+
return createStageChannel(raw).append;
|
|
226
|
+
}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import type { EventRecord } from "./ownData.js";
|
|
2
|
+
import "./test-fixtures/semanticSetup.js";
|
|
3
|
+
import { it as test } from "vitest";
|
|
4
|
+
import assert from "node:assert/strict";
|
|
5
|
+
const { createAppendAckAdapter } = await import("./appendAck.js");
|
|
6
|
+
const {
|
|
7
|
+
objectNode: O,
|
|
8
|
+
scalarNode: S,
|
|
9
|
+
eventDigest,
|
|
10
|
+
} = await import("./eventCodec.js");
|
|
11
|
+
const data = () =>
|
|
12
|
+
O([
|
|
13
|
+
["event", S("dispatch")],
|
|
14
|
+
["stage", S("attach")],
|
|
15
|
+
["request", S(null)],
|
|
16
|
+
]);
|
|
17
|
+
const tick = () => new Promise((resolve) => setImmediate(resolve));
|
|
18
|
+
test("fixed C10 four-element known answer and no caller family selector", async () => {
|
|
19
|
+
const value = await eventDigest(
|
|
20
|
+
O([
|
|
21
|
+
["sequence", S(1)],
|
|
22
|
+
["data", S(null)],
|
|
23
|
+
]),
|
|
24
|
+
);
|
|
25
|
+
assert.equal(
|
|
26
|
+
value,
|
|
27
|
+
"unbound-qualification-event:v2:sha256:a591e9d0f61ec0ea22a004efbb53b9c151aa3f2f52691cd6bde1234d8aae7e31",
|
|
28
|
+
);
|
|
29
|
+
assert.equal(eventDigest.length, 1);
|
|
30
|
+
});
|
|
31
|
+
test("codec full UTF8 tuple bound rejects before digest", async () => {
|
|
32
|
+
let hashes = 0;
|
|
33
|
+
const original = globalThis.crypto.subtle.digest;
|
|
34
|
+
globalThis.crypto.subtle.digest = function (...args) {
|
|
35
|
+
hashes++;
|
|
36
|
+
return original.apply(this, args);
|
|
37
|
+
};
|
|
38
|
+
try {
|
|
39
|
+
await assert.rejects(
|
|
40
|
+
eventDigest(O([["large", S("é".repeat(250000))]])),
|
|
41
|
+
/C10_SOURCE_STOP/,
|
|
42
|
+
);
|
|
43
|
+
assert.equal(hashes, 0);
|
|
44
|
+
} finally {
|
|
45
|
+
globalThis.crypto.subtle.digest = original;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
test("append needs send fulfillment AND exact ACK even if ACK synchronous", async () => {
|
|
49
|
+
let release!: () => void,
|
|
50
|
+
acknowledge!: (value: unknown) => void,
|
|
51
|
+
completed = false,
|
|
52
|
+
startedResolve!: () => void;
|
|
53
|
+
const started = new Promise<void>((resolve) => {
|
|
54
|
+
startedResolve = resolve;
|
|
55
|
+
});
|
|
56
|
+
const append = createAppendAckAdapter({
|
|
57
|
+
timeoutMs: 5000,
|
|
58
|
+
send: (r: EventRecord, ack: (value: unknown) => void) => {
|
|
59
|
+
acknowledge = ack;
|
|
60
|
+
ack({ sequence: r.sequence, binding: r.binding });
|
|
61
|
+
return new Promise<void>((resolve) => {
|
|
62
|
+
release = resolve;
|
|
63
|
+
startedResolve();
|
|
64
|
+
});
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
const p = append(data()).then(() => {
|
|
68
|
+
completed = true;
|
|
69
|
+
});
|
|
70
|
+
await started;
|
|
71
|
+
assert.equal(completed, false);
|
|
72
|
+
release();
|
|
73
|
+
await p;
|
|
74
|
+
assert.equal(completed, true);
|
|
75
|
+
acknowledge({ sequence: 1, binding: "bad" });
|
|
76
|
+
await assert.rejects(append(data()), /C10_SOURCE_STOP/);
|
|
77
|
+
});
|
|
78
|
+
test("synchronous append reservation rejects second hash while first may commit as old core", async () => {
|
|
79
|
+
let sent = 0;
|
|
80
|
+
const append = createAppendAckAdapter({
|
|
81
|
+
timeoutMs: 5000,
|
|
82
|
+
send: async (r: EventRecord, ack: (value: unknown) => void) => {
|
|
83
|
+
sent++;
|
|
84
|
+
ack({ sequence: r.sequence, binding: r.binding });
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
const a = append(data()),
|
|
88
|
+
b = append(data());
|
|
89
|
+
await Promise.all([a, assert.rejects(b, /C10_SOURCE_STOP/)]);
|
|
90
|
+
assert.equal(sent, 1);
|
|
91
|
+
});
|
|
92
|
+
test("deferred hash beyond original timer rejects and late hash never sends", async () => {
|
|
93
|
+
const original = globalThis.crypto.subtle.digest;
|
|
94
|
+
let release!: () => void,
|
|
95
|
+
sent = 0;
|
|
96
|
+
globalThis.crypto.subtle.digest = () =>
|
|
97
|
+
new Promise((resolve) => {
|
|
98
|
+
release = () => resolve(new ArrayBuffer(32));
|
|
99
|
+
});
|
|
100
|
+
try {
|
|
101
|
+
const append = createAppendAckAdapter({
|
|
102
|
+
timeoutMs: 5,
|
|
103
|
+
send: async () => {
|
|
104
|
+
sent++;
|
|
105
|
+
},
|
|
106
|
+
});
|
|
107
|
+
await assert.rejects(append(data()), /C10_SOURCE_STOP/);
|
|
108
|
+
assert.equal(sent, 0);
|
|
109
|
+
release();
|
|
110
|
+
await tick();
|
|
111
|
+
assert.equal(sent, 0);
|
|
112
|
+
await assert.rejects(append(data()), /C10_SOURCE_STOP/);
|
|
113
|
+
} finally {
|
|
114
|
+
globalThis.crypto.subtle.digest = original;
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
test("send rejection after matching ACK remains failure and permanently closed", async () => {
|
|
118
|
+
const append = createAppendAckAdapter({
|
|
119
|
+
timeoutMs: 5000,
|
|
120
|
+
send: async (r: EventRecord, ack: (value: unknown) => void) => {
|
|
121
|
+
ack({ sequence: r.sequence, binding: r.binding });
|
|
122
|
+
throw Error("PRIVATE_ERROR_NOT_EXPORTED");
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
await assert.rejects(
|
|
126
|
+
append(data()),
|
|
127
|
+
(e) => (e as Error).message === "C10_SOURCE_STOP",
|
|
128
|
+
);
|
|
129
|
+
await assert.rejects(append(data()), /C10_SOURCE_STOP/);
|
|
130
|
+
});
|
|
131
|
+
test("missing send completion times out despite ACK, no automatic retry", async () => {
|
|
132
|
+
let sends = 0;
|
|
133
|
+
const append = createAppendAckAdapter({
|
|
134
|
+
timeoutMs: 5,
|
|
135
|
+
send: (r: EventRecord, ack: (value: unknown) => void) => {
|
|
136
|
+
sends++;
|
|
137
|
+
ack({ sequence: r.sequence, binding: r.binding });
|
|
138
|
+
return new Promise(() => {});
|
|
139
|
+
},
|
|
140
|
+
});
|
|
141
|
+
await assert.rejects(append(data()), /C10_SOURCE_STOP/);
|
|
142
|
+
await assert.rejects(append(data()), /C10_SOURCE_STOP/);
|
|
143
|
+
assert.equal(sends, 1);
|
|
144
|
+
});
|
|
145
|
+
test("wrong duplicate and late ACK reject permanently without raw logging", async () => {
|
|
146
|
+
for (const mode of ["wrong", "duplicate", "late"]) {
|
|
147
|
+
let ackFn!: (value: unknown) => void, record!: EventRecord;
|
|
148
|
+
const append = createAppendAckAdapter({
|
|
149
|
+
timeoutMs: 5,
|
|
150
|
+
send: async (r: EventRecord, ack: (value: unknown) => void) => {
|
|
151
|
+
record = r;
|
|
152
|
+
ackFn = ack;
|
|
153
|
+
if (mode === "wrong") ack({ sequence: 99, binding: r.binding });
|
|
154
|
+
if (mode === "duplicate") {
|
|
155
|
+
ack({ sequence: r.sequence, binding: r.binding });
|
|
156
|
+
ack({ sequence: r.sequence, binding: r.binding });
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
});
|
|
160
|
+
await assert.rejects(append(data()), /C10_SOURCE_STOP/);
|
|
161
|
+
if (mode === "late")
|
|
162
|
+
ackFn({ sequence: record.sequence, binding: record.binding });
|
|
163
|
+
await assert.rejects(append(data()), /C10_SOURCE_STOP/);
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
test("crypto error is fixed failure without fallback or send", async () => {
|
|
167
|
+
const original = globalThis.crypto.subtle.digest;
|
|
168
|
+
let sent = 0;
|
|
169
|
+
globalThis.crypto.subtle.digest = () =>
|
|
170
|
+
Promise.reject(Error("PRIVATE_ERROR_NOT_EXPORTED"));
|
|
171
|
+
try {
|
|
172
|
+
const append = createAppendAckAdapter({
|
|
173
|
+
timeoutMs: 5000,
|
|
174
|
+
send: async () => {
|
|
175
|
+
sent++;
|
|
176
|
+
},
|
|
177
|
+
});
|
|
178
|
+
await assert.rejects(
|
|
179
|
+
append(data()),
|
|
180
|
+
(e) => (e as Error).message === "C10_SOURCE_STOP",
|
|
181
|
+
);
|
|
182
|
+
assert.equal(sent, 0);
|
|
183
|
+
} finally {
|
|
184
|
+
globalThis.crypto.subtle.digest = original;
|
|
185
|
+
}
|
|
186
|
+
});
|