cdk-ecr-deployment 0.0.76 → 0.0.79

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 (356) hide show
  1. package/.jsii +28 -25
  2. package/lambda/Dockerfile +25 -0
  3. package/lambda/install.js +64 -0
  4. package/lib/index.js +40 -23
  5. package/node_modules/@sindresorhus/is/dist/index.d.ts +225 -0
  6. package/node_modules/@sindresorhus/is/dist/index.js +427 -0
  7. package/node_modules/@sindresorhus/is/dist/types.d.ts +24 -0
  8. package/node_modules/@sindresorhus/is/dist/types.js +3 -0
  9. package/node_modules/@sindresorhus/is/license +9 -0
  10. package/node_modules/@sindresorhus/is/package.json +96 -0
  11. package/node_modules/@sindresorhus/is/readme.md +628 -0
  12. package/node_modules/@szmarczak/http-timer/LICENSE +21 -0
  13. package/node_modules/@szmarczak/http-timer/README.md +93 -0
  14. package/node_modules/@szmarczak/http-timer/dist/source/index.d.ts +32 -0
  15. package/node_modules/@szmarczak/http-timer/dist/source/index.js +126 -0
  16. package/node_modules/@szmarczak/http-timer/package.json +72 -0
  17. package/node_modules/@types/cacheable-request/LICENSE +21 -0
  18. package/node_modules/@types/cacheable-request/README.md +16 -0
  19. package/node_modules/@types/cacheable-request/index.d.ts +137 -0
  20. package/node_modules/@types/cacheable-request/node_modules/@types/node/LICENSE +21 -0
  21. package/node_modules/@types/cacheable-request/node_modules/@types/node/README.md +16 -0
  22. package/node_modules/@types/cacheable-request/node_modules/@types/node/assert/strict.d.ts +8 -0
  23. package/node_modules/@types/cacheable-request/node_modules/@types/node/assert.d.ts +912 -0
  24. package/node_modules/@types/cacheable-request/node_modules/@types/node/async_hooks.d.ts +497 -0
  25. package/node_modules/@types/cacheable-request/node_modules/@types/node/buffer.d.ts +2142 -0
  26. package/node_modules/@types/cacheable-request/node_modules/@types/node/child_process.d.ts +1365 -0
  27. package/node_modules/@types/cacheable-request/node_modules/@types/node/cluster.d.ts +414 -0
  28. package/node_modules/@types/cacheable-request/node_modules/@types/node/console.d.ts +412 -0
  29. package/node_modules/@types/cacheable-request/node_modules/@types/node/constants.d.ts +18 -0
  30. package/node_modules/@types/cacheable-request/node_modules/@types/node/crypto.d.ts +3307 -0
  31. package/node_modules/@types/cacheable-request/node_modules/@types/node/dgram.d.ts +545 -0
  32. package/node_modules/@types/cacheable-request/node_modules/@types/node/diagnostics_channel.d.ts +128 -0
  33. package/node_modules/@types/cacheable-request/node_modules/@types/node/dns/promises.d.ts +357 -0
  34. package/node_modules/@types/cacheable-request/node_modules/@types/node/dns.d.ts +643 -0
  35. package/node_modules/@types/cacheable-request/node_modules/@types/node/domain.d.ts +169 -0
  36. package/node_modules/@types/cacheable-request/node_modules/@types/node/events.d.ts +623 -0
  37. package/node_modules/@types/cacheable-request/node_modules/@types/node/fs/promises.d.ts +1004 -0
  38. package/node_modules/@types/cacheable-request/node_modules/@types/node/fs.d.ts +3748 -0
  39. package/node_modules/@types/cacheable-request/node_modules/@types/node/globals.d.ts +284 -0
  40. package/node_modules/@types/cacheable-request/node_modules/@types/node/globals.global.d.ts +1 -0
  41. package/node_modules/@types/cacheable-request/node_modules/@types/node/http.d.ts +1368 -0
  42. package/node_modules/@types/cacheable-request/node_modules/@types/node/http2.d.ts +2100 -0
  43. package/node_modules/@types/cacheable-request/node_modules/@types/node/https.d.ts +391 -0
  44. package/node_modules/@types/cacheable-request/node_modules/@types/node/index.d.ts +131 -0
  45. package/node_modules/@types/cacheable-request/node_modules/@types/node/inspector.d.ts +2738 -0
  46. package/node_modules/@types/cacheable-request/node_modules/@types/node/module.d.ts +114 -0
  47. package/node_modules/@types/cacheable-request/node_modules/@types/node/net.d.ts +783 -0
  48. package/node_modules/@types/cacheable-request/node_modules/@types/node/os.d.ts +455 -0
  49. package/node_modules/@types/cacheable-request/node_modules/@types/node/package.json +230 -0
  50. package/node_modules/@types/cacheable-request/node_modules/@types/node/path.d.ts +172 -0
  51. package/node_modules/@types/cacheable-request/node_modules/@types/node/perf_hooks.d.ts +555 -0
  52. package/node_modules/@types/cacheable-request/node_modules/@types/node/process.d.ts +1477 -0
  53. package/node_modules/@types/cacheable-request/node_modules/@types/node/punycode.d.ts +117 -0
  54. package/node_modules/@types/cacheable-request/node_modules/@types/node/querystring.d.ts +131 -0
  55. package/node_modules/@types/cacheable-request/node_modules/@types/node/readline.d.ts +542 -0
  56. package/node_modules/@types/cacheable-request/node_modules/@types/node/repl.d.ts +424 -0
  57. package/node_modules/@types/cacheable-request/node_modules/@types/node/stream/consumers.d.ts +24 -0
  58. package/node_modules/@types/cacheable-request/node_modules/@types/node/stream/promises.d.ts +42 -0
  59. package/node_modules/@types/cacheable-request/node_modules/@types/node/stream/web.d.ts +6 -0
  60. package/node_modules/@types/cacheable-request/node_modules/@types/node/stream.d.ts +1249 -0
  61. package/node_modules/@types/cacheable-request/node_modules/@types/node/string_decoder.d.ts +67 -0
  62. package/node_modules/@types/cacheable-request/node_modules/@types/node/timers/promises.d.ts +68 -0
  63. package/node_modules/@types/cacheable-request/node_modules/@types/node/timers.d.ts +94 -0
  64. package/node_modules/@types/cacheable-request/node_modules/@types/node/tls.d.ts +1019 -0
  65. package/node_modules/@types/cacheable-request/node_modules/@types/node/trace_events.d.ts +161 -0
  66. package/node_modules/@types/cacheable-request/node_modules/@types/node/tty.d.ts +204 -0
  67. package/node_modules/@types/cacheable-request/node_modules/@types/node/url.d.ts +798 -0
  68. package/node_modules/@types/cacheable-request/node_modules/@types/node/util.d.ts +1563 -0
  69. package/node_modules/@types/cacheable-request/node_modules/@types/node/v8.d.ts +378 -0
  70. package/node_modules/@types/cacheable-request/node_modules/@types/node/vm.d.ts +507 -0
  71. package/node_modules/@types/cacheable-request/node_modules/@types/node/wasi.d.ts +158 -0
  72. package/node_modules/@types/cacheable-request/node_modules/@types/node/worker_threads.d.ts +649 -0
  73. package/node_modules/@types/cacheable-request/node_modules/@types/node/zlib.d.ts +517 -0
  74. package/node_modules/@types/cacheable-request/package.json +35 -0
  75. package/node_modules/@types/http-cache-semantics/LICENSE +21 -0
  76. package/node_modules/@types/http-cache-semantics/README.md +16 -0
  77. package/node_modules/@types/http-cache-semantics/index.d.ts +170 -0
  78. package/node_modules/@types/http-cache-semantics/package.json +25 -0
  79. package/node_modules/@types/keyv/LICENSE +21 -0
  80. package/node_modules/@types/keyv/README.md +16 -0
  81. package/node_modules/@types/keyv/index.d.ts +77 -0
  82. package/node_modules/@types/keyv/node_modules/@types/node/LICENSE +21 -0
  83. package/node_modules/@types/keyv/node_modules/@types/node/README.md +16 -0
  84. package/node_modules/@types/keyv/node_modules/@types/node/assert/strict.d.ts +8 -0
  85. package/node_modules/@types/keyv/node_modules/@types/node/assert.d.ts +912 -0
  86. package/node_modules/@types/keyv/node_modules/@types/node/async_hooks.d.ts +497 -0
  87. package/node_modules/@types/keyv/node_modules/@types/node/buffer.d.ts +2142 -0
  88. package/node_modules/@types/keyv/node_modules/@types/node/child_process.d.ts +1365 -0
  89. package/node_modules/@types/keyv/node_modules/@types/node/cluster.d.ts +414 -0
  90. package/node_modules/@types/keyv/node_modules/@types/node/console.d.ts +412 -0
  91. package/node_modules/@types/keyv/node_modules/@types/node/constants.d.ts +18 -0
  92. package/node_modules/@types/keyv/node_modules/@types/node/crypto.d.ts +3307 -0
  93. package/node_modules/@types/keyv/node_modules/@types/node/dgram.d.ts +545 -0
  94. package/node_modules/@types/keyv/node_modules/@types/node/diagnostics_channel.d.ts +128 -0
  95. package/node_modules/@types/keyv/node_modules/@types/node/dns/promises.d.ts +357 -0
  96. package/node_modules/@types/keyv/node_modules/@types/node/dns.d.ts +643 -0
  97. package/node_modules/@types/keyv/node_modules/@types/node/domain.d.ts +169 -0
  98. package/node_modules/@types/keyv/node_modules/@types/node/events.d.ts +623 -0
  99. package/node_modules/@types/keyv/node_modules/@types/node/fs/promises.d.ts +1004 -0
  100. package/node_modules/@types/keyv/node_modules/@types/node/fs.d.ts +3748 -0
  101. package/node_modules/@types/keyv/node_modules/@types/node/globals.d.ts +284 -0
  102. package/node_modules/@types/keyv/node_modules/@types/node/globals.global.d.ts +1 -0
  103. package/node_modules/@types/keyv/node_modules/@types/node/http.d.ts +1368 -0
  104. package/node_modules/@types/keyv/node_modules/@types/node/http2.d.ts +2100 -0
  105. package/node_modules/@types/keyv/node_modules/@types/node/https.d.ts +391 -0
  106. package/node_modules/@types/keyv/node_modules/@types/node/index.d.ts +131 -0
  107. package/node_modules/@types/keyv/node_modules/@types/node/inspector.d.ts +2738 -0
  108. package/node_modules/@types/keyv/node_modules/@types/node/module.d.ts +114 -0
  109. package/node_modules/@types/keyv/node_modules/@types/node/net.d.ts +783 -0
  110. package/node_modules/@types/keyv/node_modules/@types/node/os.d.ts +455 -0
  111. package/node_modules/@types/keyv/node_modules/@types/node/package.json +230 -0
  112. package/node_modules/@types/keyv/node_modules/@types/node/path.d.ts +172 -0
  113. package/node_modules/@types/keyv/node_modules/@types/node/perf_hooks.d.ts +555 -0
  114. package/node_modules/@types/keyv/node_modules/@types/node/process.d.ts +1477 -0
  115. package/node_modules/@types/keyv/node_modules/@types/node/punycode.d.ts +117 -0
  116. package/node_modules/@types/keyv/node_modules/@types/node/querystring.d.ts +131 -0
  117. package/node_modules/@types/keyv/node_modules/@types/node/readline.d.ts +542 -0
  118. package/node_modules/@types/keyv/node_modules/@types/node/repl.d.ts +424 -0
  119. package/node_modules/@types/keyv/node_modules/@types/node/stream/consumers.d.ts +24 -0
  120. package/node_modules/@types/keyv/node_modules/@types/node/stream/promises.d.ts +42 -0
  121. package/node_modules/@types/keyv/node_modules/@types/node/stream/web.d.ts +6 -0
  122. package/node_modules/@types/keyv/node_modules/@types/node/stream.d.ts +1249 -0
  123. package/node_modules/@types/keyv/node_modules/@types/node/string_decoder.d.ts +67 -0
  124. package/node_modules/@types/keyv/node_modules/@types/node/timers/promises.d.ts +68 -0
  125. package/node_modules/@types/keyv/node_modules/@types/node/timers.d.ts +94 -0
  126. package/node_modules/@types/keyv/node_modules/@types/node/tls.d.ts +1019 -0
  127. package/node_modules/@types/keyv/node_modules/@types/node/trace_events.d.ts +161 -0
  128. package/node_modules/@types/keyv/node_modules/@types/node/tty.d.ts +204 -0
  129. package/node_modules/@types/keyv/node_modules/@types/node/url.d.ts +798 -0
  130. package/node_modules/@types/keyv/node_modules/@types/node/util.d.ts +1563 -0
  131. package/node_modules/@types/keyv/node_modules/@types/node/v8.d.ts +378 -0
  132. package/node_modules/@types/keyv/node_modules/@types/node/vm.d.ts +507 -0
  133. package/node_modules/@types/keyv/node_modules/@types/node/wasi.d.ts +158 -0
  134. package/node_modules/@types/keyv/node_modules/@types/node/worker_threads.d.ts +649 -0
  135. package/node_modules/@types/keyv/node_modules/@types/node/zlib.d.ts +517 -0
  136. package/node_modules/@types/keyv/package.json +32 -0
  137. package/node_modules/@types/responselike/LICENSE +21 -0
  138. package/node_modules/@types/responselike/README.md +16 -0
  139. package/node_modules/@types/responselike/index.d.ts +34 -0
  140. package/node_modules/@types/responselike/node_modules/@types/node/LICENSE +21 -0
  141. package/node_modules/@types/responselike/node_modules/@types/node/README.md +16 -0
  142. package/node_modules/@types/responselike/node_modules/@types/node/assert/strict.d.ts +8 -0
  143. package/node_modules/@types/responselike/node_modules/@types/node/assert.d.ts +912 -0
  144. package/node_modules/@types/responselike/node_modules/@types/node/async_hooks.d.ts +497 -0
  145. package/node_modules/@types/responselike/node_modules/@types/node/buffer.d.ts +2142 -0
  146. package/node_modules/@types/responselike/node_modules/@types/node/child_process.d.ts +1365 -0
  147. package/node_modules/@types/responselike/node_modules/@types/node/cluster.d.ts +414 -0
  148. package/node_modules/@types/responselike/node_modules/@types/node/console.d.ts +412 -0
  149. package/node_modules/@types/responselike/node_modules/@types/node/constants.d.ts +18 -0
  150. package/node_modules/@types/responselike/node_modules/@types/node/crypto.d.ts +3307 -0
  151. package/node_modules/@types/responselike/node_modules/@types/node/dgram.d.ts +545 -0
  152. package/node_modules/@types/responselike/node_modules/@types/node/diagnostics_channel.d.ts +128 -0
  153. package/node_modules/@types/responselike/node_modules/@types/node/dns/promises.d.ts +357 -0
  154. package/node_modules/@types/responselike/node_modules/@types/node/dns.d.ts +643 -0
  155. package/node_modules/@types/responselike/node_modules/@types/node/domain.d.ts +169 -0
  156. package/node_modules/@types/responselike/node_modules/@types/node/events.d.ts +623 -0
  157. package/node_modules/@types/responselike/node_modules/@types/node/fs/promises.d.ts +1004 -0
  158. package/node_modules/@types/responselike/node_modules/@types/node/fs.d.ts +3748 -0
  159. package/node_modules/@types/responselike/node_modules/@types/node/globals.d.ts +284 -0
  160. package/node_modules/@types/responselike/node_modules/@types/node/globals.global.d.ts +1 -0
  161. package/node_modules/@types/responselike/node_modules/@types/node/http.d.ts +1368 -0
  162. package/node_modules/@types/responselike/node_modules/@types/node/http2.d.ts +2100 -0
  163. package/node_modules/@types/responselike/node_modules/@types/node/https.d.ts +391 -0
  164. package/node_modules/@types/responselike/node_modules/@types/node/index.d.ts +131 -0
  165. package/node_modules/@types/responselike/node_modules/@types/node/inspector.d.ts +2738 -0
  166. package/node_modules/@types/responselike/node_modules/@types/node/module.d.ts +114 -0
  167. package/node_modules/@types/responselike/node_modules/@types/node/net.d.ts +783 -0
  168. package/node_modules/@types/responselike/node_modules/@types/node/os.d.ts +455 -0
  169. package/node_modules/@types/responselike/node_modules/@types/node/package.json +230 -0
  170. package/node_modules/@types/responselike/node_modules/@types/node/path.d.ts +172 -0
  171. package/node_modules/@types/responselike/node_modules/@types/node/perf_hooks.d.ts +555 -0
  172. package/node_modules/@types/responselike/node_modules/@types/node/process.d.ts +1477 -0
  173. package/node_modules/@types/responselike/node_modules/@types/node/punycode.d.ts +117 -0
  174. package/node_modules/@types/responselike/node_modules/@types/node/querystring.d.ts +131 -0
  175. package/node_modules/@types/responselike/node_modules/@types/node/readline.d.ts +542 -0
  176. package/node_modules/@types/responselike/node_modules/@types/node/repl.d.ts +424 -0
  177. package/node_modules/@types/responselike/node_modules/@types/node/stream/consumers.d.ts +24 -0
  178. package/node_modules/@types/responselike/node_modules/@types/node/stream/promises.d.ts +42 -0
  179. package/node_modules/@types/responselike/node_modules/@types/node/stream/web.d.ts +6 -0
  180. package/node_modules/@types/responselike/node_modules/@types/node/stream.d.ts +1249 -0
  181. package/node_modules/@types/responselike/node_modules/@types/node/string_decoder.d.ts +67 -0
  182. package/node_modules/@types/responselike/node_modules/@types/node/timers/promises.d.ts +68 -0
  183. package/node_modules/@types/responselike/node_modules/@types/node/timers.d.ts +94 -0
  184. package/node_modules/@types/responselike/node_modules/@types/node/tls.d.ts +1019 -0
  185. package/node_modules/@types/responselike/node_modules/@types/node/trace_events.d.ts +161 -0
  186. package/node_modules/@types/responselike/node_modules/@types/node/tty.d.ts +204 -0
  187. package/node_modules/@types/responselike/node_modules/@types/node/url.d.ts +798 -0
  188. package/node_modules/@types/responselike/node_modules/@types/node/util.d.ts +1563 -0
  189. package/node_modules/@types/responselike/node_modules/@types/node/v8.d.ts +378 -0
  190. package/node_modules/@types/responselike/node_modules/@types/node/vm.d.ts +507 -0
  191. package/node_modules/@types/responselike/node_modules/@types/node/wasi.d.ts +158 -0
  192. package/node_modules/@types/responselike/node_modules/@types/node/worker_threads.d.ts +649 -0
  193. package/node_modules/@types/responselike/node_modules/@types/node/zlib.d.ts +517 -0
  194. package/node_modules/@types/responselike/package.json +25 -0
  195. package/node_modules/cacheable-lookup/LICENSE +21 -0
  196. package/node_modules/cacheable-lookup/README.md +240 -0
  197. package/node_modules/cacheable-lookup/index.d.ts +139 -0
  198. package/node_modules/cacheable-lookup/package.json +45 -0
  199. package/node_modules/cacheable-lookup/source/index.js +436 -0
  200. package/node_modules/cacheable-request/LICENSE +21 -0
  201. package/node_modules/cacheable-request/README.md +206 -0
  202. package/node_modules/cacheable-request/package.json +56 -0
  203. package/node_modules/cacheable-request/src/index.js +251 -0
  204. package/node_modules/clone-response/LICENSE +21 -0
  205. package/node_modules/clone-response/README.md +62 -0
  206. package/node_modules/clone-response/package.json +44 -0
  207. package/node_modules/clone-response/src/index.js +17 -0
  208. package/node_modules/decompress-response/index.d.ts +22 -0
  209. package/node_modules/decompress-response/index.js +58 -0
  210. package/node_modules/decompress-response/license +9 -0
  211. package/node_modules/decompress-response/node_modules/mimic-response/index.d.ts +17 -0
  212. package/node_modules/decompress-response/node_modules/mimic-response/index.js +77 -0
  213. package/node_modules/decompress-response/node_modules/mimic-response/license +9 -0
  214. package/node_modules/decompress-response/node_modules/mimic-response/package.json +42 -0
  215. package/node_modules/decompress-response/node_modules/mimic-response/readme.md +78 -0
  216. package/node_modules/decompress-response/package.json +56 -0
  217. package/node_modules/decompress-response/readme.md +48 -0
  218. package/node_modules/defer-to-connect/LICENSE +21 -0
  219. package/node_modules/defer-to-connect/README.md +38 -0
  220. package/node_modules/defer-to-connect/dist/source/index.d.ts +10 -0
  221. package/node_modules/defer-to-connect/dist/source/index.js +47 -0
  222. package/node_modules/defer-to-connect/package.json +71 -0
  223. package/node_modules/end-of-stream/LICENSE +21 -0
  224. package/node_modules/end-of-stream/README.md +54 -0
  225. package/node_modules/end-of-stream/index.js +94 -0
  226. package/node_modules/end-of-stream/package.json +37 -0
  227. package/node_modules/get-stream/buffer-stream.js +52 -0
  228. package/node_modules/get-stream/index.d.ts +108 -0
  229. package/node_modules/get-stream/index.js +60 -0
  230. package/node_modules/get-stream/license +9 -0
  231. package/node_modules/get-stream/package.json +50 -0
  232. package/node_modules/get-stream/readme.md +124 -0
  233. package/node_modules/got/dist/source/as-promise/create-rejection.d.ts +2 -0
  234. package/node_modules/got/dist/source/as-promise/create-rejection.js +30 -0
  235. package/node_modules/got/dist/source/as-promise/index.d.ts +3 -0
  236. package/node_modules/got/dist/source/as-promise/index.js +175 -0
  237. package/node_modules/got/dist/source/as-promise/normalize-arguments.d.ts +3 -0
  238. package/node_modules/got/dist/source/as-promise/normalize-arguments.js +78 -0
  239. package/node_modules/got/dist/source/as-promise/parse-body.d.ts +3 -0
  240. package/node_modules/got/dist/source/as-promise/parse-body.js +25 -0
  241. package/node_modules/got/dist/source/as-promise/types.d.ts +256 -0
  242. package/node_modules/got/dist/source/as-promise/types.js +40 -0
  243. package/node_modules/got/dist/source/core/calculate-retry-delay.d.ts +5 -0
  244. package/node_modules/got/dist/source/core/calculate-retry-delay.js +29 -0
  245. package/node_modules/got/dist/source/core/index.d.ts +1124 -0
  246. package/node_modules/got/dist/source/core/index.js +1491 -0
  247. package/node_modules/got/dist/source/core/utils/dns-ip-version.d.ts +5 -0
  248. package/node_modules/got/dist/source/core/utils/dns-ip-version.js +17 -0
  249. package/node_modules/got/dist/source/core/utils/get-body-size.d.ts +3 -0
  250. package/node_modules/got/dist/source/core/utils/get-body-size.js +32 -0
  251. package/node_modules/got/dist/source/core/utils/get-buffer.d.ts +4 -0
  252. package/node_modules/got/dist/source/core/utils/get-buffer.js +16 -0
  253. package/node_modules/got/dist/source/core/utils/is-form-data.d.ts +8 -0
  254. package/node_modules/got/dist/source/core/utils/is-form-data.js +4 -0
  255. package/node_modules/got/dist/source/core/utils/is-response-ok.d.ts +2 -0
  256. package/node_modules/got/dist/source/core/utils/is-response-ok.js +8 -0
  257. package/node_modules/got/dist/source/core/utils/options-to-url.d.ts +14 -0
  258. package/node_modules/got/dist/source/core/utils/options-to-url.js +53 -0
  259. package/node_modules/got/dist/source/core/utils/proxy-events.d.ts +3 -0
  260. package/node_modules/got/dist/source/core/utils/proxy-events.js +17 -0
  261. package/node_modules/got/dist/source/core/utils/timed-out.d.ts +29 -0
  262. package/node_modules/got/dist/source/core/utils/timed-out.js +121 -0
  263. package/node_modules/got/dist/source/core/utils/unhandle.d.ts +11 -0
  264. package/node_modules/got/dist/source/core/utils/unhandle.js +22 -0
  265. package/node_modules/got/dist/source/core/utils/url-to-options.d.ts +15 -0
  266. package/node_modules/got/dist/source/core/utils/url-to-options.js +24 -0
  267. package/node_modules/got/dist/source/core/utils/weakable-map.d.ts +8 -0
  268. package/node_modules/got/dist/source/core/utils/weakable-map.js +29 -0
  269. package/node_modules/got/dist/source/create.d.ts +5 -0
  270. package/node_modules/got/dist/source/create.js +240 -0
  271. package/node_modules/got/dist/source/index.d.ts +4 -0
  272. package/node_modules/got/dist/source/index.js +132 -0
  273. package/node_modules/got/dist/source/types.d.ts +342 -0
  274. package/node_modules/got/dist/source/types.js +2 -0
  275. package/node_modules/got/dist/source/utils/deep-freeze.d.ts +1 -0
  276. package/node_modules/got/dist/source/utils/deep-freeze.js +12 -0
  277. package/node_modules/got/dist/source/utils/deprecation-warning.d.ts +2 -0
  278. package/node_modules/got/dist/source/utils/deprecation-warning.js +13 -0
  279. package/node_modules/got/license +9 -0
  280. package/node_modules/got/package.json +130 -0
  281. package/node_modules/got/readme.md +2476 -0
  282. package/node_modules/http-cache-semantics/LICENSE +9 -0
  283. package/node_modules/http-cache-semantics/README.md +203 -0
  284. package/node_modules/http-cache-semantics/index.js +673 -0
  285. package/node_modules/http-cache-semantics/package.json +24 -0
  286. package/node_modules/http2-wrapper/LICENSE +21 -0
  287. package/node_modules/http2-wrapper/README.md +470 -0
  288. package/node_modules/http2-wrapper/package.json +54 -0
  289. package/node_modules/http2-wrapper/source/agent.js +670 -0
  290. package/node_modules/http2-wrapper/source/auto.js +149 -0
  291. package/node_modules/http2-wrapper/source/client-request.js +445 -0
  292. package/node_modules/http2-wrapper/source/incoming-message.js +58 -0
  293. package/node_modules/http2-wrapper/source/index.js +28 -0
  294. package/node_modules/http2-wrapper/source/utils/calculate-server-name.js +27 -0
  295. package/node_modules/http2-wrapper/source/utils/errors.js +45 -0
  296. package/node_modules/http2-wrapper/source/utils/is-request-pseudo-header.js +13 -0
  297. package/node_modules/http2-wrapper/source/utils/proxy-events.js +7 -0
  298. package/node_modules/http2-wrapper/source/utils/url-to-options.js +25 -0
  299. package/node_modules/json-buffer/.travis.yml +3 -0
  300. package/node_modules/json-buffer/LICENSE +22 -0
  301. package/node_modules/json-buffer/README.md +24 -0
  302. package/node_modules/json-buffer/index.js +58 -0
  303. package/node_modules/json-buffer/package.json +34 -0
  304. package/node_modules/json-buffer/test/index.js +63 -0
  305. package/node_modules/keyv/LICENSE +21 -0
  306. package/node_modules/keyv/README.md +288 -0
  307. package/node_modules/keyv/package.json +49 -0
  308. package/node_modules/keyv/src/index.js +111 -0
  309. package/node_modules/lowercase-keys/index.d.ts +16 -0
  310. package/node_modules/lowercase-keys/index.js +10 -0
  311. package/node_modules/lowercase-keys/license +9 -0
  312. package/node_modules/lowercase-keys/package.json +38 -0
  313. package/node_modules/lowercase-keys/readme.md +32 -0
  314. package/node_modules/mimic-response/index.js +32 -0
  315. package/node_modules/mimic-response/license +9 -0
  316. package/node_modules/mimic-response/package.json +37 -0
  317. package/node_modules/mimic-response/readme.md +54 -0
  318. package/node_modules/normalize-url/index.d.ts +267 -0
  319. package/node_modules/normalize-url/index.js +216 -0
  320. package/node_modules/normalize-url/license +9 -0
  321. package/node_modules/normalize-url/package.json +50 -0
  322. package/node_modules/normalize-url/readme.md +286 -0
  323. package/node_modules/once/LICENSE +15 -0
  324. package/node_modules/once/README.md +79 -0
  325. package/node_modules/once/once.js +42 -0
  326. package/node_modules/once/package.json +33 -0
  327. package/node_modules/p-cancelable/index.d.ts +176 -0
  328. package/node_modules/p-cancelable/index.js +111 -0
  329. package/node_modules/p-cancelable/license +9 -0
  330. package/node_modules/p-cancelable/package.json +49 -0
  331. package/node_modules/p-cancelable/readme.md +153 -0
  332. package/node_modules/pump/.travis.yml +5 -0
  333. package/node_modules/pump/LICENSE +21 -0
  334. package/node_modules/pump/README.md +65 -0
  335. package/node_modules/pump/index.js +82 -0
  336. package/node_modules/pump/package.json +24 -0
  337. package/node_modules/pump/test-browser.js +66 -0
  338. package/node_modules/pump/test-node.js +53 -0
  339. package/node_modules/quick-lru/index.d.ts +97 -0
  340. package/node_modules/quick-lru/index.js +123 -0
  341. package/node_modules/quick-lru/license +9 -0
  342. package/node_modules/quick-lru/package.json +43 -0
  343. package/node_modules/quick-lru/readme.md +111 -0
  344. package/node_modules/resolve-alpn/LICENSE +22 -0
  345. package/node_modules/resolve-alpn/README.md +60 -0
  346. package/node_modules/resolve-alpn/index.js +43 -0
  347. package/node_modules/resolve-alpn/package.json +34 -0
  348. package/node_modules/responselike/LICENSE +19 -0
  349. package/node_modules/responselike/README.md +77 -0
  350. package/node_modules/responselike/package.json +38 -0
  351. package/node_modules/responselike/src/index.js +34 -0
  352. package/node_modules/wrappy/LICENSE +15 -0
  353. package/node_modules/wrappy/README.md +36 -0
  354. package/node_modules/wrappy/package.json +29 -0
  355. package/node_modules/wrappy/wrappy.js +33 -0
  356. package/package.json +7 -4
