@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.
Files changed (335) hide show
  1. package/CHANGELOG.md +12 -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/billing/renewalAttach/internal/originalOwner.d.ts +27 -0
  245. package/dist/client/billing/renewalAttach/internal/originalOwner.d.ts.map +1 -0
  246. package/dist/client/billing/renewalAttach/internal/originalOwner.js +236 -0
  247. package/dist/client/billing/renewalAttach/internal/originalOwner.js.map +1 -0
  248. package/dist/client/billing/renewalAttach/internal/sourceBindings.d.ts +5 -0
  249. package/dist/client/billing/renewalAttach/internal/sourceBindings.d.ts.map +1 -0
  250. package/dist/client/billing/renewalAttach/internal/sourceBindings.js +9 -0
  251. package/dist/client/billing/renewalAttach/internal/sourceBindings.js.map +1 -0
  252. package/dist/client/billing/renewalAttach/internal/stockRawDelegate.d.ts +6 -0
  253. package/dist/client/billing/renewalAttach/internal/stockRawDelegate.d.ts.map +1 -0
  254. package/dist/client/billing/renewalAttach/internal/stockRawDelegate.js +35 -0
  255. package/dist/client/billing/renewalAttach/internal/stockRawDelegate.js.map +1 -0
  256. package/docs/renewal-context-reads.md +43 -0
  257. package/docs/renewal-phase-assembly.md +23 -0
  258. package/docs/renewal-raw-acquisition.md +64 -0
  259. package/package.json +1 -1
  260. package/src/client/billing/renewalAttach/internal/acquisition/array-order.test.js +70 -0
  261. package/src/client/billing/renewalAttach/internal/acquisition/coupon-stop-order.test.js +23 -0
  262. package/src/client/billing/renewalAttach/internal/acquisition/fetch-metadata.test.js +77 -0
  263. package/src/client/billing/renewalAttach/internal/acquisition/raw-acquisition.test.js +418 -0
  264. package/src/client/billing/renewalAttach/internal/acquisition/rawAcquisition.ts +160 -0
  265. package/src/client/billing/renewalAttach/internal/acquisition/rawCouponJoins.ts +110 -0
  266. package/src/client/billing/renewalAttach/internal/acquisition/rawWireSource.ts +156 -0
  267. package/src/client/billing/renewalAttach/internal/acquisition/readLifetime.ts +64 -0
  268. package/src/client/billing/renewalAttach/internal/acquisition/sourceBinding.test.js +138 -0
  269. package/src/client/billing/renewalAttach/internal/acquisition/test-fixtures/fixture.mjs +510 -0
  270. package/src/client/billing/renewalAttach/internal/acquisition/test-fixtures/raw-retention-fixture.mjs +64 -0
  271. package/src/client/billing/renewalAttach/internal/acquisition/test-fixtures/scenario.mjs +159 -0
  272. package/src/client/billing/renewalAttach/internal/acquisition/test-fixtures/sourcePort.mjs +25 -0
  273. package/src/client/billing/renewalAttach/internal/c10/appendAck.first.test.ts +86 -0
  274. package/src/client/billing/renewalAttach/internal/c10/appendAck.ts +226 -0
  275. package/src/client/billing/renewalAttach/internal/c10/appendCodec.test.ts +186 -0
  276. package/src/client/billing/renewalAttach/internal/c10/arrayOrder.test.ts +47 -0
  277. package/src/client/billing/renewalAttach/internal/c10/attachEvents.ts +144 -0
  278. package/src/client/billing/renewalAttach/internal/c10/compiler.test.ts +443 -0
  279. package/src/client/billing/renewalAttach/internal/c10/configureEvents.ts +145 -0
  280. package/src/client/billing/renewalAttach/internal/c10/eventCapture.ts +464 -0
  281. package/src/client/billing/renewalAttach/internal/c10/eventCodec.ts +131 -0
  282. package/src/client/billing/renewalAttach/internal/c10/hardening.test.ts +175 -0
  283. package/src/client/billing/renewalAttach/internal/c10/historicalClassifier.test.ts +114 -0
  284. package/src/client/billing/renewalAttach/internal/c10/ownData.ts +103 -0
  285. package/src/client/billing/renewalAttach/internal/c10/ownerBinding.ts +2 -0
  286. package/src/client/billing/renewalAttach/internal/c10/ownerContinuations.test.ts +283 -0
  287. package/src/client/billing/renewalAttach/internal/c10/privacy.ts +181 -0
  288. package/src/client/billing/renewalAttach/internal/c10/publicApi.ts +8 -0
  289. package/src/client/billing/renewalAttach/internal/c10/reflectionPrivacy.test.ts +87 -0
  290. package/src/client/billing/renewalAttach/internal/c10/test-fixtures/compilerIndex.mjs +3 -0
  291. package/src/client/billing/renewalAttach/internal/c10/test-fixtures/fixture.mjs +49 -0
  292. package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f00.mjs +63 -0
  293. package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f01.mjs +160 -0
  294. package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f02.mjs +88 -0
  295. package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f03.mjs +102 -0
  296. package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f04.mjs +82 -0
  297. package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f05.mjs +20 -0
  298. package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f06.mjs +41 -0
  299. package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f07.mjs +137 -0
  300. package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f08.mjs +153 -0
  301. package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f09.mjs +127 -0
  302. package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f10.mjs +85 -0
  303. package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f11.mjs +170 -0
  304. package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f12.mjs +6 -0
  305. package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f13.mjs +295 -0
  306. package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f14.mjs +78 -0
  307. package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f15.mjs +177 -0
  308. package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f16.mjs +8 -0
  309. package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f17.mjs +34 -0
  310. package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f18.mjs +32 -0
  311. package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f19.json +452 -0
  312. package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f20.mjs +177 -0
  313. package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f21.mjs +466 -0
  314. package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f22.mjs +29 -0
  315. package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f23.mjs +165 -0
  316. package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f24.mjs +507 -0
  317. package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f25.mjs +89 -0
  318. package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f26.mjs +38 -0
  319. package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f27.mjs +45 -0
  320. package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f28.mjs +309 -0
  321. package/src/client/billing/renewalAttach/internal/c10/test-fixtures/frozen/f29.mjs +58 -0
  322. package/src/client/billing/renewalAttach/internal/c10/test-fixtures/publishedRawkeyHelper.mjs +104 -0
  323. package/src/client/billing/renewalAttach/internal/c10/test-fixtures/semanticSetup.ts +43 -0
  324. package/src/client/billing/renewalAttach/internal/material/capture.ts +243 -0
  325. package/src/client/billing/renewalAttach/internal/material/classifiers.test.ts +510 -0
  326. package/src/client/billing/renewalAttach/internal/material/classifiers.ts +313 -0
  327. package/src/client/billing/renewalAttach/internal/material/nodeKernel.ts +118 -0
  328. package/src/client/billing/renewalAttach/internal/material/readMaterial.ts +176 -0
  329. package/src/client/billing/renewalAttach/internal/material/requiredJson.ts +183 -0
  330. package/src/client/billing/renewalAttach/internal/originalOwner.test.ts +258 -0
  331. package/src/client/billing/renewalAttach/internal/originalOwner.ts +280 -0
  332. package/src/client/billing/renewalAttach/internal/sourceBindings.test.ts +13 -0
  333. package/src/client/billing/renewalAttach/internal/sourceBindings.ts +8 -0
  334. package/src/client/billing/renewalAttach/internal/stockRawDelegate.test.ts +156 -0
  335. package/src/client/billing/renewalAttach/internal/stockRawDelegate.ts +43 -0
