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