@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,153 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const id = (prefix) =>
|
|
3
|
+
z
|
|
4
|
+
.string()
|
|
5
|
+
.max(255)
|
|
6
|
+
.regex(new RegExp(`^${prefix}_[A-Za-z0-9_]+$`));
|
|
7
|
+
export const reference = (prefix, object) =>
|
|
8
|
+
z.union([
|
|
9
|
+
id(prefix),
|
|
10
|
+
z
|
|
11
|
+
.object({
|
|
12
|
+
id: id(prefix),
|
|
13
|
+
object: z.literal(object),
|
|
14
|
+
deleted: z.literal(false).optional(),
|
|
15
|
+
livemode: z.boolean().optional(),
|
|
16
|
+
customer: z
|
|
17
|
+
.union([
|
|
18
|
+
id("cus"),
|
|
19
|
+
z
|
|
20
|
+
.object({
|
|
21
|
+
id: id("cus"),
|
|
22
|
+
object: z.literal("customer"),
|
|
23
|
+
deleted: z.literal(false).optional(),
|
|
24
|
+
livemode: z.boolean().optional(),
|
|
25
|
+
customer_account: id("acct").nullable().optional(),
|
|
26
|
+
})
|
|
27
|
+
.passthrough(),
|
|
28
|
+
])
|
|
29
|
+
.nullable()
|
|
30
|
+
.optional(),
|
|
31
|
+
customer_account: id("acct").nullable().optional(),
|
|
32
|
+
})
|
|
33
|
+
.passthrough(),
|
|
34
|
+
]);
|
|
35
|
+
const account = reference("acct", "account");
|
|
36
|
+
const issuer = z.discriminatedUnion("type", [
|
|
37
|
+
z.object({ type: z.literal("self"), account: z.null().optional() }).strict(),
|
|
38
|
+
z.object({ type: z.literal("account"), account }).strict(),
|
|
39
|
+
]);
|
|
40
|
+
const invoiceTaxId = z.union([
|
|
41
|
+
id("txi"),
|
|
42
|
+
z
|
|
43
|
+
.object({
|
|
44
|
+
id: id("txi"),
|
|
45
|
+
object: z.literal("tax_id"),
|
|
46
|
+
deleted: z.literal(false).optional(),
|
|
47
|
+
livemode: z.boolean(),
|
|
48
|
+
customer: z.null().optional(),
|
|
49
|
+
customer_account: z.null().optional(),
|
|
50
|
+
owner: z.discriminatedUnion("type", [
|
|
51
|
+
z
|
|
52
|
+
.object({
|
|
53
|
+
type: z.literal("self"),
|
|
54
|
+
customer_account: z.null(),
|
|
55
|
+
account: z.null().optional(),
|
|
56
|
+
customer: z.null().optional(),
|
|
57
|
+
})
|
|
58
|
+
.strict(),
|
|
59
|
+
z
|
|
60
|
+
.object({
|
|
61
|
+
type: z.literal("account"),
|
|
62
|
+
account,
|
|
63
|
+
customer_account: z.null(),
|
|
64
|
+
customer: z.null().optional(),
|
|
65
|
+
})
|
|
66
|
+
.strict(),
|
|
67
|
+
]),
|
|
68
|
+
})
|
|
69
|
+
.passthrough(),
|
|
70
|
+
]);
|
|
71
|
+
export const taxRate = z
|
|
72
|
+
.object({
|
|
73
|
+
id: id("txr"),
|
|
74
|
+
object: z.literal("tax_rate"),
|
|
75
|
+
deleted: z.literal(false).optional(),
|
|
76
|
+
livemode: z.boolean(),
|
|
77
|
+
})
|
|
78
|
+
.passthrough();
|
|
79
|
+
const string = z.string().max(5000);
|
|
80
|
+
export const settingsInput = z
|
|
81
|
+
.object({
|
|
82
|
+
context: z
|
|
83
|
+
.object({
|
|
84
|
+
customerAccountId: id("acct"),
|
|
85
|
+
customerId: id("cus"),
|
|
86
|
+
livemode: z.boolean(),
|
|
87
|
+
effectiveCollectionMethod: z.enum([
|
|
88
|
+
"charge_automatically",
|
|
89
|
+
"send_invoice",
|
|
90
|
+
]),
|
|
91
|
+
effectiveAutomaticTax: z.boolean(),
|
|
92
|
+
effectiveInvoiceIssuer: issuer,
|
|
93
|
+
})
|
|
94
|
+
.strict(),
|
|
95
|
+
settings: z
|
|
96
|
+
.object({
|
|
97
|
+
application_fee_percent: z.null(),
|
|
98
|
+
billing_thresholds: z.null(),
|
|
99
|
+
collection_method: z
|
|
100
|
+
.enum(["charge_automatically", "send_invoice"])
|
|
101
|
+
.nullable(),
|
|
102
|
+
default_payment_method: reference("pm", "payment_method").nullable(),
|
|
103
|
+
on_behalf_of: account.nullable(),
|
|
104
|
+
transfer_data: z
|
|
105
|
+
.object({
|
|
106
|
+
destination: account,
|
|
107
|
+
amount_percent: z
|
|
108
|
+
.number()
|
|
109
|
+
.min(0)
|
|
110
|
+
.max(100)
|
|
111
|
+
.multipleOf(0.01)
|
|
112
|
+
.nullable(),
|
|
113
|
+
})
|
|
114
|
+
.strict()
|
|
115
|
+
.nullable(),
|
|
116
|
+
automatic_tax: z
|
|
117
|
+
.object({
|
|
118
|
+
enabled: z.boolean(),
|
|
119
|
+
liability: issuer.nullable().optional(),
|
|
120
|
+
disabled_reason: z.null().optional(),
|
|
121
|
+
})
|
|
122
|
+
.strict()
|
|
123
|
+
.optional(),
|
|
124
|
+
default_tax_rates: z.array(taxRate).max(20).nullable().optional(),
|
|
125
|
+
invoice_settings: z
|
|
126
|
+
.object({
|
|
127
|
+
account_tax_ids: z.array(invoiceTaxId).max(20).nullable(),
|
|
128
|
+
custom_fields: z
|
|
129
|
+
.array(
|
|
130
|
+
z
|
|
131
|
+
.object({
|
|
132
|
+
name: z.string().max(40),
|
|
133
|
+
value: z.string().max(140),
|
|
134
|
+
})
|
|
135
|
+
.strict(),
|
|
136
|
+
)
|
|
137
|
+
.max(4)
|
|
138
|
+
.nullable(),
|
|
139
|
+
days_until_due: z.number().int().nonnegative().max(3650).nullable(),
|
|
140
|
+
description: string.nullable(),
|
|
141
|
+
footer: string.nullable(),
|
|
142
|
+
issuer: issuer.nullable(),
|
|
143
|
+
})
|
|
144
|
+
.strict()
|
|
145
|
+
.nullable(),
|
|
146
|
+
description: string.nullable(),
|
|
147
|
+
metadata: z
|
|
148
|
+
.record(z.string().max(40), z.string().min(1).max(500))
|
|
149
|
+
.nullable(),
|
|
150
|
+
})
|
|
151
|
+
.strict(),
|
|
152
|
+
})
|
|
153
|
+
.strict();
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const id = (prefix) =>
|
|
3
|
+
z
|
|
4
|
+
.string()
|
|
5
|
+
.max(255)
|
|
6
|
+
.regex(new RegExp(`^${prefix}_[A-Za-z0-9_]+$`));
|
|
7
|
+
const integer = z.number().int().positive().max(Number.MAX_SAFE_INTEGER);
|
|
8
|
+
// Stripe allows caller-supplied product IDs, including IDs without prod_.
|
|
9
|
+
const productId = z.string().min(1).max(255).regex(/\S/);
|
|
10
|
+
const product = z.union([
|
|
11
|
+
productId,
|
|
12
|
+
z
|
|
13
|
+
.object({
|
|
14
|
+
id: productId,
|
|
15
|
+
object: z.literal("product"),
|
|
16
|
+
deleted: z.literal(false).optional(),
|
|
17
|
+
})
|
|
18
|
+
.passthrough(),
|
|
19
|
+
]);
|
|
20
|
+
export const renewalPrice = z
|
|
21
|
+
.object({
|
|
22
|
+
id: id("price"),
|
|
23
|
+
object: z.literal("price"),
|
|
24
|
+
product,
|
|
25
|
+
active: z.boolean(),
|
|
26
|
+
livemode: z.boolean(),
|
|
27
|
+
type: z.literal("recurring"),
|
|
28
|
+
currency: z.string().regex(/^[a-z]{3}$/),
|
|
29
|
+
billing_scheme: z.literal("per_unit"),
|
|
30
|
+
recurring: z
|
|
31
|
+
.object({
|
|
32
|
+
interval: z.enum(["day", "week", "month", "year"]),
|
|
33
|
+
interval_count: integer,
|
|
34
|
+
usage_type: z.literal("licensed"),
|
|
35
|
+
})
|
|
36
|
+
.passthrough(),
|
|
37
|
+
})
|
|
38
|
+
.passthrough();
|
|
39
|
+
export const renewalExpected = z
|
|
40
|
+
.object({
|
|
41
|
+
customerAccountId: id("acct"),
|
|
42
|
+
subscriptionId: id("sub"),
|
|
43
|
+
itemId: id("si"),
|
|
44
|
+
currentPriceId: id("price"),
|
|
45
|
+
currentProductId: productId,
|
|
46
|
+
targetPriceId: id("price"),
|
|
47
|
+
targetProductId: productId,
|
|
48
|
+
periodStart: integer,
|
|
49
|
+
periodEnd: integer,
|
|
50
|
+
livemode: z.boolean(),
|
|
51
|
+
})
|
|
52
|
+
.strict()
|
|
53
|
+
.refine((v) => v.periodEnd > v.periodStart, "Invalid original period.");
|
|
54
|
+
export const renewalSubscription = z
|
|
55
|
+
.object({
|
|
56
|
+
id: id("sub"),
|
|
57
|
+
object: z.literal("subscription"),
|
|
58
|
+
customer_account: id("acct"),
|
|
59
|
+
status: z.literal("active"),
|
|
60
|
+
currency: z.string().regex(/^[a-z]{3}$/),
|
|
61
|
+
livemode: z.boolean(),
|
|
62
|
+
schedule: z.null(),
|
|
63
|
+
cancel_at: z.null(),
|
|
64
|
+
cancel_at_period_end: z.literal(false),
|
|
65
|
+
pause_collection: z.null(),
|
|
66
|
+
pending_update: z.null(),
|
|
67
|
+
default_source: z.null(),
|
|
68
|
+
application_fee_percent: z.null(),
|
|
69
|
+
payment_settings: z.union([
|
|
70
|
+
z.null(),
|
|
71
|
+
z
|
|
72
|
+
.object({
|
|
73
|
+
payment_method_options: z.null(),
|
|
74
|
+
payment_method_types: z.null(),
|
|
75
|
+
save_default_payment_method: z.literal("off").nullable(),
|
|
76
|
+
})
|
|
77
|
+
.strict(),
|
|
78
|
+
]),
|
|
79
|
+
billing_schedules: z.array(z.unknown()).length(0).optional(),
|
|
80
|
+
items: z
|
|
81
|
+
.object({
|
|
82
|
+
has_more: z.literal(false),
|
|
83
|
+
data: z.tuple([
|
|
84
|
+
z
|
|
85
|
+
.object({
|
|
86
|
+
id: id("si"),
|
|
87
|
+
object: z.literal("subscription_item"),
|
|
88
|
+
subscription: id("sub"),
|
|
89
|
+
current_period_start: integer,
|
|
90
|
+
current_period_end: integer,
|
|
91
|
+
quantity: integer,
|
|
92
|
+
price: renewalPrice,
|
|
93
|
+
})
|
|
94
|
+
.passthrough(),
|
|
95
|
+
]),
|
|
96
|
+
})
|
|
97
|
+
.passthrough(),
|
|
98
|
+
})
|
|
99
|
+
.passthrough();
|
|
100
|
+
export const renewalBillingCustomer = z
|
|
101
|
+
.object({
|
|
102
|
+
id: id("cus"),
|
|
103
|
+
object: z.literal("customer"),
|
|
104
|
+
customer_account: id("acct"),
|
|
105
|
+
livemode: z.boolean(),
|
|
106
|
+
deleted: z.literal(false).optional(),
|
|
107
|
+
discount: z.union([
|
|
108
|
+
z.null(),
|
|
109
|
+
z
|
|
110
|
+
.object({
|
|
111
|
+
id: id("di"),
|
|
112
|
+
object: z.literal("discount"),
|
|
113
|
+
deleted: z.literal(false).optional(),
|
|
114
|
+
})
|
|
115
|
+
.passthrough(),
|
|
116
|
+
]),
|
|
117
|
+
})
|
|
118
|
+
.passthrough();
|
|
119
|
+
export const renewalPreparationInput = z
|
|
120
|
+
.object({
|
|
121
|
+
subscription: z.unknown(),
|
|
122
|
+
targetPrice: z.unknown(),
|
|
123
|
+
billingCustomer: z.unknown().optional(),
|
|
124
|
+
expected: renewalExpected,
|
|
125
|
+
key: z.string(),
|
|
126
|
+
})
|
|
127
|
+
.strict();
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/** A bounded JSON copy. Reject non-JSON values rather than silently dropping them. */
|
|
2
|
+
export function renewalSnapshot(value) {
|
|
3
|
+
const seen = new Set();
|
|
4
|
+
let nodes = 0;
|
|
5
|
+
let characters = 500_000;
|
|
6
|
+
function charge(size) {
|
|
7
|
+
characters -= size;
|
|
8
|
+
if (characters < 0)
|
|
9
|
+
throw new Error("Renewal snapshot exceeds its JSON size budget.");
|
|
10
|
+
}
|
|
11
|
+
function copy(item, depth) {
|
|
12
|
+
if (++nodes > 10_000 || depth > 40)
|
|
13
|
+
throw new Error("Renewal snapshot exceeds its JSON traversal budget.");
|
|
14
|
+
if (typeof item === "string") {
|
|
15
|
+
charge(item.length);
|
|
16
|
+
return item;
|
|
17
|
+
}
|
|
18
|
+
if (item === null || typeof item === "boolean") return item;
|
|
19
|
+
if (typeof item === "number" && Number.isFinite(item)) return item;
|
|
20
|
+
if (typeof item !== "object" || item === null || seen.has(item))
|
|
21
|
+
throw new Error("Renewal snapshot must contain finite JSON values.");
|
|
22
|
+
if (
|
|
23
|
+
!Array.isArray(item) &&
|
|
24
|
+
![Object.prototype, null].includes(Object.getPrototypeOf(item))
|
|
25
|
+
)
|
|
26
|
+
throw new Error("Renewal snapshot must contain plain JSON objects.");
|
|
27
|
+
if (Array.isArray(item) && item.length > 10_000)
|
|
28
|
+
throw new Error(
|
|
29
|
+
"Renewal snapshot array is too large for its JSON budget.",
|
|
30
|
+
);
|
|
31
|
+
seen.add(item);
|
|
32
|
+
const entries = [];
|
|
33
|
+
for (const key in item) {
|
|
34
|
+
const entry = Object.getOwnPropertyDescriptor(item, key);
|
|
35
|
+
if (!entry) continue;
|
|
36
|
+
if (!("value" in entry))
|
|
37
|
+
throw new Error("Renewal snapshot must contain JSON data properties.");
|
|
38
|
+
if (entries.length >= 10_000)
|
|
39
|
+
throw new Error(
|
|
40
|
+
"Renewal snapshot object exceeds its JSON traversal budget.",
|
|
41
|
+
);
|
|
42
|
+
charge(key.length);
|
|
43
|
+
entries.push([key, entry.value]);
|
|
44
|
+
}
|
|
45
|
+
if (
|
|
46
|
+
Object.getOwnPropertySymbols(item).some(
|
|
47
|
+
(key) => Object.getOwnPropertyDescriptor(item, key)?.enumerable,
|
|
48
|
+
)
|
|
49
|
+
)
|
|
50
|
+
throw new Error("Renewal snapshot must contain JSON data properties.");
|
|
51
|
+
let result;
|
|
52
|
+
if (Array.isArray(item)) {
|
|
53
|
+
if (
|
|
54
|
+
entries.some(
|
|
55
|
+
([key]) =>
|
|
56
|
+
!/^(0|[1-9][0-9]*)$/.test(key) || Number(key) >= item.length,
|
|
57
|
+
)
|
|
58
|
+
)
|
|
59
|
+
throw new Error(
|
|
60
|
+
"Renewal snapshot arrays must contain only JSON elements.",
|
|
61
|
+
);
|
|
62
|
+
result = Array.from({ length: item.length }, (_, index) => {
|
|
63
|
+
const entry = Object.getOwnPropertyDescriptor(item, String(index));
|
|
64
|
+
if (!entry || !("value" in entry))
|
|
65
|
+
throw new Error(
|
|
66
|
+
"Renewal snapshot must not contain sparse JSON arrays.",
|
|
67
|
+
);
|
|
68
|
+
return copy(entry.value, depth + 1);
|
|
69
|
+
});
|
|
70
|
+
} else {
|
|
71
|
+
result = Object.fromEntries(
|
|
72
|
+
entries
|
|
73
|
+
.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))
|
|
74
|
+
.map(([key, entry]) => [key, copy(entry, depth + 1)]),
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
seen.delete(item);
|
|
78
|
+
return result;
|
|
79
|
+
}
|
|
80
|
+
const normalized = copy(value, 0);
|
|
81
|
+
const serialized = JSON.stringify(normalized);
|
|
82
|
+
if (serialized.length > 500_000)
|
|
83
|
+
throw new Error("Renewal snapshot is too large.");
|
|
84
|
+
return JSON.parse(serialized);
|
|
85
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { requiredJSONSnapshot } from "./f15.mjs";
|
|
2
|
+
import { objectNode, scalarNode, encode, materialize } from "./f14.mjs";
|
|
3
|
+
import { need, closed, freeze } from "./f17.mjs";
|
|
4
|
+
const expected = [
|
|
5
|
+
"customerAccountId",
|
|
6
|
+
"subscriptionId",
|
|
7
|
+
"itemId",
|
|
8
|
+
"currentPriceId",
|
|
9
|
+
"currentProductId",
|
|
10
|
+
"targetPriceId",
|
|
11
|
+
"targetProductId",
|
|
12
|
+
"periodStart",
|
|
13
|
+
"periodEnd",
|
|
14
|
+
"livemode",
|
|
15
|
+
];
|
|
16
|
+
function preparation(x) {
|
|
17
|
+
const p = closed(
|
|
18
|
+
x,
|
|
19
|
+
["subscription", "targetPrice", "expected", "key"],
|
|
20
|
+
["billingCustomer"],
|
|
21
|
+
);
|
|
22
|
+
closed(p.expected, expected);
|
|
23
|
+
need(typeof p.key === "string");
|
|
24
|
+
}
|
|
25
|
+
function attach(x) {
|
|
26
|
+
const a = closed(x, [
|
|
27
|
+
"preparation",
|
|
28
|
+
"apiVersion",
|
|
29
|
+
"attachKey",
|
|
30
|
+
"firstDispatchedAt",
|
|
31
|
+
]);
|
|
32
|
+
preparation(a.preparation);
|
|
33
|
+
need(
|
|
34
|
+
typeof a.apiVersion === "string" &&
|
|
35
|
+
typeof a.attachKey === "string" &&
|
|
36
|
+
typeof a.firstDispatchedAt === "number",
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
function receipt(x) {
|
|
40
|
+
const r = closed(x, ["attachRequest", "actualDispatch", "providerSnapshot"]);
|
|
41
|
+
attach(r.attachRequest);
|
|
42
|
+
closed(r.actualDispatch, [
|
|
43
|
+
"scope",
|
|
44
|
+
"apiVersion",
|
|
45
|
+
"method",
|
|
46
|
+
"path",
|
|
47
|
+
"payload",
|
|
48
|
+
"key",
|
|
49
|
+
"firstDispatchedAt",
|
|
50
|
+
]);
|
|
51
|
+
}
|
|
52
|
+
function configuration(x) {
|
|
53
|
+
const c = closed(
|
|
54
|
+
x,
|
|
55
|
+
[
|
|
56
|
+
"preparation",
|
|
57
|
+
"attachReceipt",
|
|
58
|
+
"freshSubscription",
|
|
59
|
+
"targetPrice",
|
|
60
|
+
"schedule",
|
|
61
|
+
"apiVersion",
|
|
62
|
+
"observedAt",
|
|
63
|
+
"firstDispatchedAt",
|
|
64
|
+
"configureKey",
|
|
65
|
+
],
|
|
66
|
+
["billingCustomer"],
|
|
67
|
+
);
|
|
68
|
+
preparation(c.preparation);
|
|
69
|
+
receipt(c.attachReceipt);
|
|
70
|
+
need(
|
|
71
|
+
typeof c.apiVersion === "string" &&
|
|
72
|
+
typeof c.observedAt === "number" &&
|
|
73
|
+
typeof c.firstDispatchedAt === "number" &&
|
|
74
|
+
typeof c.configureKey === "string",
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
function shape(x, stage, fresh) {
|
|
78
|
+
const configure = stage === "configure";
|
|
79
|
+
const root = configure ? "configuration" : "attachRequest";
|
|
80
|
+
const a = closed(x, [
|
|
81
|
+
root,
|
|
82
|
+
"intent",
|
|
83
|
+
...(fresh
|
|
84
|
+
? [
|
|
85
|
+
"freshSubscription",
|
|
86
|
+
"targetPrice",
|
|
87
|
+
"billingCustomer",
|
|
88
|
+
...(configure ? ["schedule"] : []),
|
|
89
|
+
"observedAt",
|
|
90
|
+
]
|
|
91
|
+
: []),
|
|
92
|
+
]);
|
|
93
|
+
need(a.intent === "initial" || (!configure && a.intent === "replay_unknown"));
|
|
94
|
+
if (fresh)
|
|
95
|
+
need(
|
|
96
|
+
typeof a.observedAt === "number" &&
|
|
97
|
+
Number.isSafeInteger(a.observedAt) &&
|
|
98
|
+
a.observedAt >= 0,
|
|
99
|
+
);
|
|
100
|
+
(configure ? configuration : attach)(a[root]);
|
|
101
|
+
}
|
|
102
|
+
export function captureRaw(value, stage, fresh) {
|
|
103
|
+
shape(value, stage, fresh);
|
|
104
|
+
// Original whole ordinary admission precedes any clone/encoding. Discard array reflection order.
|
|
105
|
+
requiredJSONSnapshot(value);
|
|
106
|
+
let nodes = 0,
|
|
107
|
+
raw = 0;
|
|
108
|
+
const active = new Set();
|
|
109
|
+
function scalar(x) {
|
|
110
|
+
requiredJSONSnapshot(x);
|
|
111
|
+
if (typeof x === "string") raw += x.length;
|
|
112
|
+
need(raw <= 500000);
|
|
113
|
+
return scalarNode(x);
|
|
114
|
+
}
|
|
115
|
+
function walk(x, depth) {
|
|
116
|
+
need(++nodes <= 10000 && depth <= 40);
|
|
117
|
+
if (x === null || typeof x !== "object") return scalar(x);
|
|
118
|
+
need(!active.has(x));
|
|
119
|
+
const array = Array.isArray(x),
|
|
120
|
+
proto = Object.getPrototypeOf(x);
|
|
121
|
+
need(
|
|
122
|
+
array
|
|
123
|
+
? proto === Array.prototype
|
|
124
|
+
: proto === Object.prototype || proto === null,
|
|
125
|
+
);
|
|
126
|
+
const keys = Reflect.ownKeys(x);
|
|
127
|
+
need(keys.every((k) => typeof k === "string"));
|
|
128
|
+
const length = array ? Object.getOwnPropertyDescriptor(x, "length") : null;
|
|
129
|
+
if (array)
|
|
130
|
+
need(
|
|
131
|
+
length &&
|
|
132
|
+
"value" in length &&
|
|
133
|
+
Number.isSafeInteger(length.value) &&
|
|
134
|
+
length.value >= 0 &&
|
|
135
|
+
length.value <= 10000,
|
|
136
|
+
);
|
|
137
|
+
const entries = [];
|
|
138
|
+
active.add(x);
|
|
139
|
+
for (const key of keys) {
|
|
140
|
+
if (array && key === "length") continue;
|
|
141
|
+
need(
|
|
142
|
+
!array || (/^(0|[1-9][0-9]*)$/.test(key) && Number(key) < length.value),
|
|
143
|
+
);
|
|
144
|
+
const d = Object.getOwnPropertyDescriptor(x, key);
|
|
145
|
+
need(d && d.enumerable && "value" in d);
|
|
146
|
+
requiredJSONSnapshot({ [key]: d.value === null ? null : true });
|
|
147
|
+
requiredJSONSnapshot(key);
|
|
148
|
+
raw += key.length;
|
|
149
|
+
need(raw <= 500000);
|
|
150
|
+
entries.push([key, walk(d.value, depth + 1)]);
|
|
151
|
+
}
|
|
152
|
+
active.delete(x);
|
|
153
|
+
if (array) {
|
|
154
|
+
need(entries.length === length.value);
|
|
155
|
+
entries.sort(([a], [b]) => Number(a) - Number(b));
|
|
156
|
+
return Object.freeze({
|
|
157
|
+
kind: "array",
|
|
158
|
+
entries: Object.freeze(entries.map(Object.freeze)),
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
return objectNode(entries);
|
|
162
|
+
}
|
|
163
|
+
const node = walk(value, 0);
|
|
164
|
+
encode(node);
|
|
165
|
+
const detached = materialize(node);
|
|
166
|
+
shape(detached, stage, fresh);
|
|
167
|
+
const plain = requiredJSONSnapshot(detached);
|
|
168
|
+
shape(plain, stage, fresh);
|
|
169
|
+
return freeze(plain);
|
|
170
|
+
}
|