@@ -0,0 +1,510 @@
1
+ import { afterEach, expect, it, vi } from "vitest";
2
+ import { configuration } from "../../../../../../tests/renewalAggregate/rawRetention.js";
3
+ import {
4
+ prepareRenewalPriceReplacementV2,
5
+ prepareRenewalScheduleAttachmentV2,
6
+ } from "../../../renewalV2/index.js";
7
+
8
+ afterEach(() => {
9
+ vi.doUnmock("../sourceBindings.js");
10
+ vi.resetModules();
11
+ vi.unstubAllGlobals();
12
+ vi.restoreAllMocks();
13
+ });
14
+
15
+ function fixture(strings = true) {
16
+ const p: any = structuredClone(configuration().preparation);
17
+ const couponReads: any[] = [],
18
+ ids = new Map<string, number>();
19
+ for (const source of [p.subscription, p.subscription.items.data[0]])
20
+ for (const d of source.discounts) {
21
+ const c = d.source.coupon;
22
+ c.times_redeemed = 7;
23
+ c.metadata = { declared: "SYNTHETIC_RETAINED_315", opaque: "keep" };
24
+ c.future_native = { unknown: [null, 1.25, "ordinary"] };
25
+ if (!ids.has(c.id)) {
26
+ ids.set(c.id, couponReads.length);
27
+ couponReads.push({
28
+ couponId: c.id,
29
+ wireCoupon: structuredClone(c),
30
+ association: { resource: "coupon", ordinal: 4 + couponReads.length },
31
+ });
32
+ }
33
+ if (strings) d.source.coupon = c.id;
34
+ }
35
+ p.subscription.opaque = { preserved: ["Sub", null] };
36
+ p.targetPrice.opaque = { preserved: "Price" };
37
+ p.billingCustomer.opaque = { preserved: "Customer" };
38
+ const b: any = {
39
+ wireSubscription: structuredClone(p.subscription),
40
+ wireTargetPrice: structuredClone(p.targetPrice),
41
+ wireBillingCustomer: structuredClone(p.billingCustomer),
42
+ couponReads,
43
+ derivedCouponJoins: null,
44
+ };
45
+ const rows = [
46
+ b.wireSubscription.discounts,
47
+ b.wireSubscription.items.data[0].discounts,
48
+ ].map((list: any[]) =>
49
+ list.map((d, index) => {
50
+ const ref = d.source.coupon,
51
+ id = typeof ref === "string" ? ref : ref.id,
52
+ couponReadIndex = couponReads.findIndex((r) => r.couponId === id);
53
+ return {
54
+ index,
55
+ discountId: d.id,
56
+ originalCouponReference: structuredClone(ref),
57
+ couponReadIndex,
58
+ joinedDiscount: {
59
+ ...structuredClone(d),
60
+ source: {
61
+ ...structuredClone(d.source),
62
+ coupon: structuredClone(couponReads[couponReadIndex].wireCoupon),
63
+ },
64
+ },
65
+ };
66
+ }),
67
+ );
68
+ b.derivedCouponJoins = { subscription: rows[0], item: rows[1] };
69
+ const attachRequest = {
70
+ preparation: p,
71
+ apiVersion: "2026-09-30.endive",
72
+ attachKey: "attach:retained315",
73
+ firstDispatchedAt: p.expected.periodStart + 1,
74
+ };
75
+ return { attachRequest, originalBundle: b };
76
+ }
77
+ async function live(strings = true) {
78
+ vi.resetModules();
79
+ const input = fixture(strings);
80
+ const service = {
81
+ clock: {
82
+ basis: {
83
+ startWallMs: 0,
84
+ startNs: 0n,
85
+ workEndWallMs: 0,
86
+ workEndNs: 0n,
87
+ endWallMs: 0,
88
+ endNs: 0n,
89
+ },
90
+ sample: () => ({
91
+ wallMs: input.attachRequest.firstDispatchedAt * 1000,
92
+ ns: BigInt(input.attachRequest.firstDispatchedAt * 1000) * 1000000n,
93
+ }),
94
+ subscribeRetirement: () => () => {},
95
+ },
96
+ originalPolicy: { firstDispatchedAt: 0, periodStart: 0, periodEnd: 0 },
97
+ originAssociation: Object.freeze({}),
98
+ };
99
+ const start = input.attachRequest.firstDispatchedAt * 1000;
100
+ Object.assign(service.clock.basis, {
101
+ startWallMs: start,
102
+ startNs: BigInt(start) * 1000000n,
103
+ workEndWallMs: start + 180000,
104
+ workEndNs: BigInt(start + 180000) * 1000000n,
105
+ endWallMs: start + 210000,
106
+ endNs: BigInt(start + 210000) * 1000000n,
107
+ });
108
+ Object.assign(service.originalPolicy, {
109
+ firstDispatchedAt: input.attachRequest.firstDispatchedAt,
110
+ periodStart: input.attachRequest.preparation.expected.periodStart,
111
+ periodEnd: input.attachRequest.preparation.expected.periodEnd,
112
+ });
113
+ vi.doMock("../sourceBindings.js", () => ({
114
+ loadOwnedOriginalSource: () => service,
115
+ }));
116
+ const { OWNER } = await import("../originalOwner.js");
117
+ OWNER.check();
118
+ const classifiers = await import("./classifiers.js");
119
+ return { input, OWNER, classifiers, service };
120
+ }
121
+
122
+ it("classifies complete retained raw Coupon evidence with actual C1 and C2", async () => {
123
+ const h = await live();
124
+ const raw = h.input.attachRequest;
125
+ const prepared = await prepareRenewalPriceReplacementV2(raw.preparation);
126
+ h.OWNER.check();
127
+ const request = await prepareRenewalScheduleAttachmentV2({
128
+ prepared,
129
+ apiVersion: raw.apiVersion,
130
+ attachKey: raw.attachKey,
131
+ firstDispatchedAt: raw.firstDispatchedAt,
132
+ });
133
+ h.OWNER.check();
134
+ expect(request.payload).toEqual({
135
+ from_subscription: raw.preparation.expected.subscriptionId,
136
+ });
137
+ const result = await h.classifiers.classifyOwnedRetainedInitialAttachment(
138
+ h.input,
139
+ );
140
+ expect(result.status).toBe("classified");
141
+ });
142
+
143
+ function freshInput(h: Awaited<ReturnType<typeof live>>) {
144
+ return {
145
+ ...h.input,
146
+ currentBundle: structuredClone(h.input.originalBundle),
147
+ observedAt: h.input.attachRequest.firstDispatchedAt,
148
+ };
149
+ }
150
+ function derive(b: any) {
151
+ const lists = [
152
+ b.wireSubscription.discounts,
153
+ b.wireSubscription.items.data[0].discounts,
154
+ ];
155
+ const rows = lists.map((list: any[]) =>
156
+ list.map((d, index) => {
157
+ const ref = d.source.coupon,
158
+ id = typeof ref === "string" ? ref : ref.id,
159
+ couponReadIndex = b.couponReads.findIndex(
160
+ (r: any) => r.couponId === id,
161
+ );
162
+ return {
163
+ index,
164
+ discountId: d.id,
165
+ originalCouponReference: structuredClone(ref),
166
+ couponReadIndex,
167
+ joinedDiscount: {
168
+ ...structuredClone(d),
169
+ source: {
170
+ ...structuredClone(d.source),
171
+ coupon: structuredClone(b.couponReads[couponReadIndex].wireCoupon),
172
+ },
173
+ },
174
+ };
175
+ }),
176
+ );
177
+ b.derivedCouponJoins = { subscription: rows[0], item: rows[1] };
178
+ }
179
+ function realDigestCounter() {
180
+ const subtle = globalThis.crypto.subtle,
181
+ original = subtle.digest.bind(subtle);
182
+ let count = 0;
183
+ vi.spyOn(subtle, "digest").mockImplementation((algorithm, data) => {
184
+ count++;
185
+ return original(algorithm, data);
186
+ });
187
+ return () => count;
188
+ }
189
+ it.each([true, false])(
190
+ "retained and fresh full material preserve same-form string=%s Coupon evidence",
191
+ async (strings) => {
192
+ const h = await live(strings),
193
+ input = freshInput(h),
194
+ before = structuredClone(input);
195
+ const a = await h.classifiers.classifyOwnedRetainedInitialAttachment(
196
+ h.input,
197
+ ),
198
+ result = await h.classifiers.classifyOwnedInitialAttachment(input);
199
+ expect(a.status).toBe("classified");
200
+ expect(result.status).toBe("classified");
201
+ if (a.status !== "classified" || result.status !== "classified")
202
+ throw Error("Expected actual material");
203
+ expect(Object.keys(result.material)).toHaveLength(21);
204
+ expect(result.material.rawSources).toEqual({
205
+ attachRequest: input.attachRequest,
206
+ intent: "initial",
207
+ freshSubscription: input.currentBundle.wireSubscription,
208
+ targetPrice: input.currentBundle.wireTargetPrice,
209
+ billingCustomer: input.currentBundle.wireBillingCustomer,
210
+ observedAt: input.observedAt,
211
+ });
212
+ expect(a.material.rawSources).toEqual({
213
+ attachRequest: h.input.attachRequest,
214
+ intent: "initial",
215
+ });
216
+ expect(result.material.stageEvidence).toEqual({
217
+ actualFreshSubscription: input.currentBundle.wireSubscription,
218
+ });
219
+ expect(a.material.freshness).toBe("retained");
220
+ expect(result.material.freshness).toBe("fresh");
221
+ expect(
222
+ result.material.subscriptionDiscounts[0].source.coupon.times_redeemed,
223
+ ).toBe(7);
224
+ expect(
225
+ result.material.subscriptionDiscounts[0].source.coupon.future_native,
226
+ ).toEqual({ unknown: [null, 1.25, "ordinary"] });
227
+ expect(input).toEqual(before);
228
+ expect(Object.isFrozen(result.material)).toBe(true);
229
+ expect(result.material.completeRequest.logicalBinding).toBe(
230
+ result.material.originalPrepared.requestIdentity.binding,
231
+ );
232
+ expect(result.material.completeRequest.requestIdentity.binding).toMatch(
233
+ /^renewal-attach:v2:sha256:[0-9a-f]{64}$/,
234
+ );
235
+ },
236
+ );
237
+ it.each([
238
+ "Sub",
239
+ "Price",
240
+ "Customer",
241
+ "Couponcounter",
242
+ "Couponunknown",
243
+ "ordinal",
244
+ "missingCoupon",
245
+ "referenceForm",
246
+ "derivedIndex",
247
+ "schedule",
248
+ ])("fresh refuses complete raw/lineage drift %s", async (kind) => {
249
+ const h = await live(),
250
+ input = freshInput(h),
251
+ b = input.currentBundle;
252
+ if (kind === "Sub") b.wireSubscription.opaque.preserved.push("drift");
253
+ if (kind === "Price") b.wireTargetPrice.opaque.preserved = "drift";
254
+ if (kind === "Customer") b.wireBillingCustomer.opaque.preserved = "drift";
255
+ if (kind === "Couponcounter") {
256
+ b.couponReads[0].wireCoupon.times_redeemed++;
257
+ derive(b);
258
+ }
259
+ if (kind === "Couponunknown") {
260
+ b.couponReads[0].wireCoupon.future_native.extra = true;
261
+ derive(b);
262
+ }
263
+ if (kind === "ordinal") b.couponReads[0].association.ordinal++;
264
+ if (kind === "missingCoupon") b.couponReads.pop();
265
+ if (kind === "referenceForm") {
266
+ b.wireSubscription.discounts[0].source.coupon = structuredClone(
267
+ b.couponReads[0].wireCoupon,
268
+ );
269
+ derive(b);
270
+ }
271
+ if (kind === "derivedIndex")
272
+ b.derivedCouponJoins.subscription[0].couponReadIndex = 1;
273
+ if (kind === "schedule") b.wireSubscription.schedule = "sub_sched_unowned";
274
+ expect(
275
+ (await h.classifiers.classifyOwnedInitialAttachment(input)).status,
276
+ ).toBe("unsupported");
277
+ });
278
+ it("retained needs historical full Coupon body, never a current replacement", async () => {
279
+ const h = await live();
280
+ h.input.originalBundle.couponReads = [];
281
+ expect(
282
+ (await h.classifiers.classifyOwnedRetainedInitialAttachment(h.input))
283
+ .status,
284
+ ).toBe("unsupported");
285
+ });
286
+ it("complete typed discount applicability is still checked after coherent lineage", async () => {
287
+ const h = await live(),
288
+ input = freshInput(h);
289
+ for (const b of [input.originalBundle, input.currentBundle]) {
290
+ b.couponReads[0].wireCoupon.applies_to.products = [
291
+ input.attachRequest.preparation.expected.currentProductId,
292
+ ];
293
+ derive(b);
294
+ }
295
+ expect(
296
+ (await h.classifiers.classifyOwnedInitialAttachment(input)).status,
297
+ ).toBe("unsupported");
298
+ });
299
+ it.each(["__proto__", "constructor", "prototype"])(
300
+ "retains safe own %s, order, null and repeated ordinary references",
301
+ async (key) => {
302
+ const h = await live();
303
+ const shared = { safe: [null, 1.25] };
304
+ for (const b of [
305
+ h.input.attachRequest.preparation.subscription,
306
+ h.input.originalBundle.wireSubscription,
307
+ ])
308
+ Object.defineProperty(b, key, {
309
+ value: { left: shared, right: shared },
310
+ enumerable: true,
311
+ configurable: true,
312
+ writable: true,
313
+ });
314
+ const input = freshInput(h),
315
+ result = await h.classifiers.classifyOwnedInitialAttachment(input);
316
+ expect(result.status).toBe("classified");
317
+ if (result.status !== "classified") throw Error("Expected material");
318
+ expect(
319
+ Object.prototype.hasOwnProperty.call(
320
+ result.material.originalPrepared.providerSnapshot.subscription,
321
+ key,
322
+ ),
323
+ ).toBe(true);
324
+ expect(
325
+ (result.material.originalPrepared.providerSnapshot.subscription as any)[
326
+ key
327
+ ],
328
+ ).toEqual({ left: shared, right: shared });
329
+ },
330
+ );
331
+ it.each([
332
+ "get",
333
+ "has",
334
+ "getPrototypeOf",
335
+ "ownKeys",
336
+ "getOwnPropertyDescriptor",
337
+ ])("rejects raw Proxy before %s trap or hash", async (name) => {
338
+ const h = await live();
339
+ let traps = 0;
340
+ const digest = realDigestCounter();
341
+ const raw = new Proxy(h.input, {
342
+ [name]() {
343
+ traps++;
344
+ throw Error("raw trap");
345
+ },
346
+ });
347
+ expect(
348
+ (await h.classifiers.classifyOwnedRetainedInitialAttachment(raw)).status,
349
+ ).toBe("unsupported");
350
+ expect(traps).toBe(0);
351
+ expect(digest()).toBe(0);
352
+ });
353
+ it("rejects accessors, unknown caller proof, secret-name empty strings and cycles before hash", async () => {
354
+ const h = await live(),
355
+ digest = realDigestCounter();
356
+ const accessor = Object.defineProperty({}, "attachRequest", {
357
+ get() {
358
+ throw Error("raw getter");
359
+ },
360
+ enumerable: true,
361
+ });
362
+ const cyclic: any = structuredClone(h.input);
363
+ cyclic.originalBundle.wireSubscription.cycle = cyclic;
364
+ const secret: any = structuredClone(h.input);
365
+ secret.attachRequest.preparation.subscription.client_secret = "";
366
+ for (const raw of [accessor, { ...h.input, proof: true }, secret, cyclic])
367
+ expect(
368
+ (await h.classifiers.classifyOwnedRetainedInitialAttachment(raw)).status,
369
+ ).toBe("unsupported");
370
+ expect(digest()).toBe(0);
371
+ });
372
+ it("dead original owner stops before input reflection and crypto", async () => {
373
+ const h = await live(),
374
+ digest = realDigestCounter();
375
+ let traps = 0;
376
+ const raw = new Proxy(
377
+ {},
378
+ {
379
+ getPrototypeOf() {
380
+ traps++;
381
+ return Object.prototype;
382
+ },
383
+ },
384
+ );
385
+ h.OWNER.retire();
386
+ expect(
387
+ (await h.classifiers.classifyOwnedRetainedInitialAttachment(raw)).status,
388
+ ).toBe("unsupported");
389
+ expect(traps).toBe(0);
390
+ expect(digest()).toBe(0);
391
+ });
392
+ it.each([1, 3])(
393
+ "retirement at actual digest %s prevents later constructor/publication",
394
+ async (at) => {
395
+ const h = await live(),
396
+ subtle = globalThis.crypto.subtle,
397
+ real = subtle.digest.bind(subtle);
398
+ let calls = 0,
399
+ release!: () => void,
400
+ entered!: () => void;
401
+ const gate = new Promise<void>((r) => (release = r)),
402
+ entry = new Promise<void>((r) => (entered = r));
403
+ vi.spyOn(subtle, "digest").mockImplementation(async (algorithm, data) => {
404
+ calls++;
405
+ if (calls === at) {
406
+ entered();
407
+ await gate;
408
+ }
409
+ return real(algorithm, data);
410
+ });
411
+ let settled = false;
412
+ const pending = h.classifiers
413
+ .classifyOwnedRetainedInitialAttachment(h.input)
414
+ .then((value) => {
415
+ settled = true;
416
+ return value;
417
+ });
418
+ try {
419
+ const reached = await Promise.race([
420
+ entry.then(() => true),
421
+ pending.then(() => false),
422
+ ]);
423
+ expect(reached).toBe(true);
424
+ expect(settled).toBe(false);
425
+ h.OWNER.retire();
426
+ release();
427
+ expect((await pending).status).toBe("unsupported");
428
+ expect(calls).toBe(at);
429
+ } finally {
430
+ release();
431
+ await pending;
432
+ }
433
+ },
434
+ );
435
+ it("whole generated output limit refuses without trimming admitted input", async () => {
436
+ const h = await live();
437
+ for (const b of [
438
+ h.input.attachRequest.preparation.subscription,
439
+ h.input.originalBundle.wireSubscription,
440
+ ])
441
+ b.outputPadding = "x".repeat(100000);
442
+ const input = freshInput(h),
443
+ snapshot = structuredClone(input),
444
+ digest = realDigestCounter();
445
+ expect(JSON.stringify(input).length).toBeLessThan(500000);
446
+ expect(
447
+ (await h.classifiers.classifyOwnedInitialAttachment(input)).status,
448
+ ).toBe("unsupported");
449
+ expect(digest()).toBeGreaterThan(0);
450
+ expect(input).toEqual(snapshot);
451
+ });
452
+ it("private scalar, UTF8, node and depth bounds remain fail closed", async () => {
453
+ const { requiredJSONSnapshot } = await import("./requiredJson.js");
454
+ expect(() => requiredJSONSnapshot("é".repeat(250001))).toThrow();
455
+ expect(() =>
456
+ requiredJSONSnapshot(Array.from({ length: 10000 }, () => null)),
457
+ ).toThrow();
458
+ let deep: any = null;
459
+ for (let i = 0; i < 41; i++) deep = { next: deep };
460
+ expect(() => requiredJSONSnapshot(deep)).toThrow();
461
+ expect(() => requiredJSONSnapshot(Infinity)).toThrow();
462
+ expect(() => requiredJSONSnapshot(Number.MAX_SAFE_INTEGER + 1)).toThrow();
463
+ });
464
+ it("canonical private node encoding keeps numeric indices and own special keys", async () => {
465
+ const k = await import("./nodeKernel.js");
466
+ const text = k.encode(
467
+ k.objectNode([
468
+ ["10", k.scalarNode("ten")],
469
+ ["2", k.scalarNode("two")],
470
+ ["__proto__", k.scalarNode(null)],
471
+ ["a", k.scalarNode(-0)],
472
+ ]),
473
+ );
474
+ expect(text).toBe('{"2":"two","10":"ten","__proto__":null,"a":0}');
475
+ expect(
476
+ Object.prototype.hasOwnProperty.call(
477
+ k.materialize(
478
+ k.objectNode([["__proto__", k.scalarNode("safe")]]),
479
+ ) as object,
480
+ "__proto__",
481
+ ),
482
+ ).toBe(true);
483
+ });
484
+
485
+ it("normal unbound Source rejects before raw input or crypto and registry stays empty", async () => {
486
+ vi.doUnmock("../sourceBindings.js");
487
+ vi.resetModules();
488
+ const bindings = await import("../sourceBindings.js");
489
+ expect(bindings.COMPILED_ENTRIES).toEqual([]);
490
+ const c = await import("./classifiers.js");
491
+ let traps = 0;
492
+ const raw = new Proxy(
493
+ {},
494
+ {
495
+ getPrototypeOf() {
496
+ traps++;
497
+ return Object.prototype;
498
+ },
499
+ },
500
+ ),
501
+ digest = realDigestCounter();
502
+ expect((await c.classifyOwnedRetainedInitialAttachment(raw)).status).toBe(
503
+ "unsupported",
504
+ );
505
+ expect((await c.classifyOwnedInitialAttachment(raw)).status).toBe(
506
+ "unsupported",
507
+ );
508
+ expect(traps).toBe(0);
509
+ expect(digest()).toBe(0);
510
+ });