msw 2.15.0 → 3.0.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 (765) hide show
  1. package/README.md +8 -0
  2. package/cli/init.js +12 -9
  3. package/cli/invariant.js +2 -2
  4. package/lib/_chunks/attach-sibling-handlers.js +360 -0
  5. package/lib/_chunks/attach-sibling-handlers.js.map +1 -0
  6. package/lib/_chunks/colors.js +18 -0
  7. package/lib/_chunks/colors.js.map +1 -0
  8. package/lib/_chunks/cookie-store.js +348 -0
  9. package/lib/_chunks/cookie-store.js.map +1 -0
  10. package/lib/_chunks/execute-handlers.js +29 -0
  11. package/lib/_chunks/execute-handlers.js.map +1 -0
  12. package/lib/_chunks/handlers-controller.d.ts +262 -0
  13. package/lib/_chunks/has-ref-counted.js +9 -0
  14. package/lib/_chunks/has-ref-counted.js.map +1 -0
  15. package/lib/_chunks/http-handler.d.ts +72 -0
  16. package/lib/_chunks/http-handler.js +182 -0
  17. package/lib/_chunks/http-handler.js.map +1 -0
  18. package/lib/_chunks/http-response.js +137 -0
  19. package/lib/_chunks/http-response.js.map +1 -0
  20. package/lib/{core → _chunks}/http.d.ts +15 -18
  21. package/lib/_chunks/http.js +30 -0
  22. package/lib/_chunks/http.js.map +1 -0
  23. package/lib/_chunks/interceptor-source.d.ts +163 -0
  24. package/lib/_chunks/interceptor-source.js +756 -0
  25. package/lib/_chunks/interceptor-source.js.map +1 -0
  26. package/lib/_chunks/is-object.js +11 -0
  27. package/lib/_chunks/is-object.js.map +1 -0
  28. package/lib/_chunks/match-request-url.d.ts +14 -0
  29. package/lib/_chunks/request-handler.d.ts +295 -0
  30. package/lib/_chunks/request-handler.js +369 -0
  31. package/lib/_chunks/request-handler.js.map +1 -0
  32. package/lib/_chunks/shared-options.d.ts +20 -0
  33. package/lib/_chunks/sse.d.ts +95 -0
  34. package/lib/_chunks/sse.js +599 -0
  35. package/lib/_chunks/sse.js.map +1 -0
  36. package/lib/_chunks/symbols.js +22 -0
  37. package/lib/_chunks/symbols.js.map +1 -0
  38. package/lib/_chunks/websocket-upgrade.js +46 -0
  39. package/lib/_chunks/websocket-upgrade.js.map +1 -0
  40. package/lib/_chunks/ws.d.ts +133 -0
  41. package/lib/_chunks/ws.js +293 -0
  42. package/lib/_chunks/ws.js.map +1 -0
  43. package/lib/browser/index.d.ts +225 -96
  44. package/lib/browser/index.js +555 -3694
  45. package/lib/browser/index.js.map +1 -1
  46. package/lib/core/experimental/index.d.ts +3 -17
  47. package/lib/core/experimental/index.js +2 -38
  48. package/lib/core/index.d.ts +15 -27
  49. package/lib/core/index.js +15 -64
  50. package/lib/graphql/index.d.ts +550 -0
  51. package/lib/graphql/index.js +1244 -0
  52. package/lib/graphql/index.js.map +1 -0
  53. package/lib/http/index.d.ts +4 -0
  54. package/lib/http/index.js +4 -0
  55. package/lib/iife/index.js +35857 -28422
  56. package/lib/iife/index.js.map +1 -1
  57. package/lib/mockServiceWorker.js +185 -86
  58. package/lib/node/index.d.ts +79 -104
  59. package/lib/node/index.js +103 -201
  60. package/lib/node/index.js.map +1 -1
  61. package/lib/sse/index.d.ts +2 -0
  62. package/lib/sse/index.js +2 -0
  63. package/lib/{core → utils}/bypass.d.ts +5 -4
  64. package/lib/utils/bypass.js +41 -0
  65. package/lib/utils/bypass.js.map +1 -0
  66. package/lib/utils/delay.d.ts +15 -0
  67. package/lib/utils/delay.js +45 -0
  68. package/lib/utils/delay.js.map +1 -0
  69. package/lib/utils/get-clean-url-string.d.ts +9 -0
  70. package/lib/utils/get-clean-url-string.js +15 -0
  71. package/lib/utils/get-clean-url-string.js.map +1 -0
  72. package/lib/utils/get-response.d.ts +13 -0
  73. package/lib/utils/get-response.js +23 -0
  74. package/lib/utils/get-response.js.map +1 -0
  75. package/lib/utils/is-common-asset-request.d.ts +22 -0
  76. package/lib/utils/is-common-asset-request.js +31 -0
  77. package/lib/utils/is-common-asset-request.js.map +1 -0
  78. package/lib/utils/passthrough.d.ts +31 -0
  79. package/lib/utils/passthrough.js +41 -0
  80. package/lib/utils/passthrough.js.map +1 -0
  81. package/lib/vite/index.d.ts +44 -0
  82. package/lib/vite/index.js +90 -0
  83. package/lib/vite/index.js.map +1 -0
  84. package/lib/vite/runtime.d.ts +6 -0
  85. package/lib/vite/runtime.js +77 -0
  86. package/lib/vite/runtime.js.map +1 -0
  87. package/lib/ws/index.d.ts +4 -0
  88. package/lib/ws/index.js +4 -0
  89. package/package.json +93 -201
  90. package/src/browser/default-network-options.ts +31 -0
  91. package/src/browser/glossary.ts +11 -23
  92. package/src/browser/index.ts +5 -1
  93. package/src/browser/setup-worker.ts +15 -68
  94. package/src/browser/sources/fallback-http-source.ts +1 -1
  95. package/src/browser/sources/service-worker-source.ts +76 -69
  96. package/src/browser/tsconfig.browser.json +4 -2
  97. package/src/browser/utils/{deserializeRequest.ts → deserialize-request.ts} +3 -4
  98. package/src/browser/utils/{getAbsoluteWorkerUrl.test.ts → get-absolute-worker-url.test.ts} +3 -3
  99. package/src/browser/utils/get-worker-instance.ts +2 -2
  100. package/src/browser/utils/should-invalidate-worker.test.ts +11 -11
  101. package/src/browser/utils/should-invalidate-worker.ts +1 -1
  102. package/src/browser/utils/validate-worker-scope.ts +1 -1
  103. package/src/browser/utils/{workerChannel.ts → worker-channel.ts} +42 -20
  104. package/src/core/experimental/define-network.test.ts +43 -8
  105. package/src/core/experimental/define-network.ts +32 -13
  106. package/src/core/experimental/frames/http-frame.test.ts +15 -13
  107. package/src/core/experimental/frames/http-frame.ts +10 -9
  108. package/src/core/experimental/frames/websocket-frame.test.ts +129 -15
  109. package/src/core/experimental/frames/websocket-frame.ts +71 -20
  110. package/src/core/experimental/handlers-controller.test.ts +141 -34
  111. package/src/core/experimental/handlers-controller.ts +107 -30
  112. package/src/core/experimental/index.ts +1 -0
  113. package/src/core/experimental/on-unhandled-frame.test.ts +19 -19
  114. package/src/core/experimental/on-unhandled-frame.ts +7 -12
  115. package/src/core/experimental/request-utils.test.ts +4 -29
  116. package/src/core/experimental/request-utils.ts +0 -14
  117. package/src/core/experimental/sources/interceptor-source.ts +44 -29
  118. package/src/core/experimental/sources/network-source.test.ts +3 -3
  119. package/src/core/experimental/sources/network-source.ts +3 -3
  120. package/src/core/handlers/handler.ts +42 -0
  121. package/src/core/handlers/{RequestHandler.ts → request-handler.ts} +26 -41
  122. package/src/core/index.ts +35 -58
  123. package/src/core/shared-options.ts +21 -0
  124. package/src/core/type-utils.ts +18 -0
  125. package/src/core/utils/{cookieStore.ts → cookie-store.ts} +14 -9
  126. package/src/core/utils/{executeHandlers.ts → execute-handlers.ts} +2 -2
  127. package/src/core/utils/http-status-messages.ts +69 -0
  128. package/src/core/utils/internal/{attachSiblingHandlers.ts → attach-sibling-handlers.ts} +20 -0
  129. package/src/core/utils/internal/{devUtils.test.ts → dev-utils.test.ts} +3 -3
  130. package/src/core/utils/internal/{Disposable.ts → disposable.ts} +1 -1
  131. package/src/core/utils/internal/{getCallFrame.test.ts → get-call-frame.test.ts} +1 -1
  132. package/src/core/utils/internal/{getCallFrame.ts → get-call-frame.ts} +1 -1
  133. package/src/core/utils/internal/{hasRefCounted.test.ts → has-ref-counted.test.ts} +4 -4
  134. package/src/core/utils/internal/{hasRefCounted.ts → has-ref-counted.ts} +1 -1
  135. package/src/core/utils/internal/{isIterable.test.ts → is-iterable.test.ts} +1 -1
  136. package/src/core/utils/internal/is-iterable.ts +16 -0
  137. package/src/core/utils/internal/{isObject.test.ts → is-object.test.ts} +1 -1
  138. package/src/core/utils/internal/{isStringEqual.test.ts → is-string-equal.test.ts} +7 -7
  139. package/src/core/utils/internal/{jsonParse.test.ts → json-parse.test.ts} +1 -1
  140. package/src/core/utils/internal/observe-response-body-stream.test.ts +7 -7
  141. package/src/core/utils/internal/observe-response-body-stream.ts +3 -4
  142. package/src/core/utils/internal/{parseMultipartData.test.ts → parse-multipart-data.test.ts} +1 -1
  143. package/src/core/utils/internal/{parseMultipartData.ts → parse-multipart-data.ts} +1 -1
  144. package/src/core/utils/internal/{toReadonlyArray.test.ts → to-readonly-array.test.ts} +4 -4
  145. package/src/core/utils/logging/colors.ts +13 -0
  146. package/src/core/utils/logging/{getStatusCodeColor.test.ts → get-status-code-color.test.ts} +1 -1
  147. package/src/core/utils/logging/{getTimestamp.test.ts → get-timestamp.test.ts} +1 -1
  148. package/src/core/utils/logging/{serializeRequest.test.ts → serialize-request.test.ts} +1 -1
  149. package/src/core/utils/logging/{serializeResponse.test.ts → serialize-response.test.ts} +8 -10
  150. package/src/core/utils/logging/{serializeResponse.ts → serialize-response.ts} +2 -4
  151. package/src/core/utils/matching/match-request-url.test.ts +90 -0
  152. package/src/core/utils/matching/match-request-url.ts +45 -0
  153. package/src/core/utils/matching/{normalizePath.node.test.ts → normalize-path.node.test.ts} +2 -4
  154. package/src/core/utils/matching/{normalizePath.test.ts → normalize-path.test.ts} +2 -4
  155. package/src/core/utils/matching/{normalizePath.ts → normalize-path.ts} +8 -5
  156. package/src/core/utils/request/{getAllAcceptedMimeTypes.test.ts → get-all-accepted-mime-types.test.ts} +14 -14
  157. package/src/core/utils/request/get-request-cookies.ts +76 -0
  158. package/src/core/utils/request/store-response-cookies.ts +15 -0
  159. package/src/core/utils/request/{toPublicUrl.node.test.ts → to-public-url.node.test.ts} +1 -1
  160. package/src/core/utils/request/{toPublicUrl.test.ts → to-public-url.test.ts} +2 -2
  161. package/src/core/utils/{HttpResponse/decorators.ts → response-decorators.ts} +6 -8
  162. package/src/core/utils/url/{getAbsoluteUrl.node.test.ts → get-absolute-url.node.test.ts} +5 -7
  163. package/src/core/utils/url/{getAbsoluteUrl.test.ts → get-absolute-url.test.ts} +7 -7
  164. package/src/core/utils/url/{getAbsoluteUrl.ts → get-absolute-url.ts} +1 -1
  165. package/src/core/utils/url/is-absolute-url.test.ts +30 -0
  166. package/src/{core/handlers/GraphQLHandler.test.ts → graphql/graphql-handler.test.ts} +37 -36
  167. package/src/{core/handlers/GraphQLHandler.ts → graphql/graphql-handler.ts} +54 -41
  168. package/src/graphql/graphql-subscription-event.ts +39 -0
  169. package/src/graphql/graphql-subscription.test.ts +208 -0
  170. package/src/graphql/graphql-subscription.ts +1487 -0
  171. package/src/graphql/graphql.test.ts +14 -0
  172. package/src/graphql/graphql.ts +179 -0
  173. package/src/graphql/index.ts +34 -0
  174. package/src/{core/utils/internal/parseGraphQLRequest.test.ts → graphql/parse-graphql-request.test.ts} +47 -6
  175. package/src/{core/utils/internal/parseGraphQLRequest.ts → graphql/parse-graphql-request.ts} +59 -32
  176. package/src/{core/handlers/HttpHandler.test.ts → http/http-handler.test.ts} +22 -22
  177. package/src/{core/handlers/HttpHandler.ts → http/http-handler.ts} +16 -18
  178. package/src/{core/HttpResponse.test.ts → http/http-response.test.ts} +25 -27
  179. package/src/{core/HttpResponse.ts → http/http-response.ts} +15 -17
  180. package/src/{core → http}/http.ts +7 -7
  181. package/src/http/index.test.ts +19 -0
  182. package/src/http/index.ts +22 -0
  183. package/src/http/symbols.ts +19 -0
  184. package/src/iife/index.ts +2 -0
  185. package/src/mockServiceWorker.js +183 -84
  186. package/src/node/async-handlers-controller.test.ts +4 -4
  187. package/src/node/glossary.ts +8 -4
  188. package/src/node/index.ts +1 -6
  189. package/src/node/setup-server-common.ts +16 -73
  190. package/src/node/setup-server.ts +9 -40
  191. package/src/sse/index.test.ts +14 -0
  192. package/src/sse/index.ts +7 -0
  193. package/src/{core → sse}/sse.ts +25 -21
  194. package/src/tsconfig.core.build.json +5 -1
  195. package/src/tsconfig.core.json +8 -1
  196. package/src/tsconfig.node.json +1 -1
  197. package/src/tsconfig.src.json +1 -1
  198. package/src/{core → utils}/bypass.test.ts +22 -5
  199. package/src/{core → utils}/bypass.ts +11 -0
  200. package/src/{core → utils}/delay.ts +5 -5
  201. package/src/utils/get-clean-url-string.test.ts +24 -0
  202. package/src/utils/get-clean-url-string.ts +16 -0
  203. package/src/{core/getResponse.test.ts → utils/get-response.test.ts} +9 -9
  204. package/src/{core/getResponse.ts → utils/get-response.ts} +2 -2
  205. package/src/{core/isCommonAssetRequest.ts → utils/is-common-asset-request.ts} +4 -3
  206. package/src/utils/passthrough.test.ts +41 -0
  207. package/src/utils/passthrough.ts +46 -0
  208. package/src/vite/client.d.ts +16 -0
  209. package/src/vite/index.ts +4 -0
  210. package/src/vite/options.d.ts +5 -0
  211. package/src/vite/plugin.test.ts +918 -0
  212. package/src/vite/plugin.ts +133 -0
  213. package/src/vite/runtime.ts +117 -0
  214. package/src/vite/tsconfig.build.json +7 -0
  215. package/src/ws/index.ts +23 -0
  216. package/src/{core/ws/utils/attachWebSocketLogger.ts → ws/utils/attach-websocket-logger.ts} +45 -23
  217. package/src/{core/ws/utils/getMessageLength.test.ts → ws/utils/get-message-length.test.ts} +4 -4
  218. package/src/{core/ws/utils/getMessageLength.ts → ws/utils/get-message-length.ts} +1 -1
  219. package/src/{core/ws/utils/getPublicData.test.ts → ws/utils/get-public-data.test.ts} +7 -7
  220. package/src/ws/utils/get-public-data.ts +23 -0
  221. package/src/{core/ws/utils/truncateMessage.test.ts → ws/utils/truncate-message.test.ts} +3 -3
  222. package/src/{core/ws/WebSocketClientManager.test.ts → ws/websocket-client-manager.test.ts} +8 -9
  223. package/src/{core/ws/WebSocketClientManager.ts → ws/websocket-client-manager.ts} +24 -28
  224. package/src/{core/ws/WebSocketClientStore.ts → ws/websocket-client-store.ts} +2 -2
  225. package/src/{core/handlers/WebSocketHandler.test.ts → ws/websocket-handler.test.ts} +15 -15
  226. package/src/{core/handlers/WebSocketHandler.ts → ws/websocket-handler.ts} +144 -32
  227. package/src/{core/ws/WebSocketIndexedDBClientStore.ts → ws/websocket-indexeddb-client-store.ts} +12 -13
  228. package/src/{core/ws/WebSocketMemoryClientStore.ts → ws/websocket-memory-client-store.ts} +4 -4
  229. package/src/ws/websocket-upgrade.ts +83 -0
  230. package/src/{core → ws}/ws.test.ts +3 -4
  231. package/src/{core → ws}/ws.ts +106 -53
  232. package/browser/package.json +0 -31
  233. package/cli/package.json +0 -3
  234. package/config/package.json +0 -3
  235. package/config/scripts/postinstall.js +0 -36
  236. package/lib/browser/index.d.mts +0 -112
  237. package/lib/browser/index.mjs +0 -3706
  238. package/lib/browser/index.mjs.map +0 -1
  239. package/lib/core/HttpResponse-BE_Y2Ak9.d.mts +0 -389
  240. package/lib/core/HttpResponse-DL-P1EeG.d.ts +0 -389
  241. package/lib/core/HttpResponse.d.mts +0 -6
  242. package/lib/core/HttpResponse.d.ts +0 -6
  243. package/lib/core/HttpResponse.js +0 -176
  244. package/lib/core/HttpResponse.js.map +0 -1
  245. package/lib/core/HttpResponse.mjs +0 -159
  246. package/lib/core/HttpResponse.mjs.map +0 -1
  247. package/lib/core/bypass.d.mts +0 -16
  248. package/lib/core/bypass.js +0 -42
  249. package/lib/core/bypass.js.map +0 -1
  250. package/lib/core/bypass.mjs +0 -22
  251. package/lib/core/bypass.mjs.map +0 -1
  252. package/lib/core/delay.d.mts +0 -18
  253. package/lib/core/delay.d.ts +0 -18
  254. package/lib/core/delay.js +0 -77
  255. package/lib/core/delay.js.map +0 -1
  256. package/lib/core/delay.mjs +0 -57
  257. package/lib/core/delay.mjs.map +0 -1
  258. package/lib/core/experimental/compat.d.mts +0 -17
  259. package/lib/core/experimental/compat.d.ts +0 -17
  260. package/lib/core/experimental/compat.js +0 -55
  261. package/lib/core/experimental/compat.js.map +0 -1
  262. package/lib/core/experimental/compat.mjs +0 -37
  263. package/lib/core/experimental/compat.mjs.map +0 -1
  264. package/lib/core/experimental/define-network.d.mts +0 -75
  265. package/lib/core/experimental/define-network.d.ts +0 -75
  266. package/lib/core/experimental/define-network.js +0 -134
  267. package/lib/core/experimental/define-network.js.map +0 -1
  268. package/lib/core/experimental/define-network.mjs +0 -119
  269. package/lib/core/experimental/define-network.mjs.map +0 -1
  270. package/lib/core/experimental/frames/http-frame.d.mts +0 -77
  271. package/lib/core/experimental/frames/http-frame.d.ts +0 -77
  272. package/lib/core/experimental/frames/http-frame.js +0 -197
  273. package/lib/core/experimental/frames/http-frame.js.map +0 -1
  274. package/lib/core/experimental/frames/http-frame.mjs +0 -181
  275. package/lib/core/experimental/frames/http-frame.mjs.map +0 -1
  276. package/lib/core/experimental/frames/network-frame.d.mts +0 -12
  277. package/lib/core/experimental/frames/network-frame.d.ts +0 -12
  278. package/lib/core/experimental/frames/network-frame.js +0 -35
  279. package/lib/core/experimental/frames/network-frame.js.map +0 -1
  280. package/lib/core/experimental/frames/network-frame.mjs +0 -15
  281. package/lib/core/experimental/frames/network-frame.mjs.map +0 -1
  282. package/lib/core/experimental/frames/websocket-frame.d.mts +0 -55
  283. package/lib/core/experimental/frames/websocket-frame.d.ts +0 -55
  284. package/lib/core/experimental/frames/websocket-frame.js +0 -131
  285. package/lib/core/experimental/frames/websocket-frame.js.map +0 -1
  286. package/lib/core/experimental/frames/websocket-frame.mjs +0 -118
  287. package/lib/core/experimental/frames/websocket-frame.mjs.map +0 -1
  288. package/lib/core/experimental/handlers-controller.d.mts +0 -36
  289. package/lib/core/experimental/handlers-controller.d.ts +0 -36
  290. package/lib/core/experimental/handlers-controller.js +0 -146
  291. package/lib/core/experimental/handlers-controller.js.map +0 -1
  292. package/lib/core/experimental/handlers-controller.mjs +0 -126
  293. package/lib/core/experimental/handlers-controller.mjs.map +0 -1
  294. package/lib/core/experimental/index.d.mts +0 -17
  295. package/lib/core/experimental/index.js.map +0 -1
  296. package/lib/core/experimental/index.mjs +0 -27
  297. package/lib/core/experimental/index.mjs.map +0 -1
  298. package/lib/core/experimental/on-unhandled-frame.d.mts +0 -12
  299. package/lib/core/experimental/on-unhandled-frame.d.ts +0 -12
  300. package/lib/core/experimental/on-unhandled-frame.js +0 -91
  301. package/lib/core/experimental/on-unhandled-frame.js.map +0 -1
  302. package/lib/core/experimental/on-unhandled-frame.mjs +0 -71
  303. package/lib/core/experimental/on-unhandled-frame.mjs.map +0 -1
  304. package/lib/core/experimental/request-utils.d.mts +0 -12
  305. package/lib/core/experimental/request-utils.d.ts +0 -12
  306. package/lib/core/experimental/request-utils.js +0 -50
  307. package/lib/core/experimental/request-utils.js.map +0 -1
  308. package/lib/core/experimental/request-utils.mjs +0 -30
  309. package/lib/core/experimental/request-utils.mjs.map +0 -1
  310. package/lib/core/experimental/setup-api.d.mts +0 -33
  311. package/lib/core/experimental/setup-api.d.ts +0 -33
  312. package/lib/core/experimental/setup-api.js +0 -58
  313. package/lib/core/experimental/setup-api.js.map +0 -1
  314. package/lib/core/experimental/setup-api.mjs +0 -40
  315. package/lib/core/experimental/setup-api.mjs.map +0 -1
  316. package/lib/core/experimental/sources/interceptor-source.d.mts +0 -28
  317. package/lib/core/experimental/sources/interceptor-source.d.ts +0 -28
  318. package/lib/core/experimental/sources/interceptor-source.js +0 -155
  319. package/lib/core/experimental/sources/interceptor-source.js.map +0 -1
  320. package/lib/core/experimental/sources/interceptor-source.mjs +0 -135
  321. package/lib/core/experimental/sources/interceptor-source.mjs.map +0 -1
  322. package/lib/core/experimental/sources/network-source.d.mts +0 -31
  323. package/lib/core/experimental/sources/network-source.d.ts +0 -31
  324. package/lib/core/experimental/sources/network-source.js +0 -51
  325. package/lib/core/experimental/sources/network-source.js.map +0 -1
  326. package/lib/core/experimental/sources/network-source.mjs +0 -32
  327. package/lib/core/experimental/sources/network-source.mjs.map +0 -1
  328. package/lib/core/getResponse.d.mts +0 -18
  329. package/lib/core/getResponse.d.ts +0 -18
  330. package/lib/core/getResponse.js +0 -35
  331. package/lib/core/getResponse.js.map +0 -1
  332. package/lib/core/getResponse.mjs +0 -17
  333. package/lib/core/getResponse.mjs.map +0 -1
  334. package/lib/core/graphql.d.mts +0 -76
  335. package/lib/core/graphql.d.ts +0 -76
  336. package/lib/core/graphql.js +0 -91
  337. package/lib/core/graphql.js.map +0 -1
  338. package/lib/core/graphql.mjs +0 -74
  339. package/lib/core/graphql.mjs.map +0 -1
  340. package/lib/core/handlers/GraphQLHandler.d.mts +0 -6
  341. package/lib/core/handlers/GraphQLHandler.d.ts +0 -6
  342. package/lib/core/handlers/GraphQLHandler.js +0 -232
  343. package/lib/core/handlers/GraphQLHandler.js.map +0 -1
  344. package/lib/core/handlers/GraphQLHandler.mjs +0 -221
  345. package/lib/core/handlers/GraphQLHandler.mjs.map +0 -1
  346. package/lib/core/handlers/HttpHandler.d.mts +0 -75
  347. package/lib/core/handlers/HttpHandler.d.ts +0 -75
  348. package/lib/core/handlers/HttpHandler.js +0 -129
  349. package/lib/core/handlers/HttpHandler.js.map +0 -1
  350. package/lib/core/handlers/HttpHandler.mjs +0 -113
  351. package/lib/core/handlers/HttpHandler.mjs.map +0 -1
  352. package/lib/core/handlers/RequestHandler.d.mts +0 -6
  353. package/lib/core/handlers/RequestHandler.d.ts +0 -6
  354. package/lib/core/handlers/RequestHandler.js +0 -365
  355. package/lib/core/handlers/RequestHandler.js.map +0 -1
  356. package/lib/core/handlers/RequestHandler.mjs +0 -348
  357. package/lib/core/handlers/RequestHandler.mjs.map +0 -1
  358. package/lib/core/handlers/WebSocketHandler.d.mts +0 -49
  359. package/lib/core/handlers/WebSocketHandler.d.ts +0 -49
  360. package/lib/core/handlers/WebSocketHandler.js +0 -178
  361. package/lib/core/handlers/WebSocketHandler.js.map +0 -1
  362. package/lib/core/handlers/WebSocketHandler.mjs +0 -160
  363. package/lib/core/handlers/WebSocketHandler.mjs.map +0 -1
  364. package/lib/core/http.d.mts +0 -31
  365. package/lib/core/http.js +0 -41
  366. package/lib/core/http.js.map +0 -1
  367. package/lib/core/http.mjs +0 -25
  368. package/lib/core/http.mjs.map +0 -1
  369. package/lib/core/index.d.mts +0 -27
  370. package/lib/core/index.js.map +0 -1
  371. package/lib/core/index.mjs +0 -52
  372. package/lib/core/index.mjs.map +0 -1
  373. package/lib/core/isCommonAssetRequest.d.mts +0 -20
  374. package/lib/core/isCommonAssetRequest.d.ts +0 -20
  375. package/lib/core/isCommonAssetRequest.js +0 -42
  376. package/lib/core/isCommonAssetRequest.js.map +0 -1
  377. package/lib/core/isCommonAssetRequest.mjs +0 -22
  378. package/lib/core/isCommonAssetRequest.mjs.map +0 -1
  379. package/lib/core/on-unhandled-frame-0KmwUmeV.d.ts +0 -56
  380. package/lib/core/on-unhandled-frame-gkokW4Rr.d.mts +0 -56
  381. package/lib/core/passthrough.d.mts +0 -24
  382. package/lib/core/passthrough.d.ts +0 -24
  383. package/lib/core/passthrough.js +0 -33
  384. package/lib/core/passthrough.js.map +0 -1
  385. package/lib/core/passthrough.mjs +0 -13
  386. package/lib/core/passthrough.mjs.map +0 -1
  387. package/lib/core/sharedOptions.d.mts +0 -68
  388. package/lib/core/sharedOptions.d.ts +0 -68
  389. package/lib/core/sharedOptions.js +0 -17
  390. package/lib/core/sharedOptions.js.map +0 -1
  391. package/lib/core/sharedOptions.mjs +0 -1
  392. package/lib/core/sharedOptions.mjs.map +0 -1
  393. package/lib/core/sse.d.mts +0 -102
  394. package/lib/core/sse.d.ts +0 -102
  395. package/lib/core/sse.js +0 -690
  396. package/lib/core/sse.js.map +0 -1
  397. package/lib/core/sse.mjs +0 -672
  398. package/lib/core/sse.mjs.map +0 -1
  399. package/lib/core/typeUtils.d.mts +0 -12
  400. package/lib/core/typeUtils.d.ts +0 -12
  401. package/lib/core/typeUtils.js +0 -17
  402. package/lib/core/typeUtils.js.map +0 -1
  403. package/lib/core/typeUtils.mjs +0 -1
  404. package/lib/core/typeUtils.mjs.map +0 -1
  405. package/lib/core/utils/HttpResponse/decorators.d.mts +0 -22
  406. package/lib/core/utils/HttpResponse/decorators.d.ts +0 -22
  407. package/lib/core/utils/HttpResponse/decorators.js +0 -84
  408. package/lib/core/utils/HttpResponse/decorators.js.map +0 -1
  409. package/lib/core/utils/HttpResponse/decorators.mjs +0 -54
  410. package/lib/core/utils/HttpResponse/decorators.mjs.map +0 -1
  411. package/lib/core/utils/cookieStore.d.mts +0 -13
  412. package/lib/core/utils/cookieStore.d.ts +0 -13
  413. package/lib/core/utils/cookieStore.js +0 -90
  414. package/lib/core/utils/cookieStore.js.map +0 -1
  415. package/lib/core/utils/cookieStore.mjs +0 -74
  416. package/lib/core/utils/cookieStore.mjs.map +0 -1
  417. package/lib/core/utils/executeHandlers.d.mts +0 -6
  418. package/lib/core/utils/executeHandlers.d.ts +0 -6
  419. package/lib/core/utils/executeHandlers.js +0 -51
  420. package/lib/core/utils/executeHandlers.js.map +0 -1
  421. package/lib/core/utils/executeHandlers.mjs +0 -31
  422. package/lib/core/utils/executeHandlers.mjs.map +0 -1
  423. package/lib/core/utils/handleRequest.d.mts +0 -30
  424. package/lib/core/utils/handleRequest.d.ts +0 -30
  425. package/lib/core/utils/handleRequest.js +0 -76
  426. package/lib/core/utils/handleRequest.js.map +0 -1
  427. package/lib/core/utils/handleRequest.mjs +0 -58
  428. package/lib/core/utils/handleRequest.mjs.map +0 -1
  429. package/lib/core/utils/internal/Disposable.d.mts +0 -7
  430. package/lib/core/utils/internal/Disposable.d.ts +0 -7
  431. package/lib/core/utils/internal/Disposable.js +0 -51
  432. package/lib/core/utils/internal/Disposable.js.map +0 -1
  433. package/lib/core/utils/internal/Disposable.mjs +0 -31
  434. package/lib/core/utils/internal/Disposable.mjs.map +0 -1
  435. package/lib/core/utils/internal/attachSiblingHandlers.d.mts +0 -15
  436. package/lib/core/utils/internal/attachSiblingHandlers.d.ts +0 -15
  437. package/lib/core/utils/internal/attachSiblingHandlers.js +0 -44
  438. package/lib/core/utils/internal/attachSiblingHandlers.js.map +0 -1
  439. package/lib/core/utils/internal/attachSiblingHandlers.mjs +0 -24
  440. package/lib/core/utils/internal/attachSiblingHandlers.mjs.map +0 -1
  441. package/lib/core/utils/internal/checkGlobals.d.mts +0 -3
  442. package/lib/core/utils/internal/checkGlobals.d.ts +0 -3
  443. package/lib/core/utils/internal/checkGlobals.js +0 -34
  444. package/lib/core/utils/internal/checkGlobals.js.map +0 -1
  445. package/lib/core/utils/internal/checkGlobals.mjs +0 -14
  446. package/lib/core/utils/internal/checkGlobals.mjs.map +0 -1
  447. package/lib/core/utils/internal/devUtils.d.mts +0 -28
  448. package/lib/core/utils/internal/devUtils.d.ts +0 -28
  449. package/lib/core/utils/internal/devUtils.js +0 -48
  450. package/lib/core/utils/internal/devUtils.js.map +0 -1
  451. package/lib/core/utils/internal/devUtils.mjs +0 -28
  452. package/lib/core/utils/internal/devUtils.mjs.map +0 -1
  453. package/lib/core/utils/internal/getCallFrame.d.mts +0 -6
  454. package/lib/core/utils/internal/getCallFrame.d.ts +0 -6
  455. package/lib/core/utils/internal/getCallFrame.js +0 -41
  456. package/lib/core/utils/internal/getCallFrame.js.map +0 -1
  457. package/lib/core/utils/internal/getCallFrame.mjs +0 -21
  458. package/lib/core/utils/internal/getCallFrame.mjs.map +0 -1
  459. package/lib/core/utils/internal/hasRefCounted.d.mts +0 -3
  460. package/lib/core/utils/internal/hasRefCounted.d.ts +0 -3
  461. package/lib/core/utils/internal/hasRefCounted.js +0 -34
  462. package/lib/core/utils/internal/hasRefCounted.js.map +0 -1
  463. package/lib/core/utils/internal/hasRefCounted.mjs +0 -14
  464. package/lib/core/utils/internal/hasRefCounted.mjs.map +0 -1
  465. package/lib/core/utils/internal/isHandlerKind.d.mts +0 -19
  466. package/lib/core/utils/internal/isHandlerKind.d.ts +0 -19
  467. package/lib/core/utils/internal/isHandlerKind.js +0 -30
  468. package/lib/core/utils/internal/isHandlerKind.js.map +0 -1
  469. package/lib/core/utils/internal/isHandlerKind.mjs +0 -10
  470. package/lib/core/utils/internal/isHandlerKind.mjs.map +0 -1
  471. package/lib/core/utils/internal/isIterable.d.mts +0 -20
  472. package/lib/core/utils/internal/isIterable.d.ts +0 -20
  473. package/lib/core/utils/internal/isIterable.js +0 -30
  474. package/lib/core/utils/internal/isIterable.js.map +0 -1
  475. package/lib/core/utils/internal/isIterable.mjs +0 -10
  476. package/lib/core/utils/internal/isIterable.mjs.map +0 -1
  477. package/lib/core/utils/internal/isObject.d.mts +0 -6
  478. package/lib/core/utils/internal/isObject.d.ts +0 -6
  479. package/lib/core/utils/internal/isObject.js +0 -27
  480. package/lib/core/utils/internal/isObject.js.map +0 -1
  481. package/lib/core/utils/internal/isObject.mjs +0 -7
  482. package/lib/core/utils/internal/isObject.mjs.map +0 -1
  483. package/lib/core/utils/internal/isStringEqual.d.mts +0 -6
  484. package/lib/core/utils/internal/isStringEqual.d.ts +0 -6
  485. package/lib/core/utils/internal/isStringEqual.js +0 -27
  486. package/lib/core/utils/internal/isStringEqual.js.map +0 -1
  487. package/lib/core/utils/internal/isStringEqual.mjs +0 -7
  488. package/lib/core/utils/internal/isStringEqual.mjs.map +0 -1
  489. package/lib/core/utils/internal/jsonParse.d.mts +0 -7
  490. package/lib/core/utils/internal/jsonParse.d.ts +0 -7
  491. package/lib/core/utils/internal/jsonParse.js +0 -31
  492. package/lib/core/utils/internal/jsonParse.js.map +0 -1
  493. package/lib/core/utils/internal/jsonParse.mjs +0 -11
  494. package/lib/core/utils/internal/jsonParse.mjs.map +0 -1
  495. package/lib/core/utils/internal/mergeRight.d.mts +0 -7
  496. package/lib/core/utils/internal/mergeRight.d.ts +0 -7
  497. package/lib/core/utils/internal/mergeRight.js +0 -43
  498. package/lib/core/utils/internal/mergeRight.js.map +0 -1
  499. package/lib/core/utils/internal/mergeRight.mjs +0 -23
  500. package/lib/core/utils/internal/mergeRight.mjs.map +0 -1
  501. package/lib/core/utils/internal/observe-response-body-stream.d.mts +0 -18
  502. package/lib/core/utils/internal/observe-response-body-stream.d.ts +0 -18
  503. package/lib/core/utils/internal/observe-response-body-stream.js +0 -64
  504. package/lib/core/utils/internal/observe-response-body-stream.js.map +0 -1
  505. package/lib/core/utils/internal/observe-response-body-stream.mjs +0 -44
  506. package/lib/core/utils/internal/observe-response-body-stream.mjs.map +0 -1
  507. package/lib/core/utils/internal/parseGraphQLRequest.d.mts +0 -6
  508. package/lib/core/utils/internal/parseGraphQLRequest.d.ts +0 -6
  509. package/lib/core/utils/internal/parseGraphQLRequest.js +0 -146
  510. package/lib/core/utils/internal/parseGraphQLRequest.js.map +0 -1
  511. package/lib/core/utils/internal/parseGraphQLRequest.mjs +0 -129
  512. package/lib/core/utils/internal/parseGraphQLRequest.mjs.map +0 -1
  513. package/lib/core/utils/internal/parseMultipartData.d.mts +0 -14
  514. package/lib/core/utils/internal/parseMultipartData.d.ts +0 -14
  515. package/lib/core/utils/internal/parseMultipartData.js +0 -84
  516. package/lib/core/utils/internal/parseMultipartData.js.map +0 -1
  517. package/lib/core/utils/internal/parseMultipartData.mjs +0 -64
  518. package/lib/core/utils/internal/parseMultipartData.mjs.map +0 -1
  519. package/lib/core/utils/internal/pipeEvents.d.mts +0 -8
  520. package/lib/core/utils/internal/pipeEvents.d.ts +0 -8
  521. package/lib/core/utils/internal/pipeEvents.js +0 -37
  522. package/lib/core/utils/internal/pipeEvents.js.map +0 -1
  523. package/lib/core/utils/internal/pipeEvents.mjs +0 -17
  524. package/lib/core/utils/internal/pipeEvents.mjs.map +0 -1
  525. package/lib/core/utils/internal/toReadonlyArray.d.mts +0 -6
  526. package/lib/core/utils/internal/toReadonlyArray.d.ts +0 -6
  527. package/lib/core/utils/internal/toReadonlyArray.js +0 -29
  528. package/lib/core/utils/internal/toReadonlyArray.js.map +0 -1
  529. package/lib/core/utils/internal/toReadonlyArray.mjs +0 -9
  530. package/lib/core/utils/internal/toReadonlyArray.mjs.map +0 -1
  531. package/lib/core/utils/internal/tryCatch.d.mts +0 -3
  532. package/lib/core/utils/internal/tryCatch.d.ts +0 -3
  533. package/lib/core/utils/internal/tryCatch.js +0 -32
  534. package/lib/core/utils/internal/tryCatch.js.map +0 -1
  535. package/lib/core/utils/internal/tryCatch.mjs +0 -12
  536. package/lib/core/utils/internal/tryCatch.mjs.map +0 -1
  537. package/lib/core/utils/logging/getStatusCodeColor.d.mts +0 -11
  538. package/lib/core/utils/logging/getStatusCodeColor.d.ts +0 -11
  539. package/lib/core/utils/logging/getStatusCodeColor.js +0 -40
  540. package/lib/core/utils/logging/getStatusCodeColor.js.map +0 -1
  541. package/lib/core/utils/logging/getStatusCodeColor.mjs +0 -20
  542. package/lib/core/utils/logging/getStatusCodeColor.mjs.map +0 -1
  543. package/lib/core/utils/logging/getTimestamp.d.mts +0 -9
  544. package/lib/core/utils/logging/getTimestamp.d.ts +0 -9
  545. package/lib/core/utils/logging/getTimestamp.js +0 -32
  546. package/lib/core/utils/logging/getTimestamp.js.map +0 -1
  547. package/lib/core/utils/logging/getTimestamp.mjs +0 -12
  548. package/lib/core/utils/logging/getTimestamp.mjs.map +0 -1
  549. package/lib/core/utils/logging/serializeRequest.d.mts +0 -12
  550. package/lib/core/utils/logging/serializeRequest.d.ts +0 -12
  551. package/lib/core/utils/logging/serializeRequest.js +0 -34
  552. package/lib/core/utils/logging/serializeRequest.js.map +0 -1
  553. package/lib/core/utils/logging/serializeRequest.mjs +0 -14
  554. package/lib/core/utils/logging/serializeRequest.mjs.map +0 -1
  555. package/lib/core/utils/logging/serializeResponse.d.mts +0 -9
  556. package/lib/core/utils/logging/serializeResponse.d.ts +0 -9
  557. package/lib/core/utils/logging/serializeResponse.js +0 -48
  558. package/lib/core/utils/logging/serializeResponse.js.map +0 -1
  559. package/lib/core/utils/logging/serializeResponse.mjs +0 -18
  560. package/lib/core/utils/logging/serializeResponse.mjs.map +0 -1
  561. package/lib/core/utils/matching/matchRequestUrl.d.mts +0 -20
  562. package/lib/core/utils/matching/matchRequestUrl.d.ts +0 -20
  563. package/lib/core/utils/matching/matchRequestUrl.js +0 -55
  564. package/lib/core/utils/matching/matchRequestUrl.js.map +0 -1
  565. package/lib/core/utils/matching/matchRequestUrl.mjs +0 -35
  566. package/lib/core/utils/matching/matchRequestUrl.mjs.map +0 -1
  567. package/lib/core/utils/matching/normalizePath.d.mts +0 -13
  568. package/lib/core/utils/matching/normalizePath.d.ts +0 -13
  569. package/lib/core/utils/matching/normalizePath.js +0 -33
  570. package/lib/core/utils/matching/normalizePath.js.map +0 -1
  571. package/lib/core/utils/matching/normalizePath.mjs +0 -13
  572. package/lib/core/utils/matching/normalizePath.mjs.map +0 -1
  573. package/lib/core/utils/request/getAllAcceptedMimeTypes.d.mts +0 -14
  574. package/lib/core/utils/request/getAllAcceptedMimeTypes.d.ts +0 -14
  575. package/lib/core/utils/request/getAllAcceptedMimeTypes.js +0 -61
  576. package/lib/core/utils/request/getAllAcceptedMimeTypes.js.map +0 -1
  577. package/lib/core/utils/request/getAllAcceptedMimeTypes.mjs +0 -41
  578. package/lib/core/utils/request/getAllAcceptedMimeTypes.mjs.map +0 -1
  579. package/lib/core/utils/request/getRequestCookies.d.mts +0 -3
  580. package/lib/core/utils/request/getRequestCookies.d.ts +0 -3
  581. package/lib/core/utils/request/getRequestCookies.js +0 -79
  582. package/lib/core/utils/request/getRequestCookies.js.map +0 -1
  583. package/lib/core/utils/request/getRequestCookies.mjs +0 -62
  584. package/lib/core/utils/request/getRequestCookies.mjs.map +0 -1
  585. package/lib/core/utils/request/onUnhandledRequest.d.mts +0 -9
  586. package/lib/core/utils/request/onUnhandledRequest.d.ts +0 -9
  587. package/lib/core/utils/request/onUnhandledRequest.js +0 -76
  588. package/lib/core/utils/request/onUnhandledRequest.js.map +0 -1
  589. package/lib/core/utils/request/onUnhandledRequest.mjs +0 -56
  590. package/lib/core/utils/request/onUnhandledRequest.mjs.map +0 -1
  591. package/lib/core/utils/request/storeResponseCookies.d.mts +0 -3
  592. package/lib/core/utils/request/storeResponseCookies.d.ts +0 -3
  593. package/lib/core/utils/request/storeResponseCookies.js +0 -32
  594. package/lib/core/utils/request/storeResponseCookies.js.map +0 -1
  595. package/lib/core/utils/request/storeResponseCookies.mjs +0 -12
  596. package/lib/core/utils/request/storeResponseCookies.mjs.map +0 -1
  597. package/lib/core/utils/request/toPublicUrl.d.mts +0 -7
  598. package/lib/core/utils/request/toPublicUrl.d.ts +0 -7
  599. package/lib/core/utils/request/toPublicUrl.js +0 -31
  600. package/lib/core/utils/request/toPublicUrl.js.map +0 -1
  601. package/lib/core/utils/request/toPublicUrl.mjs +0 -11
  602. package/lib/core/utils/request/toPublicUrl.mjs.map +0 -1
  603. package/lib/core/utils/toResponseInit.d.mts +0 -3
  604. package/lib/core/utils/toResponseInit.d.ts +0 -3
  605. package/lib/core/utils/toResponseInit.js +0 -31
  606. package/lib/core/utils/toResponseInit.js.map +0 -1
  607. package/lib/core/utils/toResponseInit.mjs +0 -11
  608. package/lib/core/utils/toResponseInit.mjs.map +0 -1
  609. package/lib/core/utils/url/cleanUrl.d.mts +0 -7
  610. package/lib/core/utils/url/cleanUrl.d.ts +0 -7
  611. package/lib/core/utils/url/cleanUrl.js +0 -31
  612. package/lib/core/utils/url/cleanUrl.js.map +0 -1
  613. package/lib/core/utils/url/cleanUrl.mjs +0 -11
  614. package/lib/core/utils/url/cleanUrl.mjs.map +0 -1
  615. package/lib/core/utils/url/getAbsoluteUrl.d.mts +0 -6
  616. package/lib/core/utils/url/getAbsoluteUrl.d.ts +0 -6
  617. package/lib/core/utils/url/getAbsoluteUrl.js +0 -38
  618. package/lib/core/utils/url/getAbsoluteUrl.js.map +0 -1
  619. package/lib/core/utils/url/getAbsoluteUrl.mjs +0 -18
  620. package/lib/core/utils/url/getAbsoluteUrl.mjs.map +0 -1
  621. package/lib/core/utils/url/isAbsoluteUrl.d.mts +0 -6
  622. package/lib/core/utils/url/isAbsoluteUrl.d.ts +0 -6
  623. package/lib/core/utils/url/isAbsoluteUrl.js +0 -27
  624. package/lib/core/utils/url/isAbsoluteUrl.js.map +0 -1
  625. package/lib/core/utils/url/isAbsoluteUrl.mjs +0 -7
  626. package/lib/core/utils/url/isAbsoluteUrl.mjs.map +0 -1
  627. package/lib/core/ws/WebSocketClientManager.d.mts +0 -65
  628. package/lib/core/ws/WebSocketClientManager.d.ts +0 -65
  629. package/lib/core/ws/WebSocketClientManager.js +0 -163
  630. package/lib/core/ws/WebSocketClientManager.js.map +0 -1
  631. package/lib/core/ws/WebSocketClientManager.mjs +0 -143
  632. package/lib/core/ws/WebSocketClientManager.mjs.map +0 -1
  633. package/lib/core/ws/WebSocketClientStore.d.mts +0 -13
  634. package/lib/core/ws/WebSocketClientStore.d.ts +0 -13
  635. package/lib/core/ws/WebSocketClientStore.js +0 -26
  636. package/lib/core/ws/WebSocketClientStore.js.map +0 -1
  637. package/lib/core/ws/WebSocketClientStore.mjs +0 -6
  638. package/lib/core/ws/WebSocketClientStore.mjs.map +0 -1
  639. package/lib/core/ws/WebSocketIndexedDBClientStore.d.mts +0 -14
  640. package/lib/core/ws/WebSocketIndexedDBClientStore.d.ts +0 -14
  641. package/lib/core/ws/WebSocketIndexedDBClientStore.js +0 -131
  642. package/lib/core/ws/WebSocketIndexedDBClientStore.js.map +0 -1
  643. package/lib/core/ws/WebSocketIndexedDBClientStore.mjs +0 -111
  644. package/lib/core/ws/WebSocketIndexedDBClientStore.mjs.map +0 -1
  645. package/lib/core/ws/WebSocketMemoryClientStore.d.mts +0 -12
  646. package/lib/core/ws/WebSocketMemoryClientStore.d.ts +0 -12
  647. package/lib/core/ws/WebSocketMemoryClientStore.js +0 -42
  648. package/lib/core/ws/WebSocketMemoryClientStore.js.map +0 -1
  649. package/lib/core/ws/WebSocketMemoryClientStore.mjs +0 -22
  650. package/lib/core/ws/WebSocketMemoryClientStore.mjs.map +0 -1
  651. package/lib/core/ws/handleWebSocketEvent.d.mts +0 -20
  652. package/lib/core/ws/handleWebSocketEvent.d.ts +0 -20
  653. package/lib/core/ws/handleWebSocketEvent.js +0 -61
  654. package/lib/core/ws/handleWebSocketEvent.js.map +0 -1
  655. package/lib/core/ws/handleWebSocketEvent.mjs +0 -43
  656. package/lib/core/ws/handleWebSocketEvent.mjs.map +0 -1
  657. package/lib/core/ws/utils/attachWebSocketLogger.d.mts +0 -18
  658. package/lib/core/ws/utils/attachWebSocketLogger.d.ts +0 -18
  659. package/lib/core/ws/utils/attachWebSocketLogger.js +0 -228
  660. package/lib/core/ws/utils/attachWebSocketLogger.js.map +0 -1
  661. package/lib/core/ws/utils/attachWebSocketLogger.mjs +0 -208
  662. package/lib/core/ws/utils/attachWebSocketLogger.mjs.map +0 -1
  663. package/lib/core/ws/utils/getMessageLength.d.mts +0 -11
  664. package/lib/core/ws/utils/getMessageLength.d.ts +0 -11
  665. package/lib/core/ws/utils/getMessageLength.js +0 -34
  666. package/lib/core/ws/utils/getMessageLength.js.map +0 -1
  667. package/lib/core/ws/utils/getMessageLength.mjs +0 -14
  668. package/lib/core/ws/utils/getMessageLength.mjs.map +0 -1
  669. package/lib/core/ws/utils/getPublicData.d.mts +0 -5
  670. package/lib/core/ws/utils/getPublicData.d.ts +0 -5
  671. package/lib/core/ws/utils/getPublicData.js +0 -37
  672. package/lib/core/ws/utils/getPublicData.js.map +0 -1
  673. package/lib/core/ws/utils/getPublicData.mjs +0 -17
  674. package/lib/core/ws/utils/getPublicData.mjs.map +0 -1
  675. package/lib/core/ws/utils/truncateMessage.d.mts +0 -3
  676. package/lib/core/ws/utils/truncateMessage.d.ts +0 -3
  677. package/lib/core/ws/utils/truncateMessage.js +0 -31
  678. package/lib/core/ws/utils/truncateMessage.js.map +0 -1
  679. package/lib/core/ws/utils/truncateMessage.mjs +0 -11
  680. package/lib/core/ws/utils/truncateMessage.mjs.map +0 -1
  681. package/lib/core/ws/webSocketInterceptor.d.mts +0 -5
  682. package/lib/core/ws/webSocketInterceptor.d.ts +0 -5
  683. package/lib/core/ws/webSocketInterceptor.js +0 -26
  684. package/lib/core/ws/webSocketInterceptor.js.map +0 -1
  685. package/lib/core/ws/webSocketInterceptor.mjs +0 -6
  686. package/lib/core/ws/webSocketInterceptor.mjs.map +0 -1
  687. package/lib/core/ws.d.mts +0 -88
  688. package/lib/core/ws.d.ts +0 -88
  689. package/lib/core/ws.js +0 -94
  690. package/lib/core/ws.js.map +0 -1
  691. package/lib/core/ws.mjs +0 -80
  692. package/lib/core/ws.mjs.map +0 -1
  693. package/lib/native/index.d.mts +0 -66
  694. package/lib/native/index.d.ts +0 -66
  695. package/lib/native/index.js +0 -88
  696. package/lib/native/index.js.map +0 -1
  697. package/lib/native/index.mjs +0 -67
  698. package/lib/native/index.mjs.map +0 -1
  699. package/lib/node/index.d.mts +0 -113
  700. package/lib/node/index.mjs +0 -185
  701. package/lib/node/index.mjs.map +0 -1
  702. package/lib/shims/cookie.d.mts +0 -7
  703. package/lib/shims/cookie.d.ts +0 -7
  704. package/lib/shims/cookie.js +0 -294
  705. package/lib/shims/cookie.mjs +0 -286
  706. package/lib/shims/statuses.d.mts +0 -6
  707. package/lib/shims/statuses.d.ts +0 -6
  708. package/lib/shims/statuses.js +0 -195
  709. package/lib/shims/statuses.mjs +0 -187
  710. package/native/package.json +0 -30
  711. package/node/package.json +0 -33
  712. package/src/browser/utils/pruneGetRequestBody.test.ts +0 -51
  713. package/src/browser/utils/pruneGetRequestBody.ts +0 -21
  714. package/src/core/experimental/compat.ts +0 -50
  715. package/src/core/experimental/setup-api.ts +0 -55
  716. package/src/core/graphql.test.ts +0 -11
  717. package/src/core/graphql.ts +0 -136
  718. package/src/core/passthrough.test.ts +0 -11
  719. package/src/core/passthrough.ts +0 -25
  720. package/src/core/sharedOptions.ts +0 -71
  721. package/src/core/typeUtils.ts +0 -26
  722. package/src/core/utils/handleRequest.test.ts +0 -574
  723. package/src/core/utils/handleRequest.ts +0 -117
  724. package/src/core/utils/internal/checkGlobals.ts +0 -17
  725. package/src/core/utils/internal/isHandlerKind.test.ts +0 -62
  726. package/src/core/utils/internal/isHandlerKind.ts +0 -17
  727. package/src/core/utils/internal/isIterable.ts +0 -32
  728. package/src/core/utils/internal/mergeRight.test.ts +0 -43
  729. package/src/core/utils/internal/mergeRight.ts +0 -30
  730. package/src/core/utils/internal/pipeEvents.test.ts +0 -14
  731. package/src/core/utils/internal/pipeEvents.ts +0 -26
  732. package/src/core/utils/internal/tryCatch.test.ts +0 -29
  733. package/src/core/utils/internal/tryCatch.ts +0 -11
  734. package/src/core/utils/matching/matchRequestUrl.test.ts +0 -267
  735. package/src/core/utils/matching/matchRequestUrl.ts +0 -77
  736. package/src/core/utils/request/getRequestCookies.ts +0 -88
  737. package/src/core/utils/request/onUnhandledRequest.node.test.ts +0 -62
  738. package/src/core/utils/request/onUnhandledRequest.test.ts +0 -226
  739. package/src/core/utils/request/onUnhandledRequest.ts +0 -81
  740. package/src/core/utils/request/storeResponseCookies.ts +0 -15
  741. package/src/core/utils/url/cleanUrl.test.ts +0 -22
  742. package/src/core/utils/url/cleanUrl.ts +0 -16
  743. package/src/core/utils/url/isAbsoluteUrl.test.ts +0 -32
  744. package/src/core/ws/handleWebSocketEvent.ts +0 -68
  745. package/src/core/ws/utils/getPublicData.ts +0 -18
  746. package/src/core/ws/webSocketInterceptor.ts +0 -3
  747. package/src/native/index.ts +0 -44
  748. package/src/package.json +0 -3
  749. package/src/shims/cookie.ts +0 -7
  750. package/src/shims/statuses.ts +0 -6
  751. /package/src/browser/utils/{getAbsoluteWorkerUrl.ts → get-absolute-worker-url.ts} +0 -0
  752. /package/src/core/utils/internal/{devUtils.ts → dev-utils.ts} +0 -0
  753. /package/src/core/utils/internal/{isObject.ts → is-object.ts} +0 -0
  754. /package/src/core/utils/internal/{isStringEqual.ts → is-string-equal.ts} +0 -0
  755. /package/src/core/utils/internal/{jsonParse.ts → json-parse.ts} +0 -0
  756. /package/src/core/utils/internal/{toReadonlyArray.ts → to-readonly-array.ts} +0 -0
  757. /package/src/core/utils/logging/{getStatusCodeColor.ts → get-status-code-color.ts} +0 -0
  758. /package/src/core/utils/logging/{getTimestamp.ts → get-timestamp.ts} +0 -0
  759. /package/src/core/utils/logging/{serializeRequest.ts → serialize-request.ts} +0 -0
  760. /package/src/core/utils/request/{getAllAcceptedMimeTypes.ts → get-all-accepted-mime-types.ts} +0 -0
  761. /package/src/core/utils/request/{toPublicUrl.ts → to-public-url.ts} +0 -0
  762. /package/src/core/utils/{toResponseInit.ts → to-response-init.ts} +0 -0
  763. /package/src/core/utils/url/{isAbsoluteUrl.ts → is-absolute-url.ts} +0 -0
  764. /package/src/{core → http}/http.test.ts +0 -0
  765. /package/src/{core/ws/utils/truncateMessage.ts → ws/utils/truncate-message.ts} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/core/utils/internal/parse-multipart-data.ts","../../src/graphql/parse-graphql-request.ts","../../src/core/utils/request/get-all-accepted-mime-types.ts","../../src/graphql/graphql-handler.ts","../../src/graphql/graphql-subscription-event.ts","../../src/graphql/graphql-subscription.ts","../../src/graphql/graphql.ts"],"sourcesContent":["import { stringToHeaders } from 'headers-polyfill'\nimport type { DefaultRequestMultipartBody } from '../../handlers/request-handler'\n\ninterface ParsedContentHeaders {\n name: string\n filename?: string\n contentType: string\n}\n\ninterface ContentDispositionDirective {\n [key: string]: string | undefined\n name: string\n filename?: string\n 'form-data': string\n}\n\nfunction parseContentHeaders(headersString: string): ParsedContentHeaders {\n const headers = stringToHeaders(headersString)\n const contentType = headers.get('content-type') || 'text/plain'\n const disposition = headers.get('content-disposition')\n\n if (!disposition) {\n throw new Error('\"Content-Disposition\" header is required.')\n }\n\n const directives = disposition.split(';').reduce((acc, chunk) => {\n const [name, ...rest] = chunk.trim().split('=')\n acc[name] = rest.join('=')\n return acc\n }, {} as ContentDispositionDirective)\n\n const name = directives.name?.slice(1, -1)\n const filename = directives.filename?.slice(1, -1)\n\n return {\n name,\n filename,\n contentType,\n }\n}\n\n/**\n * Parses a given string as a multipart/form-data.\n * Does not throw an exception on an invalid multipart string.\n */\nexport function parseMultipartData<T extends DefaultRequestMultipartBody>(\n data: string,\n headers?: Headers,\n): T | undefined {\n const contentType = headers?.get('content-type')\n\n if (!contentType) {\n return undefined\n }\n\n const [, ...directives] = contentType.split(/; */)\n const boundary = directives\n .filter((d) => d.startsWith('boundary='))\n .map((s) => s.replace(/^boundary=/, ''))[0]\n\n if (!boundary) {\n return undefined\n }\n\n const boundaryRegExp = new RegExp(\n `--+${boundary.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')}`,\n )\n const fields = data\n .split(boundaryRegExp)\n .filter((chunk) => chunk.startsWith('\\r\\n') && chunk.endsWith('\\r\\n'))\n .map((chunk) => chunk.trimStart().replace(/\\r\\n$/, ''))\n\n if (!fields.length) {\n return undefined\n }\n\n const parsedBody: DefaultRequestMultipartBody = {}\n\n try {\n for (const field of fields) {\n const [contentHeaders, ...rest] = field.split('\\r\\n\\r\\n')\n const contentBody = rest.join('\\r\\n\\r\\n')\n const { contentType, filename, name } =\n parseContentHeaders(contentHeaders)\n\n const value =\n filename === undefined\n ? contentBody\n : new File([contentBody], filename, { type: contentType })\n\n const parsedValue = parsedBody[name]\n\n if (parsedValue === undefined) {\n parsedBody[name] = value\n } else if (Array.isArray(parsedValue)) {\n parsedBody[name] = [...parsedValue, value]\n } else {\n parsedBody[name] = [parsedValue, value]\n }\n }\n\n return parsedBody as T\n } catch {\n return undefined\n }\n}\n","import {\n parse,\n type DocumentNode,\n type OperationDefinitionNode,\n type OperationTypeNode,\n} from 'graphql'\nimport type { GraphQLVariables } from './graphql-handler'\nimport { toPublicUrl } from '#core/utils/request/to-public-url'\nimport { devUtils } from '#core/utils/internal/dev-utils'\nimport { jsonParse } from '#core/utils/internal/json-parse'\nimport { parseMultipartData } from '#core/utils/internal/parse-multipart-data'\n\ninterface GraphQLInput {\n query: string | null\n variables?: GraphQLVariables\n operationName?: string | null\n}\n\nexport interface ParsedGraphQLQuery {\n /**\n * Undefined if the document has no operation matching the\n * requested operation name.\n */\n operationType?: OperationTypeNode\n operationName?: string\n}\n\nexport type ParsedGraphQLRequest<\n VariablesType extends GraphQLVariables = GraphQLVariables,\n> =\n | (ParsedGraphQLQuery & {\n query: string\n variables?: VariablesType\n })\n | undefined\n\nexport function parseDocumentNode(\n node: DocumentNode,\n operationName?: string | null,\n): ParsedGraphQLQuery {\n const operationDefs = node.definitions.filter((definition) => {\n return definition.kind === 'OperationDefinition'\n }) as Array<OperationDefinitionNode>\n\n /**\n * @note A document may bundle multiple operations (e.g. the ones\n * emitted by GraphQL Code Generator). Honor the requested operation\n * name, and resolve nothing if the document has no such operation.\n * Falling back to the first operation would silently resolve one the\n * client never asked for.\n */\n const operationDef = operationName\n ? operationDefs.find((definition) => {\n return definition.name?.value === operationName\n })\n : operationDefs[0]\n\n return {\n operationType: operationDef?.operation,\n /**\n * @note Echo the requested operation name even when the document\n * has no such operation. It makes the \"unhandled operation\" warnings\n * name the operation the client actually asked for.\n */\n operationName: operationDef?.name?.value || operationName || undefined,\n }\n}\n\nasync function parseQuery(\n query: string,\n operationName?: string | null,\n): Promise<ParsedGraphQLQuery | Error> {\n try {\n const ast = parse(query)\n return parseDocumentNode(ast, operationName)\n } catch (error) {\n return error as Error\n }\n}\n\ntype GraphQLParsedOperationsMap = Record<string, string[]>\nexport type GraphQLMultipartRequestBody = {\n operations: string\n map?: string\n} & {\n [fileName: string]: File\n}\n\nfunction extractMultipartVariables<VariablesType extends GraphQLVariables>(\n variables: VariablesType,\n map: GraphQLParsedOperationsMap,\n files: Record<string, File>,\n) {\n const operations = { variables }\n\n for (const [key, pathArray] of Object.entries(map)) {\n if (!(key in files)) {\n throw new Error(`Given files do not have a key '${key}' .`)\n }\n\n for (const dotPath of pathArray) {\n const [lastPath, ...reversedPaths] = dotPath.split('.').reverse()\n const paths = reversedPaths.reverse()\n let target: Record<string, any> = operations\n\n for (const path of paths) {\n if (!(path in target)) {\n throw new Error(`Property '${path}' is not in operations.`)\n }\n\n target = target[path]\n }\n\n target[lastPath] = files[key]\n }\n }\n\n return operations.variables\n}\n\nasync function getGraphQLInput(request: Request): Promise<GraphQLInput | null> {\n switch (request.method) {\n case 'GET': {\n const url = new URL(request.url)\n const query = url.searchParams.get('query')\n const variables = url.searchParams.get('variables') || ''\n\n return {\n query,\n variables: jsonParse(variables),\n operationName: url.searchParams.get('operationName'),\n }\n }\n\n case 'POST': {\n // Clone the request so we could read its body without locking\n // the body stream to the downward consumers.\n const requestClone = request.clone()\n\n // Handle multipart body GraphQL operations.\n if (\n request.headers.get('content-type')?.includes('multipart/form-data')\n ) {\n const responseJson = parseMultipartData<GraphQLMultipartRequestBody>(\n await requestClone.text(),\n request.headers,\n )\n\n if (!responseJson) {\n return null\n }\n\n const { operations, map, ...files } = responseJson\n const parsedOperations =\n jsonParse<{\n query?: string\n variables?: GraphQLVariables\n operationName?: string | null\n }>(operations) || {}\n\n if (!parsedOperations.query) {\n return null\n }\n\n const parsedMap = jsonParse<GraphQLParsedOperationsMap>(map || '') || {}\n const variables = parsedOperations.variables\n ? extractMultipartVariables(\n parsedOperations.variables,\n parsedMap,\n files,\n )\n : {}\n\n return {\n query: parsedOperations.query,\n variables,\n operationName: parsedOperations.operationName,\n }\n }\n\n // Handle plain POST GraphQL operations.\n const requestJson: {\n query: string\n variables?: GraphQLVariables\n operationName?: string | null\n operations?: any /** @todo Annotate this */\n } = await requestClone.json().catch(() => null)\n\n if (requestJson?.query) {\n const { query, variables, operationName } = requestJson\n\n return {\n query,\n variables,\n operationName,\n }\n }\n return null\n }\n\n default:\n return null\n }\n}\n\n/**\n * Determines if a given request can be considered a GraphQL request.\n * Does not parse the query and does not guarantee its validity.\n */\nexport async function parseGraphQLRequest(\n request: Request,\n): Promise<ParsedGraphQLRequest> {\n const input = await getGraphQLInput(request)\n\n if (!input || !input.query) {\n return\n }\n\n const { query, variables, operationName } = input\n const parsedResult = await parseQuery(query, operationName)\n\n if (parsedResult instanceof Error) {\n const requestPublicUrl = toPublicUrl(request.url)\n\n throw new Error(\n devUtils.formatMessage(\n 'Failed to intercept a GraphQL request to \"%s %s\": cannot parse query. See the error message from the parser below.\\n\\n%s',\n request.method,\n requestPublicUrl,\n parsedResult.message,\n ),\n )\n }\n\n return {\n query: input.query,\n operationType: parsedResult.operationType,\n operationName: parsedResult.operationName,\n variables,\n }\n}\n","/**\n * Returns all accepted mime types, ordered by precedence as defined\n * in [RFC 7231 Section 5.3.2](https://datatracker.ietf.org/doc/html/rfc7231#section-5.3.2).\n *\n * Precedence rules (highest to lowest):\n * 1. Quality value (`q` parameter, default 1).\n * 2. Specificity: `type/subtype` > `type/*` > `*\\/*`.\n * 3. Number of media type parameters (more = more specific).\n *\n * Types with `q=0` are excluded (explicitly not acceptable).\n */\nexport function getAllAcceptedMimeTypes(\n acceptHeader: string | null,\n): Array<string> {\n if (acceptHeader == null) {\n return []\n }\n\n const accepted: Array<{\n type: string\n quality: number\n specificity: number\n parameterCount: number\n }> = []\n\n for (const part of acceptHeader.split(',')) {\n const [type, ...params] = part.split(';').map((v) => v.trim())\n\n let quality = 1\n let parameterCount = 0\n\n for (const param of params) {\n const [key, value] = param.split('=').map((v) => v.trim())\n\n if (key === 'q') {\n quality = Number(value)\n } else {\n parameterCount++\n }\n }\n\n // RFC 7231: a quality value of 0 indicates \"not acceptable\".\n if (quality === 0) {\n continue\n }\n\n const [mediaType, mediaSubtype] = type.split('/')\n const specificity = mediaType === '*' ? 0 : mediaSubtype === '*' ? 1 : 2\n\n accepted.push({ type, quality, specificity, parameterCount })\n }\n\n if (!accepted.length) {\n return []\n }\n\n return accepted\n .sort((left, right) => {\n if (right.quality !== left.quality) {\n return right.quality - left.quality\n }\n\n if (right.specificity !== left.specificity) {\n return right.specificity - left.specificity\n }\n\n return right.parameterCount - left.parameterCount\n })\n .map((entry) => entry.type)\n}\n","import { invariant } from 'outvariant'\nimport {\n parse,\n type DocumentNode,\n type GraphQLError,\n type OperationTypeNode,\n} from 'graphql'\nimport {\n RequestHandler,\n type DefaultBodyType,\n type RequestHandlerDefaultInfo,\n type RequestHandlerExecutionResult,\n type RequestHandlerOptions,\n type ResponseResolver,\n} from '#core/handlers/request-handler'\nimport { getTimestamp } from '#core/utils/logging/get-timestamp'\nimport { getStatusCodeColor } from '#core/utils/logging/get-status-code-color'\nimport { serializeRequest } from '#core/utils/logging/serialize-request'\nimport { serializeResponse } from '#core/utils/logging/serialize-response'\nimport {\n matchRequestUrl,\n type Match,\n type Path,\n} from '#core/utils/matching/match-request-url'\nimport {\n parseGraphQLRequest,\n parseDocumentNode,\n type ParsedGraphQLRequest,\n type GraphQLMultipartRequestBody,\n type ParsedGraphQLQuery,\n} from './parse-graphql-request'\nimport { toPublicUrl } from '#core/utils/request/to-public-url'\nimport { devUtils } from '#core/utils/internal/dev-utils'\nimport { getAllRequestCookies } from '#core/utils/request/get-request-cookies'\nimport { kDefaultContentType } from '#http/symbols'\nimport type { StrictRequest } from '#http/http-response'\nimport { getAllAcceptedMimeTypes } from '#core/utils/request/get-all-accepted-mime-types'\nimport type { ResponseResolutionContext } from '#core/utils/execute-handlers'\n\nexport interface DocumentTypeDecoration<\n Result = { [key: string]: any },\n Variables = { [key: string]: any },\n> {\n __apiType?: (variables: Variables) => Result\n __resultType?: Result\n __variablesType?: Variables\n}\n\nexport type GraphQLOperationType = OperationTypeNode | 'all'\nexport type GraphQLHandlerNameSelector = DocumentNode | RegExp | string\n\nexport type GraphQLQuery = Record<string, any> | null\nexport type GraphQLVariables = Record<string, any>\n\nexport interface GraphQLHandlerInfo extends RequestHandlerDefaultInfo {\n operationType: GraphQLOperationType\n operationName: GraphQLHandlerNameSelector | GraphQLCustomPredicate\n}\n\nexport type GraphQLRequestParsedResult = {\n match: Match\n cookies: Record<string, string>\n} & (\n | ParsedGraphQLRequest<GraphQLVariables>\n /**\n * An empty version of the ParsedGraphQLRequest\n * which simplifies the return type of the resolver\n * when the request is to a non-matching endpoint\n */\n | {\n operationType?: undefined\n operationName?: undefined\n query?: undefined\n variables?: undefined\n }\n)\n\nexport type GraphQLResolverExtras<Variables extends GraphQLVariables> = {\n query: string\n operationName: string\n variables: Variables\n cookies: Record<string, string>\n}\n\nexport type GraphQLRequestBody<VariablesType extends GraphQLVariables> =\n | GraphQLJsonRequestBody<VariablesType>\n | GraphQLMultipartRequestBody\n | Record<string, any>\n | undefined\n\nexport interface GraphQLJsonRequestBody<Variables extends GraphQLVariables> {\n query: string\n variables?: Variables\n}\n\nexport type GraphQLResponseBody<BodyType extends DefaultBodyType> =\n | {\n data?: BodyType | null\n errors?: readonly Partial<GraphQLError>[] | null\n extensions?: Record<string, any>\n }\n | null\n | undefined\n\nexport type GraphQLCustomPredicate = (args: {\n request: Request\n query: string\n operationType: GraphQLOperationType\n operationName: string\n variables: GraphQLVariables\n cookies: Record<string, string>\n}) => GraphQLCustomPredicateResult | Promise<GraphQLCustomPredicateResult>\n\ntype GraphQLCustomPredicateResult = boolean | { matches: boolean }\n\nexport type GraphQLPredicate<Query = any, Variables = any> =\n | GraphQLHandlerNameSelector\n | DocumentTypeDecoration<Query, Variables>\n | GraphQLCustomPredicate\n\nexport function isDocumentNode(\n value: DocumentNode | any,\n): value is DocumentNode {\n if (value == null) {\n return false\n }\n\n return typeof value === 'object' && 'kind' in value && 'definitions' in value\n}\n\nfunction isDocumentTypeDecoration(\n value: unknown,\n): value is DocumentTypeDecoration<any, any> {\n return value instanceof String\n}\n\nexport class GraphQLHandler extends RequestHandler<\n GraphQLHandlerInfo,\n GraphQLRequestParsedResult,\n GraphQLResolverExtras<any>\n> {\n private endpoint: Path\n\n static parsedRequestCache = new WeakMap<\n Request,\n ParsedGraphQLRequest<GraphQLVariables>\n >()\n\n static #parseOperationName(\n predicate: GraphQLPredicate,\n operationType: GraphQLOperationType,\n ): GraphQLHandlerInfo['operationName'] {\n const getOperationName = (node: ParsedGraphQLQuery): string => {\n invariant(\n node.operationType === operationType,\n 'Failed to create a GraphQL handler: provided a DocumentNode with a mismatched operation type (expected \"%s\" but got \"%s\").',\n operationType,\n node.operationType,\n )\n\n invariant(\n node.operationName,\n 'Failed to create a GraphQL handler: provided a DocumentNode without operation name',\n )\n\n return node.operationName\n }\n\n if (isDocumentNode(predicate)) {\n return getOperationName(parseDocumentNode(predicate))\n }\n\n if (isDocumentTypeDecoration(predicate)) {\n const documentNode = parse(predicate.toString())\n\n invariant(\n isDocumentNode(documentNode),\n 'Failed to create a GraphQL handler: given TypedDocumentString (%s) does not produce a valid DocumentNode',\n predicate,\n )\n\n return getOperationName(parseDocumentNode(documentNode))\n }\n\n return predicate\n }\n\n /**\n * Creates a GraphQL handler information object from the given\n * operation predicate. Normalizes `DocumentNode` and typed document\n * string predicates to plain operation names.\n */\n static parseGraphQLRequestInfo(args: {\n operationType: GraphQLOperationType\n predicate: GraphQLPredicate\n url: Path\n }): GraphQLHandlerInfo {\n const operationName = GraphQLHandler.#parseOperationName(\n args.predicate,\n args.operationType,\n )\n\n const displayOperationName =\n typeof operationName === 'function' ? '[custom predicate]' : operationName\n\n const header =\n args.operationType === 'all'\n ? `${args.operationType} (origin: ${args.url.toString()})`\n : `${args.operationType}${displayOperationName ? ` ${displayOperationName}` : ''} (origin: ${args.url.toString()})`\n\n return {\n header,\n operationType: args.operationType,\n operationName,\n }\n }\n\n constructor(\n operationType: GraphQLOperationType,\n predicate: GraphQLPredicate,\n endpoint: Path,\n resolver: ResponseResolver<GraphQLResolverExtras<any>, any, any>,\n options?: RequestHandlerOptions,\n ) {\n super({\n info: GraphQLHandler.parseGraphQLRequestInfo({\n operationType,\n predicate,\n url: endpoint,\n }),\n resolver,\n options,\n })\n\n this.endpoint = endpoint\n }\n\n /**\n * Parses the request body, once per request, cached across all\n * GraphQL handlers. This is done to avoid multiple parsing of the\n * request body, which each requires a clone of the request.\n */\n async parseGraphQLRequestOrGetFromCache(\n request: Request,\n ): Promise<ParsedGraphQLRequest<GraphQLVariables>> {\n if (!GraphQLHandler.parsedRequestCache.has(request)) {\n GraphQLHandler.parsedRequestCache.set(\n request,\n await parseGraphQLRequest(request).catch((error) => {\n console.error(error)\n return undefined\n }),\n )\n }\n\n return GraphQLHandler.parsedRequestCache.get(request)\n }\n\n async parse(args: { request: Request }): Promise<GraphQLRequestParsedResult> {\n // If the request doesn't match a specified endpoint, there's no\n // need to parse it since there's no case where we would handle this\n const match = matchRequestUrl(new URL(args.request.url), this.endpoint)\n const cookies = getAllRequestCookies(args.request)\n\n if (!match.matches) {\n return {\n match,\n cookies,\n }\n }\n\n const parsedResult = await this.parseGraphQLRequestOrGetFromCache(\n args.request,\n )\n\n if (typeof parsedResult === 'undefined') {\n return {\n match,\n cookies,\n }\n }\n\n return {\n match,\n cookies,\n query: parsedResult.query,\n operationType: parsedResult.operationType,\n operationName: parsedResult.operationName,\n variables: parsedResult.variables,\n }\n }\n\n async predicate(args: {\n request: Request\n parsedResult: GraphQLRequestParsedResult\n }): Promise<boolean> {\n if (args.parsedResult.operationType === undefined) {\n return false\n }\n\n if (!args.parsedResult.operationName && this.info.operationType !== 'all') {\n const publicUrl = toPublicUrl(args.request.url)\n\n devUtils.warn(`\\\nFailed to intercept a GraphQL request at \"${args.request.method} ${publicUrl}\": anonymous GraphQL operations are not supported.\n\nConsider naming this operation or using the \"operation()\" request handler of \"graphql.link()\" to intercept GraphQL requests regardless of their operation name/type. Read more: https://mswjs.io/docs/api/graphql/#graphqloperationresolver`)\n return false\n }\n\n const hasMatchingOperationType =\n this.info.operationType === 'all' ||\n args.parsedResult.operationType === this.info.operationType\n\n /**\n * Check if the operation name matches the outgoing GraphQL request.\n * @note Unlike the HTTP handler, the custom predicate functions are invoked\n * during predicate, not parsing, because GraphQL request parsing happens first,\n * and non-GraphQL requests are filtered out automatically.\n */\n const hasMatchingOperationName = await this.matchOperationName({\n request: args.request,\n parsedResult: args.parsedResult,\n })\n\n return (\n args.parsedResult.match.matches &&\n hasMatchingOperationType &&\n hasMatchingOperationName\n )\n }\n\n public async run(args: {\n request: StrictRequest<any>\n requestId: string\n resolutionContext?: ResponseResolutionContext\n }): Promise<RequestHandlerExecutionResult<GraphQLRequestParsedResult> | null> {\n const result = await super.run(args)\n\n if (result?.response == null) {\n return result\n }\n\n if (!(kDefaultContentType in result.response)) {\n return result\n }\n\n const acceptedMimeTypes = getAllAcceptedMimeTypes(\n args.request.headers.get('accept'),\n )\n\n if (acceptedMimeTypes.length === 0) {\n return result\n }\n\n const graphqlResponseIndex = acceptedMimeTypes.indexOf(\n 'application/graphql-response+json',\n )\n const jsonIndex = acceptedMimeTypes.indexOf('application/json')\n\n /**\n * Use the \"application/graphql-response+json\" response content type\n * only when the client accepts it AND prefers it over \"application/json\"\n * (i.e. it appears earlier in the precedence-sorted list, or \"application/json\"\n * is not listed at all).\n * @see https://github.com/graphql/graphql-over-http/blob/4d1df1fb829ec2dd3ecbf3c6aa4025bd356c270d/spec/GraphQLOverHTTP.md#accept\n */\n if (\n graphqlResponseIndex !== -1 &&\n (jsonIndex === -1 || graphqlResponseIndex <= jsonIndex)\n ) {\n result.response.headers.set(\n 'content-type',\n 'application/graphql-response+json',\n )\n }\n\n return result\n }\n\n private async matchOperationName(args: {\n request: Request\n parsedResult: GraphQLRequestParsedResult\n }): Promise<boolean> {\n if (typeof this.info.operationName === 'function') {\n const customPredicateResult = await this.info.operationName({\n request: args.request,\n ...this.extendResolverArgs({\n request: args.request,\n parsedResult: args.parsedResult,\n }),\n })\n\n /**\n * @note Keep the { matches } signature in case we decide to support path parameters\n * in GraphQL handlers. If that happens, the custom predicate would have to be moved\n * to the parsing phase, the same as we have for the HttpHandler, and the user will\n * have a possibility to return parsed path parameters from the custom predicate.\n */\n return typeof customPredicateResult === 'boolean'\n ? customPredicateResult\n : customPredicateResult.matches\n }\n\n if (this.info.operationName instanceof RegExp) {\n return this.info.operationName.test(args.parsedResult.operationName || '')\n }\n\n return args.parsedResult.operationName === this.info.operationName\n }\n\n protected extendResolverArgs(args: {\n request: Request\n parsedResult: GraphQLRequestParsedResult\n }) {\n return {\n query: args.parsedResult.query || '',\n operationType: args.parsedResult.operationType!,\n operationName: args.parsedResult.operationName || '',\n variables: args.parsedResult.variables || {},\n cookies: args.parsedResult.cookies,\n }\n }\n\n async log(args: {\n request: Request\n response: Response\n parsedResult: GraphQLRequestParsedResult\n }) {\n const loggedRequest = await serializeRequest(args.request)\n const loggedResponse = await serializeResponse(args.response)\n const statusColor = getStatusCodeColor(loggedResponse.status)\n const requestInfo = args.parsedResult.operationName\n ? `${args.parsedResult.operationType} ${args.parsedResult.operationName}`\n : `anonymous ${args.parsedResult.operationType}`\n\n console.groupCollapsed(\n devUtils.formatMessage(\n `${getTimestamp()} ${requestInfo} (%c${loggedResponse.status} ${\n loggedResponse.statusText\n }%c)`,\n ),\n `color:${statusColor}`,\n 'color:inherit',\n )\n // eslint-disable-next-line no-console\n console.log('Request:', loggedRequest)\n // eslint-disable-next-line no-console\n console.log('Handler:', this)\n // eslint-disable-next-line no-console\n console.log('Response:', loggedResponse)\n console.groupEnd()\n }\n}\n","import { TypedEvent } from 'rettime'\n\nexport interface GraphQLSubscriptionEventInit {\n operationName: string\n query: string\n variables: Record<string, unknown>\n request: Request\n}\n\n/**\n * Emitted when a GraphQL subscription is established over an\n * intercepted WebSocket connection (i.e. matched by a subscription\n * handler and resolved).\n *\n * @note The event is referenced by the WebSocket frame event map so\n * the life-cycle event emitters derived from it (e.g. `server.events`)\n * are typed correctly. It lives in its own module so the emitting\n * `msw/graphql` module doesn't pull the entire frame graph, and the\n * core stays free of the `graphql` dependency (the event carries\n * plain data only).\n */\nexport class GraphQLSubscriptionEvent extends TypedEvent<\n void,\n void,\n 'graphql:subscription'\n> {\n public readonly operationName: string\n public readonly query: string\n public readonly variables: Record<string, unknown>\n public readonly request: Request\n\n constructor(init: GraphQLSubscriptionEventInit) {\n super('graphql:subscription')\n this.operationName = init.operationName\n this.query = init.query\n this.variables = init.variables\n this.request = init.request\n }\n}\n","import { invariant } from 'outvariant'\nimport { Emitter, TypedEvent } from 'rettime'\nimport { parse, OperationTypeNode, type GraphQLError } from 'graphql'\nimport { resolveWebSocketUrl } from '@mswjs/interceptors'\nimport type {\n WebSocketClientHandle,\n WebSocketConnectionEventData,\n WebSocketData,\n WebSocketServerHandle,\n} from '@mswjs/interceptors/WebSocket'\nimport { http } from '#http/http'\nimport { webSocketUpgrade } from '#ws/websocket-upgrade'\nimport {\n WebSocketHandler,\n kConnect,\n type WebSocketHandlerConnection,\n type WebSocketResolutionContext,\n} from '#ws/websocket-handler'\nimport { GraphQLSubscriptionEvent } from './graphql-subscription-event'\nimport {\n matchRequestUrl,\n type Path,\n type PathParams,\n} from '#core/utils/matching/match-request-url'\nimport type { ResponseResolverFinalizeFunction } from '#core/handlers/request-handler'\nimport type { MaybePromise } from '#core/type-utils'\nimport { attachSiblingHandlers } from '#core/utils/internal/attach-sibling-handlers'\nimport { jsonParse } from '#core/utils/internal/json-parse'\nimport { devUtils } from '#core/utils/internal/dev-utils'\nimport { getTimestamp } from '#core/utils/logging/get-timestamp'\nimport { toPublicUrl } from '#core/utils/request/to-public-url'\nimport { colors } from '#core/utils/logging/colors'\nimport {\n GraphQLHandler,\n isDocumentNode,\n type DocumentTypeDecoration,\n type GraphQLHandlerInfo,\n type GraphQLHandlerNameSelector,\n type GraphQLQuery,\n type GraphQLVariables,\n} from './graphql-handler'\nimport {\n parseDocumentNode,\n type ParsedGraphQLQuery,\n} from './parse-graphql-request'\n\n/**\n * Messages of the `graphql-transport-ws` protocol.\n * @see https://github.com/graphql/graphql-over-http/blob/main/rfcs/GraphQLOverWebSocket.md\n */\ninterface GraphQLWebSocketInitMessage {\n type: 'connection_init'\n payload?: Record<string, unknown>\n}\n\ninterface GraphQLWebSocketSubscribePayload<\n Variables extends GraphQLVariables = GraphQLVariables,\n> {\n operationName?: string | null\n query: string\n variables?: Variables\n extensions?: Record<string, unknown>\n}\n\nexport interface GraphQLWebSocketSubscribeMessage<\n Variables extends GraphQLVariables = GraphQLVariables,\n> {\n type: 'subscribe'\n id: string\n payload: GraphQLWebSocketSubscribePayload<Variables>\n}\n\ninterface GraphQLWebSocketCompleteMessage {\n type: 'complete'\n id: string\n}\n\ninterface GraphQLWebSocketPingMessage {\n type: 'ping'\n payload?: Record<string, unknown>\n}\n\ninterface GraphQLWebSocketPongMessage {\n type: 'pong'\n payload?: Record<string, unknown>\n}\n\ntype GraphQLWebSocketClientMessage =\n | GraphQLWebSocketInitMessage\n | GraphQLWebSocketSubscribeMessage\n | GraphQLWebSocketCompleteMessage\n | GraphQLWebSocketPingMessage\n | GraphQLWebSocketPongMessage\n\ninterface GraphQLWebSocketAcknowledgeMessage {\n type: 'connection_ack'\n payload?: Record<string, unknown>\n}\n\ninterface GraphQLWebSocketNextMessage {\n type: 'next'\n id: string\n payload: GraphQLSubscriptionPayload\n}\n\ninterface GraphQLWebSocketErrorMessage {\n type: 'error'\n id: string\n payload: ReadonlyArray<Partial<GraphQLError>>\n}\n\ntype GraphQLWebSocketServerMessage =\n | GraphQLWebSocketAcknowledgeMessage\n | GraphQLWebSocketNextMessage\n | GraphQLWebSocketErrorMessage\n | GraphQLWebSocketCompleteMessage\n | GraphQLWebSocketPingMessage\n | GraphQLWebSocketPongMessage\n\n/**\n * A GraphQL execution result published to a subscription.\n */\nexport interface GraphQLSubscriptionPayload<\n Query extends GraphQLQuery = GraphQLQuery,\n> {\n data?: Query | null\n errors?: ReadonlyArray<Partial<GraphQLError>> | null\n extensions?: Record<string, unknown>\n}\n\nfunction createInitMessage(payload?: Record<string, unknown>): string {\n return JSON.stringify({\n type: 'connection_init',\n payload,\n } satisfies GraphQLWebSocketInitMessage)\n}\n\nfunction createAcknowledgeMessage(): string {\n return JSON.stringify({\n type: 'connection_ack',\n } satisfies GraphQLWebSocketAcknowledgeMessage)\n}\n\nfunction createNextMessage(args: {\n id: string\n payload: GraphQLSubscriptionPayload\n}): string {\n return JSON.stringify({\n id: args.id,\n type: 'next',\n payload: args.payload,\n } satisfies GraphQLWebSocketNextMessage)\n}\n\nfunction createErrorMessage(args: {\n id: string\n payload: ReadonlyArray<Partial<GraphQLError>>\n}): string {\n return JSON.stringify({\n id: args.id,\n type: 'error',\n payload: args.payload,\n } satisfies GraphQLWebSocketErrorMessage)\n}\n\nfunction createCompleteMessage(args: { id: string }): string {\n return JSON.stringify({\n id: args.id,\n type: 'complete',\n } satisfies GraphQLWebSocketCompleteMessage)\n}\n\nfunction createPongMessage(): string {\n return JSON.stringify({\n type: 'pong',\n } satisfies GraphQLWebSocketPongMessage)\n}\n\n/**\n * Construct a request representing the WebSocket upgrade of the given\n * connection. GraphQL subscriptions have no request of their own, so\n * this describes the connection they are multiplexed over.\n */\nfunction createUpgradeRequest(url: URL): Request {\n return new Request(url, {\n headers: {\n connection: 'upgrade',\n upgrade: 'websocket',\n },\n })\n}\n\nfunction parseGraphQLWebSocketMessage<MessageType extends { type: string }>(\n data: WebSocketData,\n): MessageType | undefined {\n if (typeof data !== 'string') {\n return undefined\n }\n\n const message = jsonParse<MessageType>(data)\n\n if (!message || typeof message.type !== 'string') {\n return undefined\n }\n\n return message\n}\n\n/**\n * A subscriber provided by a `GraphQLSubscriptionHandler` for a particular\n * WebSocket connection. Returns true if the handler matched the parsed\n * subscribe operation and resolved it.\n */\ntype GraphQLSubscriptionSubscriber = (args: {\n node: ParsedGraphQLQuery\n message: GraphQLWebSocketSubscribeMessage\n}) => boolean\n\ninterface GraphQLSubscriptionSubscriberEntry {\n transport: GraphQLSubscriptionTransportHandler\n subscriber: GraphQLSubscriptionSubscriber\n}\n\ntype GraphQLSubscriptionCleanup = () => MaybePromise<void>\n\ninterface GraphQLSubscriptionConnection {\n client: WebSocketClientHandle\n server: WebSocketServerHandle\n subscribers: Map<WebSocketHandler, GraphQLSubscriptionSubscriberEntry>\n /**\n * The active subscriptions of this connection, mapped to the cleanups\n * scheduled for them via the resolver's `finalize()`.\n */\n subscriptions: Map<string, Array<GraphQLSubscriptionCleanup>>\n events?: WebSocketResolutionContext['events']\n /**\n * The payload of the client's `connection_init` message (i.e. the\n * `connectionParams` of the GraphQL client). Kept so it can be\n * replayed to the original server on passthrough.\n */\n connectionParams?: Record<string, unknown>\n /**\n * Resolves once the original server has acknowledged this connection.\n * The upstream session is established once per connection, no matter\n * how many subscriptions pass through it.\n */\n upstreamSession?: Promise<void>\n}\n\n/**\n * Connect to the original server and initialize the `graphql-transport-ws`\n * session for the given connection, at most once.\n *\n * @note The server connection is shared by every subscription of this\n * client. Initializing it more than once makes a compliant GraphQL server\n * close it (\"Too many initialisation requests\").\n */\nfunction ensureUpstreamSession(\n connection: GraphQLSubscriptionConnection,\n): Promise<void> {\n if (connection.upstreamSession) {\n return connection.upstreamSession\n }\n\n const { server } = connection\n\n connection.upstreamSession = new Promise<void>((resolve) => {\n server.addEventListener('message', (event) => {\n const message =\n parseGraphQLWebSocketMessage<GraphQLWebSocketServerMessage>(event.data)\n\n if (message?.type === 'connection_ack') {\n // Prevent the original acknowledgement from being forwarded to\n // the client: it has already received a mocked one on connect.\n event.preventDefault()\n resolve()\n }\n })\n\n server.addEventListener(\n 'open',\n () => {\n server.send(createInitMessage(connection.connectionParams))\n },\n { once: true },\n )\n\n server.connect()\n })\n\n return connection.upstreamSession\n}\n\n/**\n * The `graphql-transport-ws` sessions of the intercepted WebSocket\n * connections, keyed by the client id.\n *\n * @note This registry is module-level, and not per-transport, on purpose.\n * Multiple `graphql.link()` calls to the same endpoint create multiple\n * transports, and all of them must share a single session per connection.\n * Otherwise, each transport binds its own protocol listeners to the same\n * client, which makes it receive duplicate `connection_ack`/`pong` frames\n * and resolves matching subscription handlers more than once.\n */\nconst connections = new Map<string, GraphQLSubscriptionConnection>()\n\n/**\n * The WebSocket protocol implemented by the subscription transport.\n * @see https://github.com/graphql/graphql-over-http/blob/main/rfcs/GraphQLOverWebSocket.md\n */\nconst GRAPHQL_WEBSOCKET_SUBPROTOCOL = 'graphql-transport-ws'\n\nfunction includesGraphQLProtocol(\n protocols: string | Array<string> | null | undefined,\n): boolean {\n if (protocols == null) {\n return false\n }\n\n // Support both the WebSocket constructor argument (a protocol string\n // or a list of protocol strings) and the `Sec-WebSocket-Protocol`\n // request header (a comma-separated list).\n const requestedProtocols =\n typeof protocols === 'string' ? protocols.split(',') : protocols\n\n return requestedProtocols.some((protocol) => {\n return protocol.trim() === GRAPHQL_WEBSOCKET_SUBPROTOCOL\n })\n}\n\n/**\n * A WebSocket handler that only matches connections that requested the\n * `graphql-transport-ws` protocol. Connections without it (e.g.\n * arbitrary non-GraphQL WebSockets whose URL matched a permissive\n * endpoint like a wildcard link) are left unhandled so they follow the\n * regular unhandled connection flow (warnings, passthrough).\n */\nabstract class GraphQLWebSocketHandler extends WebSocketHandler {\n public async run(\n connection: WebSocketConnectionEventData,\n resolutionContext?: WebSocketResolutionContext,\n ): Promise<WebSocketHandlerConnection | null> {\n if (!includesGraphQLProtocol(connection.info.protocols)) {\n return null\n }\n\n return super.run(connection, resolutionContext)\n }\n}\n\n/**\n * A WebSocket handler implementing the `graphql-transport-ws` protocol\n * session for a single GraphQL endpoint. One transport is shared across\n * all subscription handlers created from the same `graphql.link()` call\n * (attached to each of them as a sibling handler).\n *\n * The transport owns the protocol/session concerns: connection\n * acknowledgement, keep-alive, the per-connection registry of active\n * subscriptions, and dispatching parsed `subscribe` operations to the\n * matching subscription handler.\n */\nexport class GraphQLSubscriptionTransportHandler extends GraphQLWebSocketHandler {\n /**\n * Register the given handler as a subscriber to the GraphQL\n * subscriptions on the given WebSocket connection. Subscribers are\n * dispatched in registration order, which follows the handlers\n * resolution order (runtime handlers take precedence).\n */\n public subscribe(\n connection: WebSocketHandlerConnection,\n handler: WebSocketHandler,\n subscriber: GraphQLSubscriptionSubscriber,\n ): void {\n const transportConnection = this.#getOrCreateConnection(connection)\n transportConnection.subscribers.set(handler, {\n transport: this,\n subscriber,\n })\n }\n\n public getConnection(\n clientId: string,\n ): GraphQLSubscriptionConnection | undefined {\n return connections.get(clientId)\n }\n\n public async run(\n connection: WebSocketConnectionEventData,\n resolutionContext?: WebSocketResolutionContext,\n ): Promise<WebSocketHandlerConnection | null> {\n const handlerConnection = await super.run(connection, resolutionContext)\n\n // Capture the network frame events reference for this connection.\n // The transport emits life-cycle events (e.g. \"graphql:subscription\")\n // long after the run: whenever the client sends a \"subscribe\" message.\n if (handlerConnection) {\n const transportConnection = this.#getOrCreateConnection(handlerConnection)\n\n // Never overwrite the events of a session shared with another\n // transport: only the frame that resolved it provides them.\n if (resolutionContext?.events) {\n transportConnection.events = resolutionContext.events\n }\n }\n\n return handlerConnection\n }\n\n /**\n * End the given subscription without notifying the client. Used when\n * the subscription has already been terminated over the wire (e.g. the\n * original server completed it and that frame reached the client).\n */\n public endSubscription(args: {\n clientId: string\n subscriptionId: string\n }): void {\n const connection = connections.get(args.clientId)\n\n if (connection) {\n this.#endSubscription(connection, args.subscriptionId)\n }\n }\n\n /**\n * Schedule a cleanup to run once the given subscription ends.\n *\n * @note If the subscription has already ended by the time this is\n * called, the cleanup runs immediately. The resolver can no longer\n * affect that subscription, so there is nothing left to wait for.\n */\n public finalize(args: {\n clientId: string\n subscriptionId: string\n cleanup: GraphQLSubscriptionCleanup\n }): void {\n const cleanups = connections\n .get(args.clientId)\n ?.subscriptions.get(args.subscriptionId)\n\n if (cleanups) {\n cleanups.push(args.cleanup)\n return\n }\n\n this.#exhaustCleanups([args.cleanup])\n }\n\n async #endAllSubscriptions(\n connection: GraphQLSubscriptionConnection,\n ): Promise<void> {\n const pendingCleanups: Array<Promise<void>> = []\n\n for (const subscriptionId of connection.subscriptions.keys()) {\n pendingCleanups.push(this.#endSubscription(connection, subscriptionId))\n }\n\n await Promise.all(pendingCleanups)\n }\n\n /**\n * End the given subscription and run the cleanups scheduled for it.\n *\n * This is the single exit point for every way a subscription can end:\n * completed by the mock, by the client, or by the original server;\n * terminated with errors; dropped when the client disconnects; or\n * detached from its resolver when the handlers are reset. Ending an\n * already-ended subscription is a no-op, so the cleanups are\n * guaranteed to run at most once.\n */\n #endSubscription(\n connection: GraphQLSubscriptionConnection,\n subscriptionId: string,\n ): Promise<void> {\n const cleanups = connection.subscriptions.get(subscriptionId)\n\n if (!cleanups) {\n return Promise.resolve()\n }\n\n connection.subscriptions.delete(subscriptionId)\n return this.#exhaustCleanups(cleanups)\n }\n\n /**\n * Run the given cleanups as LIFO, consistently with `finalize()` in\n * the request handlers. Cleanups are detached from the subscription\n * life-cycle: nothing awaits them, so this must never reject.\n */\n async #exhaustCleanups(\n cleanups: Array<GraphQLSubscriptionCleanup>,\n ): Promise<void> {\n const errors: Array<Error> = []\n\n for (let index = cleanups.length - 1; index >= 0; index--) {\n try {\n await cleanups[index]()\n } catch (error) {\n if (error instanceof Error) {\n errors.push(error)\n }\n }\n }\n\n if (errors.length > 0) {\n devUtils.error(\n 'Failed to execute the cleanup for a GraphQL subscription to \"%s\". Please see the original error below.',\n this.url.toString(),\n new AggregateError(errors),\n )\n }\n }\n\n /**\n * Send a `next` message with the given payload to the subscription.\n */\n public publish(args: {\n clientId: string\n subscriptionId: string\n payload: GraphQLSubscriptionPayload\n }): void {\n const connection = this.#getConnectionForSubscription({\n clientId: args.clientId,\n subscriptionId: args.subscriptionId,\n intent: 'publish to',\n })\n\n if (!connection) {\n return\n }\n\n connection.client.send(\n createNextMessage({\n id: args.subscriptionId,\n payload: args.payload,\n }),\n )\n }\n\n /**\n * Send a terminal `error` message to the subscription and\n * removes it from the registry of active subscriptions.\n */\n public error(args: {\n clientId: string\n subscriptionId: string\n errors: ReadonlyArray<Partial<GraphQLError>>\n }): void {\n const connection = this.#getConnectionForSubscription({\n clientId: args.clientId,\n subscriptionId: args.subscriptionId,\n intent: 'error',\n })\n\n if (!connection) {\n return\n }\n\n connection.client.send(\n createErrorMessage({\n id: args.subscriptionId,\n payload: args.errors,\n }),\n )\n this.#endSubscription(connection, args.subscriptionId)\n }\n\n /**\n * Send a `complete` message to the subscription and removes it\n * from the registry of active subscriptions.\n */\n public complete(args: { clientId: string; subscriptionId: string }): void {\n const connection = this.#getConnectionForSubscription({\n clientId: args.clientId,\n subscriptionId: args.subscriptionId,\n intent: 'complete',\n })\n\n if (!connection) {\n return\n }\n\n connection.client.send(createCompleteMessage({ id: args.subscriptionId }))\n this.#endSubscription(connection, args.subscriptionId)\n }\n\n /**\n * Drop this transport's subscribers and active subscriptions from the\n * sessions it participates in. The sessions themselves are left intact:\n * they are shared with the other transports of the same connection and\n * own the protocol listeners for as long as the client stays connected.\n *\n * @note This method is invoked automatically when the handlers\n * controller resets the handlers (e.g. `server.resetHandlers()`).\n */\n public reset(): void {\n for (const connection of connections.values()) {\n let ownsConnection = false\n\n for (const [handler, entry] of connection.subscribers) {\n if (entry.transport === this) {\n connection.subscribers.delete(handler)\n ownsConnection = true\n }\n }\n\n // Resetting the handlers detaches the resolvers from their\n // subscriptions, so run their cleanups instead of dropping them.\n if (ownsConnection) {\n this.#endAllSubscriptions(connection)\n }\n }\n }\n\n /**\n * Forget the sessions of this transport, ending their subscriptions.\n * @note This method is invoked automatically when the network is\n * disabled (e.g. `server.close()`).\n */\n public dispose(): MaybePromise<void> {\n const pendingCleanups: Array<Promise<void>> = []\n\n for (const [clientId, connection] of connections) {\n for (const [handler, entry] of connection.subscribers) {\n if (entry.transport === this) {\n connection.subscribers.delete(handler)\n }\n }\n\n // A session is shared by all the transports of the same endpoint,\n // so it's only torn down once the last of them is disposed of.\n if (connection.subscribers.size === 0) {\n pendingCleanups.push(this.#endAllSubscriptions(connection))\n connections.delete(clientId)\n }\n }\n\n if (pendingCleanups.length > 0) {\n return Promise.all(pendingCleanups).then(() => {})\n }\n }\n\n /**\n * @note The transport is the sole owner of logging for GraphQL\n * subscription connections. It logs parsed `graphql-transport-ws`\n * frames instead of raw WebSocket messages.\n */\n public log(connection: WebSocketConnectionEventData): () => void {\n return attachGraphQLSubscriptionLogger(connection)\n }\n\n protected [kConnect](connection: WebSocketHandlerConnection): boolean {\n this.#getOrCreateConnection(connection)\n return true\n }\n\n #getOrCreateConnection(\n connection: WebSocketHandlerConnection,\n ): GraphQLSubscriptionConnection {\n const { client } = connection\n const existingConnection = connections.get(client.id)\n\n if (existingConnection) {\n return existingConnection\n }\n\n const transportConnection: GraphQLSubscriptionConnection = {\n client: connection.client,\n server: connection.server,\n subscribers: new Map(),\n subscriptions: new Map(),\n }\n connections.set(client.id, transportConnection)\n\n // Bind the protocol listeners alongside the session that owns them.\n // Creating the session and binding its listeners is a single step, so\n // they are guaranteed to be bound exactly once per connection no matter\n // how many transports end up sharing this session.\n client.addEventListener('message', (event) => {\n this.#handleClientMessage(client.id, event.data)\n })\n\n client.addEventListener('close', () => {\n // The resolvers can no longer affect any of the subscriptions\n // on this connection once the client disconnects.\n this.#endAllSubscriptions(transportConnection)\n connections.delete(client.id)\n })\n\n return transportConnection\n }\n\n #getConnectionForSubscription(args: {\n clientId: string\n subscriptionId: string\n intent: string\n }): GraphQLSubscriptionConnection | undefined {\n const connection = connections.get(args.clientId)\n\n if (!connection || !connection.subscriptions.has(args.subscriptionId)) {\n devUtils.warn(\n 'Failed to %s the GraphQL subscription \"%s\": the subscription is no longer active.',\n args.intent,\n args.subscriptionId,\n )\n return undefined\n }\n\n return connection\n }\n\n #handleClientMessage(clientId: string, data: WebSocketData): void {\n const connection = connections.get(clientId)\n\n if (!connection) {\n return\n }\n\n const message =\n parseGraphQLWebSocketMessage<GraphQLWebSocketClientMessage>(data)\n\n if (!message) {\n return\n }\n\n switch (message.type) {\n case 'connection_init': {\n // Preserve the initialization payload (e.g. the client's\n // credentials) so passthrough can replay it to the server.\n connection.connectionParams = message.payload\n connection.client.send(createAcknowledgeMessage())\n break\n }\n\n case 'ping': {\n connection.client.send(createPongMessage())\n break\n }\n\n case 'subscribe': {\n this.#handleSubscribeMessage(connection, message)\n break\n }\n\n case 'complete': {\n this.#endSubscription(connection, message.id)\n break\n }\n }\n }\n\n #handleSubscribeMessage(\n connection: GraphQLSubscriptionConnection,\n message: GraphQLWebSocketSubscribeMessage,\n ): void {\n let node: ParsedGraphQLQuery\n\n try {\n node = parseDocumentNode(\n parse(message.payload.query),\n message.payload.operationName,\n )\n } catch (error) {\n devUtils.warn(\n 'Failed to intercept a GraphQL subscription to \"%s\": the subscription query is not a valid GraphQL document.\\n\\n%s',\n toPublicUrl(connection.client.url),\n error,\n )\n return\n }\n\n if (node.operationType !== OperationTypeNode.SUBSCRIPTION) {\n devUtils.warn(\n 'Intercepted a GraphQL %s \"%s\" over WebSocket: only subscription operations are supported over the WebSocket transport.',\n node.operationType,\n node.operationName || '(anonymous)',\n )\n return\n }\n\n // Register the subscription before dispatching it so the resolver\n // can publish to it synchronously.\n connection.subscriptions.set(message.id, [])\n\n for (const { subscriber } of connection.subscribers.values()) {\n if (subscriber({ node, message })) {\n this.#emitSubscriptionEvent(connection, node, message)\n return\n }\n }\n\n devUtils.warn(\n 'Intercepted a GraphQL subscription \"%s\" to \"%s\" that has no matching subscription handler. If you wish to mock this subscription, create a subscription handler for it.',\n node.operationName || '(anonymous)',\n toPublicUrl(connection.client.url),\n )\n }\n\n /**\n * Emit the \"graphql:subscription\" life-cycle event on the network.\n * The event is emitted once the subscription has been established:\n * matched by a subscription handler and resolved.\n */\n #emitSubscriptionEvent(\n connection: GraphQLSubscriptionConnection,\n node: ParsedGraphQLQuery,\n message: GraphQLWebSocketSubscribeMessage,\n ): void {\n // Anonymous subscriptions can never match a subscription handler.\n if (!connection.events || !node.operationName) {\n return\n }\n\n connection.events.emit(\n new GraphQLSubscriptionEvent({\n operationName: node.operationName,\n query: message.payload.query,\n variables: { ...message.payload.variables },\n request: createUpgradeRequest(connection.client.url),\n }),\n )\n }\n}\n\nexport type GraphQLSubscriptionName<\n Query extends GraphQLQuery = GraphQLQuery,\n Variables extends GraphQLVariables = GraphQLVariables,\n> = GraphQLHandlerNameSelector | DocumentTypeDecoration<Query, Variables>\n\nexport interface GraphQLSubscriptionResolverInfo<\n Query extends GraphQLQuery = GraphQLQuery,\n Variables extends GraphQLVariables = GraphQLVariables,\n> {\n /**\n * Path parameters parsed from the WebSocket connection URL.\n */\n params: PathParams\n\n /**\n * The name of the intercepted operation.\n */\n operationName: string\n\n /**\n * Intercepted GraphQL subscription.\n */\n subscription: GraphQLSubscription<Query, Variables>\n\n /**\n * The request that established the WebSocket connection this\n * subscription is multiplexed over.\n */\n request: Request\n\n /**\n * Schedule a cleanup to run once this subscription ends and the\n * resolver can no longer affect it: it has been completed (by the mock,\n * the client, or the original server), terminated with errors, or the\n * client has disconnected.\n *\n * @example\n * api.subscription('OnCommentAdded', ({ subscription, finalize }) => {\n * const interval = setInterval(() => subscription.publish(payload), 1000)\n * finalize(() => clearInterval(interval))\n * })\n */\n finalize: ResponseResolverFinalizeFunction\n}\n\nexport type GraphQLSubscriptionResolver<\n Query extends GraphQLQuery = GraphQLQuery,\n Variables extends GraphQLVariables = GraphQLVariables,\n> = (info: GraphQLSubscriptionResolverInfo<Query, Variables>) => void\n\nexport interface GraphQLSubscriptionHandlerOptions {\n /**\n * Mark this handler as used after its first match.\n * Used handlers do not match subsequent subscriptions.\n */\n once?: boolean\n}\n\n/**\n * A WebSocket handler intercepting GraphQL subscriptions by their\n * operation name. Matching and resolution are delegated to it by the\n * subscription transport (its sibling handler) so the first matching\n * handler wins, respecting runtime handler overrides.\n */\nexport class GraphQLSubscriptionHandler<\n Query extends GraphQLQuery = GraphQLQuery,\n Variables extends GraphQLVariables = GraphQLVariables,\n> extends GraphQLWebSocketHandler {\n public info: GraphQLHandlerInfo\n public isUsed: boolean\n\n readonly #operationName: string | RegExp\n readonly #transport: GraphQLSubscriptionTransportHandler\n readonly #resolver: GraphQLSubscriptionResolver<Query, Variables>\n readonly #options: GraphQLSubscriptionHandlerOptions\n\n constructor(args: {\n url: Path\n operationName: GraphQLSubscriptionName<Query, Variables>\n transport: GraphQLSubscriptionTransportHandler\n resolver: GraphQLSubscriptionResolver<Query, Variables>\n options?: GraphQLSubscriptionHandlerOptions\n }) {\n super(args.url)\n\n // Create the same GraphQL handler info as request-based GraphQL\n // handlers so this handler prints nicely during introspection\n // (e.g. `server.listHandlers()`). This also normalizes `DocumentNode`\n // and typed document predicates to plain operation names.\n this.info = GraphQLHandler.parseGraphQLRequestInfo({\n operationType: OperationTypeNode.SUBSCRIPTION,\n predicate: args.operationName,\n url: args.url,\n })\n\n const { operationName } = this.info\n\n invariant(\n typeof operationName !== 'function' && !isDocumentNode(operationName),\n 'Failed to create a GraphQL subscription handler: custom predicates are not supported for subscriptions',\n )\n\n this.#operationName = operationName\n this.#transport = args.transport\n this.#resolver = args.resolver\n this.#options = args.options || {}\n this.isUsed = false\n }\n\n public reset(): void {\n this.isUsed = false\n }\n\n /**\n * @note Individual subscription handlers stay silent. The subscription\n * transport owns the GraphQL-aware logging for the entire connection\n * (a logger is attached once per matching handler otherwise).\n */\n public log(): () => void {\n return function detachLogger() {}\n }\n\n protected [kConnect](connection: WebSocketHandlerConnection): boolean {\n this.#transport.subscribe(connection, this, (args) => {\n return this.#handleSubscribe(connection, args)\n })\n\n return true\n }\n\n #handleSubscribe(\n connection: WebSocketHandlerConnection,\n args: {\n node: ParsedGraphQLQuery\n message: GraphQLWebSocketSubscribeMessage\n },\n ): boolean {\n if (this.#options.once && this.isUsed) {\n return false\n }\n\n const { operationName } = args.node\n\n if (!operationName || !this.#matchesOperationName(operationName)) {\n return false\n }\n\n this.isUsed = true\n\n const subscription = new GraphQLSubscription<Query, Variables>({\n message: args.message,\n clientId: connection.client.id,\n transport: this.#transport,\n })\n\n this.#resolver({\n params: connection.params,\n operationName,\n subscription,\n request: createUpgradeRequest(connection.client.url),\n finalize: (cleanup) => {\n this.#transport.finalize({\n clientId: connection.client.id,\n subscriptionId: subscription.id,\n cleanup,\n })\n },\n })\n\n return true\n }\n\n #matchesOperationName(operationName: string): boolean {\n if (this.#operationName instanceof RegExp) {\n return this.#operationName.test(operationName)\n }\n\n return this.#operationName === operationName\n }\n}\n\n/**\n * Representation of the intercepted GraphQL subscription.\n */\nexport class GraphQLSubscription<\n Query extends GraphQLQuery = GraphQLQuery,\n Variables extends GraphQLVariables = GraphQLVariables,\n> {\n public id: string\n public query: string\n public variables: Variables\n public extensions?: Record<string, unknown>\n\n readonly #message: GraphQLWebSocketSubscribeMessage\n readonly #clientId: string\n readonly #transport: GraphQLSubscriptionTransportHandler\n\n constructor(args: {\n message: GraphQLWebSocketSubscribeMessage\n clientId: string\n transport: GraphQLSubscriptionTransportHandler\n }) {\n this.id = args.message.id\n this.query = args.message.payload.query\n this.variables = (args.message.payload.variables || {}) as Variables\n this.extensions = args.message.payload.extensions\n\n this.#message = args.message\n this.#clientId = args.clientId\n this.#transport = args.transport\n }\n\n /**\n * Publish an execution result to the subscribed client.\n *\n * @example\n * subscription.publish({\n * data: {\n * postAdded: {\n * id: 'abc-123'\n * }\n * }\n * })\n */\n public publish(payload: GraphQLSubscriptionPayload<Query>): void {\n this.#transport.publish({\n clientId: this.#clientId,\n subscriptionId: this.id,\n payload,\n })\n }\n\n /**\n * Use the given `Iterable` or `AsyncIterable` as the source\n * of data for this subscription. Whenever the iterable yields a\n * value, it gets published to this subscription.\n *\n * @example\n * subscription.from(async function* () {\n * yield { text: 'hello world' }\n * })\n */\n public async from(\n source: Iterable<Query> | AsyncIterable<Query>,\n ): Promise<void> {\n for await (const data of source) {\n this.publish({ data })\n }\n }\n\n /**\n * Terminate this subscription with the given errors.\n *\n * @example\n * subscription.error([{ message: 'Something went wrong' }])\n */\n public error(errors: ReadonlyArray<Partial<GraphQLError>>): void {\n this.#transport.error({\n clientId: this.#clientId,\n subscriptionId: this.id,\n errors,\n })\n }\n\n /**\n * Marks this subscription as complete.\n *\n * @example\n * subscription.complete()\n */\n public complete(): void {\n this.#transport.complete({\n clientId: this.#clientId,\n subscriptionId: this.id,\n })\n }\n\n /**\n * Perform this GraphQL subscription as-is.\n * This establishes a connection to the actual server, replays\n * the intercepted subscription, and forwards the server payloads\n * to the GraphQL client. You can intercept, modify, or prevent\n * any of the original server messages.\n *\n * @example\n * const postAddedSubscription = subscription.passthrough()\n * postAddedSubscription.addEventListener('next', (event) => {\n * event.preventDefault()\n * event.data.payload.data.postAdded.id = 'mock-id'\n * subscription.publish(event.data.payload)\n * })\n */\n public passthrough(): GraphQLPassthroughSubscription {\n const connection = this.#transport.getConnection(this.#clientId)\n\n /**\n * @note One can only call this method inside the GraphQL subscription\n * handler. By that point, the WebSocket connection has been established\n * and intercepted so the connection reference is guaranteed.\n */\n invariant(\n connection,\n 'Failed to passthrough the GraphQL subscription (\"%s\"): the underlying WebSocket connection is closed',\n this.query,\n )\n\n return new GraphQLPassthroughSubscription({\n server: connection.server,\n message: this.#message,\n upstreamSession: ensureUpstreamSession(connection),\n onTerminate: () => {\n this.#transport.endSubscription({\n clientId: this.#clientId,\n subscriptionId: this.id,\n })\n },\n })\n }\n}\n\nexport type GraphQLPassthroughSubscriptionEventMap = {\n connection_ack: TypedEvent\n next: TypedEvent<GraphQLWebSocketNextMessage>\n error: TypedEvent<GraphQLWebSocketErrorMessage>\n complete: TypedEvent<GraphQLWebSocketCompleteMessage>\n}\n\n/**\n * Representation of a GraphQL subscription to the actual server.\n * You interface with this object from the client's perspective.\n */\nexport class GraphQLPassthroughSubscription {\n readonly #server: WebSocketServerHandle\n readonly #message: GraphQLWebSocketSubscribeMessage\n readonly #emitter: Emitter<GraphQLPassthroughSubscriptionEventMap>\n readonly #abortController: AbortController\n readonly #onTerminate: () => void\n\n constructor(args: {\n server: WebSocketServerHandle\n message: GraphQLWebSocketSubscribeMessage\n upstreamSession: Promise<void>\n onTerminate: () => void\n }) {\n this.#server = args.server\n this.#message = args.message\n this.#onTerminate = args.onTerminate\n this.#emitter = new Emitter()\n\n // An abort controller responsible for removing the server event\n // listeners once the subscription is unsubscribed.\n this.#abortController = new AbortController()\n\n // Replay this subscription once the shared upstream session is\n // established, so the server can authorize this client first.\n args.upstreamSession.then(() => {\n if (!this.#abortController.signal.aborted) {\n this.#server.send(JSON.stringify(this.#message))\n }\n })\n\n this.#server.addEventListener(\n 'message',\n (event) => {\n const message =\n parseGraphQLWebSocketMessage<GraphQLWebSocketServerMessage>(\n event.data,\n )\n\n if (!message) {\n return\n }\n\n switch (message.type) {\n case 'connection_ack': {\n event.preventDefault()\n this.#emitter.emit(new TypedEvent('connection_ack'))\n break\n }\n\n case 'next': {\n if (message.id !== this.#message.id) {\n break\n }\n\n const nextEvent = new TypedEvent('next', { data: message })\n this.#emitter.emit(nextEvent)\n\n if (nextEvent.defaultPrevented) {\n event.preventDefault()\n }\n\n break\n }\n\n case 'error': {\n if (message.id !== this.#message.id) {\n break\n }\n\n const errorEvent = new TypedEvent('error', { data: message })\n this.#emitter.emit(errorEvent)\n\n if (errorEvent.defaultPrevented) {\n event.preventDefault()\n break\n }\n\n // The original server terminated the subscription and that\n // frame reaches the client, so the subscription ends here.\n // A prevented frame means the mock took over instead.\n this.#onTerminate()\n break\n }\n\n case 'complete': {\n if (message.id !== this.#message.id) {\n break\n }\n\n const completeEvent = new TypedEvent('complete', { data: message })\n this.#emitter.emit(completeEvent)\n\n if (completeEvent.defaultPrevented) {\n event.preventDefault()\n break\n }\n\n this.#onTerminate()\n break\n }\n }\n },\n { signal: this.#abortController.signal },\n )\n }\n\n /**\n * Add an event listener to the given GraphQL subscription event.\n *\n * @example\n * const onPostAddedSubscription = subscription.passthrough()\n * onPostAddedSubscription.addEventListener('next', (event) => {\n * console.log(event.data)\n * // { id, payload, ... }\n * })\n */\n public addEventListener<\n EventType extends keyof GraphQLPassthroughSubscriptionEventMap & string,\n >(\n event: EventType,\n listener: Emitter.Listener<\n Emitter<GraphQLPassthroughSubscriptionEventMap>,\n EventType\n >,\n ): void {\n this.#emitter.on(event, listener, {\n signal: this.#abortController.signal,\n })\n }\n\n /**\n * Unsubscribe from this passthrough GraphQL subscription.\n * This stops this subscription on the original server.\n *\n * @note Unsubscribing from the original subscription has no\n * effect on the intercepted `subscription` object.\n *\n * @example\n * const onPostAddedSubscription = subscription.passthrough()\n * onPostAddedSubscription.unsubscribe()\n */\n public unsubscribe(): void {\n this.#abortController.abort()\n this.#emitter.removeAllListeners()\n\n /**\n * @note Complete this subscription instead of closing the server\n * connection. That connection is shared by every subscription of\n * this client, and closing it would terminate the unrelated ones.\n */\n this.#server.send(createCompleteMessage({ id: this.#message.id }))\n }\n}\n\nfunction logGraphQLFrame(args: {\n color: string\n label: string\n payload?: unknown\n}): void {\n const timestamp = getTimestamp({ milliseconds: true })\n\n if (typeof args.payload === 'undefined') {\n // eslint-disable-next-line no-console\n console.log(\n devUtils.formatMessage(`${timestamp} %c${args.label}%c`),\n `color:${args.color}`,\n 'color:inherit',\n )\n return\n }\n\n console.groupCollapsed(\n devUtils.formatMessage(`${timestamp} %c${args.label}%c`),\n `color:${args.color}`,\n 'color:inherit',\n )\n // eslint-disable-next-line no-console\n console.log(args.payload)\n console.groupEnd()\n}\n\n/**\n * Attach a GraphQL-aware logger to the intercepted WebSocket connection.\n * Unlike the raw WebSocket logger, this logger prints parsed\n * `graphql-transport-ws` frames relevant to the subscription.\n */\nfunction attachGraphQLSubscriptionLogger(\n connection: WebSocketConnectionEventData,\n): () => void {\n const { client } = connection\n const abortController = new AbortController()\n\n logGraphQLFrame({\n color: colors.system,\n label: `GraphQL subscription connection ${toPublicUrl(client.url)}`,\n })\n\n client.addEventListener(\n 'message',\n (event) => {\n const message =\n parseGraphQLWebSocketMessage<GraphQLWebSocketClientMessage>(event.data)\n\n if (!message) {\n return\n }\n\n switch (message.type) {\n case 'subscribe': {\n logGraphQLFrame({\n color: colors.outgoing,\n label: `subscribe (id: ${message.id})`,\n payload: message.payload,\n })\n break\n }\n\n case 'complete': {\n logGraphQLFrame({\n color: colors.outgoing,\n label: `complete (id: ${message.id})`,\n })\n break\n }\n }\n },\n { signal: abortController.signal },\n )\n\n // Proxy `client.send` to log the frames published to the client\n // (`client.send` does not dispatch any observable events).\n const originalClientSend = client.send\n\n client.send = new Proxy(client.send, {\n apply: (target, thisArg, args) => {\n const [data] = args\n const message =\n parseGraphQLWebSocketMessage<GraphQLWebSocketServerMessage>(data)\n\n if (message) {\n switch (message.type) {\n case 'next': {\n logGraphQLFrame({\n color: colors.mocked,\n label: `next (id: ${message.id})`,\n payload: message.payload,\n })\n break\n }\n\n case 'error': {\n logGraphQLFrame({\n color: colors.mocked,\n label: `error (id: ${message.id})`,\n payload: message.payload,\n })\n break\n }\n\n case 'complete': {\n logGraphQLFrame({\n color: colors.mocked,\n label: `complete (id: ${message.id})`,\n })\n break\n }\n }\n }\n\n return Reflect.apply(target, thisArg, args)\n },\n })\n\n return function detachLogger() {\n abortController.abort()\n client.send = originalClientSend\n }\n}\n\nexport type GraphQLSubscriptionHandlerFactory = <\n Query extends GraphQLQuery = GraphQLQuery,\n Variables extends GraphQLVariables = GraphQLVariables,\n>(\n operationName: GraphQLSubscriptionName<Query, Variables>,\n resolver: GraphQLSubscriptionResolver<Query, Variables>,\n options?: GraphQLSubscriptionHandlerOptions,\n) => GraphQLSubscriptionHandler<Query, Variables>\n\n/**\n * Create a `subscription()` handler factory bound to the given GraphQL\n * endpoint. All subscription handlers created by the factory share a single\n * subscription transport and a single WebSocket upgrade handler, both\n * attached to each handler as siblings.\n *\n * @example\n * const subscription = createGraphQLSubscriptionHandler('https://api.example.com/graphql')\n * subscription('OnPostAdded', ({ subscription }) => {\n * subscription.publish({ data: { postAdded: { id: 'abc-123' } } })\n * })\n */\nexport function createGraphQLSubscriptionHandler(\n url: Path,\n): GraphQLSubscriptionHandlerFactory {\n const webSocketUrl =\n typeof url === 'string' ? url.replace(/^http/, 'ws') : url\n\n const transport = new GraphQLSubscriptionTransportHandler(webSocketUrl)\n\n // The `upgrade` request handler enables WebSocket interception in Node.js.\n // The same handler instance is shared between all subscription handlers\n // of this endpoint (sibling handlers are deduped by reference).\n const upgradeHandler = http.get(({ request }) => {\n return (\n request.headers.get('upgrade')?.toLowerCase() === 'websocket' &&\n includesGraphQLProtocol(request.headers.get('sec-websocket-protocol')) &&\n matchRequestUrl(new URL(resolveWebSocketUrl(request.url)), webSocketUrl)\n .matches\n )\n }, webSocketUpgrade)\n\n return (operationName, resolver, options) => {\n const handler = new GraphQLSubscriptionHandler({\n url: webSocketUrl,\n operationName,\n transport,\n resolver,\n options,\n })\n\n return attachSiblingHandlers(handler, [transport, upgradeHandler])\n }\n}\n","import type {\n ResponseResolver,\n RequestHandlerOptions,\n} from '#core/handlers/request-handler'\nimport {\n GraphQLHandler,\n type GraphQLVariables,\n type GraphQLOperationType,\n type GraphQLResolverExtras,\n type GraphQLResponseBody,\n type GraphQLQuery,\n type GraphQLPredicate,\n} from './graphql-handler'\nimport { createRequestId } from '@mswjs/interceptors'\nimport { getAllRequestCookies } from '#core/utils/request/get-request-cookies'\nimport type { Path } from '#core/utils/matching/match-request-url'\nimport { attachSiblingHandlers } from '#core/utils/internal/attach-sibling-handlers'\nimport {\n createGraphQLSubscriptionHandler,\n type GraphQLSubscriptionHandlerFactory,\n} from './graphql-subscription'\n\nexport type GraphQLRequestHandler = <\n Query extends GraphQLQuery = GraphQLQuery,\n Variables extends GraphQLVariables = GraphQLVariables,\n>(\n predicate: GraphQLPredicate<Query, Variables>,\n resolver: GraphQLResponseResolver<\n [Query] extends [never] ? GraphQLQuery : Query,\n Variables\n >,\n options?: RequestHandlerOptions,\n) => GraphQLHandler\n\nexport type GraphQLOperationHandler = <\n Query extends GraphQLQuery = GraphQLQuery,\n Variables extends GraphQLVariables = GraphQLVariables,\n>(\n resolver: GraphQLResponseResolver<\n [Query] extends [never] ? GraphQLQuery : Query,\n Variables\n >,\n options?: RequestHandlerOptions,\n) => GraphQLHandler\n\nexport type GraphQLResponseResolver<\n Query extends GraphQLQuery = GraphQLQuery,\n Variables extends GraphQLVariables = GraphQLVariables,\n> = ResponseResolver<\n GraphQLResolverExtras<Variables>,\n null,\n GraphQLResponseBody<[Query] extends [never] ? GraphQLQuery : Query>\n>\n\nfunction createScopedGraphQLHandler(\n operationType: GraphQLOperationType,\n url: Path,\n): GraphQLRequestHandler {\n return (predicate, resolver, options = {}) => {\n return new GraphQLHandler(operationType, predicate, url, resolver, options)\n }\n}\n\nfunction createGraphQLOperationHandler(\n url: Path,\n subscriptionFactory?: GraphQLSubscriptionHandlerFactory,\n): GraphQLOperationHandler {\n /**\n * @note An explicitly generic function so the subscription sibling\n * can be created with the same `Query`/`Variables` types as the\n * operation resolver, without casting its resolver info.\n */\n return <\n Query extends GraphQLQuery = GraphQLQuery,\n Variables extends GraphQLVariables = GraphQLVariables,\n >(\n resolver: GraphQLResponseResolver<\n [Query] extends [never] ? GraphQLQuery : Query,\n Variables\n >,\n options?: RequestHandlerOptions,\n ): GraphQLHandler => {\n const handler = new GraphQLHandler(\n 'all',\n new RegExp('.*'),\n url,\n resolver,\n options,\n )\n\n if (!subscriptionFactory) {\n return handler\n }\n\n // Attach a catch-all subscription handler as a sibling so the\n // operation handler also matches GraphQL subscriptions over WebSocket.\n // The subscription transport guarantees only actual GraphQL\n // subscriptions are dispatched to it.\n const subscriptionCatchAllHandler = subscriptionFactory<Query, Variables>(\n new RegExp('.*'),\n ({ operationName, subscription, request, finalize }) => {\n /**\n * @note Subscriptions are resolved imperatively, so the return\n * value of the resolver is ignored. The request describes the\n * WebSocket connection this subscription is multiplexed over.\n */\n resolver({\n operationName,\n query: subscription.query,\n variables: subscription.variables,\n cookies: getAllRequestCookies(request),\n request,\n requestId: createRequestId(),\n finalize,\n })\n },\n // Forward the handler options so a one-time operation handler is\n // also consumed by the first subscription it matches.\n options,\n )\n\n return attachSiblingHandlers(handler, [subscriptionCatchAllHandler])\n }\n}\n\nexport interface GraphQLLink {\n query: GraphQLRequestHandler\n mutation: GraphQLRequestHandler\n operation: GraphQLOperationHandler\n /**\n * Intercept a GraphQL subscription.\n *\n * @example\n * const api = graphql.link('https://api.example.com/graphql')\n * api.subscription('OnPostAdded', ({ subscription }) => {\n * subscription.publish({\n * data: { postAdded: { id: 'abc-123' } },\n * })\n * })\n */\n subscription: GraphQLSubscriptionHandlerFactory\n}\n\n/**\n * A namespace to intercept and mock GraphQL operations\n *\n * @example\n * const api = graphql.link('https://api.example.com/graphql')\n * api.query('GetUser', resolver)\n * api.mutation('DeletePost', resolver)\n *\n * @see {@link https://mswjs.io/docs/api/graphql `graphql` API reference}\n */\nexport const graphql = {\n /**\n * Intercepts GraphQL operations scoped by the given URL.\n *\n * @example\n * const github = graphql.link('https://api.github.com/graphql')\n * github.query('GetRepo', resolver)\n *\n * @see {@link https://mswjs.io/docs/api/graphql#graphqllinkurl `graphql.link()` API reference}\n */\n link(url: Path): GraphQLLink {\n /**\n * @note Create the subscription handler factory once per link so\n * the `subscription()` and `operation()` handlers share the same\n * underlying subscription transport (deduped by reference).\n */\n const subscription = createGraphQLSubscriptionHandler(url)\n\n return {\n operation: createGraphQLOperationHandler(url, subscription),\n query: createScopedGraphQLHandler('query', url),\n mutation: createScopedGraphQLHandler('mutation', url),\n subscription,\n }\n },\n}\n"],"mappings":";;;;;;;;;;;;;;AAgBA,SAAS,oBAAoB,eAA6C;CACxE,MAAM,UAAU,gBAAgB,aAAa;CAC7C,MAAM,cAAc,QAAQ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AAI,OAAO,IAAI,IACd,EAAE,eAAe,cAAc,SAAS,eAAe;;;;;;GAMtD,SAAS;IACP;IACA,OAAO,aAAa;IACpB,WAAW,aAAa;IACxB,SAAS,qBAAqB,OAAO;IACrC;IACA,WAAW,gBAAgB;IAC3B;GACF,CAAC;EACH,GAGA,OACF;EAEA,OAAO,sBAAsB,SAAS,CAAC,2BAA2B,CAAC;CACrE;AACF;;;;;;;;;;;AA8BA,MAAa,UAAU;;;;;;;;;;AAUrB,KAAK,KAAwB;;;;;;CAM3B,MAAM,eAAe,iCAAiC,GAAG;CAEzD,OAAO;EACL,WAAW,8BAA8B,KAAK,YAAY;EAC1D,OAAO,2BAA2B,SAAS,GAAG;EAC9C,UAAU,2BAA2B,YAAY,GAAG;EACpD;CACF;AACF,EACF"}
@@ -0,0 +1,4 @@
1
+ import { h as StrictRequest, m as HttpResponseInit, p as HttpResponse } from "../_chunks/request-handler.js";
2
+ import { a as HttpMethods, c as HttpRequestResolverExtras, i as HttpHandlerMethod, l as RequestQuery, n as HttpHandler, o as HttpRequestParsedResult, r as HttpHandlerInfo, t as HttpCustomPredicate } from "../_chunks/http-handler.js";
3
+ import { n as HttpResponseResolver, r as http, t as HttpRequestHandler } from "../_chunks/http.js";
4
+ export { type HttpCustomPredicate, HttpHandler, type HttpHandlerInfo, type HttpHandlerMethod, HttpMethods, type HttpRequestHandler, type HttpRequestParsedResult, type HttpRequestResolverExtras, HttpResponse, type HttpResponseInit, type HttpResponseResolver, type RequestQuery, type StrictRequest, http };
@@ -0,0 +1,4 @@
1
+ import { n as HttpMethods, t as HttpHandler } from "../_chunks/http-handler.js";
2
+ import { t as http } from "../_chunks/http.js";
3
+ import { t as HttpResponse } from "../_chunks/http-response.js";
4
+ export { HttpHandler, HttpMethods, HttpResponse, http };