cdk-ecr-deployment 0.0.76 → 0.0.82

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 (357) hide show
  1. package/.gitattributes +20 -21
  2. package/.jsii +43 -35
  3. package/lambda/Dockerfile +25 -0
  4. package/lambda/install.js +64 -0
  5. package/lib/index.js +40 -23
  6. package/node_modules/@sindresorhus/is/dist/index.d.ts +225 -0
  7. package/node_modules/@sindresorhus/is/dist/index.js +427 -0
  8. package/node_modules/@sindresorhus/is/dist/types.d.ts +24 -0
  9. package/node_modules/@sindresorhus/is/dist/types.js +3 -0
  10. package/node_modules/@sindresorhus/is/license +9 -0
  11. package/node_modules/@sindresorhus/is/package.json +96 -0
  12. package/node_modules/@sindresorhus/is/readme.md +628 -0
  13. package/node_modules/@szmarczak/http-timer/LICENSE +21 -0
  14. package/node_modules/@szmarczak/http-timer/README.md +93 -0
  15. package/node_modules/@szmarczak/http-timer/dist/source/index.d.ts +32 -0
  16. package/node_modules/@szmarczak/http-timer/dist/source/index.js +126 -0
  17. package/node_modules/@szmarczak/http-timer/package.json +72 -0
  18. package/node_modules/@types/cacheable-request/LICENSE +21 -0
  19. package/node_modules/@types/cacheable-request/README.md +16 -0
  20. package/node_modules/@types/cacheable-request/index.d.ts +137 -0
  21. package/node_modules/@types/cacheable-request/node_modules/@types/node/LICENSE +21 -0
  22. package/node_modules/@types/cacheable-request/node_modules/@types/node/README.md +16 -0
  23. package/node_modules/@types/cacheable-request/node_modules/@types/node/assert/strict.d.ts +8 -0
  24. package/node_modules/@types/cacheable-request/node_modules/@types/node/assert.d.ts +912 -0
  25. package/node_modules/@types/cacheable-request/node_modules/@types/node/async_hooks.d.ts +497 -0
  26. package/node_modules/@types/cacheable-request/node_modules/@types/node/buffer.d.ts +2142 -0
  27. package/node_modules/@types/cacheable-request/node_modules/@types/node/child_process.d.ts +1366 -0
  28. package/node_modules/@types/cacheable-request/node_modules/@types/node/cluster.d.ts +414 -0
  29. package/node_modules/@types/cacheable-request/node_modules/@types/node/console.d.ts +412 -0
  30. package/node_modules/@types/cacheable-request/node_modules/@types/node/constants.d.ts +18 -0
  31. package/node_modules/@types/cacheable-request/node_modules/@types/node/crypto.d.ts +3307 -0
  32. package/node_modules/@types/cacheable-request/node_modules/@types/node/dgram.d.ts +545 -0
  33. package/node_modules/@types/cacheable-request/node_modules/@types/node/diagnostics_channel.d.ts +134 -0
  34. package/node_modules/@types/cacheable-request/node_modules/@types/node/dns/promises.d.ts +368 -0
  35. package/node_modules/@types/cacheable-request/node_modules/@types/node/dns.d.ts +654 -0
  36. package/node_modules/@types/cacheable-request/node_modules/@types/node/domain.d.ts +169 -0
  37. package/node_modules/@types/cacheable-request/node_modules/@types/node/events.d.ts +623 -0
  38. package/node_modules/@types/cacheable-request/node_modules/@types/node/fs/promises.d.ts +1091 -0
  39. package/node_modules/@types/cacheable-request/node_modules/@types/node/fs.d.ts +3784 -0
  40. package/node_modules/@types/cacheable-request/node_modules/@types/node/globals.d.ts +284 -0
  41. package/node_modules/@types/cacheable-request/node_modules/@types/node/globals.global.d.ts +1 -0
  42. package/node_modules/@types/cacheable-request/node_modules/@types/node/http.d.ts +1369 -0
  43. package/node_modules/@types/cacheable-request/node_modules/@types/node/http2.d.ts +2100 -0
  44. package/node_modules/@types/cacheable-request/node_modules/@types/node/https.d.ts +391 -0
  45. package/node_modules/@types/cacheable-request/node_modules/@types/node/index.d.ts +131 -0
  46. package/node_modules/@types/cacheable-request/node_modules/@types/node/inspector.d.ts +2745 -0
  47. package/node_modules/@types/cacheable-request/node_modules/@types/node/module.d.ts +114 -0
  48. package/node_modules/@types/cacheable-request/node_modules/@types/node/net.d.ts +783 -0
  49. package/node_modules/@types/cacheable-request/node_modules/@types/node/os.d.ts +455 -0
  50. package/node_modules/@types/cacheable-request/node_modules/@types/node/package.json +230 -0
  51. package/node_modules/@types/cacheable-request/node_modules/@types/node/path.d.ts +172 -0
  52. package/node_modules/@types/cacheable-request/node_modules/@types/node/perf_hooks.d.ts +555 -0
  53. package/node_modules/@types/cacheable-request/node_modules/@types/node/process.d.ts +1481 -0
  54. package/node_modules/@types/cacheable-request/node_modules/@types/node/punycode.d.ts +117 -0
  55. package/node_modules/@types/cacheable-request/node_modules/@types/node/querystring.d.ts +131 -0
  56. package/node_modules/@types/cacheable-request/node_modules/@types/node/readline.d.ts +543 -0
  57. package/node_modules/@types/cacheable-request/node_modules/@types/node/repl.d.ts +424 -0
  58. package/node_modules/@types/cacheable-request/node_modules/@types/node/stream/consumers.d.ts +24 -0
  59. package/node_modules/@types/cacheable-request/node_modules/@types/node/stream/promises.d.ts +42 -0
  60. package/node_modules/@types/cacheable-request/node_modules/@types/node/stream/web.d.ts +391 -0
  61. package/node_modules/@types/cacheable-request/node_modules/@types/node/stream.d.ts +1249 -0
  62. package/node_modules/@types/cacheable-request/node_modules/@types/node/string_decoder.d.ts +67 -0
  63. package/node_modules/@types/cacheable-request/node_modules/@types/node/timers/promises.d.ts +68 -0
  64. package/node_modules/@types/cacheable-request/node_modules/@types/node/timers.d.ts +94 -0
  65. package/node_modules/@types/cacheable-request/node_modules/@types/node/tls.d.ts +1019 -0
  66. package/node_modules/@types/cacheable-request/node_modules/@types/node/trace_events.d.ts +161 -0
  67. package/node_modules/@types/cacheable-request/node_modules/@types/node/tty.d.ts +204 -0
  68. package/node_modules/@types/cacheable-request/node_modules/@types/node/url.d.ts +821 -0
  69. package/node_modules/@types/cacheable-request/node_modules/@types/node/util.d.ts +1594 -0
  70. package/node_modules/@types/cacheable-request/node_modules/@types/node/v8.d.ts +378 -0
  71. package/node_modules/@types/cacheable-request/node_modules/@types/node/vm.d.ts +507 -0
  72. package/node_modules/@types/cacheable-request/node_modules/@types/node/wasi.d.ts +158 -0
  73. package/node_modules/@types/cacheable-request/node_modules/@types/node/worker_threads.d.ts +649 -0
  74. package/node_modules/@types/cacheable-request/node_modules/@types/node/zlib.d.ts +517 -0
  75. package/node_modules/@types/cacheable-request/package.json +35 -0
  76. package/node_modules/@types/http-cache-semantics/LICENSE +21 -0
  77. package/node_modules/@types/http-cache-semantics/README.md +16 -0
  78. package/node_modules/@types/http-cache-semantics/index.d.ts +170 -0
  79. package/node_modules/@types/http-cache-semantics/package.json +25 -0
  80. package/node_modules/@types/keyv/LICENSE +21 -0
  81. package/node_modules/@types/keyv/README.md +16 -0
  82. package/node_modules/@types/keyv/index.d.ts +77 -0
  83. package/node_modules/@types/keyv/node_modules/@types/node/LICENSE +21 -0
  84. package/node_modules/@types/keyv/node_modules/@types/node/README.md +16 -0
  85. package/node_modules/@types/keyv/node_modules/@types/node/assert/strict.d.ts +8 -0
  86. package/node_modules/@types/keyv/node_modules/@types/node/assert.d.ts +912 -0
  87. package/node_modules/@types/keyv/node_modules/@types/node/async_hooks.d.ts +497 -0
  88. package/node_modules/@types/keyv/node_modules/@types/node/buffer.d.ts +2142 -0
  89. package/node_modules/@types/keyv/node_modules/@types/node/child_process.d.ts +1366 -0
  90. package/node_modules/@types/keyv/node_modules/@types/node/cluster.d.ts +414 -0
  91. package/node_modules/@types/keyv/node_modules/@types/node/console.d.ts +412 -0
  92. package/node_modules/@types/keyv/node_modules/@types/node/constants.d.ts +18 -0
  93. package/node_modules/@types/keyv/node_modules/@types/node/crypto.d.ts +3307 -0
  94. package/node_modules/@types/keyv/node_modules/@types/node/dgram.d.ts +545 -0
  95. package/node_modules/@types/keyv/node_modules/@types/node/diagnostics_channel.d.ts +134 -0
  96. package/node_modules/@types/keyv/node_modules/@types/node/dns/promises.d.ts +368 -0
  97. package/node_modules/@types/keyv/node_modules/@types/node/dns.d.ts +654 -0
  98. package/node_modules/@types/keyv/node_modules/@types/node/domain.d.ts +169 -0
  99. package/node_modules/@types/keyv/node_modules/@types/node/events.d.ts +623 -0
  100. package/node_modules/@types/keyv/node_modules/@types/node/fs/promises.d.ts +1091 -0
  101. package/node_modules/@types/keyv/node_modules/@types/node/fs.d.ts +3784 -0
  102. package/node_modules/@types/keyv/node_modules/@types/node/globals.d.ts +284 -0
  103. package/node_modules/@types/keyv/node_modules/@types/node/globals.global.d.ts +1 -0
  104. package/node_modules/@types/keyv/node_modules/@types/node/http.d.ts +1369 -0
  105. package/node_modules/@types/keyv/node_modules/@types/node/http2.d.ts +2100 -0
  106. package/node_modules/@types/keyv/node_modules/@types/node/https.d.ts +391 -0
  107. package/node_modules/@types/keyv/node_modules/@types/node/index.d.ts +131 -0
  108. package/node_modules/@types/keyv/node_modules/@types/node/inspector.d.ts +2745 -0
  109. package/node_modules/@types/keyv/node_modules/@types/node/module.d.ts +114 -0
  110. package/node_modules/@types/keyv/node_modules/@types/node/net.d.ts +783 -0
  111. package/node_modules/@types/keyv/node_modules/@types/node/os.d.ts +455 -0
  112. package/node_modules/@types/keyv/node_modules/@types/node/package.json +230 -0
  113. package/node_modules/@types/keyv/node_modules/@types/node/path.d.ts +172 -0
  114. package/node_modules/@types/keyv/node_modules/@types/node/perf_hooks.d.ts +555 -0
  115. package/node_modules/@types/keyv/node_modules/@types/node/process.d.ts +1481 -0
  116. package/node_modules/@types/keyv/node_modules/@types/node/punycode.d.ts +117 -0
  117. package/node_modules/@types/keyv/node_modules/@types/node/querystring.d.ts +131 -0
  118. package/node_modules/@types/keyv/node_modules/@types/node/readline.d.ts +543 -0
  119. package/node_modules/@types/keyv/node_modules/@types/node/repl.d.ts +424 -0
  120. package/node_modules/@types/keyv/node_modules/@types/node/stream/consumers.d.ts +24 -0
  121. package/node_modules/@types/keyv/node_modules/@types/node/stream/promises.d.ts +42 -0
  122. package/node_modules/@types/keyv/node_modules/@types/node/stream/web.d.ts +391 -0
  123. package/node_modules/@types/keyv/node_modules/@types/node/stream.d.ts +1249 -0
  124. package/node_modules/@types/keyv/node_modules/@types/node/string_decoder.d.ts +67 -0
  125. package/node_modules/@types/keyv/node_modules/@types/node/timers/promises.d.ts +68 -0
  126. package/node_modules/@types/keyv/node_modules/@types/node/timers.d.ts +94 -0
  127. package/node_modules/@types/keyv/node_modules/@types/node/tls.d.ts +1019 -0
  128. package/node_modules/@types/keyv/node_modules/@types/node/trace_events.d.ts +161 -0
  129. package/node_modules/@types/keyv/node_modules/@types/node/tty.d.ts +204 -0
  130. package/node_modules/@types/keyv/node_modules/@types/node/url.d.ts +821 -0
  131. package/node_modules/@types/keyv/node_modules/@types/node/util.d.ts +1594 -0
  132. package/node_modules/@types/keyv/node_modules/@types/node/v8.d.ts +378 -0
  133. package/node_modules/@types/keyv/node_modules/@types/node/vm.d.ts +507 -0
  134. package/node_modules/@types/keyv/node_modules/@types/node/wasi.d.ts +158 -0
  135. package/node_modules/@types/keyv/node_modules/@types/node/worker_threads.d.ts +649 -0
  136. package/node_modules/@types/keyv/node_modules/@types/node/zlib.d.ts +517 -0
  137. package/node_modules/@types/keyv/package.json +32 -0
  138. package/node_modules/@types/responselike/LICENSE +21 -0
  139. package/node_modules/@types/responselike/README.md +16 -0
  140. package/node_modules/@types/responselike/index.d.ts +34 -0
  141. package/node_modules/@types/responselike/node_modules/@types/node/LICENSE +21 -0
  142. package/node_modules/@types/responselike/node_modules/@types/node/README.md +16 -0
  143. package/node_modules/@types/responselike/node_modules/@types/node/assert/strict.d.ts +8 -0
  144. package/node_modules/@types/responselike/node_modules/@types/node/assert.d.ts +912 -0
  145. package/node_modules/@types/responselike/node_modules/@types/node/async_hooks.d.ts +497 -0
  146. package/node_modules/@types/responselike/node_modules/@types/node/buffer.d.ts +2142 -0
  147. package/node_modules/@types/responselike/node_modules/@types/node/child_process.d.ts +1366 -0
  148. package/node_modules/@types/responselike/node_modules/@types/node/cluster.d.ts +414 -0
  149. package/node_modules/@types/responselike/node_modules/@types/node/console.d.ts +412 -0
  150. package/node_modules/@types/responselike/node_modules/@types/node/constants.d.ts +18 -0
  151. package/node_modules/@types/responselike/node_modules/@types/node/crypto.d.ts +3307 -0
  152. package/node_modules/@types/responselike/node_modules/@types/node/dgram.d.ts +545 -0
  153. package/node_modules/@types/responselike/node_modules/@types/node/diagnostics_channel.d.ts +134 -0
  154. package/node_modules/@types/responselike/node_modules/@types/node/dns/promises.d.ts +368 -0
  155. package/node_modules/@types/responselike/node_modules/@types/node/dns.d.ts +654 -0
  156. package/node_modules/@types/responselike/node_modules/@types/node/domain.d.ts +169 -0
  157. package/node_modules/@types/responselike/node_modules/@types/node/events.d.ts +623 -0
  158. package/node_modules/@types/responselike/node_modules/@types/node/fs/promises.d.ts +1091 -0
  159. package/node_modules/@types/responselike/node_modules/@types/node/fs.d.ts +3784 -0
  160. package/node_modules/@types/responselike/node_modules/@types/node/globals.d.ts +284 -0
  161. package/node_modules/@types/responselike/node_modules/@types/node/globals.global.d.ts +1 -0
  162. package/node_modules/@types/responselike/node_modules/@types/node/http.d.ts +1369 -0
  163. package/node_modules/@types/responselike/node_modules/@types/node/http2.d.ts +2100 -0
  164. package/node_modules/@types/responselike/node_modules/@types/node/https.d.ts +391 -0
  165. package/node_modules/@types/responselike/node_modules/@types/node/index.d.ts +131 -0
  166. package/node_modules/@types/responselike/node_modules/@types/node/inspector.d.ts +2745 -0
  167. package/node_modules/@types/responselike/node_modules/@types/node/module.d.ts +114 -0
  168. package/node_modules/@types/responselike/node_modules/@types/node/net.d.ts +783 -0
  169. package/node_modules/@types/responselike/node_modules/@types/node/os.d.ts +455 -0
  170. package/node_modules/@types/responselike/node_modules/@types/node/package.json +230 -0
  171. package/node_modules/@types/responselike/node_modules/@types/node/path.d.ts +172 -0
  172. package/node_modules/@types/responselike/node_modules/@types/node/perf_hooks.d.ts +555 -0
  173. package/node_modules/@types/responselike/node_modules/@types/node/process.d.ts +1481 -0
  174. package/node_modules/@types/responselike/node_modules/@types/node/punycode.d.ts +117 -0
  175. package/node_modules/@types/responselike/node_modules/@types/node/querystring.d.ts +131 -0
  176. package/node_modules/@types/responselike/node_modules/@types/node/readline.d.ts +543 -0
  177. package/node_modules/@types/responselike/node_modules/@types/node/repl.d.ts +424 -0
  178. package/node_modules/@types/responselike/node_modules/@types/node/stream/consumers.d.ts +24 -0
  179. package/node_modules/@types/responselike/node_modules/@types/node/stream/promises.d.ts +42 -0
  180. package/node_modules/@types/responselike/node_modules/@types/node/stream/web.d.ts +391 -0
  181. package/node_modules/@types/responselike/node_modules/@types/node/stream.d.ts +1249 -0
  182. package/node_modules/@types/responselike/node_modules/@types/node/string_decoder.d.ts +67 -0
  183. package/node_modules/@types/responselike/node_modules/@types/node/timers/promises.d.ts +68 -0
  184. package/node_modules/@types/responselike/node_modules/@types/node/timers.d.ts +94 -0
  185. package/node_modules/@types/responselike/node_modules/@types/node/tls.d.ts +1019 -0
  186. package/node_modules/@types/responselike/node_modules/@types/node/trace_events.d.ts +161 -0
  187. package/node_modules/@types/responselike/node_modules/@types/node/tty.d.ts +204 -0
  188. package/node_modules/@types/responselike/node_modules/@types/node/url.d.ts +821 -0
  189. package/node_modules/@types/responselike/node_modules/@types/node/util.d.ts +1594 -0
  190. package/node_modules/@types/responselike/node_modules/@types/node/v8.d.ts +378 -0
  191. package/node_modules/@types/responselike/node_modules/@types/node/vm.d.ts +507 -0
  192. package/node_modules/@types/responselike/node_modules/@types/node/wasi.d.ts +158 -0
  193. package/node_modules/@types/responselike/node_modules/@types/node/worker_threads.d.ts +649 -0
  194. package/node_modules/@types/responselike/node_modules/@types/node/zlib.d.ts +517 -0
  195. package/node_modules/@types/responselike/package.json +25 -0
  196. package/node_modules/cacheable-lookup/LICENSE +21 -0
  197. package/node_modules/cacheable-lookup/README.md +240 -0
  198. package/node_modules/cacheable-lookup/index.d.ts +139 -0
  199. package/node_modules/cacheable-lookup/package.json +45 -0
  200. package/node_modules/cacheable-lookup/source/index.js +436 -0
  201. package/node_modules/cacheable-request/LICENSE +21 -0
  202. package/node_modules/cacheable-request/README.md +206 -0
  203. package/node_modules/cacheable-request/package.json +56 -0
  204. package/node_modules/cacheable-request/src/index.js +251 -0
  205. package/node_modules/clone-response/LICENSE +21 -0
  206. package/node_modules/clone-response/README.md +62 -0
  207. package/node_modules/clone-response/package.json +44 -0
  208. package/node_modules/clone-response/src/index.js +17 -0
  209. package/node_modules/decompress-response/index.d.ts +22 -0
  210. package/node_modules/decompress-response/index.js +58 -0
  211. package/node_modules/decompress-response/license +9 -0
  212. package/node_modules/decompress-response/node_modules/mimic-response/index.d.ts +17 -0
  213. package/node_modules/decompress-response/node_modules/mimic-response/index.js +77 -0
  214. package/node_modules/decompress-response/node_modules/mimic-response/license +9 -0
  215. package/node_modules/decompress-response/node_modules/mimic-response/package.json +42 -0
  216. package/node_modules/decompress-response/node_modules/mimic-response/readme.md +78 -0
  217. package/node_modules/decompress-response/package.json +56 -0
  218. package/node_modules/decompress-response/readme.md +48 -0
  219. package/node_modules/defer-to-connect/LICENSE +21 -0
  220. package/node_modules/defer-to-connect/README.md +38 -0
  221. package/node_modules/defer-to-connect/dist/source/index.d.ts +10 -0
  222. package/node_modules/defer-to-connect/dist/source/index.js +47 -0
  223. package/node_modules/defer-to-connect/package.json +71 -0
  224. package/node_modules/end-of-stream/LICENSE +21 -0
  225. package/node_modules/end-of-stream/README.md +54 -0
  226. package/node_modules/end-of-stream/index.js +94 -0
  227. package/node_modules/end-of-stream/package.json +37 -0
  228. package/node_modules/get-stream/buffer-stream.js +52 -0
  229. package/node_modules/get-stream/index.d.ts +108 -0
  230. package/node_modules/get-stream/index.js +60 -0
  231. package/node_modules/get-stream/license +9 -0
  232. package/node_modules/get-stream/package.json +50 -0
  233. package/node_modules/get-stream/readme.md +124 -0
  234. package/node_modules/got/dist/source/as-promise/create-rejection.d.ts +2 -0
  235. package/node_modules/got/dist/source/as-promise/create-rejection.js +30 -0
  236. package/node_modules/got/dist/source/as-promise/index.d.ts +3 -0
  237. package/node_modules/got/dist/source/as-promise/index.js +175 -0
  238. package/node_modules/got/dist/source/as-promise/normalize-arguments.d.ts +3 -0
  239. package/node_modules/got/dist/source/as-promise/normalize-arguments.js +78 -0
  240. package/node_modules/got/dist/source/as-promise/parse-body.d.ts +3 -0
  241. package/node_modules/got/dist/source/as-promise/parse-body.js +25 -0
  242. package/node_modules/got/dist/source/as-promise/types.d.ts +256 -0
  243. package/node_modules/got/dist/source/as-promise/types.js +42 -0
  244. package/node_modules/got/dist/source/core/calculate-retry-delay.d.ts +5 -0
  245. package/node_modules/got/dist/source/core/calculate-retry-delay.js +29 -0
  246. package/node_modules/got/dist/source/core/index.d.ts +1124 -0
  247. package/node_modules/got/dist/source/core/index.js +1497 -0
  248. package/node_modules/got/dist/source/core/utils/dns-ip-version.d.ts +5 -0
  249. package/node_modules/got/dist/source/core/utils/dns-ip-version.js +17 -0
  250. package/node_modules/got/dist/source/core/utils/get-body-size.d.ts +3 -0
  251. package/node_modules/got/dist/source/core/utils/get-body-size.js +32 -0
  252. package/node_modules/got/dist/source/core/utils/get-buffer.d.ts +4 -0
  253. package/node_modules/got/dist/source/core/utils/get-buffer.js +16 -0
  254. package/node_modules/got/dist/source/core/utils/is-form-data.d.ts +8 -0
  255. package/node_modules/got/dist/source/core/utils/is-form-data.js +4 -0
  256. package/node_modules/got/dist/source/core/utils/is-response-ok.d.ts +2 -0
  257. package/node_modules/got/dist/source/core/utils/is-response-ok.js +8 -0
  258. package/node_modules/got/dist/source/core/utils/options-to-url.d.ts +14 -0
  259. package/node_modules/got/dist/source/core/utils/options-to-url.js +53 -0
  260. package/node_modules/got/dist/source/core/utils/proxy-events.d.ts +3 -0
  261. package/node_modules/got/dist/source/core/utils/proxy-events.js +17 -0
  262. package/node_modules/got/dist/source/core/utils/timed-out.d.ts +29 -0
  263. package/node_modules/got/dist/source/core/utils/timed-out.js +121 -0
  264. package/node_modules/got/dist/source/core/utils/unhandle.d.ts +11 -0
  265. package/node_modules/got/dist/source/core/utils/unhandle.js +22 -0
  266. package/node_modules/got/dist/source/core/utils/url-to-options.d.ts +15 -0
  267. package/node_modules/got/dist/source/core/utils/url-to-options.js +24 -0
  268. package/node_modules/got/dist/source/core/utils/weakable-map.d.ts +8 -0
  269. package/node_modules/got/dist/source/core/utils/weakable-map.js +29 -0
  270. package/node_modules/got/dist/source/create.d.ts +5 -0
  271. package/node_modules/got/dist/source/create.js +240 -0
  272. package/node_modules/got/dist/source/index.d.ts +4 -0
  273. package/node_modules/got/dist/source/index.js +132 -0
  274. package/node_modules/got/dist/source/types.d.ts +344 -0
  275. package/node_modules/got/dist/source/types.js +2 -0
  276. package/node_modules/got/dist/source/utils/deep-freeze.d.ts +1 -0
  277. package/node_modules/got/dist/source/utils/deep-freeze.js +12 -0
  278. package/node_modules/got/dist/source/utils/deprecation-warning.d.ts +2 -0
  279. package/node_modules/got/dist/source/utils/deprecation-warning.js +13 -0
  280. package/node_modules/got/license +9 -0
  281. package/node_modules/got/package.json +130 -0
  282. package/node_modules/got/readme.md +2477 -0
  283. package/node_modules/http-cache-semantics/LICENSE +9 -0
  284. package/node_modules/http-cache-semantics/README.md +203 -0
  285. package/node_modules/http-cache-semantics/index.js +673 -0
  286. package/node_modules/http-cache-semantics/package.json +24 -0
  287. package/node_modules/http2-wrapper/LICENSE +21 -0
  288. package/node_modules/http2-wrapper/README.md +470 -0
  289. package/node_modules/http2-wrapper/package.json +54 -0
  290. package/node_modules/http2-wrapper/source/agent.js +670 -0
  291. package/node_modules/http2-wrapper/source/auto.js +149 -0
  292. package/node_modules/http2-wrapper/source/client-request.js +445 -0
  293. package/node_modules/http2-wrapper/source/incoming-message.js +58 -0
  294. package/node_modules/http2-wrapper/source/index.js +28 -0
  295. package/node_modules/http2-wrapper/source/utils/calculate-server-name.js +27 -0
  296. package/node_modules/http2-wrapper/source/utils/errors.js +45 -0
  297. package/node_modules/http2-wrapper/source/utils/is-request-pseudo-header.js +13 -0
  298. package/node_modules/http2-wrapper/source/utils/proxy-events.js +7 -0
  299. package/node_modules/http2-wrapper/source/utils/url-to-options.js +25 -0
  300. package/node_modules/json-buffer/.travis.yml +3 -0
  301. package/node_modules/json-buffer/LICENSE +22 -0
  302. package/node_modules/json-buffer/README.md +24 -0
  303. package/node_modules/json-buffer/index.js +58 -0
  304. package/node_modules/json-buffer/package.json +34 -0
  305. package/node_modules/json-buffer/test/index.js +63 -0
  306. package/node_modules/keyv/LICENSE +21 -0
  307. package/node_modules/keyv/README.md +290 -0
  308. package/node_modules/keyv/package.json +54 -0
  309. package/node_modules/keyv/src/index.js +109 -0
  310. package/node_modules/lowercase-keys/index.d.ts +16 -0
  311. package/node_modules/lowercase-keys/index.js +10 -0
  312. package/node_modules/lowercase-keys/license +9 -0
  313. package/node_modules/lowercase-keys/package.json +38 -0
  314. package/node_modules/lowercase-keys/readme.md +32 -0
  315. package/node_modules/mimic-response/index.js +32 -0
  316. package/node_modules/mimic-response/license +9 -0
  317. package/node_modules/mimic-response/package.json +37 -0
  318. package/node_modules/mimic-response/readme.md +54 -0
  319. package/node_modules/normalize-url/index.d.ts +267 -0
  320. package/node_modules/normalize-url/index.js +216 -0
  321. package/node_modules/normalize-url/license +9 -0
  322. package/node_modules/normalize-url/package.json +50 -0
  323. package/node_modules/normalize-url/readme.md +286 -0
  324. package/node_modules/once/LICENSE +15 -0
  325. package/node_modules/once/README.md +79 -0
  326. package/node_modules/once/once.js +42 -0
  327. package/node_modules/once/package.json +33 -0
  328. package/node_modules/p-cancelable/index.d.ts +176 -0
  329. package/node_modules/p-cancelable/index.js +111 -0
  330. package/node_modules/p-cancelable/license +9 -0
  331. package/node_modules/p-cancelable/package.json +49 -0
  332. package/node_modules/p-cancelable/readme.md +153 -0
  333. package/node_modules/pump/.travis.yml +5 -0
  334. package/node_modules/pump/LICENSE +21 -0
  335. package/node_modules/pump/README.md +65 -0
  336. package/node_modules/pump/index.js +82 -0
  337. package/node_modules/pump/package.json +24 -0
  338. package/node_modules/pump/test-browser.js +66 -0
  339. package/node_modules/pump/test-node.js +53 -0
  340. package/node_modules/quick-lru/index.d.ts +97 -0
  341. package/node_modules/quick-lru/index.js +123 -0
  342. package/node_modules/quick-lru/license +9 -0
  343. package/node_modules/quick-lru/package.json +43 -0
  344. package/node_modules/quick-lru/readme.md +111 -0
  345. package/node_modules/resolve-alpn/LICENSE +22 -0
  346. package/node_modules/resolve-alpn/README.md +60 -0
  347. package/node_modules/resolve-alpn/index.js +43 -0
  348. package/node_modules/resolve-alpn/package.json +34 -0
  349. package/node_modules/responselike/LICENSE +19 -0
  350. package/node_modules/responselike/README.md +77 -0
  351. package/node_modules/responselike/package.json +38 -0
  352. package/node_modules/responselike/src/index.js +34 -0
  353. package/node_modules/wrappy/LICENSE +15 -0
  354. package/node_modules/wrappy/README.md +36 -0
  355. package/node_modules/wrappy/package.json +29 -0
  356. package/node_modules/wrappy/wrappy.js +33 -0
  357. package/package.json +42 -39
