@fantastic.dev/better-stripe 0.89.0 → 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 +6 -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/connect/payoutExecutionTestHelpers.d.ts +16 -16
- package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +32 -32
- package/dist/component/balanceFunding/internal/actions.d.ts +11 -11
- package/dist/component/financialObservations/settlementHelpers.d.ts +3 -3
- package/dist/component/usage/allowance.fixtures.d.ts +16 -16
- package/dist/component/usageCredits/accounting.fixtures.d.ts +16 -16
- package/docs/renewal-context-reads.md +28 -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
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
import { OWNER } from "../originalOwner.js";
|
|
2
|
+
import {
|
|
3
|
+
prepareRenewalPriceReplacementV2 as c1,
|
|
4
|
+
prepareRenewalScheduleAttachmentV2 as c2,
|
|
5
|
+
} from "../../../renewalV2/index.js";
|
|
6
|
+
import {
|
|
7
|
+
captureRetainedInput,
|
|
8
|
+
captureOwnedInput,
|
|
9
|
+
ownedRetainedEligibility,
|
|
10
|
+
ownedCouponEligibility,
|
|
11
|
+
type RetainedInput,
|
|
12
|
+
type FreshInput,
|
|
13
|
+
} from "./capture.js";
|
|
14
|
+
import { validateOwnedReadMaterial } from "./readMaterial.js";
|
|
15
|
+
import { requiredJSONSnapshot } from "./requiredJson.js";
|
|
16
|
+
import {
|
|
17
|
+
objectNode,
|
|
18
|
+
scalarNode,
|
|
19
|
+
encode,
|
|
20
|
+
materialize,
|
|
21
|
+
need,
|
|
22
|
+
freeze,
|
|
23
|
+
type Node,
|
|
24
|
+
} from "./nodeKernel.js";
|
|
25
|
+
type Prepared = Awaited<ReturnType<typeof c1>>;
|
|
26
|
+
type Request = Awaited<ReturnType<typeof c2>>;
|
|
27
|
+
type Reads = ReturnType<typeof validateOwnedReadMaterial>;
|
|
28
|
+
type Args = {
|
|
29
|
+
attachRequest: RetainedInput["attachRequest"];
|
|
30
|
+
intent: "initial";
|
|
31
|
+
freshSubscription?: unknown;
|
|
32
|
+
targetPrice?: unknown;
|
|
33
|
+
billingCustomer?: unknown;
|
|
34
|
+
observedAt?: number;
|
|
35
|
+
};
|
|
36
|
+
function material(
|
|
37
|
+
args: Args,
|
|
38
|
+
fresh: boolean,
|
|
39
|
+
prepared: Prepared,
|
|
40
|
+
request: Request,
|
|
41
|
+
reads: Reads,
|
|
42
|
+
evidence: { actualFreshSubscription: unknown },
|
|
43
|
+
) {
|
|
44
|
+
return {
|
|
45
|
+
classificationRevision: "renewal-material-v2",
|
|
46
|
+
protocolRevision: "renewal-stage-protocol-v1",
|
|
47
|
+
stage: "attach",
|
|
48
|
+
intent: args.intent,
|
|
49
|
+
scope: request.scope,
|
|
50
|
+
apiVersion: request.apiVersion,
|
|
51
|
+
profile: reads.profile,
|
|
52
|
+
quantity: prepared.quantity,
|
|
53
|
+
currentPrice: reads.item.price,
|
|
54
|
+
targetPrice: reads.targetPrice,
|
|
55
|
+
source: reads.subscription,
|
|
56
|
+
nativeItem: reads.item,
|
|
57
|
+
billingCustomer: reads.customer,
|
|
58
|
+
subscriptionDiscounts: reads.discounts,
|
|
59
|
+
itemDiscounts: reads.itemDiscounts,
|
|
60
|
+
settings: reads.originalSettings,
|
|
61
|
+
originalPrepared: prepared,
|
|
62
|
+
completeRequest: request,
|
|
63
|
+
stageEvidence: evidence,
|
|
64
|
+
rawSources: args,
|
|
65
|
+
freshness: fresh ? "fresh" : "retained",
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
type InitialMaterial = ReturnType<typeof material>;
|
|
69
|
+
type Classified = {
|
|
70
|
+
status: "classified";
|
|
71
|
+
kind: "RENEWAL_MATERIAL_V2_DATA_CONSISTENCY_ONLY";
|
|
72
|
+
material: InitialMaterial;
|
|
73
|
+
};
|
|
74
|
+
const RETAINED_STOP = Object.freeze({
|
|
75
|
+
status: "unsupported" as const,
|
|
76
|
+
code: "RETAINED_INITIAL_MATERIAL_STOP",
|
|
77
|
+
});
|
|
78
|
+
const FRESH_STOP = Object.freeze({
|
|
79
|
+
status: "unsupported" as const,
|
|
80
|
+
code: "RAW_COUPON_MATERIAL_STOP",
|
|
81
|
+
});
|
|
82
|
+
const PREFIX = "/material/";
|
|
83
|
+
// This lexical publication closure accepts only locally reconstructed values, never a caller handle.
|
|
84
|
+
function release(
|
|
85
|
+
material: InitialMaterial,
|
|
86
|
+
prepared: Prepared,
|
|
87
|
+
request: Request,
|
|
88
|
+
): Classified {
|
|
89
|
+
const slots = new Map([
|
|
90
|
+
[
|
|
91
|
+
PREFIX + "originalPrepared/requestIdentity/binding",
|
|
92
|
+
prepared.requestIdentity.binding,
|
|
93
|
+
],
|
|
94
|
+
[
|
|
95
|
+
PREFIX + "completeRequest/logicalBinding",
|
|
96
|
+
prepared.requestIdentity.binding,
|
|
97
|
+
],
|
|
98
|
+
[
|
|
99
|
+
PREFIX + "completeRequest/requestIdentity/binding",
|
|
100
|
+
request.requestIdentity.binding,
|
|
101
|
+
],
|
|
102
|
+
]);
|
|
103
|
+
need(slots.size === 3);
|
|
104
|
+
let nodes = 0,
|
|
105
|
+
raw = 0;
|
|
106
|
+
const seen = new Set<object>(),
|
|
107
|
+
found = new Set<string>();
|
|
108
|
+
function walk(x: unknown, path: string, depth: number): Node {
|
|
109
|
+
need(++nodes <= 10000 && depth <= 40);
|
|
110
|
+
if (slots.has(path)) {
|
|
111
|
+
need(
|
|
112
|
+
typeof x === "string" &&
|
|
113
|
+
x === slots.get(path) &&
|
|
114
|
+
/^(?:renewal|renewal-attach|renewal-attach-receipt|renewal-baseline|renewal-defaults|renewal-configure):v2:sha256:[0-9a-f]{64}$/.test(
|
|
115
|
+
x,
|
|
116
|
+
),
|
|
117
|
+
);
|
|
118
|
+
found.add(path);
|
|
119
|
+
raw += x.length;
|
|
120
|
+
need(raw <= 500000);
|
|
121
|
+
return scalarNode(x);
|
|
122
|
+
}
|
|
123
|
+
if (x === null || typeof x !== "object") {
|
|
124
|
+
requiredJSONSnapshot(x);
|
|
125
|
+
if (typeof x === "string") raw += x.length;
|
|
126
|
+
need(raw <= 500000);
|
|
127
|
+
return scalarNode(x);
|
|
128
|
+
}
|
|
129
|
+
need(!seen.has(x));
|
|
130
|
+
seen.add(x);
|
|
131
|
+
const array = Array.isArray(x),
|
|
132
|
+
keys = Reflect.ownKeys(x),
|
|
133
|
+
entries: [string, Node][] = [];
|
|
134
|
+
const proto = Object.getPrototypeOf(x);
|
|
135
|
+
need(
|
|
136
|
+
array
|
|
137
|
+
? proto === Array.prototype
|
|
138
|
+
: proto === Object.prototype || proto === null,
|
|
139
|
+
);
|
|
140
|
+
const length = array ? Object.getOwnPropertyDescriptor(x, "length") : null;
|
|
141
|
+
if (array)
|
|
142
|
+
need(
|
|
143
|
+
length &&
|
|
144
|
+
"value" in length &&
|
|
145
|
+
Number.isSafeInteger(length.value) &&
|
|
146
|
+
length.value <= 10000,
|
|
147
|
+
);
|
|
148
|
+
for (const key of keys) {
|
|
149
|
+
need(typeof key === "string");
|
|
150
|
+
if (array && key === "length") continue;
|
|
151
|
+
const d = Object.getOwnPropertyDescriptor(x, key);
|
|
152
|
+
need(d && d.enumerable && "value" in d);
|
|
153
|
+
requiredJSONSnapshot(key);
|
|
154
|
+
requiredJSONSnapshot({ [key]: d.value === null ? null : true });
|
|
155
|
+
raw += key.length;
|
|
156
|
+
need(raw <= 500000);
|
|
157
|
+
need(
|
|
158
|
+
!array ||
|
|
159
|
+
(/^(0|[1-9][0-9]*)$/.test(key) && Number(key) < length!.value),
|
|
160
|
+
);
|
|
161
|
+
entries.push([key, walk(d.value, path + "/" + key, depth + 1)]);
|
|
162
|
+
}
|
|
163
|
+
seen.delete(x);
|
|
164
|
+
if (array) {
|
|
165
|
+
need(entries.length === length!.value);
|
|
166
|
+
entries.sort(([a], [b]) => Number(a) - Number(b));
|
|
167
|
+
return Object.freeze({
|
|
168
|
+
kind: "array" as const,
|
|
169
|
+
entries: Object.freeze(
|
|
170
|
+
entries.map(
|
|
171
|
+
Object.freeze as (
|
|
172
|
+
entry: [string, Node],
|
|
173
|
+
) => Readonly<[string, Node]>,
|
|
174
|
+
),
|
|
175
|
+
),
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
return objectNode(entries);
|
|
179
|
+
}
|
|
180
|
+
const node = walk(
|
|
181
|
+
{
|
|
182
|
+
status: "classified",
|
|
183
|
+
kind: "RENEWAL_MATERIAL_V2_DATA_CONSISTENCY_ONLY",
|
|
184
|
+
material,
|
|
185
|
+
},
|
|
186
|
+
"",
|
|
187
|
+
0,
|
|
188
|
+
);
|
|
189
|
+
need(found.size === slots.size);
|
|
190
|
+
encode(node);
|
|
191
|
+
return freeze(materialize(node)) as Classified;
|
|
192
|
+
}
|
|
193
|
+
async function retained(value: RetainedInput) {
|
|
194
|
+
const raw = value.attachRequest;
|
|
195
|
+
OWNER.check();
|
|
196
|
+
const prepared = await c1(raw.preparation);
|
|
197
|
+
OWNER.check();
|
|
198
|
+
OWNER.check();
|
|
199
|
+
const request = await c2({
|
|
200
|
+
prepared,
|
|
201
|
+
apiVersion: raw.apiVersion,
|
|
202
|
+
attachKey: raw.attachKey,
|
|
203
|
+
firstDispatchedAt: raw.firstDispatchedAt,
|
|
204
|
+
});
|
|
205
|
+
OWNER.check();
|
|
206
|
+
const discounts = ownedRetainedEligibility(value),
|
|
207
|
+
args = { attachRequest: raw, intent: "initial" as const };
|
|
208
|
+
const reads = validateOwnedReadMaterial(
|
|
209
|
+
{
|
|
210
|
+
apiVersion: raw.apiVersion,
|
|
211
|
+
observedAt: raw.firstDispatchedAt,
|
|
212
|
+
freshSubscription: raw.preparation.subscription,
|
|
213
|
+
targetPrice: prepared.providerSnapshot.targetPrice,
|
|
214
|
+
billingCustomer: prepared.providerSnapshot.billingCustomer,
|
|
215
|
+
},
|
|
216
|
+
prepared,
|
|
217
|
+
undefined,
|
|
218
|
+
discounts,
|
|
219
|
+
);
|
|
220
|
+
OWNER.check();
|
|
221
|
+
const result = release(
|
|
222
|
+
material(args, false, prepared, request, reads, {
|
|
223
|
+
actualFreshSubscription: raw.preparation.subscription,
|
|
224
|
+
}),
|
|
225
|
+
prepared,
|
|
226
|
+
request,
|
|
227
|
+
);
|
|
228
|
+
OWNER.check();
|
|
229
|
+
return result;
|
|
230
|
+
}
|
|
231
|
+
async function fresh(value: FreshInput) {
|
|
232
|
+
const raw = value.attachRequest;
|
|
233
|
+
OWNER.check();
|
|
234
|
+
const prepared = await c1(raw.preparation);
|
|
235
|
+
OWNER.check();
|
|
236
|
+
OWNER.check();
|
|
237
|
+
const request = await c2({
|
|
238
|
+
prepared,
|
|
239
|
+
apiVersion: raw.apiVersion,
|
|
240
|
+
attachKey: raw.attachKey,
|
|
241
|
+
firstDispatchedAt: raw.firstDispatchedAt,
|
|
242
|
+
});
|
|
243
|
+
OWNER.check();
|
|
244
|
+
const discounts = ownedCouponEligibility(value),
|
|
245
|
+
b = value.currentBundle;
|
|
246
|
+
const args = {
|
|
247
|
+
attachRequest: raw,
|
|
248
|
+
intent: "initial" as const,
|
|
249
|
+
freshSubscription: b.wireSubscription,
|
|
250
|
+
targetPrice: b.wireTargetPrice,
|
|
251
|
+
billingCustomer: b.wireBillingCustomer,
|
|
252
|
+
observedAt: value.observedAt,
|
|
253
|
+
};
|
|
254
|
+
const reads = validateOwnedReadMaterial(
|
|
255
|
+
{
|
|
256
|
+
apiVersion: raw.apiVersion,
|
|
257
|
+
observedAt: value.observedAt,
|
|
258
|
+
freshSubscription: b.wireSubscription,
|
|
259
|
+
targetPrice: b.wireTargetPrice,
|
|
260
|
+
billingCustomer: b.wireBillingCustomer,
|
|
261
|
+
},
|
|
262
|
+
prepared,
|
|
263
|
+
undefined,
|
|
264
|
+
discounts,
|
|
265
|
+
);
|
|
266
|
+
OWNER.check();
|
|
267
|
+
const result = release(
|
|
268
|
+
material(args, true, prepared, request, reads, {
|
|
269
|
+
actualFreshSubscription: b.wireSubscription,
|
|
270
|
+
}),
|
|
271
|
+
prepared,
|
|
272
|
+
request,
|
|
273
|
+
);
|
|
274
|
+
OWNER.check();
|
|
275
|
+
return result;
|
|
276
|
+
}
|
|
277
|
+
/** Internal DATA consistency only; Source owner and acquisition provenance remain unbound. */
|
|
278
|
+
export function classifyOwnedRetainedInitialAttachment(
|
|
279
|
+
raw: unknown,
|
|
280
|
+
): Promise<Classified | typeof RETAINED_STOP> {
|
|
281
|
+
let value;
|
|
282
|
+
try {
|
|
283
|
+
OWNER.check();
|
|
284
|
+
value = captureRetainedInput(raw);
|
|
285
|
+
OWNER.check();
|
|
286
|
+
} catch {
|
|
287
|
+
return Promise.resolve(RETAINED_STOP);
|
|
288
|
+
}
|
|
289
|
+
return retained(value).catch(() => {
|
|
290
|
+
try {
|
|
291
|
+
OWNER.check();
|
|
292
|
+
} catch {}
|
|
293
|
+
return RETAINED_STOP;
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
export function classifyOwnedInitialAttachment(
|
|
297
|
+
raw: unknown,
|
|
298
|
+
): Promise<Classified | typeof FRESH_STOP> {
|
|
299
|
+
let value;
|
|
300
|
+
try {
|
|
301
|
+
OWNER.check();
|
|
302
|
+
value = captureOwnedInput(raw);
|
|
303
|
+
OWNER.check();
|
|
304
|
+
} catch {
|
|
305
|
+
return Promise.resolve(FRESH_STOP);
|
|
306
|
+
}
|
|
307
|
+
return fresh(value).catch(() => {
|
|
308
|
+
try {
|
|
309
|
+
OWNER.check();
|
|
310
|
+
} catch {}
|
|
311
|
+
return FRESH_STOP;
|
|
312
|
+
});
|
|
313
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
export type Node =
|
|
2
|
+
| { readonly kind: "scalar"; readonly value: unknown }
|
|
3
|
+
| {
|
|
4
|
+
readonly kind: "array" | "object";
|
|
5
|
+
readonly entries: readonly (readonly [string, Node])[];
|
|
6
|
+
};
|
|
7
|
+
export function stop(): never {
|
|
8
|
+
throw Error("MATERIAL_V2_UNSUPPORTED");
|
|
9
|
+
}
|
|
10
|
+
export function need(value: unknown): asserts value {
|
|
11
|
+
if (!value) stop();
|
|
12
|
+
}
|
|
13
|
+
export function freeze<T>(x: T): T {
|
|
14
|
+
if (x && typeof x === "object") {
|
|
15
|
+
for (const d of Object.values(Object.getOwnPropertyDescriptors(x)))
|
|
16
|
+
if ("value" in d) freeze(d.value);
|
|
17
|
+
Object.freeze(x);
|
|
18
|
+
}
|
|
19
|
+
return x;
|
|
20
|
+
}
|
|
21
|
+
export function closed(
|
|
22
|
+
x: unknown,
|
|
23
|
+
required: readonly string[],
|
|
24
|
+
optional: readonly string[] = [],
|
|
25
|
+
): Record<string, unknown> {
|
|
26
|
+
need(x && typeof x === "object" && !Array.isArray(x));
|
|
27
|
+
const p = Object.getPrototypeOf(x);
|
|
28
|
+
need(p === Object.prototype || p === null);
|
|
29
|
+
const keys = Reflect.ownKeys(x);
|
|
30
|
+
need(
|
|
31
|
+
keys.every(
|
|
32
|
+
(k) =>
|
|
33
|
+
typeof k === "string" && (required.includes(k) || optional.includes(k)),
|
|
34
|
+
),
|
|
35
|
+
);
|
|
36
|
+
need(required.every((k) => keys.includes(k)));
|
|
37
|
+
return Object.fromEntries(
|
|
38
|
+
keys.map((k) => {
|
|
39
|
+
const d = Object.getOwnPropertyDescriptor(x, k);
|
|
40
|
+
need(d && d.enumerable && "value" in d);
|
|
41
|
+
return [k, d.value];
|
|
42
|
+
}),
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
export const objectNode = (
|
|
46
|
+
entries: readonly (readonly [string, Node])[],
|
|
47
|
+
): Node =>
|
|
48
|
+
Object.freeze({
|
|
49
|
+
kind: "object",
|
|
50
|
+
entries: Object.freeze(entries.map((e) => Object.freeze(e))),
|
|
51
|
+
});
|
|
52
|
+
export const scalarNode = (value: unknown): Node =>
|
|
53
|
+
Object.freeze({ kind: "scalar", value });
|
|
54
|
+
function ordered(entries: readonly (readonly [string, Node])[]) {
|
|
55
|
+
const index = (k: string) =>
|
|
56
|
+
/^(0|[1-9][0-9]*)$/.test(k) && Number(k) <= 4294967294;
|
|
57
|
+
return [...entries].sort(([a], [b]) => {
|
|
58
|
+
const ai = index(a),
|
|
59
|
+
bi = index(b);
|
|
60
|
+
return ai && bi
|
|
61
|
+
? Number(a) - Number(b)
|
|
62
|
+
: ai
|
|
63
|
+
? -1
|
|
64
|
+
: bi
|
|
65
|
+
? 1
|
|
66
|
+
: a < b
|
|
67
|
+
? -1
|
|
68
|
+
: a > b
|
|
69
|
+
? 1
|
|
70
|
+
: 0;
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
/** Canonical bytes from private captured nodes only; every duplicate occurrence is charged. */
|
|
74
|
+
export function encode(node: Node): string {
|
|
75
|
+
let nodes = 0,
|
|
76
|
+
total = 0;
|
|
77
|
+
function part(s: string) {
|
|
78
|
+
total += s.length;
|
|
79
|
+
if (total > 500000) stop();
|
|
80
|
+
return s;
|
|
81
|
+
}
|
|
82
|
+
function walk(n: Node, depth: number): string {
|
|
83
|
+
if (++nodes > 10000 || depth > 40) stop();
|
|
84
|
+
if (n.kind === "scalar") return part(JSON.stringify(n.value)!);
|
|
85
|
+
if (n.kind === "array")
|
|
86
|
+
return (
|
|
87
|
+
part("[") +
|
|
88
|
+
n.entries
|
|
89
|
+
.map(([, v], i) => (i ? part(",") : "") + walk(v, depth + 1))
|
|
90
|
+
.join("") +
|
|
91
|
+
part("]")
|
|
92
|
+
);
|
|
93
|
+
if (n.kind !== "object") stop();
|
|
94
|
+
return (
|
|
95
|
+
part("{") +
|
|
96
|
+
ordered(n.entries)
|
|
97
|
+
.map(
|
|
98
|
+
([k, v], i) =>
|
|
99
|
+
(i ? part(",") : "") +
|
|
100
|
+
part(JSON.stringify(k)) +
|
|
101
|
+
part(":") +
|
|
102
|
+
walk(v, depth + 1),
|
|
103
|
+
)
|
|
104
|
+
.join("") +
|
|
105
|
+
part("}")
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
const text = walk(node, 0);
|
|
109
|
+
if (new TextEncoder().encode(text).byteLength > 500000) stop();
|
|
110
|
+
return text;
|
|
111
|
+
}
|
|
112
|
+
export function materialize(node: Node): unknown {
|
|
113
|
+
if (node.kind === "scalar") return node.value;
|
|
114
|
+
if (node.kind === "array") return node.entries.map(([, v]) => materialize(v));
|
|
115
|
+
return Object.fromEntries(
|
|
116
|
+
ordered(node.entries).map(([k, v]) => [k, materialize(v)]),
|
|
117
|
+
);
|
|
118
|
+
}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { PreparedRenewalPriceReplacement } from "../../../renewalPriceReplacement.js";
|
|
3
|
+
import {
|
|
4
|
+
renewalSubscription,
|
|
5
|
+
renewalPrice,
|
|
6
|
+
renewalBillingCustomer,
|
|
7
|
+
} from "../../../renewalReplacementSchema.js";
|
|
8
|
+
import {
|
|
9
|
+
readInput,
|
|
10
|
+
referenceId,
|
|
11
|
+
equal,
|
|
12
|
+
conflict,
|
|
13
|
+
unsupported,
|
|
14
|
+
supportedVersion,
|
|
15
|
+
timestamp,
|
|
16
|
+
resourceId,
|
|
17
|
+
productId,
|
|
18
|
+
} from "../../../renewalAggregate/shared.js";
|
|
19
|
+
import { profileOf } from "../../../renewalAggregate/profile.js";
|
|
20
|
+
import { qualifySourceDiscounts } from "../../../renewalAggregate/sourceDiscounts.js";
|
|
21
|
+
import { qualifyOriginalSettings } from "../../../renewalAggregate/sourceSettings.js";
|
|
22
|
+
// Internal semantic material only. Public wrappers must rebuild their own preparation.
|
|
23
|
+
export type RenewalPreparationMaterial = Pick<
|
|
24
|
+
PreparedRenewalPriceReplacement,
|
|
25
|
+
"expected" | "quantity" | "providerSnapshot"
|
|
26
|
+
>;
|
|
27
|
+
const attachedReference = z.union([
|
|
28
|
+
resourceId("sub_sched"),
|
|
29
|
+
z
|
|
30
|
+
.object({
|
|
31
|
+
id: resourceId("sub_sched"),
|
|
32
|
+
object: z.literal("subscription_schedule"),
|
|
33
|
+
deleted: z.literal(false).optional(),
|
|
34
|
+
customer_account: resourceId("acct").optional(),
|
|
35
|
+
livemode: z.boolean().optional(),
|
|
36
|
+
})
|
|
37
|
+
.passthrough(),
|
|
38
|
+
]);
|
|
39
|
+
|
|
40
|
+
export function validateOwnedReadMaterial(
|
|
41
|
+
args: Omit<z.infer<typeof readInput>, "prepared">,
|
|
42
|
+
prepared: RenewalPreparationMaterial,
|
|
43
|
+
scheduleId: string | undefined,
|
|
44
|
+
ownedDiscounts: { subscription: unknown; item: unknown },
|
|
45
|
+
) {
|
|
46
|
+
supportedVersion(args.apiVersion);
|
|
47
|
+
const subscription = renewalSubscription
|
|
48
|
+
.extend({ schedule: scheduleId ? attachedReference : z.null() })
|
|
49
|
+
.safeParse(args.freshSubscription);
|
|
50
|
+
if (!subscription.success)
|
|
51
|
+
unsupported("unsupported_original_subscription_state");
|
|
52
|
+
const source = subscription.data;
|
|
53
|
+
if (scheduleId) {
|
|
54
|
+
if (
|
|
55
|
+
referenceId(source.schedule, "sub_sched", "subscription_schedule") !==
|
|
56
|
+
scheduleId
|
|
57
|
+
)
|
|
58
|
+
conflict("schedule_association_mismatch");
|
|
59
|
+
if (
|
|
60
|
+
typeof source.schedule === "object" &&
|
|
61
|
+
source.schedule !== null &&
|
|
62
|
+
((source.schedule.customer_account !== undefined &&
|
|
63
|
+
source.schedule.customer_account !==
|
|
64
|
+
prepared.expected.customerAccountId) ||
|
|
65
|
+
(source.schedule.livemode !== undefined &&
|
|
66
|
+
source.schedule.livemode !== prepared.expected.livemode))
|
|
67
|
+
)
|
|
68
|
+
conflict("schedule_association_mismatch");
|
|
69
|
+
}
|
|
70
|
+
const { schedule: originalSchedule, ...original } =
|
|
71
|
+
prepared.providerSnapshot.subscription;
|
|
72
|
+
// Compare complete captured bodies, not parser outputs that may omit own keys.
|
|
73
|
+
const { schedule: freshSchedule, ...fresh } =
|
|
74
|
+
args.freshSubscription as typeof source;
|
|
75
|
+
if (scheduleId ? originalSchedule !== null : freshSchedule !== null)
|
|
76
|
+
conflict("schedule_association_mismatch");
|
|
77
|
+
if (!equal(original, fresh)) conflict("original_source_drift");
|
|
78
|
+
const target = renewalPrice.safeParse(args.targetPrice);
|
|
79
|
+
if (!target.success || !target.data.active)
|
|
80
|
+
unsupported("unsupported_target_price");
|
|
81
|
+
if (!equal(args.targetPrice, prepared.providerSnapshot.targetPrice))
|
|
82
|
+
conflict("target_price_drift");
|
|
83
|
+
if (
|
|
84
|
+
prepared.providerSnapshot.billingCustomer === undefined ||
|
|
85
|
+
args.billingCustomer === undefined
|
|
86
|
+
)
|
|
87
|
+
unsupported("missing_retained_billing_customer");
|
|
88
|
+
const customer = renewalBillingCustomer.safeParse(args.billingCustomer);
|
|
89
|
+
if (!customer.success) unsupported("unsupported_billing_customer");
|
|
90
|
+
if (!equal(args.billingCustomer, prepared.providerSnapshot.billingCustomer))
|
|
91
|
+
conflict("billing_customer_drift");
|
|
92
|
+
const referenceContext = {
|
|
93
|
+
customerAccountId: prepared.expected.customerAccountId,
|
|
94
|
+
livemode: prepared.expected.livemode,
|
|
95
|
+
};
|
|
96
|
+
if (
|
|
97
|
+
referenceId(source.customer, "cus", "customer", referenceContext) !==
|
|
98
|
+
customer.data.id ||
|
|
99
|
+
customer.data.customer_account !== prepared.expected.customerAccountId ||
|
|
100
|
+
customer.data.livemode !== prepared.expected.livemode
|
|
101
|
+
)
|
|
102
|
+
conflict("billing_customer_identity_mismatch");
|
|
103
|
+
const item = source.items.data[0];
|
|
104
|
+
if (
|
|
105
|
+
productId(item.price.product, referenceContext) !==
|
|
106
|
+
prepared.expected.currentProductId ||
|
|
107
|
+
productId(target.data.product, referenceContext) !==
|
|
108
|
+
prepared.expected.targetProductId
|
|
109
|
+
)
|
|
110
|
+
unsupported("product_identity_mismatch");
|
|
111
|
+
if (
|
|
112
|
+
args.observedAt < prepared.expected.periodStart ||
|
|
113
|
+
args.observedAt >= prepared.expected.periodEnd
|
|
114
|
+
)
|
|
115
|
+
unsupported("outside_original_paid_period");
|
|
116
|
+
for (const field of [
|
|
117
|
+
"billing_thresholds",
|
|
118
|
+
"managed_payments",
|
|
119
|
+
"next_pending_invoice_item_invoice",
|
|
120
|
+
"pending_invoice_item_interval",
|
|
121
|
+
"pending_setup_intent",
|
|
122
|
+
"canceled_at",
|
|
123
|
+
"ended_at",
|
|
124
|
+
"trial_settings",
|
|
125
|
+
])
|
|
126
|
+
if (source[field] !== null) unsupported(`unsupported_original_${field}`);
|
|
127
|
+
if (item.billing_thresholds !== null)
|
|
128
|
+
unsupported("unsupported_item_billing_thresholds");
|
|
129
|
+
if (item.current_trial !== null)
|
|
130
|
+
unsupported("unsupported_or_missing_item_current_trial");
|
|
131
|
+
if (
|
|
132
|
+
!Array.isArray(source.billing_schedules) ||
|
|
133
|
+
source.billing_schedules.length
|
|
134
|
+
)
|
|
135
|
+
unsupported("unsupported_original_billing_schedules");
|
|
136
|
+
if (
|
|
137
|
+
source.trial_end !== null &&
|
|
138
|
+
(!timestamp.safeParse(source.trial_end).success ||
|
|
139
|
+
Number(source.trial_end) > prepared.expected.periodStart)
|
|
140
|
+
)
|
|
141
|
+
unsupported("unsupported_original_trial");
|
|
142
|
+
if (source.status_details != null || source.presentment_details != null)
|
|
143
|
+
unsupported("unsupported_special_billing_state");
|
|
144
|
+
const originalSettings = qualifyOriginalSettings(source, item, customer.data);
|
|
145
|
+
const profile = profileOf(source, item.price, target.data, args.apiVersion);
|
|
146
|
+
const anchor = timestamp.parse(source.billing_cycle_anchor);
|
|
147
|
+
if (anchor > prepared.expected.periodStart)
|
|
148
|
+
unsupported("unqualified_anchor_after_paid_period_start");
|
|
149
|
+
const discounts = qualifySourceDiscounts(
|
|
150
|
+
ownedDiscounts.subscription,
|
|
151
|
+
"subscription",
|
|
152
|
+
prepared.expected,
|
|
153
|
+
customer.data.id,
|
|
154
|
+
args.observedAt,
|
|
155
|
+
);
|
|
156
|
+
const itemDiscounts = qualifySourceDiscounts(
|
|
157
|
+
ownedDiscounts.item,
|
|
158
|
+
"item",
|
|
159
|
+
prepared.expected,
|
|
160
|
+
customer.data.id,
|
|
161
|
+
args.observedAt,
|
|
162
|
+
);
|
|
163
|
+
return {
|
|
164
|
+
prepared,
|
|
165
|
+
subscription: source,
|
|
166
|
+
item,
|
|
167
|
+
customer: customer.data,
|
|
168
|
+
targetPrice: target.data,
|
|
169
|
+
profile,
|
|
170
|
+
discounts,
|
|
171
|
+
itemDiscounts,
|
|
172
|
+
originalSettings,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export type RenewalReadMaterial = ReturnType<typeof validateOwnedReadMaterial>;
|