@@ -0,0 +1,436 @@
1
+ 'use strict';
2
+ const {
3
+ V4MAPPED,
4
+ ADDRCONFIG,
5
+ ALL,
6
+ promises: {
7
+ Resolver: AsyncResolver
8
+ },
9
+ lookup: dnsLookup
10
+ } = require('dns');
11
+ const {promisify} = require('util');
12
+ const os = require('os');
13
+
14
+ const kCacheableLookupCreateConnection = Symbol('cacheableLookupCreateConnection');
15
+ const kCacheableLookupInstance = Symbol('cacheableLookupInstance');
16
+ const kExpires = Symbol('expires');
17
+
18
+ const supportsALL = typeof ALL === 'number';
19
+
20
+ const verifyAgent = agent => {
21
+ if (!(agent && typeof agent.createConnection === 'function')) {
22
+ throw new Error('Expected an Agent instance as the first argument');
23
+ }
24
+ };
25
+
26
+ const map4to6 = entries => {
27
+ for (const entry of entries) {
28
+ if (entry.family === 6) {
29
+ continue;
30
+ }
31
+
32
+ entry.address = `::ffff:${entry.address}`;
33
+ entry.family = 6;
34
+ }
35
+ };
36
+
37
+ const getIfaceInfo = () => {
38
+ let has4 = false;
39
+ let has6 = false;
40
+
41
+ for (const device of Object.values(os.networkInterfaces())) {
42
+ for (const iface of device) {
43
+ if (iface.internal) {
44
+ continue;
45
+ }
46
+
47
+ if (iface.family === 'IPv6') {
48
+ has6 = true;
49
+ } else {
50
+ has4 = true;
51
+ }
52
+
53
+ if (has4 && has6) {
54
+ return {has4, has6};
55
+ }
56
+ }
57
+ }
58
+
59
+ return {has4, has6};
60
+ };
61
+
62
+ const isIterable = map => {
63
+ return Symbol.iterator in map;
64
+ };
65
+
66
+ const ttl = {ttl: true};
67
+ const all = {all: true};
68
+
69
+ class CacheableLookup {
70
+ constructor({
71
+ cache = new Map(),
72
+ maxTtl = Infinity,
73
+ fallbackDuration = 3600,
74
+ errorTtl = 0.15,
75
+ resolver = new AsyncResolver(),
76
+ lookup = dnsLookup
77
+ } = {}) {
78
+ this.maxTtl = maxTtl;
79
+ this.errorTtl = errorTtl;
80
+
81
+ this._cache = cache;
82
+ this._resolver = resolver;
83
+ this._dnsLookup = promisify(lookup);
84
+
85
+ if (this._resolver instanceof AsyncResolver) {
86
+ this._resolve4 = this._resolver.resolve4.bind(this._resolver);
87
+ this._resolve6 = this._resolver.resolve6.bind(this._resolver);
88
+ } else {
89
+ this._resolve4 = promisify(this._resolver.resolve4.bind(this._resolver));
90
+ this._resolve6 = promisify(this._resolver.resolve6.bind(this._resolver));
91
+ }
92
+
93
+ this._iface = getIfaceInfo();
94
+
95
+ this._pending = {};
96
+ this._nextRemovalTime = false;
97
+ this._hostnamesToFallback = new Set();
98
+
99
+ if (fallbackDuration < 1) {
100
+ this._fallback = false;
101
+ } else {
102
+ this._fallback = true;
103
+
104
+ const interval = setInterval(() => {
105
+ this._hostnamesToFallback.clear();
106
+ }, fallbackDuration * 1000);
107
+
108
+ /* istanbul ignore next: There is no `interval.unref()` when running inside an Electron renderer */
109
+ if (interval.unref) {
110
+ interval.unref();
111
+ }
112
+ }
113
+
114
+ this.lookup = this.lookup.bind(this);
115
+ this.lookupAsync = this.lookupAsync.bind(this);
116
+ }
117
+
118
+ set servers(servers) {
119
+ this.clear();
120
+
121
+ this._resolver.setServers(servers);
122
+ }
123
+
124
+ get servers() {
125
+ return this._resolver.getServers();
126
+ }
127
+
128
+ lookup(hostname, options, callback) {
129
+ if (typeof options === 'function') {
130
+ callback = options;
131
+ options = {};
132
+ } else if (typeof options === 'number') {
133
+ options = {
134
+ family: options
135
+ };
136
+ }
137
+
138
+ if (!callback) {
139
+ throw new Error('Callback must be a function.');
140
+ }
141
+
142
+ // eslint-disable-next-line promise/prefer-await-to-then
143
+ this.lookupAsync(hostname, options).then(result => {
144
+ if (options.all) {
145
+ callback(null, result);
146
+ } else {
147
+ callback(null, result.address, result.family, result.expires, result.ttl);
148
+ }
149
+ }, callback);
150
+ }
151
+
152
+ async lookupAsync(hostname, options = {}) {
153
+ if (typeof options === 'number') {
154
+ options = {
155
+ family: options
156
+ };
157
+ }
158
+
159
+ let cached = await this.query(hostname);
160
+
161
+ if (options.family === 6) {
162
+ const filtered = cached.filter(entry => entry.family === 6);
163
+
164
+ if (options.hints & V4MAPPED) {
165
+ if ((supportsALL && options.hints & ALL) || filtered.length === 0) {
166
+ map4to6(cached);
167
+ } else {
168
+ cached = filtered;
169
+ }
170
+ } else {
171
+ cached = filtered;
172
+ }
173
+ } else if (options.family === 4) {
174
+ cached = cached.filter(entry => entry.family === 4);
175
+ }
176
+
177
+ if (options.hints & ADDRCONFIG) {
178
+ const {_iface} = this;
179
+ cached = cached.filter(entry => entry.family === 6 ? _iface.has6 : _iface.has4);
180
+ }
181
+
182
+ if (cached.length === 0) {
183
+ const error = new Error(`cacheableLookup ENOTFOUND ${hostname}`);
184
+ error.code = 'ENOTFOUND';
185
+ error.hostname = hostname;
186
+
187
+ throw error;
188
+ }
189
+
190
+ if (options.all) {
191
+ return cached;
192
+ }
193
+
194
+ return cached[0];
195
+ }
196
+
197
+ async query(hostname) {
198
+ let cached = await this._cache.get(hostname);
199
+
200
+ if (!cached) {
201
+ const pending = this._pending[hostname];
202
+
203
+ if (pending) {
204
+ cached = await pending;
205
+ } else {
206
+ const newPromise = this.queryAndCache(hostname);
207
+ this._pending[hostname] = newPromise;
208
+
209
+ try {
210
+ cached = await newPromise;
211
+ } finally {
212
+ delete this._pending[hostname];
213
+ }
214
+ }
215
+ }
216
+
217
+ cached = cached.map(entry => {
218
+ return {...entry};
219
+ });
220
+
221
+ return cached;
222
+ }
223
+
224
+ async _resolve(hostname) {
225
+ const wrap = async promise => {
226
+ try {
227
+ return await promise;
228
+ } catch (error) {
229
+ if (error.code === 'ENODATA' || error.code === 'ENOTFOUND') {
230
+ return [];
231
+ }
232
+
233
+ throw error;
234
+ }
235
+ };
236
+
237
+ // ANY is unsafe as it doesn't trigger new queries in the underlying server.
238
+ const [A, AAAA] = await Promise.all([
239
+ this._resolve4(hostname, ttl),
240
+ this._resolve6(hostname, ttl)
241
+ ].map(promise => wrap(promise)));
242
+
243
+ let aTtl = 0;
244
+ let aaaaTtl = 0;
245
+ let cacheTtl = 0;
246
+
247
+ const now = Date.now();
248
+
249
+ for (const entry of A) {
250
+ entry.family = 4;
251
+ entry.expires = now + (entry.ttl * 1000);
252
+
253
+ aTtl = Math.max(aTtl, entry.ttl);
254
+ }
255
+
256
+ for (const entry of AAAA) {
257
+ entry.family = 6;
258
+ entry.expires = now + (entry.ttl * 1000);
259
+
260
+ aaaaTtl = Math.max(aaaaTtl, entry.ttl);
261
+ }
262
+
263
+ if (A.length > 0) {
264
+ if (AAAA.length > 0) {
265
+ cacheTtl = Math.min(aTtl, aaaaTtl);
266
+ } else {
267
+ cacheTtl = aTtl;
268
+ }
269
+ } else {
270
+ cacheTtl = aaaaTtl;
271
+ }
272
+
273
+ return {
274
+ entries: [
275
+ ...A,
276
+ ...AAAA
277
+ ],
278
+ cacheTtl
279
+ };
280
+ }
281
+
282
+ async _lookup(hostname) {
283
+ try {
284
+ const entries = await this._dnsLookup(hostname, {
285
+ all: true
286
+ });
287
+
288
+ return {
289
+ entries,
290
+ cacheTtl: 0
291
+ };
292
+ } catch (_) {
293
+ return {
294
+ entries: [],
295
+ cacheTtl: 0
296
+ };
297
+ }
298
+ }
299
+
300
+ async _set(hostname, data, cacheTtl) {
301
+ if (this.maxTtl > 0 && cacheTtl > 0) {
302
+ cacheTtl = Math.min(cacheTtl, this.maxTtl) * 1000;
303
+ data[kExpires] = Date.now() + cacheTtl;
304
+
305
+ try {
306
+ await this._cache.set(hostname, data, cacheTtl);
307
+ } catch (error) {
308
+ this.lookupAsync = async () => {
309
+ const cacheError = new Error('Cache Error. Please recreate the CacheableLookup instance.');
310
+ cacheError.cause = error;
311
+
312
+ throw cacheError;
313
+ };
314
+ }
315
+
316
+ if (isIterable(this._cache)) {
317
+ this._tick(cacheTtl);
318
+ }
319
+ }
320
+ }
321
+
322
+ async queryAndCache(hostname) {
323
+ if (this._hostnamesToFallback.has(hostname)) {
324
+ return this._dnsLookup(hostname, all);
325
+ }
326
+
327
+ let query = await this._resolve(hostname);
328
+
329
+ if (query.entries.length === 0 && this._fallback) {
330
+ query = await this._lookup(hostname);
331
+
332
+ if (query.entries.length !== 0) {
333
+ // Use `dns.lookup(...)` for that particular hostname
334
+ this._hostnamesToFallback.add(hostname);
335
+ }
336
+ }
337
+
338
+ const cacheTtl = query.entries.length === 0 ? this.errorTtl : query.cacheTtl;
339
+ await this._set(hostname, query.entries, cacheTtl);
340
+
341
+ return query.entries;
342
+ }
343
+
344
+ _tick(ms) {
345
+ const nextRemovalTime = this._nextRemovalTime;
346
+
347
+ if (!nextRemovalTime || ms < nextRemovalTime) {
348
+ clearTimeout(this._removalTimeout);
349
+
350
+ this._nextRemovalTime = ms;
351
+
352
+ this._removalTimeout = setTimeout(() => {
353
+ this._nextRemovalTime = false;
354
+
355
+ let nextExpiry = Infinity;
356
+
357
+ const now = Date.now();
358
+
359
+ for (const [hostname, entries] of this._cache) {
360
+ const expires = entries[kExpires];
361
+
362
+ if (now >= expires) {
363
+ this._cache.delete(hostname);
364
+ } else if (expires < nextExpiry) {
365
+ nextExpiry = expires;
366
+ }
367
+ }
368
+
369
+ if (nextExpiry !== Infinity) {
370
+ this._tick(nextExpiry - now);
371
+ }
372
+ }, ms);
373
+
374
+ /* istanbul ignore next: There is no `timeout.unref()` when running inside an Electron renderer */
375
+ if (this._removalTimeout.unref) {
376
+ this._removalTimeout.unref();
377
+ }
378
+ }
379
+ }
380
+
381
+ install(agent) {
382
+ verifyAgent(agent);
383
+
384
+ if (kCacheableLookupCreateConnection in agent) {
385
+ throw new Error('CacheableLookup has been already installed');
386
+ }
387
+
388
+ agent[kCacheableLookupCreateConnection] = agent.createConnection;
389
+ agent[kCacheableLookupInstance] = this;
390
+
391
+ agent.createConnection = (options, callback) => {
392
+ if (!('lookup' in options)) {
393
+ options.lookup = this.lookup;
394
+ }
395
+
396
+ return agent[kCacheableLookupCreateConnection](options, callback);
397
+ };
398
+ }
399
+
400
+ uninstall(agent) {
401
+ verifyAgent(agent);
402
+
403
+ if (agent[kCacheableLookupCreateConnection]) {
404
+ if (agent[kCacheableLookupInstance] !== this) {
405
+ throw new Error('The agent is not owned by this CacheableLookup instance');
406
+ }
407
+
408
+ agent.createConnection = agent[kCacheableLookupCreateConnection];
409
+
410
+ delete agent[kCacheableLookupCreateConnection];
411
+ delete agent[kCacheableLookupInstance];
412
+ }
413
+ }
414
+
415
+ updateInterfaceInfo() {
416
+ const {_iface} = this;
417
+
418
+ this._iface = getIfaceInfo();
419
+
420
+ if ((_iface.has4 && !this._iface.has4) || (_iface.has6 && !this._iface.has6)) {
421
+ this._cache.clear();
422
+ }
423
+ }
424
+
425
+ clear(hostname) {
426
+ if (hostname) {
427
+ this._cache.delete(hostname);
428
+ return;
429
+ }
430
+
431
+ this._cache.clear();
432
+ }
433
+ }
434
+
435
+ module.exports = CacheableLookup;
436
+ module.exports.default = CacheableLookup;
@@ -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,206 @@
1
+ # cacheable-request
2
+
3
+ > Wrap native HTTP requests with RFC compliant cache support
4
+
5
+ [![Build Status](https://travis-ci.org/lukechilds/cacheable-request.svg?branch=master)](https://travis-ci.org/lukechilds/cacheable-request)
6
+ [![Coverage Status](https://coveralls.io/repos/github/lukechilds/cacheable-request/badge.svg?branch=master)](https://coveralls.io/github/lukechilds/cacheable-request?branch=master)
7
+ [![npm](https://img.shields.io/npm/dm/cacheable-request.svg)](https://www.npmjs.com/package/cacheable-request)
8
+ [![npm](https://img.shields.io/npm/v/cacheable-request.svg)](https://www.npmjs.com/package/cacheable-request)
9
+
10
+ [RFC 7234](http://httpwg.org/specs/rfc7234.html) compliant HTTP caching for native Node.js HTTP/HTTPS requests. Caching works out of the box in memory or is easily pluggable with a wide range of storage adapters.
11
+
12
+ **Note:** This is a low level wrapper around the core HTTP modules, it's not a high level request library.
13
+
14
+ ## Features
15
+
16
+ - Only stores cacheable responses as defined by RFC 7234
17
+ - Fresh cache entries are served directly from cache
18
+ - Stale cache entries are revalidated with `If-None-Match`/`If-Modified-Since` headers
19
+ - 304 responses from revalidation requests use cached body
20
+ - Updates `Age` header on cached responses
21
+ - Can completely bypass cache on a per request basis
22
+ - In memory cache by default
23
+ - Official support for Redis, MongoDB, SQLite, PostgreSQL and MySQL storage adapters
24
+ - Easily plug in your own or third-party storage adapters
25
+ - If DB connection fails, cache is automatically bypassed ([disabled by default](#optsautomaticfailover))
26
+ - Adds cache support to any existing HTTP code with minimal changes
27
+ - Uses [http-cache-semantics](https://github.com/pornel/http-cache-semantics) internally for HTTP RFC 7234 compliance
28
+
29
+ ## Install
30
+
31
+ ```shell
32
+ npm install cacheable-request
33
+ ```
34
+
35
+ ## Usage
36
+
37
+ ```js
38
+ const http = require('http');
39
+ const CacheableRequest = require('cacheable-request');
40
+
41
+ // Then instead of
42
+ const req = http.request('http://example.com', cb);
43
+ req.end();
44
+
45
+ // You can do
46
+ const cacheableRequest = new CacheableRequest(http.request);
47
+ const cacheReq = cacheableRequest('http://example.com', cb);
48
+ cacheReq.on('request', req => req.end());
49
+ // Future requests to 'example.com' will be returned from cache if still valid
50
+
51
+ // You pass in any other http.request API compatible method to be wrapped with cache support:
52
+ const cacheableRequest = new CacheableRequest(https.request);
53
+ const cacheableRequest = new CacheableRequest(electron.net);
54
+ ```
55
+
56
+ ## Storage Adapters
57
+
58
+ `cacheable-request` uses [Keyv](https://github.com/lukechilds/keyv) to support a wide range of storage adapters.
59
+
60
+ For example, to use Redis as a cache backend, you just need to install the official Redis Keyv storage adapter:
61
+
62
+ ```
63
+ npm install @keyv/redis
64
+ ```
65
+
66
+ And then you can pass `CacheableRequest` your connection string:
67
+
68
+ ```js
69
+ const cacheableRequest = new CacheableRequest(http.request, 'redis://user:pass@localhost:6379');
70
+ ```
71
+
72
+ [View all official Keyv storage adapters.](https://github.com/lukechilds/keyv#official-storage-adapters)
73
+
74
+ Keyv also supports anything that follows the Map API so it's easy to write your own storage adapter or use a third-party solution.
75
+
76
+ e.g The following are all valid storage adapters
77
+
78
+ ```js
79
+ const storageAdapter = new Map();
80
+ // or
81
+ const storageAdapter = require('./my-storage-adapter');
82
+ // or
83
+ const QuickLRU = require('quick-lru');
84
+ const storageAdapter = new QuickLRU({ maxSize: 1000 });
85
+
86
+ const cacheableRequest = new CacheableRequest(http.request, storageAdapter);
87
+ ```
88
+
89
+ View the [Keyv docs](https://github.com/lukechilds/keyv) for more information on how to use storage adapters.
90
+
91
+ ## API
92
+
93
+ ### new cacheableRequest(request, [storageAdapter])
94
+
95
+ Returns the provided request function wrapped with cache support.
96
+
97
+ #### request
98
+
99
+ Type: `function`
100
+
101
+ Request function to wrap with cache support. Should be [`http.request`](https://nodejs.org/api/http.html#http_http_request_options_callback) or a similar API compatible request function.
102
+
103
+ #### storageAdapter
104
+
105
+ Type: `Keyv storage adapter`<br>
106
+ Default: `new Map()`
107
+
108
+ A [Keyv](https://github.com/lukechilds/keyv) storage adapter instance, or connection string if using with an official Keyv storage adapter.
109
+
110
+ ### Instance
111
+
112
+ #### cacheableRequest(opts, [cb])
113
+
114
+ Returns an event emitter.
115
+
116
+ ##### opts
117
+
118
+ Type: `object`, `string`
119
+
120
+ - Any of the default request functions options.
121
+ - Any [`http-cache-semantics`](https://github.com/kornelski/http-cache-semantics#constructor-options) options.
122
+ - Any of the following:
123
+
124
+ ###### opts.cache
125
+
126
+ Type: `boolean`<br>
127
+ Default: `true`
128
+
129
+ If the cache should be used. Setting this to false will completely bypass the cache for the current request.
130
+
131
+ ###### opts.strictTtl
132
+
133
+ Type: `boolean`<br>
134
+ Default: `false`
135
+
136
+ If set to `true` once a cached resource has expired it is deleted and will have to be re-requested.
137
+
138
+ If set to `false` (default), after a cached resource's TTL expires it is kept in the cache and will be revalidated on the next request with `If-None-Match`/`If-Modified-Since` headers.
139
+
140
+ ###### opts.maxTtl
141
+
142
+ Type: `number`<br>
143
+ Default: `undefined`
144
+
145
+ Limits TTL. The `number` represents milliseconds.
146
+
147
+ ###### opts.automaticFailover
148
+
149
+ Type: `boolean`<br>
150
+ Default: `false`
151
+
152
+ When set to `true`, if the DB connection fails we will automatically fallback to a network request. DB errors will still be emitted to notify you of the problem even though the request callback may succeed.
153
+
154
+ ###### opts.forceRefresh
155
+
156
+ Type: `boolean`<br>
157
+ Default: `false`
158
+
159
+ Forces refreshing the cache. If the response could be retrieved from the cache, it will perform a new request and override the cache instead.
160
+
161
+ ##### cb
162
+
163
+ Type: `function`
164
+
165
+ The callback function which will receive the response as an argument.
166
+
167
+ The response can be either a [Node.js HTTP response stream](https://nodejs.org/api/http.html#http_class_http_incomingmessage) or a [responselike object](https://github.com/lukechilds/responselike). The response will also have a `fromCache` property set with a boolean value.
168
+
169
+ ##### .on('request', request)
170
+
171
+ `request` event to get the request object of the request.
172
+
173
+ **Note:** This event will only fire if an HTTP request is actually made, not when a response is retrieved from cache. However, you should always handle the `request` event to end the request and handle any potential request errors.
174
+
175
+ ##### .on('response', response)
176
+
177
+ `response` event to get the response object from the HTTP request or cache.
178
+
179
+ ##### .on('error', error)
180
+
181
+ `error` event emitted in case of an error with the cache.
182
+
183
+ Errors emitted here will be an instance of `CacheableRequest.RequestError` or `CacheableRequest.CacheError`. You will only ever receive a `RequestError` if the request function throws (normally caused by invalid user input). Normal request errors should be handled inside the `request` event.
184
+
185
+ To properly handle all error scenarios you should use the following pattern:
186
+
187
+ ```js
188
+ cacheableRequest('example.com', cb)
189
+ .on('error', err => {
190
+ if (err instanceof CacheableRequest.CacheError) {
191
+ handleCacheError(err); // Cache error
192
+ } else if (err instanceof CacheableRequest.RequestError) {
193
+ handleRequestError(err); // Request function thrown
194
+ }
195
+ })
196
+ .on('request', req => {
197
+ req.on('error', handleRequestError); // Request error emitted
198
+ req.end();
199
+ });
200
+ ```
201
+
202
+ **Note:** Database connection errors are emitted here, however `cacheable-request` will attempt to re-request the resource and bypass the cache on a connection error. Therefore a database connection error doesn't necessarily mean the request won't be fulfilled.
203
+
204
+ ## License
205
+
206
+ MIT © Luke Childs
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "cacheable-request",
3
+ "version": "7.0.2",
4
+ "description": "Wrap native HTTP requests with RFC compliant cache support",
5
+ "license": "MIT",
6
+ "repository": "lukechilds/cacheable-request",
7
+ "author": "Luke Childs <lukechilds123@gmail.com> (http://lukechilds.co.uk)",
8
+ "main": "src/index.js",
9
+ "engines": {
10
+ "node": ">=8"
11
+ },
12
+ "scripts": {
13
+ "test": "xo && nyc ava",
14
+ "coverage": "nyc report --reporter=text-lcov | coveralls"
15
+ },
16
+ "files": [
17
+ "src"
18
+ ],
19
+ "keywords": [
20
+ "HTTP",
21
+ "HTTPS",
22
+ "cache",
23
+ "caching",
24
+ "layer",
25
+ "cacheable",
26
+ "RFC 7234",
27
+ "RFC",
28
+ "7234",
29
+ "compliant"
30
+ ],
31
+ "dependencies": {
32
+ "clone-response": "^1.0.2",
33
+ "get-stream": "^5.1.0",
34
+ "http-cache-semantics": "^4.0.0",
35
+ "keyv": "^4.0.0",
36
+ "lowercase-keys": "^2.0.0",
37
+ "normalize-url": "^6.0.1",
38
+ "responselike": "^2.0.0"
39
+ },
40
+ "devDependencies": {
41
+ "@keyv/sqlite": "^2.0.0",
42
+ "ava": "^1.1.0",
43
+ "coveralls": "^3.0.0",
44
+ "create-test-server": "3.0.0",
45
+ "delay": "^4.0.0",
46
+ "eslint-config-xo-lukechilds": "^1.0.0",
47
+ "nyc": "^14.1.1",
48
+ "pify": "^4.0.0",
49
+ "sqlite3": "^4.0.2",
50
+ "this": "^1.0.2",
51
+ "xo": "^0.23.0"
52
+ },
53
+ "xo": {
54
+ "extends": "xo-lukechilds"
55
+ }
56
+ }