@fantastic.dev/better-stripe 0.90.0 → 0.92.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 (239) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -1
  3. package/dist/client/billing/renewalAttach/internal/acquisition/ownedAcquisition.d.ts +41 -0
  4. package/dist/client/billing/renewalAttach/internal/acquisition/ownedAcquisition.d.ts.map +1 -0
  5. package/dist/client/billing/renewalAttach/internal/acquisition/ownedAcquisition.js +187 -0
  6. package/dist/client/billing/renewalAttach/internal/acquisition/ownedAcquisition.js.map +1 -0
  7. package/dist/client/billing/renewalAttach/internal/acquisition/rawAcquisition.d.ts +2 -23
  8. package/dist/client/billing/renewalAttach/internal/acquisition/rawAcquisition.d.ts.map +1 -1
  9. package/dist/client/billing/renewalAttach/internal/acquisition/rawAcquisition.js +1 -112
  10. package/dist/client/billing/renewalAttach/internal/acquisition/rawAcquisition.js.map +1 -1
  11. package/dist/client/billing/renewalAttach/internal/acquisition/rawWireSource.d.ts +8 -3
  12. package/dist/client/billing/renewalAttach/internal/acquisition/rawWireSource.d.ts.map +1 -1
  13. package/dist/client/billing/renewalAttach/internal/acquisition/rawWireSource.js +1 -0
  14. package/dist/client/billing/renewalAttach/internal/acquisition/rawWireSource.js.map +1 -1
  15. package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/sourcePort.d.mts +1 -1
  16. package/dist/client/billing/renewalAttach/internal/configure/actor.d.ts +14 -0
  17. package/dist/client/billing/renewalAttach/internal/configure/actor.d.ts.map +1 -0
  18. package/dist/client/billing/renewalAttach/internal/configure/actor.js +444 -0
  19. package/dist/client/billing/renewalAttach/internal/configure/actor.js.map +1 -0
  20. package/dist/client/billing/renewalAttach/internal/configure/capture.d.ts +12 -0
  21. package/dist/client/billing/renewalAttach/internal/configure/capture.d.ts.map +1 -0
  22. package/dist/client/billing/renewalAttach/internal/configure/capture.js +99 -0
  23. package/dist/client/billing/renewalAttach/internal/configure/capture.js.map +1 -0
  24. package/dist/client/billing/renewalAttach/internal/configure/output.d.ts +16 -0
  25. package/dist/client/billing/renewalAttach/internal/configure/output.d.ts.map +1 -0
  26. package/dist/client/billing/renewalAttach/internal/configure/output.js +274 -0
  27. package/dist/client/billing/renewalAttach/internal/configure/output.js.map +1 -0
  28. package/dist/client/billing/renewalAttach/internal/configure/ownedContinuation.d.ts +3 -0
  29. package/dist/client/billing/renewalAttach/internal/configure/ownedContinuation.d.ts.map +1 -0
  30. package/dist/client/billing/renewalAttach/internal/configure/ownedContinuation.js +61 -0
  31. package/dist/client/billing/renewalAttach/internal/configure/ownedContinuation.js.map +1 -0
  32. package/dist/client/billing/renewalAttach/internal/configure/replay.d.ts +3 -0
  33. package/dist/client/billing/renewalAttach/internal/configure/replay.d.ts.map +1 -0
  34. package/dist/client/billing/renewalAttach/internal/configure/replay.js +9 -0
  35. package/dist/client/billing/renewalAttach/internal/configure/replay.js.map +1 -0
  36. package/dist/client/billing/renewalAttach/internal/configure/request.d.ts +39 -0
  37. package/dist/client/billing/renewalAttach/internal/configure/request.d.ts.map +1 -0
  38. package/dist/client/billing/renewalAttach/internal/configure/request.js +245 -0
  39. package/dist/client/billing/renewalAttach/internal/configure/request.js.map +1 -0
  40. package/dist/client/billing/renewalAttach/internal/configure/transport.d.ts +88 -0
  41. package/dist/client/billing/renewalAttach/internal/configure/transport.d.ts.map +1 -0
  42. package/dist/client/billing/renewalAttach/internal/configure/transport.js +289 -0
  43. package/dist/client/billing/renewalAttach/internal/configure/transport.js.map +1 -0
  44. package/dist/client/billing/renewalAttach/internal/observation/actor.d.ts +16 -0
  45. package/dist/client/billing/renewalAttach/internal/observation/actor.d.ts.map +1 -0
  46. package/dist/client/billing/renewalAttach/internal/observation/actor.js +383 -0
  47. package/dist/client/billing/renewalAttach/internal/observation/actor.js.map +1 -0
  48. package/dist/client/billing/renewalAttach/internal/observation/capture.d.ts +9 -0
  49. package/dist/client/billing/renewalAttach/internal/observation/capture.d.ts.map +1 -0
  50. package/dist/client/billing/renewalAttach/internal/observation/capture.js +216 -0
  51. package/dist/client/billing/renewalAttach/internal/observation/capture.js.map +1 -0
  52. package/dist/client/billing/renewalAttach/internal/observation/configureAcknowledgement.d.ts +5 -0
  53. package/dist/client/billing/renewalAttach/internal/observation/configureAcknowledgement.d.ts.map +1 -0
  54. package/dist/client/billing/renewalAttach/internal/observation/configureAcknowledgement.js +11 -0
  55. package/dist/client/billing/renewalAttach/internal/observation/configureAcknowledgement.js.map +1 -0
  56. package/dist/client/billing/renewalAttach/internal/observation/profile.d.ts +7 -0
  57. package/dist/client/billing/renewalAttach/internal/observation/profile.d.ts.map +1 -0
  58. package/dist/client/billing/renewalAttach/internal/observation/profile.js +190 -0
  59. package/dist/client/billing/renewalAttach/internal/observation/profile.js.map +1 -0
  60. package/dist/client/billing/renewalAttach/internal/observation/record.d.ts +5 -0
  61. package/dist/client/billing/renewalAttach/internal/observation/record.d.ts.map +1 -0
  62. package/dist/client/billing/renewalAttach/internal/observation/record.js +317 -0
  63. package/dist/client/billing/renewalAttach/internal/observation/record.js.map +1 -0
  64. package/dist/client/billing/renewalAttach/internal/observation/types.d.ts +84 -0
  65. package/dist/client/billing/renewalAttach/internal/observation/types.d.ts.map +1 -0
  66. package/dist/client/billing/renewalAttach/internal/observation/types.js +27 -0
  67. package/dist/client/billing/renewalAttach/internal/observation/types.js.map +1 -0
  68. package/dist/client/billing/renewalAttach/internal/operations/configureReadTransport.d.ts +18 -0
  69. package/dist/client/billing/renewalAttach/internal/operations/configureReadTransport.d.ts.map +1 -0
  70. package/dist/client/billing/renewalAttach/internal/operations/configureReadTransport.js +229 -0
  71. package/dist/client/billing/renewalAttach/internal/operations/configureReadTransport.js.map +1 -0
  72. package/dist/client/billing/renewalAttach/internal/operations/fixedTransport.d.ts +163 -0
  73. package/dist/client/billing/renewalAttach/internal/operations/fixedTransport.d.ts.map +1 -0
  74. package/dist/client/billing/renewalAttach/internal/operations/fixedTransport.js +443 -0
  75. package/dist/client/billing/renewalAttach/internal/operations/fixedTransport.js.map +1 -0
  76. package/dist/client/billing/renewalAttach/internal/operations/initialAttach.d.ts +8 -0
  77. package/dist/client/billing/renewalAttach/internal/operations/initialAttach.d.ts.map +1 -0
  78. package/dist/client/billing/renewalAttach/internal/operations/initialAttach.js +467 -0
  79. package/dist/client/billing/renewalAttach/internal/operations/initialAttach.js.map +1 -0
  80. package/dist/client/billing/renewalAttach/internal/operations/ownedAwait.d.ts +6 -0
  81. package/dist/client/billing/renewalAttach/internal/operations/ownedAwait.d.ts.map +1 -0
  82. package/dist/client/billing/renewalAttach/internal/operations/ownedAwait.js +59 -0
  83. package/dist/client/billing/renewalAttach/internal/operations/ownedAwait.js.map +1 -0
  84. package/dist/client/billing/renewalAttach/internal/operations/providerFailure.d.ts +10 -0
  85. package/dist/client/billing/renewalAttach/internal/operations/providerFailure.d.ts.map +1 -0
  86. package/dist/client/billing/renewalAttach/internal/operations/providerFailure.js +48 -0
  87. package/dist/client/billing/renewalAttach/internal/operations/providerFailure.js.map +1 -0
  88. package/dist/client/billing/renewalAttach/internal/operations/sourceOperations.d.ts +20 -0
  89. package/dist/client/billing/renewalAttach/internal/operations/sourceOperations.d.ts.map +1 -0
  90. package/dist/client/billing/renewalAttach/internal/operations/sourceOperations.js +44 -0
  91. package/dist/client/billing/renewalAttach/internal/operations/sourceOperations.js.map +1 -0
  92. package/dist/client/billing/renewalAttach/internal/operations/types.d.ts +42 -0
  93. package/dist/client/billing/renewalAttach/internal/operations/types.d.ts.map +1 -0
  94. package/dist/client/billing/renewalAttach/internal/operations/types.js +158 -0
  95. package/dist/client/billing/renewalAttach/internal/operations/types.js.map +1 -0
  96. package/dist/client/billing/renewalAttach/internal/preflight/configurePreflight.d.ts +5 -0
  97. package/dist/client/billing/renewalAttach/internal/preflight/configurePreflight.d.ts.map +1 -0
  98. package/dist/client/billing/renewalAttach/internal/preflight/configurePreflight.js +214 -0
  99. package/dist/client/billing/renewalAttach/internal/preflight/configurePreflight.js.map +1 -0
  100. package/dist/client/billing/renewalAttach/internal/preflight/grammar.d.ts +33 -0
  101. package/dist/client/billing/renewalAttach/internal/preflight/grammar.d.ts.map +1 -0
  102. package/dist/client/billing/renewalAttach/internal/preflight/grammar.js +208 -0
  103. package/dist/client/billing/renewalAttach/internal/preflight/grammar.js.map +1 -0
  104. package/dist/client/billing/renewalAttach/internal/preflight/output.d.ts +4 -0
  105. package/dist/client/billing/renewalAttach/internal/preflight/output.d.ts.map +1 -0
  106. package/dist/client/billing/renewalAttach/internal/preflight/output.js +25 -0
  107. package/dist/client/billing/renewalAttach/internal/preflight/output.js.map +1 -0
  108. package/dist/client/billing/renewalAttach/internal/preflight/record.d.ts +16 -0
  109. package/dist/client/billing/renewalAttach/internal/preflight/record.d.ts.map +1 -0
  110. package/dist/client/billing/renewalAttach/internal/preflight/record.js +93 -0
  111. package/dist/client/billing/renewalAttach/internal/preflight/record.js.map +1 -0
  112. package/dist/client/billing/renewalAttach/internal/preflight/relations.d.ts +7 -0
  113. package/dist/client/billing/renewalAttach/internal/preflight/relations.d.ts.map +1 -0
  114. package/dist/client/billing/renewalAttach/internal/preflight/relations.js +153 -0
  115. package/dist/client/billing/renewalAttach/internal/preflight/relations.js.map +1 -0
  116. package/dist/client/billing/renewalAttach/internal/recovery/material.d.ts +22 -0
  117. package/dist/client/billing/renewalAttach/internal/recovery/material.d.ts.map +1 -0
  118. package/dist/client/billing/renewalAttach/internal/recovery/material.js +221 -0
  119. package/dist/client/billing/renewalAttach/internal/recovery/material.js.map +1 -0
  120. package/dist/client/billing/renewalAttach/internal/recovery/output.d.ts +8 -0
  121. package/dist/client/billing/renewalAttach/internal/recovery/output.d.ts.map +1 -0
  122. package/dist/client/billing/renewalAttach/internal/recovery/output.js +101 -0
  123. package/dist/client/billing/renewalAttach/internal/recovery/output.js.map +1 -0
  124. package/dist/client/billing/renewalAttach/internal/recovery/record.d.ts +12 -0
  125. package/dist/client/billing/renewalAttach/internal/recovery/record.d.ts.map +1 -0
  126. package/dist/client/billing/renewalAttach/internal/recovery/record.js +186 -0
  127. package/dist/client/billing/renewalAttach/internal/recovery/record.js.map +1 -0
  128. package/dist/client/billing/renewalAttach/internal/recovery/recoveryActor.d.ts +5 -0
  129. package/dist/client/billing/renewalAttach/internal/recovery/recoveryActor.d.ts.map +1 -0
  130. package/dist/client/billing/renewalAttach/internal/recovery/recoveryActor.js +498 -0
  131. package/dist/client/billing/renewalAttach/internal/recovery/recoveryActor.js.map +1 -0
  132. package/dist/client/billing/renewalAttach/internal/recovery/relation.d.ts +21 -0
  133. package/dist/client/billing/renewalAttach/internal/recovery/relation.d.ts.map +1 -0
  134. package/dist/client/billing/renewalAttach/internal/recovery/relation.js +119 -0
  135. package/dist/client/billing/renewalAttach/internal/recovery/relation.js.map +1 -0
  136. package/dist/client/connect/payoutExecutionTestHelpers.d.ts +16 -16
  137. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +32 -32
  138. package/dist/component/balanceFunding/internal/actions.d.ts +11 -11
  139. package/dist/component/financialObservations/settlementHelpers.d.ts +3 -3
  140. package/dist/component/usage/allowance.fixtures.d.ts +16 -16
  141. package/dist/component/usageCredits/accounting.fixtures.d.ts +16 -16
  142. package/docs/renewal-context-reads.md +26 -8
  143. package/docs/renewal-material-observation.md +58 -0
  144. package/docs/renewal-phase-assembly.md +68 -0
  145. package/docs/renewal-raw-acquisition.md +19 -5
  146. package/package.json +1 -1
  147. package/src/client/billing/renewalAttach/internal/acquisition/ownedAcquisition.ts +304 -0
  148. package/src/client/billing/renewalAttach/internal/acquisition/rawAcquisition.ts +2 -160
  149. package/src/client/billing/renewalAttach/internal/acquisition/rawWireSource.ts +15 -3
  150. package/src/client/billing/renewalAttach/internal/configure/actor.ts +586 -0
  151. package/src/client/billing/renewalAttach/internal/configure/capture.ts +117 -0
  152. package/src/client/billing/renewalAttach/internal/configure/dispatch.integration.test.ts +32 -0
  153. package/src/client/billing/renewalAttach/internal/configure/limits.test.ts +510 -0
  154. package/src/client/billing/renewalAttach/internal/configure/order.integration.test.ts +207 -0
  155. package/src/client/billing/renewalAttach/internal/configure/output.ts +372 -0
  156. package/src/client/billing/renewalAttach/internal/configure/ownedContinuation.ts +56 -0
  157. package/src/client/billing/renewalAttach/internal/configure/ownership.integration.test.ts +148 -0
  158. package/src/client/billing/renewalAttach/internal/configure/replay.integration.test.ts +173 -0
  159. package/src/client/billing/renewalAttach/internal/configure/replay.ts +13 -0
  160. package/src/client/billing/renewalAttach/internal/configure/request.ts +312 -0
  161. package/src/client/billing/renewalAttach/internal/configure/transport.integration.test.ts +507 -0
  162. package/src/client/billing/renewalAttach/internal/configure/transport.ts +348 -0
  163. package/src/client/billing/renewalAttach/internal/observation/actor.ts +487 -0
  164. package/src/client/billing/renewalAttach/internal/observation/capture.ts +251 -0
  165. package/src/client/billing/renewalAttach/internal/observation/configureAcknowledgement.ts +20 -0
  166. package/src/client/billing/renewalAttach/internal/observation/observation.integration.test.ts +220 -0
  167. package/src/client/billing/renewalAttach/internal/observation/observationConfigureACK.integration.test.ts +36 -0
  168. package/src/client/billing/renewalAttach/internal/observation/observationConfigureACKControls.integration.test.ts +48 -0
  169. package/src/client/billing/renewalAttach/internal/observation/observationConfigureACKLifecycle.integration.test.ts +44 -0
  170. package/src/client/billing/renewalAttach/internal/observation/observationConfiguredHistory.integration.test.ts +34 -0
  171. package/src/client/billing/renewalAttach/internal/observation/observationRetirement.integration.test.ts +60 -0
  172. package/src/client/billing/renewalAttach/internal/observation/profile.ts +264 -0
  173. package/src/client/billing/renewalAttach/internal/observation/record.ts +408 -0
  174. package/src/client/billing/renewalAttach/internal/observation/types.ts +107 -0
  175. package/src/client/billing/renewalAttach/internal/operations/configureReadTransport.ts +285 -0
  176. package/src/client/billing/renewalAttach/internal/operations/defaultBindings.test.ts +69 -0
  177. package/src/client/billing/renewalAttach/internal/operations/fixedTransport.ts +574 -0
  178. package/src/client/billing/renewalAttach/internal/operations/initialAttach.integration.test.ts +34 -0
  179. package/src/client/billing/renewalAttach/internal/operations/initialAttach.ts +535 -0
  180. package/src/client/billing/renewalAttach/internal/operations/ownedAwait.ts +63 -0
  181. package/src/client/billing/renewalAttach/internal/operations/providerFailure.integration.test.ts +61 -0
  182. package/src/client/billing/renewalAttach/internal/operations/providerFailure.ts +66 -0
  183. package/src/client/billing/renewalAttach/internal/operations/sourceOperations.ts +50 -0
  184. package/src/client/billing/renewalAttach/internal/operations/transport.integration.test.ts +116 -0
  185. package/src/client/billing/renewalAttach/internal/operations/types.ts +223 -0
  186. package/src/client/billing/renewalAttach/internal/preflight/configurePreflight.integration.test.ts +285 -0
  187. package/src/client/billing/renewalAttach/internal/preflight/configurePreflight.ts +258 -0
  188. package/src/client/billing/renewalAttach/internal/preflight/configureReads.integration.test.ts +139 -0
  189. package/src/client/billing/renewalAttach/internal/preflight/grammar.ts +257 -0
  190. package/src/client/billing/renewalAttach/internal/preflight/output.ts +42 -0
  191. package/src/client/billing/renewalAttach/internal/preflight/owner.integration.test.ts +82 -0
  192. package/src/client/billing/renewalAttach/internal/preflight/preflight.integration.test.ts +354 -0
  193. package/src/client/billing/renewalAttach/internal/preflight/record.ts +127 -0
  194. package/src/client/billing/renewalAttach/internal/preflight/relations.ts +209 -0
  195. package/src/client/billing/renewalAttach/internal/recovery/material.ts +311 -0
  196. package/src/client/billing/renewalAttach/internal/recovery/output.ts +136 -0
  197. package/src/client/billing/renewalAttach/internal/recovery/record.ts +230 -0
  198. package/src/client/billing/renewalAttach/internal/recovery/recovery.integration.test.ts +463 -0
  199. package/src/client/billing/renewalAttach/internal/recovery/recoveryActor.ts +599 -0
  200. package/src/client/billing/renewalAttach/internal/recovery/relation.ts +175 -0
  201. package/src/client/billing/renewalAttach/internal/test-fixtures/attachEntries.ts +217 -0
  202. package/src/client/billing/renewalAttach/internal/test-fixtures/attachObservations.ts +226 -0
  203. package/src/client/billing/renewalAttach/internal/test-fixtures/attachScenario.ts +556 -0
  204. package/src/client/billing/renewalAttach/internal/test-fixtures/attachScenarioAssertions.ts +180 -0
  205. package/src/client/billing/renewalAttach/internal/test-fixtures/attachScenarioBarriers.ts +144 -0
  206. package/src/client/billing/renewalAttach/internal/test-fixtures/configurePreflightAssertions.ts +122 -0
  207. package/src/client/billing/renewalAttach/internal/test-fixtures/configurePreflightBarriers.ts +330 -0
  208. package/src/client/billing/renewalAttach/internal/test-fixtures/configurePreflightControls.ts +139 -0
  209. package/src/client/billing/renewalAttach/internal/test-fixtures/configurePreflightOperation.ts +513 -0
  210. package/src/client/billing/renewalAttach/internal/test-fixtures/configureReadNativeBaseline.ts +344 -0
  211. package/src/client/billing/renewalAttach/internal/test-fixtures/configureReadOperation.ts +278 -0
  212. package/src/client/billing/renewalAttach/internal/test-fixtures/configureReadPort.ts +17 -0
  213. package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteAssertions.ts +537 -0
  214. package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteBarriers.ts +125 -0
  215. package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteDeclarations.ts +325 -0
  216. package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteDelegate.ts +38 -0
  217. package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteHistory.ts +471 -0
  218. package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteObservations.ts +515 -0
  219. package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteOperation.ts +587 -0
  220. package/src/client/billing/renewalAttach/internal/test-fixtures/observationAssertions.ts +211 -0
  221. package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfigureACKAssertions.ts +115 -0
  222. package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfigureACKDeclarations.ts +141 -0
  223. package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfigureACKLifecycleAssertions.ts +74 -0
  224. package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfigureACKLifecycleDeclarations.ts +79 -0
  225. package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfigureACKLifecycleInstrumentation.ts +207 -0
  226. package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfigureACKLifecycleOperation.ts +494 -0
  227. package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfigureACKOperation.ts +452 -0
  228. package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfiguredHistoryAssertions.ts +88 -0
  229. package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfiguredHistoryDeclarations.ts +170 -0
  230. package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfiguredHistoryNative.ts +99 -0
  231. package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfiguredHistoryOperation.ts +411 -0
  232. package/src/client/billing/renewalAttach/internal/test-fixtures/observationDeclarations.ts +192 -0
  233. package/src/client/billing/renewalAttach/internal/test-fixtures/observationHTTP.ts +197 -0
  234. package/src/client/billing/renewalAttach/internal/test-fixtures/observationObservations.ts +269 -0
  235. package/src/client/billing/renewalAttach/internal/test-fixtures/observationOperation.ts +262 -0
  236. package/src/client/billing/renewalAttach/internal/test-fixtures/observationProbe.ts +319 -0
  237. package/src/client/billing/renewalAttach/internal/test-fixtures/ownedOperations.ts +94 -0
  238. package/src/client/billing/renewalAttach/internal/test-fixtures/sourceOperationPort.ts +16 -0
  239. package/src/client/billing/renewalAttach/internal/test-fixtures/stockHttp.ts +21 -0
