@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,183 @@
|
|
|
1
|
+
// Private required-material prerequisite. No operator, PII or typed-field admission.
|
|
2
|
+
const STOP = "REQUIRED_JSON_PRIVACY_STOP";
|
|
3
|
+
const credentialNames = new Set([
|
|
4
|
+
"clientsecret",
|
|
5
|
+
"confirmationsecret",
|
|
6
|
+
"accesstoken",
|
|
7
|
+
"refreshtoken",
|
|
8
|
+
"authorization",
|
|
9
|
+
"apikey",
|
|
10
|
+
"secretkey",
|
|
11
|
+
"adminkey",
|
|
12
|
+
"privatekey",
|
|
13
|
+
"stripesecretkey",
|
|
14
|
+
"cardnumber",
|
|
15
|
+
"creditcardnumber",
|
|
16
|
+
"cvc",
|
|
17
|
+
"cvv",
|
|
18
|
+
"bankaccountnumber",
|
|
19
|
+
"routingnumber",
|
|
20
|
+
"iban",
|
|
21
|
+
"accountnumber",
|
|
22
|
+
]);
|
|
23
|
+
const credentialText =
|
|
24
|
+
/(?:sk|rk)_(?:test|live)_|whsec_|_secret_|\bBearer\s+|\bAuthorization\s*:|-----BEGIN (?:[A-Z]+ )?PRIVATE KEY-----|(?:^|\D)(?:\d[ -]?){12,18}\d(?:$|\D)/i;
|
|
25
|
+
const fail: () => never = () => {
|
|
26
|
+
throw new Error(STOP);
|
|
27
|
+
};
|
|
28
|
+
// Counts JSON escaping without serializing or reading object properties.
|
|
29
|
+
function stringSize(text: string) {
|
|
30
|
+
let bytes = 2,
|
|
31
|
+
characters = 2;
|
|
32
|
+
for (let i = 0; i < text.length; i++) {
|
|
33
|
+
const n = text.charCodeAt(i);
|
|
34
|
+
if (n === 34 || n === 92 || [8, 9, 10, 12, 13].includes(n)) {
|
|
35
|
+
bytes += 2;
|
|
36
|
+
characters += 2;
|
|
37
|
+
} else if (n < 32) {
|
|
38
|
+
bytes += 6;
|
|
39
|
+
characters += 6;
|
|
40
|
+
} else if (
|
|
41
|
+
n >= 0xd800 &&
|
|
42
|
+
n <= 0xdbff &&
|
|
43
|
+
i + 1 < text.length &&
|
|
44
|
+
text.charCodeAt(i + 1) >= 0xdc00 &&
|
|
45
|
+
text.charCodeAt(i + 1) <= 0xdfff
|
|
46
|
+
) {
|
|
47
|
+
bytes += 4;
|
|
48
|
+
characters += 2;
|
|
49
|
+
i++;
|
|
50
|
+
} else if (n >= 0xd800 && n <= 0xdfff) {
|
|
51
|
+
bytes += 6;
|
|
52
|
+
characters += 6;
|
|
53
|
+
} else {
|
|
54
|
+
bytes += n < 128 ? 1 : n < 2048 ? 2 : 3;
|
|
55
|
+
characters++;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return { bytes, characters };
|
|
59
|
+
}
|
|
60
|
+
export function requiredJSONSnapshot(value: unknown): unknown {
|
|
61
|
+
try {
|
|
62
|
+
let nodes = 0,
|
|
63
|
+
rawCharacters = 0,
|
|
64
|
+
jsonCharacters = 0,
|
|
65
|
+
utf8Bytes = 0;
|
|
66
|
+
const active = new Set<object>(),
|
|
67
|
+
captures = new Map<
|
|
68
|
+
object,
|
|
69
|
+
{ array: boolean; entries: [string, unknown][] }
|
|
70
|
+
>();
|
|
71
|
+
function charge(characters: number, bytes: number) {
|
|
72
|
+
jsonCharacters += characters;
|
|
73
|
+
utf8Bytes += bytes;
|
|
74
|
+
if (jsonCharacters > 500000 || utf8Bytes > 500000) fail();
|
|
75
|
+
}
|
|
76
|
+
function string(text: string) {
|
|
77
|
+
if (credentialText.test(text)) fail();
|
|
78
|
+
rawCharacters += text.length;
|
|
79
|
+
if (rawCharacters > 500000) fail();
|
|
80
|
+
const size = stringSize(text);
|
|
81
|
+
charge(size.characters, size.bytes);
|
|
82
|
+
}
|
|
83
|
+
function scan(item: unknown, depth: number) {
|
|
84
|
+
if (++nodes > 10000 || depth > 40) fail();
|
|
85
|
+
if (typeof item === "string") {
|
|
86
|
+
string(item);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (item === null) {
|
|
90
|
+
charge(4, 4);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
if (typeof item === "boolean") {
|
|
94
|
+
charge(item ? 4 : 5, item ? 4 : 5);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
if (typeof item === "number") {
|
|
98
|
+
if (
|
|
99
|
+
!Number.isFinite(item) ||
|
|
100
|
+
(Number.isInteger(item) && !Number.isSafeInteger(item))
|
|
101
|
+
)
|
|
102
|
+
fail();
|
|
103
|
+
const size = String(item).length;
|
|
104
|
+
charge(size, size);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
if (!item || typeof item !== "object" || active.has(item)) fail();
|
|
108
|
+
const array = Array.isArray(item),
|
|
109
|
+
proto = Object.getPrototypeOf(item);
|
|
110
|
+
if (
|
|
111
|
+
array
|
|
112
|
+
? proto !== Array.prototype
|
|
113
|
+
: proto !== Object.prototype && proto !== null
|
|
114
|
+
)
|
|
115
|
+
fail();
|
|
116
|
+
const keys = Reflect.ownKeys(item);
|
|
117
|
+
if (keys.some((key) => typeof key !== "string")) fail();
|
|
118
|
+
const length = array
|
|
119
|
+
? Object.getOwnPropertyDescriptor(item, "length")
|
|
120
|
+
: null;
|
|
121
|
+
if (
|
|
122
|
+
array &&
|
|
123
|
+
(!length ||
|
|
124
|
+
!("value" in length) ||
|
|
125
|
+
!Number.isSafeInteger(length.value) ||
|
|
126
|
+
length.value > 10000)
|
|
127
|
+
)
|
|
128
|
+
fail();
|
|
129
|
+
const entries: [string, unknown][] = [];
|
|
130
|
+
for (const key of keys) {
|
|
131
|
+
if (array && key === "length") continue;
|
|
132
|
+
if (entries.length >= 10000) fail();
|
|
133
|
+
if (
|
|
134
|
+
array &&
|
|
135
|
+
(!/^(0|[1-9][0-9]*)$/.test(key as string) ||
|
|
136
|
+
Number(key) >= length!.value)
|
|
137
|
+
)
|
|
138
|
+
fail();
|
|
139
|
+
// Secret names themselves are not secret values. Non-null values stop.
|
|
140
|
+
const descriptor = Object.getOwnPropertyDescriptor(item, key);
|
|
141
|
+
if (!descriptor || !descriptor.enumerable || !("value" in descriptor))
|
|
142
|
+
fail();
|
|
143
|
+
if (
|
|
144
|
+
credentialNames.has(
|
|
145
|
+
(key as string).replace(/[^A-Za-z0-9]/g, "").toLowerCase(),
|
|
146
|
+
) &&
|
|
147
|
+
descriptor.value !== null
|
|
148
|
+
)
|
|
149
|
+
fail();
|
|
150
|
+
if (!array) string(key as string);
|
|
151
|
+
else {
|
|
152
|
+
rawCharacters += (key as string).length;
|
|
153
|
+
if (rawCharacters > 500000) fail();
|
|
154
|
+
}
|
|
155
|
+
entries.push([key as string, descriptor.value]);
|
|
156
|
+
}
|
|
157
|
+
if (array && entries.length !== length!.value) fail();
|
|
158
|
+
charge(
|
|
159
|
+
2 + Math.max(0, entries.length - 1) + (array ? 0 : entries.length),
|
|
160
|
+
2 + Math.max(0, entries.length - 1) + (array ? 0 : entries.length),
|
|
161
|
+
);
|
|
162
|
+
active.add(item);
|
|
163
|
+
for (const [, child] of entries) scan(child, depth + 1);
|
|
164
|
+
active.delete(item);
|
|
165
|
+
// Internal descriptor capture only. No detached JSON clone exists until all scans pass.
|
|
166
|
+
captures.set(item, { array, entries });
|
|
167
|
+
}
|
|
168
|
+
scan(value, 0);
|
|
169
|
+
function copy(item: unknown): unknown {
|
|
170
|
+
if (!item || typeof item !== "object") return item;
|
|
171
|
+
const { array, entries } = captures.get(item)!;
|
|
172
|
+
if (array) return entries.map(([, child]) => copy(child));
|
|
173
|
+
return Object.fromEntries(
|
|
174
|
+
entries
|
|
175
|
+
.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))
|
|
176
|
+
.map(([key, child]) => [key, copy(child)]),
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
return copy(value);
|
|
180
|
+
} catch {
|
|
181
|
+
fail();
|
|
182
|
+
}
|
|
183
|
+
}
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { afterEach, expect, it, vi } from "vitest";
|
|
2
|
+
|
|
3
|
+
afterEach(() => {
|
|
4
|
+
vi.doUnmock("./sourceBindings.js");
|
|
5
|
+
vi.resetModules();
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
function fixture() {
|
|
9
|
+
const basis = {
|
|
10
|
+
startWallMs: 1_000_000,
|
|
11
|
+
startNs: 1_000_000_000n,
|
|
12
|
+
workEndWallMs: 1_180_000,
|
|
13
|
+
workEndNs: 1_180_000_000n,
|
|
14
|
+
endWallMs: 1_210_000,
|
|
15
|
+
endNs: 1_210_000_000n,
|
|
16
|
+
};
|
|
17
|
+
const policy = { firstDispatchedAt: 1000, periodStart: 900, periodEnd: 2000 };
|
|
18
|
+
const sample = { wallMs: basis.startWallMs, ns: basis.startNs };
|
|
19
|
+
let samples = 0;
|
|
20
|
+
let loads = 0;
|
|
21
|
+
let detached = 0;
|
|
22
|
+
let listener = () => {};
|
|
23
|
+
const source = {
|
|
24
|
+
clock: {
|
|
25
|
+
basis,
|
|
26
|
+
sample() {
|
|
27
|
+
samples++;
|
|
28
|
+
return { ...sample };
|
|
29
|
+
},
|
|
30
|
+
subscribeRetirement(fn: () => void) {
|
|
31
|
+
listener = fn;
|
|
32
|
+
return () => {
|
|
33
|
+
detached++;
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
originalPolicy: policy,
|
|
38
|
+
originAssociation: Object.freeze({}),
|
|
39
|
+
};
|
|
40
|
+
return {
|
|
41
|
+
basis,
|
|
42
|
+
policy,
|
|
43
|
+
sample,
|
|
44
|
+
source,
|
|
45
|
+
load() {
|
|
46
|
+
loads++;
|
|
47
|
+
return source;
|
|
48
|
+
},
|
|
49
|
+
retire() {
|
|
50
|
+
listener();
|
|
51
|
+
},
|
|
52
|
+
counts() {
|
|
53
|
+
return { samples, loads, detached };
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async function owner(f = fixture()) {
|
|
59
|
+
vi.resetModules();
|
|
60
|
+
vi.doMock("./sourceBindings.js", () => ({
|
|
61
|
+
loadOwnedOriginalSource: () => f.load(),
|
|
62
|
+
}));
|
|
63
|
+
return { f, OWNER: (await import("./originalOwner.js")).OWNER };
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
it("valid original owner is live with exactly one accepted sample", async () => {
|
|
67
|
+
const { OWNER, f } = await owner();
|
|
68
|
+
let actual: unknown;
|
|
69
|
+
try {
|
|
70
|
+
actual = OWNER.check();
|
|
71
|
+
} catch {
|
|
72
|
+
actual = "stopped";
|
|
73
|
+
}
|
|
74
|
+
expect(actual).toEqual({
|
|
75
|
+
wallMs: 1_000_000,
|
|
76
|
+
ns: 1_000_000_000n,
|
|
77
|
+
nowSeconds: 1000,
|
|
78
|
+
retired: false,
|
|
79
|
+
});
|
|
80
|
+
expect(f.counts()).toEqual({ loads: 1, samples: 1, detached: 0 });
|
|
81
|
+
expect(OWNER.sample).toBe(OWNER.check);
|
|
82
|
+
expect(Object.isFrozen(OWNER)).toBe(true);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it("loads lazily once, copies the original basis, and does not sample on basis access", async () => {
|
|
86
|
+
const { OWNER, f } = await owner();
|
|
87
|
+
expect(f.counts().loads).toBe(0);
|
|
88
|
+
const captured = OWNER.basis;
|
|
89
|
+
f.basis.workEndWallMs = 9_000_000;
|
|
90
|
+
expect(OWNER.basis).toBe(captured);
|
|
91
|
+
expect(captured.workEndWallMs).toBe(1_180_000);
|
|
92
|
+
expect(Object.isFrozen(captured)).toBe(true);
|
|
93
|
+
expect(f.counts()).toEqual({ loads: 1, samples: 0, detached: 0 });
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it.each(["wall", "ns"] as const)(
|
|
97
|
+
"original %s work end is exclusive and irreversibly closes",
|
|
98
|
+
async (clock) => {
|
|
99
|
+
const { OWNER, f } = await owner();
|
|
100
|
+
OWNER.check();
|
|
101
|
+
if (clock === "wall") f.sample.wallMs = f.basis.workEndWallMs;
|
|
102
|
+
else f.sample.ns = f.basis.workEndNs;
|
|
103
|
+
expect(() => OWNER.check()).toThrow("ORIGINAL_OWNER_STOP");
|
|
104
|
+
f.sample.wallMs = f.basis.startWallMs;
|
|
105
|
+
f.sample.ns = f.basis.startNs;
|
|
106
|
+
expect(() => OWNER.check()).toThrow("ORIGINAL_OWNER_STOP");
|
|
107
|
+
expect(f.counts().samples).toBe(2);
|
|
108
|
+
},
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
it.each(["wall", "ns"] as const)(
|
|
112
|
+
"%s regression cannot renew the owner",
|
|
113
|
+
async (clock) => {
|
|
114
|
+
const { OWNER, f } = await owner();
|
|
115
|
+
f.sample.wallMs++;
|
|
116
|
+
f.sample.ns++;
|
|
117
|
+
OWNER.check();
|
|
118
|
+
if (clock === "wall") f.sample.wallMs--;
|
|
119
|
+
else f.sample.ns--;
|
|
120
|
+
expect(() => OWNER.check()).toThrow("ORIGINAL_OWNER_STOP");
|
|
121
|
+
},
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
it("derives floor seconds from the same sample and enforces future first dispatch", async () => {
|
|
125
|
+
const f = fixture();
|
|
126
|
+
f.policy.firstDispatchedAt = 1001;
|
|
127
|
+
const { OWNER } = await owner(f);
|
|
128
|
+
expect(() => OWNER.check()).toThrow("ORIGINAL_OWNER_STOP");
|
|
129
|
+
expect(f.counts().samples).toBe(1);
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
it("age 86400 is refused independently under a declared long synthetic basis", async () => {
|
|
133
|
+
const f = fixture();
|
|
134
|
+
f.basis.workEndWallMs = 100_000_000;
|
|
135
|
+
f.basis.endWallMs = 100_001_000;
|
|
136
|
+
f.basis.workEndNs = 100_000_000_000n;
|
|
137
|
+
f.basis.endNs = 100_001_000_000n;
|
|
138
|
+
f.policy.periodEnd = 200_000;
|
|
139
|
+
const { OWNER } = await owner(f);
|
|
140
|
+
f.sample.wallMs = (1000 + 86399) * 1000;
|
|
141
|
+
expect(OWNER.check().nowSeconds).toBe(87399);
|
|
142
|
+
f.sample.wallMs += 1000;
|
|
143
|
+
expect(() => OWNER.check()).toThrow("ORIGINAL_OWNER_STOP");
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
it("paid period start is inclusive and end exclusive", async () => {
|
|
147
|
+
const f = fixture();
|
|
148
|
+
f.policy.periodStart = 1000;
|
|
149
|
+
f.policy.periodEnd = 1001;
|
|
150
|
+
const { OWNER } = await owner(f);
|
|
151
|
+
expect(OWNER.check().nowSeconds).toBe(1000);
|
|
152
|
+
f.sample.wallMs = 1_001_000;
|
|
153
|
+
expect(() => OWNER.check()).toThrow("ORIGINAL_OWNER_STOP");
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
it("rejects a Source Proxy before any reflective traps or samples", async () => {
|
|
157
|
+
const f = fixture();
|
|
158
|
+
let traps = 0;
|
|
159
|
+
const value = new Proxy(f.source, {
|
|
160
|
+
getPrototypeOf() {
|
|
161
|
+
traps++;
|
|
162
|
+
return Object.prototype;
|
|
163
|
+
},
|
|
164
|
+
ownKeys() {
|
|
165
|
+
traps++;
|
|
166
|
+
return [];
|
|
167
|
+
},
|
|
168
|
+
get() {
|
|
169
|
+
traps++;
|
|
170
|
+
return null;
|
|
171
|
+
},
|
|
172
|
+
});
|
|
173
|
+
f.load = () => value;
|
|
174
|
+
const { OWNER } = await owner(f);
|
|
175
|
+
expect(() => OWNER.check()).toThrow("ORIGINAL_OWNER_STOP");
|
|
176
|
+
expect(traps).toBe(0);
|
|
177
|
+
expect(f.counts().samples).toBe(0);
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
it("rejects an own accessor without invoking it", async () => {
|
|
181
|
+
const f = fixture();
|
|
182
|
+
let gets = 0;
|
|
183
|
+
Object.defineProperty(f.source, "clock", {
|
|
184
|
+
get() {
|
|
185
|
+
gets++;
|
|
186
|
+
return null;
|
|
187
|
+
},
|
|
188
|
+
enumerable: true,
|
|
189
|
+
});
|
|
190
|
+
const { OWNER } = await owner(f);
|
|
191
|
+
expect(() => OWNER.check()).toThrow("ORIGINAL_OWNER_STOP");
|
|
192
|
+
expect(gets).toBe(0);
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
it("retirement notifies active waiters once and never samples again", async () => {
|
|
196
|
+
const { OWNER, f } = await owner();
|
|
197
|
+
let active = 0;
|
|
198
|
+
let removed = 0;
|
|
199
|
+
OWNER.check();
|
|
200
|
+
OWNER.subscribe(() => {
|
|
201
|
+
active++;
|
|
202
|
+
});
|
|
203
|
+
const unsubscribe = OWNER.subscribe(() => {
|
|
204
|
+
removed++;
|
|
205
|
+
});
|
|
206
|
+
unsubscribe();
|
|
207
|
+
unsubscribe();
|
|
208
|
+
f.retire();
|
|
209
|
+
OWNER.retire();
|
|
210
|
+
expect(active).toBe(1);
|
|
211
|
+
expect(removed).toBe(0);
|
|
212
|
+
expect(f.counts().detached).toBe(1);
|
|
213
|
+
expect(() => OWNER.check()).toThrow("ORIGINAL_OWNER_STOP");
|
|
214
|
+
expect(f.counts().samples).toBe(1);
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
it("cannot revive after a Source loader catches a reentrant check", async () => {
|
|
218
|
+
const f = fixture();
|
|
219
|
+
let nested = () => {};
|
|
220
|
+
const ordinaryLoad = f.load;
|
|
221
|
+
f.load = () => {
|
|
222
|
+
try {
|
|
223
|
+
nested();
|
|
224
|
+
} catch {
|
|
225
|
+
/* The outer load must stay closed. */
|
|
226
|
+
}
|
|
227
|
+
return ordinaryLoad();
|
|
228
|
+
};
|
|
229
|
+
const { OWNER } = await owner(f);
|
|
230
|
+
nested = () => {
|
|
231
|
+
OWNER.check();
|
|
232
|
+
};
|
|
233
|
+
expect(() => OWNER.check()).toThrow("ORIGINAL_OWNER_STOP");
|
|
234
|
+
expect(f.counts().samples).toBe(0);
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
it("cannot revive during listener registration and detaches its returned listener", async () => {
|
|
238
|
+
const f = fixture();
|
|
239
|
+
let nested = () => {};
|
|
240
|
+
let detached = 0;
|
|
241
|
+
f.source.clock.subscribeRetirement = () => {
|
|
242
|
+
try {
|
|
243
|
+
nested();
|
|
244
|
+
} catch {
|
|
245
|
+
/* The registration cannot publish live. */
|
|
246
|
+
}
|
|
247
|
+
return () => {
|
|
248
|
+
detached++;
|
|
249
|
+
};
|
|
250
|
+
};
|
|
251
|
+
const { OWNER } = await owner(f);
|
|
252
|
+
nested = () => {
|
|
253
|
+
OWNER.check();
|
|
254
|
+
};
|
|
255
|
+
expect(() => OWNER.check()).toThrow("ORIGINAL_OWNER_STOP");
|
|
256
|
+
expect(detached).toBe(1);
|
|
257
|
+
expect(f.counts().samples).toBe(0);
|
|
258
|
+
});
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
/** Internal owner mechanics; Source origin and production bindings remain unbound. */
|
|
2
|
+
import { types } from "node:util";
|
|
3
|
+
import { loadOwnedOriginalSource } from "./sourceBindings.js";
|
|
4
|
+
|
|
5
|
+
export interface OriginalBasis {
|
|
6
|
+
readonly startWallMs: number;
|
|
7
|
+
readonly startNs: bigint;
|
|
8
|
+
readonly workEndWallMs: number;
|
|
9
|
+
readonly workEndNs: bigint;
|
|
10
|
+
readonly endWallMs: number;
|
|
11
|
+
readonly endNs: bigint;
|
|
12
|
+
}
|
|
13
|
+
export interface OriginalSample {
|
|
14
|
+
readonly wallMs: number;
|
|
15
|
+
readonly ns: bigint;
|
|
16
|
+
readonly nowSeconds: number;
|
|
17
|
+
readonly retired: false;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function stop(): never {
|
|
21
|
+
throw new Error("ORIGINAL_OWNER_STOP");
|
|
22
|
+
}
|
|
23
|
+
function need(value: unknown): asserts value {
|
|
24
|
+
if (!value) stop();
|
|
25
|
+
}
|
|
26
|
+
const isProxy = types.isProxy;
|
|
27
|
+
const u64 = 18446744073709551615n;
|
|
28
|
+
const ms = (value: unknown): value is number =>
|
|
29
|
+
typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
30
|
+
const ns = (value: unknown): value is bigint =>
|
|
31
|
+
typeof value === "bigint" && value >= 0n && value <= u64;
|
|
32
|
+
function own<K extends string>(
|
|
33
|
+
value: unknown,
|
|
34
|
+
names: readonly K[],
|
|
35
|
+
): Record<K, unknown> {
|
|
36
|
+
need(!isProxy(value));
|
|
37
|
+
need(value !== null && typeof value === "object" && !Array.isArray(value));
|
|
38
|
+
const prototype = Object.getPrototypeOf(value);
|
|
39
|
+
need(prototype === Object.prototype || prototype === null);
|
|
40
|
+
const keys = Reflect.ownKeys(value);
|
|
41
|
+
need(
|
|
42
|
+
keys.length === names.length &&
|
|
43
|
+
keys.every((key) => typeof key === "string" && names.includes(key as K)),
|
|
44
|
+
);
|
|
45
|
+
const result = Object.create(null) as Record<K, unknown>;
|
|
46
|
+
for (const key of names) {
|
|
47
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
48
|
+
need(
|
|
49
|
+
descriptor &&
|
|
50
|
+
descriptor.enumerable &&
|
|
51
|
+
Object.prototype.hasOwnProperty.call(descriptor, "value"),
|
|
52
|
+
);
|
|
53
|
+
Object.defineProperty(result, key, {
|
|
54
|
+
value: descriptor.value,
|
|
55
|
+
enumerable: true,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return result;
|
|
59
|
+
}
|
|
60
|
+
interface Context {
|
|
61
|
+
readonly basis: Readonly<OriginalBasis>;
|
|
62
|
+
readonly policy: Readonly<{
|
|
63
|
+
firstDispatchedAt: number;
|
|
64
|
+
periodStart: number;
|
|
65
|
+
periodEnd: number;
|
|
66
|
+
}>;
|
|
67
|
+
readonly sample: (...args: never[]) => unknown;
|
|
68
|
+
readonly clock: object;
|
|
69
|
+
readonly originAssociation: object;
|
|
70
|
+
}
|
|
71
|
+
let state: string = "unused";
|
|
72
|
+
let context: Context | null = null;
|
|
73
|
+
let checking = false;
|
|
74
|
+
let last: Readonly<OriginalSample> | null = null;
|
|
75
|
+
let detachClock: (() => void) | null = null;
|
|
76
|
+
let detached = false;
|
|
77
|
+
const waiters = new Set<{ fn: () => void; active: boolean }>();
|
|
78
|
+
// Source registration can synchronously reenter and close the latch.
|
|
79
|
+
const isClosed = () => state === "closed";
|
|
80
|
+
function detach() {
|
|
81
|
+
if (!detached && detachClock) {
|
|
82
|
+
detached = true;
|
|
83
|
+
try {
|
|
84
|
+
Reflect.apply(detachClock, undefined, []);
|
|
85
|
+
} catch {
|
|
86
|
+
/* Closing remains irreversible. */
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function notify(fn: () => void) {
|
|
91
|
+
try {
|
|
92
|
+
Reflect.apply(fn, undefined, []);
|
|
93
|
+
} catch {
|
|
94
|
+
/* One waiter cannot prevent retirement. */
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
function close() {
|
|
98
|
+
if (state === "closed") return;
|
|
99
|
+
state = "closed";
|
|
100
|
+
detach();
|
|
101
|
+
const active = [...waiters];
|
|
102
|
+
waiters.clear();
|
|
103
|
+
for (const record of active)
|
|
104
|
+
if (record.active) {
|
|
105
|
+
record.active = false;
|
|
106
|
+
notify(record.fn);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function initialize(): Context {
|
|
110
|
+
if (state === "closed") stop();
|
|
111
|
+
if (state === "loading") {
|
|
112
|
+
close();
|
|
113
|
+
stop();
|
|
114
|
+
}
|
|
115
|
+
if (state === "live") {
|
|
116
|
+
need(context);
|
|
117
|
+
return context;
|
|
118
|
+
}
|
|
119
|
+
state = "loading";
|
|
120
|
+
try {
|
|
121
|
+
const loaded = loadOwnedOriginalSource();
|
|
122
|
+
need(state === "loading");
|
|
123
|
+
const source = own(loaded, [
|
|
124
|
+
"clock",
|
|
125
|
+
"originalPolicy",
|
|
126
|
+
"originAssociation",
|
|
127
|
+
]);
|
|
128
|
+
const clock = own(source.clock, ["basis", "sample", "subscribeRetirement"]);
|
|
129
|
+
const basis = own(clock.basis, [
|
|
130
|
+
"startWallMs",
|
|
131
|
+
"startNs",
|
|
132
|
+
"workEndWallMs",
|
|
133
|
+
"workEndNs",
|
|
134
|
+
"endWallMs",
|
|
135
|
+
"endNs",
|
|
136
|
+
]);
|
|
137
|
+
need(
|
|
138
|
+
ms(basis.startWallMs) &&
|
|
139
|
+
ms(basis.workEndWallMs) &&
|
|
140
|
+
ms(basis.endWallMs) &&
|
|
141
|
+
ns(basis.startNs) &&
|
|
142
|
+
ns(basis.workEndNs) &&
|
|
143
|
+
ns(basis.endNs) &&
|
|
144
|
+
basis.startWallMs < basis.workEndWallMs &&
|
|
145
|
+
basis.workEndWallMs <= basis.endWallMs &&
|
|
146
|
+
basis.startNs < basis.workEndNs &&
|
|
147
|
+
basis.workEndNs <= basis.endNs,
|
|
148
|
+
);
|
|
149
|
+
const policy = own(source.originalPolicy, [
|
|
150
|
+
"firstDispatchedAt",
|
|
151
|
+
"periodStart",
|
|
152
|
+
"periodEnd",
|
|
153
|
+
]);
|
|
154
|
+
need(
|
|
155
|
+
ms(policy.firstDispatchedAt) &&
|
|
156
|
+
ms(policy.periodStart) &&
|
|
157
|
+
ms(policy.periodEnd) &&
|
|
158
|
+
policy.periodStart < policy.periodEnd,
|
|
159
|
+
);
|
|
160
|
+
need(
|
|
161
|
+
source.originAssociation !== null &&
|
|
162
|
+
typeof source.originAssociation === "object" &&
|
|
163
|
+
!isProxy(source.originAssociation),
|
|
164
|
+
);
|
|
165
|
+
need(
|
|
166
|
+
typeof clock.sample === "function" &&
|
|
167
|
+
!isProxy(clock.sample) &&
|
|
168
|
+
typeof clock.subscribeRetirement === "function" &&
|
|
169
|
+
!isProxy(clock.subscribeRetirement),
|
|
170
|
+
);
|
|
171
|
+
// These assertions follow complete own-data validation above. Nothing is taken from a caller API.
|
|
172
|
+
context = Object.freeze({
|
|
173
|
+
basis: Object.freeze({ ...basis }) as unknown as OriginalBasis,
|
|
174
|
+
policy: Object.freeze({ ...policy }) as unknown as Context["policy"],
|
|
175
|
+
sample: clock.sample as Context["sample"],
|
|
176
|
+
clock: source.clock as object,
|
|
177
|
+
originAssociation: source.originAssociation,
|
|
178
|
+
});
|
|
179
|
+
const unsubscribe: unknown = Reflect.apply(
|
|
180
|
+
clock.subscribeRetirement,
|
|
181
|
+
source.clock,
|
|
182
|
+
[close],
|
|
183
|
+
);
|
|
184
|
+
need(typeof unsubscribe === "function" && !isProxy(unsubscribe));
|
|
185
|
+
detachClock = unsubscribe as () => void;
|
|
186
|
+
if (isClosed()) detach();
|
|
187
|
+
need(state === "loading");
|
|
188
|
+
state = "live";
|
|
189
|
+
return context;
|
|
190
|
+
} catch {
|
|
191
|
+
close();
|
|
192
|
+
stop();
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
function check(): Readonly<OriginalSample> {
|
|
196
|
+
if (state === "closed" || checking) {
|
|
197
|
+
close();
|
|
198
|
+
stop();
|
|
199
|
+
}
|
|
200
|
+
checking = true;
|
|
201
|
+
try {
|
|
202
|
+
const current = initialize();
|
|
203
|
+
need(state === "live");
|
|
204
|
+
const raw: unknown = Reflect.apply(current.sample, current.clock, []);
|
|
205
|
+
need(state === "live");
|
|
206
|
+
const value = own(raw, ["wallMs", "ns"]),
|
|
207
|
+
basis = current.basis,
|
|
208
|
+
policy = current.policy;
|
|
209
|
+
need(
|
|
210
|
+
ms(value.wallMs) &&
|
|
211
|
+
ns(value.ns) &&
|
|
212
|
+
value.wallMs >= basis.startWallMs &&
|
|
213
|
+
value.ns >= basis.startNs &&
|
|
214
|
+
value.wallMs < basis.workEndWallMs &&
|
|
215
|
+
value.ns < basis.workEndNs &&
|
|
216
|
+
value.wallMs < basis.endWallMs &&
|
|
217
|
+
value.ns < basis.endNs &&
|
|
218
|
+
(!last || (value.wallMs >= last.wallMs && value.ns >= last.ns)),
|
|
219
|
+
);
|
|
220
|
+
const nowSeconds = Math.floor(value.wallMs / 1000),
|
|
221
|
+
lastSeconds = last ? last.nowSeconds : policy.firstDispatchedAt;
|
|
222
|
+
need(
|
|
223
|
+
Number.isSafeInteger(nowSeconds) &&
|
|
224
|
+
nowSeconds >= lastSeconds &&
|
|
225
|
+
nowSeconds >= policy.firstDispatchedAt &&
|
|
226
|
+
nowSeconds - policy.firstDispatchedAt < 86400 &&
|
|
227
|
+
nowSeconds >= policy.periodStart &&
|
|
228
|
+
nowSeconds < policy.periodEnd,
|
|
229
|
+
);
|
|
230
|
+
need(state === "live");
|
|
231
|
+
const accepted = Object.freeze({
|
|
232
|
+
wallMs: value.wallMs,
|
|
233
|
+
ns: value.ns,
|
|
234
|
+
nowSeconds,
|
|
235
|
+
retired: false as const,
|
|
236
|
+
});
|
|
237
|
+
last = accepted;
|
|
238
|
+
return accepted;
|
|
239
|
+
} catch {
|
|
240
|
+
close();
|
|
241
|
+
stop();
|
|
242
|
+
} finally {
|
|
243
|
+
checking = false;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
function subscribe(fn: () => void): () => void {
|
|
247
|
+
if (typeof fn !== "function" || isProxy(fn)) {
|
|
248
|
+
close();
|
|
249
|
+
stop();
|
|
250
|
+
}
|
|
251
|
+
if (state !== "closed") {
|
|
252
|
+
try {
|
|
253
|
+
initialize();
|
|
254
|
+
} catch {
|
|
255
|
+
/* Closed listeners are notified below. */
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
if (state === "closed") {
|
|
259
|
+
notify(fn);
|
|
260
|
+
return () => {};
|
|
261
|
+
}
|
|
262
|
+
const record = { fn, active: true };
|
|
263
|
+
waiters.add(record);
|
|
264
|
+
return () => {
|
|
265
|
+
if (record.active) {
|
|
266
|
+
record.active = false;
|
|
267
|
+
waiters.delete(record);
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
/** Stable internal identity. Importing it neither loads a Source nor samples a clock. */
|
|
272
|
+
export const OWNER = Object.freeze({
|
|
273
|
+
get basis() {
|
|
274
|
+
return initialize().basis;
|
|
275
|
+
},
|
|
276
|
+
check,
|
|
277
|
+
sample: check,
|
|
278
|
+
subscribe,
|
|
279
|
+
retire: close,
|
|
280
|
+
});
|