serverless-spy 0.0.9 → 0.0.10

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 (346) hide show
  1. package/.jsii +5 -2
  2. package/cli/cli.ts +1 -1
  3. package/cli/node_modules/ws/LICENSE +19 -0
  4. package/cli/node_modules/ws/README.md +495 -0
  5. package/cli/node_modules/ws/browser.js +8 -0
  6. package/cli/node_modules/ws/index.js +13 -0
  7. package/cli/node_modules/ws/lib/buffer-util.js +127 -0
  8. package/cli/node_modules/ws/lib/constants.js +12 -0
  9. package/cli/node_modules/ws/lib/event-target.js +266 -0
  10. package/cli/node_modules/ws/lib/extension.js +203 -0
  11. package/cli/node_modules/ws/lib/limiter.js +55 -0
  12. package/cli/node_modules/ws/lib/permessage-deflate.js +511 -0
  13. package/cli/node_modules/ws/lib/receiver.js +618 -0
  14. package/cli/node_modules/ws/lib/sender.js +478 -0
  15. package/cli/node_modules/ws/lib/stream.js +159 -0
  16. package/cli/node_modules/ws/lib/subprotocol.js +62 -0
  17. package/cli/node_modules/ws/lib/validation.js +125 -0
  18. package/cli/node_modules/ws/lib/websocket-server.js +535 -0
  19. package/cli/node_modules/ws/lib/websocket.js +1305 -0
  20. package/cli/node_modules/ws/package.json +61 -0
  21. package/cli/node_modules/ws/wrapper.mjs +8 -0
  22. package/cli/ws.ts +1 -1
  23. package/lib/cjs/cli/cli.d.ts +1 -0
  24. package/lib/cjs/cli/cli.js +87 -0
  25. package/lib/cjs/cli/ws.d.ts +1 -0
  26. package/lib/cjs/cli/ws.js +68 -0
  27. package/lib/cjs/common/getWebSocketUrl.d.ts +2 -0
  28. package/lib/cjs/common/getWebSocketUrl.js +57 -0
  29. package/lib/cjs/index.d.ts +2 -0
  30. package/lib/cjs/index.js +19 -0
  31. package/lib/cjs/listener/PrettifyForDisplay.d.ts +3 -0
  32. package/lib/cjs/listener/PrettifyForDisplay.js +3 -0
  33. package/lib/cjs/listener/RecursivePartial.d.ts +4 -0
  34. package/lib/cjs/listener/RecursivePartial.js +3 -0
  35. package/lib/cjs/listener/SpyHandlers.ts.d.ts +109 -0
  36. package/lib/cjs/listener/SpyHandlers.ts.js +3 -0
  37. package/lib/cjs/listener/SpyListener.d.ts +40 -0
  38. package/lib/cjs/listener/SpyListener.js +3 -0
  39. package/lib/cjs/listener/createServerlessSpyListener.d.ts +13 -0
  40. package/lib/cjs/listener/createServerlessSpyListener.js +167 -0
  41. package/lib/cjs/listener/index.d.ts +2 -0
  42. package/lib/cjs/listener/index.js +19 -0
  43. package/lib/cjs/listener/matchers.d.ts +0 -0
  44. package/lib/cjs/listener/matchers.js +55 -0
  45. package/lib/cjs/listener/setup.d.ts +0 -0
  46. package/lib/cjs/listener/setup.js +21 -0
  47. package/lib/{ServerlessSpy.d.ts → cjs/src/ServerlessSpy.d.ts} +0 -0
  48. package/lib/{ServerlessSpy.js → cjs/src/ServerlessSpy.js} +1 -1
  49. package/lib/{index.d.ts → cjs/src/index.d.ts} +0 -0
  50. package/lib/{index.js → cjs/src/index.js} +0 -0
  51. package/lib/mjs/cli/cli.d.ts +1 -0
  52. package/lib/mjs/cli/cli.js +85 -0
  53. package/lib/mjs/cli/ws.d.ts +1 -0
  54. package/lib/mjs/cli/ws.js +66 -0
  55. package/lib/mjs/common/getWebSocketUrl.d.ts +2 -0
  56. package/lib/mjs/common/getWebSocketUrl.js +53 -0
  57. package/lib/mjs/index.d.ts +2 -0
  58. package/lib/mjs/index.js +3 -0
  59. package/lib/mjs/listener/PrettifyForDisplay.d.ts +3 -0
  60. package/lib/mjs/listener/PrettifyForDisplay.js +2 -0
  61. package/lib/mjs/listener/RecursivePartial.d.ts +4 -0
  62. package/lib/mjs/listener/RecursivePartial.js +2 -0
  63. package/lib/mjs/listener/SpyHandlers.ts.d.ts +109 -0
  64. package/lib/mjs/listener/SpyHandlers.ts.js +2 -0
  65. package/lib/mjs/listener/SpyListener.d.ts +40 -0
  66. package/lib/mjs/listener/SpyListener.js +2 -0
  67. package/lib/mjs/listener/createServerlessSpyListener.d.ts +13 -0
  68. package/lib/mjs/listener/createServerlessSpyListener.js +163 -0
  69. package/lib/mjs/listener/index.d.ts +2 -0
  70. package/lib/mjs/listener/index.js +3 -0
  71. package/lib/mjs/listener/matchers.d.ts +0 -0
  72. package/lib/mjs/listener/matchers.js +55 -0
  73. package/lib/mjs/listener/setup.d.ts +0 -0
  74. package/lib/mjs/listener/setup.js +21 -0
  75. package/lib/mjs/src/ServerlessSpy.d.ts +27 -0
  76. package/lib/mjs/src/ServerlessSpy.js +293 -0
  77. package/lib/mjs/src/index.d.ts +1 -0
  78. package/lib/mjs/src/index.js +2 -0
  79. package/listener/node_modules/ws/LICENSE +19 -0
  80. package/listener/node_modules/ws/README.md +495 -0
  81. package/listener/node_modules/ws/browser.js +8 -0
  82. package/listener/node_modules/ws/index.js +13 -0
  83. package/listener/node_modules/ws/lib/buffer-util.js +127 -0
  84. package/listener/node_modules/ws/lib/constants.js +12 -0
  85. package/listener/node_modules/ws/lib/event-target.js +266 -0
  86. package/listener/node_modules/ws/lib/extension.js +203 -0
  87. package/listener/node_modules/ws/lib/limiter.js +55 -0
  88. package/listener/node_modules/ws/lib/permessage-deflate.js +511 -0
  89. package/listener/node_modules/ws/lib/receiver.js +618 -0
  90. package/listener/node_modules/ws/lib/sender.js +478 -0
  91. package/listener/node_modules/ws/lib/stream.js +159 -0
  92. package/listener/node_modules/ws/lib/subprotocol.js +62 -0
  93. package/listener/node_modules/ws/lib/validation.js +125 -0
  94. package/listener/node_modules/ws/lib/websocket-server.js +535 -0
  95. package/listener/node_modules/ws/lib/websocket.js +1305 -0
  96. package/listener/node_modules/ws/package.json +61 -0
  97. package/listener/node_modules/ws/wrapper.mjs +8 -0
  98. package/node_modules/@aws-crypto/crc32/node_modules/tslib/package.json +1 -5
  99. package/node_modules/@aws-crypto/crc32/package.json +1 -5
  100. package/node_modules/@aws-crypto/crc32c/node_modules/tslib/package.json +1 -5
  101. package/node_modules/@aws-crypto/crc32c/package.json +1 -5
  102. package/node_modules/@aws-crypto/ie11-detection/node_modules/tslib/package.json +1 -5
  103. package/node_modules/@aws-crypto/ie11-detection/package.json +1 -5
  104. package/node_modules/@aws-crypto/sha1-browser/node_modules/tslib/package.json +1 -5
  105. package/node_modules/@aws-crypto/sha1-browser/package.json +1 -5
  106. package/node_modules/@aws-crypto/sha256-browser/node_modules/tslib/package.json +1 -5
  107. package/node_modules/@aws-crypto/sha256-browser/package.json +1 -5
  108. package/node_modules/@aws-crypto/sha256-js/node_modules/tslib/package.json +1 -5
  109. package/node_modules/@aws-crypto/sha256-js/package.json +1 -5
  110. package/node_modules/@aws-crypto/supports-web-crypto/node_modules/tslib/package.json +1 -5
  111. package/node_modules/@aws-crypto/supports-web-crypto/package.json +1 -5
  112. package/node_modules/@aws-crypto/util/node_modules/tslib/package.json +1 -5
  113. package/node_modules/@aws-crypto/util/package.json +1 -5
  114. package/node_modules/@aws-sdk/abort-controller/package.json +1 -5
  115. package/node_modules/@aws-sdk/chunked-blob-reader/package.json +1 -5
  116. package/node_modules/@aws-sdk/chunked-blob-reader-native/package.json +1 -5
  117. package/node_modules/@aws-sdk/client-apigatewaymanagementapi/package.json +1 -5
  118. package/node_modules/@aws-sdk/client-cognito-identity/package.json +1 -5
  119. package/node_modules/@aws-sdk/client-dynamodb/package.json +1 -5
  120. package/node_modules/@aws-sdk/client-eventbridge/package.json +1 -5
  121. package/node_modules/@aws-sdk/client-lambda/package.json +1 -5
  122. package/node_modules/@aws-sdk/client-s3/node_modules/entities/package.json +1 -5
  123. package/node_modules/@aws-sdk/client-s3/package.json +1 -5
  124. package/node_modules/@aws-sdk/client-sns/node_modules/entities/package.json +1 -5
  125. package/node_modules/@aws-sdk/client-sns/package.json +1 -5
  126. package/node_modules/@aws-sdk/client-sqs/node_modules/entities/package.json +1 -5
  127. package/node_modules/@aws-sdk/client-sqs/package.json +1 -5
  128. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/abort-controller/package.json +1 -5
  129. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/client-sso/package.json +1 -5
  130. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/client-sts/package.json +1 -5
  131. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/config-resolver/package.json +1 -5
  132. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/credential-provider-env/package.json +1 -5
  133. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/credential-provider-imds/package.json +1 -5
  134. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/credential-provider-ini/package.json +1 -5
  135. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/credential-provider-node/package.json +1 -5
  136. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/credential-provider-process/package.json +1 -5
  137. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/credential-provider-sso/package.json +1 -5
  138. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/credential-provider-web-identity/package.json +1 -5
  139. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/fetch-http-handler/package.json +1 -5
  140. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/hash-node/package.json +1 -5
  141. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/invalid-dependency/package.json +1 -5
  142. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/is-array-buffer/package.json +1 -5
  143. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/middleware-content-length/package.json +1 -5
  144. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/middleware-host-header/package.json +1 -5
  145. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/middleware-logger/package.json +1 -5
  146. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/middleware-retry/package.json +1 -5
  147. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/middleware-sdk-sts/package.json +1 -5
  148. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/middleware-serde/package.json +1 -5
  149. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/middleware-signing/package.json +1 -5
  150. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/middleware-stack/package.json +1 -5
  151. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/middleware-user-agent/package.json +1 -5
  152. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/node-config-provider/package.json +1 -5
  153. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/node-http-handler/package.json +1 -5
  154. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/property-provider/package.json +1 -5
  155. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/protocol-http/package.json +1 -5
  156. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/querystring-builder/package.json +1 -5
  157. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/querystring-parser/package.json +1 -5
  158. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/service-error-classification/package.json +1 -5
  159. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/shared-ini-file-loader/package.json +1 -5
  160. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/signature-v4/package.json +1 -5
  161. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/smithy-client/package.json +1 -5
  162. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/types/package.json +1 -5
  163. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/url-parser/package.json +1 -5
  164. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/util-base64-browser/package.json +1 -5
  165. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/util-base64-node/package.json +1 -5
  166. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/util-body-length-browser/package.json +1 -5
  167. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/util-body-length-node/package.json +1 -5
  168. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/util-buffer-from/package.json +1 -5
  169. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/util-config-provider/package.json +1 -5
  170. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/util-hex-encoding/package.json +1 -5
  171. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/util-uri-escape/package.json +1 -5
  172. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/util-user-agent-browser/package.json +1 -5
  173. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/util-user-agent-node/package.json +1 -5
  174. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/util-utf8-browser/package.json +1 -5
  175. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/util-utf8-node/package.json +1 -5
  176. package/node_modules/@aws-sdk/client-ssm/node_modules/@aws-sdk/util-waiter/package.json +1 -5
  177. package/node_modules/@aws-sdk/client-ssm/node_modules/entities/package.json +1 -5
  178. package/node_modules/@aws-sdk/client-ssm/package.json +1 -5
  179. package/node_modules/@aws-sdk/client-sso/package.json +1 -5
  180. package/node_modules/@aws-sdk/client-sts/node_modules/entities/package.json +1 -5
  181. package/node_modules/@aws-sdk/client-sts/package.json +1 -5
  182. package/node_modules/@aws-sdk/config-resolver/package.json +1 -5
  183. package/node_modules/@aws-sdk/credential-provider-cognito-identity/package.json +1 -5
  184. package/node_modules/@aws-sdk/credential-provider-env/package.json +1 -5
  185. package/node_modules/@aws-sdk/credential-provider-imds/package.json +1 -5
  186. package/node_modules/@aws-sdk/credential-provider-ini/package.json +1 -5
  187. package/node_modules/@aws-sdk/credential-provider-node/package.json +1 -5
  188. package/node_modules/@aws-sdk/credential-provider-process/package.json +1 -5
  189. package/node_modules/@aws-sdk/credential-provider-sso/package.json +1 -5
  190. package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +1 -5
  191. package/node_modules/@aws-sdk/credential-providers/package.json +1 -5
  192. package/node_modules/@aws-sdk/endpoint-cache/package.json +1 -5
  193. package/node_modules/@aws-sdk/eventstream-codec/package.json +1 -5
  194. package/node_modules/@aws-sdk/eventstream-serde-browser/package.json +1 -5
  195. package/node_modules/@aws-sdk/eventstream-serde-config-resolver/package.json +1 -5
  196. package/node_modules/@aws-sdk/eventstream-serde-node/package.json +1 -5
  197. package/node_modules/@aws-sdk/eventstream-serde-universal/package.json +1 -5
  198. package/node_modules/@aws-sdk/fetch-http-handler/package.json +1 -5
  199. package/node_modules/@aws-sdk/hash-blob-browser/package.json +1 -5
  200. package/node_modules/@aws-sdk/hash-node/package.json +1 -5
  201. package/node_modules/@aws-sdk/hash-stream-node/package.json +1 -5
  202. package/node_modules/@aws-sdk/invalid-dependency/package.json +1 -5
  203. package/node_modules/@aws-sdk/is-array-buffer/package.json +1 -5
  204. package/node_modules/@aws-sdk/lib-dynamodb/package.json +1 -5
  205. package/node_modules/@aws-sdk/md5-js/package.json +1 -5
  206. package/node_modules/@aws-sdk/middleware-bucket-endpoint/package.json +1 -5
  207. package/node_modules/@aws-sdk/middleware-content-length/package.json +1 -5
  208. package/node_modules/@aws-sdk/middleware-endpoint-discovery/package.json +1 -5
  209. package/node_modules/@aws-sdk/middleware-expect-continue/package.json +1 -5
  210. package/node_modules/@aws-sdk/middleware-flexible-checksums/package.json +1 -5
  211. package/node_modules/@aws-sdk/middleware-host-header/package.json +1 -5
  212. package/node_modules/@aws-sdk/middleware-location-constraint/package.json +1 -5
  213. package/node_modules/@aws-sdk/middleware-logger/package.json +1 -5
  214. package/node_modules/@aws-sdk/middleware-recursion-detection/package.json +1 -5
  215. package/node_modules/@aws-sdk/middleware-retry/package.json +1 -5
  216. package/node_modules/@aws-sdk/middleware-sdk-eventbridge/package.json +1 -5
  217. package/node_modules/@aws-sdk/middleware-sdk-s3/package.json +1 -5
  218. package/node_modules/@aws-sdk/middleware-sdk-sqs/package.json +1 -5
  219. package/node_modules/@aws-sdk/middleware-sdk-sts/package.json +1 -5
  220. package/node_modules/@aws-sdk/middleware-serde/package.json +1 -5
  221. package/node_modules/@aws-sdk/middleware-signing/package.json +1 -5
  222. package/node_modules/@aws-sdk/middleware-ssec/package.json +1 -5
  223. package/node_modules/@aws-sdk/middleware-stack/package.json +1 -5
  224. package/node_modules/@aws-sdk/middleware-user-agent/package.json +1 -5
  225. package/node_modules/@aws-sdk/node-config-provider/package.json +1 -5
  226. package/node_modules/@aws-sdk/node-http-handler/package.json +1 -5
  227. package/node_modules/@aws-sdk/property-provider/package.json +1 -5
  228. package/node_modules/@aws-sdk/protocol-http/package.json +1 -5
  229. package/node_modules/@aws-sdk/querystring-builder/package.json +1 -5
  230. package/node_modules/@aws-sdk/querystring-parser/package.json +1 -5
  231. package/node_modules/@aws-sdk/service-error-classification/package.json +1 -5
  232. package/node_modules/@aws-sdk/shared-ini-file-loader/package.json +1 -5
  233. package/node_modules/@aws-sdk/signature-v4/package.json +1 -5
  234. package/node_modules/@aws-sdk/signature-v4-multi-region/package.json +1 -5
  235. package/node_modules/@aws-sdk/smithy-client/package.json +1 -5
  236. package/node_modules/@aws-sdk/types/package.json +1 -5
  237. package/node_modules/@aws-sdk/url-parser/package.json +1 -5
  238. package/node_modules/@aws-sdk/util-arn-parser/package.json +1 -5
  239. package/node_modules/@aws-sdk/util-base64-browser/package.json +1 -5
  240. package/node_modules/@aws-sdk/util-base64-node/package.json +1 -5
  241. package/node_modules/@aws-sdk/util-body-length-browser/package.json +1 -5
  242. package/node_modules/@aws-sdk/util-body-length-node/package.json +1 -5
  243. package/node_modules/@aws-sdk/util-buffer-from/package.json +1 -5
  244. package/node_modules/@aws-sdk/util-config-provider/package.json +1 -5
  245. package/node_modules/@aws-sdk/util-credentials/node_modules/@aws-sdk/shared-ini-file-loader/package.json +1 -5
  246. package/node_modules/@aws-sdk/util-credentials/package.json +1 -5
  247. package/node_modules/@aws-sdk/util-defaults-mode-browser/package.json +1 -5
  248. package/node_modules/@aws-sdk/util-defaults-mode-node/package.json +1 -5
  249. package/node_modules/@aws-sdk/util-dynamodb/package.json +1 -5
  250. package/node_modules/@aws-sdk/util-hex-encoding/package.json +1 -5
  251. package/node_modules/@aws-sdk/util-locate-window/package.json +1 -5
  252. package/node_modules/@aws-sdk/util-middleware/package.json +1 -5
  253. package/node_modules/@aws-sdk/util-stream-browser/package.json +1 -5
  254. package/node_modules/@aws-sdk/util-stream-node/package.json +1 -5
  255. package/node_modules/@aws-sdk/util-uri-escape/package.json +1 -5
  256. package/node_modules/@aws-sdk/util-user-agent-browser/package.json +1 -5
  257. package/node_modules/@aws-sdk/util-user-agent-node/package.json +1 -5
  258. package/node_modules/@aws-sdk/util-utf8-browser/package.json +1 -5
  259. package/node_modules/@aws-sdk/util-utf8-node/package.json +1 -5
  260. package/node_modules/@aws-sdk/util-waiter/package.json +1 -5
  261. package/node_modules/@aws-sdk/xml-builder/package.json +1 -5
  262. package/node_modules/@graphql-tools/merge/package.json +0 -4
  263. package/node_modules/@graphql-tools/schema/package.json +0 -4
  264. package/node_modules/@graphql-tools/utils/package.json +0 -4
  265. package/node_modules/@serverless-stack/node/package.json +1 -5
  266. package/node_modules/@tsconfig/node14/package.json +1 -5
  267. package/node_modules/available-typed-arrays/package.json +1 -5
  268. package/node_modules/aws-jwt-verify/package.json +1 -5
  269. package/node_modules/aws-lambda/node_modules/argparse/package.json +1 -5
  270. package/node_modules/aws-lambda/node_modules/commander/package.json +1 -5
  271. package/node_modules/aws-lambda/node_modules/js-yaml/package.json +1 -5
  272. package/node_modules/aws-lambda/package.json +1 -5
  273. package/node_modules/aws-sdk/node_modules/uuid/package.json +1 -5
  274. package/node_modules/aws-sdk/package.json +0 -4
  275. package/node_modules/aws4/package.json +1 -5
  276. package/node_modules/base64-js/package.json +1 -5
  277. package/node_modules/bowser/package.json +1 -5
  278. package/node_modules/buffer/package.json +1 -5
  279. package/node_modules/call-bind/package.json +1 -5
  280. package/node_modules/define-properties/package.json +1 -5
  281. package/node_modules/es-abstract/package.json +1 -5
  282. package/node_modules/es-to-primitive/package.json +1 -5
  283. package/node_modules/esprima/package.json +1 -5
  284. package/node_modules/events/package.json +0 -4
  285. package/node_modules/fast-xml-parser/package.json +1 -5
  286. package/node_modules/for-each/package.json +1 -5
  287. package/node_modules/function-bind/package.json +1 -5
  288. package/node_modules/function.prototype.name/package.json +1 -5
  289. package/node_modules/functions-have-names/package.json +1 -5
  290. package/node_modules/get-intrinsic/package.json +1 -5
  291. package/node_modules/get-symbol-description/package.json +1 -5
  292. package/node_modules/glob-to-regexp/package.json +1 -5
  293. package/node_modules/graceful-fs/package.json +1 -5
  294. package/node_modules/graphql/package.json +1 -5
  295. package/node_modules/graphql-helix/package.json +1 -5
  296. package/node_modules/has/package.json +1 -5
  297. package/node_modules/has-bigints/package.json +1 -5
  298. package/node_modules/has-property-descriptors/package.json +1 -5
  299. package/node_modules/has-symbols/package.json +1 -5
  300. package/node_modules/has-tostringtag/package.json +1 -5
  301. package/node_modules/ieee754/package.json +1 -5
  302. package/node_modules/inherits/package.json +1 -5
  303. package/node_modules/internal-slot/package.json +1 -5
  304. package/node_modules/is-arguments/package.json +1 -5
  305. package/node_modules/is-bigint/package.json +1 -5
  306. package/node_modules/is-boolean-object/package.json +1 -5
  307. package/node_modules/is-callable/package.json +1 -5
  308. package/node_modules/is-date-object/package.json +1 -5
  309. package/node_modules/is-generator-function/package.json +1 -5
  310. package/node_modules/is-negative-zero/package.json +1 -5
  311. package/node_modules/is-number-object/package.json +1 -5
  312. package/node_modules/is-regex/package.json +1 -5
  313. package/node_modules/is-shared-array-buffer/package.json +1 -5
  314. package/node_modules/is-string/package.json +1 -5
  315. package/node_modules/is-symbol/package.json +1 -5
  316. package/node_modules/is-typed-array/package.json +1 -5
  317. package/node_modules/is-weakref/package.json +1 -5
  318. package/node_modules/isarray/package.json +1 -5
  319. package/node_modules/jmespath/package.json +1 -5
  320. package/node_modules/mnemonist/package.json +1 -5
  321. package/node_modules/object-inspect/package.json +1 -5
  322. package/node_modules/object-keys/package.json +1 -5
  323. package/node_modules/object.assign/package.json +1 -5
  324. package/node_modules/obliterator/package.json +1 -5
  325. package/node_modules/querystring/package.json +1 -5
  326. package/node_modules/regexp.prototype.flags/package.json +1 -5
  327. package/node_modules/safe-buffer/package.json +1 -5
  328. package/node_modules/sax/package.json +1 -5
  329. package/node_modules/side-channel/package.json +1 -5
  330. package/node_modules/sprintf-js/package.json +1 -5
  331. package/node_modules/string.prototype.trimend/package.json +1 -5
  332. package/node_modules/string.prototype.trimstart/package.json +1 -5
  333. package/node_modules/tslib/package.json +1 -5
  334. package/node_modules/unbox-primitive/package.json +1 -5
  335. package/node_modules/url/node_modules/punycode/package.json +1 -5
  336. package/node_modules/url/package.json +1 -5
  337. package/node_modules/util/package.json +1 -5
  338. package/node_modules/uuid/package.json +1 -5
  339. package/node_modules/value-or-promise/package.json +1 -5
  340. package/node_modules/watchpack/package.json +1 -5
  341. package/node_modules/which-boxed-primitive/package.json +1 -5
  342. package/node_modules/which-typed-array/package.json +1 -5
  343. package/node_modules/xml2js/node_modules/xmlbuilder/package.json +1 -5
  344. package/node_modules/xml2js/package.json +1 -5
  345. package/package.json +11 -3
  346. package/tsconfig.npm.json +50 -0
