game_dig 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (719) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +0 -4
  3. data/CHANGELOG.md +13 -0
  4. data/README.md +88 -28
  5. data/Rakefile +3 -3
  6. data/cli/pry_nodo.rb +5 -0
  7. data/game_dig.gemspec +21 -14
  8. data/lib/custom_errors/cli_not_found.rb +4 -0
  9. data/lib/custom_errors/error.rb +4 -0
  10. data/lib/game_dig/helper.rb +51 -0
  11. data/lib/game_dig/node/gamedig-example.js +17 -0
  12. data/lib/game_dig/node/node_modules/.bin/fxparser +1 -0
  13. data/lib/game_dig/node/node_modules/.bin/gamedig +1 -0
  14. data/lib/game_dig/node/node_modules/.bin/seek-bunzip +1 -0
  15. data/lib/game_dig/node/node_modules/.bin/seek-table +1 -0
  16. data/lib/game_dig/node/node_modules/.yarn-integrity +73 -0
  17. data/lib/game_dig/node/node_modules/@sindresorhus/is/dist/index.d.ts +246 -0
  18. data/lib/game_dig/node/node_modules/@sindresorhus/is/dist/index.js +454 -0
  19. data/lib/game_dig/node/node_modules/@sindresorhus/is/dist/types.d.ts +32 -0
  20. data/lib/game_dig/node/node_modules/@sindresorhus/is/dist/types.js +2 -0
  21. data/lib/game_dig/node/node_modules/@sindresorhus/is/license +9 -0
  22. data/lib/game_dig/node/node_modules/@sindresorhus/is/package.json +76 -0
  23. data/lib/game_dig/node/node_modules/@sindresorhus/is/readme.md +698 -0
  24. data/lib/game_dig/node/node_modules/@szmarczak/http-timer/LICENSE +21 -0
  25. data/lib/game_dig/node/node_modules/@szmarczak/http-timer/README.md +93 -0
  26. data/lib/game_dig/node/node_modules/@szmarczak/http-timer/dist/source/index.d.ts +32 -0
  27. data/lib/game_dig/node/node_modules/@szmarczak/http-timer/dist/source/index.js +106 -0
  28. data/lib/game_dig/node/node_modules/@szmarczak/http-timer/package.json +89 -0
  29. data/lib/game_dig/node/node_modules/@types/http-cache-semantics/LICENSE +21 -0
  30. data/lib/game_dig/node/node_modules/@types/http-cache-semantics/README.md +15 -0
  31. data/lib/game_dig/node/node_modules/@types/http-cache-semantics/index.d.ts +165 -0
  32. data/lib/game_dig/node/node_modules/@types/http-cache-semantics/package.json +25 -0
  33. data/lib/game_dig/node/node_modules/any-promise/.jshintrc +4 -0
  34. data/lib/game_dig/node/node_modules/any-promise/.npmignore +7 -0
  35. data/lib/game_dig/node/node_modules/any-promise/LICENSE +19 -0
  36. data/lib/game_dig/node/node_modules/any-promise/README.md +161 -0
  37. data/lib/game_dig/node/node_modules/any-promise/implementation.d.ts +3 -0
  38. data/lib/game_dig/node/node_modules/any-promise/implementation.js +1 -0
  39. data/lib/game_dig/node/node_modules/any-promise/index.d.ts +73 -0
  40. data/lib/game_dig/node/node_modules/any-promise/index.js +1 -0
  41. data/lib/game_dig/node/node_modules/any-promise/loader.js +78 -0
  42. data/lib/game_dig/node/node_modules/any-promise/optional.js +6 -0
  43. data/lib/game_dig/node/node_modules/any-promise/package.json +45 -0
  44. data/lib/game_dig/node/node_modules/any-promise/register/bluebird.d.ts +1 -0
  45. data/lib/game_dig/node/node_modules/any-promise/register/bluebird.js +2 -0
  46. data/lib/game_dig/node/node_modules/any-promise/register/es6-promise.d.ts +1 -0
  47. data/lib/game_dig/node/node_modules/any-promise/register/es6-promise.js +2 -0
  48. data/lib/game_dig/node/node_modules/any-promise/register/lie.d.ts +1 -0
  49. data/lib/game_dig/node/node_modules/any-promise/register/lie.js +2 -0
  50. data/lib/game_dig/node/node_modules/any-promise/register/native-promise-only.d.ts +1 -0
  51. data/lib/game_dig/node/node_modules/any-promise/register/native-promise-only.js +2 -0
  52. data/lib/game_dig/node/node_modules/any-promise/register/pinkie.d.ts +1 -0
  53. data/lib/game_dig/node/node_modules/any-promise/register/pinkie.js +2 -0
  54. data/lib/game_dig/node/node_modules/any-promise/register/promise.d.ts +1 -0
  55. data/lib/game_dig/node/node_modules/any-promise/register/promise.js +2 -0
  56. data/lib/game_dig/node/node_modules/any-promise/register/q.d.ts +1 -0
  57. data/lib/game_dig/node/node_modules/any-promise/register/q.js +2 -0
  58. data/lib/game_dig/node/node_modules/any-promise/register/rsvp.d.ts +1 -0
  59. data/lib/game_dig/node/node_modules/any-promise/register/rsvp.js +2 -0
  60. data/lib/game_dig/node/node_modules/any-promise/register/vow.d.ts +1 -0
  61. data/lib/game_dig/node/node_modules/any-promise/register/vow.js +2 -0
  62. data/lib/game_dig/node/node_modules/any-promise/register/when.d.ts +1 -0
  63. data/lib/game_dig/node/node_modules/any-promise/register/when.js +2 -0
  64. data/lib/game_dig/node/node_modules/any-promise/register-shim.js +18 -0
  65. data/lib/game_dig/node/node_modules/any-promise/register.d.ts +17 -0
  66. data/lib/game_dig/node/node_modules/any-promise/register.js +94 -0
  67. data/lib/game_dig/node/node_modules/barse/.npmignore +2 -0
  68. data/lib/game_dig/node/node_modules/barse/.travis.yml +4 -0
  69. data/lib/game_dig/node/node_modules/barse/README.md +138 -0
  70. data/lib/game_dig/node/node_modules/barse/example/complete.js +34 -0
  71. data/lib/game_dig/node/node_modules/barse/example/next.js +21 -0
  72. data/lib/game_dig/node/node_modules/barse/index.js +282 -0
  73. data/lib/game_dig/node/node_modules/barse/node_modules/readable-stream/.npmignore +5 -0
  74. data/lib/game_dig/node/node_modules/barse/node_modules/readable-stream/LICENSE +18 -0
  75. data/lib/game_dig/node/node_modules/barse/node_modules/readable-stream/README.md +15 -0
  76. data/lib/game_dig/node/node_modules/barse/node_modules/readable-stream/duplex.js +1 -0
  77. data/lib/game_dig/node/node_modules/barse/node_modules/readable-stream/lib/_stream_duplex.js +89 -0
  78. data/lib/game_dig/node/node_modules/barse/node_modules/readable-stream/lib/_stream_passthrough.js +46 -0
  79. data/lib/game_dig/node/node_modules/barse/node_modules/readable-stream/lib/_stream_readable.js +982 -0
  80. data/lib/game_dig/node/node_modules/barse/node_modules/readable-stream/lib/_stream_transform.js +210 -0
  81. data/lib/game_dig/node/node_modules/barse/node_modules/readable-stream/lib/_stream_writable.js +386 -0
  82. data/lib/game_dig/node/node_modules/barse/node_modules/readable-stream/package.json +32 -0
  83. data/lib/game_dig/node/node_modules/barse/node_modules/readable-stream/passthrough.js +1 -0
  84. data/lib/game_dig/node/node_modules/barse/node_modules/readable-stream/readable.js +11 -0
  85. data/lib/game_dig/node/node_modules/barse/node_modules/readable-stream/transform.js +1 -0
  86. data/lib/game_dig/node/node_modules/barse/node_modules/readable-stream/writable.js +1 -0
  87. data/lib/game_dig/node/node_modules/barse/package.json +48 -0
  88. data/lib/game_dig/node/node_modules/barse/test/integration.js +37 -0
  89. data/lib/game_dig/node/node_modules/barse/test/loop.js +36 -0
  90. data/lib/game_dig/node/node_modules/barse/test/next.js +34 -0
  91. data/lib/game_dig/node/node_modules/barse/test/scope.js +18 -0
  92. data/lib/game_dig/node/node_modules/barse/test/string.js +33 -0
  93. data/lib/game_dig/node/node_modules/barse/test/vars.js +20 -0
  94. data/lib/game_dig/node/node_modules/cacheable-lookup/LICENSE +21 -0
  95. data/lib/game_dig/node/node_modules/cacheable-lookup/README.md +245 -0
  96. data/lib/game_dig/node/node_modules/cacheable-lookup/index.d.ts +144 -0
  97. data/lib/game_dig/node/node_modules/cacheable-lookup/package.json +61 -0
  98. data/lib/game_dig/node/node_modules/cacheable-lookup/source/index.js +452 -0
  99. data/lib/game_dig/node/node_modules/cacheable-request/README.md +335 -0
  100. data/lib/game_dig/node/node_modules/cacheable-request/dist/index.d.ts +17 -0
  101. data/lib/game_dig/node/node_modules/cacheable-request/dist/index.d.ts.map +1 -0
  102. data/lib/game_dig/node/node_modules/cacheable-request/dist/index.js +275 -0
  103. data/lib/game_dig/node/node_modules/cacheable-request/dist/index.js.map +1 -0
  104. data/lib/game_dig/node/node_modules/cacheable-request/dist/types.d.ts +106 -0
  105. data/lib/game_dig/node/node_modules/cacheable-request/dist/types.d.ts.map +1 -0
  106. data/lib/game_dig/node/node_modules/cacheable-request/dist/types.js +19 -0
  107. data/lib/game_dig/node/node_modules/cacheable-request/dist/types.js.map +1 -0
  108. data/lib/game_dig/node/node_modules/cacheable-request/node_modules/mimic-response/index.d.ts +29 -0
  109. data/lib/game_dig/node/node_modules/cacheable-request/node_modules/mimic-response/index.js +75 -0
  110. data/lib/game_dig/node/node_modules/cacheable-request/node_modules/mimic-response/license +9 -0
  111. data/lib/game_dig/node/node_modules/cacheable-request/node_modules/mimic-response/package.json +44 -0
  112. data/lib/game_dig/node/node_modules/cacheable-request/node_modules/mimic-response/readme.md +78 -0
  113. data/lib/game_dig/node/node_modules/cacheable-request/package.json +121 -0
  114. data/lib/game_dig/node/node_modules/commander/CHANGELOG.md +361 -0
  115. data/lib/game_dig/node/node_modules/commander/LICENSE +22 -0
  116. data/lib/game_dig/node/node_modules/commander/Readme.md +791 -0
  117. data/lib/game_dig/node/node_modules/commander/index.js +1881 -0
  118. data/lib/game_dig/node/node_modules/commander/package.json +51 -0
  119. data/lib/game_dig/node/node_modules/commander/typings/index.d.ts +410 -0
  120. data/lib/game_dig/node/node_modules/core-util-is/LICENSE +19 -0
  121. data/lib/game_dig/node/node_modules/core-util-is/README.md +3 -0
  122. data/lib/game_dig/node/node_modules/core-util-is/lib/util.js +107 -0
  123. data/lib/game_dig/node/node_modules/core-util-is/package.json +38 -0
  124. data/lib/game_dig/node/node_modules/decompress-response/index.d.ts +22 -0
  125. data/lib/game_dig/node/node_modules/decompress-response/index.js +58 -0
  126. data/lib/game_dig/node/node_modules/decompress-response/license +9 -0
  127. data/lib/game_dig/node/node_modules/decompress-response/package.json +56 -0
  128. data/lib/game_dig/node/node_modules/decompress-response/readme.md +48 -0
  129. data/lib/game_dig/node/node_modules/defer-to-connect/LICENSE +21 -0
  130. data/lib/game_dig/node/node_modules/defer-to-connect/README.md +38 -0
  131. data/lib/game_dig/node/node_modules/defer-to-connect/dist/source/index.d.ts +10 -0
  132. data/lib/game_dig/node/node_modules/defer-to-connect/dist/source/index.js +47 -0
  133. data/lib/game_dig/node/node_modules/defer-to-connect/package.json +71 -0
  134. data/lib/game_dig/node/node_modules/emitter-component/History.md +35 -0
  135. data/lib/game_dig/node/node_modules/emitter-component/Makefile +7 -0
  136. data/lib/game_dig/node/node_modules/emitter-component/Readme.md +70 -0
  137. data/lib/game_dig/node/node_modules/emitter-component/bower.json +21 -0
  138. data/lib/game_dig/node/node_modules/emitter-component/component.json +9 -0
  139. data/lib/game_dig/node/node_modules/emitter-component/index.js +164 -0
  140. data/lib/game_dig/node/node_modules/emitter-component/package.json +19 -0
  141. data/lib/game_dig/node/node_modules/emitter-component/test/emitter.js +195 -0
  142. data/lib/game_dig/node/node_modules/event-to-promise/LICENSE +14 -0
  143. data/lib/game_dig/node/node_modules/event-to-promise/README.md +180 -0
  144. data/lib/game_dig/node/node_modules/event-to-promise/index.js +106 -0
  145. data/lib/game_dig/node/node_modules/event-to-promise/package.json +35 -0
  146. data/lib/game_dig/node/node_modules/fast-xml-parser/CHANGELOG.md +671 -0
  147. data/lib/game_dig/node/node_modules/fast-xml-parser/LICENSE +21 -0
  148. data/lib/game_dig/node/node_modules/fast-xml-parser/README.md +223 -0
  149. data/lib/game_dig/node/node_modules/fast-xml-parser/lib/fxbuilder.min.js +2 -0
  150. data/lib/game_dig/node/node_modules/fast-xml-parser/lib/fxbuilder.min.js.map +1 -0
  151. data/lib/game_dig/node/node_modules/fast-xml-parser/lib/fxp.cjs +1 -0
  152. data/lib/game_dig/node/node_modules/fast-xml-parser/lib/fxp.d.cts +458 -0
  153. data/lib/game_dig/node/node_modules/fast-xml-parser/lib/fxp.min.js +2 -0
  154. data/lib/game_dig/node/node_modules/fast-xml-parser/lib/fxp.min.js.map +1 -0
  155. data/lib/game_dig/node/node_modules/fast-xml-parser/lib/fxparser.min.js +2 -0
  156. data/lib/game_dig/node/node_modules/fast-xml-parser/lib/fxparser.min.js.map +1 -0
  157. data/lib/game_dig/node/node_modules/fast-xml-parser/lib/fxvalidator.min.js +2 -0
  158. data/lib/game_dig/node/node_modules/fast-xml-parser/lib/fxvalidator.min.js.map +1 -0
  159. data/lib/game_dig/node/node_modules/fast-xml-parser/package.json +90 -0
  160. data/lib/game_dig/node/node_modules/fast-xml-parser/src/cli/cli.js +97 -0
  161. data/lib/game_dig/node/node_modules/fast-xml-parser/src/cli/man.js +17 -0
  162. data/lib/game_dig/node/node_modules/fast-xml-parser/src/cli/read.js +43 -0
  163. data/lib/game_dig/node/node_modules/fast-xml-parser/src/fxp.d.ts +445 -0
  164. data/lib/game_dig/node/node_modules/fast-xml-parser/src/fxp.js +14 -0
  165. data/lib/game_dig/node/node_modules/fast-xml-parser/src/ignoreAttributes.js +18 -0
  166. data/lib/game_dig/node/node_modules/fast-xml-parser/src/util.js +68 -0
  167. data/lib/game_dig/node/node_modules/fast-xml-parser/src/v6/CharsSymbol.js +16 -0
  168. data/lib/game_dig/node/node_modules/fast-xml-parser/src/v6/EntitiesParser.js +104 -0
  169. data/lib/game_dig/node/node_modules/fast-xml-parser/src/v6/OptionsBuilder.js +61 -0
  170. data/lib/game_dig/node/node_modules/fast-xml-parser/src/v6/OutputBuilders/BaseOutputBuilder.js +69 -0
  171. data/lib/game_dig/node/node_modules/fast-xml-parser/src/v6/OutputBuilders/JsArrBuilder.js +103 -0
  172. data/lib/game_dig/node/node_modules/fast-xml-parser/src/v6/OutputBuilders/JsMinArrBuilder.js +100 -0
  173. data/lib/game_dig/node/node_modules/fast-xml-parser/src/v6/OutputBuilders/JsObjBuilder.js +154 -0
  174. data/lib/game_dig/node/node_modules/fast-xml-parser/src/v6/OutputBuilders/ParserOptionsBuilder.js +94 -0
  175. data/lib/game_dig/node/node_modules/fast-xml-parser/src/v6/Report.js +0 -0
  176. data/lib/game_dig/node/node_modules/fast-xml-parser/src/v6/TagPath.js +81 -0
  177. data/lib/game_dig/node/node_modules/fast-xml-parser/src/v6/TagPathMatcher.js +13 -0
  178. data/lib/game_dig/node/node_modules/fast-xml-parser/src/v6/XMLParser.js +83 -0
  179. data/lib/game_dig/node/node_modules/fast-xml-parser/src/v6/Xml2JsParser.js +235 -0
  180. data/lib/game_dig/node/node_modules/fast-xml-parser/src/v6/XmlPartReader.js +210 -0
  181. data/lib/game_dig/node/node_modules/fast-xml-parser/src/v6/XmlSpecialTagsReader.js +111 -0
  182. data/lib/game_dig/node/node_modules/fast-xml-parser/src/v6/inputSource/BufferSource.js +116 -0
  183. data/lib/game_dig/node/node_modules/fast-xml-parser/src/v6/inputSource/StringSource.js +121 -0
  184. data/lib/game_dig/node/node_modules/fast-xml-parser/src/v6/valueParsers/EntitiesParser.js +105 -0
  185. data/lib/game_dig/node/node_modules/fast-xml-parser/src/v6/valueParsers/booleanParser.js +22 -0
  186. data/lib/game_dig/node/node_modules/fast-xml-parser/src/v6/valueParsers/booleanParserExt.js +19 -0
  187. data/lib/game_dig/node/node_modules/fast-xml-parser/src/v6/valueParsers/currency.js +38 -0
  188. data/lib/game_dig/node/node_modules/fast-xml-parser/src/v6/valueParsers/join.js +13 -0
  189. data/lib/game_dig/node/node_modules/fast-xml-parser/src/v6/valueParsers/number.js +14 -0
  190. data/lib/game_dig/node/node_modules/fast-xml-parser/src/v6/valueParsers/trim.js +6 -0
  191. data/lib/game_dig/node/node_modules/fast-xml-parser/src/validator.js +425 -0
  192. data/lib/game_dig/node/node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js +285 -0
  193. data/lib/game_dig/node/node_modules/fast-xml-parser/src/xmlbuilder/orderedJs2Xml.js +134 -0
  194. data/lib/game_dig/node/node_modules/fast-xml-parser/src/xmlbuilder/prettifyJs2Xml.js +0 -0
  195. data/lib/game_dig/node/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js +369 -0
  196. data/lib/game_dig/node/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js +46 -0
  197. data/lib/game_dig/node/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js +606 -0
  198. data/lib/game_dig/node/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js +71 -0
  199. data/lib/game_dig/node/node_modules/fast-xml-parser/src/xmlparser/node2json.js +119 -0
  200. data/lib/game_dig/node/node_modules/fast-xml-parser/src/xmlparser/xmlNode.js +40 -0
  201. data/lib/game_dig/node/node_modules/form-data-encoder/@type/FileLike.d.ts +23 -0
  202. data/lib/game_dig/node/node_modules/form-data-encoder/@type/FormDataEncoder.d.ts +169 -0
  203. data/lib/game_dig/node/node_modules/form-data-encoder/@type/FormDataLike.d.ts +40 -0
  204. data/lib/game_dig/node/node_modules/form-data-encoder/@type/index.d.ts +5 -0
  205. data/lib/game_dig/node/node_modules/form-data-encoder/@type/util/Headers.d.ts +8 -0
  206. data/lib/game_dig/node/node_modules/form-data-encoder/@type/util/createBoundary.d.ts +12 -0
  207. data/lib/game_dig/node/node_modules/form-data-encoder/@type/util/escapeName.d.ts +10 -0
  208. data/lib/game_dig/node/node_modules/form-data-encoder/@type/util/getStreamIterator.d.ts +6 -0
  209. data/lib/game_dig/node/node_modules/form-data-encoder/@type/util/isFile.d.ts +34 -0
  210. data/lib/game_dig/node/node_modules/form-data-encoder/@type/util/isFormData.d.ts +7 -0
  211. data/lib/game_dig/node/node_modules/form-data-encoder/@type/util/isFunction.d.ts +6 -0
  212. data/lib/game_dig/node/node_modules/form-data-encoder/@type/util/isPlainObject.d.ts +1 -0
  213. data/lib/game_dig/node/node_modules/form-data-encoder/@type/util/normalizeValue.d.ts +10 -0
  214. data/lib/game_dig/node/node_modules/form-data-encoder/@type/util/proxyHeaders.d.ts +2 -0
  215. data/lib/game_dig/node/node_modules/form-data-encoder/lib/FileLike.js +1 -0
  216. data/lib/game_dig/node/node_modules/form-data-encoder/lib/FormDataEncoder.js +134 -0
  217. data/lib/game_dig/node/node_modules/form-data-encoder/lib/FormDataLike.js +1 -0
  218. data/lib/game_dig/node/node_modules/form-data-encoder/lib/index.js +5 -0
  219. data/lib/game_dig/node/node_modules/form-data-encoder/lib/util/Headers.js +1 -0
  220. data/lib/game_dig/node/node_modules/form-data-encoder/lib/util/createBoundary.js +9 -0
  221. data/lib/game_dig/node/node_modules/form-data-encoder/lib/util/escapeName.js +4 -0
  222. data/lib/game_dig/node/node_modules/form-data-encoder/lib/util/getStreamIterator.js +21 -0
  223. data/lib/game_dig/node/node_modules/form-data-encoder/lib/util/isFile.js +8 -0
  224. data/lib/game_dig/node/node_modules/form-data-encoder/lib/util/isFormData.js +8 -0
  225. data/lib/game_dig/node/node_modules/form-data-encoder/lib/util/isFunction.js +1 -0
  226. data/lib/game_dig/node/node_modules/form-data-encoder/lib/util/isPlainObject.js +12 -0
  227. data/lib/game_dig/node/node_modules/form-data-encoder/lib/util/normalizeValue.js +8 -0
  228. data/lib/game_dig/node/node_modules/form-data-encoder/lib/util/proxyHeaders.js +14 -0
  229. data/lib/game_dig/node/node_modules/form-data-encoder/license +21 -0
  230. data/lib/game_dig/node/node_modules/form-data-encoder/package.json +70 -0
  231. data/lib/game_dig/node/node_modules/form-data-encoder/readme.md +368 -0
  232. data/lib/game_dig/node/node_modules/gamedig/GAMES_LIST.md +563 -0
  233. data/lib/game_dig/node/node_modules/gamedig/LICENSE +21 -0
  234. data/lib/game_dig/node/node_modules/gamedig/README.md +155 -0
  235. data/lib/game_dig/node/node_modules/gamedig/bin/gamedig.js +64 -0
  236. data/lib/game_dig/node/node_modules/gamedig/dist/index.cjs +18075 -0
  237. data/lib/game_dig/node/node_modules/gamedig/lib/DnsResolver.js +80 -0
  238. data/lib/game_dig/node/node_modules/gamedig/lib/GlobalUdpSocket.js +69 -0
  239. data/lib/game_dig/node/node_modules/gamedig/lib/HexUtil.js +20 -0
  240. data/lib/game_dig/node/node_modules/gamedig/lib/Logger.js +45 -0
  241. data/lib/game_dig/node/node_modules/gamedig/lib/Promises.js +18 -0
  242. data/lib/game_dig/node/node_modules/gamedig/lib/ProtocolResolver.js +7 -0
  243. data/lib/game_dig/node/node_modules/gamedig/lib/QueryRunner.js +122 -0
  244. data/lib/game_dig/node/node_modules/gamedig/lib/Results.js +36 -0
  245. data/lib/game_dig/node/node_modules/gamedig/lib/game-resolver.js +27 -0
  246. data/lib/game_dig/node/node_modules/gamedig/lib/gamedig.js +23 -0
  247. data/lib/game_dig/node/node_modules/gamedig/lib/games.js +3458 -0
  248. data/lib/game_dig/node/node_modules/gamedig/lib/index.js +5 -0
  249. data/lib/game_dig/node/node_modules/gamedig/lib/reader.js +172 -0
  250. data/lib/game_dig/node/node_modules/gamedig/node_modules/.bin/fxparser +1 -0
  251. data/lib/game_dig/node/node_modules/gamedig/node_modules/.bin/seek-bunzip +1 -0
  252. data/lib/game_dig/node/node_modules/gamedig/node_modules/.bin/seek-table +1 -0
  253. data/lib/game_dig/node/node_modules/gamedig/package.json +80 -0
  254. data/lib/game_dig/node/node_modules/gamedig/protocols/altvmp.js +63 -0
  255. data/lib/game_dig/node/node_modules/gamedig/protocols/armagetron.js +65 -0
  256. data/lib/game_dig/node/node_modules/gamedig/protocols/asa.js +18 -0
  257. data/lib/game_dig/node/node_modules/gamedig/protocols/ase.js +45 -0
  258. data/lib/game_dig/node/node_modules/gamedig/protocols/assettocorsa.js +41 -0
  259. data/lib/game_dig/node/node_modules/gamedig/protocols/battlefield.js +167 -0
  260. data/lib/game_dig/node/node_modules/gamedig/protocols/beammp.js +46 -0
  261. data/lib/game_dig/node/node_modules/gamedig/protocols/beammpmaster.js +17 -0
  262. data/lib/game_dig/node/node_modules/gamedig/protocols/brokeprotocol.js +13 -0
  263. data/lib/game_dig/node/node_modules/gamedig/protocols/brokeprotocolmaster.js +418 -0
  264. data/lib/game_dig/node/node_modules/gamedig/protocols/buildandshoot.js +42 -0
  265. data/lib/game_dig/node/node_modules/gamedig/protocols/core.js +369 -0
  266. data/lib/game_dig/node/node_modules/gamedig/protocols/cs2d.js +65 -0
  267. data/lib/game_dig/node/node_modules/gamedig/protocols/dayz.js +196 -0
  268. data/lib/game_dig/node/node_modules/gamedig/protocols/discord.js +29 -0
  269. data/lib/game_dig/node/node_modules/gamedig/protocols/doom3.js +149 -0
  270. data/lib/game_dig/node/node_modules/gamedig/protocols/eco.js +22 -0
  271. data/lib/game_dig/node/node_modules/gamedig/protocols/eldewrito.js +22 -0
  272. data/lib/game_dig/node/node_modules/gamedig/protocols/epic.js +153 -0
  273. data/lib/game_dig/node/node_modules/gamedig/protocols/factorio.js +24 -0
  274. data/lib/game_dig/node/node_modules/gamedig/protocols/farmingsimulator.js +69 -0
  275. data/lib/game_dig/node/node_modules/gamedig/protocols/ffow.js +38 -0
  276. data/lib/game_dig/node/node_modules/gamedig/protocols/fivem.js +35 -0
  277. data/lib/game_dig/node/node_modules/gamedig/protocols/gamespy1.js +182 -0
  278. data/lib/game_dig/node/node_modules/gamedig/protocols/gamespy2.js +142 -0
  279. data/lib/game_dig/node/node_modules/gamedig/protocols/gamespy3.js +198 -0
  280. data/lib/game_dig/node/node_modules/gamedig/protocols/geneshift.js +46 -0
  281. data/lib/game_dig/node/node_modules/gamedig/protocols/goldsrc.js +8 -0
  282. data/lib/game_dig/node/node_modules/gamedig/protocols/gtasao.js +8 -0
  283. data/lib/game_dig/node/node_modules/gamedig/protocols/hawakening.js +13 -0
  284. data/lib/game_dig/node/node_modules/gamedig/protocols/hawakeningmaster.js +718 -0
  285. data/lib/game_dig/node/node_modules/gamedig/protocols/hexen2.js +14 -0
  286. data/lib/game_dig/node/node_modules/gamedig/protocols/index.js +85 -0
  287. data/lib/game_dig/node/node_modules/gamedig/protocols/jc2mp.js +18 -0
  288. data/lib/game_dig/node/node_modules/gamedig/protocols/kspdmp.js +28 -0
  289. data/lib/game_dig/node/node_modules/gamedig/protocols/mafia2mp.js +42 -0
  290. data/lib/game_dig/node/node_modules/gamedig/protocols/mafia2online.js +9 -0
  291. data/lib/game_dig/node/node_modules/gamedig/protocols/minecraft.js +107 -0
  292. data/lib/game_dig/node/node_modules/gamedig/protocols/minecraftbedrock.js +73 -0
  293. data/lib/game_dig/node/node_modules/gamedig/protocols/minecraftvanilla.js +86 -0
  294. data/lib/game_dig/node/node_modules/gamedig/protocols/minetest.js +39 -0
  295. data/lib/game_dig/node/node_modules/gamedig/protocols/mumble.js +39 -0
  296. data/lib/game_dig/node/node_modules/gamedig/protocols/mumbleping.js +25 -0
  297. data/lib/game_dig/node/node_modules/gamedig/protocols/nadeo.js +85 -0
  298. data/lib/game_dig/node/node_modules/gamedig/protocols/openttd.js +164 -0
  299. data/lib/game_dig/node/node_modules/gamedig/protocols/palworld.js +32 -0
  300. data/lib/game_dig/node/node_modules/gamedig/protocols/quake1.js +14 -0
  301. data/lib/game_dig/node/node_modules/gamedig/protocols/quake2.js +90 -0
  302. data/lib/game_dig/node/node_modules/gamedig/protocols/quake3.js +28 -0
  303. data/lib/game_dig/node/node_modules/gamedig/protocols/ragemp.js +49 -0
  304. data/lib/game_dig/node/node_modules/gamedig/protocols/renegadex.js +232 -0
  305. data/lib/game_dig/node/node_modules/gamedig/protocols/renegadexmaster.js +21 -0
  306. data/lib/game_dig/node/node_modules/gamedig/protocols/renown.js +20 -0
  307. data/lib/game_dig/node/node_modules/gamedig/protocols/rfactor.js +69 -0
  308. data/lib/game_dig/node/node_modules/gamedig/protocols/samp.js +105 -0
  309. data/lib/game_dig/node/node_modules/gamedig/protocols/satisfactory.js +106 -0
  310. data/lib/game_dig/node/node_modules/gamedig/protocols/savage2.js +25 -0
  311. data/lib/game_dig/node/node_modules/gamedig/protocols/scpsl.js +54 -0
  312. data/lib/game_dig/node/node_modules/gamedig/protocols/sdtd.js +109 -0
  313. data/lib/game_dig/node/node_modules/gamedig/protocols/soldat.js +45 -0
  314. data/lib/game_dig/node/node_modules/gamedig/protocols/squad.js +20 -0
  315. data/lib/game_dig/node/node_modules/gamedig/protocols/starmade.js +67 -0
  316. data/lib/game_dig/node/node_modules/gamedig/protocols/starsiege.js +10 -0
  317. data/lib/game_dig/node/node_modules/gamedig/protocols/teamspeak2.js +72 -0
  318. data/lib/game_dig/node/node_modules/gamedig/protocols/teamspeak3.js +70 -0
  319. data/lib/game_dig/node/node_modules/gamedig/protocols/terraria.js +27 -0
  320. data/lib/game_dig/node/node_modules/gamedig/protocols/theisleevrima.js +19 -0
  321. data/lib/game_dig/node/node_modules/gamedig/protocols/toxikk.js +122 -0
  322. data/lib/game_dig/node/node_modules/gamedig/protocols/tribes1.js +153 -0
  323. data/lib/game_dig/node/node_modules/gamedig/protocols/tribes1master.js +80 -0
  324. data/lib/game_dig/node/node_modules/gamedig/protocols/unreal2.js +151 -0
  325. data/lib/game_dig/node/node_modules/gamedig/protocols/ut3.js +45 -0
  326. data/lib/game_dig/node/node_modules/gamedig/protocols/valve.js +472 -0
  327. data/lib/game_dig/node/node_modules/gamedig/protocols/vcmp.js +10 -0
  328. data/lib/game_dig/node/node_modules/gamedig/protocols/ventrilo.js +238 -0
  329. data/lib/game_dig/node/node_modules/gamedig/protocols/vintagestory.js +24 -0
  330. data/lib/game_dig/node/node_modules/gamedig/protocols/vintagestorymaster.js +17 -0
  331. data/lib/game_dig/node/node_modules/gamedig/protocols/warsow.js +13 -0
  332. data/lib/game_dig/node/node_modules/gamedig/protocols/xonotic.js +16 -0
  333. data/lib/game_dig/node/node_modules/gbxremote/.editorconfig +15 -0
  334. data/lib/game_dig/node/node_modules/gbxremote/.npmignore +5 -0
  335. data/lib/game_dig/node/node_modules/gbxremote/LICENSE +23 -0
  336. data/lib/game_dig/node/node_modules/gbxremote/README.md +196 -0
  337. data/lib/game_dig/node/node_modules/gbxremote/lib/client.js +214 -0
  338. data/lib/game_dig/node/node_modules/gbxremote/lib/gbxremote.js +18 -0
  339. data/lib/game_dig/node/node_modules/gbxremote/package.json +55 -0
  340. data/lib/game_dig/node/node_modules/get-stream/buffer-stream.js +52 -0
  341. data/lib/game_dig/node/node_modules/get-stream/index.d.ts +105 -0
  342. data/lib/game_dig/node/node_modules/get-stream/index.js +61 -0
  343. data/lib/game_dig/node/node_modules/get-stream/license +9 -0
  344. data/lib/game_dig/node/node_modules/get-stream/package.json +47 -0
  345. data/lib/game_dig/node/node_modules/get-stream/readme.md +124 -0
  346. data/lib/game_dig/node/node_modules/got/dist/source/as-promise/index.d.ts +3 -0
  347. data/lib/game_dig/node/node_modules/got/dist/source/as-promise/index.js +158 -0
  348. data/lib/game_dig/node/node_modules/got/dist/source/as-promise/types.d.ts +38 -0
  349. data/lib/game_dig/node/node_modules/got/dist/source/as-promise/types.js +17 -0
  350. data/lib/game_dig/node/node_modules/got/dist/source/core/calculate-retry-delay.d.ts +4 -0
  351. data/lib/game_dig/node/node_modules/got/dist/source/core/calculate-retry-delay.js +29 -0
  352. data/lib/game_dig/node/node_modules/got/dist/source/core/errors.d.ts +90 -0
  353. data/lib/game_dig/node/node_modules/got/dist/source/core/errors.js +178 -0
  354. data/lib/game_dig/node/node_modules/got/dist/source/core/index.d.ts +190 -0
  355. data/lib/game_dig/node/node_modules/got/dist/source/core/index.js +1126 -0
  356. data/lib/game_dig/node/node_modules/got/dist/source/core/options.d.ts +1253 -0
  357. data/lib/game_dig/node/node_modules/got/dist/source/core/options.js +1653 -0
  358. data/lib/game_dig/node/node_modules/got/dist/source/core/parse-link-header.d.ts +4 -0
  359. data/lib/game_dig/node/node_modules/got/dist/source/core/parse-link-header.js +33 -0
  360. data/lib/game_dig/node/node_modules/got/dist/source/core/response.d.ts +109 -0
  361. data/lib/game_dig/node/node_modules/got/dist/source/core/response.js +39 -0
  362. data/lib/game_dig/node/node_modules/got/dist/source/core/timed-out.d.ts +30 -0
  363. data/lib/game_dig/node/node_modules/got/dist/source/core/timed-out.js +138 -0
  364. data/lib/game_dig/node/node_modules/got/dist/source/core/utils/get-body-size.d.ts +3 -0
  365. data/lib/game_dig/node/node_modules/got/dist/source/core/utils/get-body-size.js +22 -0
  366. data/lib/game_dig/node/node_modules/got/dist/source/core/utils/is-client-request.d.ts +5 -0
  367. data/lib/game_dig/node/node_modules/got/dist/source/core/utils/is-client-request.js +4 -0
  368. data/lib/game_dig/node/node_modules/got/dist/source/core/utils/is-form-data.d.ts +8 -0
  369. data/lib/game_dig/node/node_modules/got/dist/source/core/utils/is-form-data.js +4 -0
  370. data/lib/game_dig/node/node_modules/got/dist/source/core/utils/is-unix-socket-url.d.ts +2 -0
  371. data/lib/game_dig/node/node_modules/got/dist/source/core/utils/is-unix-socket-url.js +4 -0
  372. data/lib/game_dig/node/node_modules/got/dist/source/core/utils/options-to-url.d.ts +13 -0
  373. data/lib/game_dig/node/node_modules/got/dist/source/core/utils/options-to-url.js +48 -0
  374. data/lib/game_dig/node/node_modules/got/dist/source/core/utils/proxy-events.d.ts +3 -0
  375. data/lib/game_dig/node/node_modules/got/dist/source/core/utils/proxy-events.js +15 -0
  376. data/lib/game_dig/node/node_modules/got/dist/source/core/utils/unhandle.d.ts +11 -0
  377. data/lib/game_dig/node/node_modules/got/dist/source/core/utils/unhandle.js +20 -0
  378. data/lib/game_dig/node/node_modules/got/dist/source/core/utils/url-to-options.d.ts +15 -0
  379. data/lib/game_dig/node/node_modules/got/dist/source/core/utils/url-to-options.js +22 -0
  380. data/lib/game_dig/node/node_modules/got/dist/source/core/utils/weakable-map.d.ts +8 -0
  381. data/lib/game_dig/node/node_modules/got/dist/source/core/utils/weakable-map.js +38 -0
  382. data/lib/game_dig/node/node_modules/got/dist/source/create.d.ts +3 -0
  383. data/lib/game_dig/node/node_modules/got/dist/source/create.js +187 -0
  384. data/lib/game_dig/node/node_modules/got/dist/source/index.d.ts +15 -0
  385. data/lib/game_dig/node/node_modules/got/dist/source/index.js +20 -0
  386. data/lib/game_dig/node/node_modules/got/dist/source/types.d.ts +262 -0
  387. data/lib/game_dig/node/node_modules/got/dist/source/types.js +1 -0
  388. data/lib/game_dig/node/node_modules/got/license +9 -0
  389. data/lib/game_dig/node/node_modules/got/package.json +155 -0
  390. data/lib/game_dig/node/node_modules/got/readme.md +527 -0
  391. data/lib/game_dig/node/node_modules/http-cache-semantics/LICENSE +9 -0
  392. data/lib/game_dig/node/node_modules/http-cache-semantics/README.md +268 -0
  393. data/lib/game_dig/node/node_modules/http-cache-semantics/index.js +928 -0
  394. data/lib/game_dig/node/node_modules/http-cache-semantics/package.json +22 -0
  395. data/lib/game_dig/node/node_modules/http2-wrapper/LICENSE +21 -0
  396. data/lib/game_dig/node/node_modules/http2-wrapper/README.md +459 -0
  397. data/lib/game_dig/node/node_modules/http2-wrapper/index.d.ts +141 -0
  398. data/lib/game_dig/node/node_modules/http2-wrapper/package.json +81 -0
  399. data/lib/game_dig/node/node_modules/http2-wrapper/source/agent.js +796 -0
  400. data/lib/game_dig/node/node_modules/http2-wrapper/source/auto.js +225 -0
  401. data/lib/game_dig/node/node_modules/http2-wrapper/source/client-request.js +563 -0
  402. data/lib/game_dig/node/node_modules/http2-wrapper/source/incoming-message.js +73 -0
  403. data/lib/game_dig/node/node_modules/http2-wrapper/source/index.js +50 -0
  404. data/lib/game_dig/node/node_modules/http2-wrapper/source/proxies/get-auth-headers.js +17 -0
  405. data/lib/game_dig/node/node_modules/http2-wrapper/source/proxies/h1-over-h2.js +90 -0
  406. data/lib/game_dig/node/node_modules/http2-wrapper/source/proxies/h2-over-h1.js +48 -0
  407. data/lib/game_dig/node/node_modules/http2-wrapper/source/proxies/h2-over-h2.js +32 -0
  408. data/lib/game_dig/node/node_modules/http2-wrapper/source/proxies/h2-over-hx.js +40 -0
  409. data/lib/game_dig/node/node_modules/http2-wrapper/source/proxies/initialize.js +21 -0
  410. data/lib/game_dig/node/node_modules/http2-wrapper/source/proxies/unexpected-status-code-error.js +11 -0
  411. data/lib/game_dig/node/node_modules/http2-wrapper/source/utils/calculate-server-name.js +29 -0
  412. data/lib/game_dig/node/node_modules/http2-wrapper/source/utils/check-type.js +20 -0
  413. data/lib/game_dig/node/node_modules/http2-wrapper/source/utils/delay-async-destroy.js +33 -0
  414. data/lib/game_dig/node/node_modules/http2-wrapper/source/utils/errors.js +51 -0
  415. data/lib/game_dig/node/node_modules/http2-wrapper/source/utils/is-request-pseudo-header.js +13 -0
  416. data/lib/game_dig/node/node_modules/http2-wrapper/source/utils/js-stream-socket.js +8 -0
  417. data/lib/game_dig/node/node_modules/http2-wrapper/source/utils/proxy-events.js +7 -0
  418. data/lib/game_dig/node/node_modules/http2-wrapper/source/utils/proxy-socket-handler.js +102 -0
  419. data/lib/game_dig/node/node_modules/http2-wrapper/source/utils/validate-header-name.js +11 -0
  420. data/lib/game_dig/node/node_modules/http2-wrapper/source/utils/validate-header-value.js +17 -0
  421. data/lib/game_dig/node/node_modules/iconv-lite/Changelog.md +236 -0
  422. data/lib/game_dig/node/node_modules/iconv-lite/LICENSE +21 -0
  423. data/lib/game_dig/node/node_modules/iconv-lite/README.md +138 -0
  424. data/lib/game_dig/node/node_modules/iconv-lite/encodings/dbcs-codec.js +532 -0
  425. data/lib/game_dig/node/node_modules/iconv-lite/encodings/dbcs-data.js +185 -0
  426. data/lib/game_dig/node/node_modules/iconv-lite/encodings/index.js +23 -0
  427. data/lib/game_dig/node/node_modules/iconv-lite/encodings/internal.js +218 -0
  428. data/lib/game_dig/node/node_modules/iconv-lite/encodings/sbcs-codec.js +75 -0
  429. data/lib/game_dig/node/node_modules/iconv-lite/encodings/sbcs-data-generated.js +451 -0
  430. data/lib/game_dig/node/node_modules/iconv-lite/encodings/sbcs-data.js +178 -0
  431. data/lib/game_dig/node/node_modules/iconv-lite/encodings/tables/big5-added.json +122 -0
  432. data/lib/game_dig/node/node_modules/iconv-lite/encodings/tables/cp936.json +264 -0
  433. data/lib/game_dig/node/node_modules/iconv-lite/encodings/tables/cp949.json +273 -0
  434. data/lib/game_dig/node/node_modules/iconv-lite/encodings/tables/cp950.json +177 -0
  435. data/lib/game_dig/node/node_modules/iconv-lite/encodings/tables/eucjp.json +182 -0
  436. data/lib/game_dig/node/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +1 -0
  437. data/lib/game_dig/node/node_modules/iconv-lite/encodings/tables/gbk-added.json +56 -0
  438. data/lib/game_dig/node/node_modules/iconv-lite/encodings/tables/shiftjis.json +125 -0
  439. data/lib/game_dig/node/node_modules/iconv-lite/encodings/utf16.js +187 -0
  440. data/lib/game_dig/node/node_modules/iconv-lite/encodings/utf32.js +307 -0
  441. data/lib/game_dig/node/node_modules/iconv-lite/encodings/utf7.js +283 -0
  442. data/lib/game_dig/node/node_modules/iconv-lite/lib/bom-handling.js +48 -0
  443. data/lib/game_dig/node/node_modules/iconv-lite/lib/helpers/merge-exports.js +13 -0
  444. data/lib/game_dig/node/node_modules/iconv-lite/lib/index.d.ts +41 -0
  445. data/lib/game_dig/node/node_modules/iconv-lite/lib/index.js +183 -0
  446. data/lib/game_dig/node/node_modules/iconv-lite/lib/streams.js +105 -0
  447. data/lib/game_dig/node/node_modules/iconv-lite/package.json +59 -0
  448. data/lib/game_dig/node/node_modules/inherits/LICENSE +16 -0
  449. data/lib/game_dig/node/node_modules/inherits/README.md +42 -0
  450. data/lib/game_dig/node/node_modules/inherits/inherits.js +9 -0
  451. data/lib/game_dig/node/node_modules/inherits/inherits_browser.js +27 -0
  452. data/lib/game_dig/node/node_modules/inherits/package.json +29 -0
  453. data/lib/game_dig/node/node_modules/isarray/README.md +54 -0
  454. data/lib/game_dig/node/node_modules/isarray/build/build.js +209 -0
  455. data/lib/game_dig/node/node_modules/isarray/component.json +19 -0
  456. data/lib/game_dig/node/node_modules/isarray/index.js +3 -0
  457. data/lib/game_dig/node/node_modules/isarray/package.json +25 -0
  458. data/lib/game_dig/node/node_modules/json-buffer/.travis.yml +3 -0
  459. data/lib/game_dig/node/node_modules/json-buffer/LICENSE +22 -0
  460. data/lib/game_dig/node/node_modules/json-buffer/README.md +24 -0
  461. data/lib/game_dig/node/node_modules/json-buffer/index.js +58 -0
  462. data/lib/game_dig/node/node_modules/json-buffer/package.json +34 -0
  463. data/lib/game_dig/node/node_modules/json-buffer/test/index.js +63 -0
  464. data/lib/game_dig/node/node_modules/keyv/README.md +429 -0
  465. data/lib/game_dig/node/node_modules/keyv/package.json +57 -0
  466. data/lib/game_dig/node/node_modules/keyv/src/index.d.ts +112 -0
  467. data/lib/game_dig/node/node_modules/keyv/src/index.js +259 -0
  468. data/lib/game_dig/node/node_modules/long/LICENSE +202 -0
  469. data/lib/game_dig/node/node_modules/long/README.md +286 -0
  470. data/lib/game_dig/node/node_modules/long/index.d.ts +2 -0
  471. data/lib/game_dig/node/node_modules/long/index.js +1581 -0
  472. data/lib/game_dig/node/node_modules/long/package.json +58 -0
  473. data/lib/game_dig/node/node_modules/long/types.d.ts +474 -0
  474. data/lib/game_dig/node/node_modules/long/umd/index.d.ts +3 -0
  475. data/lib/game_dig/node/node_modules/long/umd/index.js +1622 -0
  476. data/lib/game_dig/node/node_modules/long/umd/package.json +3 -0
  477. data/lib/game_dig/node/node_modules/long/umd/types.d.ts +474 -0
  478. data/lib/game_dig/node/node_modules/lowercase-keys/index.d.ts +14 -0
  479. data/lib/game_dig/node/node_modules/lowercase-keys/index.js +3 -0
  480. data/lib/game_dig/node/node_modules/lowercase-keys/license +9 -0
  481. data/lib/game_dig/node/node_modules/lowercase-keys/package.json +41 -0
  482. data/lib/game_dig/node/node_modules/lowercase-keys/readme.md +32 -0
  483. data/lib/game_dig/node/node_modules/mimic-response/index.d.ts +17 -0
  484. data/lib/game_dig/node/node_modules/mimic-response/index.js +77 -0
  485. data/lib/game_dig/node/node_modules/mimic-response/license +9 -0
  486. data/lib/game_dig/node/node_modules/mimic-response/package.json +42 -0
  487. data/lib/game_dig/node/node_modules/mimic-response/readme.md +78 -0
  488. data/lib/game_dig/node/node_modules/minimist/.eslintrc +29 -0
  489. data/lib/game_dig/node/node_modules/minimist/.github/FUNDING.yml +12 -0
  490. data/lib/game_dig/node/node_modules/minimist/.nycrc +14 -0
  491. data/lib/game_dig/node/node_modules/minimist/CHANGELOG.md +298 -0
  492. data/lib/game_dig/node/node_modules/minimist/LICENSE +18 -0
  493. data/lib/game_dig/node/node_modules/minimist/README.md +121 -0
  494. data/lib/game_dig/node/node_modules/minimist/example/parse.js +4 -0
  495. data/lib/game_dig/node/node_modules/minimist/index.js +263 -0
  496. data/lib/game_dig/node/node_modules/minimist/package.json +75 -0
  497. data/lib/game_dig/node/node_modules/minimist/test/all_bool.js +34 -0
  498. data/lib/game_dig/node/node_modules/minimist/test/bool.js +177 -0
  499. data/lib/game_dig/node/node_modules/minimist/test/dash.js +43 -0
  500. data/lib/game_dig/node/node_modules/minimist/test/default_bool.js +37 -0
  501. data/lib/game_dig/node/node_modules/minimist/test/dotted.js +24 -0
  502. data/lib/game_dig/node/node_modules/minimist/test/kv_short.js +32 -0
  503. data/lib/game_dig/node/node_modules/minimist/test/long.js +33 -0
  504. data/lib/game_dig/node/node_modules/minimist/test/num.js +38 -0
  505. data/lib/game_dig/node/node_modules/minimist/test/parse.js +209 -0
  506. data/lib/game_dig/node/node_modules/minimist/test/parse_modified.js +11 -0
  507. data/lib/game_dig/node/node_modules/minimist/test/proto.js +64 -0
  508. data/lib/game_dig/node/node_modules/minimist/test/short.js +69 -0
  509. data/lib/game_dig/node/node_modules/minimist/test/stop_early.js +17 -0
  510. data/lib/game_dig/node/node_modules/minimist/test/unknown.js +104 -0
  511. data/lib/game_dig/node/node_modules/minimist/test/whitespace.js +10 -0
  512. data/lib/game_dig/node/node_modules/net/LICENSE +19 -0
  513. data/lib/game_dig/node/node_modules/net/README.md +0 -0
  514. data/lib/game_dig/node/node_modules/net/index.js +28 -0
  515. data/lib/game_dig/node/node_modules/net/package.json +17 -0
  516. data/lib/game_dig/node/node_modules/net/test.js +6 -0
  517. data/lib/game_dig/node/node_modules/normalize-url/index.d.ts +342 -0
  518. data/lib/game_dig/node/node_modules/normalize-url/index.js +308 -0
  519. data/lib/game_dig/node/node_modules/normalize-url/license +9 -0
  520. data/lib/game_dig/node/node_modules/normalize-url/package.json +57 -0
  521. data/lib/game_dig/node/node_modules/normalize-url/readme.md +347 -0
  522. data/lib/game_dig/node/node_modules/p-cancelable/index.d.ts +168 -0
  523. data/lib/game_dig/node/node_modules/p-cancelable/index.js +110 -0
  524. data/lib/game_dig/node/node_modules/p-cancelable/license +9 -0
  525. data/lib/game_dig/node/node_modules/p-cancelable/package.json +50 -0
  526. data/lib/game_dig/node/node_modules/p-cancelable/readme.md +152 -0
  527. data/lib/game_dig/node/node_modules/process-nextick-args/index.js +45 -0
  528. data/lib/game_dig/node/node_modules/process-nextick-args/license.md +19 -0
  529. data/lib/game_dig/node/node_modules/process-nextick-args/package.json +25 -0
  530. data/lib/game_dig/node/node_modules/process-nextick-args/readme.md +18 -0
  531. data/lib/game_dig/node/node_modules/quick-lru/index.d.ts +97 -0
  532. data/lib/game_dig/node/node_modules/quick-lru/index.js +123 -0
  533. data/lib/game_dig/node/node_modules/quick-lru/license +9 -0
  534. data/lib/game_dig/node/node_modules/quick-lru/package.json +43 -0
  535. data/lib/game_dig/node/node_modules/quick-lru/readme.md +111 -0
  536. data/lib/game_dig/node/node_modules/readable-stream/.travis.yml +34 -0
  537. data/lib/game_dig/node/node_modules/readable-stream/CONTRIBUTING.md +38 -0
  538. data/lib/game_dig/node/node_modules/readable-stream/GOVERNANCE.md +136 -0
  539. data/lib/game_dig/node/node_modules/readable-stream/LICENSE +47 -0
  540. data/lib/game_dig/node/node_modules/readable-stream/README.md +58 -0
  541. data/lib/game_dig/node/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md +60 -0
  542. data/lib/game_dig/node/node_modules/readable-stream/duplex-browser.js +1 -0
  543. data/lib/game_dig/node/node_modules/readable-stream/duplex.js +1 -0
  544. data/lib/game_dig/node/node_modules/readable-stream/lib/_stream_duplex.js +131 -0
  545. data/lib/game_dig/node/node_modules/readable-stream/lib/_stream_passthrough.js +47 -0
  546. data/lib/game_dig/node/node_modules/readable-stream/lib/_stream_readable.js +1019 -0
  547. data/lib/game_dig/node/node_modules/readable-stream/lib/_stream_transform.js +214 -0
  548. data/lib/game_dig/node/node_modules/readable-stream/lib/_stream_writable.js +685 -0
  549. data/lib/game_dig/node/node_modules/readable-stream/lib/internal/streams/BufferList.js +78 -0
  550. data/lib/game_dig/node/node_modules/readable-stream/lib/internal/streams/destroy.js +84 -0
  551. data/lib/game_dig/node/node_modules/readable-stream/lib/internal/streams/stream-browser.js +1 -0
  552. data/lib/game_dig/node/node_modules/readable-stream/lib/internal/streams/stream.js +1 -0
  553. data/lib/game_dig/node/node_modules/readable-stream/node_modules/isarray/.npmignore +1 -0
  554. data/lib/game_dig/node/node_modules/readable-stream/node_modules/isarray/.travis.yml +4 -0
  555. data/lib/game_dig/node/node_modules/readable-stream/node_modules/isarray/Makefile +6 -0
  556. data/lib/game_dig/node/node_modules/readable-stream/node_modules/isarray/README.md +60 -0
  557. data/lib/game_dig/node/node_modules/readable-stream/node_modules/isarray/component.json +19 -0
  558. data/lib/game_dig/node/node_modules/readable-stream/node_modules/isarray/index.js +5 -0
  559. data/lib/game_dig/node/node_modules/readable-stream/node_modules/isarray/package.json +45 -0
  560. data/lib/game_dig/node/node_modules/readable-stream/node_modules/isarray/test.js +20 -0
  561. data/lib/game_dig/node/node_modules/readable-stream/node_modules/string_decoder/.travis.yml +50 -0
  562. data/lib/game_dig/node/node_modules/readable-stream/node_modules/string_decoder/LICENSE +48 -0
  563. data/lib/game_dig/node/node_modules/readable-stream/node_modules/string_decoder/README.md +47 -0
  564. data/lib/game_dig/node/node_modules/readable-stream/node_modules/string_decoder/lib/string_decoder.js +296 -0
  565. data/lib/game_dig/node/node_modules/readable-stream/node_modules/string_decoder/package.json +31 -0
  566. data/lib/game_dig/node/node_modules/readable-stream/package.json +52 -0
  567. data/lib/game_dig/node/node_modules/readable-stream/passthrough.js +1 -0
  568. data/lib/game_dig/node/node_modules/readable-stream/readable-browser.js +7 -0
  569. data/lib/game_dig/node/node_modules/readable-stream/readable.js +19 -0
  570. data/lib/game_dig/node/node_modules/readable-stream/transform.js +1 -0
  571. data/lib/game_dig/node/node_modules/readable-stream/writable-browser.js +1 -0
  572. data/lib/game_dig/node/node_modules/readable-stream/writable.js +8 -0
  573. data/lib/game_dig/node/node_modules/resolve-alpn/LICENSE +22 -0
  574. data/lib/game_dig/node/node_modules/resolve-alpn/README.md +60 -0
  575. data/lib/game_dig/node/node_modules/resolve-alpn/index.js +43 -0
  576. data/lib/game_dig/node/node_modules/resolve-alpn/package.json +34 -0
  577. data/lib/game_dig/node/node_modules/responselike/LICENSE +19 -0
  578. data/lib/game_dig/node/node_modules/responselike/README.md +77 -0
  579. data/lib/game_dig/node/node_modules/responselike/index.d.ts +86 -0
  580. data/lib/game_dig/node/node_modules/responselike/index.js +39 -0
  581. data/lib/game_dig/node/node_modules/responselike/license +10 -0
  582. data/lib/game_dig/node/node_modules/responselike/package.json +39 -0
  583. data/lib/game_dig/node/node_modules/responselike/readme.md +75 -0
  584. data/lib/game_dig/node/node_modules/safe-buffer/LICENSE +21 -0
  585. data/lib/game_dig/node/node_modules/safe-buffer/README.md +584 -0
  586. data/lib/game_dig/node/node_modules/safe-buffer/index.d.ts +187 -0
  587. data/lib/game_dig/node/node_modules/safe-buffer/index.js +62 -0
  588. data/lib/game_dig/node/node_modules/safe-buffer/package.json +37 -0
  589. data/lib/game_dig/node/node_modules/safer-buffer/LICENSE +21 -0
  590. data/lib/game_dig/node/node_modules/safer-buffer/Porting-Buffer.md +268 -0
  591. data/lib/game_dig/node/node_modules/safer-buffer/Readme.md +156 -0
  592. data/lib/game_dig/node/node_modules/safer-buffer/dangerous.js +58 -0
  593. data/lib/game_dig/node/node_modules/safer-buffer/package.json +34 -0
  594. data/lib/game_dig/node/node_modules/safer-buffer/safer.js +77 -0
  595. data/lib/game_dig/node/node_modules/safer-buffer/tests.js +406 -0
  596. data/lib/game_dig/node/node_modules/sax/LICENSE +41 -0
  597. data/lib/game_dig/node/node_modules/sax/README.md +225 -0
  598. data/lib/game_dig/node/node_modules/sax/lib/sax.js +1565 -0
  599. data/lib/game_dig/node/node_modules/sax/package.json +25 -0
  600. data/lib/game_dig/node/node_modules/seek-bzip/LICENSE +26 -0
  601. data/lib/game_dig/node/node_modules/seek-bzip/README.md +185 -0
  602. data/lib/game_dig/node/node_modules/seek-bzip/bin/seek-bunzip +129 -0
  603. data/lib/game_dig/node/node_modules/seek-bzip/bin/seek-bzip-table +71 -0
  604. data/lib/game_dig/node/node_modules/seek-bzip/lib/bitreader.js +94 -0
  605. data/lib/game_dig/node/node_modules/seek-bzip/lib/crc32.js +104 -0
  606. data/lib/game_dig/node/node_modules/seek-bzip/lib/index.js +605 -0
  607. data/lib/game_dig/node/node_modules/seek-bzip/lib/stream.js +42 -0
  608. data/lib/game_dig/node/node_modules/seek-bzip/package.json +34 -0
  609. data/lib/game_dig/node/node_modules/stream/.npmignore +3 -0
  610. data/lib/game_dig/node/node_modules/stream/Makefile +11 -0
  611. data/lib/game_dig/node/node_modules/stream/README.md +59 -0
  612. data/lib/game_dig/node/node_modules/stream/component.json +19 -0
  613. data/lib/game_dig/node/node_modules/stream/index.js +115 -0
  614. data/lib/game_dig/node/node_modules/stream/package.json +25 -0
  615. data/lib/game_dig/node/node_modules/stream/test.html +173 -0
  616. data/lib/game_dig/node/node_modules/string-to-stream/LICENSE +20 -0
  617. data/lib/game_dig/node/node_modules/string-to-stream/README.md +34 -0
  618. data/lib/game_dig/node/node_modules/string-to-stream/index.js +23 -0
  619. data/lib/game_dig/node/node_modules/string-to-stream/package.json +53 -0
  620. data/lib/game_dig/node/node_modules/string_decoder/.npmignore +2 -0
  621. data/lib/game_dig/node/node_modules/string_decoder/LICENSE +20 -0
  622. data/lib/game_dig/node/node_modules/string_decoder/README.md +7 -0
  623. data/lib/game_dig/node/node_modules/string_decoder/index.js +221 -0
  624. data/lib/game_dig/node/node_modules/string_decoder/package.json +25 -0
  625. data/lib/game_dig/node/node_modules/strnum/.github/SECURITY.md +5 -0
  626. data/lib/game_dig/node/node_modules/strnum/.vscode/launch.json +25 -0
  627. data/lib/game_dig/node/node_modules/strnum/CHANGELOG.md +33 -0
  628. data/lib/game_dig/node/node_modules/strnum/LICENSE +21 -0
  629. data/lib/game_dig/node/node_modules/strnum/README.md +97 -0
  630. data/lib/game_dig/node/node_modules/strnum/algo.stflow +84 -0
  631. data/lib/game_dig/node/node_modules/strnum/package.json +31 -0
  632. data/lib/game_dig/node/node_modules/strnum/strnum.js +129 -0
  633. data/lib/game_dig/node/node_modules/strnum/strnum.test.js +173 -0
  634. data/lib/game_dig/node/node_modules/strnum/test.js +9 -0
  635. data/lib/game_dig/node/node_modules/telnet-client/LICENSE +8 -0
  636. data/lib/game_dig/node/node_modules/telnet-client/README.md +363 -0
  637. data/lib/game_dig/node/node_modules/telnet-client/lib/index.d.ts +92 -0
  638. data/lib/game_dig/node/node_modules/telnet-client/lib/index.js +506 -0
  639. data/lib/game_dig/node/node_modules/telnet-client/lib/index.js.map +1 -0
  640. data/lib/game_dig/node/node_modules/telnet-client/lib/utils.d.ts +15 -0
  641. data/lib/game_dig/node/node_modules/telnet-client/lib/utils.js +34 -0
  642. data/lib/game_dig/node/node_modules/telnet-client/lib/utils.js.map +1 -0
  643. data/lib/game_dig/node/node_modules/telnet-client/package.json +103 -0
  644. data/lib/game_dig/node/node_modules/util-deprecate/History.md +16 -0
  645. data/lib/game_dig/node/node_modules/util-deprecate/LICENSE +24 -0
  646. data/lib/game_dig/node/node_modules/util-deprecate/README.md +53 -0
  647. data/lib/game_dig/node/node_modules/util-deprecate/browser.js +67 -0
  648. data/lib/game_dig/node/node_modules/util-deprecate/node.js +6 -0
  649. data/lib/game_dig/node/node_modules/util-deprecate/package.json +27 -0
  650. data/lib/game_dig/node/node_modules/varint/README.md +53 -0
  651. data/lib/game_dig/node/node_modules/varint/bench.js +57 -0
  652. data/lib/game_dig/node/node_modules/varint/decode.js +29 -0
  653. data/lib/game_dig/node/node_modules/varint/encode.js +30 -0
  654. data/lib/game_dig/node/node_modules/varint/index.js +5 -0
  655. data/lib/game_dig/node/node_modules/varint/length.js +25 -0
  656. data/lib/game_dig/node/node_modules/varint/package.json +24 -0
  657. data/lib/game_dig/node/node_modules/varint/test.js +156 -0
  658. data/lib/game_dig/node/node_modules/xmlbuilder/.npmignore +5 -0
  659. data/lib/game_dig/node/node_modules/xmlbuilder/CHANGELOG.md +395 -0
  660. data/lib/game_dig/node/node_modules/xmlbuilder/LICENSE +21 -0
  661. data/lib/game_dig/node/node_modules/xmlbuilder/README.md +85 -0
  662. data/lib/game_dig/node/node_modules/xmlbuilder/lib/Utility.js +139 -0
  663. data/lib/game_dig/node/node_modules/xmlbuilder/lib/XMLAttribute.js +31 -0
  664. data/lib/game_dig/node/node_modules/xmlbuilder/lib/XMLCData.js +32 -0
  665. data/lib/game_dig/node/node_modules/xmlbuilder/lib/XMLComment.js +32 -0
  666. data/lib/game_dig/node/node_modules/xmlbuilder/lib/XMLDTDAttList.js +50 -0
  667. data/lib/game_dig/node/node_modules/xmlbuilder/lib/XMLDTDElement.js +35 -0
  668. data/lib/game_dig/node/node_modules/xmlbuilder/lib/XMLDTDEntity.js +56 -0
  669. data/lib/game_dig/node/node_modules/xmlbuilder/lib/XMLDTDNotation.js +37 -0
  670. data/lib/game_dig/node/node_modules/xmlbuilder/lib/XMLDeclaration.js +40 -0
  671. data/lib/game_dig/node/node_modules/xmlbuilder/lib/XMLDocType.js +107 -0
  672. data/lib/game_dig/node/node_modules/xmlbuilder/lib/XMLDocument.js +48 -0
  673. data/lib/game_dig/node/node_modules/xmlbuilder/lib/XMLDocumentCB.js +402 -0
  674. data/lib/game_dig/node/node_modules/xmlbuilder/lib/XMLElement.js +111 -0
  675. data/lib/game_dig/node/node_modules/xmlbuilder/lib/XMLNode.js +432 -0
  676. data/lib/game_dig/node/node_modules/xmlbuilder/lib/XMLProcessingInstruction.js +35 -0
  677. data/lib/game_dig/node/node_modules/xmlbuilder/lib/XMLRaw.js +32 -0
  678. data/lib/game_dig/node/node_modules/xmlbuilder/lib/XMLStreamWriter.js +278 -0
  679. data/lib/game_dig/node/node_modules/xmlbuilder/lib/XMLStringWriter.js +302 -0
  680. data/lib/game_dig/node/node_modules/xmlbuilder/lib/XMLStringifier.js +192 -0
  681. data/lib/game_dig/node/node_modules/xmlbuilder/lib/XMLText.js +32 -0
  682. data/lib/game_dig/node/node_modules/xmlbuilder/lib/XMLWriterBase.js +68 -0
  683. data/lib/game_dig/node/node_modules/xmlbuilder/lib/index.js +53 -0
  684. data/lib/game_dig/node/node_modules/xmlbuilder/package.json +37 -0
  685. data/lib/game_dig/node/node_modules/xmlrpc/.idea/date_formatter.js +77 -0
  686. data/lib/game_dig/node/node_modules/xmlrpc/.npmignore +5 -0
  687. data/lib/game_dig/node/node_modules/xmlrpc/.travis.yml +6 -0
  688. data/lib/game_dig/node/node_modules/xmlrpc/HISTORY.md +129 -0
  689. data/lib/game_dig/node/node_modules/xmlrpc/LICENSE +23 -0
  690. data/lib/game_dig/node/node_modules/xmlrpc/README.md +235 -0
  691. data/lib/game_dig/node/node_modules/xmlrpc/lib/client.js +177 -0
  692. data/lib/game_dig/node/node_modules/xmlrpc/lib/cookies.js +111 -0
  693. data/lib/game_dig/node/node_modules/xmlrpc/lib/customtype.js +10 -0
  694. data/lib/game_dig/node/node_modules/xmlrpc/lib/date_formatter.js +188 -0
  695. data/lib/game_dig/node/node_modules/xmlrpc/lib/deserializer.js +324 -0
  696. data/lib/game_dig/node/node_modules/xmlrpc/lib/serializer.js +202 -0
  697. data/lib/game_dig/node/node_modules/xmlrpc/lib/server.js +78 -0
  698. data/lib/game_dig/node/node_modules/xmlrpc/lib/xmlrpc.js +65 -0
  699. data/lib/game_dig/node/node_modules/xmlrpc/package.json +35 -0
  700. data/lib/game_dig/node/node_modules/xmlrpc/tmp/client.js +28 -0
  701. data/lib/game_dig/node/node_modules/xmlrpc/tmp/server.crt +13 -0
  702. data/lib/game_dig/node/node_modules/xmlrpc/tmp/server.csr +11 -0
  703. data/lib/game_dig/node/node_modules/xmlrpc/tmp/server.js +10 -0
  704. data/lib/game_dig/node/node_modules/xmlrpc/tmp/server.key +15 -0
  705. data/lib/game_dig/node/node_modules/xmlrpc/tmp/server.key.org +18 -0
  706. data/lib/game_dig/node/package.json +8 -0
  707. data/lib/game_dig/node/yarn.lock +359 -0
  708. data/lib/game_dig/nodo.rb +54 -0
  709. data/lib/game_dig/query_result.rb +71 -0
  710. data/lib/game_dig/version.rb +1 -1
  711. data/lib/game_dig.rb +64 -55
  712. metadata +742 -16
  713. data/cli/pry_service.rb +0 -5
  714. data/lib/custom_errors/game_dig_cli_not_found.rb +0 -2
  715. data/lib/custom_errors/game_dig_error.rb +0 -2
  716. data/lib/game_dig/game_dig_helper.rb +0 -68
  717. data/lib/game_dig/service.rb +0 -38
  718. data/lib/node/gamedig-service.js +0 -46
  719. data/lib/node/package.json +0 -9