@@ -0,0 +1,452 @@
1
+ import assert from "node:assert/strict";
2
+ import { vi } from "vitest";
3
+ import * as actualPublicAPI from "../../../renewalV2/index.js";
4
+ import * as publicObserver from "../../../renewalV2/observation.js";
5
+ import {
6
+ declareOptionalConfigureACK18,
7
+ declareOptionalConfigureACKCase,
8
+ type OptionalConfigureACKCase,
9
+ type OptionalConfigureACKControl,
10
+ } from "./observationConfigureACKDeclarations.js";
11
+ import { configureWriteFixture } from "./configureWriteOperation.js";
12
+ import { assertConfigureACK, ackSlots } from "./configureWriteAssertions.js";
13
+ import { assertFit } from "./configurePreflightAssertions.js";
14
+ import { data, deepFreeze } from "./configurePreflightControls.js";
15
+
16
+ /** Fixed first18 TEST chain. No production custody/context registrar is introduced. */
17
+ export async function optionalConfigureACK18Fixture() {
18
+ return setupOptionalConfigureACK("actual18-default-absent");
19
+ }
20
+ export async function optionalConfigureACKControlFixture(
21
+ controlCase: OptionalConfigureACKControl,
22
+ ) {
23
+ return setupOptionalConfigureACK(controlCase);
24
+ }
25
+ async function setupOptionalConfigureACK(
26
+ controlCase: OptionalConfigureACKCase,
27
+ ) {
28
+ const selected = declareOptionalConfigureACKCase(controlCase);
29
+ const declaration = selected.declaration;
30
+ if (controlCase === "actual18-default-absent")
31
+ assert.deepEqual(
32
+ declaration,
33
+ declareOptionalConfigureACK18(),
34
+ "ORIGINAL18_WHOLE_DECLARATION_PARITY",
35
+ );
36
+ const writer = await configureWriteFixture(selected.writerMode);
37
+ const pending: Promise<unknown>[] = [];
38
+ const calls: { method: string; path: string }[] = [];
39
+ const promises: Promise<unknown>[] = [];
40
+ const counters = {
41
+ source: 0,
42
+ target: 0,
43
+ coverage: 0,
44
+ observer: 0,
45
+ C6: 0,
46
+ C3: 0,
47
+ C9: 0,
48
+ lookup: 0,
49
+ };
50
+ const clean = async () => {
51
+ try {
52
+ await Promise.all(pending);
53
+ } finally {
54
+ vi.doUnmock("../configure/actor.js");
55
+ vi.doUnmock("../../../renewalV2/observation.js");
56
+ await writer.cleanup();
57
+ }
58
+ };
59
+ try {
60
+ assert.deepEqual(
61
+ writer.write,
62
+ declaration.writer,
63
+ "PREDECLARED_WRITER_RECIPE_PARITY",
64
+ );
65
+ const basis = writer.OWNER.basis;
66
+ const writerACK: unknown = await writer.captureWriter().invoke();
67
+ assertConfigureACK(writer, writerACK);
68
+ const expectedSlots = selected.writerMode === "ack" ? 18 : 19;
69
+ const expectedDefaultsPresent = expectedSlots === 19;
70
+ assert.equal(ackSlots(writer).length, expectedSlots);
71
+ const ack = data(writerACK);
72
+ assert.equal(
73
+ Object.prototype.hasOwnProperty.call(
74
+ data(ack.receipt),
75
+ "defaultSettingsBinding",
76
+ ),
77
+ expectedDefaultsPresent,
78
+ );
79
+ const rawReceipt = data(ack.rawReceipt);
80
+ assert.equal(
81
+ Object.prototype.hasOwnProperty.call(
82
+ data(rawReceipt.providerSnapshot),
83
+ "default_settings",
84
+ ),
85
+ expectedDefaultsPresent,
86
+ );
87
+ if (expectedDefaultsPresent) {
88
+ const defaults = data(rawReceipt.providerSnapshot).default_settings;
89
+ assert.deepEqual(defaults, declaration.writer.response.default_settings);
90
+ if (selected.writerMode === "defaults-null") assert.equal(defaults, null);
91
+ else assert(defaults !== null && typeof defaults === "object");
92
+ const defaultBinding = data(ack.receipt).defaultSettingsBinding;
93
+ assert.equal(
94
+ defaultBinding,
95
+ writer.expectedReceipt.defaultSettingsBinding,
96
+ );
97
+ assert(typeof defaultBinding === "string");
98
+ assert.match(
99
+ defaultBinding,
100
+ /^renewal-configured-defaults:v2:sha256:[0-9a-f]{64}$/,
101
+ );
102
+ }
103
+ assert.deepEqual(rawReceipt, writer.rawReceipt);
104
+ const phases = data(rawReceipt.providerSnapshot).phases;
105
+ assert(Array.isArray(phases));
106
+ assert.equal(phases.length, 1);
107
+ const actualOperation = writer.fixedAOperation();
108
+ assert.equal(actualOperation.owner, writer.OWNER);
109
+ assert.equal(
110
+ actualOperation.actualAttachAcknowledgement,
111
+ writer.acknowledgement,
112
+ );
113
+ const originalEntry = actualOperation.originalEntry;
114
+ const origin = actualOperation.originAssociation;
115
+ const source = await import("../operations/sourceOperations.js");
116
+ assert.equal(source.ORIGINAL_ORIGIN_ASSOCIATION, origin);
117
+ assert(source.COMPILED_INITIAL_ENTRIES.includes(originalEntry));
118
+ const writerBefore = Object.freeze({
119
+ records: writer.writeState.records.length,
120
+ posts: writer.writeState.calls.filter((row) => row.method === "POST")
121
+ .length,
122
+ c9: writer.writeState.explicitC9,
123
+ });
124
+ assert.deepEqual(writerBefore, { records: 3, posts: 1, c9: 1 });
125
+ const setupBefore = Object.freeze({
126
+ records: writer.state.records.length,
127
+ posts: writer.state.calls.filter((row) => row.method === "POST").length,
128
+ });
129
+ assert.deepEqual(setupBefore, { records: 3, posts: 1 });
130
+ const input = deepFreeze({
131
+ configuration: writer.expectedRecord.configuration,
132
+ reads: declaration.reads,
133
+ configureReceipt: rawReceipt,
134
+ });
135
+ const direct: unknown = await Reflect.apply(
136
+ publicObserver.inspectRenewalScheduleMaterialV2,
137
+ publicObserver,
138
+ [input],
139
+ );
140
+ assert.deepEqual(
141
+ direct,
142
+ declaration.expectedObservation,
143
+ "UNMODIFIED_PUBLIC_OBSERVER_UNKNOWN_PREREQUISITE",
144
+ );
145
+ const expectedOutput = deepFreeze({
146
+ status: "owned_observation_data",
147
+ observation: direct,
148
+ reads: declaration.reads,
149
+ observedAt: declaration.observedAt,
150
+ retainedConfigureAcknowledgement: "present",
151
+ operationalAuthority: false,
152
+ });
153
+ const prerequisites = {
154
+ record: assertFit(writer.expectedRecord),
155
+ actualACK: assertFit(writerACK),
156
+ rawReceipt: assertFit(rawReceipt),
157
+ publicInput: assertFit(input),
158
+ publicResult: assertFit(direct),
159
+ expectedOutput: assertFit(expectedOutput),
160
+ };
161
+ assert.equal(writer.OWNER.basis, basis);
162
+ vi.stubGlobal("fetch", async (value: unknown, init: RequestInit) => {
163
+ const row = declaration.rows[calls.length];
164
+ assert(row, "UNDECLARED_OPTIONAL_ACK_READ");
165
+ const url = new URL(String(value));
166
+ assert.equal(url.origin, "https://api.stripe.com");
167
+ assert.equal(url.pathname + url.search, row.path);
168
+ assert.equal(init.method, "GET");
169
+ assert.equal(init.body, undefined);
170
+ assert.equal(init.redirect, "error");
171
+ const headers = new Headers(init.headers);
172
+ assert.equal(
173
+ headers.get("stripe-version"),
174
+ declaration.writer.baseline.apiVersion,
175
+ );
176
+ assert.equal(headers.get("stripe-account"), null);
177
+ calls.push({ method: "GET", path: row.path });
178
+ return new Response(JSON.stringify(row.body), {
179
+ status: 200,
180
+ headers: {
181
+ "content-type": "application/json",
182
+ "request-id": "req_SYNTHETIC_OPTIONAL_ACK",
183
+ },
184
+ });
185
+ });
186
+ const readTransport = Object.freeze({
187
+ rawRequest(...args: unknown[]) {
188
+ writer.OWNER.check();
189
+ const row = declaration.rows[promises.length];
190
+ assert(row);
191
+ assert.deepEqual(args, ["GET", row.path, undefined, row.options]);
192
+ const promise = writer.readFixedA(...args);
193
+ promises.push(promise);
194
+ pending.push(
195
+ promise.then(
196
+ () => {},
197
+ () => {},
198
+ ),
199
+ );
200
+ return promise;
201
+ },
202
+ });
203
+ const observationEntry = Object.freeze({
204
+ originalEntry,
205
+ coversObservation(
206
+ record: unknown,
207
+ actualInput: unknown,
208
+ result: unknown,
209
+ ) {
210
+ counters.coverage++;
211
+ assert.deepEqual(record, writer.expectedRecord);
212
+ assert.deepEqual(actualInput, input);
213
+ assert.deepEqual(result, direct);
214
+ return true;
215
+ },
216
+ });
217
+ const operation = Object.freeze({
218
+ owner: writer.OWNER,
219
+ originAssociation: origin,
220
+ originalEntry,
221
+ observationEntry,
222
+ record: writer.expectedRecord,
223
+ actualAttachAcknowledgement: writer.acknowledgement,
224
+ readTransport,
225
+ configureAcknowledgement: writerACK,
226
+ configureOperation: actualOperation,
227
+ });
228
+ let sourceOperation: unknown = operation;
229
+ if (controlCase === "cloned-returnedACK")
230
+ sourceOperation = Object.freeze({
231
+ ...operation,
232
+ configureAcknowledgement: deepFreeze(structuredClone(writerACK)),
233
+ });
234
+ else if (controlCase === "foreign-operation")
235
+ sourceOperation = Object.freeze({
236
+ ...operation,
237
+ configureOperation: Object.freeze({
238
+ declared: "FOREIGN_CONFIGURE_OPERATION",
239
+ }),
240
+ });
241
+ else if (controlCase === "cloned-actual-operation")
242
+ sourceOperation = Object.freeze({
243
+ ...operation,
244
+ configureOperation: Object.freeze({ ...actualOperation }),
245
+ });
246
+ else if (controlCase === "raw-C9-input-instead-of-returnedACK")
247
+ sourceOperation = Object.freeze({
248
+ ...operation,
249
+ configureAcknowledgement: rawReceipt,
250
+ });
251
+ else if (controlCase === "own-ACK-undefined")
252
+ sourceOperation = Object.freeze({
253
+ ...operation,
254
+ configureAcknowledgement: undefined,
255
+ });
256
+ else if (controlCase === "own-ACK-null")
257
+ sourceOperation = Object.freeze({
258
+ ...operation,
259
+ configureAcknowledgement: null,
260
+ });
261
+ else if (
262
+ controlCase === "ACK-present-operation-absent" ||
263
+ controlCase === "operation-present-ACK-absent"
264
+ ) {
265
+ const omitted =
266
+ controlCase === "ACK-present-operation-absent"
267
+ ? "configureOperation"
268
+ : "configureAcknowledgement";
269
+ sourceOperation = Object.freeze(
270
+ Object.fromEntries(
271
+ Object.entries(operation).filter(([key]) => key !== omitted),
272
+ ),
273
+ );
274
+ }
275
+ const actualWriterActor = await import("../configure/actor.js");
276
+ const actualLookup = actualWriterActor.readOwnedConfigureAcknowledgement;
277
+ assert.equal(typeof actualLookup, "function");
278
+ vi.doMock("../configure/actor.js", () => ({
279
+ ...actualWriterActor,
280
+ readOwnedConfigureAcknowledgement(
281
+ this: unknown,
282
+ ...args: Parameters<typeof actualLookup>
283
+ ) {
284
+ counters.lookup++;
285
+ return Reflect.apply(actualLookup, this, args) as ReturnType<
286
+ typeof actualLookup
287
+ >;
288
+ },
289
+ }));
290
+ vi.doMock("../operations/sourceOperations.js", () => ({
291
+ ...source,
292
+ COMPILED_OBSERVATION_ENTRIES: Object.freeze([observationEntry]),
293
+ loadFixedObservationOperation() {
294
+ assert.equal(arguments.length, 0);
295
+ counters.source++;
296
+ return sourceOperation;
297
+ },
298
+ }));
299
+ const keep = <T>(promise: Promise<T>) => {
300
+ pending.push(
301
+ promise.then(
302
+ () => {},
303
+ () => {},
304
+ ),
305
+ );
306
+ return promise;
307
+ };
308
+ vi.doMock("../../../renewalV2/index.js", () => ({
309
+ ...actualPublicAPI,
310
+ projectRenewalConfigurationV2(
311
+ ...args: Parameters<
312
+ typeof actualPublicAPI.projectRenewalConfigurationV2
313
+ >
314
+ ) {
315
+ counters.C6++;
316
+ return keep(
317
+ Reflect.apply(
318
+ actualPublicAPI.projectRenewalConfigurationV2,
319
+ actualPublicAPI,
320
+ args,
321
+ ) as ReturnType<typeof actualPublicAPI.projectRenewalConfigurationV2>,
322
+ );
323
+ },
324
+ constructRenewalScheduleAttachmentReceiptV2(
325
+ ...args: Parameters<
326
+ typeof actualPublicAPI.constructRenewalScheduleAttachmentReceiptV2
327
+ >
328
+ ) {
329
+ counters.C3++;
330
+ return keep(
331
+ Reflect.apply(
332
+ actualPublicAPI.constructRenewalScheduleAttachmentReceiptV2,
333
+ actualPublicAPI,
334
+ args,
335
+ ) as ReturnType<
336
+ typeof actualPublicAPI.constructRenewalScheduleAttachmentReceiptV2
337
+ >,
338
+ );
339
+ },
340
+ constructRenewalConfigurationReceiptV2(
341
+ ...args: Parameters<
342
+ typeof actualPublicAPI.constructRenewalConfigurationReceiptV2
343
+ >
344
+ ) {
345
+ counters.C9++;
346
+ return keep(
347
+ Reflect.apply(
348
+ actualPublicAPI.constructRenewalConfigurationReceiptV2,
349
+ actualPublicAPI,
350
+ args,
351
+ ) as ReturnType<
352
+ typeof actualPublicAPI.constructRenewalConfigurationReceiptV2
353
+ >,
354
+ );
355
+ },
356
+ }));
357
+ vi.doMock("../../../renewalV2/observation.js", () => ({
358
+ ...publicObserver,
359
+ inspectRenewalScheduleMaterialV2(
360
+ ...args: Parameters<
361
+ typeof publicObserver.inspectRenewalScheduleMaterialV2
362
+ >
363
+ ) {
364
+ counters.observer++;
365
+ const promise = Reflect.apply(
366
+ publicObserver.inspectRenewalScheduleMaterialV2,
367
+ publicObserver,
368
+ args,
369
+ ) as ReturnType<typeof publicObserver.inspectRenewalScheduleMaterialV2>;
370
+ pending.push(
371
+ promise.then(
372
+ () => {},
373
+ () => {},
374
+ ),
375
+ );
376
+ return promise;
377
+ },
378
+ }));
379
+ const actor = await import("../observation/actor.js");
380
+ writer.OWNER.check();
381
+ assert.deepEqual(counters, {
382
+ source: 0,
383
+ target: 0,
384
+ coverage: 0,
385
+ observer: 0,
386
+ C6: 0,
387
+ C3: 0,
388
+ C9: 0,
389
+ lookup: 0,
390
+ });
391
+ assert.equal(calls.length, 0);
392
+ console.log(
393
+ JSON.stringify({
394
+ kind: "OPTIONAL_ACK18_ACTUAL_PREREQUISITES",
395
+ actualInitialACK: true,
396
+ actualWriterACK: true,
397
+ actualConfigureOperationPointer: true,
398
+ sameOriginalOwnerENTRYAndOrigin: true,
399
+ controlCase,
400
+ controlStage: selected.stage,
401
+ generatedSlots: expectedSlots,
402
+ originalClientAndPromisePath: true,
403
+ writerBefore,
404
+ setupBefore,
405
+ observationHTTP: 0,
406
+ directUnmodifiedObserver: direct,
407
+ prerequisites,
408
+ operationalAuthority: false,
409
+ }),
410
+ );
411
+ return {
412
+ declaration,
413
+ selected,
414
+ writer,
415
+ writerACK,
416
+ operation,
417
+ sourceOperation,
418
+ basis,
419
+ input,
420
+ expectedOutput,
421
+ writerBefore,
422
+ setupBefore,
423
+ calls,
424
+ promises,
425
+ counters,
426
+ capture() {
427
+ const handle = actor.captureOwnedRenewalObservationV2();
428
+ return Object.freeze({
429
+ invoke() {
430
+ counters.target++;
431
+ const promise = Reflect.apply(
432
+ handle.invoke,
433
+ handle,
434
+ [],
435
+ ) as ReturnType<typeof handle.invoke>;
436
+ pending.push(
437
+ promise.then(
438
+ () => {},
439
+ () => {},
440
+ ),
441
+ );
442
+ return promise;
443
+ },
444
+ });
445
+ },
446
+ cleanup: clean,
447
+ };
448
+ } catch (error) {
449
+ await clean();
450
+ throw error;
451
+ }
452
+ }
@@ -0,0 +1,88 @@
1
+ import assert from "node:assert/strict";
2
+ import { data } from "./configurePreflightControls.js";
3
+ import { assertFit } from "./configurePreflightAssertions.js";
4
+ import type { configuredHistoryFixture } from "./observationConfiguredHistoryOperation.js";
5
+
6
+ export function assertConfiguredHistoryResult(
7
+ h: Awaited<ReturnType<typeof configuredHistoryFixture>>,
8
+ output: unknown,
9
+ ) {
10
+ assert.deepEqual(output, h.expectedOutput);
11
+ const out = data(output);
12
+ assert.deepEqual(
13
+ Object.keys(out).sort(),
14
+ [
15
+ "status",
16
+ "observation",
17
+ "reads",
18
+ "observedAt",
19
+ "retainedConfigureAcknowledgement",
20
+ "operationalAuthority",
21
+ ].sort(),
22
+ );
23
+ assert.equal(out.retainedConfigureAcknowledgement, "present");
24
+ assert.equal(out.operationalAuthority, false);
25
+ assert.equal(h.counters.target, 1);
26
+ assert.equal(h.counters.source, 1);
27
+ assert.equal(h.counters.coverage, 1);
28
+ assert.equal(h.counters.observer, 1);
29
+ assert.equal(h.counters.C6, 1);
30
+ assert.equal(h.counters.C3, 1);
31
+ assert.equal(h.counters.C9, 1);
32
+ assert.equal(h.counters.lookup, 1);
33
+ assert.notEqual(output, h.expectedOutput);
34
+ assert.notEqual(out.reads, h.declaration.reads);
35
+ assert.notEqual(data(out.reads).schedule, h.declaration.reads.schedule);
36
+ assert.notEqual(out.observation, data(h.expectedOutput).observation);
37
+ assert.equal(h.writer.writeState.explicitC9, h.writerBefore.c9);
38
+ assert.equal(h.calls.length, 6);
39
+ assert.equal(h.promises.length, 6);
40
+ assert.deepEqual(
41
+ h.calls,
42
+ h.declaration.rows.map((row) => ({ method: "GET", path: row.path })),
43
+ );
44
+ assert.equal(h.writer.writeState.records.length, h.writerBefore.records);
45
+ assert.equal(
46
+ h.writer.writeState.calls.filter((row) => row.method === "POST").length,
47
+ h.writerBefore.posts,
48
+ );
49
+ assert.equal(h.writer.state.records.length, h.setupBefore.records);
50
+ assert.equal(
51
+ h.writer.state.calls.filter((row) => row.method === "POST").length,
52
+ h.setupBefore.posts,
53
+ );
54
+ assert.equal(h.writer.OWNER.basis, h.basis);
55
+ assert.equal(h.operation.configureOperation, h.writer.fixedAOperation());
56
+ assert.equal(h.operation.configureAcknowledgement, h.writerACK);
57
+ assert.equal(
58
+ h.operation.actualAttachAcknowledgement,
59
+ h.writer.acknowledgement,
60
+ );
61
+ assert.deepEqual(out.observation, h.declaration.expectedObservation);
62
+ const sample = h.finalSample();
63
+ assert(sample);
64
+ assert.equal(out.observedAt, Math.floor(sample.wallMs / 1000));
65
+ assert.equal(
66
+ h.writer.OWNER.check().nowSeconds,
67
+ Math.floor(sample.wallMs / 1000),
68
+ );
69
+ const subscription = data(data(out.reads).subscription);
70
+ assert.equal(
71
+ subscription.latest_invoice,
72
+ h.declaration.controlCase === "H07-active-invoice-I0-I1"
73
+ ? "in_successor"
74
+ : "in_original",
75
+ );
76
+ const items = data(subscription.items).data;
77
+ assert(Array.isArray(items) && items.length === 1);
78
+ assert.equal(data(data(items[0]).plan).object, "plan");
79
+ assert.deepEqual(data(out.reads).schedule, h.declaration.reads.schedule);
80
+ assertFit(output);
81
+ const frozen = (value: unknown) => {
82
+ if (value && typeof value === "object") {
83
+ assert(Object.isFrozen(value));
84
+ for (const child of Object.values(value)) frozen(child);
85
+ }
86
+ };
87
+ frozen(output);
88
+ }
@@ -0,0 +1,170 @@
1
+ import assert from "node:assert/strict";
2
+ import { declareConfigureWriteCase } from "./configureWriteDeclarations.js";
3
+ import { deepFreeze } from "./configurePreflightControls.js";
4
+ import { configuredHistoryLiveReads } from "./observationConfiguredHistoryNative.js";
5
+
6
+ export const configuredHistoryCases = [
7
+ "H01-pending",
8
+ "H02-active",
9
+ "H03-history-onephase",
10
+ "H04-history-opaque-drift",
11
+ "H05-live-target-end",
12
+ "H06-live-default-drift",
13
+ "H07-active-invoice-I0-I1",
14
+ "H08-active-unknown-metadata",
15
+ "H09-live-coupon-counter",
16
+ "H10-live-customer-sequence",
17
+ ] as const;
18
+ export type ConfiguredHistoryCase = (typeof configuredHistoryCases)[number];
19
+ const unsigned = {
20
+ acknowledgementEstablished: false,
21
+ authenticationEstablished: false,
22
+ providerQualificationRequired: true,
23
+ } as const;
24
+ /** Every complete writer/live raw scenario and exact result precedes all constructors. */
25
+ export function declareConfiguredHistoryCase(
26
+ controlCase: ConfiguredHistoryCase,
27
+ ) {
28
+ assert(
29
+ (configuredHistoryCases as readonly string[]).includes(controlCase),
30
+ "UNDECLARED_CONFIGURED_HISTORY_CASE",
31
+ );
32
+ const writerMode =
33
+ controlCase === "H03-history-onephase"
34
+ ? "configured-history-onephase"
35
+ : controlCase === "H04-history-opaque-drift"
36
+ ? "configured-history-drift"
37
+ : "configured-history";
38
+ const writer = declareConfigureWriteCase(writerMode);
39
+ const active =
40
+ controlCase === "H02-active" ||
41
+ controlCase === "H07-active-invoice-I0-I1" ||
42
+ controlCase === "H08-active-unknown-metadata";
43
+ const reads = configuredHistoryLiveReads(writer.baseline, active);
44
+ if (controlCase === "H05-live-target-end")
45
+ reads.schedule.phases[1]!.end_date++;
46
+ if (controlCase === "H06-live-default-drift")
47
+ Object.defineProperty(reads.schedule.default_settings, "description", {
48
+ value: "TEST_DECLARED_DEFAULT_DRIFT",
49
+ enumerable: true,
50
+ configurable: true,
51
+ writable: true,
52
+ });
53
+ if (controlCase === "H07-active-invoice-I0-I1")
54
+ reads.subscription.latest_invoice = "in_successor";
55
+ if (controlCase === "H08-active-unknown-metadata")
56
+ reads.subscription.metadata.keep = "TEST_DECLARED_ACTIVE_DRIFT";
57
+ if (controlCase === "H09-live-coupon-counter")
58
+ reads.coupons[0]!.times_redeemed++;
59
+ if (controlCase === "H10-live-customer-sequence")
60
+ reads.billingCustomer.next_invoice_sequence++;
61
+ const results = {
62
+ "H01-pending": { ...unsigned, predicate: "pending_material_match" },
63
+ "H02-active": {
64
+ ...unsigned,
65
+ predicate: "current_target_material_match",
66
+ observedItemId: "si_successor",
67
+ nativePeriod: { start: 1771113600, end: 1773532800 },
68
+ },
69
+ "H03-history-onephase": {
70
+ ...unsigned,
71
+ predicate: "unknown",
72
+ reason: "configured_baseline_material_unproven",
73
+ },
74
+ "H04-history-opaque-drift": {
75
+ ...unsigned,
76
+ predicate: "conflict",
77
+ reason: "full_phase_or_default_read_drift",
78
+ },
79
+ "H05-live-target-end": {
80
+ ...unsigned,
81
+ predicate: "conflict",
82
+ reason: "configured_ack_full_baseline_drift",
83
+ },
84
+ "H06-live-default-drift": {
85
+ ...unsigned,
86
+ predicate: "conflict",
87
+ reason: "full_phase_or_default_read_drift",
88
+ },
89
+ "H07-active-invoice-I0-I1": {
90
+ ...unsigned,
91
+ predicate: "conflict",
92
+ reason: "effective_full_material_drift",
93
+ },
94
+ "H08-active-unknown-metadata": {
95
+ ...unsigned,
96
+ predicate: "conflict",
97
+ reason: "effective_full_material_drift",
98
+ },
99
+ "H09-live-coupon-counter": {
100
+ ...unsigned,
101
+ predicate: "conflict",
102
+ reason: "expanded_coupon_read_drift",
103
+ },
104
+ "H10-live-customer-sequence": {
105
+ ...unsigned,
106
+ predicate: "conflict",
107
+ reason: "billing_customer_full_read_drift",
108
+ },
109
+ };
110
+ const e = writer.baseline.original.attachRequest.preparation.expected;
111
+ const query = new URLSearchParams([
112
+ ["expand[0]", "discounts"],
113
+ ["expand[1]", "items.data.discounts"],
114
+ ["expand[2]", "items.data.price"],
115
+ ]);
116
+ const rows = [
117
+ {
118
+ resource: "schedule",
119
+ path:
120
+ "/v1/subscription_schedules/" + encodeURIComponent(reads.schedule.id),
121
+ body: reads.schedule,
122
+ },
123
+ {
124
+ resource: "subscription",
125
+ path:
126
+ "/v1/subscriptions/" +
127
+ encodeURIComponent(e.subscriptionId) +
128
+ "?" +
129
+ query,
130
+ body: reads.subscription,
131
+ },
132
+ {
133
+ resource: "price",
134
+ path: "/v1/prices/" + encodeURIComponent(e.targetPriceId),
135
+ body: reads.targetPrice,
136
+ },
137
+ {
138
+ resource: "customer",
139
+ path: "/v1/customers/" + encodeURIComponent(reads.billingCustomer.id),
140
+ body: reads.billingCustomer,
141
+ },
142
+ ...reads.coupons.map((coupon) => ({
143
+ resource: "coupon",
144
+ path: "/v1/coupons/" + encodeURIComponent(coupon.id),
145
+ body: coupon,
146
+ })),
147
+ ];
148
+ return deepFreeze({
149
+ controlCase,
150
+ writerMode,
151
+ writer,
152
+ reads,
153
+ historyPhaseCount: controlCase === "H03-history-onephase" ? 1 : 2,
154
+ expectedObservation: results[controlCase],
155
+ expectedWithoutReceipt: {
156
+ ...unsigned,
157
+ predicate: "unknown",
158
+ reason: "future_duration_not_bound",
159
+ },
160
+ observedAt: Math.floor(writer.writeAt / 1000),
161
+ rows: rows.map((row, i) => ({
162
+ ...row,
163
+ ordinal: i + 1,
164
+ options: {
165
+ apiVersion: writer.baseline.apiVersion,
166
+ maxNetworkRetries: 0 as const,
167
+ },
168
+ })),
169
+ } as const);
170
+ }