@@ -0,0 +1,618 @@
1
+ 'use strict';
2
+
3
+ const { Writable } = require('stream');
4
+
5
+ const PerMessageDeflate = require('./permessage-deflate');
6
+ const {
7
+ BINARY_TYPES,
8
+ EMPTY_BUFFER,
9
+ kStatusCode,
10
+ kWebSocket
11
+ } = require('./constants');
12
+ const { concat, toArrayBuffer, unmask } = require('./buffer-util');
13
+ const { isValidStatusCode, isValidUTF8 } = require('./validation');
14
+
15
+ const GET_INFO = 0;
16
+ const GET_PAYLOAD_LENGTH_16 = 1;
17
+ const GET_PAYLOAD_LENGTH_64 = 2;
18
+ const GET_MASK = 3;
19
+ const GET_DATA = 4;
20
+ const INFLATING = 5;
21
+
22
+ /**
23
+ * HyBi Receiver implementation.
24
+ *
25
+ * @extends Writable
26
+ */
27
+ class Receiver extends Writable {
28
+ /**
29
+ * Creates a Receiver instance.
30
+ *
31
+ * @param {Object} [options] Options object
32
+ * @param {String} [options.binaryType=nodebuffer] The type for binary data
33
+ * @param {Object} [options.extensions] An object containing the negotiated
34
+ * extensions
35
+ * @param {Boolean} [options.isServer=false] Specifies whether to operate in
36
+ * client or server mode
37
+ * @param {Number} [options.maxPayload=0] The maximum allowed message length
38
+ * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
39
+ * not to skip UTF-8 validation for text and close messages
40
+ */
41
+ constructor(options = {}) {
42
+ super();
43
+
44
+ this._binaryType = options.binaryType || BINARY_TYPES[0];
45
+ this._extensions = options.extensions || {};
46
+ this._isServer = !!options.isServer;
47
+ this._maxPayload = options.maxPayload | 0;
48
+ this._skipUTF8Validation = !!options.skipUTF8Validation;
49
+ this[kWebSocket] = undefined;
50
+
51
+ this._bufferedBytes = 0;
52
+ this._buffers = [];
53
+
54
+ this._compressed = false;
55
+ this._payloadLength = 0;
56
+ this._mask = undefined;
57
+ this._fragmented = 0;
58
+ this._masked = false;
59
+ this._fin = false;
60
+ this._opcode = 0;
61
+
62
+ this._totalPayloadLength = 0;
63
+ this._messageLength = 0;
64
+ this._fragments = [];
65
+
66
+ this._state = GET_INFO;
67
+ this._loop = false;
68
+ }
69
+
70
+ /**
71
+ * Implements `Writable.prototype._write()`.
72
+ *
73
+ * @param {Buffer} chunk The chunk of data to write
74
+ * @param {String} encoding The character encoding of `chunk`
75
+ * @param {Function} cb Callback
76
+ * @private
77
+ */
78
+ _write(chunk, encoding, cb) {
79
+ if (this._opcode === 0x08 && this._state == GET_INFO) return cb();
80
+
81
+ this._bufferedBytes += chunk.length;
82
+ this._buffers.push(chunk);
83
+ this.startLoop(cb);
84
+ }
85
+
86
+ /**
87
+ * Consumes `n` bytes from the buffered data.
88
+ *
89
+ * @param {Number} n The number of bytes to consume
90
+ * @return {Buffer} The consumed bytes
91
+ * @private
92
+ */
93
+ consume(n) {
94
+ this._bufferedBytes -= n;
95
+
96
+ if (n === this._buffers[0].length) return this._buffers.shift();
97
+
98
+ if (n < this._buffers[0].length) {
99
+ const buf = this._buffers[0];
100
+ this._buffers[0] = buf.slice(n);
101
+ return buf.slice(0, n);
102
+ }
103
+
104
+ const dst = Buffer.allocUnsafe(n);
105
+
106
+ do {
107
+ const buf = this._buffers[0];
108
+ const offset = dst.length - n;
109
+
110
+ if (n >= buf.length) {
111
+ dst.set(this._buffers.shift(), offset);
112
+ } else {
113
+ dst.set(new Uint8Array(buf.buffer, buf.byteOffset, n), offset);
114
+ this._buffers[0] = buf.slice(n);
115
+ }
116
+
117
+ n -= buf.length;
118
+ } while (n > 0);
119
+
120
+ return dst;
121
+ }
122
+
123
+ /**
124
+ * Starts the parsing loop.
125
+ *
126
+ * @param {Function} cb Callback
127
+ * @private
128
+ */
129
+ startLoop(cb) {
130
+ let err;
131
+ this._loop = true;
132
+
133
+ do {
134
+ switch (this._state) {
135
+ case GET_INFO:
136
+ err = this.getInfo();
137
+ break;
138
+ case GET_PAYLOAD_LENGTH_16:
139
+ err = this.getPayloadLength16();
140
+ break;
141
+ case GET_PAYLOAD_LENGTH_64:
142
+ err = this.getPayloadLength64();
143
+ break;
144
+ case GET_MASK:
145
+ this.getMask();
146
+ break;
147
+ case GET_DATA:
148
+ err = this.getData(cb);
149
+ break;
150
+ default:
151
+ // `INFLATING`
152
+ this._loop = false;
153
+ return;
154
+ }
155
+ } while (this._loop);
156
+
157
+ cb(err);
158
+ }
159
+
160
+ /**
161
+ * Reads the first two bytes of a frame.
162
+ *
163
+ * @return {(RangeError|undefined)} A possible error
164
+ * @private
165
+ */
166
+ getInfo() {
167
+ if (this._bufferedBytes < 2) {
168
+ this._loop = false;
169
+ return;
170
+ }
171
+
172
+ const buf = this.consume(2);
173
+
174
+ if ((buf[0] & 0x30) !== 0x00) {
175
+ this._loop = false;
176
+ return error(
177
+ RangeError,
178
+ 'RSV2 and RSV3 must be clear',
179
+ true,
180
+ 1002,
181
+ 'WS_ERR_UNEXPECTED_RSV_2_3'
182
+ );
183
+ }
184
+
185
+ const compressed = (buf[0] & 0x40) === 0x40;
186
+
187
+ if (compressed && !this._extensions[PerMessageDeflate.extensionName]) {
188
+ this._loop = false;
189
+ return error(
190
+ RangeError,
191
+ 'RSV1 must be clear',
192
+ true,
193
+ 1002,
194
+ 'WS_ERR_UNEXPECTED_RSV_1'
195
+ );
196
+ }
197
+
198
+ this._fin = (buf[0] & 0x80) === 0x80;
199
+ this._opcode = buf[0] & 0x0f;
200
+ this._payloadLength = buf[1] & 0x7f;
201
+
202
+ if (this._opcode === 0x00) {
203
+ if (compressed) {
204
+ this._loop = false;
205
+ return error(
206
+ RangeError,
207
+ 'RSV1 must be clear',
208
+ true,
209
+ 1002,
210
+ 'WS_ERR_UNEXPECTED_RSV_1'
211
+ );
212
+ }
213
+
214
+ if (!this._fragmented) {
215
+ this._loop = false;
216
+ return error(
217
+ RangeError,
218
+ 'invalid opcode 0',
219
+ true,
220
+ 1002,
221
+ 'WS_ERR_INVALID_OPCODE'
222
+ );
223
+ }
224
+
225
+ this._opcode = this._fragmented;
226
+ } else if (this._opcode === 0x01 || this._opcode === 0x02) {
227
+ if (this._fragmented) {
228
+ this._loop = false;
229
+ return error(
230
+ RangeError,
231
+ `invalid opcode ${this._opcode}`,
232
+ true,
233
+ 1002,
234
+ 'WS_ERR_INVALID_OPCODE'
235
+ );
236
+ }
237
+
238
+ this._compressed = compressed;
239
+ } else if (this._opcode > 0x07 && this._opcode < 0x0b) {
240
+ if (!this._fin) {
241
+ this._loop = false;
242
+ return error(
243
+ RangeError,
244
+ 'FIN must be set',
245
+ true,
246
+ 1002,
247
+ 'WS_ERR_EXPECTED_FIN'
248
+ );
249
+ }
250
+
251
+ if (compressed) {
252
+ this._loop = false;
253
+ return error(
254
+ RangeError,
255
+ 'RSV1 must be clear',
256
+ true,
257
+ 1002,
258
+ 'WS_ERR_UNEXPECTED_RSV_1'
259
+ );
260
+ }
261
+
262
+ if (this._payloadLength > 0x7d) {
263
+ this._loop = false;
264
+ return error(
265
+ RangeError,
266
+ `invalid payload length ${this._payloadLength}`,
267
+ true,
268
+ 1002,
269
+ 'WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH'
270
+ );
271
+ }
272
+ } else {
273
+ this._loop = false;
274
+ return error(
275
+ RangeError,
276
+ `invalid opcode ${this._opcode}`,
277
+ true,
278
+ 1002,
279
+ 'WS_ERR_INVALID_OPCODE'
280
+ );
281
+ }
282
+
283
+ if (!this._fin && !this._fragmented) this._fragmented = this._opcode;
284
+ this._masked = (buf[1] & 0x80) === 0x80;
285
+
286
+ if (this._isServer) {
287
+ if (!this._masked) {
288
+ this._loop = false;
289
+ return error(
290
+ RangeError,
291
+ 'MASK must be set',
292
+ true,
293
+ 1002,
294
+ 'WS_ERR_EXPECTED_MASK'
295
+ );
296
+ }
297
+ } else if (this._masked) {
298
+ this._loop = false;
299
+ return error(
300
+ RangeError,
301
+ 'MASK must be clear',
302
+ true,
303
+ 1002,
304
+ 'WS_ERR_UNEXPECTED_MASK'
305
+ );
306
+ }
307
+
308
+ if (this._payloadLength === 126) this._state = GET_PAYLOAD_LENGTH_16;
309
+ else if (this._payloadLength === 127) this._state = GET_PAYLOAD_LENGTH_64;
310
+ else return this.haveLength();
311
+ }
312
+
313
+ /**
314
+ * Gets extended payload length (7+16).
315
+ *
316
+ * @return {(RangeError|undefined)} A possible error
317
+ * @private
318
+ */
319
+ getPayloadLength16() {
320
+ if (this._bufferedBytes < 2) {
321
+ this._loop = false;
322
+ return;
323
+ }
324
+
325
+ this._payloadLength = this.consume(2).readUInt16BE(0);
326
+ return this.haveLength();
327
+ }
328
+
329
+ /**
330
+ * Gets extended payload length (7+64).
331
+ *
332
+ * @return {(RangeError|undefined)} A possible error
333
+ * @private
334
+ */
335
+ getPayloadLength64() {
336
+ if (this._bufferedBytes < 8) {
337
+ this._loop = false;
338
+ return;
339
+ }
340
+
341
+ const buf = this.consume(8);
342
+ const num = buf.readUInt32BE(0);
343
+
344
+ //
345
+ // The maximum safe integer in JavaScript is 2^53 - 1. An error is returned
346
+ // if payload length is greater than this number.
347
+ //
348
+ if (num > Math.pow(2, 53 - 32) - 1) {
349
+ this._loop = false;
350
+ return error(
351
+ RangeError,
352
+ 'Unsupported WebSocket frame: payload length > 2^53 - 1',
353
+ false,
354
+ 1009,
355
+ 'WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH'
356
+ );
357
+ }
358
+
359
+ this._payloadLength = num * Math.pow(2, 32) + buf.readUInt32BE(4);
360
+ return this.haveLength();
361
+ }
362
+
363
+ /**
364
+ * Payload length has been read.
365
+ *
366
+ * @return {(RangeError|undefined)} A possible error
367
+ * @private
368
+ */
369
+ haveLength() {
370
+ if (this._payloadLength && this._opcode < 0x08) {
371
+ this._totalPayloadLength += this._payloadLength;
372
+ if (this._totalPayloadLength > this._maxPayload && this._maxPayload > 0) {
373
+ this._loop = false;
374
+ return error(
375
+ RangeError,
376
+ 'Max payload size exceeded',
377
+ false,
378
+ 1009,
379
+ 'WS_ERR_UNSUPPORTED_MESSAGE_LENGTH'
380
+ );
381
+ }
382
+ }
383
+
384
+ if (this._masked) this._state = GET_MASK;
385
+ else this._state = GET_DATA;
386
+ }
387
+
388
+ /**
389
+ * Reads mask bytes.
390
+ *
391
+ * @private
392
+ */
393
+ getMask() {
394
+ if (this._bufferedBytes < 4) {
395
+ this._loop = false;
396
+ return;
397
+ }
398
+
399
+ this._mask = this.consume(4);
400
+ this._state = GET_DATA;
401
+ }
402
+
403
+ /**
404
+ * Reads data bytes.
405
+ *
406
+ * @param {Function} cb Callback
407
+ * @return {(Error|RangeError|undefined)} A possible error
408
+ * @private
409
+ */
410
+ getData(cb) {
411
+ let data = EMPTY_BUFFER;
412
+
413
+ if (this._payloadLength) {
414
+ if (this._bufferedBytes < this._payloadLength) {
415
+ this._loop = false;
416
+ return;
417
+ }
418
+
419
+ data = this.consume(this._payloadLength);
420
+
421
+ if (
422
+ this._masked &&
423
+ (this._mask[0] | this._mask[1] | this._mask[2] | this._mask[3]) !== 0
424
+ ) {
425
+ unmask(data, this._mask);
426
+ }
427
+ }
428
+
429
+ if (this._opcode > 0x07) return this.controlMessage(data);
430
+
431
+ if (this._compressed) {
432
+ this._state = INFLATING;
433
+ this.decompress(data, cb);
434
+ return;
435
+ }
436
+
437
+ if (data.length) {
438
+ //
439
+ // This message is not compressed so its length is the sum of the payload
440
+ // length of all fragments.
441
+ //
442
+ this._messageLength = this._totalPayloadLength;
443
+ this._fragments.push(data);
444
+ }
445
+
446
+ return this.dataMessage();
447
+ }
448
+
449
+ /**
450
+ * Decompresses data.
451
+ *
452
+ * @param {Buffer} data Compressed data
453
+ * @param {Function} cb Callback
454
+ * @private
455
+ */
456
+ decompress(data, cb) {
457
+ const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName];
458
+
459
+ perMessageDeflate.decompress(data, this._fin, (err, buf) => {
460
+ if (err) return cb(err);
461
+
462
+ if (buf.length) {
463
+ this._messageLength += buf.length;
464
+ if (this._messageLength > this._maxPayload && this._maxPayload > 0) {
465
+ return cb(
466
+ error(
467
+ RangeError,
468
+ 'Max payload size exceeded',
469
+ false,
470
+ 1009,
471
+ 'WS_ERR_UNSUPPORTED_MESSAGE_LENGTH'
472
+ )
473
+ );
474
+ }
475
+
476
+ this._fragments.push(buf);
477
+ }
478
+
479
+ const er = this.dataMessage();
480
+ if (er) return cb(er);
481
+
482
+ this.startLoop(cb);
483
+ });
484
+ }
485
+
486
+ /**
487
+ * Handles a data message.
488
+ *
489
+ * @return {(Error|undefined)} A possible error
490
+ * @private
491
+ */
492
+ dataMessage() {
493
+ if (this._fin) {
494
+ const messageLength = this._messageLength;
495
+ const fragments = this._fragments;
496
+
497
+ this._totalPayloadLength = 0;
498
+ this._messageLength = 0;
499
+ this._fragmented = 0;
500
+ this._fragments = [];
501
+
502
+ if (this._opcode === 2) {
503
+ let data;
504
+
505
+ if (this._binaryType === 'nodebuffer') {
506
+ data = concat(fragments, messageLength);
507
+ } else if (this._binaryType === 'arraybuffer') {
508
+ data = toArrayBuffer(concat(fragments, messageLength));
509
+ } else {
510
+ data = fragments;
511
+ }
512
+
513
+ this.emit('message', data, true);
514
+ } else {
515
+ const buf = concat(fragments, messageLength);
516
+
517
+ if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
518
+ this._loop = false;
519
+ return error(
520
+ Error,
521
+ 'invalid UTF-8 sequence',
522
+ true,
523
+ 1007,
524
+ 'WS_ERR_INVALID_UTF8'
525
+ );
526
+ }
527
+
528
+ this.emit('message', buf, false);
529
+ }
530
+ }
531
+
532
+ this._state = GET_INFO;
533
+ }
534
+
535
+ /**
536
+ * Handles a control message.
537
+ *
538
+ * @param {Buffer} data Data to handle
539
+ * @return {(Error|RangeError|undefined)} A possible error
540
+ * @private
541
+ */
542
+ controlMessage(data) {
543
+ if (this._opcode === 0x08) {
544
+ this._loop = false;
545
+
546
+ if (data.length === 0) {
547
+ this.emit('conclude', 1005, EMPTY_BUFFER);
548
+ this.end();
549
+ } else if (data.length === 1) {
550
+ return error(
551
+ RangeError,
552
+ 'invalid payload length 1',
553
+ true,
554
+ 1002,
555
+ 'WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH'
556
+ );
557
+ } else {
558
+ const code = data.readUInt16BE(0);
559
+
560
+ if (!isValidStatusCode(code)) {
561
+ return error(
562
+ RangeError,
563
+ `invalid status code ${code}`,
564
+ true,
565
+ 1002,
566
+ 'WS_ERR_INVALID_CLOSE_CODE'
567
+ );
568
+ }
569
+
570
+ const buf = data.slice(2);
571
+
572
+ if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
573
+ return error(
574
+ Error,
575
+ 'invalid UTF-8 sequence',
576
+ true,
577
+ 1007,
578
+ 'WS_ERR_INVALID_UTF8'
579
+ );
580
+ }
581
+
582
+ this.emit('conclude', code, buf);
583
+ this.end();
584
+ }
585
+ } else if (this._opcode === 0x09) {
586
+ this.emit('ping', data);
587
+ } else {
588
+ this.emit('pong', data);
589
+ }
590
+
591
+ this._state = GET_INFO;
592
+ }
593
+ }
594
+
595
+ module.exports = Receiver;
596
+
597
+ /**
598
+ * Builds an error object.
599
+ *
600
+ * @param {function(new:Error|RangeError)} ErrorCtor The error constructor
601
+ * @param {String} message The error message
602
+ * @param {Boolean} prefix Specifies whether or not to add a default prefix to
603
+ * `message`
604
+ * @param {Number} statusCode The status code
605
+ * @param {String} errorCode The exposed error code
606
+ * @return {(Error|RangeError)} The error
607
+ * @private
608
+ */
609
+ function error(ErrorCtor, message, prefix, statusCode, errorCode) {
610
+ const err = new ErrorCtor(
611
+ prefix ? `Invalid WebSocket frame: ${message}` : message
612
+ );
613
+
614
+ Error.captureStackTrace(err, error);
615
+ err.code = errorCode;
616
+ err[kStatusCode] = statusCode;
617
+ return err;
618
+ }