@@ -0,0 +1,251 @@
1
+ 'use strict';
2
+
3
+ const EventEmitter = require('events');
4
+ const urlLib = require('url');
5
+ const normalizeUrl = require('normalize-url');
6
+ const getStream = require('get-stream');
7
+ const CachePolicy = require('http-cache-semantics');
8
+ const Response = require('responselike');
9
+ const lowercaseKeys = require('lowercase-keys');
10
+ const cloneResponse = require('clone-response');
11
+ const Keyv = require('keyv');
12
+
13
+ class CacheableRequest {
14
+ constructor(request, cacheAdapter) {
15
+ if (typeof request !== 'function') {
16
+ throw new TypeError('Parameter `request` must be a function');
17
+ }
18
+
19
+ this.cache = new Keyv({
20
+ uri: typeof cacheAdapter === 'string' && cacheAdapter,
21
+ store: typeof cacheAdapter !== 'string' && cacheAdapter,
22
+ namespace: 'cacheable-request'
23
+ });
24
+
25
+ return this.createCacheableRequest(request);
26
+ }
27
+
28
+ createCacheableRequest(request) {
29
+ return (opts, cb) => {
30
+ let url;
31
+ if (typeof opts === 'string') {
32
+ url = normalizeUrlObject(urlLib.parse(opts));
33
+ opts = {};
34
+ } else if (opts instanceof urlLib.URL) {
35
+ url = normalizeUrlObject(urlLib.parse(opts.toString()));
36
+ opts = {};
37
+ } else {
38
+ const [pathname, ...searchParts] = (opts.path || '').split('?');
39
+ const search = searchParts.length > 0 ?
40
+ `?${searchParts.join('?')}` :
41
+ '';
42
+ url = normalizeUrlObject({ ...opts, pathname, search });
43
+ }
44
+
45
+ opts = {
46
+ headers: {},
47
+ method: 'GET',
48
+ cache: true,
49
+ strictTtl: false,
50
+ automaticFailover: false,
51
+ ...opts,
52
+ ...urlObjectToRequestOptions(url)
53
+ };
54
+ opts.headers = lowercaseKeys(opts.headers);
55
+
56
+ const ee = new EventEmitter();
57
+ const normalizedUrlString = normalizeUrl(
58
+ urlLib.format(url),
59
+ {
60
+ stripWWW: false,
61
+ removeTrailingSlash: false,
62
+ stripAuthentication: false
63
+ }
64
+ );
65
+ const key = `${opts.method}:${normalizedUrlString}`;
66
+ let revalidate = false;
67
+ let madeRequest = false;
68
+
69
+ const makeRequest = opts => {
70
+ madeRequest = true;
71
+ let requestErrored = false;
72
+ let requestErrorCallback;
73
+
74
+ const requestErrorPromise = new Promise(resolve => {
75
+ requestErrorCallback = () => {
76
+ if (!requestErrored) {
77
+ requestErrored = true;
78
+ resolve();
79
+ }
80
+ };
81
+ });
82
+
83
+ const handler = response => {
84
+ if (revalidate && !opts.forceRefresh) {
85
+ response.status = response.statusCode;
86
+ const revalidatedPolicy = CachePolicy.fromObject(revalidate.cachePolicy).revalidatedPolicy(opts, response);
87
+ if (!revalidatedPolicy.modified) {
88
+ const headers = revalidatedPolicy.policy.responseHeaders();
89
+ response = new Response(revalidate.statusCode, headers, revalidate.body, revalidate.url);
90
+ response.cachePolicy = revalidatedPolicy.policy;
91
+ response.fromCache = true;
92
+ }
93
+ }
94
+
95
+ if (!response.fromCache) {
96
+ response.cachePolicy = new CachePolicy(opts, response, opts);
97
+ response.fromCache = false;
98
+ }
99
+
100
+ let clonedResponse;
101
+ if (opts.cache && response.cachePolicy.storable()) {
102
+ clonedResponse = cloneResponse(response);
103
+
104
+ (async () => {
105
+ try {
106
+ const bodyPromise = getStream.buffer(response);
107
+
108
+ await Promise.race([
109
+ requestErrorPromise,
110
+ new Promise(resolve => response.once('end', resolve))
111
+ ]);
112
+
113
+ if (requestErrored) {
114
+ return;
115
+ }
116
+
117
+ const body = await bodyPromise;
118
+
119
+ const value = {
120
+ cachePolicy: response.cachePolicy.toObject(),
121
+ url: response.url,
122
+ statusCode: response.fromCache ? revalidate.statusCode : response.statusCode,
123
+ body
124
+ };
125
+
126
+ let ttl = opts.strictTtl ? response.cachePolicy.timeToLive() : undefined;
127
+ if (opts.maxTtl) {
128
+ ttl = ttl ? Math.min(ttl, opts.maxTtl) : opts.maxTtl;
129
+ }
130
+
131
+ await this.cache.set(key, value, ttl);
132
+ } catch (error) {
133
+ ee.emit('error', new CacheableRequest.CacheError(error));
134
+ }
135
+ })();
136
+ } else if (opts.cache && revalidate) {
137
+ (async () => {
138
+ try {
139
+ await this.cache.delete(key);
140
+ } catch (error) {
141
+ ee.emit('error', new CacheableRequest.CacheError(error));
142
+ }
143
+ })();
144
+ }
145
+
146
+ ee.emit('response', clonedResponse || response);
147
+ if (typeof cb === 'function') {
148
+ cb(clonedResponse || response);
149
+ }
150
+ };
151
+
152
+ try {
153
+ const req = request(opts, handler);
154
+ req.once('error', requestErrorCallback);
155
+ req.once('abort', requestErrorCallback);
156
+ ee.emit('request', req);
157
+ } catch (error) {
158
+ ee.emit('error', new CacheableRequest.RequestError(error));
159
+ }
160
+ };
161
+
162
+ (async () => {
163
+ const get = async opts => {
164
+ await Promise.resolve();
165
+
166
+ const cacheEntry = opts.cache ? await this.cache.get(key) : undefined;
167
+ if (typeof cacheEntry === 'undefined') {
168
+ return makeRequest(opts);
169
+ }
170
+
171
+ const policy = CachePolicy.fromObject(cacheEntry.cachePolicy);
172
+ if (policy.satisfiesWithoutRevalidation(opts) && !opts.forceRefresh) {
173
+ const headers = policy.responseHeaders();
174
+ const response = new Response(cacheEntry.statusCode, headers, cacheEntry.body, cacheEntry.url);
175
+ response.cachePolicy = policy;
176
+ response.fromCache = true;
177
+
178
+ ee.emit('response', response);
179
+ if (typeof cb === 'function') {
180
+ cb(response);
181
+ }
182
+ } else {
183
+ revalidate = cacheEntry;
184
+ opts.headers = policy.revalidationHeaders(opts);
185
+ makeRequest(opts);
186
+ }
187
+ };
188
+
189
+ const errorHandler = error => ee.emit('error', new CacheableRequest.CacheError(error));
190
+ this.cache.once('error', errorHandler);
191
+ ee.on('response', () => this.cache.removeListener('error', errorHandler));
192
+
193
+ try {
194
+ await get(opts);
195
+ } catch (error) {
196
+ if (opts.automaticFailover && !madeRequest) {
197
+ makeRequest(opts);
198
+ }
199
+
200
+ ee.emit('error', new CacheableRequest.CacheError(error));
201
+ }
202
+ })();
203
+
204
+ return ee;
205
+ };
206
+ }
207
+ }
208
+
209
+ function urlObjectToRequestOptions(url) {
210
+ const options = { ...url };
211
+ options.path = `${url.pathname || '/'}${url.search || ''}`;
212
+ delete options.pathname;
213
+ delete options.search;
214
+ return options;
215
+ }
216
+
217
+ function normalizeUrlObject(url) {
218
+ // If url was parsed by url.parse or new URL:
219
+ // - hostname will be set
220
+ // - host will be hostname[:port]
221
+ // - port will be set if it was explicit in the parsed string
222
+ // Otherwise, url was from request options:
223
+ // - hostname or host may be set
224
+ // - host shall not have port encoded
225
+ return {
226
+ protocol: url.protocol,
227
+ auth: url.auth,
228
+ hostname: url.hostname || url.host || 'localhost',
229
+ port: url.port,
230
+ pathname: url.pathname,
231
+ search: url.search
232
+ };
233
+ }
234
+
235
+ CacheableRequest.RequestError = class extends Error {
236
+ constructor(error) {
237
+ super(error.message);
238
+ this.name = 'RequestError';
239
+ Object.assign(this, error);
240
+ }
241
+ };
242
+
243
+ CacheableRequest.CacheError = class extends Error {
244
+ constructor(error) {
245
+ super(error.message);
246
+ this.name = 'CacheError';
247
+ Object.assign(this, error);
248
+ }
249
+ };
250
+
251
+ module.exports = CacheableRequest;
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2017 Luke Childs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,62 @@
1
+ # clone-response
2
+
3
+ > Clone a Node.js HTTP response stream
4
+
5
+ [![Build Status](https://travis-ci.org/lukechilds/clone-response.svg?branch=master)](https://travis-ci.org/lukechilds/clone-response)
6
+ [![Coverage Status](https://coveralls.io/repos/github/lukechilds/clone-response/badge.svg?branch=master)](https://coveralls.io/github/lukechilds/clone-response?branch=master)
7
+ [![npm](https://img.shields.io/npm/dm/clone-response.svg)](https://www.npmjs.com/package/clone-response)
8
+ [![npm](https://img.shields.io/npm/v/clone-response.svg)](https://www.npmjs.com/package/clone-response)
9
+
10
+ Returns a new stream and copies over all properties and methods from the original response giving you a complete duplicate.
11
+
12
+ This is useful in situations where you need to consume the response stream but also want to pass an unconsumed stream somewhere else to be consumed later.
13
+
14
+ ## Install
15
+
16
+ ```shell
17
+ npm install --save clone-response
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ ```js
23
+ const http = require('http');
24
+ const cloneResponse = require('clone-response');
25
+
26
+ http.get('http://example.com', response => {
27
+ const clonedResponse = cloneResponse(response);
28
+ response.pipe(process.stdout);
29
+
30
+ setImmediate(() => {
31
+ // The response stream has already been consumed by the time this executes,
32
+ // however the cloned response stream is still available.
33
+ doSomethingWithResponse(clonedResponse);
34
+ });
35
+ });
36
+ ```
37
+
38
+ Please bear in mind that the process of cloning a stream consumes it. However, you can consume a stream multiple times in the same tick, therefore allowing you to create multiple clones. e.g:
39
+
40
+ ```js
41
+ const clone1 = cloneResponse(response);
42
+ const clone2 = cloneResponse(response);
43
+ // response can still be consumed in this tick but cannot be consumed if passed
44
+ // into any async callbacks. clone1 and clone2 can be passed around and be
45
+ // consumed in the future.
46
+ ```
47
+
48
+ ## API
49
+
50
+ ### cloneResponse(response)
51
+
52
+ Returns a clone of the passed in response.
53
+
54
+ #### response
55
+
56
+ Type: `stream`
57
+
58
+ A [Node.js HTTP response stream](https://nodejs.org/api/http.html#http_class_http_incomingmessage) to clone.
59
+
60
+ ## License
61
+
62
+ MIT © Luke Childs
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "clone-response",
3
+ "version": "1.0.2",
4
+ "description": "Clone a Node.js HTTP response stream",
5
+ "main": "src/index.js",
6
+ "scripts": {
7
+ "test": "xo && nyc ava",
8
+ "coverage": "nyc report --reporter=text-lcov | coveralls"
9
+ },
10
+ "xo": {
11
+ "extends": "xo-lukechilds"
12
+ },
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/lukechilds/clone-response.git"
16
+ },
17
+ "keywords": [
18
+ "clone",
19
+ "duplicate",
20
+ "copy",
21
+ "response",
22
+ "HTTP",
23
+ "stream"
24
+ ],
25
+ "author": "Luke Childs <lukechilds123@gmail.com> (http://lukechilds.co.uk)",
26
+ "license": "MIT",
27
+ "bugs": {
28
+ "url": "https://github.com/lukechilds/clone-response/issues"
29
+ },
30
+ "homepage": "https://github.com/lukechilds/clone-response",
31
+ "dependencies": {
32
+ "mimic-response": "^1.0.0"
33
+ },
34
+ "devDependencies": {
35
+ "ava": "^0.22.0",
36
+ "coveralls": "^2.13.1",
37
+ "create-test-server": "^2.0.1",
38
+ "eslint-config-xo-lukechilds": "^1.0.0",
39
+ "get-stream": "^3.0.0",
40
+ "nyc": "^11.0.2",
41
+ "pify": "^3.0.0",
42
+ "xo": "^0.19.0"
43
+ }
44
+ }
@@ -0,0 +1,17 @@
1
+ 'use strict';
2
+
3
+ const PassThrough = require('stream').PassThrough;
4
+ const mimicResponse = require('mimic-response');
5
+
6
+ const cloneResponse = response => {
7
+ if (!(response && response.pipe)) {
8
+ throw new TypeError('Parameter `response` must be a response stream.');
9
+ }
10
+
11
+ const clone = new PassThrough();
12
+ mimicResponse(response, clone);
13
+
14
+ return response.pipe(clone);
15
+ };
16
+
17
+ module.exports = cloneResponse;
@@ -0,0 +1,22 @@
1
+ /// <reference types="node"/>
2
+ import {IncomingMessage} from 'http';
3
+
4
+ /**
5
+ Decompress a HTTP response if needed.
6
+
7
+ @param response - The HTTP incoming stream with compressed data.
8
+ @returns The decompressed HTTP response stream.
9
+
10
+ @example
11
+ ```
12
+ import {http} from 'http';
13
+ import decompressResponse = require('decompress-response');
14
+
15
+ http.get('https://sindresorhus.com', response => {
16
+ response = decompressResponse(response);
17
+ });
18
+ ```
19
+ */
20
+ declare function decompressResponse(response: IncomingMessage): IncomingMessage;
21
+
22
+ export = decompressResponse;
@@ -0,0 +1,58 @@
1
+ 'use strict';
2
+ const {Transform, PassThrough} = require('stream');
3
+ const zlib = require('zlib');
4
+ const mimicResponse = require('mimic-response');
5
+
6
+ module.exports = response => {
7
+ const contentEncoding = (response.headers['content-encoding'] || '').toLowerCase();
8
+
9
+ if (!['gzip', 'deflate', 'br'].includes(contentEncoding)) {
10
+ return response;
11
+ }
12
+
13
+ // TODO: Remove this when targeting Node.js 12.
14
+ const isBrotli = contentEncoding === 'br';
15
+ if (isBrotli && typeof zlib.createBrotliDecompress !== 'function') {
16
+ response.destroy(new Error('Brotli is not supported on Node.js < 12'));
17
+ return response;
18
+ }
19
+
20
+ let isEmpty = true;
21
+
22
+ const checker = new Transform({
23
+ transform(data, _encoding, callback) {
24
+ isEmpty = false;
25
+
26
+ callback(null, data);
27
+ },
28
+
29
+ flush(callback) {
30
+ callback();
31
+ }
32
+ });
33
+
34
+ const finalStream = new PassThrough({
35
+ autoDestroy: false,
36
+ destroy(error, callback) {
37
+ response.destroy();
38
+
39
+ callback(error);
40
+ }
41
+ });
42
+
43
+ const decompressStream = isBrotli ? zlib.createBrotliDecompress() : zlib.createUnzip();
44
+
45
+ decompressStream.once('error', error => {
46
+ if (isEmpty && !response.readable) {
47
+ finalStream.end();
48
+ return;
49
+ }
50
+
51
+ finalStream.destroy(error);
52
+ });
53
+
54
+ mimicResponse(response, finalStream);
55
+ response.pipe(checker).pipe(decompressStream).pipe(finalStream);
56
+
57
+ return finalStream;
58
+ };
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,17 @@
1
+ import {IncomingMessage} from 'http';
2
+
3
+ /**
4
+ Mimic a [Node.js HTTP response stream](https://nodejs.org/api/http.html#http_class_http_incomingmessage)
5
+
6
+ Makes `toStream` include the properties from `fromStream`.
7
+
8
+ @param fromStream - The stream to copy the properties from.
9
+ @param toStream - The stream to copy the properties to.
10
+ @return The same object as `toStream`.
11
+ */
12
+ declare function mimicResponse<T extends NodeJS.ReadableStream>(
13
+ fromStream: IncomingMessage, // eslint-disable-line @typescript-eslint/prefer-readonly-parameter-types
14
+ toStream: T,
15
+ ): T & IncomingMessage;
16
+
17
+ export = mimicResponse;
@@ -0,0 +1,77 @@
1
+ 'use strict';
2
+
3
+ // We define these manually to ensure they're always copied
4
+ // even if they would move up the prototype chain
5
+ // https://nodejs.org/api/http.html#http_class_http_incomingmessage
6
+ const knownProperties = [
7
+ 'aborted',
8
+ 'complete',
9
+ 'headers',
10
+ 'httpVersion',
11
+ 'httpVersionMinor',
12
+ 'httpVersionMajor',
13
+ 'method',
14
+ 'rawHeaders',
15
+ 'rawTrailers',
16
+ 'setTimeout',
17
+ 'socket',
18
+ 'statusCode',
19
+ 'statusMessage',
20
+ 'trailers',
21
+ 'url'
22
+ ];
23
+
24
+ module.exports = (fromStream, toStream) => {
25
+ if (toStream._readableState.autoDestroy) {
26
+ throw new Error('The second stream must have the `autoDestroy` option set to `false`');
27
+ }
28
+
29
+ const fromProperties = new Set(Object.keys(fromStream).concat(knownProperties));
30
+
31
+ const properties = {};
32
+
33
+ for (const property of fromProperties) {
34
+ // Don't overwrite existing properties.
35
+ if (property in toStream) {
36
+ continue;
37
+ }
38
+
39
+ properties[property] = {
40
+ get() {
41
+ const value = fromStream[property];
42
+ const isFunction = typeof value === 'function';
43
+
44
+ return isFunction ? value.bind(fromStream) : value;
45
+ },
46
+ set(value) {
47
+ fromStream[property] = value;
48
+ },
49
+ enumerable: true,
50
+ configurable: false
51
+ };
52
+ }
53
+
54
+ Object.defineProperties(toStream, properties);
55
+
56
+ fromStream.once('aborted', () => {
57
+ toStream.destroy();
58
+
59
+ toStream.emit('aborted');
60
+ });
61
+
62
+ fromStream.once('close', () => {
63
+ if (fromStream.complete) {
64
+ if (toStream.readable) {
65
+ toStream.once('end', () => {
66
+ toStream.emit('close');
67
+ });
68
+ } else {
69
+ toStream.emit('close');
70
+ }
71
+ } else {
72
+ toStream.emit('close');
73
+ }
74
+ });
75
+
76
+ return toStream;
77
+ };
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "mimic-response",
3
+ "version": "3.1.0",
4
+ "description": "Mimic a Node.js HTTP response stream",
5
+ "license": "MIT",
6
+ "repository": "sindresorhus/mimic-response",
7
+ "funding": "https://github.com/sponsors/sindresorhus",
8
+ "author": {
9
+ "name": "Sindre Sorhus",
10
+ "email": "sindresorhus@gmail.com",
11
+ "url": "https://sindresorhus.com"
12
+ },
13
+ "engines": {
14
+ "node": ">=10"
15
+ },
16
+ "scripts": {
17
+ "test": "xo && ava && tsd"
18
+ },
19
+ "files": [
20
+ "index.d.ts",
21
+ "index.js"
22
+ ],
23
+ "keywords": [
24
+ "mimic",
25
+ "response",
26
+ "stream",
27
+ "http",
28
+ "https",
29
+ "request",
30
+ "get",
31
+ "core"
32
+ ],
33
+ "devDependencies": {
34
+ "@types/node": "^14.0.1",
35
+ "ava": "^2.4.0",
36
+ "create-test-server": "^2.4.0",
37
+ "p-event": "^4.1.0",
38
+ "pify": "^5.0.0",
39
+ "tsd": "^0.11.0",
40
+ "xo": "^0.30.0"
41
+ }
42
+ }