@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,537 @@
1
+ import assert from "node:assert/strict";
2
+ import { createHash } from "node:crypto";
3
+ import { data, deepFreeze } from "./configurePreflightControls.js";
4
+ import { assertFit } from "./configurePreflightAssertions.js";
5
+ import type { declareConfigureWriteCase } from "./configureWriteDeclarations.js";
6
+ import type { WriteObservations } from "./configureWriteObservations.js";
7
+ import { assertActualWriteCounters } from "./configureWriteObservations.js";
8
+ import type { configureWriteBarriers } from "./configureWriteBarriers.js";
9
+ import type { ConfigureWriteFixture } from "./configureWriteOperation.js";
10
+ import type { ProjectedRenewalConfigurationV2 } from "../../../renewalV2/index.js";
11
+
12
+ /** Independent form oracle: compare every encoded leaf, including numeric array positions. */
13
+ function formLeaves(value: unknown, path = ""): [string, string][] {
14
+ if (value === null) return [[path, ""]];
15
+ if (typeof value !== "object") return [[path, String(value)]];
16
+ return Object.entries(value).flatMap(([key, child]) =>
17
+ formLeaves(child, path ? path + "[" + key + "]" : key),
18
+ );
19
+ }
20
+ export function createWriteHTTPAndSink(
21
+ declared: ReturnType<typeof declareConfigureWriteCase>,
22
+ s: WriteObservations,
23
+ gates: ReturnType<typeof configureWriteBarriers>,
24
+ request: ProjectedRenewalConfigurationV2,
25
+ owner: typeof import("../originalOwner.js").OWNER,
26
+ advanceSchedule: () => void,
27
+ ) {
28
+ const b = declared.currentBundle;
29
+ const query = new URLSearchParams(
30
+ ["discounts", "items.data.discounts", "items.data.price"].map((v, i) => [
31
+ "expand[" + i + "]",
32
+ v,
33
+ ]),
34
+ );
35
+ const rows = deepFreeze([
36
+ {
37
+ method: "GET",
38
+ path:
39
+ "/v1/subscriptions/" +
40
+ encodeURIComponent(b.wireSubscription.id) +
41
+ "?" +
42
+ query,
43
+ body: b.wireSubscription,
44
+ },
45
+ {
46
+ method: "GET",
47
+ path: "/v1/prices/" + encodeURIComponent(b.wireTargetPrice.id),
48
+ body: b.wireTargetPrice,
49
+ },
50
+ {
51
+ method: "GET",
52
+ path: "/v1/customers/" + encodeURIComponent(b.wireBillingCustomer.id),
53
+ body: b.wireBillingCustomer,
54
+ },
55
+ ...b.couponReads.map((row) => ({
56
+ method: "GET",
57
+ path: "/v1/coupons/" + encodeURIComponent(row.couponId),
58
+ body: row.wireCoupon,
59
+ })),
60
+ { method: "GET", path: request.path, body: declared.currentSchedule },
61
+ { method: "POST", path: request.path, body: declared.response },
62
+ ]);
63
+ const fetch = async (input: unknown, init: RequestInit) => {
64
+ const row = rows[s.calls.length],
65
+ url = new URL(String(input));
66
+ assert(row, "UNDECLARED_CONFIGURE_WRITE_HTTP");
67
+ assert.equal(url.origin, "https://api.stripe.com");
68
+ assert.equal(url.pathname + url.search, row.path);
69
+ assert.equal(init.method, row.method);
70
+ assert.equal(init.redirect, "error");
71
+ const headers = new Headers(init.headers);
72
+ assert.equal(headers.get("stripe-version"), request.apiVersion);
73
+ assert.equal(headers.get("stripe-account"), null);
74
+ if (row.method === "POST") {
75
+ assert.equal(headers.get("idempotency-key"), request.key);
76
+ const received = [
77
+ ...new URLSearchParams(String(init.body)).entries(),
78
+ ].sort();
79
+ assert.deepEqual(received, formLeaves(request.payload).sort());
80
+ assert.equal(s.records.length, 1, "POST_REQUIRES_DISPATCH_SEND_AND_ACK");
81
+ }
82
+ s.calls.push({
83
+ method: row.method,
84
+ path: row.path,
85
+ body: init.body ?? null,
86
+ key: headers.get("idempotency-key"),
87
+ });
88
+ s.trace.push("http:" + row.method);
89
+ if (
90
+ (declared.name === "get-reject" && row.method === "GET") ||
91
+ (declared.name === "post-reject" && row.method === "POST")
92
+ )
93
+ throw declared.providerRejection;
94
+ if (declared.name === "retire-get" && row.method === "GET")
95
+ await gates.hold("get");
96
+ if (
97
+ (declared.name === "retire-post" || declared.name === "pending-prior") &&
98
+ row.method === "POST"
99
+ )
100
+ await gates.hold("post");
101
+ if (row.method === "GET" && row.path === request.path) advanceSchedule();
102
+ const status = row.method === "POST" ? declared.status : 200;
103
+ return new Response(
104
+ JSON.stringify(status >= 400 ? declared.errorBody : row.body),
105
+ {
106
+ status,
107
+ headers: {
108
+ "content-type": "application/json",
109
+ ...(declared.requestId === null
110
+ ? {}
111
+ : { "request-id": declared.requestId }),
112
+ ...(status === 307 || status === 308
113
+ ? { location: "https://api.stripe.com/v1/forbidden-retry" }
114
+ : {}),
115
+ },
116
+ },
117
+ );
118
+ };
119
+ const sink = Object.freeze({
120
+ send(value: unknown, acknowledge: (value: unknown) => void) {
121
+ owner.check();
122
+ const record = data(value),
123
+ sequence = record.sequence;
124
+ assert.equal(sequence, s.records.length + 1);
125
+ assertFit(record);
126
+ s.records.push(record);
127
+ s.trace.push("sink:" + String(sequence));
128
+ const ack = { sequence, binding: record.binding };
129
+ if (declared.name === "wrong-ack") {
130
+ acknowledge({ ...ack, binding: "wrong" });
131
+ return;
132
+ }
133
+ if (declared.name === "duplicate-ack") {
134
+ acknowledge(ack);
135
+ acknowledge(ack);
136
+ return;
137
+ }
138
+ const stage =
139
+ sequence === 1 ? "dispatch" : sequence === 2 ? "response" : "receipt";
140
+ if (declared.name === stage + "-ack") {
141
+ const task = gates.hold(stage + "-ack").then(() => {
142
+ acknowledge(ack);
143
+ s.trace.push("ack:" + String(sequence));
144
+ });
145
+ gates.pending.push(task);
146
+ return;
147
+ }
148
+ acknowledge(ack);
149
+ s.trace.push("ack:" + String(sequence));
150
+ if (declared.name === stage + "-send") return gates.hold(stage + "-send");
151
+ if (declared.name === "retire-" + stage) return gates.hold(stage);
152
+ },
153
+ });
154
+ return Object.freeze({ fetch, sink });
155
+ }
156
+
157
+ const requestSlots = [
158
+ ["logicalBinding"],
159
+ ["attachReceiptBinding"],
160
+ ["baselineBinding"],
161
+ ["defaultSettingsBinding"],
162
+ ["requestIdentity", "binding"],
163
+ ] as const;
164
+ export function ackSlots(h: ConfigureWriteFixture) {
165
+ const record = [
166
+ ...requestSlots.map((path) => ["originalRecord", "request", ...path]),
167
+ ["originalRecord", "attachReceipt", "logicalBinding"],
168
+ ["originalRecord", "attachReceipt", "request", "logicalBinding"],
169
+ [
170
+ "originalRecord",
171
+ "attachReceipt",
172
+ "request",
173
+ "requestIdentity",
174
+ "binding",
175
+ ],
176
+ ["originalRecord", "attachReceipt", "binding"],
177
+ ];
178
+ return [
179
+ ...record,
180
+ ["receipt", "logicalBinding"],
181
+ ...requestSlots.map((path) => ["receipt", "request", ...path]),
182
+ ["receipt", "attachReceiptBinding"],
183
+ ["receipt", "providerSnapshotBinding"],
184
+ ["receipt", "binding"],
185
+ ...(Object.prototype.hasOwnProperty.call(
186
+ h.expectedReceipt,
187
+ "defaultSettingsBinding",
188
+ )
189
+ ? [["receipt", "defaultSettingsBinding"]]
190
+ : []),
191
+ ];
192
+ }
193
+ export function assertConfigureACK(h: ConfigureWriteFixture, output: unknown) {
194
+ assert.deepEqual(output, h.expectedACK);
195
+ const out = data(output);
196
+ assert.deepEqual(Object.keys(out).sort(), [
197
+ "operationalAuthority",
198
+ "originalRecord",
199
+ "rawReceipt",
200
+ "receipt",
201
+ "status",
202
+ ]);
203
+ assert(Object.isFrozen(out));
204
+ assert.equal(out.operationalAuthority, false);
205
+ assert.deepEqual(data(out.receipt).providerSnapshot, h.write.response);
206
+ assert.deepEqual(data(out.receipt).request, h.projected);
207
+ const slots = ackSlots(h);
208
+ assert.equal(
209
+ slots.length,
210
+ h.write.name === "defaults-null" ||
211
+ h.write.name === "defaults-object" ||
212
+ h.write.name === "configured-history" ||
213
+ h.write.name === "configured-history-onephase" ||
214
+ h.write.name === "configured-history-drift"
215
+ ? 19
216
+ : 18,
217
+ );
218
+ for (const path of slots) {
219
+ let actual: unknown = output,
220
+ expected: unknown = h.expectedACK;
221
+ for (const key of path) {
222
+ actual = data(actual)[key];
223
+ expected = data(expected)[key];
224
+ }
225
+ assert.equal(actual, expected);
226
+ }
227
+ assertActualWriteCounters(h.writeState);
228
+ assert.equal(
229
+ h.writeState.calls.length,
230
+ 5 + h.write.currentBundle.couponReads.length,
231
+ );
232
+ assert(h.writeState.calls.filter((row) => row.method === "GET").length <= 44);
233
+ for (const [part, value] of [
234
+ ["record", h.expectedRecord],
235
+ ["rawReceipt", h.rawReceipt],
236
+ ["receipt", h.expectedReceipt],
237
+ ["ACK", output],
238
+ ] as const)
239
+ console.log(
240
+ JSON.stringify({
241
+ kind: "CONFIGURE_WRITER_WHOLE_METRICS",
242
+ part,
243
+ ...assertFit(value),
244
+ }),
245
+ );
246
+ }
247
+
248
+ export function assertProviderFailure(
249
+ h: ConfigureWriteFixture,
250
+ error: unknown,
251
+ phase: "read" | "post",
252
+ ) {
253
+ assert(error instanceof Error);
254
+ assert.equal(error.message, "OWNED_CONFIGURE_PROVIDER_REJECTED");
255
+ const descriptor = Object.getOwnPropertyDescriptor(error, "failure");
256
+ assert(descriptor && "value" in descriptor);
257
+ assert.equal(descriptor.enumerable, false);
258
+ assert.equal(descriptor.configurable, false);
259
+ assert.equal(descriptor.writable, false);
260
+ const failure = data(descriptor.value);
261
+ assert.deepEqual(Object.keys(failure).sort(), [
262
+ "category",
263
+ "diagnostics",
264
+ "operationalAuthority",
265
+ "ordinal",
266
+ "outcome",
267
+ "phase",
268
+ "request",
269
+ "resource",
270
+ ]);
271
+ assert.equal(failure.category, "provider_rejected");
272
+ assert.equal(failure.phase, phase);
273
+ assert.equal(
274
+ failure.resource,
275
+ phase === "read" ? "subscription" : "configure",
276
+ );
277
+ assert.equal(
278
+ failure.ordinal,
279
+ phase === "read" ? 1 : 5 + h.write.currentBundle.couponReads.length,
280
+ );
281
+ const diagnostics = data(failure.diagnostics);
282
+ assert(Object.isFrozen(diagnostics));
283
+ assert(
284
+ Object.keys(diagnostics).every((key) =>
285
+ ["type", "code", "requestId", "statusCode"].includes(key),
286
+ ),
287
+ );
288
+ for (const value of Object.values(diagnostics))
289
+ if (typeof value === "string") {
290
+ assert(value.length > 0 && value.length <= 255);
291
+ assert(!value.includes("sk_live_"));
292
+ }
293
+
294
+ assert.equal(failure.outcome, "unknown");
295
+ assert.equal(failure.operationalAuthority, false);
296
+ assert.deepEqual(failure.request, h.projected);
297
+ assert(Object.isFrozen(failure));
298
+ assertFit(failure);
299
+ assert.equal(Object.prototype.hasOwnProperty.call(error, "cause"), false);
300
+ }
301
+
302
+ /** Actual unchanged C9 and all whole DATA metrics must qualify before the target. */
303
+ export async function establishWriteOracle(
304
+ active: typeof import("../../../renewalV2/index.js"),
305
+ owner: typeof import("../originalOwner.js").OWNER,
306
+ configuration: Parameters<typeof active.projectRenewalConfigurationV2>[0],
307
+ projected: ProjectedRenewalConfigurationV2,
308
+ write: ReturnType<typeof declareConfigureWriteCase>,
309
+ expectedRecord: unknown,
310
+ ) {
311
+ const dispatch = {
312
+ scope: projected.scope,
313
+ apiVersion: projected.apiVersion,
314
+ method: projected.method,
315
+ path: projected.path,
316
+ payload: projected.payload,
317
+ key: projected.key,
318
+ firstDispatchedAt: projected.firstDispatchedAt,
319
+ };
320
+ const rawReceipt = deepFreeze({
321
+ configuration: configuration,
322
+ actualDispatch: dispatch,
323
+ providerSnapshot: write.oracleResponse,
324
+ transport: {
325
+ status: 200,
326
+ ...(write.oracleRequestId === null
327
+ ? {}
328
+ : { requestId: write.oracleRequestId }),
329
+ },
330
+ });
331
+ const expectedReceipt =
332
+ await active.constructRenewalConfigurationReceiptV2(rawReceipt);
333
+ owner.check();
334
+ assert.equal(
335
+ expectedReceipt.stage,
336
+ "configure_acknowledged",
337
+ "ACTUAL_C9_PREREQUISITE",
338
+ );
339
+ assertFit(rawReceipt);
340
+ assertFit(expectedReceipt);
341
+ const expectedACK = deepFreeze({
342
+ status: "configure_acknowledged",
343
+ originalRecord: expectedRecord,
344
+ rawReceipt,
345
+ receipt: expectedReceipt,
346
+ operationalAuthority: false,
347
+ });
348
+ assertFit(expectedACK);
349
+ return { rawReceipt, expectedReceipt, expectedACK };
350
+ }
351
+
352
+ /** Independent Node hash oracle uses the documented exact V2 JSON preimage. */
353
+ function expectedBinding(family: string, preimage: unknown) {
354
+ const canonical = (value: unknown): unknown =>
355
+ Array.isArray(value)
356
+ ? value.map(canonical)
357
+ : value !== null && typeof value === "object"
358
+ ? Object.fromEntries(
359
+ Object.entries(value)
360
+ .sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))
361
+ .map(([key, child]) => [key, canonical(child)]),
362
+ )
363
+ : value;
364
+ const text = JSON.stringify(
365
+ canonical(["betterstripe-renewal-binding", 2, family, preimage]),
366
+ );
367
+ assert(Buffer.byteLength(text, "utf8") <= 500000);
368
+ return (
369
+ family +
370
+ ":v2:sha256:" +
371
+ createHash("sha256").update(text, "utf8").digest("hex")
372
+ );
373
+ }
374
+ export function assertWriteTokenPreimages(
375
+ preparedValue: unknown,
376
+ recordValue: unknown,
377
+ receiptValue: unknown,
378
+ ) {
379
+ const prepared = data(preparedValue),
380
+ record = data(recordValue),
381
+ request = data(record.request),
382
+ attach = data(record.attachReceipt),
383
+ receipt = data(receiptValue);
384
+ const {
385
+ status: _status,
386
+ preservation: _preservation,
387
+ requestIdentity: _identity,
388
+ ...C1
389
+ } = prepared;
390
+ const logical = expectedBinding("renewal", C1);
391
+ assert.equal(request.logicalBinding, logical);
392
+ assert.equal(attach.logicalBinding, logical);
393
+ const attachRequest = data(attach.request),
394
+ { requestIdentity: attachIdentity, ...C2 } = attachRequest;
395
+ assert.equal(attachRequest.logicalBinding, logical);
396
+ assert.equal(
397
+ data(attachIdentity).binding,
398
+ expectedBinding("renewal-attach", C2),
399
+ );
400
+ const { binding: attachBinding, ...C3 } = attach;
401
+ assert.equal(attachBinding, expectedBinding("renewal-attach-receipt", C3));
402
+ assert.equal(request.attachReceiptBinding, attachBinding);
403
+ assert.equal(
404
+ request.baselineBinding,
405
+ expectedBinding("renewal-baseline", attach.providerSnapshot),
406
+ );
407
+ const configuration = data(record.configuration),
408
+ schedule = data(configuration.schedule);
409
+ assert.equal(
410
+ request.defaultSettingsBinding,
411
+ expectedBinding("renewal-defaults", schedule.default_settings),
412
+ );
413
+ const {
414
+ status: _s,
415
+ providerQualification: _q,
416
+ profile: _p,
417
+ requestIdentity,
418
+ ...C6
419
+ } = request;
420
+ assert.equal(Object.keys(C6).length, 14);
421
+ assert.equal(
422
+ data(requestIdentity).binding,
423
+ expectedBinding("renewal-configure", C6),
424
+ );
425
+ assert.deepEqual(receipt.request, request);
426
+ assert.equal(receipt.logicalBinding, logical);
427
+ assert.equal(receipt.attachReceiptBinding, attachBinding);
428
+ assert.equal(
429
+ receipt.providerSnapshotBinding,
430
+ expectedBinding("renewal-configured-baseline", receipt.providerSnapshot),
431
+ );
432
+ const response = data(receipt.providerSnapshot);
433
+ assert.equal(
434
+ Object.prototype.hasOwnProperty.call(receipt, "defaultSettingsBinding"),
435
+ Object.prototype.hasOwnProperty.call(response, "default_settings"),
436
+ );
437
+ if (Object.prototype.hasOwnProperty.call(response, "default_settings"))
438
+ assert.equal(
439
+ receipt.defaultSettingsBinding,
440
+ expectedBinding("renewal-configured-defaults", response.default_settings),
441
+ );
442
+ const { binding, ...C9 } = receipt;
443
+ assert.equal(binding, expectedBinding("renewal-configure-receipt", C9));
444
+ }
445
+
446
+ export function logWritePrerequisites(values: {
447
+ initialOutput: unknown;
448
+ preflightOutput: unknown;
449
+ expectedRecord: unknown;
450
+ rawReceipt: unknown;
451
+ expectedReceipt: unknown;
452
+ expectedACK: unknown;
453
+ request: ProjectedRenewalConfigurationV2;
454
+ state: WriteObservations;
455
+ }) {
456
+ const { request, state } = values;
457
+ assert.equal(Object.keys(request).length, 18);
458
+ assert.equal(data(values.initialOutput).status, "attach_acknowledged");
459
+ assert.equal(
460
+ data(values.preflightOutput).status,
461
+ "configure_preflight_consistent",
462
+ );
463
+ assert.equal(data(values.expectedReceipt).stage, "configure_acknowledged");
464
+ assert.deepEqual(
465
+ [
466
+ state.calls.length,
467
+ state.records.length,
468
+ state.sourceLoads,
469
+ state.pairLoads,
470
+ state.reserves,
471
+ state.coverage,
472
+ state.targetCalls,
473
+ ],
474
+ [0, 0, 0, 0, 0, 0, 0],
475
+ );
476
+ const raw = data(values.rawReceipt);
477
+ const events = [
478
+ { event: "dispatch", stage: "configure", request },
479
+ {
480
+ event: "response",
481
+ stage: "configure",
482
+ request,
483
+ body: raw.providerSnapshot,
484
+ transport: raw.transport,
485
+ },
486
+ {
487
+ event: "receipt",
488
+ stage: "configure",
489
+ request,
490
+ receipt: values.expectedReceipt,
491
+ },
492
+ ];
493
+ for (const [index, event] of events.entries()) {
494
+ const envelope = { sequence: index + 1, data: event };
495
+ const template = {
496
+ ...envelope,
497
+ binding: expectedBinding("unbound-qualification-event", envelope),
498
+ };
499
+ console.log(
500
+ JSON.stringify({
501
+ kind: "CONFIGURE_WRITER_PREREQUISITE_METRICS",
502
+ part: "C10-DATA-template-" + String(index + 1),
503
+ ...assertFit(template),
504
+ }),
505
+ );
506
+ }
507
+ for (const [part, value] of Object.entries(values))
508
+ if (!["request", "state"].includes(part))
509
+ console.log(
510
+ JSON.stringify({
511
+ kind: "CONFIGURE_WRITER_PREREQUISITE_METRICS",
512
+ part,
513
+ ...assertFit(value),
514
+ }),
515
+ );
516
+ console.log(
517
+ JSON.stringify({
518
+ kind: "CONFIGURE_WRITER_PREREQUISITES",
519
+ actualInitialACK: true,
520
+ actualOwnedPreflight: true,
521
+ actualDirectC9: true,
522
+ requestFields: 18,
523
+ generatedACKSlots: Object.prototype.hasOwnProperty.call(
524
+ values.expectedReceipt,
525
+ "defaultSettingsBinding",
526
+ )
527
+ ? 19
528
+ : 18,
529
+ preimageOracle: "independent-Node-C1-through-C9",
530
+ writeHTTP: 0,
531
+ writeRecords: 0,
532
+ targetCalls: 0,
533
+ C10TemplatesAreActualSinkEvidence: false,
534
+ operationalAuthority: false,
535
+ }),
536
+ );
537
+ }
@@ -0,0 +1,125 @@
1
+ import assert from "node:assert/strict";
2
+ import { webcrypto } from "node:crypto";
3
+ import { vi } from "vitest";
4
+
5
+ export function configureWriteBarriers() {
6
+ const pending: Promise<unknown>[] = [];
7
+ const waiting = new Map<
8
+ string,
9
+ {
10
+ entered: Promise<void>;
11
+ signal: () => void;
12
+ release: () => void;
13
+ released: Promise<void>;
14
+ }
15
+ >();
16
+ const cell = (key: string) => {
17
+ let value = waiting.get(key);
18
+ if (!value) {
19
+ let signal!: () => void, release!: () => void;
20
+ const entered = new Promise<void>((r) => {
21
+ signal = r;
22
+ });
23
+ const released = new Promise<void>((r) => {
24
+ release = r;
25
+ });
26
+ value = { entered, signal, release, released };
27
+ waiting.set(key, value);
28
+ }
29
+ return value;
30
+ };
31
+ const activeDigests = new Set<Promise<unknown>>();
32
+ return {
33
+ pending,
34
+ activeDigests,
35
+ async hold(key: string) {
36
+ const c = cell(key);
37
+ c.signal();
38
+ await c.released;
39
+ },
40
+ async entered(key: string, operation: Promise<unknown>) {
41
+ const settled = operation.then(
42
+ () => false,
43
+ () => false,
44
+ );
45
+ assert.equal(
46
+ await Promise.race([cell(key).entered.then(() => true), settled]),
47
+ true,
48
+ "WRITE_SETTLED_BEFORE_DECLARED_BARRIER",
49
+ );
50
+ },
51
+ release(key: string) {
52
+ cell(key).release();
53
+ },
54
+ async cleanup() {
55
+ try {
56
+ for (const c of waiting.values()) c.release();
57
+ await Promise.allSettled(pending);
58
+ assert.equal(activeDigests.size, 0);
59
+ } finally {
60
+ vi.doUnmock("../configure/transport.js");
61
+ vi.doUnmock("../acquisition/ownedAcquisition.js");
62
+ }
63
+ },
64
+ };
65
+ }
66
+
67
+ /** Real native digest receiver and arguments; observed continuations are all joined. */
68
+ export function installWriteDigestAccounting(
69
+ gates: ReturnType<typeof configureWriteBarriers>,
70
+ ) {
71
+ vi.stubGlobal("crypto", {
72
+ subtle: {
73
+ digest(...args: Parameters<typeof webcrypto.subtle.digest>) {
74
+ const [algorithm, input] = args;
75
+ assert.equal(
76
+ typeof algorithm === "string" ? algorithm : algorithm.name,
77
+ "SHA-256",
78
+ );
79
+ assert(ArrayBuffer.isView(input));
80
+ const tuple: unknown = JSON.parse(
81
+ new TextDecoder().decode(
82
+ new Uint8Array(input.buffer, input.byteOffset, input.byteLength),
83
+ ),
84
+ );
85
+ assert(Array.isArray(tuple));
86
+ // Public renewal bindings and C10 event digests use distinct fixed domains.
87
+ assert.equal(tuple.length, 4);
88
+ assert.equal(tuple[0], "betterstripe-renewal-binding");
89
+ assert.equal(tuple[1], 2);
90
+ assert.equal(typeof tuple[2], "string");
91
+ assert(
92
+ new Set([
93
+ "renewal",
94
+ "renewal-attach",
95
+ "renewal-attach-receipt",
96
+ "renewal-baseline",
97
+ "renewal-defaults",
98
+ "renewal-configure",
99
+ "renewal-configured-baseline",
100
+ "renewal-configured-defaults",
101
+ "renewal-configure-receipt",
102
+ "unbound-qualification-event",
103
+ ]).has(tuple[2]),
104
+ );
105
+ const actual = Reflect.apply(
106
+ webcrypto.subtle.digest,
107
+ webcrypto.subtle,
108
+ args,
109
+ ) as ReturnType<typeof webcrypto.subtle.digest>;
110
+ gates.activeDigests.add(actual);
111
+ gates.pending.push(
112
+ actual.then(
113
+ () => {
114
+ gates.activeDigests.delete(actual);
115
+ },
116
+ () => {
117
+ gates.activeDigests.delete(actual);
118
+ },
119
+ ),
120
+ );
121
+ return actual;
122
+ },
123
+ },
124
+ });
125
+ }