@@ -0,0 +1,1653 @@
1
+ import process from 'node:process';
2
+ import { promisify, inspect } from 'node:util';
3
+ import { checkServerIdentity } from 'node:tls';
4
+ // DO NOT use destructuring for `https.request` and `http.request` as it's not compatible with `nock`.
5
+ import http from 'node:http';
6
+ import https from 'node:https';
7
+ import is, { assert } from '@sindresorhus/is';
8
+ import lowercaseKeys from 'lowercase-keys';
9
+ import CacheableLookup from 'cacheable-lookup';
10
+ import http2wrapper from 'http2-wrapper';
11
+ import { isFormData } from 'form-data-encoder';
12
+ import parseLinkHeader from './parse-link-header.js';
13
+ const [major, minor] = process.versions.node.split('.').map(Number);
14
+ function validateSearchParameters(searchParameters) {
15
+ // eslint-disable-next-line guard-for-in
16
+ for (const key in searchParameters) {
17
+ const value = searchParameters[key];
18
+ assert.any([is.string, is.number, is.boolean, is.null_, is.undefined], value);
19
+ }
20
+ }
21
+ const globalCache = new Map();
22
+ let globalDnsCache;
23
+ const getGlobalDnsCache = () => {
24
+ if (globalDnsCache) {
25
+ return globalDnsCache;
26
+ }
27
+ globalDnsCache = new CacheableLookup();
28
+ return globalDnsCache;
29
+ };
30
+ const defaultInternals = {
31
+ request: undefined,
32
+ agent: {
33
+ http: undefined,
34
+ https: undefined,
35
+ http2: undefined,
36
+ },
37
+ h2session: undefined,
38
+ decompress: true,
39
+ timeout: {
40
+ connect: undefined,
41
+ lookup: undefined,
42
+ read: undefined,
43
+ request: undefined,
44
+ response: undefined,
45
+ secureConnect: undefined,
46
+ send: undefined,
47
+ socket: undefined,
48
+ },
49
+ prefixUrl: '',
50
+ body: undefined,
51
+ form: undefined,
52
+ json: undefined,
53
+ cookieJar: undefined,
54
+ ignoreInvalidCookies: false,
55
+ searchParams: undefined,
56
+ dnsLookup: undefined,
57
+ dnsCache: undefined,
58
+ context: {},
59
+ hooks: {
60
+ init: [],
61
+ beforeRequest: [],
62
+ beforeError: [],
63
+ beforeRedirect: [],
64
+ beforeRetry: [],
65
+ afterResponse: [],
66
+ },
67
+ followRedirect: true,
68
+ maxRedirects: 10,
69
+ cache: undefined,
70
+ throwHttpErrors: true,
71
+ username: '',
72
+ password: '',
73
+ http2: false,
74
+ allowGetBody: false,
75
+ headers: {
76
+ 'user-agent': 'got (https://github.com/sindresorhus/got)',
77
+ },
78
+ methodRewriting: false,
79
+ dnsLookupIpVersion: undefined,
80
+ parseJson: JSON.parse,
81
+ stringifyJson: JSON.stringify,
82
+ retry: {
83
+ limit: 2,
84
+ methods: [
85
+ 'GET',
86
+ 'PUT',
87
+ 'HEAD',
88
+ 'DELETE',
89
+ 'OPTIONS',
90
+ 'TRACE',
91
+ ],
92
+ statusCodes: [
93
+ 408,
94
+ 413,
95
+ 429,
96
+ 500,
97
+ 502,
98
+ 503,
99
+ 504,
100
+ 521,
101
+ 522,
102
+ 524,
103
+ ],
104
+ errorCodes: [
105
+ 'ETIMEDOUT',
106
+ 'ECONNRESET',
107
+ 'EADDRINUSE',
108
+ 'ECONNREFUSED',
109
+ 'EPIPE',
110
+ 'ENOTFOUND',
111
+ 'ENETUNREACH',
112
+ 'EAI_AGAIN',
113
+ ],
114
+ maxRetryAfter: undefined,
115
+ calculateDelay: ({ computedValue }) => computedValue,
116
+ backoffLimit: Number.POSITIVE_INFINITY,
117
+ noise: 100,
118
+ },
119
+ localAddress: undefined,
120
+ method: 'GET',
121
+ createConnection: undefined,
122
+ cacheOptions: {
123
+ shared: undefined,
124
+ cacheHeuristic: undefined,
125
+ immutableMinTimeToLive: undefined,
126
+ ignoreCargoCult: undefined,
127
+ },
128
+ https: {
129
+ alpnProtocols: undefined,
130
+ rejectUnauthorized: undefined,
131
+ checkServerIdentity: undefined,
132
+ certificateAuthority: undefined,
133
+ key: undefined,
134
+ certificate: undefined,
135
+ passphrase: undefined,
136
+ pfx: undefined,
137
+ ciphers: undefined,
138
+ honorCipherOrder: undefined,
139
+ minVersion: undefined,
140
+ maxVersion: undefined,
141
+ signatureAlgorithms: undefined,
142
+ tlsSessionLifetime: undefined,
143
+ dhparam: undefined,
144
+ ecdhCurve: undefined,
145
+ certificateRevocationLists: undefined,
146
+ },
147
+ encoding: undefined,
148
+ resolveBodyOnly: false,
149
+ isStream: false,
150
+ responseType: 'text',
151
+ url: undefined,
152
+ pagination: {
153
+ transform(response) {
154
+ if (response.request.options.responseType === 'json') {
155
+ return response.body;
156
+ }
157
+ return JSON.parse(response.body);
158
+ },
159
+ paginate({ response }) {
160
+ const rawLinkHeader = response.headers.link;
161
+ if (typeof rawLinkHeader !== 'string' || rawLinkHeader.trim() === '') {
162
+ return false;
163
+ }
164
+ const parsed = parseLinkHeader(rawLinkHeader);
165
+ const next = parsed.find(entry => entry.parameters.rel === 'next' || entry.parameters.rel === '"next"');
166
+ if (next) {
167
+ return {
168
+ url: new URL(next.reference, response.url),
169
+ };
170
+ }
171
+ return false;
172
+ },
173
+ filter: () => true,
174
+ shouldContinue: () => true,
175
+ countLimit: Number.POSITIVE_INFINITY,
176
+ backoff: 0,
177
+ requestLimit: 10000,
178
+ stackAllItems: false,
179
+ },
180
+ setHost: true,
181
+ maxHeaderSize: undefined,
182
+ signal: undefined,
183
+ enableUnixSockets: false,
184
+ };
185
+ const cloneInternals = (internals) => {
186
+ const { hooks, retry } = internals;
187
+ const result = {
188
+ ...internals,
189
+ context: { ...internals.context },
190
+ cacheOptions: { ...internals.cacheOptions },
191
+ https: { ...internals.https },
192
+ agent: { ...internals.agent },
193
+ headers: { ...internals.headers },
194
+ retry: {
195
+ ...retry,
196
+ errorCodes: [...retry.errorCodes],
197
+ methods: [...retry.methods],
198
+ statusCodes: [...retry.statusCodes],
199
+ },
200
+ timeout: { ...internals.timeout },
201
+ hooks: {
202
+ init: [...hooks.init],
203
+ beforeRequest: [...hooks.beforeRequest],
204
+ beforeError: [...hooks.beforeError],
205
+ beforeRedirect: [...hooks.beforeRedirect],
206
+ beforeRetry: [...hooks.beforeRetry],
207
+ afterResponse: [...hooks.afterResponse],
208
+ },
209
+ searchParams: internals.searchParams ? new URLSearchParams(internals.searchParams) : undefined,
210
+ pagination: { ...internals.pagination },
211
+ };
212
+ if (result.url !== undefined) {
213
+ result.prefixUrl = '';
214
+ }
215
+ return result;
216
+ };
217
+ const cloneRaw = (raw) => {
218
+ const { hooks, retry } = raw;
219
+ const result = { ...raw };
220
+ if (is.object(raw.context)) {
221
+ result.context = { ...raw.context };
222
+ }
223
+ if (is.object(raw.cacheOptions)) {
224
+ result.cacheOptions = { ...raw.cacheOptions };
225
+ }
226
+ if (is.object(raw.https)) {
227
+ result.https = { ...raw.https };
228
+ }
229
+ if (is.object(raw.cacheOptions)) {
230
+ result.cacheOptions = { ...result.cacheOptions };
231
+ }
232
+ if (is.object(raw.agent)) {
233
+ result.agent = { ...raw.agent };
234
+ }
235
+ if (is.object(raw.headers)) {
236
+ result.headers = { ...raw.headers };
237
+ }
238
+ if (is.object(retry)) {
239
+ result.retry = { ...retry };
240
+ if (is.array(retry.errorCodes)) {
241
+ result.retry.errorCodes = [...retry.errorCodes];
242
+ }
243
+ if (is.array(retry.methods)) {
244
+ result.retry.methods = [...retry.methods];
245
+ }
246
+ if (is.array(retry.statusCodes)) {
247
+ result.retry.statusCodes = [...retry.statusCodes];
248
+ }
249
+ }
250
+ if (is.object(raw.timeout)) {
251
+ result.timeout = { ...raw.timeout };
252
+ }
253
+ if (is.object(hooks)) {
254
+ result.hooks = {
255
+ ...hooks,
256
+ };
257
+ if (is.array(hooks.init)) {
258
+ result.hooks.init = [...hooks.init];
259
+ }
260
+ if (is.array(hooks.beforeRequest)) {
261
+ result.hooks.beforeRequest = [...hooks.beforeRequest];
262
+ }
263
+ if (is.array(hooks.beforeError)) {
264
+ result.hooks.beforeError = [...hooks.beforeError];
265
+ }
266
+ if (is.array(hooks.beforeRedirect)) {
267
+ result.hooks.beforeRedirect = [...hooks.beforeRedirect];
268
+ }
269
+ if (is.array(hooks.beforeRetry)) {
270
+ result.hooks.beforeRetry = [...hooks.beforeRetry];
271
+ }
272
+ if (is.array(hooks.afterResponse)) {
273
+ result.hooks.afterResponse = [...hooks.afterResponse];
274
+ }
275
+ }
276
+ // TODO: raw.searchParams
277
+ if (is.object(raw.pagination)) {
278
+ result.pagination = { ...raw.pagination };
279
+ }
280
+ return result;
281
+ };
282
+ const getHttp2TimeoutOption = (internals) => {
283
+ const delays = [internals.timeout.socket, internals.timeout.connect, internals.timeout.lookup, internals.timeout.request, internals.timeout.secureConnect].filter(delay => typeof delay === 'number');
284
+ if (delays.length > 0) {
285
+ return Math.min(...delays);
286
+ }
287
+ return undefined;
288
+ };
289
+ const init = (options, withOptions, self) => {
290
+ const initHooks = options.hooks?.init;
291
+ if (initHooks) {
292
+ for (const hook of initHooks) {
293
+ hook(withOptions, self);
294
+ }
295
+ }
296
+ };
297
+ export default class Options {
298
+ constructor(input, options, defaults) {
299
+ Object.defineProperty(this, "_unixOptions", {
300
+ enumerable: true,
301
+ configurable: true,
302
+ writable: true,
303
+ value: void 0
304
+ });
305
+ Object.defineProperty(this, "_internals", {
306
+ enumerable: true,
307
+ configurable: true,
308
+ writable: true,
309
+ value: void 0
310
+ });
311
+ Object.defineProperty(this, "_merging", {
312
+ enumerable: true,
313
+ configurable: true,
314
+ writable: true,
315
+ value: void 0
316
+ });
317
+ Object.defineProperty(this, "_init", {
318
+ enumerable: true,
319
+ configurable: true,
320
+ writable: true,
321
+ value: void 0
322
+ });
323
+ assert.any([is.string, is.urlInstance, is.object, is.undefined], input);
324
+ assert.any([is.object, is.undefined], options);
325
+ assert.any([is.object, is.undefined], defaults);
326
+ if (input instanceof Options || options instanceof Options) {
327
+ throw new TypeError('The defaults must be passed as the third argument');
328
+ }
329
+ this._internals = cloneInternals(defaults?._internals ?? defaults ?? defaultInternals);
330
+ this._init = [...(defaults?._init ?? [])];
331
+ this._merging = false;
332
+ this._unixOptions = undefined;
333
+ // This rule allows `finally` to be considered more important.
334
+ // Meaning no matter the error thrown in the `try` block,
335
+ // if `finally` throws then the `finally` error will be thrown.
336
+ //
337
+ // Yes, we want this. If we set `url` first, then the `url.searchParams`
338
+ // would get merged. Instead we set the `searchParams` first, then
339
+ // `url.searchParams` is overwritten as expected.
340
+ //
341
+ /* eslint-disable no-unsafe-finally */
342
+ try {
343
+ if (is.plainObject(input)) {
344
+ try {
345
+ this.merge(input);
346
+ this.merge(options);
347
+ }
348
+ finally {
349
+ this.url = input.url;
350
+ }
351
+ }
352
+ else {
353
+ try {
354
+ this.merge(options);
355
+ }
356
+ finally {
357
+ if (options?.url !== undefined) {
358
+ if (input === undefined) {
359
+ this.url = options.url;
360
+ }
361
+ else {
362
+ throw new TypeError('The `url` option is mutually exclusive with the `input` argument');
363
+ }
364
+ }
365
+ else if (input !== undefined) {
366
+ this.url = input;
367
+ }
368
+ }
369
+ }
370
+ }
371
+ catch (error) {
372
+ error.options = this;
373
+ throw error;
374
+ }
375
+ /* eslint-enable no-unsafe-finally */
376
+ }
377
+ merge(options) {
378
+ if (!options) {
379
+ return;
380
+ }
381
+ if (options instanceof Options) {
382
+ for (const init of options._init) {
383
+ this.merge(init);
384
+ }
385
+ return;
386
+ }
387
+ options = cloneRaw(options);
388
+ init(this, options, this);
389
+ init(options, options, this);
390
+ this._merging = true;
391
+ // Always merge `isStream` first
392
+ if ('isStream' in options) {
393
+ this.isStream = options.isStream;
394
+ }
395
+ try {
396
+ let push = false;
397
+ for (const key in options) {
398
+ // `got.extend()` options
399
+ if (key === 'mutableDefaults' || key === 'handlers') {
400
+ continue;
401
+ }
402
+ // Never merge `url`
403
+ if (key === 'url') {
404
+ continue;
405
+ }
406
+ if (!(key in this)) {
407
+ throw new Error(`Unexpected option: ${key}`);
408
+ }
409
+ // @ts-expect-error Type 'unknown' is not assignable to type 'never'.
410
+ const value = options[key];
411
+ if (value === undefined) {
412
+ continue;
413
+ }
414
+ // @ts-expect-error Type 'unknown' is not assignable to type 'never'.
415
+ this[key] = value;
416
+ push = true;
417
+ }
418
+ if (push) {
419
+ this._init.push(options);
420
+ }
421
+ }
422
+ finally {
423
+ this._merging = false;
424
+ }
425
+ }
426
+ /**
427
+ Custom request function.
428
+ The main purpose of this is to [support HTTP2 using a wrapper](https://github.com/szmarczak/http2-wrapper).
429
+
430
+ @default http.request | https.request
431
+ */
432
+ get request() {
433
+ return this._internals.request;
434
+ }
435
+ set request(value) {
436
+ assert.any([is.function_, is.undefined], value);
437
+ this._internals.request = value;
438
+ }
439
+ /**
440
+ An object representing `http`, `https` and `http2` keys for [`http.Agent`](https://nodejs.org/api/http.html#http_class_http_agent), [`https.Agent`](https://nodejs.org/api/https.html#https_class_https_agent) and [`http2wrapper.Agent`](https://github.com/szmarczak/http2-wrapper#new-http2agentoptions) instance.
441
+ This is necessary because a request to one protocol might redirect to another.
442
+ In such a scenario, Got will switch over to the right protocol agent for you.
443
+
444
+ If a key is not present, it will default to a global agent.
445
+
446
+ @example
447
+ ```
448
+ import got from 'got';
449
+ import HttpAgent from 'agentkeepalive';
450
+
451
+ const {HttpsAgent} = HttpAgent;
452
+
453
+ await got('https://sindresorhus.com', {
454
+ agent: {
455
+ http: new HttpAgent(),
456
+ https: new HttpsAgent()
457
+ }
458
+ });
459
+ ```
460
+ */
461
+ get agent() {
462
+ return this._internals.agent;
463
+ }
464
+ set agent(value) {
465
+ assert.plainObject(value);
466
+ // eslint-disable-next-line guard-for-in
467
+ for (const key in value) {
468
+ if (!(key in this._internals.agent)) {
469
+ throw new TypeError(`Unexpected agent option: ${key}`);
470
+ }
471
+ // @ts-expect-error - No idea why `value[key]` doesn't work here.
472
+ assert.any([is.object, is.undefined], value[key]);
473
+ }
474
+ if (this._merging) {
475
+ Object.assign(this._internals.agent, value);
476
+ }
477
+ else {
478
+ this._internals.agent = { ...value };
479
+ }
480
+ }
481
+ get h2session() {
482
+ return this._internals.h2session;
483
+ }
484
+ set h2session(value) {
485
+ this._internals.h2session = value;
486
+ }
487
+ /**
488
+ Decompress the response automatically.
489
+
490
+ This will set the `accept-encoding` header to `gzip, deflate, br` unless you set it yourself.
491
+
492
+ If this is disabled, a compressed response is returned as a `Buffer`.
493
+ This may be useful if you want to handle decompression yourself or stream the raw compressed data.
494
+
495
+ @default true
496
+ */
497
+ get decompress() {
498
+ return this._internals.decompress;
499
+ }
500
+ set decompress(value) {
501
+ assert.boolean(value);
502
+ this._internals.decompress = value;
503
+ }
504
+ /**
505
+ Milliseconds to wait for the server to end the response before aborting the request with `got.TimeoutError` error (a.k.a. `request` property).
506
+ By default, there's no timeout.
507
+
508
+ This also accepts an `object` with the following fields to constrain the duration of each phase of the request lifecycle:
509
+
510
+ - `lookup` starts when a socket is assigned and ends when the hostname has been resolved.
511
+ Does not apply when using a Unix domain socket.
512
+ - `connect` starts when `lookup` completes (or when the socket is assigned if lookup does not apply to the request) and ends when the socket is connected.
513
+ - `secureConnect` starts when `connect` completes and ends when the handshaking process completes (HTTPS only).
514
+ - `socket` starts when the socket is connected. See [request.setTimeout](https://nodejs.org/api/http.html#http_request_settimeout_timeout_callback).
515
+ - `response` starts when the request has been written to the socket and ends when the response headers are received.
516
+ - `send` starts when the socket is connected and ends with the request has been written to the socket.
517
+ - `request` starts when the request is initiated and ends when the response's end event fires.
518
+ */
519
+ get timeout() {
520
+ // We always return `Delays` here.
521
+ // It has to be `Delays | number`, otherwise TypeScript will error because the getter and the setter have incompatible types.
522
+ return this._internals.timeout;
523
+ }
524
+ set timeout(value) {
525
+ assert.plainObject(value);
526
+ // eslint-disable-next-line guard-for-in
527
+ for (const key in value) {
528
+ if (!(key in this._internals.timeout)) {
529
+ throw new Error(`Unexpected timeout option: ${key}`);
530
+ }
531
+ // @ts-expect-error - No idea why `value[key]` doesn't work here.
532
+ assert.any([is.number, is.undefined], value[key]);
533
+ }
534
+ if (this._merging) {
535
+ Object.assign(this._internals.timeout, value);
536
+ }
537
+ else {
538
+ this._internals.timeout = { ...value };
539
+ }
540
+ }
541
+ /**
542
+ When specified, `prefixUrl` will be prepended to `url`.
543
+ The prefix can be any valid URL, either relative or absolute.
544
+ A trailing slash `/` is optional - one will be added automatically.
545
+
546
+ __Note__: `prefixUrl` will be ignored if the `url` argument is a URL instance.
547
+
548
+ __Note__: Leading slashes in `input` are disallowed when using this option to enforce consistency and avoid confusion.
549
+ For example, when the prefix URL is `https://example.com/foo` and the input is `/bar`, there's ambiguity whether the resulting URL would become `https://example.com/foo/bar` or `https://example.com/bar`.
550
+ The latter is used by browsers.
551
+
552
+ __Tip__: Useful when used with `got.extend()` to create niche-specific Got instances.
553
+
554
+ __Tip__: You can change `prefixUrl` using hooks as long as the URL still includes the `prefixUrl`.
555
+ If the URL doesn't include it anymore, it will throw.
556
+
557
+ @example
558
+ ```
559
+ import got from 'got';
560
+
561
+ await got('unicorn', {prefixUrl: 'https://cats.com'});
562
+ //=> 'https://cats.com/unicorn'
563
+
564
+ const instance = got.extend({
565
+ prefixUrl: 'https://google.com'
566
+ });
567
+
568
+ await instance('unicorn', {
569
+ hooks: {
570
+ beforeRequest: [
571
+ options => {
572
+ options.prefixUrl = 'https://cats.com';
573
+ }
574
+ ]
575
+ }
576
+ });
577
+ //=> 'https://cats.com/unicorn'
578
+ ```
579
+ */
580
+ get prefixUrl() {
581
+ // We always return `string` here.
582
+ // It has to be `string | URL`, otherwise TypeScript will error because the getter and the setter have incompatible types.
583
+ return this._internals.prefixUrl;
584
+ }
585
+ set prefixUrl(value) {
586
+ assert.any([is.string, is.urlInstance], value);
587
+ if (value === '') {
588
+ this._internals.prefixUrl = '';
589
+ return;
590
+ }
591
+ value = value.toString();
592
+ if (!value.endsWith('/')) {
593
+ value += '/';
594
+ }
595
+ if (this._internals.prefixUrl && this._internals.url) {
596
+ const { href } = this._internals.url;
597
+ this._internals.url.href = value + href.slice(this._internals.prefixUrl.length);
598
+ }
599
+ this._internals.prefixUrl = value;
600
+ }
601
+ /**
602
+ __Note #1__: The `body` option cannot be used with the `json` or `form` option.
603
+
604
+ __Note #2__: If you provide this option, `got.stream()` will be read-only.
605
+
606
+ __Note #3__: If you provide a payload with the `GET` or `HEAD` method, it will throw a `TypeError` unless the method is `GET` and the `allowGetBody` option is set to `true`.
607
+
608
+ __Note #4__: This option is not enumerable and will not be merged with the instance defaults.
609
+
610
+ The `content-length` header will be automatically set if `body` is a `string` / `Buffer` / [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData) / [`form-data` instance](https://github.com/form-data/form-data), and `content-length` and `transfer-encoding` are not manually set in `options.headers`.
611
+
612
+ Since Got 12, the `content-length` is not automatically set when `body` is a `fs.createReadStream`.
613
+ */
614
+ get body() {
615
+ return this._internals.body;
616
+ }
617
+ set body(value) {
618
+ assert.any([is.string, is.buffer, is.nodeStream, is.generator, is.asyncGenerator, isFormData, is.undefined], value);
619
+ if (is.nodeStream(value)) {
620
+ assert.truthy(value.readable);
621
+ }
622
+ if (value !== undefined) {
623
+ assert.undefined(this._internals.form);
624
+ assert.undefined(this._internals.json);
625
+ }
626
+ this._internals.body = value;
627
+ }
628
+ /**
629
+ The form body is converted to a query string using [`(new URLSearchParams(object)).toString()`](https://nodejs.org/api/url.html#url_constructor_new_urlsearchparams_obj).
630
+
631
+ If the `Content-Type` header is not present, it will be set to `application/x-www-form-urlencoded`.
632
+
633
+ __Note #1__: If you provide this option, `got.stream()` will be read-only.
634
+
635
+ __Note #2__: This option is not enumerable and will not be merged with the instance defaults.
636
+ */
637
+ get form() {
638
+ return this._internals.form;
639
+ }
640
+ set form(value) {
641
+ assert.any([is.plainObject, is.undefined], value);
642
+ if (value !== undefined) {
643
+ assert.undefined(this._internals.body);
644
+ assert.undefined(this._internals.json);
645
+ }
646
+ this._internals.form = value;
647
+ }
648
+ /**
649
+ JSON body. If the `Content-Type` header is not set, it will be set to `application/json`.
650
+
651
+ __Note #1__: If you provide this option, `got.stream()` will be read-only.
652
+
653
+ __Note #2__: This option is not enumerable and will not be merged with the instance defaults.
654
+ */
655
+ get json() {
656
+ return this._internals.json;
657
+ }
658
+ set json(value) {
659
+ if (value !== undefined) {
660
+ assert.undefined(this._internals.body);
661
+ assert.undefined(this._internals.form);
662
+ }
663
+ this._internals.json = value;
664
+ }
665
+ /**
666
+ The URL to request, as a string, a [`https.request` options object](https://nodejs.org/api/https.html#https_https_request_options_callback), or a [WHATWG `URL`](https://nodejs.org/api/url.html#url_class_url).
667
+
668
+ Properties from `options` will override properties in the parsed `url`.
669
+
670
+ If no protocol is specified, it will throw a `TypeError`.
671
+
672
+ __Note__: The query string is **not** parsed as search params.
673
+
674
+ @example
675
+ ```
676
+ await got('https://example.com/?query=a b'); //=> https://example.com/?query=a%20b
677
+ await got('https://example.com/', {searchParams: {query: 'a b'}}); //=> https://example.com/?query=a+b
678
+
679
+ // The query string is overridden by `searchParams`
680
+ await got('https://example.com/?query=a b', {searchParams: {query: 'a b'}}); //=> https://example.com/?query=a+b
681
+ ```
682
+ */
683
+ get url() {
684
+ return this._internals.url;
685
+ }
686
+ set url(value) {
687
+ assert.any([is.string, is.urlInstance, is.undefined], value);
688
+ if (value === undefined) {
689
+ this._internals.url = undefined;
690
+ return;
691
+ }
692
+ if (is.string(value) && value.startsWith('/')) {
693
+ throw new Error('`url` must not start with a slash');
694
+ }
695
+ const urlString = `${this.prefixUrl}${value.toString()}`;
696
+ const url = new URL(urlString);
697
+ this._internals.url = url;
698
+ if (url.protocol === 'unix:') {
699
+ url.href = `http://unix${url.pathname}${url.search}`;
700
+ }
701
+ if (url.protocol !== 'http:' && url.protocol !== 'https:') {
702
+ const error = new Error(`Unsupported protocol: ${url.protocol}`);
703
+ error.code = 'ERR_UNSUPPORTED_PROTOCOL';
704
+ throw error;
705
+ }
706
+ if (this._internals.username) {
707
+ url.username = this._internals.username;
708
+ this._internals.username = '';
709
+ }
710
+ if (this._internals.password) {
711
+ url.password = this._internals.password;
712
+ this._internals.password = '';
713
+ }
714
+ if (this._internals.searchParams) {
715
+ url.search = this._internals.searchParams.toString();
716
+ this._internals.searchParams = undefined;
717
+ }
718
+ if (url.hostname === 'unix') {
719
+ if (!this._internals.enableUnixSockets) {
720
+ throw new Error('Using UNIX domain sockets but option `enableUnixSockets` is not enabled');
721
+ }
722
+ const matches = /(?<socketPath>.+?):(?<path>.+)/.exec(`${url.pathname}${url.search}`);
723
+ if (matches?.groups) {
724
+ const { socketPath, path } = matches.groups;
725
+ this._unixOptions = {
726
+ socketPath,
727
+ path,
728
+ host: '',
729
+ };
730
+ }
731
+ else {
732
+ this._unixOptions = undefined;
733
+ }
734
+ return;
735
+ }
736
+ this._unixOptions = undefined;
737
+ }
738
+ /**
739
+ Cookie support. You don't have to care about parsing or how to store them.
740
+
741
+ __Note__: If you provide this option, `options.headers.cookie` will be overridden.
742
+ */
743
+ get cookieJar() {
744
+ return this._internals.cookieJar;
745
+ }
746
+ set cookieJar(value) {
747
+ assert.any([is.object, is.undefined], value);
748
+ if (value === undefined) {
749
+ this._internals.cookieJar = undefined;
750
+ return;
751
+ }
752
+ let { setCookie, getCookieString } = value;
753
+ assert.function_(setCookie);
754
+ assert.function_(getCookieString);
755
+ /* istanbul ignore next: Horrible `tough-cookie` v3 check */
756
+ if (setCookie.length === 4 && getCookieString.length === 0) {
757
+ setCookie = promisify(setCookie.bind(value));
758
+ getCookieString = promisify(getCookieString.bind(value));
759
+ this._internals.cookieJar = {
760
+ setCookie,
761
+ getCookieString: getCookieString,
762
+ };
763
+ }
764
+ else {
765
+ this._internals.cookieJar = value;
766
+ }
767
+ }
768
+ /**
769
+ You can abort the `request` using [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController).
770
+
771
+ @example
772
+ ```
773
+ import got from 'got';
774
+
775
+ const abortController = new AbortController();
776
+
777
+ const request = got('https://httpbin.org/anything', {
778
+ signal: abortController.signal
779
+ });
780
+
781
+ setTimeout(() => {
782
+ abortController.abort();
783
+ }, 100);
784
+ ```
785
+ */
786
+ get signal() {
787
+ return this._internals.signal;
788
+ }
789
+ set signal(value) {
790
+ assert.object(value);
791
+ this._internals.signal = value;
792
+ }
793
+ /**
794
+ Ignore invalid cookies instead of throwing an error.
795
+ Only useful when the `cookieJar` option has been set. Not recommended.
796
+
797
+ @default false
798
+ */
799
+ get ignoreInvalidCookies() {
800
+ return this._internals.ignoreInvalidCookies;
801
+ }
802
+ set ignoreInvalidCookies(value) {
803
+ assert.boolean(value);
804
+ this._internals.ignoreInvalidCookies = value;
805
+ }
806
+ /**
807
+ Query string that will be added to the request URL.
808
+ This will override the query string in `url`.
809
+
810
+ If you need to pass in an array, you can do it using a `URLSearchParams` instance.
811
+
812
+ @example
813
+ ```
814
+ import got from 'got';
815
+
816
+ const searchParams = new URLSearchParams([['key', 'a'], ['key', 'b']]);
817
+
818
+ await got('https://example.com', {searchParams});
819
+
820
+ console.log(searchParams.toString());
821
+ //=> 'key=a&key=b'
822
+ ```
823
+ */
824
+ get searchParams() {
825
+ if (this._internals.url) {
826
+ return this._internals.url.searchParams;
827
+ }
828
+ if (this._internals.searchParams === undefined) {
829
+ this._internals.searchParams = new URLSearchParams();
830
+ }
831
+ return this._internals.searchParams;
832
+ }
833
+ set searchParams(value) {
834
+ assert.any([is.string, is.object, is.undefined], value);
835
+ const url = this._internals.url;
836
+ if (value === undefined) {
837
+ this._internals.searchParams = undefined;
838
+ if (url) {
839
+ url.search = '';
840
+ }
841
+ return;
842
+ }
843
+ const searchParameters = this.searchParams;
844
+ let updated;
845
+ if (is.string(value)) {
846
+ updated = new URLSearchParams(value);
847
+ }
848
+ else if (value instanceof URLSearchParams) {
849
+ updated = value;
850
+ }
851
+ else {
852
+ validateSearchParameters(value);
853
+ updated = new URLSearchParams();
854
+ // eslint-disable-next-line guard-for-in
855
+ for (const key in value) {
856
+ const entry = value[key];
857
+ if (entry === null) {
858
+ updated.append(key, '');
859
+ }
860
+ else if (entry === undefined) {
861
+ searchParameters.delete(key);
862
+ }
863
+ else {
864
+ updated.append(key, entry);
865
+ }
866
+ }
867
+ }
868
+ if (this._merging) {
869
+ // These keys will be replaced
870
+ for (const key of updated.keys()) {
871
+ searchParameters.delete(key);
872
+ }
873
+ for (const [key, value] of updated) {
874
+ searchParameters.append(key, value);
875
+ }
876
+ }
877
+ else if (url) {
878
+ url.search = searchParameters.toString();
879
+ }
880
+ else {
881
+ this._internals.searchParams = searchParameters;
882
+ }
883
+ }
884
+ get searchParameters() {
885
+ throw new Error('The `searchParameters` option does not exist. Use `searchParams` instead.');
886
+ }
887
+ set searchParameters(_value) {
888
+ throw new Error('The `searchParameters` option does not exist. Use `searchParams` instead.');
889
+ }
890
+ get dnsLookup() {
891
+ return this._internals.dnsLookup;
892
+ }
893
+ set dnsLookup(value) {
894
+ assert.any([is.function_, is.undefined], value);
895
+ this._internals.dnsLookup = value;
896
+ }
897
+ /**
898
+ An instance of [`CacheableLookup`](https://github.com/szmarczak/cacheable-lookup) used for making DNS lookups.
899
+ Useful when making lots of requests to different *public* hostnames.
900
+
901
+ `CacheableLookup` uses `dns.resolver4(..)` and `dns.resolver6(...)` under the hood and fall backs to `dns.lookup(...)` when the first two fail, which may lead to additional delay.
902
+
903
+ __Note__: This should stay disabled when making requests to internal hostnames such as `localhost`, `database.local` etc.
904
+
905
+ @default false
906
+ */
907
+ get dnsCache() {
908
+ return this._internals.dnsCache;
909
+ }
910
+ set dnsCache(value) {
911
+ assert.any([is.object, is.boolean, is.undefined], value);
912
+ if (value === true) {
913
+ this._internals.dnsCache = getGlobalDnsCache();
914
+ }
915
+ else if (value === false) {
916
+ this._internals.dnsCache = undefined;
917
+ }
918
+ else {
919
+ this._internals.dnsCache = value;
920
+ }
921
+ }
922
+ /**
923
+ User data. `context` is shallow merged and enumerable. If it contains non-enumerable properties they will NOT be merged.
924
+
925
+ @example
926
+ ```
927
+ import got from 'got';
928
+
929
+ const instance = got.extend({
930
+ hooks: {
931
+ beforeRequest: [
932
+ options => {
933
+ if (!options.context || !options.context.token) {
934
+ throw new Error('Token required');
935
+ }
936
+
937
+ options.headers.token = options.context.token;
938
+ }
939
+ ]
940
+ }
941
+ });
942
+
943
+ const context = {
944
+ token: 'secret'
945
+ };
946
+
947
+ const response = await instance('https://httpbin.org/headers', {context});
948
+
949
+ // Let's see the headers
950
+ console.log(response.body);
951
+ ```
952
+ */
953
+ get context() {
954
+ return this._internals.context;
955
+ }
956
+ set context(value) {
957
+ assert.object(value);
958
+ if (this._merging) {
959
+ Object.assign(this._internals.context, value);
960
+ }
961
+ else {
962
+ this._internals.context = { ...value };
963
+ }
964
+ }
965
+ /**
966
+ Hooks allow modifications during the request lifecycle.
967
+ Hook functions may be async and are run serially.
968
+ */
969
+ get hooks() {
970
+ return this._internals.hooks;
971
+ }
972
+ set hooks(value) {
973
+ assert.object(value);
974
+ // eslint-disable-next-line guard-for-in
975
+ for (const knownHookEvent in value) {
976
+ if (!(knownHookEvent in this._internals.hooks)) {
977
+ throw new Error(`Unexpected hook event: ${knownHookEvent}`);
978
+ }
979
+ const typedKnownHookEvent = knownHookEvent;
980
+ const hooks = value[typedKnownHookEvent];
981
+ assert.any([is.array, is.undefined], hooks);
982
+ if (hooks) {
983
+ for (const hook of hooks) {
984
+ assert.function_(hook);
985
+ }
986
+ }
987
+ if (this._merging) {
988
+ if (hooks) {
989
+ // @ts-expect-error FIXME
990
+ this._internals.hooks[typedKnownHookEvent].push(...hooks);
991
+ }
992
+ }
993
+ else {
994
+ if (!hooks) {
995
+ throw new Error(`Missing hook event: ${knownHookEvent}`);
996
+ }
997
+ // @ts-expect-error FIXME
998
+ this._internals.hooks[knownHookEvent] = [...hooks];
999
+ }
1000
+ }
1001
+ }
1002
+ /**
1003
+ Defines if redirect responses should be followed automatically.
1004
+
1005
+ Note that if a `303` is sent by the server in response to any request type (`POST`, `DELETE`, etc.), Got will automatically request the resource pointed to in the location header via `GET`.
1006
+ This is in accordance with [the spec](https://tools.ietf.org/html/rfc7231#section-6.4.4). You can optionally turn on this behavior also for other redirect codes - see `methodRewriting`.
1007
+
1008
+ @default true
1009
+ */
1010
+ get followRedirect() {
1011
+ return this._internals.followRedirect;
1012
+ }
1013
+ set followRedirect(value) {
1014
+ assert.boolean(value);
1015
+ this._internals.followRedirect = value;
1016
+ }
1017
+ get followRedirects() {
1018
+ throw new TypeError('The `followRedirects` option does not exist. Use `followRedirect` instead.');
1019
+ }
1020
+ set followRedirects(_value) {
1021
+ throw new TypeError('The `followRedirects` option does not exist. Use `followRedirect` instead.');
1022
+ }
1023
+ /**
1024
+ If exceeded, the request will be aborted and a `MaxRedirectsError` will be thrown.
1025
+
1026
+ @default 10
1027
+ */
1028
+ get maxRedirects() {
1029
+ return this._internals.maxRedirects;
1030
+ }
1031
+ set maxRedirects(value) {
1032
+ assert.number(value);
1033
+ this._internals.maxRedirects = value;
1034
+ }
1035
+ /**
1036
+ A cache adapter instance for storing cached response data.
1037
+
1038
+ @default false
1039
+ */
1040
+ get cache() {
1041
+ return this._internals.cache;
1042
+ }
1043
+ set cache(value) {
1044
+ assert.any([is.object, is.string, is.boolean, is.undefined], value);
1045
+ if (value === true) {
1046
+ this._internals.cache = globalCache;
1047
+ }
1048
+ else if (value === false) {
1049
+ this._internals.cache = undefined;
1050
+ }
1051
+ else {
1052
+ this._internals.cache = value;
1053
+ }
1054
+ }
1055
+ /**
1056
+ Determines if a `got.HTTPError` is thrown for unsuccessful responses.
1057
+
1058
+ If this is disabled, requests that encounter an error status code will be resolved with the `response` instead of throwing.
1059
+ This may be useful if you are checking for resource availability and are expecting error responses.
1060
+
1061
+ @default true
1062
+ */
1063
+ get throwHttpErrors() {
1064
+ return this._internals.throwHttpErrors;
1065
+ }
1066
+ set throwHttpErrors(value) {
1067
+ assert.boolean(value);
1068
+ this._internals.throwHttpErrors = value;
1069
+ }
1070
+ get username() {
1071
+ const url = this._internals.url;
1072
+ const value = url ? url.username : this._internals.username;
1073
+ return decodeURIComponent(value);
1074
+ }
1075
+ set username(value) {
1076
+ assert.string(value);
1077
+ const url = this._internals.url;
1078
+ const fixedValue = encodeURIComponent(value);
1079
+ if (url) {
1080
+ url.username = fixedValue;
1081
+ }
1082
+ else {
1083
+ this._internals.username = fixedValue;
1084
+ }
1085
+ }
1086
+ get password() {
1087
+ const url = this._internals.url;
1088
+ const value = url ? url.password : this._internals.password;
1089
+ return decodeURIComponent(value);
1090
+ }
1091
+ set password(value) {
1092
+ assert.string(value);
1093
+ const url = this._internals.url;
1094
+ const fixedValue = encodeURIComponent(value);
1095
+ if (url) {
1096
+ url.password = fixedValue;
1097
+ }
1098
+ else {
1099
+ this._internals.password = fixedValue;
1100
+ }
1101
+ }
1102
+ /**
1103
+ If set to `true`, Got will additionally accept HTTP2 requests.
1104
+
1105
+ It will choose either HTTP/1.1 or HTTP/2 depending on the ALPN protocol.
1106
+
1107
+ __Note__: This option requires Node.js 15.10.0 or newer as HTTP/2 support on older Node.js versions is very buggy.
1108
+
1109
+ __Note__: Overriding `options.request` will disable HTTP2 support.
1110
+
1111
+ @default false
1112
+
1113
+ @example
1114
+ ```
1115
+ import got from 'got';
1116
+
1117
+ const {headers} = await got('https://nghttp2.org/httpbin/anything', {http2: true});
1118
+
1119
+ console.log(headers.via);
1120
+ //=> '2 nghttpx'
1121
+ ```
1122
+ */
1123
+ get http2() {
1124
+ return this._internals.http2;
1125
+ }
1126
+ set http2(value) {
1127
+ assert.boolean(value);
1128
+ this._internals.http2 = value;
1129
+ }
1130
+ /**
1131
+ Set this to `true` to allow sending body for the `GET` method.
1132
+ However, the [HTTP/2 specification](https://tools.ietf.org/html/rfc7540#section-8.1.3) says that `An HTTP GET request includes request header fields and no payload body`, therefore when using the HTTP/2 protocol this option will have no effect.
1133
+ This option is only meant to interact with non-compliant servers when you have no other choice.
1134
+
1135
+ __Note__: The [RFC 7231](https://tools.ietf.org/html/rfc7231#section-4.3.1) doesn't specify any particular behavior for the GET method having a payload, therefore __it's considered an [anti-pattern](https://en.wikipedia.org/wiki/Anti-pattern)__.
1136
+
1137
+ @default false
1138
+ */
1139
+ get allowGetBody() {
1140
+ return this._internals.allowGetBody;
1141
+ }
1142
+ set allowGetBody(value) {
1143
+ assert.boolean(value);
1144
+ this._internals.allowGetBody = value;
1145
+ }
1146
+ /**
1147
+ Request headers.
1148
+
1149
+ Existing headers will be overwritten. Headers set to `undefined` will be omitted.
1150
+
1151
+ @default {}
1152
+ */
1153
+ get headers() {
1154
+ return this._internals.headers;
1155
+ }
1156
+ set headers(value) {
1157
+ assert.plainObject(value);
1158
+ if (this._merging) {
1159
+ Object.assign(this._internals.headers, lowercaseKeys(value));
1160
+ }
1161
+ else {
1162
+ this._internals.headers = lowercaseKeys(value);
1163
+ }
1164
+ }
1165
+ /**
1166
+ Specifies if the HTTP request method should be [rewritten as `GET`](https://tools.ietf.org/html/rfc7231#section-6.4) on redirects.
1167
+
1168
+ As the [specification](https://tools.ietf.org/html/rfc7231#section-6.4) prefers to rewrite the HTTP method only on `303` responses, this is Got's default behavior.
1169
+ Setting `methodRewriting` to `true` will also rewrite `301` and `302` responses, as allowed by the spec. This is the behavior followed by `curl` and browsers.
1170
+
1171
+ __Note__: Got never performs method rewriting on `307` and `308` responses, as this is [explicitly prohibited by the specification](https://www.rfc-editor.org/rfc/rfc7231#section-6.4.7).
1172
+
1173
+ @default false
1174
+ */
1175
+ get methodRewriting() {
1176
+ return this._internals.methodRewriting;
1177
+ }
1178
+ set methodRewriting(value) {
1179
+ assert.boolean(value);
1180
+ this._internals.methodRewriting = value;
1181
+ }
1182
+ /**
1183
+ Indicates which DNS record family to use.
1184
+
1185
+ Values:
1186
+ - `undefined`: IPv4 (if present) or IPv6
1187
+ - `4`: Only IPv4
1188
+ - `6`: Only IPv6
1189
+
1190
+ @default undefined
1191
+ */
1192
+ get dnsLookupIpVersion() {
1193
+ return this._internals.dnsLookupIpVersion;
1194
+ }
1195
+ set dnsLookupIpVersion(value) {
1196
+ if (value !== undefined && value !== 4 && value !== 6) {
1197
+ throw new TypeError(`Invalid DNS lookup IP version: ${value}`);
1198
+ }
1199
+ this._internals.dnsLookupIpVersion = value;
1200
+ }
1201
+ /**
1202
+ A function used to parse JSON responses.
1203
+
1204
+ @example
1205
+ ```
1206
+ import got from 'got';
1207
+ import Bourne from '@hapi/bourne';
1208
+
1209
+ const parsed = await got('https://example.com', {
1210
+ parseJson: text => Bourne.parse(text)
1211
+ }).json();
1212
+
1213
+ console.log(parsed);
1214
+ ```
1215
+ */
1216
+ get parseJson() {
1217
+ return this._internals.parseJson;
1218
+ }
1219
+ set parseJson(value) {
1220
+ assert.function_(value);
1221
+ this._internals.parseJson = value;
1222
+ }
1223
+ /**
1224
+ A function used to stringify the body of JSON requests.
1225
+
1226
+ @example
1227
+ ```
1228
+ import got from 'got';
1229
+
1230
+ await got.post('https://example.com', {
1231
+ stringifyJson: object => JSON.stringify(object, (key, value) => {
1232
+ if (key.startsWith('_')) {
1233
+ return;
1234
+ }
1235
+
1236
+ return value;
1237
+ }),
1238
+ json: {
1239
+ some: 'payload',
1240
+ _ignoreMe: 1234
1241
+ }
1242
+ });
1243
+ ```
1244
+
1245
+ @example
1246
+ ```
1247
+ import got from 'got';
1248
+
1249
+ await got.post('https://example.com', {
1250
+ stringifyJson: object => JSON.stringify(object, (key, value) => {
1251
+ if (typeof value === 'number') {
1252
+ return value.toString();
1253
+ }
1254
+
1255
+ return value;
1256
+ }),
1257
+ json: {
1258
+ some: 'payload',
1259
+ number: 1
1260
+ }
1261
+ });
1262
+ ```
1263
+ */
1264
+ get stringifyJson() {
1265
+ return this._internals.stringifyJson;
1266
+ }
1267
+ set stringifyJson(value) {
1268
+ assert.function_(value);
1269
+ this._internals.stringifyJson = value;
1270
+ }
1271
+ /**
1272
+ An object representing `limit`, `calculateDelay`, `methods`, `statusCodes`, `maxRetryAfter` and `errorCodes` fields for maximum retry count, retry handler, allowed methods, allowed status codes, maximum [`Retry-After`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After) time and allowed error codes.
1273
+
1274
+ Delays between retries counts with function `1000 * Math.pow(2, retry) + Math.random() * 100`, where `retry` is attempt number (starts from 1).
1275
+
1276
+ The `calculateDelay` property is a `function` that receives an object with `attemptCount`, `retryOptions`, `error` and `computedValue` properties for current retry count, the retry options, error and default computed value.
1277
+ The function must return a delay in milliseconds (or a Promise resolving with it) (`0` return value cancels retry).
1278
+
1279
+ By default, it retries *only* on the specified methods, status codes, and on these network errors:
1280
+
1281
+ - `ETIMEDOUT`: One of the [timeout](#timeout) limits were reached.
1282
+ - `ECONNRESET`: Connection was forcibly closed by a peer.
1283
+ - `EADDRINUSE`: Could not bind to any free port.
1284
+ - `ECONNREFUSED`: Connection was refused by the server.
1285
+ - `EPIPE`: The remote side of the stream being written has been closed.
1286
+ - `ENOTFOUND`: Couldn't resolve the hostname to an IP address.
1287
+ - `ENETUNREACH`: No internet connection.
1288
+ - `EAI_AGAIN`: DNS lookup timed out.
1289
+
1290
+ __Note__: If `maxRetryAfter` is set to `undefined`, it will use `options.timeout`.
1291
+ __Note__: If [`Retry-After`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After) header is greater than `maxRetryAfter`, it will cancel the request.
1292
+ */
1293
+ get retry() {
1294
+ return this._internals.retry;
1295
+ }
1296
+ set retry(value) {
1297
+ assert.plainObject(value);
1298
+ assert.any([is.function_, is.undefined], value.calculateDelay);
1299
+ assert.any([is.number, is.undefined], value.maxRetryAfter);
1300
+ assert.any([is.number, is.undefined], value.limit);
1301
+ assert.any([is.array, is.undefined], value.methods);
1302
+ assert.any([is.array, is.undefined], value.statusCodes);
1303
+ assert.any([is.array, is.undefined], value.errorCodes);
1304
+ assert.any([is.number, is.undefined], value.noise);
1305
+ if (value.noise && Math.abs(value.noise) > 100) {
1306
+ throw new Error(`The maximum acceptable retry noise is +/- 100ms, got ${value.noise}`);
1307
+ }
1308
+ for (const key in value) {
1309
+ if (!(key in this._internals.retry)) {
1310
+ throw new Error(`Unexpected retry option: ${key}`);
1311
+ }
1312
+ }
1313
+ if (this._merging) {
1314
+ Object.assign(this._internals.retry, value);
1315
+ }
1316
+ else {
1317
+ this._internals.retry = { ...value };
1318
+ }
1319
+ const { retry } = this._internals;
1320
+ retry.methods = [...new Set(retry.methods.map(method => method.toUpperCase()))];
1321
+ retry.statusCodes = [...new Set(retry.statusCodes)];
1322
+ retry.errorCodes = [...new Set(retry.errorCodes)];
1323
+ }
1324
+ /**
1325
+ From `http.RequestOptions`.
1326
+
1327
+ The IP address used to send the request from.
1328
+ */
1329
+ get localAddress() {
1330
+ return this._internals.localAddress;
1331
+ }
1332
+ set localAddress(value) {
1333
+ assert.any([is.string, is.undefined], value);
1334
+ this._internals.localAddress = value;
1335
+ }
1336
+ /**
1337
+ The HTTP method used to make the request.
1338
+
1339
+ @default 'GET'
1340
+ */
1341
+ get method() {
1342
+ return this._internals.method;
1343
+ }
1344
+ set method(value) {
1345
+ assert.string(value);
1346
+ this._internals.method = value.toUpperCase();
1347
+ }
1348
+ get createConnection() {
1349
+ return this._internals.createConnection;
1350
+ }
1351
+ set createConnection(value) {
1352
+ assert.any([is.function_, is.undefined], value);
1353
+ this._internals.createConnection = value;
1354
+ }
1355
+ /**
1356
+ From `http-cache-semantics`
1357
+
1358
+ @default {}
1359
+ */
1360
+ get cacheOptions() {
1361
+ return this._internals.cacheOptions;
1362
+ }
1363
+ set cacheOptions(value) {
1364
+ assert.plainObject(value);
1365
+ assert.any([is.boolean, is.undefined], value.shared);
1366
+ assert.any([is.number, is.undefined], value.cacheHeuristic);
1367
+ assert.any([is.number, is.undefined], value.immutableMinTimeToLive);
1368
+ assert.any([is.boolean, is.undefined], value.ignoreCargoCult);
1369
+ for (const key in value) {
1370
+ if (!(key in this._internals.cacheOptions)) {
1371
+ throw new Error(`Cache option \`${key}\` does not exist`);
1372
+ }
1373
+ }
1374
+ if (this._merging) {
1375
+ Object.assign(this._internals.cacheOptions, value);
1376
+ }
1377
+ else {
1378
+ this._internals.cacheOptions = { ...value };
1379
+ }
1380
+ }
1381
+ /**
1382
+ Options for the advanced HTTPS API.
1383
+ */
1384
+ get https() {
1385
+ return this._internals.https;
1386
+ }
1387
+ set https(value) {
1388
+ assert.plainObject(value);
1389
+ assert.any([is.boolean, is.undefined], value.rejectUnauthorized);
1390
+ assert.any([is.function_, is.undefined], value.checkServerIdentity);
1391
+ assert.any([is.string, is.object, is.array, is.undefined], value.certificateAuthority);
1392
+ assert.any([is.string, is.object, is.array, is.undefined], value.key);
1393
+ assert.any([is.string, is.object, is.array, is.undefined], value.certificate);
1394
+ assert.any([is.string, is.undefined], value.passphrase);
1395
+ assert.any([is.string, is.buffer, is.array, is.undefined], value.pfx);
1396
+ assert.any([is.array, is.undefined], value.alpnProtocols);
1397
+ assert.any([is.string, is.undefined], value.ciphers);
1398
+ assert.any([is.string, is.buffer, is.undefined], value.dhparam);
1399
+ assert.any([is.string, is.undefined], value.signatureAlgorithms);
1400
+ assert.any([is.string, is.undefined], value.minVersion);
1401
+ assert.any([is.string, is.undefined], value.maxVersion);
1402
+ assert.any([is.boolean, is.undefined], value.honorCipherOrder);
1403
+ assert.any([is.number, is.undefined], value.tlsSessionLifetime);
1404
+ assert.any([is.string, is.undefined], value.ecdhCurve);
1405
+ assert.any([is.string, is.buffer, is.array, is.undefined], value.certificateRevocationLists);
1406
+ for (const key in value) {
1407
+ if (!(key in this._internals.https)) {
1408
+ throw new Error(`HTTPS option \`${key}\` does not exist`);
1409
+ }
1410
+ }
1411
+ if (this._merging) {
1412
+ Object.assign(this._internals.https, value);
1413
+ }
1414
+ else {
1415
+ this._internals.https = { ...value };
1416
+ }
1417
+ }
1418
+ /**
1419
+ [Encoding](https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings) to be used on `setEncoding` of the response data.
1420
+
1421
+ To get a [`Buffer`](https://nodejs.org/api/buffer.html), you need to set `responseType` to `buffer` instead.
1422
+ Don't set this option to `null`.
1423
+
1424
+ __Note__: This doesn't affect streams! Instead, you need to do `got.stream(...).setEncoding(encoding)`.
1425
+
1426
+ @default 'utf-8'
1427
+ */
1428
+ get encoding() {
1429
+ return this._internals.encoding;
1430
+ }
1431
+ set encoding(value) {
1432
+ if (value === null) {
1433
+ throw new TypeError('To get a Buffer, set `options.responseType` to `buffer` instead');
1434
+ }
1435
+ assert.any([is.string, is.undefined], value);
1436
+ this._internals.encoding = value;
1437
+ }
1438
+ /**
1439
+ When set to `true` the promise will return the Response body instead of the Response object.
1440
+
1441
+ @default false
1442
+ */
1443
+ get resolveBodyOnly() {
1444
+ return this._internals.resolveBodyOnly;
1445
+ }
1446
+ set resolveBodyOnly(value) {
1447
+ assert.boolean(value);
1448
+ this._internals.resolveBodyOnly = value;
1449
+ }
1450
+ /**
1451
+ Returns a `Stream` instead of a `Promise`.
1452
+ This is equivalent to calling `got.stream(url, options?)`.
1453
+
1454
+ @default false
1455
+ */
1456
+ get isStream() {
1457
+ return this._internals.isStream;
1458
+ }
1459
+ set isStream(value) {
1460
+ assert.boolean(value);
1461
+ this._internals.isStream = value;
1462
+ }
1463
+ /**
1464
+ The parsing method.
1465
+
1466
+ The promise also has `.text()`, `.json()` and `.buffer()` methods which return another Got promise for the parsed body.
1467
+
1468
+ It's like setting the options to `{responseType: 'json', resolveBodyOnly: true}` but without affecting the main Got promise.
1469
+
1470
+ __Note__: When using streams, this option is ignored.
1471
+
1472
+ @example
1473
+ ```
1474
+ const responsePromise = got(url);
1475
+ const bufferPromise = responsePromise.buffer();
1476
+ const jsonPromise = responsePromise.json();
1477
+
1478
+ const [response, buffer, json] = Promise.all([responsePromise, bufferPromise, jsonPromise]);
1479
+ // `response` is an instance of Got Response
1480
+ // `buffer` is an instance of Buffer
1481
+ // `json` is an object
1482
+ ```
1483
+
1484
+ @example
1485
+ ```
1486
+ // This
1487
+ const body = await got(url).json();
1488
+
1489
+ // is semantically the same as this
1490
+ const body = await got(url, {responseType: 'json', resolveBodyOnly: true});
1491
+ ```
1492
+ */
1493
+ get responseType() {
1494
+ return this._internals.responseType;
1495
+ }
1496
+ set responseType(value) {
1497
+ if (value === undefined) {
1498
+ this._internals.responseType = 'text';
1499
+ return;
1500
+ }
1501
+ if (value !== 'text' && value !== 'buffer' && value !== 'json') {
1502
+ throw new Error(`Invalid \`responseType\` option: ${value}`);
1503
+ }
1504
+ this._internals.responseType = value;
1505
+ }
1506
+ get pagination() {
1507
+ return this._internals.pagination;
1508
+ }
1509
+ set pagination(value) {
1510
+ assert.object(value);
1511
+ if (this._merging) {
1512
+ Object.assign(this._internals.pagination, value);
1513
+ }
1514
+ else {
1515
+ this._internals.pagination = value;
1516
+ }
1517
+ }
1518
+ get auth() {
1519
+ throw new Error('Parameter `auth` is deprecated. Use `username` / `password` instead.');
1520
+ }
1521
+ set auth(_value) {
1522
+ throw new Error('Parameter `auth` is deprecated. Use `username` / `password` instead.');
1523
+ }
1524
+ get setHost() {
1525
+ return this._internals.setHost;
1526
+ }
1527
+ set setHost(value) {
1528
+ assert.boolean(value);
1529
+ this._internals.setHost = value;
1530
+ }
1531
+ get maxHeaderSize() {
1532
+ return this._internals.maxHeaderSize;
1533
+ }
1534
+ set maxHeaderSize(value) {
1535
+ assert.any([is.number, is.undefined], value);
1536
+ this._internals.maxHeaderSize = value;
1537
+ }
1538
+ get enableUnixSockets() {
1539
+ return this._internals.enableUnixSockets;
1540
+ }
1541
+ set enableUnixSockets(value) {
1542
+ assert.boolean(value);
1543
+ this._internals.enableUnixSockets = value;
1544
+ }
1545
+ // eslint-disable-next-line @typescript-eslint/naming-convention
1546
+ toJSON() {
1547
+ return { ...this._internals };
1548
+ }
1549
+ [Symbol.for('nodejs.util.inspect.custom')](_depth, options) {
1550
+ return inspect(this._internals, options);
1551
+ }
1552
+ createNativeRequestOptions() {
1553
+ const internals = this._internals;
1554
+ const url = internals.url;
1555
+ let agent;
1556
+ if (url.protocol === 'https:') {
1557
+ agent = internals.http2 ? internals.agent : internals.agent.https;
1558
+ }
1559
+ else {
1560
+ agent = internals.agent.http;
1561
+ }
1562
+ const { https } = internals;
1563
+ let { pfx } = https;
1564
+ if (is.array(pfx) && is.plainObject(pfx[0])) {
1565
+ pfx = pfx.map(object => ({
1566
+ buf: object.buffer,
1567
+ passphrase: object.passphrase,
1568
+ }));
1569
+ }
1570
+ return {
1571
+ ...internals.cacheOptions,
1572
+ ...this._unixOptions,
1573
+ // HTTPS options
1574
+ // eslint-disable-next-line @typescript-eslint/naming-convention
1575
+ ALPNProtocols: https.alpnProtocols,
1576
+ ca: https.certificateAuthority,
1577
+ cert: https.certificate,
1578
+ key: https.key,
1579
+ passphrase: https.passphrase,
1580
+ pfx: https.pfx,
1581
+ rejectUnauthorized: https.rejectUnauthorized,
1582
+ checkServerIdentity: https.checkServerIdentity ?? checkServerIdentity,
1583
+ ciphers: https.ciphers,
1584
+ honorCipherOrder: https.honorCipherOrder,
1585
+ minVersion: https.minVersion,
1586
+ maxVersion: https.maxVersion,
1587
+ sigalgs: https.signatureAlgorithms,
1588
+ sessionTimeout: https.tlsSessionLifetime,
1589
+ dhparam: https.dhparam,
1590
+ ecdhCurve: https.ecdhCurve,
1591
+ crl: https.certificateRevocationLists,
1592
+ // HTTP options
1593
+ lookup: internals.dnsLookup ?? internals.dnsCache?.lookup,
1594
+ family: internals.dnsLookupIpVersion,
1595
+ agent,
1596
+ setHost: internals.setHost,
1597
+ method: internals.method,
1598
+ maxHeaderSize: internals.maxHeaderSize,
1599
+ localAddress: internals.localAddress,
1600
+ headers: internals.headers,
1601
+ createConnection: internals.createConnection,
1602
+ timeout: internals.http2 ? getHttp2TimeoutOption(internals) : undefined,
1603
+ // HTTP/2 options
1604
+ h2session: internals.h2session,
1605
+ };
1606
+ }
1607
+ getRequestFunction() {
1608
+ const url = this._internals.url;
1609
+ const { request } = this._internals;
1610
+ if (!request && url) {
1611
+ return this.getFallbackRequestFunction();
1612
+ }
1613
+ return request;
1614
+ }
1615
+ getFallbackRequestFunction() {
1616
+ const url = this._internals.url;
1617
+ if (!url) {
1618
+ return;
1619
+ }
1620
+ if (url.protocol === 'https:') {
1621
+ if (this._internals.http2) {
1622
+ if (major < 15 || (major === 15 && minor < 10)) {
1623
+ const error = new Error('To use the `http2` option, install Node.js 15.10.0 or above');
1624
+ error.code = 'EUNSUPPORTED';
1625
+ throw error;
1626
+ }
1627
+ return http2wrapper.auto;
1628
+ }
1629
+ return https.request;
1630
+ }
1631
+ return http.request;
1632
+ }
1633
+ freeze() {
1634
+ const options = this._internals;
1635
+ Object.freeze(options);
1636
+ Object.freeze(options.hooks);
1637
+ Object.freeze(options.hooks.afterResponse);
1638
+ Object.freeze(options.hooks.beforeError);
1639
+ Object.freeze(options.hooks.beforeRedirect);
1640
+ Object.freeze(options.hooks.beforeRequest);
1641
+ Object.freeze(options.hooks.beforeRetry);
1642
+ Object.freeze(options.hooks.init);
1643
+ Object.freeze(options.https);
1644
+ Object.freeze(options.cacheOptions);
1645
+ Object.freeze(options.agent);
1646
+ Object.freeze(options.headers);
1647
+ Object.freeze(options.timeout);
1648
+ Object.freeze(options.retry);
1649
+ Object.freeze(options.retry.errorCodes);
1650
+ Object.freeze(options.retry.methods);
1651
+ Object.freeze(options.retry.statusCodes);
1652
+ }
1653
+ }