@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,47 @@
1
+ import type { EventRecord } from "./ownData.js";
2
+ import "./test-fixtures/semanticSetup.js";
3
+ import { it as test } from "vitest";
4
+ import assert from "node:assert/strict";
5
+ const { fixture, copy } = await import("./test-fixtures/fixture.mjs");
6
+ const { createAttachEventCompiler, createConfigureEventCompiler } =
7
+ await import("./test-fixtures/compilerIndex.mjs");
8
+ const reverse = <T extends object>(a: T) =>
9
+ new Proxy(a, { ownKeys: (t) => Reflect.ownKeys(t).reverse() });
10
+ const delivery = () => {
11
+ const records: EventRecord[] = [];
12
+ return {
13
+ records,
14
+ options: {
15
+ timeoutMs: 5000,
16
+ send: async (r: EventRecord, ack: (value: unknown) => void) => {
17
+ records.push(r);
18
+ ack({ sequence: r.sequence, binding: r.binding });
19
+ },
20
+ },
21
+ };
22
+ };
23
+ test("array reflection order cannot change recorded request phase index values", async () => {
24
+ const f = await fixture(),
25
+ d = delivery(),
26
+ c = createConfigureEventCompiler(f.sourceConfigure, d.options),
27
+ request = copy(f.configure);
28
+ request.payload.phases = reverse(request.payload.phases);
29
+ await c.dispatch({ event: "dispatch", stage: "configure", request });
30
+ assert.deepEqual(
31
+ (d.records[0].data as { request: unknown }).request,
32
+ f.configure,
33
+ );
34
+ });
35
+ test("source array reflection order preserves canonical indexed raw preparation", async () => {
36
+ const f = await fixture(),
37
+ d = delivery(),
38
+ source = copy(f.sourceAttach);
39
+ const coupon = source.preparation.subscription.discounts[0].source.coupon;
40
+ coupon.applies_to.products = reverse(coupon.applies_to.products);
41
+ const c = createAttachEventCompiler(source, d.options);
42
+ await c.dispatch({ event: "dispatch", stage: "attach", request: f.request });
43
+ assert.deepEqual(
44
+ (d.records[0].data as { request: unknown }).request,
45
+ f.request,
46
+ );
47
+ });
@@ -0,0 +1,144 @@
1
+ import type { CapturedNode } from "./eventCodec.js";
2
+ import type { PreparedRenewalScheduleAttachmentV2 } from "../../../renewalV2/index.js";
3
+ // One distinct attach-stage channel, sequence1..3. No combined producer lineage.
4
+ import { need, stop, field, equalNodes, freeze, sevenWire } from "./ownData.js";
5
+ import {
6
+ captureAttachSource,
7
+ captureAttachDispatch,
8
+ captureAttachResponse,
9
+ captureAttachReceipt,
10
+ } from "./eventCapture.js";
11
+ import { materialize } from "./eventCodec.js";
12
+ import { createStageChannel } from "./appendAck.js";
13
+ import {
14
+ prepareRenewalPriceReplacementV2,
15
+ prepareRenewalScheduleAttachmentV2,
16
+ constructRenewalScheduleAttachmentReceiptV2,
17
+ } from "./publicApi.js";
18
+ export function createAttachEventCompiler(raw: unknown, options: unknown) {
19
+ const channel = createStageChannel(options);
20
+ let source: ReturnType<typeof captureAttachSource>;
21
+ try {
22
+ channel.gate();
23
+ source = captureAttachSource(raw);
24
+ channel.gate();
25
+ } catch {
26
+ channel.close();
27
+ stop();
28
+ }
29
+ const append = channel.append;
30
+ let position = 0,
31
+ busy = false,
32
+ closed = false,
33
+ request: PreparedRenewalScheduleAttachmentV2 | undefined,
34
+ requestNode: CapturedNode | undefined,
35
+ response: Readonly<{ body: unknown }> | undefined;
36
+ async function locked(
37
+ expected: number,
38
+ capture: (value: unknown) => CapturedNode,
39
+ value: unknown,
40
+ action: (node: CapturedNode) => void | Promise<void>,
41
+ ) {
42
+ try {
43
+ channel.gate();
44
+ if (closed || busy || position !== expected) {
45
+ closed = true;
46
+ channel.close();
47
+ stop();
48
+ }
49
+ busy = true;
50
+ const node = capture(value);
51
+ channel.gate();
52
+ return await channel.run(async () => {
53
+ channel.gate();
54
+ await action(node);
55
+ channel.gate();
56
+ need(!closed);
57
+ await append(node);
58
+ channel.gate();
59
+ need(!closed);
60
+ position++;
61
+ return Object.freeze({
62
+ kind: "C10_EVENT_DATA_APPENDED",
63
+ stageChannel: "attach",
64
+ actualFulfillmentEstablished: false,
65
+ authenticationEstablished: false,
66
+ });
67
+ });
68
+ } catch {
69
+ closed = true;
70
+ channel.close();
71
+ stop();
72
+ } finally {
73
+ busy = false;
74
+ }
75
+ }
76
+
77
+ const dispatch = (value: unknown) =>
78
+ locked(0, captureAttachDispatch, value, async (node) => {
79
+ channel.gate();
80
+ const prepared = await prepareRenewalPriceReplacementV2(
81
+ source.preparation,
82
+ );
83
+ channel.gate();
84
+ need(!closed);
85
+ channel.gate();
86
+ const r = await prepareRenewalScheduleAttachmentV2({
87
+ prepared,
88
+ apiVersion: source.apiVersion,
89
+ attachKey: source.attachKey,
90
+ firstDispatchedAt: source.firstDispatchedAt,
91
+ });
92
+ channel.gate();
93
+ need(!closed);
94
+ const proof = captureAttachDispatch({
95
+ event: "dispatch",
96
+ stage: "attach",
97
+ request: r,
98
+ });
99
+ need(equalNodes(node, proof));
100
+ request = freeze(r);
101
+ requestNode = field(proof, "request");
102
+ });
103
+ const responseEvent = (value: unknown) =>
104
+ locked(1, captureAttachResponse, value, async (node) => {
105
+ need(
106
+ request &&
107
+ requestNode &&
108
+ equalNodes(field(node, "request"), requestNode),
109
+ );
110
+ // Safe admitted response retained BEFORE any C3 identity/receipt requirement.
111
+ response = freeze({ body: materialize(field(node, "body")) });
112
+ });
113
+ const receipt = (value: unknown) =>
114
+ locked(2, captureAttachReceipt, value, async (node) => {
115
+ need(
116
+ response &&
117
+ request &&
118
+ requestNode &&
119
+ equalNodes(field(node, "request"), requestNode),
120
+ );
121
+ channel.gate();
122
+ const r = await constructRenewalScheduleAttachmentReceiptV2({
123
+ attachRequest: source,
124
+ actualDispatch: sevenWire(request),
125
+ providerSnapshot: response.body as Record<string, unknown>,
126
+ });
127
+ channel.gate();
128
+ need(!closed);
129
+ const proof = captureAttachReceipt({
130
+ event: "receipt",
131
+ stage: "attach",
132
+ request,
133
+ receipt: r,
134
+ });
135
+ need(equalNodes(node, proof));
136
+ });
137
+ return Object.freeze({
138
+ stageChannel: "attach",
139
+ combinedProducerLineageEstablished: false,
140
+ dispatch,
141
+ response: responseEvent,
142
+ receipt,
143
+ });
144
+ }
@@ -0,0 +1,443 @@
1
+ import type { EventRecord } from "./ownData.js";
2
+ import "./test-fixtures/semanticSetup.js";
3
+ import { it as test } from "vitest";
4
+ import assert from "node:assert/strict";
5
+ import { createHash } from "node:crypto";
6
+ const { fixture, copy, wire, sdk } =
7
+ await import("./test-fixtures/fixture.mjs");
8
+ const { createAttachEventCompiler, createConfigureEventCompiler } =
9
+ await import("./test-fixtures/compilerIndex.mjs");
10
+ const canonical = (v: unknown): string =>
11
+ JSON.stringify(
12
+ v && typeof v === "object"
13
+ ? Array.isArray(v)
14
+ ? v.map((x) => JSON.parse(canonical(x)))
15
+ : Object.fromEntries(
16
+ Object.keys(v)
17
+ .sort()
18
+ .map((k) => [
19
+ k,
20
+ JSON.parse(canonical((v as Record<string, unknown>)[k])),
21
+ ]),
22
+ )
23
+ : v,
24
+ );
25
+ const oracle = (r: EventRecord) =>
26
+ "unbound-qualification-event:v2:sha256:" +
27
+ createHash("sha256")
28
+ .update(
29
+ canonical([
30
+ "betterstripe-renewal-binding",
31
+ 2,
32
+ "unbound-qualification-event",
33
+ { sequence: r.sequence, data: r.data },
34
+ ]),
35
+ )
36
+ .digest("hex");
37
+ const delivery = () => {
38
+ const records: EventRecord[] = [];
39
+ return {
40
+ records,
41
+ options: {
42
+ timeoutMs: 5000,
43
+ send: async (r: EventRecord, ack: (value: unknown) => void) => {
44
+ records.push(r);
45
+ ack({ sequence: r.sequence, binding: r.binding });
46
+ },
47
+ },
48
+ };
49
+ };
50
+ type Fixture = Awaited<ReturnType<typeof fixture>>;
51
+ type Stage = "attach" | "configure";
52
+ const events = (f: Fixture, stage: Stage) =>
53
+ stage === "attach"
54
+ ? [
55
+ { event: "dispatch", stage, request: f.request },
56
+ {
57
+ event: "response",
58
+ stage,
59
+ request: f.request,
60
+ body: f.s.attach.providerSnapshot,
61
+ status: 200,
62
+ },
63
+ { event: "receipt", stage, request: f.request, receipt: f.attach },
64
+ ]
65
+ : [
66
+ { event: "dispatch", stage, request: f.configure },
67
+ {
68
+ event: "response",
69
+ stage,
70
+ request: f.configure,
71
+ body: f.s.configuredBody,
72
+ transport: f.transport,
73
+ },
74
+ { event: "receipt", stage, request: f.configure, receipt: f.stored },
75
+ ];
76
+ const owner = (f: Fixture, stage: Stage, d: ReturnType<typeof delivery>) =>
77
+ stage === "attach"
78
+ ? createAttachEventCompiler(f.sourceAttach, d.options)
79
+ : createConfigureEventCompiler(f.sourceConfigure, d.options);
80
+ for (const stage of ["attach", "configure"] as const)
81
+ test(
82
+ stage +
83
+ " all three lexical events bind whole envelopes with independent C10 oracle",
84
+ async () => {
85
+ const f = await fixture(),
86
+ d = delivery(),
87
+ c = owner(f, stage, d),
88
+ es = events(f, stage);
89
+ for (const e of es)
90
+ await c[e.event as "dispatch" | "response" | "receipt"](e);
91
+ assert.equal(d.records.length, 3);
92
+ for (const [i, r] of d.records.entries()) {
93
+ assert.equal(r.sequence, i + 1);
94
+ assert.equal(r.binding, oracle(r));
95
+ assert.deepEqual(r.data, es[i]);
96
+ assert.ok(Object.isFrozen((r.data as { request: unknown }).request));
97
+ }
98
+ assert.equal(Object.prototype.hasOwnProperty.call(c, "qualified"), false);
99
+ },
100
+ );
101
+ for (const stage of ["attach", "configure"] as const)
102
+ test(
103
+ stage + " safe wrong identity response recorded before receipt failure",
104
+ async () => {
105
+ const f = await fixture(),
106
+ d = delivery(),
107
+ c = owner(f, stage, d),
108
+ es = events(f, stage);
109
+ await c.dispatch(es[0]);
110
+ const wrong = copy(es[1]);
111
+ wrong.body.customer_account = "acct_Foreign";
112
+ await c.response(wrong);
113
+ await assert.rejects(c.receipt(es[2]), /C10_SOURCE_STOP/);
114
+ assert.equal(d.records.length, 2);
115
+ assert.equal(
116
+ (d.records[1].data as { body: Record<string, unknown> }).body
117
+ .customer_account,
118
+ "acct_Foreign",
119
+ );
120
+ },
121
+ );
122
+ test("all seven wire request mutations rejected without any send", async () => {
123
+ const f = await fixture();
124
+ for (const [k, value] of Object.entries({
125
+ scope: "connected",
126
+ apiVersion: "other",
127
+ method: "GET",
128
+ path: "/other",
129
+ payload: { from_subscription: "sub_Other" },
130
+ key: "OTHER",
131
+ firstDispatchedAt: 1,
132
+ })) {
133
+ const d = delivery(),
134
+ c = owner(f, "attach", d),
135
+ e = copy(events(f, "attach")[0]);
136
+ e.request[k] = value;
137
+ await assert.rejects(c.dispatch(e), /C10_SOURCE_STOP/);
138
+ assert.equal(d.records.length, 0, k);
139
+ }
140
+ });
141
+ test("synchronous first lock prevents concurrent initial calls through async hash", async () => {
142
+ const f = await fixture(),
143
+ d = delivery(),
144
+ c = owner(f, "attach", d),
145
+ e = events(f, "attach")[0];
146
+ const a = c.dispatch(e),
147
+ b = c.dispatch(e);
148
+ await Promise.all([
149
+ assert.rejects(a, /C10_SOURCE_STOP/),
150
+ assert.rejects(b, /C10_SOURCE_STOP/),
151
+ ]);
152
+ assert.equal(d.records.length, 0);
153
+ });
154
+ test("unknown/symbol/accessor event keys rejected without getter or digest", async () => {
155
+ const f = await fixture();
156
+ const original = globalThis.crypto.subtle.digest;
157
+ let calls = 0;
158
+ globalThis.crypto.subtle.digest = function (...args) {
159
+ calls++;
160
+ return original.apply(this, args);
161
+ };
162
+ try {
163
+ for (const kind of ["unknown", "symbol", "accessor"]) {
164
+ const d = delivery(),
165
+ c = owner(f, "attach", d),
166
+ e = copy(events(f, "attach")[0]);
167
+ let got = 0;
168
+ if (kind === "unknown") e.extra = true;
169
+ if (kind === "symbol") e[Symbol("extra")] = true;
170
+ if (kind === "accessor")
171
+ Object.defineProperty(e, "request", {
172
+ enumerable: true,
173
+ get() {
174
+ got++;
175
+ throw Error("GETTER");
176
+ },
177
+ });
178
+ await assert.rejects(c.dispatch(e), /C10_SOURCE_STOP/);
179
+ assert.equal(got, 0);
180
+ assert.equal(d.records.length, 0);
181
+ }
182
+ assert.equal(calls, 0);
183
+ } finally {
184
+ globalThis.crypto.subtle.digest = original;
185
+ }
186
+ });
187
+ test("source root descriptor mutation removing required apiVersion stops before hash", async () => {
188
+ const f = await fixture(),
189
+ d = delivery(),
190
+ raw = copy(f.sourceAttach);
191
+ let calls = 0;
192
+ const original = globalThis.crypto.subtle.digest;
193
+ globalThis.crypto.subtle.digest = function (...args) {
194
+ calls++;
195
+ return original.apply(this, args);
196
+ };
197
+ try {
198
+ const p = new Proxy(raw, {
199
+ getPrototypeOf(t) {
200
+ delete t.apiVersion;
201
+ return Object.prototype;
202
+ },
203
+ });
204
+ assert.throws(
205
+ () => createAttachEventCompiler(p, d.options),
206
+ /C10_SOURCE_STOP/,
207
+ );
208
+ assert.equal(calls, 0);
209
+ } finally {
210
+ globalThis.crypto.subtle.digest = original;
211
+ }
212
+ });
213
+ test("body secret/client_secret empty never sent, getter never read", async () => {
214
+ const f = await fixture();
215
+ for (const kind of ["text", "name", "accessor"]) {
216
+ const d = delivery(),
217
+ c = owner(f, "attach", d),
218
+ es = events(f, "attach");
219
+ await c.dispatch(es[0]);
220
+ const e = copy(es[1]);
221
+ let got = 0;
222
+ if (kind === "text") e.body.extra = "sk_test_SYNTHETIC";
223
+ if (kind === "name") e.body.client_secret = "";
224
+ if (kind === "accessor")
225
+ Object.defineProperty(e.body, "extra", {
226
+ enumerable: true,
227
+ get() {
228
+ got++;
229
+ throw Error("SECRET");
230
+ },
231
+ });
232
+ await assert.rejects(c.response(e), /C10_SOURCE_STOP/);
233
+ assert.equal(got, 0);
234
+ assert.equal(d.records.length, 1);
235
+ }
236
+ });
237
+ test("capture before first await detaches event and raw source mutation", async () => {
238
+ const f = await fixture(),
239
+ d = delivery(),
240
+ raw = copy(f.sourceAttach),
241
+ c = createAttachEventCompiler(raw, d.options),
242
+ e = copy(events(f, "attach")[0]);
243
+ const p = c.dispatch(e);
244
+ raw.attachKey = "CHANGED";
245
+ raw.preparation.subscription.metadata.extra = "CHANGED";
246
+ e.request.payload.from_subscription = "sub_CHANGED";
247
+ await p;
248
+ assert.deepEqual(d.records[0].data, events(f, "attach")[0]);
249
+ });
250
+ test("foreign/reordered/duplicate branch permanently stops owner", async () => {
251
+ const f = await fixture();
252
+ for (const method of ["response", "receipt"] as const) {
253
+ const d = delivery(),
254
+ c = owner(f, "attach", d);
255
+ await assert.rejects(
256
+ c[method](events(f, "attach")[method === "response" ? 1 : 2]),
257
+ /C10_SOURCE_STOP/,
258
+ );
259
+ await assert.rejects(c.dispatch(events(f, "attach")[0]), /C10_SOURCE_STOP/);
260
+ assert.equal(d.records.length, 0);
261
+ }
262
+ const d = delivery(),
263
+ c = owner(f, "attach", d);
264
+ await c.dispatch(events(f, "attach")[0]);
265
+ await assert.rejects(c.dispatch(events(f, "attach")[0]), /C10_SOURCE_STOP/);
266
+ assert.equal(d.records.length, 1);
267
+ });
268
+ test("receipt body mutation cannot replace same-response full reconstruction", async () => {
269
+ const f = await fixture(),
270
+ d = delivery(),
271
+ c = owner(f, "configure", d),
272
+ es = events(f, "configure");
273
+ await c.dispatch(es[0]);
274
+ await c.response(es[1]);
275
+ const e = copy(es[2]);
276
+ e.receipt.providerSnapshot.metadata.changed = "ordinary";
277
+ await assert.rejects(c.receipt(e), /C10_SOURCE_STOP/);
278
+ assert.equal(d.records.length, 2);
279
+ });
280
+
281
+ test("new whole event UTF8, nodes and depth limits stop complete response", async () => {
282
+ const f = await fixture();
283
+ for (const kind of ["utf8", "nodes", "depth"]) {
284
+ const d = delivery(),
285
+ c = owner(f, "attach", d),
286
+ es = events(f, "attach");
287
+ await c.dispatch(es[0]);
288
+ const e = copy(es[1]);
289
+ if (kind === "utf8") e.body.extra = "é".repeat(250001);
290
+ if (kind === "nodes")
291
+ e.body.extra = Array.from({ length: 10001 }, () => null);
292
+ if (kind === "depth") {
293
+ let v = null;
294
+ for (let i = 0; i < 41; i++) v = { next: v };
295
+ e.body.extra = v;
296
+ }
297
+ await assert.rejects(c.response(e), /C10_SOURCE_STOP/);
298
+ assert.equal(d.records.length, 1, kind);
299
+ }
300
+ });
301
+ test("new opaque own proto response key retained and C10-sensitive", async () => {
302
+ const f = await fixture();
303
+ const bindings = [];
304
+ for (const value of ["alpha", "beta"]) {
305
+ const d = delivery(),
306
+ c = owner(f, "attach", d),
307
+ es = events(f, "attach"),
308
+ body = copy(es[1].body);
309
+ Object.defineProperty(body, "__proto__", {
310
+ value: { opaque: value },
311
+ enumerable: true,
312
+ writable: true,
313
+ configurable: true,
314
+ });
315
+ await c.dispatch(es[0]);
316
+ await c.response({ ...es[1], body });
317
+ const receipt = await sdk.constructRenewalScheduleAttachmentReceiptV2({
318
+ attachRequest: f.sourceAttach,
319
+ actualDispatch: wire(f.request),
320
+ providerSnapshot: body,
321
+ });
322
+ await c.receipt({ ...es[2], receipt });
323
+ assert.equal(
324
+ Object.prototype.hasOwnProperty.call(
325
+ (d.records[1].data as { body: Record<string, unknown> }).body,
326
+ "__proto__",
327
+ ),
328
+ true,
329
+ );
330
+ assert.equal(
331
+ (d.records[1].data as { body: { __proto__: { opaque: unknown } } }).body
332
+ .__proto__.opaque,
333
+ value,
334
+ );
335
+ assert.equal(
336
+ Object.getPrototypeOf(
337
+ (d.records[1].data as { body: Record<string, unknown> }).body,
338
+ ),
339
+ Object.prototype,
340
+ );
341
+ bindings.push(d.records[1].binding);
342
+ }
343
+ assert.notEqual(bindings[0], bindings[1]);
344
+ assert.equal((Object.prototype as Record<string, unknown>).opaque, undefined);
345
+ });
346
+ test("new optional configured defaults absent null object preserve distinct exact C8", async () => {
347
+ const f = await fixture();
348
+ for (const mode of ["absent", "null", "object"]) {
349
+ const d = delivery(),
350
+ c = owner(f, "configure", d),
351
+ es = events(f, "configure"),
352
+ body = copy(es[1].body);
353
+ if (mode === "absent") delete body.default_settings;
354
+ if (mode === "null") body.default_settings = null;
355
+ const receipt = await sdk.constructRenewalConfigurationReceiptV2({
356
+ configuration: f.sourceConfigure,
357
+ actualDispatch: wire(f.configure),
358
+ providerSnapshot: body,
359
+ transport: f.transport,
360
+ });
361
+ await c.dispatch(es[0]);
362
+ await c.response({ ...es[1], body });
363
+ await c.receipt({ ...es[2], receipt });
364
+ assert.equal(
365
+ Object.prototype.hasOwnProperty.call(
366
+ (d.records[2].data as { receipt: unknown }).receipt,
367
+ "defaultSettingsBinding",
368
+ ),
369
+ mode !== "absent",
370
+ );
371
+ assert.deepEqual(
372
+ (d.records[2].data as { receipt: unknown }).receipt,
373
+ receipt,
374
+ );
375
+ }
376
+ });
377
+ test("new nested request identity deletion during reflection rejects before digest", async () => {
378
+ const f = await fixture(),
379
+ d = delivery(),
380
+ c = owner(f, "attach", d),
381
+ e = copy(events(f, "attach")[0]);
382
+ const target = e.request.requestIdentity;
383
+ e.request.requestIdentity = new Proxy(target, {
384
+ getPrototypeOf(t) {
385
+ delete t.binding;
386
+ return Object.prototype;
387
+ },
388
+ });
389
+ let hashes = 0;
390
+ const original = globalThis.crypto.subtle.digest;
391
+ globalThis.crypto.subtle.digest = function (...args) {
392
+ hashes++;
393
+ return original.apply(this, args);
394
+ };
395
+ try {
396
+ await assert.rejects(c.dispatch(e), /C10_SOURCE_STOP/);
397
+ assert.equal(hashes, 0);
398
+ assert.equal(d.records.length, 0);
399
+ } finally {
400
+ globalThis.crypto.subtle.digest = original;
401
+ }
402
+ });
403
+ test("new real derived PAN-looking claim accepted only at recomputed fixed slot", async () => {
404
+ const f = await fixture();
405
+ let selected;
406
+ const pan = /(?:^|\D)(?:\d[ -]?){12,18}\d(?:$|\D)/i;
407
+ for (let i = 0; i < 200 && !selected; i++) {
408
+ const raw = copy(f.sourceAttach);
409
+ raw.preparation.subscription.metadata.c10_vector = "SYNTHETIC" + i;
410
+ const prepared = await sdk.prepareRenewalPriceReplacementV2(
411
+ raw.preparation,
412
+ ),
413
+ request = await sdk.prepareRenewalScheduleAttachmentV2({
414
+ prepared,
415
+ apiVersion: raw.apiVersion,
416
+ attachKey: raw.attachKey,
417
+ firstDispatchedAt: raw.firstDispatchedAt,
418
+ });
419
+ if (
420
+ pan.test(request.logicalBinding) ||
421
+ pan.test(request.requestIdentity.binding)
422
+ )
423
+ selected = { raw, request };
424
+ }
425
+ assert.ok(selected, "bounded deterministic derived-claim vector must exist");
426
+ const d = delivery(),
427
+ c = createAttachEventCompiler(selected.raw, d.options);
428
+ await c.dispatch({
429
+ event: "dispatch",
430
+ stage: "attach",
431
+ request: selected.request,
432
+ });
433
+ assert.equal(d.records.length, 1);
434
+ const e = {
435
+ event: "response",
436
+ stage: "attach",
437
+ request: selected.request,
438
+ body: { extra: "1234567890123456" },
439
+ status: 200,
440
+ };
441
+ await assert.rejects(c.response(e), /C10_SOURCE_STOP/);
442
+ assert.equal(d.records.length, 1);
443
+ });